Commit f526af99 authored by Andreas Henriksson's avatar Andreas Henriksson Committed by Stephen Hemminger

iproute: fix tc -iec display of Mibit rates

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: default avatarThomas Mühlgrabner <muehltom@cable.vol.at>
Signed-off-by: default avatarAndreas Henriksson <andreas@fatal.se>
parent 8ced4fcd
......@@ -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
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment