Skip to content

Commit

Permalink
Merge pull request #4278 from yzguy/T7016
Browse files Browse the repository at this point in the history
T7016: force delete only dynamic IPv4 address from interface
  • Loading branch information
c-po authored Jan 6, 2025
2 parents 9dae22e + e65dba3 commit 9c091f0
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 9c091f0

Please sign in to comment.