mirror of
https://github.com/reactos/reactos.git
synced 2025-01-02 20:43:18 +00:00
According to this osr page:
http://www.osr.com/ddk/network/103ndisx_51pu.htm NdisMEthIndicateReceive passes an NDIS_HANDLE (Specifically, MiniportAdapterHandle), rather than the ETH_FILTER structure. God knows why this wasn't caught before but it did awfully strange stuff including the occasional crash, and more importantly, seemingly randomly corrupting the LAN_ADAPTER and IP_INTERFACE structures in tcpip.sys when we landed in packet receiving in datalink/lan.c. Fixed now. svn path=/trunk/; revision=10276
This commit is contained in:
parent
b477fd3439
commit
a85dce53e9
5 changed files with 57 additions and 19 deletions
|
@ -7,7 +7,9 @@
|
|||
* REVISIONS:
|
||||
* CSH 27/08-2000 Created
|
||||
*/
|
||||
#include <roscfg.h>
|
||||
#include <ne2000.h>
|
||||
#include <debug.h>
|
||||
|
||||
/* Null-terminated array of ports to probe. This is "semi-risky" (Don Becker). */
|
||||
ULONG ProbeAddressList[] = { 0x280, 0x300, 0x320, 0x340, 0x360, 0x380, 0 };
|
||||
|
@ -921,6 +923,8 @@ VOID NICIndicatePacket(
|
|||
#endif
|
||||
|
||||
if (IndicateLength >= DRIVER_HEADER_SIZE) {
|
||||
NDIS_DbgPrint(MAX_TRACE,("Adapter->MiniportAdapterHandle: %x\n",
|
||||
Adapter->MiniportAdapterHandle));
|
||||
NdisMEthIndicateReceive(Adapter->MiniportAdapterHandle,
|
||||
NULL,
|
||||
(PVOID)&Adapter->Lookahead,
|
||||
|
@ -974,6 +978,8 @@ VOID NICReadPacket(
|
|||
/* Skip packet */
|
||||
Adapter->NextPacket = Adapter->CurrentPage;
|
||||
} else {
|
||||
NDIS_DbgPrint(MAX_TRACE,("Adapter->MiniportAdapterHandle: %x\n",
|
||||
Adapter->MiniportAdapterHandle));
|
||||
NICIndicatePacket(Adapter);
|
||||
|
||||
/* Go to the next free buffer in receive ring */
|
||||
|
@ -1221,6 +1227,8 @@ VOID HandleReceive(
|
|||
} else {
|
||||
NDIS_DbgPrint(MID_TRACE, ("Got a packet in the receive ring.\n"));
|
||||
|
||||
NDIS_DbgPrint(MAX_TRACE,("Adapter->MiniportAdapterHandle: %x\n",
|
||||
Adapter->MiniportAdapterHandle));
|
||||
/* Read packet from receive buffer ring */
|
||||
NICReadPacket(Adapter);
|
||||
|
||||
|
@ -1334,7 +1342,12 @@ VOID STDCALL MiniportHandleInterrupt(
|
|||
/* Overflow. Handled almost the same way as a receive interrupt */
|
||||
Adapter->BufferOverflow = TRUE;
|
||||
|
||||
HandleReceive(Adapter);
|
||||
NDIS_DbgPrint(MAX_TRACE,("Adapter->MiniportAdapterHandle: %x\n",
|
||||
Adapter->MiniportAdapterHandle));
|
||||
if(Adapter->MiniportAdapterHandle)
|
||||
HandleReceive(Adapter);
|
||||
else
|
||||
NDIS_DbgPrint(MAX_TRACE,("No miniport adapter yet\n"));
|
||||
|
||||
Adapter->InterruptStatus &= ~ISR_OVW;
|
||||
break;
|
||||
|
@ -1348,8 +1361,13 @@ VOID STDCALL MiniportHandleInterrupt(
|
|||
case ISR_PRX:
|
||||
NDIS_DbgPrint(MID_TRACE, ("Receive interrupt.\n"));
|
||||
|
||||
HandleReceive(Adapter);
|
||||
|
||||
NDIS_DbgPrint(MAX_TRACE,("Adapter->MiniportAdapterHandle: %x\n",
|
||||
Adapter->MiniportAdapterHandle));
|
||||
if(Adapter->MiniportAdapterHandle)
|
||||
HandleReceive(Adapter);
|
||||
else
|
||||
NDIS_DbgPrint(MAX_TRACE,("No miniport adapter yet\n"));
|
||||
|
||||
Adapter->InterruptStatus &= ~(ISR_PRX | ISR_RXE);
|
||||
break;
|
||||
|
||||
|
|
|
@ -7,7 +7,9 @@
|
|||
* REVISIONS:
|
||||
* CSH 27/08-2000 Created
|
||||
*/
|
||||
#include <roscfg.h>
|
||||
#include <ne2000.h>
|
||||
#include <debug.h>
|
||||
|
||||
|
||||
#ifdef DBG
|
||||
|
@ -163,7 +165,7 @@ NDIS_STATUS STDCALL MiniportInitialize(
|
|||
NDIS_STATUS Status;
|
||||
PNIC_ADAPTER Adapter;
|
||||
|
||||
NDIS_DbgPrint(MAX_TRACE, ("Called.\n"));
|
||||
NDIS_DbgPrint(MAX_TRACE, ("Called (Adapter %X).\n", MiniportAdapterHandle));
|
||||
|
||||
/* Search for 802.3 media which is the only one we support */
|
||||
for (i = 0; i < MediumArraySize; i++) {
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
#ifdef DBG
|
||||
|
||||
/* See debug.h for debug/trace constants */
|
||||
DWORD DebugTraceLevel = 0;
|
||||
DWORD DebugTraceLevel = MIN_TRACE;
|
||||
|
||||
#endif /* DBG */
|
||||
|
||||
|
|
|
@ -162,7 +162,8 @@ MiniIndicateData(
|
|||
/* KIRQL OldIrql; */
|
||||
PLIST_ENTRY CurrentEntry;
|
||||
PADAPTER_BINDING AdapterBinding;
|
||||
|
||||
static PVOID ReceiveHandler = 0;
|
||||
|
||||
NDIS_DbgPrint(DEBUG_MINIPORT, ("Called. Adapter (0x%X) HeaderBuffer (0x%X) "
|
||||
"HeaderBufferSize (0x%X) LookaheadBuffer (0x%X) LookaheadBufferSize (0x%X).\n",
|
||||
Adapter, HeaderBuffer, HeaderBufferSize, LookaheadBuffer, LookaheadBufferSize));
|
||||
|
@ -225,6 +226,25 @@ MiniIndicateData(
|
|||
}
|
||||
#endif
|
||||
|
||||
if( !ReceiveHandler )
|
||||
ReceiveHandler =
|
||||
*AdapterBinding->ProtocolBinding->Chars.u4.ReceiveHandler;
|
||||
ASSERT( ReceiveHandler ==
|
||||
*AdapterBinding->ProtocolBinding->Chars.u4.ReceiveHandler );
|
||||
|
||||
|
||||
NDIS_DbgPrint
|
||||
(MID_TRACE,
|
||||
("XXX (%x) %x %x %x %x %x %x %x XXX\n",
|
||||
*AdapterBinding->ProtocolBinding->Chars.u4.ReceiveHandler,
|
||||
AdapterBinding->NdisOpenBlock.ProtocolBindingContext,
|
||||
MacReceiveContext,
|
||||
HeaderBuffer,
|
||||
HeaderBufferSize,
|
||||
LookaheadBuffer,
|
||||
LookaheadBufferSize,
|
||||
PacketSize));
|
||||
|
||||
/* call the receive handler */
|
||||
(*AdapterBinding->ProtocolBinding->Chars.u4.ReceiveHandler)(
|
||||
AdapterBinding->NdisOpenBlock.ProtocolBindingContext,
|
||||
|
@ -353,7 +373,7 @@ MiniEthReceiveComplete(
|
|||
|
||||
VOID STDCALL
|
||||
MiniEthReceiveIndication(
|
||||
IN PETH_FILTER Filter, /* shouldn't be NDIS_HANDLE? */
|
||||
IN NDIS_HANDLE MiniportAdapter,
|
||||
IN NDIS_HANDLE MacReceiveContext,
|
||||
IN PCHAR Address,
|
||||
IN PVOID HeaderBuffer,
|
||||
|
@ -364,7 +384,7 @@ MiniEthReceiveIndication(
|
|||
/*
|
||||
* FUNCTION: Receive indication function for Ethernet devices
|
||||
* ARGUMENTS:
|
||||
* Filter = Pointer to Ethernet filter
|
||||
* MiniportAdapter = Miniport Adapter Handle (PLOGICAL_ADAPTER)
|
||||
* MacReceiveContext = MAC receive context handle
|
||||
* Address = Pointer to destination Ethernet address
|
||||
* HeaderBuffer = Pointer to Ethernet header buffer
|
||||
|
@ -374,15 +394,13 @@ MiniEthReceiveIndication(
|
|||
* PacketSize = Total size of received packet
|
||||
*/
|
||||
{
|
||||
if( Filter ) {
|
||||
MiniIndicateData((PLOGICAL_ADAPTER)Filter->Miniport,
|
||||
MacReceiveContext,
|
||||
HeaderBuffer,
|
||||
HeaderBufferSize,
|
||||
LookaheadBuffer,
|
||||
LookaheadBufferSize,
|
||||
PacketSize);
|
||||
}
|
||||
MiniIndicateData(MiniportAdapter,
|
||||
MacReceiveContext,
|
||||
HeaderBuffer,
|
||||
HeaderBufferSize,
|
||||
LookaheadBuffer,
|
||||
LookaheadBufferSize,
|
||||
PacketSize);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -4452,7 +4452,7 @@ typedef VOID
|
|||
|
||||
typedef VOID
|
||||
(STDCALL *ETH_RCV_INDICATE_HANDLER)(
|
||||
IN PETH_FILTER Filter,
|
||||
IN NDIS_HANDLE MiniportAdapter,
|
||||
IN NDIS_HANDLE MacReceiveContext,
|
||||
IN PCHAR Address,
|
||||
IN PVOID HeaderBuffer,
|
||||
|
@ -4986,7 +4986,7 @@ NdisMDeregisterIoPortRange(
|
|||
PacketSize) \
|
||||
{ \
|
||||
(*((PNDIS_MINIPORT_BLOCK)(MiniportAdapterHandle))->EthRxIndicateHandler)( \
|
||||
(((PNDIS_MINIPORT_BLOCK)(MiniportAdapterHandle))->FilterDbs.u.EthDB), \
|
||||
(MiniportAdapterHandle), \
|
||||
(MiniportReceiveContext), \
|
||||
(HeaderBuffer), \
|
||||
(HeaderBuffer), \
|
||||
|
|
Loading…
Reference in a new issue