Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Decrease zenoh_link_udp::UDP_MAX_MTU to fit UDP over IPv6 #1071

Merged
merged 2 commits into from
Jun 3, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 9 additions & 8 deletions io/zenoh-links/zenoh-link-udp/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,15 @@ use zenoh_result::{zerror, ZResult};
// $ sysctl -w net.core.rmem_max=4194304
// $ sysctl -w net.core.rmem_default=4194304

// Maximum MTU (UDP PDU) in bytes.
// NOTE: The UDP field size sets a theoretical limit of 65,535 bytes (8 byte header + 65,527 bytes of
// data) for a UDP datagram. However the actual limit for the data length, which is imposed by
// the underlying IPv4 protocol, is 65,507 bytes (65,535 − 8 byte UDP header − 20 byte IP header).
// Although in IPv6 it is possible to have UDP datagrams of size greater than 65,535 bytes via
// IPv6 Jumbograms, its usage in Zenoh is discouraged unless the consequences are very well
// understood.
const UDP_MAX_MTU: u16 = 65_507;
/// Maximum MTU (UDP PDU) in bytes.
///
/// # Note
/// The UDP field size sets a theoretical limit of 65,535 bytes (8 byte header + 65,527 bytes of
/// data) for a UDP datagram. However the actual limit for the data length, which is imposed by the
/// underlying IPv4 protocol, is 65,507 bytes (65,535 − 8 byte UDP header − 20 byte IP header).
/// Although in IPv6 it is possible to have UDP datagrams of size greater than 65,535 bytes via IPv6
/// Jumbograms, its usage in Zenoh is discouraged unless the consequences are very well understood.
const UDP_MAX_MTU: u16 = u16::MAX - 8 - 40;

pub const UDP_LOCATOR_PREFIX: &str = "udp";

Expand Down
Loading