Skip to content

Commit

Permalink
Merge pull request #857 from thvdveld/fix-622
Browse files Browse the repository at this point in the history
fix: clarify mtu+=2 for IEEE802154
  • Loading branch information
thvdveld authored Nov 17, 2023
2 parents b57e2f9 + 969f32d commit a1d4307
Showing 1 changed file with 6 additions and 1 deletion.
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

0 comments on commit a1d4307

Please sign in to comment.