quic_stateless_reset_rate_init() split <quic_tune.sec_stateless_reset_rate>
across threads as (rate + tid) / nbthread, which can round down to 0 when
<rate> is lower than <nbthread>. send_stateless_reset() reads a 0 value as
"no limit", so a low <rate> silently disabled rate limiting on some
threads instead of restricting it further.
Fix it by giving every thread the same value, rounded up so it can never
reach 0: (rate + nbthread - 1) / nbthread. Updated the doc accordingly.
This bug was introduced by commit
297321e3e ("MINOR: quic: add
tune.quic.sec.stateless-reset-rate"), only present in this dev branch,
so no backport is needed.
tune.quic.sec.stateless-reset-rate <number>
Sets the maximum total number of QUIC Stateless Reset packets emitted per
- second, across all threads. Each thread gets its own even share of this
- total, so the actual number sent per second may be slightly under or over
- <number> depending on how evenly it divides by the thread count, but the
- total across all threads never drifts from it over time.
+ second, across all threads. Each thread is given the same share of this
+ total, rounded up so that share always stays strictly positive. As a
+ result, when <number> does not divide evenly among the threads, the real
+ total emitted per second across all threads can be higher than <number>.
The default value is 1000.
static int quic_stateless_reset_rate_init(void)
{
- /* split N across threads so the totals add up to exactly N: this
- * thread gets (N + tid) / nbthread. No flat ceil() here, since that
- * could push the total above N.
+ /* every thread gets the same share: (rate + nbthread - 1) / nbthread,
+ * which stays strictly positive for any rate >= 1.
*/
quic_stateless_reset_rate =
- (quic_tune.sec_stateless_reset_rate + tid) / global.nbthread;
+ (quic_tune.sec_stateless_reset_rate + global.nbthread - 1) / global.nbthread;
return 1;
}
REGISTER_PER_THREAD_INIT(quic_stateless_reset_rate_init);