diff options
author | Simon <965089+sarthurdev@users.noreply.github.com> | 2021-05-23 11:14:14 +0200 |
---|---|---|
committer | Christian Poessinger <christian@poessinger.com> | 2021-05-23 11:14:31 +0200 |
commit | 5e1ed4086f96141611680892911dad82c28795ee (patch) | |
tree | 195c2ec5515b5b00ace1e08b905400ce7341d7d3 /python/vyos/configverify.py | |
parent | 86f951b2b821c24e07a434e8d62eb7d0f6e061ca (diff) | |
download | vyos-1x-5e1ed4086f96141611680892911dad82c28795ee.tar.gz vyos-1x-5e1ed4086f96141611680892911dad82c28795ee.zip |
vyos.configverify: T3570: sub interface MTU must be less or equal to parent MTU
Diffstat (limited to 'python/vyos/configverify.py')
-rw-r--r-- | python/vyos/configverify.py | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/python/vyos/configverify.py b/python/vyos/configverify.py index 99c472582..41d80d6e7 100644 --- a/python/vyos/configverify.py +++ b/python/vyos/configverify.py @@ -45,6 +45,16 @@ def verify_mtu(config): raise ConfigError(f'Interface MTU too high, ' \ f'maximum supported MTU is {max_mtu}!') +def verify_mtu_parent(config, parent): + if 'mtu' not in config or 'mtu' not in parent: + return + + mtu = int(config['mtu']) + parent_mtu = int(parent['mtu']) + if mtu > parent_mtu: + raise ConfigError(f'Interface MTU ({mtu}) too high, ' \ + f'parent interface MTU is {parent_mtu}!') + def verify_mtu_ipv6(config): """ Common helper function used by interface implementations to perform @@ -266,6 +276,7 @@ def verify_vlan_config(config): verify_dhcpv6(vlan) verify_address(vlan) verify_vrf(vlan) + verify_mtu_parent(vlan, config) # 802.1ad (Q-in-Q) VLANs for s_vlan in config.get('vif_s', {}): @@ -273,12 +284,15 @@ def verify_vlan_config(config): verify_dhcpv6(s_vlan) verify_address(s_vlan) verify_vrf(s_vlan) + verify_mtu_parent(s_vlan, config) for c_vlan in s_vlan.get('vif_c', {}): c_vlan = s_vlan['vif_c'][c_vlan] verify_dhcpv6(c_vlan) verify_address(c_vlan) verify_vrf(c_vlan) + verify_mtu_parent(c_vlan, config) + verify_mtu_parent(c_vlan, s_vlan) def verify_accel_ppp_base_service(config): """ |