Skip to content

Commit

Permalink
swarm: fix external address candidate
Browse files Browse the repository at this point in the history
The `NewExternalAddrCandidate` event is yielded both before and after address translation. This will
cause, in the case of TCP, ephemeral ports to be added as candidate.

In turn, that will cause protocols like AutoNAT to fail as these candidates are not actually
reachable/external.

Fixes #4153
  • Loading branch information
b-zee committed Jul 5, 2023
1 parent 7308221 commit 92df42b
Showing 1 changed file with 0 additions and 5 deletions.
5 changes: 0 additions & 5 deletions swarm/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1062,11 +1062,6 @@ where
self.pending_event = Some((peer_id, handler, event));
}
ToSwarm::NewExternalAddrCandidate(addr) => {
self.behaviour
.on_swarm_event(FromSwarm::NewExternalAddrCandidate(
NewExternalAddrCandidate { addr: &addr },
));

// Generate more candidates based on address translation.
// For TCP without port-reuse, the observed address contains an ephemeral port which needs to be replaced by the port of a listen address.

Expand Down

0 comments on commit 92df42b

Please sign in to comment.