MINOR: appctx/cli: remove the "dns" entry from the appctx union
This one now migrates to the general purpose cli.p0.
diff --git a/include/types/applet.h b/include/types/applet.h
index 31045f3..b90a370 100644
--- a/include/types/applet.h
+++ b/include/types/applet.h
@@ -155,9 +155,6 @@
struct hlua_function *fcn;
} hlua_cli;
struct {
- struct dns_resolvers *ptr;
- } resolvers;
- struct {
int iid; /* if >= 0, ID of the proxy to filter on */
struct proxy *px; /* current proxy being dumped, NULL = not started yet. */
struct server *sv; /* current server being dumped, NULL = not started yet. */
diff --git a/src/dns.c b/src/dns.c
index 012fced..2a333f1 100644
--- a/src/dns.c
+++ b/src/dns.c
@@ -1268,19 +1268,19 @@
return t;
}
+/* if an arg is found, it sets the resolvers section pointer into cli.p0 */
static int cli_parse_stat_resolvers(char **args, struct appctx *appctx, void *private)
{
struct dns_resolvers *presolvers;
if (*args[3]) {
- appctx->ctx.resolvers.ptr = NULL;
list_for_each_entry(presolvers, &dns_resolvers, list) {
if (strcmp(presolvers->id, args[3]) == 0) {
- appctx->ctx.resolvers.ptr = presolvers;
+ appctx->ctx.cli.p0 = presolvers;
break;
}
}
- if (appctx->ctx.resolvers.ptr == NULL) {
+ if (appctx->ctx.cli.p0 == NULL) {
appctx->ctx.cli.msg = "Can't find that resolvers section\n";
appctx->st0 = CLI_ST_PRINT;
return 1;
@@ -1289,9 +1289,10 @@
return 0;
}
-/* This function dumps counters from all resolvers section and associated name servers.
- * It returns 0 if the output buffer is full and it needs
- * to be called again, otherwise non-zero.
+/* This function dumps counters from all resolvers section and associated name
+ * servers. It returns 0 if the output buffer is full and it needs to be called
+ * again, otherwise non-zero. It may limit itself to the resolver pointed to by
+ * <cli.p0> if it's not null.
*/
static int cli_io_handler_dump_resolvers_to_buffer(struct appctx *appctx)
{
@@ -1312,7 +1313,7 @@
}
else {
list_for_each_entry(presolvers, &dns_resolvers, list) {
- if (appctx->ctx.resolvers.ptr != NULL && appctx->ctx.resolvers.ptr != presolvers)
+ if (appctx->ctx.cli.p0 != NULL && appctx->ctx.cli.p0 != presolvers)
continue;
chunk_appendf(&trash, "Resolvers section %s\n", presolvers->id);