in6_proto.c revision 183550
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: head/sys/netinet6/in6_proto.c 183550 2008-10-02 15:37:58Z zec $");
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
136extern	struct domain inet6domain;
137static	struct pr_usrreqs nousrreqs;
138
139#define PR_LISTEN	0
140#define PR_ABRTACPTDIS	0
141
142struct 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
347extern int in6_inithead(void **, int);
348
349struct 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
366DOMAIN_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
383int	ip6_forwarding = IPV6FORWARDING;	/* act as router? */
384int	ip6_sendredirects = IPV6_SENDREDIRECTS;
385int	ip6_defhlim = IPV6_DEFHLIM;
386int	ip6_defmcasthlim = IPV6_DEFAULT_MULTICAST_HOPS;
387int	ip6_accept_rtadv = 0;	/* "IPV6FORWARDING ? 0 : 1" is dangerous */
388int	ip6_maxfragpackets;	/* initialized in frag6.c:frag6_init() */
389int	ip6_maxfrags;	/* initialized in frag6.c:frag6_init() */
390int	ip6_log_interval = 5;
391int	ip6_hdrnestlimit = 15;	/* How many header options will we process? */
392int	ip6_dad_count = 1;	/* DupAddrDetectionTransmits */
393int	ip6_auto_flowlabel = 1;
394int	ip6_gif_hlim = 0;
395int	ip6_use_deprecated = 1;	/* allow deprecated addr (RFC2462 5.5.4) */
396int	ip6_rr_prune = 5;	/* router renumbering prefix
397				 * walk list every 5 sec. */
398int	ip6_mcast_pmtu = 0;	/* enable pMTU discovery for multicast? */
399int	ip6_v6only = 1;
400
401int	ip6_keepfaith = 0;
402time_t	ip6_log_time = (time_t)0L;
403#ifdef IPSTEALTH
404int	ip6stealth = 0;
405#endif
406int	nd6_onlink_ns_rfc4861 = 0; /* allow 'on-link' nd6 NS (as in RFC 4861) */
407
408/* icmp6 */
409/*
410 * BSDI4 defines these variables in in_proto.c...
411 * XXX: what if we don't define INET? Should we define pmtu6_expire
412 * or so? (jinmei@kame.net 19990310)
413 */
414int pmtu_expire = 60*10;
415int pmtu_probe = 60*2;
416
417/* raw IP6 parameters */
418/*
419 * Nominal space allocated to a raw ip socket.
420 */
421#define	RIPV6SNDQ	8192
422#define	RIPV6RCVQ	8192
423
424u_long	rip6_sendspace = RIPV6SNDQ;
425u_long	rip6_recvspace = RIPV6RCVQ;
426
427/* ICMPV6 parameters */
428int	icmp6_rediraccept = 1;		/* accept and process redirects */
429int	icmp6_redirtimeout = 10 * 60;	/* 10 minutes */
430int	icmp6errppslim = 100;		/* 100pps */
431/* control how to respond to NI queries */
432int	icmp6_nodeinfo = (ICMP6_NODEINFO_FQDNOK|ICMP6_NODEINFO_NODEADDROK);
433
434/* UDP on IP6 parameters */
435int	udp6_sendspace = 9216;		/* really max datagram size */
436int	udp6_recvspace = 40 * (1024 + sizeof(struct sockaddr_in6));
437					/* 40 1K datagrams */
438
439/*
440 * sysctl related items.
441 */
442SYSCTL_NODE(_net,	PF_INET6,	inet6,	CTLFLAG_RW,	0,
443	"Internet6 Family");
444
445/* net.inet6 */
446SYSCTL_NODE(_net_inet6,	IPPROTO_IPV6,	ip6,	CTLFLAG_RW, 0,	"IP6");
447SYSCTL_NODE(_net_inet6,	IPPROTO_ICMPV6,	icmp6,	CTLFLAG_RW, 0,	"ICMP6");
448SYSCTL_NODE(_net_inet6,	IPPROTO_UDP,	udp6,	CTLFLAG_RW, 0,	"UDP6");
449SYSCTL_NODE(_net_inet6,	IPPROTO_TCP,	tcp6,	CTLFLAG_RW, 0,	"TCP6");
450#ifdef SCTP
451SYSCTL_NODE(_net_inet6,	IPPROTO_SCTP,	sctp6,	CTLFLAG_RW, 0,	"SCTP6");
452#endif
453#ifdef IPSEC
454SYSCTL_NODE(_net_inet6,	IPPROTO_ESP,	ipsec6,	CTLFLAG_RW, 0,	"IPSEC6");
455#endif /* IPSEC */
456
457/* net.inet6.ip6 */
458static int
459sysctl_ip6_temppltime(SYSCTL_HANDLER_ARGS)
460{
461	INIT_VNET_INET6(curvnet);
462	int error = 0;
463	int old;
464
465	error = SYSCTL_OUT(req, arg1, sizeof(int));
466	if (error || !req->newptr)
467		return (error);
468	old = V_ip6_temp_preferred_lifetime;
469	error = SYSCTL_IN(req, arg1, sizeof(int));
470	if (V_ip6_temp_preferred_lifetime <
471	    V_ip6_desync_factor + V_ip6_temp_regen_advance) {
472		V_ip6_temp_preferred_lifetime = old;
473		return (EINVAL);
474	}
475	return (error);
476}
477
478static int
479sysctl_ip6_tempvltime(SYSCTL_HANDLER_ARGS)
480{
481	INIT_VNET_INET6(curvnet);
482	int error = 0;
483	int old;
484
485	error = SYSCTL_OUT(req, arg1, sizeof(int));
486	if (error || !req->newptr)
487		return (error);
488	old = V_ip6_temp_valid_lifetime;
489	error = SYSCTL_IN(req, arg1, sizeof(int));
490	if (V_ip6_temp_valid_lifetime < V_ip6_temp_preferred_lifetime) {
491		V_ip6_temp_preferred_lifetime = old;
492		return (EINVAL);
493	}
494	return (error);
495}
496
497SYSCTL_V_INT(V_NET, vnet_inet6, _net_inet6_ip6, IPV6CTL_FORWARDING,
498	forwarding, CTLFLAG_RW,		ip6_forwarding,	0, "");
499SYSCTL_V_INT(V_NET, vnet_inet6, _net_inet6_ip6, IPV6CTL_SENDREDIRECTS,
500	redirect, CTLFLAG_RW,		ip6_sendredirects,	0, "");
501SYSCTL_V_INT(V_NET, vnet_inet6, _net_inet6_ip6, IPV6CTL_DEFHLIM,
502	hlim, CTLFLAG_RW,		ip6_defhlim,	0, "");
503SYSCTL_V_STRUCT(V_NET, vnet_inet6, _net_inet6_ip6, IPV6CTL_STATS, stats,
504	CTLFLAG_RD, ip6stat, ip6stat, "");
505SYSCTL_V_INT(V_NET, vnet_inet6, _net_inet6_ip6, IPV6CTL_MAXFRAGPACKETS,
506	maxfragpackets, CTLFLAG_RW,	ip6_maxfragpackets,	0, "");
507SYSCTL_V_INT(V_NET, vnet_inet6, _net_inet6_ip6, IPV6CTL_ACCEPT_RTADV,
508	accept_rtadv, CTLFLAG_RW,	ip6_accept_rtadv,	0, "");
509SYSCTL_V_INT(V_NET, vnet_inet6, _net_inet6_ip6, IPV6CTL_KEEPFAITH,
510	keepfaith, CTLFLAG_RW,		ip6_keepfaith,	0, "");
511SYSCTL_V_INT(V_NET, vnet_inet6, _net_inet6_ip6, IPV6CTL_LOG_INTERVAL,
512	log_interval, CTLFLAG_RW,	ip6_log_interval,	0, "");
513SYSCTL_V_INT(V_NET, vnet_inet6, _net_inet6_ip6, IPV6CTL_HDRNESTLIMIT,
514	hdrnestlimit, CTLFLAG_RW,	ip6_hdrnestlimit,	0, "");
515SYSCTL_V_INT(V_NET, vnet_inet6, _net_inet6_ip6, IPV6CTL_DAD_COUNT,
516	dad_count, CTLFLAG_RW,	ip6_dad_count,	0, "");
517SYSCTL_V_INT(V_NET, vnet_inet6, _net_inet6_ip6, IPV6CTL_AUTO_FLOWLABEL,
518	auto_flowlabel, CTLFLAG_RW,	ip6_auto_flowlabel,	0, "");
519SYSCTL_V_INT(V_NET, vnet_inet6, _net_inet6_ip6, IPV6CTL_DEFMCASTHLIM,
520	defmcasthlim, CTLFLAG_RW,	ip6_defmcasthlim,	0, "");
521SYSCTL_STRING(_net_inet6_ip6, IPV6CTL_KAME_VERSION,
522	kame_version, CTLFLAG_RD,	__KAME_VERSION,		0, "");
523SYSCTL_V_INT(V_NET, vnet_inet6, _net_inet6_ip6, IPV6CTL_USE_DEPRECATED,
524	use_deprecated, CTLFLAG_RW,	ip6_use_deprecated,	0, "");
525SYSCTL_V_INT(V_NET, vnet_inet6, _net_inet6_ip6, IPV6CTL_RR_PRUNE,
526	rr_prune, CTLFLAG_RW,	ip6_rr_prune,			0, "");
527SYSCTL_V_INT(V_NET, vnet_inet6, _net_inet6_ip6, IPV6CTL_USETEMPADDR,
528	use_tempaddr, CTLFLAG_RW, ip6_use_tempaddr,		0, "");
529SYSCTL_V_OID(V_NET, vnet_inet6, _net_inet6_ip6, IPV6CTL_TEMPPLTIME, temppltime,
530	CTLTYPE_INT|CTLFLAG_RW, ip6_temp_preferred_lifetime, 0,
531   	sysctl_ip6_temppltime, "I", "");
532SYSCTL_V_OID(V_NET, vnet_inet6, _net_inet6_ip6, IPV6CTL_TEMPVLTIME, tempvltime,
533	CTLTYPE_INT|CTLFLAG_RW, ip6_temp_valid_lifetime, 0,
534   	sysctl_ip6_tempvltime, "I", "");
535SYSCTL_V_INT(V_NET, vnet_inet6, _net_inet6_ip6, IPV6CTL_V6ONLY,
536	v6only,	CTLFLAG_RW,	ip6_v6only,			0, "");
537#ifndef VIMAGE
538TUNABLE_INT("net.inet6.ip6.auto_linklocal", &ip6_auto_linklocal);
539#endif
540SYSCTL_V_INT(V_NET, vnet_inet6, _net_inet6_ip6, IPV6CTL_AUTO_LINKLOCAL,
541	auto_linklocal, CTLFLAG_RW, ip6_auto_linklocal,	0, "");
542SYSCTL_V_STRUCT(V_NET, vnet_inet6, _net_inet6_ip6, IPV6CTL_RIP6STATS,
543	rip6stats, CTLFLAG_RD, rip6stat, rip6stat, "");
544SYSCTL_V_INT(V_NET, vnet_inet6, _net_inet6_ip6, IPV6CTL_PREFER_TEMPADDR,
545	prefer_tempaddr, CTLFLAG_RW, ip6_prefer_tempaddr, 0, "");
546SYSCTL_V_INT(V_NET, vnet_inet6, _net_inet6_ip6, IPV6CTL_USE_DEFAULTZONE,
547	use_defaultzone, CTLFLAG_RW, ip6_use_defzone, 0,"");
548SYSCTL_V_INT(V_NET, vnet_inet6, _net_inet6_ip6, IPV6CTL_MAXFRAGS,
549	maxfrags, CTLFLAG_RW, ip6_maxfrags, 0, "");
550SYSCTL_V_INT(V_NET, vnet_inet6, _net_inet6_ip6, IPV6CTL_MCAST_PMTU,
551	mcast_pmtu, CTLFLAG_RW, ip6_mcast_pmtu, 0, "");
552#ifdef IPSTEALTH
553SYSCTL_V_INT(V_NET, vnet_inet6, _net_inet6_ip6, IPV6CTL_STEALTH,
554	stealth, CTLFLAG_RW, ip6stealth, 0, "");
555#endif
556
557/* net.inet6.icmp6 */
558SYSCTL_V_INT(V_NET, vnet_inet6, _net_inet6_icmp6, ICMPV6CTL_REDIRACCEPT,
559	rediraccept, CTLFLAG_RW,	icmp6_rediraccept,	0, "");
560SYSCTL_V_INT(V_NET, vnet_inet6, _net_inet6_icmp6, ICMPV6CTL_REDIRTIMEOUT,
561	redirtimeout, CTLFLAG_RW,	icmp6_redirtimeout,	0, "");
562SYSCTL_V_STRUCT(V_NET, vnet_inet6, _net_inet6_icmp6, ICMPV6CTL_STATS,
563	stats, CTLFLAG_RD, icmp6stat, icmp6stat, "");
564SYSCTL_V_INT(V_NET, vnet_inet6, _net_inet6_icmp6, ICMPV6CTL_ND6_PRUNE,
565	nd6_prune, CTLFLAG_RW,		nd6_prune,	0, "");
566SYSCTL_V_INT(V_NET, vnet_inet6, _net_inet6_icmp6, ICMPV6CTL_ND6_DELAY,
567	nd6_delay, CTLFLAG_RW,		nd6_delay,	0, "");
568SYSCTL_V_INT(V_NET, vnet_inet6, _net_inet6_icmp6, ICMPV6CTL_ND6_UMAXTRIES,
569	nd6_umaxtries, CTLFLAG_RW,	nd6_umaxtries,	0, "");
570SYSCTL_V_INT(V_NET, vnet_inet6, _net_inet6_icmp6, ICMPV6CTL_ND6_MMAXTRIES,
571	nd6_mmaxtries, CTLFLAG_RW,	nd6_mmaxtries,	0, "");
572SYSCTL_V_INT(V_NET, vnet_inet6, _net_inet6_icmp6, ICMPV6CTL_ND6_USELOOPBACK,
573	nd6_useloopback, CTLFLAG_RW,	nd6_useloopback, 0, "");
574SYSCTL_V_INT(V_NET, vnet_inet6, _net_inet6_icmp6, ICMPV6CTL_NODEINFO,
575	nodeinfo, CTLFLAG_RW,	icmp6_nodeinfo,	0, "");
576SYSCTL_V_INT(V_NET, vnet_inet6, _net_inet6_icmp6, ICMPV6CTL_ERRPPSLIMIT,
577	errppslimit, CTLFLAG_RW,	icmp6errppslim,	0, "");
578SYSCTL_V_INT(V_NET, vnet_inet6, _net_inet6_icmp6, ICMPV6CTL_ND6_MAXNUDHINT,
579	nd6_maxnudhint, CTLFLAG_RW,	nd6_maxnudhint, 0, "");
580SYSCTL_V_INT(V_NET, vnet_inet6, _net_inet6_icmp6, ICMPV6CTL_ND6_DEBUG,
581	nd6_debug, CTLFLAG_RW,	nd6_debug,		0, "");
582
583SYSCTL_INT(_net_inet6_icmp6, ICMPV6CTL_ND6_ONLINKNSRFC4861,
584	nd6_onlink_ns_rfc4861, CTLFLAG_RW, &nd6_onlink_ns_rfc4861, 0,
585	"Accept 'on-link' nd6 NS in compliance with RFC 4861.");
586