]> git.puffer.fish Git - matthieu/frr.git/commitdiff
babeld: Fix starvation handling on route loss per RFC 8966 ยง3.8.2.1
authorzmw12306 <zmw12306@gmail.com>
Sat, 5 Apr 2025 18:26:32 +0000 (14:26 -0400)
committerzmw12306 <zmw12306@gmail.com>
Sat, 5 Apr 2025 18:26:32 +0000 (14:26 -0400)
When all feasible routes to a destination are lost, but unexpired unfeasible routes exist, the node MUST send a seqno request to prevent starvation.

Signed-off-by: zmw12306 <zmw12306@gmail.com>
babeld/route.c

index 466f41383cb8036697b9cb3925d510a8241bfab8..eefc5c94df1e542055b992881829f6deaadd6793 100644 (file)
@@ -1078,17 +1078,26 @@ route_lost(struct source *src, unsigned oldmetric)
     new_route = find_best_route(src->prefix, src->plen, 1, NULL);
     if(new_route) {
         consider_route(new_route);
-    } else if(oldmetric < INFINITY) {
-        /* Avoid creating a blackhole. */
-        send_update_resend(NULL, src->prefix, src->plen);
-        /* If the route was usable enough, try to get an alternate one.
-           If it was not, we could be dealing with oscillations around
-           the value of INFINITY. */
-        if(oldmetric <= INFINITY / 2)
+    } else {
+        struct babel_route *unfeasible = find_best_route(src->prefix, src->plen, 0, NULL);
+
+        if(unfeasible && !route_expired(unfeasible)) {
+            /* MUST send seqno request when we have unexpired unfeasible routes */
             send_request_resend(NULL, src->prefix, src->plen,
-                                src->metric >= INFINITY ?
-                                src->seqno : seqno_plus(src->seqno, 1),
+                                seqno_plus(src->seqno, 1),
                                 src->id);
+        } else if(oldmetric < INFINITY) {
+            /* Avoid creating a blackhole. */
+            send_update_resend(NULL, src->prefix, src->plen);
+            /* If the route was usable enough, try to get an alternate one.
+            If it was not, we could be dealing with oscillations around
+            the value of INFINITY. */
+            if(oldmetric <= INFINITY / 2)
+                send_request_resend(NULL, src->prefix, src->plen,
+                                    src->metric >= INFINITY ?
+                                    src->seqno : seqno_plus(src->seqno, 1),
+                                    src->id);
+        }
     }
 }