]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: quic: remove <ipv4> arg from qc_new_conn()
authorAmaury Denoyelle <adenoyelle@haproxy.com>
Wed, 12 Nov 2025 10:36:09 +0000 (11:36 +0100)
committerAmaury Denoyelle <adenoyelle@haproxy.com>
Mon, 17 Nov 2025 09:20:54 +0000 (10:20 +0100)
Remove <ipv4> argument from qc_new_conn(). This parameter is unnecessary
as it can be derived from the family type of the addresses also passed
as argument.

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

index 0c8c77c6372b0253725a3ca989443bb00849fef9..3c447c73d30c24e772c8d7fd8444863652a5a582 100644 (file)
@@ -64,7 +64,7 @@ struct task *quic_conn_app_io_cb(struct task *t, void *context, unsigned int sta
 
 void quic_conn_closed_err_count_inc(struct quic_conn *qc, struct quic_frame *frm);
 int qc_h3_request_reject(struct quic_conn *qc, uint64_t id);
-struct quic_conn *qc_new_conn(void *target, int ipv4,
+struct quic_conn *qc_new_conn(void *target,
                               const struct quic_rx_packet *initial_pkt,
                               const struct quic_cid *token_odcid,
                               struct quic_connection_id *conn_id,
index 9dc690d1c5b1691c94a94ba11bfb92419786371a..7495cf82304570e46683ad2c49f1e8962096a88f 100644 (file)
@@ -1095,7 +1095,7 @@ struct task *qc_process_timer(struct task *task, void *ctx, unsigned int state)
 
 /* Allocate a new QUIC connection. <target> represents the internal connection
  * endpoint, either a listener for a server-side connection or a server on
- * client side. <ipv4> boolean is set to 1 for IPv4 connection or 0 for IPv6.
+ * client side.
  *
  * On server side, <initial_pkt> must points to the client INITIAL packet which
  * initiate this connection allocation. It is used as a source to determine the
@@ -1113,7 +1113,7 @@ struct task *qc_process_timer(struct task *task, void *ctx, unsigned int state)
  *
  * Returns the newly allocated quic_conn instance on success or NULL on error.
  */
-struct quic_conn *qc_new_conn(void *target, int ipv4,
+struct quic_conn *qc_new_conn(void *target,
                               const struct quic_rx_packet *initial_pkt,
                               const struct quic_cid *token_odcid,
                               struct quic_connection_id *conn_id,
@@ -1338,7 +1338,7 @@ struct quic_conn *qc_new_conn(void *target, int ipv4,
        qc->max_ack_delay = 0;
        /* Only one path at this time (multipath not supported) */
        qc->path = &qc->paths[0];
-       quic_cc_path_init(qc->path, ipv4,
+       quic_cc_path_init(qc->path, peer_addr->ss_family == AF_INET,
                          l ? l->bind_conf->max_cwnd : quic_tune.be.cc_max_win_size,
                          cc_algo ? cc_algo : default_quic_cc_algo, qc);
 
index 6714c903766676e0d9543dad33649df2946865ab..f4e3f7d6bab347fcfd85922fad036d296ec0c2b2 100644 (file)
@@ -1722,7 +1722,6 @@ static struct quic_conn *quic_rx_pkt_retrieve_conn(struct quic_rx_packet *pkt,
 
                if (!qc) {
                        struct quic_connection_id *conn_id;
-                       int ipv4;
 
                        /* Reject INITIAL early if listener limits reached. */
                        if (unlikely(HA_ATOMIC_LOAD(&l->rx.quic_curr_handshake) >=
@@ -1798,7 +1797,6 @@ static struct quic_conn *quic_rx_pkt_retrieve_conn(struct quic_rx_packet *pkt,
                        }
 
                        pkt->saddr = dgram->saddr;
-                       ipv4 = dgram->saddr.ss_family == AF_INET;
 
                        conn_id = quic_cid_alloc();
                        if (!conn_id) {
@@ -1825,7 +1823,7 @@ static struct quic_conn *quic_rx_pkt_retrieve_conn(struct quic_rx_packet *pkt,
                                pool_free(pool_head_quic_connection_id, conn_id);
                        }
                        else {
-                               qc = qc_new_conn(l, ipv4, pkt, &token_odcid,
+                               qc = qc_new_conn(l, pkt, &token_odcid,
                                                 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. */
index 913fda80383b20d72ac6aad4722637575b7eece1..ca7d4e9f9c2903a379af70a3b12705f3d6283220 100644 (file)
@@ -136,7 +136,6 @@ static int qc_conn_init(struct connection *conn, void **xprt_ctx)
        }
        else {
                int retry_rand_cid = 3; /* Number of random retries on CID collision. */
-               int ipv4 = conn->dst->ss_family == AF_INET;
                struct server *srv = objt_server(conn->target);
 
                conn_id = quic_cid_alloc();
@@ -162,7 +161,7 @@ static int qc_conn_init(struct connection *conn, void **xprt_ctx)
                        goto out;
                }
 
-               qc = qc_new_conn(srv, ipv4, NULL, NULL, conn_id, NULL, &srv->addr);
+               qc = qc_new_conn(srv, NULL, NULL, conn_id, NULL, &srv->addr);
                if (!qc) {
                        pool_free(pool_head_quic_connection_id, conn_id);
                        goto out;