mirror of
https://github.com/reactos/reactos.git
synced 2025-02-24 09:25:10 +00:00
- Merge aicom-network-fixes up to r35787
svn path=/trunk/; revision=35788
This commit is contained in:
parent
dcae209a08
commit
7641cc07cc
6 changed files with 49 additions and 26 deletions
|
@ -53,6 +53,7 @@ AfdBindSocket(PDEVICE_OBJECT DeviceObject, PIRP Irp,
|
|||
return UnlockAndMaybeComplete( FCB, STATUS_NO_MEMORY,
|
||||
Irp, 0, NULL );
|
||||
|
||||
if( FCB->LocalAddress ) ExFreePool( FCB->LocalAddress );
|
||||
FCB->LocalAddress = TaCopyTransportAddress( &BindReq->Address );
|
||||
|
||||
if( FCB->LocalAddress )
|
||||
|
|
|
@ -33,6 +33,7 @@ NTSTATUS WarmSocketForConnection( PAFD_FCB FCB ) {
|
|||
}
|
||||
|
||||
NTSTATUS MakeSocketIntoConnection( PAFD_FCB FCB ) {
|
||||
NTSTATUS Status;
|
||||
|
||||
/* Allocate the receive area and start receiving */
|
||||
FCB->Recv.Window =
|
||||
|
@ -50,14 +51,18 @@ NTSTATUS MakeSocketIntoConnection( PAFD_FCB FCB ) {
|
|||
|
||||
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 @@ AfdStreamSocketConnect(PDEVICE_OBJECT DeviceObject, PIRP Irp,
|
|||
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 @@ AfdStreamSocketConnect(PDEVICE_OBJECT DeviceObject, PIRP Irp,
|
|||
/* Drop through to SOCKET_STATE_BOUND */
|
||||
|
||||
case SOCKET_STATE_BOUND:
|
||||
if( FCB->RemoteAddress ) ExFreePool( FCB->RemoteAddress );
|
||||
FCB->RemoteAddress =
|
||||
TaCopyTransportAddress( &ConnectReq->RemoteAddress );
|
||||
|
||||
|
|
|
@ -17,6 +17,7 @@ static VOID SatisfyAccept( PAFD_DEVICE_EXTENSION DeviceExt,
|
|||
PFILE_OBJECT NewFileObject,
|
||||
PAFD_TDI_OBJECT_QELT Qelt ) {
|
||||
PAFD_FCB FCB = NewFileObject->FsContext;
|
||||
NTSTATUS Status;
|
||||
|
||||
if( !SocketAcquireStateLock( FCB ) ) {
|
||||
LostSocket( Irp );
|
||||
|
@ -26,21 +27,28 @@ static VOID SatisfyAccept( PAFD_DEVICE_EXTENSION DeviceExt,
|
|||
/* 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 @@ static NTSTATUS NTAPI ListenComplete
|
|||
( 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 @@ static NTSTATUS NTAPI ListenComplete
|
|||
return STATUS_CANCELLED;
|
||||
}
|
||||
|
||||
if( !SocketAcquireStateLock( FCB ) ) return Status;
|
||||
if( !SocketAcquireStateLock( FCB ) ) return STATUS_FILE_CLOSED;
|
||||
|
||||
FCB->ListenIrp.InFlightRequest = NULL;
|
||||
|
||||
|
@ -114,8 +122,10 @@ static NTSTATUS NTAPI ListenComplete
|
|||
|
||||
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 @@ static NTSTATUS NTAPI ListenComplete
|
|||
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 @@ static NTSTATUS NTAPI ListenComplete
|
|||
|
||||
SocketStateUnlock( FCB );
|
||||
|
||||
return STATUS_SUCCESS;
|
||||
return Status;
|
||||
}
|
||||
|
||||
NTSTATUS AfdListenSocket(PDEVICE_OBJECT DeviceObject, PIRP Irp,
|
||||
|
|
|
@ -136,7 +136,8 @@ static NTSTATUS TdiOpenDevice(
|
|||
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));
|
||||
|
|
|
@ -1625,7 +1625,7 @@ NdisIAddDevice(
|
|||
|
||||
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;
|
||||
|
|
|
@ -27,6 +27,9 @@ TDI_STATUS InfoTdiQueryGetAddrTable( PNDIS_BUFFER Buffer,
|
|||
|
||||
TI_DbgPrint(DEBUG_INFO, ("Called.\n"));
|
||||
|
||||
if (!IpAddress)
|
||||
return TDI_NO_RESOURCES;
|
||||
|
||||
TcpipAcquireSpinLock(&InterfaceListLock, &OldIrql);
|
||||
|
||||
ForEachInterface(CurrentIF) {
|
||||
|
@ -80,7 +83,7 @@ TDI_STATUS InfoTdiQueryGetRouteTable( PNDIS_BUFFER Buffer, PUINT BufferSize ) {
|
|||
if( !RCache || !RouteEntries ) {
|
||||
if( RCache ) ExFreePool( RCache );
|
||||
if( RouteEntries ) ExFreePool( RouteEntries );
|
||||
return STATUS_NO_MEMORY;
|
||||
return TDI_NO_RESOURCES;
|
||||
}
|
||||
|
||||
RtlZeroMemory( RouteEntries, Size );
|
||||
|
|
Loading…
Reference in a new issue