On 27/04/16(Wed) 18:13, Martin Pieuchot wrote:
> gif(4) is the only p2p interface for which the kernel does some kind of
> link-layer address resolution when it comes to IPv6 & ND.
> 
> I don't believe this is necessary because we do not install any cloning
> route on p2p interfaces.  However the rt_checkgate() call *is* necessary
> because your default IPv6 route, or any gateway route, might go through
> your tunnel.
> 
> So the diff below removes gif(4) interfaces from the list of interfaces
> that need a link-layer cache and move the check *after* calling
> rt_checkgate().  This way all the p2p-specific code in nd6_output()
> can go away.
> 
> I'd like to hear from people using such setup to know if this break
> anything.

Here's a non broken diff, thanks to naddy@ for finding that.

Index: netinet6/nd6.c
===================================================================
RCS file: /cvs/src/sys/netinet6/nd6.c,v
retrieving revision 1.178
diff -u -p -r1.178 nd6.c
--- netinet6/nd6.c      27 Apr 2016 14:47:27 -0000      1.178
+++ netinet6/nd6.c      7 May 2016 11:49:28 -0000
@@ -1512,9 +1512,6 @@ nd6_output(struct ifnet *ifp, struct mbu
        if (IN6_IS_ADDR_MULTICAST(&dst->sin6_addr))
                goto sendpkt;
 
-       if (nd6_need_cache(ifp) == 0)
-               goto sendpkt;
-
        /*
         * next hop determination.
         */
@@ -1524,21 +1521,11 @@ nd6_output(struct ifnet *ifp, struct mbu
                        m_freem(m);
                        return (error);
                }
-
-               /*
-                * We skip link-layer address resolution and NUD
-                * if the gateway is not a neighbor from ND point
-                * of view, regardless of the value of nd_ifinfo.flags.
-                * The second condition is a bit tricky; we skip
-                * if the gateway is our own address, which is
-                * sometimes used to install a route to a p2p link.
-                */
-               if ((ifp->if_flags & IFF_POINTOPOINT) &&
-                   ((nd6_is_addr_neighbor(satosin6(rt_key(rt)), ifp) == 0) ||
-                   in6ifa_ifpwithaddr(ifp, &satosin6(rt_key(rt))->sin6_addr)))
-                       goto sendpkt;
        }
 
+       if (nd6_need_cache(ifp) == 0)
+               goto sendpkt;
+
        /*
         * Address resolution or Neighbor Unreachability Detection
         * for the next hop.
@@ -1565,8 +1552,7 @@ nd6_output(struct ifnet *ifp, struct mbu
                }
        }
        if (ln == NULL || rt == NULL) {
-               if ((ifp->if_flags & IFF_POINTOPOINT) == 0 &&
-                   !(ND_IFINFO(ifp)->flags & ND6_IFF_PERFORMNUD)) {
+               if ((ND_IFINFO(ifp)->flags & ND6_IFF_PERFORMNUD) == 0) {
                        char addr[INET6_ADDRSTRLEN];
 
                        log(LOG_DEBUG, "%s: can't allocate llinfo for %s "
@@ -1591,13 +1577,6 @@ nd6_output(struct ifnet *ifp, struct mbu
        TAILQ_REMOVE(&nd6_list, ln, ln_list);
        TAILQ_INSERT_HEAD(&nd6_list, ln, ln_list);
 
-       /* We don't have to do link-layer address resolution on a p2p link. */
-       if ((ifp->if_flags & IFF_POINTOPOINT) != 0 &&
-           ln->ln_state < ND6_LLINFO_REACHABLE) {
-               ln->ln_state = ND6_LLINFO_STALE;
-               nd6_llinfo_settimer(ln, (long)nd6_gctimer * hz);
-       }
-
        /*
         * The first time we send a packet to a neighbor whose entry is
         * STALE, we have to change the state to DELAY and a sets a timer to
@@ -1658,11 +1637,8 @@ nd6_need_cache(struct ifnet *ifp)
         */
        switch (ifp->if_type) {
        case IFT_ETHER:
-       case IFT_IEEE1394:
-       case IFT_PROPVIRTUAL:
        case IFT_IEEE80211:
        case IFT_CARP:
-       case IFT_GIF:           /* XXX need more cases? */
                return (1);
        default:
                return (0);

Reply via email to