summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorMatt Caswell <matt@openssl.org>2023-09-18 11:41:42 +0100
committerMatt Caswell <matt@openssl.org>2023-09-22 13:56:43 +0100
commitfbfcc3fe3458c50a11aa414a1e499a2eee0eb2e9 (patch)
tree99b72fd4d4b3584cef0e90322fea02585815d71f /test
parentd3a8daca587157dda52991448258800e9cf1f657 (diff)
Add some optional debug output to the noisy dgram BIO
Reviewed-by: Tim Hudson <tjh@openssl.org> Reviewed-by: Paul Dale <pauli@openssl.org> (Merged from https://github.com/openssl/openssl/pull/22157)
Diffstat (limited to 'test')
-rw-r--r--test/helpers/noisydgrambio.c37
1 files changed, 37 insertions, 0 deletions
diff --git a/test/helpers/noisydgrambio.c b/test/helpers/noisydgrambio.c
index c1eb141ee5..b42dbe6f4b 100644
--- a/test/helpers/noisydgrambio.c
+++ b/test/helpers/noisydgrambio.c
@@ -202,6 +202,16 @@ static int noisy_dgram_recvmmsg(BIO *bio, BIO_MSG *msg, size_t stride,
if (!BIO_recvmmsg(next, msg, stride, num_msg, flags, msgs_processed))
return 0;
+#ifdef OSSL_NOISY_DGRAM_DEBUG
+ printf("Pre-filter datagram list:\n");
+ for (i = 0; i < *msgs_processed; i++) {
+ printf("Pre-filter Datagram:\n");
+ BIO_dump_fp(stdout, msg[i].data, msg[i].data_len);
+ printf("\n");
+ }
+ printf("End of pre-filter datagram list\nApplying noise filters:\n");
+#endif
+
msg_cnt = *msgs_processed;
/* Introduce noise */
@@ -224,6 +234,11 @@ static int noisy_dgram_recvmmsg(BIO *bio, BIO_MSG *msg, size_t stride,
return 0;
msg_cnt++;
data->delayed_dgram = 0;
+#ifdef OSSL_NOISY_DGRAM_DEBUG
+ printf("**Inserting a delayed datagram\n");
+ BIO_dump_fp(stdout, thismsg->data, thismsg->data_len);
+ printf("\n");
+#endif
continue;
} /* else we have no space for the insertion, so just drop it */
data->delayed_dgram = 0;
@@ -246,9 +261,21 @@ static int noisy_dgram_recvmmsg(BIO *bio, BIO_MSG *msg, size_t stride,
return 0;
data->delayed_dgram = data->this_dgram + delay;
+
+#ifdef OSSL_NOISY_DGRAM_DEBUG
+ printf("**Delaying a datagram for %u messages%s\n",
+ (unsigned int)delay, should_drop ? "" : "(duplicating)");
+ BIO_dump_fp(stdout, thismsg->data, thismsg->data_len);
+ printf("\n");
+#endif
}
if (should_drop) {
+#ifdef OSSL_NOISY_DGRAM_DEBUG
+ printf("**Dropping a datagram\n");
+ BIO_dump_fp(stdout, thismsg->data, thismsg->data_len);
+ printf("\n");
+#endif
for (j = i + 1; j < msg_cnt; j++) {
if (!bio_msg_copy(&msg[j - 1], &msg[j]))
return 0;
@@ -257,6 +284,16 @@ static int noisy_dgram_recvmmsg(BIO *bio, BIO_MSG *msg, size_t stride,
}
}
+#ifdef OSSL_NOISY_DGRAM_DEBUG
+ printf("End of noise filters\nPost-filter datagram list:\n");
+ for (i = 0; i < msg_cnt; i++) {
+ printf("Post-filter Datagram:\n");
+ BIO_dump_fp(stdout, msg[i].data, msg[i].data_len);
+ printf("\n");
+ }
+ printf("End of post-filter datagram list\n");
+#endif
+
*msgs_processed = msg_cnt;
if (msg_cnt == 0) {