diff options
author | Yu Watanabe <watanabe.yu+github@gmail.com> | 2020-03-16 19:08:36 +0900 |
---|---|---|
committer | Yu Watanabe <watanabe.yu+github@gmail.com> | 2020-03-16 19:34:47 +0900 |
commit | 0d7bd445d26590aad7b05040c9d8423fcd6e5d4f (patch) | |
tree | 56e7400069814d0d749b944c8baa0ed4f3810817 /test | |
parent | b453122789ec4c6f39e6ceb9900e0e80a6abeb99 (diff) | |
download | systemd-0d7bd445d26590aad7b05040c9d8423fcd6e5d4f.tar.gz |
test-network: add a test case for DHCPv4.UseGateway=no
Diffstat (limited to 'test')
-rw-r--r-- | test/test-network/conf/dhcp-client-ipv4-use-gateway-no.network | 9 | ||||
-rwxr-xr-x | test/test-network/systemd-networkd-tests.py | 14 |
2 files changed, 23 insertions, 0 deletions
diff --git a/test/test-network/conf/dhcp-client-ipv4-use-gateway-no.network b/test/test-network/conf/dhcp-client-ipv4-use-gateway-no.network new file mode 100644 index 0000000000..fb31772201 --- /dev/null +++ b/test/test-network/conf/dhcp-client-ipv4-use-gateway-no.network @@ -0,0 +1,9 @@ +[Match] +Name=veth99 + +[Network] +DHCP=ipv4 +IPv6AcceptRA=false + +[DHCPv4] +UseGateway=no diff --git a/test/test-network/systemd-networkd-tests.py b/test/test-network/systemd-networkd-tests.py index 5df1fed985..388e615602 100755 --- a/test/test-network/systemd-networkd-tests.py +++ b/test/test-network/systemd-networkd-tests.py @@ -2921,6 +2921,7 @@ class NetworkdDHCPClientTests(unittest.TestCase, Utilities): 'dhcp-client-ipv4-dhcp-settings.network', 'dhcp-client-ipv4-only-ipv6-disabled.network', 'dhcp-client-ipv4-only.network', + 'dhcp-client-ipv4-use-gateway-no.network', 'dhcp-client-ipv4-use-routes-no.network', 'dhcp-client-ipv6-only.network', 'dhcp-client-ipv6-rapid-commit.network', @@ -3040,6 +3041,19 @@ class NetworkdDHCPClientTests(unittest.TestCase, Utilities): self.assertRegex(output, r'default via 192.168.5.1 proto dhcp src 192.168.5.181 metric 1024') self.assertRegex(output, r'192.168.5.1 proto dhcp scope link src 192.168.5.181 metric 1024') + def test_dhcp_client_ipv4_use_gateway_no(self): + copy_unit_to_networkd_unit_path('25-veth.netdev', 'dhcp-server-veth-peer.network', 'dhcp-client-ipv4-use-gateway-no.network') + + start_networkd() + self.wait_online(['veth-peer:carrier']) + start_dnsmasq(additional_options='--dhcp-option=option:dns-server,192.168.5.6,192.168.5.7', lease_time='2m') + self.wait_online(['veth99:routable', 'veth-peer:routable']) + + output = check_output('ip route show dev veth99') + print(output) + self.assertRegex(output, r'192.168.5.0/24 via 192.168.5.5 proto dhcp src 192.168.5.181 metric 1024') + self.assertNotRegex(output, r'default via 192.168.5.1') + def test_dhcp_client_ipv4_ipv6(self): copy_unit_to_networkd_unit_path('25-veth.netdev', 'dhcp-server-veth-peer.network', 'dhcp-client-ipv6-only.network', 'dhcp-client-ipv4-only.network') |