iperf3 on ARM bug in iperf_parse_arguments

492 views
Skip to first unread message

Prash

unread,
Jul 25, 2012, 6:53:09 PM7/25/12
to iper...@googlegroups.com
Hi,

I cross compiled iperf3 on ARM and after I started the binary I kept getting the usage irrespective of what option I pass. After code walk through and debugging I found a bug in the code. In iperf_api.c file iperf_parse_arguments function, ch variable needs to be int type instead of char type. Problem is getopt_long returns integer value and it is stored in char variable. Because of this while loop did not exit when -1 was returned by getopt_long, instead in the switch default case printed usage and then iperf was just exiting.

Thanks,
Prash

Edvinas Stunžėnas

unread,
Sep 5, 2012, 10:32:53 AM9/5/12
to iper...@googlegroups.com
There is no bug in code, only missing compiler options. On ARM platform char == unsigned char.

Two ways to solve issue:
1. Run configure using CFLAGS="-Wall -fsigned-char"
2. Patch makeifle:

diff -r dafbddb0e039 src/Makefile.in
--- a/src/Makefile.in   Mon Aug 20 14:35:58 2012 -0700
+++ b/src/Makefile.in   Wed Sep 05 17:22:26 2012 +0300
@@ -266,7 +266,7 @@
 
 # Specify the sources and various flags for the iperf binary
 iperf3_SOURCES = main.c
-iperf3_CFLAGS = -g -Wall
+iperf3_CFLAGS = -g -Wall -fsigned-char
 iperf3_LDADD = libiperf.a
 iperf3_LDFLAGS = 

Cheers
Reply all
Reply to author
Forward
0 new messages