jkorell/iperf

Always show the "usage" help regardless of parameters entered (Linux on Power)

Closed this issue · 3 comments

What steps will reproduce the problem?
1.  Compile on Linux on Power platform
2.  Run: iperf3 -s --> This will show the help screen instead of starting the 
server listener


What is the expected output? What do you see instead?
Expected: The iperf3 listener server would start up
What we see now: The usage help screen gets displayed in iperf3 exits.


What version of the product are you using? On what operating system?
iperf-3.0b5


Please provide any additional information below.
This is due to line 431 in iperf_api.c, which defines the 'ch' variable as:

char ch;

In the while loop on line 437, ch is populated with the call to getopt_long, 
then compared to -1.

Irregardless of platform (x86 or POWER), the hex value stored will be 0xff.  

However, on x86, "char" is treated as a *signed* char.  Meanwhile, on POWER, 
"char" is treated as an "unsigned" char by default.

Hence, in order to make that while loop work correctly, you need to use, 
"signed char" explicitly so that it is supported across platforms.

Original issue reported on code.google.com by nstojkov...@gmail.com on 3 Oct 2013 at 2:34

Oh yes - and of course, when on POWER, the char is treated as *unsigned*, 0xff 
would be 255 of course - so comparing 255 with -1 obviously doesn't match.  
Since it doesn't match -1 to terminate the loop, nor does it match any of the 
cases, it falls into the default case printing out the help.

Original comment by nstojkov...@gmail.com on 3 Oct 2013 at 2:37

This is fixed in the current version.

Original comment by jef.posk...@gmail.com on 3 Oct 2013 at 2:57

  • Changed state: Fixed
Fixed in the current version? Does this mean it was fixed in a version that is 
currently available in the Downloads section or in the current development 
version which will be released later?

Original comment by nstojkov...@gmail.com on 9 Oct 2013 at 1:07