]> git.ipfire.org Git - thirdparty/iproute2.git/commitdiff
ip: allow using a device "help" (or a prefix thereof)
authorChristoph Schulz <develop@kristov.de>
Fri, 25 Sep 2015 06:44:07 +0000 (08:44 +0200)
committerStephen Hemminger <shemming@brocade.com>
Wed, 7 Oct 2015 09:35:17 +0000 (10:35 +0100)
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
ip/ipaddress.c
ip/iplink.c
ip/ipmaddr.c

index 62a8240f1c8f85a7284cd671001dd13b92fed3bf..9884efd4586dd49b23e084d1b3ee3a9515ce7b81 100644 (file)
@@ -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);
index e53984720d3ce620e74f8a5ee40a09a2f4cdf536..e864ca6567424368d19e62d05b05e3e660e30d59 100644 (file)
@@ -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);
index 1c452055b5f0b71b76eb63dc5f6f0c799c38ed41..f30de86d1858a013b5ab8b9fd65bf61dd7a5a3ce 100644 (file)
@@ -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)
index a77a18fbfdc0c41910cad085b8301c9205c695e2..cbd6d115f59072d5911201cceb1efcb6bc6d442f 100644 (file)
@@ -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);