]> rtime.felk.cvut.cz Git - lisovros/iproute2_canprio.git/commitdiff
Make link mode case independent
authorStephen Hemminger <stephen.hemminger@vyatta.com>
Thu, 5 Apr 2012 22:10:19 +0000 (15:10 -0700)
committerStephen Hemminger <stephen.hemminger@vyatta.com>
Thu, 5 Apr 2012 22:10:19 +0000 (15:10 -0700)
The link mode is printed in upper case, and following the general
rule that ip command output should work on input, allow either case.

ip/iplink.c

index a58e4d06787a687eb9b3c7468ff9219d95a36499..a3613d24e5489c4c740a95e4229c9b6a2004b174 100644 (file)
@@ -134,9 +134,9 @@ struct link_util *get_link_kind(const char *id)
 
 int get_link_mode(const char *mode)
 {
-       if (strcmp(mode, "default") == 0)
+       if (strcasecmp(mode, "default") == 0)
                return IF_LINK_MODE_DEFAULT;
-       if (strcmp(mode, "dormant") == 0)
+       if (strcasecmp(mode, "dormant") == 0)
                return IF_LINK_MODE_DORMANT;
        return -1;
 }
@@ -433,7 +433,7 @@ int iplink_parse(int argc, char **argv, struct iplink_req *req,
                } else if (strcmp(*argv, "mode") == 0) {
                        int mode;
                        NEXT_ARG();
-                       mode =  get_link_mode(*argv);
+                       mode = get_link_mode(*argv);
                        if (mode < 0)
                                invarg("Invalid link mode\n", *argv);
                        addattr8(&req->n, sizeof(*req), IFLA_LINKMODE, mode);