device: check ext_ip6_config_captured for ll_addr in dhcp6_start_with_link_ready()
We should not check ip6_config for the link local address because ip6_config contains the merged settings we want to configure, not the addresses that are actually configured on the device. Check ext_ip6_config_captured for that. Also, reuse nm_ip6_config_get_address_first_nontentative() which only takes an address after it survived DAD.
This commit is contained in:
@@ -5284,9 +5284,7 @@ dhcp6_start_with_link_ready (NMDevice *self, NMConnection *connection)
|
|||||||
GByteArray *tmp = NULL;
|
GByteArray *tmp = NULL;
|
||||||
const guint8 *hw_addr;
|
const guint8 *hw_addr;
|
||||||
size_t hw_addr_len = 0;
|
size_t hw_addr_len = 0;
|
||||||
const struct in6_addr *ll_addr = NULL;
|
const NMPlatformIP6Address *ll_addr = NULL;
|
||||||
NMIP6Config *ip6_config;
|
|
||||||
int i;
|
|
||||||
|
|
||||||
g_assert (connection);
|
g_assert (connection);
|
||||||
s_ip6 = nm_connection_get_setting_ip6_config (connection);
|
s_ip6 = nm_connection_get_setting_ip6_config (connection);
|
||||||
@@ -5298,22 +5296,16 @@ dhcp6_start_with_link_ready (NMDevice *self, NMConnection *connection)
|
|||||||
g_byte_array_append (tmp, hw_addr, hw_addr_len);
|
g_byte_array_append (tmp, hw_addr, hw_addr_len);
|
||||||
}
|
}
|
||||||
|
|
||||||
ip6_config = priv->ip6_config;
|
if (priv->ext_ip6_config_captured)
|
||||||
for (i = 0; ip6_config && i < nm_ip6_config_get_num_addresses (ip6_config); i++) {
|
ll_addr = nm_ip6_config_get_address_first_nontentative (priv->ext_ip6_config_captured, TRUE);
|
||||||
const NMPlatformIP6Address *addr = nm_ip6_config_get_address (ip6_config, i);
|
|
||||||
|
|
||||||
if (IN6_IS_ADDR_LINKLOCAL (&addr->address)) {
|
|
||||||
ll_addr = &addr->address;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
g_return_val_if_fail (ll_addr, FALSE);
|
g_return_val_if_fail (ll_addr, FALSE);
|
||||||
|
|
||||||
priv->dhcp6_client = nm_dhcp_manager_start_ip6 (nm_dhcp_manager_get (),
|
priv->dhcp6_client = nm_dhcp_manager_start_ip6 (nm_dhcp_manager_get (),
|
||||||
nm_device_get_ip_iface (self),
|
nm_device_get_ip_iface (self),
|
||||||
nm_device_get_ip_ifindex (self),
|
nm_device_get_ip_ifindex (self),
|
||||||
tmp,
|
tmp,
|
||||||
ll_addr,
|
&ll_addr->address,
|
||||||
nm_connection_get_uuid (connection),
|
nm_connection_get_uuid (connection),
|
||||||
nm_device_get_ip6_route_metric (self),
|
nm_device_get_ip6_route_metric (self),
|
||||||
nm_setting_ip_config_get_dhcp_send_hostname (s_ip6),
|
nm_setting_ip_config_get_dhcp_send_hostname (s_ip6),
|
||||||
|
Reference in New Issue
Block a user