summaryrefslogtreecommitdiff
path: root/python
diff options
context:
space:
mode:
authorChristian Poessinger <christian@poessinger.com>2022-07-10 22:44:03 +0200
committerChristian Poessinger <christian@poessinger.com>2022-07-18 08:14:33 +0200
commit905fe01e1d9bf0930e0dd113f825777786daaa57 (patch)
tree531567b804801f3a6c509922dd657bf1b4f09cfa /python
parent872423e103a756ec470846108143e28f70c4d254 (diff)
downloadvyos-1x-905fe01e1d9bf0930e0dd113f825777786daaa57.tar.gz
vyos-1x-905fe01e1d9bf0930e0dd113f825777786daaa57.zip
vyos.configdict(): T4228: is_member() must use the "real" hardware interface
When is_member() is inspecting the bridge/Bond member interfaces it must work with the real interface (e.g. eth1) under the "ethernet" node and not work on the "member interface eth1" CLI tree, that makes no sense at all. (cherry picked from commit 3915791216998a18bf6831450df68ee199e2e4f8)
Diffstat (limited to 'python')
-rw-r--r--python/vyos/configdict.py14
1 files changed, 7 insertions, 7 deletions
diff --git a/python/vyos/configdict.py b/python/vyos/configdict.py
index be10cbdfc..cc50c5167 100644
--- a/python/vyos/configdict.py
+++ b/python/vyos/configdict.py
@@ -203,11 +203,12 @@ def is_member(conf, interface, intftype=None):
intftype is optional, if not passed it will search all known types
(currently bridge and bonding)
- Returns:
- None -> Interface is not a member
- interface name -> Interface is a member of this interface
- False -> interface type cannot have members
+ Returns: dict
+ empty -> Interface is not a member
+ key -> Interface is a member of this interface
"""
+ from vyos.ifconfig import Section
+
ret_val = {}
intftypes = ['bonding', 'bridge']
@@ -227,9 +228,8 @@ def is_member(conf, interface, intftype=None):
for intf in conf.list_nodes(base):
member = base + [intf, 'member', 'interface', interface]
if conf.exists(member):
- tmp = conf.get_config_dict(member, key_mangling=('-', '_'),
- get_first_key=True, no_tag_node_value_mangle=True)
- ret_val.update({intf : tmp})
+ if conf.exists(['interfaces', Section.section(interface), interface]):
+ ret_val.update({intf : {}})
old_level = conf.set_level(old_level)
return ret_val