From: Hugo Landau Date: Tue, 6 Jun 2023 15:25:11 +0000 (+0100) Subject: QUIC CONFORMANCE: RFC 9000 s. 13.3: MAX_STREAM_DATA generation X-Git-Tag: openssl-3.2.0-alpha1~446 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=22f21fbdd6ed7032f28d4f22ef1abc98e1c5d325;p=thirdparty%2Fopenssl.git QUIC CONFORMANCE: RFC 9000 s. 13.3: MAX_STREAM_DATA generation Reviewed-by: Tomas Mraz Reviewed-by: Matt Caswell Reviewed-by: Paul Dale (Merged from https://github.com/openssl/openssl/pull/21135) --- diff --git a/ssl/quic/quic_stream_map.c b/ssl/quic/quic_stream_map.c index 6fac30c243d..1a6e5fc464f 100644 --- a/ssl/quic/quic_stream_map.c +++ b/ssl/quic/quic_stream_map.c @@ -335,8 +335,9 @@ void ossl_quic_stream_map_update_state(QUIC_STREAM_MAP *qsm, QUIC_STREAM *s) && !s->ready_for_gc && ((ossl_quic_stream_has_recv(s) && !ossl_quic_stream_recv_is_reset(s) - && (s->want_max_stream_data - || ossl_quic_rxfc_has_cwm_changed(&s->rxfc, 0))) + && (s->recv_state == QUIC_RSTREAM_STATE_RECV + && (s->want_max_stream_data + || ossl_quic_rxfc_has_cwm_changed(&s->rxfc, 0)))) || s->want_stop_sending || s->want_reset_stream || (!s->peer_stop_sending && stream_has_data_to_send(s))); diff --git a/ssl/quic/quic_txp.c b/ssl/quic/quic_txp.c index 1732b64e730..6ca356c3c28 100644 --- a/ssl/quic/quic_txp.c +++ b/ssl/quic/quic_txp.c @@ -1923,8 +1923,15 @@ static int txp_generate_stream_related(OSSL_QUIC_TX_PACKETISER *txp, = f.final_size - ossl_quic_txfc_get_swm(&stream->txfc); } - /* Stream Flow Control Frames (MAX_STREAM_DATA) */ - if (ossl_quic_stream_has_recv_buffer(stream) + /* + * Stream Flow Control Frames (MAX_STREAM_DATA) + * + * RFC 9000 s. 13.3: "An endpoint SHOULD stop sending MAX_STREAM_DATA + * frames when the receiving part of the stream enters a "Size Known" or + * "Reset Recvd" state." -- In practice, RECV is the only state + * in which it makes sense to generate more MAX_STREAM_DATA frames. + */ + if (stream->recv_state == QUIC_RSTREAM_STATE_RECV && (stream->want_max_stream_data || ossl_quic_rxfc_has_cwm_changed(&stream->rxfc, 0))) {