Author: cgutman
Date: Tue Oct 20 04:30:05 2009
New Revision: 43635
URL: http://svn.reactos.org/svn/reactos?rev=43635&view=rev
Log:
- Copy correct data to our lookahead buffer. It was previously missing the media header which messed up the lookahead buffer size passed to ProtocolReceive
- Fix the check for loopback indication. It was previously checking whether the source and destination packets were the same which makes no sense at all
- Correct the offset and length passed to NdisCopyFromPacketToPacket. The caller's values of these don't include the header size but the packet does
- Fixes a crash when running "ping 10.0.2.15 -l 1800" on vbox with NAT
Modified:
trunk/reactos/drivers/network/ndis/ndis/protocol.c
Modified: trunk/reactos/drivers/network/ndis/ndis/protocol.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/network/ndis/ndis/…
==============================================================================
--- trunk/reactos/drivers/network/ndis/ndis/protocol.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/network/ndis/ndis/protocol.c [iso-8859-1] Tue Oct 20 04:30:05 2009
@@ -279,7 +279,8 @@
NDIS_DbgPrint(MAX_TRACE, ("acquiring miniport block lock\n"));
KeAcquireSpinLock(&Adapter->NdisMiniportBlock.Lock, &OldIrql);
{
- BufferedLength = CopyPacketToBuffer(LookaheadBuffer, Packet, 0, Adapter->NdisMiniportBlock.CurrentLookahead);
+ BufferedLength = CopyPacketToBuffer(LookaheadBuffer, Packet, 0, Adapter->NdisMiniportBlock.CurrentLookahead +
+ Adapter->MediumHeaderSize);
Adapter->NdisMiniportBlock.IndicatedPacket[KeGetCurrentProcessorNumber()] = Packet;
}
KeReleaseSpinLock(&Adapter->NdisMiniportBlock.Lock, OldIrql);
@@ -297,6 +298,12 @@
}
ExFreePool(LookaheadBuffer);
+
+ KeAcquireSpinLock(&Adapter->NdisMiniportBlock.Lock, &OldIrql);
+ {
+ Adapter->NdisMiniportBlock.IndicatedPacket[KeGetCurrentProcessorNumber()] = NULL;
+ }
+ KeReleaseSpinLock(&Adapter->NdisMiniportBlock.Lock, OldIrql);
return NDIS_STATUS_SUCCESS;
}
@@ -649,12 +656,12 @@
/* FIXME: Interrupts must be disabled for adapter */
/* XXX sd - why is that true? */
- if (Packet == Adapter->NdisMiniportBlock.IndicatedPacket[KeGetCurrentProcessorNumber()]) {
+ if (Adapter->NdisMiniportBlock.IndicatedPacket[KeGetCurrentProcessorNumber()]) {
NDIS_DbgPrint(MAX_TRACE, ("LoopPacket\n"));
/* NDIS is responsible for looping this packet */
NdisCopyFromPacketToPacket(Packet,
- ByteOffset,
- BytesToTransfer,
+ ByteOffset + Adapter->MediumHeaderSize,
+ BytesToTransfer + Adapter->MediumHeaderSize,
Adapter->NdisMiniportBlock.IndicatedPacket[KeGetCurrentProcessorNumber()],
0,
BytesTransferred);