Skip to content

UDP: Use MSS instead of MTU for max size #77

@jeppenodgaard

Description

@jeppenodgaard

The MTU is default 1500 (Ethernet v2 maximum).

This value is used during image transfer but without subtracting IP and UDP header.
This results in fragmentation where last 2nd fragment payload length is ~28 bytes.

This is probably not the intention because it will likely decrease the performance and might not be supported by the target UDP stack.

A work around is to set the MTU to 1472 (1500 - IPv4 header - UDP header), then fragmentation no longer occurs.

Solution suggestion:
Calculate the Maximum Segment Size (MSS) and use that as UDP payload maximum size.
This is recommended by https://www.rfc-editor.org/rfc/rfc8085 section 3.2:

To determine an appropriate UDP payload size, applications MUST
subtract the size of the IP header (which includes any IPv4 optional
headers or IPv6 extension headers) as well as the length of the UDP
header (8 bytes) from the PMTU size. This size, known as the Maximum
Segment Size (MSS), can be obtained from the TCP/IP stack [RFC1122].

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions