Iperf 2.0.1 integer overflow
Dear Iperf Developers,
Thank you for solving the Linux pthreads problem. However, there still
is an issue that could also be found in previous Iperf versions. At
Linux "unsigned long" appears to be used for the "max_size_t", resulting
in an Integer overflow at very high bandwidths:
> src/iperf -c localhost -i 2 -P 3
------------------------------------------------------------
Client connecting to localhost, TCP port 5001
TCP window size: 64.0 KByte (default)
------------------------------------------------------------
[ 7] local 127.0.0.1 port 49433 connected with 127.0.0.1 port 5001
[ 6] local 127.0.0.1 port 49432 connected with 127.0.0.1 port 5001
[ 5] local 127.0.0.1 port 49431 connected with 127.0.0.1 port 5001
[ 7] 0.0- 2.0 sec 286 MBytes 1.20 Gbits/sec
[ 5] 0.0- 2.0 sec 304 MBytes 1.27 Gbits/sec
[ 6] 0.0- 2.0 sec 224 MBytes 938 Mbits/sec
[SUM] 0.0- 2.0 sec 813 MBytes 3.41 Gbits/sec
[ 6] 2.0- 4.0 sec 304 MBytes 1.27 Gbits/sec
[ 5] 2.0- 4.0 sec 312 MBytes 1.31 Gbits/sec
[ 7] 2.0- 4.0 sec 229 MBytes 959 Mbits/sec
[SUM] 2.0- 4.0 sec 845 MBytes 3.54 Gbits/sec
[ 6] 4.0- 6.0 sec 168 MBytes 703 Mbits/sec
[ 5] 4.0- 6.0 sec 413 MBytes 1.73 Gbits/sec
[ 7] 4.0- 6.0 sec 238 MBytes 999 Mbits/sec
[SUM] 4.0- 6.0 sec 819 MBytes 3.44 Gbits/sec
[ 7] 6.0- 8.0 sec 201 MBytes 844 Mbits/sec
[ 6] 6.0- 8.0 sec 350 MBytes 1.47 Gbits/sec
[ 5] 6.0- 8.0 sec 330 MBytes 1.38 Gbits/sec
[SUM] 6.0- 8.0 sec 881 MBytes 3.70 Gbits/sec
[ 7] 8.0-10.0 sec 300 MBytes 1.26 Gbits/sec
[ 7] 0.0-10.0 sec 1.22 GBytes 1.05 Gbits/sec
[ 6] 0.0-10.0 sec 1.26 GBytes 1.08 Gbits/sec
[ 5] 0.0-10.0 sec 1.65 GBytes 1.42 Gbits/sec
[SUM] 0.0-10.0 sec 140 MBytes 118 Mbits/sec <-----
This overflow makes Iperf unsuited for 10 Gbit/s links.
However, when I change in "include/headers.h"
#ifdef HAVE_INT64_T
typedef int64_t max_size_t;
#else
typedef unsigned long max_size_t;
#endif // HAVE_INT64_T
into:
#ifdef HAVE_INT64_T
typedef int64_t max_size_t;
#else
typedef unsigned long long max_size_t;
#endif // HAVE_INT64_T
such that "unsigned long long" has been forced to use, the overflow
problem seems to be solved:
> src/iperf -c localhost -i 2 -P 3
------------------------------------------------------------
Client connecting to localhost, TCP port 5001
TCP window size: 64.0 KByte (default)
------------------------------------------------------------
[ 7] local 127.0.0.1 port 49561 connected with 127.0.0.1 port 5001
[ 6] local 127.0.0.1 port 49560 connected with 127.0.0.1 port 5001
[ 5] local 127.0.0.1 port 49559 connected with 127.0.0.1 port 5001
[ 7] 0.0- 2.0 sec 315 MBytes 1.32 Gbits/sec
[ 6] 0.0- 2.0 sec 330 MBytes 1.39 Gbits/sec
[ 5] 0.0- 2.0 sec 222 MBytes 931 Mbits/sec
[SUM] 0.0- 2.0 sec 867 MBytes 3.64 Gbits/sec
[ 6] 2.0- 4.0 sec 469 MBytes 1.97 Gbits/sec
[ 7] 2.0- 4.0 sec 285 MBytes 1.19 Gbits/sec
[ 5] 2.0- 4.0 sec 60.8 MBytes 255 Mbits/sec
[SUM] 2.0- 4.0 sec 815 MBytes 3.42 Gbits/sec
[ 7] 4.0- 6.0 sec 286 MBytes 1.20 Gbits/sec
[ 6] 4.0- 6.0 sec 455 MBytes 1.91 Gbits/sec
[ 5] 4.0- 6.0 sec 87.0 MBytes 365 Mbits/sec
[SUM] 4.0- 6.0 sec 828 MBytes 3.47 Gbits/sec
[ 7] 6.0- 8.0 sec 415 MBytes 1.74 Gbits/sec
[ 6] 6.0- 8.0 sec 202 MBytes 846 Mbits/sec
[ 5] 6.0- 8.0 sec 292 MBytes 1.22 Gbits/sec
[SUM] 6.0- 8.0 sec 909 MBytes 3.81 Gbits/sec
[ 7] 0.0-10.0 sec 1.55 GBytes 1.33 Gbits/sec
[ 6] 0.0-10.0 sec 1.78 GBytes 1.53 Gbits/sec
[ 5] 8.0-10.0 sec 254 MBytes 1.07 Gbits/sec
[ 5] 0.0-10.0 sec 915 MBytes 765 Mbits/sec
[SUM] 0.0-10.0 sec 4.22 GBytes 3.62 Gbits/sec <-----
And the sum is here even larger as in the overflow example above:
1.22 + 1.26 + 1.65 = 4.13 GBytes
Would it be possible to add also in the configure script a check to use
"unsigned long long", when available?
Kind regards,
Hans