From adbc1540ed20292d7f8be392483f7c15cb0d8e31 Mon Sep 17 00:00:00 2001 From: John Hodge Date: Fri, 23 Mar 2012 12:04:28 +0800 Subject: [PATCH] IPStack - Fixed bug in ping code --- KernelLand/Modules/IPStack/icmp.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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 ); -- 2.20.1