Search code examples
clinuxudpfragmentrecv

Is kernel did de-fragmentation


When I received packet with recv at linux, is the kernel did de-fragmentation so I will get de-fragmentation data? Or should I take care of it on user-space?


Solution

  • When receiving UDP data via a socket of type SOCK_DGRAM, you'll only receive the complete datagram (assuming your input buffer is large enough to receive it).

    Any IP fragmentation is handled transparently from userspace.

    If you're using raw sockets, then you need to handle defragmentation yourself.