Set IPsec VTI MTU to configured value at boot. Implements #9111

(cherry picked from commit 3334f9c4cd7111c624ba2395b91c065d7dd338b1)
This commit is contained in:
jim-p 2019-06-03 14:21:05 -04:00
parent ef0045d812
commit affe8a552e

View File

@ -1453,6 +1453,21 @@ function interface_ipsec_vti_configure($ph1ent) {
file_put_contents("/tmp/{$ipsecif}_router{$gwtype}", $addr['right']);
}
}
/* Check/set the MTU if the user configured a custom value.
* https://redmine.pfsense.org/issues/9111 */
$currentvtimtu = get_interface_mtu($ipsecif);
foreach ($config['interfaces'] as $tmpinterface) {
if ($tmpinterface['if'] == $ipsecif) {
if (isset($tmpinterface['mtu']) && is_numericint($tmpinterface['mtu'])) {
$vtimtu = $tmpinterface['mtu'];
}
}
}
if (is_numericint($vtimtu)) {
if ($vtimtu != $currentvtimtu) {
mwexec("/sbin/ifconfig {$ipsecif} mtu {$vtimtu}");
}
}
system_routing_configure(convert_real_interface_to_friendly_interface_name($ipsecif));
}
}