mirror of
https://github.com/jmcorgan/fips.git
synced 2026-08-12 01:27:32 +00:00
FSP wire format revision and session-layer MMP implementation
FSP wire format revision (TASK-2026-0007): Introduce the FIPS Session Protocol (FSP) wire format with a 4-byte common prefix [ver_phase:1][flags:1][payload_len:2 LE] replacing the old 1-byte msg_type dispatch. All session messages share this prefix with phase-based dispatch (Established, Setup, Ack, Unencrypted). - New session_wire.rs: FSP constants, header types, parse/build helpers - SessionMessageType enum: DataPacket (0x10), SenderReport (0x11), ReceiverReport (0x12), PathMtuNotification (0x13) - FspFlags (CP/K/U) and FspInnerFlags (SP) for flag management - SessionSenderReport, SessionReceiverReport, PathMtuNotification message structs with encode/decode - FSP send pipeline: 12-byte header as AAD, 6-byte inner header (timestamp + msg_type + inner_flags), encrypt_with_aad() - FSP receive pipeline: parse header, extract cleartext coords (CP), AEAD decrypt with AAD, strip inner header, msg_type dispatch - Forwarding: transit nodes parse cleartext coords without decryption - Removed DataPacket struct and associated types - SessionEntry: session_start_ms, mark_established(), session_timestamp() - FIPS_OVERHEAD: 144 → 150 bytes (+6 for FSP inner header) - Design docs updated for new wire format Session-layer MMP implementation (TASK-2026-0008): Implement complete session-layer MMP reusing the link-layer algorithm modules (SenderState, ReceiverState, MmpMetrics, SpinBitState) with independent configuration and higher report interval clamps. - SessionMmpConfig: separate config section (node.session_mmp.*) - MmpSessionState: session-specific wrapper with PathMtuState tracking - Session-layer constants (500ms-10s report intervals, 1s cold start) - Parameterized interval methods (new_with_cold_start, update_report_interval_with_bounds) on SenderState/ReceiverState - Bidirectional From conversions between link/session report types - SessionEntry: mmp and is_initiator fields, initialized on Established - send_session_msg() for reports/notifications - Per-message RX recording with spin bit state tracking - Handlers for SenderReport, ReceiverReport, PathMtuNotification - path_mtu threaded from SessionDatagram envelope through to handlers - check_session_mmp_reports() tick handler with collect-then-send pattern - Periodic and teardown operator logging for session metrics - PathMtuState: destination observes incoming MTU on all session messages, source seeded from outbound transport MTU, decrease-immediate / increase-requires-3-consecutive rules Link-layer MMP fix: - Stop feeding spin bit RTT samples into SRTT estimator; inter-frame timing in the mesh is irregular, inflating spin-bit RTT by variable processing delays; timestamp-echo provides accurate RTT 29 files changed, 602 tests pass, 0 clippy warnings.
This commit is contained in:
+13
-5
@@ -62,13 +62,21 @@ const MAX_ORIGINAL_PACKET: usize = MIN_IPV6_MTU - IPV6_HEADER_LEN - ICMPV6_HEADE
|
||||
/// Total FIPS encapsulation overhead (worst case).
|
||||
///
|
||||
/// Breakdown:
|
||||
/// - Noise encryption tag: 16 bytes
|
||||
/// - Established frame header: 16 bytes (common prefix + receiver_idx + counter)
|
||||
/// - Inner header: 5 bytes (4-byte timestamp + 1-byte msg_type)
|
||||
/// - Noise encryption tag: 16 bytes (FLP link-layer AEAD)
|
||||
/// - FLP established frame header: 16 bytes (common prefix + receiver_idx + counter)
|
||||
/// - FLP inner header: 5 bytes (4-byte timestamp + 1-byte msg_type)
|
||||
/// - SessionDatagram fields: 35 bytes (ttl + path_mtu + src_addr + dest_addr)
|
||||
/// - DataPacket header: 12 bytes (msg_type + flags + counter + payload_len)
|
||||
/// - FSP header: 12 bytes (4-byte prefix + 8-byte counter)
|
||||
/// - FSP inner header: 6 bytes (4-byte timestamp + 1-byte msg_type + 1-byte inner_flags)
|
||||
/// - Session AEAD tag: 16 bytes (FSP session-layer AEAD)
|
||||
/// - Coordinates (worst case): ~60 bytes (2 coords with depth 3 each)
|
||||
pub const FIPS_OVERHEAD: u16 = 16 + 16 + 5 + 35 + 12 + 60; // 144 bytes
|
||||
///
|
||||
/// The old 12-byte session header is replaced by FSP header (12) + FSP inner
|
||||
/// header (6) + session AEAD tag (16) = 34 bytes, an increase of 22 bytes.
|
||||
/// However, the old overhead already accounted for the session AEAD tag in
|
||||
/// the "Noise encryption tag" line, and the old header included the counter.
|
||||
/// Net change: +6 bytes for FSP inner header.
|
||||
pub const FIPS_OVERHEAD: u16 = 16 + 16 + 5 + 35 + 12 + 6 + 60; // 150 bytes
|
||||
|
||||
/// Calculate the effective IPv6 MTU for FIPS-encapsulated traffic.
|
||||
///
|
||||
|
||||
Reference in New Issue
Block a user