QUIC CONFORMANCE: RFC 9000 s. 13.3: MAX_STREAM_DATA generation
authorHugo Landau <hlandau@openssl.org>
Tue, 6 Jun 2023 15:25:11 +0000 (16:25 +0100)
committerPauli <pauli@openssl.org>
Sun, 16 Jul 2023 22:17:57 +0000 (08:17 +1000)
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Paul Dale <pauli@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/21135)

ssl/quic/quic_stream_map.c
ssl/quic/quic_txp.c

index 6fac30c243d15e6026012976b8c57f737696831f..1a6e5fc464f487be97c1db30121c16a48ed602df 100644 (file)
@@ -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)));
index 1732b64e730506a8bf9ef5c3d87e868cfabc694f..6ca356c3c28918d11b3900684b536013dad2b79f 100644 (file)
@@ -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))) {