]> git.ipfire.org Git - thirdparty/bird.git/commitdiff
Babel: fix seqno wrapping on seqno request
authorFabian Bläse <fabian@blaese.de>
Tue, 10 Dec 2024 01:14:06 +0000 (02:14 +0100)
committerOndrej Zajicek <santiago@crfreenet.org>
Tue, 10 Dec 2024 01:14:06 +0000 (02:14 +0100)
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.

proto/babel/babel.c

index fe5c0599a3312a1ebedefc034d1c480374405b28..b5cbb63f8591846225646953a86fb801e221601a 100644 (file)
@@ -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();