From: John Hodge Date: Fri, 23 Mar 2012 04:04:28 +0000 (+0800) Subject: IPStack - Fixed bug in ping code X-Git-Tag: rel0.15~722 X-Git-Url: https://git.ucc.asn.au/?a=commitdiff_plain;h=adbc1540ed20292d7f8be392483f7c15cb0d8e31;p=tpg%2Facess2.git IPStack - Fixed bug in ping code --- diff --git a/KernelLand/Modules/IPStack/icmp.c b/KernelLand/Modules/IPStack/icmp.c index f1355fa6..80974ef1 100644 --- a/KernelLand/Modules/IPStack/icmp.c +++ b/KernelLand/Modules/IPStack/icmp.c @@ -121,7 +121,7 @@ int ICMP_Ping(tInterface *Interface, tIPv4 Addr) gICMP_PingSlots[i].bArrived = 0; hdr->ID = i; hdr->Sequence = ~i; - hdr->Checksum = htons( IPv4_Checksum((Uint16*)hdr, sizeof(buf)/2) ); + hdr->Checksum = htons( IPv4_Checksum((Uint16*)buf, sizeof(buf)) ); ts = now(); @@ -133,7 +133,7 @@ int ICMP_Ping(tInterface *Interface, tIPv4 Addr) end = ts + Interface->TimeoutDelay; while( !gICMP_PingSlots[i].bArrived && now() < end) Threads_Yield(); - if(now() > end) + if(now() >= end) return -1; return (int)( now() - ts );