[PATCH v2] Babel: fix seqno wrapping on seqno request

Fabian Bläse fabian at blaese.de
Sat Dec 7 21:38:10 CET 2024


The Babel seqno wraps around when reaching its maximum value
(UINT16_MAX). When comparing seqnos, this has to be taken into account.
Therefore, plain number comparisons do not work.

In a previous attempt to fix the wrapping behavior, one particular
comparison was missed. This causes the seqno of originated babel routes
to not wrap, but remain at UINT16_MAX indefinitely, resulting in slow
route propagation on topology changes.

Make use of the previously introduced gt_mod64k macro to compare seqnos
correctly.

Fixes: 3e7e4a71868bc519aacc0eb785471b46fc345a5c

Signed-off-by: Fabian Bläse <fabian at blaese.de>

---
v2: fix syntax error

 proto/babel/babel.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/proto/babel/babel.c b/proto/babel/babel.c
index fe5c0599..209492f0 100644
--- a/proto/babel/babel.c
+++ b/proto/babel/babel.c
@@ -1015,7 +1015,7 @@ babel_send_update_(struct babel_iface *ifa, btime changed, struct fib *rtable)
 
     /* Our own seqno might have changed, in which case we update the routes we
        originate. */
-    if ((e->router_id == p->router_id) && (e->seqno < p->update_seqno))
+    if ((e->router_id == p->router_id) && (gt_mod64k(p->update_seqno, e->seqno)))
     {
       e->seqno = p->update_seqno;
       e->updated = current_time();
-- 
2.47.1



More information about the Bird-users mailing list