Author: cgutman
Date: Fri Sep 19 19:39:55 2008
New Revision: 36338
URL:
http://svn.reactos.org/svn/reactos?rev=36338&view=rev
Log:
- Merge aicom-network-fixes up to r36337
Modified:
trunk/reactos/drivers/network/ndis/ndis/config.c
trunk/reactos/drivers/network/ndis/ndis/control.c
trunk/reactos/drivers/network/ndis/ndis/miniport.c
trunk/reactos/drivers/network/tcpip/datalink/lan.c
trunk/reactos/drivers/network/tcpip/tcpip/fileobjs.c
trunk/reactos/drivers/network/tcpip/tcpip/pool.c
trunk/reactos/lib/drivers/ip/network/transmit.c
trunk/reactos/lib/drivers/ip/transport/tcp/accept.c
trunk/reactos/lib/drivers/ip/transport/tcp/event.c
Modified: trunk/reactos/drivers/network/ndis/ndis/config.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/network/ndis/ndis/…
==============================================================================
--- trunk/reactos/drivers/network/ndis/ndis/config.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/network/ndis/ndis/config.c [iso-8859-1] Fri Sep 19 19:39:55
2008
@@ -68,17 +68,6 @@
PVOID Data;
WCHAR Buff[25];
- if(ParameterType != NdisParameterInteger &&
- ParameterType != NdisParameterHexInteger &&
- ParameterType != NdisParameterString &&
- ParameterType != NdisParameterMultiString &&
- ParameterType != NdisParameterBinary
- )
- {
- *Status = NDIS_STATUS_NOT_SUPPORTED;
- return;
- }
-
/* reset parameter type to standard reg types */
switch(ParameterType)
{
@@ -118,7 +107,7 @@
break;
default:
- *Status = NDIS_STATUS_FAILURE;
+ *Status = NDIS_STATUS_NOT_SUPPORTED;
return;
}
@@ -342,6 +331,7 @@
)
{
NDIS_DbgPrint(MID_TRACE,("unsupported parameter type\n"));
+ *Status = NDIS_STATUS_NOT_SUPPORTED;
return;
}
Modified: trunk/reactos/drivers/network/ndis/ndis/control.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/network/ndis/ndis/…
==============================================================================
--- trunk/reactos/drivers/network/ndis/ndis/control.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/network/ndis/ndis/control.c [iso-8859-1] Fri Sep 19 19:39:55
2008
@@ -87,6 +87,7 @@
}
}
}
+ Lock->Context = PsGetCurrentThread();
LockState->LockState = 3;
}
}
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 Sep 19 19:39:55
2008
@@ -818,7 +818,10 @@
KeLowerIrql(RaiseOldIrql);
}
}
- if( NdisStatus != NDIS_STATUS_PENDING ) {
+
+ if( NdisStatus == NDIS_STATUS_RESOURCES )
+ MiniQueueWorkItem(Adapter, WorkItemType, WorkItemContext);
+ else if( NdisStatus != NDIS_STATUS_PENDING ) {
NdisMSendComplete
( Adapter, (PNDIS_PACKET)WorkItemContext, NdisStatus );
Adapter->MiniportBusy = FALSE;
@@ -1143,7 +1146,6 @@
* ShutdownHandler: Function to call to handle the bugcheck
* NOTES:
* - I'm not sure about ShutdownContext
- * - FIXME - memory leak below
*/
{
PLOGICAL_ADAPTER Adapter = (PLOGICAL_ADAPTER)MiniportHandle;
@@ -1164,8 +1166,9 @@
BugcheckContext->ShutdownHandler = ShutdownHandler;
BugcheckContext->DriverContext = ShutdownContext;
- /* not sure if this needs to be initialized or not... oh well, it's a leak. */
BugcheckContext->CallbackRecord = ExAllocatePool(NonPagedPool,
sizeof(KBUGCHECK_CALLBACK_RECORD));
+
+ KeInitializeCallbackRecord(BugcheckContext->CallbackRecord);
KeRegisterBugCheckCallback(BugcheckContext->CallbackRecord, NdisIBugcheckCallback,
BugcheckContext, sizeof(BugcheckContext), (PUCHAR)"Ndis Miniport");
Modified: trunk/reactos/drivers/network/tcpip/datalink/lan.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/network/tcpip/data…
==============================================================================
--- trunk/reactos/drivers/network/tcpip/datalink/lan.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/network/tcpip/datalink/lan.c [iso-8859-1] Fri Sep 19 19:39:55
2008
@@ -1207,17 +1207,17 @@
/* Convert returned link speed to bps (it is in 100bps increments) */
IF->Speed = Speed * 100L;
- /* Add adapter to the adapter list */
- ExInterlockedInsertTailList(&AdapterListHead,
- &IF->ListEntry,
- &AdapterListLock);
-
/* Bind adapter to IP layer */
if( !BindAdapter(IF, RegistryPath) ) {
TI_DbgPrint(DEBUG_DATALINK,("denying adapter %wZ (BindAdapter)\n",
AdapterName));
exFreePool(IF);
return NDIS_STATUS_NOT_ACCEPTED;
}
+
+ /* Add adapter to the adapter list */
+ ExInterlockedInsertTailList(&AdapterListHead,
+ &IF->ListEntry,
+ &AdapterListLock);
TI_DbgPrint(DEBUG_DATALINK, ("Leaving.\n"));
Modified: trunk/reactos/drivers/network/tcpip/tcpip/fileobjs.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/network/tcpip/tcpi…
==============================================================================
--- trunk/reactos/drivers/network/tcpip/tcpip/fileobjs.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/network/tcpip/tcpip/fileobjs.c [iso-8859-1] Fri Sep 19 19:39:55
2008
@@ -409,6 +409,11 @@
Status = TCPSocket( Connection, AF_INET, SOCK_STREAM, IPPROTO_TCP );
+ if( !NT_SUCCESS(Status) ) {
+ TCPFreeConnectionEndpoint( Connection );
+ return Status;
+ }
+
/* Return connection endpoint file object */
Request->Handle.ConnectionContext = Connection;
Modified: trunk/reactos/drivers/network/tcpip/tcpip/pool.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/network/tcpip/tcpi…
==============================================================================
--- trunk/reactos/drivers/network/tcpip/tcpip/pool.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/network/tcpip/tcpip/pool.c [iso-8859-1] Fri Sep 19 19:39:55
2008
@@ -25,6 +25,8 @@
/* FIXME: Get buffer from a free buffer pool with enough room */
Buffer = ExAllocatePool(NonPagedPool, Size);
+
+ RtlZeroMemory(Buffer, Size);
TI_DbgPrint(DEBUG_MEMORY, ("Allocated (%i) bytes at (0x%X).\n", Size,
Buffer));
Modified: trunk/reactos/lib/drivers/ip/network/transmit.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/drivers/ip/network/tra…
==============================================================================
--- trunk/reactos/lib/drivers/ip/network/transmit.c [iso-8859-1] (original)
+++ trunk/reactos/lib/drivers/ip/network/transmit.c [iso-8859-1] Fri Sep 19 19:39:55 2008
@@ -34,10 +34,7 @@
("Called. Context (0x%X) NdisPacket (0x%X) NdisStatus (0x%X)\n",
Context, NdisPacket, NdisStatus));
- /* FIXME: Stop sending fragments and cleanup datagram buffers if
- there was an error */
-
- if (PrepareNextFragment(IFC)) {
+ if (NT_SUCCESS(NdisStatus) && PrepareNextFragment(IFC)) {
/* A fragment was prepared for transmission, so send it */
IPSendFragment(IFC->NdisPacket, IFC->NCE, IFC);
} else {
Modified: trunk/reactos/lib/drivers/ip/transport/tcp/accept.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/drivers/ip/transport/t…
==============================================================================
--- trunk/reactos/lib/drivers/ip/transport/tcp/accept.c [iso-8859-1] (original)
+++ trunk/reactos/lib/drivers/ip/transport/tcp/accept.c [iso-8859-1] Fri Sep 19 19:39:55
2008
@@ -117,6 +117,7 @@
if( Bucket->AssociatedEndpoint == Connection ) {
RemoveEntryList( ListEntry->Blink );
ExFreePool( Bucket );
+ break;
}
}
@@ -141,10 +142,14 @@
if( Status == STATUS_PENDING ) {
Bucket = ExAllocatePool( NonPagedPool, sizeof(*Bucket) );
- Bucket->AssociatedEndpoint = Connection;
- Bucket->Request.RequestNotifyObject = Complete;
- Bucket->Request.RequestContext = Context;
- InsertHeadList( &Listener->ListenRequest, &Bucket->Entry );
+
+ if( Bucket ) {
+ Bucket->AssociatedEndpoint = Connection;
+ Bucket->Request.RequestNotifyObject = Complete;
+ Bucket->Request.RequestContext = Context;
+ InsertHeadList( &Listener->ListenRequest, &Bucket->Entry );
+ } else
+ Status = STATUS_NO_MEMORY;
}
TcpipRecursiveMutexLeave( &TCPLock );
Modified: trunk/reactos/lib/drivers/ip/transport/tcp/event.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/drivers/ip/transport/t…
==============================================================================
--- trunk/reactos/lib/drivers/ip/transport/tcp/event.c [iso-8859-1] (original)
+++ trunk/reactos/lib/drivers/ip/transport/tcp/event.c [iso-8859-1] Fri Sep 19 19:39:55
2008
@@ -104,8 +104,7 @@
IPSendDatagram( &Packet, NCE, TCPPacketSendComplete, NULL );
- if( !NT_SUCCESS(NdisStatus) ) return OSK_EINVAL;
- else return 0;
+ return 0;
}
int TCPSleep( void *ClientData, void *token, int priority, char *msg,
@@ -144,7 +143,9 @@
TcpipRecursiveMutexEnter( &TCPLock, TRUE );
PoolFreeBuffer( SleepingThread );
- }
+ } else
+ return OSK_ENOBUFS;
+
TI_DbgPrint(DEBUG_TCP,("Waiting finished: %x\n", token));
return 0;
}