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