diff options
author | Hugo Landau <hlandau@openssl.org> | 2023-10-31 16:11:43 +0000 |
---|---|---|
committer | Hugo Landau <hlandau@openssl.org> | 2023-11-02 08:11:31 +0000 |
commit | 660718ee5bafce9c5ca7604801a59f53df28f202 (patch) | |
tree | 41263bea90fa3473eafdf1f111ba10fa02616c52 | |
parent | a6eb287a667ccbc241c59b23b151672e450bda4b (diff) |
QUIC MULTISTREAM TEST: Ensure frames are only injected into correct packet types
Although the previous commit is enough to fix the immediate cause of the
stochastic failure on Windows, this is a more resilient fix; make sure
we only inject a given frame into the correct packet type for our
various injection functions.
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/22578)
-rw-r--r-- | test/quic_multistream_test.c | 26 |
1 files changed, 16 insertions, 10 deletions
diff --git a/test/quic_multistream_test.c b/test/quic_multistream_test.c index 795a8973a1..8d513d7f08 100644 --- a/test/quic_multistream_test.c +++ b/test/quic_multistream_test.c @@ -2832,7 +2832,7 @@ static int script_23_inject_plain(struct helper *h, QUIC_PKT_HDR *hdr, unsigned char frame_buf[16]; size_t written; - if (h->inject_word0 == 0) + if (h->inject_word0 == 0 || hdr->type != QUIC_PKT_TYPE_1RTT) return 1; if (!TEST_true(WPACKET_init_static_len(&wpkt, frame_buf, @@ -2885,7 +2885,7 @@ static int script_24_inject_plain(struct helper *h, QUIC_PKT_HDR *hdr, unsigned char frame_buf[16]; size_t written; - if (h->inject_word0 == 0) + if (h->inject_word0 == 0 || hdr->type != QUIC_PKT_TYPE_1RTT) return 1; if (!TEST_true(WPACKET_init_static_len(&wpkt, frame_buf, @@ -2995,7 +2995,7 @@ static int script_28_inject_plain(struct helper *h, QUIC_PKT_HDR *hdr, unsigned char frame_buf[32]; size_t written; - if (h->inject_word0 == 0) + if (h->inject_word0 == 0 || hdr->type != QUIC_PKT_TYPE_1RTT) return 1; if (!TEST_true(WPACKET_init_static_len(&wpkt, frame_buf, @@ -3130,6 +3130,9 @@ static int script_32_inject_plain(struct helper *h, QUIC_PKT_HDR *hdr, size_t written; uint64_t type = OSSL_QUIC_FRAME_TYPE_STREAM_OFF_LEN, offset, flen, i; + if (hdr->type != QUIC_PKT_TYPE_1RTT) + return 1; + switch (h->inject_word1) { default: return 0; @@ -3344,6 +3347,9 @@ static int script_39_inject_plain(struct helper *h, QUIC_PKT_HDR *hdr, QUIC_CONN_ID new_cid = {0}; QUIC_CHANNEL *ch = ossl_quic_tserver_get_channel(h->s_priv); + if (hdr->type != QUIC_PKT_TYPE_1RTT) + return 1; + switch (h->inject_word1) { case 0: return 1; @@ -3487,7 +3493,7 @@ static int script_41_inject_plain(struct helper *h, QUIC_PKT_HDR *hdr, unsigned char frame_buf[16]; size_t written; - if (h->inject_word0 == 0) + if (h->inject_word0 == 0 || hdr->type != QUIC_PKT_TYPE_1RTT) return 1; if (!TEST_true(WPACKET_init_static_len(&wpkt, frame_buf, @@ -3681,7 +3687,7 @@ static int script_44_inject_plain(struct helper *h, QUIC_PKT_HDR *hdr, unsigned char frame_buf[16]; size_t written; - if (h->inject_word0 == 0) + if (h->inject_word0 == 0 || hdr->type != QUIC_PKT_TYPE_1RTT) return 1; if (!TEST_true(WPACKET_init_static_len(&wpkt, frame_buf, @@ -3993,7 +3999,7 @@ static int script_52_inject_plain(struct helper *h, QUIC_PKT_HDR *hdr, WPACKET wpkt; uint64_t type = h->inject_word1; - if (h->inject_word0 == 0) + if (h->inject_word0 == 0 || hdr->type != QUIC_PKT_TYPE_1RTT) return 1; --h->inject_word0; @@ -4082,7 +4088,7 @@ static int script_53_inject_plain(struct helper *h, QUIC_PKT_HDR *hdr, unsigned char *frame_buf = NULL; size_t frame_len, i; - if (h->inject_word0 == 0) + if (h->inject_word0 == 0 || hdr->type != QUIC_PKT_TYPE_1RTT) return 1; h->inject_word0 = 0; @@ -4254,7 +4260,7 @@ static int script_58_inject_plain(struct helper *h, QUIC_PKT_HDR *hdr, size_t written; WPACKET wpkt; - if (h->inject_word0 == 0) + if (h->inject_word0 == 0 || hdr->type != QUIC_PKT_TYPE_1RTT) return 1; if (!TEST_true(WPACKET_init_static_len(&wpkt, frame_buf, @@ -4377,7 +4383,7 @@ static int script_61_inject_plain(struct helper *h, QUIC_PKT_HDR *hdr, unsigned char frame_buf[32]; size_t written; - if (h->inject_word0 == 0) + if (h->inject_word0 == 0 || hdr->type != QUIC_PKT_TYPE_1RTT) return 1; if (!TEST_true(WPACKET_init_static_len(&wpkt, frame_buf, @@ -4557,7 +4563,7 @@ static int script_66_inject_plain(struct helper *h, QUIC_PKT_HDR *hdr, unsigned char frame_buf[64]; size_t written; - if (h->inject_word0 == 0) + if (h->inject_word0 == 0 || hdr->type != QUIC_PKT_TYPE_1RTT) return 1; if (!TEST_true(WPACKET_init_static_len(&wpkt, frame_buf, |