From 0e64d71196ab865ce50505c7ba13a5d400b3aafe Mon Sep 17 00:00:00 2001 From: Max Inden Date: Tue, 12 Sep 2023 05:03:38 +0200 Subject: [PATCH 1/2] fix(server): filter out `/quic` in favor of `/quic-v1` Configuration files generated by Kubo <= v0.22 list both `/quic` and `/quic-v1` listen addresses with the same UDP port. Given that we enable draft-29, the two addresses are treated the same by rust-libp2p's QUIC implementation. Though calling `listen_on` with both results in an "Address already in use" error by the OS on the second call. To prevent this from happening filter out `/quic` addresses in favor of `/quic-v1`. Pull-Request: #4467. --- misc/server/CHANGELOG.md | 8 ++++++++ misc/server/src/main.rs | 7 ++----- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/misc/server/CHANGELOG.md b/misc/server/CHANGELOG.md index d7c8f71d033..571d52c5cf1 100644 --- a/misc/server/CHANGELOG.md +++ b/misc/server/CHANGELOG.md @@ -8,6 +8,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Changed - Add libp2p-lookup to Dockerfile to enable healthchecks. +### Fixed + +- Disable QUIC `draft-29` support. + Listening on `/quic` and `/quic-v1` addresses with the same port would otherwise result in an "Address already in use" error by the OS. + See [PR 4467]. + +[PR 4467]: https://github.com/libp2p/rust-libp2p/pull/4467 + ## [0.12.2] ### Fixed - Adhere to `--metrics-path` flag and listen on `0.0.0.0:8888` (default IPFS metrics port). diff --git a/misc/server/src/main.rs b/misc/server/src/main.rs index 67abb5b2549..e5c74a81ecb 100644 --- a/misc/server/src/main.rs +++ b/misc/server/src/main.rs @@ -89,11 +89,7 @@ async fn main() -> Result<(), Box> { .multiplex(yamux::Config::default()) .timeout(Duration::from_secs(20)); - let quic_transport = { - let mut config = quic::Config::new(&local_keypair); - config.support_draft_29 = true; - quic::tokio::Transport::new(config) - }; + let quic_transport = quic::tokio::Transport::new(quic::Config::new(&local_keypair)); dns::TokioDnsConfig::system(libp2p::core::transport::OrTransport::new( quic_transport, @@ -126,6 +122,7 @@ async fn main() -> Result<(), Box> { Err(e) => return Err(e.into()), } } + if config.addresses.append_announce.is_empty() { warn!("No external addresses configured."); } From 92b5721ccbd63a697cda931771696fc588736a08 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 12 Sep 2023 05:34:12 +0000 Subject: [PATCH 2/2] deps: bump stun from 0.4.4 to 0.5.0 Pull-Request: #4482. --- Cargo.lock | 98 +++++++++++++++++++++++++++++------- transports/webrtc/Cargo.toml | 2 +- 2 files changed, 81 insertions(+), 19 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 2d1192af98b..5f3aa2d8b2a 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2328,7 +2328,7 @@ dependencies = [ "tokio", "waitgroup", "webrtc-srtp", - "webrtc-util", + "webrtc-util 0.7.0", ] [[package]] @@ -3326,7 +3326,7 @@ dependencies = [ "rcgen 0.10.0", "serde", "sha2 0.10.7", - "stun", + "stun 0.5.0", "thiserror", "tinytemplate", "tokio", @@ -3539,6 +3539,15 @@ dependencies = [ "autocfg", ] +[[package]] +name = "memoffset" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5de893c32cde5f383baa4c04c5d6dbdd735cfd4a794b0debdb2bb1b421da5ff4" +dependencies = [ + "autocfg", +] + [[package]] name = "memoffset" version = "0.9.0" @@ -3772,6 +3781,19 @@ dependencies = [ "memoffset 0.6.5", ] +[[package]] +name = "nix" +version = "0.26.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "598beaf3cc6fdd9a5dfb1630c2800c7acd31df7aaf0f565796fba2b53ca1af1b" +dependencies = [ + "bitflags 1.3.2", + "cfg-if 1.0.0", + "libc", + "memoffset 0.7.1", + "pin-utils", +] + [[package]] name = "nohash-hasher" version = "0.2.0" @@ -4737,7 +4759,7 @@ checksum = "6423493804221c276d27f3cc383cd5cbe1a1f10f210909fd4951b579b01293cd" dependencies = [ "bytes", "thiserror", - "webrtc-util", + "webrtc-util 0.7.0", ] [[package]] @@ -4751,7 +4773,7 @@ dependencies = [ "log", "netlink-packet-route", "netlink-proto", - "nix", + "nix 0.24.3", "thiserror", "tokio", ] @@ -4766,7 +4788,7 @@ dependencies = [ "rand 0.8.5", "serde", "thiserror", - "webrtc-util", + "webrtc-util 0.7.0", ] [[package]] @@ -5420,7 +5442,26 @@ dependencies = [ "thiserror", "tokio", "url", - "webrtc-util", + "webrtc-util 0.7.0", +] + +[[package]] +name = "stun" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7beb1624a3ea34778d58d30e2b8606b4d29fe65e87c4d50b87ed30afd5c3830c" +dependencies = [ + "base64 0.21.4", + "crc", + "lazy_static", + "md-5", + "rand 0.8.5", + "ring", + "subtle", + "thiserror", + "tokio", + "url", + "webrtc-util 0.8.0", ] [[package]] @@ -5940,10 +5981,10 @@ dependencies = [ "md-5", "rand 0.8.5", "ring", - "stun", + "stun 0.4.4", "thiserror", "tokio", - "webrtc-util", + "webrtc-util 0.7.0", ] [[package]] @@ -6327,7 +6368,7 @@ dependencies = [ "serde_json", "sha2 0.10.7", "smol_str", - "stun", + "stun 0.4.4", "thiserror", "time", "tokio", @@ -6341,7 +6382,7 @@ dependencies = [ "webrtc-media", "webrtc-sctp", "webrtc-srtp", - "webrtc-util", + "webrtc-util 0.7.0", ] [[package]] @@ -6356,7 +6397,7 @@ dependencies = [ "thiserror", "tokio", "webrtc-sctp", - "webrtc-util", + "webrtc-util 0.7.0", ] [[package]] @@ -6396,7 +6437,7 @@ dependencies = [ "thiserror", "tokio", "webpki 0.21.4", - "webrtc-util", + "webrtc-util 0.7.0", "x25519-dalek 2.0.0-pre.1", "x509-parser 0.13.2", ] @@ -6414,7 +6455,7 @@ dependencies = [ "rand 0.8.5", "serde", "serde_json", - "stun", + "stun 0.4.4", "thiserror", "tokio", "turn", @@ -6422,7 +6463,7 @@ dependencies = [ "uuid", "waitgroup", "webrtc-mdns", - "webrtc-util", + "webrtc-util 0.7.0", ] [[package]] @@ -6435,7 +6476,7 @@ dependencies = [ "socket2 0.4.9", "thiserror", "tokio", - "webrtc-util", + "webrtc-util 0.7.0", ] [[package]] @@ -6465,7 +6506,7 @@ dependencies = [ "rand 0.8.5", "thiserror", "tokio", - "webrtc-util", + "webrtc-util 0.7.0", ] [[package]] @@ -6488,7 +6529,7 @@ dependencies = [ "subtle", "thiserror", "tokio", - "webrtc-util", + "webrtc-util 0.7.0", ] [[package]] @@ -6505,7 +6546,28 @@ dependencies = [ "lazy_static", "libc", "log", - "nix", + "nix 0.24.3", + "rand 0.8.5", + "thiserror", + "tokio", + "winapi", +] + +[[package]] +name = "webrtc-util" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1adc96bee68417e1f4d19dd7698124a7f859db55ae2fd3eedbbb7e732f614735" +dependencies = [ + "async-trait", + "bitflags 1.3.2", + "bytes", + "cc", + "ipnet", + "lazy_static", + "libc", + "log", + "nix 0.26.4", "rand 0.8.5", "thiserror", "tokio", diff --git a/transports/webrtc/Cargo.toml b/transports/webrtc/Cargo.toml index debdbaaf577..8139d96e705 100644 --- a/transports/webrtc/Cargo.toml +++ b/transports/webrtc/Cargo.toml @@ -29,7 +29,7 @@ quick-protobuf-codec = { workspace = true } rand = "0.8" rcgen = "0.10.0" serde = { version = "1.0", features = ["derive"] } -stun = "0.4" +stun = "0.5" thiserror = "1" tinytemplate = "1.2" tokio = { version = "1.32", features = ["net"], optional = true}