summaryrefslogtreecommitdiff
path: root/src/network/networkd-link.c
diff options
context:
space:
mode:
authorTom Gundersen <teg@jklm.no>2015-11-16 17:43:08 +0100
committerTom Gundersen <teg@jklm.no>2015-11-17 14:17:41 +0100
commitc601ebf79f0c54be14d3c16f0f484c0335cdeec4 (patch)
treec13fb6b3eb731d5f885bf0bed63935d84bb6fc02 /src/network/networkd-link.c
parentfb84d8966e5ce49b0c705768bb4da4956c4e529a (diff)
sd-dhcp6-client: bind to link-local address
This ensures that several DHCPv6 clients can run on separate interfaces simultaneously.
Diffstat (limited to 'src/network/networkd-link.c')
-rw-r--r--src/network/networkd-link.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/src/network/networkd-link.c b/src/network/networkd-link.c
index ba64473cd3..01d5942ce5 100644
--- a/src/network/networkd-link.c
+++ b/src/network/networkd-link.c
@@ -615,7 +615,7 @@ void link_check_ready(Link *link) {
return;
if (link_ipv6ll_enabled(link))
- if (!link->ipv6ll_address)
+ if (in_addr_is_null(AF_INET6, (const union in_addr_union*) &link->ipv6ll_address) > 0)
return;
if ((link_dhcp4_enabled(link) && !link_dhcp6_enabled(link) &&
@@ -1260,9 +1260,14 @@ static int link_acquire_ipv6_conf(Link *link) {
if (link_dhcp6_enabled(link)) {
assert(link->dhcp6_client);
+ assert(in_addr_is_link_local(AF_INET6, (const union in_addr_union*)&link->ipv6ll_address) > 0);
log_link_debug(link, "Acquiring DHCPv6 lease");
+ 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)
return log_link_warning_errno(link, r, "Could not acquire DHCPv6 lease: %m");
@@ -2122,7 +2127,7 @@ static int link_configure(Link *link) {
if (r < 0)
return r;
- if (link->ipv6ll_address) {
+ if (in_addr_is_null(AF_INET6, (const union in_addr_union*) &link->ipv6ll_address) == 0) {
r = link_acquire_ipv6_conf(link);
if (r < 0)
return r;
@@ -2473,14 +2478,14 @@ failed:
return r;
}
-int link_ipv6ll_gained(Link *link) {
+int link_ipv6ll_gained(Link *link, const struct in6_addr *address) {
int r;
assert(link);
log_link_info(link, "Gained IPv6LL");
- link->ipv6ll_address = true;
+ link->ipv6ll_address = *address;
link_check_ready(link);
if (!IN_SET(link->state, LINK_STATE_PENDING, LINK_STATE_PENDING, LINK_STATE_UNMANAGED, LINK_STATE_FAILED)) {