svn commit: r296986 - head/sys/netinet6

Kristof Provost kp at FreeBSD.org
Thu Apr 7 19:13:58 UTC 2016


> On 17 Mar 2016, at 12:10, Andrey V. Elsukov <ae at FreeBSD.org> wrote:
> 
> Author: ae
> Date: Thu Mar 17 11:10:44 2016
> New Revision: 296986
> URL: https://svnweb.freebsd.org/changeset/base/296986
> 
> Log:
>  Reduce the number of local variables. Remove redundant check that inp
>  pointer isn't NULL, it is safe, because we are handling IPV6_PKTINFO
>  socket option in this block of code. Also, use in6ifa_withaddr() instead
>  of ifa_withaddr().
...
>  in6_selectsrc(uint32_t fibnum, struct so
> 		 * the interface must be specified; otherwise, ifa_ifwithaddr()
> 		 * will fail matching the address.
> 		 */
> -		bzero(&srcsock, sizeof(srcsock));
> -		srcsock.sin6_family = AF_INET6;
> -		srcsock.sin6_len = sizeof(srcsock);
> -		srcsock.sin6_addr = pi->ipi6_addr;
> +		tmp = pi->ipi6_addr;
> 		if (ifp) {
> -			error = in6_setscope(&srcsock.sin6_addr, ifp, NULL);
> +			error = in6_setscope(&tmp, ifp, &odstzone);
> 			if (error)
> 				return (error);
> 		}
> 		if (cred != NULL && (error = prison_local_ip6(cred,
> -		    &srcsock.sin6_addr, (inp != NULL &&
> -		    (inp->inp_flags & IN6P_IPV6_V6ONLY) != 0))) != 0)
> +		    &tmp, (inp->inp_flags & IN6P_IPV6_V6ONLY) != 0)) != 0)
> 			return (error);
> 
> 		/*
> @@ -262,19 +255,18 @@ in6_selectsrc(uint32_t fibnum, struct so
> 		 * ancillary data.
> 		 */
> 		if ((inp->inp_flags & INP_BINDANY) == 0) {
> -			ia6 = (struct in6_ifaddr *)ifa_ifwithaddr(
> -			    (struct sockaddr *)&srcsock);
> -			if (ia6 == NULL || (ia6->ia6_flags & (IN6_IFF_ANYCAST |
> +			ia = in6ifa_ifwithaddr(&tmp, odstzone);

I believe this breaks radvd. It tries to send out RAs with a link-local source address.
These fail with 'ERR#49 'Can't assign requested address’’.

Note that ‘tmp’ has had the zoneid embedded into it already (in6_setscope() above), so the address comparison in in6ifa_ifwithaddr() fails to match.
That leads to the EADDRNOTAVAIL error.

I don’t think this is the specific commit that broke things (at least, I don’t see how it worked before),
but I’m hoping you’ll have a better idea of what went wrong.

Regards,
Kristof


More information about the svn-src-head mailing list