From: Andreas Henriksson <andreas@fatal.se>
To: Stephen Hemminger <shemminger@vyatta.com>
Cc: netdev@vger.kernel.org, "Thomas Mühlgrabner" <muehltom@cable.vol.at>
Subject: [PATCH] iproute: fix tc -iec display of Mibit rates
Date: Fri, 9 Mar 2012 17:09:19 +0100 [thread overview]
Message-ID: <20120309160919.GA22767@amd64.fatal.se> (raw)
As reported by Thomas Mühlgrabner <muehltom@cable.vol.at>
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 <muehltom@cable.vol.at>
Signed-off-by: Andreas Henriksson <andreas@fatal.se>
diff --git a/tc/tc_util.c b/tc/tc_util.c
index 5829d61..36e3c7d 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
next reply other threads:[~2012-03-09 16:06 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-03-09 16:09 Andreas Henriksson [this message]
2012-03-10 17:14 ` [PATCH] iproute: fix tc -iec display of Mibit rates Stephen Hemminger
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20120309160919.GA22767@amd64.fatal.se \
--to=andreas@fatal.se \
--cc=muehltom@cable.vol.at \
--cc=netdev@vger.kernel.org \
--cc=shemminger@vyatta.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).