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 $ */
|
/* $KAME: in6_proto.c,v 1.66 2000/10/10 15:35:47 itojun Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -62,7 +62,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <sys/cdefs.h>
|
#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_inet.h"
|
||||||
#include "opt_ipsec.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 */
|
DOMAIN_DEFINE(inet6domain); /* forward declare and add to link set */
|
||||||
|
|
||||||
const struct ip6protosw inet6sw[] = {
|
const struct ip6protosw inet6sw[] = {
|
||||||
{ 0, &inet6domain, IPPROTO_IPV6, 0,
|
{ .pr_domain = &inet6domain,
|
||||||
0, 0, 0, 0,
|
.pr_protocol = IPPROTO_IPV6,
|
||||||
0,
|
.pr_init = ip6_init,
|
||||||
ip6_init, 0, frag6_slowtimo, frag6_drain,
|
.pr_slowtimo = frag6_slowtimo,
|
||||||
|
.pr_drain = frag6_drain,
|
||||||
},
|
},
|
||||||
{ SOCK_DGRAM, &inet6domain, IPPROTO_UDP, PR_ATOMIC|PR_ADDR|PR_PURGEIF,
|
{ .pr_type = SOCK_DGRAM,
|
||||||
udp6_input, 0, udp6_ctlinput, ip6_ctloutput,
|
.pr_domain = &inet6domain,
|
||||||
udp6_usrreq, udp6_init,
|
.pr_protocol = IPPROTO_UDP,
|
||||||
0, 0, 0,
|
.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,
|
{ .pr_type = SOCK_STREAM,
|
||||||
tcp6_input, NULL, tcp6_ctlinput, tcp_ctloutput,
|
.pr_domain = &inet6domain,
|
||||||
tcp_usrreq,
|
.pr_protocol = IPPROTO_TCP,
|
||||||
#ifdef INET /* don't call initialization and timeout routines twice */
|
.pr_flags = PR_CONNREQUIRED|PR_WANTRCVD|PR_LISTEN|PR_ABRTACPTDIS|PR_PURGEIF,
|
||||||
0, 0, 0, 0,
|
.pr_input = tcp6_input,
|
||||||
#else
|
.pr_ctlinput = tcp6_ctlinput,
|
||||||
tcp_init, 0, tcp_slowtimo, tcp_drain,
|
.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
|
#endif
|
||||||
},
|
},
|
||||||
{ SOCK_RAW, &inet6domain, IPPROTO_RAW, PR_ATOMIC|PR_ADDR|PR_PURGEIF,
|
{ .pr_type = SOCK_RAW,
|
||||||
rip6_input, rip6_output, rip6_ctlinput, rip6_ctloutput,
|
.pr_domain = &inet6domain,
|
||||||
rip6_usrreq,
|
.pr_protocol = IPPROTO_RAW,
|
||||||
0, 0, 0, 0,
|
.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,
|
{ .pr_type = SOCK_RAW,
|
||||||
icmp6_input, rip6_output, rip6_ctlinput, rip6_ctloutput,
|
.pr_domain = &inet6domain,
|
||||||
rip6_usrreq,
|
.pr_protocol = IPPROTO_ICMPV6,
|
||||||
icmp6_init, 0, 0, 0,
|
.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,
|
{ .pr_type = SOCK_RAW,
|
||||||
dest6_input, 0, 0, 0,
|
.pr_domain = &inet6domain,
|
||||||
0,
|
.pr_protocol = IPPROTO_DSTOPTS,
|
||||||
0, 0, 0, 0,
|
.pr_flags = PR_ATOMIC|PR_ADDR,
|
||||||
|
.pr_input = dest6_input,
|
||||||
},
|
},
|
||||||
{ SOCK_RAW, &inet6domain, IPPROTO_ROUTING,PR_ATOMIC|PR_ADDR,
|
{ .pr_type = SOCK_RAW,
|
||||||
route6_input, 0, 0, 0,
|
.pr_domain = &inet6domain,
|
||||||
0,
|
.pr_protocol = IPPROTO_ROUTING,
|
||||||
0, 0, 0, 0,
|
.pr_flags = PR_ATOMIC|PR_ADDR,
|
||||||
|
.pr_input = route6_input,
|
||||||
},
|
},
|
||||||
{ SOCK_RAW, &inet6domain, IPPROTO_FRAGMENT,PR_ATOMIC|PR_ADDR,
|
{ .pr_type = SOCK_RAW,
|
||||||
frag6_input, 0, 0, 0,
|
.pr_domain = &inet6domain,
|
||||||
0,
|
.pr_protocol = IPPROTO_FRAGMENT,
|
||||||
0, 0, 0, 0,
|
.pr_flags = PR_ATOMIC|PR_ADDR,
|
||||||
|
.pr_input = frag6_input,
|
||||||
},
|
},
|
||||||
#ifdef IPSEC
|
#ifdef IPSEC
|
||||||
{ SOCK_RAW, &inet6domain, IPPROTO_AH, PR_ATOMIC|PR_ADDR,
|
{ .pr_type = SOCK_RAW,
|
||||||
ah6_input, 0, ah6_ctlinput, 0,
|
.pr_domain = &inet6domain,
|
||||||
0,
|
.pr_protocol = IPPROTO_AH,
|
||||||
0, 0, 0, 0,
|
.pr_flags = PR_ATOMIC|PR_ADDR,
|
||||||
|
.pr_input = ah6_input,
|
||||||
|
.pr_ctlinput = ah6_ctlinput,
|
||||||
},
|
},
|
||||||
#ifdef IPSEC_ESP
|
#ifdef IPSEC_ESP
|
||||||
{ SOCK_RAW, &inet6domain, IPPROTO_ESP, PR_ATOMIC|PR_ADDR,
|
{ .pr_type = SOCK_RAW,
|
||||||
esp6_input, 0, esp6_ctlinput, 0,
|
.pr_domain = &inet6domain,
|
||||||
0,
|
.pr_protocol = IPPROTO_ESP,
|
||||||
0, 0, 0, 0,
|
.pr_flags = PR_ATOMIC|PR_ADDR,
|
||||||
|
.pr_input = esp6_input,
|
||||||
|
.pr_ctlinput = esp6_ctlinput,
|
||||||
},
|
},
|
||||||
#endif
|
#endif
|
||||||
{ SOCK_RAW, &inet6domain, IPPROTO_IPCOMP, PR_ATOMIC|PR_ADDR,
|
{ .pr_type = SOCK_RAW,
|
||||||
ipcomp6_input, 0, 0, 0,
|
.pr_domain = &inet6domain,
|
||||||
0,
|
.pr_protocol = IPPROTO_IPCOMP,
|
||||||
0, 0, 0, 0,
|
.pr_flags = PR_ATOMIC|PR_ADDR,
|
||||||
|
.pr_input = ipcomp6_input,
|
||||||
},
|
},
|
||||||
#endif /* IPSEC */
|
#endif /* IPSEC */
|
||||||
#ifdef FAST_IPSEC
|
#ifdef FAST_IPSEC
|
||||||
|
@ -228,48 +258,84 @@ const struct ip6protosw inet6sw[] = {
|
||||||
},
|
},
|
||||||
#endif /* FAST_IPSEC */
|
#endif /* FAST_IPSEC */
|
||||||
#ifdef INET
|
#ifdef INET
|
||||||
{ SOCK_RAW, &inet6domain, IPPROTO_IPV4, PR_ATOMIC|PR_ADDR|PR_LASTHDR,
|
{ .pr_type = SOCK_RAW,
|
||||||
encap6_input, rip6_output, encap6_ctlinput, rip6_ctloutput,
|
.pr_domain = &inet6domain,
|
||||||
rip6_usrreq,
|
.pr_protocol = IPPROTO_IPV4,
|
||||||
encap_init, 0, 0, 0,
|
.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
|
#endif
|
||||||
{ SOCK_RAW, &inet6domain, IPPROTO_IPV6, PR_ATOMIC|PR_ADDR|PR_LASTHDR,
|
{ .pr_type = SOCK_RAW,
|
||||||
encap6_input, rip6_output, encap6_ctlinput, rip6_ctloutput,
|
.pr_domain = &inet6domain,
|
||||||
rip6_usrreq,
|
.pr_protocol = IPPROTO_IPV6,
|
||||||
encap_init, 0, 0, 0,
|
.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
|
#if NETHERIP > 1
|
||||||
{ SOCK_RAW, &inet6domain, IPPROTO_ETHERIP, PR_ATOMIC|PR_ADDR|PR_LASTHDR,
|
{ .pr_type = SOCK_RAW,
|
||||||
ip6_etherip_input, rip6_output, rip6_ctlinput, rip6_ctloutput,
|
.pr_domain = &inet6domain,
|
||||||
rip6_usrreq,
|
.pr_protocol = IPPROTO_ETHERIP,
|
||||||
0, 0, 0, 0,
|
.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
|
#endif
|
||||||
#if NCARP > 0
|
#if NCARP > 0
|
||||||
{ SOCK_RAW, &inet6domain, IPPROTO_CARP, PR_ATOMIC|PR_ADDR,
|
{ .pr_type = SOCK_RAW,
|
||||||
carp6_proto_input, rip6_output, 0, rip6_ctloutput,
|
.pr_domain = &inet6domain,
|
||||||
rip6_usrreq,
|
.pr_protocol = IPPROTO_CARP,
|
||||||
0, 0, 0, 0,
|
.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 */
|
#endif /* NCARP */
|
||||||
#ifdef ISO
|
#ifdef ISO
|
||||||
{ SOCK_RAW, &inet6domain, IPPROTO_EON, PR_ATOMIC|PR_ADDR|PR_LASTHDR,
|
{ .pr_type = SOCK_RAW,
|
||||||
encap6_input, rip6_output, encap6_ctlinput, rip6_ctloutput,
|
.pr_domain = &inet6domain,
|
||||||
rip6_usrreq, /*XXX*/
|
.pr_protocol = IPPROTO_EON,
|
||||||
encap_init, 0, 0, 0,
|
.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
|
#endif
|
||||||
{ SOCK_RAW, &inet6domain, IPPROTO_PIM, PR_ATOMIC|PR_ADDR|PR_LASTHDR,
|
{ .pr_type = SOCK_RAW,
|
||||||
pim6_input, rip6_output, 0, rip6_ctloutput,
|
.pr_domain = &inet6domain,
|
||||||
rip6_usrreq,
|
.pr_protocol = IPPROTO_PIM,
|
||||||
0, 0, 0, 0,
|
.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 */
|
/* raw wildcard */
|
||||||
{ SOCK_RAW, &inet6domain, 0, PR_ATOMIC|PR_ADDR|PR_LASTHDR,
|
{ .pr_type = SOCK_RAW,
|
||||||
rip6_input, rip6_output, 0, rip6_ctloutput,
|
.pr_domain = &inet6domain,
|
||||||
rip6_usrreq,
|
.pr_flags = PR_ATOMIC|PR_ADDR|PR_LASTHDR,
|
||||||
rip6_init, 0, 0, 0,
|
.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