Using the loopback interface for local traffic is not optional.  I
wonder if anybody using IPv6 ever turned this sysctl off.  I'd be
interested to hear from you and see your routing table if you did
it.

Otherwise, the diff below removes the global variable for IPv4 and
the sysctl button for IPv6, ok?

Index: sys/netinet/icmp6.h
===================================================================
RCS file: /home/ncvs/src/sys/netinet/icmp6.h,v
retrieving revision 1.38
diff -u -p -r1.38 icmp6.h
--- sys/netinet/icmp6.h 24 Oct 2013 11:20:16 -0000      1.38
+++ sys/netinet/icmp6.h 6 May 2014 09:53:40 -0000
@@ -529,7 +529,6 @@ struct icmp6stat {
 #define ICMPV6CTL_ND6_DELAY    8
 #define ICMPV6CTL_ND6_UMAXTRIES        9
 #define ICMPV6CTL_ND6_MMAXTRIES                10
-#define ICMPV6CTL_ND6_USELOOPBACK      11
 #define ICMPV6CTL_NODEINFO     13
 #define ICMPV6CTL_ERRPPSLIMIT  14      /* ICMPv6 error pps limitation */
 #define ICMPV6CTL_ND6_MAXNUDHINT       15
@@ -552,7 +551,7 @@ struct icmp6stat {
        { "nd6_delay", CTLTYPE_INT }, \
        { "nd6_umaxtries", CTLTYPE_INT }, \
        { "nd6_mmaxtries", CTLTYPE_INT }, \
-       { "nd6_useloopback", CTLTYPE_INT }, \
+       { 0, 0 }, \
        { 0, 0 }, \
        { "nodeinfo", CTLTYPE_INT }, \
        { "errppslimit", CTLTYPE_INT }, \
@@ -576,7 +575,7 @@ struct icmp6stat {
        &nd6_delay, \
        &nd6_umaxtries, \
        &nd6_mmaxtries, \
-       &nd6_useloopback, \
+       NULL, \
        NULL, \
        &icmp6_nodeinfo, \
        &icmp6errppslim, \
Index: sys/netinet/if_ether.c
===================================================================
RCS file: /home/ncvs/src/sys/netinet/if_ether.c,v
retrieving revision 1.126
diff -u -p -r1.126 if_ether.c
--- sys/netinet/if_ether.c      5 May 2014 11:44:33 -0000       1.126
+++ sys/netinet/if_ether.c      6 May 2014 09:53:40 -0000
@@ -90,7 +90,6 @@ LIST_HEAD(, llinfo_arp) llinfo_arp;
 struct ifqueue arpintrq;
 int    arp_inuse, arp_allocated;
 int    arp_maxtries = 5;
-int    useloopback = 1;        /* use loopback interface for local traffic */
 int    arpinit_done;
 int    la_hold_total;
 
@@ -233,23 +232,6 @@ arp_rtrequest(int req, struct rtentry *r
                                break;
                }
                if (ifa) {
-                       /*
-                        * This test used to be
-                        *      if (lo0ifp->if_flags & IFF_UP)
-                        * It allowed local traffic to be forced through
-                        * the hardware by configuring the loopback down.
-                        * However, it causes problems during network
-                        * configuration for boards that can't receive
-                        * packets they send.  It is now necessary to clear
-                        * "useloopback" and remove the route to force
-                        * traffic out to the hardware.
-                        *
-                        * In 4.4BSD, the above "if" statement checked
-                        * rt->rt_ifa against rt_key(rt).  It was changed
-                        * to the current form so that we can provide a
-                        * better support for multiple IPv4 addresses on a
-                        * interface.
-                        */
                        rt->rt_expire = 0;
                        SDL(gate)->sdl_alen = ETHER_ADDR_LEN;
                        memcpy(LLADDR(SDL(gate)),
@@ -260,8 +242,8 @@ arp_rtrequest(int req, struct rtentry *r
                         * should not (ab)use it for any route related
                         * to an interface of a different rdomain.
                         */
-                       if (useloopback)
-                               rt->rt_ifp = lo0ifp;
+                       rt->rt_ifp = lo0ifp;
+
                        /*
                         * make sure to set rt->rt_ifa to the interface
                         * address we are using, otherwise we will have trouble
Index: sbin/sysctl/sysctl.8
===================================================================
RCS file: /home/ncvs/src/sbin/sysctl/sysctl.8,v
retrieving revision 1.179
diff -u -p -r1.179 sysctl.8
--- sbin/sysctl/sysctl.8        4 May 2014 07:01:10 -0000       1.179
+++ sbin/sysctl/sysctl.8        6 May 2014 09:53:40 -0000
@@ -317,7 +317,6 @@ and a few require a kernel compiled with
 .It net.inet6.icmp6.nd6_delay Ta integer Ta yes
 .It net.inet6.icmp6.nd6_umaxtries Ta integer Ta yes
 .It net.inet6.icmp6.nd6_mmaxtries Ta integer Ta yes
-.It net.inet6.icmp6.nd6_useloopback Ta integer Ta yes
 .It net.inet6.icmp6.nodeinfo Ta integer Ta yes
 .It net.inet6.icmp6.errppslimit Ta integer Ta yes
 .It net.inet6.icmp6.nd6_maxnudhint Ta integer Ta yes
Index: lib/libc/gen/sysctl.3
===================================================================
RCS file: /home/ncvs/src/lib/libc/gen/sysctl.3,v
retrieving revision 1.234
diff -u -p -r1.234 sysctl.3
--- lib/libc/gen/sysctl.3       4 May 2014 07:01:10 -0000       1.234
+++ lib/libc/gen/sysctl.3       6 May 2014 09:53:40 -0000
@@ -1665,7 +1665,6 @@ The currently defined protocols and name
 .It icmp6 Ta nd6_mmaxtries Ta integer Ta yes
 .It icmp6 Ta nd6_prune Ta integer Ta yes
 .It icmp6 Ta nd6_umaxtries Ta integer Ta yes
-.It icmp6 Ta nd6_useloopback Ta integer Ta yes
 .It icmp6 Ta nodeinfo Ta integer Ta yes
 .It icmp6 Ta rediraccept Ta integer Ta yes
 .It icmp6 Ta redirtimeout Ta integer Ta yes
@@ -1758,9 +1757,6 @@ This variable specifies the
 .Dv MAX_UNICAST_SOLICIT
 constant in IPv6 neighbor discovery specification
 .Pq RFC 4861 .
-.Pp
-.It Li icmp6.nd6_useloopback
-If set to non-zero, IPv6 will use the loopback interface for local traffic.
 .Pp
 .It Li icmp6.nodeinfo
 This variable enables responses to ICMPv6 node information queries.
Index: sys/netinet6/nd6.c
===================================================================
RCS file: /home/ncvs/src/sys/netinet6/nd6.c,v
retrieving revision 1.115
diff -u -p -r1.115 nd6.c
--- sys/netinet6/nd6.c  5 May 2014 11:44:33 -0000       1.115
+++ sys/netinet6/nd6.c  6 May 2014 09:53:40 -0000
@@ -72,7 +72,6 @@ int   nd6_prune       = 1;    /* walk list every 1 
 int    nd6_delay       = 5;    /* delay first probe time 5 second */
 int    nd6_umaxtries   = 3;    /* maximum unicast query */
 int    nd6_mmaxtries   = 3;    /* maximum multicast query */
-int    nd6_useloopback = 1;    /* use loopback interface for local traffic */
 int    nd6_gctimer     = (60 * 60 * 24); /* 1 day: garbage collection timer */
 
 /* preventing too many loops in ND option parsing */
@@ -1163,21 +1162,20 @@ nd6_rtrequest(int req, struct rtentry *r
                         * should not (ab)use it for any route related
                         * to an interface of a different rdomain.
                         */
-                       if (nd6_useloopback) {
-                               rt->rt_ifp = lo0ifp;
-                               /*
-                                * Make sure rt_ifa be equal to the ifaddr
-                                * corresponding to the address.
-                                * We need this because when we refer
-                                * rt_ifa->ia6_flags in ip6_input, we assume
-                                * that the rt_ifa points to the address instead
-                                * of the loopback address.
-                                */
-                               if (ifa != rt->rt_ifa) {
-                                       ifafree(rt->rt_ifa);
-                                       ifa->ifa_refcnt++;
-                                       rt->rt_ifa = ifa;
-                               }
+                       rt->rt_ifp = lo0ifp;
+
+                       /*
+                        * Make sure rt_ifa be equal to the ifaddr
+                        * corresponding to the address.
+                        * We need this because when we refer
+                        * rt_ifa->ia6_flags in ip6_input, we assume
+                        * that the rt_ifa points to the address instead
+                        * of the loopback address.
+                        */
+                       if (ifa != rt->rt_ifa) {
+                               ifafree(rt->rt_ifa);
+                               ifa->ifa_refcnt++;
+                               rt->rt_ifa = ifa;
                        }
                } else if (rt->rt_flags & RTF_ANNOUNCE) {
                        nd6_llinfo_settimer(ln, -1);
Index: sys/netinet6/nd6.h
===================================================================
RCS file: /home/ncvs/src/sys/netinet6/nd6.h,v
retrieving revision 1.36
diff -u -p -r1.36 nd6.h
--- sys/netinet6/nd6.h  7 Jan 2014 17:07:46 -0000       1.36
+++ sys/netinet6/nd6.h  6 May 2014 09:53:40 -0000
@@ -215,7 +215,6 @@ extern int nd6_prune;
 extern int nd6_delay;
 extern int nd6_umaxtries;
 extern int nd6_mmaxtries;
-extern int nd6_useloopback;
 extern int nd6_maxnudhint;
 extern int nd6_gctimer;
 extern struct llinfo_nd6 llinfo_nd6;

Reply via email to