Repository navigation
feat: Shuffle the client Initial crypto data - #2228
Conversation
Look for ranges of `N` or more bytes of graphical ASCII data in `data`. Create at least one split point for each range, multiple ones each `N` bytes if the range is long enough. Create data chunks based on those split points. Shuffle the chunks and return them. CC @martinthomson @dennisjackson
Failed Interop TestsQUIC Interop Runner, client vs. server 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
|
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #2228 +/- ##
==========================================
+ Coverage 95.38% 95.39% +0.01%
==========================================
Files 112 113 +1
Lines 36593 36683 +90
==========================================
+ Hits 34903 34994 +91
+ Misses 1690 1689 -1 ☔ View full report in Codecov by Sentry. |
Benchmark resultsPerformance differences relative to c6d5502. coalesce_acked_from_zero 1+1 entries: Change within noise threshold. time: [98.372 ns 98.696 ns 99.034 ns]
change: [-1.3417% -0.7152% -0.2178%] (p = 0.01 < 0.05)
coalesce_acked_from_zero 3+1 entries: Change within noise threshold. time: [116.67 ns 117.04 ns 117.44 ns]
change: [-0.8933% -0.5158% -0.1757%] (p = 0.01 < 0.05)
coalesce_acked_from_zero 10+1 entries: Change within noise threshold. time: [116.23 ns 116.58 ns 117.01 ns]
change: [-0.9375% -0.4989% -0.0836%] (p = 0.02 < 0.05)
coalesce_acked_from_zero 1000+1 entries: No change in performance detected. time: [97.661 ns 101.56 ns 110.40 ns]
change: [+0.0832% +3.4703% +9.5705%] (p = 0.22 > 0.05)
RxStreamOrderer::inbound_frame(): 💔 Performance has regressed. time: [114.39 ms 114.47 ms 114.54 ms]
change: [+2.6355% +2.7211% +2.8008%] (p = 0.00 < 0.05)
SentPackets::take_ranges: No change in performance detected. time: [5.5185 µs 5.6965 µs 5.8883 µs]
change: [-2.6985% +0.4724% +3.6310%] (p = 0.77 > 0.05)
transfer/pacing-false/varying-seeds: No change in performance detected. time: [26.085 ms 27.055 ms 28.019 ms]
change: [-2.7087% +2.9087% +8.8336%] (p = 0.31 > 0.05)
transfer/pacing-true/varying-seeds: No change in performance detected. time: [33.267 ms 34.933 ms 36.601 ms]
change: [-4.7335% +1.6798% +8.9963%] (p = 0.64 > 0.05)
transfer/pacing-false/same-seed: No change in performance detected. time: [24.999 ms 25.778 ms 26.554 ms]
change: [-4.8756% -0.8536% +3.3036%] (p = 0.69 > 0.05)
transfer/pacing-true/same-seed: No change in performance detected. time: [39.864 ms 41.951 ms 44.104 ms]
change: [-5.8674% +1.1545% +8.7258%] (p = 0.74 > 0.05)
1-conn/1-100mb-resp/mtu-1504 (aka. Download)/client: No change in performance detected. time: [899.71 ms 909.17 ms 918.77 ms]
thrpt: [108.84 MiB/s 109.99 MiB/s 111.15 MiB/s]
change:
time: [-1.0575% +0.4603% +1.9740%] (p = 0.56 > 0.05)
thrpt: [-1.9358% -0.4582% +1.0688%]
1-conn/10_000-parallel-1b-resp/mtu-1504 (aka. RPS)/client: Change within noise threshold. time: [314.69 ms 317.96 ms 321.30 ms]
thrpt: [31.124 Kelem/s 31.450 Kelem/s 31.778 Kelem/s]
change:
time: [-3.4925% -2.1493% -0.7494%] (p = 0.00 < 0.05)
thrpt: [+0.7551% +2.1965% +3.6189%]
1-conn/1-1b-resp/mtu-1504 (aka. HPS)/client: No change in performance detected. time: [33.531 ms 33.723 ms 33.925 ms]
thrpt: [29.477 elem/s 29.653 elem/s 29.823 elem/s]
change:
time: [-1.0394% -0.1718% +0.7032%] (p = 0.70 > 0.05)
thrpt: [-0.6983% +0.1721% +1.0503%]
1-conn/1-100mb-resp/mtu-1504 (aka. Upload)/client: Change within noise threshold. time: [1.6757 s 1.6942 s 1.7129 s]
thrpt: [58.380 MiB/s 59.026 MiB/s 59.676 MiB/s]
change:
time: [+0.1173% +1.8842% +3.6179%] (p = 0.04 < 0.05)
thrpt: [-3.4916% -1.8494% -0.1172%]
Client/server transfer resultsTransfer of 33554432 bytes over loopback.
|
martinthomson
left a comment
There was a problem hiding this comment.
I spent a few minutes writing some code that might be a good replacement for this if you only care about splitting at a useful point. This would be used by drawing a random value in the range (r.start + 1..end - 1) to split on. It's a lot less code...
/// Finds the range where the SNI extension lives.
/// If this isn't a ClientHello, then return the whole message.
fn find_sni_split(mut buf: &[u8]) -> Range<usize> {
fn read_len(buf: &[u8]) -> usize {
let mut len = 0;
for v in buf {
len = len << 8 & usize::from(v);
}
len
}
fn skip_vec<const N: usize>(i: usize, buf: &[u8]) -> usize {
i + N + read_len(&buf[i..i + N])
}
// ClientHello == 1
if buf[0] == 1 {
let mut i = 1 + 3 + 2 + 32; // msg_type, length, version, random
i = skip_vec::<1>(i, buf); // session_id
i = skip_vec::<2>(i, buf); // cipher_suites
i = skip_vec::<1>(i, buf); // compression_methods
i += 2; // extensions length
while i < buf.len() {
if buf[i] == 0 || buf[i + 1] == 0 {
// SNI!
return i..i + 4 + read_len(buf[i + 2..i + 4]);
}
}
}
0..buf.len()
}
Thanks for this, but I think it needs more work? I don't think this handles invalid crypto data well, |
|
Fair. It was only a few minutes of work. Adding bounds checks will complicate it a little, but not overmuch. Of course, you could take the attitude I did, which is that the TLS stack should not be producing invalid messages, so panicking in that case is justified. |
|
I am nervous about making assumptions about the input. But let me play with it and see how much complexity bounds checking adds. |
|
Ah, it wasn't that; there were some minor nits that caused it to misbehave. |
Co-authored-by: Martin Thomson <mt@lowentropy.net> Signed-off-by: Lars Eggert <lars@eggert.org>
…feat-initial-mixer
Co-authored-by: Martin Thomson <mt@lowentropy.net> Signed-off-by: Lars Eggert <lars@eggert.org>
`compatible_upgrade_large_initial` tests whether Neqo can handle an ACK using QUIC version Y on a connection that ends up using QUIC version X. mozilla#2228 changed the test, asserting that the server will drop 2 instead of 1 packet. This spuriosly fails on CI: https://github.com/mozilla/neqo/actions/runs/12796212878/job/35675377711?pr=2295 This commit allows both 1 and 2 packets dropped by the server.
`compatible_upgrade_large_initial` tests whether Neqo can handle an ACK using QUIC version Y on a connection that ends up using QUIC version X. #2228 changed the test, asserting that the server will drop 2 instead of 1 packet. This spuriosly fails on CI: https://github.com/mozilla/neqo/actions/runs/12796212878/job/35675377711?pr=2295 This commit allows both 1 and 2 packets dropped by the server.
Find the index range of the SNI extension in
data, splitdatain half at the midpoint of the SNI extension, and return the two halves and their respective starting indexes in reverse order.CC @martinthomson @dennisjackson