UDP over v6: payload truncated at 1024 bytes

Matthias Lang <>
Wed Apr 7 15:45:10 CEST 2004


I know that Fredrik's immediate problem [erlang's UDP receive buffer
size was too small for his application] has been solved, but the claim
that UDP packets aren't re-assembled by the OS has been bugging me for
a few days:

 Peter Lund> At least in IPv4 (and TCP) you cannot ever count on any packet
 Peter Lund> of any size to arrive at the destination without being fragmented
 Peter Lund> into 2 or more parts. 

This is true at L1, but it is not relevant to Fredrik's problem.

 Fredrik> But surely the operating system should re-assemble the 
 Fredrik> two fragments before passing it to the application, even 
 Fredrik> for UDP, no?

 Peter Lund> No! The OS (any OS) does not help you when running TCP/IPv4.

No!!!! Fredrik is correct.

Linux DOES re-assemble fragmented IP datagrams for TCP/IPv4. The code
for doing it is in

  net/ipv4/ip_fragment.c   (2.4.25)

the functions ip_defrag() and ip_frag_reasm() do the work.

I suspect that re-assembling IP datagrams is required by POSIX,
i.e. the behaviour will be the same for Solaris, BSD and modern
variants of Windows. But I haven't checked that. Nor do I have my copy
of Stevens handy.

Matthias



More information about the erlang-questions mailing list