Subject: Re: A question about the IP header checksum
To: None <tech-net@NetBSD.org>
From: der Mouse <mouse@Rodents.Montreal.QC.CA>
List: tech-net
Date: 12/05/2007 19:46:24
>> [...one's complement arithmetic...0x0000...0xffff...]
> Are you suggesting that if you perform the math and the result is
> either 0x0000 of 0xffff that you need to check the header for both,
> instead of doing a simple comparison?

Well, note that the checksum is defined as the _complement of_ the sum
of the headers words.  This suggests to me that the intended design is
to just sum up the words in a received packet and check that the sum is
zero.

Depending on how you compute the sum, it's even possible to arrange
that you get only one of the two zero values.  This means that checking
sums can be done by summing and then doing a simple compare against
whichever zero value is the one your algorithm generates.

/~\ The ASCII				der Mouse
\ / Ribbon Campaign
 X  Against HTML	       mouse@rodents.montreal.qc.ca
/ \ Email!	     7D C8 61 52 5D E7 2D 39  4E F1 31 3E E8 B3 27 4B