diff --git a/neqo-transport/Cargo.toml b/neqo-transport/Cargo.toml index 3db4053d7..86050b31a 100644 --- a/neqo-transport/Cargo.toml +++ b/neqo-transport/Cargo.toml @@ -22,7 +22,7 @@ indexmap = { version = "2.2", default-features = false } # See https://github.co log = { workspace = true } neqo-common = { path = "../neqo-common" } neqo-crypto = { path = "../neqo-crypto" } -mtu = { version = "0.1.3", default-features = false } +mtu = { path = "../../mtu", default-features = false } qlog = { workspace = true } smallvec = { version = "1.11", default-features = false } static_assertions = { version = "1.1", default-features = false } diff --git a/neqo-transport/src/path.rs b/neqo-transport/src/path.rs index f53c03bd8..caed4d294 100644 --- a/neqo-transport/src/path.rs +++ b/neqo-transport/src/path.rs @@ -15,7 +15,9 @@ use std::{ time::{Duration, Instant}, }; -use neqo_common::{hex, qdebug, qinfo, qlog::NeqoQlog, qtrace, Datagram, Encoder, IpTos, IpTosEcn}; +use neqo_common::{ + hex, qdebug, qinfo, qlog::NeqoQlog, qtrace, qwarn, Datagram, Encoder, IpTos, IpTosEcn, +}; use neqo_crypto::random; use crate::{ @@ -569,8 +571,19 @@ impl Path { qlog: NeqoQlog, now: Instant, ) -> Self { - let iface_mtu = - mtu::interface_and_mtu(&(local, remote)).map_or_else(|_| usize::MAX, |(_, m)| m); + // We're passing `None` into `mtu::interface_and_mtu` here, which force the lookup to only + // take the local address into account. Taking the remote address into account would require + // a call to `connect`, which Firefox blocklists for Rust dependencies. + let iface_mtu = match mtu::interface_and_mtu(&(local.ip(), remote)) { + Ok((name, mtu)) => { + qdebug!("Outbound interface {name} has MTU {mtu}"); + mtu + } + Err(e) => { + qwarn!("Failed to determine outbound interface: {e}"); + usize::MAX + } + }; let mut sender = PacketSender::new(cc, pacing, Pmtud::new(remote.ip(), iface_mtu), now); sender.set_qlog(qlog.clone()); Self {