]> git.saurik.com Git - apple/xnu.git/blobdiff - bsd/netinet/in_proto.c
xnu-4570.51.1.tar.gz
[apple/xnu.git] / bsd / netinet / in_proto.c
index 6e3507bec03aa2b10f5d2ca60fb6d8a9cd54a8f8..4a9d198192cacb8b178dc064cf5fa766c2b5fd1a 100644 (file)
@@ -73,6 +73,7 @@
 
 #include <net/if.h>
 #include <net/route.h>
+#include <net/kpi_protocol.h>
 
 #include <netinet/in.h>
 #include <netinet/in_var.h>
@@ -129,7 +130,7 @@ static struct protosw inetsw[] = {
        .pr_type =              SOCK_DGRAM,
        .pr_protocol =          IPPROTO_UDP,
        .pr_flags =             PR_ATOMIC|PR_ADDR|PR_PROTOLOCK|PR_PCBLOCK|
-                               PR_EVCONNINFO,
+                               PR_EVCONNINFO|PR_PRECONN_WRITE,
        .pr_input =             udp_input,
        .pr_ctlinput =          udp_ctlinput,
        .pr_ctloutput =         udp_ctloutput,
@@ -143,7 +144,8 @@ static struct protosw inetsw[] = {
        .pr_type =              SOCK_STREAM,
        .pr_protocol =          IPPROTO_TCP,
        .pr_flags =             PR_CONNREQUIRED|PR_WANTRCVD|PR_PCBLOCK|
-                               PR_PROTOLOCK|PR_DISPOSE|PR_EVCONNINFO,
+                               PR_PROTOLOCK|PR_DISPOSE|PR_EVCONNINFO|
+                               PR_PRECONN_WRITE|PR_DATA_IDEMPOTENT,
        .pr_input =             tcp_input,
        .pr_ctlinput =          tcp_ctlinput,
        .pr_ctloutput =         tcp_ctloutput,
@@ -192,17 +194,6 @@ static struct protosw inetsw[] = {
        .pr_usrreqs =           &rip_usrreqs,
        .pr_unlock =            rip_unlock,
 },
-#if MROUTING
-{
-       .pr_type =              SOCK_RAW,
-       .pr_protocol =          IPPROTO_RSVP,
-       .pr_flags =             PR_ATOMIC|PR_ADDR|PR_LASTHDR,
-       .pr_input =             rsvp_input,
-       .pr_ctloutput =         rip_ctloutput,
-       .pr_usrreqs =           &rip_usrreqs,
-       .pr_unlock =            rip_unlock,
-},
-#endif /* MROUTING */
 {
        .pr_type =              SOCK_RAW,
        .pr_protocol =          IPPROTO_GRE,
@@ -312,6 +303,13 @@ in_dinit(struct domain *dp)
 
        inetdomain = dp;
 
+       /*
+        * Verify that the maximum possible tcp/ip header will still
+        * fit in a small mbuf because m_pullup only puls into 256
+        * byte mbuf
+        */
+       _CASSERT((sizeof(struct tcpiphdr) + TCP_MAXOLEN) <= _MHLEN);
+
        /*
         * Attach first, then initialize; ip_init() needs raw IP handler.
         */
@@ -336,15 +334,15 @@ static void
 ip_proto_input(protocol_family_t protocol, mbuf_t packet_list)
 {
 #pragma unused(protocol)
-       mbuf_t  packet;
-       int how_many = 0 ;
 
-       /* ip_input should handle a list of packets but does not yet */
-       for (packet = packet_list; packet; packet = packet_list) {
-               how_many++;
-               packet_list = mbuf_nextpkt(packet);
-               mbuf_setnextpkt(packet, NULL);
-               ip_input(packet);
+       if (packet_list->m_nextpkt != NULL) {
+               ip_input_process_list(packet_list);
+       } else {
+               /*
+                * XXX remove this path if ip_input_process_list is proven
+                * to be stable and has minimum overhead on most platforms.
+                */
+               ip_input(packet_list);
        }
 }