Wireshark-bugs: [Wireshark-bugs] [Bug 3112] CDP Checksum Calculation Incorrect
Date: Mon, 22 Dec 2008 13:14:13 -0800 (PST)
https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=3112





--- Comment #5 from Guy Harris <guy@xxxxxxxxxxxx>  2008-12-22 13:14:12 PDT ---
To quote RFC 793, which is what defines the Internet checksum:

    The checksum field is the 16 bit one's complement of the one's
    complement sum of all 16 bit words in the header and text.  If a
    segment contains an odd number of header and text octets to be
    checksummed, the last octet is padded on the right with zeros to
    form a 16 bit word for checksum purposes.  The pad is not
    transmitted as part of the segment.  While computing the checksum,
    the checksum field itself is replaced with zeros.

So, for test 7:

    test 7 data: 0xbfe29ba1 length: 1       fe
    in_cksum         65281
    WS CDP checksum  65281
    CDP checksum     511

That's a case with an odd number of octets, so it'd be padded on the right with
zeroes, giving 0xfe00.  The one's complement of that is 0x01ff, or 511.


-- 
Configure bugmail: https://bugs.wireshark.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.