Subject: Re: A question about the IP header checksum
To: None <jonathan@dsg.stanford.edu, patrick@klos.com>
From: None <patrick@klos.com>
List: tech-net
Date: 12/05/2007 16:53:29
>In message <200712052052.lB5KqSd9028342@sage.klos.com>,
>patrick@klos.com writes:
>
>>Hello IP Gurus,
>>
>>I have a question about the IP header checksum that I'm looking for a
>>definitive answer for.  I'm pretty sure I have the answer, but if anyone 
>>can help me substantiate my answer, it would really help.
>>
>>The IP header checksum is pretty straightforward: add up all the (2 byte)
>>words in the IP header using one's complement addition, then take the one's
>>complement of the sum and insert that as the checksum.  Here's the question:
>>
>>    Is it proper to substitute a resulting value of 0x0000 with 0xffff as 
>>    is done in UDP?
>
>Long verbose answer:
>
>It's not *im*proper to do that, since 1's complement arithmetic, zero
>is a signed value. There are two zero values. 0xFFFF is -0, and 0x0000
>is +0.  But I don't see any good or compelling reason to do so.
>The, er, "very controversial" [rfc-1122, sec 4.1.3.4] mechanism
>whereby a UDP sender indicates "sender did not compute a UDP checksum"
>are applicable only to UDP.
>
>Indeed, rfc-1122 notes that UDP receiver who has received a UDP packet
>with a nonzero UDP checksum doesn't need to take any special action
>(with regard to verifying the received checksum) with regard to -0 and
>+0; they are equivalent.

Thanks for responding.  That is consistant with the other responses and
what I'm finding by poking around some other relevant RFCs.

>May I ask: why would you want to make this 0x0000 -> 0xffff
>substituion for an IP header checksum?

Sure, you can ask.  It's not that *I* want to make such a substitution.
It came up because a customer ran across a packet that implemented the IP 
checksum this way, and my customer was concerned that our product flagged
that packet as having an incorrect checksum.  Now that we've investigated the
topic, I have to accept that either form of the value should be accepted in
the IP header checksum field.

Patrick
========= For LAN/WAN Protocol Analysis, check out PacketView Pro! =========
    Patrick Klos                           Email: patrick@klos.com
    Network/Embedded Software Engineer     Web:   http://www.klos.com/
    Klos Technologies, Inc.                Phone: 603-714-0195
============================================================================