Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src add net.inet6.icmp6.nodeinfo sysctl.
details: https://anonhg.NetBSD.org/src/rev/6636180b4cd5
branches: trunk
changeset: 480087:6636180b4cd5
user: itojun <itojun%NetBSD.org@localhost>
date: Sun Jan 02 16:31:17 2000 +0000
description:
add net.inet6.icmp6.nodeinfo sysctl.
this allows you to disable/enable ICMPv6 node information query/reply
processing (which tells remote end the gethostname(3) setting, interface
addresses on the node, and some other things - documented in
draft-ietf-ipngwg-icmp-name-lookup* or something alike).
to test it, try ping6 -w ::1 with nodeinfo=0 and nodeinfo=1.
(sync with kame change)
diffstat:
lib/libc/gen/sysctl.3 | 6 +++++-
sys/netinet6/icmp6.c | 39 +++++++++++++++++++++++++--------------
sys/netinet6/icmp6.h | 7 +++++--
sys/netinet6/in6_proto.c | 5 ++++-
usr.sbin/sysctl/sysctl.8 | 3 ++-
5 files changed, 41 insertions(+), 19 deletions(-)
diffs (214 lines):
diff -r e9d24ec077d0 -r 6636180b4cd5 lib/libc/gen/sysctl.3
--- a/lib/libc/gen/sysctl.3 Sun Jan 02 13:59:34 2000 +0000
+++ b/lib/libc/gen/sysctl.3 Sun Jan 02 16:31:17 2000 +0000
@@ -1,4 +1,4 @@
-.\" $NetBSD: sysctl.3,v 1.42 2000/01/02 13:34:25 itojun Exp $
+.\" $NetBSD: sysctl.3,v 1.43 2000/01/02 16:31:17 itojun Exp $
.\"
.\" Copyright (c) 1993
.\" The Regents of the University of California. All rights reserved.
@@ -761,6 +761,7 @@
.It icmp6 nd6_mmaxtries integer yes
.It icmp6 nd6_useloopback integer yes
.It icmp6 nd6_proxyall integer yes
+.It icmp6 nodeinfo integer yes
.It tcp6 mssdflt integer yes
.It tcp6 do_rfc1323 integer yes
.It tcp6 keepidle integer yes
@@ -877,6 +878,9 @@
local traffic.
.It Li icmp6.nd6_proxyall
The variable enables proxy neighbor advertisements.
+.It Li icmp6.nodeinfo
+The variable enables, or disables, kernel support for
+ICMPv6 node information query/reply.
.El
.Pp
Variables net.*.tcp6 and net.*.udp6 are identical to
diff -r e9d24ec077d0 -r 6636180b4cd5 sys/netinet6/icmp6.c
--- a/sys/netinet6/icmp6.c Sun Jan 02 13:59:34 2000 +0000
+++ b/sys/netinet6/icmp6.c Sun Jan 02 16:31:17 2000 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: icmp6.c,v 1.13 1999/12/15 06:28:44 itojun Exp $ */
+/* $NetBSD: icmp6.c,v 1.14 2000/01/02 16:31:18 itojun Exp $ */
/*
* Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -133,6 +133,7 @@
extern struct inpcbhead ripcb;
#endif
extern u_int icmp6errratelim;
+extern int icmp6_nodeinfo;
#if defined(__NetBSD__) || defined(__OpenBSD__)
static struct rttimer_queue *icmp6_mtudisc_timeout_q = NULL;
extern int pmtu_expire;
@@ -646,6 +647,9 @@
if (code != 0)
goto badcode;
+ if (!icmp6_nodeinfo)
+ break;
+
if (icmp6len == sizeof(struct icmp6_hdr) + 4)
mode = WRU;
else if (icmp6len >= sizeof(struct icmp6_hdr) + 8) /* XXX */
@@ -657,12 +661,16 @@
#define hostnamelen strlen(hostname)
#endif
if (mode == FQDN) {
+#ifndef PULLDOWN_TEST
IP6_EXTHDR_CHECK(m, off, sizeof(struct icmp6_nodeinfo),
IPPROTO_DONE);
- n = ni6_input(m, off);
- noff = sizeof(struct ip6_hdr);
- }
- else {
+#endif
+ n = m_copy(m, 0, M_COPYALL);
+ if (n)
+ n = ni6_input(n, off);
+ if (n)
+ noff = sizeof(struct ip6_hdr);
+ } else {
u_char *p;
MGETHDR(n, M_DONTWAIT, m->m_type);
@@ -916,10 +924,11 @@
#ifndef PULLDOWN_TEST
ni6 = (struct icmp6_nodeinfo *)(mtod(m, caddr_t) + off);
#else
- IP6_EXTHDR_GET(ni6, struct icmp6_nodeinfo *, m, off,
- sizeof(*ni6));
- if (ni6 == NULL)
+ IP6_EXTHDR_GET(ni6, struct icmp6_nodeinfo *, m, off, sizeof(*ni6));
+ if (ni6 == NULL) {
+ /* m is already reclaimed */
return NULL;
+ }
#endif
qtype = ntohs(ni6->ni_qtype);
@@ -957,8 +966,10 @@
/* allocate a mbuf to reply. */
MGETHDR(n, M_DONTWAIT, m->m_type);
- if (n == NULL)
+ if (n == NULL) {
+ m_freem(m);
return(NULL);
+ }
M_COPY_PKTHDR(n, m); /* just for recvif */
if (replylen > MHLEN) {
if (replylen > MCLBYTES)
@@ -1024,9 +1035,11 @@
nni6->ni_type = ICMP6_NI_REPLY;
nni6->ni_code = ICMP6_NI_SUCESS;
+ m_freem(m);
return(n);
bad:
+ m_freem(m);
if (n)
m_freem(n);
return(NULL);
@@ -1305,11 +1318,7 @@
/*
* Reflect the ip6 packet back to the source.
- * The caller MUST check if the destination is multicast or not.
- * This function is usually called with a unicast destination which
- * can be safely the source of the reply packet. But some exceptions
- * exist(e.g. ECHOREPLY, PATCKET_TOOBIG, "10" in OPTION type).
- * ``off'' points to the icmp6 header, counted from the top of the mbuf.
+ * OFF points to the icmp6 header, counted from the top of the mbuf.
*/
void
icmp6_reflect(m, off)
@@ -2244,6 +2253,8 @@
&nd6_useloopback);
case ICMPV6CTL_ND6_PROXYALL:
return sysctl_int(oldp, oldlenp, newp, newlen, &nd6_proxyall);
+ case ICMPV6CTL_NODEINFO:
+ return sysctl_int(oldp, oldlenp, newp, newlen, &icmp6_nodeinfo);
default:
return ENOPROTOOPT;
}
diff -r e9d24ec077d0 -r 6636180b4cd5 sys/netinet6/icmp6.h
--- a/sys/netinet6/icmp6.h Sun Jan 02 13:59:34 2000 +0000
+++ b/sys/netinet6/icmp6.h Sun Jan 02 16:31:17 2000 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: icmp6.h,v 1.6 1999/12/13 15:17:21 itojun Exp $ */
+/* $NetBSD: icmp6.h,v 1.7 2000/01/02 16:31:18 itojun Exp $ */
/*
* Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -526,7 +526,8 @@
#define ICMPV6CTL_ND6_MMAXTRIES 10
#define ICMPV6CTL_ND6_USELOOPBACK 11
#define ICMPV6CTL_ND6_PROXYALL 12
-#define ICMPV6CTL_MAXID 13
+#define ICMPV6CTL_NODEINFO 13
+#define ICMPV6CTL_MAXID 14
#define ICMPV6CTL_NAMES { \
{ 0, 0 }, \
@@ -542,6 +543,7 @@
{ "nd6_mmaxtries", CTLTYPE_INT }, \
{ "nd6_useloopback", CTLTYPE_INT }, \
{ "nd6_proxyall", CTLTYPE_INT }, \
+ { "nodeinfo", CTLTYPE_INT }, \
}
#define ICMPV6CTL_VARS { \
@@ -559,6 +561,7 @@
&nd6_mmaxtries, \
&nd6_useloopback, \
&nd6_proxyall, \
+ &icmp6_nodeinfo, \
}
#define RTF_PROBEMTU RTF_PROTO1
diff -r e9d24ec077d0 -r 6636180b4cd5 sys/netinet6/in6_proto.c
--- a/sys/netinet6/in6_proto.c Sun Jan 02 13:59:34 2000 +0000
+++ b/sys/netinet6/in6_proto.c Sun Jan 02 16:31:17 2000 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: in6_proto.c,v 1.9 1999/12/13 15:17:22 itojun Exp $ */
+/* $NetBSD: in6_proto.c,v 1.10 2000/01/02 16:31:18 itojun Exp $ */
/*
* Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -469,6 +469,7 @@
int icmp6_rediraccept = 1; /* accept and process redirects */
int icmp6_redirtimeout = 10 * 60; /* 10 minutes */
u_int icmp6errratelim = 1000; /* 1000usec = 1msec */
+int icmp6_nodeinfo = 1; /* enable/disable NI response */
#ifdef TCP6
/* TCP on IP6 parameters */
@@ -661,6 +662,8 @@
nd6_useloopback, CTLFLAG_RW, &nd6_useloopback, 0, "");
SYSCTL_INT(_net_inet6_icmp6, ICMPV6CTL_ND6_PROXYALL,
nd6_proxyall, CTLFLAG_RW, &nd6_proxyall, 0, "");
+SYSCTL_INT(_net_inet6_icmp6, ICMPV6CTL_NODEINFO,
+ nodeinfo, CTLFLAG_RW, &icmp6_nodeinfo, 0, "");
#if __FreeBSD__ < 3
/* net.inet6.udp6 */
diff -r e9d24ec077d0 -r 6636180b4cd5 usr.sbin/sysctl/sysctl.8
--- a/usr.sbin/sysctl/sysctl.8 Sun Jan 02 13:59:34 2000 +0000
+++ b/usr.sbin/sysctl/sysctl.8 Sun Jan 02 16:31:17 2000 +0000
@@ -1,4 +1,4 @@
-.\" $NetBSD: sysctl.8,v 1.34 1999/12/17 05:01:26 garbled Exp $
+.\" $NetBSD: sysctl.8,v 1.35 2000/01/02 16:31:19 itojun Exp $
.\"
.\" Copyright (c) 1993
.\" The Regents of the University of California. All rights reserved.
@@ -248,6 +248,7 @@
.It net.inet6.icmp6.nd6_mmaxtries integer yes
.It net.inet6.icmp6.nd6_useloopback integer yes
.It net.inet6.icmp6.nd6_proxyall integer yes
+.It net.inet6.icmp6.nodeinfo integer yes
.It net.key.debug integer yes
.It net.key.spi_try integer yes
.It net.key.spi_min_value integer yes
Home |
Main Index |
Thread Index |
Old Index