network/ndisc: introduce route_is_bound_to_link() helper function and use it where applicable
No functional change, and preparation for later commits.
This commit is contained in:
@@ -2062,7 +2062,7 @@ static int ndisc_drop_outdated(Link *link, const struct in6_addr *router, usec_t
|
||||
if (route->source != NETWORK_CONFIG_SOURCE_NDISC)
|
||||
continue;
|
||||
|
||||
if (route->nexthop.ifindex != link->ifindex)
|
||||
if (!route_is_bound_to_link(route, link))
|
||||
continue;
|
||||
|
||||
if (route->protocol == RTPROT_REDIRECT)
|
||||
@@ -2198,7 +2198,7 @@ static int ndisc_setup_expire(Link *link) {
|
||||
if (route->source != NETWORK_CONFIG_SOURCE_NDISC)
|
||||
continue;
|
||||
|
||||
if (route->nexthop.ifindex != link->ifindex)
|
||||
if (!route_is_bound_to_link(route, link))
|
||||
continue;
|
||||
|
||||
if (!route_exists(route))
|
||||
@@ -2436,7 +2436,7 @@ static int ndisc_neighbor_handle_router_message(Link *link, sd_ndisc_neighbor *n
|
||||
if (route->source != NETWORK_CONFIG_SOURCE_NDISC)
|
||||
continue;
|
||||
|
||||
if (route->nexthop.ifindex != link->ifindex)
|
||||
if (!route_is_bound_to_link(route, link))
|
||||
continue;
|
||||
|
||||
if (!in6_addr_equal(&route->provider.in6, &original_address))
|
||||
@@ -2729,7 +2729,7 @@ int link_drop_ndisc_config(Link *link, Network *network) {
|
||||
if (route->source != NETWORK_CONFIG_SOURCE_NDISC)
|
||||
continue;
|
||||
|
||||
if (route->nexthop.ifindex != link->ifindex)
|
||||
if (!route_is_bound_to_link(route, link))
|
||||
continue;
|
||||
|
||||
if (route->protocol == RTPROT_REDIRECT)
|
||||
|
||||
@@ -352,6 +352,18 @@ static int route_get_link(Manager *manager, const Route *route, Link **ret) {
|
||||
return route_nexthop_get_link(manager, &route->nexthop, ret);
|
||||
}
|
||||
|
||||
bool route_is_bound_to_link(const Route *route, Link *link) {
|
||||
assert(route);
|
||||
assert(link);
|
||||
assert(link->manager);
|
||||
|
||||
Link *route_link;
|
||||
if (route_get_link(link->manager, route, &route_link) < 0)
|
||||
return false;
|
||||
|
||||
return route_link->ifindex == link->ifindex;
|
||||
}
|
||||
|
||||
int route_get_request(Manager *manager, const Route *route, Request **ret) {
|
||||
Request *req;
|
||||
|
||||
|
||||
@@ -100,6 +100,7 @@ int route_remove(Route *route, Manager *manager);
|
||||
int route_remove_and_cancel(Route *route, Manager *manager);
|
||||
|
||||
int route_get(Manager *manager, const Route *route, Route **ret);
|
||||
bool route_is_bound_to_link(const Route *route, Link *link);
|
||||
int route_get_request(Manager *manager, const Route *route, Request **ret);
|
||||
|
||||
bool route_can_update(const Route *existing, const Route *requesting);
|
||||
|
||||
Reference in New Issue
Block a user