Skip to content

Commit 60c9a48

Browse files
committed
WIP: quic: add traces
1 parent c93c666 commit 60c9a48

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

src/quic_cid.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -321,6 +321,8 @@ struct quic_conn *retrieve_qc_conn_from_cid(struct quic_rx_packet *pkt,
321321
HA_RWLOCK_RDLOCK(QC_CID_LOCK, &tree->lock);
322322
node = ebmb_lookup(&tree->root, pkt->dcid.data, pkt->dcid.len);
323323

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

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

334337
tree = &quic_cid_trees[quic_cid_tree_idx(&derive_cid)];
338+
TRACE_PRINTF(TRACE_LEVEL_PROTO, QUIC_EV_CONN_RXPKT, 0, 0, 0, 0,
339+
"tree@%p", tree);
335340
HA_RWLOCK_RDLOCK(QC_CID_LOCK, &tree->lock);
336341
node = ebmb_lookup(&tree->root, derive_cid.data, derive_cid.len);
337342
}

src/quic_trace.c

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -310,11 +310,21 @@ static void quic_trace(enum trace_level level, uint64_t mask, const struct trace
310310
const struct quic_rx_packet *pkt = a2;
311311
const struct quic_rx_crypto_frm *cf = a3;
312312
const SSL *ssl = a4;
313+
int i;
313314

314-
if (pkt)
315+
if (pkt) {
315316
chunk_appendf(&trace_buf, " pkt@%p el=%c pn=%llu", pkt,
316317
quic_packet_type_enc_level_char(pkt->type),
317318
(unsigned long long)pkt->pn);
319+
if (pkt->dcid.len) {
320+
chunk_appendf(&trace_buf, "dcid: ");
321+
/* DCID */
322+
for (i = 0; i < pkt->dcid.len; ++i)
323+
chunk_appendf(&trace_buf, "%02x", pkt->dcid.data[i]);
324+
}
325+
}
326+
327+
318328
if (cf)
319329
chunk_appendf(&trace_buf, " cfoff=%llu cflen=%llu",
320330
(unsigned long long)cf->offset_node.key,

0 commit comments

Comments
 (0)