Commit in reactos/drivers on MAIN
lib/ip/network/loopback.c+41.6 -> 1.7
              /neighbor.c+10-61.7 -> 1.8
              /receive.c+1-11.4 -> 1.5
lib/ip/transport/tcp/tcp.c+27-121.14 -> 1.15
lib/oskittcp/oskittcp/in_pcb.c+21.3 -> 1.4
                     /interface.c+7-11.19 -> 1.20
net/tcpip/tcpip/buffer.c+11.2 -> 1.3
+52-20
7 modified files
- Fix receiving of loopback packets.
- Fix recursive spinlock acquire in NBQueuePacket.
- Don't pend connect requests if they're satisfied during the call.
- Basic implementation of listen.

reactos/drivers/lib/ip/network
loopback.c 1.6 -> 1.7
diff -u -r1.6 -r1.7
--- loopback.c	25 Nov 2004 23:56:58 -0000	1.6
+++ loopback.c	12 Dec 2004 11:48:03 -0000	1.7
@@ -39,11 +39,15 @@
   IPPacket.NdisPacket = NdisPacket;
   IPPacket.HeaderSize = 0;
   GetDataPtr( NdisPacket, 0, (PCHAR *)&IPPacket.Header, &IPPacket.TotalSize );
+  IPPacket.Header += Offset;
+  IPPacket.ContigSize = IPPacket.TotalSize;
+  IPPacket.Position = Offset;
 
   TI_DbgPrint(MAX_TRACE, 
 	      ("Doing receive (complete: %x, context %x, packet %x)\n",
 	       PC(NdisPacket)->DLComplete, Context, NdisPacket));
   IPReceive(Context, &IPPacket);
+  DisplayIPPacket(&IPPacket);
   TI_DbgPrint(MAX_TRACE, 
 	      ("Finished receive (complete: %x, context %x, packet %x)\n",
 	       PC(NdisPacket)->DLComplete, Context, NdisPacket));

reactos/drivers/lib/ip/network
neighbor.c 1.7 -> 1.8
diff -u -r1.7 -r1.8
--- neighbor.c	30 Nov 2004 00:10:40 -0000	1.7
+++ neighbor.c	12 Dec 2004 11:48:03 -0000	1.8
@@ -30,8 +30,9 @@
     PNEIGHBOR_PACKET Packet;
 
     /* Send any waiting packets */
-    if( !IsListEmpty( &NCE->PacketQueue ) ) {
-	PacketEntry = RemoveHeadList( &NCE->PacketQueue );
+    PacketEntry = ExInterlockedRemoveHeadList(&NCE->PacketQueue,
+                                              &NCE->Table->Lock);
+    if( PacketEntry != NULL ) {
 	Packet = CONTAINING_RECORD( PacketEntry, NEIGHBOR_PACKET, Next );
 
 	TI_DbgPrint
@@ -57,8 +58,9 @@
     PLIST_ENTRY PacketEntry;
     PNEIGHBOR_PACKET Packet;
 	
-    while( !IsListEmpty( &NCE->PacketQueue ) ) {
-	PacketEntry = RemoveHeadList( &NCE->PacketQueue );
+    PacketEntry = ExInterlockedRemoveHeadList(&NCE->PacketQueue,
+                                              &NCE->Table->Lock);
+    while( PacketEntry != NULL ) {
 	Packet = CONTAINING_RECORD
 	    ( PacketEntry, NEIGHBOR_PACKET, Next );
 
@@ -78,6 +80,8 @@
     }
 	
 	PoolFreeBuffer( Packet );
+	PacketEntry = ExInterlockedRemoveHeadList(&NCE->PacketQueue,
+	                                          &NCE->Table->Lock);
     }
 }
 
@@ -448,11 +452,11 @@
   Packet->Packet = NdisPacket;
   InsertTailList( &NCE->PacketQueue, &Packet->Next );
 
+  TcpipReleaseSpinLock(Lock, OldIrql);
+
   if( NCE->State & NUD_CONNECTED )
       NBSendPackets( NCE );
 
-  TcpipReleaseSpinLock(Lock, OldIrql);
-
   return TRUE;
 }
 

reactos/drivers/lib/ip/network
receive.c 1.4 -> 1.5
diff -u -r1.4 -r1.5
--- receive.c	25 Nov 2004 23:56:58 -0000	1.4
+++ receive.c	12 Dec 2004 11:48:03 -0000	1.5
@@ -395,7 +395,7 @@
     /* If this is the first fragment, save the IP header */
     if (FragFirst == 0) {
       TI_DbgPrint(DEBUG_IP, ("First fragment found. Header buffer is at (0x%X). "
-        "Header size is (%d).\n", IPDR->IPv4Header, IPPacket->HeaderSize));
+        "Header size is (%d).\n", &IPDR->IPv4Header, IPPacket->HeaderSize));
 
       RtlCopyMemory(&IPDR->IPv4Header, IPPacket->Header, IPPacket->HeaderSize);
       IPDR->HeaderSize = IPPacket->HeaderSize;

