summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/test-network/conf/dhcp-client-reassign-static-routes-ipv4.network (renamed from test/test-network/conf/dhcp-client-use-routes-no.network)0
-rw-r--r--test/test-network/conf/dhcp-client-reassign-static-routes-ipv6.network8
-rwxr-xr-xtest/test-network/systemd-networkd-tests.py40
3 files changed, 46 insertions, 2 deletions
diff --git a/test/test-network/conf/dhcp-client-use-routes-no.network b/test/test-network/conf/dhcp-client-reassign-static-routes-ipv4.network
index 0c97ef5d8a..0c97ef5d8a 100644
--- a/test/test-network/conf/dhcp-client-use-routes-no.network
+++ b/test/test-network/conf/dhcp-client-reassign-static-routes-ipv4.network
diff --git a/test/test-network/conf/dhcp-client-reassign-static-routes-ipv6.network b/test/test-network/conf/dhcp-client-reassign-static-routes-ipv6.network
new file mode 100644
index 0000000000..c662e99753
--- /dev/null
+++ b/test/test-network/conf/dhcp-client-reassign-static-routes-ipv6.network
@@ -0,0 +1,8 @@
+[Match]
+Name=veth99
+
+[Network]
+IPv6AcceptRA=yes
+
+[Route]
+Destination=2600:0:0:1::/64
diff --git a/test/test-network/systemd-networkd-tests.py b/test/test-network/systemd-networkd-tests.py
index 272d5453fe..399824af5c 100755
--- a/test/test-network/systemd-networkd-tests.py
+++ b/test/test-network/systemd-networkd-tests.py
@@ -2202,6 +2202,8 @@ class NetworkdDHCPClientTests(unittest.TestCase, Utilities):
'dhcp-client-keep-configuration-dhcp-on-stop.network',
'dhcp-client-keep-configuration-dhcp.network',
'dhcp-client-listen-port.network',
+ 'dhcp-client-reassign-static-routes-ipv4.network',
+ 'dhcp-client-reassign-static-routes-ipv6.network',
'dhcp-client-route-metric.network',
'dhcp-client-route-table.network',
'dhcp-client-use-dns-ipv4-and-ra.network',
@@ -2406,9 +2408,9 @@ class NetworkdDHCPClientTests(unittest.TestCase, Utilities):
print(output)
self.assertRegex(output, 'metric 24')
- def test_dhcp_client_use_routes_no(self):
+ def test_dhcp_client_reassign_static_routes_ipv4(self):
copy_unit_to_networkd_unit_path('25-veth.netdev', 'dhcp-server-veth-peer.network',
- 'dhcp-client-use-routes-no.network')
+ 'dhcp-client-reassign-static-routes-ipv4.network')
start_networkd()
wait_online(['veth-peer:carrier'])
start_dnsmasq(lease_time='2m')
@@ -2425,6 +2427,9 @@ class NetworkdDHCPClientTests(unittest.TestCase, Utilities):
self.assertRegex(output, r'192.168.6.0/24 proto static')
self.assertRegex(output, r'192.168.7.0/24 proto static')
+ stop_dnsmasq(dnsmasq_pid_file)
+ start_dnsmasq(ipv4_range='192.168.5.210,192.168.5.220', lease_time='2m')
+
# Sleep for 120 sec as the dnsmasq minimum lease time can only be set to 120
print('Wait for the dynamic address to be renewed')
time.sleep(125)
@@ -2438,6 +2443,37 @@ class NetworkdDHCPClientTests(unittest.TestCase, Utilities):
self.assertRegex(output, r'192.168.6.0/24 proto static')
self.assertRegex(output, r'192.168.7.0/24 proto static')
+ def test_dhcp_client_reassign_static_routes_ipv6(self):
+ copy_unit_to_networkd_unit_path('25-veth.netdev', 'dhcp-server-veth-peer.network',
+ 'dhcp-client-reassign-static-routes-ipv6.network')
+ start_networkd()
+ wait_online(['veth-peer:carrier'])
+ start_dnsmasq(lease_time='2m')
+ wait_online(['veth99:routable', 'veth-peer:routable'])
+
+ output = check_output('ip address show dev veth99 scope global')
+ print(output)
+ self.assertRegex(output, r'inet6 2600::[0-9a-f]*/128 scope global (?:noprefixroute dynamic|dynamic noprefixroute)')
+
+ output = check_output('ip -6 route show dev veth99')
+ print(output)
+ self.assertRegex(output, r'2600::/64 proto ra metric 1024')
+ self.assertRegex(output, r'2600:0:0:1::/64 proto static metric 1024 pref medium')
+
+ stop_dnsmasq(dnsmasq_pid_file)
+ start_dnsmasq(ipv6_range='2600::30,2600::40', lease_time='2m')
+
+ # Sleep for 120 sec as the dnsmasq minimum lease time can only be set to 120
+ print('Wait for the dynamic address to be renewed')
+ time.sleep(125)
+
+ wait_online(['veth99:routable'])
+
+ output = check_output('ip -6 route show dev veth99')
+ print(output)
+ self.assertRegex(output, r'2600::/64 proto ra metric 1024')
+ self.assertRegex(output, r'2600:0:0:1::/64 proto static metric 1024 pref medium')
+
def test_dhcp_keep_configuration_dhcp(self):
copy_unit_to_networkd_unit_path('25-veth.netdev', 'dhcp-v4-server-veth-peer.network', 'dhcp-client-keep-configuration-dhcp.network')
start_networkd()