From: Christoph Schulz Date: Fri, 25 Sep 2015 06:44:07 +0000 (+0200) Subject: ip: allow using a device "help" (or a prefix thereof) X-Git-Tag: v4.3.0~38 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8aacb9bbbd741c2873ee90118264ae2d5bbd9ae3;p=thirdparty%2Fiproute2.git ip: allow using a device "help" (or a prefix thereof) 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 --- diff --git a/ip/ip6tunnel.c b/ip/ip6tunnel.c index 62a8240f1..9884efd45 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 e53984720..e864ca656 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 1c452055b..f30de86d1 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 a77a18fbf..cbd6d115f 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);