* [PATCH iproute2 v2] ip: allow using a device "help" (or a prefix thereof)
@ 2015-09-25 6:44 Christoph Schulz
0 siblings, 0 replies; only message in thread
From: Christoph Schulz @ 2015-09-25 6:44 UTC (permalink / raw)
To: netdev, lists; +Cc: Wilhelm Wijkander, Vadim Kochan, Leonhard Preis
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 | 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);
--
2.4.6
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2015-09-25 6:44 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-09-25 6:44 [PATCH iproute2 v2] ip: allow using a device "help" (or a prefix thereof) Christoph Schulz
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).