networkd: link - only consider configured when all addresses are ready
We were considering a link configured whilst its IPv6 addresses were still tentative. Fixes issue #650.
This commit is contained in:
@@ -283,11 +283,20 @@ static int address_release(Address *address, Link *link) {
|
||||
}
|
||||
|
||||
int address_drop(Address *address) {
|
||||
Link *link;
|
||||
bool ready;
|
||||
|
||||
assert(address);
|
||||
|
||||
ready = address_is_ready(address);
|
||||
link = address->link;
|
||||
|
||||
address_release(address, address->link);
|
||||
address_free(address);
|
||||
|
||||
if (link && !ready)
|
||||
link_check_ready(link);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -45,7 +45,7 @@ static int dhcp4_route_handler(sd_netlink *rtnl, sd_netlink_message *m,
|
||||
|
||||
if (!link->dhcp4_messages) {
|
||||
link->dhcp4_configured = true;
|
||||
link_client_handler(link);
|
||||
link_check_ready(link);
|
||||
}
|
||||
|
||||
return 1;
|
||||
|
||||
@@ -176,7 +176,7 @@ static void dhcp6_handler(sd_dhcp6_client *client, int event, void *userdata) {
|
||||
return;
|
||||
}
|
||||
|
||||
link_client_handler(link);
|
||||
link_check_ready(link);
|
||||
}
|
||||
|
||||
static int dhcp6_configure(Link *link, int event) {
|
||||
|
||||
@@ -67,7 +67,7 @@ static int ipv4ll_address_lost(Link *link) {
|
||||
|
||||
route_remove(route, link, &link_route_remove_handler);
|
||||
|
||||
link_client_handler(link);
|
||||
link_check_ready(link);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -88,7 +88,7 @@ static int ipv4ll_route_handler(sd_netlink *rtnl, sd_netlink_message *m, void *u
|
||||
link->ipv4ll_route = true;
|
||||
|
||||
if (link->ipv4ll_address == true)
|
||||
link_client_handler(link);
|
||||
link_check_ready(link);
|
||||
|
||||
return 1;
|
||||
}
|
||||
@@ -110,7 +110,7 @@ static int ipv4ll_address_handler(sd_netlink *rtnl, sd_netlink_message *m, void
|
||||
link->ipv4ll_address = true;
|
||||
|
||||
if (link->ipv4ll_route == true)
|
||||
link_client_handler(link);
|
||||
link_check_ready(link);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -503,7 +503,10 @@ static int link_enter_configured(Link *link) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
void link_client_handler(Link *link) {
|
||||
void link_check_ready(Link *link) {
|
||||
Address *a;
|
||||
Iterator i;
|
||||
|
||||
assert(link);
|
||||
assert(link->network);
|
||||
|
||||
@@ -523,6 +526,10 @@ void link_client_handler(Link *link) {
|
||||
!link->dhcp4_configured && !link->dhcp6_configured))
|
||||
return;
|
||||
|
||||
SET_FOREACH(a, link->addresses, i)
|
||||
if (!address_is_ready(a))
|
||||
return;
|
||||
|
||||
if (link->state != LINK_STATE_CONFIGURED)
|
||||
link_enter_configured(link);
|
||||
|
||||
@@ -550,7 +557,7 @@ static int route_handler(sd_netlink *rtnl, sd_netlink_message *m, void *userdata
|
||||
if (link->link_messages == 0) {
|
||||
log_link_debug(link, "Routes set");
|
||||
link->static_configured = true;
|
||||
link_client_handler(link);
|
||||
link_check_ready(link);
|
||||
}
|
||||
|
||||
return 1;
|
||||
@@ -579,7 +586,7 @@ static int link_enter_set_routes(Link *link) {
|
||||
|
||||
if (link->link_messages == 0) {
|
||||
link->static_configured = true;
|
||||
link_client_handler(link);
|
||||
link_check_ready(link);
|
||||
} else
|
||||
log_link_debug(link, "Setting routes");
|
||||
|
||||
|
||||
@@ -126,7 +126,7 @@ int link_route_remove_handler(sd_netlink *rtnl, sd_netlink_message *m, void *use
|
||||
void link_enter_failed(Link *link);
|
||||
int link_initialized(Link *link, struct udev_device *device);
|
||||
|
||||
void link_client_handler(Link *link);
|
||||
void link_check_ready(Link *link);
|
||||
|
||||
int link_update(Link *link, sd_netlink_message *message);
|
||||
|
||||
|
||||
@@ -404,6 +404,7 @@ int manager_rtnl_process_address(sd_netlink *rtnl, sd_netlink_message *message,
|
||||
address->flags = flags;
|
||||
address->cinfo = cinfo;
|
||||
|
||||
link_check_ready(link);
|
||||
} else {
|
||||
r = address_add(link, family, &in_addr, prefixlen, &address);
|
||||
if (r < 0) {
|
||||
@@ -416,7 +417,7 @@ int manager_rtnl_process_address(sd_netlink *rtnl, sd_netlink_message *message,
|
||||
address->flags = flags;
|
||||
address->cinfo = cinfo;
|
||||
|
||||
link_save(link);
|
||||
link_check_ready(link);
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user