commit 067b8e963928a39eadca429969ae77edc8b01f29
parent a6ae06cf45b00c15f3262c856735c6900fe696ef
Author: Max Leonard Inden <mail@max-inden.de>
Date: Tue, 18 Nov 2025 11:49:33 +0000
Bug 1909910 - enable QUIC PMTUD r=necko-reviewers,kershaw
Differential Revision: https://phabricator.services.mozilla.com/D223575
Diffstat:
5 files changed, 38 insertions(+), 7 deletions(-)
diff --git a/modules/libpref/init/StaticPrefList.yaml b/modules/libpref/init/StaticPrefList.yaml
@@ -15436,6 +15436,13 @@
value: 30
mirror: always
+# Whether to enable Packetization Layer Path MTU Discovery.
+- name: network.http.http3.pmtud
+ type: RelaxedAtomicBool
+ value: true
+ mirror: always
+ rust: true
+
# When true, a http request will be upgraded to https when HTTPS RR is
# available.
- name: network.dns.upgrade_with_https_rr
diff --git a/netwerk/socket/neqo_glue/src/lib.rs b/netwerk/socket/neqo_glue/src/lib.rs
@@ -423,6 +423,8 @@ impl NeqoHttp3Conn {
let pmtud_enabled =
// Check if PMTUD is explicitly enabled,
pmtud_enabled
+ // or enabled via pref,
+ || static_prefs::pref!("network.http.http3.pmtud")
// but disable PMTUD if NSPR is used (socket == None) or
// transmitted UDP datagrams might get fragmented by the IP layer.
&& socket.as_ref().map_or(false, |s| !s.may_fragment());
diff --git a/netwerk/test/unit/test_http3_coalescing.js b/netwerk/test/unit/test_http3_coalescing.js
@@ -39,6 +39,7 @@ registerCleanupFunction(async () => {
Services.prefs.clearUserPref(
"network.dns.httpssvc.http3_fast_fallback_timeout"
);
+ Services.prefs.clearUserPref("network.http.http3.pmtud");
Services.prefs.clearUserPref(
"network.http.http3.alt-svc-mapping-for-testing"
);
@@ -72,6 +73,14 @@ function channelOpenPromise(chan, flags) {
}
async function H3CoalescingTest(host1, host2) {
+ // Disable PMTUD (Path MTU Discovery) to avoid race condition between DNS
+ // resolution (to validate whether we can coalesce) and new connection
+ // attempt. Long term one might not want to start the new connection attempt
+ // in the first place.
+ //
+ // See Bug 1909910 for more details.
+ Services.prefs.setBoolPref("network.http.http3.pmtud", false);
+
Services.prefs.setCharPref(
"network.http.http3.alt-svc-mapping-for-testing",
`${host1};h3=:${h3Port}`
diff --git a/netwerk/test/unit/xpcshell.toml b/netwerk/test/unit/xpcshell.toml
@@ -765,6 +765,7 @@ skip-if = [
"os == 'win' && os_version == '10.2009' && processor == 'x86_64'", # Bug 1808049
"os == 'win' && os_version == '11.26100' && processor == 'x86_64'", # Bug 1808049
"os == 'win' && os_version == '11.26100' && processor == 'x86'", # Bug 1808049
+ "verify", # Bug 2000787
]
["test_http3_direct_proxy.js"]
diff --git a/testing/web-platform/tests/webtransport/datagrams.https.any.js b/testing/web-platform/tests/webtransport/datagrams.https.any.js
@@ -199,13 +199,25 @@ promise_test(async t => {
const writer = wt.datagrams.writable.getWriter();
const reader = wt.datagrams.readable.getReader();
- // Write and read max-size datagram.
- await writer.write(new Uint8Array(wt.datagrams.maxDatagramSize+1));
- // This should resolve with no datagram sent, which is hard to test for.
- // Wait for incoming datagrams to arrive, and if they do, fail.
- const result = await Promise.race([reader.read(), wait(500)]);
- assert_equals(result, undefined);
-}, 'Fail to transfer max-size+1 datagram');
+ let maxDatagramSize = wt.datagrams.maxDatagramSize;
+
+ while (true) {
+ // Write and read max-size datagram.
+ await writer.write(new Uint8Array(maxDatagramSize + 1));
+ // This should resolve with no datagram sent, which is hard to test for.
+ // Wait for incoming datagrams to arrive, and if they do, fail.
+ const result = await Promise.race([reader.read(), wait(500)]);
+ if (result === undefined) {
+ return; // Success, no datagram received, exit the test early.
+ }
+
+ // Maybe QUIC's PMTUD increased the max-size datagram in the meantime. If
+ // so, try again.
+ const currentMaxDatagramSize = wt.datagrams.maxDatagramSize;
+ assert_greater_than(currentMaxDatagramSize, maxDatagramSize);
+ maxDatagramSize = currentMaxDatagramSize;
+ }
+}, 'Fail to transfer max-size+1 datagram, handle PMTUD increases');
promise_test(async t => {
// Make a WebTransport connection, but session is not necessarily established.