David Miller <[EMAIL PROTECTED]> wrote on 11/13/2006 04:50:58 PM: > Puzzling :-) Then why is the transformation only performed for > UDP in the ipv4 stack? It seems by your logic TCP would need > to either do the "if (sum==0) sum=~0;" thing or it would need > to accept both "0" and "~0" in the checksum checking path.
That's actually what I was suggesting. In 1's-complement, ~0 == -0 which is still 0, so barring any special case (like UDP's "0 means no checksum" rule), it should be equally valid for a packet to have 0 or ~0 as the checksum (with otherwise identical data)-- they are both correct, and equal to each other. That extra 1's-complement 0 is, of course, why UDP can have the special case of remapping 0->~0. Since the patch was for output-side, it doesn't matter whether you remap 0 to ~0 or not (except for the special case), but a receiver technically should allow either. In practice, it won't matter if the machines you're talking to are remapping (or not) in the same way. But 0 and -0 (aka ~0) are still equal. :-) It obviously doesn't come up much. +-DLS - To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html