Author: hrs
Date: Wed Jul 31 16:24:49 2013
New Revision: 253841
URL: http://svnweb.freebsd.org/changeset/base/253841

Log:
  Allocate in6_ifextra (ifp->if_afdata[AF_INET6]) only for IPv6-capable
  interfaces.  This eliminates unnecessary IPv6 processing for non-IPv6
  interfaces.
  
  MFC after:    3 days

Modified:
  head/sys/netinet6/in6.c
  head/sys/netinet6/in6_ifattach.c
  head/sys/netinet6/nd6.c

Modified: head/sys/netinet6/in6.c
==============================================================================
--- head/sys/netinet6/in6.c     Wed Jul 31 15:55:01 2013        (r253840)
+++ head/sys/netinet6/in6.c     Wed Jul 31 16:24:49 2013        (r253841)
@@ -2746,6 +2746,13 @@ in6_domifattach(struct ifnet *ifp)
 {
        struct in6_ifextra *ext;
 
+       /* There are not IPv6-capable interfaces. */
+       switch (ifp->if_type) {
+       case IFT_PFLOG:
+       case IFT_PFSYNC:
+       case IFT_USB:
+               return (NULL);
+       }
        ext = (struct in6_ifextra *)malloc(sizeof(*ext), M_IFADDR, M_WAITOK);
        bzero(ext, sizeof(*ext));
 

Modified: head/sys/netinet6/in6_ifattach.c
==============================================================================
--- head/sys/netinet6/in6_ifattach.c    Wed Jul 31 15:55:01 2013        
(r253840)
+++ head/sys/netinet6/in6_ifattach.c    Wed Jul 31 16:24:49 2013        
(r253841)
@@ -724,15 +724,8 @@ in6_ifattach(struct ifnet *ifp, struct i
        struct in6_ifaddr *ia;
        struct in6_addr in6;
 
-       /* some of the interfaces are inherently not IPv6 capable */
-       switch (ifp->if_type) {
-       case IFT_PFLOG:
-       case IFT_PFSYNC:
-               ND_IFINFO(ifp)->flags &= ~ND6_IFF_AUTO_LINKLOCAL;
-               ND_IFINFO(ifp)->flags |= ND6_IFF_IFDISABLED;
+       if (ifp->if_afdata[AF_INET6] == NULL)
                return;
-       }
-
        /*
         * quirks based on interface type
         */

Modified: head/sys/netinet6/nd6.c
==============================================================================
--- head/sys/netinet6/nd6.c     Wed Jul 31 15:55:01 2013        (r253840)
+++ head/sys/netinet6/nd6.c     Wed Jul 31 16:24:49 2013        (r253841)
@@ -1227,6 +1227,8 @@ nd6_ioctl(u_long cmd, caddr_t data, stru
        struct nd_prefix *pr;
        int i = 0, error = 0;
 
+       if (ifp->if_afdata[AF_INET6] == NULL)
+               return (EPFNOSUPPORT);
        switch (cmd) {
        case SIOCGDRLST_IN6:
                /*
@@ -1801,6 +1803,8 @@ nd6_slowtimo(void *arg)
            nd6_slowtimo, curvnet);
        IFNET_RLOCK_NOSLEEP();
        TAILQ_FOREACH(ifp, &V_ifnet, if_list) {
+               if (ifp->if_afdata[AF_INET6] == NULL)
+                       continue;
                nd6if = ND_IFINFO(ifp);
                if (nd6if->basereachable && /* already initialized */
                    (nd6if->recalctm -= ND6_SLOWTIMER_INTERVAL) <= 0) {
_______________________________________________
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to