2007-02-28 01:19:05 +03:00
|
|
|
/* $NetBSD: in6_proto.c,v 1.73 2007/02/27 22:19:05 degroote Exp $ */
|
2000-10-10 20:26:43 +04:00
|
|
|
/* $KAME: in6_proto.c,v 1.66 2000/10/10 15:35:47 itojun Exp $ */
|
1999-07-04 01:24:45 +04:00
|
|
|
|
1999-06-28 10:36:47 +04:00
|
|
|
/*
|
|
|
|
* Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
|
|
|
|
* All rights reserved.
|
2000-07-06 16:36:18 +04:00
|
|
|
*
|
1999-06-28 10:36:47 +04:00
|
|
|
* Redistribution and use in source and binary forms, with or without
|
|
|
|
* modification, are permitted provided that the following conditions
|
|
|
|
* are met:
|
|
|
|
* 1. Redistributions of source code must retain the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer.
|
|
|
|
* 2. Redistributions in binary form must reproduce the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer in the
|
|
|
|
* documentation and/or other materials provided with the distribution.
|
|
|
|
* 3. Neither the name of the project nor the names of its contributors
|
|
|
|
* may be used to endorse or promote products derived from this software
|
|
|
|
* without specific prior written permission.
|
2000-07-06 16:36:18 +04:00
|
|
|
*
|
1999-06-28 10:36:47 +04:00
|
|
|
* THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
|
|
|
|
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
|
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
|
|
* ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
|
|
|
|
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
|
|
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
|
|
|
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
|
|
|
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|
|
|
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
|
|
|
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
|
|
|
* SUCH DAMAGE.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Copyright (c) 1982, 1986, 1993
|
|
|
|
* The Regents of the University of California. All rights reserved.
|
|
|
|
*
|
|
|
|
* Redistribution and use in source and binary forms, with or without
|
|
|
|
* modification, are permitted provided that the following conditions
|
|
|
|
* are met:
|
|
|
|
* 1. Redistributions of source code must retain the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer.
|
|
|
|
* 2. Redistributions in binary form must reproduce the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer in the
|
|
|
|
* documentation and/or other materials provided with the distribution.
|
2003-08-07 20:26:28 +04:00
|
|
|
* 3. Neither the name of the University nor the names of its contributors
|
1999-06-28 10:36:47 +04:00
|
|
|
* may be used to endorse or promote products derived from this software
|
|
|
|
* without specific prior written permission.
|
|
|
|
*
|
|
|
|
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
|
|
|
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
|
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
|
|
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
|
|
|
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
|
|
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
|
|
|
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
|
|
|
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|
|
|
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
|
|
|
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
|
|
|
* SUCH DAMAGE.
|
|
|
|
*
|
|
|
|
* @(#)in_proto.c 8.1 (Berkeley) 6/10/93
|
|
|
|
*/
|
|
|
|
|
2001-11-13 03:56:55 +03:00
|
|
|
#include <sys/cdefs.h>
|
2007-02-28 01:19:05 +03:00
|
|
|
__KERNEL_RCSID(0, "$NetBSD: in6_proto.c,v 1.73 2007/02/27 22:19:05 degroote Exp $");
|
2001-11-13 03:56:55 +03:00
|
|
|
|
1999-06-28 10:36:47 +04:00
|
|
|
#include "opt_inet.h"
|
1999-07-10 02:57:15 +04:00
|
|
|
#include "opt_ipsec.h"
|
2001-02-20 11:49:15 +03:00
|
|
|
#include "opt_iso.h"
|
1999-06-28 10:36:47 +04:00
|
|
|
|
|
|
|
#include <sys/param.h>
|
|
|
|
#include <sys/socket.h>
|
|
|
|
#include <sys/protosw.h>
|
|
|
|
#include <sys/kernel.h>
|
|
|
|
#include <sys/domain.h>
|
|
|
|
#include <sys/mbuf.h>
|
|
|
|
|
|
|
|
#include <net/if.h>
|
|
|
|
#include <net/radix.h>
|
|
|
|
#include <net/route.h>
|
|
|
|
|
|
|
|
#include <netinet/in.h>
|
|
|
|
#include <netinet/in_systm.h>
|
|
|
|
#include <netinet/in_var.h>
|
2000-04-19 10:30:51 +04:00
|
|
|
#include <netinet/ip_encap.h>
|
1999-06-28 10:36:47 +04:00
|
|
|
#include <netinet/ip.h>
|
|
|
|
#include <netinet/ip_var.h>
|
|
|
|
#include <netinet/in_pcb.h>
|
2000-02-06 15:49:37 +03:00
|
|
|
#include <netinet/ip6.h>
|
1999-06-28 10:36:47 +04:00
|
|
|
#include <netinet6/ip6_var.h>
|
2000-02-06 15:49:37 +03:00
|
|
|
#include <netinet/icmp6.h>
|
1999-06-28 10:36:47 +04:00
|
|
|
#include <netinet6/in6_pcb.h>
|
|
|
|
|
|
|
|
#include <netinet/tcp.h>
|
|
|
|
#include <netinet/tcp_fsm.h>
|
|
|
|
#include <netinet/tcp_seq.h>
|
|
|
|
#include <netinet/tcp_timer.h>
|
|
|
|
#include <netinet/tcp_var.h>
|
|
|
|
#include <netinet/tcpip.h>
|
|
|
|
#include <netinet/tcp_debug.h>
|
|
|
|
|
|
|
|
#include <netinet6/udp6.h>
|
|
|
|
#include <netinet6/udp6_var.h>
|
|
|
|
|
|
|
|
#include <netinet6/pim6_var.h>
|
|
|
|
|
|
|
|
#include <netinet6/nd6.h>
|
1999-12-13 18:17:17 +03:00
|
|
|
|
1999-06-28 10:36:47 +04:00
|
|
|
#ifdef IPSEC
|
1999-12-13 18:17:17 +03:00
|
|
|
#include <netinet6/ipsec.h>
|
1999-06-28 10:36:47 +04:00
|
|
|
#include <netinet6/ah.h>
|
|
|
|
#ifdef IPSEC_ESP
|
|
|
|
#include <netinet6/esp.h>
|
|
|
|
#endif
|
|
|
|
#include <netinet6/ipcomp.h>
|
2001-10-24 10:36:37 +04:00
|
|
|
#endif /* IPSEC */
|
1999-06-28 10:36:47 +04:00
|
|
|
|
2007-02-10 12:43:05 +03:00
|
|
|
#ifdef FAST_IPSEC
|
|
|
|
#include <netipsec/ipsec.h>
|
|
|
|
#include <netipsec/ipsec6.h>
|
|
|
|
#include <netipsec/key.h>
|
|
|
|
#endif /* FAST_IPSEC */
|
|
|
|
|
|
|
|
|
2006-05-18 13:05:49 +04:00
|
|
|
#include "carp.h"
|
|
|
|
#if NCARP > 0
|
|
|
|
#include <netinet/ip_carp.h>
|
|
|
|
#endif
|
|
|
|
|
2006-11-23 07:07:07 +03:00
|
|
|
#include "etherip.h"
|
|
|
|
#if NETHERIP > 1
|
|
|
|
#include <netinet6/ip6_etherip.h>
|
|
|
|
#endif
|
|
|
|
|
1999-06-28 10:36:47 +04:00
|
|
|
#include <netinet6/ip6protosw.h>
|
|
|
|
|
2001-12-21 06:21:50 +03:00
|
|
|
#include <net/net_osdep.h>
|
|
|
|
|
2003-04-17 23:58:57 +04:00
|
|
|
#ifndef offsetof /* XXX */
|
1999-06-28 10:36:47 +04:00
|
|
|
#define offsetof(type, member) ((size_t)(&((type *)0)->member))
|
2003-04-17 23:58:57 +04:00
|
|
|
#endif
|
1999-06-28 10:36:47 +04:00
|
|
|
|
|
|
|
/*
|
|
|
|
* TCP/IP protocol family: IP6, ICMP6, UDP, TCP.
|
|
|
|
*/
|
|
|
|
|
2005-01-23 21:41:56 +03:00
|
|
|
DOMAIN_DEFINE(inet6domain); /* forward declare and add to link set */
|
1999-06-28 10:36:47 +04:00
|
|
|
|
2004-04-22 05:01:40 +04:00
|
|
|
const struct ip6protosw inet6sw[] = {
|
2007-02-19 10:28:58 +03:00
|
|
|
{ .pr_domain = &inet6domain,
|
|
|
|
.pr_protocol = IPPROTO_IPV6,
|
|
|
|
.pr_init = ip6_init,
|
|
|
|
.pr_slowtimo = frag6_slowtimo,
|
|
|
|
.pr_drain = frag6_drain,
|
1999-06-28 10:36:47 +04:00
|
|
|
},
|
2007-02-19 10:28:58 +03:00
|
|
|
{ .pr_type = SOCK_DGRAM,
|
|
|
|
.pr_domain = &inet6domain,
|
|
|
|
.pr_protocol = IPPROTO_UDP,
|
|
|
|
.pr_flags = PR_ATOMIC|PR_ADDR|PR_PURGEIF,
|
|
|
|
.pr_input = udp6_input,
|
|
|
|
.pr_ctlinput = udp6_ctlinput,
|
|
|
|
.pr_ctloutput = ip6_ctloutput,
|
|
|
|
.pr_usrreq = udp6_usrreq,
|
|
|
|
.pr_init = udp6_init,
|
1999-06-28 10:36:47 +04:00
|
|
|
},
|
2007-02-19 10:28:58 +03:00
|
|
|
{ .pr_type = SOCK_STREAM,
|
|
|
|
.pr_domain = &inet6domain,
|
|
|
|
.pr_protocol = IPPROTO_TCP,
|
|
|
|
.pr_flags = PR_CONNREQUIRED|PR_WANTRCVD|PR_LISTEN|PR_ABRTACPTDIS|PR_PURGEIF,
|
|
|
|
.pr_input = tcp6_input,
|
|
|
|
.pr_ctlinput = tcp6_ctlinput,
|
|
|
|
.pr_ctloutput = tcp_ctloutput,
|
|
|
|
.pr_usrreq = tcp_usrreq,
|
|
|
|
#ifndef INET /* don't call initialization and timeout routines twice */
|
|
|
|
.pr_init = tcp_init,
|
|
|
|
.pr_slowtimo = tcp_slowtimo,
|
|
|
|
.pr_drain = tcp_drain,
|
1999-07-27 10:23:57 +04:00
|
|
|
#endif
|
1999-12-13 18:17:17 +03:00
|
|
|
},
|
2007-02-19 10:28:58 +03:00
|
|
|
{ .pr_type = SOCK_RAW,
|
|
|
|
.pr_domain = &inet6domain,
|
|
|
|
.pr_protocol = IPPROTO_RAW,
|
|
|
|
.pr_flags = PR_ATOMIC|PR_ADDR|PR_PURGEIF,
|
|
|
|
.pr_input = rip6_input,
|
|
|
|
.pr_output = rip6_output,
|
|
|
|
.pr_ctlinput = rip6_ctlinput,
|
|
|
|
.pr_ctloutput = rip6_ctloutput,
|
|
|
|
.pr_usrreq = rip6_usrreq,
|
1999-06-28 10:36:47 +04:00
|
|
|
},
|
2007-02-19 10:28:58 +03:00
|
|
|
{ .pr_type = SOCK_RAW,
|
|
|
|
.pr_domain = &inet6domain,
|
|
|
|
.pr_protocol = IPPROTO_ICMPV6,
|
|
|
|
.pr_flags = PR_ATOMIC|PR_ADDR|PR_LASTHDR,
|
|
|
|
.pr_input = icmp6_input,
|
|
|
|
.pr_output = rip6_output,
|
|
|
|
.pr_ctlinput = rip6_ctlinput,
|
|
|
|
.pr_ctloutput = rip6_ctloutput,
|
|
|
|
.pr_usrreq = rip6_usrreq,
|
|
|
|
.pr_init = icmp6_init,
|
1999-06-28 10:36:47 +04:00
|
|
|
},
|
2007-02-19 10:28:58 +03:00
|
|
|
{ .pr_type = SOCK_RAW,
|
|
|
|
.pr_domain = &inet6domain,
|
|
|
|
.pr_protocol = IPPROTO_DSTOPTS,
|
|
|
|
.pr_flags = PR_ATOMIC|PR_ADDR,
|
|
|
|
.pr_input = dest6_input,
|
1999-06-28 10:36:47 +04:00
|
|
|
},
|
2007-02-19 10:28:58 +03:00
|
|
|
{ .pr_type = SOCK_RAW,
|
|
|
|
.pr_domain = &inet6domain,
|
|
|
|
.pr_protocol = IPPROTO_ROUTING,
|
|
|
|
.pr_flags = PR_ATOMIC|PR_ADDR,
|
|
|
|
.pr_input = route6_input,
|
1999-06-28 10:36:47 +04:00
|
|
|
},
|
2007-02-19 10:28:58 +03:00
|
|
|
{ .pr_type = SOCK_RAW,
|
|
|
|
.pr_domain = &inet6domain,
|
|
|
|
.pr_protocol = IPPROTO_FRAGMENT,
|
|
|
|
.pr_flags = PR_ATOMIC|PR_ADDR,
|
|
|
|
.pr_input = frag6_input,
|
1999-06-28 10:36:47 +04:00
|
|
|
},
|
|
|
|
#ifdef IPSEC
|
2007-02-19 10:28:58 +03:00
|
|
|
{ .pr_type = SOCK_RAW,
|
|
|
|
.pr_domain = &inet6domain,
|
|
|
|
.pr_protocol = IPPROTO_AH,
|
|
|
|
.pr_flags = PR_ATOMIC|PR_ADDR,
|
|
|
|
.pr_input = ah6_input,
|
|
|
|
.pr_ctlinput = ah6_ctlinput,
|
1999-06-28 10:36:47 +04:00
|
|
|
},
|
|
|
|
#ifdef IPSEC_ESP
|
2007-02-19 10:28:58 +03:00
|
|
|
{ .pr_type = SOCK_RAW,
|
|
|
|
.pr_domain = &inet6domain,
|
|
|
|
.pr_protocol = IPPROTO_ESP,
|
|
|
|
.pr_flags = PR_ATOMIC|PR_ADDR,
|
|
|
|
.pr_input = esp6_input,
|
|
|
|
.pr_ctlinput = esp6_ctlinput,
|
1999-06-28 10:36:47 +04:00
|
|
|
},
|
|
|
|
#endif
|
2007-02-19 10:28:58 +03:00
|
|
|
{ .pr_type = SOCK_RAW,
|
|
|
|
.pr_domain = &inet6domain,
|
|
|
|
.pr_protocol = IPPROTO_IPCOMP,
|
|
|
|
.pr_flags = PR_ATOMIC|PR_ADDR,
|
|
|
|
.pr_input = ipcomp6_input,
|
1999-06-28 10:36:47 +04:00
|
|
|
},
|
|
|
|
#endif /* IPSEC */
|
2007-02-10 12:43:05 +03:00
|
|
|
#ifdef FAST_IPSEC
|
2007-02-28 01:19:05 +03:00
|
|
|
{ .pr_type = SOCK_RAW,
|
|
|
|
.pr_domain = &inet6domain,
|
|
|
|
.pr_protocol = IPPROTO_AH,
|
|
|
|
.pr_flags = PR_ATOMIC|PR_ADDR,
|
|
|
|
.pr_input = ipsec6_common_input,
|
|
|
|
.pr_ctlinput = ah6_ctlinput,
|
2007-02-10 12:43:05 +03:00
|
|
|
},
|
2007-02-28 01:19:05 +03:00
|
|
|
{ .pr_type = SOCK_RAW,
|
|
|
|
.pr_domain = &inet6domain,
|
|
|
|
.pr_protocol = IPPROTO_ESP,
|
|
|
|
.pr_flags = PR_ATOMIC|PR_ADDR,
|
|
|
|
.pr_input = ipsec6_common_input,
|
|
|
|
.pr_ctlinput = esp6_ctlinput,
|
2007-02-10 12:43:05 +03:00
|
|
|
},
|
2007-02-28 01:19:05 +03:00
|
|
|
{ .pr_type = SOCK_RAW,
|
|
|
|
.pr_domain = &inet6domain,
|
|
|
|
.pr_protocol = IPPROTO_IPCOMP,
|
|
|
|
.pr_flags = PR_ATOMIC|PR_ADDR,
|
|
|
|
.pr_input = ipsec6_common_input,
|
2007-02-10 12:43:05 +03:00
|
|
|
},
|
|
|
|
#endif /* FAST_IPSEC */
|
2000-04-19 10:30:51 +04:00
|
|
|
#ifdef INET
|
2007-02-19 10:28:58 +03:00
|
|
|
{ .pr_type = SOCK_RAW,
|
|
|
|
.pr_domain = &inet6domain,
|
|
|
|
.pr_protocol = IPPROTO_IPV4,
|
|
|
|
.pr_flags = PR_ATOMIC|PR_ADDR|PR_LASTHDR,
|
|
|
|
.pr_input = encap6_input,
|
|
|
|
.pr_output = rip6_output,
|
|
|
|
.pr_ctlinput = encap6_ctlinput,
|
|
|
|
.pr_ctloutput = rip6_ctloutput,
|
|
|
|
.pr_usrreq = rip6_usrreq,
|
|
|
|
.pr_init = encap_init,
|
1999-06-28 10:36:47 +04:00
|
|
|
},
|
2000-04-19 10:30:51 +04:00
|
|
|
#endif
|
2007-02-19 10:28:58 +03:00
|
|
|
{ .pr_type = SOCK_RAW,
|
|
|
|
.pr_domain = &inet6domain,
|
|
|
|
.pr_protocol = IPPROTO_IPV6,
|
|
|
|
.pr_flags = PR_ATOMIC|PR_ADDR|PR_LASTHDR,
|
|
|
|
.pr_input = encap6_input,
|
|
|
|
.pr_output = rip6_output,
|
|
|
|
.pr_ctlinput = encap6_ctlinput,
|
|
|
|
.pr_ctloutput = rip6_ctloutput,
|
|
|
|
.pr_usrreq = rip6_usrreq,
|
|
|
|
.pr_init = encap_init,
|
1999-06-28 10:36:47 +04:00
|
|
|
},
|
2006-11-23 07:07:07 +03:00
|
|
|
#if NETHERIP > 1
|
2007-02-19 10:28:58 +03:00
|
|
|
{ .pr_type = SOCK_RAW,
|
|
|
|
.pr_domain = &inet6domain,
|
|
|
|
.pr_protocol = IPPROTO_ETHERIP,
|
|
|
|
.pr_flags = PR_ATOMIC|PR_ADDR|PR_LASTHDR,
|
|
|
|
.pr_input = ip6_etherip_input,
|
|
|
|
.pr_output = rip6_output,
|
|
|
|
.pr_ctlinput = rip6_ctlinput,
|
|
|
|
.pr_ctloutput = rip6_ctloutput,
|
|
|
|
.pr_usrreq = rip6_usrreq,
|
2006-11-23 07:07:07 +03:00
|
|
|
},
|
|
|
|
#endif
|
2006-05-18 13:05:49 +04:00
|
|
|
#if NCARP > 0
|
2007-02-19 10:28:58 +03:00
|
|
|
{ .pr_type = SOCK_RAW,
|
|
|
|
.pr_domain = &inet6domain,
|
|
|
|
.pr_protocol = IPPROTO_CARP,
|
|
|
|
.pr_flags = PR_ATOMIC|PR_ADDR,
|
|
|
|
.pr_input = carp6_proto_input,
|
|
|
|
.pr_output = rip6_output,
|
|
|
|
.pr_ctloutput = rip6_ctloutput,
|
|
|
|
.pr_usrreq = rip6_usrreq,
|
2006-05-18 13:05:49 +04:00
|
|
|
},
|
|
|
|
#endif /* NCARP */
|
2001-02-20 11:49:15 +03:00
|
|
|
#ifdef ISO
|
2007-02-19 10:28:58 +03:00
|
|
|
{ .pr_type = SOCK_RAW,
|
|
|
|
.pr_domain = &inet6domain,
|
|
|
|
.pr_protocol = IPPROTO_EON,
|
|
|
|
.pr_flags = PR_ATOMIC|PR_ADDR|PR_LASTHDR,
|
|
|
|
.pr_input = encap6_input,
|
|
|
|
.pr_output = rip6_output,
|
|
|
|
.pr_ctlinput = encap6_ctlinput,
|
|
|
|
.pr_ctloutput = rip6_ctloutput,
|
|
|
|
.pr_usrreq = rip6_usrreq,
|
|
|
|
/*XXX*/
|
|
|
|
.pr_init = encap_init,
|
2001-02-20 11:49:15 +03:00
|
|
|
},
|
|
|
|
#endif
|
2007-02-19 10:28:58 +03:00
|
|
|
{ .pr_type = SOCK_RAW,
|
|
|
|
.pr_domain = &inet6domain,
|
|
|
|
.pr_protocol = IPPROTO_PIM,
|
|
|
|
.pr_flags = PR_ATOMIC|PR_ADDR|PR_LASTHDR,
|
|
|
|
.pr_input = pim6_input,
|
|
|
|
.pr_output = rip6_output,
|
|
|
|
.pr_ctloutput = rip6_ctloutput,
|
|
|
|
.pr_usrreq = rip6_usrreq,
|
1999-06-28 10:36:47 +04:00
|
|
|
},
|
|
|
|
/* raw wildcard */
|
2007-02-19 10:28:58 +03:00
|
|
|
{ .pr_type = SOCK_RAW,
|
|
|
|
.pr_domain = &inet6domain,
|
|
|
|
.pr_flags = PR_ATOMIC|PR_ADDR|PR_LASTHDR,
|
|
|
|
.pr_input = rip6_input,
|
|
|
|
.pr_output = rip6_output,
|
|
|
|
.pr_ctloutput = rip6_ctloutput,
|
|
|
|
.pr_usrreq = rip6_usrreq,
|
|
|
|
.pr_init = rip6_init,
|
1999-06-28 10:36:47 +04:00
|
|
|
},
|
|
|
|
};
|
|
|
|
|
2006-08-30 21:05:30 +04:00
|
|
|
struct domain inet6domain = {
|
Here are various changes designed to protect against bad IPv4
routing caused by stale route caches (struct route). Route caches
are sprinkled throughout PCBs, the IP fast-forwarding table, and
IP tunnel interfaces (gre, gif, stf).
Stale IPv6 and ISO route caches will be treated by separate patches.
Thank you to Christoph Badura for suggesting the general approach
to invalidating route caches that I take here.
Here are the details:
Add hooks to struct domain for tracking and for invalidating each
domain's route caches: dom_rtcache, dom_rtflush, and dom_rtflushall.
Introduce helper subroutines, rtflush(ro) for invalidating a route
cache, rtflushall(family) for invalidating all route caches in a
routing domain, and rtcache(ro) for notifying the domain of a new
cached route.
Chain together all IPv4 route caches where ro_rt != NULL. Provide
in_rtcache() for adding a route to the chain. Provide in_rtflush()
and in_rtflushall() for invalidating IPv4 route caches. In
in_rtflush(), set ro_rt to NULL, and remove the route from the
chain. In in_rtflushall(), walk the chain and remove every route
cache.
In rtrequest1(), call rtflushall() to invalidate route caches when
a route is added.
In gif(4), discard the workaround for stale caches that involves
expiring them every so often.
Replace the pattern 'RTFREE(ro->ro_rt); ro->ro_rt = NULL;' with a
call to rtflush(ro).
Update ipflow_fastforward() and all other users of route caches so
that they expect a cached route, ro->ro_rt, to turn to NULL.
Take care when moving a 'struct route' to rtflush() the source and
to rtcache() the destination.
In domain initializers, use .dom_xxx tags.
KNF here and there.
2006-12-09 08:33:04 +03:00
|
|
|
.dom_family = AF_INET6, .dom_name = "internet6",
|
|
|
|
.dom_init = NULL, .dom_externalize = NULL, .dom_dispose = NULL,
|
|
|
|
.dom_protosw = (const struct protosw *)inet6sw,
|
|
|
|
.dom_protoswNPROTOSW = (const struct protosw *)&inet6sw[sizeof(inet6sw)/sizeof(inet6sw[0])],
|
|
|
|
.dom_rtattach = rn_inithead,
|
|
|
|
.dom_rtoffset = offsetof(struct sockaddr_in6, sin6_addr) << 3,
|
|
|
|
.dom_maxrtkey = sizeof(struct sockaddr_in6),
|
|
|
|
.dom_ifattach = in6_domifattach, .dom_ifdetach = in6_domifdetach,
|
|
|
|
.dom_ifqueues = { &ip6intrq, NULL },
|
|
|
|
.dom_link = { NULL },
|
|
|
|
.dom_mowner = MOWNER_INIT("","")
|
2006-08-30 21:05:30 +04:00
|
|
|
};
|
1999-06-28 10:36:47 +04:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Internet configuration info
|
|
|
|
*/
|
|
|
|
#ifndef IPV6FORWARDING
|
|
|
|
#ifdef GATEWAY6
|
|
|
|
#define IPV6FORWARDING 1 /* forward IP6 packets not for us */
|
|
|
|
#else
|
|
|
|
#define IPV6FORWARDING 0 /* don't forward IP6 packets not for us */
|
|
|
|
#endif /* GATEWAY6 */
|
|
|
|
#endif /* !IPV6FORWARDING */
|
|
|
|
|
|
|
|
int ip6_forwarding = IPV6FORWARDING; /* act as router? */
|
2003-08-07 12:52:32 +04:00
|
|
|
int ip6_sendredirects = 1;
|
1999-06-28 10:36:47 +04:00
|
|
|
int ip6_defhlim = IPV6_DEFHLIM;
|
|
|
|
int ip6_defmcasthlim = IPV6_DEFAULT_MULTICAST_HOPS;
|
|
|
|
int ip6_accept_rtadv = 0; /* "IPV6FORWARDING ? 0 : 1" is dangerous */
|
|
|
|
int ip6_maxfragpackets = 200;
|
2002-05-28 07:04:05 +04:00
|
|
|
int ip6_maxfrags = 200;
|
1999-06-28 10:36:47 +04:00
|
|
|
int ip6_log_interval = 5;
|
|
|
|
int ip6_hdrnestlimit = 50; /* appropriate? */
|
|
|
|
int ip6_dad_count = 1; /* DupAddrDetectionTransmits */
|
|
|
|
int ip6_auto_flowlabel = 1;
|
2002-08-21 02:06:04 +04:00
|
|
|
int ip6_use_deprecated = 1; /* allow deprecated addr (RFC2462 5.5.4) */
|
1999-12-13 18:17:17 +03:00
|
|
|
int ip6_rr_prune = 5; /* router renumbering prefix
|
2001-12-21 11:54:19 +03:00
|
|
|
* walk list every 5 sec. */
|
2006-03-06 02:47:08 +03:00
|
|
|
int ip6_mcast_pmtu = 0; /* enable pMTU discovery for multicast? */
|
2003-11-03 18:12:06 +03:00
|
|
|
int ip6_v6only = 1;
|
2000-01-06 09:41:18 +03:00
|
|
|
|
1999-06-28 10:36:47 +04:00
|
|
|
int ip6_keepfaith = 0;
|
|
|
|
time_t ip6_log_time = (time_t)0L;
|
|
|
|
|
|
|
|
/* icmp6 */
|
1999-12-13 18:17:17 +03:00
|
|
|
/*
|
|
|
|
* BSDI4 defines these variables in in_proto.c...
|
|
|
|
* XXX: what if we don't define INET? Should we define pmtu6_expire
|
|
|
|
* or so? (jinmei@kame.net 19990310)
|
|
|
|
*/
|
1999-06-28 10:36:47 +04:00
|
|
|
int pmtu_expire = 60*10;
|
|
|
|
|
|
|
|
/* raw IP6 parameters */
|
|
|
|
/*
|
|
|
|
* Nominal space allocated to a raw ip socket.
|
|
|
|
*/
|
|
|
|
#define RIPV6SNDQ 8192
|
|
|
|
#define RIPV6RCVQ 8192
|
|
|
|
|
|
|
|
u_long rip6_sendspace = RIPV6SNDQ;
|
|
|
|
u_long rip6_recvspace = RIPV6RCVQ;
|
|
|
|
|
|
|
|
/* ICMPV6 parameters */
|
|
|
|
int icmp6_rediraccept = 1; /* accept and process redirects */
|
|
|
|
int icmp6_redirtimeout = 10 * 60; /* 10 minutes */
|
2000-07-06 16:36:18 +04:00
|
|
|
int icmp6errppslim = 100; /* 100pps */
|
2000-01-02 19:31:17 +03:00
|
|
|
int icmp6_nodeinfo = 1; /* enable/disable NI response */
|
1999-06-28 10:36:47 +04:00
|
|
|
|
|
|
|
/* UDP on IP6 parameters */
|
|
|
|
int udp6_sendspace = 9216; /* really max datagram size */
|
|
|
|
int udp6_recvspace = 40 * (1024 + sizeof(struct sockaddr_in6));
|
|
|
|
/* 40 1K datagrams */
|