summaryrefslogtreecommitdiffstats
path: root/ssl/quic/quic_record_tx.c
diff options
context:
space:
mode:
authorMatt Caswell <matt@openssl.org>2023-05-05 16:51:43 +0100
committerMatt Caswell <matt@openssl.org>2023-05-24 12:18:33 +0100
commite8528c95a0543a218b432d2ea02e6bd0c1e7ab19 (patch)
tree9c71c34078cf44e9534a03889330014081f61927 /ssl/quic/quic_record_tx.c
parent45454cccf8172b5a2d7c1342067a1d8dc8396fc9 (diff)
Enable tracing of packets that have been sent
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_record_tx.c')
-rw-r--r--ssl/quic/quic_record_tx.c19
1 files changed, 16 insertions, 3 deletions
diff --git a/ssl/quic/quic_record_tx.c b/ssl/quic/quic_record_tx.c
index 28ebc436bb..9040f2f904 100644
--- a/ssl/quic/quic_record_tx.c
+++ b/ssl/quic/quic_record_tx.c
@@ -94,6 +94,11 @@ struct ossl_qtx_st {
ossl_mutate_packet_cb mutatecb;
ossl_finish_mutate_cb finishmutatecb;
void *mutatearg;
+
+ /* Message callback related arguments */
+ ossl_msg_cb msg_callback;
+ void *msg_callback_arg;
+ SSL *msg_callback_s;
};
/* Instantiates a new QTX. */
@@ -112,6 +117,9 @@ OSSL_QTX *ossl_qtx_new(const OSSL_QTX_ARGS *args)
qtx->propq = args->propq;
qtx->bio = args->bio;
qtx->mdpl = args->mdpl;
+ qtx->msg_callback = args->msg_callback;
+ qtx->msg_callback_arg = args->msg_callback_arg;
+ qtx->msg_callback_s = args->msg_callback_s;
return qtx;
}
@@ -432,9 +440,9 @@ static int qtx_write_hdr(OSSL_QTX *qtx, const QUIC_PKT_HDR *hdr, TXE *txe,
{
WPACKET wpkt;
size_t l = 0;
+ unsigned char *data = txe_data(txe) + txe->data_len;
- if (!WPACKET_init_static_len(&wpkt, txe_data(txe) + txe->data_len,
- txe->alloc_len - txe->data_len, 0))
+ if (!WPACKET_init_static_len(&wpkt, data, txe->alloc_len - txe->data_len, 0))
return 0;
if (!ossl_quic_wire_encode_pkt_hdr(&wpkt, hdr->dst_conn_id.id_len,
@@ -443,9 +451,14 @@ static int qtx_write_hdr(OSSL_QTX *qtx, const QUIC_PKT_HDR *hdr, TXE *txe,
WPACKET_finish(&wpkt);
return 0;
}
+ WPACKET_finish(&wpkt);
+
+ if (qtx->msg_callback != NULL)
+ qtx->msg_callback(1, OSSL_QUIC1_VERSION, SSL3_RT_QUIC_PACKET, data, l,
+ qtx->msg_callback_s, qtx->msg_callback_arg);
txe->data_len += l;
- WPACKET_finish(&wpkt);
+
return 1;
}