Project

General

Profile

Bug #2786 ยป fix_vlan_mtu.diff

Renato Botelho, 02/15/2013 07:52 AM

View differences:

etc/inc/interfaces.inc
break;
}
if (!empty($wancfg['mtu'])) {
pfSense_interface_mtu($realif, $wancfg['mtu']);
} else {
$mtu = get_interface_default_mtu(remove_numbers($realhwif));
if ($mtu != get_interface_mtu($realhwif))
pfSense_interface_mtu($realhwif, $mtu);
$mtu = get_interface_default_mtu(remove_numbers($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']);
usr/local/www/interfaces.php
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'])
......
<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>
    (1-1/1)