diff options
| author | Christian Breunig <christian@breunig.cc> | 2025-11-04 16:16:25 +0100 |
|---|---|---|
| committer | Christian Breunig <christian@breunig.cc> | 2025-11-04 16:24:29 +0100 |
| commit | 2f5ced44d12f3e92a22cc43eb5f4e7df4b7f062f (patch) | |
| tree | 6886802c6e999ff78068bf91ff2983216bb75773 /smoketest/scripts/cli/test_interfaces_virtual-ethernet.py | |
| parent | e1b7b865a63454ae4b8f840c94ab599633faaf7f (diff) | |
| download | vyos-1x-2f5ced44d12f3e92a22cc43eb5f4e7df4b7f062f.tar.gz vyos-1x-2f5ced44d12f3e92a22cc43eb5f4e7df4b7f062f.zip | |
veth: T7990: fix stale DHCP clients when removing virtual Ethernet pairs
When removing a veth interface, the kernel automatically deletes its peer
interface, since veth devices always exist in pairs. However, this automatic
removal does not trigger the remove() helper in vyos.ifconfig.interfaces, which
can leave associated DHCP(v6) clients running indefinitely.
For example:
ip link add veth0 type veth peer name veth1
ip link del dev veth1
Removing veth1 will also delete veth0 in the kernel, but the VyOS cleanup
routines are never called for veth0. This patch ensures that peer removal
correctly purges both interfaces and their associated state.
This drops the workarounds in veth smoketest and falls back to the common
interface smoketests from the inherited base class.
Diffstat (limited to 'smoketest/scripts/cli/test_interfaces_virtual-ethernet.py')
| -rwxr-xr-x | smoketest/scripts/cli/test_interfaces_virtual-ethernet.py | 27 |
1 files changed, 0 insertions, 27 deletions
diff --git a/smoketest/scripts/cli/test_interfaces_virtual-ethernet.py b/smoketest/scripts/cli/test_interfaces_virtual-ethernet.py index 0a581951d..9bcc1cb1f 100755 --- a/smoketest/scripts/cli/test_interfaces_virtual-ethernet.py +++ b/smoketest/scripts/cli/test_interfaces_virtual-ethernet.py @@ -15,14 +15,10 @@ # along with this program. If not, see <http://www.gnu.org/licenses/>. import unittest -from netifaces import interfaces # pylint: disable = no-name-in-module from base_interfaces_test import BasicInterfaceTest from base_vyostest_shim import VyOSUnitTestSHIM -from vyos.frrender import mgmt_daemon -from vyos.utils.process import process_named_running - class VEthInterfaceTest(BasicInterfaceTest.TestCase): @classmethod def setUpClass(cls): @@ -36,28 +32,5 @@ class VEthInterfaceTest(BasicInterfaceTest.TestCase): # call base-classes classmethod super(VEthInterfaceTest, cls).setUpClass() - # As we always need a pair of veth interfaces, we can not rely on the base - # class check to determine if there is a dhcp6c or dhclient instance - # running. This test will always fail as there is an instance still running - # on the peer interface. - def tearDown(self): - self.cli_delete(self._base_path) - self.cli_commit() - - # Verify that no previously interface remained on the system - for intf in self._interfaces: - self.assertNotIn(intf, interfaces()) - - # check process health and continuity - self.assertEqual(self.mgmt_daemon_pid, process_named_running(mgmt_daemon)) - - @classmethod - def tearDownClass(cls): - # No daemon started during tests should remain running - for daemon in ['dhcp6c', 'dhclient']: - cls.assertFalse(cls, process_named_running(daemon)) - - super(VEthInterfaceTest, cls).tearDownClass() - if __name__ == '__main__': unittest.main(verbosity=2, failfast=VyOSUnitTestSHIM.TestCase.debug_on()) |
