1
0
mirror of https://github.com/CumulusNetworks/ifupdown2.git synced 2024-05-06 15:54:50 +00:00

addons: address: remove old ip address when intf is moved to dhcp

Signed-off-by: Julien Fortin <julien@cumulusnetworks.com>
This commit is contained in:
Julien Fortin
2019-07-17 01:21:03 +02:00
parent d92f630c59
commit 2e2dcdaf36

View File

@ -856,6 +856,12 @@ class address(moduleBase):
if addr_method not in ["dhcp", "ppp"]:
self._inet_address_config(ifaceobj, ifaceobj_getfunc,
force_reapply)
else:
# remove old addresses added by ifupdown2
# (if intf was moved from static config to dhcp)
for old_ifaceobj in statemanager.statemanager_api.get_ifaceobjs(ifaceobj.name) or []:
for addr in old_ifaceobj.get_attr_value("address") or []:
self.ipcmd.addr_del(ifaceobj.name, addr)
self.process_mtu(ifaceobj, ifaceobj_getfunc)