From: Amaury Denoyelle Date: Fri, 25 Mar 2022 08:09:40 +0000 (+0100) Subject: MINOR: mux-quic: add trace event for frame sending X-Git-Tag: v2.6-dev4~7 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=fa29f33f2c022673771bf4ea451cd2cdf59d6eb8;p=thirdparty%2Fhaproxy.git MINOR: mux-quic: add trace event for frame sending Define a new qmux event QMUX_EV_SEND_FRM. This allows to pass a quic_frame as an extra argument. Depending on the frame type, a special format can be used to log the frame content. Currently this event is only used in qc_send_max_streams. Thus the handler is only able to handle MAX_STREAMS frames. --- diff --git a/src/mux_quic.c b/src/mux_quic.c index 8496df730a..2d8addbd93 100644 --- a/src/mux_quic.c +++ b/src/mux_quic.c @@ -46,6 +46,8 @@ static const struct trace_event qmux_trace_events[] = { { .mask = QMUX_EV_STRM_SEND, .name = "strm_send", .desc = "sending data for stream" }, #define QMUX_EV_STRM_END (1ULL << 12) { .mask = QMUX_EV_STRM_END, .name = "strm_end", .desc = "detaching app-layer stream" }, +#define QMUX_EV_SEND_FRM (1ULL << 13) + { .mask = QMUX_EV_SEND_FRM, .name = "send_frm", .desc = "sending QUIC frame" }, { } }; @@ -813,6 +815,7 @@ static int qc_send_max_streams(struct qcc *qcc) frm->type = QUIC_FT_MAX_STREAMS_BIDI; frm->max_streams_bidi.max_streams = qcc->lfctl.ms_bidi + qcc->lfctl.cl_bidi_r; + TRACE_DEVEL("sending MAX_STREAMS frame", QMUX_EV_SEND_FRM, qcc->conn, NULL, frm); LIST_APPEND(&frms, &frm->list); if (qc_send_frames(qcc, &frms)) @@ -1140,6 +1143,24 @@ static int qc_wake(struct connection *conn) } +static void qmux_trace_frm(const struct quic_frame *frm) +{ + switch (frm->type) { + case QUIC_FT_MAX_STREAMS_BIDI: + chunk_appendf(&trace_buf, " max_streams=%lu", + frm->max_streams_bidi.max_streams); + break; + + case QUIC_FT_MAX_STREAMS_UNI: + chunk_appendf(&trace_buf, " max_streams=%lu", + frm->max_streams_uni.max_streams); + break; + + default: + break; + } +} + /* quic-mux trace handler */ static void qmux_trace(enum trace_level level, uint64_t mask, const struct trace_source *src, @@ -1163,6 +1184,9 @@ static void qmux_trace(enum trace_level level, uint64_t mask, const uint64_t *id = a3; chunk_appendf(&trace_buf, " id=%lu", *id); } + + if (mask & QMUX_EV_SEND_FRM) + qmux_trace_frm(a3); } }