From 86209c679c6b7ca9d5bac1f67ffd391b9b16c008 Mon Sep 17 00:00:00 2001 From: Christian Poessinger Date: Tue, 2 Feb 2021 22:32:07 +0100 Subject: 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 (cherry picked from commit ccd516b4d10c518ea445928c01d6c7dc2770777b) --- python/vyos/configverify.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/python/vyos/configverify.py b/python/vyos/configverify.py index e54552335..fefe22175 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] -- cgit v1.2.3