From 49f6e9a38567c39ddc1f5b139790dd655b2a4d06 Mon Sep 17 00:00:00 2001 From: zmw12306 Date: Sat, 5 Apr 2025 14:00:41 -0400 Subject: [PATCH] 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 --- babeld/message.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/babeld/message.c b/babeld/message.c index 5a33d5c288..40e2d20ee0 100644 --- a/babeld/message.c +++ b/babeld/message.c @@ -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; } -- 2.39.5