]> git.pld-linux.org Git - packages/iproute2.git/blame - iproute2-rates-1024-fix.patch
- updated to 040730 (unfortunately our linux-libc-headers are TOO OLD to handle all...
[packages/iproute2.git] / iproute2-rates-1024-fix.patch
CommitLineData
dd786d93
SP
1--- iproute2-2.6.8/tc/tc_util.c 2004-07-02 17:53:03.000000000 +0000
2+++ iproute2-2.6.8.new/tc/tc_util.c 2004-07-25 17:40:46.427882688 +0000
3@@ -119,17 +119,17 @@
4 else if (strcasecmp(p, "gbit") == 0)
5 bps = (bps * 1000000000.)/8;
6 else if (strcasecmp(p, "kibit") == 0)
7- bps *= 1024 / 8;
8+ bps *= 1000 / 8;
9 else if (strcasecmp(p, "mibit") == 0)
10- bps *= 1024*1024/8;
11+ bps *= 1000*1000/8;
12 else if (strcasecmp(p, "gibit") == 0)
13 bps *= 1024*1024*1024/8;
14 else if (strcasecmp(p, "kbps") == 0)
15- bps *= 1024;
16+ bps *= 1000;
17 else if (strcasecmp(p, "mbps") == 0)
18- bps *= 1024*1024;
19+ bps *= 1000*1000;
20 else if (strcasecmp(p, "gbps") == 0)
21- bps *= 1024*1024*1024;
22+ bps *= 1000*1000*1000;
23 else if (strcasecmp(p, "bps") != 0)
24 return -1;
aa63c42e 25
dd786d93
SP
26@@ -172,11 +172,11 @@
27 extern int use_iec;
28
29 if (use_iec) {
30- if (tmp >= 1024*1023 &&
31- fabs(1024*1024*rint(tmp/(1024*1024)) - tmp) < 1024)
32- snprintf(buf, len, "%gMibps", rint(tmp/(1024*1024)));
33- else if (tmp >= 1024-16 && fabs(1024*rint(tmp/1024) - tmp) < 16)
34- snprintf(buf, len, "%gKibps", rint(tmp/1024));
35+ if (tmp >= 1000*999 &&
36+ fabs(1000*1000*rint(tmp/(1000*1000)) - tmp) < 1000)
37+ snprintf(buf, len, "%gMibps", rint(tmp/(1000*1000)));
38+ else if (tmp >= 1000-10 && fabs(1024*rint(tmp/1000) - tmp) < 10)
39+ snprintf(buf, len, "%gKibps", rint(tmp/1000));
40 else
41 snprintf(buf, len, "%ubps", rate);
aa63c42e 42
This page took 0.059698 seconds and 4 git commands to generate.