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