mirror of
https://github.com/jmcorgan/fips.git
synced 2026-08-09 08:14:42 +00:00
Align the datagram hop-limit helpers with the forwarder's semantics
The forwarding path was corrected to full IP semantics: local delivery is not hop-limit gated, and forwarding decrements first and drops at zero. Two helpers on SessionDatagram were left implementing the old rule. decrement_ttl still checked before decrementing, and can_forward still answered true at a hop limit of one, where the decrement leaves zero and the datagram is dropped. Neither is called anywhere today, which is precisely why they are worth correcting rather than leaving as an invitation to reintroduce the defect. The TtlExhausted reject doc described behaviour that no longer exists. The reject is charged for a transit arrival at one as well as at zero, and is never charged for a datagram addressed to this node, whose delivery is decided ahead of the test. Both helpers are pinned by tests at the boundary, which fail against the previous implementations.
This commit is contained in:
+5
-1
@@ -232,7 +232,11 @@ pub enum ForwardingReject {
|
||||
/// `SessionDatagramRef::decode` returned an error. Tracked via
|
||||
/// [`ForwardingStats::decode_error_packets`](crate::node::stats::ForwardingStats).
|
||||
DecodeError,
|
||||
/// Datagram arrived with TTL=0 — already exhausted, no forward.
|
||||
/// Transit datagram whose TTL would reach zero on this hop, so it is
|
||||
/// dropped rather than forwarded. Charged for an arrival at TTL 1 as
|
||||
/// well as an already-exhausted arrival at TTL 0. Never charged for a
|
||||
/// datagram addressed to this node, whose delivery is not TTL-gated and
|
||||
/// is decided ahead of this test.
|
||||
/// Tracked via
|
||||
/// [`ForwardingStats::ttl_exhausted_packets`](crate::node::stats::ForwardingStats).
|
||||
TtlExhausted,
|
||||
|
||||
Reference in New Issue
Block a user