Skip to content

fix(quic): send MTU probes only on a validated path - #7788

Merged
kixelated merged 2 commits into
moq-dev:mainfrom
ramiscaleai:fix/quic-mtu-probe-unvalidated-path
Nov 4, 2026
Merged

kixelated merged 2 commits into
moq-dev:mainfrom
ramiscaleai:fix/quic-mtu-probe-unvalidated-path

Conversation

@ramiscaleai

@ramiscaleai ramiscaleai commented Nov 4, 2026 •

Copy link
Copy Markdown
Contributor

Problem

After a peer migrates to a new address, Connection::transmit restarts MTU discovery on the new path. The MTU probe is built at the end of transmit, after the loop that checks anti_amplification_blocked, so it is never counted against the 3x limit of RFC 9000 section 8. Every ACK of a probe from the unvalidated address releases the next, larger probe. If the PATH_CHALLENGE to that address is lost, the path stays amplification-blocked: the server can neither repeat the challenge nor keep its loss timer armed until the peer sends several times more data.

The regression test reproduces it. Without the fix the server sends an MTU probe to the unvalidated address. With that probe check removed from the test, the same run also sends 5,115 bytes to an address it had received 766 bytes from, past 3x plus two datagrams of slack.

This is quinn-rs/quinn#2981 (commit aea1e538, by Jacob Thrane Lund; 0.11.x backport quinn-rs/quinn#2984). The fork has the same code, and rs/moq-quic/README.md says upstream fixes are ported by hand with their regression tests.

Approach

Send an MTU probe only when self.path.validated. Both endpoints validate the handshake path before the connection is established, so only MTU discovery on a migrated path waits, until its PATH_RESPONSE arrives. The new test migration_mtu_probes_respect_anti_amplification_limit ports upstream's to the fork's Pair harness: it migrates the client to a new IP, loses every PATH_CHALLENGE, and checks the server's bytes against 3x what it received and that no probe goes out. Then it lets one through and checks that the path validates and MTU discovery runs back up to the full MTU. The README lists the port and moves the "checked through" markers to quinn aea1e538 and 0.11.x 77a51bdc, the only commits since the previous markers.

Impact

  • No public API or wire change.
  • After a migration, MTU discovery on the new path starts once the path is validated instead of immediately. Connections that do not migrate are unaffected.
  • moq-quic is not on release, so there is nothing to backport.

Alternatives

  • Count the probe against the anti-amplification budget (anti_amplification_blocked(probe_size)) instead of deferring it. A probe is a full-MTU datagram and the unvalidated budget is needed for the PATH_CHALLENGE, so deferring until validation is simpler and matches upstream.

Follow-ups

None.

Testing

cargo test -p moq-quic --lib migration_mtu_probes_respect_anti_amplification_limit
  without the fix: FAILED, 25 of 25 runs: "server sent an MTU probe to an unvalidated address" (left: 5, right: 4)
  with the fix:    ok, 25 of 25 runs
cargo test -p moq-quic                       # 735 passed, 0 failed, 19 ignored (the new test included)
cargo clippy --locked --all-targets -p moq-quic -- -D warnings
cargo fmt --all --check
RUSTDOCFLAGS="-D warnings" cargo doc --locked --no-deps -p moq-quic

I ran these per crate, not through just ci. This host has no pkg-config, so the build dropped pipewire and libspa from rs/workspace-hack/Cargo.toml locally; that edit is not in the diff.

Review

