summaryrefslogtreecommitdiff
path: root/python/vyos/util.py
diff options
context:
space:
mode:
authorChristian Breunig <christian@breunig.cc>2023-08-28 21:21:14 +0200
committerChristian Breunig <christian@breunig.cc>2023-08-28 21:21:14 +0200
commit47d9c8067135b97bc1fbc5450dc5fa9b8e65e345 (patch)
treeac6f7858775346329d3b8c004b552209c12ad513 /python/vyos/util.py
parent396329cc9a2419c5be8ddd0bc8fbde67fdcb03fa (diff)
downloadvyos-1x-47d9c8067135b97bc1fbc5450dc5fa9b8e65e345.tar.gz
vyos-1x-47d9c8067135b97bc1fbc5450dc5fa9b8e65e345.zip
T5428: fix DHCP address renewal/release when running in VRF
Diffstat (limited to 'python/vyos/util.py')
-rw-r--r--python/vyos/util.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/python/vyos/util.py b/python/vyos/util.py
index ede22006c..20c743b35 100644
--- a/python/vyos/util.py
+++ b/python/vyos/util.py
@@ -788,6 +788,13 @@ def get_interface_config(interface):
tmp = loads(cmd(f'ip -d -j link show {interface}'))[0]
return tmp
+def get_interface_vrf(interface):
+ """ Returns VRF of given interface """
+ tmp = get_interface_config(interface)
+ if dict_search('linkinfo.info_slave_kind', tmp) == 'vrf':
+ return tmp['master']
+ return 'default'
+
def print_error(str='', end='\n'):
"""
Print `str` to stderr, terminated with `end`.