Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 6 Mar 2017 05:12:46 +0000
From:      "jhujhiti_adjectivism.org (Erick Turnquist)" <phabric-noreply@FreeBSD.org>
To:        freebsd-net@freebsd.org
Subject:   [Differential] D9451: Constrain IPv6 interface routes to each FIB
Message-ID:  <51b001cb7f7d0dbf9c31ab6695400b7e@localhost.localdomain>
In-Reply-To: <differential-rev-PHID-DREV-xl62ljmjgot45obmsgfw-req@FreeBSD.org>
References:  <differential-rev-PHID-DREV-xl62ljmjgot45obmsgfw-req@FreeBSD.org>

next in thread | previous in thread | raw e-mail | index | archive | help

jhujhiti_adjectivism.org added inline comments.

INLINE COMMENTS

> asomers wrote in nd6.c:1295
> Yep, it's true.  One way is to do it with static routes.  Another way involves changing the interfaces's fib.  For example, like this:
> 
>   ifconfig tap0 create
>   ifconfig tap0 10.1.0.1/24 fib 2
>   ifconfig tap0 10.1.1.1/24 fib 3 alias

That's... counter-intuitive. But given that behavior, we absolutely should check other other FIBs here. The function is already looping over all prefixes on the interface so I inserted a check of all FIBs (if necessary) inside of it.

> asomers wrote in nd6.c:1353
> The original code seems too complicated.  I think it should go a little like this (locks elided):
> 
>   if (ifp->if_flags & IFF_POINTOPOINT) {
>           TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) {
>   			if (ifa->ifa_addr->sa_family != addr->sa_family)
>   				continue;
>   			if (ifa->ifa_dstaddr != NULL &&
>   			    sa_equal(addr, ifa->ifa_dstaddr)) {
>   				return (1);
>   			}
>   		}
>   }
> 
> No unnecessary looping over either fibs or interfaces.

This seems like a good idea. Is this new code what you had in mind?

> nd6_rtr.c:574
>  	    (struct sockaddr *)&gate,
> -	    (struct sockaddr *)&mask, RTF_GATEWAY, &oldrt, RT_DEFAULT_FIB);
> +	    (struct sockaddr *)&mask, RTF_GATEWAY, &oldrt, dr->ifp->if_fib);
>  	if (oldrt) {

I'm now wondering if this is incorrect. If the interface's FIB changes after the router has been added to the list, we would fail to remove it here.

Should the default router (and maybe prefix) structs include a new field to store the FIB in which the router(/prefix) was originally learned?

REPOSITORY
  rS FreeBSD src repository

REVISION DETAIL
  https://reviews.freebsd.org/D9451

EMAIL PREFERENCES
  https://reviews.freebsd.org/settings/panel/emailpreferences/

To: jhujhiti_adjectivism.org, #network, bz, asomers
Cc: jch, bz, imp, ae, freebsd-net-list


Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?51b001cb7f7d0dbf9c31ab6695400b7e>