From da8763c3aea765d02929a7496119354f00938631 Mon Sep 17 00:00:00 2001 From: stormshield-frb <144998884+stormshield-frb@users.noreply.github.com> Date: Wed, 5 Feb 2025 11:03:44 +0100 Subject: [PATCH] fix(autonat): prevent infinity loop on wrong nonce Fix #5816. Pull-Request: #5848. --- Cargo.lock | 2 +- Cargo.toml | 2 +- protocols/autonat/CHANGELOG.md | 5 +++++ protocols/autonat/Cargo.toml | 2 +- protocols/autonat/src/v2/client/handler/dial_back.rs | 7 +------ 5 files changed, 9 insertions(+), 9 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index e8affaa2628..7043353dc01 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2717,7 +2717,7 @@ dependencies = [ [[package]] name = "libp2p-autonat" -version = "0.14.0" +version = "0.14.1" dependencies = [ "async-trait", "asynchronous-codec", diff --git a/Cargo.toml b/Cargo.toml index 33cce85e21b..1cb4fbff95e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -74,7 +74,7 @@ rust-version = "1.83.0" [workspace.dependencies] libp2p = { version = "0.55.1", path = "libp2p" } libp2p-allow-block-list = { version = "0.5.0", path = "misc/allow-block-list" } -libp2p-autonat = { version = "0.14.0", path = "protocols/autonat" } +libp2p-autonat = { version = "0.14.1", path = "protocols/autonat" } libp2p-connection-limits = { version = "0.5.0", path = "misc/connection-limits" } libp2p-core = { version = "0.43.0", path = "core" } libp2p-dcutr = { version = "0.13.0", path = "protocols/dcutr" } diff --git a/protocols/autonat/CHANGELOG.md b/protocols/autonat/CHANGELOG.md index e80dc4df437..36c8752deed 100644 --- a/protocols/autonat/CHANGELOG.md +++ b/protocols/autonat/CHANGELOG.md @@ -1,3 +1,8 @@ +## 0.14.1 + +- Fix infinity loop on wrong `nonce` when performing `dial_back`. + See [PR 5848](https://github.com/libp2p/rust-libp2p/pull/5848). + ## 0.14.0 - Verify that an incoming AutoNAT dial comes from a connected peer. See [PR 5597](https://github.com/libp2p/rust-libp2p/pull/5597). diff --git a/protocols/autonat/Cargo.toml b/protocols/autonat/Cargo.toml index f614db56eb1..04a43515fdd 100644 --- a/protocols/autonat/Cargo.toml +++ b/protocols/autonat/Cargo.toml @@ -3,7 +3,7 @@ name = "libp2p-autonat" edition = "2021" rust-version = { workspace = true } description = "NAT and firewall detection for libp2p" -version = "0.14.0" +version = "0.14.1" authors = [ "David Craven ", "Elena Frank ", diff --git a/protocols/autonat/src/v2/client/handler/dial_back.rs b/protocols/autonat/src/v2/client/handler/dial_back.rs index 7cdf194343a..1e86b46152b 100644 --- a/protocols/autonat/src/v2/client/handler/dial_back.rs +++ b/protocols/autonat/src/v2/client/handler/dial_back.rs @@ -109,12 +109,7 @@ fn perform_dial_back( match receiver.await { Ok(Ok(())) => {} Ok(Err(e)) => return Some((Err(e), state)), - Err(_) => { - return Some(( - Err(io::Error::new(io::ErrorKind::Other, "Sender got cancelled")), - state, - )); - } + Err(_) => return None, } if let Err(e) = protocol::dial_back_response(&mut state.stream).await { return Some((Err(e), state));