Index | Thread | Search

From:
Theo Buehler <tb@theobuehler.org>
Subject:
Re: bgpd: memset the right struct member
To:
tech@openbsd.org
Date:
Tue, 11 Feb 2025 15:20:39 +0100

Download raw body.

Thread
On Tue, Feb 11, 2025 at 03:06:37PM +0100, Claudio Jeker wrote:
> In capa_neg_calc() memset the ext_nh array in the RFC 8950 bits of the
> function. This is a copy paste error from the ADD_PATH block below.

ok

> I doubt there are any consequences because of this (at least as mentioned
> add-path is handled later).

Yes, it seems harmless, sorry for missing that.

> 
> Found while working on something else.
> -- 
> :wq Claudio
> 
> Index: session.c
> ===================================================================
> RCS file: /cvs/src/usr.sbin/bgpd/session.c,v
> diff -u -p -r1.510 session.c
> --- session.c	6 Feb 2025 12:38:58 -0000	1.510
> +++ session.c	11 Feb 2025 14:03:38 -0000
> @@ -2867,7 +2867,7 @@ capa_neg_calc(struct peer *p)
>  	    p->capa.peer.grestart.grnotification) != 0;
>  
>  	/* RFC 8950 extended nexthop encoding: both sides need to agree */
> -	memset(p->capa.neg.add_path, 0, sizeof(p->capa.neg.add_path));
> +	memset(p->capa.neg.ext_nh, 0, sizeof(p->capa.neg.ext_nh));
>  	for (i = AID_MIN; i < AID_MAX; i++) {
>  		if (p->capa.neg.mp[i] == 0)
>  			continue;
>