From 118a75fcde0ce0ee80d07fa6570f55e2e780895c Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Sat, 30 Jan 2016 22:31:37 +0100 Subject: [PATCH] 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. --- src/devices/nm-device.c | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/src/devices/nm-device.c b/src/devices/nm-device.c index 2a5ae8ad0..712c9d90e 100644 --- a/src/devices/nm-device.c +++ b/src/devices/nm-device.c @@ -5284,9 +5284,7 @@ dhcp6_start_with_link_ready (NMDevice *self, NMConnection *connection) GByteArray *tmp = NULL; const guint8 *hw_addr; size_t hw_addr_len = 0; - const struct in6_addr *ll_addr = NULL; - NMIP6Config *ip6_config; - int i; + const NMPlatformIP6Address *ll_addr = NULL; g_assert (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); } - ip6_config = priv->ip6_config; - for (i = 0; ip6_config && i < nm_ip6_config_get_num_addresses (ip6_config); i++) { - const NMPlatformIP6Address *addr = nm_ip6_config_get_address (ip6_config, i); + if (priv->ext_ip6_config_captured) + ll_addr = nm_ip6_config_get_address_first_nontentative (priv->ext_ip6_config_captured, TRUE); - if (IN6_IS_ADDR_LINKLOCAL (&addr->address)) { - ll_addr = &addr->address; - break; - } - } g_return_val_if_fail (ll_addr, FALSE); priv->dhcp6_client = nm_dhcp_manager_start_ip6 (nm_dhcp_manager_get (), nm_device_get_ip_iface (self), nm_device_get_ip_ifindex (self), tmp, - ll_addr, + &ll_addr->address, nm_connection_get_uuid (connection), nm_device_get_ip6_route_metric (self), nm_setting_ip_config_get_dhcp_send_hostname (s_ip6),