network: dhcp4: re-request DHCP4 address and routes immediately
It is not necessary to wait for removal is finished, as network queue already do the same thing.
This commit is contained in:
@@ -180,6 +180,10 @@ static int dhcp4_route_handler(sd_netlink *rtnl, sd_netlink_message *m, Link *li
|
||||
if (r < 0)
|
||||
link_enter_failed(link);
|
||||
|
||||
r = dhcp4_request_address_and_routes(link, false);
|
||||
if (r < 0)
|
||||
link_enter_failed(link);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -712,48 +716,6 @@ static int dhcp_reset_hostname(Link *link) {
|
||||
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;
|
||||
@@ -761,19 +723,15 @@ static int dhcp4_remove_all(Link *link) {
|
||||
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;
|
||||
|
||||
@@ -111,7 +111,6 @@ typedef struct Link {
|
||||
char *lease_file;
|
||||
uint32_t original_mtu;
|
||||
unsigned dhcp4_messages;
|
||||
unsigned dhcp4_remove_messages;
|
||||
sd_ipv4acd *dhcp_acd;
|
||||
bool dhcp4_route_failed:1;
|
||||
bool dhcp4_route_retrying:1;
|
||||
|
||||
Reference in New Issue
Block a user