From: Matteo Croce Date: Mon, 19 May 2025 03:46:50 +0000 (+0200) Subject: networkd: add test to ensure that untracked addresses are kept X-Git-Tag: v258-rc1~568 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6479204e567cd55e1bfc5894131fba80ea68a780;p=thirdparty%2Fsystemd.git networkd: add test to ensure that untracked addresses are kept Users can alter the network configuration manually, but networkd should not interfere with manually set addresses and routes. --- diff --git a/test/test-network/systemd-networkd-tests.py b/test/test-network/systemd-networkd-tests.py index dbc4589aa2d..fbf5354eb58 100755 --- a/test/test-network/systemd-networkd-tests.py +++ b/test/test-network/systemd-networkd-tests.py @@ -5063,6 +5063,31 @@ class NetworkdNetworkTests(unittest.TestCase, Utilities): print('### ip monitor dev dummy98 END') + def test_keep_untracked_addresses(self): + # Add an unmanaged interface with an up address + + copy_network_unit('12-dummy.netdev', '85-static-ipv6.network') + start_networkd() + self.wait_online('dummy98:routable') + + print('### ip -4 addr add 10.234.77.111/32 dev dummy98') + output = check_output('ip -4 addr add 10.234.77.111/32 dev dummy98') + print(output) + + print('### ip -6 addr add 2222:3333::4444/64 dev dummy98') + output = check_output('ip -6 addr add 2222:3333::4444/64 dev dummy98') + print(output) + + restart_networkd() + + output = check_output('ip -4 addr show dev dummy98') + print(output) + self.assertRegex(output, 'inet 10\.234\.77\.111/32.*dummy98') + + output = check_output('ip -6 addr show dev dummy98') + print(output) + self.assertRegex(output, 'inet6 2222:3333::4444/64 scope global') + def check_nexthop(self, manage_foreign_nexthops, first): self.wait_online('veth99:routable', 'veth-peer:routable', 'dummy98:routable')