summaryrefslogtreecommitdiff
path: root/python
diff options
context:
space:
mode:
authorDaniil Baturin <daniil@vyos.io>2025-02-09 15:13:20 +0000
committerGitHub <noreply@github.com>2025-02-09 15:13:20 +0000
commit41e9b8b362faedc0c20316255d59d7f90e848a4c (patch)
treec6b97137bed5cfd1ecbbf1fed385e71a8f1c7991 /python
parent38dacfeb8fb66d135f8ad219ff3c2fc7504f3029 (diff)
parent9e313faaef139215dbcff0f79721164e627bed30 (diff)
downloadvyos-1x-41e9b8b362faedc0c20316255d59d7f90e848a4c.tar.gz
vyos-1x-41e9b8b362faedc0c20316255d59d7f90e848a4c.zip
Merge pull request #4340 from c-po/T5103-vrf-dhcp
vyos.ifconfig: T5103: always stop the DHCP client process bevore changing VRF
Diffstat (limited to 'python')
-rw-r--r--python/vyos/ifconfig/interface.py12
1 files changed, 11 insertions, 1 deletions
diff --git a/python/vyos/ifconfig/interface.py b/python/vyos/ifconfig/interface.py
index 5d8326bb3..979b62578 100644
--- a/python/vyos/ifconfig/interface.py
+++ b/python/vyos/ifconfig/interface.py
@@ -615,8 +615,18 @@ class Interface(Control):
# Get current VRF table ID
old_vrf_tableid = get_vrf_tableid(self.ifname)
- self.set_interface('vrf', vrf)
+ # Always stop the DHCP client process to clean up routes within the VRF
+ # where the process was originally started. There is no need to add a
+ # condition to only call the method if "address dhcp" was defined, as
+ # this is handled inside set_dhcp(v6) by only stopping if the daemon is
+ # running. DHCP client process restart will be handled later on once the
+ # interface is moved to the new VRF.
+ self.set_dhcp(False)
+ self.set_dhcpv6(False)
+
+ # Move interface in/out of VRF
+ self.set_interface('vrf', vrf)
if vrf:
# Get routing table ID number for VRF
vrf_table_id = get_vrf_tableid(vrf)