From 472a0ca440b6bb200b3ea3a23ba6ee10dbe8fa5f Mon Sep 17 00:00:00 2001 From: Christopher Faulet Date: Tue, 29 Sep 2026 09:28:45 +0200 Subject: [PATCH] BUG/MINOR: resolvers: don't dump a nameserver twice in "show resolvers" When the output buffer is full, "show resolvers" yields and resumes from the nameserver saved in its context. But this one is only updated after a nameserver was successfully dumped, so the dump resumes from the last nameserver already dumped, which appears twice in the output, instead of the one which could not be dumped. This can be reproduced with 40 nameservers in a section and "tune.bufsize 4096": "show resolvers" lists 43 nameservers, ns13, ns25 and ns37 appearing twice. Let's save the nameserver being dumped before trying to dump it instead. This patch should be backported to all stable branches. --- src/resolvers.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/resolvers.c b/src/resolvers.c index addc98836..a3091b95d 100644 --- a/src/resolvers.c +++ b/src/resolvers.c @@ -3208,6 +3208,8 @@ static int cli_io_handler_dump_resolvers_to_buffer(struct appctx *appctx) } list_for_each_entry_from(ns, &resolvers->nameservers, list) { + /* restart from this one if the buffer is full */ + ctx->ns = ns; chunk_reset(&trash); chunk_appendf(&trash, " nameserver %s:\n", ns->id); chunk_appendf(&trash, " sent: %lld\n", ns->counters->sent); @@ -3228,7 +3230,6 @@ static int cli_io_handler_dump_resolvers_to_buffer(struct appctx *appctx) chunk_appendf(&trash, " outdated: %lld\n", ns->counters->app.resolver.outdated); if (applet_putchk(appctx, &trash) == -1) goto full; - ctx->ns = ns; } ctx->ns = NULL; -- 2.47.3