Author: cgutman Date: Sun Oct 25 05:30:28 2009 New Revision: 43732
URL: http://svn.reactos.org/svn/reactos?rev=43732&view=rev Log: - Fix sending malformed ICMP packets because we read the wrong length from the wrong address in the buffer - Fix the sequence number stored in the packet - Fix potential null pointer freeing - tracert partially works now (Setting TTL isn't implemented yet)
Modified: trunk/reactos/base/applications/network/tracert/tracert.c trunk/reactos/base/applications/network/tracert/tracert.h
Modified: trunk/reactos/base/applications/network/tracert/tracert.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/network/t... ============================================================================== --- trunk/reactos/base/applications/network/tracert/tracert.c [iso-8859-1] (original) +++ trunk/reactos/base/applications/network/tracert/tracert.c [iso-8859-1] Sun Oct 25 05:30:28 2009 @@ -260,10 +260,10 @@ pInfo->SendPacket->icmpheader.code = 0; pInfo->SendPacket->icmpheader.checksum = 0; pInfo->SendPacket->icmpheader.id = (USHORT)GetCurrentProcessId(); - pInfo->SendPacket->icmpheader.seq = iSeqNum; + pInfo->SendPacket->icmpheader.seq = htons((USHORT)iSeqNum);
/* calculate checksum of packet */ - pInfo->SendPacket->icmpheader.checksum = CheckSum((PUSHORT)&pInfo->SendPacket, + pInfo->SendPacket->icmpheader.checksum = CheckSum((PUSHORT)&pInfo->SendPacket->icmpheader, sizeof(ICMP_HEADER) + PACKET_SIZE); }
@@ -279,8 +279,8 @@ pInfo->lTimeStart = GetTime(pInfo);
iSockRet = sendto(pInfo->icmpSock, //socket - (char *)pInfo->SendPacket, //buffer - PACKET_SIZE, //size of buffer + (char *)&pInfo->SendPacket->icmpheader,//buffer + sizeof(ICMP_HEADER) + PACKET_SIZE,//size of buffer 0, //flags (SOCKADDR *)&pInfo->dest, //destination sizeof(pInfo->dest)); //address length @@ -598,7 +598,7 @@ 0, pInfo->SendPacket);
- if (pInfo->SendPacket) + if (pInfo->RecvPacket) HeapFree(GetProcessHeap(), 0, pInfo->RecvPacket);
Modified: trunk/reactos/base/applications/network/tracert/tracert.h URL: http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/network/t... ============================================================================== --- trunk/reactos/base/applications/network/tracert/tracert.h [iso-8859-1] (original) +++ trunk/reactos/base/applications/network/tracert/tracert.h [iso-8859-1] Sun Oct 25 05:30:28 2009 @@ -13,7 +13,7 @@ #define TTL_EXCEEDED 11
#define MAX_PING_PACKET_SIZE 1024 -#define MAX_PING_DATA_SIZE (MAX_PING_PACKET_SIZE + sizeof(IPv4Header) +#define MAX_PING_DATA_SIZE (MAX_PING_PACKET_SIZE + sizeof(IPv4Header)) #define PACKET_SIZE 32 #define ICMP_MIN_SIZE 8
@@ -53,8 +53,8 @@ /* ICMP Echo Reply Header, 12 bytes */ typedef struct EchoReplyHeader { + struct timeval timestamp; struct ICMPHeader icmpheader; - struct timeval timestamp; } ECHO_REPLY_HEADER, *PECHO_REPLY_HEADER;
/* ICMP Echo Reply Header, 12 bytes */