]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: quic: adjust CID conn tree alloc in qc_new_conn()
authorAmaury Denoyelle <adenoyelle@haproxy.com>
Thu, 6 Nov 2025 15:24:37 +0000 (16:24 +0100)
committerAmaury Denoyelle <adenoyelle@haproxy.com>
Mon, 10 Nov 2025 11:10:14 +0000 (12:10 +0100)
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

index 0cc9b6ed9ffe8a622dd8ec321314a7f8bc55aba6..aba6d0cf846342aecd45e69d54a82dbeffb12552 100644 (file)
@@ -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);