aboutsummaryrefslogtreecommitdiff
path: root/src/iperf_client_api.c
AgeCommit message (Collapse)Author
2019-06-05enh: Introduce iperf_set_test_logfile API function (#871)srgnk
To be able to set the test->outfile to a different file other than default if using libiperf API. Since logfile is now opened in iperf_parse_arguments() and this function may not be used if running iperf using API, define a dedicated function iperf_open_logfile() and move the opening of logfile into iperf_run_client() and iperf_run_server() to make sure logfile will be opened if iperf_parse_arguments() was not called.
2018-12-13Bidirect mode implementation (#780)Boris Okunev
Adds the `--bidir` flag to support simultaneous two-way tests. Submitted by @LikHait. Fixes #201.
2018-09-28Merge branch 'iperf_time' of https://github.com/accelleran/iperf into ↵Bruce A. Mah
accelleran-iperf_time
2018-06-08Fix some indentation (#750)Brendan Jackman
There are lots of mixed tabs and spaces, most of them look OK if tabs are 8 characters wide, but this bit seems to have been written by someone whose editor thinks they're 4 characters wide, so it looks all messed up.
2018-05-17Add initial portable time abstractionBen Fox-Moore
2018-01-03Fix regression that caused client to close control connection prematurely. ↵Bruce A. Mah
(#682) The user-visible symptom was messages of the following form on the server: iperf3: the client has unexpectedly closed the connection This bug was introduced in #597 and was present in iperf 3.2 and 3.3. Fixes #677.
2017-11-16Fix some compile-time warnings on macOS (#671)Bruce A. Mah
* Attempt to quiet a warning with print(3) formatting. As a part of this, factor out PRIu64 support / compatibility (added in #664) into a header file and make it more portable by taking into account the size of a long integer. Based on email conversation with: @pprindeville. * Follow-up to pull request #669, fixing compiler warnings on platforms that don't have HAVE_TCP_CONGESTION defined.
2017-11-14Add missing saved_errno dance around some close(2) calls. (#669)Todd C. Miller
2017-10-27Issue #659 (#660)Boris Okunev
Ignore nonsensical TCP MSS when trying to compute the default UDP packet size. This fix seems to be primarily needed for Windows systems, but it's a good bit of sanity checking to do in any case.
2017-09-19Reverse the order of tests for better legibility and logical sense.Bruce A. Mah
Suggested by @pprindeville.
2017-09-18Two fixes for a warning for possibly-too-large UDP packets.Bruce A. Mah
1. Make sure we have a valid TCP MSS on the path when comparing the UDP block size. 2. Fix a redundant "warning". This should fix a bug observed on Windows but not (so far) on any UNIX-like platforms. Fixes #608.
2017-06-12Close ctrl_sck iperf_client_end() (#597)p0intR
This avoids a leak of file descriptors.
2017-05-17Issue 216 (#581)Bruce A. Mah
* Add configurable timeout for the setup of the control connection. This is specified using the new --connect-timeout option, with an integer parameter in ms. The iperf3 client will wait for this amount of time for the setup of the control connection to the server. If this option is not given, the OS default for TCP connection setup is used. Specifying a smaller connection timeout allows faster detection of a down / unresponsive iperf3 server. The implementation uses a variation on the timeout_connect() function from OpenBSD's netcat utility. Fixes #216.
2017-02-02Prevent two recently added messages from spamming JSON output on UDP tests.Bruce A. Mah
Stumbled on by: @daldoyle
2017-01-10Issue 496 (#498)Bruce A. Mah
* Dynamically determine an appropriate default UDP send size. We use the TCP MSS for the control connection as the default UDP sending length, if the --length parameter is not specified for a UDP test. This computation replaces the former hard-coded 8K default, which was way too large for non-jumbo-frame Ethernet networks. The concept for this solution was adapted from nuttcp. The iperf3 implementation is pretty easy since we already were getting the MSS for the control connection anyway (although we needed to get it slightly earlier in the setup process to be useful). Towards issue #496. While here, s/int/socklen_t/ in one place to fix a compile warning, and bump a few copyright dates. * Warn if doing a UDP test and the socket buffer isn't big enough. This is surprisingly an issue on FreeBSD and macOS, where the MTU over the loopback interface is actually larger than the default UDP socket buffer size. In these cases, doing a UDP test over the loopback interface (with the new UDP defaults) will fail unless a smaller --length or a larger --window size is set explicitly. Linux has larger UDP socket buffers by default (much larger than the largest possible MTU), but even in the case that the socket buffers are too small to hold an MTU-sized send, the kernel seems to do the send correctly anyway. Still working towards a good solution for issue #496. * Further refinement on UDP buffer size settings. If the default buffer size on a UDP test can't hold a packet, then increase the buffer size to be large enough to hold one packet payload. (If the buffer size was explicitly set, but too small to hold a packet payload, then warn but don't change the buffer size.) Minor code refactoring to...factor out some common code into a new iperf_udp_buffercheck() function. Still working towards issue #496.
2016-10-17Replace iprintf w/ iperf_printf (cygwin conflict) (#468)Nevo Hed
This does not seek to address all cygwin portability issues just this specific compile-time conflict See also #280 and #295. See https://github.com/esnet/iperf/issues/280
2016-09-22Fix build on FreeBSD.Bruce A. Mah
2016-09-22First try at issue #461.Bruce A. Mah
First, realize that we've been setting the congestion control (CC) algorithm unnecessarily; rather than doing it for all listening or connecting sockets, do it just for those sockets that are being used for TCP test streams. Record the CC algorithm in use (this handles the case where a CC algorithm hasn't been specified), and have the client and server exchange this information. Report the CC algorithms that were used (note that it's theoretically possible for the two ends of the test to be using different algorithms, if no algorithm was explicitly specified and the two end hosts have different defaults, or if one side allows setting the CC algorithm and the other doesn't). Committing to a branch to make it easier to test this code on a wider combination of systems.
2015-03-31257 Segfault in the signal handlerManoj Joseph
2015-01-14Make the combination of -B and -P but not --cport workBruce A. Mah
The case where we should have been binding the client sockets to ephemeral ports at a specific address for parallel tests was broken. Fixes #239 Submitted by: @jfitzgibbon
2014-09-29Update license and copyright text to conform to LBNL standards.Bruce A. Mah
Note that the license remains a 3-clause BSD license; the only license changes were to add the name of the program and to add some punctuation.
2014-09-22Don't pass NULL when we really mean to pass 0.Bruce A. Mah
Fixes a warning on MacOS.
2014-09-15Support --cport and --parallelKevin Constantine
When running multiple parallel streams, the specified port number is incremented for each successive stream. Signed-off-by: Kevin Constantine <kevin.constantine@gmail.com>
2014-09-15Merge branch 'master' of github.com:kevinconstantine/iperf into ↵Bruce A. Mah
kevinconstantine-master
2014-09-15specify client-side port: UDP supportKevin Constantine
--cport can be specified for udp connections Signed-off-by: Kevin Constantine <kevin.constantine@gmail.com>
2014-09-15Rename locale.{c,h} to iperf_locale.{c,h} to avoid filename collisionBruce A. Mah
with system header <locale.h>. This apparently fixes problems on an ARM build, but this was generally broken anyway. It's slightly amazing this didn't cause problems before; perhaps we never used <locale.h> before? Addresses #203.
2014-05-02Fix a comment.Bruce A. Mah
2014-04-25Make sockets for non-UDP tests non-blocking (rather than all senderBruce A. Mah
side sockets). This is reported to fix some oddities after a recent change in this area. Somewhat related to Issue #125. Submitted by: @i2aaron
2014-04-23Only set sockets to non-blocking mode on the sending side of theBruce A. Mah
transfer. Note that the sender can either be the client or the server depending on whether --reverse is used. This fixes some problems with UDP transfers getting severely confused and (wrongly) complaining about packets arriving out of order. Related to issue #125.
2014-04-16Commit a version of the patch for #125 for testing.Bruce A. Mah
Originally submitted by: @i2aaron
2014-03-14Fix a call to iprintf(), also fix sequencing of some output flushes.Bruce A. Mah
Related to Issue #119.
2014-03-14Support --logfile argument to make all output go to a file.Bruce A. Mah
This works for both client and server side (in the case of the server, either for daemon or non-daemon mode). Consistifies a few places that were using printf instead of iprintf. Fixes Issue 119.
2014-01-30Replace system("uname -a") with call to uname(3).Bruce A. Mah
Slightly reworked version of a patch that was... Submitted by: Susant Sahani <ssahani@redhat.com>
2014-01-13Add FreeBSD support for -A (set CPU affinity).Bruce A. Mah
Mostly this change consists of adding FreeBSD-specific code to handle this feature. The concepts and system calls are very similar to what's already done for Linux. One difference is that on FreeBSD, the CPU affinity mask is saved before -A processing and restored afterwards. This causes a slight change to the function signatures for iperf_setaffinity() and iperf_clearaffinity() (these functions however are not documented as a part of the libiperf3 API). Slightly improve some of the documentation for the -A command line option, to hopefully stave off some of the questions about this feature. Mostly based on a submitted patch. Issue: 128 (better error message for CPU affinity failure) Submitted by: Susant Sahani <ssahani@redhat.com>
2014-01-07Second try at printing statistics when processes are interrupted.Bruce A. Mah
When the client process gets interrupted, both the client and server dump out accumulated interval statistics, as well as a partial set of summary statistics (basically each side dumps what it has, but without the exchange of information that usually happens at the end of a normal run). If the server process gets interrupted, the server dumps out its accumulated interval and summary statistics as above. The client does this as well in the -R case, but exits with a "Broken pipe" in the non -R case (this behavior was present all along; it was not introduced in this change). More investigation will be needed to understand the client behavior. Bump copyright dates in a few places. Issue: 132 (signal handler for API calls) Discussed with: aaron@internet2.edu
2014-01-03Fix a deadlock leading to a hang in -R mode.Bruce A. Mah
In -R mode, the test consists of the server sending to the client until the client tells it to stop by setting the test state to TEST_END via the control socket. However once the client changes the test state, it stopped reading the incoming test data from the server. In many (but not all) scenarios this could result in the server filling up its send window (thus blocking on writes) before the TEST_END message arrived from the client. At this point the server was hanging waiting for the client to drain its data connection(s), and the client was waiting for the server to send a state change message for EXCHANGE_RESULTS. Bump copyright date while here. This fix handles at least part of... Issue: 129 (iperf3 hangs with -R and -Z flags)
2013-12-19Added -k / --blockcount.Jef Poskanzer
2013-12-04Show UDP stats in interval reports.Jef Poskanzer
To the extent possible, anyway - on the sender side, only the packet counts are available. Also a few minor bug fixes.
2013-11-29Use setitimer() instead of alarm().Jef Poskanzer
This lets us check timers every tenth second instead of every second, so we can switch out of the more expensive select() mode even with the default reporting interval of a second.
2013-11-26Show user/system CPU usage as well as total.Jef Poskanzer
2013-11-25Performance improvement - only put socket fd's into the appropriateJef Poskanzer
fdset, not into both sets.
2013-11-15Performance improvements.Jef Poskanzer
2013-11-11Moved a bunch more output strings to locale.[hc].Jef Poskanzer
2013-11-08Get rid of some compiler warnings about iprintf.Jef Poskanzer
2013-11-08Added the -T / --title flag.Jef Poskanzer
2013-11-08The ctrl_sck does not need to be in the select write_set, and indeedJef Poskanzer
having it there may cause the select to return immediately every time. Which is bad, m'kay? Also, changed the coding idiom used to keep track of the maximum fd in the fd sets, to be clearer.
2013-11-07Added a cast to avoid a compiler warning.Jef Poskanzer
2013-11-07Another potentially protocol-breaking but necessary change.Jef Poskanzer
The error numbers sent for SERVER_ERROR state were declared as ints, and therefore could be 32 or 64 bits depending on architecture. I changed them to be explicitly 32 bits. This should be the last of these, I've checked out at every network read/write call and they look ok. And bumped the version to 3.0-RC5.
2013-11-01Run -i interval timers on the server as well as the client.Jef Poskanzer
2013-10-29Move termination signal handing from main into iperf_run_clientJef Poskanzer
and iperf_run_server, so that API users get it too. Also, call iperf_errexit with an appropriate message, which in -J mode dumps out any accumulated JSON data.