On Fri, Aug 05, 2011 at 08:19:21PM +0200, Mike Belopuhov wrote:
> opinions?
Although there are other opinions, I think we should not reinvent
the wheel and use KAME where apropiate. So we should go this way.
> + if (ifp && !(ifp->if_flags & IFF_LOOPBACK))
> + sa6.sin6_addr.s6_addr16[1] =
> + htons(in6_addr2scopeid(ifp, &sa6.sin6_addr));
I think this sets the scope id also for global addresses. Should
this be more like the code in ip6_input()?
if (ifp && IN6_IS_SCOPE_EMBED(&sa6.sin6_addr))
sa6.sin6_addr.s6_addr16[1] = htons(ifp->if_index);
> + pi->ipi6_addr = sa6.sin6_addr; /* XXX: this overrides pi */
> +
> return (&pi->ipi6_addr);
Do you know, why KAME returns &ia6->ia_addr.sin6_addr?
It is more conservative to keep the code we have, so that is fine.
> + clone = IN6_IS_ADDR_MULTICAST(&dstsock->sin6_addr) ? 0 : 1;
> + if ((error = selectroute(dstsock, opts, mopts, ro, retifp,
> + &rt, clone)) != 0)
Our selectroute() function is missing the clone paramter, not the
norouteok. So you should pass 1 as last argument.
bluhm