]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: quic: filter closing conn on "show quic"
authorAmaury Denoyelle <adenoyelle@haproxy.com>
Wed, 1 Feb 2023 16:31:02 +0000 (17:31 +0100)
committerAmaury Denoyelle <adenoyelle@haproxy.com>
Thu, 9 Feb 2023 17:14:40 +0000 (18:14 +0100)
Reduce default "show quic" output by masking connection on
closing/draing state due to a CONNECTION_CLOSE emission/reception. These
connections can still be displayed using the special argument "all".

This should be backported up to 2.7.

doc/management.txt
src/quic_conn.c

index bf7ba8c4b606590586133d819e5fb1c1574333e8..2678fdf652624429f704c32428a2156e19c7d604 100644 (file)
@@ -2966,10 +2966,11 @@ show resolvers [<resolvers section id>]
     too_big: too big response
     outdated: number of response arrived too late (after an other name server)
 
-show quic
+show quic [all]
   Dump information on all active QUIC frontend connections. This command is
   restricted and can only be issued on sockets configured for levels "operator"
-  or "admin".
+  or "admin". By default, connections on closing or draining state are not
+  displayed. Use the extra argument "all" to include them in the output.
 
 show servers conn [<backend>]
   Dump the current and idle connections state of the servers belonging to the
index a7712800b0e00e9b7dcd63fdb925deead5157dd8..631f2f2e86915769c18621f149e56ee242fe9848 100644 (file)
@@ -7624,8 +7624,11 @@ struct show_quic_ctx {
        unsigned int epoch;
        struct bref bref; /* back-reference to the quic-conn being dumped */
        unsigned int thr;
+       int flags;
 };
 
+#define QC_CLI_FL_SHOW_ALL 0x1 /* show closing/draining connections */
+
 static int cli_parse_show_quic(char **args, char *payload, struct appctx *appctx, void *private)
 {
        struct show_quic_ctx *ctx = applet_reserve_svcctx(appctx, sizeof(*ctx));
@@ -7633,8 +7636,12 @@ static int cli_parse_show_quic(char **args, char *payload, struct appctx *appctx
        if (!cli_has_level(appctx, ACCESS_LVL_OPER))
                return 1;
 
+       if (*args[2] && strcmp(args[2], "all") == 0)
+               ctx->flags |= QC_CLI_FL_SHOW_ALL;
+
        ctx->epoch = _HA_ATOMIC_FETCH_ADD(&qc_epoch, 1);
        ctx->thr = 0;
+       ctx->flags = 0;
 
        LIST_INIT(&ctx->bref.users);
 
@@ -7699,6 +7706,12 @@ static int cli_io_handler_dump_quic(struct appctx *appctx)
                        continue;
                }
 
+               if (!ctx->flags & QC_CLI_FL_SHOW_ALL &&
+                   qc->flags & (QUIC_FL_CONN_CLOSING|QUIC_FL_CONN_DRAINING)) {
+                       ctx->bref.ref = qc->el_th_ctx.n;
+                       continue;
+               }
+
                /* CIDs */
                chunk_appendf(&trash, "* %p[%02u]: scid=", qc, qc->tid);
                for (cid_len = 0; cid_len < qc->scid.len; ++cid_len)