Skip to content

fix: discard retry with scid matching the initial dcid - #3785

Merged
martinthomson merged 2 commits into
mozilla:mainfrom
uwezkhan:retry-scid-matches-dcid
Jul 7, 2026
Merged

martinthomson merged 2 commits into
mozilla:mainfrom
uwezkhan:retry-scid-matches-dcid

Conversation

@uwezkhan

@uwezkhan uwezkhan commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

handle_retry validates a received Retry against a duplicate Retry, an empty token, and a bad integrity tag, but never compares the Retry's Source Connection ID to the Destination Connection ID the client used in its Initial. RFC 9000 Section 17.2.5.2 requires a client to discard a Retry whose Source Connection ID matches that Destination Connection ID. The Retry integrity key is a fixed public value, so a valid tag does not by itself show the Retry came from the server; a party that observed the Initial can compute one, which is why this comparison exists.

Before, such a Retry was adopted: the client took its Source Connection ID as the new remote CID, saved the token, and re-keyed the initial secrets. After, the packet is dropped and the client stays in WaitInitial. The check sits beside the existing integrity check in handle_retry, the one place a client processes a Retry, so no caller needs a separate guard. The tradeoff is a stricter client that discards one more Retry shape, against the negligible case of a server that reuses the client's random Initial DCID as its own connection ID.

@larseggert

Copy link
Copy Markdown
Collaborator

@uwezkhan thanks for all the contributions, including this one. Can we send you some Mozilla swag as a little thank you?

@codecov

codecov Bot commented Jul 6, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 96.77%. Comparing base (358b69b) to head (5f66f1c).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3785      +/-   ##
==========================================
- Coverage   96.92%   96.77%   -0.16%     
==========================================
  Files         115      120       +5     
  Lines       40371    40723     +352     
  Branches    40371    40723     +352     
==========================================
+ Hits        39131    39410     +279     
- Misses       1225     1288      +63     
- Partials       15       25      +10     
Flag Coverage Δ
freebsd 94.13% <90.90%> (-0.14%) ⬇️
linux 96.95% <100.00%> (+<0.01%) ⬆️
macos 95.07% <90.90%> (-0.01%) ⬇️
windows 95.12% <90.90%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Components Coverage Δ
neqo-common 99.09% <ø> (ø)
neqo-http3 95.39% <ø> (ø)
neqo-qpack 97.31% <ø> (ø)
neqo-transport 97.72% <100.00%> (+<0.01%) ⬆️
neqo-udp 95.37% <ø> (ø)
mtu 89.13% <ø> (ø)
🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@codspeed

codspeed Bot commented Jul 6, 2026 •

Copy link
Copy Markdown
Contributor

Merging this PR will improve performance by 5.07%

⚡ 1 improved benchmark
✅ 67 untouched benchmarks
⏩ 39 skipped benchmarks1

Performance Changes

Mode Benchmark BASE HEAD Efficiency
⚡ Simulation simulated/10-streams/each-1048576-bytes 248.4 ms 236.4 ms +5.07%

Tip

Curious why this is faster? Comment @codspeedbot explain why this is faster on this PR, or directly use the CodSpeed MCP with your agent.


Comparing uwezkhan:retry-scid-matches-dcid (5f66f1c) with main (358b69b)

Open in CodSpeed

Footnotes

  1. 39 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports. ↩

@martinthomson martinthomson left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This is really good. Thanks.

@uwezkhan

uwezkhan commented Jul 6, 2026

Copy link
Copy Markdown
Contributor Author

@uwezkhan thanks for all the contributions, including this one. Can we send you some Mozilla swag as a little thank you?

Thanks Lars that's really kind I'd be happy to. What's the best way to get you my shipping details? Didn't want to drop my address in the thread here.

@larseggert

Copy link
Copy Markdown
Collaborator

@uwezkhan please email me at leggert [at] mozilla.com

@uwezkhan

uwezkhan commented Jul 6, 2026

Copy link
Copy Markdown
Contributor Author

please email me at leggert [at] mozilla.com

Will do.

@martinthomson
martinthomson enabled auto-merge July 6, 2026 23:32
@github-actions

github-actions Bot commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

Benchmark results

Significant performance differences relative to 358b69b.

transfer/1-conn/1-100mb-req (aka. Upload): 💔 Performance has regressed by +9.3822%.
       time:   [163.70 ms 169.86 ms 176.86 ms]
       thrpt:  [565.41 MiB/s 588.72 MiB/s 610.88 MiB/s]
