From 4ceb7caa6a4b4929c23d33166ce6cac49ecbeaca Mon Sep 17 00:00:00 2001 From: mpi Date: Wed, 7 May 2014 08:14:59 +0000 Subject: [PATCH] Kill the {nd6_,}useloopback buttons, using the loopback interface for local traffic is not optional. ok mikeb@, stsp@, jca@ --- lib/libc/gen/sysctl.3 | 8 ++------ sbin/sysctl/sysctl.8 | 5 ++--- sys/netinet/icmp6.h | 7 +++---- sys/netinet/if_ether.c | 24 +++--------------------- sys/netinet6/nd6.c | 32 +++++++++++++++----------------- sys/netinet6/nd6.h | 3 +-- 6 files changed, 26 insertions(+), 53 deletions(-) diff --git a/lib/libc/gen/sysctl.3 b/lib/libc/gen/sysctl.3 index 1bd5c0ef169..5812dd72a44 100644 --- a/lib/libc/gen/sysctl.3 +++ b/lib/libc/gen/sysctl.3 @@ -1,4 +1,4 @@ -.\" $OpenBSD: sysctl.3,v 1.234 2014/05/04 07:01:10 jmc Exp $ +.\" $OpenBSD: sysctl.3,v 1.235 2014/05/07 08:14:59 mpi Exp $ .\" .\" Copyright (c) 1993 .\" The Regents of the University of California. All rights reserved. @@ -27,7 +27,7 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.Dd $Mdocdate: May 4 2014 $ +.Dd $Mdocdate: May 7 2014 $ .Dt SYSCTL 3 .Os .Sh NAME @@ -1665,7 +1665,6 @@ The currently defined protocols and names are: .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 @@ -1759,9 +1758,6 @@ This variable specifies the 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. If set to 0, responses will not be generated for diff --git a/sbin/sysctl/sysctl.8 b/sbin/sysctl/sysctl.8 index 58303c2323c..6a3340555f5 100644 --- a/sbin/sysctl/sysctl.8 +++ b/sbin/sysctl/sysctl.8 @@ -1,4 +1,4 @@ -.\" $OpenBSD: sysctl.8,v 1.179 2014/05/04 07:01:10 jmc Exp $ +.\" $OpenBSD: sysctl.8,v 1.180 2014/05/07 08:14:59 mpi Exp $ .\" $NetBSD: sysctl.8,v 1.4 1995/09/30 07:12:49 thorpej Exp $ .\" .\" Copyright (c) 1993 @@ -30,7 +30,7 @@ .\" .\" @(#)sysctl.8 8.2 (Berkeley) 5/9/95 .\" -.Dd $Mdocdate: May 4 2014 $ +.Dd $Mdocdate: May 7 2014 $ .Dt SYSCTL 8 .Os .Sh NAME @@ -317,7 +317,6 @@ and a few require a kernel compiled with non-standard .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 diff --git a/sys/netinet/icmp6.h b/sys/netinet/icmp6.h index d370c36f3dc..c1af65e9bf6 100644 --- a/sys/netinet/icmp6.h +++ b/sys/netinet/icmp6.h @@ -1,4 +1,4 @@ -/* $OpenBSD: icmp6.h,v 1.38 2013/10/24 11:20:16 deraadt Exp $ */ +/* $OpenBSD: icmp6.h,v 1.39 2014/05/07 08:14:59 mpi Exp $ */ /* $KAME: icmp6.h,v 1.84 2003/04/23 10:26:51 itojun Exp $ */ /* @@ -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, \ diff --git a/sys/netinet/if_ether.c b/sys/netinet/if_ether.c index 2e8c294dd9d..8c8433d5c7a 100644 --- a/sys/netinet/if_ether.c +++ b/sys/netinet/if_ether.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_ether.c,v 1.126 2014/05/05 11:44:33 mpi Exp $ */ +/* $OpenBSD: if_ether.c,v 1.127 2014/05/07 08:14:59 mpi Exp $ */ /* $NetBSD: if_ether.c,v 1.31 1996/05/11 12:59:58 mycroft Exp $ */ /* @@ -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 *rt) 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 *rt) * 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 diff --git a/sys/netinet6/nd6.c b/sys/netinet6/nd6.c index 71a1aec6222..4365d95d784 100644 --- a/sys/netinet6/nd6.c +++ b/sys/netinet6/nd6.c @@ -1,4 +1,4 @@ -/* $OpenBSD: nd6.c,v 1.115 2014/05/05 11:44:33 mpi Exp $ */ +/* $OpenBSD: nd6.c,v 1.116 2014/05/07 08:14:59 mpi Exp $ */ /* $KAME: nd6.c,v 1.280 2002/06/08 19:52:07 itojun Exp $ */ /* @@ -72,7 +72,6 @@ int nd6_prune = 1; /* walk list every 1 seconds */ 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 *rt) * 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); diff --git a/sys/netinet6/nd6.h b/sys/netinet6/nd6.h index de300d99d96..fb001cad37d 100644 --- a/sys/netinet6/nd6.h +++ b/sys/netinet6/nd6.h @@ -1,4 +1,4 @@ -/* $OpenBSD: nd6.h,v 1.36 2014/01/07 17:07:46 mikeb Exp $ */ +/* $OpenBSD: nd6.h,v 1.37 2014/05/07 08:14:59 mpi Exp $ */ /* $KAME: nd6.h,v 1.95 2002/06/08 11:31:06 itojun Exp $ */ /* @@ -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; -- 2.20.1