]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
test-network: add tests for IPv6 routes with reject type 17834/head
authorYu Watanabe <watanabe.yu+github@gmail.com>
Thu, 3 Dec 2020 10:09:55 +0000 (19:09 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Fri, 4 Dec 2020 07:50:35 +0000 (16:50 +0900)
test/test-network/conf/25-route-static.network
test/test-network/systemd-networkd-tests.py

index bb485eb6b0dfa7de4b54b52ed93e60f3dc5d3336..ea47a0c03b748333dfbda91aafa56044309ee4ba 100644 (file)
@@ -48,6 +48,18 @@ Destination=202.54.1.3
 Type=prohibit
 Destination=202.54.1.4
 
+[Route]
+Type=blackhole
+Destination=2001:1234:5678::2
+
+[Route]
+Type=unreachable
+Destination=2001:1234:5678::3
+
+[Route]
+Type=prohibit
+Destination=2001:1234:5678::4
+
 [Route]
 Type=local
 Destination=149.10.123.1
index f759840d2381ce48cea43c28ea9c5ca2db8cf397..0a33ce777995bb84a2dd1bead798a44ab06ed4a8 100755 (executable)
@@ -2216,6 +2216,21 @@ class NetworkdNetworkTests(unittest.TestCase, Utilities):
         print(output)
         self.assertRegex(output, 'prohibit 202.54.1.4 proto static')
 
+        print('### ip -6 route show type blackhole')
+        output = check_output('ip -6 route show type blackhole')
+        print(output)
+        self.assertIn('blackhole 2001:1234:5678::2 dev lo proto static', output)
+
+        print('### ip -6 route show type unreachable')
+        output = check_output('ip -6 route show type unreachable')
+        print(output)
+        self.assertIn('unreachable 2001:1234:5678::3 dev lo proto static', output)
+
+        print('### ip -6 route show type prohibit')
+        output = check_output('ip -6 route show type prohibit')
+        print(output)
+        self.assertIn('prohibit 2001:1234:5678::4 dev lo proto static', output)
+
         print('### ip route show 192.168.10.1')
         output = check_output('ip route show 192.168.10.1')
         print(output)
@@ -2261,6 +2276,21 @@ class NetworkdNetworkTests(unittest.TestCase, Utilities):
         print(output)
         self.assertEqual(output, '')
 
+        print('### ip -6 route show type blackhole')
+        output = check_output('ip -6 route show type blackhole')
+        print(output)
+        self.assertEqual(output, '')
+
+        print('### ip -6 route show type unreachable')
+        output = check_output('ip -6 route show type unreachable')
+        print(output)
+        self.assertEqual(output, '')
+
+        print('### ip -6 route show type prohibit')
+        output = check_output('ip -6 route show type prohibit')
+        print(output)
+        self.assertEqual(output, '')
+
         remove_unit_from_networkd_path(['25-address-static.network'])
         check_output(*networkctl_cmd, 'reload', env=env)
         time.sleep(1)
@@ -2282,6 +2312,21 @@ class NetworkdNetworkTests(unittest.TestCase, Utilities):
         print(output)
         self.assertRegex(output, 'prohibit 202.54.1.4 proto static')
 
+        print('### ip -6 route show type blackhole')
+        output = check_output('ip -6 route show type blackhole')
+        print(output)
+        self.assertIn('blackhole 2001:1234:5678::2 dev lo proto static', output)
+
+        print('### ip -6 route show type unreachable')
+        output = check_output('ip -6 route show type unreachable')
+        print(output)
+        self.assertIn('unreachable 2001:1234:5678::3 dev lo proto static', output)
+
+        print('### ip -6 route show type prohibit')
+        output = check_output('ip -6 route show type prohibit')
+        print(output)
+        self.assertIn('prohibit 2001:1234:5678::4 dev lo proto static', output)
+
         rc = call("ip link del dummy98")
         self.assertEqual(rc, 0)
         time.sleep(2)
@@ -2302,6 +2347,21 @@ class NetworkdNetworkTests(unittest.TestCase, Utilities):
         print(output)
         self.assertEqual(output, '')
 
+        print('### ip -6 route show type blackhole')
+        output = check_output('ip -6 route show type blackhole')
+        print(output)
+        self.assertEqual(output, '')
+
+        print('### ip -6 route show type unreachable')
+        output = check_output('ip -6 route show type unreachable')
+        print(output)
+        self.assertEqual(output, '')
+
+        print('### ip -6 route show type prohibit')
+        output = check_output('ip -6 route show type prohibit')
+        print(output)
+        self.assertEqual(output, '')
+
     @expectedFailureIfRTA_VIAIsNotSupported()
     def test_route_via_ipv6(self):
         copy_unit_to_networkd_unit_path('25-route-via-ipv6.network', '12-dummy.netdev')