From a83ed86b78b68fa98283a603f7ba98c38f6366e3 Mon Sep 17 00:00:00 2001 From: Christopher Faulet Date: Wed, 3 Dec 2025 14:30:30 +0100 Subject: [PATCH] MEDIUM: quic: Add connection as argument when qc_new_conn() is called 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 | 1 + src/quic_conn.c | 3 ++- src/quic_rx.c | 2 +- src/xprt_quic.c | 3 +-- 4 files changed, 5 insertions(+), 4 deletions(-) diff --git a/include/haproxy/quic_conn.h b/include/haproxy/quic_conn.h index 84318c1bf..e769b343a 100644 --- a/include/haproxy/quic_conn.h +++ b/include/haproxy/quic_conn.h @@ -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); diff --git a/src/quic_conn.c b/src/quic_conn.c index 38f2208d9..264fb0487 100644 --- a/src/quic_conn.c +++ b/src/quic_conn.c @@ -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; diff --git a/src/quic_rx.c b/src/quic_rx.c index 797844476..9aed7b288 100644 --- a/src/quic_rx.c +++ b/src/quic_rx.c @@ -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); diff --git a/src/xprt_quic.c b/src/xprt_quic.c index e6ca5a361..ca687f021 100644 --- a/src/xprt_quic.c +++ b/src/xprt_quic.c @@ -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;