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