UDP over v6: payload truncated at 1024 bytes

Serge Aleynikov serge@REDACTED
Mon Apr 5 15:40:21 CEST 2004


Fredrik,

How many hops do you have between your client and the server?  TCP 
handles fragmentation differently from UDP.  TCP does it transparently 
for the programmer by defining a maximum segment size and breaking 
datagrams down into smaller messages of max segment size (at most) 
before transmission. For any given network node and a programmer using 
TCP is usually safe attempting to send long datagrams.

As far as I know in UDP there is no concept similar to the max segment 
size.  If the user sends a datagram longer than the MTU of the server's 
network link, it is immediately fragmented at the IP layer before 
transmission.  If the receiver gets a fragment it waits a set amount
of time for the remaining fragments to arrive. If all the fragments do 
not arrive with a given period the receiver throws away the collected 
fragments and any others that arrive late.

If possible, the best option is to remain below the minimum
MTU specified by IPv4 or IPv6, which, as far as I recall, is 567 and 
1280 bytes. However, in IPv4 networks the most common value is 1500, 
which must be set on *all* hops in the packet's way in order for the 
receiver to get an unfragmented packet of 1500 bytes.

VPNs and other technologies may add extra headers to packets when they 
encode data, which may also lead to an increased size of a packet and 
fragmentation.  Thus, it is important that the data segment of UDP
datagrams stay well below this MTU value if the application is to be 
used between nodes separated by several hops.

Serge

Fredrik Thulin wrote:
> On Monday 05 April 2004 14.10, Peter Lund wrote:
> 
>>At least in IPv4 (and TCP) you cannot ever count on any packet
>>of any size to arrive at the destination without being fragmented
>>into 2 or more parts. If this is different for UDP and in v6,
>>I do not know. But hopefully someone else can tell...
> 
> 
> But surely the operating system should re-assemble the two fragments before 
> passing it to the application, even for UDP, no? 
> 
> Forgot to mention some facts in my original post : Erlang is R9C-0. Both hosts 
> are connected to the same Ethernet segment and the MTU is 1500, so there 
> really should be no fragmentation of UDP packet with 1343 bytes payload.
> 
> Operating system on both sending and receiving hosts is Linux, running a 
> RedHat kernel called 2.4.20-30.7.
> 
> /Fredrik




More information about the erlang-questions mailing list