change:
       time:   [+5.6289% +9.3822% +13.292] (p = 0.00 < 0.05)
       thrpt:  [-11.732% -8.5774% -5.3289]
       Performance has regressed.
Found 17 outliers among 100 measurements (17.00%)
17 (17.00%) high severe
streams/walltime/1000-streams/each-1-bytes: 💚 Performance has improved by -1.3410%.
       time:   [10.926 ms 10.942 ms 10.959 ms]
       thrpt:  [89.108 KiB/s 89.245 KiB/s 89.380 KiB/s]
change:
       time:   [-1.5612% -1.3410% -1.1307] (p = 0.00 < 0.05)
       thrpt:  [+1.1437% +1.3592% +1.5860]
       Performance has improved.
streams/walltime/1000-streams/each-1000-bytes: 💚 Performance has improved by -2.2414%.
       time:   [31.484 ms 31.525 ms 31.568 ms]
       thrpt:  [30.210 MiB/s 30.251 MiB/s 30.291 MiB/s]
change:
       time:   [-2.4370% -2.2414% -2.0582] (p = 0.00 < 0.05)
       thrpt:  [+2.1014% +2.2928% +2.4978]
       Performance has improved.
Found 1 outliers among 100 measurements (1.00%)
1 (1.00%) high severe
All results
transfer/1-conn/1-100mb-resp (aka. Download): No change in performance detected.
       time:   [145.70 ms 146.08 ms 146.49 ms]
       thrpt:  [682.64 MiB/s 684.56 MiB/s 686.33 MiB/s]
change:
       time:   [-0.1215% +0.2346% +0.6279] (p = 0.23 > 0.05)
       thrpt:  [-0.6240% -0.2340% +0.1216]
       No change in performance detected.
Found 2 outliers among 100 measurements (2.00%)
1 (1.00%) high mild
1 (1.00%) high severe
transfer/1-conn/10_000-parallel-1b-resp (aka. RPS): No change in performance detected.
       time:   [260.84 ms 262.49 ms 264.14 ms]
       thrpt:  [37.859 Kelem/s 38.097 Kelem/s 38.338 Kelem/s]
change:
       time:   [-0.3710% +0.5531% +1.4810] (p = 0.24 > 0.05)
       thrpt:  [-1.4594% -0.5500% +0.3724]
       No change in performance detected.
transfer/1-conn/1-1b-resp (aka. HPS): No change in performance detected.
       time:   [38.497 ms 38.642 ms 38.804 ms]
       thrpt:  [25.770   B/s 25.878   B/s 25.976   B/s]
change:
       time:   [-0.6105% -0.0448% +0.5747] (p = 0.88 > 0.05)
       thrpt:  [-0.5715% +0.0449% +0.6142]
       No change in performance detected.
Found 6 outliers among 100 measurements (6.00%)
1 (1.00%) low mild
1 (1.00%) high mild
4 (4.00%) high severe
transfer/1-conn/1-100mb-req (aka. Upload): 💔 Performance has regressed by +9.3822%.
       time:   [163.70 ms 169.86 ms 176.86 ms]
       thrpt:  [565.41 MiB/s 588.72 MiB/s 610.88 MiB/s]
change:
       time:   [+5.6289% +9.3822% +13.292] (p = 0.00 < 0.05)
       thrpt:  [-11.732% -8.5774% -5.3289]
       Performance has regressed.
Found 17 outliers among 100 measurements (17.00%)
17 (17.00%) high severe
streams/walltime/1-streams/each-1000-bytes: No change in performance detected.
       time:   [548.95 µs 553.34 µs 560.15 µs]
       thrpt:  [1.7025 MiB/s 1.7235 MiB/s 1.7373 MiB/s]
change:
       time:   [-0.4397% +0.5245% +1.9591] (p = 0.41 > 0.05)
       thrpt:  [-1.9215% -0.5218% +0.4416]
       No change in performance detected.
Found 13 outliers among 100 measurements (13.00%)
4 (4.00%) high mild
9 (9.00%) high severe
streams/walltime/1000-streams/each-1-bytes: 💚 Performance has improved by -1.3410%.
       time:   [10.926 ms 10.942 ms 10.959 ms]
       thrpt:  [89.108 KiB/s 89.245 KiB/s 89.380 KiB/s]
change:
       time:   [-1.5612% -1.3410% -1.1307] (p = 0.00 < 0.05)
       thrpt:  [+1.1437% +1.3592% +1.5860]
       Performance has improved.
