summaryrefslogtreecommitdiff
path: root/python/vyos/configdict.py
diff options
context:
space:
mode:
authorChristian Breunig <christian@breunig.cc>2023-08-28 21:21:14 +0200
committerChristian Breunig <christian@breunig.cc>2023-08-28 21:21:14 +0200
commit47d9c8067135b97bc1fbc5450dc5fa9b8e65e345 (patch)
treeac6f7858775346329d3b8c004b552209c12ad513 /python/vyos/configdict.py
parent396329cc9a2419c5be8ddd0bc8fbde67fdcb03fa (diff)
downloadvyos-1x-47d9c8067135b97bc1fbc5450dc5fa9b8e65e345.tar.gz
vyos-1x-47d9c8067135b97bc1fbc5450dc5fa9b8e65e345.zip
T5428: fix DHCP address renewal/release when running in VRF
Diffstat (limited to 'python/vyos/configdict.py')
-rw-r--r--python/vyos/configdict.py32
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