1
1

476 Коммитов

Автор SHA1 Сообщение Дата
a1346054
e919e8c21b trim excess whitespace 2021-09-03 14:11:16 +00:00
a1346054
50d6cce65c fix spelling 2021-09-03 14:11:16 +00:00
Bruce A. Mah
1b577aea91
Minor editorial changes to comments from PR #1174.
No functional changes.
2021-07-16 14:30:43 -07:00
DJ Breuer (dbreue200)
0d078c4a1d Added {end}{sum_sent} and {end}{sum_received} to UDP JSON output 2021-07-16 14:22:18 -07:00
Hamid Anvari
ba0dad3160 handling possible stat() error 2021-07-07 15:59:03 -07:00
Hamid Anvari
e65803672d Auto adjustment of test-end condition for file-transfer
In file transfer mode (-F), if no test-end condition is set,
(bytes, blocks, duration), it will automatically adjsut it to
file size (in bytes).
2021-07-07 15:59:03 -07:00
Bruce A. Mah
b043b4e245
fix: Consistently print target_bandwidth in the JSON start section. (#1177)
Previously we only did this for TCP tests with non-default -b.

Follow-on commit to #1168 and #776.
2021-06-30 09:02:34 -07:00
TheRealDJ
584a8d5492
Test bitrate (--bitrate) added to JSON output in {test}{test_start} (#1168)
Fixes #1167.
2021-06-30 08:45:06 -07:00
Bruce A. Mah
36a094d403
Remove fsync(2) call after every write to a receiving --file. (#1176)
This removes a performance pessimization that wasn't really
needed in the first place.

Fixes #1159.
2021-06-29 17:27:05 -07:00
Shuo Chen
47985d7fc4 Add tcp_info.snd_wnd to JSON output.
tcp_info.snd_wnd is available on FreeBSD and NetBSD since TCP_INFO was
added.  It was added to Linux 5.4 in late 2019 and becomes available
in Ubuntu 20.04 and Debian 11.

Tested on:
* Debian 11 running on x86-64 with this field.
* Debian 10 armv7 running on Raspberry Pi 2 without this field.
* NetBSD 9.2 armv7 running on Raspberry Pi 3 with this field.
* FreeBSD 13 aarch64 running on Raspberry Pi 4 with this field.
2021-05-21 15:16:08 -07:00
Bruce A. Mah
787919c4b3
fix: Handle a corner case more gracefully.
If the buffer happens to be holding exactly a sending chunk size,
we no longer arbitrarily quit.

While here, use equivalent, easier-to-read tests in a couple places.

Discussed with @hanvari

Follow-up to #1115.
2021-04-16 14:59:31 -07:00
Hamid Anvari
f4a114652f diskfile_send() sent data capped at file-size
Issue: `diskfile_send()` unconditional call to `sp->snd2`
would result in sending full buffer size everytime,
regardless of the file size.

Fix: The function updated to check for end-of-file (reading 0 bytes)
and,
1. set `sp->pending_size` to appropriate data length available to be sent
2. check for end condition and avoid sending data more than file size.

Note: The fix is only for the maximum cap on the data size sent on the network.
If other parameters (-t, -n, etc.) yield smaller size or shorter time then needed,
the file will still be partially sent to the network.
2021-04-16 14:55:02 -07:00
Bruce A. Mah
466f4c187f
Make sure we don't pass in a negative buffer size.
In theory this check should always succeed, given the relative
buffer sizes as currently coded.

Suggested by @grigorescu
Related to #1134.

(cherry picked from commit c3578291ca4bf5216ec979908b226320be3bdb1d)
Signed-off-by: Bruce A. Mah <bmah@es.net>
2021-04-14 10:21:38 -07:00
Bruce A. Mah
6b266c79e6
enh: Move iperf_printf's buffer off the stack.
(cherry picked from commit 528cea5d540d088aedb8a58f09edeba57f2d471a)
Signed-off-by: Bruce A. Mah <bmah@es.net>
2021-04-14 10:21:24 -07:00
Bruce A. Mah
9e2006e2f0
fix: Do a better job of counting bytes in iperf_printf.
Related to #1134.

(cherry picked from commit f9bc60895765473709757ff382ec1f4253a5b714)
Signed-off-by: Bruce A. Mah <bmah@es.net>
2021-04-14 10:21:04 -07:00
Bruce A. Mah
35a3ed3fb0
fix: Fix a couple of buffer overrun hazards.
Pointed out by @berkakinci.

Fixes #1134.

(cherry picked from commit 9e244bb97fbbe084549204ac2b0fa1e69af3e485)
Signed-off-by: Bruce A. Mah <bmah@es.net>
2021-04-14 10:20:27 -07:00
Bruce A. Mah
ac5fad17a9
Revert "fix: Fix a couple of buffer overrun hazards." 2021-04-14 10:16:34 -07:00
Bruce A. Mah
c3578291ca
Make sure we don't pass in a negative buffer size.
In theory this check should always succeed, given the relative
buffer sizes as currently coded.
2021-04-12 13:12:11 -07:00
Bruce A. Mah
528cea5d54
enh: Move iperf_printf's buffer off the stack. 2021-04-12 11:38:24 -07:00
Bruce A. Mah
f9bc608957
fix: Do a better job of counting bytes in iperf_printf. 2021-04-12 11:34:57 -07:00
Bruce A. Mah
9e244bb97f
fix: Fix a couple of buffer overrun hazards.
Pointed out by @berkakinci.

Fixes #1134.
2021-04-09 16:56:36 -07:00
David Bar-On
44c6fed2b6
Fix issue 1129 for not sending stat to to undefined socket (#1132)
This fix avoids trying to do operations on a socket that was never opened successfully.
2021-04-09 12:33:06 -07:00
David Bar-On
8ffe72e24c
enh: Add --rcv-timeout option (#1125)
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.
2021-02-26 12:39:06 -08:00
David Bar-On
49a5771af1
IP don't fragment support (#1119)
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>
2021-02-16 14:28:54 -08:00
Bruce A. Mah
25f50c23a7
Issue 1118 (#1121)
* 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.
2021-02-08 14:54:11 -08:00
Hamid Anvari
de33801499
Fix iperf_send() termination test in bytes/blocks mode (#1113)
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.
2021-02-05 15:59:35 -08:00
Hamid Anvari
4e526a1a0b
API interface for setting/getting congestion control (#1036) (#1112)
Same restrictions/compatibility applies as
the CLI -C/--congestion options.
(Linux and FreeBSD only)

Fixes #1036
2021-02-04 15:16:38 -08:00
Bruce A. Mah
8f1efb68dc
fix: Don't write trailing NUL to pidfile.
Fixes #1120.
2021-02-04 08:47:13 -08:00
Wojciech Jowsa
fab96c1d96
Enable writing to pidfile in client mode (#1110) 2021-02-04 08:30:47 -08:00
David Bar-On
be66b57544
Server select timeout to prevent server to get stuck because of client or network errors (#1101) 2021-02-01 16:26:42 -08:00
Bruce A. Mah
21581a7216
enh: Support SO_BINDTODEVICE (#1097)
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>
2020-12-22 15:52:24 -08:00
Tony Weng
d1260e6f94
fix (tcp): Fix behavior with partial sends when using -k with TCP (#1082)
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.
2020-12-21 10:29:36 -08:00
Bruce A. Mah
d2a68e0896
Issue 1079 (#1091)
* docs: Add a few notes about RSA key formats used for auth.

* enh(auth): If we can't read key files, emit appropriate OpenSSL error.

Fixes #1079.
2020-12-07 14:10:56 -08:00
David Bar-On
91c33dcfd0
Bitrate throttling when burst is specified (#1090)
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.)
2020-12-04 08:26:53 -08:00
Bruce A. Mah
d3049a60fe
fix: Hide auth diagnostics behind --debug to avoid polluting JSON output. (#1087)
Fixes #1086.

While here, fix wording of an error message.
2020-12-01 09:14:36 -08:00
ralcini
bd1437791a
Configurable value for time drift between client/server for authentication request issue1065 (#1070)
* 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>
2020-11-11 17:27:47 -08:00
Bruce A. Mah
98d87bd7e8
fix: Fix regression in #997 where JSON output was free-ed too early. (#1059)
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.
2020-10-01 13:28:12 -07:00
Bruce A. Mah
80b7c7b271
fix: Plug various minor memory leaks (#1033)
* 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.
2020-08-03 17:49:27 -07:00
Bruce A. Mah
1a908ce13e
feat: Add a --timestamps flag to prepend a timestamp per output line. (#1028)
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.
2020-07-23 07:52:46 -07:00
Bruce A. Mah
d5d2e2473f
fix: Correctly emit an error message when unable to get a password. (#1026)
This occurs when iperf3 is being run with authentication and it
tries to get a password interactively, but there's no tty available.

Fixes #1024.
2020-07-10 16:31:41 -07:00
Bruce A. Mah
223da98090
Issue 999 follow up (#1025)
* 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.
2020-07-10 15:29:47 -07:00
David Bar-On
a0c6f0eca9
feat: Issue #937 - Add a server option to limit total allowed throughput (#999) 2020-07-10 08:36:40 -07:00
Yun Jiang
5e7ea0bd1e
fix: Prevent 100% CPU usage when --bidir option is enabled. (#1011) 2020-07-07 08:01:35 -07:00
David Bar-On
3888e044c3
chore: Change applicable function arguments from 'char *' to 'const char *' (#1006)
Fixes #946.  Should not present any functional changes.
2020-06-12 10:03:30 -07:00
Stefano Garzarella
0b0aa349fa
Fix warning: "HAVE_SCTP" redefined (#1010)
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>
2020-06-12 09:28:15 -07:00
Bruce A. Mah
06e3f08d98
fix(auth): Fix a potential buffer overflow in iperf3 client.
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.
2020-05-20 14:34:11 -07:00
Bruce A. Mah
79630e8734
fix: Fix memory management issues around calls to cJSON_Print() (#997)
Related to #883.
2020-05-19 07:44:09 -07:00
Bruce A. Mah
de848cffad
feat(api): Provide API access to --commit-timeout. (#1001)
Fixes #1000.  Part of #595.
2020-05-19 07:37:18 -07:00
Bruce A. Mah
624c01d444
chore: Fix whitespace glitch that caused a compiler warning on Ubuntu 18.04.
Whitespace-only change, no functional difference.
2020-04-14 17:03:04 -07:00
Stefano Garzarella
23cd3ddc86
fix (iperf_api): fix compiler warning while printing an uint64_t (#969)
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>
2020-03-27 15:03:56 -07:00