summaryrefslogtreecommitdiff
path: root/ssl
diff options
context:
space:
mode:
authorHugo Landau <hlandau@openssl.org>2023-04-18 19:30:54 +0100
committerHugo Landau <hlandau@openssl.org>2023-05-12 14:47:11 +0100
commit0815b725a83da10f60c60d679a88b616da01cecf (patch)
tree0105d65367a4adfd2f14b1daaebb368ca2b93ac7 /ssl
parent54562e899c5394505417adc1e0c6410f6a0677f3 (diff)
downloadopenssl-new-0815b725a83da10f60c60d679a88b616da01cecf.tar.gz
QUIC CHANNEL: Store TPs for initial flow control in TX direction
Reviewed-by: Matt Caswell <matt@openssl.org> Reviewed-by: Tomas Mraz <tomas@openssl.org> (Merged from https://github.com/openssl/openssl/pull/20765)
Diffstat (limited to 'ssl')
-rw-r--r--ssl/quic/quic_channel.c37
-rw-r--r--ssl/quic/quic_channel_local.h5
2 files changed, 29 insertions, 13 deletions
diff --git a/ssl/quic/quic_channel.c b/ssl/quic/quic_channel.c
index 47d9b970bd..79e015d123 100644
--- a/ssl/quic/quic_channel.c
+++ b/ssl/quic/quic_channel.c
@@ -30,7 +30,7 @@
/*
* Interval before we force a PING to ensure NATs don't timeout. This is based
- * on the lowest commonly seen value of 30 seconds as cited in RFC 9000 s.
+ * on the lowest commonly seen value of 30 seconds as cited in RFC 9000 s.
* 10.1.2.
*/
#define MAX_NAT_INTERVAL (ossl_ms2time(25000))
@@ -105,6 +105,12 @@ static int gen_rand_conn_id(OSSL_LIB_CTX *libctx, size_t len, QUIC_CONN_ID *cid)
* QUIC Channel Initialization and Teardown
* ========================================
*/
+#define DEFAULT_INIT_CONN_RXFC_WND ( 2 * 1024 * 1024)
+#define DEFAULT_MAX_CONN_RXFC_WND (10 * 1024 * 1024)
+
+#define DEFAULT_INIT_STREAM_RXFC_WND ( 2 * 1024 * 1024)
+#define DEFAULT_MAX_STREAM_RXFC_WND (10 * 1024 * 1024)
+
static int ch_init(QUIC_CHANNEL *ch)
{
OSSL_QUIC_TX_PACKETISER_ARGS txp_args = {0};
@@ -139,9 +145,17 @@ static int ch_init(QUIC_CHANNEL *ch)
if (!ossl_quic_txfc_init(&ch->conn_txfc, NULL))
goto err;
+ /*
+ * Note: The TP we transmit governs what the peer can transmit and thus
+ * applies to the RXFC.
+ */
+ ch->tx_init_max_stream_data_bidi_local = DEFAULT_INIT_STREAM_RXFC_WND;
+ ch->tx_init_max_stream_data_bidi_remote = DEFAULT_INIT_STREAM_RXFC_WND;
+ ch->tx_init_max_stream_data_uni = DEFAULT_INIT_STREAM_RXFC_WND;
+
if (!ossl_quic_rxfc_init(&ch->conn_rxfc, NULL,
- 2 * 1024 * 1024,
- 10 * 1024 * 1024,
+ DEFAULT_INIT_CONN_RXFC_WND,
+ DEFAULT_MAX_CONN_RXFC_WND,
get_time, ch))
goto err;
@@ -1156,29 +1170,26 @@ static int ch_generate_transport_params(QUIC_CHANNEL *ch)
ossl_quic_rxfc_get_cwm(&ch->conn_rxfc)))
goto err;
- /*
- * We actually want the default CWM for a new RXFC, but here we just use
- * stream0 as a representative specimen. TODO(QUIC): revisit this when we
- * support multiple streams.
- */
+ /* Send the default CWM for a new RXFC. */
if (!ossl_quic_wire_encode_transport_param_int(&wpkt, QUIC_TPARAM_INITIAL_MAX_STREAM_DATA_BIDI_LOCAL,
- ossl_quic_rxfc_get_cwm(&ch->stream0->rxfc)))
+ ch->tx_init_max_stream_data_bidi_local))
goto err;
if (!ossl_quic_wire_encode_transport_param_int(&wpkt, QUIC_TPARAM_INITIAL_MAX_STREAM_DATA_BIDI_REMOTE,
- ossl_quic_rxfc_get_cwm(&ch->stream0->rxfc)))
+ ch->tx_init_max_stream_data_bidi_remote))
goto err;
if (!ossl_quic_wire_encode_transport_param_int(&wpkt, QUIC_TPARAM_INITIAL_MAX_STREAM_DATA_UNI,
- ossl_quic_rxfc_get_cwm(&ch->stream0->rxfc)))
+ ch->tx_init_max_stream_data_uni))
goto err;
+ /* TODO(QUIC): MAX_STREAMS modelling */
if (!ossl_quic_wire_encode_transport_param_int(&wpkt, QUIC_TPARAM_INITIAL_MAX_STREAMS_BIDI,
- ch->is_server ? 1 : 0))
+ ch->is_server ? 100 : 100))
goto err;
if (!ossl_quic_wire_encode_transport_param_int(&wpkt, QUIC_TPARAM_INITIAL_MAX_STREAMS_UNI,
- 0))
+ 100))
goto err;
if (!WPACKET_get_total_written(&wpkt, &buf_len))
diff --git a/ssl/quic/quic_channel_local.h b/ssl/quic/quic_channel_local.h
index 18b50313f4..fbf16a93db 100644
--- a/ssl/quic/quic_channel_local.h
+++ b/ssl/quic/quic_channel_local.h
@@ -123,6 +123,11 @@ struct quic_channel_st {
/* Server only: The DCID we currently expect the peer to use to talk to us. */
QUIC_CONN_ID cur_local_dcid;
+ /* Transport parameter values we send to our peer. */
+ uint64_t tx_init_max_stream_data_bidi_local;
+ uint64_t tx_init_max_stream_data_bidi_remote;
+ uint64_t tx_init_max_stream_data_uni;
+
/* Transport parameter values received from server. */
uint64_t rx_init_max_stream_data_bidi_local;
uint64_t rx_init_max_stream_data_bidi_remote;