Merge pull request #13086 from yuwata/network-dhcp6-cleanups
network: dhcp6 cleanups
This commit is contained in:
@@ -1559,7 +1559,7 @@
|
||||
<term><varname>UseDNS=</varname></term>
|
||||
<term><varname>UseNTP=</varname></term>
|
||||
<listitem>
|
||||
<para>As in the <literal>[DHCP]</literal> section.</para>
|
||||
<para>As in the <literal>[DHCPv4]</literal> section.</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
|
||||
@@ -405,21 +405,10 @@ static int dhcp6_address_handler(sd_netlink *rtnl, sd_netlink_message *m, Link *
|
||||
|
||||
r = sd_netlink_message_get_errno(m);
|
||||
if (r < 0 && r != -EEXIST) {
|
||||
if (link->rtnl_extended_attrs) {
|
||||
log_link_warning(link, "Could not set extended netlink attributes, reverting to fallback mechanism");
|
||||
|
||||
link->rtnl_extended_attrs = false;
|
||||
dhcp6_lease_address_acquired(link->dhcp6_client, link);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
log_link_error_errno(link, r, "Could not set DHCPv6 address: %m");
|
||||
|
||||
link_enter_failed(link);
|
||||
return 1;
|
||||
}
|
||||
if (r >= 0)
|
||||
} else if (r >= 0)
|
||||
(void) manager_rtnl_process_address(rtnl, m, link->manager);
|
||||
|
||||
r = link_request_set_routes(link);
|
||||
@@ -447,10 +436,8 @@ static int dhcp6_address_change(
|
||||
|
||||
addr->family = AF_INET6;
|
||||
addr->in_addr.in6 = *ip6_addr;
|
||||
|
||||
addr->flags = IFA_F_NOPREFIXROUTE;
|
||||
addr->prefixlen = 128;
|
||||
|
||||
addr->cinfo.ifa_prefered = lifetime_preferred;
|
||||
addr->cinfo.ifa_valid = lifetime_valid;
|
||||
|
||||
@@ -510,6 +497,7 @@ static void dhcp6_handler(sd_dhcp6_client *client, int event, void *userdata) {
|
||||
(void) dhcp6_lease_pd_prefix_lost(client, link);
|
||||
(void) dhcp6_prefix_remove_all(link->manager, link);
|
||||
|
||||
link_dirty(link);
|
||||
link->dhcp6_configured = false;
|
||||
break;
|
||||
|
||||
@@ -532,6 +520,7 @@ static void dhcp6_handler(sd_dhcp6_client *client, int event, void *userdata) {
|
||||
return;
|
||||
}
|
||||
|
||||
link_dirty(link);
|
||||
link->dhcp6_configured = true;
|
||||
break;
|
||||
|
||||
|
||||
@@ -605,7 +605,6 @@ static int link_new(Manager *manager, sd_netlink_message *message, Link **ret) {
|
||||
.n_ref = 1,
|
||||
.manager = manager,
|
||||
.state = LINK_STATE_PENDING,
|
||||
.rtnl_extended_attrs = true,
|
||||
.ifindex = ifindex,
|
||||
.iftype = iftype,
|
||||
.sysctl_ipv6_enabled = -1,
|
||||
|
||||
@@ -113,7 +113,6 @@ typedef struct Link {
|
||||
sd_radv *radv;
|
||||
|
||||
sd_dhcp6_client *dhcp6_client;
|
||||
bool rtnl_extended_attrs;
|
||||
|
||||
/* This is about LLDP reception */
|
||||
sd_lldp *lldp;
|
||||
|
||||
@@ -1395,7 +1395,7 @@ void manager_free(Manager *m) {
|
||||
|
||||
while ((a = hashmap_first_key(m->dhcp6_prefixes)))
|
||||
(void) dhcp6_prefix_remove(m, a);
|
||||
hashmap_free(m->dhcp6_prefixes);
|
||||
m->dhcp6_prefixes = hashmap_free(m->dhcp6_prefixes);
|
||||
|
||||
while ((link = hashmap_steal_first(m->links))) {
|
||||
if (link->dhcp6_client)
|
||||
|
||||
@@ -2905,7 +2905,7 @@ class NetworkdDHCPClientTests(unittest.TestCase, Utilities):
|
||||
self.wait_address('veth99', r'inet 192.168.5.[0-9]*/24 brd 192.168.5.255 scope global dynamic', ipv='-4')
|
||||
self.wait_address('veth99', r'inet6 2600::[0-9a-f]*/128 scope global (?:dynamic noprefixroute|noprefixroute dynamic)', ipv='-6')
|
||||
|
||||
time.sleep(10)
|
||||
time.sleep(3)
|
||||
output = check_output(*resolvectl_cmd, 'dns', 'veth99', env=env)
|
||||
print(output)
|
||||
self.assertRegex(output, '192.168.5.1')
|
||||
@@ -2923,7 +2923,7 @@ class NetworkdDHCPClientTests(unittest.TestCase, Utilities):
|
||||
self.wait_address('veth99', r'inet 192.168.5.[0-9]*/24 brd 192.168.5.255 scope global dynamic', ipv='-4')
|
||||
self.wait_address('veth99', r'inet6 2600::[0-9a-f]*/128 scope global (?:dynamic noprefixroute|noprefixroute dynamic)', ipv='-6')
|
||||
|
||||
time.sleep(10)
|
||||
time.sleep(3)
|
||||
output = check_output(*resolvectl_cmd, 'dns', 'veth99', env=env)
|
||||
print(output)
|
||||
self.assertNotRegex(output, '192.168.5.1')
|
||||
@@ -2941,7 +2941,7 @@ class NetworkdDHCPClientTests(unittest.TestCase, Utilities):
|
||||
self.wait_address('veth99', r'inet 192.168.5.[0-9]*/24 brd 192.168.5.255 scope global dynamic', ipv='-4')
|
||||
self.wait_address('veth99', r'inet6 2600::[0-9a-f]*/128 scope global (?:dynamic noprefixroute|noprefixroute dynamic)', ipv='-6')
|
||||
|
||||
time.sleep(10)
|
||||
time.sleep(3)
|
||||
output = check_output(*resolvectl_cmd, 'dns', 'veth99', env=env)
|
||||
print(output)
|
||||
self.assertRegex(output, '192.168.5.1')
|
||||
@@ -2959,7 +2959,7 @@ class NetworkdDHCPClientTests(unittest.TestCase, Utilities):
|
||||
self.wait_address('veth99', r'inet 192.168.5.[0-9]*/24 brd 192.168.5.255 scope global dynamic', ipv='-4')
|
||||
self.wait_address('veth99', r'inet6 2600::[0-9a-f]*/128 scope global (?:dynamic noprefixroute|noprefixroute dynamic)', ipv='-6')
|
||||
|
||||
time.sleep(10)
|
||||
time.sleep(3)
|
||||
output = check_output(*resolvectl_cmd, 'dns', 'veth99', env=env)
|
||||
print(output)
|
||||
self.assertRegex(output, '192.168.5.1')
|
||||
|
||||
Reference in New Issue
Block a user