Repository navigation
fix(http3/connect-udp): parse context id as varint - #3018
Conversation
MASQUE connect-udp prefixes each proxied UDP datagram payload with a context ID. A context ID is a varint. > Context IDs are 62-bit integers (0 to 262-1). Context IDs are encoded as > variable-length integers; see Section 16 of [QUIC]. https://www.rfc-editor.org/rfc/rfc9298.html#section-4 Previously the code would parse the first byte only, checking whether it is 0x00. But 0x00 is not the only varint encoding of 0. Another e.g. is 0x40 0x00. This commit properly parses the context ID as a varint. --- Fixes mozilla#3017
There was a problem hiding this comment.
Pull Request Overview
This PR fixes the parsing of context IDs in HTTP/3 MASQUE connect-udp datagrams to properly handle varint encoding as specified in RFC 9298. Previously, the code only checked the first byte for 0x00, but context ID 0 can be encoded in multiple varint formats (e.g., 0x00 or 0x40 0x00).
- Replace byte-by-byte parsing with proper varint decoding using
Decoder::decode_varint() - Update error type to handle 64-bit context IDs instead of 8-bit values
- Add comprehensive test coverage for different varint encodings of context ID 0
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| neqo-http3/src/features/extended_connect/session.rs | Update error enum to use u64 for context IDs |
| neqo-http3/src/features/extended_connect/connect_udp_session.rs | Implement proper varint parsing and add test coverage |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #3018 +/- ##
==========================================
- Coverage 93.40% 93.37% -0.04%
==========================================
Files 123 123
Lines 35716 35724 +8
Branches 35716 35724 +8
==========================================
- Hits 33361 33357 -4
- Misses 1509 1521 +12
Partials 846 846
|
Client/server transfer resultsPerformance differences relative to f6821b3. Transfer of 33554432 bytes over loopback, min. 100 runs. All unit-less numbers are in milliseconds.
Download data for |
Benchmark resultsPerformance differences relative to f6821b3. 1-conn/1-100mb-resp/mtu-1504 (aka. Download)/client: No change in performance detected. time: [200.86 ms 201.29 ms 201.85 ms]
thrpt: [495.43 MiB/s 496.80 MiB/s 497.86 MiB/s]
change:
time: [−0.2232% +0.0758% +0.4093%] (p = 0.65 > 0.05)
thrpt: [−0.4077% −0.0758% +0.2237%]
1-conn/10_000-parallel-1b-resp/mtu-1504 (aka. RPS)/client: Change within noise threshold. time: [291.82 ms 293.59 ms 295.39 ms]
thrpt: [33.854 Kelem/s 34.061 Kelem/s 34.268 Kelem/s]
change:
time: [−2.4614% −1.6373% −0.7932%] (p = 0.00 < 0.05)
thrpt: [+0.7995% +1.6646% +2.5235%]
1-conn/1-1b-resp/mtu-1504 (aka. HPS)/client: Change within noise threshold. time: [28.468 ms 28.569 ms 28.691 ms]
thrpt: [34.854 B/s 35.003 B/s 35.127 B/s]
change:
time: [+0.1155% +0.4658% +0.9658%] (p = 0.02 < 0.05)
thrpt: [−0.9566% −0.4636% −0.1153%]
1-conn/1-100mb-req/mtu-1504 (aka. Upload)/client: No change in performance detected. time: [208.70 ms 209.00 ms 209.36 ms]
thrpt: [477.65 MiB/s 478.46 MiB/s 479.17 MiB/s]
change:
time: [−0.2259% −0.0076% +0.2204%] (p = 0.95 > 0.05)
thrpt: [−0.2199% +0.0076% +0.2264%]
decode 4096 bytes, mask ff: Change within noise threshold. time: [11.594 µs 11.615 µs 11.644 µs]
change: [−0.7142% −0.3549% +0.0027%] (p = 0.05 < 0.05)
decode 1048576 bytes, mask ff: No change in performance detected. time: [3.0221 ms 3.0331 ms 3.0448 ms]
change: [−0.1881% +0.2898% +0.7843%] (p = 0.24 > 0.05)
decode 4096 bytes, mask 7f: No change in performance detected. time: [19.945 µs 19.996 µs 20.055 µs]
change: [−0.8418% −0.3371% +0.1264%] (p = 0.18 > 0.05)
decode 1048576 bytes, mask 7f: No change in performance detected. time: [5.0409 ms 5.0561 ms 5.0740 ms]
change: [−0.3575% +0.0877% +0.5044%] (p = 0.69 > 0.05)
decode 4096 bytes, mask 3f: No change in performance detected. time: [8.2827 µs 8.3219 µs 8.3665 µs]
change: [−0.8219% +0.0969% +0.8249%] (p = 0.84 > 0.05)
decode 1048576 bytes, mask 3f: No change in performance detected. time: [1.5867 ms 1.5936 ms 1.6006 ms]
change: [−0.5980% +0.0152% +0.6292%] (p = 0.89 > 0.05)
1-streams/each-1000-bytes/wallclock-time: No change in performance detected. time: [592.09 µs 594.01 µs 596.23 µs]
change: [−0.0868% +0.4653% +0.9903%] (p = 0.09 > 0.05)
1000-streams/each-1-bytes/wallclock-time: No change in performance detected. time: [13.985 ms 14.009 ms 14.034 ms]
change: [−0.3030% −0.0643% +0.1852%] (p = 0.61 > 0.05)
1000-streams/each-1-bytes/simulated-time: No change in performance detected. time: [14.975 s 14.990 s 15.004 s]
thrpt: [66.649 B/s 66.713 B/s 66.777 B/s]
change:
time: [−0.2271% −0.0917% +0.0443%] (p = 0.19 > 0.05)
thrpt: [−0.0443% +0.0918% +0.2276%]
1000-streams/each-1000-bytes/wallclock-time: Change within noise threshold. time: [50.547 ms 50.726 ms 50.918 ms]
change: [+0.8774% +1.3613% +1.8768%] (p = 0.00 < 0.05)
coalesce_acked_from_zero 1+1 entries: No change in performance detected. time: [88.209 ns 88.510 ns 88.804 ns]
change: [−0.7070% −0.1409% +0.4249%] (p = 0.64 > 0.05)
coalesce_acked_from_zero 3+1 entries: No change in performance detected. time: [106.17 ns 106.59 ns 107.03 ns]
change: [−0.3858% +0.0754% +0.5557%] (p = 0.75 > 0.05)
coalesce_acked_from_zero 10+1 entries: No change in performance detected. time: [105.46 ns 105.81 ns 106.26 ns]
change: [−1.1406% −0.1526% +0.8016%] (p = 0.78 > 0.05)
coalesce_acked_from_zero 1000+1 entries: No change in performance detected. time: [89.218 ns 89.368 ns 89.540 ns]
change: [−0.9603% +0.1542% +1.2508%] (p = 0.79 > 0.05)
RxStreamOrderer::inbound_frame(): Change within noise threshold. time: [110.18 ms 110.29 ms 110.45 ms]
change: [+0.3150% +0.4519% +0.6145%] (p = 0.00 < 0.05)
sent::Packets::take_ranges: :green_heart: Performance has improved. time: [4.5135 µs 4.6212 µs 4.7228 µs]
change: [−7.0650% −4.1535% −1.0614%] (p = 0.01 < 0.05)
transfer/pacing-false/varying-seeds/wallclock-time/run: Change within noise threshold. time: [26.067 ms 26.104 ms 26.143 ms]
change: [−0.9842% −0.7749% −0.5602%] (p = 0.00 < 0.05)
transfer/pacing-false/varying-seeds/simulated-time/run: No change in performance detected. time: [25.116 s 25.150 s 25.185 s]
thrpt: [162.64 KiB/s 162.86 KiB/s 163.09 KiB/s]
change:
time: [−0.2866% −0.0777% +0.1287%] (p = 0.47 > 0.05)
thrpt: [−0.1285% +0.0778% +0.2874%]
transfer/pacing-true/varying-seeds/wallclock-time/run: No change in performance detected. time: [26.703 ms 26.773 ms 26.846 ms]
change: [−0.5900% −0.2206% +0.1474%] (p = 0.25 > 0.05)
transfer/pacing-true/varying-seeds/simulated-time/run: No change in performance detected. time: [24.965 s 25.007 s 25.049 s]
thrpt: [163.52 KiB/s 163.79 KiB/s 164.07 KiB/s]
change:
time: [−0.0757% +0.1656% +0.4050%] (p = 0.19 > 0.05)
thrpt: [−0.4034% −0.1653% +0.0758%]
transfer/pacing-false/same-seed/wallclock-time/run: No change in performance detected. time: [26.027 ms 26.056 ms 26.098 ms]
change: [−0.0175% +0.1350% +0.3259%] (p = 0.12 > 0.05)
transfer/pacing-false/same-seed/simulated-time/run: No change in performance detected. time: [25.152 s 25.152 s 25.152 s]
thrpt: [162.85 KiB/s 162.85 KiB/s 162.85 KiB/s]
change:
time: [+0.0000% +0.0000% +0.0000%] (p = NaN > 0.05)
thrpt: [+0.0000% +0.0000% +0.0000%]
transfer/pacing-true/same-seed/wallclock-time/run: Change within noise threshold. time: [27.747 ms 27.784 ms 27.836 ms]
change: [−1.8767% −1.7309% −1.5263%] (p = 0.00 < 0.05)
transfer/pacing-true/same-seed/simulated-time/run: No change in performance detected. time: [25.588 s 25.588 s 25.588 s]
thrpt: [160.07 KiB/s 160.07 KiB/s 160.07 KiB/s]
change:
time: [+0.0000% +0.0000% +0.0000%] (p = NaN > 0.05)
thrpt: [+0.0000% +0.0000% +0.0000%]
Download data for |
Failed Interop TestsQUIC Interop Runner, client vs. server, differences relative to f6821b3. neqo-latest as client
neqo-latest as server
All resultsSucceeded Interop TestsQUIC Interop Runner, client vs. server neqo-latest as client
neqo-latest as server
Unsupported Interop TestsQUIC Interop Runner, client vs. server neqo-latest as client
neqo-latest as server
|
MASQUE connect-udp prefixes each proxied UDP datagram payload with a context ID. A context ID is a varint.
https://www.rfc-editor.org/rfc/rfc9298.html#section-4
Previously the code would parse the first byte only, checking whether it is 0x00. But 0x00 is not the only varint encoding of 0. Another e.g. is 0x40 0x00.
This commit properly parses the context ID as a varint.
Fixes #3017