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 /src/conf_mode/vrf.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 'src/conf_mode/vrf.py')
-rwxr-xr-x | src/conf_mode/vrf.py | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/src/conf_mode/vrf.py b/src/conf_mode/vrf.py index def4cc70d..a5152342c 100755 --- a/src/conf_mode/vrf.py +++ b/src/conf_mode/vrf.py @@ -1,6 +1,6 @@ #!/usr/bin/env python3 # -# Copyright (C) 2020-2022 VyOS maintainers and contributors +# Copyright (C) 2020-2023 VyOS maintainers and contributors # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License version 2 or later as @@ -28,6 +28,8 @@ from vyos.util import cmd from vyos.util import dict_search from vyos.util import sysctl_write from vyos.util import is_ipv6_enabled +from vyos.util import interface_exists +from vyos.util import get_vrf_members from vyos import ConfigError from vyos import airbag airbag.enable() @@ -155,7 +157,17 @@ def apply(vrf): sysctl_write('net.ipv4.udp_l3mdev_accept', bind_all) for tmp in (dict_search('vrf_remove', vrf) or []): - if os.path.isdir(f'/sys/class/net/{tmp}'): + if interface_exists(tmp): + # T5492: deleting a VRF instance may leafe processes running + # (e.g. dhclient) as there is a depedency ordering issue in the CLI. + # We need to ensure that we stop the dhclient processes first so + # a proper DHCLP RELEASE message is sent + for interface in get_vrf_members(tmp): + vrf_iface = Interface(interface) + vrf_iface.set_dhcp(False) + vrf_iface.set_dhcpv6(False) + + # Delete the VRF Kernel interface call(f'ip link delete dev {tmp}') if 'name' in vrf: |