From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nathan Harold Subject: [PATCH] iproute2: fix 'ip xfrm monitor all' command Date: Wed, 30 May 2018 12:11:32 -0700 Message-ID: <20180530191132.62598-1-nharold@google.com> Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Cc: Nathan Harold To: netdev@vger.kernel.org Return-path: Received: from mail-ua0-f201.google.com ([209.85.217.201]:53394 "EHLO mail-ua0-f201.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753627AbeE3TLi (ORCPT ); Wed, 30 May 2018 15:11:38 -0400 Received: by mail-ua0-f201.google.com with SMTP id n13-v6so3770140ual.20 for ; Wed, 30 May 2018 12:11:37 -0700 (PDT) Sender: netdev-owner@vger.kernel.org List-ID: 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 --- ip/xfrm_monitor.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ip/xfrm_monitor.c b/ip/xfrm_monitor.c index 2eabece0..5d086768 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); } -- 2.17.1.1185.g55be947832-goog