xref: /freebsd/sys/netinet6/in6_proto.c (revision 77a0943ded95b9e6438f7db70c4a28e4d93946d4)
1 /*	$FreeBSD$	*/
2 /*	$KAME: in6_proto.c,v 1.64 2000/06/20 16:20:27 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 #include "opt_inet.h"
69 #include "opt_inet6.h"
70 #include "opt_ipsec.h"
71 
72 #include <sys/param.h>
73 #include <sys/socket.h>
74 #include <sys/socketvar.h>
75 #include <sys/protosw.h>
76 #include <sys/kernel.h>
77 #include <sys/domain.h>
78 #include <sys/mbuf.h>
79 #include <sys/systm.h>
80 #include <sys/sysctl.h>
81 
82 #include <net/if.h>
83 #include <net/radix.h>
84 #include <net/route.h>
85 
86 #include <netinet/in.h>
87 #include <netinet/in_systm.h>
88 #include <netinet/in_var.h>
89 #include <netinet/ip_encap.h>
90 #include <netinet/ip.h>
91 #include <netinet/ip_var.h>
92 #include <netinet/ip6.h>
93 #include <netinet6/ip6_var.h>
94 #include <netinet/icmp6.h>
95 
96 #include <netinet/tcp.h>
97 #include <netinet/tcp_timer.h>
98 #include <netinet/tcp_var.h>
99 #include <netinet/udp.h>
100 #include <netinet/udp_var.h>
101 #include <netinet6/tcp6_var.h>
102 
103 #include <netinet6/udp6_var.h>
104 
105 #include <netinet6/pim6_var.h>
106 
107 #include <netinet6/nd6.h>
108 #include <netinet6/in6_prefix.h>
109 
110 #ifdef IPSEC
111 #include <netinet6/ipsec.h>
112 #include <netinet6/ipsec6.h>
113 #include <netinet6/ah.h>
114 #include <netinet6/ah6.h>
115 #ifdef IPSEC_ESP
116 #include <netinet6/esp.h>
117 #include <netinet6/esp6.h>
118 #endif
119 #include <netinet6/ipcomp.h>
120 #include <netinet6/ipcomp6.h>
121 #endif /*IPSEC*/
122 
123 #include <netinet6/ip6protosw.h>
124 
125 #include "gif.h"
126 #if NGIF > 0
127 #include <netinet6/in6_gif.h>
128 #endif
129 
130 #include <net/net_osdep.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 struct ip6protosw inet6sw[] = {
140 { 0,		&inet6domain,	IPPROTO_IPV6,	0,
141   0,		0,		0,		0,
142   0,
143   ip6_init,	0,		frag6_slowtimo,	frag6_drain,
144   &nousrreqs,
145 },
146 { SOCK_DGRAM,	&inet6domain,	IPPROTO_UDP,	PR_ATOMIC | PR_ADDR,
147   udp6_input,	0,		udp6_ctlinput,	ip6_ctloutput,
148   0,
149   0,		0,		0,		0,
150   &udp6_usrreqs,
151 },
152 { SOCK_STREAM,	&inet6domain,	IPPROTO_TCP,	PR_CONNREQUIRED | PR_WANTRCVD,
153   tcp6_input,	0,		tcp6_ctlinput,	tcp_ctloutput,
154   0,
155 #ifdef INET	/* don't call timeout routines twice */
156   tcp_init,	0,		0,		tcp_drain,
157 #else
158   tcp_init,	tcp_fasttimo,	tcp_slowtimo,	tcp_drain,
159 #endif
160   &tcp6_usrreqs,
161 },
162 { SOCK_RAW,	&inet6domain,	IPPROTO_RAW,	PR_ATOMIC | PR_ADDR,
163   rip6_input,	rip6_output,	rip6_ctlinput,	rip6_ctloutput,
164   0,
165   0,		0,		0,		0,
166   &rip6_usrreqs
167 },
168 { SOCK_RAW,	&inet6domain,	IPPROTO_ICMPV6,	PR_ATOMIC | PR_ADDR,
169   icmp6_input,	rip6_output,	0,		rip6_ctloutput,
170   0,
171   icmp6_init,	icmp6_fasttimo,	0,		0,
172   &rip6_usrreqs
173 },
174 { SOCK_RAW,	&inet6domain,	IPPROTO_DSTOPTS,PR_ATOMIC|PR_ADDR,
175   dest6_input,	0,	 	0,		0,
176   0,
177   0,		0,		0,		0,
178   &nousrreqs
179 },
180 { SOCK_RAW,	&inet6domain,	IPPROTO_ROUTING,PR_ATOMIC|PR_ADDR,
181   route6_input,	0,	 	0,		0,
182   0,
183   0,		0,		0,		0,
184   &nousrreqs
185 },
186 { SOCK_RAW,	&inet6domain,	IPPROTO_FRAGMENT,PR_ATOMIC|PR_ADDR,
187   frag6_input,	0,	 	0,		0,
188   0,
189   0,		0,		0,		0,
190   &nousrreqs
191 },
192 #ifdef IPSEC
193 { SOCK_RAW,	&inet6domain,	IPPROTO_AH,	PR_ATOMIC|PR_ADDR,
194   ah6_input,	0,	 	0,		0,
195   0,
196   0,		0,		0,		0,
197   &nousrreqs,
198 },
199 #ifdef IPSEC_ESP
200 { SOCK_RAW,	&inet6domain,	IPPROTO_ESP,	PR_ATOMIC|PR_ADDR,
201   esp6_input,	0,	 	0,		0,
202   0,
203   0,		0,		0,		0,
204   &nousrreqs,
205 },
206 #endif
207 { SOCK_RAW,	&inet6domain,	IPPROTO_IPCOMP,	PR_ATOMIC|PR_ADDR,
208   ipcomp6_input, 0,	 	0,		0,
209   0,
210   0,		0,		0,		0,
211   &nousrreqs,
212 },
213 #endif /* IPSEC */
214 #ifdef INET
215 { SOCK_RAW,	&inet6domain,	IPPROTO_IPV4,	PR_ATOMIC|PR_ADDR,
216   encap6_input,	rip6_output, 	0,		rip6_ctloutput,
217   0,
218   0,		0,		0,		0,
219   &rip6_usrreqs
220 },
221 #endif /*INET*/
222 { SOCK_RAW,	&inet6domain,	IPPROTO_IPV6,	PR_ATOMIC|PR_ADDR,
223   encap6_input, rip6_output,	 0,	rip6_ctloutput,
224   0,
225 #ifndef INET
226   encap_init,	0,		0,		0,
227 #else
228   0,		0,		0,		0,
229 #endif
230   &rip6_usrreqs
231 },
232 { SOCK_RAW,     &inet6domain,	IPPROTO_PIM,	PR_ATOMIC|PR_ADDR,
233   pim6_input,    rip6_output,	0,              rip6_ctloutput,
234   0,
235   0,            0,              0,              0,
236   &rip6_usrreqs
237 },
238 /* raw wildcard */
239 { SOCK_RAW,	&inet6domain,	0,		PR_ATOMIC | PR_ADDR,
240   rip6_input,	rip6_output,	0,		rip6_ctloutput,
241   0, 0,
242   0,		0,		0,
243   &rip6_usrreqs
244 },
245 };
246 
247 #if NGIF > 0
248 struct ip6protosw in6_gif_protosw =
249 { SOCK_RAW,	&inet6domain,	0/*IPPROTO_IPV[46]*/,	PR_ATOMIC|PR_ADDR,
250   in6_gif_input, rip6_output,	0,		rip6_ctloutput,
251   0,
252   0,            0,              0,              0,
253   &rip6_usrreqs
254 };
255 #endif /*NGIF*/
256 
257 extern int in6_inithead __P((void **, int));
258 
259 struct domain inet6domain =
260     { AF_INET6, "internet6", 0, 0, 0,
261       (struct protosw *)inet6sw,
262       (struct protosw *)&inet6sw[sizeof(inet6sw)/sizeof(inet6sw[0])], 0,
263       in6_inithead,
264       offsetof(struct sockaddr_in6, sin6_addr) << 3,
265       sizeof(struct sockaddr_in6) };
266 
267 DOMAIN_SET(inet6);
268 
269 /*
270  * Internet configuration info
271  */
272 #ifndef	IPV6FORWARDING
273 #ifdef GATEWAY6
274 #define	IPV6FORWARDING	1	/* forward IP6 packets not for us */
275 #else
276 #define	IPV6FORWARDING	0	/* don't forward IP6 packets not for us */
277 #endif /* GATEWAY6 */
278 #endif /* !IPV6FORWARDING */
279 
280 #ifndef	IPV6_SENDREDIRECTS
281 #define	IPV6_SENDREDIRECTS	1
282 #endif
283 
284 int	ip6_forwarding = IPV6FORWARDING;	/* act as router? */
285 int	ip6_sendredirects = IPV6_SENDREDIRECTS;
286 int	ip6_defhlim = IPV6_DEFHLIM;
287 int	ip6_defmcasthlim = IPV6_DEFAULT_MULTICAST_HOPS;
288 int	ip6_accept_rtadv = 0;	/* "IPV6FORWARDING ? 0 : 1" is dangerous */
289 int	ip6_maxfragpackets = 200;
290 int	ip6_log_interval = 5;
291 int	ip6_hdrnestlimit = 50;	/* appropriate? */
292 int	ip6_dad_count = 1;	/* DupAddrDetectionTransmits */
293 u_int32_t ip6_flow_seq;
294 int	ip6_auto_flowlabel = 1;
295 #if NGIF > 0
296 int	ip6_gif_hlim = GIF_HLIM;
297 #else
298 int	ip6_gif_hlim = 0;
299 #endif
300 int	ip6_use_deprecated = 1;	/* allow deprecated addr (RFC2462 5.5.4) */
301 int	ip6_rr_prune = 5;	/* router renumbering prefix
302 				 * walk list every 5 sec.    */
303 int	ip6_mapped_addr_on = 1;
304 
305 u_int32_t ip6_id = 0UL;
306 int	ip6_keepfaith = 0;
307 time_t	ip6_log_time = (time_t)0L;
308 
309 /* icmp6 */
310 /*
311  * BSDI4 defines these variables in in_proto.c...
312  * XXX: what if we don't define INET? Should we define pmtu6_expire
313  * or so? (jinmei@kame.net 19990310)
314  */
315 int pmtu_expire = 60*10;
316 int pmtu_probe = 60*2;
317 
318 /* raw IP6 parameters */
319 /*
320  * Nominal space allocated to a raw ip socket.
321  */
322 #define	RIPV6SNDQ	8192
323 #define	RIPV6RCVQ	8192
324 
325 u_long	rip6_sendspace = RIPV6SNDQ;
326 u_long	rip6_recvspace = RIPV6RCVQ;
327 
328 /* ICMPV6 parameters */
329 int	icmp6_rediraccept = 1;		/* accept and process redirects */
330 int	icmp6_redirtimeout = 10 * 60;	/* 10 minutes */
331 struct timeval icmp6errratelim = { 0, 0 };	/* no ratelimit */
332 int	icmp6errppslim = 100;		/* 100pps */
333 int	icmp6_nodeinfo = 1;		/* enable/disable NI response */
334 
335 #ifdef TCP6
336 /* TCP on IP6 parameters */
337 int	tcp6_sendspace = 1024 * 8;
338 int	tcp6_recvspace = 1024 * 8;
339 int 	tcp6_mssdflt = TCP6_MSS;
340 int 	tcp6_rttdflt = TCP6TV_SRTTDFLT / PR_SLOWHZ;
341 int	tcp6_do_rfc1323 = 1;
342 int	tcp6_conntimeo = TCP6TV_KEEP_INIT;	/* initial connection timeout */
343 int	tcp6_43maxseg = 0;
344 int	tcp6_pmtu = 0;
345 
346 /*
347  * Parameters for keepalive option.
348  * Connections for which SO_KEEPALIVE is set will be probed
349  * after being idle for a time of tcp6_keepidle (in units of PR_SLOWHZ).
350  * Starting at that time, the connection is probed at intervals
351  * of tcp6_keepintvl (same units) until a response is received
352  * or until tcp6_keepcnt probes have been made, at which time
353  * the connection is dropped.  Note that a tcp6_keepidle value
354  * under 2 hours is nonconformant with RFC-1122, Internet Host Requirements.
355  */
356 int	tcp6_keepidle = TCP6TV_KEEP_IDLE;	/* time before probing idle */
357 int	tcp6_keepintvl = TCP6TV_KEEPINTVL;	/* interval betwn idle probes */
358 int	tcp6_keepcnt = TCP6TV_KEEPCNT;		/* max idle probes */
359 int	tcp6_maxpersistidle = TCP6TV_KEEP_IDLE;	/* max idle time in persist */
360 
361 #ifndef INET_SERVER
362 #define	TCP6_LISTEN_HASH_SIZE	17
363 #define	TCP6_CONN_HASH_SIZE	97
364 #define	TCP6_SYN_HASH_SIZE	293
365 #define	TCP6_SYN_BUCKET_SIZE	35
366 #else
367 #define	TCP6_LISTEN_HASH_SIZE	97
368 #define	TCP6_CONN_HASH_SIZE	9973
369 #define	TCP6_SYN_HASH_SIZE	997
370 #define	TCP6_SYN_BUCKET_SIZE	35
371 #endif
372 int	tcp6_listen_hash_size = TCP6_LISTEN_HASH_SIZE;
373 int	tcp6_conn_hash_size = TCP6_CONN_HASH_SIZE;
374 struct	tcp6_hash_list tcp6_listen_hash[TCP6_LISTEN_HASH_SIZE],
375 	tcp6_conn_hash[TCP6_CONN_HASH_SIZE];
376 
377 int	tcp6_syn_cache_size = TCP6_SYN_HASH_SIZE;
378 int	tcp6_syn_cache_limit = TCP6_SYN_HASH_SIZE*TCP6_SYN_BUCKET_SIZE;
379 int	tcp6_syn_bucket_limit = 3*TCP6_SYN_BUCKET_SIZE;
380 struct	syn_cache_head6 tcp6_syn_cache[TCP6_SYN_HASH_SIZE];
381 struct	syn_cache_head6 *tcp6_syn_cache_first;
382 int	tcp6_syn_cache_interval = 8;	/* runs timer every 4 seconds */
383 int	tcp6_syn_cache_timeo = TCP6TV_KEEP_INIT;
384 
385 /*
386  * Parameters for computing a desirable data segment size
387  * given an upper bound (either interface MTU, or peer's MSS option)_.
388  * As applications tend to use a buffer size that is a multiple
389  * of kilobytes, try for something that divides evenly. However,
390  * do not round down too much.
391  *
392  * Round segment size down to a multiple of TCP6_ROUNDSIZE if this
393  * does not result in lowering by more than (size/TCP6_ROUNDFRAC).
394  * For example, round 536 to 512.  Older versions of the system
395  * effectively used MCLBYTES (1K or 2K) as TCP6_ROUNDSIZE, with
396  * a value of 1 for TCP6_ROUNDFRAC (eliminating its effect).
397  * We round to a multiple of 256 for SLIP.
398  */
399 #ifndef	TCP6_ROUNDSIZE
400 #define	TCP6_ROUNDSIZE	256	/* round to multiple of 256 */
401 #endif
402 #ifndef	TCP6_ROUNDFRAC
403 #define	TCP6_ROUNDFRAC	10	/* round down at most N/10, or 10% */
404 #endif
405 
406 int	tcp6_roundsize = TCP6_ROUNDSIZE;
407 int	tcp6_roundfrac = TCP6_ROUNDFRAC;
408 #endif /*TCP6*/
409 
410 /* UDP on IP6 parameters */
411 int	udp6_sendspace = 9216;		/* really max datagram size */
412 int	udp6_recvspace = 40 * (1024 + sizeof(struct sockaddr_in6));
413 					/* 40 1K datagrams */
414 
415 /*
416  * sysctl related items.
417  */
418 SYSCTL_NODE(_net,	PF_INET6,	inet6,	CTLFLAG_RW,	0,
419 	"Internet6 Family");
420 
421 /* net.inet6 */
422 SYSCTL_NODE(_net_inet6,	IPPROTO_IPV6,	ip6,	CTLFLAG_RW, 0,	"IP6");
423 SYSCTL_NODE(_net_inet6,	IPPROTO_ICMPV6,	icmp6,	CTLFLAG_RW, 0,	"ICMP6");
424 SYSCTL_NODE(_net_inet6,	IPPROTO_UDP,	udp6,	CTLFLAG_RW, 0,	"UDP6");
425 SYSCTL_NODE(_net_inet6,	IPPROTO_TCP,	tcp6,	CTLFLAG_RW, 0,	"TCP6");
426 #ifdef IPSEC
427 SYSCTL_NODE(_net_inet6,	IPPROTO_ESP,	ipsec6,	CTLFLAG_RW, 0,	"IPSEC6");
428 #endif /* IPSEC */
429 
430 /* net.inet6.ip6 */
431 static int
432 sysctl_ip6_forwarding(SYSCTL_HANDLER_ARGS)
433 {
434 	int error = 0;
435 	int old_ip6_forwarding;
436 	int changed;
437 
438 	error = SYSCTL_OUT(req, arg1, sizeof(int));
439 	if (error || !req->newptr)
440 		return (error);
441 	old_ip6_forwarding = ip6_forwarding;
442 	error = SYSCTL_IN(req, arg1, sizeof(int));
443 	if (error != 0)
444 		return (error);
445 	changed = (ip6_forwarding ? 1 : 0) ^ (old_ip6_forwarding ? 1 : 0);
446 	if (changed == 0)
447 		return (error);
448 	/*
449 	 * XXX while host->router removes prefix got from RA,
450 	 * router->host case nukes all the prefixes managed by in6_prefix.c
451 	 * (both RR and static).  therefore, switching from host->router->host
452 	 * will remove statically configured addresses/prefixes.
453 	 * not sure if it is intended behavior or not.
454 	 */
455 	if (ip6_forwarding != 0) {	/* host becomes router */
456 		int s = splnet();
457 		struct nd_prefix *pr, *next;
458 
459 		for (pr = nd_prefix.lh_first; pr; pr = next) {
460 			next = pr->ndpr_next;
461 			if (!IN6_IS_ADDR_UNSPECIFIED(&pr->ndpr_addr))
462 				in6_ifdel(pr->ndpr_ifp, &pr->ndpr_addr);
463 			prelist_remove(pr);
464 		}
465 		splx(s);
466 	} else {			/* router becomes host */
467 		while(!LIST_EMPTY(&rr_prefix))
468 			delete_each_prefix(LIST_FIRST(&rr_prefix),
469 					   PR_ORIG_KERNEL);
470 	}
471 
472 	return (error);
473 }
474 
475 static int
476 sysctl_icmp6_ratelimit (SYSCTL_HANDLER_ARGS)
477 {
478 	int rate_usec, error, s;
479 
480 	/*
481 	 * The sysctl specifies the rate in usec-between-icmp,
482 	 * so we must convert from/to a timeval.
483 	 */
484 	rate_usec = (icmp6errratelim.tv_sec * 1000000) +
485 	    icmp6errratelim.tv_usec;
486 	error = sysctl_handle_int(oidp, &rate_usec, 0, req);
487 	if (error)
488 		return (error);
489 	if (rate_usec < 0)
490 		return (EINVAL);
491 	s = splnet();
492 	icmp6errratelim.tv_sec = rate_usec / 1000000;
493 	icmp6errratelim.tv_usec = rate_usec % 1000000;
494 	splx(s);
495 
496 	return (0);
497 }
498 
499 SYSCTL_OID(_net_inet6_ip6, IPV6CTL_FORWARDING, forwarding,
500 	   CTLTYPE_INT|CTLFLAG_RW, &ip6_forwarding, 0, sysctl_ip6_forwarding,
501 	   "I", "");
502 SYSCTL_INT(_net_inet6_ip6, IPV6CTL_SENDREDIRECTS,
503 	redirect, CTLFLAG_RW,		&ip6_sendredirects,	0, "");
504 SYSCTL_INT(_net_inet6_ip6, IPV6CTL_DEFHLIM,
505 	hlim, CTLFLAG_RW,		&ip6_defhlim,	0, "");
506 SYSCTL_INT(_net_inet6_ip6, IPV6CTL_MAXFRAGPACKETS,
507 	maxfragpackets, CTLFLAG_RW,	&ip6_maxfragpackets,	0, "");
508 SYSCTL_INT(_net_inet6_ip6, IPV6CTL_ACCEPT_RTADV,
509 	accept_rtadv, CTLFLAG_RW,	&ip6_accept_rtadv,	0, "");
510 SYSCTL_INT(_net_inet6_ip6, IPV6CTL_KEEPFAITH,
511 	keepfaith, CTLFLAG_RW,		&ip6_keepfaith,	0, "");
512 SYSCTL_INT(_net_inet6_ip6, IPV6CTL_LOG_INTERVAL,
513 	log_interval, CTLFLAG_RW,	&ip6_log_interval,	0, "");
514 SYSCTL_INT(_net_inet6_ip6, IPV6CTL_HDRNESTLIMIT,
515 	hdrnestlimit, CTLFLAG_RW,	&ip6_hdrnestlimit,	0, "");
516 SYSCTL_INT(_net_inet6_ip6, IPV6CTL_DAD_COUNT,
517 	dad_count, CTLFLAG_RW,	&ip6_dad_count,	0, "");
518 SYSCTL_INT(_net_inet6_ip6, IPV6CTL_AUTO_FLOWLABEL,
519 	auto_flowlabel, CTLFLAG_RW,	&ip6_auto_flowlabel,	0, "");
520 SYSCTL_INT(_net_inet6_ip6, IPV6CTL_DEFMCASTHLIM,
521 	defmcasthlim, CTLFLAG_RW,	&ip6_defmcasthlim,	0, "");
522 SYSCTL_INT(_net_inet6_ip6, IPV6CTL_GIF_HLIM,
523 	gifhlim, CTLFLAG_RW,	&ip6_gif_hlim,			0, "");
524 SYSCTL_STRING(_net_inet6_ip6, IPV6CTL_KAME_VERSION,
525 	kame_version, CTLFLAG_RD,	__KAME_VERSION,		0, "");
526 SYSCTL_INT(_net_inet6_ip6, IPV6CTL_USE_DEPRECATED,
527 	use_deprecated, CTLFLAG_RW,	&ip6_use_deprecated,	0, "");
528 SYSCTL_INT(_net_inet6_ip6, IPV6CTL_RR_PRUNE,
529 	rr_prune, CTLFLAG_RW,	&ip6_rr_prune,			0, "");
530 SYSCTL_INT(_net_inet6_ip6, IPV6CTL_MAPPED_ADDR,
531 	mapped_addr, CTLFLAG_RW,	&ip6_mapped_addr_on,	0, "");
532 
533 /* net.inet6.icmp6 */
534 SYSCTL_INT(_net_inet6_icmp6, ICMPV6CTL_REDIRACCEPT,
535 	rediraccept, CTLFLAG_RW,	&icmp6_rediraccept,	0, "");
536 SYSCTL_INT(_net_inet6_icmp6, ICMPV6CTL_REDIRTIMEOUT,
537 	redirtimeout, CTLFLAG_RW,	&icmp6_redirtimeout,	0, "");
538 SYSCTL_STRUCT(_net_inet6_icmp6, ICMPV6CTL_STATS, stats, CTLFLAG_RD,
539 	&icmp6stat, icmp6stat, "");
540 SYSCTL_PROC(_net_inet6_icmp6, ICMPV6CTL_ERRRATELIMIT,
541 	errratelimit, CTLTYPE_INT|CTLFLAG_RW,
542 	0, sizeof(int), sysctl_icmp6_ratelimit, "I", "");
543 SYSCTL_INT(_net_inet6_icmp6, ICMPV6CTL_ND6_PRUNE,
544 	nd6_prune, CTLFLAG_RW,		&nd6_prune,	0, "");
545 SYSCTL_INT(_net_inet6_icmp6, ICMPV6CTL_ND6_DELAY,
546 	nd6_delay, CTLFLAG_RW,		&nd6_delay,	0, "");
547 SYSCTL_INT(_net_inet6_icmp6, ICMPV6CTL_ND6_UMAXTRIES,
548 	nd6_umaxtries, CTLFLAG_RW,	&nd6_umaxtries,	0, "");
549 SYSCTL_INT(_net_inet6_icmp6, ICMPV6CTL_ND6_MMAXTRIES,
550 	nd6_mmaxtries, CTLFLAG_RW,	&nd6_mmaxtries,	0, "");
551 SYSCTL_INT(_net_inet6_icmp6, ICMPV6CTL_ND6_USELOOPBACK,
552 	nd6_useloopback, CTLFLAG_RW,	&nd6_useloopback, 0, "");
553 SYSCTL_INT(_net_inet6_icmp6, ICMPV6CTL_NODEINFO,
554 	nodeinfo, CTLFLAG_RW,	&icmp6_nodeinfo,	0, "");
555 SYSCTL_INT(_net_inet6_icmp6, ICMPV6CTL_ERRPPSLIMIT,
556 	errppslimit, CTLFLAG_RW,	&icmp6errppslim,	0, "");
557 SYSCTL_INT(_net_inet6_icmp6, ICMPV6CTL_ND6_MAXNUDHINT,
558 	nd6_maxnudhint, CTLFLAG_RW,	&nd6_maxnudhint, 0, "");
559