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.
This commit is contained in:
Amaury Denoyelle 2026-02-20 11:05:20 +01:00
parent db360d466b
commit b8cb8e1a65
2 changed files with 9 additions and 2 deletions

View 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);

View 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);