]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MINOR: quic: fix counters used on BE side
authorAmaury Denoyelle <adenoyelle@haproxy.com>
Fri, 20 Feb 2026 10:05:20 +0000 (11:05 +0100)
committerAmaury Denoyelle <adenoyelle@haproxy.com>
Fri, 20 Feb 2026 13:08:27 +0000 (14:08 +0100)
quic_conn is initialized with a pointer to its proxy counters. These
counters are then updated during the connection lifetime.

Counters pointer was incorrect for backend quic_conn, as it always
referenced frontend counters. For pure backend, no stats would be
updated. For listen instances, this resulted in incorrect stats
reporting.

Fix this by correctly set proxy counters based on the connection side.

This must be backported up to 3.3.

include/haproxy/quic_conn.h
src/quic_conn.c

index e769b343a66c1bb346a5126a3604d74ce707bdfe..5eb9f92c3ebb763c105e9f639ba9199bf12e54fa 100644 (file)
@@ -193,7 +193,11 @@ static inline void *qc_counters(enum obj_type *o, const struct stats_module *m)
        p = l ? l->bind_conf->frontend :
                s ? s->proxy : NULL;
 
-       return p ? EXTRA_COUNTERS_GET(p->extra_counters_fe, m) : NULL;
+       if (l && p)
+               return EXTRA_COUNTERS_GET(p->extra_counters_fe, m);
+       else if (s && p)
+               return EXTRA_COUNTERS_GET(p->extra_counters_be, m);
+       return NULL;
 }
 
 void chunk_frm_appendf(struct buffer *buf, const struct quic_frame *frm);
index 264fb0487779fb29fd81c33564121e46015bc1b8..3784740108f340c571715d5a4c9564a097eadf61 100644 (file)
@@ -1222,7 +1222,6 @@ struct quic_conn *qc_new_conn(void *target,
        /* Packet number spaces */
        qc->ipktns = qc->hpktns = qc->apktns = NULL;
        LIST_INIT(&qc->pktns_list);
-       qc->prx_counters = EXTRA_COUNTERS_GET(prx->extra_counters_fe, &quic_stats_module);
 
        qc->cids = pool_alloc(pool_head_quic_cids);
        if (!qc->cids) {
@@ -1252,6 +1251,8 @@ struct quic_conn *qc_new_conn(void *target,
                qc->odcid = initial_pkt->dcid;
                /* Copy the packet SCID to reuse it as DCID for sending */
                qc->dcid = initial_pkt->scid;
+
+               qc->prx_counters = EXTRA_COUNTERS_GET(prx->extra_counters_fe, &quic_stats_module);
        }
        /* QUIC Client (outgoing connection to servers) */
        else {
@@ -1273,6 +1274,8 @@ struct quic_conn *qc_new_conn(void *target,
                        goto err;
                qc->dcid.len = sizeof(qc->dcid.data);
                qc->odcid = qc->dcid;
+
+               qc->prx_counters = EXTRA_COUNTERS_GET(prx->extra_counters_be, &quic_stats_module);
        }
 
        qc->err = quic_err_transport(QC_ERR_NO_ERROR);