From f526af995e4b610334ddea250686643b2d6e9729 Mon Sep 17 00:00:00 2001 From: Andreas Henriksson Date: Fri, 9 Mar 2012 17:09:19 +0100 Subject: [PATCH] iproute: fix tc -iec display of Mibit rates MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit As reported by Thomas Mühlgrabner in http://bugs.debian.org/662979 : When showing htb class configuration with "tc -iec class show", the output for Mibit is actually the value for bit. Example: configure a class with a ceil of 1000Mibit. Output states 1048576000 Mibit. The cause is missing parenteses in the display code of tc.... (Please also note that a lower value of 100Mibit will be displayed as 102400 Kibit, which I think is kind of ugly.) Reported-by: Thomas Mühlgrabner Signed-off-by: Andreas Henriksson --- tc/tc_util.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tc/tc_util.c b/tc/tc_util.c index 5829d6138..36e3c7df9 100644 --- a/tc/tc_util.c +++ b/tc/tc_util.c @@ -203,7 +203,7 @@ void print_rate(char *buf, int len, __u32 rate) if (use_iec) { if (tmp >= 1000.0*1024.0*1024.0) - snprintf(buf, len, "%.0fMibit", tmp/1024.0*1024.0); + snprintf(buf, len, "%.0fMibit", tmp/(1024.0*1024.0)); else if (tmp >= 1000.0*1024) snprintf(buf, len, "%.0fKibit", tmp/1024); else -- 2.47.3