]> git.ipfire.org Git - thirdparty/iproute2.git/commitdiff
tc: allow 0% for percent options
authorStephen Hemminger <stephen@networkplumber.org>
Thu, 17 May 2018 23:20:50 +0000 (16:20 -0700)
committerStephen Hemminger <stephen@networkplumber.org>
Thu, 17 May 2018 23:20:50 +0000 (16:20 -0700)
Allowing 0% is sometimes useful for example in netem loss and drop
or perhaps dropping all traffic in a HTB bin.

Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=199745
Reported-by: stuartmarsden@gmail.com
Fixes: 927e3cfb52b5 ("tc: B.W limits can now be specified in %.")
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
lib/utils.c

index 7b2c6dd1926889b5f058e930f93aee3266ab0db4..02ce67721915e14336685a5280c7133dda180773 100644 (file)
@@ -105,7 +105,7 @@ int parse_percent(double *val, const char *str)
        *val = strtod(str, &p) / 100.;
        if (*val == HUGE_VALF || *val == HUGE_VALL)
                return 1;
-       if (*val == 0.0 || (*p && strcmp(p, "%")))
+       if (*p && strcmp(p, "%"))
                return -1;
 
        return 0;