]> git.ipfire.org Git - thirdparty/iproute2.git/commitdiff
iproute2: fix 'ip xfrm monitor all' command
authorNathan Harold <nharold@google.com>
Wed, 30 May 2018 19:11:32 +0000 (12:11 -0700)
committerStephen Hemminger <stephen@networkplumber.org>
Fri, 1 Jun 2018 19:57:26 +0000 (15:57 -0400)
Currently, calling 'ip xfrm monitor all' will
actually invoke the 'all-nsid' command because the
soft-match for 'all-nsid' occurs before the precise
match for 'all'. This patch rearranges the checks
so that the 'all' command, itself an alias for
invoking 'ip xfrm monitor' with no argument, can
be called consistent with the syntax for other ip
commands that accept an 'all'.

Signed-off-by: Nathan Harold <nharold@google.com>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
ip/xfrm_monitor.c

index 2eabece0c39b2b581bf9fd6cd0c84b00ba1b0b40..5d086768560e3013c78ae4462ab10b6677f6b29d 100644 (file)
@@ -359,6 +359,8 @@ int do_xfrm_monitor(int argc, char **argv)
                if (matches(*argv, "file") == 0) {
                        NEXT_ARG();
                        file = *argv;
+               } else if (strcmp(*argv, "all") == 0) {
+                       /* fall out */
                } else if (matches(*argv, "all-nsid") == 0) {
                        listen_all_nsid = 1;
                } else if (matches(*argv, "acquire") == 0) {
@@ -381,7 +383,7 @@ int do_xfrm_monitor(int argc, char **argv)
                        groups = 0;
                } else if (matches(*argv, "help") == 0) {
                        usage();
-               } else if (strcmp(*argv, "all")) {
+               } else {
                        fprintf(stderr, "Argument \"%s\" is unknown, try \"ip xfrm monitor help\".\n", *argv);
                        exit(-1);
                }