From: Frederic Lecaille Date: Thu, 27 Aug 2026 13:59:41 +0000 (+0200) Subject: BUG/MINOR: quic: fix zero value of tune.quic.sec.stateless-reset-rate X-Git-Tag: v3.5-dev6~41 X-Git-Url: https://git.kaiwu.me/?a=commitdiff_plain;h=af4106fb297777b72d6c05dc7fb9c51e021c02fe;p=haproxy.git BUG/MINOR: quic: fix zero value of tune.quic.sec.stateless-reset-rate quic_stateless_reset_rate_init() split across threads as (rate + tid) / nbthread, which can round down to 0 when is lower than . send_stateless_reset() reads a 0 value as "no limit", so a low 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. --- diff --git a/doc/configuration.txt b/doc/configuration.txt index ae5f44ccc..fa9b418f4 100644 --- a/doc/configuration.txt +++ b/doc/configuration.txt @@ -5367,10 +5367,10 @@ tune.quic.mem.tx-max tune.quic.sec.stateless-reset-rate 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 - 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 does not divide evenly among the threads, the real + total emitted per second across all threads can be higher than . The default value is 1000. diff --git a/src/quic_tx.c b/src/quic_tx.c index 00193fd9b..43ce8fc57 100644 --- a/src/quic_tx.c +++ b/src/quic_tx.c @@ -2379,12 +2379,11 @@ REGISTER_UNITTEST("quic_tx", quic_tx_unittest); 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);