Author: cgutman
Date: Fri Aug 29 22:42:46 2008
New Revision: 35788
URL:
http://svn.reactos.org/svn/reactos?rev=35788&view=rev
Log:
- Merge aicom-network-fixes up to r35787
Modified:
trunk/reactos/drivers/network/afd/afd/bind.c
trunk/reactos/drivers/network/afd/afd/connect.c
trunk/reactos/drivers/network/afd/afd/listen.c
trunk/reactos/drivers/network/afd/afd/tdi.c
trunk/reactos/drivers/network/ndis/ndis/miniport.c
trunk/reactos/drivers/network/tcpip/tcpip/ninfo.c
Modified: trunk/reactos/drivers/network/afd/afd/bind.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/network/afd/afd/bi…
==============================================================================
--- trunk/reactos/drivers/network/afd/afd/bind.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/network/afd/afd/bind.c [iso-8859-1] Fri Aug 29 22:42:46 2008
@@ -53,6 +53,7 @@
return UnlockAndMaybeComplete( FCB, STATUS_NO_MEMORY,
Irp, 0, NULL );
+ if( FCB->LocalAddress ) ExFreePool( FCB->LocalAddress );
FCB->LocalAddress = TaCopyTransportAddress( &BindReq->Address );
if( FCB->LocalAddress )
Modified: trunk/reactos/drivers/network/afd/afd/connect.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/network/afd/afd/co…
==============================================================================
--- trunk/reactos/drivers/network/afd/afd/connect.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/network/afd/afd/connect.c [iso-8859-1] Fri Aug 29 22:42:46 2008
@@ -33,6 +33,7 @@
}
NTSTATUS MakeSocketIntoConnection( PAFD_FCB FCB ) {
+ NTSTATUS Status;
/* Allocate the receive area and start receiving */
FCB->Recv.Window =
@@ -50,14 +51,18 @@
FCB->State = SOCKET_STATE_CONNECTED;
- return TdiReceive( &FCB->ReceiveIrp.InFlightRequest,
- FCB->Connection.Object,
- TDI_RECEIVE_NORMAL,
- FCB->Recv.Window,
- FCB->Recv.Size,
- &FCB->ReceiveIrp.Iosb,
- ReceiveComplete,
- FCB );
+ Status = TdiReceive( &FCB->ReceiveIrp.InFlightRequest,
+ FCB->Connection.Object,
+ TDI_RECEIVE_NORMAL,
+ FCB->Recv.Window,
+ FCB->Recv.Size,
+ &FCB->ReceiveIrp.Iosb,
+ ReceiveComplete,
+ FCB );
+
+ if( Status == STATUS_PENDING ) Status = STATUS_SUCCESS;
+
+ return Status;
}
static NTSTATUS NTAPI StreamSocketConnectComplete
@@ -166,6 +171,7 @@
return LeaveIrpUntilLater( FCB, Irp, FUNCTION_CONNECT );
case SOCKET_STATE_CREATED:
+ if( FCB->LocalAddress ) ExFreePool( FCB->LocalAddress );
FCB->LocalAddress =
TaCopyTransportAddress( &ConnectReq->RemoteAddress );
@@ -193,6 +199,7 @@
/* Drop through to SOCKET_STATE_BOUND */
case SOCKET_STATE_BOUND:
+ if( FCB->RemoteAddress ) ExFreePool( FCB->RemoteAddress );
FCB->RemoteAddress =
TaCopyTransportAddress( &ConnectReq->RemoteAddress );
Modified: trunk/reactos/drivers/network/afd/afd/listen.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/network/afd/afd/li…
==============================================================================
--- trunk/reactos/drivers/network/afd/afd/listen.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/network/afd/afd/listen.c [iso-8859-1] Fri Aug 29 22:42:46 2008
@@ -17,6 +17,7 @@
PFILE_OBJECT NewFileObject,
PAFD_TDI_OBJECT_QELT Qelt ) {
PAFD_FCB FCB = NewFileObject->FsContext;
+ NTSTATUS Status;
if( !SocketAcquireStateLock( FCB ) ) {
LostSocket( Irp );
@@ -26,20 +27,27 @@
/* Transfer the connection to the new socket, launch the opening read */
AFD_DbgPrint(MID_TRACE,("Completing a real accept (FCB %x)\n", FCB));
- FCB->State = SOCKET_STATE_CONNECTED;
FCB->Connection = Qelt->Object;
+
+ if( FCB->RemoteAddress ) ExFreePool( FCB->RemoteAddress );
FCB->RemoteAddress =
TaCopyTransportAddress( Qelt->ConnInfo->RemoteAddress );
+ if( !FCB->RemoteAddress )
+ Status = STATUS_NO_MEMORY;
+ else
+ Status = MakeSocketIntoConnection( FCB );
+
+ if( NT_SUCCESS(Status) ) {
+ FCB->PollState |= AFD_EVENT_SEND;
+ PollReeval( DeviceExt, NewFileObject );
+ }
+
if( Irp->MdlAddress ) UnlockRequest( Irp, IoGetCurrentIrpStackLocation( Irp ) );
-
+
Irp->IoStatus.Information = 0;
- Irp->IoStatus.Status = STATUS_SUCCESS;
+ Irp->IoStatus.Status = Status;
IoCompleteRequest( Irp, IO_NETWORK_INCREMENT );
-
- MakeSocketIntoConnection( FCB );
- FCB->PollState |= AFD_EVENT_SEND;
- PollReeval( DeviceExt, NewFileObject );
SocketStateUnlock( FCB );
}
@@ -90,7 +98,7 @@
( PDEVICE_OBJECT DeviceObject,
PIRP Irp,
PVOID Context ) {
- NTSTATUS Status = STATUS_FILE_CLOSED;
+ NTSTATUS Status = STATUS_SUCCESS;
PAFD_FCB FCB = (PAFD_FCB)Context;
PAFD_TDI_OBJECT_QELT Qelt;
@@ -99,7 +107,7 @@
return STATUS_CANCELLED;
}
- if( !SocketAcquireStateLock( FCB ) ) return Status;
+ if( !SocketAcquireStateLock( FCB ) ) return STATUS_FILE_CLOSED;
FCB->ListenIrp.InFlightRequest = NULL;
@@ -114,8 +122,10 @@
Qelt = ExAllocatePool( NonPagedPool, sizeof(*Qelt) );
if( !Qelt ) {
+ /* Is this correct? */
TdiCloseDevice( FCB->Connection.Handle,
FCB->Connection.Object );
+ Status = STATUS_NO_MEMORY;
} else {
UINT AddressType =
FCB->LocalAddress->Address[0].AddressType;
@@ -128,11 +138,12 @@
ConnectionReturnInfo->RemoteAddress));
TdiBuildNullConnectionInfo( &Qelt->ConnInfo, AddressType );
- TaCopyTransportAddressInPlace
- ( Qelt->ConnInfo->RemoteAddress,
- FCB->ListenIrp.ConnectionReturnInfo->RemoteAddress );
-
- InsertTailList( &FCB->PendingConnections, &Qelt->ListEntry );
+ if( Qelt->ConnInfo ) {
+ TaCopyTransportAddressInPlace
+ ( Qelt->ConnInfo->RemoteAddress,
+ FCB->ListenIrp.ConnectionReturnInfo->RemoteAddress );
+ InsertTailList( &FCB->PendingConnections, &Qelt->ListEntry );
+ } else Status = STATUS_NO_MEMORY;
}
/* Satisfy a pre-accept request if one is available */
@@ -160,7 +171,7 @@
SocketStateUnlock( FCB );
- return STATUS_SUCCESS;
+ return Status;
}
NTSTATUS AfdListenSocket(PDEVICE_OBJECT DeviceObject, PIRP Irp,
Modified: trunk/reactos/drivers/network/afd/afd/tdi.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/network/afd/afd/td…
==============================================================================
--- trunk/reactos/drivers/network/afd/afd/tdi.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/network/afd/afd/tdi.c [iso-8859-1] Fri Aug 29 22:42:46 2008
@@ -136,7 +136,8 @@
NULL); /* Handle
information */
if (!NT_SUCCESS(Status)) {
AFD_DbgPrint(MIN_TRACE, ("ObReferenceObjectByHandle() failed with status
(0x%X).\n", Status));
- ZwClose(*Handle);
+ ZwClose(*Handle);
+ *Handle = NULL;
} else {
AFD_DbgPrint(MAX_TRACE, ("Got handle (0x%X) Object (0x%X)\n",
*Handle, *Object));
Modified: trunk/reactos/drivers/network/ndis/ndis/miniport.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/network/ndis/ndis/…
==============================================================================
--- trunk/reactos/drivers/network/ndis/ndis/miniport.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/network/ndis/ndis/miniport.c [iso-8859-1] Fri Aug 29 22:42:46
2008
@@ -1625,7 +1625,7 @@
Status = IoGetDeviceProperty(PhysicalDeviceObject, DevicePropertyDriverKeyName,
0, NULL, &DriverKeyLength);
- if (Status != STATUS_BUFFER_TOO_SMALL)
+ if (Status != STATUS_BUFFER_TOO_SMALL && Status != STATUS_BUFFER_OVERFLOW)
{
NDIS_DbgPrint(DEBUG_MINIPORT, ("Can't get miniport driver key
length.\n"));
return Status;
Modified: trunk/reactos/drivers/network/tcpip/tcpip/ninfo.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/network/tcpip/tcpi…
==============================================================================
--- trunk/reactos/drivers/network/tcpip/tcpip/ninfo.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/network/tcpip/tcpip/ninfo.c [iso-8859-1] Fri Aug 29 22:42:46
2008
@@ -26,6 +26,9 @@
IF_LIST_ITER(CurrentIF);
TI_DbgPrint(DEBUG_INFO, ("Called.\n"));
+
+ if (!IpAddress)
+ return TDI_NO_RESOURCES;
TcpipAcquireSpinLock(&InterfaceListLock, &OldIrql);
@@ -80,7 +83,7 @@
if( !RCache || !RouteEntries ) {
if( RCache ) ExFreePool( RCache );
if( RouteEntries ) ExFreePool( RouteEntries );
- return STATUS_NO_MEMORY;
+ return TDI_NO_RESOURCES;
}
RtlZeroMemory( RouteEntries, Size );