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)
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))
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))
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)
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;
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);