]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
test-network: add test case for tunnel Local=dhcp4 34957/head
authorYu Watanabe <watanabe.yu+github@gmail.com>
Mon, 28 Oct 2024 17:18:05 +0000 (02:18 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Thu, 31 Oct 2024 09:41:44 +0000 (18:41 +0900)
For issue #24854.

test/test-network/conf/25-dhcp-client-ipv4-only.network
test/test-network/conf/25-sit-dhcp4.netdev [new file with mode: 0644]
test/test-network/conf/25-sit-dhcp4.network [new file with mode: 0644]
test/test-network/systemd-networkd-tests.py

index 5e83bd24dc1f62d0657d7f4e10809bfaaf6469c2..7d79ee3485e1589b6cbed9f72f6f1c49b6071a59 100644 (file)
@@ -6,6 +6,7 @@ Name=veth99
 DHCP=ipv4
 IPv6AcceptRA=no
 Address=192.168.5.250/24
+Tunnel=sit-dhcp4
 
 [DHCPv4]
 RequestAddress=192.168.5.110
diff --git a/test/test-network/conf/25-sit-dhcp4.netdev b/test/test-network/conf/25-sit-dhcp4.netdev
new file mode 100644 (file)
index 0000000..7f89504
--- /dev/null
@@ -0,0 +1,8 @@
+# SPDX-License-Identifier: LGPL-2.1-or-later
+[NetDev]
+Name=sit-dhcp4
+Kind=sit
+
+[Tunnel]
+Local=dhcp4
+Remote=any
diff --git a/test/test-network/conf/25-sit-dhcp4.network b/test/test-network/conf/25-sit-dhcp4.network
new file mode 100644 (file)
index 0000000..bcf3305
--- /dev/null
@@ -0,0 +1,4 @@
+# SPDX-License-Identifier: LGPL-2.1-or-later
+[Match]
+Name=sit-dhcp4
+Type=sit
index 82339583bed47f21344be9a8efed7a854cbd916d..61a4933d652aff2d71a7749814513e0e8af01a64 100755 (executable)
@@ -6829,7 +6829,8 @@ class NetworkdDHCPClientTests(unittest.TestCase, Utilities):
 
     @expectedFailureIfKernelReturnsInvalidFlags()
     def test_dhcp_client_ipv4_only(self):
-        copy_network_unit('25-veth.netdev', '25-dhcp-server-veth-peer.network', '25-dhcp-client-ipv4-only.network')
+        copy_network_unit('25-veth.netdev', '25-dhcp-server-veth-peer.network', '25-dhcp-client-ipv4-only.network',
+                          '25-sit-dhcp4.netdev', '25-sit-dhcp4.network')
 
         self.setup_nftset('addr4', 'ipv4_addr')
         self.setup_nftset('network4', 'ipv4_addr', 'flags interval;')
@@ -6842,7 +6843,7 @@ class NetworkdDHCPClientTests(unittest.TestCase, Utilities):
                       '--dhcp-option=option:domain-search,example.com',
                       '--dhcp-alternate-port=67,5555',
                       ipv4_range='192.168.5.110,192.168.5.119')
-        self.wait_online('veth99:routable', 'veth-peer:routable')
+        self.wait_online('veth99:routable', 'veth-peer:routable', 'sit-dhcp4:carrier')
         self.wait_address('veth99', r'inet 192.168.5.11[0-9]*/24', ipv='-4')
 
         print('## ip address show dev veth99 scope global')
@@ -6915,6 +6916,11 @@ class NetworkdDHCPClientTests(unittest.TestCase, Utilities):
             a = socket.inet_ntop(socket.AF_INET, bytearray(i['ConfigProvider']))
             self.assertEqual('192.168.5.1', a)
 
+        print('## tunnel')
+        output = check_output('ip -d link show sit-dhcp4')
+        print(output)
+        self.assertRegex(output, fr'sit (ip6ip )?remote any local {address1} dev veth99')
+
         print('## dnsmasq log')
         output = read_dnsmasq_log_file()
         print(output)
@@ -7010,6 +7016,11 @@ class NetworkdDHCPClientTests(unittest.TestCase, Utilities):
             a = socket.inet_ntop(socket.AF_INET, bytearray(i['ConfigProvider']))
             self.assertEqual('192.168.5.1', a)
 
+        print('## tunnel')
+        output = check_output('ip -d link show sit-dhcp4')
+        print(output)
+        self.assertRegex(output, fr'sit (ip6ip )?remote any local {address2} dev veth99')
+
         print('## dnsmasq log')
         output = read_dnsmasq_log_file()
         print(output)