summaryrefslogtreecommitdiff
path: root/python
diff options
context:
space:
mode:
authorChristian Poessinger <christian@poessinger.com>2022-07-11 07:58:13 +0200
committerChristian Poessinger <christian@poessinger.com>2022-07-11 08:12:06 +0200
commitfdeae251431cb747e8f60d96269b4365b7401807 (patch)
treedc9f981380cfb2b82cbb57be6a6eaa7facbfa033 /python
parent4315c8fa5bb090e2b7edd6bda205041623e2511d (diff)
downloadvyos-1x-fdeae251431cb747e8f60d96269b4365b7401807.tar.gz
vyos-1x-fdeae251431cb747e8f60d96269b4365b7401807.zip
vyos.configdict(): T4228: is_member() must split VLAN interfaces
Commit 39157912 ("vyos.configdict(): T4228: is_member() must use the "real" hardware interface") added a bugfix on calling is_member() to retrieve the real physical information about an interface. It did not include a code path to also split up VLAN interfaces. This has been fixed.
Diffstat (limited to 'python')
-rw-r--r--python/vyos/configdict.py14
1 files changed, 12 insertions, 2 deletions
diff --git a/python/vyos/configdict.py b/python/vyos/configdict.py
index e9ef39930..29d89520c 100644
--- a/python/vyos/configdict.py
+++ b/python/vyos/configdict.py
@@ -222,8 +222,18 @@ def is_member(conf, interface, intftype=None):
for intf in conf.list_nodes(base):
member = base + [intf, 'member', 'interface', interface]
if conf.exists(member):
- if conf.exists(['interfaces', Section.section(interface), interface]):
- ret_val.update({intf : {}})
+ member_type = Section.section(interface)
+ # Check if it's a VLAN (QinQ) interface
+ interface = interface.split('.')
+ if len(interface) == 3:
+ if conf.exists(['interfaces', member_type, interface[0], 'vif-s', interface[1], 'vif-c', interface[2]]):
+ ret_val.update({intf : {}})
+ elif len(interface) == 2:
+ if conf.exists(['interfaces', member_type, interface[0], 'vif', interface[1]]):
+ ret_val.update({intf : {}})
+ else:
+ if conf.exists(['interfaces', member_type, interface[0]]):
+ ret_val.update({intf : {}})
return ret_val