X-Git-Url: https://git.ucc.asn.au/?a=blobdiff_plain;f=Modules%2FIPStack%2Ficmp.c;h=16037199173abb974df8cae419ab4b5b41f0c917;hb=58c7107eb0a5ae254c135f2eaa6263751f1ebe67;hp=969a1fa9176fcb45bd2919de47d2b1a1547749c8;hpb=abe6c6cf7fac39102e20cd28687b24c67f4952f8;p=tpg%2Facess2.git diff --git a/Modules/IPStack/icmp.c b/Modules/IPStack/icmp.c index 969a1fa9..16037199 100644 --- a/Modules/IPStack/icmp.c +++ b/Modules/IPStack/icmp.c @@ -81,7 +81,7 @@ void ICMP_GetPacket(tInterface *Interface, void *Address, int Length, void *Buff //Log_Debug("ICMPv4", "Replying"); hdr->Type = ICMP_ECHOREPLY; hdr->Checksum = 0; - hdr->Checksum = htons( IPv4_Checksum(hdr, Length) ); + hdr->Checksum = htons( IPv4_Checksum( (Uint16*)hdr, Length/2 ) ); //Log_Debug("ICMPv4", "Checksum = 0x%04x", hdr->Checksum); IPv4_SendPacket(Interface, *(tIPv4*)Address, 1, ntohs(hdr->Sequence), Length, hdr); break; @@ -117,7 +117,7 @@ int ICMP_Ping(tInterface *Interface, tIPv4 Addr) gICMP_PingSlots[i].bArrived = 0; hdr->ID = i; hdr->Sequence = ~i; - hdr->Checksum = htons( IPv4_Checksum(hdr, sizeof(buf)) ); + hdr->Checksum = htons( IPv4_Checksum((Uint16*)hdr, sizeof(buf)/2) ); ts = now(); @@ -129,5 +129,5 @@ int ICMP_Ping(tInterface *Interface, tIPv4 Addr) if(now() > end) return -1; - return (int)ts; + return (int)( now() - ts ); }