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