summaryrefslogtreecommitdiff
path: root/python
diff options
context:
space:
mode:
authorViacheslav Hletenko <v.gletenko@vyos.io>2023-12-14 17:29:39 +0000
committerMergify <37929162+mergify[bot]@users.noreply.github.com>2023-12-14 17:55:10 +0000
commita6d1af3c943600e971662b5b8992a576804ec060 (patch)
tree98e686854e11c41112c8757af75105420d7a3c45 /python
parentb225192d74d1080689d3d725079e77de3ff2a742 (diff)
downloadvyos-1x-a6d1af3c943600e971662b5b8992a576804ec060.tar.gz
vyos-1x-a6d1af3c943600e971662b5b8992a576804ec060.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` (cherry picked from commit 2ebac5af10a36668ed3b8cfa6e5a9f61cf5d1068)
Diffstat (limited to 'python')
-rw-r--r--python/vyos/ifconfig/interface.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/python/vyos/ifconfig/interface.py b/python/vyos/ifconfig/interface.py
index 8783ccc1e..a038ef28d 100644
--- a/python/vyos/ifconfig/interface.py
+++ b/python/vyos/ifconfig/interface.py
@@ -113,7 +113,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)),
},
}