From: Hugo Landau Date: Tue, 25 Jul 2023 10:32:25 +0000 (+0100) Subject: QUIC FC: Rename stream count mode to reflect actual function X-Git-Tag: openssl-3.2.0-alpha1~279 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=1051b4a0b9e307e51fdf491e6824e6610007824d;p=thirdparty%2Fopenssl.git QUIC FC: Rename stream count mode to reflect actual function Reviewed-by: Tomas Mraz Reviewed-by: Matt Caswell (Merged from https://github.com/openssl/openssl/pull/21547) --- diff --git a/include/internal/quic_fc.h b/include/internal/quic_fc.h index ea7161534e0..06a7cc1db0d 100644 --- a/include/internal/quic_fc.h +++ b/include/internal/quic_fc.h @@ -137,7 +137,7 @@ struct quic_rxfc_st { OSSL_TIME (*now)(void *arg); void *now_arg; QUIC_RXFC *parent; - unsigned char error_code, has_cwm_changed, is_fin, stream_count_mode; + unsigned char error_code, has_cwm_changed, is_fin, standalone; }; /* @@ -155,12 +155,14 @@ int ossl_quic_rxfc_init(QUIC_RXFC *rxfc, QUIC_RXFC *conn_rxfc, void *now_arg); /* - * Initialises an RX flow controller for stream count enforcement. + * Initialises an RX flow controller which is used by itself and not under a + * connection-level RX flow controller. This can be used for stream count + * enforcement as well as CRYPTO buffer enforcement. */ -int ossl_quic_rxfc_init_for_stream_count(QUIC_RXFC *rxfc, - uint64_t initial_window_size, - OSSL_TIME (*now)(void *arg), - void *now_arg); +int ossl_quic_rxfc_init_standalone(QUIC_RXFC *rxfc, + uint64_t initial_window_size, + OSSL_TIME (*now)(void *arg), + void *now_arg); /* * Gets the parent (i.e., connection-level) RXFC. Returns NULL if called on a diff --git a/ssl/quic/quic_channel.c b/ssl/quic/quic_channel.c index 9ba756b1d31..bdf6376e2b9 100644 --- a/ssl/quic/quic_channel.c +++ b/ssl/quic/quic_channel.c @@ -176,14 +176,14 @@ static int ch_init(QUIC_CHANNEL *ch) get_time, ch)) goto err; - if (!ossl_quic_rxfc_init_for_stream_count(&ch->max_streams_bidi_rxfc, - DEFAULT_INIT_CONN_MAX_STREAMS, - get_time, ch)) + if (!ossl_quic_rxfc_init_standalone(&ch->max_streams_bidi_rxfc, + DEFAULT_INIT_CONN_MAX_STREAMS, + get_time, ch)) goto err; - if (!ossl_quic_rxfc_init_for_stream_count(&ch->max_streams_uni_rxfc, - DEFAULT_INIT_CONN_MAX_STREAMS, - get_time, ch)) + if (!ossl_quic_rxfc_init_standalone(&ch->max_streams_uni_rxfc, + DEFAULT_INIT_CONN_MAX_STREAMS, + get_time, ch)) goto err; if (!ossl_statm_init(&ch->statm)) diff --git a/ssl/quic/quic_fc.c b/ssl/quic/quic_fc.c index caf69a1d67f..6cb5834c259 100644 --- a/ssl/quic/quic_fc.c +++ b/ssl/quic/quic_fc.c @@ -146,21 +146,21 @@ int ossl_quic_rxfc_init(QUIC_RXFC *rxfc, QUIC_RXFC *conn_rxfc, rxfc->now = now; rxfc->now_arg = now_arg; rxfc->is_fin = 0; - rxfc->stream_count_mode = 0; + rxfc->standalone = 0; return 1; } -int ossl_quic_rxfc_init_for_stream_count(QUIC_RXFC *rxfc, - uint64_t initial_window_size, - OSSL_TIME (*now)(void *arg), - void *now_arg) +int ossl_quic_rxfc_init_standalone(QUIC_RXFC *rxfc, + uint64_t initial_window_size, + OSSL_TIME (*now)(void *arg), + void *now_arg) { if (!ossl_quic_rxfc_init(rxfc, NULL, initial_window_size, initial_window_size, now, now_arg)) return 0; - rxfc->stream_count_mode = 1; + rxfc->standalone = 1; return 1; } @@ -200,7 +200,7 @@ int ossl_quic_rxfc_on_rx_stream_frame(QUIC_RXFC *rxfc, uint64_t end, int is_fin) { uint64_t delta; - if (!rxfc->stream_count_mode && rxfc->parent == NULL) + if (!rxfc->standalone && rxfc->parent == NULL) return 0; if (rxfc->is_fin && ((is_fin && rxfc->hwm != end) || end > rxfc->hwm)) { @@ -341,7 +341,7 @@ int ossl_quic_rxfc_on_retire(QUIC_RXFC *rxfc, uint64_t num_bytes, OSSL_TIME rtt) { - if (rxfc->parent == NULL && !rxfc->stream_count_mode) + if (rxfc->parent == NULL && !rxfc->standalone) return 0; if (num_bytes == 0) @@ -353,7 +353,7 @@ int ossl_quic_rxfc_on_retire(QUIC_RXFC *rxfc, rxfc_on_retire(rxfc, num_bytes, 0, rtt); - if (!rxfc->stream_count_mode) + if (!rxfc->standalone) rxfc_on_retire(rxfc->parent, num_bytes, rxfc->cur_window_size, rtt); return 1;