From 777b560d04e90743236d293b4a9e7bab58b5046d Mon Sep 17 00:00:00 2001 From: Willy Tarreau Date: Fri, 16 Dec 2016 18:06:26 +0100 Subject: [PATCH] MINOR: appctx/cli: remove the "dns" entry from the appctx union This one now migrates to the general purpose cli.p0. --- include/types/applet.h | 3 --- src/dns.c | 15 ++++++++------- 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/include/types/applet.h b/include/types/applet.h index 31045f337..b90a370df 100644 --- a/include/types/applet.h +++ b/include/types/applet.h @@ -154,9 +154,6 @@ struct appctx { struct task *task; 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. */ diff --git a/src/dns.c b/src/dns.c index 012fcede4..2a333f1d3 100644 --- a/src/dns.c +++ b/src/dns.c @@ -1268,19 +1268,19 @@ struct task *dns_process_resolve(struct task *t) 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 @@ static int cli_parse_stat_resolvers(char **args, struct appctx *appctx, void *pr 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 + * if it's not null. */ static int cli_io_handler_dump_resolvers_to_buffer(struct appctx *appctx) { @@ -1312,7 +1313,7 @@ static int cli_io_handler_dump_resolvers_to_buffer(struct appctx *appctx) } 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);