In article <1178093809.545231.302190@h2g2000hsg.googlegroups. com>,
khsharpy@gmail.com wrote:
> Hello!
>
> I'm confused about UDP checksum when being disabled.
>
> The book, "Data communication and Networking, 4th edition, Forouzan",
> said
> --->
> "If the checksum is not calculated, the field is filled with 1s. Note
> that a calculated checksum can never be all 1s because this implies
> that the sum is all 0s, which is impossible because it requires that
> the value of fields to be 0s..." , p.712
>
> When UDP checksum disabled, the field is filled with 0xFFFF.
>
> I think this is logically right!! If the checksum field to be all 1s,
> the sum of all field must be 0, which means, all fields must be 0.
> Impossible...
>
>
> But!!
>
> the rfc768.txt said
> --->
> "If the computed checksum is zero, it is transmitted as all ones (the
> equivalent in one's complement arithmetic). An all zero transmitted
> checksum value means that the transmitter generated no checksum (for
> debugging or for higher level protocols that don't care). "
>
> When UDP checksum disabled, the filed is filled with 0x0000
>
> Two documents say oppositely each other.
>
> Which of them is right??
The RFC is correct. RFC 1122 restates it:
IMPLEMENTATION:
There is a common implementation error in UDP
checksums. Unlike the TCP checksum, the UDP checksum
is optional; the value zero is transmitted in the
checksum field of a UDP header to indicate the absence
of a checksum. If the transmitter really calculates a
UDP checksum of zero, it must transmit the checksum as
all 1's (65535). No special action is required at the
receiver, since zero and 65535 are equivalent in 1's
complement arithmetic.
>
>
> If as above, Normally computed checksum field value could be 0. but it
> would be considered as "disabled mode"....
>
> I think the book DCN is right. because considering the way of checkum
> calculation, it is logically right.
>
> but RFC!!
>
>
> Maybe the checksum's meanning of the RFC sentences, the one before 1's
> complement computation???
When the RFC says "the computed checksum", it refers to the final value
AFTER performing the one's complement of the sum of all the bytes. So
if the ordinary sum is 0xffff, the computed checksum will be 0x0000.
The RFC then says that this should be transmitted as 0xffff. There's no
ambiguity because the ordinary sum can never be 0x0000.
--
Barry Margolin,
barmar@alum.mit.edu
Arlington, MA
*** PLEASE post questions in newsgroups, not directly to me ***
*** PLEASE don't copy me on replies, I'll read them in the group ***