]> git.ipfire.org Git - thirdparty/openssl.git/commitdiff
QUIC: Fix multistream test on macOS
authorHugo Landau <hlandau@openssl.org>
Thu, 13 Jul 2023 12:48:32 +0000 (05:48 -0700)
committerPauli <pauli@openssl.org>
Sun, 16 Jul 2023 22:18:05 +0000 (08:18 +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)

include/internal/quic_channel.h
include/internal/quic_tserver.h
ssl/quic/quic_channel.c
ssl/quic/quic_tserver.c
test/quic_multistream_test.c

index 0606a11698dbe0d0ba0df24f77b9fba0c1a17b10..bd9f45c68a98cad5424ed41ec678b39226e0e2d2 100644 (file)
@@ -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
index d97199f6e6704b3ec0a88d842abc0848c4f28a8b..cd87a9298e12338504f607d34ef93e4fbe910a11 100644 (file)
@@ -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
index cb644179d727836471bbd2d7f043a69c8d9d7218..41995455efd6b12eabe682070499a7c8ce305365 100644 (file)
@@ -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;
+}
index 8f701591d7f672db1a7734c0b2e34fba901c7def..c8970e4761d21dc5728a943bbdf3a45f2ed9ca2d 100644 (file)
@@ -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;
+}
index fa82b3a56e2108b7fde42b9de87b416313dd58be..0a5a8b6ce1f79130d04442223bf4d9b53255f8be 100644 (file)
@@ -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))