mirror of
https://github.com/jmcorgan/fips.git
synced 2026-08-11 09:07:44 +00:00
FLP wire format revision and MMP link-layer measurement protocol
## FLP Wire Format Revision Replace the 1-byte discriminator with a structured wire format: - 4-byte common prefix (ver+phase, flags, payload_len) and 16-byte established frame header with AEAD AAD binding - 5-byte encrypted inner header (4-byte session-relative timestamp + 1-byte message type) on all link messages - Phase-based packet dispatch replacing discriminator-based dispatch - SessionDatagram reassigned from type 0x40 to 0x00; add SenderReport (0x01) and ReceiverReport (0x02) message types for MMP - SessionDatagram: rename hop_limit to ttl, add path_mtu field (u16 LE) with min(datagram.path_mtu, transport.mtu()) at forwarding - Updated handshake packets (msg1: 87->90 bytes, msg2: 42->45 bytes) - FIPS_OVERHEAD updated from 135 to 144 bytes ## MMP Link-Layer Measurement Protocol Add the Metrics Measurement Protocol for link quality measurement between FIPS peers. Measures RTT, loss, jitter, throughput, OWD trend, and ETX from periodic sender/receiver reports exchanged over established links. Module layout: - mmp/algorithms.rs: JitterEstimator, SrttEstimator, DualEwma, OwdTrend, SpinBit, ETX computation - mmp/report.rs: SenderReport (48B) and ReceiverReport (68B) wire format - mmp/sender.rs: per-peer TX counters and interval tracking - mmp/receiver.rs: per-peer RX counters, jitter, loss, gap tracking - mmp/metrics.rs: derived metrics from report processing (SRTT, goodput_bps) - mmp/mod.rs: MmpMode (Full/Lightweight/Minimal), MmpConfig, MmpPeerState - node/handlers/mmp.rs: report dispatch, timer-driven generation, operator logging (periodic + teardown) Integration: per-frame TX/RX hooks in encrypted message handling, report dispatch from link message router, timer-driven generation from tick handler, and periodic operator logging with throughput formatting. Three operating modes: Full (sender + receiver reports, spin bit, CE echo), Lightweight (receiver reports only), Minimal (spin bit + CE echo only). ## Design Documentation Updated FLP sections across all design documents to match the implemented wire format, including revised overhead calculations and numeric values. 568 tests pass, clippy clean.
This commit is contained in:
+11
-5
@@ -7,6 +7,7 @@
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
use super::IdentityConfig;
|
||||
use crate::mmp::MmpConfig;
|
||||
|
||||
// ============================================================================
|
||||
// Node Configuration Subsections
|
||||
@@ -213,9 +214,9 @@ impl BloomConfig {
|
||||
/// Session/data plane (`node.session.*`).
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
pub struct SessionConfig {
|
||||
/// Default SessionDatagram hop limit (`node.session.default_hop_limit`).
|
||||
#[serde(default = "SessionConfig::default_hop_limit")]
|
||||
pub default_hop_limit: u8,
|
||||
/// Default SessionDatagram TTL (`node.session.default_ttl`).
|
||||
#[serde(default = "SessionConfig::default_ttl")]
|
||||
pub default_ttl: u8,
|
||||
/// Queue depth per dest during session establishment (`node.session.pending_packets_per_dest`).
|
||||
#[serde(default = "SessionConfig::default_pending_packets_per_dest")]
|
||||
pub pending_packets_per_dest: usize,
|
||||
@@ -236,7 +237,7 @@ pub struct SessionConfig {
|
||||
impl Default for SessionConfig {
|
||||
fn default() -> Self {
|
||||
Self {
|
||||
default_hop_limit: 64,
|
||||
default_ttl: 64,
|
||||
pending_packets_per_dest: 16,
|
||||
pending_max_destinations: 256,
|
||||
idle_timeout_secs: 90,
|
||||
@@ -246,7 +247,7 @@ impl Default for SessionConfig {
|
||||
}
|
||||
|
||||
impl SessionConfig {
|
||||
fn default_hop_limit() -> u8 { 64 }
|
||||
fn default_ttl() -> u8 { 64 }
|
||||
fn default_pending_packets_per_dest() -> usize { 16 }
|
||||
fn default_pending_max_destinations() -> usize { 256 }
|
||||
fn default_idle_timeout_secs() -> u64 { 90 }
|
||||
@@ -341,6 +342,10 @@ pub struct NodeConfig {
|
||||
/// Internal buffers (`node.buffers.*`).
|
||||
#[serde(default)]
|
||||
pub buffers: BuffersConfig,
|
||||
|
||||
/// Metrics Measurement Protocol (`node.mmp.*`).
|
||||
#[serde(default)]
|
||||
pub mmp: MmpConfig,
|
||||
}
|
||||
|
||||
impl Default for NodeConfig {
|
||||
@@ -359,6 +364,7 @@ impl Default for NodeConfig {
|
||||
bloom: BloomConfig::default(),
|
||||
session: SessionConfig::default(),
|
||||
buffers: BuffersConfig::default(),
|
||||
mmp: MmpConfig::default(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user