]> git.proxmox.com Git - mirror_iproute2.git/blobdiff - tc/q_choke.c
tc: B.W limits can now be specified in %.
[mirror_iproute2.git] / tc / q_choke.c
index 726914b2146b0f707bcb116cd753ca6fb48f106b..50ac4ad4ecb8093e00b46e439fd50a7f10186c5f 100644 (file)
@@ -31,7 +31,7 @@ static void explain(void)
 }
 
 static int choke_parse_opt(struct qdisc_util *qu, int argc, char **argv,
-                          struct nlmsghdr *n)
+                          struct nlmsghdr *n, const char *dev)
 {
        struct tc_red_qopt opt = {};
        unsigned int burst = 0;
@@ -53,7 +53,12 @@ static int choke_parse_opt(struct qdisc_util *qu, int argc, char **argv,
                        }
                } else if (strcmp(*argv, "bandwidth") == 0) {
                        NEXT_ARG();
-                       if (get_rate(&rate, *argv)) {
+                       if (strchr(*argv, '%')) {
+                               if (get_percent_rate(&rate, *argv, dev)) {
+                                       fprintf(stderr, "Illegal \"bandwidth\"\n");
+                                       return -1;
+                               }
+                       } else if (get_rate(&rate, *argv)) {
                                fprintf(stderr, "Illegal \"bandwidth\"\n");
                                return -1;
                        }