aboutsummaryrefslogtreecommitdiffstats
path: root/src/transport/libp2p/driver.rs
diff options
context:
space:
mode:
authortv <tv@krebsco.de>2026-11-01 19:51:08 +0100
committertv <tv@krebsco.de>2026-11-01 19:51:08 +0100
commit5c5efb0440d50a91de942817f0886fcba6d5d3ae (patch)
treea90edcf5136f9130e8c0d113405357da2044c0e4 /src/transport/libp2p/driver.rs
parentd5bac903cf181b2f1ace38ae330bb0a286d26da3 (diff)
libp2p: remember wrong addresses
Diffstat (limited to 'src/transport/libp2p/driver.rs')
-rw-r--r--src/transport/libp2p/driver.rs13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/transport/libp2p/driver.rs b/src/transport/libp2p/driver.rs
index c89a784..39a2a5d 100644
--- a/src/transport/libp2p/driver.rs
+++ b/src/transport/libp2p/driver.rs
@@ -272,6 +272,19 @@ pub(super) async fn run(
}
SwarmEvent::OutgoingConnectionError { connection_id, peer_id, error } => {
count_dial_failure(&mut lock(&book).counts.dial_failures, &error);
+ // Another peer there: not this one's address, though it said so (a
+ // NATed peer's LAN address, the same range as ours).
+ if let (Some(peer), ::libp2p::swarm::DialError::WrongPeerId { obtained, address }) =
+ (peer_id, &error)
+ {
+ debug!(
+ peer = %Addressed(SCHEME, &peer),
+ address = %address,
+ obtained = %obtained,
+ "Another peer at an address of this one; not dialling it there again"
+ );
+ lock(&book).not_theirs(peer, address.clone());
+ }
if let Some((_, done)) = identifying.remove(&connection_id) {
let _ = done.send(Err(describe_dial_error(&error)));
}