if (r < 0)
link_enter_failed(link);
+ r = dhcp4_request_address_and_routes(link, false);
+ if (r < 0)
+ link_enter_failed(link);
+
return 1;
}
return 0;
}
-static int dhcp4_route_remove_handler(sd_netlink *rtnl, sd_netlink_message *m, Link *link) {
- int r;
-
- assert(link);
- assert(link->dhcp4_remove_messages > 0);
-
- link->dhcp4_remove_messages--;
-
- r = link_route_remove_handler_internal(rtnl, m, link, "Failed to remove DHCPv4 route, ignoring");
- if (r <= 0)
- return r;
-
- if (link->dhcp4_remove_messages == 0) {
- r = dhcp4_request_address_and_routes(link, false);
- if (r < 0)
- link_enter_failed(link);
- }
-
- return 1;
-}
-
-static int dhcp4_address_remove_handler(sd_netlink *rtnl, sd_netlink_message *m, Link *link) {
- int r;
-
- assert(link);
- assert(link->dhcp4_remove_messages > 0);
-
- link->dhcp4_remove_messages--;
-
- r = address_remove_handler_internal(rtnl, m, link, "Failed to remove DHCPv4 address, ignoring");
- if (r <= 0)
- return r;
-
- if (link->dhcp4_remove_messages == 0) {
- r = dhcp4_request_address_and_routes(link, false);
- if (r < 0)
- link_enter_failed(link);
- }
-
- return 1;
-}
-
static int dhcp4_remove_all(Link *link) {
Route *route;
int k, r = 0;
assert(link);
SET_FOREACH(route, link->dhcp_routes) {
- k = route_remove(route, NULL, link, dhcp4_route_remove_handler);
+ k = route_remove(route, NULL, link, NULL);
if (k < 0)
r = k;
- else
- link->dhcp4_remove_messages++;
}
if (link->dhcp_address) {
- k = address_remove(link->dhcp_address, link, dhcp4_address_remove_handler);
+ k = address_remove(link->dhcp_address, link, NULL);
if (k < 0)
r = k;
- else
- link->dhcp4_remove_messages++;
}
return r;