MINOR: quic: dump quic_conn debug string for logs

Define a new xprt_ops callback named dump_info. This can be used to
extend MUX debug string with infos from the lower layer.

Implement dump_info for QUIC stack. For now, only minimal info are
reported : bytes in flight and size of the sending window. This should
allow to detect if the congestion controller is fine. These info are
reported via QUIC MUX debug string sample.
This commit is contained in:
Amaury Denoyelle 2024-08-01 11:35:04 +02:00
parent 630fa53c51
commit 663416b4ef
5 changed files with 25 additions and 0 deletions

View File

@ -404,6 +404,7 @@ struct xprt_ops {
int (*add_xprt)(struct connection *conn, void *xprt_ctx, void *toadd_ctx, const struct xprt_ops *toadd_ops, void **oldxprt_ctx, const struct xprt_ops **oldxprt_ops); /* Add a new XPRT as the new xprt, and return the old one */
struct ssl_sock_ctx *(*get_ssl_sock_ctx)(struct connection *); /* retrieve the ssl_sock_ctx in use, or NULL if none */
int (*show_fd)(struct buffer *, const struct connection *, const void *ctx); /* append some data about xprt for "show fd"; returns non-zero if suspicious */
void (*dump_info)(struct buffer *, const struct connection *);
};
/* mux_ops describes the mux operations, which are to be performed at the

View File

@ -23,6 +23,10 @@
#include <haproxy/quic_trace-t.h>
#include <haproxy/buf-t.h>
struct quic_conn;
#define TRACE_SOURCE &trace_quic
/* Initializes a enc_debug_info struct (only for debug purpose) */
@ -37,4 +41,6 @@ static inline void enc_debug_info_init(struct enc_debug_info *edi,
edi->pn = pn;
}
void quic_dump_qc_info(struct buffer *msg, const struct quic_conn *qc);
#endif /* _HAPROXY_QUIC_TRACE_H */

View File

@ -3226,6 +3226,9 @@ static int qmux_sctl(struct stconn *sc, enum mux_sctl_type mux_sctl, void *outpu
if (dbg_ctx->arg.debug_flags & MUX_SCTL_DBG_STR_L_CONN)
chunk_appendf(buf, " conn.flg=%#08x", qcc->conn->flags);
if (dbg_ctx->arg.debug_flags & MUX_SCTL_DBG_STR_L_XPRT)
qcc->conn->xprt->dump_info(buf, qcc->conn);
dbg_ctx->ret.buf = *buf;
return ret;

View File

@ -12,6 +12,8 @@
#include <inttypes.h>
#include <haproxy/api-t.h>
#include <haproxy/chunk.h>
#include <haproxy/quic_conn.h>
#include <haproxy/quic_tls.h>
#include <haproxy/quic_trace.h>
@ -631,3 +633,9 @@ static void quic_trace(enum trace_level level, uint64_t mask, const struct trace
}
}
void quic_dump_qc_info(struct buffer *msg, const struct quic_conn *qc)
{
chunk_appendf(msg, " qc.wnd=%llu/%llu", (ullong)qc->path->in_flight,
(ullong)qc->path->cwnd);
}

View File

@ -11,6 +11,7 @@
*/
#include <haproxy/api.h>
#include <haproxy/buf.h>
#include <haproxy/connection.h>
#include <haproxy/quic_conn.h>
#include <haproxy/ssl_sock.h>
@ -161,6 +162,11 @@ static struct ssl_sock_ctx *qc_get_ssl_sock_ctx(struct connection *conn)
return conn->handle.qc->xprt_ctx;
}
static void qc_xprt_dump_info(struct buffer *msg, const struct connection *conn)
{
quic_dump_qc_info(msg, conn->handle.qc);
}
/* transport-layer operations for QUIC connections. */
static struct xprt_ops ssl_quic = {
.close = quic_close,
@ -172,6 +178,7 @@ static struct xprt_ops ssl_quic = {
.destroy_bind_conf = ssl_sock_destroy_bind_conf,
.get_alpn = ssl_sock_get_alpn,
.get_ssl_sock_ctx = qc_get_ssl_sock_ctx,
.dump_info = qc_xprt_dump_info,
.name = "QUIC",
};