interfaces: adjust MTU for VLAN parents

For a VLAN on top of HW this doesn't seem required (although it makes sense)
the VLAN on top of VLAN actually needs this so add it for both.

It should be said that this is simply trying to fix setting oversize MTU
values and therefore now backs off when the parent MTU fits the requirement.

Still try to set any bad MTU value configured by the user.
This commit is contained in:
Franco Fichtner 2023-08-16 15:14:26 +02:00
parent c1411950d7
commit 2935d13e45

View File

@ -2168,15 +2168,19 @@ function interface_configure_mtu($device, $mtu, $ifconfig_details)
{
if (strstr($device, 'vlan') || strstr($device, 'qinq')) {
$parent_device = interface_parent_devices($device)[0];
$parent_mtu = $mtu;
$parent_mtu = $mtu + 4;
$force = false;
$parent_cfg = $config['interfaces'][convert_real_interface_to_friendly_interface_name($parent_realif)] ?? [];
if (isset($parent_cfg['enable']) && !empty($parent_cfg['mtu'])) {
$parent_mtu = $parent_cfg['mtu'];
$force = true;
}
/* configure parent MTU now to avoid silent fail for current device MTU change */
interface_configure_mtu($parent_device, $parent_mtu, $ifconfig_details);
if ($force || $mtu > $ifconfig_details[$parent_device]['mtu']) {
/* configure parent MTU recursively to avoid a fail for current device MTU requirement */
interface_configure_mtu($parent_device, $parent_mtu, $ifconfig_details);
}
}
if ($mtu != $ifconfig_details[$device]['mtu']) {