Skip to contentSkip to conversation

tc: allow 0% for percent options

PATCH New Stephen Hemminger 1 participant 1 message May 17, 2018

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 tc: allow 0% for percent options

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 [email protected]
Fixes 927e3cfb52b5 ("tc: B.W limits can now be specified in %.")
---
 lib/utils.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
lib/utils.c +1 -1
index 7b2c6dd19268..02ce67721915 100644
@@ -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;
Signature · 1 line
2.17.0