]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
test-network: add more test cases when ipv6 is disabled 12774/head
authorYu Watanabe <watanabe.yu+github@gmail.com>
Wed, 12 Jun 2019 02:01:32 +0000 (11:01 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Wed, 12 Jun 2019 02:04:10 +0000 (11:04 +0900)
test/test-network/conf/25-sysctl-disable-ipv6.network
test/test-network/systemd-networkd-tests.py

index e52078e0d4cf7e2e2ae2539ce29300068a79378b..c4c5fbc12945eb42a9771a470e19ef2817d2c5f0 100644 (file)
@@ -4,3 +4,15 @@ Name=dummy98
 [Network]
 IPv6AcceptRA=no
 Address=10.2.3.4/16
+
+# This should be ignored when ipv6 is disabled
+Gateway=2607:5300:0203:39ff:ff:ff:ff:ff
+
+[Address]
+# This should be ignored when ipv6 is disabled
+Address=2607:5300:0203:3906::/64
+
+[Route]
+# This should be ignored when ipv6 is disabled
+Destination=2607:5300:0203:39ff:ff:ff:ff:ff
+Scope=link
index ddb2465e1da3393489d12bd97bada39886a7ea8d..f22fdbe5af754921764db1c1fd560506ad6b386d 100755 (executable)
@@ -1579,7 +1579,12 @@ class NetworkdNetworkTests(unittest.TestCase, Utilities):
         output = check_output('ip -6 address show dummy98')
         print(output)
         self.assertEqual(output, '')
-        self.check_operstate('dummy98', 'routable')
+        output = check_output('ip -4 route show dev dummy98')
+        print(output)
+        self.assertEqual(output, '10.2.0.0/16 proto kernel scope link src 10.2.3.4')
+        output = check_output('ip -6 route show dev dummy98')
+        print(output)
+        self.assertEqual(output, '')
 
         check_output('ip link del dummy98')
 
@@ -1595,8 +1600,14 @@ class NetworkdNetworkTests(unittest.TestCase, Utilities):
         self.assertRegex(output, 'inet 10.2.3.4/16 brd 10.2.255.255 scope global dummy98')
         output = check_output('ip -6 address show dummy98')
         print(output)
+        self.assertRegex(output, 'inet6 2607:5300:203:3906::/64 scope global')
         self.assertRegex(output, 'inet6 .* scope link')
-        self.check_operstate('dummy98', 'routable')
+        output = check_output('ip -4 route show dev dummy98')
+        print(output)
+        self.assertEqual(output, '10.2.0.0/16 proto kernel scope link src 10.2.3.4')
+        output = check_output('ip -6 route show dev dummy98')
+        print(output)
+        self.assertRegex(output, 'default via 2607:5300:203:39ff:ff:ff:ff:ff proto static')
 
     def test_bind_carrier(self):
         copy_unit_to_networkd_unit_path('25-bind-carrier.network', '11-dummy.netdev')