diff options
author | Christian Poessinger <christian@poessinger.com> | 2021-12-09 21:48:50 +0100 |
---|---|---|
committer | Christian Poessinger <christian@poessinger.com> | 2021-12-09 21:58:24 +0100 |
commit | 91898b8bd876af6b4d7fae54981e78400f57e008 (patch) | |
tree | 04a0bb4c64e328b9c090787b963ba4fcd4a4a042 /python | |
parent | 1a814661a0ade01f144398b91dd6998e42018fdd (diff) | |
download | vyos-1x-91898b8bd876af6b4d7fae54981e78400f57e008.tar.gz vyos-1x-91898b8bd876af6b4d7fae54981e78400f57e008.zip |
vyos.configdict: T4064: bugfix for IP addresses not removed from Kernel
Commit e8c6595fc47 ("vyos.ifconfig: T2738: do not remove OS assigned IP
addresses from interface") addressed an issue with IP addresses added to
interfaces by daemons and not by the CLI. The solution in this commit for IP
address removal unfortunately did not cover VLAN (802.1q and 802.1ad) IP address
removal in the same way as it is done for non VLAN interfaces. The code was
missing.
Diffstat (limited to 'python')
-rw-r--r-- | python/vyos/configdict.py | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/python/vyos/configdict.py b/python/vyos/configdict.py index 8e5781b81..c78a95d97 100644 --- a/python/vyos/configdict.py +++ b/python/vyos/configdict.py @@ -420,7 +420,10 @@ def get_interface_dict(config, base, ifname=''): if not 'dhcpv6_options' in vif_config: del default_vif_values['dhcpv6_options'] - dict['vif'][vif] = dict_merge(default_vif_values, vif_config) + address = leaf_node_changed(config, ['vif', vif, 'address']) + if address: dict['vif'][vif].update({'address_old' : address}) + + dict['vif'][vif] = dict_merge(default_vif_values, dict['vif'][vif]) # XXX: T2665: blend in proper DHCPv6-PD default values dict['vif'][vif] = T2665_set_dhcpv6pd_defaults(dict['vif'][vif]) @@ -438,7 +441,11 @@ def get_interface_dict(config, base, ifname=''): if not 'dhcpv6_options' in vif_s_config: del default_vif_s_values['dhcpv6_options'] - dict['vif_s'][vif_s] = dict_merge(default_vif_s_values, vif_s_config) + address = leaf_node_changed(config, ['vif-s', vif_s, 'address']) + if address: dict['vif_s'][vif_s].update({'address_old' : address}) + + dict['vif_s'][vif_s] = dict_merge(default_vif_s_values, + dict['vif_s'][vif_s]) # XXX: T2665: blend in proper DHCPv6-PD default values dict['vif_s'][vif_s] = T2665_set_dhcpv6pd_defaults( dict['vif_s'][vif_s]) @@ -455,8 +462,12 @@ def get_interface_dict(config, base, ifname=''): if not 'dhcpv6_options' in vif_c_config: del default_vif_c_values['dhcpv6_options'] + address = leaf_node_changed(config, ['vif-s', vif_s, 'vif-c', vif_c, 'address']) + if address: dict['vif_s'][vif_s]['vif_c'][vif_c].update( + {'address_old' : address}) + dict['vif_s'][vif_s]['vif_c'][vif_c] = dict_merge( - default_vif_c_values, vif_c_config) + default_vif_c_values, dict['vif_s'][vif_s]['vif_c'][vif_c]) # XXX: T2665: blend in proper DHCPv6-PD default values dict['vif_s'][vif_s]['vif_c'][vif_c] = T2665_set_dhcpv6pd_defaults( dict['vif_s'][vif_s]['vif_c'][vif_c]) |