babeld: Request forwarding does not prioritize feasible routes

Modify route selection to check feasibility first, then fall back to non-feasible routes as per SHOULD requirement.

Signed-off-by: zmw12306 <zmw12306@gmail.com>
This commit is contained in:
zmw12306 2025-04-05 14:00:41 -04:00
parent 44c4743e08
commit 49f6e9a385

View file

@ -1905,8 +1905,14 @@ handle_request(struct neighbour *neigh, const unsigned char *prefix,
/* We were about to forward a request to its requestor. Try to
find a different neighbour to forward the request to. */
struct babel_route *other_route;
/* First try feasible routes as required by RFC */
other_route = find_best_route(prefix, plen, 1, neigh);
other_route = find_best_route(prefix, plen, 0, neigh);
if(!other_route || route_metric(other_route) >= INFINITY) {
/* If no feasible route found, try non-feasible routes */
other_route = find_best_route(prefix, plen, 0, neigh);
}
if(other_route && route_metric(other_route) < INFINITY)
successor = other_route->neigh;
}