mirror of
https://github.com/systemd/systemd.git
synced 2024-11-23 18:23:32 +08:00
network/ndisc: several cleanups for ndisc_remove_route()
- drop unnecessary call of ndisc_set_route_priority() at the beginning, as it is called later in the loop below, - use RET_GATHER() and remove all possible routes even if failed.
This commit is contained in:
parent
2437ebee20
commit
42d9660f10
@ -292,14 +292,12 @@ static int ndisc_request_router_route(Route *route, Link *link, sd_ndisc_router
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int ndisc_remove_route(Route *route, Link *link) {
|
static int ndisc_remove_route(Route *route, Link *link) {
|
||||||
int r;
|
int r, ret = 0;
|
||||||
|
|
||||||
assert(route);
|
assert(route);
|
||||||
assert(link);
|
assert(link);
|
||||||
assert(link->manager);
|
assert(link->manager);
|
||||||
|
|
||||||
ndisc_set_route_priority(link, route);
|
|
||||||
|
|
||||||
if (!route->table_set)
|
if (!route->table_set)
|
||||||
route->table = link_get_ndisc_route_table(link);
|
route->table = link_get_ndisc_route_table(link);
|
||||||
|
|
||||||
@ -331,9 +329,7 @@ static int ndisc_remove_route(Route *route, Link *link) {
|
|||||||
if (existing->source == NETWORK_CONFIG_SOURCE_STATIC)
|
if (existing->source == NETWORK_CONFIG_SOURCE_STATIC)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
r = route_remove_and_cancel(existing, link->manager);
|
RET_GATHER(ret, route_remove_and_cancel(existing, link->manager));
|
||||||
if (r < 0)
|
|
||||||
return r;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Then, check if the route exists. */
|
/* Then, check if the route exists. */
|
||||||
@ -341,13 +337,11 @@ static int ndisc_remove_route(Route *route, Link *link) {
|
|||||||
if (existing->source == NETWORK_CONFIG_SOURCE_STATIC)
|
if (existing->source == NETWORK_CONFIG_SOURCE_STATIC)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
r = route_remove_and_cancel(existing, link->manager);
|
RET_GATHER(ret, route_remove_and_cancel(existing, link->manager));
|
||||||
if (r < 0)
|
|
||||||
return r;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int ndisc_address_handler(sd_netlink *rtnl, sd_netlink_message *m, Request *req, Link *link, Address *address) {
|
static int ndisc_address_handler(sd_netlink *rtnl, sd_netlink_message *m, Request *req, Link *link, Address *address) {
|
||||||
|
Loading…
Reference in New Issue
Block a user