From: Ronan Pigott Date: Wed, 25 Oct 2023 00:57:45 +0000 (-0700) Subject: test-network: add dhcp rapid commit test X-Git-Tag: v255-rc1~112^2 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F29693%2Fhead;p=thirdparty%2Fsystemd.git test-network: add dhcp rapid commit test --- diff --git a/test/test-network/systemd-networkd-tests.py b/test/test-network/systemd-networkd-tests.py index f4c8a627683..1b8bf6f4211 100755 --- a/test/test-network/systemd-networkd-tests.py +++ b/test/test-network/systemd-networkd-tests.py @@ -5553,6 +5553,26 @@ class NetworkdDHCPClientTests(unittest.TestCase, Utilities): print(f"State = {state}") self.assertEqual(state, 'bound') + @unittest.skipUnless("--dhcp-rapid-commit" in run("dnsmasq --help").stdout, reason="dnsmasq is missing dhcp-rapid-commit support") + def test_dhcp_client_rapid_commit(self): + copy_network_unit('25-veth.netdev', '25-dhcp-server-veth-peer.network', '25-dhcp-client.network') + start_networkd() + self.wait_online(['veth-peer:carrier']) + + start_dnsmasq('--dhcp-rapid-commit') + self.wait_online(['veth99:routable', 'veth-peer:routable']) + self.wait_address('veth99', r'inet 192.168.5.[0-9]*/24', ipv='-4') + + state = get_dhcp4_client_state('veth99') + print(f"DHCPv4 client state = {state}") + self.assertEqual(state, 'bound') + + output = read_dnsmasq_log_file() + self.assertIn('DHCPDISCOVER(veth-peer)', output) + self.assertNotIn('DHCPOFFER(veth-peer)', output) + self.assertNotIn('DHCPREQUEST(veth-peer)', output) + self.assertIn('DHCPACK(veth-peer)', output) + def test_dhcp_client_ipv6_only_mode_without_ipv6_connectivity(self): copy_network_unit('25-veth.netdev', '25-dhcp-server-ipv6-only-mode.network',