diff options
author | Daniil Baturin <daniil@vyos.io> | 2025-01-08 13:07:21 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-01-08 13:07:21 +0000 |
commit | 5a4ab1ebc53d7f296faec876850b3624207a6f35 (patch) | |
tree | 20f41455c415374958f693ef048250fefe8fa8a4 /python | |
parent | db5703cb534948248365585bc80f51f2f74369e9 (diff) | |
parent | 68afb84f43148604d0c0433994741db3fb7639c5 (diff) | |
download | vyos-1x-5a4ab1ebc53d7f296faec876850b3624207a6f35.tar.gz vyos-1x-5a4ab1ebc53d7f296faec876850b3624207a6f35.zip |
Merge pull request #4284 from indrajitr/simplify-T7016
T7016: Simplify logic for force deleting dynamic IPv4 address from interface
Diffstat (limited to 'python')
-rw-r--r-- | python/vyos/ifconfig/interface.py | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/python/vyos/ifconfig/interface.py b/python/vyos/ifconfig/interface.py index 07075fd1b..cb73e2597 100644 --- a/python/vyos/ifconfig/interface.py +++ b/python/vyos/ifconfig/interface.py @@ -1,4 +1,4 @@ -# Copyright 2019-2024 VyOS maintainers and contributors <maintainers@vyos.io> +# Copyright 2019-2025 VyOS maintainers and contributors <maintainers@vyos.io> # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public @@ -1410,13 +1410,11 @@ class Interface(Control): tmp = get_interface_address(self.ifname) if tmp and 'addr_info' in tmp: for address_dict in tmp['addr_info']: - 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}') + # Only remove dynamic assigned addresses + if address_dict['family'] == 'inet' and 'dynamic' in address_dict: + 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]: |