]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: appctx/cli: remove the "dns" entry from the appctx union
authorWilly Tarreau <w@1wt.eu>
Fri, 16 Dec 2016 17:06:26 +0000 (18:06 +0100)
committerWilly Tarreau <w@1wt.eu>
Fri, 16 Dec 2016 18:40:14 +0000 (19:40 +0100)
This one now migrates to the general purpose cli.p0.

include/types/applet.h
src/dns.c

index 31045f337b1704280c114f817bdbc1a06111da7e..b90a370df6e819d45087c82aac32e48724bb2e7f 100644 (file)
@@ -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. */
index 012fcede4f9a4e513dc2a02449ba82113ba44c0a..2a333f1d31bcd6928b1bcd70b6a6501247b8945f 100644 (file)
--- 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
+ * <cli.p0> 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);