From 9cf9f30f449f2f19e294fad5a86c16517ab78282 Mon Sep 17 00:00:00 2001 From: Phil Davis Date: Wed, 20 Jul 2016 19:31:34 +0930 Subject: Backport Fix issue with QinQ on LAGG interfaces where MTU doesn't apply to parent Original pull request to master was #2905 --- src/etc/inc/interfaces.inc | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/src/etc/inc/interfaces.inc b/src/etc/inc/interfaces.inc index 4eee7bc..a7eee18 100644 --- a/src/etc/inc/interfaces.inc +++ b/src/etc/inc/interfaces.inc @@ -4976,6 +4976,7 @@ function interface_find_child_cfgmtu($realiface) { $interface = convert_real_interface_to_friendly_interface_name($realiface); $vlans = link_interface_to_vlans($realiface); + $qinqs = link_interface_to_qinqs($realiface); $bridge = link_interface_to_bridge($realiface); if (!empty($interface)) { $gifs = link_interface_to_gif($interface); @@ -4999,6 +5000,19 @@ function interface_find_child_cfgmtu($realiface) { } } } + if (is_array($qinqs)) { + foreach ($qinqs as $qinq) { + $ifass = convert_real_interface_to_friendly_interface_name($qinq['vlanif']); + if (empty($ifass)) { + continue; + } + if (!empty($config['interfaces'][$ifass]['mtu'])) { + if (intval($config['interfaces'][$ifass]['mtu']) > $mtu) { + $mtu = intval($config['interfaces'][$ifass]['mtu']); + } + } + } + } if (is_array($gifs)) { foreach ($gifs as $gif) { $ifass = convert_real_interface_to_friendly_interface_name($gif['gifif']); @@ -5060,6 +5074,30 @@ function link_interface_to_vlans($int, $action = "") { } } +function link_interface_to_qinqs($int, $action = "") { + global $config; + + if (empty($int)) { + return; + } + + if (is_array($config['qinqs']['qinqentry'])) { + $ifaces = array(); + foreach ($config['qinqs']['qinqentry'] as $qinq) { + if ($int == $qinq['if']) { + if ($action == "update") { + interfaces_bring_up($int); + } else { + $ifaces[$qinq['tag']] = $qinq; + } + } + } + if (!empty($ifaces)) { + return $ifaces; + } + } +} + function link_interface_to_vips($int, $action = "", $vhid = '') { global $config; -- cgit v1.1