Commit 617f8d83 authored by jan.koester's avatar jan.koester
Browse files

quic: start at 1200-byte datagrams and let PMTUD climb

Sending 1472-byte datagrams from the start assumed a 1500-byte path. On
paths that silently drop anything larger (PPPoE, tunnels, mobile) the
first full-size response packet and every same-size retransmit were
black-holed, so H3 responses larger than one packet never completed.
Start at the RFC 8899 base of 1200; the existing DPLPMTUD probing raises
it to the confirmed size (1468 over loopback).

Co-Authored-By: default avatarClaude Opus 5.5 <noreply@anthropic.com>
parent dd4dd65c
Loading
Loading
Loading
Loading
+11 −6
Changes for src/socket.h: 11 added lines, 6 removed lines.
Original line number Diff line number Diff line
@@ -857,16 +857,15 @@ namespace netplus {
		// Path MTU Discovery (DPLPMTUD, RFC 8899 / RFC 9000 §14.3-14.4).
		// Probing starts automatically once the handshake completes — no
		// separate enable call needed. This raises the ceiling the
		// post-handshake prober searches toward; the default (1472)
		// matches the fixed pre-discovery baseline exactly, so leaving it
		// untouched is a no-op. The peer's advertised max_udp_payload_size
		// post-handshake prober searches toward from the 1200-byte
		// baseline (default ceiling 1472). The peer's advertised max_udp_payload_size
		// transport parameter always applies as an additional hard ceiling
		// on top of this value. A listening socket's setting is copied to
		// every connection it accepts (see quic::accept()).
		void setPmtuCeiling(uint64_t ceiling) { _pmtud_ceiling = ceiling; }

		// Currently confirmed usable UDP payload size for this
		// connection's sends — 1472 until (and unless) PMTU discovery has
		// connection's sends — 1200 until (and unless) PMTU discovery has
		// probed something larger.
		uint64_t getMaxUdpPayload() const { return _max_udp_payload; }

@@ -1862,9 +1861,15 @@ namespace netplus {

		// Transport parameters
		uint64_t _max_idle_timeout = 30000;    // 30s
		uint64_t _max_udp_payload = 1472;      // Default: Ethernet-safe (1500 - IP/UDP headers).
		uint64_t _max_udp_payload = 1200;      // RFC 8899 BASE_PLPMTU / RFC 9000 §14 minimum.
		                                        // Also doubles as PMTUD's "current confirmed
		                                        // send size" — see pmtudTick().
		                                        // send size" — see pmtudTick(), which probes up
		                                        // toward _pmtud_ceiling after the handshake.
		                                        // Starting at 1472 assumed a full 1500-byte path:
		                                        // on PPPoE (1492), tunnels or mobile links every
		                                        // full-size packet -- and every retransmit of it,
		                                        // same size -- was black-holed, stalling the
		                                        // stream forever (seen on tuxist.de, 11-14).
		uint64_t _active_connection_id_limit = 2;

		// Path MTU Discovery ceilings (see setPmtuCeiling()). _pmtud_ceiling
+7 −4
Changes for test/quic_rfc9000_test.cpp: 7 added lines, 4 removed lines.
Original line number Diff line number Diff line
@@ -704,8 +704,9 @@ static void test_idle_survival() {
static void test_pmtu_discovery() {
    std::cout << "\n=== RFC 9000 §14.3-14.4: Path MTU Discovery ===" << std::endl;

    // Default ceiling (1472) must be a no-op: discovery never raises the
    // confirmed send size past today's fixed baseline unless asked to.
    // Default ceiling (1472): sends start at the RFC 8899 1200-byte base
    // and discovery climbs to (within PMTUD_CONVERGE of) the ceiling over
    // loopback -- but never past it unless the ceiling is raised.
    {
        quic client;
        client.setTrustPolicy(netplus::TlsTrustPolicy{false});  // test-only self-signed cert, no CA chain to verify
@@ -715,8 +716,10 @@ static void test_pmtu_discovery() {
            client.pumpNetwork(MSG_DONTWAIT);
            std::this_thread::sleep_for(std::chrono::microseconds(200));
        }
        check(client.getMaxUdpPayload() == 1472,
              "Default ceiling: confirmed size stays at the 1472 baseline");
        uint64_t confirmed = client.getMaxUdpPayload();
        std::cout << "    Default-ceiling max_udp_payload: " << confirmed << std::endl;
        check(confirmed > 1200 && confirmed <= 1472,
              "Default ceiling: discovery climbs from 1200 but stays within 1472");
    }

    // Raising the ceiling should let the client discover a larger usable