QLOG: Events: Implement transport:packet_received
authorHugo Landau <hlandau@openssl.org>
Fri, 8 Sep 2023 13:10:06 +0000 (14:10 +0100)
committerHugo Landau <hlandau@openssl.org>
Fri, 2 Feb 2024 11:49:34 +0000 (11:49 +0000)
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Neil Horman <nhorman@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/22037)

include/internal/qlog_event_helpers.h
include/internal/qlog_events.h
ssl/quic/qlog_event_helpers.c
ssl/quic/quic_channel.c

index e1a9bcf534f09c5dd90e7d4eea7701b0dfd78a3d..83defe043b523caaf9af94efddafccedf2a94ce3 100644 (file)
@@ -45,4 +45,12 @@ void ossl_qlog_event_transport_packet_sent(QLOG *qlog,
                                            size_t numn_iovec,
                                            uint64_t datagram_id);
 
+/* transport:packet_received */
+void ossl_qlog_event_transport_packet_received(QLOG *qlog,
+                                               const QUIC_PKT_HDR *hdr,
+                                               QUIC_PN pn,
+                                               const OSSL_QTX_IOVEC *iovec,
+                                               size_t numn_iovec,
+                                               uint64_t datagram_id);
+
 #endif
index 06706b5952b252e556e08dcb48045bfab669f906..e79b95246167b14a23db9500d98e610c0dea1304 100644 (file)
@@ -11,4 +11,5 @@ QLOG_EVENT(connectivity, connection_state_updated)
 QLOG_EVENT(connectivity, connection_closed)
 QLOG_EVENT(transport, parameters_set)
 QLOG_EVENT(transport, packet_sent)
+QLOG_EVENT(transport, packet_received)
 QLOG_EVENT(recovery, packet_lost)
index ad2e87ff3dbef84183ea23cba2f665cfb25dd49e..16fd8ae74ef1e4e1722fa532245f09b6742f6996 100644 (file)
@@ -611,3 +611,17 @@ void ossl_qlog_event_transport_packet_sent(QLOG *qlog,
     QLOG_EVENT_END()
 #endif
 }
+
+void ossl_qlog_event_transport_packet_received(QLOG *qlog,
+                                               const QUIC_PKT_HDR *hdr,
+                                               QUIC_PN pn,
+                                               const OSSL_QTX_IOVEC *iovec,
+                                               size_t num_iovec,
+                                               uint64_t datagram_id)
+{
+#ifndef OPENSSL_NO_QLOG
+    QLOG_EVENT_BEGIN(qlog, transport, packet_received)
+        log_packet(qlog, hdr, pn, iovec, num_iovec, datagram_id);
+    QLOG_EVENT_END()
+#endif
+}
index 274765b731c97034664bb55a9852b895228b1b42..b76f825d0e7d5504fa9bc3f0f9a739a66b3ca795 100644 (file)
@@ -2098,6 +2098,7 @@ static void ch_rx_handle_packet(QUIC_CHANNEL *ch, int channel_only)
 {
     uint32_t enc_level;
     int old_have_processed_any_pkt = ch->have_processed_any_pkt;
+    OSSL_QTX_IOVEC iovec;
 
     assert(ch->qrx_pkt != NULL);
 
@@ -2184,6 +2185,12 @@ static void ch_rx_handle_packet(QUIC_CHANNEL *ch, int channel_only)
         return;
     }
 
+    iovec.buf       = ch->qrx_pkt->hdr->data;
+    iovec.buf_len   = ch->qrx_pkt->hdr->len;
+    ossl_qlog_event_transport_packet_received(ch_get_qlog(ch), ch->qrx_pkt->hdr,
+                                              ch->qrx_pkt->pn, &iovec, 1,
+                                              ch->qrx_pkt->datagram_id);
+
     /* Handle incoming packet. */
     switch (ch->qrx_pkt->hdr->type) {
     case QUIC_PKT_TYPE_RETRY: