Index | Thread | Search

From:
Theo Buehler <tb@theobuehler.org>
Subject:
Re: bgpd: consider IPv6 lladdr as connected
To:
tech@openbsd.org
Date:
Fri, 7 Jun 2024 10:45:20 +0200

Download raw body.

Thread
On Fri, Jun 07, 2024 at 10:33:00AM +0200, Claudio Jeker wrote:
> In the session engine get_alternate_addr() is used to figure out a)
> the local address of the oposite address family and b) decide if the
> connection is directly attached and in that case set the interface scope
> for the session. This allows the remote end to send IPv6 link local nexthops.
> 
> Now especially with IFF_POINTOPOINT interfaces only deciding based on the
> destination address is too strict. Many IPv6 P2P setups don't set the dest
> addr or set it but still use link-local addresses on the link.
> 
> To fix this consider IPv6 connections from link local addresses as 
> connected. This should help when using IPv6 link local sessions.

Totally makes sense to me

ok tb

> -- 
> :wq Claudio
> 
> Index: session.c
> ===================================================================
> RCS file: /cvs/src/usr.sbin/bgpd/session.c,v
> diff -u -p -r1.478 session.c
> --- session.c	22 May 2024 08:41:14 -0000	1.478
> +++ session.c	5 Jun 2024 08:46:46 -0000
> @@ -1254,7 +1254,11 @@ get_alternate_addr(struct bgpd_addr *loc
>  		    match->ifa_addr->sa_family != AF_INET6)
>  			continue;
>  		if (sa_equal(local, match->ifa_addr)) {
> -			if (match->ifa_flags & IFF_POINTOPOINT &&
> +			if (remote->aid == AID_INET6 &&
> +			    IN6_IS_ADDR_LINKLOCAL(&remote->v6)) {
> +				/* IPv6 LLA are by definition connected */
> +				connected = 1;
> +			} else if (match->ifa_flags & IFF_POINTOPOINT &&
>  			    match->ifa_dstaddr != NULL) {
>  				if (sa_equal(remote, match->ifa_dstaddr))
>  					connected = 1;
>