From acc6fde0d44d22c7fa4578c967aee69c3fbcf350 Mon Sep 17 00:00:00 2001 From: Hugo Landau Date: Tue, 18 Apr 2023 19:30:56 +0100 Subject: QUIC APL: Fix a bug where incoming unidirectional streams weren't detected Reviewed-by: Matt Caswell Reviewed-by: Tomas Mraz (Merged from https://github.com/openssl/openssl/pull/20765) --- ssl/quic/quic_impl.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/ssl/quic/quic_impl.c b/ssl/quic/quic_impl.c index d74ed36256..cce1bde5c4 100644 --- a/ssl/quic/quic_impl.c +++ b/ssl/quic/quic_impl.c @@ -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); -- cgit v1.2.1