IPStack - Fixed TCP checksuming
[tpg/acess2.git] / Modules / IPStack / ipv4.c
index a2e63ef..6c387cc 100644 (file)
@@ -208,7 +208,7 @@ void IPv4_int_GetPacket(tAdapter *Adapter, tMacAddr From, int Length, void *Buff
                break ;
        // Unknown, silent drop
        default:
-               Log_Warning("IPv4", "Unknown firewall response %i", ret);
+               Log_Warning("IPv4", "Unknown firewall rule");
                return ;
        }
        
@@ -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)

UCC git Repository :: git.ucc.asn.au