This prevents an "undefined socket" error, which can be incorrect if
the control connection didn't get opened due to a (for example)
"connection refused" type error.
This can be tested by running iperf3 in client mode and pointing it
towards a non-existent (or not-running) server.
Fixes#1129 (#1132 was an earlier, partial fix).
Enhancement to PR #1101 - add --rcv-timeout option to allow setting the timeout for receiving packet from the sender in a running test, instead of the constant 120 seconds set in #1101. This is to allow short timeout, so the server will not be "busy" for long time doing nothing. Also, the resolution is set to ms (with minimum of 100ms), as at least in fast networks that may be required.
Since both the server and the client can be a sender, the option is allowed for both. The server setting is for all tests - the client is not sending its --rcv-timeout setting to the server.
While changing the help message, few printf constants from other help lines were changed to parameters.
Adds an --dont-fragment flag that sets the DF flag in the header for UDP/IPv4 tests.
Co-authored-by: root <root@DESKTOP-L81E90U.localdomain>
Co-authored-by: Bruce A. Mah <bmah@es.net>
* fix: Correctly emit JSON for --server --json.
Put extra error diagnostic information behind --verbose, to avoid putting
extra "error" members in JSON output.
Fixes#1118.
`test->done` represents the test completion.
In some modes, duration-based (-t) test, and file-transfer (-F) in particular,
the `test->done` is set during the timeout handler or file-transfer functions.
For such configurations, and in general, `test->done` being set is sufficient
condition for terminating the test.
This commit generalizes the condition check to `test->done`,
removing the clause which limtis this condition case to duration-based test only.
In iperf_send() function, the check for termination test
in bytes/blocks mode is at the end of the iteration loop
for multisend (outer loop) and streams (inner loop).
If for any iteration of multisend (outer) loop bytes/blocks
sent reaches the desired limit, it still continues to send
data until the loop is exhausted. (The `break;` command does not
help, since it is already inside the streams (inner) loop).
This is a simple fix which brings the condition check to the
beginning of the inner loop, so it will skip the iteration if
the bytes/blocks count is already reached the target; hence
avoiding to send more data to the network.
For every new connection we saved the name of the congestion
control algorithm, but if there were multiple connections we'd
leak all but the last name.
Fixes#1100.
This lets iperf work better with multi-homed machines and
VRF.
Fixes#1089.
Based on a patch by Ben Greear <greearb@candelatech.com> via PR #817.
Co-authored-by: Ben Greear <greearb@candelatech.com>
We now only count an attempted send once all of its bytes are sent
(and will perform partial sends if necessary to finish sending all the bytes).
Previously, partial sends were counted as completed, for the purpose
of the -k option.
When the -b option specifies a burst value, throttling the bitrate does not work. This is because iperf_check_throttle() does not perform the check when burst value was defined.
This change removes the dependency of iperf_check_throttle() on the burst value and moves that check to the caller of that function. (Except for the call by send_timer_proc() which does not seem to be related to the change.)
Making sure the server closes prot_listener socket at the end of a session with a client. Without this change the socket may remain open, for example when there is a failure during the UDP stream establishment because the --window value is too high. Closing the socket was added to cleanup_server() as it seems to handle all cases where the socket may remain open.
* Issue 1065
* feat: Allow to configure a custom value for time drift between client/server for authentication
The use case is to support scenarios where it's not possible to enforce sync between client and server times.
* enh: drift redefined with skew
Co-authored-by: Francesco Marino <francesco.marino@cybaze.it>
The goal is to improve the responsiveness and/or reliability of
messages on the control connection, particularly in cases where the
test traffic fills up the path between client and server.
Originally suggested and implemented by @andrepuschmann, this version
adds some error-checking and a version for the client side as well as
the server.
Fixes#1045.
It didn't make anything crash, but API clients wouldn't be able to
access the JSON output.
Bug pointed out, and fix suggested by, @scottmsilver. Fixes#1058.
On a 32-bit PowerPC Linux system using musl libc (with 64-bit time_t),
the t_auth test fails because `long` is not the same type as `time_t`.
This patch uses an int64_t temporary value, which can be truncated to
32-bit if necessary.
* fix: Make --reverse tests with --blockcount or --bytes actually terminate.
Note that these options still don't really give intuitive results, because
the ending conditions are evaluated on the client, which then needs to
convey to the server via the control channel to stop sending. This
will almost never result in the desired outcome of "a test of exactly
N sends (or bytes) sent from the server to the client".
Also add test cases for --blockcount / --bytes with --reverse.
Towards #982.
* fix: Fix memory leaks related to --logfile.
* fix: Fix memory leaks related to loading RSA keys.
* fix: Fix some memory leaks in failure cases in the iperf3 client.
Fixes#1023.
This flag takes an optional argument, which is a format specification to strftime(3)...this allows for custom timestamp formats. Based on a suggested implementation by @davidBar-On. Towards #909.
* doc: Add manpage text for --server-bitrate-limit.
While here, normalize the manpage text for all command-line options
that take [KMGT] scaling suffixes (there were about three different
strings in use).
* doc: Bump manpage date.
* fix: Fix printf format string warnings on macOS.
* fix: Fix compatibility definition of PRIu64 in iperf_udp.c to match iperf.h.
The netinet/sctp.h header file defines HAVE_SCTP, so we have this
warning while building:
In file included from ../../src/iperf.h:30,
from ../../src/iperf_sctp.c:46:
./iperf_config.h:44: warning: "HAVE_SCTP" redefined
44 | #define HAVE_SCTP 1
|
In file included from ../../src/iperf_sctp.c:43:
/usr/include/netinet/sctp.h:56: note: this is the location of the previous definition
56 | #define HAVE_SCTP
|
This patch replaces our HAVE_SCTP definition with HAVE_SCTP_H to avoid
this warning.
Signed-off-by: Stefano Garzarella <sgarzare@redhat.com>
This condition was only possible when configuration authentication
via the libiperf API.
While here, also fix a few other sundry issues:
* Remove arbitrary length limits on username and password.
* Improved error handling.
* Updated error messages for readability.
* Fixed minor typo in some identifiers.
Fixes#996.
This fixes a problem where UDP tests between systems with significant
clock skew would register large amounts of jitter at the start of the
test.
Fixes#842. Analysis done by (and solution inspired by) @davidBar-On.
This is a modified version of cJSON with support for 64-bit integers. This change pulls in some bug fixes and security fixes. It also fixes some compiler warnings on ILP32, caused by the way that we imported the previous cJSON (fixes inspired by #855).
Fix the following warning:
../../src/iperf_api.c: In function ‘iperf_on_connect’:
../../src/iperf_api.c:791:58: warning: format ‘%llu’ expects argument
of type ‘long long unsigned int’, but argument 3 has type ‘uint64_t’
{aka ‘long unsigned int’} [-Wformat=]
Signed-off-by: Stefano Garzarella <sgarzare@redhat.com>
the similar change also exist in the offical git:
https://github.com/DaveGamble/cJSON
Part of #935.
Change-Id: I3d98de3ec893ccf0b0cab37acc2dbfef00d9e2b6
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
(cherry picked from commit 98c868360c858f4c5fd466bd03fd157ac56b3f06)
Signed-off-by: Bruce A. Mah <bmah@es.net>
Part of #935.
Change-Id: Id702dee9d894d91420719928ae2de6b44b72f579
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
(cherry picked from commit 9dab732f5ec41be873cae3351b3d57fbfad36c93)
Signed-off-by: Bruce A. Mah <bmah@es.net>
by including arpa/inet.h, strings.h and sys/timer.h
Part of #935.
Change-Id: Ibac8d3a992457f2a7cc10f74b144e3ebe69976d8
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
(cherry picked from commit b9aa6cef43b338666a72bf6425fc88ed7602bce5)
Signed-off-by: Bruce A. Mah <bmah@es.net>
since not all platform define these signal number
Part of #935.
Change-Id: I98f14590ad45d1fe7e61076cce5a76b7874772ea
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
(cherry picked from commit d4267b66b5550c0e4cfec60439eab1d57a4a0c7a)
Signed-off-by: Bruce A. Mah <bmah@es.net>
Part of #935.
Change-Id: Ibcc4ad4370a6f99b030ca2c44f151c4550695957
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
(cherry picked from commit 6c10c3e6e65ffca32d97b3f2ef4db839c049a85c)
Signed-off-by: Bruce A. Mah <bmah@es.net>
Part of #935.
Change-Id: I5c563ad0cffce1a75b6a8039aa9a2e1543763880
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
(cherry picked from commit d7e30bea791e7bcd28eebf1ca6fe39e4f00ddc3c)
Signed-off-by: Bruce A. Mah <bmah@es.net>
When burst mode is configured for unlimited rate (-b0) but with a
specific packet burst value (e.g. /1000), iperf only sends packets once,
after that the iperf_check_throttle function gets called and sets
green_light=0 due to the rate value being 0 and average calculated rate
always being higher than 0.
The iperf_check_throttle function is designed to be skipped in case the
target rate is unlimited or if a specific burst value was configured,
however this skip is only utilized in one place where the function is
called leading to the situation above.
This can be fixed by moving the "skip throttling" condition directly
inside the iperf_check_throttle function.
Signed-off-by: Ondrej Lichtner <olichtne@redhat.com>
If --bidir option was passed before --client option on command line,
the latter would override ipt->mode parameter of the test back to SENDER
or RECEIVER making the test hang during execution.
Fix this by checking if ipt->bidirectional was set to true in
iperf_set_test_role() function.
The base64 decode will crash on musl c-library builds for OpenWRT
due to the write of the '\0' past the end of the allocated buffer.
Fix other various memory leaks on the authentication code paths.
Fix some memory-free library calls into OpenSSL.
Based heavily on PR #881 originally submitted by @acmay,
with comments from @ralcini.
The TEST_END message is racing with the server_timer_proc timer.
When the RTT is higher than a second, the timer wins the race
and closes the control socket before the results are exchanged.
This results in the client reporting:
"error - control socket has closed unexpectedly"
as reported in GH issue 751.
This change doesn't prevent the race, but significantly increases the
grace period based on a maximum RTT of 4 seconds and accounts for
the ten transitions in the iperf3 state machine.
(cherry picked from commit 34bdddb75194e880e6dbc6dcaa5b5386975c11b3)
(originally submitted by @acooks in #859)
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.
In bidirectional mode, if option --get-server-output is set and if
both client and server have --json set to true, client would still print
the json output of server to stdout as a separate piece instead of
including it into client's json output.
This patch fixes this problem, the server's json output would be
appended to client's json field 'server_output_json' as it should be.
If client was started with --repeating-payload option, tell the
server to use the repeating_payload also.
Since repeating_payload is a client specific option at the moment and
we don't tell the server if repeating_payload was set not not,
server always uses randomized patterns in reverse and bidirectional
modes disregarding what patterns the client was told to generate.
So, if client was started with both --repeating-payload and --reverse,
the server would still send the randomized data to the client which
doesn't seem right.
This commit fixes this issue.
Signed-off-by: Sergey Nemov <sergey.nemov@intel.com>
The bug reported in #505 seems to not exist at this time, and
the text added in this manpage change caused some other problems,
a la perfsonar/pscheduler#819.
Fixes#860.