Use sparse initializers for "struct domain" and "struct protosw",
so they are easier to follow for the human being.
This commit is contained in:
parent
643d537fcd
commit
303989a2f3
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=152242
@ -48,29 +48,35 @@ __FBSDID("$FreeBSD$");
|
||||
*/
|
||||
|
||||
static struct protosw localsw[] = {
|
||||
{ SOCK_STREAM, &localdomain, 0, PR_CONNREQUIRED|PR_WANTRCVD|PR_RIGHTS,
|
||||
0, 0, 0, &uipc_ctloutput,
|
||||
0,
|
||||
0, 0, 0, 0,
|
||||
&uipc_usrreqs
|
||||
{
|
||||
.pr_type = SOCK_STREAM,
|
||||
.pr_domain = &localdomain,
|
||||
.pr_flags = PR_CONNREQUIRED|PR_WANTRCVD|PR_RIGHTS,
|
||||
.pr_ctloutput = &uipc_ctloutput,
|
||||
.pr_usrreqs = &uipc_usrreqs
|
||||
},
|
||||
{ SOCK_DGRAM, &localdomain, 0, PR_ATOMIC|PR_ADDR|PR_RIGHTS,
|
||||
0, 0, 0, 0,
|
||||
0,
|
||||
0, 0, 0, 0,
|
||||
&uipc_usrreqs
|
||||
{
|
||||
.pr_type = SOCK_DGRAM,
|
||||
.pr_domain = &localdomain,
|
||||
.pr_flags = PR_ATOMIC|PR_ADDR|PR_RIGHTS,
|
||||
.pr_usrreqs = &uipc_usrreqs
|
||||
},
|
||||
{ 0, 0, 0, 0,
|
||||
0, 0, raw_ctlinput, 0,
|
||||
0,
|
||||
raw_init, 0, 0, 0,
|
||||
&raw_usrreqs
|
||||
{
|
||||
.pr_ctlinput = raw_ctlinput,
|
||||
.pr_init = raw_init,
|
||||
.pr_usrreqs = &raw_usrreqs
|
||||
}
|
||||
};
|
||||
|
||||
struct domain localdomain =
|
||||
{ AF_LOCAL, "local", unp_init, unp_externalize, unp_dispose,
|
||||
localsw, &localsw[sizeof(localsw)/sizeof(localsw[0])] };
|
||||
struct domain localdomain = {
|
||||
.dom_family = AF_LOCAL,
|
||||
.dom_name = "local",
|
||||
.dom_init = unp_init,
|
||||
.dom_externalize = unp_externalize,
|
||||
.dom_dispose = unp_dispose,
|
||||
.dom_protosw = localsw,
|
||||
.dom_protoswNPROTOSW = &localsw[sizeof(localsw)/sizeof(localsw[0])]
|
||||
};
|
||||
DOMAIN_SET(local);
|
||||
|
||||
SYSCTL_NODE(_net, PF_LOCAL, local, CTLFLAG_RW, 0, "Local domain");
|
||||
|
@ -118,19 +118,27 @@ static void greattach(void);
|
||||
|
||||
#ifdef INET
|
||||
extern struct domain inetdomain;
|
||||
static const struct protosw in_gre_protosw =
|
||||
{ SOCK_RAW, &inetdomain, IPPROTO_GRE, PR_ATOMIC|PR_ADDR,
|
||||
(pr_input_t*)gre_input, (pr_output_t*)rip_output, rip_ctlinput, rip_ctloutput,
|
||||
0,
|
||||
0, 0, 0, 0,
|
||||
&rip_usrreqs
|
||||
static const struct protosw in_gre_protosw = {
|
||||
.pr_type = SOCK_RAW,
|
||||
.pr_domain = &inetdomain,
|
||||
.pr_protocol = IPPROTO_GRE,
|
||||
.pr_flags = PR_ATOMIC|PR_ADDR,
|
||||
.pr_input = (pr_input_t *)gre_input,
|
||||
.pr_output = (pr_output_t *)rip_output,
|
||||
.pr_ctlinput = rip_ctlinput,
|
||||
.pr_ctloutput = rip_ctloutput,
|
||||
.pr_usrreqs = &rip_usrreqs
|
||||
};
|
||||
static const struct protosw in_mobile_protosw =
|
||||
{ SOCK_RAW, &inetdomain, IPPROTO_MOBILE, PR_ATOMIC|PR_ADDR,
|
||||
(pr_input_t*)gre_mobile_input, (pr_output_t*)rip_output, rip_ctlinput, rip_ctloutput,
|
||||
0,
|
||||
0, 0, 0, 0,
|
||||
&rip_usrreqs
|
||||
static const struct protosw in_mobile_protosw = {
|
||||
.pr_type = SOCK_RAW,
|
||||
.pr_domain = &inetdomain,
|
||||
.pr_protocol = IPPROTO_MOBILE,
|
||||
.pr_flags = PR_ATOMIC|PR_ADDR,
|
||||
.pr_input = (pr_input_t *)gre_mobile_input,
|
||||
.pr_output = (pr_output_t *)rip_output,
|
||||
.pr_ctlinput = rip_ctlinput,
|
||||
.pr_ctloutput = rip_ctloutput,
|
||||
.pr_usrreqs = &rip_usrreqs
|
||||
};
|
||||
#endif
|
||||
|
||||
|
@ -150,12 +150,15 @@ static MALLOC_DEFINE(M_STF, STFNAME, "6to4 Tunnel Interface");
|
||||
static const int ip_stf_ttl = 40;
|
||||
|
||||
extern struct domain inetdomain;
|
||||
struct protosw in_stf_protosw =
|
||||
{ SOCK_RAW, &inetdomain, IPPROTO_IPV6, PR_ATOMIC|PR_ADDR,
|
||||
in_stf_input, (pr_output_t*)rip_output, 0, rip_ctloutput,
|
||||
0,
|
||||
0, 0, 0, 0,
|
||||
&rip_usrreqs
|
||||
struct protosw in_stf_protosw = {
|
||||
.pr_type = SOCK_RAW,
|
||||
.pr_domain = &inetdomain,
|
||||
.pr_protocol = IPPROTO_IPV6,
|
||||
.pr_flags = PR_ATOMIC|PR_ADDR,
|
||||
.pr_input = in_stf_input,
|
||||
.pr_output = (pr_output_t *)rip_output,
|
||||
.pr_ctloutput = rip_ctloutput,
|
||||
.pr_usrreqs = &rip_usrreqs
|
||||
};
|
||||
|
||||
static char *stfnames[] = {"stf0", "stf", "6to4", NULL};
|
||||
|
@ -1257,16 +1257,22 @@ SYSCTL_NODE(_net, PF_ROUTE, routetable, CTLFLAG_RD, sysctl_rtsock, "");
|
||||
static struct domain routedomain; /* or at least forward */
|
||||
|
||||
static struct protosw routesw[] = {
|
||||
{ SOCK_RAW, &routedomain, 0, PR_ATOMIC|PR_ADDR,
|
||||
0, route_output, raw_ctlinput, 0,
|
||||
0,
|
||||
raw_init, 0, 0, 0,
|
||||
&route_usrreqs
|
||||
{
|
||||
.pr_type = SOCK_RAW,
|
||||
.pr_domain = &routedomain,
|
||||
.pr_flags = PR_ATOMIC|PR_ADDR,
|
||||
.pr_output = route_output,
|
||||
.pr_ctlinput = raw_ctlinput,
|
||||
.pr_init = raw_init,
|
||||
.pr_usrreqs = &route_usrreqs
|
||||
}
|
||||
};
|
||||
|
||||
static struct domain routedomain =
|
||||
{ PF_ROUTE, "route", 0, 0, 0,
|
||||
routesw, &routesw[sizeof(routesw)/sizeof(routesw[0])] };
|
||||
static struct domain routedomain = {
|
||||
.dom_family = PF_ROUTE,
|
||||
.dom_name = "route",
|
||||
.dom_protosw = routesw,
|
||||
.dom_protoswNPROTOSW = &routesw[sizeof(routesw)/sizeof(routesw[0])]
|
||||
};
|
||||
|
||||
DOMAIN_SET(route);
|
||||
|
@ -41,30 +41,24 @@ static struct domain atalkdomain;
|
||||
static struct protosw atalksw[] = {
|
||||
{
|
||||
/* Identifiers */
|
||||
SOCK_DGRAM, &atalkdomain, ATPROTO_DDP, PR_ATOMIC|PR_ADDR,
|
||||
/*
|
||||
* protocol-protocol interface.
|
||||
* fields are pr_input, pr_output, pr_ctlinput, and pr_ctloutput.
|
||||
* pr_input can be called from the udp protocol stack for iptalk
|
||||
* packets bound for a local socket.
|
||||
* pr_output can be used by higher level appletalk protocols, should
|
||||
* they be included in the kernel.
|
||||
*/
|
||||
0, ddp_output, 0, 0,
|
||||
/* socket-protocol interface. deprecated */
|
||||
NULL,
|
||||
/* utility routines. */
|
||||
ddp_init, 0, 0, 0,
|
||||
&ddp_usrreqs
|
||||
.pr_type = SOCK_DGRAM,
|
||||
.pr_domain = &atalkdomain,
|
||||
.pr_protocol = ATPROTO_DDP,
|
||||
.pr_flags = PR_ATOMIC|PR_ADDR,
|
||||
.pr_output = ddp_output,
|
||||
.pr_init = ddp_init,
|
||||
.pr_usrreqs = &ddp_usrreqs
|
||||
},
|
||||
};
|
||||
|
||||
static struct domain atalkdomain = {
|
||||
AF_APPLETALK, "appletalk", 0, 0, 0,
|
||||
atalksw, &atalksw[sizeof(atalksw)/sizeof(atalksw[0])],
|
||||
0, rn_inithead,
|
||||
8 * (u_long) &((struct sockaddr_at *) 0)->sat_addr,
|
||||
sizeof(struct sockaddr_at)
|
||||
.dom_family = AF_APPLETALK,
|
||||
.dom_name = "appletalk",
|
||||
.dom_protosw = atalksw,
|
||||
.dom_protoswNPROTOSW = &atalksw[sizeof(atalksw)/sizeof(atalksw[0])],
|
||||
.dom_rtattach = rn_inithead,
|
||||
.dom_rtoffset = offsetof(struct sockaddr_at, sat_addr) << 3,
|
||||
.dom_maxrtkey = sizeof(struct sockaddr_at)
|
||||
};
|
||||
|
||||
DOMAIN_SET(atalk);
|
||||
|
@ -54,65 +54,43 @@ __FBSDID("$FreeBSD$");
|
||||
NET_NEEDS_GIANT("netatm");
|
||||
|
||||
struct protosw atmsw[] = {
|
||||
{ SOCK_DGRAM, /* ioctl()-only */
|
||||
&atmdomain,
|
||||
0,
|
||||
0,
|
||||
0, /* pr_input */
|
||||
0, /* pr_output */
|
||||
0, /* pr_ctlinput */
|
||||
0, /* pr_ctloutput */
|
||||
0, /* pr_ousrreq */
|
||||
0, /* pr_init */
|
||||
0, /* pr_fasttimo */
|
||||
0, /* pr_slowtimo */
|
||||
0, /* pr_drain */
|
||||
&atm_dgram_usrreqs, /* pr_usrreqs */
|
||||
{
|
||||
.pr_type = SOCK_DGRAM, /* ioctl()-only */
|
||||
.pr_domain = &atmdomain,
|
||||
.pr_usrreqs = &atm_dgram_usrreqs
|
||||
},
|
||||
|
||||
{ SOCK_SEQPACKET, /* AAL-5 */
|
||||
&atmdomain,
|
||||
ATM_PROTO_AAL5,
|
||||
PR_ATOMIC|PR_CONNREQUIRED,
|
||||
0, /* pr_input */
|
||||
0, /* pr_output */
|
||||
0, /* pr_ctlinput */
|
||||
atm_aal5_ctloutput, /* pr_ctloutput */
|
||||
0, /* pr_ousrreq */
|
||||
0, /* pr_init */
|
||||
0, /* pr_fasttimo */
|
||||
0, /* pr_slowtimo */
|
||||
0, /* pr_drain */
|
||||
&atm_aal5_usrreqs, /* pr_usrreqs */
|
||||
{
|
||||
.pr_type = SOCK_SEQPACKET, /* AAL-5 */
|
||||
.pr_domain = &atmdomain,
|
||||
.pr_protocol = ATM_PROTO_AAL5,
|
||||
.pr_flags = PR_ATOMIC|PR_CONNREQUIRED,
|
||||
.pr_ctloutput = atm_aal5_ctloutput,
|
||||
.pr_usrreqs = &atm_aal5_usrreqs
|
||||
},
|
||||
|
||||
#ifdef XXX
|
||||
{ SOCK_SEQPACKET, /* SSCOP */
|
||||
&atmdomain,
|
||||
ATM_PROTO_SSCOP,
|
||||
PR_ATOMIC|PR_CONNREQUIRED|PR_WANTRCVD,
|
||||
x, /* pr_input */
|
||||
x, /* pr_output */
|
||||
x, /* pr_ctlinput */
|
||||
x, /* pr_ctloutput */
|
||||
0, /* pr_ousrreq */
|
||||
0, /* pr_init */
|
||||
0, /* pr_fasttimo */
|
||||
0, /* pr_slowtimo */
|
||||
x, /* pr_drain */
|
||||
x, /* pr_usrreqs */
|
||||
{
|
||||
.pr_type = SOCK_SEQPACKET, /* SSCOP */
|
||||
.pr_domain = &atmdomain,
|
||||
.pr_protocol = ATM_PROTO_SSCOP,
|
||||
.pr_flags = PR_ATOMIC|PR_CONNREQUIRED|PR_WANTRCVD,
|
||||
.pr_input = x,
|
||||
.pr_output = x,
|
||||
.pr_ctlinput = x,
|
||||
.pr_ctloutput = x,
|
||||
.pr_drain = x,
|
||||
.pr_usrreqs = x
|
||||
},
|
||||
#endif
|
||||
};
|
||||
|
||||
struct domain atmdomain = {
|
||||
AF_ATM,
|
||||
"atm",
|
||||
atm_initialize,
|
||||
0,
|
||||
0,
|
||||
atmsw,
|
||||
&atmsw[sizeof(atmsw) / sizeof(atmsw[0])]
|
||||
.dom_family = AF_ATM,
|
||||
.dom_name = "atm",
|
||||
.dom_init = atm_initialize,
|
||||
.dom_protosw = atmsw,
|
||||
.dom_protoswNPROTOSW = &atmsw[sizeof(atmsw) / sizeof(atmsw[0])]
|
||||
};
|
||||
|
||||
DOMAIN_SET(atm);
|
||||
|
@ -140,56 +140,39 @@ static struct pr_usrreqs ng_btsocket_rfcomm_usrreqs = {
|
||||
|
||||
static struct protosw ng_btsocket_protosw[] = {
|
||||
{
|
||||
SOCK_RAW, /* protocol type */
|
||||
&ng_btsocket_domain, /* backpointer to domain */
|
||||
BLUETOOTH_PROTO_HCI, /* protocol */
|
||||
PR_ATOMIC | PR_ADDR, /* flags */
|
||||
NULL, NULL, NULL, /* input, output, ctlinput */
|
||||
ng_btsocket_hci_raw_ctloutput, /* ctloutput */
|
||||
NULL, /* ousrreq() */
|
||||
ng_btsocket_hci_raw_init, /* init */
|
||||
NULL, NULL, NULL, /* fasttimeo, slowtimo, drain */
|
||||
&ng_btsocket_hci_raw_usrreqs, /* usrreq table (above) */
|
||||
/* { NULL } */ /* pfh (protocol filter head?) */
|
||||
.pr_type = SOCK_RAW,
|
||||
.pr_domain = &ng_btsocket_domain,
|
||||
.pr_protocol = BLUETOOTH_PROTO_HCI,
|
||||
.pr_flags = PR_ATOMIC|PR_ADDR,
|
||||
.pr_ctloutput = ng_btsocket_hci_raw_ctloutput,
|
||||
.pr_init = ng_btsocket_hci_raw_init,
|
||||
.pr_usrreqs = &ng_btsocket_hci_raw_usrreqs,
|
||||
},
|
||||
{
|
||||
SOCK_RAW, /* protocol type */
|
||||
&ng_btsocket_domain, /* backpointer to domain */
|
||||
BLUETOOTH_PROTO_L2CAP, /* protocol */
|
||||
PR_ATOMIC | PR_ADDR, /* flags */
|
||||
NULL, NULL, NULL, /* input, output, ctlinput */
|
||||
NULL, /* ctloutput */
|
||||
NULL, /* ousrreq() */
|
||||
ng_btsocket_l2cap_raw_init, /* init */
|
||||
NULL, NULL, NULL, /* fasttimeo, slowtimo, drain */
|
||||
&ng_btsocket_l2cap_raw_usrreqs, /* usrreq table (above) */
|
||||
/* { NULL } */ /* pfh (protocol filter head?) */
|
||||
.pr_type = SOCK_RAW,
|
||||
.pr_domain = &ng_btsocket_domain,
|
||||
.pr_protocol = BLUETOOTH_PROTO_L2CAP,
|
||||
.pr_flags = PR_ATOMIC|PR_ADDR,
|
||||
.pr_init = ng_btsocket_l2cap_raw_init,
|
||||
.pr_usrreqs = &ng_btsocket_l2cap_raw_usrreqs,
|
||||
},
|
||||
{
|
||||
SOCK_SEQPACKET, /* protocol type */
|
||||
&ng_btsocket_domain, /* backpointer to domain */
|
||||
BLUETOOTH_PROTO_L2CAP, /* protocol */
|
||||
PR_ATOMIC | PR_CONNREQUIRED, /* flags */
|
||||
NULL, NULL, NULL, /* input, output, ctlinput */
|
||||
ng_btsocket_l2cap_ctloutput, /* ctloutput */
|
||||
NULL, /* ousrreq() */
|
||||
ng_btsocket_l2cap_init, /* init */
|
||||
NULL, NULL, NULL, /* fasttimeo, slowtimo, drain */
|
||||
&ng_btsocket_l2cap_usrreqs, /* usrreq table (above) */
|
||||
/* { NULL } */ /* pfh (protocol filter head?) */
|
||||
.pr_type = SOCK_SEQPACKET,
|
||||
.pr_domain = &ng_btsocket_domain,
|
||||
.pr_protocol = BLUETOOTH_PROTO_L2CAP,
|
||||
.pr_flags = PR_ATOMIC|PR_CONNREQUIRED,
|
||||
.pr_ctloutput = ng_btsocket_l2cap_ctloutput,
|
||||
.pr_init = ng_btsocket_l2cap_init,
|
||||
.pr_usrreqs = &ng_btsocket_l2cap_usrreqs,
|
||||
},
|
||||
{
|
||||
SOCK_STREAM, /* protocol type */
|
||||
&ng_btsocket_domain, /* backpointer to domain */
|
||||
BLUETOOTH_PROTO_RFCOMM, /* protocol */
|
||||
PR_CONNREQUIRED, /* flags */
|
||||
NULL, NULL, NULL, /* input, output, ctlinput */
|
||||
ng_btsocket_rfcomm_ctloutput, /* ctloutput */
|
||||
NULL, /* ousrreq() */
|
||||
ng_btsocket_rfcomm_init, /* init */
|
||||
NULL, NULL, NULL, /* fasttimeo, slowtimo, drain */
|
||||
&ng_btsocket_rfcomm_usrreqs, /* usrreq table (above) */
|
||||
/* { NULL } */ /* pfh (protocol filter head?) */
|
||||
.pr_type = SOCK_STREAM,
|
||||
.pr_domain = &ng_btsocket_domain,
|
||||
.pr_protocol = BLUETOOTH_PROTO_RFCOMM,
|
||||
.pr_flags = PR_CONNREQUIRED,
|
||||
.pr_ctloutput = ng_btsocket_rfcomm_ctloutput,
|
||||
.pr_init = ng_btsocket_rfcomm_init,
|
||||
.pr_usrreqs = &ng_btsocket_rfcomm_usrreqs,
|
||||
}
|
||||
};
|
||||
#define ng_btsocket_protosw_size \
|
||||
@ -202,17 +185,10 @@ static struct protosw ng_btsocket_protosw[] = {
|
||||
*/
|
||||
|
||||
struct domain ng_btsocket_domain = {
|
||||
AF_BLUETOOTH, /* family */
|
||||
"bluetooth", /* domain name */
|
||||
NULL, /* init() */
|
||||
NULL, /* externalize() */
|
||||
NULL, /* dispose() */
|
||||
ng_btsocket_protosw, /* protosw entry */
|
||||
ng_btsocket_protosw_end, /* end of protosw entries */
|
||||
NULL, /* next domain in list */
|
||||
NULL, /* rtattach() */
|
||||
0, /* arg to rtattach in bits */
|
||||
0 /* maxrtkey */
|
||||
.dom_family = AF_BLUETOOTH,
|
||||
.dom_name = "bluetooth",
|
||||
.dom_protosw = ng_btsocket_protosw,
|
||||
.dom_protoswNPROTOSW = ng_btsocket_protosw_end
|
||||
};
|
||||
|
||||
/*
|
||||
|
@ -1130,42 +1130,27 @@ static struct pr_usrreqs ngd_usrreqs = {
|
||||
extern struct domain ngdomain; /* stop compiler warnings */
|
||||
|
||||
static struct protosw ngsw[] = {
|
||||
{
|
||||
SOCK_DGRAM, /* protocol type */
|
||||
&ngdomain, /* backpointer to domain */
|
||||
NG_CONTROL,
|
||||
PR_ATOMIC | PR_ADDR /* | PR_RIGHTS */, /* flags */
|
||||
0, 0, 0, 0, /* input, output, ctlinput, ctloutput */
|
||||
NULL, /* ousrreq */
|
||||
0, 0, 0, 0, /* init, fasttimeo, slowtimo, drain */
|
||||
&ngc_usrreqs, /* usrreq table (above) */
|
||||
/*{NULL}*/ /* pffh (protocol filter head?) */
|
||||
},
|
||||
{
|
||||
SOCK_DGRAM, /* protocol type */
|
||||
&ngdomain, /* backpointer to domain */
|
||||
NG_DATA,
|
||||
PR_ATOMIC | PR_ADDR, /* flags */
|
||||
0, 0, 0, 0, /* input, output, ctlinput, ctloutput */
|
||||
NULL, /* ousrreq() */
|
||||
0, 0, 0, 0, /* init, fasttimeo, slowtimo, drain */
|
||||
&ngd_usrreqs, /* usrreq table (above) */
|
||||
/*{NULL}*/ /* pffh (protocol filter head?) */
|
||||
}
|
||||
{
|
||||
.pr_type = SOCK_DGRAM,
|
||||
.pr_domain = &ngdomain,
|
||||
.pr_protocol = NG_CONTROL,
|
||||
.pr_flags = PR_ATOMIC | PR_ADDR /* | PR_RIGHTS */,
|
||||
.pr_usrreqs = &ngc_usrreqs
|
||||
},
|
||||
{
|
||||
.pr_type = SOCK_DGRAM,
|
||||
.pr_domain = &ngdomain,
|
||||
.pr_protocol = NG_DATA,
|
||||
.pr_flags = PR_ATOMIC | PR_ADDR,
|
||||
.pr_usrreqs = &ngd_usrreqs
|
||||
}
|
||||
};
|
||||
|
||||
struct domain ngdomain = {
|
||||
AF_NETGRAPH,
|
||||
"netgraph",
|
||||
NULL, /* init() */
|
||||
NULL, /* externalise() */
|
||||
NULL, /* dispose() */
|
||||
ngsw, /* protosw entry */
|
||||
&ngsw[sizeof(ngsw) / sizeof(ngsw[0])], /* Number of protosw entries */
|
||||
NULL, /* next domain in list */
|
||||
NULL, /* rtattach() */
|
||||
0, /* arg to rtattach in bits */
|
||||
0 /* maxrtkey */
|
||||
.dom_family = AF_NETGRAPH,
|
||||
.dom_name = "netgraph",
|
||||
.dom_protosw = ngsw,
|
||||
.dom_protoswNPROTOSW = &ngsw[sizeof(ngsw) / sizeof(ngsw[0])]
|
||||
};
|
||||
|
||||
/*
|
||||
|
@ -74,12 +74,15 @@ static int gif_validate4(const struct ip *, struct gif_softc *,
|
||||
struct ifnet *);
|
||||
|
||||
extern struct domain inetdomain;
|
||||
struct protosw in_gif_protosw =
|
||||
{ SOCK_RAW, &inetdomain, 0/* IPPROTO_IPV[46] */, PR_ATOMIC|PR_ADDR,
|
||||
in_gif_input, (pr_output_t*)rip_output, 0, rip_ctloutput,
|
||||
0,
|
||||
0, 0, 0, 0,
|
||||
&rip_usrreqs
|
||||
struct protosw in_gif_protosw = {
|
||||
.pr_type = SOCK_RAW,
|
||||
.pr_domain = &inetdomain,
|
||||
.pr_protocol = 0/* IPPROTO_IPV[46] */,
|
||||
.pr_flags = PR_ATOMIC|PR_ADDR,
|
||||
.pr_input = in_gif_input,
|
||||
.pr_output = (pr_output_t*)rip_output,
|
||||
.pr_ctloutput = rip_ctloutput,
|
||||
.pr_usrreqs = &rip_usrreqs
|
||||
};
|
||||
|
||||
static int ip_gif_ttl = GIF_TTL;
|
||||
|
@ -100,156 +100,228 @@ static struct pr_usrreqs nousrreqs;
|
||||
extern struct domain inetdomain;
|
||||
|
||||
/* Spacer for loadable protocols. */
|
||||
#define IPPROTOSPACER \
|
||||
{ 0, &inetdomain, PROTO_SPACER, 0, \
|
||||
NULL, NULL, NULL, NULL, \
|
||||
NULL, \
|
||||
NULL, NULL, NULL, NULL, \
|
||||
&nousrreqs \
|
||||
#define IPPROTOSPACER \
|
||||
{ \
|
||||
.pr_domain = &inetdomain, \
|
||||
.pr_protocol = PROTO_SPACER, \
|
||||
.pr_usrreqs = &nousrreqs \
|
||||
}
|
||||
|
||||
struct protosw inetsw[] = {
|
||||
{ 0, &inetdomain, 0, 0,
|
||||
0, 0, 0, 0,
|
||||
0,
|
||||
ip_init, 0, ip_slowtimo, ip_drain,
|
||||
&nousrreqs
|
||||
{
|
||||
.pr_type = 0,
|
||||
.pr_domain = &inetdomain,
|
||||
.pr_protocol = IPPROTO_IP,
|
||||
.pr_init = ip_init,
|
||||
.pr_slowtimo = ip_slowtimo,
|
||||
.pr_drain = ip_drain,
|
||||
.pr_usrreqs = &nousrreqs
|
||||
},
|
||||
{ SOCK_DGRAM, &inetdomain, IPPROTO_UDP, PR_ATOMIC|PR_ADDR,
|
||||
udp_input, 0, udp_ctlinput, ip_ctloutput,
|
||||
0,
|
||||
udp_init, 0, 0, 0,
|
||||
&udp_usrreqs
|
||||
{
|
||||
.pr_type = SOCK_DGRAM,
|
||||
.pr_domain = &inetdomain,
|
||||
.pr_protocol = IPPROTO_UDP,
|
||||
.pr_flags = PR_ATOMIC|PR_ADDR,
|
||||
.pr_input = udp_input,
|
||||
.pr_ctlinput = udp_ctlinput,
|
||||
.pr_ctloutput = ip_ctloutput,
|
||||
.pr_init = udp_init,
|
||||
.pr_usrreqs = &udp_usrreqs
|
||||
},
|
||||
{ SOCK_STREAM, &inetdomain, IPPROTO_TCP,
|
||||
PR_CONNREQUIRED|PR_IMPLOPCL|PR_WANTRCVD,
|
||||
tcp_input, 0, tcp_ctlinput, tcp_ctloutput,
|
||||
0,
|
||||
tcp_init, 0, tcp_slowtimo, tcp_drain,
|
||||
&tcp_usrreqs
|
||||
{
|
||||
.pr_type = SOCK_STREAM,
|
||||
.pr_domain = &inetdomain,
|
||||
.pr_protocol = IPPROTO_TCP,
|
||||
.pr_flags = PR_CONNREQUIRED|PR_IMPLOPCL|PR_WANTRCVD,
|
||||
.pr_input = tcp_input,
|
||||
.pr_ctlinput = tcp_ctlinput,
|
||||
.pr_ctloutput = tcp_ctloutput,
|
||||
.pr_init = tcp_init,
|
||||
.pr_slowtimo = tcp_slowtimo,
|
||||
.pr_drain = tcp_drain,
|
||||
.pr_usrreqs = &tcp_usrreqs
|
||||
},
|
||||
{ SOCK_RAW, &inetdomain, IPPROTO_RAW, PR_ATOMIC|PR_ADDR,
|
||||
rip_input, 0, rip_ctlinput, rip_ctloutput,
|
||||
0,
|
||||
0, 0, 0, 0,
|
||||
&rip_usrreqs
|
||||
{
|
||||
.pr_type = SOCK_RAW,
|
||||
.pr_domain = &inetdomain,
|
||||
.pr_protocol = IPPROTO_RAW,
|
||||
.pr_flags = PR_ATOMIC|PR_ADDR,
|
||||
.pr_input = rip_input,
|
||||
.pr_ctlinput = rip_ctlinput,
|
||||
.pr_ctloutput = rip_ctloutput,
|
||||
.pr_usrreqs = &rip_usrreqs
|
||||
},
|
||||
{ SOCK_RAW, &inetdomain, IPPROTO_ICMP, PR_ATOMIC|PR_ADDR|PR_LASTHDR,
|
||||
icmp_input, 0, 0, rip_ctloutput,
|
||||
0,
|
||||
0, 0, 0, 0,
|
||||
&rip_usrreqs
|
||||
{
|
||||
.pr_type = SOCK_RAW,
|
||||
.pr_domain = &inetdomain,
|
||||
.pr_protocol = IPPROTO_ICMP,
|
||||
.pr_flags = PR_ATOMIC|PR_ADDR|PR_LASTHDR,
|
||||
.pr_input = icmp_input,
|
||||
.pr_ctloutput = rip_ctloutput,
|
||||
.pr_usrreqs = &rip_usrreqs
|
||||
},
|
||||
{ SOCK_RAW, &inetdomain, IPPROTO_IGMP, PR_ATOMIC|PR_ADDR|PR_LASTHDR,
|
||||
igmp_input, 0, 0, rip_ctloutput,
|
||||
0,
|
||||
igmp_init, igmp_fasttimo, igmp_slowtimo, 0,
|
||||
&rip_usrreqs
|
||||
{
|
||||
.pr_type = SOCK_RAW,
|
||||
.pr_domain = &inetdomain,
|
||||
.pr_protocol = IPPROTO_IGMP,
|
||||
.pr_flags = PR_ATOMIC|PR_ADDR|PR_LASTHDR,
|
||||
.pr_input = igmp_input,
|
||||
.pr_ctloutput = rip_ctloutput,
|
||||
.pr_init = igmp_init,
|
||||
.pr_fasttimo = igmp_fasttimo,
|
||||
.pr_slowtimo = igmp_slowtimo,
|
||||
.pr_usrreqs = &rip_usrreqs
|
||||
},
|
||||
{ SOCK_RAW, &inetdomain, IPPROTO_RSVP, PR_ATOMIC|PR_ADDR|PR_LASTHDR,
|
||||
rsvp_input, 0, 0, rip_ctloutput,
|
||||
0,
|
||||
0, 0, 0, 0,
|
||||
&rip_usrreqs
|
||||
{
|
||||
.pr_type = SOCK_RAW,
|
||||
.pr_domain = &inetdomain,
|
||||
.pr_protocol = IPPROTO_RSVP,
|
||||
.pr_flags = PR_ATOMIC|PR_ADDR|PR_LASTHDR,
|
||||
.pr_input = rsvp_input,
|
||||
.pr_ctloutput = rip_ctloutput,
|
||||
.pr_usrreqs = &rip_usrreqs
|
||||
},
|
||||
#ifdef IPSEC
|
||||
{ SOCK_RAW, &inetdomain, IPPROTO_AH, PR_ATOMIC|PR_ADDR,
|
||||
ah4_input, 0, 0, 0,
|
||||
0,
|
||||
0, 0, 0, 0,
|
||||
&nousrreqs
|
||||
{
|
||||
.pr_type = SOCK_RAW,
|
||||
.pr_domain = &inetdomain,
|
||||
.pr_protocol = IPPROTO_AH,
|
||||
.pr_flags = PR_ATOMIC|PR_ADDR,
|
||||
.pr_input = ah4_input,
|
||||
.pr_usrreqs = &nousrreqs
|
||||
},
|
||||
#ifdef IPSEC_ESP
|
||||
{ SOCK_RAW, &inetdomain, IPPROTO_ESP, PR_ATOMIC|PR_ADDR,
|
||||
esp4_input, 0, 0, 0,
|
||||
0,
|
||||
0, 0, 0, 0,
|
||||
&nousrreqs
|
||||
{
|
||||
.pr_type = SOCK_RAW,
|
||||
.pr_domain = &inetdomain,
|
||||
.pr_protocol = IPPROTO_ESP,
|
||||
.pr_flags = PR_ATOMIC|PR_ADDR,
|
||||
.pr_input = esp4_input,
|
||||
.pr_usrreqs = &nousrreqs
|
||||
},
|
||||
#endif
|
||||
{ SOCK_RAW, &inetdomain, IPPROTO_IPCOMP, PR_ATOMIC|PR_ADDR,
|
||||
ipcomp4_input, 0, 0, 0,
|
||||
0,
|
||||
0, 0, 0, 0,
|
||||
&nousrreqs
|
||||
{
|
||||
.pr_type = SOCK_RAW,
|
||||
.pr_domain = &inetdomain,
|
||||
.pr_protocol = IPPROTO_IPCOMP,
|
||||
.pr_flags = PR_ATOMIC|PR_ADDR,
|
||||
.pr_input = ipcomp4_input,
|
||||
.pr_usrreqs = &nousrreqs
|
||||
},
|
||||
#endif /* IPSEC */
|
||||
#ifdef FAST_IPSEC
|
||||
{ SOCK_RAW, &inetdomain, IPPROTO_AH, PR_ATOMIC|PR_ADDR,
|
||||
ah4_input, 0, ah4_ctlinput, 0,
|
||||
0,
|
||||
0, 0, 0, 0,
|
||||
&nousrreqs
|
||||
{
|
||||
.pr_type = SOCK_RAW,
|
||||
.pr_domain = &inetdomain,
|
||||
.pr_protocol = IPPROTO_AH,
|
||||
.pr_flags = PR_ATOMIC|PR_ADDR,
|
||||
.pr_input = ah4_input,
|
||||
.pr_ctlinput = ah4_ctlinput,
|
||||
.pr_usrreqs = &nousrreqs
|
||||
},
|
||||
{ SOCK_RAW, &inetdomain, IPPROTO_ESP, PR_ATOMIC|PR_ADDR,
|
||||
esp4_input, 0, esp4_ctlinput, 0,
|
||||
0,
|
||||
0, 0, 0, 0,
|
||||
&nousrreqs
|
||||
{
|
||||
.pr_type = SOCK_RAW,
|
||||
.pr_domain = &inetdomain,
|
||||
.pr_protocol = IPPROTO_ESP,
|
||||
.pr_flags = PR_ATOMIC|PR_ADDR,
|
||||
.pr_input = esp4_input,
|
||||
.pr_ctlinput = esp4_ctlinput,
|
||||
.pr_usrreqs = &nousrreqs
|
||||
},
|
||||
{ SOCK_RAW, &inetdomain, IPPROTO_IPCOMP, PR_ATOMIC|PR_ADDR,
|
||||
ipcomp4_input, 0, 0, 0,
|
||||
0,
|
||||
0, 0, 0, 0,
|
||||
&nousrreqs
|
||||
{
|
||||
.pr_type = SOCK_RAW,
|
||||
.pr_domain = &inetdomain,
|
||||
.pr_protocol = IPPROTO_IPCOMP,
|
||||
.pr_flags = PR_ATOMIC|PR_ADDR,
|
||||
.pr_input = ipcomp4_input,
|
||||
.pr_usrreqs = &nousrreqs
|
||||
},
|
||||
#endif /* FAST_IPSEC */
|
||||
{ SOCK_RAW, &inetdomain, IPPROTO_IPV4, PR_ATOMIC|PR_ADDR|PR_LASTHDR,
|
||||
encap4_input, 0, 0, rip_ctloutput,
|
||||
0,
|
||||
encap_init, 0, 0, 0,
|
||||
&rip_usrreqs
|
||||
{
|
||||
.pr_type = SOCK_RAW,
|
||||
.pr_domain = &inetdomain,
|
||||
.pr_protocol = IPPROTO_IPV4,
|
||||
.pr_flags = PR_ATOMIC|PR_ADDR|PR_LASTHDR,
|
||||
.pr_input = encap4_input,
|
||||
.pr_ctloutput = rip_ctloutput,
|
||||
.pr_init = encap_init,
|
||||
.pr_usrreqs = &rip_usrreqs
|
||||
},
|
||||
{ SOCK_RAW, &inetdomain, IPPROTO_MOBILE, PR_ATOMIC|PR_ADDR|PR_LASTHDR,
|
||||
encap4_input, 0, 0, rip_ctloutput,
|
||||
0,
|
||||
encap_init, 0, 0, 0,
|
||||
&rip_usrreqs
|
||||
{
|
||||
.pr_type = SOCK_RAW,
|
||||
.pr_domain = &inetdomain,
|
||||
.pr_protocol = IPPROTO_MOBILE,
|
||||
.pr_flags = PR_ATOMIC|PR_ADDR|PR_LASTHDR,
|
||||
.pr_input = encap4_input,
|
||||
.pr_ctloutput = rip_ctloutput,
|
||||
.pr_init = encap_init,
|
||||
.pr_usrreqs = &rip_usrreqs
|
||||
},
|
||||
{ SOCK_RAW, &inetdomain, IPPROTO_GRE, PR_ATOMIC|PR_ADDR|PR_LASTHDR,
|
||||
encap4_input, 0, 0, rip_ctloutput,
|
||||
0,
|
||||
encap_init, 0, 0, 0,
|
||||
&rip_usrreqs
|
||||
{
|
||||
.pr_type = SOCK_RAW,
|
||||
.pr_domain = &inetdomain,
|
||||
.pr_protocol = IPPROTO_GRE,
|
||||
.pr_flags = PR_ATOMIC|PR_ADDR|PR_LASTHDR,
|
||||
.pr_input = encap4_input,
|
||||
.pr_ctloutput = rip_ctloutput,
|
||||
.pr_init = encap_init,
|
||||
.pr_usrreqs = &rip_usrreqs
|
||||
},
|
||||
# ifdef INET6
|
||||
{ SOCK_RAW, &inetdomain, IPPROTO_IPV6, PR_ATOMIC|PR_ADDR|PR_LASTHDR,
|
||||
encap4_input, 0, 0, rip_ctloutput,
|
||||
0,
|
||||
encap_init, 0, 0, 0,
|
||||
&rip_usrreqs
|
||||
{
|
||||
.pr_type = SOCK_RAW,
|
||||
.pr_domain = &inetdomain,
|
||||
.pr_protocol = IPPROTO_IPV6,
|
||||
.pr_flags = PR_ATOMIC|PR_ADDR|PR_LASTHDR,
|
||||
.pr_input = encap4_input,
|
||||
.pr_ctloutput = rip_ctloutput,
|
||||
.pr_init = encap_init,
|
||||
.pr_usrreqs = &rip_usrreqs
|
||||
},
|
||||
#endif
|
||||
#ifdef IPXIP
|
||||
{ SOCK_RAW, &inetdomain, IPPROTO_IDP, PR_ATOMIC|PR_ADDR|PR_LASTHDR,
|
||||
ipxip_input, 0, ipxip_ctlinput, 0,
|
||||
0,
|
||||
0, 0, 0, 0,
|
||||
&rip_usrreqs
|
||||
{
|
||||
.pr_type = SOCK_RAW,
|
||||
.pr_domain = &inetdomain,
|
||||
.pr_protocol = IPPROTO_IDP,
|
||||
.pr_flags = PR_ATOMIC|PR_ADDR|PR_LASTHDR,
|
||||
.pr_input = ipxip_input,
|
||||
.pr_ctlinput = ipxip_ctlinput,
|
||||
.pr_usrreqs = &rip_usrreqs
|
||||
},
|
||||
#endif
|
||||
#ifdef PIM
|
||||
{ SOCK_RAW, &inetdomain, IPPROTO_PIM, PR_ATOMIC|PR_ADDR|PR_LASTHDR,
|
||||
pim_input, 0, 0, rip_ctloutput,
|
||||
0,
|
||||
0, 0, 0, 0,
|
||||
&rip_usrreqs
|
||||
{
|
||||
.pr_type = SOCK_RAW,
|
||||
.pr_domain = &inetdomain,
|
||||
.pr_protocol = IPPROTO_PIM,
|
||||
.pr_flags = PR_ATOMIC|PR_ADDR|PR_LASTHDR,
|
||||
.pr_input = pim_input,
|
||||
.pr_ctloutput = rip_ctloutput,
|
||||
.pr_usrreqs = &rip_usrreqs
|
||||
},
|
||||
#endif /* PIM */
|
||||
#ifdef DEV_PFSYNC
|
||||
{ SOCK_RAW, &inetdomain, IPPROTO_PFSYNC, PR_ATOMIC|PR_ADDR,
|
||||
pfsync_input, 0, 0, rip_ctloutput,
|
||||
0,
|
||||
0, 0, 0, 0,
|
||||
&rip_usrreqs
|
||||
{
|
||||
.pr_type = SOCK_RAW,
|
||||
.pr_domain = &inetdomain,
|
||||
.pr_protocol = IPPROTO_PFSYNC,
|
||||
.pr_flags = PR_ATOMIC|PR_ADDR,
|
||||
.pr_input = pfsync_input,
|
||||
.pr_ctloutput = rip_ctloutput,
|
||||
.pr_usrreqs = &rip_usrreqs
|
||||
},
|
||||
#endif /* DEV_PFSYNC */
|
||||
#ifdef DEV_CARP
|
||||
{ SOCK_RAW, &inetdomain, IPPROTO_CARP, PR_ATOMIC|PR_ADDR,
|
||||
carp_input, (pr_output_t*)rip_output, 0, rip_ctloutput,
|
||||
0,
|
||||
0, 0, 0, 0,
|
||||
&rip_usrreqs
|
||||
{
|
||||
.pr_type = SOCK_RAW,
|
||||
.pr_domain = &inetdomain,
|
||||
.pr_protocol = IPPROTO_CARP,
|
||||
.pr_flags = PR_ATOMIC|PR_ADDR,
|
||||
.pr_input = carp_input,
|
||||
.pr_output = (pr_output_t*)rip_output,
|
||||
.pr_ctloutput = rip_ctloutput,
|
||||
.pr_usrreqs = &rip_usrreqs
|
||||
},
|
||||
#endif /* DEV_CARP */
|
||||
/* Spacer n-times for loadable protocols. */
|
||||
@ -262,22 +334,28 @@ IPPROTOSPACER,
|
||||
IPPROTOSPACER,
|
||||
IPPROTOSPACER,
|
||||
/* raw wildcard */
|
||||
{ SOCK_RAW, &inetdomain, 0, PR_ATOMIC|PR_ADDR,
|
||||
rip_input, 0, 0, rip_ctloutput,
|
||||
0,
|
||||
rip_init, 0, 0, 0,
|
||||
&rip_usrreqs
|
||||
{
|
||||
.pr_type = SOCK_RAW,
|
||||
.pr_domain = &inetdomain,
|
||||
.pr_flags = PR_ATOMIC|PR_ADDR,
|
||||
.pr_input = rip_input,
|
||||
.pr_ctloutput = rip_ctloutput,
|
||||
.pr_init = rip_init,
|
||||
.pr_usrreqs = &rip_usrreqs
|
||||
},
|
||||
};
|
||||
|
||||
extern int in_inithead(void **, int);
|
||||
|
||||
struct domain inetdomain =
|
||||
{ AF_INET, "internet", 0, 0, 0,
|
||||
inetsw,
|
||||
&inetsw[sizeof(inetsw)/sizeof(inetsw[0])], 0,
|
||||
in_inithead, 32, sizeof(struct sockaddr_in)
|
||||
};
|
||||
struct domain inetdomain = {
|
||||
.dom_family = AF_INET,
|
||||
.dom_name = "internet",
|
||||
.dom_protosw = inetsw,
|
||||
.dom_protoswNPROTOSW = &inetsw[sizeof(inetsw)/sizeof(inetsw[0])],
|
||||
.dom_rtattach = in_inithead,
|
||||
.dom_rtoffset = 32,
|
||||
.dom_maxrtkey = sizeof(struct sockaddr_in)
|
||||
};
|
||||
|
||||
DOMAIN_SET(inet);
|
||||
|
||||
|
@ -649,11 +649,14 @@ struct pr_usrreqs div_usrreqs = {
|
||||
};
|
||||
|
||||
struct protosw div_protosw = {
|
||||
SOCK_RAW, NULL, IPPROTO_DIVERT, PR_ATOMIC|PR_ADDR,
|
||||
div_input, NULL, div_ctlinput, ip_ctloutput,
|
||||
NULL,
|
||||
div_init, NULL, NULL, NULL,
|
||||
&div_usrreqs
|
||||
.pr_type = SOCK_RAW,
|
||||
.pr_protocol = IPPROTO_DIVERT,
|
||||
.pr_flags = PR_ATOMIC|PR_ADDR,
|
||||
.pr_input = div_input,
|
||||
.pr_ctlinput = div_ctlinput,
|
||||
.pr_ctloutput = ip_ctloutput,
|
||||
.pr_init = div_init,
|
||||
.pr_usrreqs = &div_usrreqs
|
||||
};
|
||||
|
||||
static int
|
||||
|
@ -920,11 +920,14 @@ mroute_encap_input(struct mbuf *m, int off)
|
||||
|
||||
extern struct domain inetdomain;
|
||||
static struct protosw mroute_encap_protosw =
|
||||
{ SOCK_RAW, &inetdomain, IPPROTO_IPV4, PR_ATOMIC|PR_ADDR,
|
||||
mroute_encap_input, 0, 0, rip_ctloutput,
|
||||
0,
|
||||
0, 0, 0, 0,
|
||||
&rip_usrreqs
|
||||
{
|
||||
.pr_type = SOCK_RAW,
|
||||
.pr_domain = &inetdomain,
|
||||
.pr_protocol = IPPROTO_IPV4,
|
||||
.pr_flags = PR_ATOMIC|PR_ADDR,
|
||||
.pr_input = mroute_encap_input,
|
||||
.pr_ctloutput = rip_ctloutput,
|
||||
.pr_usrreqs = &rip_usrreqs
|
||||
};
|
||||
|
||||
/*
|
||||
|
@ -151,129 +151,190 @@ static struct pr_usrreqs nousrreqs;
|
||||
#define PR_ABRTACPTDIS 0
|
||||
|
||||
struct ip6protosw inet6sw[] = {
|
||||
{ 0, &inet6domain, IPPROTO_IPV6, 0,
|
||||
0, 0, 0, 0,
|
||||
0,
|
||||
ip6_init, 0, frag6_slowtimo, frag6_drain,
|
||||
&nousrreqs,
|
||||
{
|
||||
.pr_type = 0,
|
||||
.pr_domain = &inet6domain,
|
||||
.pr_protocol = IPPROTO_IPV6,
|
||||
.pr_init = ip6_init,
|
||||
.pr_slowtimo = frag6_slowtimo,
|
||||
.pr_drain = frag6_drain,
|
||||
.pr_usrreqs = &nousrreqs,
|
||||
},
|
||||
{ SOCK_DGRAM, &inet6domain, IPPROTO_UDP, PR_ATOMIC|PR_ADDR,
|
||||
udp6_input, 0, udp6_ctlinput, ip6_ctloutput,
|
||||
0,
|
||||
0, 0, 0, 0,
|
||||
&udp6_usrreqs,
|
||||
{
|
||||
.pr_type = SOCK_DGRAM,
|
||||
.pr_domain = &inet6domain,
|
||||
.pr_protocol = IPPROTO_UDP,
|
||||
.pr_flags = PR_ATOMIC|PR_ADDR,
|
||||
.pr_input = udp6_input,
|
||||
.pr_ctlinput = udp6_ctlinput,
|
||||
.pr_ctloutput = ip6_ctloutput,
|
||||
.pr_usrreqs = &udp6_usrreqs,
|
||||
},
|
||||
{ SOCK_STREAM, &inet6domain, IPPROTO_TCP, PR_CONNREQUIRED|PR_WANTRCVD|PR_LISTEN,
|
||||
tcp6_input, 0, tcp6_ctlinput, tcp_ctloutput,
|
||||
0,
|
||||
#ifdef INET /* don't call initialization and timeout routines twice */
|
||||
0, 0, 0, tcp_drain,
|
||||
#else
|
||||
tcp_init, tcp_fasttimo, tcp_slowtimo, tcp_drain,
|
||||
{
|
||||
.pr_type = SOCK_STREAM,
|
||||
.pr_domain = &inet6domain,
|
||||
.pr_protocol = IPPROTO_TCP,
|
||||
.pr_flags = PR_CONNREQUIRED|PR_WANTRCVD|PR_LISTEN,
|
||||
.pr_input = tcp6_input,
|
||||
.pr_ctlinput = tcp6_ctlinput,
|
||||
.pr_ctloutput = tcp_ctloutput,
|
||||
#ifndef INET /* don't call initialization and timeout routines twice */
|
||||
.pr_init = tcp_init,
|
||||
.pr_fasttimo = tcp_fasttimo,
|
||||
.pr_slowtimo = tcp_slowtimo,
|
||||
#endif
|
||||
&tcp6_usrreqs,
|
||||
.pr_drain = tcp_drain,
|
||||
.pr_usrreqs = &tcp6_usrreqs,
|
||||
},
|
||||
{ SOCK_RAW, &inet6domain, IPPROTO_RAW, PR_ATOMIC|PR_ADDR,
|
||||
rip6_input, rip6_output, rip6_ctlinput, rip6_ctloutput,
|
||||
0,
|
||||
0, 0, 0, 0,
|
||||
&rip6_usrreqs
|
||||
{
|
||||
.pr_type = SOCK_RAW,
|
||||
.pr_domain = &inet6domain,
|
||||
.pr_protocol = IPPROTO_RAW,
|
||||
.pr_flags = PR_ATOMIC|PR_ADDR,
|
||||
.pr_input = rip6_input,
|
||||
.pr_output = rip6_output,
|
||||
.pr_ctlinput = rip6_ctlinput,
|
||||
.pr_ctloutput = rip6_ctloutput,
|
||||
.pr_usrreqs = &rip6_usrreqs
|
||||
},
|
||||
{ SOCK_RAW, &inet6domain, IPPROTO_ICMPV6, PR_ATOMIC|PR_ADDR|PR_LASTHDR,
|
||||
icmp6_input, rip6_output, rip6_ctlinput, rip6_ctloutput,
|
||||
0,
|
||||
icmp6_init, icmp6_fasttimo, 0, 0,
|
||||
&rip6_usrreqs
|
||||
{
|
||||
.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_init = icmp6_init,
|
||||
.pr_fasttimo = icmp6_fasttimo,
|
||||
.pr_usrreqs = &rip6_usrreqs
|
||||
},
|
||||
{ SOCK_RAW, &inet6domain, IPPROTO_DSTOPTS,PR_ATOMIC|PR_ADDR,
|
||||
dest6_input, 0, 0, 0,
|
||||
0,
|
||||
0, 0, 0, 0,
|
||||
&nousrreqs
|
||||
{
|
||||
.pr_type = SOCK_RAW,
|
||||
.pr_domain = &inet6domain,
|
||||
.pr_protocol = IPPROTO_DSTOPTS,
|
||||
.pr_flags = PR_ATOMIC|PR_ADDR,
|
||||
.pr_input = dest6_input,
|
||||
.pr_usrreqs = &nousrreqs
|
||||
},
|
||||
{ SOCK_RAW, &inet6domain, IPPROTO_ROUTING,PR_ATOMIC|PR_ADDR,
|
||||
route6_input, 0, 0, 0,
|
||||
0,
|
||||
0, 0, 0, 0,
|
||||
&nousrreqs
|
||||
{
|
||||
.pr_type = SOCK_RAW,
|
||||
.pr_domain = &inet6domain,
|
||||
.pr_protocol = IPPROTO_ROUTING,
|
||||
.pr_flags = PR_ATOMIC|PR_ADDR,
|
||||
.pr_input = route6_input,
|
||||
.pr_usrreqs = &nousrreqs
|
||||
},
|
||||
{ SOCK_RAW, &inet6domain, IPPROTO_FRAGMENT,PR_ATOMIC|PR_ADDR,
|
||||
frag6_input, 0, 0, 0,
|
||||
0,
|
||||
0, 0, 0, 0,
|
||||
&nousrreqs
|
||||
{
|
||||
.pr_type = SOCK_RAW,
|
||||
.pr_domain = &inet6domain,
|
||||
.pr_protocol = IPPROTO_FRAGMENT,
|
||||
.pr_flags = PR_ATOMIC|PR_ADDR,
|
||||
.pr_input = frag6_input,
|
||||
.pr_usrreqs = &nousrreqs
|
||||
},
|
||||
#ifdef IPSEC
|
||||
{ SOCK_RAW, &inet6domain, IPPROTO_AH, PR_ATOMIC|PR_ADDR,
|
||||
ah6_input, 0, 0, 0,
|
||||
0,
|
||||
0, 0, 0, 0,
|
||||
&nousrreqs,
|
||||
{
|
||||
.pr_type = SOCK_RAW,
|
||||
.pr_domain = &inet6domain,
|
||||
.pr_protocol = IPPROTO_AH,
|
||||
.pr_flags = PR_ATOMIC|PR_ADDR,
|
||||
.pr_input = ah6_input,
|
||||
.pr_usrreqs = &nousrreqs,
|
||||
},
|
||||
#ifdef IPSEC_ESP
|
||||
{ SOCK_RAW, &inet6domain, IPPROTO_ESP, PR_ATOMIC|PR_ADDR,
|
||||
esp6_input, 0,
|
||||
esp6_ctlinput,
|
||||
0,
|
||||
0,
|
||||
0, 0, 0, 0,
|
||||
&nousrreqs,
|
||||
{
|
||||
.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,
|
||||
.pr_usrreqs = &nousrreqs,
|
||||
},
|
||||
#endif
|
||||
{ SOCK_RAW, &inet6domain, IPPROTO_IPCOMP, PR_ATOMIC|PR_ADDR,
|
||||
ipcomp6_input, 0, 0, 0,
|
||||
0,
|
||||
0, 0, 0, 0,
|
||||
&nousrreqs,
|
||||
{
|
||||
.pr_type = SOCK_RAW,
|
||||
.pr_domain = &inet6domain,
|
||||
.pr_protocol = IPPROTO_IPCOMP,
|
||||
.pr_flags = PR_ATOMIC|PR_ADDR,
|
||||
.pr_input = ipcomp6_input,
|
||||
.pr_usrreqs = &nousrreqs,
|
||||
},
|
||||
#endif /* IPSEC */
|
||||
#ifdef INET
|
||||
{ SOCK_RAW, &inet6domain, IPPROTO_IPV4, PR_ATOMIC|PR_ADDR|PR_LASTHDR,
|
||||
encap6_input, rip6_output, 0, rip6_ctloutput,
|
||||
0,
|
||||
encap_init, 0, 0, 0,
|
||||
&rip6_usrreqs
|
||||
{
|
||||
.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_ctloutput = rip6_ctloutput,
|
||||
.pr_init = encap_init,
|
||||
.pr_usrreqs = &rip6_usrreqs
|
||||
},
|
||||
#endif /* INET */
|
||||
{ SOCK_RAW, &inet6domain, IPPROTO_IPV6, PR_ATOMIC|PR_ADDR|PR_LASTHDR,
|
||||
encap6_input, rip6_output, 0, rip6_ctloutput,
|
||||
0,
|
||||
encap_init, 0, 0, 0,
|
||||
&rip6_usrreqs
|
||||
{
|
||||
.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_ctloutput = rip6_ctloutput,
|
||||
.pr_init = encap_init,
|
||||
.pr_usrreqs = &rip6_usrreqs
|
||||
},
|
||||
{ SOCK_RAW, &inet6domain, IPPROTO_PIM, PR_ATOMIC|PR_ADDR|PR_LASTHDR,
|
||||
pim6_input, rip6_output, 0, rip6_ctloutput,
|
||||
0,
|
||||
0, 0, 0, 0,
|
||||
&rip6_usrreqs
|
||||
{
|
||||
.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_usrreqs = &rip6_usrreqs
|
||||
},
|
||||
#ifdef DEV_CARP
|
||||
{ SOCK_RAW, &inet6domain, IPPROTO_CARP, PR_ATOMIC|PR_ADDR,
|
||||
carp6_input, rip6_output, 0, rip6_ctloutput,
|
||||
0,
|
||||
0, 0, 0, 0,
|
||||
&rip6_usrreqs
|
||||
{
|
||||
.pr_type = SOCK_RAW,
|
||||
.pr_domain = &inet6domain,
|
||||
.pr_protocol = IPPROTO_CARP,
|
||||
.pr_flags = PR_ATOMIC|PR_ADDR,
|
||||
.pr_input = carp6_input,
|
||||
.pr_output = rip6_output,
|
||||
.pr_ctloutput = rip6_ctloutput,
|
||||
.pr_usrreqs = &rip6_usrreqs
|
||||
},
|
||||
#endif /* DEV_CARP */
|
||||
/* raw wildcard */
|
||||
{ SOCK_RAW, &inet6domain, 0, PR_ATOMIC|PR_ADDR,
|
||||
rip6_input, rip6_output, 0, rip6_ctloutput,
|
||||
0,
|
||||
0, 0, 0, 0,
|
||||
&rip6_usrreqs
|
||||
{
|
||||
.pr_type = SOCK_RAW,
|
||||
.pr_domain = &inet6domain,
|
||||
.pr_flags = PR_ATOMIC|PR_ADDR,
|
||||
.pr_input = rip6_input,
|
||||
.pr_output = rip6_output,
|
||||
.pr_ctloutput = rip6_ctloutput,
|
||||
.pr_usrreqs = &rip6_usrreqs
|
||||
},
|
||||
};
|
||||
|
||||
extern int in6_inithead __P((void **, int));
|
||||
|
||||
struct domain inet6domain =
|
||||
{ AF_INET6, "internet6", 0, 0, 0,
|
||||
(struct protosw *)inet6sw,
|
||||
(struct protosw *)&inet6sw[sizeof(inet6sw)/sizeof(inet6sw[0])], 0,
|
||||
in6_inithead,
|
||||
offsetof(struct sockaddr_in6, sin6_addr) << 3,
|
||||
sizeof(struct sockaddr_in6),
|
||||
in6_domifattach, in6_domifdetach, };
|
||||
struct domain inet6domain = {
|
||||
.dom_family = AF_INET6,
|
||||
.dom_name = "internet6",
|
||||
.dom_protosw = (struct protosw *)inet6sw,
|
||||
.dom_protoswNPROTOSW = (struct protosw *)
|
||||
&inet6sw[sizeof(inet6sw)/sizeof(inet6sw[0])],
|
||||
.dom_rtattach = in6_inithead,
|
||||
.dom_rtoffset = offsetof(struct sockaddr_in6, sin6_addr) << 3,
|
||||
.dom_maxrtkey = sizeof(struct sockaddr_in6),
|
||||
.dom_ifattach = in6_domifattach,
|
||||
.dom_ifdetach = in6_domifdetach
|
||||
};
|
||||
|
||||
DOMAIN_SET(inet6);
|
||||
|
||||
|
@ -585,11 +585,15 @@ SYSCTL_NODE(_net, PF_KEY, key, CTLFLAG_RW, 0, "Key Family");
|
||||
extern struct domain keydomain;
|
||||
|
||||
struct protosw keysw[] = {
|
||||
{ SOCK_RAW, &keydomain, PF_KEY_V2, PR_ATOMIC|PR_ADDR,
|
||||
0, (pr_output_t *)key_output, raw_ctlinput, 0,
|
||||
0,
|
||||
raw_init, 0, 0, 0,
|
||||
&key_usrreqs
|
||||
{
|
||||
.pr_type = SOCK_RAW,
|
||||
.pr_domain = &keydomain,
|
||||
.pr_protocol = PF_KEY_V2,
|
||||
.pr_flags = PR_ATOMIC|PR_ADDR,
|
||||
.pr_output = (pr_output_t *)key_output,
|
||||
.pr_ctlinput = raw_ctlinput,
|
||||
.pr_init = raw_init,
|
||||
.pr_usrreqs = &key_usrreqs
|
||||
}
|
||||
};
|
||||
|
||||
@ -600,8 +604,12 @@ key_init0(void)
|
||||
key_init();
|
||||
}
|
||||
|
||||
struct domain keydomain =
|
||||
{ PF_KEY, "key", key_init0, 0, 0,
|
||||
keysw, &keysw[sizeof(keysw)/sizeof(keysw[0])] };
|
||||
struct domain keydomain = {
|
||||
.dom_family = PF_KEY,
|
||||
.dom_name = "key",
|
||||
.dom_init = key_init0,
|
||||
.dom_protosw = keysw,
|
||||
.dom_protoswNPROTOSW = &keysw[sizeof(keysw)/sizeof(keysw[0])]
|
||||
};
|
||||
|
||||
DOMAIN_SET(key);
|
||||
|
@ -62,42 +62,59 @@ static struct pr_usrreqs nousrreqs;
|
||||
static struct domain ipxdomain;
|
||||
|
||||
static struct protosw ipxsw[] = {
|
||||
{ 0, &ipxdomain, 0, 0,
|
||||
0, 0, 0, 0,
|
||||
0,
|
||||
ipx_init, 0, 0, 0,
|
||||
&nousrreqs
|
||||
{
|
||||
.pr_domain = &ipxdomain,
|
||||
.pr_init = ipx_init,
|
||||
.pr_usrreqs = &nousrreqs
|
||||
},
|
||||
{ SOCK_DGRAM, &ipxdomain, 0, PR_ATOMIC|PR_ADDR,
|
||||
0, 0, ipx_ctlinput, ipx_ctloutput,
|
||||
0,
|
||||
0, 0, 0, 0,
|
||||
&ipx_usrreqs
|
||||
{
|
||||
.pr_type = SOCK_DGRAM,
|
||||
.pr_domain = &ipxdomain,
|
||||
.pr_flags = PR_ATOMIC|PR_ADDR,
|
||||
.pr_ctlinput = ipx_ctlinput,
|
||||
.pr_ctloutput = ipx_ctloutput,
|
||||
.pr_usrreqs = &ipx_usrreqs
|
||||
},
|
||||
{ SOCK_STREAM, &ipxdomain, IPXPROTO_SPX, PR_CONNREQUIRED|PR_WANTRCVD,
|
||||
0, 0, spx_ctlinput, spx_ctloutput,
|
||||
0,
|
||||
spx_init, spx_fasttimo, spx_slowtimo, 0,
|
||||
&spx_usrreqs
|
||||
{
|
||||
.pr_type = SOCK_STREAM,
|
||||
.pr_domain = &ipxdomain,
|
||||
.pr_protocol = IPXPROTO_SPX,
|
||||
.pr_flags = PR_CONNREQUIRED|PR_WANTRCVD,
|
||||
.pr_ctlinput = spx_ctlinput,
|
||||
.pr_ctloutput = spx_ctloutput,
|
||||
.pr_init = spx_init,
|
||||
.pr_fasttimo = spx_fasttimo,
|
||||
.pr_slowtimo = spx_slowtimo,
|
||||
.pr_usrreqs = &spx_usrreqs
|
||||
},
|
||||
{ SOCK_SEQPACKET,&ipxdomain, IPXPROTO_SPX, PR_CONNREQUIRED|PR_WANTRCVD|PR_ATOMIC,
|
||||
0, 0, spx_ctlinput, spx_ctloutput,
|
||||
0,
|
||||
0, 0, 0, 0,
|
||||
&spx_usrreq_sps
|
||||
{
|
||||
.pr_type = SOCK_SEQPACKET,
|
||||
.pr_domain = &ipxdomain,
|
||||
.pr_protocol = IPXPROTO_SPX,
|
||||
.pr_flags = PR_CONNREQUIRED|PR_WANTRCVD|PR_ATOMIC,
|
||||
.pr_ctlinput = spx_ctlinput,
|
||||
.pr_ctloutput = spx_ctloutput,
|
||||
.pr_usrreqs = &spx_usrreq_sps
|
||||
},
|
||||
{ SOCK_RAW, &ipxdomain, IPXPROTO_RAW, PR_ATOMIC|PR_ADDR,
|
||||
0, 0, 0, ipx_ctloutput,
|
||||
0,
|
||||
0, 0, 0, 0,
|
||||
&ripx_usrreqs
|
||||
{
|
||||
.pr_type = SOCK_RAW,
|
||||
.pr_domain = &ipxdomain,
|
||||
.pr_protocol = IPXPROTO_RAW,
|
||||
.pr_flags = PR_ATOMIC|PR_ADDR,
|
||||
.pr_ctloutput = ipx_ctloutput,
|
||||
.pr_usrreqs = &ripx_usrreqs
|
||||
},
|
||||
};
|
||||
|
||||
static struct domain ipxdomain =
|
||||
{ AF_IPX, "network systems", 0, 0, 0,
|
||||
ipxsw, &ipxsw[sizeof(ipxsw)/sizeof(ipxsw[0])], 0,
|
||||
rn_inithead, 16, sizeof(struct sockaddr_ipx)};
|
||||
static struct domain ipxdomain = {
|
||||
.dom_family = AF_IPX,
|
||||
.dom_name = "network systems",
|
||||
.dom_protosw = ipxsw,
|
||||
.dom_protoswNPROTOSW = &ipxsw[sizeof(ipxsw)/sizeof(ipxsw[0])],
|
||||
.dom_rtattach = rn_inithead,
|
||||
.dom_rtoffset = 16,
|
||||
.dom_maxrtkey = sizeof(struct sockaddr_ipx)
|
||||
};
|
||||
|
||||
DOMAIN_SET(ipx);
|
||||
SYSCTL_NODE(_net, PF_IPX, ipx, CTLFLAG_RW, 0,
|
||||
|
@ -495,16 +495,24 @@ SYSCTL_NODE(_net, PF_KEY, key, CTLFLAG_RW, 0, "Key Family");
|
||||
extern struct domain keydomain;
|
||||
|
||||
struct protosw keysw[] = {
|
||||
{ SOCK_RAW, &keydomain, PF_KEY_V2, PR_ATOMIC|PR_ADDR,
|
||||
0, (pr_output_t *)key_output, raw_ctlinput, 0,
|
||||
0,
|
||||
raw_init, 0, 0, 0,
|
||||
&key_usrreqs
|
||||
{
|
||||
.pr_type = SOCK_RAW,
|
||||
.pr_domain = &keydomain,
|
||||
.pr_protocol = PF_KEY_V2,
|
||||
.pr_flags = PR_ATOMIC|PR_ADDR,
|
||||
.pr_output = (pr_output_t *)key_output,
|
||||
.pr_ctlinput = raw_ctlinput,
|
||||
.pr_init = raw_init,
|
||||
.pr_usrreqs = &key_usrreqs
|
||||
}
|
||||
};
|
||||
|
||||
struct domain keydomain =
|
||||
{ PF_KEY, "key", key_init, 0, 0,
|
||||
keysw, &keysw[sizeof(keysw)/sizeof(keysw[0])] };
|
||||
struct domain keydomain = {
|
||||
.dom_family = PF_KEY,
|
||||
.dom_name = "key",
|
||||
.dom_init = key_init,
|
||||
.dom_protosw = keysw,
|
||||
.dom_protoswNPROTOSW = &keysw[sizeof(keysw)/sizeof(keysw[0])]
|
||||
};
|
||||
|
||||
DOMAIN_SET(key);
|
||||
|
@ -57,30 +57,36 @@ static void natm_init(void);
|
||||
static struct domain natmdomain;
|
||||
|
||||
static struct protosw natmsw[] = {
|
||||
{ SOCK_STREAM, &natmdomain, PROTO_NATMAAL5, PR_CONNREQUIRED,
|
||||
0, 0, 0, 0,
|
||||
0,
|
||||
0, 0, 0, 0,
|
||||
&natm_usrreqs
|
||||
{
|
||||
.pr_type = SOCK_STREAM,
|
||||
.pr_domain = &natmdomain,
|
||||
.pr_protocol = PROTO_NATMAAL5,
|
||||
.pr_flags = PR_CONNREQUIRED,
|
||||
.pr_usrreqs = &natm_usrreqs
|
||||
},
|
||||
{ SOCK_DGRAM, &natmdomain, PROTO_NATMAAL5, PR_CONNREQUIRED | PR_ATOMIC,
|
||||
0, 0, 0, 0,
|
||||
0,
|
||||
0, 0, 0, 0,
|
||||
&natm_usrreqs
|
||||
{
|
||||
.pr_type = SOCK_DGRAM,
|
||||
.pr_domain = &natmdomain,
|
||||
.pr_protocol = PROTO_NATMAAL5,
|
||||
.pr_flags = PR_CONNREQUIRED|PR_ATOMIC,
|
||||
.pr_usrreqs = &natm_usrreqs
|
||||
},
|
||||
{ SOCK_STREAM, &natmdomain, PROTO_NATMAAL0, PR_CONNREQUIRED,
|
||||
0, 0, 0, 0,
|
||||
0,
|
||||
0, 0, 0, 0,
|
||||
&natm_usrreqs
|
||||
{
|
||||
.pr_type = SOCK_STREAM,
|
||||
.pr_domain = &natmdomain,
|
||||
.pr_protocol = PROTO_NATMAAL0,
|
||||
.pr_flags = PR_CONNREQUIRED,
|
||||
.pr_usrreqs = &natm_usrreqs
|
||||
},
|
||||
};
|
||||
|
||||
static struct domain natmdomain =
|
||||
{ AF_NATM, "natm", natm_init, 0, 0,
|
||||
natmsw, &natmsw[sizeof(natmsw)/sizeof(natmsw[0])], 0,
|
||||
0, 0, 0};
|
||||
static struct domain natmdomain = {
|
||||
.dom_family = AF_NATM,
|
||||
.dom_name = "natm",
|
||||
.dom_init = natm_init,
|
||||
.dom_protosw = natmsw,
|
||||
.dom_protoswNPROTOSW = &natmsw[sizeof(natmsw)/sizeof(natmsw[0])],
|
||||
};
|
||||
|
||||
static int natmqmaxlen = 1000 /* IFQ_MAXLEN */; /* max # of packets on queue */
|
||||
static struct ifqueue natmintrq;
|
||||
|
Loading…
Reference in New Issue
Block a user