Author: tfaber
Date: Sat Feb 11 23:13:45 2017
New Revision: 73779
URL:
http://svn.reactos.org/svn/reactos?rev=73779&view=rev
Log:
[IP]
- Handle chained pbuf structures in TCPSendDataCallback
CORE-10715
Modified:
trunk/reactos/sdk/lib/drivers/ip/transport/tcp/if.c
Modified: trunk/reactos/sdk/lib/drivers/ip/transport/tcp/if.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/sdk/lib/drivers/ip/transpo…
==============================================================================
--- trunk/reactos/sdk/lib/drivers/ip/transport/tcp/if.c [iso-8859-1] (original)
+++ trunk/reactos/sdk/lib/drivers/ip/transport/tcp/if.c [iso-8859-1] Sat Feb 11 23:13:45
2017
@@ -15,6 +15,8 @@
IP_PACKET Packet;
IP_ADDRESS RemoteAddress, LocalAddress;
PIPv4_HEADER Header;
+ ULONG Length;
+ ULONG TotalLength;
/* The caller frees the pbuf struct */
@@ -39,7 +41,7 @@
{
return ERR_RTE;
}
-
+
NdisStatus = AllocatePacketWithBuffer(&Packet.NdisPacket, NULL, p->tot_len);
if (NdisStatus != NDIS_STATUS_SUCCESS)
{
@@ -49,19 +51,22 @@
GetDataPtr(Packet.NdisPacket, 0, (PCHAR*)&Packet.Header, &Packet.TotalSize);
Packet.MappedHeader = TRUE;
- if (p->tot_len != p->len ||
- Packet.TotalSize != p->len)
+ ASSERT(Packet.TotalSize == p->tot_len);
+
+ TotalLength = p->tot_len;
+ Length = 0;
+ while (Length < TotalLength)
{
- DbgPrint("TCPSendDataCallback: tot_len = %u, len = %u, TotalSize =
%u\n",
- p->tot_len, p->len, Packet.TotalSize);
- ASSERT(p->tot_len == p->len);
- ASSERT(Packet.TotalSize == p->len);
+ ASSERT(p->len <= TotalLength - Length);
+ ASSERT(p->tot_len == TotalLength - Length);
+ RtlCopyMemory((PCHAR)Packet.Header + Length, p->payload, p->len);
+ Length += p->len;
+ p = p->next;
}
-
- RtlCopyMemory(Packet.Header, p->payload, p->len);
+ ASSERT(Length == TotalLength);
Packet.HeaderSize = sizeof(IPv4_HEADER);
- Packet.TotalSize = p->tot_len;
+ Packet.TotalSize = TotalLength;
Packet.SrcAddr = LocalAddress;
Packet.DstAddr = RemoteAddress;
@@ -77,9 +82,9 @@
{
#if 0
ULONG OperationalStatus;
-
+
GetInterfaceConnectionStatus(IF, &OperationalStatus);
-
+
if (OperationalStatus == MIB_IF_OPER_STATUS_OPERATIONAL)
netif_set_link_up(IF->TCPContext);
else