reactos/drivers/lib/ip/transport/tcp
tcp.c 1.14 -> 1.15
diff -u -r1.14 -r1.15
--- tcp.c	11 Dec 2004 16:36:06 -0000	1.14
+++ tcp.c	12 Dec 2004 11:48:03 -0000	1.15
@@ -427,7 +427,7 @@
 
     TcpipRecursiveMutexLeave( &TCPLock );
     
-    if( Status == OSK_EINPROGRESS || Status == STATUS_SUCCESS ) 
+    if( Status == OSK_EINPROGRESS ) 
 	return STATUS_PENDING;
     else
 	return Status;
@@ -496,26 +496,41 @@
   UINT Backlog, 
   PTCP_COMPLETION_ROUTINE Complete,
   PVOID Context) {
-   NTSTATUS Status;
+    NTSTATUS Status;
+    SOCKADDR_IN AddressToBind;
 
-   TI_DbgPrint(DEBUG_TCP,("TCPListen started\n"));
+    TI_DbgPrint(DEBUG_TCP,("TCPListen started\n"));
 
-   TI_DbgPrint(DEBUG_TCP,("Connection->SocketContext %x\n",
-     Connection->SocketContext));
+    TI_DbgPrint(DEBUG_TCP,("Connection->SocketContext %x\n",
+	Connection->SocketContext));
 
-   ASSERT(Connection);
-   ASSERT_KM_POINTER(Connection->SocketContext);
+    ASSERT(Connection);
+    ASSERT_KM_POINTER(Connection->SocketContext);
+    ASSERT_KM_POINTER(Connection->AddressFile);
 
-   TcpipRecursiveMutexEnter( &TCPLock, TRUE );
+    TcpipRecursiveMutexEnter( &TCPLock, TRUE );
    
-   Status =  TCPTranslateError( OskitTCPListen( Connection->SocketContext,
+    AddressToBind.sin_family = AF_INET;
+    memcpy( &AddressToBind.sin_addr, 
+	    &Connection->AddressFile->Address.Address.IPv4Address,
+	    sizeof(AddressToBind.sin_addr) );
+    AddressToBind.sin_port = Connection->AddressFile->Port;
+
+    TI_DbgPrint(DEBUG_TCP,("AddressToBind - %x:%x\n", AddressToBind.sin_addr, AddressToBind.sin_port));
+
+    OskitTCPBind( Connection->SocketContext,
+		  Connection,
+		  &AddressToBind,
+		  sizeof(AddressToBind) );
+   
+    Status = TCPTranslateError( OskitTCPListen( Connection->SocketContext,
 						Backlog ) );
    
-   TcpipRecursiveMutexLeave( &TCPLock );
+    TcpipRecursiveMutexLeave( &TCPLock );
 
-   TI_DbgPrint(DEBUG_TCP,("TCPListen finished %x\n", Status));
+    TI_DbgPrint(DEBUG_TCP,("TCPListen finished %x\n", Status));
    
-   return Status;
+    return Status;
 }
 
 NTSTATUS TCPAccept

reactos/drivers/lib/oskittcp/oskittcp
in_pcb.c 1.3 -> 1.4
diff -u -r1.3 -r1.4
--- in_pcb.c	23 Sep 2004 03:02:29 -0000	1.3
+++ in_pcb.c	12 Dec 2004 11:48:03 -0000	1.4
@@ -150,6 +150,7 @@
 		if (lport) {
 			struct inpcb *t;
 
+#ifndef __REACTOS__
 			/* GROSS */
 			if (ntohs(lport) < IPPORT_RESERVED &&
 			    (error = suser(p->p_ucred, &p->p_acflag))) {
@@ -157,6 +158,7 @@
 					("Leaving EACCESS\n"));
 			    return (EACCES);
 			}
+#endif
 			t = in_pcblookup(head, zeroin_addr, 0,
 			    sin->sin_addr, lport, wild);
 			if (t && (reuseport & t->inp_socket->so_options) == 0)

reactos/drivers/lib/oskittcp/oskittcp
interface.c 1.19 -> 1.20
diff -u -r1.19 -r1.20
--- interface.c	4 Dec 2004 23:29:56 -0000	1.19
+++ interface.c	12 Dec 2004 11:48:03 -0000	1.20
@@ -324,7 +324,13 @@
 }
 
 int OskitTCPListen( void *socket, int backlog ) {
-    return solisten( socket, backlog );
+    int error;
+    
+    OS_DbgPrint(OSK_MID_TRACE,("Called, socket = %08x\n", socket));
+    error = solisten( socket, backlog );
+    OS_DbgPrint(OSK_MID_TRACE,("Ending: %08x\n", error));
+
+    return error;
 }
 
 void OskitTCPSetAddress( void *socket, 

reactos/drivers/net/tcpip/tcpip
buffer.c 1.2 -> 1.3
diff -u -r1.2 -r1.3
--- buffer.c	7 Nov 2004 20:37:19 -0000	1.2
+++ buffer.c	12 Dec 2004 11:48:04 -0000	1.3
@@ -370,6 +370,7 @@
 	ExFreePool( NewData );
 	UntrackFL( File, Line, Packet );
 	FreeNdisPacket( Packet );
+	return Status;
     }
     TrackWithTag(NDIS_BUFFER_TAG, Buffer, File, Line);
 
CVSspam 0.2.8