mirror of
https://github.com/reactos/reactos.git
synced 2025-06-27 21:49:42 +00:00
- Fix ECHO_REPLY_HEADER which was corrupting incoming packets (fixes displaying reply time)
- Fix a bug in the packet waiting code - Display the IP address if getnameinfo fails - tracert is actually useful now svn path=/branches/aicom-network-branch/; revision=45094
This commit is contained in:
parent
3f6a56fa36
commit
58f686f670
2 changed files with 5 additions and 23 deletions
|
@ -377,7 +377,6 @@ DecodeResponse(PAPPINFO pInfo)
|
|||
|
||||
/* cast the recieved packet into an ECHO reply and a TTL Exceed and check the ID*/
|
||||
ECHO_REPLY_HEADER *IcmpHdr = (ECHO_REPLY_HEADER *)((char*)pInfo->RecvPacket + header_len);
|
||||
TTL_EXCEED_HEADER *TTLExceedHdr = (TTL_EXCEED_HEADER *)((char *)pInfo->RecvPacket + header_len);
|
||||
|
||||
/* Make sure the reply is ok */
|
||||
if (PACKET_SIZE < header_len + ICMP_MIN_SIZE)
|
||||
|
@ -389,13 +388,6 @@ DecodeResponse(PAPPINFO pInfo)
|
|||
switch (IcmpHdr->icmpheader.type)
|
||||
{
|
||||
case TTL_EXCEEDED :
|
||||
if (TTLExceedHdr->OrigIcmpHeader.id != (USHORT)GetCurrentProcessId())
|
||||
{
|
||||
/* FIXME: our network stack shouldn't allow this... */
|
||||
/* we've picked up a packet not related to this process probably from another local program. We ignore it */
|
||||
DebugPrint(_T("Rouge packet: header id, process id %d"), TTLExceedHdr->OrigIcmpHeader.id, GetCurrentProcessId());
|
||||
return -1;
|
||||
}
|
||||
_tprintf(_T("%3ld ms"), (ULONG)((pInfo->lTimeEnd - pInfo->lTimeStart) / pInfo->TicksPerMs.QuadPart));
|
||||
return 0;
|
||||
|
||||
|
@ -415,7 +407,7 @@ DecodeResponse(PAPPINFO pInfo)
|
|||
return 2;
|
||||
}
|
||||
|
||||
return 0;
|
||||
return -3;
|
||||
}
|
||||
|
||||
|
||||
|
@ -513,11 +505,9 @@ Driver(PAPPINFO pInfo)
|
|||
|
||||
if (iRecieveReturn)
|
||||
{
|
||||
DecodeResponse(pInfo);
|
||||
if (DecodeResponse(pInfo) < 0)
|
||||
bAwaitPacket = TRUE;
|
||||
}
|
||||
else
|
||||
/* packet timed out. Don't wait for it again */
|
||||
bAwaitPacket = FALSE;
|
||||
|
||||
} while (bAwaitPacket);
|
||||
}
|
||||
|
@ -559,6 +549,7 @@ Driver(PAPPINFO pInfo)
|
|||
{
|
||||
DebugPrint(_T("error: %d"), WSAGetLastError());
|
||||
DebugPrint(_T(" getnameinfo failed: %d"), iNameInfoRet);
|
||||
_tprintf(_T("%s"), inet_ntoa(pInfo->source.sin_addr));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -50,21 +50,12 @@ typedef struct ICMPHeader
|
|||
USHORT seq; // not used in time exceeded
|
||||
} ICMP_HEADER, *PICMP_HEADER;
|
||||
|
||||
/* ICMP Echo Reply Header, 12 bytes */
|
||||
/* ICMP Echo Reply Header */
|
||||
typedef struct EchoReplyHeader
|
||||
{
|
||||
struct timeval timestamp;
|
||||
struct ICMPHeader icmpheader;
|
||||
} ECHO_REPLY_HEADER, *PECHO_REPLY_HEADER;
|
||||
|
||||
/* ICMP Echo Reply Header, 12 bytes */
|
||||
typedef struct TTLExceedHeader
|
||||
{
|
||||
struct ICMPHeader icmpheader;
|
||||
struct IPv4Header ipheader;
|
||||
struct ICMPHeader OrigIcmpHeader;
|
||||
} TTL_EXCEED_HEADER, *PTTL_EXCEED_HEADER;
|
||||
|
||||
#include <poppack.h>
|
||||
|
||||
typedef struct _APPINFO
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue