diff options
author | Christian Breunig <christian@breunig.cc> | 2023-09-02 19:02:55 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-09-02 19:02:55 +0200 |
commit | e74b38c4d862feed7a401723c1f0b1c9d9a03324 (patch) | |
tree | 3b7e21cb3462ce3d026b32de6e73c54faad7d98b /python/vyos/configdict.py | |
parent | 0ba723bcdbf608ba73bedbba74a8aa9be1d7df7b (diff) | |
parent | f7473c735ab2d5b74718012cbd27a6ca38e5dfa1 (diff) | |
download | vyos-1x-e74b38c4d862feed7a401723c1f0b1c9d9a03324.tar.gz vyos-1x-e74b38c4d862feed7a401723c1f0b1c9d9a03324.zip |
Merge pull request #2191 from c-po/equuleus
T5428: fix DHCP client running in VRF context
Diffstat (limited to 'python/vyos/configdict.py')
-rw-r--r-- | python/vyos/configdict.py | 32 |
1 files changed, 24 insertions, 8 deletions
diff --git a/python/vyos/configdict.py b/python/vyos/configdict.py index 785207c7f..9c83e3b18 100644 --- a/python/vyos/configdict.py +++ b/python/vyos/configdict.py @@ -412,10 +412,14 @@ def get_interface_dict(config, base, ifname=''): 'no-default-route', 'vendor-class-id']: dhcp = leaf_node_changed(config, ['dhcp-options', leaf_node]) if dhcp: - dict.update({'dhcp_options_old' : dhcp}) - # one option is suffiecient to set 'dhcp_options_old' key + dict.update({'dhcp_options_changed' : {}}) + # one option is suffiecient to set 'dhcp_options_changed' key break + # Check if any DHCP options changed which require a client restat + vrf = is_node_changed(config, base + [ifname, 'vrf']) + if vrf: dict.update({'dhcp_options_changed' : {}}) + # Some interfaces come with a source_interface which must also not be part # of any other bond or bridge interface as it is exclusivly assigned as the # Kernels "lower" interface to this new "virtual/upper" interface. @@ -465,10 +469,14 @@ def get_interface_dict(config, base, ifname=''): 'no-default-route', 'vendor-class-id']: dhcp = leaf_node_changed(config, ['vif', vif, 'dhcp-options', leaf_node]) if dhcp: - dict['vif'][vif].update({'dhcp_options_old' : dhcp}) - # one option is suffiecient to set 'dhcp_options_old' key + dict['vif'][vif].update({'dhcp_options_changed' : {}}) + # one option is suffiecient to set 'dhcp_options_changed' key break + # Check if any DHCP options changed which require a client restat + vrf = is_node_changed(config, base + [ifname, 'vif', vif, 'vrf']) + if vrf: dict['vif'][vif].update({'dhcp_options_changed' : {}}) + for vif_s, vif_s_config in dict.get('vif_s', {}).items(): default_vif_s_values = defaults(base + ['vif-s']) # XXX: T2665: we only wan't the vif-s defaults - do not care about vif-c @@ -497,10 +505,14 @@ def get_interface_dict(config, base, ifname=''): 'no-default-route', 'vendor-class-id']: dhcp = leaf_node_changed(config, ['vif-s', vif_s, 'dhcp-options', leaf_node]) if dhcp: - dict['vif_s'][vif_s].update({'dhcp_options_old' : dhcp}) - # one option is suffiecient to set 'dhcp_options_old' key + dict['vif_s'][vif_s].update({'dhcp_options_changed' : {}}) + # one option is suffiecient to set 'dhcp_options_changed' key break + # Check if any DHCP options changed which require a client restat + vrf = is_node_changed(config, base + [ifname, 'vif-s', vif_s, 'vrf']) + if vrf: dict['vif_s'][vif_s].update({'dhcp_options_changed' : {}}) + for vif_c, vif_c_config in vif_s_config.get('vif_c', {}).items(): default_vif_c_values = defaults(base + ['vif-s', 'vif-c']) @@ -530,10 +542,14 @@ def get_interface_dict(config, base, ifname=''): dhcp = leaf_node_changed(config, ['vif-s', vif_s, 'vif-c', vif_c, 'dhcp-options', leaf_node]) if dhcp: - dict['vif_s'][vif_s]['vif_c'][vif_c].update({'dhcp_options_old' : dhcp}) - # one option is suffiecient to set 'dhcp_options_old' key + dict['vif_s'][vif_s]['vif_c'][vif_c].update({'dhcp_options_changed' : {}}) + # one option is suffiecient to set 'dhcp_options_changed' key break + # Check if any DHCP options changed which require a client restat + vrf = is_node_changed(config, base + [ifname, 'vif-s', vif_s, 'vif-c', vif_c, 'vrf']) + if vrf: dict['vif_s'][vif_s]['vif_c'][vif_c].update({'dhcp_options_changed' : {}}) + # Check vif, vif-s/vif-c VLAN interfaces for removal dict = get_removed_vlans(config, dict) return dict |