1
0
mirror of https://github.com/systemd/systemd.git synced 2024-12-26 03:22:00 +03:00

network: dhcp4: return earlier on failure

This commit is contained in:
Yu Watanabe 2021-09-08 13:39:22 +09:00
parent 429dc05a72
commit 3596fb3600

View File

@ -135,6 +135,26 @@ static int dhcp4_after_route_configure(Request *req, void *object) {
return 0; return 0;
} }
static int dhcp4_retry(Link *link) {
int r;
assert(link);
r = dhcp4_remove_all(link);
if (r < 0)
return r;
r = link_request_static_nexthops(link, true);
if (r < 0)
return r;
r = link_request_static_routes(link, true);
if (r < 0)
return r;
return dhcp4_request_address_and_routes(link, false);
}
static int dhcp4_route_handler(sd_netlink *rtnl, sd_netlink_message *m, Link *link) { static int dhcp4_route_handler(sd_netlink *rtnl, sd_netlink_message *m, Link *link) {
int r; int r;
@ -165,19 +185,7 @@ static int dhcp4_route_handler(sd_netlink *rtnl, sd_netlink_message *m, Link *li
link->dhcp4_route_failed = false; link->dhcp4_route_failed = false;
link->dhcp4_route_retrying = true; link->dhcp4_route_retrying = true;
r = dhcp4_remove_all(link); r = dhcp4_retry(link);
if (r < 0)
link_enter_failed(link);
r = link_request_static_nexthops(link, true);
if (r < 0)
link_enter_failed(link);
r = link_request_static_routes(link, true);
if (r < 0)
link_enter_failed(link);
r = dhcp4_request_address_and_routes(link, false);
if (r < 0) if (r < 0)
link_enter_failed(link); link_enter_failed(link);