[networkd-ndisc] set IPv6LL address in DHCP client
authortomty89 <tom.ty89@gmail.com>
Fri, 20 May 2016 10:20:24 +0000 (18:20 +0800)
committertomty89 <tom.ty89@gmail.com>
Fri, 20 May 2016 10:20:24 +0000 (18:20 +0800)
Fix issue #3256 and probably #1982. Referenced link_acquire_ipv6_conf() in networkd-link.c.

src/network/networkd-ndisc.c

index b22c58b..78f02cf 100644 (file)
@@ -157,6 +157,10 @@ static void ndisc_router_handler(sd_ndisc *nd, uint8_t flags, const struct in6_a
                 if (flags & ND_RA_FLAG_MANAGED)
                         dhcp6_request_address(link);
 
+                r = sd_dhcp6_client_set_local_address(link->dhcp6_client, &link->ipv6ll_address);
+                if (r < 0 && r != -EBUSY)
+                        return log_link_warning_errno(link, r, "Could not set IPv6LL address in DHCP client: %m");
+
                 r = sd_dhcp6_client_start(link->dhcp6_client);
                 if (r < 0 && r != -EBUSY)
                         log_link_warning_errno(link, r, "Starting DHCPv6 client on NDisc request failed: %m");
@@ -203,6 +207,10 @@ static void ndisc_handler(sd_ndisc *nd, int event, void *userdata) {
         case SD_NDISC_EVENT_TIMEOUT:
                 dhcp6_request_address(link);
 
+                r = sd_dhcp6_client_set_local_address(link->dhcp6_client, &link->ipv6ll_address);
+                if (r < 0 && r != -EBUSY)
+                        return log_link_warning_errno(link, r, "Could not set IPv6LL address in DHCP client: %m");
+
                 r = sd_dhcp6_client_start(link->dhcp6_client);
                 if (r < 0 && r != -EBUSY)
                         log_link_warning_errno(link, r, "Starting DHCPv6 client after NDisc timeout failed: %m");