summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Poessinger <christian@poessinger.com>2021-02-02 22:32:07 +0100
committerChristian Poessinger <christian@poessinger.com>2021-02-02 22:32:07 +0100
commitccd516b4d10c518ea445928c01d6c7dc2770777b (patch)
tree77d22237f9eedbb7d83e7f1aa1dd767f05585ab3
parent204bfe78de119d282e27108d07b5780fccb52bce (diff)
downloadvyos-1x-ccd516b4d10c518ea445928c01d6c7dc2770777b.tar.gz
vyos-1x-ccd516b4d10c518ea445928c01d6c7dc2770777b.zip
vlan: T3018: vif/vif-s vlan id can not be re-used
In the past it was possible to configure a vif-s interface and a vif interface both with the same VLAN ID. VyOS 1.2 reported a Kernel error: RTNETLINK answers: File exists Error creating VLAN device eth1.100 so this should not be possible at all in VyOS 1.3
-rw-r--r--python/vyos/configverify.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/python/vyos/configverify.py b/python/vyos/configverify.py
index a888791ba..efcf403ce 100644
--- a/python/vyos/configverify.py
+++ b/python/vyos/configverify.py
@@ -209,6 +209,13 @@ def verify_vlan_config(config):
Common helper function used by interface implementations to perform
recurring validation of interface VLANs
"""
+
+ # VLAN and Q-in-Q IDs are not allowed to overlap
+ if 'vif' in config and 'vif_s' in config:
+ duplicate = list(set(config['vif']) & set(config['vif_s']))
+ if duplicate:
+ raise ConfigError(f'Duplicate VLAN id "{duplicate[0]}" used for vif and vif-s interfaces!')
+
# 802.1q VLANs
for vlan in config.get('vif', {}):
vlan = config['vif'][vlan]