Subject: Re: UDP checksum trouble in -current
To: None <tech-net@netbsd.org>
From: William Allen Simpson <wsimpson@greendragon.com>
List: tech-net
Date: 01/22/2005 00:37:58
Miles Nordin wrote:

>   was> Both IP and TCP checksums MUST be performed.
>
>uh, yeah, pull the handle and the RFC talks, but this is on the
>loopback interface.  What are you checking for, memory corruption?
>
>  
>
Memory corruption has been known to occur in systems....  As has bad
system interface code.

Who can trust that the data going over the backplane pins is always
correct?  I assure you, at times it isn't!  That's why we have parity
or ECC memory, too.  Just one error in a billion billion means you
have an error every few minutes as everything speeds up. 

Hard to detect when not checking.

>As long as checksums are verified for packets that arrive on a real
>interface but are destined to a loopback alias, I don't see the big
>deal either way.
>  
>
Thus speaks somebody who probably doesn't check for valid pointers and
buffer overruns, either, and especially trusts their own code.

The fact that an ethernet FCS is good on a "real" interface does not
ensure that the packet is good at all.

Once upon a time, I've written code that checked the parity of each
byte coming in an interface, and the FCS of the packet, and the
checksum of the IP header and the checksum of the TCP or UDP data,
and then the checksum of the same data after it was spooled to disk,
just to ensure it matched what came in the interface. 

(Admittedly in the days when minis such as the HP-21MX and LSI-11 or
micros such as the Z80 and 8088 couldn't be trusted to time their own
memory and IO fetches correctly, and dropped things on the floor on a
regular basis.  Things are a little better now, but why should we
depend on it?)

I assume my own code has bugs I need to catch.  And I believe that
everybody else's is probably worse.  Some people call that arrogant,
but so be it.  I call that careful.  And that's why RFCs were written
the way they were written.

Moreover, this thread started because somebody special-cased loopback,
but the packets are then sent _out_ a "real" interface....

-- 
William Allen Simpson
    Key fingerprint =  17 40 5E 67 15 6F 31 26  DD 0D B9 9B 6A 15 2C 32