]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
test-network: add test for static route with preferred source 28230/head
authorYu Watanabe <watanabe.yu+github@gmail.com>
Mon, 3 Jul 2023 07:04:30 +0000 (16:04 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Mon, 3 Jul 2023 07:13:49 +0000 (16:13 +0900)
This adds possible reproducer for issue #28009 (though, the issue is
highly racy, hence this may not trigger the issue reliably).

test/test-network/conf/25-route-preferred-source.network [new file with mode: 0644]
test/test-network/systemd-networkd-tests.py

diff --git a/test/test-network/conf/25-route-preferred-source.network b/test/test-network/conf/25-route-preferred-source.network
new file mode 100644 (file)
index 0000000..5a55460
--- /dev/null
@@ -0,0 +1,12 @@
+# SPDX-License-Identifier: LGPL-2.1-or-later
+[Match]
+Name=dummy98
+
+[Network]
+Address=2001:1234:56:8f63::1/64
+IPv6AcceptRA=no
+
+[Route]
+Destination=abcd::/16
+Gateway=2001:1234:56:8f63::1:1
+PreferredSource=2001:1234:56:8f63::1
index 1d426ee9798f254a4bfea2ded94b18a747ab81cb..902614712e8e4d2935ab5aacbd2c090bba6665a6 100755 (executable)
@@ -2975,6 +2975,21 @@ class NetworkdNetworkTests(unittest.TestCase, Utilities):
         print(output)
         self.assertIn('abcd::/16 via 2001:1234:56:8f63::1:1 proto static src 2001:1234:56:8f63::2', output)
 
+    def test_route_preferred_source_with_existing_address(self):
+        # See issue #28009.
+        copy_network_unit('25-route-preferred-source.network', '12-dummy.netdev')
+        start_networkd()
+
+        for i in range(3):
+            if i != 0:
+                networkctl_reconfigure('dummy98')
+
+            self.wait_online(['dummy98:routable'])
+
+            output = check_output('ip -6 route list dev dummy98')
+            print(output)
+            self.assertIn('abcd::/16 via 2001:1234:56:8f63::1:1 proto static src 2001:1234:56:8f63::1', output)
+
     def test_ip_link_mac_address(self):
         copy_network_unit('25-address-link-section.network', '12-dummy.netdev')
         start_networkd()