diff options
author | Patrik Flykt <patrik.flykt@linux.intel.com> | 2015-09-23 14:52:03 +0300 |
---|---|---|
committer | Patrik Flykt <patrik.flykt@linux.intel.com> | 2015-09-23 15:24:04 +0300 |
commit | 18d29550b5fbc4b0de334b8212d05decdd131f1b (patch) | |
tree | 23247ef4bce97dc37c93d8eff78d63357b97fd03 /src | |
parent | e66040417b52be98d41ba1230f25dea65147e8ee (diff) |
networkd: Wait for DHCPv6 before announcing link configured
Wait until DHCPv6 has acquired an address before announcing the link
to be configured. Log the DHCPv6 lease lost event.
Diffstat (limited to 'src')
-rw-r--r-- | src/network/networkd-dhcp6.c | 12 | ||||
-rw-r--r-- | src/network/networkd-link.c | 3 | ||||
-rw-r--r-- | src/network/networkd-link.h | 1 |
3 files changed, 15 insertions, 1 deletions
diff --git a/src/network/networkd-dhcp6.c b/src/network/networkd-dhcp6.c index 1d85fef907..13105c7865 100644 --- a/src/network/networkd-dhcp6.c +++ b/src/network/networkd-dhcp6.c @@ -147,7 +147,9 @@ static void dhcp6_handler(sd_dhcp6_client *client, int event, void *userdata) { case SD_DHCP6_CLIENT_EVENT_STOP: case SD_DHCP6_CLIENT_EVENT_RESEND_EXPIRE: case SD_DHCP6_CLIENT_EVENT_RETRANS_MAX: - log_link_debug(link, "DHCPv6 event %d", event); + log_link_warning(link, "DHCPv6 lease lost"); + + link->dhcp6_configured = false; break; case SD_DHCP6_CLIENT_EVENT_IP_ACQUIRE: @@ -165,6 +167,7 @@ static void dhcp6_handler(sd_dhcp6_client *client, int event, void *userdata) { return; } + link->dhcp6_configured = true; break; default: @@ -176,6 +179,8 @@ static void dhcp6_handler(sd_dhcp6_client *client, int event, void *userdata) { event); return; } + + link_client_handler(link); } static int dhcp6_configure(Link *link, int event) { @@ -187,6 +192,8 @@ static int dhcp6_configure(Link *link, int event) { SD_ICMP6_ND_EVENT_ROUTER_ADVERTISMENT_OTHER, SD_ICMP6_ND_EVENT_ROUTER_ADVERTISMENT_MANAGED), -EINVAL); + link->dhcp6_configured = false; + if (link->dhcp6_client) { r = sd_dhcp6_client_get_information_request(link->dhcp6_client, &information_request); @@ -221,6 +228,9 @@ static int dhcp6_configure(Link *link, int event) { goto error; } + if (r == -EALREADY) + link->dhcp6_configured = true; + return r; } diff --git a/src/network/networkd-link.c b/src/network/networkd-link.c index 86f1c3bb1a..0a7e75c89c 100644 --- a/src/network/networkd-link.c +++ b/src/network/networkd-link.c @@ -504,6 +504,9 @@ void link_client_handler(Link *link) { if (link_dhcp4_enabled(link) && !link->dhcp4_configured) return; + if (link_dhcp6_enabled(link) && !link->dhcp6_configured) + return; + if (link->state != LINK_STATE_CONFIGURED) link_enter_configured(link); diff --git a/src/network/networkd-link.h b/src/network/networkd-link.h index f588faf209..7b219c6854 100644 --- a/src/network/networkd-link.h +++ b/src/network/networkd-link.h @@ -91,6 +91,7 @@ struct Link { uint16_t original_mtu; unsigned dhcp4_messages; bool dhcp4_configured; + bool dhcp6_configured; sd_ipv4ll *ipv4ll; bool ipv4ll_address; |