summaryrefslogtreecommitdiffstats
path: root/test/test-network
diff options
context:
space:
mode:
authorYu Watanabe <watanabe.yu+github@gmail.com>2024-10-28 18:18:05 +0100
committerYu Watanabe <watanabe.yu+github@gmail.com>2024-10-31 10:41:44 +0100
commit80f38c1f65257887687291e12450bad32782773e (patch)
tree8b36f398349e09e8951dd57a85fd4d5934326abe /test/test-network
parentnetwork: update tunnel or vxlan interface if the local address is changed (diff)
downloadsystemd-80f38c1f65257887687291e12450bad32782773e.tar.xz
systemd-80f38c1f65257887687291e12450bad32782773e.zip
test-network: add test case for tunnel Local=dhcp4
For issue #24854.
Diffstat (limited to 'test/test-network')
-rw-r--r--test/test-network/conf/25-dhcp-client-ipv4-only.network1
-rw-r--r--test/test-network/conf/25-sit-dhcp4.netdev8
-rw-r--r--test/test-network/conf/25-sit-dhcp4.network4
-rwxr-xr-xtest/test-network/systemd-networkd-tests.py15
4 files changed, 26 insertions, 2 deletions
diff --git a/test/test-network/conf/25-dhcp-client-ipv4-only.network b/test/test-network/conf/25-dhcp-client-ipv4-only.network
index 5e83bd24dc..7d79ee3485 100644
--- a/test/test-network/conf/25-dhcp-client-ipv4-only.network
+++ b/test/test-network/conf/25-dhcp-client-ipv4-only.network
@@ -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
index 0000000000..7f89504cee
--- /dev/null
+++ b/test/test-network/conf/25-sit-dhcp4.netdev
@@ -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
index 0000000000..bcf330579c
--- /dev/null
+++ b/test/test-network/conf/25-sit-dhcp4.network
@@ -0,0 +1,4 @@
+# SPDX-License-Identifier: LGPL-2.1-or-later
+[Match]
+Name=sit-dhcp4
+Type=sit
diff --git a/test/test-network/systemd-networkd-tests.py b/test/test-network/systemd-networkd-tests.py
index 82339583be..61a4933d65 100755
--- a/test/test-network/systemd-networkd-tests.py
+++ b/test/test-network/systemd-networkd-tests.py
@@ -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)