Subject: A question about the IP header checksum
To: None <tech-net@netbsd.org>
From: None <patrick@klos.com>
List: tech-net
Date: 12/05/2007 12:52:28
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?

UDP explicitly defines 0x0000 as "checksum disabled", and so specifies that
a computed result of 0x0000 should be replaced with 0xffff.  TCP and IP do 
not state anything more than "take the one's complement of the one's 
complement sum of the words...".  

What do you think?

Thanks,

Patrick Klos
========= 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
============================================================================