streams/walltime/1000-streams/each-1000-bytes: 💚 Performance has improved by -2.2414%.
       time:   [31.484 ms 31.525 ms 31.568 ms]
       thrpt:  [30.210 MiB/s 30.251 MiB/s 30.291 MiB/s]
change:
       time:   [-2.4370% -2.2414% -2.0582] (p = 0.00 < 0.05)
       thrpt:  [+2.1014% +2.2928% +2.4978]
       Performance has improved.
Found 1 outliers among 100 measurements (1.00%)
1 (1.00%) high severe
streams-flow-controlled/walltime/1-streams/each-4194304-bytes: Change within noise threshold.
       time:   [27.007 ms 27.057 ms 27.108 ms]
       thrpt:  [147.56 MiB/s 147.84 MiB/s 148.11 MiB/s]
change:
       time:   [-1.1053% -0.8391% -0.5911] (p = 0.00 < 0.05)
       thrpt:  [+0.5946% +0.8462% +1.1176]
       Change within noise threshold.
Found 2 outliers among 100 measurements (2.00%)
2 (2.00%) high mild
streams-flow-controlled/walltime/10-streams/each-1048576-bytes: No change in performance detected.
       time:   [73.943 ms 74.460 ms 75.011 ms]
       thrpt:  [133.31 MiB/s 134.30 MiB/s 135.24 MiB/s]
change:
       time:   [-1.3022% -0.4018% +0.4975] (p = 0.41 > 0.05)
       thrpt:  [-0.4951% +0.4034% +1.3194]
       No change in performance detected.
Found 1 outliers among 100 measurements (1.00%)
1 (1.00%) high mild
transfer/walltime/pacing-false/varying-seeds: Change within noise threshold.
       time:   [18.245 ms 18.264 ms 18.292 ms]
       thrpt:  [218.68 MiB/s 219.01 MiB/s 219.24 MiB/s]
change:
       time:   [-0.7685% -0.6193% -0.4612] (p = 0.00 < 0.05)
       thrpt:  [+0.4633% +0.6232% +0.7745]
       Change within noise threshold.
Found 2 outliers among 100 measurements (2.00%)
1 (1.00%) high mild
1 (1.00%) high severe
transfer/walltime/pacing-true/varying-seeds: Change within noise threshold.
       time:   [18.784 ms 18.797 ms 18.810 ms]
       thrpt:  [212.65 MiB/s 212.80 MiB/s 212.94 MiB/s]
change:
       time:   [-0.4198% -0.2022% -0.0348] (p = 0.03 < 0.05)
       thrpt:  [+0.0348% +0.2026% +0.4216]
       Change within noise threshold.
Found 1 outliers among 100 measurements (1.00%)
1 (1.00%) high mild
transfer/walltime/pacing-false/same-seed: No change in performance detected.
       time:   [18.469 ms 18.493 ms 18.528 ms]
       thrpt:  [215.89 MiB/s 216.30 MiB/s 216.58 MiB/s]
change:
       time:   [-0.0989% +0.1079% +0.3338] (p = 0.37 > 0.05)
       thrpt:  [-0.3327% -0.1078% +0.0990]
       No change in performance detected.
Found 2 outliers among 100 measurements (2.00%)
1 (1.00%) high mild
1 (1.00%) high severe
transfer/walltime/pacing-true/same-seed: Change within noise threshold.
       time:   [18.679 ms 18.704 ms 18.738 ms]
       thrpt:  [213.47 MiB/s 213.86 MiB/s 214.15 MiB/s]
change:
       time:   [-1.1325% -0.8896% -0.6760] (p = 0.00 < 0.05)
       thrpt:  [+0.6806% +0.8976% +1.1454]
       Change within noise threshold.
Found 3 outliers among 100 measurements (3.00%)
1 (1.00%) high mild
2 (2.00%) high severe

Download data for profiler.firefox.com or download performance comparison data.

@github-actions

github-actions Bot commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

Failed Interop Tests

QUIC Interop Runner, client vs. server, differences relative to main at 358b69b.

