Merge pull request #29693 from rpigott/dhcp-rapid-commit

network: implement RFC4039 DHCP Rapid Commit
This commit is contained in:
Yu Watanabe
2023-10-28 10:23:23 +09:00
committed by GitHub
12 changed files with 136 additions and 27 deletions

View File

@@ -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',