Reputation: 31
What is the purpose of the 'Length' field in the UDP header? Given that there is also a 'Length' field in the IP header and the length of the UDP header is constant.
I know this question has been asked multiple times, but none of the answers I found convinced me.
If it's for IP Fragmentation - as far as I understand this, IP fragmentation breaks the UDP datagram into multiple IP frames, and then the IP layer in the receiving host reassembles the frames, using the 'Length' field from the IP header, into a UDP datagram, without the UDP layer even knowing the datagram was fragmented.
If it's because we can't assume the protocol used by the network layer is IP - maybe I don't understand correctly the exact form in which the transport layer receives the data from the network layer, but isn't it true that the transport layer receives from the network layer only the UDP header & data? If it's true, then it doesn't matter which protocol is used by the network layer. And if the transport layer receives the data in a form of stream of bits instead of block of data, then how can it calculate a checksum on the whole UDP headers & data?
I also can't accept the answer that this field is redundant, because I learned that in the times when the RFC was developed, every bit was important and there weren't bits without a dedicated purpose.
I hope you can help me get this matter clear. Thank you!
Upvotes: 1
Views: 1680
Reputation: 31
So I found an answer -
In "https://datatracker.ietf.org/doc/html/draft-ietf-tsvwg-udp-options-01" it says that:
"The UDP Length length field is typically redundant".
I think that if it's under the domain "ietf.org", I can trust that...
More details in the above link for those interested. (sections 4 & 9)
Thanks to the responders!
Upvotes: 2