network-programmingudpipnetwork-drive

How to fill the UDP length in the first UDP fragment when UDP package divided to IP fragment?


For example, one 2000 bytes UDP package(contains UDP header) and network MTU is 1500. So this UDP package should be split to two IP fragments. Only the first IP package contains the UDP header. What value should be filled into UDP length in the UDP header of first IP package? 1480 or 2000? Is there any document to confirm this?


Solution

  • UDP Length is the length of the UDP header AND the UDP data, in bytes. The fragmentation will/should NOT change this.

    [UDP] "Length is the length in octets of this user datagram including this header and the data" --RFC768, an Internet Standard. It is also in the Stevens link referenced: "Referring to Figure 10-2, the UDP Length field is the length of the UDP header and the UDP data in bytes."