All of lore.kernel.org
 help / color / mirror / Atom feed
From: Christoph Schulz <develop@kristov.de>
To: netdev@vger.kernel.org
Cc: Wilhelm Wijkander <lists@0x5e.se>,
	Vadim Kochan <vadim4j@gmail.com>,
	Leonhard Preis <leonhard@pre.is>
Subject: [PATCH] ip: allow using a device "help" (or a prefix thereof)
Date: Fri, 18 Sep 2015 10:23:45 +0200	[thread overview]
Message-ID: <55FBCA11.7070604@kristov.de> (raw)

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 <develop@kristov.de>
Reported-by: Leonhard Preis <leonhard@pre.is>
Reported-by: Wilhelm Wijkander <lists@0x5e.se>
---
 ip/ip6tunnel.c | 2 +-
 ip/ipaddress.c | 2 +-
 ip/iplink.c    | 6 ++----
 ip/ipmaddr.c   | 2 +-
 4 files changed, 5 insertions(+), 7 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 2aa5fbf..4c97b4a 100644
--- a/ip/ipaddress.c
+++ b/ip/ipaddress.c
@@ -1561,7 +1561,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 97f46cd..6f840cf 100644
--- a/ip/iplink.c
+++ b/ip/iplink.c
@@ -649,8 +649,7 @@ int iplink_parse(int argc, char **argv, struct iplink_req *req,
 		} else {
 			if (strcmp(*argv, "dev") == 0)
 				NEXT_ARG();
-
-			if (matches(*argv, "help") == 0)
+			else if (matches(*argv, "help") == 0)
 				usage();
 			if (*dev)
 				duparg2("dev", *argv);
@@ -1148,8 +1147,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);
-- 
2.4.6

             reply	other threads:[~2015-09-18  8:29 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-09-18  8:23 Christoph Schulz [this message]
2015-09-18 12:06 ` [PATCH] ip: allow using a device "help" (or a prefix thereof) Erik Hugne
2015-09-23 23:07 ` Stephen Hemminger

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=55FBCA11.7070604@kristov.de \
    --to=develop@kristov.de \
    --cc=leonhard@pre.is \
    --cc=lists@0x5e.se \
    --cc=netdev@vger.kernel.org \
    --cc=vadim4j@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.