Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

T7016: force delete only dynamic IPv4 address from interface #4278

Merged
merged 1 commit into from
Jan 6, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading