From: Hugo Landau Date: Thu, 13 Jul 2023 12:48:32 +0000 (-0700) Subject: QUIC: Fix multistream test on macOS X-Git-Tag: openssl-3.2.0-alpha1~415 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9ff3a99ea625c116833c950f51bff2554f6f7d1b;p=thirdparty%2Fopenssl.git QUIC: Fix multistream test on macOS Reviewed-by: Tomas Mraz Reviewed-by: Matt Caswell Reviewed-by: Paul Dale (Merged from https://github.com/openssl/openssl/pull/21135) --- diff --git a/include/internal/quic_channel.h b/include/internal/quic_channel.h index 0606a11698d..bd9f45c68a9 100644 --- a/include/internal/quic_channel.h +++ b/include/internal/quic_channel.h @@ -350,6 +350,9 @@ uint64_t ossl_quic_channel_get_rx_key_epoch(QUIC_CHANNEL *ch); int ossl_quic_channel_trigger_txku(QUIC_CHANNEL *ch); int ossl_quic_channel_has_pending(const QUIC_CHANNEL *ch); +/* Force transmission of an ACK-eliciting packet. */ +int ossl_quic_channel_ping(QUIC_CHANNEL *ch); + # endif #endif diff --git a/include/internal/quic_tserver.h b/include/internal/quic_tserver.h index d97199f6e67..cd87a9298e1 100644 --- a/include/internal/quic_tserver.h +++ b/include/internal/quic_tserver.h @@ -181,6 +181,9 @@ OSSL_TIME ossl_quic_tserver_get_deadline(QUIC_TSERVER *srv); */ int ossl_quic_tserver_shutdown(QUIC_TSERVER *srv); +/* Force generation of an ACK-eliciting packet. */ +int ossl_quic_tserver_ping(QUIC_TSERVER *srv); + # endif #endif diff --git a/ssl/quic/quic_channel.c b/ssl/quic/quic_channel.c index cb644179d72..41995455efd 100644 --- a/ssl/quic/quic_channel.c +++ b/ssl/quic/quic_channel.c @@ -3117,3 +3117,12 @@ int ossl_quic_channel_trigger_txku(QUIC_CHANNEL *ch) ch_trigger_txku(ch); return 1; } + +int ossl_quic_channel_ping(QUIC_CHANNEL *ch) +{ + int pn_space = ossl_quic_enc_level_to_pn_space(ch->tx_enc_level); + + ossl_quic_tx_packetiser_schedule_ack_eliciting(ch->txp, pn_space); + + return 1; +} diff --git a/ssl/quic/quic_tserver.c b/ssl/quic/quic_tserver.c index 8f701591d7f..c8970e4761d 100644 --- a/ssl/quic/quic_tserver.c +++ b/ssl/quic/quic_tserver.c @@ -489,3 +489,15 @@ int ossl_quic_tserver_shutdown(QUIC_TSERVER *srv) return ossl_quic_channel_is_terminated(srv->ch); } + +int ossl_quic_tserver_ping(QUIC_TSERVER *srv) +{ + if (ossl_quic_channel_is_terminated(srv->ch)) + return 0; + + if (!ossl_quic_channel_ping(srv->ch)) + return 0; + + ossl_quic_reactor_tick(ossl_quic_channel_get_reactor(srv->ch), 0); + return 1; +} diff --git a/test/quic_multistream_test.c b/test/quic_multistream_test.c index fa82b3a56e2..0a5a8b6ce1f 100644 --- a/test/quic_multistream_test.c +++ b/test/quic_multistream_test.c @@ -1286,8 +1286,10 @@ static int run_script_worker(struct helper *h, const struct script_op *script, int expect_remote = (op->arg1 & EXPECT_CONN_CLOSE_REMOTE) != 0; uint64_t error_code = op->arg2; - if (!ossl_quic_tserver_is_term_any(h->s)) + if (!ossl_quic_tserver_is_term_any(h->s)) { + ossl_quic_tserver_ping(h->s); SPIN_AGAIN(); + } if (!TEST_ptr(tc = ossl_quic_tserver_get_terminate_cause(h->s))) goto out; @@ -1721,11 +1723,16 @@ static const struct script_op script_5[] = { OP_C_SET_DEFAULT_STREAM_MODE(SSL_DEFAULT_STREAM_MODE_NONE) OP_C_NEW_STREAM_BIDI (a, C_BIDI_ID(0)) + OP_C_NEW_STREAM_BIDI (b, C_BIDI_ID(1)) OP_C_WRITE (a, "apple", 5) OP_C_STREAM_RESET (a, 42) + OP_C_WRITE (b, "strawberry", 10) + OP_S_BIND_STREAM_ID (a, C_BIDI_ID(0)) + OP_S_BIND_STREAM_ID (b, C_BIDI_ID(1)) + OP_S_READ_EXPECT (b, "strawberry", 10) /* Reset disrupts read of already sent data */ OP_S_READ_FAIL (a) OP_CHECK (check_stream_reset, C_BIDI_ID(0))