Skip to content

Commit

Permalink
WIP: quic: add traces
Browse files Browse the repository at this point in the history
  • Loading branch information
haproxyFred committed Sep 2, 2024
1 parent c93c666 commit 60c9a48
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
5 changes: 5 additions & 0 deletions src/quic_cid.c
Original file line number Diff line number Diff line change
Expand Up @@ -321,6 +321,8 @@ struct quic_conn *retrieve_qc_conn_from_cid(struct quic_rx_packet *pkt,
HA_RWLOCK_RDLOCK(QC_CID_LOCK, &tree->lock);
node = ebmb_lookup(&tree->root, pkt->dcid.data, pkt->dcid.len);

TRACE_PRINTF(TRACE_LEVEL_PROTO, QUIC_EV_CONN_RXPKT, 0, 0, 0, 0,
"tree@%p", tree);
/* If not found on an Initial/0-RTT packet, it could be because an
* ODCID is reused by the client. Calculate the derived CID value to
* retrieve it from the DCID tree.
Expand All @@ -329,9 +331,12 @@ struct quic_conn *retrieve_qc_conn_from_cid(struct quic_rx_packet *pkt,
pkt->type == QUIC_PACKET_TYPE_0RTT)) {
const struct quic_cid derive_cid = quic_derive_cid(&pkt->dcid, saddr);

TRACE_DEVEL("connection not found", QUIC_EV_CONN_RXPKT, NULL, pkt);
HA_RWLOCK_RDUNLOCK(QC_CID_LOCK, &tree->lock);

tree = &quic_cid_trees[quic_cid_tree_idx(&derive_cid)];
TRACE_PRINTF(TRACE_LEVEL_PROTO, QUIC_EV_CONN_RXPKT, 0, 0, 0, 0,
"tree@%p", tree);
HA_RWLOCK_RDLOCK(QC_CID_LOCK, &tree->lock);
node = ebmb_lookup(&tree->root, derive_cid.data, derive_cid.len);
}
Expand Down
12 changes: 11 additions & 1 deletion src/quic_trace.c
Original file line number Diff line number Diff line change
Expand Up @@ -310,11 +310,21 @@ static void quic_trace(enum trace_level level, uint64_t mask, const struct trace
const struct quic_rx_packet *pkt = a2;
const struct quic_rx_crypto_frm *cf = a3;
const SSL *ssl = a4;
int i;

if (pkt)
if (pkt) {
chunk_appendf(&trace_buf, " pkt@%p el=%c pn=%llu", pkt,
quic_packet_type_enc_level_char(pkt->type),
(unsigned long long)pkt->pn);
if (pkt->dcid.len) {
chunk_appendf(&trace_buf, "dcid: ");
/* DCID */
for (i = 0; i < pkt->dcid.len; ++i)
chunk_appendf(&trace_buf, "%02x", pkt->dcid.data[i]);
}
}


if (cf)
chunk_appendf(&trace_buf, " cfoff=%llu cflen=%llu",
(unsigned long long)cf->offset_node.key,
Expand Down

0 comments on commit 60c9a48

Please sign in to comment.