]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: quic: dump backend connections on show quic
authorAmaury Denoyelle <adenoyelle@haproxy.com>
Mon, 24 Nov 2025 14:00:24 +0000 (15:00 +0100)
committerAmaury Denoyelle <adenoyelle@haproxy.com>
Tue, 25 Nov 2025 13:30:18 +0000 (14:30 +0100)
Add a new "be" filter to "show quic". Its purpose is to be able to
display backend connections. These connections can also be listed using
"all" filter.

doc/management.txt
src/quic_cli.c

index be211b5554f30362c5d8da23b6cad7df4799b298..2e7416198184dc2e07d29d2a1c2af75bfaa4da52 100644 (file)
@@ -3343,9 +3343,9 @@ show quic [<format>] [<filter>]
 
   The final argument is used to restrict or extend the connection list. By
   default, active frontend connections only are displayed. Use the extra
-  argument "clo" to list instead closing frontend connections, or "all" for
-  both. It's also possible to restrict to a single connection by specifying its
-  hexadecimal address.
+  argument "clo" to list instead closing frontend connections, "be" for backend
+  connections or "all" for every categories. It's also possible to restrict to
+  a single connection by specifying its hexadecimal address.
 
 show servers conn [<backend>]
   Dump the current and idle connections state of the servers belonging to the
index f0bf407dd396ed1f0a958692069a741d6fb57260..e16067f9fe5d58396aa48fc61c7ce6dcf86b3616 100644 (file)
@@ -41,6 +41,7 @@ struct show_quic_ctx {
 
 #define QC_CLI_FL_SHOW_ALL 0x0001 /* show closing/draining connections */
 #define QC_CLI_FL_SHOW_CLO 0x0002 /* show closing/draining connections */
+#define QC_CLI_FL_SHOW_BE  0x0004 /* show closing/draining connections */
 
 /* Returns the output format for show quic. If specified explicitly use it as
  * set. Else format depends if filtering on a single connection instance. If
@@ -96,6 +97,7 @@ static int cli_parse_show_quic(char **args, char *payload, struct appctx *appctx
                             "Available output filters:\n"
                             "  all        dump all connections\n"
                             "  clo        dump frontend closing connections\n"
+                            "  be         dump backend connections\n"
                             "  <id>       dump only the connection matching this identifier (0x...)\n"
                             "Without any argument, active frontend connections are dumped using the oneline format.\n");
                return cli_err(appctx, trash.area);
@@ -167,6 +169,9 @@ static int cli_parse_show_quic(char **args, char *payload, struct appctx *appctx
                else if (istmatch(istarg, ist("clo"))) {
                        ctx->flags |= QC_CLI_FL_SHOW_CLO;
                }
+               else if (istmatch(istarg, ist("be"))) {
+                       ctx->flags |= QC_CLI_FL_SHOW_BE;
+               }
                else {
                        cli_err(appctx, "Invalid argument, use 'help' for more options.\n");
                        return 1;
@@ -441,7 +446,9 @@ static void dump_quic_full(struct show_quic_ctx *ctx, struct quic_conn *qc)
 
 static inline struct list *cli_quic_get_list(int flags, int thr)
 {
-       if (flags & QC_CLI_FL_SHOW_CLO)
+       if (flags & QC_CLI_FL_SHOW_BE)
+               return &ha_thread_ctx[thr].quic_conns_be;
+       else if (flags & QC_CLI_FL_SHOW_CLO)
                return &ha_thread_ctx[thr].quic_conns_clo;
        else
                return &ha_thread_ctx[thr].quic_conns_fe;
@@ -500,6 +507,8 @@ static int cli_io_handler_dump_quic(struct appctx *appctx)
                        }
                        else if ((ctx->flags & QC_CLI_FL_SHOW_ALL) || ctx->ptr) {
                                if (ctx->bref.ref == &ha_thread_ctx[ctx->thr].quic_conns_fe)
+                                       qc_list = &ha_thread_ctx[ctx->thr].quic_conns_be;
+                               else if (ctx->bref.ref == &ha_thread_ctx[ctx->thr].quic_conns_be)
                                        qc_list = &ha_thread_ctx[ctx->thr].quic_conns_clo;
                                ctx->bref.ref = qc_list->n;
                                continue;