Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/usr.sbin/ndp Remove in-kernel handling of Router Advertisements
details: https://anonhg.NetBSD.org/src/rev/e8a5662fc918
branches: trunk
changeset: 934434:e8a5662fc918
user: roy <roy%NetBSD.org@localhost>
date: Fri Jun 12 11:04:44 2020 +0000
description:
Remove in-kernel handling of Router Advertisements
This is much better handled by a user-land tool.
Proposed on tech-net here:
https://mail-index.netbsd.org/tech-net/2020/04/22/msg007766.html
Note that the ioctl SIOCGIFINFO_IN6 no longer sets flags. That now
needs to be done using the pre-existing SIOCSIFINFO_FLAGS ioctl.
Compat is fully provided where it makes sense, but trying to turn on
RA handling will obviously throw an error as it no longer exists.
Note that if you use IPv6 temporary addresses, this now needs to be
turned on in dhcpcd.conf(5) rather than in sysctl.conf(5).
diffstat:
distrib/sets/lists/tests/mi | 4 +-
etc/mtree/Makefile | 8 +-
etc/rc.d/network | 31 +-
sys/compat/common/if_43.c | 9 +-
sys/compat/netinet6/in6_var.h | 22 +-
sys/net/if.c | 13 +-
sys/net/if_vlan.c | 10 +-
sys/netinet/icmp6.h | 8 +-
sys/netinet/tcp_output.c | 6 +-
sys/netinet/tcp_subr.c | 20 +-
sys/netinet6/icmp6.c | 44 +-
sys/netinet6/in6.c | 176 +--
sys/netinet6/in6.h | 12 +-
sys/netinet6/in6_ifattach.c | 238 +----
sys/netinet6/in6_proto.c | 16 +-
sys/netinet6/in6_var.h | 160 +--
sys/netinet6/ip6_forward.c | 15 +-
sys/netinet6/ip6_input.c | 94 +-
sys/netinet6/ip6_mroute.c | 11 +-
sys/netinet6/ip6_output.c | 17 +-
sys/netinet6/ip6_var.h | 9 +-
sys/netinet6/nd6.c | 1301 +++--------------------
sys/netinet6/nd6.h | 307 +-----
sys/netinet6/nd6_nbr.c | 45 +-
sys/netinet6/nd6_rtr.c | 2221 +----------------------------------------
sys/rump/Makefile.rump | 4 +-
tests/net/ndp/Makefile | 4 +-
tests/net/ndp/t_ra.sh | 866 ---------------
usr.sbin/ndp/ndp.8 | 55 +-
usr.sbin/ndp/ndp.c | 619 +-----------
30 files changed, 466 insertions(+), 5879 deletions(-)
diffs (truncated from 7890 to 300 lines):
diff -r c31e11f8d385 -r e8a5662fc918 distrib/sets/lists/tests/mi
--- a/distrib/sets/lists/tests/mi Fri Jun 12 10:35:59 2020 +0000
+++ b/distrib/sets/lists/tests/mi Fri Jun 12 11:04:44 2020 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.842 2020/06/06 21:26:00 thorpej Exp $
+# $NetBSD: mi,v 1.843 2020/06/12 11:04:44 roy Exp $
#
# Note: don't delete entries from here - mark them as "obsolete" instead.
#
@@ -3884,7 +3884,7 @@
./usr/tests/net/ndp/Kyuafile tests-net-tests atf,rump,kyua
./usr/tests/net/ndp/t_dad tests-net-tests atf,rump
./usr/tests/net/ndp/t_ndp tests-net-tests atf,rump
-./usr/tests/net/ndp/t_ra tests-net-tests atf,rump
+./usr/tests/net/ndp/t_ra tests-obsolete obsolete
./usr/tests/net/net tests-net-tests compattestfile,atf
./usr/tests/net/net/Atffile tests-net-tests compattestfile,atf
./usr/tests/net/net/Kyuafile tests-net-tests compattestfile,atf,kyua
diff -r c31e11f8d385 -r e8a5662fc918 etc/mtree/Makefile
--- a/etc/mtree/Makefile Fri Jun 12 10:35:59 2020 +0000
+++ b/etc/mtree/Makefile Fri Jun 12 11:04:44 2020 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.42 2020/05/18 21:19:34 jmcneill Exp $
+# $NetBSD: Makefile,v 1.43 2020/06/12 11:04:44 roy Exp $
.include <bsd.own.mk>
@@ -57,9 +57,9 @@
.endif
.endif
-.if ${MKDTB} != "no"
-EXTRA_DIST_FILES+= NetBSD.dist.dtb
-.endif
+#.if ${MKDTB} != "no"
+#EXTRA_DIST_FILES+= NetBSD.dist.dtb
+#.endif
.if ${MKDTRACE} != "no"
EXTRA_DIST_FILES+= NetBSD.dist.dtrace
diff -r c31e11f8d385 -r e8a5662fc918 etc/rc.d/network
--- a/etc/rc.d/network Fri Jun 12 10:35:59 2020 +0000
+++ b/etc/rc.d/network Fri Jun 12 11:04:44 2020 +0000
@@ -1,6 +1,6 @@
#!/bin/sh
#
-# $NetBSD: network,v 1.78 2020/04/15 20:31:57 kim Exp $
+# $NetBSD: network,v 1.79 2020/06/12 11:04:45 roy Exp $
#
# PROVIDE: network
@@ -50,7 +50,6 @@
network_start_defaultroute
network_start_defaultroute6
have_inet6 &&
- network_start_ipv6_autoconf
network_wait_dad
network_start_resolv
network_start_local
@@ -171,7 +170,6 @@
/sbin/route -q add -inet6 ::0.0.0.0 -prefixlen 96 ::1 -reject
/sbin/sysctl -qw net.inet6.ip6.forwarding=0
- /sbin/sysctl -qw net.inet6.ip6.accept_rtadv=0
case $ip6mode in
router)
@@ -187,8 +185,10 @@
;;
autohost)
- echo 'IPv6 mode: autoconfigured host'
- /sbin/sysctl -qw net.inet6.ip6.accept_rtadv=1
+ if ! checkyesno dhcpcd; then
+ warn "rtsol and kernel ra handling have been removed"
+ warn "please configure dhcpcd in its place."
+ fi
;;
host)
@@ -319,15 +319,14 @@
;;
dhcp)
if ! checkyesno dhcpcd; then
- /sbin/dhcpcd -n \
+ /sbin/dhcpcd -n --dhcp \
${dhcpcd_flags} $int
fi
;;
rtsol)
if ! checkyesno dhcpcd; then
- /sbin/sysctl -qw \
- net.inet6.ip6.accept_rtadv=1
- /sbin/dhcpcd -q6T --nodhcp6 $int
+ /sbin/dhcpcd -n --ipv6rs \
+ ${dhcpcd_flags} $int
fi
;;
*)
@@ -439,20 +438,6 @@
fi
}
-network_start_ipv6_autoconf()
-{
- # IPv6 interface autoconfiguration.
-
- # dhcpcd will ensure DAD completes before forking
- if checkyesnox rtsol && ! checkyesno dhcpcd; then
- if [ "$ip6mode" = "autohost" ]; then
- echo
- warn "rtsol has been removed, " \
- "please configure dhcpcd in its place."
- fi
- fi
-}
-
network_wait_dad()
{
# Wait for the DAD flags to clear from all addresses.
diff -r c31e11f8d385 -r e8a5662fc918 sys/compat/common/if_43.c
--- a/sys/compat/common/if_43.c Fri Jun 12 10:35:59 2020 +0000
+++ b/sys/compat/common/if_43.c Fri Jun 12 11:04:44 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: if_43.c,v 1.24 2019/12/12 02:15:42 pgoyette Exp $ */
+/* $NetBSD: if_43.c,v 1.25 2020/06/12 11:04:45 roy Exp $ */
/*
* Copyright (c) 1982, 1986, 1989, 1990, 1993
@@ -32,7 +32,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_43.c,v 1.24 2019/12/12 02:15:42 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_43.c,v 1.25 2020/06/12 11:04:45 roy Exp $");
#if defined(_KERNEL_OPT)
#include "opt_compat_netbsd.h"
@@ -164,7 +164,6 @@
case SIOCDIFADDR:
case SIOCDIFADDR_IN6:
case SIOCDIFPHYADDR:
- case SIOCGDEFIFACE_IN6:
case SIOCG80211NWID:
case SIOCG80211STATS:
case SIOCG80211ZSTATS:
@@ -192,7 +191,6 @@
case SIOCIFCREATE:
case SIOCIFDESTROY:
case SIOCS80211NWID:
- case SIOCSDEFIFACE_IN6:
case SIOCSIFADDR:
case SIOCSIFADDR_IN6:
case SIOCSIFBRDADDR:
@@ -205,9 +203,6 @@
case SIOCSIFMTU:
case SIOCSIFNETMASK:
case SIOCSIFNETMASK_IN6:
- case SIOCSNDFLUSH_IN6:
- case SIOCSPFXFLUSH_IN6:
- case SIOCSRTRFLUSH_IN6:
case SIOCSVH:
case TAPGIFNAME:
return ncmd;
diff -r c31e11f8d385 -r e8a5662fc918 sys/compat/netinet6/in6_var.h
--- a/sys/compat/netinet6/in6_var.h Fri Jun 12 10:35:59 2020 +0000
+++ b/sys/compat/netinet6/in6_var.h Fri Jun 12 11:04:44 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: in6_var.h,v 1.5 2019/12/15 16:48:26 tsutsui Exp $ */
+/* $NetBSD: in6_var.h,v 1.6 2020/06/12 11:04:45 roy Exp $ */
/*-
* Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -49,9 +49,27 @@
struct in6_addrlifetime50 ifra_lifetime;
};
-#define OSIOCGIFALIFETIME_IN6 _IOWR('i', 81, struct in6_ifreq)
+struct prf_ra {
+ u_int32_t onlink : 1;
+ u_int32_t autonomous : 1;
+ u_int32_t router : 1;
+ u_int32_t reserved : 5;
+};
+
#define OSIOCAIFADDR_IN6 _IOW('i', 26, struct in6_aliasreq50)
#define OSIOCSIFPHYADDR_IN6 _IOW('i', 70, struct in6_aliasreq50)
+#define OSIOCGDRLST_IN6 _IOWR('i', 74, struct in6_drlist)
+#define OSIOCGPRLST_IN6 _IOWR('i', 75, struct in6_oprlist)
+#define OSIOCGIFINFO_IN6 _IOWR('i', 76, struct in6_ondireq)
+#define OSIOCSNDFLUSH_IN6 _IOWR('i', 77, struct in6_ifreq)
+#define OSIOCSPFXFLUSH_IN6 _IOWR('i', 79, struct in6_ifreq)
+#define OSIOCSRTRFLUSH_IN6 _IOWR('i', 80, struct in6_ifreq)
+#define OSIOCGIFALIFETIME_IN6 _IOWR('i', 81, struct in6_ifreq)
+#define OSIOCSDEFIFACE_IN6 _IOWR('i', 85, struct in6_ndifreq90)
+#define OSIOCGDEFIFACE_IN6 _IOWR('i', 86, struct in6_ndifreq90)
+#define OSIOCSIFINFO_FLAGS_90 _IOWR('i', 87, struct in6_ndireq90)
+#define OSIOCGIFINFO_IN6_90 _IOWR('i', 108, struct in6_ndireq90)
+#define OSIOCSIFINFO_IN6_90 _IOWR('i', 109, struct in6_ndireq90)
static __inline void in6_addrlifetime_to_in6_addrlifetime50(
struct in6_addrlifetime *al)
diff -r c31e11f8d385 -r e8a5662fc918 sys/net/if.c
--- a/sys/net/if.c Fri Jun 12 10:35:59 2020 +0000
+++ b/sys/net/if.c Fri Jun 12 11:04:44 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: if.c,v 1.477 2020/05/05 09:26:29 jdolecek Exp $ */
+/* $NetBSD: if.c,v 1.478 2020/06/12 11:04:45 roy Exp $ */
/*-
* Copyright (c) 1999, 2000, 2001, 2008 The NetBSD Foundation, Inc.
@@ -90,7 +90,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if.c,v 1.477 2020/05/05 09:26:29 jdolecek Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if.c,v 1.478 2020/06/12 11:04:45 roy Exp $");
#if defined(_KERNEL_OPT)
#include "opt_inet.h"
@@ -3139,15 +3139,6 @@
if (ifp->if_mtu == ifr->ifr_mtu)
break;
ifp->if_mtu = ifr->ifr_mtu;
- /*
- * If the link MTU changed, do network layer specific procedure.
- */
-#ifdef INET6
- KERNEL_LOCK_UNLESS_NET_MPSAFE();
- if (in6_present)
- nd6_setmtu(ifp);
- KERNEL_UNLOCK_UNLESS_NET_MPSAFE();
-#endif
return ENETRESET;
case SIOCSIFDESCR:
error = kauth_authorize_network(curlwp->l_cred,
diff -r c31e11f8d385 -r e8a5662fc918 sys/net/if_vlan.c
--- a/sys/net/if_vlan.c Fri Jun 12 10:35:59 2020 +0000
+++ b/sys/net/if_vlan.c Fri Jun 12 11:04:44 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: if_vlan.c,v 1.151 2020/02/01 02:58:15 riastradh Exp $ */
+/* $NetBSD: if_vlan.c,v 1.152 2020/06/12 11:04:45 roy Exp $ */
/*
* Copyright (c) 2000, 2001 The NetBSD Foundation, Inc.
@@ -78,7 +78,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_vlan.c,v 1.151 2020/02/01 02:58:15 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_vlan.c,v 1.152 2020/06/12 11:04:45 roy Exp $");
#ifdef _KERNEL_OPT
#include "opt_inet.h"
@@ -541,12 +541,6 @@
nmib->ifvm_p = p;
nmib->ifvm_tag = vid;
ifv->ifv_if.if_mtu = p->if_mtu - nmib->ifvm_mtufudge;
-#ifdef INET6
- KERNEL_LOCK_UNLESS_NET_MPSAFE();
- if (in6_present)
- nd6_setmtu(ifp);
- KERNEL_UNLOCK_UNLESS_NET_MPSAFE();
-#endif
ifv->ifv_if.if_flags = p->if_flags &
(IFF_UP | IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST);
diff -r c31e11f8d385 -r e8a5662fc918 sys/netinet/icmp6.h
--- a/sys/netinet/icmp6.h Fri Jun 12 10:35:59 2020 +0000
+++ b/sys/netinet/icmp6.h Fri Jun 12 11:04:44 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: icmp6.h,v 1.53 2020/03/09 21:20:55 roy Exp $ */
+/* $NetBSD: icmp6.h,v 1.54 2020/06/12 11:04:45 roy Exp $ */
/* $KAME: icmp6.h,v 1.84 2003/04/23 10:26:51 itojun Exp $ */
@@ -633,8 +633,10 @@
#define ICMPV6CTL_MTUDISC_HIWAT 16
#define ICMPV6CTL_MTUDISC_LOWAT 17
#define ICMPV6CTL_ND6_DEBUG 18
-#define ICMPV6CTL_ND6_DRLIST 19
-#define ICMPV6CTL_ND6_PRLIST 20
+#ifdef _KERNEL
+#define OICMPV6CTL_ND6_DRLIST 19
+#define OICMPV6CTL_ND6_PRLIST 20
+#endif
#define ICMPV6CTL_ND6_MAXQLEN 24
#ifdef _KERNEL
diff -r c31e11f8d385 -r e8a5662fc918 sys/netinet/tcp_output.c
--- a/sys/netinet/tcp_output.c Fri Jun 12 10:35:59 2020 +0000
+++ b/sys/netinet/tcp_output.c Fri Jun 12 11:04:44 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: tcp_output.c,v 1.212 2019/11/17 08:21:25 mlelstv Exp $ */
+/* $NetBSD: tcp_output.c,v 1.213 2020/06/12 11:04:45 roy Exp $ */
/*
* Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -135,7 +135,7 @@
*/
Home |
Main Index |
Thread Index |
Old Index