From: Amaury Denoyelle Date: Thu, 22 Oct 2026 09:13:19 +0000 (+0200) Subject: BUG/MINOR: quic: fix "show quic" filtered connection X-Git-Tag: v3.5-dev10~76 X-Git-Url: https://git.kaiwu.me/?a=commitdiff_plain;h=3eeec1481fff3bfb1d15a8db30988704af1467b6;p=haproxy.git BUG/MINOR: quic: fix "show quic" filtered connection 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 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. --- diff --git a/src/quic_cli.c b/src/quic_cli.c index 81c45a8ac..7988cbbda 100644 --- a/src/quic_cli.c +++ b/src/quic_cli.c @@ -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: