diff options
-rw-r--r-- | etc/inc/interfaces.inc | 29 | ||||
-rwxr-xr-x | usr/local/www/interfaces.php | 22 |
2 files changed, 42 insertions, 9 deletions
diff --git a/etc/inc/interfaces.inc b/etc/inc/interfaces.inc index 499344e..7b04fb2 100644 --- a/etc/inc/interfaces.inc +++ b/etc/inc/interfaces.inc @@ -2888,14 +2888,31 @@ function interface_configure($interface = "wan", $reloadall = false, $linkupeven break; } - if (!empty($wancfg['mtu'])) { - pfSense_interface_mtu($realif, $wancfg['mtu']); - } else { - $mtu = get_interface_default_mtu(remove_ifindex($realhwif)); - if ($mtu != get_interface_mtu($realhwif)) - pfSense_interface_mtu($realhwif, $mtu); + $mtu = get_interface_default_mtu(remove_ifindex($realhwif)); + + if (preg_match('/_vlan[0-9]/', $wancfg['if'])) { + foreach ($config['interfaces'] as $ifdescr => $ifdata) { + if ($ifdata['if'] == $realhwif) { + if (!empty($ifdata['mtu'])) + $mtu = $ifdata['mtu']; + break; + } + } + } else if (!empty($wancfg['mtu'])) { + $mtu = $wancfg['mtu']; } + if ($mtu != get_interface_mtu($realhwif)) + pfSense_interface_mtu($realhwif, $mtu); + + /* + * All vlans need to use the same mtu value as their parent. + */ + if (is_array($config['vlans']['vlan'])) + foreach ($config['vlans']['vlan'] as $vlan) + if (($vlan['if'] == $realhwif) && (get_interface_mtu($vlan['vlanif']) != $mtu)) + pfSense_interface_mtu($vlan['vlanif'], $mtu); + if(does_interface_exist($wancfg['if'])) interfaces_bring_up($wancfg['if']); diff --git a/usr/local/www/interfaces.php b/usr/local/www/interfaces.php index 5279a98..2f6fd48 100755 --- a/usr/local/www/interfaces.php +++ b/usr/local/www/interfaces.php @@ -92,6 +92,14 @@ if ($if == "wan" && !$wancfg['descr']) else if ($if == "lan" && !$wancfg['descr']) $wancfg['descr'] = "LAN"; +$parent_vlan_if = ""; +if (preg_match('/_vlan[0-9]/', $wancfg['if'])) { + $realhwif_array = get_parent_interface($wancfg['if']); + // Need code to handle MLPPP if we ever use $realhwif for MLPPP handling + $realhwif = $realhwif_array[0]; + $parent_vlan_if = convert_real_interface_to_friendly_interface_name($realhwif); + $wancfg['mtu'] = ''; +} foreach ($a_ppps as $pppid => $ppp) { if ($wancfg['if'] == $ppp['if']) @@ -1414,10 +1422,18 @@ $types6 = array("none" => gettext("None"), "staticv6" => gettext("Static IPv6"), <tr> <td valign="top" class="vncell"><?=gettext("MTU"); ?></td> <td class="vtable"> - <input name="mtu" type="text" class="formfld unknown" id="mtu" size="8" value="<?=htmlspecialchars($pconfig['mtu']);?>"> + <input name="mtu" type="text" class="formfld unknown" id="mtu" size="8" value="<?=htmlspecialchars($pconfig['mtu']);?>" + <?php if(!empty($parent_vlan_if)) print "disabled"; ?>> <br> - <?=gettext("If you leave this field blank, the adapter's default MTU will " . - "be used. This is typically 1500 bytes but can vary in some circumstances."); ?> + <?php + if (empty($parent_vlan_if)) + print gettext("If you leave this field blank, the adapter's default MTU will " . + "be used. This is typically 1500 bytes but can vary in some circumstances."); + else + print gettext("This interface is a VLAN and it needs to use same MTU set for " . + "its parent. You can change parent's MTU") . "<a href=\"interfaces.php?if={$parent_vlan_if}\"> " . + gettext("here") . ".</a>"; + ?> </td> </tr> <tr> |