tech-net archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: routing link local addresses: where to put the scope id?
> The point I'm asking all this is that I'm investigating why ipf fails to
> send TCP RSTs over link-local addresses. I've tracked this down as far as
> that ipf6_fastroute() calls nd6_output() with a gateway route, causing
> EHOSTUNREACH. My impression is that ipf_fastroute6() fails to tell the
> routing routines about the LL scope -- I just don't know whether it should
> do the KAME stuffing before calling the routing routines or whether it
> should call rtcache_setdst() with sin6_scope_id filled in?
Stuffing the scope into addr16[1] makes it work (for me).
I tested this on 7.1; I can't tell whether the pre-4.99.11 part is correct.
Shall I file a PR?
Index: ip_fil_netbsd.c
===================================================================
RCS file: /cvsroot/src/sys/external/bsd/ipf/netinet/ip_fil_netbsd.c,v
retrieving revision 1.11
diff -u -p -r1.11 ip_fil_netbsd.c
--- ip_fil_netbsd.c 25 Jul 2014 08:10:39 -0000 1.11
+++ ip_fil_netbsd.c 20 Jul 2017 13:04:22 -0000
@@ -1378,6 +1378,9 @@ ipf_fastroute6(struct mbuf *m0, struct m
sockaddr_in6_init(&u.dst6, &fdp->fd_ip6.in6, 0, 0, 0);
else
sockaddr_in6_init(&u.dst6, &fin->fin_fi.fi_dst.in6, 0, 0, 0);
+ /* KAME */
+ if (IN6_IS_ADDR_LINKLOCAL(&u.dst6.sin6_addr))
+ u.dst6.sin6_addr.s6_addr16[1] = htons(ifp->if_index);
dst = &u.dst;
rtcache_setdst(ro, dst);
@@ -1389,6 +1392,9 @@ ipf_fastroute6(struct mbuf *m0, struct m
dst6->sin6_family = AF_INET6;
dst6->sin6_len = sizeof(struct sockaddr_in6);
dst6->sin6_addr = fin->fin_fi.fi_dst.in6;
+ /* KAME */
+ if (IN6_IS_ADDR_LINKLOCAL(&dst6->sin6_addr))
+ dst6->sin6_addr.s6_addr16[1] = htons(ifp->if_index);
if (fdp != NULL) {
if (IP6_NOTZERO(&fdp->fd_ip6))
@@ -1407,15 +1413,6 @@ ipf_fastroute6(struct mbuf *m0, struct m
goto bad;
}
- /* KAME */
-# if __NetBSD_Version__ >= 499001100
- if (IN6_IS_ADDR_LINKLOCAL(&u.dst6.sin6_addr))
- u.dst6.sin6_addr.s6_addr16[1] = htons(ifp->if_index);
-# else
- if (IN6_IS_ADDR_LINKLOCAL(&dst6->sin6_addr))
- dst6->sin6_addr.s6_addr16[1] = htons(ifp->if_index);
-# endif
-
{
# if (__NetBSD_Version__ >= 106010000) && !defined(IN6_LINKMTU)
struct in6_ifextra *ife;
Home |
Main Index |
Thread Index |
Old Index