Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 4 May 1999 13:20:54 -0400 (EDT)
From:      Brian Dean <brdean@unx.sas.com>
To:        freebsd-hackers@freebsd.org
Subject:   udp checksum overkill
Message-ID:  <199905041720.NAA22383@dean.pc.sas.com>

next in thread | raw e-mail | index | archive | help
Hi,

I've implemented my own OS and have recently added network boot
capability to it.  In the process of doing this I have implemented a
TFTP download of my kernel from my FreeBSD system.  It has been a very
enlightening experience, especially with regard to my admittedly
minimal IP stack.

My question to those in the know is why does the UDP checksum not only
cover it's own header and data, but also portions of the IP header,
i.e., the checksum is calculated over the udp pseudo header which
includes the source/dest ip addresses, the protocol, and a repeat of
the udp hdr+data length?

Steven's book (vol 1) indicates that it is there to provide a double
check that the udp layer was delivered a packet that was actually
intended for it (hence the inclusion of the ip addresses).  However,
isn't this checksum coverage redundant because IP has it's own header
checksum (which is mandatory, unlike UDP) that covers these fields.
The packet would be discarded if the IP header checksum fails, and
unless the ip layer is buggy, the udp layer would never get a packet
that was not intended for it.

Additionally, if a host has multiple interfaces, how (without more
extensive processing) can the udp layer determine (by using the
checksum which includes src/dst ip addresses) that a packet was
intended for it or not?  I.e., wouldn't the udp checksum verification
require a computation of the checksum using all possible interface
addresses installed on the system before it could say whether the
packet was delivered to it by mistake?  It seems to me that it would
be much simpler just to run down the list of interfaces and see if one
of their addresses matches the dst ip address in the packet, if not,
then discard it.

Or am I totally missing the point of the extended coverage of the
checksum?

Thanks,
-Brian
-- 
Brian Dean					brdean@unx.sas.com


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199905041720.NAA22383>