1/*	$FreeBSD: src/sys/netinet6/in6_proto.c,v 1.19 2002/10/16 02:25:05 sam Exp $	*/
2/*	$KAME: in6_proto.c,v 1.91 2001/05/27 13:28:35 itojun Exp $	*/
3
4/*
5 * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
6 * All rights reserved.
7 *
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions
10 * are met:
11 * 1. Redistributions of source code must retain the above copyright
12 *    notice, this list of conditions and the following disclaimer.
13 * 2. Redistributions in binary form must reproduce the above copyright
14 *    notice, this list of conditions and the following disclaimer in the
15 *    documentation and/or other materials provided with the distribution.
16 * 3. Neither the name of the project nor the names of its contributors
17 *    may be used to endorse or promote products derived from this software
18 *    without specific prior written permission.
19 *
20 * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
21 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23 * ARE DISCLAIMED.  IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
24 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
26 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30 * SUCH DAMAGE.
31 */
32
33/*
34 * Copyright (c) 1982, 1986, 1993
35 *	The Regents of the University of California.  All rights reserved.
36 *
37 * Redistribution and use in source and binary forms, with or without
38 * modification, are permitted provided that the following conditions
39 * are met:
40 * 1. Redistributions of source code must retain the above copyright
41 *    notice, this list of conditions and the following disclaimer.
42 * 2. Redistributions in binary form must reproduce the above copyright
43 *    notice, this list of conditions and the following disclaimer in the
44 *    documentation and/or other materials provided with the distribution.
45 * 3. All advertising materials mentioning features or use of this software
46 *    must display the following acknowledgement:
47 *	This product includes software developed by the University of
48 *	California, Berkeley and its contributors.
49 * 4. Neither the name of the University nor the names of its contributors
50 *    may be used to endorse or promote products derived from this software
51 *    without specific prior written permission.
52 *
53 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
54 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
55 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
56 * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
57 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
58 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
59 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
60 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
61 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
62 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
63 * SUCH DAMAGE.
64 *
65 *	@(#)in_proto.c	8.1 (Berkeley) 6/10/93
66 */
67
68
69#include <sys/param.h>
70#include <sys/socket.h>
71#include <sys/socketvar.h>
72#include <sys/protosw.h>
73#include <sys/kernel.h>
74#include <sys/domain.h>
75#include <sys/mbuf.h>
76#include <sys/systm.h>
77#include <sys/sysctl.h>
78
79#include <net/if.h>
80#include <net/radix.h>
81#include <net/route.h>
82
83#include <netinet/in.h>
84#include <netinet/in_systm.h>
85#include <netinet/in_var.h>
86#include <netinet/ip_encap.h>
87#include <netinet/ip.h>
88#include <netinet/ip_var.h>
89#include <netinet/ip6.h>
90#include <netinet6/ip6_var.h>
91#include <netinet/icmp6.h>
92
93#include <netinet/tcp.h>
94#include <netinet/tcp_timer.h>
95#include <netinet/tcp_var.h>
96#include <netinet/udp.h>
97#include <netinet/udp_var.h>
98#include <netinet6/tcp6_var.h>
99#include <netinet6/raw_ip6.h>
100#include <netinet6/udp6_var.h>
101#include <netinet6/pim6_var.h>
102#include <netinet6/nd6.h>
103#include <netinet6/in6_prefix.h>
104
105#include <netinet6/ip6_mroute.h>
106
107#if IPSEC
108#include <netinet6/ipsec.h>
109#if INET6
110#include <netinet6/ipsec6.h>
111#endif
112#include <netinet6/ah.h>
113#if INET6
114#include <netinet6/ah6.h>
115#endif
116#if IPSEC_ESP
117#include <netinet6/esp.h>
118#if INET6
119#include <netinet6/esp6.h>
120#endif
121#endif
122#include <netinet6/ipcomp.h>
123#if INET6
124#include <netinet6/ipcomp6.h>
125#endif
126#endif /*IPSEC*/
127
128#include <netinet6/ip6protosw.h>
129
130#include <net/net_osdep.h>
131
132/*
133 * TCP/IP protocol family: IP6, ICMP6, UDP, TCP.
134 */
135
136extern	struct domain inet6domain;
137static struct pr_usrreqs nousrreqs;
138lck_mtx_t *inet6_domain_mutex;
139
140#define PR_LISTEN	0
141#define PR_ABRTACPTDIS	0
142
143extern int in6_inithead(void **, int);
144void in6_dinit(void) __attribute__((section("__TEXT, initcode")));
145
146static int rip6_pr_output(struct mbuf *m, struct socket *so, struct sockaddr_in6 *, struct mbuf *);
147
148struct ip6protosw inet6sw[] = {
149{ 0,		&inet6domain,	IPPROTO_IPV6,	0,
150  0,		0,		0,		0,
151  0,
152  ip6_init,	0,		frag6_slowtimo,	frag6_drain,
153  0,
154  &nousrreqs,
155  0,		0,		0,
156  { 0, 0 }, NULL, { 0 }
157},
158{ SOCK_DGRAM,	&inet6domain,	IPPROTO_UDP,	PR_ATOMIC|PR_ADDR|PR_PROTOLOCK|PR_PCBLOCK,
159  udp6_input,	0,		udp6_ctlinput,	ip6_ctloutput,
160  0,
161  0,		0,		0,		0,
162  0,
163  &udp6_usrreqs,
164  udp_lock,	udp_unlock,	udp_getlock,
165  { 0, 0 }, NULL, { 0 }
166},
167{ SOCK_STREAM,	&inet6domain,	IPPROTO_TCP,	PR_CONNREQUIRED|PR_WANTRCVD|PR_LISTEN|PR_PROTOLOCK|PR_PCBLOCK|PR_DISPOSE,
168  tcp6_input,	0,		tcp6_ctlinput,	tcp_ctloutput,
169  0,
170#if INET	/* don't call initialization and timeout routines twice */
171  0,		0,		0,		tcp_drain,
172#else
173  tcp_init,	0,	tcp_slowtimo,	tcp_drain,
174#endif
175  0,
176  &tcp6_usrreqs,
177  tcp_lock,	tcp_unlock,	tcp_getlock,
178  { 0, 0 }, NULL, { 0 }
179},
180{ SOCK_RAW,	&inet6domain,	IPPROTO_RAW,	PR_ATOMIC|PR_ADDR,
181  rip6_input,	rip6_pr_output,	rip6_ctlinput,	rip6_ctloutput,
182  0,
183  0,		0,		0,		0,
184  0,
185  &rip6_usrreqs,
186  0,		rip_unlock,	0,
187  { 0, 0 }, NULL, { 0 }
188},
189{ SOCK_RAW,	&inet6domain,	IPPROTO_ICMPV6,	PR_ATOMIC|PR_ADDR|PR_LASTHDR,
190  icmp6_input,	rip6_pr_output,	rip6_ctlinput,	rip6_ctloutput,
191  0,
192  icmp6_init,	icmp6_fasttimo,	0,		0,
193  0,
194  &rip6_usrreqs,
195  0,		rip_unlock,		0,
196  { 0, 0 }, NULL, { 0 }
197},
198{ SOCK_DGRAM,     &inet6domain,   IPPROTO_ICMPV6, PR_ATOMIC|PR_ADDR|PR_LASTHDR,
199  icmp6_input,  rip6_pr_output, rip6_ctlinput,  icmp6_dgram_ctloutput,
200  0,
201  icmp6_init,   icmp6_fasttimo, 0,              0,
202  0,
203  &icmp6_dgram_usrreqs,
204  0,            rip_unlock,             0,
205  { 0, 0 }, NULL, { 0 }
206},
207{ SOCK_RAW,	&inet6domain,	IPPROTO_DSTOPTS,PR_ATOMIC|PR_ADDR,
208  dest6_input,	0,	 	0,		0,
209  0,
210  0,		0,		0,		0,
211  0,
212  &nousrreqs,
213  0,		0,		0,
214  { 0, 0 }, NULL, { 0 }
215},
216{ SOCK_RAW,	&inet6domain,	IPPROTO_ROUTING,PR_ATOMIC|PR_ADDR,
217  route6_input,	0,	 	0,		0,
218  0,
219  0,		0,		0,		0,
220  0,
221  &nousrreqs,
222  0,		0,		0,
223  { 0, 0 }, NULL, { 0 }
224},
225{ SOCK_RAW,	&inet6domain,	IPPROTO_FRAGMENT,PR_ATOMIC|PR_ADDR,
226  frag6_input,	0,	 	0,		0,
227  0,
228  0,		0,		0,		0,
229  0,
230  &nousrreqs,
231  0,		0,		0,
232  { 0, 0 }, NULL, { 0 }
233},
234#if IPSEC
235{ SOCK_RAW,	&inet6domain,	IPPROTO_AH,	PR_ATOMIC|PR_ADDR|PR_PROTOLOCK,
236  ah6_input,	0,	 	0,		0,
237  0,
238  0,		0,		0,		0,
239  0,
240  &nousrreqs,
241  0,		0,		0,
242  { 0, 0 }, NULL, { 0 }
243},
244#if IPSEC_ESP
245{ SOCK_RAW,	&inet6domain,	IPPROTO_ESP,	PR_ATOMIC|PR_ADDR|PR_PROTOLOCK,
246  esp6_input,	0,
247  esp6_ctlinput,
248  0,
249  0,
250  0,		0,		0,		0,
251  0,
252  &nousrreqs,
253  0,		0,		0,
254  { 0, 0 }, NULL, { 0 }
255},
256#endif
257{ SOCK_RAW,	&inet6domain,	IPPROTO_IPCOMP,	PR_ATOMIC|PR_ADDR|PR_PROTOLOCK,
258  ipcomp6_input, 0,	 	0,		0,
259  0,
260  0,		0,		0,		0,
261  0,
262  &nousrreqs,
263  0,		0,		0,
264  { 0, 0 }, NULL, { 0 }
265},
266#endif /* IPSEC */
267#if INET
268{ SOCK_RAW,	&inet6domain,	IPPROTO_IPV4,	PR_ATOMIC|PR_ADDR|PR_LASTHDR,
269  encap6_input,	rip6_pr_output, 	0,		rip6_ctloutput,
270  0,
271  encap_init,	0,		0,		0,
272  0,
273  &rip6_usrreqs,
274  0,		rip_unlock,	0,
275  { 0, 0 }, NULL, { 0 }
276},
277#endif /*INET*/
278{ SOCK_RAW,	&inet6domain,	IPPROTO_IPV6,	PR_ATOMIC|PR_ADDR|PR_LASTHDR,
279  encap6_input, rip6_pr_output,	0,		rip6_ctloutput,
280  0,
281  encap_init,	0,		0,		0,
282  0,
283  &rip6_usrreqs,
284  0,		rip_unlock,	0,
285  { 0, 0 }, NULL, { 0 }
286},
287{ SOCK_RAW,     &inet6domain,	IPPROTO_PIM,	PR_ATOMIC|PR_ADDR|PR_LASTHDR,
288  pim6_input,	rip6_pr_output,	0,              rip6_ctloutput,
289  0,
290  0,		0,		0,		0,
291  0,
292  &rip6_usrreqs,
293  0,		rip_unlock,	0,
294  { 0, 0 }, NULL, { 0 }
295},
296/* raw wildcard */
297{ SOCK_RAW,	&inet6domain,	0,		PR_ATOMIC|PR_ADDR|PR_LASTHDR,
298  rip6_input,	rip6_pr_output,	0,		rip6_ctloutput,
299  0,
300  0,		0,		0,		0,
301  0,
302  &rip6_usrreqs,
303  0,		rip_unlock,	0,
304  { 0, 0 }, NULL, { 0 }
305},
306};
307
308
309int in6_proto_count = (sizeof (inet6sw) / sizeof (struct ip6protosw));
310
311struct domain inet6domain =
312    { AF_INET6, "internet6", in6_dinit, 0, 0,
313      (struct protosw *)inet6sw, 0,
314      in6_inithead, offsetof(struct sockaddr_in6, sin6_addr) << 3, sizeof(struct sockaddr_in6) ,
315      sizeof(struct sockaddr_in6), 0,
316      NULL, 0, {0,0}
317    };
318
319DOMAIN_SET(inet6);
320
321/* Initialize the PF_INET6 domain, and add in the pre-defined protos */
322void
323in6_dinit(void)
324{
325	register int i;
326	register struct ip6protosw *pr;
327	register struct domain *dp;
328	static int inet6domain_initted = 0;
329
330	if (!inet6domain_initted) {
331		dp = &inet6domain;
332
333		for (i=0, pr = &inet6sw[0]; i<in6_proto_count; i++, pr++)
334			net_add_proto((struct protosw*)pr, dp);
335
336		inet6_domain_mutex = dp->dom_mtx;
337		inet6domain_initted = 1;
338	}
339}
340
341int rip6_pr_output(__unused struct mbuf *m, __unused struct socket *so,
342					__unused struct sockaddr_in6 *sin6, __unused struct mbuf *m1)
343{
344	panic("rip6_pr_output\n");
345	return 0;
346}
347
348/*
349 * Internet configuration info
350 */
351#ifndef	IPV6FORWARDING
352#if GATEWAY6
353#define	IPV6FORWARDING	1	/* forward IP6 packets not for us */
354#else
355#define	IPV6FORWARDING	0	/* don't forward IP6 packets not for us */
356#endif /* GATEWAY6 */
357#endif /* !IPV6FORWARDING */
358
359#ifndef	IPV6_SENDREDIRECTS
360#define	IPV6_SENDREDIRECTS	1
361#endif
362
363int	ip6_forwarding = IPV6FORWARDING;	/* act as router? */
364int	ip6_sendredirects = IPV6_SENDREDIRECTS;
365int	ip6_defhlim = IPV6_DEFHLIM;
366int	ip6_defmcasthlim = IPV6_DEFAULT_MULTICAST_HOPS;
367int	ip6_accept_rtadv = 0;	/* "IPV6FORWARDING ? 0 : 1" is dangerous */
368int	ip6_maxfragpackets;	/* initialized in frag6.c:frag6_init() */
369int	ip6_maxfrags;
370int	ip6_log_interval = 5;
371int	ip6_hdrnestlimit = 50;	/* appropriate? */
372int	ip6_dad_count = 1;	/* DupAddrDetectionTransmits */
373u_int32_t ip6_flow_seq;
374int	ip6_auto_flowlabel = 1;
375int	ip6_gif_hlim = 0;
376int	ip6_use_deprecated = 1;	/* allow deprecated addr (RFC2462 5.5.4) */
377int	ip6_rr_prune = 5;	/* router renumbering prefix
378				 * walk list every 5 sec.    */
379int	ip6_v6only = 0;		/* Mapped addresses on by default -  Radar 3347718 */
380
381int	ip6_neighborgcthresh = 2048;	/* Threshold # of NDP entries for GC */
382int	ip6_maxifprefixes = 16;		/* Max acceptable prefixes via RA per IF */
383int	ip6_maxifdefrouters = 16;	/* Max acceptable def routers via RA */
384int	ip6_maxdynroutes = 4096;	/* Max # of routes created via redirect */
385
386u_int32_t ip6_id = 0UL;
387int	ip6_keepfaith = 0;
388time_t	ip6_log_time = (time_t)0L;
389
390/* icmp6 */
391/*
392 * BSDI4 defines these variables in in_proto.c...
393 * XXX: what if we don't define INET? Should we define pmtu6_expire
394 * or so? (jinmei@kame.net 19990310)
395 */
396int pmtu_expire = 60*10;
397int pmtu_probe = 60*2;
398
399/* raw IP6 parameters */
400/*
401 * Nominal space allocated to a raw ip socket.
402 */
403#define	RIPV6SNDQ	8192
404#define	RIPV6RCVQ	8192
405
406u_long	rip6_sendspace = RIPV6SNDQ;
407u_long	rip6_recvspace = RIPV6RCVQ;
408
409/* ICMPV6 parameters */
410int	icmp6_rediraccept = 1;		/* accept and process redirects */
411int	icmp6_redirtimeout = 10 * 60;	/* 10 minutes */
412int	icmp6errppslim = 100;		/* 100pps */
413int	icmp6_nodeinfo = 3;		/* enable/disable NI response */
414
415/* UDP on IP6 parameters */
416int	udp6_sendspace = 9216;		/* really max datagram size */
417int	udp6_recvspace = 40 * (1024 + sizeof(struct sockaddr_in6));
418					/* 40 1K datagrams */
419
420/*
421 * sysctl related items.
422 */
423SYSCTL_NODE(_net,	PF_INET6,	inet6,	CTLFLAG_RW,	0,
424	"Internet6 Family");
425
426/* net.inet6 */
427SYSCTL_NODE(_net_inet6,	IPPROTO_IPV6,	ip6,	CTLFLAG_RW|CTLFLAG_LOCKED, 0,	"IP6");
428SYSCTL_NODE(_net_inet6,	IPPROTO_ICMPV6,	icmp6,	CTLFLAG_RW|CTLFLAG_LOCKED, 0,	"ICMP6");
429SYSCTL_NODE(_net_inet6,	IPPROTO_UDP,	udp6,	CTLFLAG_RW|CTLFLAG_LOCKED, 0,	"UDP6");
430SYSCTL_NODE(_net_inet6,	IPPROTO_TCP,	tcp6,	CTLFLAG_RW|CTLFLAG_LOCKED, 0,	"TCP6");
431#if IPSEC
432SYSCTL_NODE(_net_inet6,	IPPROTO_ESP,	ipsec6,	CTLFLAG_RW|CTLFLAG_LOCKED, 0,	"IPSEC6");
433#endif /* IPSEC */
434
435/* net.inet6.ip6 */
436static int
437sysctl_ip6_temppltime SYSCTL_HANDLER_ARGS
438{
439	int error = 0;
440	int old;
441
442	error = SYSCTL_OUT(req, arg1, sizeof(int));
443	if (error || !req->newptr)
444		return (error);
445	old = ip6_temp_preferred_lifetime;
446	error = SYSCTL_IN(req, arg1, sizeof(int));
447	if (ip6_temp_preferred_lifetime <
448	    ip6_desync_factor + ip6_temp_regen_advance) {
449		ip6_temp_preferred_lifetime = old;
450		return(EINVAL);
451	}
452	return(error);
453}
454
455static int
456sysctl_ip6_tempvltime SYSCTL_HANDLER_ARGS
457{
458	int error = 0;
459	int old;
460
461	error = SYSCTL_OUT(req, arg1, sizeof(int));
462	if (error || !req->newptr)
463		return (error);
464	old = ip6_temp_valid_lifetime;
465	error = SYSCTL_IN(req, arg1, sizeof(int));
466	if (ip6_temp_valid_lifetime < ip6_temp_preferred_lifetime) {
467		ip6_temp_preferred_lifetime = old;
468		return(EINVAL);
469	}
470	return(error);
471}
472
473SYSCTL_INT(_net_inet6_ip6, IPV6CTL_FORWARDING,
474	forwarding, CTLFLAG_RW, 	&ip6_forwarding,	0, "");
475SYSCTL_INT(_net_inet6_ip6, IPV6CTL_SENDREDIRECTS,
476	redirect, CTLFLAG_RW,		&ip6_sendredirects,	0, "");
477SYSCTL_INT(_net_inet6_ip6, IPV6CTL_DEFHLIM,
478	hlim, CTLFLAG_RW,		&ip6_defhlim,	0, "");
479SYSCTL_STRUCT(_net_inet6_ip6, IPV6CTL_STATS, stats, CTLFLAG_RD,
480	&ip6stat, ip6stat, "");
481SYSCTL_INT(_net_inet6_ip6, IPV6CTL_MAXFRAGPACKETS,
482	maxfragpackets, CTLFLAG_RW,	&ip6_maxfragpackets,	0, "");
483SYSCTL_INT(_net_inet6_ip6, IPV6CTL_MAXFRAGS,
484        maxfrags, CTLFLAG_RW,           &ip6_maxfrags,  0, "");
485SYSCTL_INT(_net_inet6_ip6, IPV6CTL_ACCEPT_RTADV,
486	accept_rtadv, CTLFLAG_RW,	&ip6_accept_rtadv,	0, "");
487SYSCTL_INT(_net_inet6_ip6, IPV6CTL_KEEPFAITH,
488	keepfaith, CTLFLAG_RW,		&ip6_keepfaith,	0, "");
489SYSCTL_INT(_net_inet6_ip6, IPV6CTL_LOG_INTERVAL,
490	log_interval, CTLFLAG_RW,	&ip6_log_interval,	0, "");
491SYSCTL_INT(_net_inet6_ip6, IPV6CTL_HDRNESTLIMIT,
492	hdrnestlimit, CTLFLAG_RW,	&ip6_hdrnestlimit,	0, "");
493SYSCTL_INT(_net_inet6_ip6, IPV6CTL_DAD_COUNT,
494	dad_count, CTLFLAG_RW,	&ip6_dad_count,	0, "");
495SYSCTL_INT(_net_inet6_ip6, IPV6CTL_AUTO_FLOWLABEL,
496	auto_flowlabel, CTLFLAG_RW,	&ip6_auto_flowlabel,	0, "");
497SYSCTL_INT(_net_inet6_ip6, IPV6CTL_DEFMCASTHLIM,
498	defmcasthlim, CTLFLAG_RW,	&ip6_defmcasthlim,	0, "");
499SYSCTL_INT(_net_inet6_ip6, IPV6CTL_GIF_HLIM,
500	gifhlim, CTLFLAG_RW,	&ip6_gif_hlim,			0, "");
501SYSCTL_STRING(_net_inet6_ip6, IPV6CTL_KAME_VERSION,
502	kame_version, CTLFLAG_RD,	__KAME_VERSION,		0, "");
503SYSCTL_INT(_net_inet6_ip6, IPV6CTL_USE_DEPRECATED,
504	use_deprecated, CTLFLAG_RW,	&ip6_use_deprecated,	0, "");
505SYSCTL_INT(_net_inet6_ip6, IPV6CTL_RR_PRUNE,
506	rr_prune, CTLFLAG_RW,	&ip6_rr_prune,			0, "");
507SYSCTL_INT(_net_inet6_ip6, IPV6CTL_USETEMPADDR,
508	use_tempaddr, CTLFLAG_RW, &ip6_use_tempaddr,		0, "");
509SYSCTL_OID(_net_inet6_ip6, IPV6CTL_TEMPPLTIME, temppltime,
510	   CTLTYPE_INT|CTLFLAG_RW, &ip6_temp_preferred_lifetime, 0,
511	   sysctl_ip6_temppltime, "I", "");
512SYSCTL_OID(_net_inet6_ip6, IPV6CTL_TEMPVLTIME, tempvltime,
513	   CTLTYPE_INT|CTLFLAG_RW, &ip6_temp_valid_lifetime, 0,
514	   sysctl_ip6_tempvltime, "I", "");
515SYSCTL_INT(_net_inet6_ip6, IPV6CTL_V6ONLY,
516	v6only,	CTLFLAG_RW,	&ip6_v6only,			0, "");
517SYSCTL_INT(_net_inet6_ip6, IPV6CTL_AUTO_LINKLOCAL,
518	auto_linklocal, CTLFLAG_RW, &ip6_auto_linklocal,	0, "");
519SYSCTL_STRUCT(_net_inet6_ip6, IPV6CTL_RIP6STATS, rip6stats, CTLFLAG_RD,
520	&rip6stat, rip6stat, "");
521SYSCTL_STRUCT(_net_inet6_ip6, OID_AUTO, mrt6stat, CTLFLAG_RD,
522        &mrt6stat, mrt6stat, "");
523SYSCTL_INT(_net_inet6_ip6, IPV6CTL_NEIGHBORGCTHRESH,
524	neighborgcthresh, CTLFLAG_RW,	&ip6_neighborgcthresh,	0, "");
525SYSCTL_INT(_net_inet6_ip6, IPV6CTL_MAXIFPREFIXES,
526	maxifprefixes, CTLFLAG_RW,	&ip6_maxifprefixes,	0, "");
527SYSCTL_INT(_net_inet6_ip6, IPV6CTL_MAXIFDEFROUTERS,
528	maxifdefrouters, CTLFLAG_RW,	&ip6_maxifdefrouters,	0, "");
529SYSCTL_INT(_net_inet6_ip6, IPV6CTL_MAXDYNROUTES,
530	maxdynroutes, CTLFLAG_RW,	&ip6_maxdynroutes,	0, "");
531
532
533/* net.inet6.icmp6 */
534SYSCTL_INT(_net_inet6_icmp6, ICMPV6CTL_REDIRACCEPT,
535	rediraccept, CTLFLAG_RW,	&icmp6_rediraccept,	0, "");
536SYSCTL_INT(_net_inet6_icmp6, ICMPV6CTL_REDIRTIMEOUT,
537	redirtimeout, CTLFLAG_RW,	&icmp6_redirtimeout,	0, "");
538SYSCTL_STRUCT(_net_inet6_icmp6, ICMPV6CTL_STATS, stats, CTLFLAG_RD,
539	&icmp6stat, icmp6stat, "");
540SYSCTL_INT(_net_inet6_icmp6, ICMPV6CTL_ND6_PRUNE,
541	nd6_prune, CTLFLAG_RW,		&nd6_prune,	0, "");
542SYSCTL_INT(_net_inet6_icmp6, ICMPV6CTL_ND6_DELAY,
543	nd6_delay, CTLFLAG_RW,		&nd6_delay,	0, "");
544SYSCTL_INT(_net_inet6_icmp6, ICMPV6CTL_ND6_UMAXTRIES,
545	nd6_umaxtries, CTLFLAG_RW,	&nd6_umaxtries,	0, "");
546SYSCTL_INT(_net_inet6_icmp6, ICMPV6CTL_ND6_MMAXTRIES,
547	nd6_mmaxtries, CTLFLAG_RW,	&nd6_mmaxtries,	0, "");
548SYSCTL_INT(_net_inet6_icmp6, ICMPV6CTL_ND6_USELOOPBACK,
549	nd6_useloopback, CTLFLAG_RW,	&nd6_useloopback, 0, "");
550SYSCTL_INT(_net_inet6_icmp6, ICMPV6CTL_NODEINFO,
551	nodeinfo, CTLFLAG_RW,	&icmp6_nodeinfo,	0, "");
552SYSCTL_INT(_net_inet6_icmp6, ICMPV6CTL_ERRPPSLIMIT,
553	errppslimit, CTLFLAG_RW,	&icmp6errppslim,	0, "");
554SYSCTL_INT(_net_inet6_icmp6, ICMPV6CTL_ND6_MAXNUDHINT,
555	nd6_maxnudhint, CTLFLAG_RW,	&nd6_maxnudhint, 0, "");
556SYSCTL_INT(_net_inet6_icmp6, ICMPV6CTL_ND6_DEBUG,
557	nd6_debug, CTLFLAG_RW,	&nd6_debug,		0, "");
558
559