]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
test-network: add a test for OnLink= in [NextHop] section 18711/head
authorYu Watanabe <watanabe.yu+github@gmail.com>
Sun, 14 Feb 2021 06:19:06 +0000 (15:19 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Sat, 20 Feb 2021 20:16:27 +0000 (05:16 +0900)
test/test-network/conf/25-nexthop.network
test/test-network/systemd-networkd-tests.py

index d4c7aa606c4705a0a89c2842f7e8fb4233c30ac3..a0b220f9184d40cecfdefcf34094ca4b0620a314 100644 (file)
@@ -23,6 +23,11 @@ Family=ipv6
 Id=4
 Family=ipv4
 
+[NextHop]
+Id=5
+Gateway=192.168.10.1
+OnLink=yes
+
 [NextHop]
 Gateway=192.168.5.2
 
@@ -37,3 +42,7 @@ Destination=10.10.10.11
 [Route]
 NextHop=2
 Destination=2001:1234:5:8f62::1
+
+[Route]
+NextHop=5
+Destination=10.10.10.12
index a5942ec4ea753048c4ef89b4fa847eed12ace3d2..38480e1ce58923727404ca584bccea29dc56513b 100755 (executable)
@@ -2812,6 +2812,7 @@ class NetworkdNetworkTests(unittest.TestCase, Utilities):
         self.assertIn('id 2 via 2001:1234:5:8f63::2 dev veth99', output)
         self.assertIn('id 3 dev veth99', output)
         self.assertIn('id 4 dev veth99', output)
+        self.assertRegex(output, 'id 5 via 192.168.10.1 dev veth99 .*onlink')
         self.assertRegex(output, r'id [0-9]* via 192.168.5.2 dev veth99')
 
         output = check_output('ip route show dev veth99 10.10.10.10')
@@ -2822,6 +2823,10 @@ class NetworkdNetworkTests(unittest.TestCase, Utilities):
         print(output)
         self.assertEqual('10.10.10.11 nhid 2 via inet6 2001:1234:5:8f63::2 proto static', output)
 
+        output = check_output('ip route show dev veth99 10.10.10.12')
+        print(output)
+        self.assertEqual('10.10.10.12 nhid 5 via 192.168.10.1 proto static onlink', output)
+
         output = check_output('ip -6 route show dev veth99 2001:1234:5:8f62::1')
         print(output)
         self.assertEqual('2001:1234:5:8f62::1 nhid 2 via 2001:1234:5:8f63::2 proto static metric 1024 pref medium', output)