Initialize protocol switch with structure initializers.
This commit is contained in:
parent
3a91cc8a3b
commit
531d50c86a
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: in6_proto.c,v 1.71 2007/02/17 20:38:05 dyoung Exp $ */
|
||||
/* $NetBSD: in6_proto.c,v 1.72 2007/02/19 07:28:58 dyoung Exp $ */
|
||||
/* $KAME: in6_proto.c,v 1.66 2000/10/10 15:35:47 itojun Exp $ */
|
||||
|
||||
/*
|
||||
|
@ -62,7 +62,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: in6_proto.c,v 1.71 2007/02/17 20:38:05 dyoung Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: in6_proto.c,v 1.72 2007/02/19 07:28:58 dyoung Exp $");
|
||||
|
||||
#include "opt_inet.h"
|
||||
#include "opt_ipsec.h"
|
||||
|
@ -147,67 +147,97 @@ __KERNEL_RCSID(0, "$NetBSD: in6_proto.c,v 1.71 2007/02/17 20:38:05 dyoung Exp $"
|
|||
DOMAIN_DEFINE(inet6domain); /* forward declare and add to link set */
|
||||
|
||||
const struct ip6protosw inet6sw[] = {
|
||||
{ 0, &inet6domain, IPPROTO_IPV6, 0,
|
||||
0, 0, 0, 0,
|
||||
0,
|
||||
ip6_init, 0, frag6_slowtimo, frag6_drain,
|
||||
{ .pr_domain = &inet6domain,
|
||||
.pr_protocol = IPPROTO_IPV6,
|
||||
.pr_init = ip6_init,
|
||||
.pr_slowtimo = frag6_slowtimo,
|
||||
.pr_drain = frag6_drain,
|
||||
},
|
||||
{ SOCK_DGRAM, &inet6domain, IPPROTO_UDP, PR_ATOMIC|PR_ADDR|PR_PURGEIF,
|
||||
udp6_input, 0, udp6_ctlinput, ip6_ctloutput,
|
||||
udp6_usrreq, udp6_init,
|
||||
0, 0, 0,
|
||||
{ .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,
|
||||
},
|
||||
{ SOCK_STREAM, &inet6domain, IPPROTO_TCP, PR_CONNREQUIRED|PR_WANTRCVD|PR_LISTEN|PR_ABRTACPTDIS|PR_PURGEIF,
|
||||
tcp6_input, NULL, tcp6_ctlinput, tcp_ctloutput,
|
||||
tcp_usrreq,
|
||||
#ifdef INET /* don't call initialization and timeout routines twice */
|
||||
0, 0, 0, 0,
|
||||
#else
|
||||
tcp_init, 0, tcp_slowtimo, tcp_drain,
|
||||
{ .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,
|
||||
#endif
|
||||
},
|
||||
{ SOCK_RAW, &inet6domain, IPPROTO_RAW, PR_ATOMIC|PR_ADDR|PR_PURGEIF,
|
||||
rip6_input, rip6_output, rip6_ctlinput, rip6_ctloutput,
|
||||
rip6_usrreq,
|
||||
0, 0, 0, 0,
|
||||
{ .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,
|
||||
},
|
||||
{ SOCK_RAW, &inet6domain, IPPROTO_ICMPV6, PR_ATOMIC|PR_ADDR|PR_LASTHDR,
|
||||
icmp6_input, rip6_output, rip6_ctlinput, rip6_ctloutput,
|
||||
rip6_usrreq,
|
||||
icmp6_init, 0, 0, 0,
|
||||
{ .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,
|
||||
},
|
||||
{ SOCK_RAW, &inet6domain, IPPROTO_DSTOPTS,PR_ATOMIC|PR_ADDR,
|
||||
dest6_input, 0, 0, 0,
|
||||
0,
|
||||
0, 0, 0, 0,
|
||||
{ .pr_type = SOCK_RAW,
|
||||
.pr_domain = &inet6domain,
|
||||
.pr_protocol = IPPROTO_DSTOPTS,
|
||||
.pr_flags = PR_ATOMIC|PR_ADDR,
|
||||
.pr_input = dest6_input,
|
||||
},
|
||||
{ SOCK_RAW, &inet6domain, IPPROTO_ROUTING,PR_ATOMIC|PR_ADDR,
|
||||
route6_input, 0, 0, 0,
|
||||
0,
|
||||
0, 0, 0, 0,
|
||||
{ .pr_type = SOCK_RAW,
|
||||
.pr_domain = &inet6domain,
|
||||
.pr_protocol = IPPROTO_ROUTING,
|
||||
.pr_flags = PR_ATOMIC|PR_ADDR,
|
||||
.pr_input = route6_input,
|
||||
},
|
||||
{ SOCK_RAW, &inet6domain, IPPROTO_FRAGMENT,PR_ATOMIC|PR_ADDR,
|
||||
frag6_input, 0, 0, 0,
|
||||
0,
|
||||
0, 0, 0, 0,
|
||||
{ .pr_type = SOCK_RAW,
|
||||
.pr_domain = &inet6domain,
|
||||
.pr_protocol = IPPROTO_FRAGMENT,
|
||||
.pr_flags = PR_ATOMIC|PR_ADDR,
|
||||
.pr_input = frag6_input,
|
||||
},
|
||||
#ifdef IPSEC
|
||||
{ SOCK_RAW, &inet6domain, IPPROTO_AH, PR_ATOMIC|PR_ADDR,
|
||||
ah6_input, 0, ah6_ctlinput, 0,
|
||||
0,
|
||||
0, 0, 0, 0,
|
||||
{ .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,
|
||||
},
|
||||
#ifdef IPSEC_ESP
|
||||
{ SOCK_RAW, &inet6domain, IPPROTO_ESP, PR_ATOMIC|PR_ADDR,
|
||||
esp6_input, 0, esp6_ctlinput, 0,
|
||||
0,
|
||||
0, 0, 0, 0,
|
||||
{ .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,
|
||||
},
|
||||
#endif
|
||||
{ SOCK_RAW, &inet6domain, IPPROTO_IPCOMP, PR_ATOMIC|PR_ADDR,
|
||||
ipcomp6_input, 0, 0, 0,
|
||||
0,
|
||||
0, 0, 0, 0,
|
||||
{ .pr_type = SOCK_RAW,
|
||||
.pr_domain = &inet6domain,
|
||||
.pr_protocol = IPPROTO_IPCOMP,
|
||||
.pr_flags = PR_ATOMIC|PR_ADDR,
|
||||
.pr_input = ipcomp6_input,
|
||||
},
|
||||
#endif /* IPSEC */
|
||||
#ifdef FAST_IPSEC
|
||||
|
@ -228,48 +258,84 @@ const struct ip6protosw inet6sw[] = {
|
|||
},
|
||||
#endif /* FAST_IPSEC */
|
||||
#ifdef INET
|
||||
{ SOCK_RAW, &inet6domain, IPPROTO_IPV4, PR_ATOMIC|PR_ADDR|PR_LASTHDR,
|
||||
encap6_input, rip6_output, encap6_ctlinput, rip6_ctloutput,
|
||||
rip6_usrreq,
|
||||
encap_init, 0, 0, 0,
|
||||
{ .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,
|
||||
},
|
||||
#endif
|
||||
{ SOCK_RAW, &inet6domain, IPPROTO_IPV6, PR_ATOMIC|PR_ADDR|PR_LASTHDR,
|
||||
encap6_input, rip6_output, encap6_ctlinput, rip6_ctloutput,
|
||||
rip6_usrreq,
|
||||
encap_init, 0, 0, 0,
|
||||
{ .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,
|
||||
},
|
||||
#if NETHERIP > 1
|
||||
{ SOCK_RAW, &inet6domain, IPPROTO_ETHERIP, PR_ATOMIC|PR_ADDR|PR_LASTHDR,
|
||||
ip6_etherip_input, rip6_output, rip6_ctlinput, rip6_ctloutput,
|
||||
rip6_usrreq,
|
||||
0, 0, 0, 0,
|
||||
{ .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,
|
||||
},
|
||||
#endif
|
||||
#if NCARP > 0
|
||||
{ SOCK_RAW, &inet6domain, IPPROTO_CARP, PR_ATOMIC|PR_ADDR,
|
||||
carp6_proto_input, rip6_output, 0, rip6_ctloutput,
|
||||
rip6_usrreq,
|
||||
0, 0, 0, 0,
|
||||
{ .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,
|
||||
},
|
||||
#endif /* NCARP */
|
||||
#ifdef ISO
|
||||
{ SOCK_RAW, &inet6domain, IPPROTO_EON, PR_ATOMIC|PR_ADDR|PR_LASTHDR,
|
||||
encap6_input, rip6_output, encap6_ctlinput, rip6_ctloutput,
|
||||
rip6_usrreq, /*XXX*/
|
||||
encap_init, 0, 0, 0,
|
||||
{ .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,
|
||||
},
|
||||
#endif
|
||||
{ SOCK_RAW, &inet6domain, IPPROTO_PIM, PR_ATOMIC|PR_ADDR|PR_LASTHDR,
|
||||
pim6_input, rip6_output, 0, rip6_ctloutput,
|
||||
rip6_usrreq,
|
||||
0, 0, 0, 0,
|
||||
{ .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,
|
||||
},
|
||||
/* raw wildcard */
|
||||
{ SOCK_RAW, &inet6domain, 0, PR_ATOMIC|PR_ADDR|PR_LASTHDR,
|
||||
rip6_input, rip6_output, 0, rip6_ctloutput,
|
||||
rip6_usrreq,
|
||||
rip6_init, 0, 0, 0,
|
||||
{ .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,
|
||||
},
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in New Issue