Skip to content
New issue

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

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

Already on GitHub? # to your account

fix: clarify mtu+=2 for IEEE802154 #857

Merged
merged 1 commit into from
Nov 17, 2023
Merged
Changes from all commits
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
7 changes: 6 additions & 1 deletion src/phy/raw_socket.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,14 @@ impl RawSocket {

let mut mtu = lower.interface_mtu()?;

// FIXME(thvdveld): this is a workaround for https://github.com/smoltcp-rs/smoltcp/issues/622
#[cfg(feature = "medium-ieee802154")]
if medium == Medium::Ieee802154 {
// SIOCGIFMTU returns 127 - (ACK_PSDU - FCS - 1) - FCS.
// 127 - (5 - 2 - 1) - 2 = 123
// For IEEE802154, we want to add (ACK_PSDU - FCS - 1), since that is what SIOCGIFMTU
// uses as the size of the link layer header.
//
// https://github.com/torvalds/linux/blob/7475e51b87969e01a6812eac713a1c8310372e8a/net/mac802154/iface.c#L541
mtu += 2;
}

Expand Down
Loading