[e2e] UDP length field

Troy DeJongh troyd at pobox.com
Wed Apr 11 11:43:36 PDT 2001

Craig Partridge wrote:
> In message <200104111616.f3BGGhf13775 at chive.lcs.mit.edu>, Hari Balakrishnan wri
> tes:
> >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?
> Rich Stevens sought the answer to this question in 1995 (indeed, he sent
> mail to this list on Aug 18, 1995 on the subject).  My vague recollection
> is that he finally called Jon Postel and that Jon said it was a historical
> glitch, but since both Rich and Jon are no longer with us (a painful thing
> to say) I can't confirm that.
> >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?
> I think the answer is fairly clear:
>     * if UDP len <= IP len and the UDP checksum (using the UDP length) passes
>       you've got a valid UDP datagram, else discard.
> Reasoning:
>       if UDP len > IP len then either the UDP length field got trashed (which
>       suggests other parts of the header may be trashed too) or you're missing
>       data.  So discard datagram.
> But I don't know this is written anywhere.

Stevens, in his _TCP/IP Illustrated Vol 2_ (1995), notes in a 
parenthetical comment on p. 772 that the UDP length is redundant.  
He then goes on to say: "Why does the UDP length field exist?  
Possibly to add a small amount of error checking, since UDP 
checksums are optional." 

Perhaps that's the best answer he came up with.  :-)

Take care.


Troy DeJongh                                       http://pobox.com/~troyd

More information about the end2end-interest mailing list