Reviewed by a maintainer review agent at head 94585d4233 (914237eeb3 plus a merge of main, no conflicts).

  • Scope: only rs/moq-quic/README.md, src/connection/mod.rs and src/tests/mod.rs. No build scripts, CI or network-fetching code.
  • Upstream: the transmit change is identical to quinn-rs/quinn aea1e538 (quinn-rs/quinn#2981). The test is upstream's, adapted to the fork's harness. step_losing_server_datagrams filters with lose and then hands off to drive_server. Like upstream's inline loop, drive_server drops datagrams over pair.mtu and delivers only to client.addr.
  • RFC 9000: §8 and §9.3 limit all data sent to an unvalidated address to 3× what was received from it. §14 does not exempt PMTU probes, so deferring probes until the path is validated is compliant.
  • Tests: cargo test -p moq-quic --lib passes (735 passed, 19 ignored). With the self.path.validated condition reverted, migration_mtu_probes_respect_anti_amplification_limit fails: "server sent an MTU probe to an unvalidated address" (5 vs 4).
  • quest review --base origin/main (Codex gpt-6.1-sol, round 1): 0 findings.

AI disclosure: Claude Code (an AI coding agent) ported this fix and its regression test, and drafted this description. The tests above were run locally.

(Written by Claude Opus 5.5)

🤖 Generated with Claude Code

When a peer migrates to a new address, the server restarts MTU discovery
on the new path. The probe is built at the end of `transmit`, past the
anti-amplification check that guards regular datagrams, so the server
probed an address it had not validated beyond the 3x limit of RFC 9000
section 8. Each ACK of a probe released the next, larger one, and a lost
PATH_CHALLENGE left the path amplification-blocked.

Probe only a validated path. Both endpoints validate the handshake path
before the connection is established, so this only defers MTU discovery
on a migrated path until its PATH_RESPONSE arrives.

Ports quinn-rs/quinn#2981 (aea1e538) with its regression test, and
records it in the fork's README.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>

@kixelated kixelated left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Automated review by review (OpenAI)

Reviewed head: 914237e

No actionable findings. Deferring MTU probes until path validation matches the upstream fix and preserves discovery after validation; the regression checks both the unvalidated and recovered paths.

Verification: GitHub-only static review of the port, path validation and fork test harness. I did not execute builds or tests. The byte assertion allows existing datagram slack, so it does not establish strict 3× compliance independently of the probe fix.

(Written by review, OpenAI)

@coderabbitai

coderabbitai Bot commented Nov 4, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review.

Walkthrough

MTU discovery probes are now sent only when the connection is established and the current path is validated. A migration test checks probe behavior and the anti-amplification allowance before and after path validation. The README records the upstream fix and updates the sync checkpoint.

Merge Risk: Minimal · up to 91423

The change prevents MTU probes on unvalidated paths and adds coverage for discovery resuming after validation. No merge-blocking issue is identified in the supplied evidence.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 66.67% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documenta… Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Title check Passed The title names the main change: MTU probes are now sent only on a validated path, which matches the connection/mod.rs change gating probes on self.path.validated. It is short, specific, and uses the …
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Description check Passed The description directly explains the MTU probe change, anti-amplification issue, regression test, affected files, testing, and expected impact. It is clearly related to the changeset.
Full details: Title check

Explanation

The title names the main change: MTU probes are now sent only on a validated path, which matches the connection/mod.rs change gating probes on self.path.validated. It is short, specific, and uses the conventional fix(quic) prefix. It does not mention the new test, which is expected.

Full details: Docstring Coverage

Explanation

Docstring coverage is 66.67% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 3 functions across 2 files. (1 skipped: 1 unsupported.)

Resolution

Write docstrings for the functions missing them to satisfy the coverage threshold.

Finishing Touches
Simplify code
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share
Recent review info
Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: e60eb152-1ded-4ce3-a2a2-3b2f0f33e90f
Commits

Reviewing files that changed from the base of the PR and between 9a29bc1 and 914237e.

Files selected for processing: 3
  • rs/moq-quic/README.md
  • rs/moq-quic/src/connection/mod.rs
  • rs/moq-quic/src/tests/mod.rs

Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 3 remain after this review.

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ No new issues found.

Reviewed changes

Reviewed the single commit porting quinn aea1e538 (0.11.x 77a51bdc) to the fork.

  • MTU probe gated on validation (rs/moq-quic/src/connection/mod.rs:1163): the only MTU probe emission site now requires self.path.validated, matching upstream exactly. This closes the anti-amplification bypass after a migration, and the initial handshake path is already validated before state.is_established(), so non-migrated connections are unaffected.
  • Regression test (rs/moq-quic/src/tests/mod.rs:4386): ports upstream's migration_mtu_probes_respect_anti_amplification_limit, including the 3x budget check and the assertion that no probe reaches an unvalidated address, then confirms MTU discovery resumes after validation. The local step_losing_server_datagrams helper differs in implementation but has the same effective loss behavior: drive_server drops datagrams to any address other than the client's current one.
  • README sync markers (rs/moq-quic/README.md:29): records the port and advances both checked-through markers. I verified against the upstream compare API that aea1e538 and 77a51bdc are the only commits after the previous markers.

cargo fmt --all -- --check passes. I could not run the new test here because libspa-sys fails to build without libpipewire-0.3 in this environment, the same limitation the author notes. The test semantics and the fix match upstream, so I have no concerns.

(Written by deepseek/deepseek-v4.1-flash-1017)

Pullfrog  | View workflow run | Using deepseek-v4.1-flash-1017 (free via Pullfrog for OSS) | 𝕏

@kixelated
kixelated added this pull request to the merge queue Nov 4, 2026
Merged via the queue into moq-dev:main with commit fd07f5b Nov 4, 2026
8 of 9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants