]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - sys/netinet6/in6_proto.c
import ath hal
[FreeBSD/FreeBSD.git] / sys / netinet6 / in6_proto.c
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 #ifdef VIMAGE_GLOBALS
372 int     ip6_forwarding;
373 int     ip6_sendredirects;
374 int     ip6_defhlim;
375 int     ip6_defmcasthlim;
376 int     ip6_accept_rtadv;
377 int     ip6_maxfragpackets;
378 int     ip6_maxfrags;
379 int     ip6_log_interval;
380 int     ip6_hdrnestlimit;
381 int     ip6_dad_count;
382 int     ip6_auto_flowlabel;
383 int     ip6_use_deprecated;
384 int     ip6_rr_prune;
385 int     ip6_mcast_pmtu;
386 int     ip6_v6only;
387 int     ip6_keepfaith;
388 time_t  ip6_log_time;
389 int     ip6stealth;
390 int     nd6_onlink_ns_rfc4861;
391 #endif
392
393 #ifdef VIMAGE_GLOBALS
394 /* icmp6 */
395 /*
396  * BSDI4 defines these variables in in_proto.c...
397  * XXX: what if we don't define INET? Should we define pmtu6_expire
398  * or so? (jinmei@kame.net 19990310)
399  */
400 int pmtu_expire;
401 int pmtu_probe;
402
403 /* raw IP6 parameters */
404 /*
405  * Nominal space allocated to a raw ip socket.
406  */
407 u_long  rip6_sendspace;
408 u_long  rip6_recvspace;
409
410 /* ICMPV6 parameters */
411 int     icmp6_rediraccept;
412 int     icmp6_redirtimeout;
413 int     icmp6errppslim;
414 /* control how to respond to NI queries */
415 int     icmp6_nodeinfo;
416
417 /* UDP on IP6 parameters */
418 int     udp6_sendspace;
419 int     udp6_recvspace;
420 #endif /* VIMAGE_GLOBALS */
421
422 /*
423  * sysctl related items.
424  */
425 SYSCTL_NODE(_net,       PF_INET6,       inet6,  CTLFLAG_RW,     0,
426         "Internet6 Family");
427
428 /* net.inet6 */
429 SYSCTL_NODE(_net_inet6, IPPROTO_IPV6,   ip6,    CTLFLAG_RW, 0,  "IP6");
430 SYSCTL_NODE(_net_inet6, IPPROTO_ICMPV6, icmp6,  CTLFLAG_RW, 0,  "ICMP6");
431 SYSCTL_NODE(_net_inet6, IPPROTO_UDP,    udp6,   CTLFLAG_RW, 0,  "UDP6");
432 SYSCTL_NODE(_net_inet6, IPPROTO_TCP,    tcp6,   CTLFLAG_RW, 0,  "TCP6");
433 #ifdef SCTP
434 SYSCTL_NODE(_net_inet6, IPPROTO_SCTP,   sctp6,  CTLFLAG_RW, 0,  "SCTP6");
435 #endif
436 #ifdef IPSEC
437 SYSCTL_NODE(_net_inet6, IPPROTO_ESP,    ipsec6, CTLFLAG_RW, 0,  "IPSEC6");
438 #endif /* IPSEC */
439
440 /* net.inet6.ip6 */
441 static int
442 sysctl_ip6_temppltime(SYSCTL_HANDLER_ARGS)
443 {
444         INIT_VNET_INET6(curvnet);
445         int error = 0;
446         int old;
447
448         error = SYSCTL_OUT(req, arg1, sizeof(int));
449         if (error || !req->newptr)
450                 return (error);
451         old = V_ip6_temp_preferred_lifetime;
452         error = SYSCTL_IN(req, arg1, sizeof(int));
453         if (V_ip6_temp_preferred_lifetime <
454             V_ip6_desync_factor + V_ip6_temp_regen_advance) {
455                 V_ip6_temp_preferred_lifetime = old;
456                 return (EINVAL);
457         }
458         return (error);
459 }
460
461 static int
462 sysctl_ip6_tempvltime(SYSCTL_HANDLER_ARGS)
463 {
464         INIT_VNET_INET6(curvnet);
465         int error = 0;
466         int old;
467
468         error = SYSCTL_OUT(req, arg1, sizeof(int));
469         if (error || !req->newptr)
470                 return (error);
471         old = V_ip6_temp_valid_lifetime;
472         error = SYSCTL_IN(req, arg1, sizeof(int));
473         if (V_ip6_temp_valid_lifetime < V_ip6_temp_preferred_lifetime) {
474                 V_ip6_temp_preferred_lifetime = old;
475                 return (EINVAL);
476         }
477         return (error);
478 }
479
480 SYSCTL_V_INT(V_NET, vnet_inet6, _net_inet6_ip6, IPV6CTL_FORWARDING,
481         forwarding, CTLFLAG_RW,         ip6_forwarding, 0, "");
482 SYSCTL_V_INT(V_NET, vnet_inet6, _net_inet6_ip6, IPV6CTL_SENDREDIRECTS,
483         redirect, CTLFLAG_RW,           ip6_sendredirects,      0, "");
484 SYSCTL_V_INT(V_NET, vnet_inet6, _net_inet6_ip6, IPV6CTL_DEFHLIM,
485         hlim, CTLFLAG_RW,               ip6_defhlim,    0, "");
486 SYSCTL_V_STRUCT(V_NET, vnet_inet6, _net_inet6_ip6, IPV6CTL_STATS, stats,
487         CTLFLAG_RD, ip6stat, ip6stat, "");
488 SYSCTL_V_INT(V_NET, vnet_inet6, _net_inet6_ip6, IPV6CTL_MAXFRAGPACKETS,
489         maxfragpackets, CTLFLAG_RW,     ip6_maxfragpackets,     0, "");
490 SYSCTL_V_INT(V_NET, vnet_inet6, _net_inet6_ip6, IPV6CTL_ACCEPT_RTADV,
491         accept_rtadv, CTLFLAG_RW,       ip6_accept_rtadv,       0, "");
492 SYSCTL_V_INT(V_NET, vnet_inet6, _net_inet6_ip6, IPV6CTL_KEEPFAITH,
493         keepfaith, CTLFLAG_RW,          ip6_keepfaith,  0, "");
494 SYSCTL_V_INT(V_NET, vnet_inet6, _net_inet6_ip6, IPV6CTL_LOG_INTERVAL,
495         log_interval, CTLFLAG_RW,       ip6_log_interval,       0, "");
496 SYSCTL_V_INT(V_NET, vnet_inet6, _net_inet6_ip6, IPV6CTL_HDRNESTLIMIT,
497         hdrnestlimit, CTLFLAG_RW,       ip6_hdrnestlimit,       0, "");
498 SYSCTL_V_INT(V_NET, vnet_inet6, _net_inet6_ip6, IPV6CTL_DAD_COUNT,
499         dad_count, CTLFLAG_RW,  ip6_dad_count,  0, "");
500 SYSCTL_V_INT(V_NET, vnet_inet6, _net_inet6_ip6, IPV6CTL_AUTO_FLOWLABEL,
501         auto_flowlabel, CTLFLAG_RW,     ip6_auto_flowlabel,     0, "");
502 SYSCTL_V_INT(V_NET, vnet_inet6, _net_inet6_ip6, IPV6CTL_DEFMCASTHLIM,
503         defmcasthlim, CTLFLAG_RW,       ip6_defmcasthlim,       0, "");
504 SYSCTL_STRING(_net_inet6_ip6, IPV6CTL_KAME_VERSION,
505         kame_version, CTLFLAG_RD,       __KAME_VERSION,         0, "");
506 SYSCTL_V_INT(V_NET, vnet_inet6, _net_inet6_ip6, IPV6CTL_USE_DEPRECATED,
507         use_deprecated, CTLFLAG_RW,     ip6_use_deprecated,     0, "");
508 SYSCTL_V_INT(V_NET, vnet_inet6, _net_inet6_ip6, IPV6CTL_RR_PRUNE,
509         rr_prune, CTLFLAG_RW,   ip6_rr_prune,                   0, "");
510 SYSCTL_V_INT(V_NET, vnet_inet6, _net_inet6_ip6, IPV6CTL_USETEMPADDR,
511         use_tempaddr, CTLFLAG_RW, ip6_use_tempaddr,             0, "");
512 SYSCTL_V_OID(V_NET, vnet_inet6, _net_inet6_ip6, IPV6CTL_TEMPPLTIME, temppltime,
513         CTLTYPE_INT|CTLFLAG_RW, ip6_temp_preferred_lifetime, 0,
514         sysctl_ip6_temppltime, "I", "");
515 SYSCTL_V_OID(V_NET, vnet_inet6, _net_inet6_ip6, IPV6CTL_TEMPVLTIME, tempvltime,
516         CTLTYPE_INT|CTLFLAG_RW, ip6_temp_valid_lifetime, 0,
517         sysctl_ip6_tempvltime, "I", "");
518 SYSCTL_V_INT(V_NET, vnet_inet6, _net_inet6_ip6, IPV6CTL_V6ONLY,
519         v6only, CTLFLAG_RW,     ip6_v6only,                     0, "");
520 #ifndef VIMAGE
521 TUNABLE_INT("net.inet6.ip6.auto_linklocal", &ip6_auto_linklocal);
522 #endif
523 SYSCTL_V_INT(V_NET, vnet_inet6, _net_inet6_ip6, IPV6CTL_AUTO_LINKLOCAL,
524         auto_linklocal, CTLFLAG_RW, ip6_auto_linklocal, 0, "");
525 SYSCTL_V_STRUCT(V_NET, vnet_inet6, _net_inet6_ip6, IPV6CTL_RIP6STATS,
526         rip6stats, CTLFLAG_RD, rip6stat, rip6stat, "");
527 SYSCTL_V_INT(V_NET, vnet_inet6, _net_inet6_ip6, IPV6CTL_PREFER_TEMPADDR,
528         prefer_tempaddr, CTLFLAG_RW, ip6_prefer_tempaddr, 0, "");
529 SYSCTL_V_INT(V_NET, vnet_inet6, _net_inet6_ip6, IPV6CTL_USE_DEFAULTZONE,
530         use_defaultzone, CTLFLAG_RW, ip6_use_defzone, 0,"");
531 SYSCTL_V_INT(V_NET, vnet_inet6, _net_inet6_ip6, IPV6CTL_MAXFRAGS,
532         maxfrags, CTLFLAG_RW, ip6_maxfrags, 0, "");
533 SYSCTL_V_INT(V_NET, vnet_inet6, _net_inet6_ip6, IPV6CTL_MCAST_PMTU,
534         mcast_pmtu, CTLFLAG_RW, ip6_mcast_pmtu, 0, "");
535 #ifdef IPSTEALTH
536 SYSCTL_V_INT(V_NET, vnet_inet6, _net_inet6_ip6, IPV6CTL_STEALTH,
537         stealth, CTLFLAG_RW, ip6stealth, 0, "");
538 #endif
539
540 /* net.inet6.icmp6 */
541 SYSCTL_V_INT(V_NET, vnet_inet6, _net_inet6_icmp6, ICMPV6CTL_REDIRACCEPT,
542         rediraccept, CTLFLAG_RW,        icmp6_rediraccept,      0, "");
543 SYSCTL_V_INT(V_NET, vnet_inet6, _net_inet6_icmp6, ICMPV6CTL_REDIRTIMEOUT,
544         redirtimeout, CTLFLAG_RW,       icmp6_redirtimeout,     0, "");
545 SYSCTL_V_STRUCT(V_NET, vnet_inet6, _net_inet6_icmp6, ICMPV6CTL_STATS,
546         stats, CTLFLAG_RD, icmp6stat, icmp6stat, "");
547 SYSCTL_V_INT(V_NET, vnet_inet6, _net_inet6_icmp6, ICMPV6CTL_ND6_PRUNE,
548         nd6_prune, CTLFLAG_RW,          nd6_prune,      0, "");
549 SYSCTL_V_INT(V_NET, vnet_inet6, _net_inet6_icmp6, ICMPV6CTL_ND6_DELAY,
550         nd6_delay, CTLFLAG_RW,          nd6_delay,      0, "");
551 SYSCTL_V_INT(V_NET, vnet_inet6, _net_inet6_icmp6, ICMPV6CTL_ND6_UMAXTRIES,
552         nd6_umaxtries, CTLFLAG_RW,      nd6_umaxtries,  0, "");
553 SYSCTL_V_INT(V_NET, vnet_inet6, _net_inet6_icmp6, ICMPV6CTL_ND6_MMAXTRIES,
554         nd6_mmaxtries, CTLFLAG_RW,      nd6_mmaxtries,  0, "");
555 SYSCTL_V_INT(V_NET, vnet_inet6, _net_inet6_icmp6, ICMPV6CTL_ND6_USELOOPBACK,
556         nd6_useloopback, CTLFLAG_RW,    nd6_useloopback, 0, "");
557 SYSCTL_V_INT(V_NET, vnet_inet6, _net_inet6_icmp6, ICMPV6CTL_NODEINFO,
558         nodeinfo, CTLFLAG_RW,   icmp6_nodeinfo, 0, "");
559 SYSCTL_V_INT(V_NET, vnet_inet6, _net_inet6_icmp6, ICMPV6CTL_ERRPPSLIMIT,
560         errppslimit, CTLFLAG_RW,        icmp6errppslim, 0, "");
561 SYSCTL_V_INT(V_NET, vnet_inet6, _net_inet6_icmp6, ICMPV6CTL_ND6_MAXNUDHINT,
562         nd6_maxnudhint, CTLFLAG_RW,     nd6_maxnudhint, 0, "");
563 SYSCTL_V_INT(V_NET, vnet_inet6, _net_inet6_icmp6, ICMPV6CTL_ND6_DEBUG,
564         nd6_debug, CTLFLAG_RW,  nd6_debug,              0, "");
565
566 SYSCTL_V_INT(V_NET, vnet_inet6, _net_inet6_icmp6, ICMPV6CTL_ND6_ONLINKNSRFC4861,
567         nd6_onlink_ns_rfc4861, CTLFLAG_RW, nd6_onlink_ns_rfc4861, 0,
568         "Accept 'on-link' nd6 NS in compliance with RFC 4861.");