IP header checksum question - TCP-IP

This is a discussion on IP header checksum question - TCP-IP ; 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. ...

+ Reply to Thread
Results 1 to 6 of 6

Thread: IP header checksum question

  1. IP header checksum question

    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
    Klos Technologies, Inc.


  2. Re: IP header checksum question

    In article ,
    Patrick Klos wrote:
    >Hello IP Gurus,


    [I'm responding to my own post - I've received a fair amount of replies on
    the NetBSD tech-net mailing list]

    >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?


    While it looks odd, there is nothing mathematically wrong with using one
    value in place of the other. They both result in a correct final checksum
    thanks to one's complement math.

    Feel free to chime in with more info if you like - I just wanted to update
    my post with what I've learned so far.

    Patrick Klos
    Klos Technologies, Inc.


  3. Re: IP header checksum question

    pklos@osmium.mv.net (Patrick Klos) wrote:
    >> Is it proper to substitute a resulting value of 0x0000 with 0xffff
    >> as is done in UDP?

    >
    > While it looks odd, there is nothing mathematically wrong with using
    > one value in place of the other. They both result in a correct final
    > checksum thanks to one's complement math.


    According to RFC 768, placing zero in the checksum field of a UDP datagram
    is intended to signal that the checksum was not computed by the
    transmitting side. So although mathematically they both represent zero, one
    of the values is used as a flag mechanism.

    (I'm among those who programmed in assembly language on one's complement
    machines several decades ago - in my case I wrote programs for the CDC
    6400.)

  4. Re: IP header checksum question

    In article ,
    Jim Logajan wrote:
    >pklos@osmium.mv.net (Patrick Klos) wrote:
    >>> Is it proper to substitute a resulting value of 0x0000 with 0xffff
    >>> as is done in UDP?

    >>
    >> While it looks odd, there is nothing mathematically wrong with using
    >> one value in place of the other. They both result in a correct final
    >> checksum thanks to one's complement math.

    >
    >According to RFC 768, placing zero in the checksum field of a UDP datagram
    >is intended to signal that the checksum was not computed by the
    >transmitting side. So although mathematically they both represent zero, one
    >of the values is used as a flag mechanism.


    Yes, but that ONLY applies to UDP. That exception was noted in my
    original post which asked about the checksum for IP headers.

    >(I'm among those who programmed in assembly language on one's complement
    >machines several decades ago - in my case I wrote programs for the CDC
    >6400.)


    Yeah, I did some work on the Univac 1180 many (many) moons ago. Those were
    the days... writing assembler code on punch cards... and a good time was
    had by all! )

    Patrick
    ========= For LAN/WAN Protocol Analysis, check out PacketView Pro! =========
    Patrick Klos Email: patrick@klos.com
    Klos Technologies, Inc. Web: http://www.klos.com/
    ================================================== ==========================

  5. Re: IP header checksum question

    pklos@osmium.mv.net (Patrick Klos) wrote:
    > Yes, but that ONLY applies to UDP. That exception was noted in my
    > original post which asked about the checksum for IP headers.


    Ah - my mistake. I didn't go far enough back in the thread and failed to
    read your subsequent post carefully.

    As to the original question - as far as I can tell, nothing in the
    standards appear to disallow it, so it could be done. But I would say that
    it is probably neither useful nor appropriate to do that substitution. As
    you probably are aware, no less than three RFCs, RFC 1071, 1141, and 1624
    were published about computing checksums and incremental checksums (with
    the last two attempting to expand on and/or correct the previous RFC).

  6. Re: IP header checksum question

    Somebody please let me know whether the below formula specfieid in RFC 1624 can be used for incremental update method ??

    ~(~HC + ~m + m')

    Can i use the same method if i have changes in TTL and teh IP address field also ??

    like this

    ~(~HC + ~old_ttl + new_ttl + ~old_dst_address + new_dst _address)

    or how can i calculate the checksum using this method when there is change in more than 1 field

+ Reply to Thread