diff options
author | Viacheslav Hletenko <v.gletenko@vyos.io> | 2023-12-14 17:29:39 +0000 |
---|---|---|
committer | Viacheslav Hletenko <v.gletenko@vyos.io> | 2023-12-14 17:34:36 +0000 |
commit | 2ebac5af10a36668ed3b8cfa6e5a9f61cf5d1068 (patch) | |
tree | afcba5a6b9a2945ad81b2c6a0460e9a5004efde8 | |
parent | 4508fb22454e430fbd2040f37bdb75dbc4f6f68a (diff) | |
download | vyos-1x-2ebac5af10a36668ed3b8cfa6e5a9f61cf5d1068.tar.gz vyos-1x-2ebac5af10a36668ed3b8cfa6e5a9f61cf5d1068.zip |
T5749: Add a more scrict search for get_vrf method
The current implementation is wrong as it searches `master` in the
iproute2 JSON output. It is a worng as it could include bridges
or bonding interfaces
Add the more strict search `info_slave_kind == vrf`
-rw-r--r-- | python/vyos/ifconfig/interface.py | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/python/vyos/ifconfig/interface.py b/python/vyos/ifconfig/interface.py index 1586710db..56dcde214 100644 --- a/python/vyos/ifconfig/interface.py +++ b/python/vyos/ifconfig/interface.py @@ -115,7 +115,7 @@ class Interface(Control): }, 'vrf': { 'shellcmd': 'ip -json -detail link list dev {ifname}', - 'format': lambda j: jmespath.search('[*].master | [0]', json.loads(j)), + 'format': lambda j: jmespath.search('[?linkinfo.info_slave_kind == `vrf`].master | [0]', json.loads(j)), }, } |