]> git.ipfire.org Git - thirdparty/openssl.git/commitdiff
QUIC APL: Fix a bug where incoming unidirectional streams weren't detected
authorHugo Landau <hlandau@openssl.org>
Tue, 18 Apr 2023 18:30:56 +0000 (19:30 +0100)
committerHugo Landau <hlandau@openssl.org>
Fri, 12 May 2023 13:47:13 +0000 (14:47 +0100)
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/20765)

ssl/quic/quic_impl.c

index d74ed3625658d077159cd7eb0c832dc779d39770..cce1bde5c44674803ae992fa77675498453661a9 100644 (file)
@@ -1225,7 +1225,11 @@ static int quic_wait_for_stream(void *arg)
     }
 
     args->qs = ossl_quic_stream_map_get_by_id(ossl_quic_channel_get_qsm(args->qc->ch),
-                                              args->expect_id);
+                                              args->expect_id | QUIC_STREAM_DIR_BIDI);
+    if (args->qs == NULL)
+        args->qs = ossl_quic_stream_map_get_by_id(ossl_quic_channel_get_qsm(args->qc->ch),
+                                                  args->expect_id | QUIC_STREAM_DIR_UNI);
+
     if (args->qs != NULL)
         return 1; /* stream now exists */
 
@@ -1259,12 +1263,12 @@ static int qc_wait_for_default_xso_for_read(QUIC_CONNECTION *qc)
         ? QUIC_STREAM_INITIATOR_CLIENT
         : QUIC_STREAM_INITIATOR_SERVER;
 
-    expect_id |= (qc->default_stream_mode == SSL_DEFAULT_STREAM_MODE_AUTO_UNI)
-        ? QUIC_STREAM_DIR_UNI
-        : QUIC_STREAM_DIR_BIDI;
-
     qs = ossl_quic_stream_map_get_by_id(ossl_quic_channel_get_qsm(qc->ch),
-                                        expect_id);
+                                        expect_id | QUIC_STREAM_DIR_BIDI);
+    if (qs == NULL)
+        qs = ossl_quic_stream_map_get_by_id(ossl_quic_channel_get_qsm(qc->ch),
+                                            expect_id | QUIC_STREAM_DIR_UNI);
+
     if (qs == NULL) {
         ossl_quic_reactor_tick(ossl_quic_channel_get_reactor(qc->ch), 0);