diff options
author | Christian Breunig <christian@breunig.cc> | 2025-02-08 11:36:14 +0100 |
---|---|---|
committer | Christian Breunig <christian@breunig.cc> | 2025-02-08 13:46:05 +0100 |
commit | 9e313faaef139215dbcff0f79721164e627bed30 (patch) | |
tree | 6f6fe2c8f9b6ce8213bf33f2378be8ce9124283a | |
parent | 8faf67c1fab0eced732cf414d02a6c8d7affc626 (diff) | |
download | vyos-1x-9e313faaef139215dbcff0f79721164e627bed30.tar.gz vyos-1x-9e313faaef139215dbcff0f79721164e627bed30.zip |
vyos.ifconfig: T5103: always stop the DHCP client process bevore changing 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.
-rw-r--r-- | python/vyos/ifconfig/interface.py | 12 |
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) |