Author: cgutman
Date: Mon Jul 20 21:46:54 2009
New Revision: 42104
URL:
http://svn.reactos.org/svn/reactos?rev=42104&view=rev
Log:
- Update TotalLength based on the fragment size
- Make fragment offset into 8-byte units
- Don't perform a useless checksum calculation
- Fixes datagram fragmentation (tested using ping with a packet size of 16000)
- This also seems to fix DHCP over a bridged NIC in vbox
Modified:
trunk/reactos/lib/drivers/ip/network/transmit.c
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] Mon Jul 20 21:46:54 2009
@@ -114,14 +114,17 @@
RtlCopyMemory(IFC->Data, IFC->DatagramData, DataSize); // SAFE
- FragOfs = (USHORT)IFC->Position; // Swap?
+ /* Fragment offset is in 8 byte blocks */
+ FragOfs = (USHORT)(IFC->Position / 8);
+
if (MoreFragments)
FragOfs |= IPv4_MF_MASK;
else
FragOfs &= ~IPv4_MF_MASK;
Header = IFC->Header;
- Header->FlagsFragOfs = FragOfs;
+ Header->FlagsFragOfs = WH2N(FragOfs);
+ Header->TotalLength = WH2N((USHORT)(DataSize + IFC->HeaderSize));
/* FIXME: Handle options */
@@ -250,22 +253,6 @@
/* Fetch path MTU now, because it may change */
TI_DbgPrint(MID_TRACE,("PathMTU: %d\n", NCE->Interface->MTU));
- if ((IPPacket->Flags & IP_PACKET_FLAG_RAW) == 0) {
- /* Calculate checksum of IP header */
- TI_DbgPrint(MID_TRACE,("-> not IP_PACKET_FLAG_RAW\n"));
- ((PIPv4_HEADER)IPPacket->Header)->Checksum = 0;
-
- ((PIPv4_HEADER)IPPacket->Header)->Checksum = (USHORT)
- IPv4Checksum(IPPacket->Header, IPPacket->HeaderSize, 0);
- TI_DbgPrint(MID_TRACE,("IP Check: %x\n",
((PIPv4_HEADER)IPPacket->Header)->Checksum));
-
- TI_DbgPrint(MAX_TRACE, ("Sending packet (length is %d).\n",
- WN2H(((PIPv4_HEADER)IPPacket->Header)->TotalLength)));
- } else {
- TI_DbgPrint(MAX_TRACE, ("Sending raw packet (flags are 0x%X).\n",
- IPPacket->Flags));
- }
-
NdisQueryPacket(IPPacket->NdisPacket,
NULL,
NULL,