From 879036a4db0517dc332c4e2ce3c806495a5fe401 Mon Sep 17 00:00:00 2001 From: Christian Poessinger Date: Sun, 15 Sep 2019 16:02:50 +0200 Subject: Python/ifconfig: T1557: delete all assigned IP addresses on remove() --- python/vyos/ifconfig.py | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'python') diff --git a/python/vyos/ifconfig.py b/python/vyos/ifconfig.py index c0d1660d1..4bb320e21 100644 --- a/python/vyos/ifconfig.py +++ b/python/vyos/ifconfig.py @@ -129,6 +129,12 @@ class Interface: self._del_dhcp() self._del_dhcpv6() + # remove all assigned IP addresses from interface - this is a bit redundant + # as the kernel will remove all addresses on interface deletion, but we + # can not delete ALL interfaces, see below + for addr in self.get_addr(): + self.del_addr(addr) + # Ethernet interfaces can not be removed if type(self) == type(EthernetIf(self._ifname)): return -- cgit v1.2.3