* [PATCH] iproute: fix tc -iec display of Mibit rates
@ 2012-03-09 16:09 Andreas Henriksson
2012-03-10 17:14 ` Stephen Hemminger
0 siblings, 1 reply; 2+ messages in thread
From: Andreas Henriksson @ 2012-03-09 16:09 UTC (permalink / raw)
To: Stephen Hemminger; +Cc: netdev, Thomas Mühlgrabner
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
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] iproute: fix tc -iec display of Mibit rates
2012-03-09 16:09 [PATCH] iproute: fix tc -iec display of Mibit rates Andreas Henriksson
@ 2012-03-10 17:14 ` Stephen Hemminger
0 siblings, 0 replies; 2+ messages in thread
From: Stephen Hemminger @ 2012-03-10 17:14 UTC (permalink / raw)
To: Andreas Henriksson; +Cc: netdev, Thomas Mühlgrabner
On Fri, 9 Mar 2012 17:09:19 +0100
Andreas Henriksson <andreas@fatal.se> wrote:
> 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
Applied
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2012-03-10 17:14 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-03-09 16:09 [PATCH] iproute: fix tc -iec display of Mibit rates Andreas Henriksson
2012-03-10 17:14 ` Stephen Hemminger
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).