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
commita799bf88e0e26763f8cb072500b10f3cc3102e87 (patch)
tree712db41cfea9c3760c57182117a6f0842fcb7d7e /src/transport/libp2p/driver.rs
parent1dad07e5919d93f62f53c690e0f24baf7560e5cc (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)));
}