]> git.kaiwu.me - haproxy.git/commitdiff
BUG/MINOR: quic: fix "show quic" filtered connection
authorAmaury Denoyelle <adenoyelle@haproxy.com>
Thu, 22 Oct 2026 09:13:19 +0000 (11:13 +0200)
committerAmaury Denoyelle <adenoyelle@haproxy.com>
Thu, 22 Oct 2026 09:48:51 +0000 (11:48 +0200)
CLI "show quic" output can be filtered to only a single connection entry
by specifying its address as argument. However, loop iteration and
filtering was incorrectly implemented, and in effect only the first
connection of each thread could be dumped this way.

Fix this by adjusting iteration on "show quic" handler. The basic idea
is similar. If <ctx.ptr> is set, it does not dump anything for
non-matching entries. As soon as the filtered entry is dumped, the
iteration is interrupted.

This must be backported up to 3.0.

src/quic_cli.c

index 81c45a8ac8988b7796c71832238181d5c847e8f9..7988cbbdab91e3835e9939cf0a4012b8176346b9 100644 (file)
@@ -523,10 +523,6 @@ static int cli_io_handler_dump_quic(struct appctx *appctx)
                        qc = LIST_ELEM(ctx->bref.ref, struct quic_conn *, el_th_ctx);
                        if ((int)(qc->qc_epoch - ctx->epoch) > 0)
                                done = 1;
-
-                       /* Skip to next element if filter on a different connection. */
-                       if (ctx->ptr && ctx->ptr != qc)
-                               done = 1;
                }
 
                if (done) {
@@ -539,34 +535,37 @@ static int cli_io_handler_dump_quic(struct appctx *appctx)
                        continue;
                }
 
-               switch (cli_show_quic_format(ctx)) {
-               case QUIC_DUMP_FMT_CUST:
-                       dump_quic_full(ctx, qc);
-                       break;
-               case QUIC_DUMP_FMT_ONELINE:
-                       dump_quic_oneline(ctx, qc);
-                       break;
-
-               case QUIC_DUMP_FMT_STREAM:
-                       dump_quic_stream(ctx, qc);
-                       break;
-
-               case QUIC_DUMP_FMT_DEFAULT:
-                       /* An explicit format must be returned by cli_show_quic_format(). */
-                       ABORT_NOW();
-               }
 
-               if (applet_putchk(appctx, &trash) == -1) {
-                       /* Register show_quic_ctx to quic_conn instance. */
-                       LIST_APPEND(&qc->back_refs, &ctx->bref.users);
-                       goto full;
-               }
+               /* Do not dump conn if filtered on a specific different entry. */
+               if (!ctx->ptr || ctx->ptr == qc) {
+                       switch (cli_show_quic_format(ctx)) {
+                       case QUIC_DUMP_FMT_CUST:
+                               dump_quic_full(ctx, qc);
+                               break;
+                       case QUIC_DUMP_FMT_ONELINE:
+                               dump_quic_oneline(ctx, qc);
+                               break;
 
-               ctx->bref.ref = qc->el_th_ctx.n;
+                       case QUIC_DUMP_FMT_STREAM:
+                               dump_quic_stream(ctx, qc);
+                               break;
+
+                       case QUIC_DUMP_FMT_DEFAULT:
+                               /* An explicit format must be returned by cli_show_quic_format(). */
+                               ABORT_NOW();
+                       }
+
+                       if (applet_putchk(appctx, &trash) == -1) {
+                               /* Register show_quic_ctx to quic_conn instance. */
+                               LIST_APPEND(&qc->back_refs, &ctx->bref.users);
+                               goto full;
+                       }
+               }
 
                /* If filtered connection displayed, show quic can be stopped early. */
-               if (ctx->ptr)
+               if (ctx->ptr && ctx->ptr == qc)
                        goto done;
+               ctx->bref.ref = qc->el_th_ctx.n;
        }
 
  done: