Skip to content

Commit

Permalink
QLOG: Events: Implement recovery:packet_lost
Browse files Browse the repository at this point in the history
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Neil Horman <nhorman@openssl.org>
(Merged from #22037)
  • Loading branch information
hlandau committed Feb 2, 2024
1 parent 40c835d commit faf0912
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 0 deletions.
5 changes: 5 additions & 0 deletions include/internal/qlog_event_helpers.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
# include "internal/qlog.h"
# include "internal/quic_types.h"
# include "internal/quic_channel.h"
# include "internal/quic_txpim.h"

/* connectivity:connection_started */
void ossl_qlog_event_connectivity_connection_started(QLOG *qlog,
Expand All @@ -30,4 +31,8 @@ void ossl_qlog_event_connectivity_connection_state_updated(QLOG *qlog,
void ossl_qlog_event_connectivity_connection_closed(QLOG *qlog,
const QUIC_TERMINATE_CAUSE *tcause);

/* recovery:packet_lost */
void ossl_qlog_event_recovery_packet_lost(QLOG *qlog,
const QUIC_TXPIM_PKT *tpkt);

#endif
1 change: 1 addition & 0 deletions include/internal/qlog_events.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,4 @@ QLOG_EVENT(connectivity, connection_started)
QLOG_EVENT(connectivity, connection_state_updated)
QLOG_EVENT(connectivity, connection_closed)
QLOG_EVENT(transport, parameters_set)
QLOG_EVENT(recovery, packet_lost)
36 changes: 36 additions & 0 deletions ssl/quic/qlog_event_helpers.c
Original file line number Diff line number Diff line change
Expand Up @@ -145,3 +145,39 @@ void ossl_qlog_event_connectivity_connection_closed(QLOG *qlog,
QLOG_EVENT_END()
#endif
}

#ifndef OPENSSL_NO_QLOG
static const char *quic_pkt_type_to_qlog(uint32_t pkt_type)
{
switch (pkt_type) {
case QUIC_PKT_TYPE_INITIAL:
return "initial";
case QUIC_PKT_TYPE_HANDSHAKE:
return "handshake";
case QUIC_PKT_TYPE_0RTT:
return "0RTT";
case QUIC_PKT_TYPE_1RTT:
return "1RTT";
case QUIC_PKT_TYPE_VERSION_NEG:
return "version_negotiation";
case QUIC_PKT_TYPE_RETRY:
return "retry";
default:
return "unknown";
}
}
#endif

void ossl_qlog_event_recovery_packet_lost(QLOG *qlog,
const QUIC_TXPIM_PKT *tpkt)
{
#ifndef OPENSSL_NO_QLOG
QLOG_EVENT_BEGIN(qlog, recovery, packet_lost)
QLOG_BEGIN("header")
QLOG_STR("packet_type", quic_pkt_type_to_qlog(tpkt->pkt_type));
if (ossl_quic_pkt_type_has_pn(tpkt->pkt_type))
QLOG_U64("packet_number", tpkt->ackm_pkt.pkt_num);
QLOG_END()
QLOG_EVENT_END()
#endif
}
3 changes: 3 additions & 0 deletions ssl/quic/quic_fifd.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

#include "internal/quic_fifd.h"
#include "internal/quic_wire.h"
#include "internal/qlog_event_helpers.h"

DEFINE_LIST_OF(tx_history, OSSL_ACKM_TX_PKT);

Expand Down Expand Up @@ -119,6 +120,8 @@ static void on_lost(void *arg)
QUIC_CFQ_ITEM *cfq_item, *cfq_item_next;
int sstream_updated;

ossl_qlog_event_recovery_packet_lost(fifd->qlog, pkt);

/* STREAM and CRYPTO stream chunks, FIN and stream FC frames */
for (i = 0; i < num_chunks; ++i) {
sstream = fifd->get_sstream_by_id(chunks[i].stream_id,
Expand Down

0 comments on commit faf0912

Please sign in to comment.