]> git.kaiwu.me - haproxy.git/commitdiff
BUG/MINOR: h3: remove ambiguity on NULL <prx_counters>
authorAmaury Denoyelle <adenoyelle@haproxy.com>
Wed, 2 Dec 2026 15:53:25 +0000 (16:53 +0100)
committerAmaury Denoyelle <adenoyelle@haproxy.com>
Thu, 3 Dec 2026 10:49:20 +0000 (11:49 +0100)
The h3c <prx_counters> member is initialized from the proxy, accessed
through the connection target. On the backend side, a server instance is
expected. Historically, a connection target could alternatively be set
to the proxy itself in specific configurations (dispatch and transparent
backends).

In practice, these cases were never usable with QUIC. However, the rest
of the HAProxy codebase is still written defensively around this case.
To remove the current ambiguity, add NULL checks before dereferencing
the <prx_counters> member in the two h3_stats.c helpers.

This must be backported up to 3.3, as this is only relevant since QUIC
backend support.

src/h3_stats.c

index de94e5c6752e21408fb7d6b758dd0ae465f2bd8e..75bff55782c0cdfe6fa965ce7ac54517aef66770 100644 (file)
@@ -263,6 +263,10 @@ INITCALL1(STG_REGISTER, stats_register_module, &h3_stats_module);
 
 void h3_inc_err_cnt(struct h3_counters *ctrs, int error_code)
 {
+       /* Only needed for dispatch/option transparent, though such connection cannot carry QUIC/H3. */
+       if (!ctrs)
+               return;
+
        switch (error_code) {
        case H3_ERR_NO_ERROR:
                HA_ATOMIC_INC(&ctrs->h3_no_error);
@@ -332,6 +336,10 @@ void h3_inc_err_cnt(struct h3_counters *ctrs, int error_code)
 
 void h3_inc_frame_type_cnt(struct h3_counters *ctrs, int frm_type)
 {
+       /* Only needed for dispatch/option transparent, though such connection cannot carry QUIC/H3. */
+       if (!ctrs)
+               return;
+
        switch (frm_type) {
        case H3_FT_DATA:
                HA_ATOMIC_INC(&ctrs->h3_data);