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