Do not use nd6_rtrequest() for addresses configured on loopback
authormpi <mpi@openbsd.org>
Thu, 15 May 2014 09:05:13 +0000 (09:05 +0000)
committermpi <mpi@openbsd.org>
Thu, 15 May 2014 09:05:13 +0000 (09:05 +0000)
interfaces.

ok mikeb@

sys/netinet6/in6.c
sys/netinet6/nd6.c

index 300abd6..2002651 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: in6.c,v 1.136 2014/05/05 11:44:33 mpi Exp $   */
+/*     $OpenBSD: in6.c,v 1.137 2014/05/15 09:05:13 mpi Exp $   */
 /*     $KAME: in6.c,v 1.372 2004/06/14 08:14:21 itojun Exp $   */
 
 /*
@@ -1399,7 +1399,7 @@ in6_ifinit(struct ifnet *ifp, struct in6_ifaddr *ia6, int newhost)
        /* Add ownaddr as loopback rtentry, if necessary (ex. on p2p link). */
        if (newhost) {
                /* set the rtrequest function to create llinfo */
-               if ((ifp->if_flags & IFF_POINTOPOINT) == 0)
+               if ((ifp->if_flags & (IFF_LOOPBACK | IFF_POINTOPOINT)) == 0)
                        ia6->ia_ifa.ifa_rtrequest = nd6_rtrequest;
 
                rt_ifa_addloop(&(ia6->ia_ifa));
index 4365d95..450e83b 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: nd6.c,v 1.116 2014/05/07 08:14:59 mpi Exp $   */
+/*     $OpenBSD: nd6.c,v 1.117 2014/05/15 09:05:13 mpi Exp $   */
 /*     $KAME: nd6.c,v 1.280 2002/06/08 19:52:07 itojun Exp $   */
 
 /*
@@ -1059,20 +1059,14 @@ nd6_rtrequest(int req, struct rtentry *rt)
 #endif
                /* FALLTHROUGH */
        case RTM_RESOLVE:
-               if ((ifp->if_flags & (IFF_POINTOPOINT | IFF_LOOPBACK)) == 0) {
-                       /*
-                        * Address resolution isn't necessary for a point to
-                        * point link, so we can skip this test for a p2p link.
-                        */
-                       if (gate->sa_family != AF_LINK ||
-                           gate->sa_len < sizeof(null_sdl)) {
-                               log(LOG_DEBUG, "%s: bad gateway value: %s\n",
-                                   __func__, ifp->if_xname);
-                               break;
-                       }
-                       SDL(gate)->sdl_type = ifp->if_type;
-                       SDL(gate)->sdl_index = ifp->if_index;
+               if (gate->sa_family != AF_LINK ||
+                   gate->sa_len < sizeof(null_sdl)) {
+                       log(LOG_DEBUG, "%s: bad gateway value: %s\n",
+                           __func__, ifp->if_xname);
+                       break;
                }
+               SDL(gate)->sdl_type = ifp->if_type;
+               SDL(gate)->sdl_index = ifp->if_index;
                if (ln != NULL)
                        break;  /* This happens on a route change */
                /*