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