MINOR: quic: Move transport parmaters to anynomous struct.

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).
This commit is contained in:
Frédéric Lécaille 2021-01-28 16:22:52 +01:00 committed by Amaury Denoyelle
parent 577fe48890
commit 5aa4143d6c
4 changed files with 16 additions and 17 deletions

View 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];

View 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;
}

View 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;

View 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;