]> git.puffer.fish Git - mirror/frr.git/commitdiff
babeld: Request forwarding does not prioritize feasible routes 18581/head
authorzmw12306 <zmw12306@gmail.com>
Sat, 5 Apr 2025 18:00:41 +0000 (14:00 -0400)
committerzmw12306 <zmw12306@gmail.com>
Sat, 5 Apr 2025 18:00:41 +0000 (14:00 -0400)
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>
babeld/message.c

index 5a33d5c288ac6d6885143720f338ca99ba2f3e71..40e2d20ee06e5865981d96739a20356679e36471 100644 (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;
     }