Author: cgutman
Date: Sat Jan 9 17:25:11 2010
New Revision: 45016
URL:
http://svn.reactos.org/svn/reactos?rev=45016&view=rev
Log:
- Unlock the address file before calling IPSendDatagram
- We don't need to be locked anymore at that point and it also causes problems with
loopback packets
- Use the TTL value stored in the address file for ICMP packets
Modified:
branches/aicom-network-branch/lib/drivers/ip/network/icmp.c
branches/aicom-network-branch/lib/drivers/ip/transport/rawip/rawip.c
branches/aicom-network-branch/lib/drivers/ip/transport/udp/udp.c
Modified: branches/aicom-network-branch/lib/drivers/ip/network/icmp.c
URL:
http://svn.reactos.org/svn/reactos/branches/aicom-network-branch/lib/driver…
==============================================================================
--- branches/aicom-network-branch/lib/drivers/ip/network/icmp.c [iso-8859-1] (original)
+++ branches/aicom-network-branch/lib/drivers/ip/network/icmp.c [iso-8859-1] Sat Jan 9
17:25:11 2010
@@ -48,6 +48,7 @@
BOOLEAN PrepareICMPPacket(
+ PADDRESS_FILE AddrFile,
PIP_INTERFACE Interface,
PIP_PACKET IPPacket,
PIP_ADDRESS Destination,
@@ -114,8 +115,11 @@
IPHeader->Id = (USHORT)Random();
/* One fragment at offset 0 */
IPHeader->FlagsFragOfs = 0;
- /* Time-to-Live is 128 */
- IPHeader->Ttl = 128;
+ /* Set TTL */
+ if (AddrFile)
+ IPHeader->Ttl = AddrFile->TTL;
+ else
+ IPHeader->Ttl = 128;
/* Internet Control Message Protocol */
IPHeader->Protocol = IPPROTO_ICMP;
/* Checksum is 0 (for later calculation of this) */
@@ -205,30 +209,27 @@
}
}
- Status = PrepareICMPPacket( NCE->Interface,
+ Status = PrepareICMPPacket( AddrFile,
+ NCE->Interface,
&Packet,
&RemoteAddress,
BufferData,
DataSize );
+ UnlockObject(AddrFile, OldIrql);
+
if( !NT_SUCCESS(Status) )
- {
- UnlockObject(AddrFile, OldIrql);
return Status;
- }
TI_DbgPrint(MID_TRACE,("About to send datagram\n"));
if (!NT_SUCCESS(Status = IPSendDatagram( &Packet, NCE, ICMPSendPacketComplete,
NULL )))
{
- UnlockObject(AddrFile, OldIrql);
FreeNdisPacket(Packet.NdisPacket);
return Status;
}
TI_DbgPrint(MID_TRACE,("Leaving\n"));
-
- UnlockObject(AddrFile, OldIrql);
return STATUS_SUCCESS;
}
@@ -352,7 +353,7 @@
DataSize = IPPacket->TotalSize - IPPacket->HeaderSize;
- if( !PrepareICMPPacket(Interface, &NewPacket, &IPPacket->SrcAddr,
+ if( !PrepareICMPPacket(NULL, Interface, &NewPacket, &IPPacket->SrcAddr,
IPPacket->Data, DataSize) ) return;
((PICMP_HEADER)NewPacket.Data)->Type = Type;
Modified: branches/aicom-network-branch/lib/drivers/ip/transport/rawip/rawip.c
URL:
http://svn.reactos.org/svn/reactos/branches/aicom-network-branch/lib/driver…
==============================================================================
--- branches/aicom-network-branch/lib/drivers/ip/transport/rawip/rawip.c [iso-8859-1]
(original)
+++ branches/aicom-network-branch/lib/drivers/ip/transport/rawip/rawip.c [iso-8859-1] Sat
Jan 9 17:25:11 2010
@@ -249,24 +249,20 @@
BufferData,
DataSize );
+ UnlockObject(AddrFile, OldIrql);
+
if( !NT_SUCCESS(Status) )
- {
- UnlockObject(AddrFile, OldIrql);
return Status;
- }
TI_DbgPrint(MID_TRACE,("About to send datagram\n"));
if (!NT_SUCCESS(Status = IPSendDatagram( &Packet, NCE, RawIpSendPacketComplete,
NULL )))
{
- UnlockObject(AddrFile, OldIrql);
FreeNdisPacket(Packet.NdisPacket);
return Status;
}
TI_DbgPrint(MID_TRACE,("Leaving\n"));
-
- UnlockObject(AddrFile, OldIrql);
return STATUS_SUCCESS;
}
Modified: branches/aicom-network-branch/lib/drivers/ip/transport/udp/udp.c
URL:
http://svn.reactos.org/svn/reactos/branches/aicom-network-branch/lib/driver…
==============================================================================
--- branches/aicom-network-branch/lib/drivers/ip/transport/udp/udp.c [iso-8859-1]
(original)
+++ branches/aicom-network-branch/lib/drivers/ip/transport/udp/udp.c [iso-8859-1] Sat Jan
9 17:25:11 2010
@@ -224,20 +224,16 @@
BufferData,
DataSize );
+ UnlockObject(AddrFile, OldIrql);
+
if( !NT_SUCCESS(Status) )
- {
- UnlockObject(AddrFile, OldIrql);
return Status;
- }
if (!NT_SUCCESS(Status = IPSendDatagram( &Packet, NCE, UDPSendPacketComplete,
NULL )))
{
- UnlockObject(AddrFile, OldIrql);
FreeNdisPacket(Packet.NdisPacket);
return Status;
}
-
- UnlockObject(AddrFile, OldIrql);
return STATUS_SUCCESS;
}