Changeset View
Changeset View
Standalone View
Standalone View
sys/netinet/in_proto.c
Show First 20 Lines • Show All 80 Lines • ▼ Show 20 Lines | |||||
#include <netinet/udp.h> | #include <netinet/udp.h> | ||||
#include <netinet/udp_var.h> | #include <netinet/udp_var.h> | ||||
#include <netinet/ip_encap.h> | #include <netinet/ip_encap.h> | ||||
/* | /* | ||||
* TCP/IP protocol family: IP, ICMP, UDP, TCP. | * TCP/IP protocol family: IP, ICMP, UDP, TCP. | ||||
*/ | */ | ||||
static struct pr_usrreqs nousrreqs; | |||||
#ifdef SCTP | #ifdef SCTP | ||||
#include <netinet/in_pcb.h> | #include <netinet/in_pcb.h> | ||||
#include <netinet/sctp_pcb.h> | #include <netinet/sctp_pcb.h> | ||||
#include <netinet/sctp.h> | #include <netinet/sctp.h> | ||||
#include <netinet/sctp_var.h> | #include <netinet/sctp_var.h> | ||||
#endif | #endif | ||||
/* netinet/raw_ip.c */ | |||||
extern struct protosw rip_protosw, rsvp_protosw, rawipv4_protosw, | |||||
rawipv6_protosw, mobile_protosw, etherip_protosw, icmp_protosw, | |||||
igmp_protosw, gre_protosw, pim_protosw, ripwild_protosw; | |||||
/* netinet/udp_usrreq.c */ | |||||
extern struct protosw udp_protosw, udplite_protosw; | |||||
FEATURE(inet, "Internet Protocol version 4"); | FEATURE(inet, "Internet Protocol version 4"); | ||||
extern struct domain inetdomain; | |||||
/* Spacer for loadable protocols. */ | |||||
#define IPPROTOSPACER \ | |||||
{ \ | |||||
.pr_domain = &inetdomain, \ | |||||
.pr_protocol = PROTO_SPACER, \ | |||||
.pr_usrreqs = &nousrreqs \ | |||||
} | |||||
struct protosw inetsw[] = { | |||||
{ | |||||
.pr_type = SOCK_DGRAM, | |||||
.pr_domain = &inetdomain, | |||||
.pr_protocol = IPPROTO_UDP, | |||||
.pr_flags = PR_ATOMIC|PR_ADDR|PR_CAPATTACH, | |||||
.pr_ctloutput = udp_ctloutput, | |||||
.pr_usrreqs = &udp_usrreqs | |||||
}, | |||||
{ | |||||
.pr_type = SOCK_STREAM, | |||||
.pr_domain = &inetdomain, | |||||
.pr_protocol = IPPROTO_TCP, | |||||
.pr_flags = PR_CONNREQUIRED|PR_IMPLOPCL|PR_WANTRCVD| | |||||
PR_CAPATTACH, | |||||
.pr_ctloutput = tcp_ctloutput, | |||||
.pr_usrreqs = &tcp_usrreqs | |||||
}, | |||||
#ifdef SCTP | |||||
{ | |||||
.pr_type = SOCK_SEQPACKET, | |||||
.pr_domain = &inetdomain, | |||||
.pr_protocol = IPPROTO_SCTP, | |||||
.pr_flags = PR_WANTRCVD, | |||||
.pr_ctloutput = sctp_ctloutput, | |||||
.pr_usrreqs = &sctp_usrreqs | |||||
}, | |||||
{ | |||||
.pr_type = SOCK_STREAM, | |||||
.pr_domain = &inetdomain, | |||||
.pr_protocol = IPPROTO_SCTP, | |||||
.pr_flags = PR_CONNREQUIRED|PR_WANTRCVD, | |||||
.pr_ctloutput = sctp_ctloutput, | |||||
.pr_usrreqs = &sctp_usrreqs | |||||
}, | |||||
#endif /* SCTP */ | |||||
{ | |||||
.pr_type = SOCK_DGRAM, | |||||
.pr_domain = &inetdomain, | |||||
.pr_protocol = IPPROTO_UDPLITE, | |||||
.pr_flags = PR_ATOMIC|PR_ADDR|PR_CAPATTACH, | |||||
.pr_ctloutput = udp_ctloutput, | |||||
.pr_usrreqs = &udp_usrreqs | |||||
}, | |||||
{ | |||||
.pr_type = SOCK_RAW, | |||||
.pr_domain = &inetdomain, | |||||
.pr_protocol = IPPROTO_RAW, | |||||
.pr_flags = PR_ATOMIC|PR_ADDR, | |||||
.pr_ctloutput = rip_ctloutput, | |||||
.pr_usrreqs = &rip_usrreqs | |||||
}, | |||||
{ | |||||
.pr_type = SOCK_RAW, | |||||
.pr_domain = &inetdomain, | |||||
.pr_protocol = IPPROTO_ICMP, | |||||
.pr_flags = PR_ATOMIC|PR_ADDR, | |||||
.pr_ctloutput = rip_ctloutput, | |||||
.pr_usrreqs = &rip_usrreqs | |||||
}, | |||||
{ | |||||
.pr_type = SOCK_RAW, | |||||
.pr_domain = &inetdomain, | |||||
.pr_protocol = IPPROTO_IGMP, | |||||
.pr_flags = PR_ATOMIC|PR_ADDR, | |||||
.pr_ctloutput = rip_ctloutput, | |||||
.pr_usrreqs = &rip_usrreqs | |||||
}, | |||||
{ | |||||
.pr_type = SOCK_RAW, | |||||
.pr_domain = &inetdomain, | |||||
.pr_protocol = IPPROTO_RSVP, | |||||
.pr_flags = PR_ATOMIC|PR_ADDR, | |||||
.pr_ctloutput = rip_ctloutput, | |||||
.pr_usrreqs = &rip_usrreqs | |||||
}, | |||||
{ | |||||
.pr_type = SOCK_RAW, | |||||
.pr_domain = &inetdomain, | |||||
.pr_protocol = IPPROTO_IPV4, | |||||
.pr_flags = PR_ATOMIC|PR_ADDR, | |||||
.pr_ctloutput = rip_ctloutput, | |||||
.pr_usrreqs = &rip_usrreqs | |||||
}, | |||||
{ | |||||
.pr_type = SOCK_RAW, | |||||
.pr_domain = &inetdomain, | |||||
.pr_protocol = IPPROTO_MOBILE, | |||||
.pr_flags = PR_ATOMIC|PR_ADDR, | |||||
.pr_ctloutput = rip_ctloutput, | |||||
.pr_usrreqs = &rip_usrreqs | |||||
}, | |||||
{ | |||||
.pr_type = SOCK_RAW, | |||||
.pr_domain = &inetdomain, | |||||
.pr_protocol = IPPROTO_ETHERIP, | |||||
.pr_flags = PR_ATOMIC|PR_ADDR, | |||||
.pr_ctloutput = rip_ctloutput, | |||||
.pr_usrreqs = &rip_usrreqs | |||||
}, | |||||
{ | |||||
.pr_type = SOCK_RAW, | |||||
.pr_domain = &inetdomain, | |||||
.pr_protocol = IPPROTO_GRE, | |||||
.pr_flags = PR_ATOMIC|PR_ADDR, | |||||
.pr_ctloutput = rip_ctloutput, | |||||
.pr_usrreqs = &rip_usrreqs | |||||
}, | |||||
# ifdef INET6 | |||||
{ | |||||
.pr_type = SOCK_RAW, | |||||
.pr_domain = &inetdomain, | |||||
.pr_protocol = IPPROTO_IPV6, | |||||
.pr_flags = PR_ATOMIC|PR_ADDR, | |||||
.pr_ctloutput = rip_ctloutput, | |||||
.pr_usrreqs = &rip_usrreqs | |||||
}, | |||||
#endif | |||||
{ | |||||
.pr_type = SOCK_RAW, | |||||
.pr_domain = &inetdomain, | |||||
.pr_protocol = IPPROTO_PIM, | |||||
.pr_flags = PR_ATOMIC|PR_ADDR, | |||||
.pr_ctloutput = rip_ctloutput, | |||||
.pr_usrreqs = &rip_usrreqs | |||||
}, | |||||
/* Spacer n-times for loadable protocols. */ | |||||
IPPROTOSPACER, | |||||
IPPROTOSPACER, | |||||
IPPROTOSPACER, | |||||
IPPROTOSPACER, | |||||
IPPROTOSPACER, | |||||
IPPROTOSPACER, | |||||
IPPROTOSPACER, | |||||
IPPROTOSPACER, | |||||
/* raw wildcard */ | |||||
{ | |||||
.pr_type = SOCK_RAW, | |||||
.pr_domain = &inetdomain, | |||||
.pr_flags = PR_ATOMIC|PR_ADDR, | |||||
.pr_usrreqs = &rip_usrreqs | |||||
}, | |||||
}; | |||||
struct domain inetdomain = { | struct domain inetdomain = { | ||||
.dom_family = AF_INET, | .dom_family = AF_INET, | ||||
.dom_name = "internet", | .dom_name = "internet", | ||||
.dom_protosw = inetsw, | |||||
.dom_protoswNPROTOSW = &inetsw[nitems(inetsw)], | |||||
.dom_rtattach = in_inithead, | .dom_rtattach = in_inithead, | ||||
#ifdef VIMAGE | #ifdef VIMAGE | ||||
.dom_rtdetach = in_detachhead, | .dom_rtdetach = in_detachhead, | ||||
#endif | #endif | ||||
.dom_ifattach = in_domifattach, | .dom_ifattach = in_domifattach, | ||||
.dom_ifdetach = in_domifdetach | .dom_ifdetach = in_domifdetach, | ||||
.dom_nprotosw = 24, | |||||
.dom_protosw = { | |||||
&tcp_protosw, | |||||
&udp_protosw, | |||||
#ifdef SCTP | |||||
&sctp_seqpacket_protosw, | |||||
&sctp_stream_protosw, | |||||
#endif | |||||
&udplite_protosw, | |||||
&rip_protosw, | |||||
/* | |||||
* XXXGL: it is entirely possible that all below raw-based | |||||
* protosw definitions are not needed. They could have existed | |||||
* just to define pr_input, pr_drain, pr_*timo or PR_LASTHDR | |||||
* flag, and were never supposed to create a special socket. | |||||
*/ | |||||
&icmp_protosw, | |||||
&igmp_protosw, | |||||
&rsvp_protosw, | |||||
&rawipv4_protosw, | |||||
&mobile_protosw, | |||||
ðerip_protosw, | |||||
&gre_protosw, | |||||
#ifdef INET6 | |||||
&rawipv6_protosw, | |||||
#endif | |||||
&pim_protosw, | |||||
/* Spacer 8 times for loadable protocols. XXXGL: why 8? */ | |||||
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, | |||||
&ripwild_protosw, | |||||
}, | |||||
}; | }; | ||||
DOMAIN_SET(inet); | DOMAIN_SET(inet); | ||||
#endif /* INET */ | #endif /* INET */ | ||||
SYSCTL_NODE(_net, PF_INET, inet, CTLFLAG_RW | CTLFLAG_MPSAFE, 0, | SYSCTL_NODE(_net, PF_INET, inet, CTLFLAG_RW | CTLFLAG_MPSAFE, 0, | ||||
"Internet Family"); | "Internet Family"); | ||||
Show All 31 Lines |