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

Toke Høiland-Jørgensen toke at toke.dk
Mon Dec 9 10:51:28 CET 2024


Fabian Bläse <fabian at blaese.de> writes:

> 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)))

I'd drop the extra parentheses around gt_mod64k(), but otherwise LGTM!

Reviewed-by: Toke Høiland-Jørgensen <toke at toke.dk>



More information about the Bird-users mailing list