summaryrefslogtreecommitdiff
path: root/python
diff options
context:
space:
mode:
authorNataliia Solomko <natalirs1985@gmail.com>2026-06-18 15:34:12 +0300
committerNataliia Solomko <natalirs1985@gmail.com>2026-06-18 15:53:07 +0300
commitd49442a763de78b2fa5481218de1b91fb754c09c (patch)
treee924d1e8cfbe210f978cbc4b7781806d30863780 /python
parentc92535d5afcddd58875c5394f967f95cbcc94aef (diff)
downloadvyos-1x-d49442a763de78b2fa5481218de1b91fb754c09c.tar.gz
vyos-1x-d49442a763de78b2fa5481218de1b91fb754c09c.zip
vpp: T8979: Fix defunct interface retaining IP addresses after crash
flush_ip() used flush_addr(label=iface_name) which only matches addresses whose label equals exactly the interface name. Secondary IP addresses are assigned with :N suffixed labels (e.g. defunct_eth0:2, defunct_eth0:3) and are not matched, so they remain on the interface. Fix by flushing addresses by interface index instead of label, which removes all addresses regardless of their label.
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: