]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MINOR: dns: Fix CLI keyword declaration
authorChristopher Faulet <cfaulet@haproxy.com>
Tue, 3 Oct 2017 14:00:57 +0000 (16:00 +0200)
committerWilly Tarreau <w@1wt.eu>
Tue, 31 Oct 2017 10:36:12 +0000 (11:36 +0100)
The cli command to show resolvers stats is in conflict with the command to show
proxies and servers stats. When you use the command "show stat resolvers [id]",
instead of printing stats about resolvers, you get the stats about all proxies
and servers.

Now, to avoid conflict, to print resolvers stats, you must use the following
command:

     show resolvers [id]

This patch must be backported in 1.7.

src/dns.c

index dbb473e29f6adf25b781e637afb26451d8ac4ba5..aa17846c3a8e28a23df1749a3a1e8cda7df542b4 100644 (file)
--- a/src/dns.c
+++ b/src/dns.c
@@ -2248,9 +2248,9 @@ static int cli_parse_stat_resolvers(char **args, struct appctx *appctx, void *pr
 {
        struct dns_resolvers *presolvers;
 
-       if (*args[3]) {
+       if (*args[2]) {
                list_for_each_entry(presolvers, &dns_resolvers, list) {
-                       if (strcmp(presolvers->id, args[3]) == 0) {
+                       if (strcmp(presolvers->id, args[2]) == 0) {
                                appctx->ctx.cli.p0 = presolvers;
                                break;
                        }
@@ -2675,12 +2675,13 @@ static int cli_io_handler_dump_resolvers_to_buffer(struct appctx *appctx)
 }
 
 /* register cli keywords */
-static struct cli_kw_list cli_kws = {{ },{
-       { { "show", "stat", "resolvers", NULL }, "show stat resolvers [id]: dumps counters from all resolvers section and\n"
-                                                "                          associated name servers",
-                                                cli_parse_stat_resolvers, cli_io_handler_dump_resolvers_to_buffer },
-       {{},}
-}};
+static struct cli_kw_list cli_kws = {{ }, {
+               { { "show", "resolvers", NULL }, "show resolvers [id]: dumps counters from all resolvers section and\n"
+                 "                     associated name servers",
+                 cli_parse_stat_resolvers, cli_io_handler_dump_resolvers_to_buffer },
+               {{},}
+       }
+};
 
 
 __attribute__((constructor))