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:
@ -856,6 +856,12 @@ class address(moduleBase):
|
|||||||
if addr_method not in ["dhcp", "ppp"]:
|
if addr_method not in ["dhcp", "ppp"]:
|
||||||
self._inet_address_config(ifaceobj, ifaceobj_getfunc,
|
self._inet_address_config(ifaceobj, ifaceobj_getfunc,
|
||||||
force_reapply)
|
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)
|
self.process_mtu(ifaceobj, ifaceobj_getfunc)
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user