X-Git-Url: https://git.ucc.asn.au/?a=blobdiff_plain;f=Modules%2FIPStack%2Fipv4.c;h=6c387cc173e0e6b48a78854e335af096acaaa559;hb=f903bcea88df0cf2e12583ae74e35c4bfb6760bf;hp=b77581eb0939c80c5e737385b7d10af947d0651c;hpb=461ede932582098035c9b1360f9fb40524d4af34;p=tpg%2Facess2.git diff --git a/Modules/IPStack/ipv4.c b/Modules/IPStack/ipv4.c index b77581eb..6c387cc1 100644 --- a/Modules/IPStack/ipv4.c +++ b/Modules/IPStack/ipv4.c @@ -317,12 +317,15 @@ Uint16 IPv4_Checksum(const void *Buf, int Size) const Uint16 *arr = Buf; int i; - Size = (Size + 1) >> 1; // 16-bit word count - for(i = 0; i < Size; i++ ) + // Sum all whole words + for(i = 0; i < Size/2; i++ ) { Uint16 val = ntohs(arr[i]); sum += val; } + // Add the tail word +// if( i*2 != Size ) +// sum += arr[i]&0xFF; // Apply one's complement while (sum >> 16)