summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorRenato Botelho <renato@netgate.com>2015-12-29 13:49:27 -0200
committerRenato Botelho <renato@netgate.com>2015-12-29 13:49:27 -0200
commitc399d0dd03fb4df3456418bfbe15162edd16c7d1 (patch)
tree9cd25de09a523a2570c5307779a5eec0fe54ac86 /src
parent3f4e6035cbf7b5125e1ddf51690b567e9646ff9b (diff)
downloadpfsense-c399d0dd03fb4df3456418bfbe15162edd16c7d1.zip
pfsense-c399d0dd03fb4df3456418bfbe15162edd16c7d1.tar.gz
Restore default MTU when field is cleared. Fixes #3926
Diffstat (limited to 'src')
-rw-r--r--src/etc/inc/interfaces.inc76
1 files changed, 40 insertions, 36 deletions
diff --git a/src/etc/inc/interfaces.inc b/src/etc/inc/interfaces.inc
index 8b6643b..7d937ba 100644
--- a/src/etc/inc/interfaces.inc
+++ b/src/etc/inc/interfaces.inc
@@ -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']);
- }
+ }
+ } 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, $wancfg['mtu']);
- }
- unset($vlans);
+ /* 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);
}
- /* XXX: What about gre/gif/.. ? */
+ unset($vlans);
}
+ /* XXX: What about gre/gif/.. ? */
switch ($wancfg['ipaddr']) {
case 'dhcp':
OpenPOWER on IntegriCloud