MINOR: quic: Add low level traces (addresses, DCID)

Add source and destination addresses to QUIC_EV_CONN_RCV trace event. This is
used by datagram/socket level functions (quic_sock.c).

Must be backported to 2.7.
This commit is contained in:
Frdric Lcaille 2023-05-12 17:37:29 +02:00 committed by Willy Tarreau
parent 9577a152b5
commit aaf32f0c83
1 changed files with 32 additions and 7 deletions

View File

@ -742,13 +742,6 @@ static void quic_trace(enum trace_level level, uint64_t mask, const struct trace
}
if (mask & QUIC_EV_CONN_RCV) {
const struct quic_dgram *dgram = a2;
if (dgram)
chunk_appendf(&trace_buf, " dgram.len=%zu", dgram->len);
}
if (mask & QUIC_EV_CONN_IDLE_TIMER) {
if (tick_isset(qc->ack_expire))
chunk_appendf(&trace_buf, " ack_expire=%ums",
@ -761,6 +754,38 @@ static void quic_trace(enum trace_level level, uint64_t mask, const struct trace
TICKS_TO_MS(tick_remain(now_ms, qc->idle_timer_task->expire)));
}
}
if (mask & QUIC_EV_CONN_RCV) {
int i;
const struct quic_dgram *dgram = a2;
char bufaddr[INET6_ADDRSTRLEN], bufport[6];
if (qc) {
addr_to_str(&qc->peer_addr, bufaddr, sizeof(bufaddr));
port_to_str(&qc->peer_addr, bufport, sizeof(bufport));
chunk_appendf(&trace_buf, " peer_addr=%s:%s ", bufaddr, bufport);
}
if (dgram) {
chunk_appendf(&trace_buf, " dgram.len=%zu", dgram->len);
/* Socket */
if (dgram->saddr.ss_family == AF_INET ||
dgram->saddr.ss_family == AF_INET6) {
addr_to_str(&dgram->saddr, bufaddr, sizeof(bufaddr));
port_to_str(&dgram->saddr, bufport, sizeof(bufport));
chunk_appendf(&trace_buf, "saddr=%s:%s ", bufaddr, bufport);
addr_to_str(&dgram->daddr, bufaddr, sizeof(bufaddr));
port_to_str(&dgram->daddr, bufport, sizeof(bufport));
chunk_appendf(&trace_buf, "daddr=%s:%s ", bufaddr, bufport);
}
/* DCID */
for (i = 0; i < dgram->dcid_len; ++i)
chunk_appendf(&trace_buf, "%02x", dgram->dcid[i]);
}
}
if (mask & QUIC_EV_CONN_LPKT) {
const struct quic_rx_packet *pkt = a2;
const uint64_t *len = a3;