[e2e] UDP length field

Joe Touch touch at ISI.EDU
Wed Apr 11 10:59:00 PDT 2001


Hari Balakrishnan wrote:
> 
> One of my visiting students, Lars-Ake Larzon (who is involved with the UDP-lite
> proposal), asked me a question that stumped me:
> 
>         Why does UDP have a length field?

I didn't find a definitive answer in the specs; here are some other
thoughts, though:

	1. the UDP length is used in the pseudoheader (actually twice)
	   for UDP checksum calculation, and should NOT change E2E
		- the IP length includes the IP header and its 
		  options, which MAY change E2E

	2. as an additional check when UDP is used without a checksum
	   (See Stevens/Wright, TCPIP Illustrated, v2, p771).

	3. in the case where IP options add trailers
		in this case, there is insufficient information in the IP_LEN
		and IP_HLEN fields to determine where the UDP data ends

		e.g., ARP (see man ARP) - though this is no longer supported
		I'm not sure there is a legitimate use here, but I could see
		where an IP header option could add a trailer (e.g., padding,
		a CRC checksum, etc.) and this would be required to otherwise 
		support it.

> His reasoning, which is reasonable, is that this information adds no value and
> only serves to cause confusion when the IP and UDP length fields mismatch.

The lengths don't match per se. One can (normally) be computed from the
other, which (as above) is a little different.

> Finally, the RFCs seem silent on the following question:
> 
>         What should an end-receiver do when the lengths mismatch?  Is this up to the
> implementation?

This is covered in Stevens/Wright TCPIP Ill. v2, p 771, at least as to
what the current BSD code does.

Joe



More information about the end2end-interest mailing list