From patchwork Fri Sep 25 06:44:07 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Schulz X-Patchwork-Id: 522664 X-Patchwork-Delegate: shemminger@vyatta.com Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 4F64D140281 for ; Fri, 25 Sep 2015 16:44:41 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754958AbbIYGoh (ORCPT ); Fri, 25 Sep 2015 02:44:37 -0400 Received: from server1137-han.de-nserver.de ([77.75.249.171]:18412 "EHLO server1137-han.de-nserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752015AbbIYGog (ORCPT ); Fri, 25 Sep 2015 02:44:36 -0400 Received: (qmail 21620 invoked from network); 25 Sep 2015 08:44:34 +0200 X-Fcrdns: Yes Received: from a89-182-210-158.net-htp.de (HELO onion.schulz.ip-v6.eu) (89.182.210.158) (smtp-auth username mail@kristov.de, mechanism login) by server1137-han.de-nserver.de (qpsmtpd/0.92) with (ECDHE-RSA-AES256-GCM-SHA384 encrypted) ESMTPSA; Fri, 25 Sep 2015 08:44:34 +0200 Received: from [2001:6f8:13da:1:98b2:6367:c474:5be] (helo=peacock.schulz.ip-v6.eu) by onion.schulz.ip-v6.eu with esmtps (TLSv1.2:DHE-RSA-AES256-GCM-SHA384:256) (Exim 4.85) (envelope-from ) id 1ZfMkC-0006rL-1W; Fri, 25 Sep 2015 08:44:32 +0200 Received: from peacock.schulz.ip-v6.eu ([192.168.11.2]) by peacock.schulz.ip-v6.eu with esmtps (TLSv1.2:DHE-RSA-AES128-SHA:128) (Exim 4.85) (envelope-from ) id 1ZfMjq-0005zk-VU; Fri, 25 Sep 2015 08:44:11 +0200 To: netdev@vger.kernel.org, lists@0x5e.se Cc: Wilhelm Wijkander , Vadim Kochan , Leonhard Preis From: Christoph Schulz Subject: [PATCH iproute2 v2] ip: allow using a device "help" (or a prefix thereof) Message-ID: <5604ED37.4020103@kristov.de> Date: Fri, 25 Sep 2015 08:44:07 +0200 User-Agent: Mozilla/5.0 (X11; Linux i686; rv:38.0) Gecko/20100101 Thunderbird/38.2.0 MIME-Version: 1.0 X-User-Auth: Auth by mail@kristov.de through 89.182.210.158 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Device names that match "help" or a prefix thereof should be allowed anywhere a device name can be used. Note that a suitable keyword ("dev" or "name", the latter for "ip tunnel") has to be used in these cases to resolve ambiguities. Signed-off-by: Christoph Schulz Reported-by: Leonhard Preis Reported-by: Wilhelm Wijkander --- ip/ip6tunnel.c | 2 +- ip/ipaddress.c | 2 +- ip/iplink.c | 3 +-- ip/ipmaddr.c | 2 +- 4 files changed, 4 insertions(+), 5 deletions(-) diff --git a/ip/ip6tunnel.c b/ip/ip6tunnel.c index 62a8240..9884efd 100644 --- a/ip/ip6tunnel.c +++ b/ip/ip6tunnel.c @@ -287,7 +287,7 @@ static int parse_args(int argc, char **argv, int cmd, struct ip6_tnl_parm2 *p) if (strcmp(*argv, "name") == 0) { NEXT_ARG(); } - if (matches(*argv, "help") == 0) + else if (matches(*argv, "help") == 0) usage(); if (p->name[0]) duparg2("name", *argv); diff --git a/ip/ipaddress.c b/ip/ipaddress.c index e539847..e864ca6 100644 --- a/ip/ipaddress.c +++ b/ip/ipaddress.c @@ -1580,7 +1580,7 @@ static int ipaddr_list_flush_or_save(int argc, char **argv, int action) if (strcmp(*argv, "dev") == 0) { NEXT_ARG(); } - if (matches(*argv, "help") == 0) + else if (matches(*argv, "help") == 0) usage(); if (filter_dev) duparg2("dev", *argv); diff --git a/ip/iplink.c b/ip/iplink.c index 1c45205..f30de86 100644 --- a/ip/iplink.c +++ b/ip/iplink.c @@ -1148,8 +1148,7 @@ static int do_set(int argc, char **argv) } else { if (strcmp(*argv, "dev") == 0) NEXT_ARG(); - - if (matches(*argv, "help") == 0) + else if (matches(*argv, "help") == 0) usage(); if (dev) diff --git a/ip/ipmaddr.c b/ip/ipmaddr.c index a77a18f..cbd6d11 100644 --- a/ip/ipmaddr.c +++ b/ip/ipmaddr.c @@ -257,7 +257,7 @@ static int multiaddr_list(int argc, char **argv) if (strcmp(*argv, "dev") == 0) { NEXT_ARG(); } - if (matches(*argv, "help") == 0) + else if (matches(*argv, "help") == 0) usage(); if (filter.dev) duparg2("dev", *argv);