1

When sending UDP packets that exceed the PMTU, I'm told that the receiver will receive the packets in fragments. Does the network interface or OS of the receiver typically re-assemble the packets automatically?

If I had to guess, for Linux/POSIX systems the answer would be no if using a raw socket e.g. SOCK_RAW - but is this also the case if using SOCK_DGRAM?

Can anyone say whether Linux, Windows, or Mac OS do IP packet reassembly?

I'm aware that the IETF recommends against IP fragmentation, but I'm trying to understand how much I, as a network application developer, have to worry about it.

1 Answer 1

2

IP fragmentation is transparent when using a UDP socket. The OS will take care of assembling the fragments. There is not even an API for UDP sockets to get the separate fragments.

Note though that OS are not required to reassemble arbitrary fragments, they might simple discard the data if they exceed a specific size. This is fine since UDP does not provide any reliability. To cite from Wikipedia:

In IPv4, hosts must make a best-effort attempt to reassemble fragmented IP packets with a total reassembled size of up to 576 bytes. They may also attempt to reassemble fragmented IP packets larger than 576 bytes, but they are also permitted to silently discard such larger packets. ... [similar thing about IPv6 later]

3
  • I saw this as well. I am wondering about packets that exceed a total reassembled size of 576 bytes - though it sounds like the IPv4 standard says the host can discard larger packets, I'm also wondering what happens in practice.
    – Tom
    Mar 3 at 19:58
  • 1
    @Tom: I think most OS will do their best - within limits. So they will restrict the amount of memory used for reassembly, the time to wait for fragments to arrive, the disorder they accept ... . Otherwise they would be an easy target for memory-eating DoS attacks. See kernel.org/doc/html/v5.8/networking/ip-sysctl.html and look for anything with the word reassemble in it to see the various tunings in Linux. Mar 3 at 20:16
  • Thanks very much for the additional info @Steffen!
    – Tom
    Mar 3 at 20:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.