summaryrefslogtreecommitdiff
path: root/python
diff options
context:
space:
mode:
Diffstat (limited to 'python')
-rw-r--r--python/vyos/vpp/control_host.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/python/vyos/vpp/control_host.py b/python/vyos/vpp/control_host.py
index 707f56740..6ad870b7b 100644
--- a/python/vyos/vpp/control_host.py
+++ b/python/vyos/vpp/control_host.py
@@ -444,8 +444,10 @@ def flush_ip(iface_name: str) -> None:
Args:
iface_name (str): name of an interface
"""
- iproute = IPRoute()
- iproute.flush_addr(label=iface_name)
+ with IPRoute() as iproute:
+ index = iproute.link_lookup(ifname=iface_name)
+ if index:
+ iproute.flush_addr(index=index[0])
def get_eth_channels(iface_name: str) -> dict: