]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: quic: Move transport parmaters to anynomous struct.
authorFrédéric Lécaille <flecaille@haproxy.com>
Thu, 28 Jan 2021 15:22:52 +0000 (16:22 +0100)
committerAmaury Denoyelle <adenoyelle@haproxy.com>
Thu, 23 Sep 2021 13:27:25 +0000 (15:27 +0200)
We move ->params transport parameters to ->rx.params. They are the
transport parameters which will be sent to the peer, and used for
the endpoint flow control. So, they will be used to received packets
from the peer (RX part).
Also move ->rx_tps transport parameters to ->tx.params. They are the
transport parameter which are sent by the peer, and used to respect
its flow control limits. So, they will be used when sending packets
to the peer (TX part).

include/haproxy/xprt_quic-t.h
include/haproxy/xprt_quic.h
src/quic_sock.c
src/xprt_quic.c

index 2b89e4a8a718c08e80b96caf19d46cb13a1ac8db..ed994659fe9e70824882649cdafa2723ff218f37 100644 (file)
@@ -571,8 +571,6 @@ struct quic_path {
 struct quic_conn {
        uint32_t version;
 
-       /* Transport parameters. */
-       struct quic_transport_params params;
        unsigned char enc_params[QUIC_TP_MAX_ENCLEN]; /* encoded QUIC transport parameters */
        size_t enc_params_len;
 
@@ -589,9 +587,6 @@ struct quic_conn {
        struct eb_root cids;
 
        struct quic_enc_level els[QUIC_TLS_ENC_LEVEL_MAX];
-
-       struct quic_transport_params rx_tps;
-
        struct quic_pktns pktns[QUIC_TLS_PKTNS_MAX];
 
        /* Used only to reach the tasklet for the I/O handler from this quic_conn object. */
@@ -620,10 +615,14 @@ struct quic_conn {
                 * when sending probe packets.
                 */
                int nb_pto_dgrams;
+               /* Transport parameters sent by the peer */
+               struct quic_transport_params params;
        } tx;
        struct {
                /* Number of received bytes. */
                uint64_t bytes;
+               /* Transport parameters the peer will receive */
+               struct quic_transport_params params;
        } rx;
        unsigned int max_ack_delay;
        struct quic_path paths[1];
index 423419e28950aa2c93e38afc1ae55173daf05ba4..c2471cc8818d6330e3e6b3c06735d2d843429b81 100644 (file)
@@ -499,7 +499,7 @@ static inline void quic_packet_number_encode(unsigned char **buf,
 static inline unsigned int quic_ack_delay_ms(struct quic_ack *ack_frm,
                                              struct quic_conn *conn)
 {
-       return ack_frm->ack_delay << conn->rx_tps.ack_delay_exponent;
+       return ack_frm->ack_delay << conn->tx.params.ack_delay_exponent;
 }
 
 /* Initialize <dst> transport parameters from <quic_dflt_trasports_parame>.
@@ -958,11 +958,11 @@ static inline int quic_transport_params_store(struct quic_conn *conn, int server
                                               const unsigned char *buf,
                                               const unsigned char *end)
 {
-       if (!quic_transport_params_decode(&conn->rx_tps, server, buf, end))
+       if (!quic_transport_params_decode(&conn->tx.params, server, buf, end))
                return 0;
 
-       if (conn->rx_tps.max_ack_delay)
-               conn->max_ack_delay = conn->rx_tps.max_ack_delay;
+       if (conn->tx.params.max_ack_delay)
+               conn->max_ack_delay = conn->tx.params.max_ack_delay;
 
        return 1;
 }
index 6c1f2d04c5b4e47f9a004d9ae5cdcdfc92a19a2a..f349932f5fe193f4564beb34f0f12121ec329993 100644 (file)
@@ -161,18 +161,18 @@ struct connection *quic_sock_accept_conn(struct listener *l, int *status)
                              pkt->scid.data, pkt->scid.len))
                goto err;
 
-       odcid = &qc->params.original_destination_connection_id;
+       odcid = &qc->rx.params.original_destination_connection_id;
        /* Copy the transport parameters. */
-       qc->params = l->bind_conf->quic_params;
+       qc->rx.params = l->bind_conf->quic_params;
        /* Copy original_destination_connection_id transport parameter. */
        memcpy(odcid->data, &pkt->dcid, pkt->odcid_len);
        odcid->len = pkt->odcid_len;
        /* Copy the initial source connection ID. */
-       quic_cid_cpy(&qc->params.initial_source_connection_id, &qc->scid);
+       quic_cid_cpy(&qc->rx.params.initial_source_connection_id, &qc->scid);
        qc->enc_params_len =
                quic_transport_params_encode(qc->enc_params,
                                             qc->enc_params + sizeof qc->enc_params,
-                                            &qc->params, 1);
+                                            &qc->rx.params, 1);
        if (!qc->enc_params_len)
                goto err;
 
index 1c8e9de851cb9e353ec40ec1c048a1e60057fccc..851d2f467b4357a91e6595aaffc683dabd19c0b9 100644 (file)
@@ -1881,7 +1881,7 @@ static int quic_build_post_handshake_frames(struct quic_conn *conn)
                LIST_APPEND(&conn->tx.frms_to_send, &frm->list);
        }
 
-       for (i = 1; i < conn->rx_tps.active_connection_id_limit; i++) {
+       for (i = 1; i < conn->tx.params.active_connection_id_limit; i++) {
                struct quic_connection_id *cid;
 
                frm = pool_alloc(pool_head_quic_frame);
@@ -4115,13 +4115,13 @@ static int qc_conn_init(struct connection *conn, void **xprt_ctx)
                                          &ctx->ssl, &ctx->bio, ha_quic_meth, ctx) == -1) 
                        goto err;
 
-               quic_conn->params = srv->quic_params;
+               quic_conn->rx.params = srv->quic_params;
                /* Copy the initial source connection ID. */
-               quic_cid_cpy(&quic_conn->params.initial_source_connection_id, &quic_conn->scid);
+               quic_cid_cpy(&quic_conn->rx.params.initial_source_connection_id, &quic_conn->scid);
                quic_conn->enc_params_len =
                        quic_transport_params_encode(quic_conn->enc_params,
                                                     quic_conn->enc_params + sizeof quic_conn->enc_params,
-                                                    &quic_conn->params, 0);
+                                                    &quic_conn->rx.params, 0);
                if (!quic_conn->enc_params_len)
                        goto err;