From b8cb8e1a65c52b8111a0cb6cab9574688c0e5f57 Mon Sep 17 00:00:00 2001 From: Amaury Denoyelle Date: Fri, 20 Feb 2026 11:05:20 +0100 Subject: [PATCH] BUG/MINOR: quic: fix counters used on BE side 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 | 6 +++++- src/quic_conn.c | 5 ++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/include/haproxy/quic_conn.h b/include/haproxy/quic_conn.h index e769b343a..5eb9f92c3 100644 --- a/include/haproxy/quic_conn.h +++ b/include/haproxy/quic_conn.h @@ -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); diff --git a/src/quic_conn.c b/src/quic_conn.c index 264fb0487..378474010 100644 --- a/src/quic_conn.c +++ b/src/quic_conn.c @@ -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); -- 2.47.3