summaryrefslogtreecommitdiff
path: root/python
diff options
context:
space:
mode:
authorAdam Smith <zero1three@gmail.com>2025-01-04 22:16:29 -0500
committerAdam Smith <adamsmith@yzguy.io>2025-01-05 06:57:43 -0500
commite65dba36fd76b54b0ff35968475913b5b255a914 (patch)
treed7da37535496545d7af8b6fbe3117a7ffb56b5e3 /python
parent9dae22e875bc77e44633027d06afdb95eb97d66b (diff)
downloadvyos-1x-e65dba36fd76b54b0ff35968475913b5b255a914.tar.gz
vyos-1x-e65dba36fd76b54b0ff35968475913b5b255a914.zip
T7016: force delete only dynamic IPv4 address from interface
Diffstat (limited to 'python')
-rw-r--r--python/vyos/ifconfig/interface.py12
1 files changed, 7 insertions, 5 deletions
diff --git a/python/vyos/ifconfig/interface.py b/python/vyos/ifconfig/interface.py
index cad1685a9..de821ab60 100644
--- a/python/vyos/ifconfig/interface.py
+++ b/python/vyos/ifconfig/interface.py
@@ -1423,11 +1423,13 @@ class Interface(Control):
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]: