mirror of
https://github.com/jmcorgan/fips.git
synced 2026-08-11 17:17:54 +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
+26
@@ -79,6 +79,32 @@ impl CoordCache {
|
||||
self.entries.insert(addr, entry);
|
||||
}
|
||||
|
||||
/// Insert or update a cache entry with path MTU information.
|
||||
///
|
||||
/// Used by discovery response handling to store the discovered path MTU
|
||||
/// alongside the target's coordinates.
|
||||
pub fn insert_with_path_mtu(
|
||||
&mut self,
|
||||
addr: NodeAddr,
|
||||
coords: TreeCoordinate,
|
||||
current_time_ms: u64,
|
||||
path_mtu: u16,
|
||||
) {
|
||||
if let Some(entry) = self.entries.get_mut(&addr) {
|
||||
entry.update(coords, current_time_ms, self.default_ttl_ms);
|
||||
entry.set_path_mtu(path_mtu);
|
||||
return;
|
||||
}
|
||||
|
||||
if self.entries.len() >= self.max_entries {
|
||||
self.evict_one(current_time_ms);
|
||||
}
|
||||
|
||||
let mut entry = CacheEntry::new(coords, current_time_ms, self.default_ttl_ms);
|
||||
entry.set_path_mtu(path_mtu);
|
||||
self.entries.insert(addr, entry);
|
||||
}
|
||||
|
||||
/// Insert with a custom TTL.
|
||||
pub fn insert_with_ttl(
|
||||
&mut self,
|
||||
|
||||
Reference in New Issue
Block a user