summaryrefslogtreecommitdiff
path: root/python/vyos/configverify.py
diff options
context:
space:
mode:
authorSimon <965089+sarthurdev@users.noreply.github.com>2021-05-23 11:14:14 +0200
committerChristian Poessinger <christian@poessinger.com>2021-05-23 12:07:40 +0200
commit39f3d3e33a7b33361c1c0b8bda2b75d8f320df35 (patch)
treed286e7813d3814b96963da23be76a42a133f31c1 /python/vyos/configverify.py
parent2e44365dad5f8dd6a495070d36c590319a421c28 (diff)
downloadvyos-1x-39f3d3e33a7b33361c1c0b8bda2b75d8f320df35.tar.gz
vyos-1x-39f3d3e33a7b33361c1c0b8bda2b75d8f320df35.zip
vyos.configverify: T3570: sub interface MTU must be less or equal to parent MTU
(cherry picked from commit 5e1ed4086f96141611680892911dad82c28795ee)
Diffstat (limited to 'python/vyos/configverify.py')
-rw-r--r--python/vyos/configverify.py14
1 files changed, 14 insertions, 0 deletions
diff --git a/python/vyos/configverify.py b/python/vyos/configverify.py
index ac1d4210b..7f6fc040d 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
@@ -222,6 +232,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', {}):
@@ -229,12 +240,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):
"""