]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MEDIUM: quic: Add connection as argument when qc_new_conn() is called
authorChristopher Faulet <cfaulet@haproxy.com>
Wed, 3 Dec 2025 13:30:30 +0000 (14:30 +0100)
committerChristopher Faulet <cfaulet@haproxy.com>
Mon, 8 Dec 2025 14:22:00 +0000 (15:22 +0100)
This patch reverts the commit efe60745b ("MINOR: quic: remove connection arg
from qc_new_conn()"). The connection will be mandatory when the QUIC
connection is created on backend side to fix an issue when we try to reuse a
TLS session.

So, the connection is again an argument of qc_new_conn(), the 4th
argument. It is NULL for frontend QUIC connections but there is no special
check on it.

include/haproxy/quic_conn.h
src/quic_conn.c
src/quic_rx.c
src/xprt_quic.c

index 84318c1bfd35fb3f26b33f2ee2a3af630df23c26..e769b343a66c1bb346a5126a3604d74ce707bdfe 100644 (file)
@@ -67,6 +67,7 @@ int qc_h3_request_reject(struct quic_conn *qc, uint64_t id);
 struct quic_conn *qc_new_conn(void *target,
                               const struct quic_rx_packet *initial_pkt,
                               const struct quic_cid *token_odcid,
+                              struct connection *connection,
                               struct quic_connection_id *conn_id,
                               struct sockaddr_storage *local_addr,
                               struct sockaddr_storage *peer_addr);
index 38f2208d9ec941361268916aa293d076e627fa4b..264fb0487779fb29fd81c33564121e46015bc1b8 100644 (file)
@@ -1124,6 +1124,7 @@ struct task *qc_process_timer(struct task *task, void *ctx, unsigned int state)
 struct quic_conn *qc_new_conn(void *target,
                               const struct quic_rx_packet *initial_pkt,
                               const struct quic_cid *token_odcid,
+                              struct connection *conn,
                               struct quic_connection_id *conn_id,
                               struct sockaddr_storage *local_addr,
                               struct sockaddr_storage *peer_addr)
@@ -1198,7 +1199,7 @@ struct quic_conn *qc_new_conn(void *target,
        qc->idle_timer_task = NULL;
 
        qc->xprt_ctx = NULL;
-       qc->conn = NULL;
+       qc->conn = conn;
        qc->qcc = NULL;
        qc->app_ops = NULL;
        qc->path = NULL;
index 797844476d419cec856567fc3a2cdce9ca27501f..9aed7b288259b110726ffe82d380bc9ea149cac6 100644 (file)
@@ -1834,7 +1834,7 @@ static struct quic_conn *quic_rx_pkt_retrieve_conn(struct quic_rx_packet *pkt,
                        }
                        else {
                                qc = qc_new_conn(l, pkt, &token_odcid,
-                                                conn_id, &dgram->daddr, &pkt->saddr);
+                                                NULL, conn_id, &dgram->daddr, &pkt->saddr);
                                if (qc == NULL) {
                                        quic_cid_delete(conn_id); /* Removes CID from global tree as it points to a NULL qc. */
                                        pool_free(pool_head_quic_connection_id, conn_id);
index e6ca5a361821c15996c8c9317f8ce00812250549..ca687f021488535aa1a0c1e0544182939e667431 100644 (file)
@@ -165,7 +165,7 @@ static int qc_conn_init(struct connection *conn, void **xprt_ctx)
                        goto out;
                }
 
-               qc = qc_new_conn(srv, NULL, NULL, conn_id, NULL, &srv->addr);
+               qc = qc_new_conn(srv, NULL, NULL, conn, conn_id, NULL, &srv->addr);
                if (!qc) {
                        pool_free(pool_head_quic_connection_id, conn_id);
                        goto out;
@@ -175,7 +175,6 @@ static int qc_conn_init(struct connection *conn, void **xprt_ctx)
 
                conn->flags |= CO_FL_SSL_WAIT_HS | CO_FL_WAIT_L6_CONN | CO_FL_FDLESS;
                conn->handle.qc = qc;
-               qc->conn = conn;
        }
 
        ret = 0;