xref: /netbsd-src/sys/netinet6/in6_proto.c (revision 946379e7b37692fc43f68eb0d1c10daa0a7f3b6c)
1 /*	$NetBSD: in6_proto.c,v 1.107 2015/10/13 21:28:35 rjs Exp $	*/
2 /*	$KAME: in6_proto.c,v 1.66 2000/10/10 15:35:47 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 <sys/cdefs.h>
65 __KERNEL_RCSID(0, "$NetBSD: in6_proto.c,v 1.107 2015/10/13 21:28:35 rjs Exp $");
66 
67 #ifdef _KERNEL_OPT
68 #include "opt_gateway.h"
69 #include "opt_inet.h"
70 #include "opt_ipsec.h"
71 #include "opt_dccp.h"
72 #include "opt_sctp.h"
73 #endif
74 
75 #include <sys/param.h>
76 #include <sys/socket.h>
77 #include <sys/protosw.h>
78 #include <sys/kernel.h>
79 #include <sys/domain.h>
80 #include <sys/mbuf.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/in_pcb.h>
93 #include <netinet/ip6.h>
94 #include <netinet6/ip6_var.h>
95 #include <netinet/icmp6.h>
96 #include <netinet6/in6_pcb.h>
97 
98 #include <netinet/tcp.h>
99 #include <netinet/tcp_fsm.h>
100 #include <netinet/tcp_seq.h>
101 #include <netinet/tcp_timer.h>
102 #include <netinet/tcp_var.h>
103 #include <netinet/tcpip.h>
104 #include <netinet/tcp_debug.h>
105 
106 #include <netinet6/udp6.h>
107 #include <netinet6/udp6_var.h>
108 
109 #ifdef DCCP
110 #include <netinet/dccp.h>
111 #include <netinet/dccp_var.h>
112 #include <netinet6/dccp6_var.h>
113 #endif
114 
115 #ifdef SCTP
116 #include <netinet/sctp_pcb.h>
117 #include <netinet/sctp.h>
118 #include <netinet/sctp_var.h>
119 #include <netinet6/sctp6_var.h>
120 #endif
121 
122 #include <netinet6/pim6_var.h>
123 
124 #include <netinet6/nd6.h>
125 
126 #ifdef IPSEC
127 #include <netipsec/ipsec.h>
128 #include <netipsec/ipsec6.h>
129 #include <netipsec/key.h>
130 #endif /* IPSEC */
131 
132 
133 #include "carp.h"
134 #if NCARP > 0
135 #include <netinet/ip_carp.h>
136 #endif
137 
138 #include "etherip.h"
139 #if NETHERIP > 0
140 #include <netinet6/ip6_etherip.h>
141 #endif
142 
143 #include <netinet6/ip6protosw.h>
144 
145 #include <net/net_osdep.h>
146 
147 /*
148  * TCP/IP protocol family: IP6, ICMP6, UDP, TCP.
149  */
150 
151 DOMAIN_DEFINE(inet6domain);	/* forward declare and add to link set */
152 
153 /* Wrappers to acquire kernel_lock. */
154 
155 PR_WRAP_CTLINPUT(rip6_ctlinput)
156 PR_WRAP_CTLINPUT(encap6_ctlinput)
157 PR_WRAP_CTLINPUT(udp6_ctlinput)
158 PR_WRAP_CTLINPUT(tcp6_ctlinput)
159 
160 #define	rip6_ctlinput	rip6_ctlinput_wrapper
161 #define	encap6_ctlinput	encap6_ctlinput_wrapper
162 #define	udp6_ctlinput	udp6_ctlinput_wrapper
163 #define	tcp6_ctlinput	tcp6_ctlinput_wrapper
164 
165 PR_WRAP_CTLOUTPUT(rip6_ctloutput)
166 PR_WRAP_CTLOUTPUT(tcp_ctloutput)
167 PR_WRAP_CTLOUTPUT(udp6_ctloutput)
168 PR_WRAP_CTLOUTPUT(icmp6_ctloutput)
169 
170 #define	rip6_ctloutput	rip6_ctloutput_wrapper
171 #define	tcp_ctloutput	tcp_ctloutput_wrapper
172 #define	udp6_ctloutput	udp6_ctloutput_wrapper
173 #define	icmp6_ctloutput	icmp6_ctloutput_wrapper
174 
175 #if defined(DCCP)
176 PR_WRAP_CTLINPUT(dccp6_ctlinput)
177 PR_WRAP_CTLOUTPUT(dccp_ctloutput)
178 
179 #define dccp6_ctlinput	dccp6_ctlinput_wrapper
180 #define dccp_ctloutput	dccp_ctloutput_wrapper
181 #endif
182 
183 #if defined(SCTP)
184 PR_WRAP_CTLINPUT(sctp6_ctlinput)
185 PR_WRAP_CTLOUTPUT(sctp_ctloutput)
186 
187 #define sctp6_ctlinput	sctp6_ctlinput_wrapper
188 #define sctp_ctloutput	sctp_ctloutput_wrapper
189 #endif
190 
191 #if defined(IPSEC)
192 PR_WRAP_CTLINPUT(ah6_ctlinput)
193 
194 #define	ah6_ctlinput	ah6_ctlinput_wrapper
195 #endif
196 
197 #if defined(IPSEC)
198 PR_WRAP_CTLINPUT(esp6_ctlinput)
199 
200 #define	esp6_ctlinput	esp6_ctlinput_wrapper
201 #endif
202 
203 static void
204 tcp6_init(void)
205 {
206 
207 	icmp6_mtudisc_callback_register(tcp6_mtudisc_callback);
208 
209 	tcp_init_common(sizeof(struct ip6_hdr));
210 }
211 
212 const struct ip6protosw inet6sw[] = {
213 {	.pr_domain = &inet6domain,
214 	.pr_protocol = IPPROTO_IPV6,
215 	.pr_init = ip6_init,
216 	.pr_fasttimo = frag6_fasttimo,
217 	.pr_slowtimo = frag6_slowtimo,
218 	.pr_drain = frag6_drainstub,
219 },
220 {	.pr_type = SOCK_DGRAM,
221 	.pr_domain = &inet6domain,
222 	.pr_protocol = IPPROTO_UDP,
223 	.pr_flags = PR_ATOMIC|PR_ADDR|PR_PURGEIF,
224 	.pr_input = udp6_input,
225 	.pr_ctlinput = udp6_ctlinput,
226 	.pr_ctloutput = udp6_ctloutput,
227 	.pr_usrreqs = &udp6_usrreqs,
228 	.pr_init = udp6_init,
229 },
230 {	.pr_type = SOCK_STREAM,
231 	.pr_domain = &inet6domain,
232 	.pr_protocol = IPPROTO_TCP,
233 	.pr_flags = PR_CONNREQUIRED|PR_WANTRCVD|PR_LISTEN|PR_ABRTACPTDIS|PR_PURGEIF,
234 	.pr_input = tcp6_input,
235 	.pr_ctlinput = tcp6_ctlinput,
236 	.pr_ctloutput = tcp_ctloutput,
237 	.pr_usrreqs = &tcp_usrreqs,
238 	.pr_init = tcp6_init,
239 	.pr_fasttimo = tcp_fasttimo,
240 	.pr_drain = tcp_drainstub,
241 },
242 #ifdef DCCP
243 {	.pr_type = SOCK_CONN_DGRAM,
244 	.pr_domain = &inet6domain,
245 	.pr_protocol = IPPROTO_DCCP,
246 	.pr_flags = PR_CONNREQUIRED|PR_ATOMIC|PR_LISTEN,
247 	.pr_input = dccp6_input,
248 	.pr_ctlinput = dccp6_ctlinput,
249 	.pr_ctloutput = dccp_ctloutput,
250 	.pr_usrreqs = &dccp6_usrreqs,
251 #ifndef INET
252 	.pr_init = dccp_init,
253 #endif
254 },
255 #endif /* DCCP */
256 #ifdef SCTP
257 {	.pr_type = SOCK_DGRAM,
258 	.pr_domain = &inet6domain,
259 	.pr_protocol = IPPROTO_SCTP,
260 	.pr_flags = PR_ADDR_OPT|PR_WANTRCVD,
261 	.pr_input = sctp6_input,
262 	.pr_ctlinput = sctp6_ctlinput,
263 	.pr_ctloutput = sctp_ctloutput,
264 	.pr_usrreqs = &sctp6_usrreqs,
265 	.pr_drain = sctp_drain,
266 },
267 {	.pr_type = SOCK_SEQPACKET,
268 	.pr_domain = &inet6domain,
269 	.pr_protocol = IPPROTO_SCTP,
270 	.pr_flags = PR_ADDR_OPT|PR_WANTRCVD,
271 	.pr_input = sctp6_input,
272 	.pr_ctlinput = sctp6_ctlinput,
273 	.pr_ctloutput = sctp_ctloutput,
274 	.pr_drain = sctp_drain,
275 },
276 {	.pr_type = SOCK_STREAM,
277 	.pr_domain = &inet6domain,
278 	.pr_protocol = IPPROTO_SCTP,
279 	.pr_flags = PR_CONNREQUIRED|PR_ADDR_OPT|PR_WANTRCVD|PR_LISTEN,
280 	.pr_input = sctp6_input,
281 	.pr_ctlinput = sctp6_ctlinput,
282 	.pr_ctloutput = sctp_ctloutput,
283 	.pr_drain = sctp_drain,
284 },
285 #endif /* SCTP */
286 {	.pr_type = SOCK_RAW,
287 	.pr_domain = &inet6domain,
288 	.pr_protocol = IPPROTO_RAW,
289 	.pr_flags = PR_ATOMIC|PR_ADDR|PR_PURGEIF,
290 	.pr_input = rip6_input,
291 	.pr_output = rip6_output,
292 	.pr_ctlinput = rip6_ctlinput,
293 	.pr_ctloutput = rip6_ctloutput,
294 	.pr_usrreqs = &rip6_usrreqs,
295 },
296 #ifdef GATEWAY
297 {	.pr_domain = &inet6domain,
298 	.pr_protocol = IPPROTO_IPV6,
299 	.pr_slowtimo = ip6flow_slowtimo,
300 	.pr_init = ip6flow_poolinit,
301 },
302 #endif /* GATEWAY */
303 {	.pr_type = SOCK_RAW,
304 	.pr_domain = &inet6domain,
305 	.pr_protocol = IPPROTO_ICMPV6,
306 	.pr_flags = PR_ATOMIC|PR_ADDR|PR_LASTHDR,
307 	.pr_input = icmp6_input,
308 	.pr_output = rip6_output,
309 	.pr_ctlinput = rip6_ctlinput,
310 	.pr_ctloutput = icmp6_ctloutput,
311 	.pr_usrreqs = &rip6_usrreqs,
312 	.pr_init = icmp6_init,
313 },
314 {	.pr_type = SOCK_RAW,
315 	.pr_domain = &inet6domain,
316 	.pr_protocol = IPPROTO_DSTOPTS,
317 	.pr_flags = PR_ATOMIC|PR_ADDR,
318 	.pr_input = dest6_input,
319 },
320 {	.pr_type = SOCK_RAW,
321 	.pr_domain = &inet6domain,
322 	.pr_protocol = IPPROTO_ROUTING,
323 	.pr_flags = PR_ATOMIC|PR_ADDR,
324 	.pr_input = route6_input,
325 },
326 {	.pr_type = SOCK_RAW,
327 	.pr_domain = &inet6domain,
328 	.pr_protocol = IPPROTO_FRAGMENT,
329 	.pr_flags = PR_ATOMIC|PR_ADDR,
330 	.pr_input = frag6_input,
331 },
332 #ifdef IPSEC
333 {	.pr_type = SOCK_RAW,
334 	.pr_domain = &inet6domain,
335 	.pr_protocol = IPPROTO_AH,
336 	.pr_flags = PR_ATOMIC|PR_ADDR,
337 	.pr_input = ipsec6_common_input,
338 	.pr_ctlinput = ah6_ctlinput,
339 },
340 {	.pr_type = SOCK_RAW,
341 	.pr_domain = &inet6domain,
342 	.pr_protocol = IPPROTO_ESP,
343 	.pr_flags = PR_ATOMIC|PR_ADDR,
344 	.pr_input = ipsec6_common_input,
345 	.pr_ctlinput = esp6_ctlinput,
346 },
347 {	.pr_type = SOCK_RAW,
348 	.pr_domain = &inet6domain,
349 	.pr_protocol = IPPROTO_IPCOMP,
350 	.pr_flags = PR_ATOMIC|PR_ADDR,
351 	.pr_input = ipsec6_common_input,
352 },
353 #endif /* IPSEC */
354 #ifdef INET
355 {	.pr_type = SOCK_RAW,
356 	.pr_domain = &inet6domain,
357 	.pr_protocol = IPPROTO_IPV4,
358 	.pr_flags = PR_ATOMIC|PR_ADDR|PR_LASTHDR,
359 	.pr_input = encap6_input,
360 	.pr_output = rip6_output,
361 	.pr_ctlinput = encap6_ctlinput,
362 	.pr_ctloutput = rip6_ctloutput,
363 	.pr_usrreqs = &rip6_usrreqs,
364 	.pr_init = encap_init,
365 },
366 #endif
367 {	.pr_type = SOCK_RAW,
368 	.pr_domain = &inet6domain,
369 	.pr_protocol = IPPROTO_IPV6,
370 	.pr_flags = PR_ATOMIC|PR_ADDR|PR_LASTHDR,
371 	.pr_input = encap6_input,
372 	.pr_output = rip6_output,
373 	.pr_ctlinput = encap6_ctlinput,
374 	.pr_ctloutput = rip6_ctloutput,
375 	.pr_usrreqs = &rip6_usrreqs,
376 	.pr_init = encap_init,
377 },
378 #if NETHERIP > 0
379 {	.pr_type = SOCK_RAW,
380 	.pr_domain = &inet6domain,
381 	.pr_protocol = IPPROTO_ETHERIP,
382 	.pr_flags = PR_ATOMIC|PR_ADDR|PR_LASTHDR,
383 	.pr_input = ip6_etherip_input,
384 	.pr_output = rip6_output,
385 	.pr_ctlinput = rip6_ctlinput,
386 	.pr_ctloutput = rip6_ctloutput,
387 	.pr_usrreqs = &rip6_usrreqs,
388 },
389 #endif
390 #if NCARP > 0
391 {	.pr_type = SOCK_RAW,
392 	.pr_domain = &inet6domain,
393 	.pr_protocol = IPPROTO_CARP,
394 	.pr_flags = PR_ATOMIC|PR_ADDR,
395 	.pr_input = carp6_proto_input,
396 	.pr_output = rip6_output,
397 	.pr_ctloutput = rip6_ctloutput,
398 	.pr_usrreqs = &rip6_usrreqs,
399 },
400 #endif /* NCARP */
401 {	.pr_type = SOCK_RAW,
402 	.pr_domain = &inet6domain,
403 	.pr_protocol = IPPROTO_PIM,
404 	.pr_flags = PR_ATOMIC|PR_ADDR|PR_LASTHDR,
405 	.pr_input = pim6_input,
406 	.pr_output = rip6_output,
407 	.pr_ctloutput = rip6_ctloutput,
408 	.pr_usrreqs = &rip6_usrreqs,
409 	.pr_init = pim6_init,
410 },
411 /* raw wildcard */
412 {	.pr_type = SOCK_RAW,
413 	.pr_domain = &inet6domain,
414 	.pr_flags = PR_ATOMIC|PR_ADDR|PR_LASTHDR,
415 	.pr_input = rip6_input,
416 	.pr_output = rip6_output,
417 	.pr_ctloutput = rip6_ctloutput,
418 	.pr_usrreqs = &rip6_usrreqs,
419 	.pr_init = rip6_init,
420 },
421 };
422 
423 static const struct sockaddr_in6 in6_any = {
424 	  .sin6_len = sizeof(in6_any)
425 	, .sin6_family = AF_INET6
426 	, .sin6_port = 0
427 	, .sin6_flowinfo = 0
428 	, .sin6_addr = IN6ADDR_ANY_INIT
429 	, .sin6_scope_id = 0
430 };
431 
432 bool in6_present = false;
433 static void
434 in6_init(void)
435 {
436 
437 	in6_present = true;
438 }
439 
440 struct domain inet6domain = {
441 	.dom_family = AF_INET6, .dom_name = "internet6",
442 	.dom_init = in6_init, .dom_externalize = NULL, .dom_dispose = NULL,
443 	.dom_protosw = (const struct protosw *)inet6sw,
444 	.dom_protoswNPROTOSW = (const struct protosw *)&inet6sw[sizeof(inet6sw)/sizeof(inet6sw[0])],
445 	.dom_rtattach = rt_inithead,
446 	.dom_rtoffset = offsetof(struct sockaddr_in6, sin6_addr) << 3,
447 	.dom_maxrtkey = sizeof(struct ip_pack6),
448 	.dom_if_up = in6_if_up, .dom_if_down = in6_if_down,
449 	.dom_ifattach = in6_domifattach, .dom_ifdetach = in6_domifdetach,
450 	.dom_if_link_state_change = in6_if_link_state_change,
451 	.dom_ifqueues = { NULL, NULL },
452 	.dom_link = { NULL },
453 	.dom_mowner = MOWNER_INIT("",""),
454 	.dom_sa_cmpofs = offsetof(struct sockaddr_in6, sin6_addr),
455 	.dom_sa_cmplen = sizeof(struct in6_addr),
456 	.dom_sa_any = (const struct sockaddr *)&in6_any,
457 	.dom_sockaddr_externalize = sockaddr_in6_externalize,
458 	.dom_rtcache = LIST_HEAD_INITIALIZER(inet6domain.dom_rtcache)
459 };
460 
461 #if 0
462 int
463 sockaddr_in6_cmp(const struct sockaddr *lsa, const struct sockaddr *rsa)
464 {
465 	uint_fast8_t len;
466 	const uint_fast8_t addrofs = offsetof(struct sockaddr_in6, sin6_addr),
467 			   addrend = addrofs + sizeof(struct in6_addr);
468 	int rc;
469 	const struct sockaddr_in6 *lsin6, *rsin6;
470 
471 	lsin6 = satocsin6(lsa);
472 	rsin6 = satocsin6(rsa);
473 
474 	len = MIN(addrend, MIN(lsin6->sin6_len, rsin6->sin6_len));
475 
476 	if (len > addrofs &&
477 	    (rc = memcmp(&lsin6->sin6_addr, &rsin6->sin6_addr,
478 	                  len - addrofs)) != 0)
479 		return rc;
480 
481 	return lsin6->sin6_len - rsin6->sin6_len;
482 }
483 #endif
484 
485 /*
486  * Internet configuration info
487  */
488 #ifndef	IPV6FORWARDING
489 #ifdef GATEWAY6
490 #define	IPV6FORWARDING	1	/* forward IP6 packets not for us */
491 #else
492 #define	IPV6FORWARDING	0	/* don't forward IP6 packets not for us */
493 #endif /* GATEWAY6 */
494 #endif /* !IPV6FORWARDING */
495 
496 int	ip6_forwarding = IPV6FORWARDING;	/* act as router? */
497 int	ip6_sendredirects = 1;
498 int	ip6_defhlim = IPV6_DEFHLIM;
499 int	ip6_defmcasthlim = IPV6_DEFAULT_MULTICAST_HOPS;
500 int	ip6_accept_rtadv = 0;	/* "IPV6FORWARDING ? 0 : 1" is dangerous */
501 int	ip6_maxfragpackets = 200;
502 int	ip6_maxfrags = 200;
503 int	ip6_log_interval = 5;
504 int	ip6_hdrnestlimit = 50;	/* appropriate? */
505 int	ip6_dad_count = 1;	/* DupAddrDetectionTransmits */
506 int	ip6_auto_flowlabel = 1;
507 int	ip6_use_deprecated = 1;	/* allow deprecated addr (RFC2462 5.5.4) */
508 int	ip6_rr_prune = 5;	/* router renumbering prefix
509 				 * walk list every 5 sec. */
510 int	ip6_mcast_pmtu = 0;	/* enable pMTU discovery for multicast? */
511 int	ip6_v6only = 1;
512 int     ip6_neighborgcthresh = 2048; /* Threshold # of NDP entries for GC */
513 int     ip6_maxifprefixes = 16; /* Max acceptable prefixes via RA per IF */
514 int     ip6_maxifdefrouters = 16; /* Max acceptable def routers via RA */
515 int     ip6_maxdynroutes = 4096; /* Max # of routes created via redirect */
516 
517 int	ip6_keepfaith = 0;
518 time_t	ip6_log_time = 0;
519 int	ip6_rtadv_maxroutes = 100; /* (arbitrary) initial maximum number of
520                                     * routes via rtadv expected to be
521                                     * significantly larger than common use.
522                                     * if you need to count: 3 extra initial
523                                     * routes, plus 1 per interface after the
524                                     * first one, then one per non-linklocal
525                                     * prefix */
526 
527 /* icmp6 */
528 /*
529  * BSDI4 defines these variables in in_proto.c...
530  * XXX: what if we don't define INET? Should we define pmtu6_expire
531  * or so? (jinmei@kame.net 19990310)
532  */
533 int pmtu_expire = 60*10;
534 
535 /* raw IP6 parameters */
536 /*
537  * Nominal space allocated to a raw ip socket.
538  */
539 #define	RIPV6SNDQ	8192
540 #define	RIPV6RCVQ	8192
541 
542 u_long	rip6_sendspace = RIPV6SNDQ;
543 u_long	rip6_recvspace = RIPV6RCVQ;
544 
545 /* ICMPV6 parameters */
546 int	icmp6_rediraccept = 1;		/* accept and process redirects */
547 int	icmp6_redirtimeout = 10 * 60;	/* 10 minutes */
548 int	icmp6errppslim = 100;		/* 100pps */
549 int	icmp6_nodeinfo = 1;		/* enable/disable NI response */
550