diff options
author | Renato Botelho <renato@netgate.com> | 2016-01-14 14:56:37 -0200 |
---|---|---|
committer | Renato Botelho <renato@netgate.com> | 2016-01-14 14:58:12 -0200 |
commit | 5815d13659250c8319424268a1c8836928cd8cbf (patch) | |
tree | c0a0fefabbd571180788db7f965305e68994090c | |
parent | 3be3dec9601f1baf2125f2931b2d03de8eda5854 (diff) | |
download | pfsense-5815d13659250c8319424268a1c8836928cd8cbf.zip pfsense-5815d13659250c8319424268a1c8836928cd8cbf.tar.gz |
Simplify logic and fixes on interface_vlan_adapt_mtu()
- Remove some redundant code and define $if_mtu respecting the order
- Assinged interface
- PPP
- default
- When interface is a VLAN and parent is LAGG, it must be re-created
-rw-r--r-- | src/etc/inc/interfaces.inc | 27 |
1 files changed, 13 insertions, 14 deletions
diff --git a/src/etc/inc/interfaces.inc b/src/etc/inc/interfaces.inc index 55ee1c3..71c98c3 100644 --- a/src/etc/inc/interfaces.inc +++ b/src/etc/inc/interfaces.inc @@ -3079,21 +3079,20 @@ function interface_vlan_adapt_mtu($vlanifs, $mtu) { foreach ($vlanifs as $vlan) { $assignedport = convert_real_interface_to_friendly_interface_name($vlan['vlanif']); $pppoe_mtu = interface_mtu_wanted_for_pppoe($vlan['vlanif']); - if (!empty($assignedport)) { - if (!empty($config['interfaces'][$assignedport]['mtu'])) { - pfSense_interface_mtu($vlan['vlanif'], $config['interfaces'][$assignedport]['mtu']); - } else if ($pppoe_mtu != 0) { - pfSense_interface_mtu($vlan['vlanif'], $pppoe_mtu); - } else { - if (get_interface_mtu($vlan['vlanif']) != (($mtu > 1500) ? 1500 : $mtu)) { - pfSense_interface_mtu($vlan['vlanif'], (($mtu > 1500) ? 1500 : $mtu)); - } - } + $if_mtu = 0; + if (!empty($assignedport) && + !empty($config['interfaces'][$assignedport]['mtu'])) { + $if_mtu = $config['interfaces'][$assignedport]['mtu']; } else { - if ($pppoe_mtu != 0) { - pfSense_interface_mtu($vlan['vlanif'], $pppoe_mtu); - } else if (get_interface_mtu($vlan['vlanif']) != (($mtu > 1500) ? 1500 : $mtu)) { - pfSense_interface_mtu($vlan['vlanif'], (($mtu > 1500) ? 1500 : $mtu)); + $if_mtu = ($pppoe_mtu != 0 ? $pppoe_mtu : $mtu); + } + + if (get_interface_mtu($vlan['vlanif']) != $if_mtu) { + /* LAGG interface must be destroyed and re-created to change MTU */ + if (substr($vlan['if'], 0, 4) == 'lagg') { + interface_vlan_configure($vlan); + } else { + pfSense_interface_mtu($vlan['vlanif'], $if_mtu); } } } |