mirror of
https://github.com/pfsense/pfsense.git
synced 2025-10-26 11:38:35 +00:00
Restore default MTU when field is cleared. Fixes #3926
This commit is contained in:
parent
3f4e6035cb
commit
c399d0dd03
@ -3177,52 +3177,56 @@ function interface_configure($interface = "wan", $reloadall = false, $linkupeven
|
||||
interfaces_bring_up($wancfg['if']);
|
||||
}
|
||||
|
||||
if (!empty($wancfg['mtu'])) {
|
||||
if (stristr($realif, "_vlan")) {
|
||||
$assignedparent = convert_real_interface_to_friendly_interface_name($realhwif);
|
||||
if (!empty($assignedparent) && !empty($config['interfaces'][$assignedparent]['mtu'])) {
|
||||
$parentmtu = $config['interfaces'][$assignedparent]['mtu'];
|
||||
if ($wancfg['mtu'] > $parentmtu) {
|
||||
log_error("There is a conflict on MTU between parent {$realhwif} and VLAN({$realif})");
|
||||
}
|
||||
} else {
|
||||
$parentmtu = 0;
|
||||
if (isset($wancfg['mtu']) && is_numericint($wancfg['mtu'])) {
|
||||
$mtu = $wancfg['mtu'];
|
||||
} else {
|
||||
$mtu = 1500; /* Default */
|
||||
}
|
||||
|
||||
if (stristr($realif, "_vlan")) {
|
||||
$assignedparent = convert_real_interface_to_friendly_interface_name($realhwif);
|
||||
if (!empty($assignedparent) && !empty($config['interfaces'][$assignedparent]['mtu'])) {
|
||||
$parentmtu = $config['interfaces'][$assignedparent]['mtu'];
|
||||
if ($mtu > $parentmtu) {
|
||||
log_error("There is a conflict on MTU between parent {$realhwif} and VLAN({$realif})");
|
||||
}
|
||||
} else {
|
||||
$parentmtu = 0;
|
||||
}
|
||||
|
||||
$parentmtu = interface_vlan_mtu_configured($realhwif, $parentmtu);
|
||||
$parentmtu = interface_vlan_mtu_configured($realhwif, $parentmtu);
|
||||
|
||||
if (get_interface_mtu($realhwif) != $parentmtu) {
|
||||
pfSense_interface_mtu($realhwif, $parentmtu);
|
||||
}
|
||||
if (get_interface_mtu($realhwif) != $parentmtu) {
|
||||
pfSense_interface_mtu($realhwif, $parentmtu);
|
||||
}
|
||||
|
||||
/* All vlans need to use the same mtu value as their parent. */
|
||||
interface_vlan_adapt_mtu(link_interface_to_vlans($realhwif), $parentmtu);
|
||||
} else if (substr($realif, 0, 4) == 'lagg') {
|
||||
/* LAGG interface must be destroyed and re-created to change MTU */
|
||||
if ($wancfg['mtu'] != get_interface_mtu($realif)) {
|
||||
if (isset($config['laggs']['lagg']) && is_array($config['laggs']['lagg'])) {
|
||||
foreach ($config['laggs']['lagg'] as $lagg) {
|
||||
if ($lagg['laggif'] == $realif) {
|
||||
interface_lagg_configure($lagg);
|
||||
break;
|
||||
}
|
||||
/* All vlans need to use the same mtu value as their parent. */
|
||||
interface_vlan_adapt_mtu(link_interface_to_vlans($realhwif), $parentmtu);
|
||||
} else if (substr($realif, 0, 4) == 'lagg') {
|
||||
/* LAGG interface must be destroyed and re-created to change MTU */
|
||||
if ($mtu != get_interface_mtu($realif)) {
|
||||
if (isset($config['laggs']['lagg']) && is_array($config['laggs']['lagg'])) {
|
||||
foreach ($config['laggs']['lagg'] as $lagg) {
|
||||
if ($lagg['laggif'] == $realif) {
|
||||
interface_lagg_configure($lagg);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if ($wancfg['mtu'] != get_interface_mtu($realif)) {
|
||||
pfSense_interface_mtu($realif, $wancfg['mtu']);
|
||||
}
|
||||
|
||||
/* This case is needed when the parent of vlans is being configured */
|
||||
$vlans = link_interface_to_vlans($realif);
|
||||
if (is_array($vlans)) {
|
||||
interface_vlan_adapt_mtu($vlans, $wancfg['mtu']);
|
||||
}
|
||||
unset($vlans);
|
||||
}
|
||||
/* XXX: What about gre/gif/.. ? */
|
||||
} else {
|
||||
if ($mtu != get_interface_mtu($realif)) {
|
||||
pfSense_interface_mtu($realif, $mtu);
|
||||
}
|
||||
|
||||
/* This case is needed when the parent of vlans is being configured */
|
||||
$vlans = link_interface_to_vlans($realif);
|
||||
if (is_array($vlans)) {
|
||||
interface_vlan_adapt_mtu($vlans, $mtu);
|
||||
}
|
||||
unset($vlans);
|
||||
}
|
||||
/* XXX: What about gre/gif/.. ? */
|
||||
|
||||
switch ($wancfg['ipaddr']) {
|
||||
case 'dhcp':
|
||||
|
||||
Loading…
Reference in New Issue
Block a user