mirror of
https://github.com/jmcorgan/fips.git
synced 2026-08-09 00:04:54 +00:00
docs: correct Ethernet MTU framing rustdoc
The Ethernet data frame format is `[type:1][length:2 LE][payload]`, so the per-link payload MTU is the interface MTU minus 3 bytes, not minus 1. The 2-byte length field is required to trim NIC minimum-frame padding before AEAD verification. The implementation in src/transport/ethernet/mod.rs already uses saturating_sub(3) correctly; only the rustdoc on the effective_mtu field and the EthernetConfig.mtu field's documentation lagged behind. No behaviour change.
This commit is contained in:
@@ -267,8 +267,10 @@ pub struct EthernetConfig {
|
||||
#[serde(default, skip_serializing_if = "Option::is_none")]
|
||||
pub ethertype: Option<u16>,
|
||||
|
||||
/// MTU override. Defaults to the interface's MTU minus 1 (for frame type prefix).
|
||||
/// Cannot exceed the interface's actual MTU.
|
||||
/// MTU override. Defaults to the interface's MTU minus 3 bytes of frame
|
||||
/// header (`[type:1][length:2 LE][payload]`). The 2-byte length field is
|
||||
/// required to trim NIC minimum-frame padding before AEAD verification.
|
||||
/// Cannot exceed the interface's actual MTU minus 3.
|
||||
#[serde(default, skip_serializing_if = "Option::is_none")]
|
||||
pub mtu: Option<u16>,
|
||||
|
||||
|
||||
@@ -49,7 +49,9 @@ pub struct EthernetTransport {
|
||||
local_mac: Option<[u8; 6]>,
|
||||
/// Interface name (from config).
|
||||
interface: String,
|
||||
/// Effective MTU (interface MTU - 1 for frame type prefix).
|
||||
/// Effective payload MTU: interface MTU minus 3 bytes of frame header
|
||||
/// (`[type:1][length:2 LE][payload]`). The 2-byte length field is required
|
||||
/// to trim NIC minimum-frame padding before AEAD verification.
|
||||
effective_mtu: u16,
|
||||
/// Discovery buffer for discovered peers.
|
||||
discovery_buffer: Arc<DiscoveryBuffer>,
|
||||
|
||||
Reference in New Issue
Block a user