[Differential] D9451: Constrain IPv6 interface routes to each FIB

jhujhiti_adjectivism.org (Erick Turnquist) phabric-noreply at FreeBSD.org
Mon Mar 6 05:12:47 UTC 2017


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


More information about the freebsd-net mailing list