From 0ef473ba6b3f5b555aec1b3ef93debb0db3660ac Mon Sep 17 00:00:00 2001 From: Amaury Denoyelle Date: Thu, 6 Nov 2025 16:24:37 +0100 Subject: [PATCH] MINOR: quic: adjust CID conn tree alloc in qc_new_conn() Change qc_new_conn() so that the connection CID tree is allocated earlier in the function. This patch does not introduce a behavior change. Its objective is to facilitate future evolutions on CIDs handling. This patch is a prerequisite for the fix on CID collision, thus it must be backported prior to it to every affected version. --- src/quic_conn.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/quic_conn.c b/src/quic_conn.c index 0cc9b6ed9..aba6d0cf8 100644 --- a/src/quic_conn.c +++ b/src/quic_conn.c @@ -1176,6 +1176,13 @@ struct quic_conn *qc_new_conn(const struct quic_version *qv, int ipv4, 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) { + TRACE_ERROR("Could not allocate a new CID tree", QUIC_EV_CONN_INIT, qc); + goto err; + } + *qc->cids = EB_ROOT; + /* QUIC Server (or listener). */ if (l) { cc_algo = l->bind_conf->quic_cc_algo; @@ -1251,13 +1258,6 @@ struct quic_conn *qc_new_conn(const struct quic_version *qv, int ipv4, goto err; } - qc->cids = pool_alloc(pool_head_quic_cids); - if (!qc->cids) { - TRACE_ERROR("Could not allocate a new CID tree", QUIC_EV_CONN_INIT, qc); - goto err; - } - - *qc->cids = EB_ROOT; if (!l) { /* Attach the current CID to the connection */ eb64_insert(qc->cids, &conn_id->seq_num);