Johnathan Corgan
999144f59a
Fix FIPS_OVERHEAD constant and add CP flag MTU guard
...
FIPS_OVERHEAD was 150 but had two bugs: the session AEAD tag (16 bytes)
was listed in the comment but missing from the arithmetic, and the
coordinate budget (~60 bytes) was undersized and didn't belong in a
constant representing fixed data path overhead.
Corrected to 106 bytes (the actual fixed overhead without coordinates).
This increases effective_ipv6_mtu from 1322 to 1366 for standard
Ethernet, well above the IPv6 minimum of 1280.
Added a guard in send_session_data() that computes the total wire size
with coordinates before committing to include them. If adding coords
would exceed the transport MTU, the CP flag is skipped and the warmup
counter is not decremented. This prevents silently producing oversized
packets at tree depth 2+.
Updated design docs (ipv6-adapter, wire-formats, mesh-operation) with
corrected overhead values.
2026-02-19 14:18:34 +00:00
Johnathan Corgan
04d9fd625d
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.
2026-02-19 03:15:05 +00:00
Johnathan Corgan
62ce267677
Session message encode/decode, disconnect and routing integration tests
...
Add encode/decode for all session-layer message types (SessionSetup,
SessionAck, DataPacket, CoordsRequired, PathBroken) and SessionDatagram
link-layer envelope. Wire format follows design doc §8.0-8.6 with
address-only coordinate serialization (16 bytes/entry).
Struct additions: handshake_payload on SessionSetup/SessionAck, flags
on SessionAck, optional src_coords/dest_coords on DataPacket for route
cache warming (COORDS_PRESENT flag).
New disconnect integration tests verify cascading cleanup in multi-node
networks: chain peer removal, star hub departure, chain partition with
bloom filter update verification, all reason codes.
New routing tests validate bloom-filter-only transit behavior and peer
removal effects: confirm transit nodes without cached coords return None
(loop prevention), routing stops after partition, source-only coords
insufficient for multi-hop delivery.
361 tests pass (up from 335), zero warnings.
2026-02-12 13:01:29 +00:00
Johnathan Corgan
066865ddd7
Split protocol.rs into protocol/ directory, standardize imports, clean lib.rs
...
- Replace use super::*; in node/lifecycle.rs with explicit imports,
remove 10 resulting unused imports from node/mod.rs
- Split protocol.rs (1838 lines) into protocol/ directory:
mod.rs (re-exports), error.rs, link.rs, tree.rs, filter.rs,
discovery.rs, session.rs — each with co-located tests
- Remove unused flat re-exports from lib.rs for internal utility
modules (wire, index, rate_limit, icmp, noise, tun)
- 316 tests pass, zero warnings
2026-02-11 05:02:02 +00:00