diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/network/networkd-address.c | 9 | ||||
-rw-r--r-- | src/network/networkd-dhcp4.c | 2 | ||||
-rw-r--r-- | src/network/networkd-dhcp6.c | 2 | ||||
-rw-r--r-- | src/network/networkd-ipv4ll.c | 6 | ||||
-rw-r--r-- | src/network/networkd-link.c | 13 | ||||
-rw-r--r-- | src/network/networkd-link.h | 2 | ||||
-rw-r--r-- | src/network/networkd-manager.c | 3 |
7 files changed, 27 insertions, 10 deletions
diff --git a/src/network/networkd-address.c b/src/network/networkd-address.c index 316ae2e4cb..f1b364f40e 100644 --- a/src/network/networkd-address.c +++ b/src/network/networkd-address.c @@ -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; } diff --git a/src/network/networkd-dhcp4.c b/src/network/networkd-dhcp4.c index 5d9bfcea7c..e2f7d69666 100644 --- a/src/network/networkd-dhcp4.c +++ b/src/network/networkd-dhcp4.c @@ -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; diff --git a/src/network/networkd-dhcp6.c b/src/network/networkd-dhcp6.c index 2f9ecf7a89..8115232e1d 100644 --- a/src/network/networkd-dhcp6.c +++ b/src/network/networkd-dhcp6.c @@ -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) { diff --git a/src/network/networkd-ipv4ll.c b/src/network/networkd-ipv4ll.c index 01ee9f9f4a..752c09d6b1 100644 --- a/src/network/networkd-ipv4ll.c +++ b/src/network/networkd-ipv4ll.c @@ -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; } diff --git a/src/network/networkd-link.c b/src/network/networkd-link.c index 9d97089576..9661704f52 100644 --- a/src/network/networkd-link.c +++ b/src/network/networkd-link.c @@ -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"); diff --git a/src/network/networkd-link.h b/src/network/networkd-link.h index b81bae3830..a94bb2f714 100644 --- a/src/network/networkd-link.h +++ b/src/network/networkd-link.h @@ -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); diff --git a/src/network/networkd-manager.c b/src/network/networkd-manager.c index 07e47b668c..2cd4f4fef7 100644 --- a/src/network/networkd-manager.c +++ b/src/network/networkd-manager.c @@ -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; |