From: Amaury Denoyelle Date: Wed, 31 Jul 2024 15:28:24 +0000 (+0200) Subject: MINOR: mux-quic: implement debug string for logs X-Git-Tag: v3.1-dev5~33 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=630fa53c51ddfd3dbdf5e9d2495ca3fb45ff050e;p=thirdparty%2Fhaproxy.git MINOR: mux-quic: implement debug string for logs Implement MUX_SCTL_DBG_STR for QUIC MUX. This returns info for the current QCS and QCC instances, reusing qmux_dump_qc{c,s}_info functions already used for traces, and the connection flags. This stream operation is useful for debug string sample support. --- diff --git a/src/mux_quic.c b/src/mux_quic.c index b703c8bfbc..4ea46bd15c 100644 --- a/src/mux_quic.c +++ b/src/mux_quic.c @@ -3,6 +3,7 @@ #include #include +#include #include #include #include @@ -3201,7 +3202,10 @@ static int qmux_ctl(struct connection *conn, enum mux_ctl_type mux_ctl, void *ou static int qmux_sctl(struct stconn *sc, enum mux_sctl_type mux_sctl, void *output) { int ret = 0; - struct qcs *qcs = __sc_mux_strm(sc); + const struct qcs *qcs = __sc_mux_strm(sc); + const struct qcc *qcc = qcs->qcc; + union mux_sctl_dbg_str_ctx *dbg_ctx; + struct buffer *buf; switch (mux_sctl) { case MUX_SCTL_SID: @@ -3209,6 +3213,22 @@ static int qmux_sctl(struct stconn *sc, enum mux_sctl_type mux_sctl, void *outpu *((int64_t *)output) = qcs->id; return ret; + case MUX_SCTL_DBG_STR: + dbg_ctx = output; + buf = get_trash_chunk(); + + if (dbg_ctx->arg.debug_flags & MUX_SCTL_DBG_STR_L_MUXS) + qmux_dump_qcs_info(buf, qcs); + + if (dbg_ctx->arg.debug_flags & MUX_SCTL_DBG_STR_L_MUXC) + qmux_dump_qcc_info(buf, qcc); + + if (dbg_ctx->arg.debug_flags & MUX_SCTL_DBG_STR_L_CONN) + chunk_appendf(buf, " conn.flg=%#08x", qcc->conn->flags); + + dbg_ctx->ret.buf = *buf; + return ret; + default: return -1; }