summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Poessinger <christian@poessinger.com>2020-08-18 16:39:50 +0200
committerChristian Poessinger <christian@poessinger.com>2020-08-18 16:39:52 +0200
commitb9658cf8fa85d5d2bdc503d10340dc82c9c2a8c0 (patch)
tree9535172f54b3e38ab1e18b779eb4e5ac82212ce4
parent57aad3a59f9f50d44702cca96a8b6069256caf5e (diff)
downloadvyos-1x-b9658cf8fa85d5d2bdc503d10340dc82c9c2a8c0.tar.gz
vyos-1x-b9658cf8fa85d5d2bdc503d10340dc82c9c2a8c0.zip
ifconfig: T2653: bugfix when removing DHCP address
DHCP service was not stopped when an DHCP address got removed from the interface. DHCP service is now always stopped if it is not configured explicitly.
-rw-r--r--python/vyos/ifconfig/interface.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/python/vyos/ifconfig/interface.py b/python/vyos/ifconfig/interface.py
index 36f258301..892495dec 100644
--- a/python/vyos/ifconfig/interface.py
+++ b/python/vyos/ifconfig/interface.py
@@ -901,6 +901,11 @@ class Interface(Control):
if isinstance(new_addr, str):
new_addr = [new_addr]
+ # ensure DHCP/DHCPv6 is stopped (when not configured explicitly)
+ for proto in ['dhcp', 'dhcpv6']:
+ if proto not in new_addr:
+ self.del_addr(proto)
+
# determine IP addresses which are assigned to the interface and build a
# list of addresses which are no longer in the dict so they can be removed
cur_addr = self.get_addr()