diff options
| author | Christian Breunig <christian@breunig.cc> | 2025-11-20 21:24:32 +0100 |
|---|---|---|
| committer | Christian Breunig <christian@breunig.cc> | 2025-11-21 20:39:06 +0100 |
| commit | 6e9fbf809391b80b8f4c6257af26a8f53b66b53e (patch) | |
| tree | ae5f52bc7e3ce10b3b4421fc3d54f6a26d78d3a3 /src | |
| parent | 4f2d7c38ca2a0c35e81e0bf8e9a0e4abdf7fdfcc (diff) | |
| download | vyos-1x-6e9fbf809391b80b8f4c6257af26a8f53b66b53e.tar.gz vyos-1x-6e9fbf809391b80b8f4c6257af26a8f53b66b53e.zip | |
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.
Diffstat (limited to 'src')
| -rwxr-xr-x | src/conf_mode/interfaces_bonding.py | 11 |
1 files changed, 11 insertions, 0 deletions
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') |
