|
|
|
@@ -770,7 +770,11 @@ def setUpModule():
|
|
|
|
|
save_timezone()
|
|
|
|
|
|
|
|
|
|
create_service_dropin('systemd-networkd', networkd_bin,
|
|
|
|
|
['[Service]', 'Restart=no', '[Unit]', 'StartLimitIntervalSec=0'])
|
|
|
|
|
['[Service]',
|
|
|
|
|
'Restart=no',
|
|
|
|
|
'Environment=SYSTEMD_NETWORK_TEST_MODE=yes',
|
|
|
|
|
'[Unit]',
|
|
|
|
|
'StartLimitIntervalSec=0'])
|
|
|
|
|
create_service_dropin('systemd-resolved', resolved_bin)
|
|
|
|
|
create_service_dropin('systemd-timesyncd', timesyncd_bin)
|
|
|
|
|
|
|
|
|
@@ -5110,7 +5114,10 @@ class NetworkdDHCPClientTests(unittest.TestCase, Utilities):
|
|
|
|
|
self.wait_online(['veth-peer:carrier'])
|
|
|
|
|
|
|
|
|
|
# information request mode
|
|
|
|
|
start_dnsmasq('--dhcp-option=option6:dns-server,[2600::ee]',
|
|
|
|
|
# The name ipv6-only option may not be supported by older dnsmasq
|
|
|
|
|
# start_dnsmasq('--dhcp-option=option:ipv6-only,300')
|
|
|
|
|
start_dnsmasq('--dhcp-option=108,00:00:02:00',
|
|
|
|
|
'--dhcp-option=option6:dns-server,[2600::ee]',
|
|
|
|
|
'--dhcp-option=option6:ntp-server,[2600::ff]',
|
|
|
|
|
ra_mode='ra-stateless')
|
|
|
|
|
self.wait_online(['veth99:routable', 'veth-peer:routable'])
|
|
|
|
@@ -5140,7 +5147,8 @@ class NetworkdDHCPClientTests(unittest.TestCase, Utilities):
|
|
|
|
|
|
|
|
|
|
# solicit mode
|
|
|
|
|
stop_dnsmasq()
|
|
|
|
|
start_dnsmasq('--dhcp-option=option6:dns-server,[2600::ee]',
|
|
|
|
|
start_dnsmasq('--dhcp-option=108,00:00:02:00',
|
|
|
|
|
'--dhcp-option=option6:dns-server,[2600::ee]',
|
|
|
|
|
'--dhcp-option=option6:ntp-server,[2600::ff]')
|
|
|
|
|
networkctl_reconfigure('veth99')
|
|
|
|
|
self.wait_online(['veth99:routable', 'veth-peer:routable'])
|
|
|
|
@@ -5189,7 +5197,8 @@ class NetworkdDHCPClientTests(unittest.TestCase, Utilities):
|
|
|
|
|
f.write('\n[DHCPv6]\nRapidCommit=no\n')
|
|
|
|
|
|
|
|
|
|
stop_dnsmasq()
|
|
|
|
|
start_dnsmasq('--dhcp-option=option6:dns-server,[2600::ee]',
|
|
|
|
|
start_dnsmasq('--dhcp-option=108,00:00:02:00',
|
|
|
|
|
'--dhcp-option=option6:dns-server,[2600::ee]',
|
|
|
|
|
'--dhcp-option=option6:ntp-server,[2600::ff]')
|
|
|
|
|
|
|
|
|
|
networkctl_reload()
|
|
|
|
@@ -5238,16 +5247,30 @@ class NetworkdDHCPClientTests(unittest.TestCase, Utilities):
|
|
|
|
|
# Note that at this point the DHCPv6 client has not been started because no RA (with managed
|
|
|
|
|
# bit set) has yet been received and the configuration does not include WithoutRA=true
|
|
|
|
|
state = get_dhcp6_client_state('veth99')
|
|
|
|
|
print(f"State = {state}")
|
|
|
|
|
print(f"DHCPv6 client state = {state}")
|
|
|
|
|
self.assertEqual(state, 'stopped')
|
|
|
|
|
|
|
|
|
|
start_dnsmasq()
|
|
|
|
|
state = get_dhcp4_client_state('veth99')
|
|
|
|
|
print(f"DHCPv4 client state = {state}")
|
|
|
|
|
self.assertEqual(state, 'selecting')
|
|
|
|
|
|
|
|
|
|
start_dnsmasq('--dhcp-option=108,00:00:02:00')
|
|
|
|
|
self.wait_online(['veth99:routable', 'veth-peer:routable'])
|
|
|
|
|
|
|
|
|
|
state = get_dhcp6_client_state('veth99')
|
|
|
|
|
print(f"State = {state}")
|
|
|
|
|
print(f"DHCPv6 client state = {state}")
|
|
|
|
|
self.assertEqual(state, 'bound')
|
|
|
|
|
|
|
|
|
|
# DHCPv4 client will stop after an DHCPOFFER message received, so we need to wait for a while.
|
|
|
|
|
for _ in range(100):
|
|
|
|
|
state = get_dhcp4_client_state('veth99')
|
|
|
|
|
if state == 'stopped':
|
|
|
|
|
break
|
|
|
|
|
time.sleep(.2)
|
|
|
|
|
|
|
|
|
|
print(f"DHCPv4 client state = {state}")
|
|
|
|
|
self.assertEqual(state, 'stopped')
|
|
|
|
|
|
|
|
|
|
def test_dhcp_client_ipv6_only_with_custom_client_identifier(self):
|
|
|
|
|
copy_network_unit('25-veth.netdev', '25-dhcp-server-veth-peer.network', '25-dhcp-client-ipv6-only-custom-client-identifier.network')
|
|
|
|
|
|
|
|
|
@@ -5493,6 +5516,18 @@ class NetworkdDHCPClientTests(unittest.TestCase, Utilities):
|
|
|
|
|
print(f"State = {state}")
|
|
|
|
|
self.assertEqual(state, 'bound')
|
|
|
|
|
|
|
|
|
|
def test_dhcp_client_ipv6_only_mode_without_ipv6_connectivity(self):
|
|
|
|
|
copy_network_unit('25-veth.netdev',
|
|
|
|
|
'25-dhcp-server-ipv6-only-mode.network',
|
|
|
|
|
'25-dhcp-client-ipv6-only-mode.network')
|
|
|
|
|
start_networkd()
|
|
|
|
|
self.wait_online(['veth99:routable', 'veth-peer:routable'], timeout='40s')
|
|
|
|
|
self.wait_address('veth99', r'inet 192.168.5.[0-9]*/24', ipv='-4')
|
|
|
|
|
|
|
|
|
|
state = get_dhcp4_client_state('veth99')
|
|
|
|
|
print(f"State = {state}")
|
|
|
|
|
self.assertEqual(state, 'bound')
|
|
|
|
|
|
|
|
|
|
def test_dhcp_client_ipv4_use_routes_gateway(self):
|
|
|
|
|
first = True
|
|
|
|
|
for (routes, gateway, dns_and_ntp_routes, classless) in itertools.product([True, False], repeat=4):
|
|
|
|
|