]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: quic: remove connection arg from qc_new_conn()
authorAmaury Denoyelle <adenoyelle@haproxy.com>
Tue, 4 Nov 2025 16:47:42 +0000 (17:47 +0100)
committerAmaury Denoyelle <adenoyelle@haproxy.com>
Tue, 4 Nov 2025 16:47:42 +0000 (17:47 +0100)
This patch is similar to the previous one, this time dealing with
qc_new_conn(). This function was asymetric on frontend and backend side,
as connection argument was set only in the latter case.

This was required prior due to qc_alloc_ssl_sock_ctx() signature. This
has changed with the previous patch, thus qc_new_conn() can also be
realigned on both FE and BE sides. <conn> member of quic_conn instance
is always set outside it, in qc_xprt_start() on the backend case.

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

index db32934ef57050b23af668de2ed2153ebe12d611..b48b53f87a081e0bcea42a8ca449484c0a598ae3 100644 (file)
@@ -70,8 +70,7 @@ struct quic_conn *qc_new_conn(const struct quic_version *qv, int ipv4,
                               struct quic_connection_id *conn_id,
                               struct sockaddr_storage *local_addr,
                               struct sockaddr_storage *peer_addr,
-                              int token, void *owner,
-                              struct connection *conn);
+                              int token, void *owner);
 int quic_build_post_handshake_frames(struct quic_conn *qc);
 const struct quic_version *qc_supported_version(uint32_t version);
 int quic_peer_validated_addr(struct quic_conn *qc);
index 98a9820b2f7bc0366dce1f92a37844293cd470ce..e6d59cfe8f45294f0fe01d4c695fd5653a54ae76 100644 (file)
@@ -1079,8 +1079,7 @@ struct quic_conn *qc_new_conn(const struct quic_version *qv, int ipv4,
                               struct quic_connection_id *conn_id,
                               struct sockaddr_storage *local_addr,
                               struct sockaddr_storage *peer_addr,
-                              int token, void *target,
-                              struct connection *conn)
+                              int token, void *target)
 {
        struct quic_conn *qc = NULL;
        struct listener *l = objt_listener(target);
@@ -1151,7 +1150,6 @@ struct quic_conn *qc_new_conn(const struct quic_version *qv, int ipv4,
        qc->idle_timer_task = NULL;
 
        qc->xprt_ctx = NULL;
-        /* We must not free the quic-conn if upper conn is still allocated. */
        qc->conn = NULL;
        qc->qcc = NULL;
        qc->app_ops = NULL;
@@ -1228,7 +1226,6 @@ struct quic_conn *qc_new_conn(const struct quic_version *qv, int ipv4,
                conn_id = conn_cid;
 
                qc->next_cid_seq_num = 1;
-               conn->handle.qc = qc;
        }
        qc->mux_state = QC_MUX_NULL;
        qc->err = quic_err_transport(QC_ERR_NO_ERROR);
@@ -1367,7 +1364,6 @@ struct quic_conn *qc_new_conn(const struct quic_version *qv, int ipv4,
        if (!qc_new_isecs(qc, &qc->iel->tls_ctx, qc->original_version, dcid->data, dcid->len, !!l))
                goto err;
 
-       qc->conn = conn;
        /* Counters initialization */
        memset(&qc->cntrs, 0, sizeof qc->cntrs);
 
index 56078b6cea0195312cf1b918ffe1f46ea9e1e623..ee31d54a460234b9dfee8dd42545d66ea45f8c41 100644 (file)
@@ -1746,7 +1746,7 @@ static struct quic_conn *quic_rx_pkt_retrieve_conn(struct quic_rx_packet *pkt,
 
                        qc = qc_new_conn(pkt->version, ipv4, &pkt->dcid, &pkt->scid, &token_odcid,
                                         conn_id, &dgram->daddr, &pkt->saddr,
-                                        !!pkt->token_len, l, NULL);
+                                        !!pkt->token_len, l);
                        if (qc == NULL) {
                                pool_free(pool_head_quic_connection_id, conn_id);
                                goto err;
index dbcbb4caf997d2b8bb60dfd3609480277c1d5de8..12b838c038a1386be7fa01fc374a927cdda46619 100644 (file)
@@ -124,9 +124,12 @@ static int qc_conn_init(struct connection *conn, void **xprt_ctx)
                int ipv4 = conn->dst->ss_family == AF_INET;
                struct server *srv = objt_server(conn->target);
                qc = qc_new_conn(quic_version_1, ipv4, NULL, NULL, NULL,
-                                NULL, NULL, &srv->addr, 0, srv, conn);
-               if (qc)
+                                NULL, NULL, &srv->addr, 0, srv);
+               if (qc) {
                        conn->flags |= CO_FL_SSL_WAIT_HS | CO_FL_WAIT_L6_CONN;
+                       conn->handle.qc = qc;
+                       qc->conn = conn;
+               }
        }
 
        if (!qc)