]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: quic: dump quic_conn debug string for logs
authorAmaury Denoyelle <adenoyelle@haproxy.com>
Thu, 1 Aug 2024 09:35:04 +0000 (11:35 +0200)
committerAmaury Denoyelle <adenoyelle@haproxy.com>
Wed, 7 Aug 2024 13:40:52 +0000 (15:40 +0200)
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.

include/haproxy/connection-t.h
include/haproxy/quic_trace.h
src/mux_quic.c
src/quic_trace.c
src/xprt_quic.c

index 7119c0c20de18570b22c565c827a64e45a880720..228f2078c4e17585838ef7590df15ecd816006ce 100644 (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
index 19fe864307575939bb70a6b19a696c38782891ac..ddfd3cc958239d5ea30b50367c542d0eab10032c 100644 (file)
 
 #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 */
index 4ea46bd15ce3a35928c5f9350dc0ee969c6b47ed..ddaea06228e387bf2054c7920a9729c2c2f5bd0d 100644 (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;
 
index bd7a8861073cdcdeb6f1c81b8e9e0f064a9f2161..ce683f65714b34c920e1c964ab3223c896b27871 100644 (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);
+}
index 558d1a5975219745e3d5c3492c4e1725dd262a70..d6d1a16708c84f9278a43fe06b3201f78aeef634 100644 (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",
 };