Skip to content

Commit 47f61ed

Browse files
authored
feat(proto): Server sends NAT traversal probes with active CID (#575)
## Description This changes the server-side of the NAT traversal to always send path challenges using the active CID. This means it does not skip probes when there are no more CIDs (currently still limited to 5). It does means the paths are linkable, and this is a violation of a MUST in RFC9000. But this is the direction we want to take right now. ## Breaking Changes Paths are now linkable. ## Notes & open questions This is on the path towards #567. Closes #574. An attempt to replace #571 with something much simpler and without design problems. If combined with increasing MAX_MULTIPATH_PATHS on the iroh side I expect it to be similarly effective.
1 parent 1948efc commit 47f61ed

File tree

2 files changed

+12
-6
lines changed

2 files changed

+12
-6
lines changed

noq-proto/src/cid_queue.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,7 @@ impl CidQueue {
136136
}
137137

138138
/// Returns the number of unused CIDs (neither active nor reserved).
139+
#[allow(unused)]
139140
pub(crate) fn remaining(&self) -> usize {
140141
self.iter_from_reserved()
141142
.count()

noq-proto/src/connection/mod.rs

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2067,13 +2067,18 @@ impl Connection {
20672067
return None;
20682068
}
20692069

2070-
let remote_cids = self.remote_cids.get_mut(&path_id)?;
2071-
// Check if this path has enough CIDs to send a probe. One to be reserved, one in case the
2072-
// active CID needs to be retired.
2073-
if remote_cids.remaining() < 2 {
2070+
// TODO: Using the active CID here makes the paths linkable. This is a violation of
2071+
// RFC9000 but something we want to accept in the short term. Eventually we aim
2072+
// to fix up the supply of CIDs sufficiently so that we can keep paths unlinkable
2073+
// again.
2074+
let Some(cid) = self
2075+
.remote_cids
2076+
.get(&path_id)
2077+
.map(|cid_queue| cid_queue.active())
2078+
else {
2079+
trace!(%path_id, "Not sending NAT traversal probe for path with no CIDs");
20742080
return None;
2075-
}
2076-
let cid = remote_cids.next_reserved()?;
2081+
};
20772082
let token = self.rng.random();
20782083

20792084
let frame = frame::PathChallenge(token);

0 commit comments

Comments
 (0)