mirror of
https://github.com/jmcorgan/fips.git
synced 2026-08-12 01:27:32 +00:00
Add MTU fields to lookup packets for path MTU discovery
Add min_mtu (u16) to LookupRequest and path_mtu (u16) to LookupResponse, enabling the discovery system to report transport MTU capability along the lookup path. LookupRequest carries min_mtu (origin's minimum MTU requirement, default 0 = no requirement). LookupResponse carries path_mtu (initialized to u16::MAX by the target, reduced by transit nodes via min(path_mtu, outgoing_link_mtu) on the reverse path). path_mtu is a transit annotation like SessionDatagram.path_mtu and is NOT included in the proof signature. The originator stores the discovered path_mtu in CacheEntry alongside cached coordinates. Wire format: +2 bytes each for LookupRequest and LookupResponse.
This commit is contained in:
Vendored
+17
@@ -13,6 +13,12 @@ pub struct CacheEntry {
|
||||
last_used: u64,
|
||||
/// When this entry expires (Unix milliseconds).
|
||||
expires_at: u64,
|
||||
/// Path MTU discovered during lookup (if available).
|
||||
///
|
||||
/// Set from the `LookupResponse.path_mtu` field when a discovery
|
||||
/// response is cached. `None` when populated from SessionSetup or
|
||||
/// other sources that don't carry path MTU information.
|
||||
path_mtu: Option<u16>,
|
||||
}
|
||||
|
||||
impl CacheEntry {
|
||||
@@ -23,6 +29,7 @@ impl CacheEntry {
|
||||
created_at: current_time_ms,
|
||||
last_used: current_time_ms,
|
||||
expires_at: current_time_ms.saturating_add(ttl_ms),
|
||||
path_mtu: None,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -46,6 +53,16 @@ impl CacheEntry {
|
||||
self.expires_at
|
||||
}
|
||||
|
||||
/// Get the path MTU discovered during lookup, if available.
|
||||
pub fn path_mtu(&self) -> Option<u16> {
|
||||
self.path_mtu
|
||||
}
|
||||
|
||||
/// Set the path MTU discovered during lookup.
|
||||
pub fn set_path_mtu(&mut self, mtu: u16) {
|
||||
self.path_mtu = Some(mtu);
|
||||
}
|
||||
|
||||
/// Check if this entry has expired.
|
||||
pub fn is_expired(&self, current_time_ms: u64) -> bool {
|
||||
current_time_ms > self.expires_at
|
||||
|
||||
Reference in New Issue
Block a user