From: Nathan Harold Date: Wed, 30 May 2018 19:11:32 +0000 (-0700) Subject: iproute2: fix 'ip xfrm monitor all' command X-Git-Tag: v4.17.0~7 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b8e7799003e414fbe4f6f865500a3efffcfbbf67;p=thirdparty%2Fiproute2.git iproute2: fix 'ip xfrm monitor all' command 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 Signed-off-by: Stephen Hemminger --- diff --git a/ip/xfrm_monitor.c b/ip/xfrm_monitor.c index 2eabece0c..5d0867685 100644 --- a/ip/xfrm_monitor.c +++ b/ip/xfrm_monitor.c @@ -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); }