From 6e9fbf809391b80b8f4c6257af26a8f53b66b53e Mon Sep 17 00:00:00 2001 From: Christian Breunig Date: Thu, 20 Nov 2025 21:24:32 +0100 Subject: bond: T8023: validate member interface min/max MTU It is impossible to set the bond interface MTU to be larger or lower then the limits of the underlaying interface MTU. Add proper commit validation and smoketest. --- src/conf_mode/interfaces_bonding.py | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'src') diff --git a/src/conf_mode/interfaces_bonding.py b/src/conf_mode/interfaces_bonding.py index 68c2885bc..f844d0a21 100755 --- a/src/conf_mode/interfaces_bonding.py +++ b/src/conf_mode/interfaces_bonding.py @@ -248,6 +248,17 @@ def verify(bond): continue raise ConfigError(error_msg + f'it has a "{option_path.replace(".", " ")}" assigned!') + if mtu := bond.get('mtu'): + mtu = int(mtu) + max_mtu = int(EthernetIf(interface).get_max_mtu()) + min_mtu = int(EthernetIf(interface).get_min_mtu()) + if mtu > max_mtu: + raise ConfigError('Configured MTU is greater then member '\ + f'interface "{interface}" maximum of {max_mtu}!') + if mtu < min_mtu: + raise ConfigError('Configured MTU is less then member '\ + f'interface "{interface}" minimum of {min_mtu}!') + if 'primary' in bond: if bond['primary'] not in bond['member']['interface']: raise ConfigError(f'Primary interface of bond "{bond_name}" must be a member interface') -- cgit v1.2.3