neqo-pr as clientneqo-pr as server
neqo-pr vs. go-x-net: BP BA
neqo-pr vs. haproxy: BP BA
neqo-pr vs. kwik: BP BA
neqo-pr vs. lsquic: run cancelled after 20 min
neqo-pr vs. msquic: A L1 C1
neqo-pr vs. mvfst: A 🚀BA
neqo-pr vs. neqo: A
neqo-pr vs. nginx: BP BA
neqo-pr vs. ngtcp2: CM
neqo-pr vs. picoquic: A
neqo-pr vs. quic-go: A
neqo-pr vs. quic-zig: B
neqo-pr vs. quiche: BP BA
neqo-pr vs. s2n-quic: 🚀BA CM
neqo-pr vs. tquic: S BP BA
neqo-pr vs. xquic: A L1
aioquic vs. neqo-pr: CM
go-x-net vs. neqo-pr: CM
kwik vs. neqo-pr: BP BA CM
msquic vs. neqo-pr: ⚠️L1 CM
mvfst vs. neqo-pr: Z L1 C1 CM
neqo vs. neqo-pr: A
openssl vs. neqo-pr: LR M A CM
quic-go vs. neqo-pr: CM
quiche vs. neqo-pr: ⚠️L1 CM
quinn vs. neqo-pr: 🚀L1 V2 CM
s2n-quic vs. neqo-pr: CM
tquic vs. neqo-pr: CM
xquic vs. neqo-pr: M ⚠️L1 CM
All results

Succeeded Interop Tests

QUIC Interop Runner, client vs. server

neqo-pr as client

neqo-pr as server

Unsupported Interop Tests

QUIC Interop Runner, client vs. server

neqo-pr as client

neqo-pr as server

@github-actions

github-actions Bot commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

Client/server transfer results

Performance differences relative to 358b69b.

Transfer of 33554432 bytes over loopback, min. 100 runs. All unit-less numbers are in milliseconds.

Client vs. server (params) Mean ± σ Min Max MiB/s ± σ Δ baseline Δ baseline
google-neqo-cubic 264.3 ± 2.0 260.6 271.0 121.1 ± 16.0 💚 -1.0 -0.4%
msquic-neqo-cubic 145.2 ± 54.1 106.1 341.3 220.4 ± 0.6 💚 -22.1 -13.2%
neqo-google-cubic 773.4 ± 1.7 769.8 779.5 41.4 ± 18.8 💚 -1.0 -0.1%
neqo-quiche-cubic 188.2 ± 2.6 184.6 196.2 170.1 ± 12.3 💚 -0.8 -0.4%

Table above only shows statistically significant changes. See all results below.

All results

Transfer of 33554432 bytes over loopback, min. 100 runs. All unit-less numbers are in milliseconds.

Client vs. server (params) Mean ± σ Min Max MiB/s ± σ Δ baseline Δ baseline
google-google-nopacing 460.8 ± 1.6 456.2 465.7 69.4 ± 20.0
google-neqo-cubic 264.3 ± 2.0 260.6 271.0 121.1 ± 16.0 💚 -1.0 -0.4%
msquic-msquic-nopacing 147.2 ± 68.4 107.2 568.0 217.4 ± 0.5
msquic-neqo-cubic 145.2 ± 54.1 106.1 341.3 220.4 ± 0.6 💚 -22.1 -13.2%
neqo-google-cubic 773.4 ± 1.7 769.8 779.5 41.4 ± 18.8 💚 -1.0 -0.1%
neqo-msquic-cubic 145.4 ± 1.6 141.1 151.0 220.1 ± 20.0 0.1 0.1%
neqo-neqo-cubic 76.9 ± 3.1 70.2 85.7 416.4 ± 10.3 -0.1 -0.1%
neqo-neqo-cubic-nopacing 75.9 ± 3.9 69.6 101.9 421.8 ± 8.2 -0.6 -0.8%
neqo-neqo-newreno 76.5 ± 3.4 70.4 97.0 418.3 ± 9.4 -0.2 -0.2%
neqo-neqo-newreno-nopacing 76.2 ± 3.5 70.0 98.1 420.0 ± 9.1 -0.1 -0.2%
neqo-quiche-cubic 188.2 ± 2.6 184.6 196.2 170.1 ± 12.3 💚 -0.8 -0.4%
neqo-s2n-cubic 216.3 ± 2.2 210.7 226.8 147.9 ± 14.5 0.3 0.2%
quiche-neqo-cubic 178.4 ± 2.9 172.5 186.9 179.3 ± 11.0 0.3 0.2%
quiche-quiche-nopacing 139.1 ± 3.0 133.6 154.5 230.1 ± 10.7
s2n-neqo-cubic 211.7 ± 3.0 207.7 226.4 151.2 ± 10.7 -0.4 -0.2%
s2n-s2n-nopacing 292.9 ± 22.1 281.7 388.9 109.2 ± 1.4

Download data for profiler.firefox.com or download performance comparison data.

@martinthomson
martinthomson added this pull request to the merge queue Jul 7, 2026
Merged via the queue into mozilla:main with commit b7e2907 Jul 7, 2026
197 of 201 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.

3 participants