summaryrefslogtreecommitdiffstats
path: root/ssl/quic/quic_txp.c
diff options
context:
space:
mode:
authorMatt Caswell <matt@openssl.org>2023-05-05 14:46:01 +0100
committerMatt Caswell <matt@openssl.org>2023-05-24 12:18:33 +0100
commit45454cccf8172b5a2d7c1342067a1d8dc8396fc9 (patch)
tree094f5542b8ae38178f5b63df7f6aef9081249c7d /ssl/quic/quic_txp.c
parent70f0ea280af0bed9fb48b20b61c7a12c7f03e6d9 (diff)
Extend tracing of frames to transmitted frames
Previously we were only doing tracing of frames received from the peer. Now we do that for transmitted frames as well. Reviewed-by: Tomas Mraz <tomas@openssl.org> Reviewed-by: Hugo Landau <hlandau@openssl.org> (Merged from https://github.com/openssl/openssl/pull/20914)
Diffstat (limited to 'ssl/quic/quic_txp.c')
-rw-r--r--ssl/quic/quic_txp.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/ssl/quic/quic_txp.c b/ssl/quic/quic_txp.c
index a1341d8b13..b8bfb3592e 100644
--- a/ssl/quic/quic_txp.c
+++ b/ssl/quic/quic_txp.c
@@ -301,6 +301,28 @@ static int tx_helper_commit(struct tx_helper *h)
return 0;
}
+ if (h->txp->args.msg_callback != NULL && l > 0) {
+ uint64_t ftype;
+ int ctype = SSL3_RT_QUIC_FRAME_FULL;
+ PACKET pkt;
+
+ if (!PACKET_buf_init(&pkt, h->txn.data, l)
+ || !ossl_quic_wire_peek_frame_header(&pkt, &ftype)) {
+ tx_helper_end(h, 0);
+ return 0;
+ }
+
+ if (ftype == OSSL_QUIC_FRAME_TYPE_PADDING)
+ ctype = SSL3_RT_QUIC_FRAME_PADDING;
+ else if (OSSL_QUIC_FRAME_TYPE_IS_STREAM(ftype)
+ || ftype == OSSL_QUIC_FRAME_TYPE_CRYPTO)
+ ctype = SSL3_RT_QUIC_FRAME_HEADER;
+
+ h->txp->args.msg_callback(1, OSSL_QUIC1_VERSION, ctype, h->txn.data, l,
+ h->txp->args.msg_callback_s,
+ h->txp->args.msg_callback_arg);
+ }
+
h->scratch_bytes += l;
tx_helper_end(h, 1);
return 1;