Skip to content

Commit

Permalink
T7106: force delete only dynamic IPv4 address from interface
Browse files Browse the repository at this point in the history
  • Loading branch information
yzguy committed Jan 5, 2025
1 parent 9dae22e commit e32bc8e
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions python/vyos/ifconfig/interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -1423,11 +1423,13 @@ def set_dhcp(self, enable):
tmp = get_interface_address(self.ifname)
if tmp and 'addr_info' in tmp:
for address_dict in tmp['addr_info']:
# Only remove dynamic assigned addresses
if 'dynamic' not in address_dict:
continue
address = address_dict['local']
self.del_addr(address)
if address_dict['family'] == 'inet':
# Only remove dynamic assigned addresses
if 'dynamic' not in address_dict:
continue
address = address_dict['local']
prefixlen = address_dict['prefixlen']
self.del_addr(f'{address}/{prefixlen}')

# cleanup old config files
for file in [dhclient_config_file, systemd_override_file, dhclient_lease_file]:
Expand Down

0 comments on commit e32bc8e

Please sign in to comment.