[ros-diffs] [cmihail] 52485: [IP] - fix system crash when failing to connect to a remote host - Set address length in the TDI address struct - Simplify copying the address - Zero the sin_zero member

cmihail at svn.reactos.org cmihail at svn.reactos.org
Tue Jun 28 07:29:29 UTC 2011


Author: cmihail
Date: Tue Jun 28 07:29:28 2011
New Revision: 52485

URL: http://svn.reactos.org/svn/reactos?rev=52485&view=rev
Log:
[IP]
- fix system crash when failing to connect to a remote host
- Set address length in the TDI address struct
- Simplify copying the address
- Zero the sin_zero member

Modified:
    branches/GSoC_2011/TcpIpDriver/lib/drivers/ip/transport/datagram/datagram.c
    branches/GSoC_2011/TcpIpDriver/lib/drivers/ip/transport/tcp/event.c

Modified: branches/GSoC_2011/TcpIpDriver/lib/drivers/ip/transport/datagram/datagram.c
URL: http://svn.reactos.org/svn/reactos/branches/GSoC_2011/TcpIpDriver/lib/drivers/ip/transport/datagram/datagram.c?rev=52485&r1=52484&r2=52485&view=diff
==============================================================================
--- branches/GSoC_2011/TcpIpDriver/lib/drivers/ip/transport/datagram/datagram.c [iso-8859-1] (original)
+++ branches/GSoC_2011/TcpIpDriver/lib/drivers/ip/transport/datagram/datagram.c [iso-8859-1] Tue Jun 28 07:29:28 2011
@@ -135,15 +135,14 @@
 	      RTAIPAddress = (PTA_IP_ADDRESS)Current->ReturnInfo->RemoteAddress;
 	      RTAIPAddress->TAAddressCount = 1;
 	      RTAIPAddress->Address->AddressType = TDI_ADDRESS_TYPE_IP;
+          RTAIPAddress->Address->AddressLength = TDI_ADDRESS_LENGTH_IP;
 	      RTAIPAddress->Address->Address->sin_port = SrcPort;
+          RTAIPAddress->Address->Address->in_addr = SrcAddress->Address.IPv4Address;
+          RtlZeroMemory(RTAIPAddress->Address->Address->sin_zero, 8);
 
 	      TI_DbgPrint(MAX_TRACE, ("(A: %08x) Addr %08x Port %04x\n",
 				      RTAIPAddress,
 				      SrcAddress->Address.IPv4Address, SrcPort));
-
-	      RtlCopyMemory( &RTAIPAddress->Address->Address->in_addr,
-			     &SrcAddress->Address.IPv4Address,
-			     sizeof(SrcAddress->Address.IPv4Address) );
 
               ReferenceObject(AddrFile);
               UnlockObject(AddrFile, OldIrql);

Modified: branches/GSoC_2011/TcpIpDriver/lib/drivers/ip/transport/tcp/event.c
URL: http://svn.reactos.org/svn/reactos/branches/GSoC_2011/TcpIpDriver/lib/drivers/ip/transport/tcp/event.c?rev=52485&r1=52484&r2=52485&view=diff
==============================================================================
--- branches/GSoC_2011/TcpIpDriver/lib/drivers/ip/transport/tcp/event.c [iso-8859-1] (original)
+++ branches/GSoC_2011/TcpIpDriver/lib/drivers/ip/transport/tcp/event.c [iso-8859-1] Tue Jun 28 07:29:28 2011
@@ -77,7 +77,7 @@
     
     ReferenceObject(Connection);
     
-    DbgPrint("[IP, FlushAllQueues] Flushing recv/all with status: 0x%x\n", Status);
+    DbgPrint("[IP, FlushAllQueues] Flushing recv/all with status: 0x%x fox Connection = 0x%x\n", Status, Connection);
     
     while ((Entry = ExInterlockedRemoveHeadList(&Connection->ReceiveRequest, &Connection->Lock)))
     {
@@ -103,7 +103,7 @@
         Bucket->Status = Status;
         Bucket->Information = 0;
 
-        DbgPrint("[IP, FlushAllQueues] Flushing Listen request for Connection = 0x%x\n", Bucket->AssociatedEndpoint);
+        DbgPrint("[IP, FlushAllQueues] Completing Listen request for Connection = 0x%x\n", Bucket->AssociatedEndpoint);
         
         DereferenceObject(Bucket->AssociatedEndpoint);
         CompleteBucket(Connection, Bucket, TRUE);
@@ -129,22 +129,28 @@
         
         Bucket->Status = Status;
         Bucket->Information = 0;
+
+        DbgPrint("[IP, FlushAllQueues] Completing Connection request for Connection = 0x%x\n", Bucket->AssociatedEndpoint);
         
         CompleteBucket(Connection, Bucket, TRUE);
     }
     
     DereferenceObject(Connection);
+
+    DbgPrint("[IP, FlushAllQueues] Leaving\n");
 }
 
 VOID
 TCPFinEventHandler(void *arg, err_t err)
 {
     PCONNECTION_ENDPOINT Connection = arg;
-    
-    FlushAllQueues(Connection, TCPTranslateError(err));
-    
+
     /* We're already closed so we don't want to call lwip_close */
     Connection->SocketContext = NULL;
+
+    DbgPrint("[IP, TCPFinEventHandler] Called for Connection( 0x%x )-> SocketContext = pcb (0x%x)\n", Connection, Connection->SocketContext);
+    
+    FlushAllQueues(Connection, TCPTranslateError(err));
 }
     
 VOID




More information about the Ros-diffs mailing list