1
1
Граф коммитов

887 Коммитов

Автор SHA1 Сообщение Дата
Bruce A. Mah
d4dfec7874
Regen. 2018-06-29 16:25:06 -07:00
Hk
e6689a8cbb Provide a configure feature flag (--disable-profiling) to disable creation of iperf3_profile binary (#763)
Fixes #749.
2018-06-29 16:23:41 -07:00
Sam Hooke
02e16f67fb Towards issue 595 (#762)
* Add pacing timer, bytes and blocks functions to libiperf.

* Explicitly cast to uint64_t to match return type.
2018-06-28 13:30:41 -07:00
Bruce A. Mah
6e9d8525a5
Regen. 2018-06-22 14:10:41 -07:00
Bruce A. Mah
964f106a98
Change applicable http:// URLs to https://. Fix a bad URL in RPM spec. (#759) 2018-06-22 14:09:01 -07:00
Bruce A. Mah
1254e135fd
Warn if doing JSON output and either -d or -v are specified.
Debugging and/or verbose output can get in the way of producing
valid/parsable JSON.

Inspired by #737.
2018-06-08 11:55:33 -07:00
Brendan Jackman
d8f2276d70 Fix some indentation (#750)
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-06-08 11:44:09 -07:00
Bruce A. Mah
7f883016bb
Add a forgotten cast to fix a glitch in JSON output on CentOS 6. (#744)
Fixes #727.
2018-05-30 11:32:38 -07:00
Ben Fox-Moore
cde81d7640 Add initial portable time abstraction 2018-05-17 14:09:52 +02:00
Bruce A. Mah
829d619ab4
First try at implementing --extra-data. (#729)
Towards #600.
2018-05-09 17:42:17 -07:00
edupont
48a65ff76e Adding missing word (#736) 2018-05-09 17:41:58 -07:00
Bruce A. Mah
e4cd80fa80
Update manpage date. 2018-04-27 13:50:20 -07:00
Bruce A. Mah
9787028de9
Document new authentication functions in libiperf.
Follow-up commit to #712 / #713.
2018-04-27 13:48:29 -07:00
ralcini
e28f12c788 Add authentication functions to libiperf (#713)
Fixes #712.  A subsequent commit will add some information to the libiperf manual page.
2018-04-27 13:39:28 -07:00
Phil Levchenko
cbea72b6ee Add --repeating-payload option to the client side (#726)
This option simulates payload in iperf2, which is just repetitive pattern
(ASCII '0..9' repeating), as opposed to iperf3 where payload is random.
It might help in testing and reveal problems in networking gear with hardware
compression (including WiFi access points), where iperf2 and iperf3 perform
differently, just based on payload entropy.
2018-04-20 07:25:24 -07:00
Bruce A. Mah
6332d84016
Wordsmith warning message from #721 / #709. 2018-04-20 07:21:23 -07:00
Kai Borowiak
22508a21b0 Add warning if JSON output is used with explicit report format (#721)
Fixes #709.
2018-04-20 07:17:39 -07:00
Ji Jianwen
3e58489a58 Fix -B with some SCTP tests, which is part of #678 (#715)
Got the following error when running server side with -B option:

Server side:
    ./iperf3 -s -B <server_ipv4_address>
    -----------------------------------------------------------
    Server listening on 5201
    -----------------------------------------------------------
    iperf3: error - unable to start stream listener: Bad file descriptor
    -----------------------------------------------------------

Client side:
    ./iperf3 -c <server_ipv4_address> --sctp
    iperf3: error - unable to start stream listener: No such file or directory

Similar fix as below for TCP:
    commit eb1cfe5e16
    Author: Bruce A. Mah <bmah@es.net>
    Date:   Fri Aug 1 16:24:14 2014 -0700

        Another iteration on issue #193, fixes -B with some TCP tests.

Signed-off-by: Jianwen Ji <jijianwen@gmail.com>
2018-03-23 16:10:38 -07:00
Kai Borowiak
c0a441756a Add ToS Byte to iperf API (#719)
* Add ToS byte to iperf API

* Add function prototype to manual page
2018-03-23 06:28:20 -07:00
Jenkins BBVA
4fe72e1979 Add Solaris 10 portable_endian.h (#711)
Add htonll/ntohll if not defined
2018-03-09 10:28:48 -08:00
Bruce A. Mah
ff1ea4e54d
Regen. 2018-02-28 13:24:06 -08:00
Bruce A. Mah
6731b2152a
Version number bumps for iperf-3.5. Also fix a typo in release notes.
Towards #707.
2018-02-28 13:21:59 -08:00
Bruce A. Mah
c0055199b5
Fix issue 692 (#705)
Don't count data for tests received after the end of a test.
This prevents is from reporting an incorrect number of bytes
received at the end of the test, which doesn't match up with the
sum of the data received during the test intervals.
Log late receives if debugging mode enabled.

Fixes #692.
2018-02-23 15:36:25 -08:00
Bruce A. Mah
8740c8cf8e
Close credentials file when we're done reading it. (#704)
Fixes #701.
2018-02-22 17:25:25 -08:00
Bruce A. Mah
4a46483341
Merge branch 'master' of github.com:/esnet/iperf 2018-02-22 12:09:51 -08:00
Bruce A. Mah
63ae66353a
Comment on a few unused states in the state machine. 2018-02-22 12:08:50 -08:00
Jason Leschnik
a6123ce7fb Change the wording on bind parameter documentation for clarity (#702) 2018-02-21 12:23:36 -08:00
Bruce A. Mah
e147de5387
Version number bumps for iperf-3.4. 2018-02-12 14:08:45 -08:00
Bruce A. Mah
e7aa59b6b8
Make --cport work without --bind (#697).
This commit also adds SCTP support for --cport.

Fixes #616.
2018-02-12 10:30:23 -08:00
Bruce A. Mah
47450ad9e1
Fix a server-side crash with --verbose and a client with multiple connections. (#696)
This was caused by a stale / invalid pointer reference that didn't even
make any sense in context anyway.  Fixes #686.
2018-01-26 13:35:45 -08:00
Bruce A. Mah
bd85edb80a
If we're sending output to stdout, then make errors go to stderr. (#695)
No effect on JSON format output or output to a file.

Submitted by @cygnus2048, fixes #688.
2018-01-26 11:38:15 -08:00
Bruce A. Mah
cf325910bd
Make IPv6 flow labels work correctly where they didn't before. (#694)
This can happen with multiple parallel streams or with two single
stream tests run close together in time.

The fix is to allow flow labels to be reused by multiple sockets
simultaneously or within their timeout.

Submitted by @cygnus2048 and fixes #689.
2018-01-26 11:29:33 -08:00
Bruce A. Mah
b481169a5f
Fix large values of -p on FreeBSD by setting a large listen(2) backlog. (#693)
Might be useful for other platforms as well (no effects on Linux
because the semantics of listen(2) are subtly different there).
Submitted by Matt Macy.  Fixes #691.
2018-01-26 11:19:21 -08:00
Bruce A. Mah
46cb4b4b90
Fix regression that caused client to close control connection prematurely. (#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.
2018-01-03 12:03:48 -08:00
Suresh Sundriyal
a5e327b442 Include signal.h + time.h. (#680)
Required to avoid implicit declarations of 'signal()' and 'time()'; which
causes compilation to error out while compiling a statically linked binary.
2018-01-03 12:00:27 -08:00
Bruce A. Mah
1e93fdcf88
Fix comparison when checking for time skew when using authentication. (#674)
Fixes #673.

Submitted by @FuzzyStatic, reviewed by @ralcini.
2018-01-02 14:55:01 -08:00
Bruce A. Mah
eddfb8267e
Fix a couple of problems with the help message for the --length option.
* The canonical long-form option name is "length", not "len".

* The default length for UDP should be displayed in bytes not KB.
2017-11-27 09:50:50 -08:00
Bruce A. Mah
c0225583af
Fix a compiler warning on FreeBSD related to getline(3). 2017-11-16 14:22:55 -08:00
Bruce A. Mah
19329249d1
Fix some compile-time warnings on macOS (#671)
* 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-16 14:12:24 -08:00
Tobias Klausmann
f61355e3e1 Make help and manpage a bit clearer about TOS and DSCP values (#670)
Since iperf3 uses strtol() to parse these values, the user can specify
them with 0 prefix for octals and 0x for hex values.
2017-11-16 09:18:40 -08:00
Todd C. Miller
b6072241bf Add missing saved_errno dance around some close(2) calls. (#669) 2017-11-14 14:29:41 -08:00
Todd C. Miller
34f878a2c0 Remove unused functions (#668)
Namely, getsock_tcp_mss(), set_tcp_options() and iperf_test_reset().
Also fix a typo in the libiperf manual;
iperf_test_reset() was listed instead of iperf_reset_test().
2017-11-14 13:35:29 -08:00
Bruce A. Mah
222da46ba9
Follow-on to pull-request #665...update manpage and comments.
These reflect support for -A on Windows.
2017-11-13 13:00:10 -08:00
Boris Okunev
5b27ea39a7 Implemented -A flag for Windows (#665)
TODO:  Need to update some documentation that reflects `-A` is applicable to Windows.  @bmah888 to do this.
2017-11-13 12:54:34 -08:00
Todd C. Miller
480824e3c1 Remove a few unnecessary headers and unused functions. (#667)
* EXIT_SUCCESS and EXIT_FAILURE are defined in stdlib.h, not sysexits.h
so no need to include the latter.

* No need to include pthread.h.

* Remove the no longer used delay() function.
This also removes the reliance on nanosleep().

* Remove get_tcp_windowsize() and set_tcp_windowsize() which are unused.
These days, iperf uses get/setsockopt() with SO_SNDBUF SO_RCVBUF directly.
2017-11-11 10:26:59 -08:00
Bruce A. Mah
73b02f9819
Implement daemon(3) for systems that don't have it.
Fixes (and based on a patch in) #369, with some reworking by @bmah888 and @pprindeville.
2017-11-11 10:12:55 -08:00
Bruce A. Mah
95d408962a
Add function declaration for our getline() compat implementation.
Should have been a part of #663, which fixes #607.
2017-11-10 12:04:35 -08:00
Bruce A. Mah
d06415822a
Regen after merge of #663. 2017-11-08 10:19:49 -08:00
Bruce A. Mah
cb2dcd3f6d
Provide a getline(3) implementation for systems without it. (#663)
The getline(3) implementation comes from NetBSD's file(1) command.
This should make compiling work on macOS pre 10.7.  Fixes #607.
2017-11-08 10:18:30 -08:00
Philip Prindeville
d88f4cecf3 Fix 3.3 build warnings (#664)
* Fix warnings about _GNU_SOURCE being redefined.

Signed-off-by: Philip Prindeville <philipp@redfish-solutions.com>

* Fix warnings of format-specified mismatching type

Signed-off-by: Philip Prindeville <philipp@redfish-solutions.com>

* Simplify endianness checks

Linux can be built with too many types of C run-time library and it's
not reasonable to have to enumerate all of them, especially since at
least one of them (MUSL) goes out of its way to not be easily
detectable.

Instead, leverage autoconf better for Linux/BSD to detect either
<endian.h> or <sys/endian.h> directly.

Signed-off-by: Philip Prindeville <philipp@redfish-solutions.com>

* Sys headers should not be included directly

There's usually a top-level header which then includes the sys/
descendent.

Signed-off-by: Philip Prindeville <philipp@redfish-solutions.com>
2017-11-08 09:29:26 -08:00
Boris Okunev
d60f6234d5 Issue #659 (#660)
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-10-27 14:38:08 -07:00
Bruce A. Mah
010fc7e6c8 Don't overwrite a PID file corresponding to a valid process. (#654)
This fixes a problem described in issue #623 where the PID file
opened by a running instance of iperf3 could be overwritten /
deleted by a subsequent invocation of iperf3.
2017-10-25 10:04:26 -07:00
Bruce A. Mah
24da2caa09 Fix memory leak introduced in 1460aa3433. (#652)
Pointed out by:  @pprindeville
Should have been found by:  @bmah888
2017-10-13 11:01:06 -07:00
ralcini
1460aa3433 fix for https://github.com/esnet/iperf/issues/650 (#651)
Reset authentication token between tests.  Fixes #650.
2017-10-11 14:03:57 -07:00
Bruce A. Mah
b5640ac6c2 Clear TOS value when resetting test parameters. (#647)
This addresses a problem where the --tos parameter would incorrectly
"stick" on the server, causing wrong TOS values to be inserted into
packets during --reverse tests.  Fixes #639.
2017-10-11 12:10:11 -07:00
Bruce A. Mah
720a0a3e63 Allow the client to pass a duration of 0 to the server. (#648)
Seems to fix #645.
2017-10-11 11:05:55 -07:00
Bruce A. Mah
25f5947512 Fix a problem formatting very large numbers. (#642)
Avoid walking off the end of an array when trying to format a number larger than 1000T.

Motivated by #641, as reported by @shingchuang, but slightly
reimplemented.
2017-10-04 10:15:19 -07:00
Malte
b2900fd710 Delete outdated comment
This comment became outdated with cba8584b2
2017-10-04 02:09:30 +02:00
Bruce A. Mah
ca954c7668
Reverse the order of tests for better legibility and logical sense.
Suggested by @pprindeville.
2017-09-19 09:14:24 -07:00
Bruce A. Mah
d6a6751746
Two fixes for a warning for possibly-too-large UDP packets.
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-09-18 15:17:18 -07:00
Bruce A. Mah
7cf95d205d
Regen. 2017-08-14 13:46:35 -07:00
Philip Prindeville
517ad2248f Add required RSA header for OpenSSL (#622)
Signed-off-by: Philip Prindeville <philipp@redfish-solutions.com>
2017-08-01 11:16:07 -07:00
Bruce A. Mah
dadbd25838
Fix spelling mistake in manpage.
Fixes #610, pointed out by @borenius-dfn-de.
2017-07-17 08:22:45 -07:00
Bruce A. Mah
4f3a7a5403
Greatly expand description section.
Based on text by @eriitguy, fixes #480.
2017-06-20 15:04:30 -07:00
p0intR
946a5a0f15 Close ctrl_sck iperf_client_end() (#597)
This avoids a leak of file descriptors.
2017-06-12 09:42:21 -07:00
Bruce A. Mah
b0aff8490a Fix a few printf format string warnings seen on macOS / clang. (#593) 2017-06-05 10:57:07 -07:00
Bruce A. Mah
b5597278b5 Towards issue #278. Don't print small, dataless last intervals. (#592)
This is mostly a cosmetic fix...due to timing differences or
interference from data packets, it is possible that the server
will have a very small last measurement window, possibly with
no data transferred.  This looks odd (although it's not incorrect)
and we'd like to eliminate these.  If there's an interval
(presumably it'd be the last measurement interval) less than
10% of the length of a standard measurement/reporting interval,
and there are no bytes transferred in the interval, then suppress
printing the results and don't add them to the grand total.
2017-06-05 10:38:36 -07:00
Bruce A. Mah
7f06146221 Fix out-of-order / loss counting issues with UDP (#457) (#589)
* Towards issue #457.  Try to not count the sequence number
gaps resulting from out-of-order packets as actual losses.

* Put all of the UDP diagnostic output behind the --debug flag.
2017-06-02 09:35:19 -07:00
Bruce A. Mah
c458a115b7 Fix -F problems (#588)
Attempt to fix some brokenness in -F from #301.

In some work related to #125, we introduced a bug in which
chunks of a file being read for the -F option were not
completely sent, particularly with TCP sockets.  We attempt
to fix this by detecting cases in which not all data passed
to a socket could be actually sent (for example due to full
socket buffers) and preserving that data for future send
iterations.

The ending statistics in the "diskfile" JSON structure were
wrong, and did not properly distinguish between sender-side
and receiver-side statistics.  This has been fixed (at least
for the client side).

Specifically mention in the manpage that "iperf -F" is not
a file transfer tool.
2017-05-30 14:15:28 -07:00
Kenneth Wong
acb4c4c9d5 Improve C++ compatibilty (#587)
Improve the compatibility of iperf_api.h with C++ so that libiperf can more easily be used with C++ programs.

This involves function declarations as extern "C" and inclusion of a couple of more headers (which arguably improves the C use case).
2017-05-30 13:30:08 -07:00
Bruce A. Mah
39de1e0f27
Merge branch 'master' of github.com:esnet/iperf 2017-05-24 11:08:37 -07:00
Bruce A. Mah
3410d58fdc
Silence a warning for an unused variable. 2017-05-24 11:08:15 -07:00
Bruce A. Mah
0f081b7b2e Issue 583 (#586)
* s/bandwidth/bitrate/ in user-facing places.  Towards #583.

iperf3 has long misused terminology; bandwidth is a measure of
capacity.  iperf3 measures bitrate or throughput.  We standardize
on "bitrate" because it begins with the same letter as "bandwidth"
(to match the -b command-line option).

User-facing output mentioning "bandwidth" now uses "bitrate".
The long command-line option for -b (--bandwidth) is now --bitrate
(--bandwidth is transparently accepted for backward compatibility).
A few places in documentation that talk about bandwidth as a
measured value have been reworded to use bitrate or throughput.

There are a number of places in code where variables are still
called "bandwidth".  We leave these alone for now.

A mention of "bandwidth" in the test parameters JSON also needs
to remain unchanged to avoid breaking compatibility.  However,
the test results JSON never used the term "bandwidth" in
the first place.

* s/bandwidth/throughput in one place in RPM description.  Towards #583.
2017-05-24 10:50:44 -07:00
Bruce A. Mah
7a15a7ae85 Fix another compiler warning. 2017-05-23 13:05:09 -07:00
Bruce A. Mah
dc74346f26
Fix compiler warning with clang. 2017-05-23 12:52:16 -07:00
Sami Farin
e7ab564cb5 Return random ascii-string in make_cookie. (#582)
Having hostname and microsecond timestamp in the cookie is not
necessary.  Also fill test buffer with data from /dev/urandom
instead of using random().
2017-05-21 11:30:18 -07:00
Bruce A. Mah
2541b86174
Bump manpage date. 2017-05-18 16:39:55 -07:00
Brian Tierney
0c4d5992fd clarified a couple options 2017-05-18 11:43:50 -07:00
Bruce A. Mah
9d7d60aca1 Issue 216 (#581)
* 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-05-17 12:50:50 -07:00
Bruce A. Mah
52375c105a Grab TCP PMTU during tests (on Linux only). Towards #569. (#578) 2017-05-12 13:42:50 -07:00
Bruce A. Mah
d54d49c0ac
Don't free memory in uninitialized structures
Also, tighten up the scope/lifetime of some memory structures.

Inspired by #577.
2017-05-12 09:12:48 -07:00
Bruce A. Mah
35ec9e545a Bunch of reporting fixes found while investigating bug #236. (#575)
For the case of multiple TCP streams, compute the grand total
summaries using the appropriate times for the sender and receiver
ends.

Add some divide-by-zero checks.

On the server side, only print the side of the grand total lines
where we have data.  (This follows the behavior of the other
end-of-test output lines.)

Fix a minor (compared to all the other problems) bug with
UDP output printing the wrong ending timestamp.
2017-05-11 14:12:16 -07:00
Bruce A. Mah
8f0d9c47ec
Print the cJSON version in our version info. 2017-05-11 12:31:22 -07:00
Bruce A. Mah
c71712875a Fix NaN in summaries with a client talking to an iperf 3.1/3.0 server.
Recent code changes require the server to send the start and end
timestamps for a test, so that the client can accurately compute
statistics for the sender side of a test.  iperf 3.1 and 3.0
servers won't do this, so if this information isn't passed back
in the results at the end of a test, we fall back to using the
client's timestamps.  The results might not match what's displayed
on the server, but this is basically what iperf 3.1 and earlier
did anyway.

Fixes #574.
2017-05-11 11:40:14 -07:00
Bruce A. Mah
cab5dba86c Import cjson 1.5.2 (#573)
* Import source files for cJSON 1.5.2.

* Portability and 64-bit changes for cJSON.
2017-05-11 10:17:34 -07:00
Bruce A. Mah
e255a12eb9 Fix problems in human-readable UDP output
Keep track of UDP packets sent/received and use appropriately.

We were using the number of UDP packets seen on the server
(regardless of whether it was the sender or receiver) for
computing loss percentages, etc.  This caused confusion in the
case that the last UDP packet doesn't make it to the server
before the test finishes (or if a packet gets lost), because
the client and server had different ideas of how many packets were
sent (OK) and we used the wrong number when computing statistics.

This fix changes the human-readable output to make more sense.
It doesn't change the JSON output.  That needs some more review.
I'm reluctant to make structural changes to the JSON output,
because other programs rely on that format.

We also need to investigate whether the last UDP packet can be
still in flight when the test ends (per hypothesis), and if so
what we should do about this.

We apply similar fixes for human-readable summaries for multi-stream UDP tests.

The fixes are similar to those already done for the stream
summary statistics, but these cover a type of output that's only
done if there is more than one stream.

Adjust the JSON computations / output to do a better job of figuring
out the total number of packets sent.

We really need to disentangle the computation and output formatting,
these two operations shouldn't be mixed together like this.

Fixes #252.
2017-05-09 14:29:22 -07:00
Bruce A. Mah
37d913dfcc Improve error handling and documentation for -f/--format. (#568)
We now reject all invalid format characters given as the
argument to the -f/--format flag.  All valid characters are now
documented in the usage message and manual page.

Towards #566.
2017-05-08 10:01:15 -07:00
Bruce A. Mah
67653543ad
Improve / fix comments regarding UDP jitter calculation.
Internal documentation fix only, no functional change.
2017-05-05 08:59:13 -07:00
Bruce A. Mah
103d4318e8 Fix a heap corruption issue leading to a server-side crash. (#564)
Commit 5ab2132c (PR #551) fixed, among other things, a memory
leak.  The solution, however, causes a hazard where a free() of
an invalid pointer can corrupt the heap.  We've observed this
fairly repeatably while running the test_commands.sh script on
CentOS 7.

To remedy this, we NULL out a pointer after the object it
pointed to has been free-d, just like a number of other similar
objects.
2017-05-04 14:16:42 -07:00
Bruce A. Mah
5abc5f29b7
IRIX 6.5 compatibility, via a patch from @canavan in #368.
Not independently tested.
2017-05-04 09:03:43 -07:00
Bruce A. Mah
cba8584b2d Pacing timer (#563)
* Add --pacing-timer option to allow tuning of -b timers.
These control the granularity of the timer and hence burstiness
of iperf3's sends.  The default is 1ms (1000), which is the default
starting with iperf 3.2.  Follow-on to the commit in #460.

* Update manpage and release notes for --pacing-timer.
2017-05-03 16:18:32 -07:00
Bruce A. Mah
e73821cd03 Normalize socket buffer debugging output, put socket buffer sizes in JSON.
These values show up in the start structure as sock_bufsize (requested
size), sndbuf_actual (actual SO_SNDBUF value) and rcvbuf_actual (actual
SO_RCVBUF value).  These values are available for both TCP and UDP.
Both client and server emit these values in their JSON output for their
respective sides, but don't exchange them.

Towards #558.
2017-05-03 14:03:22 -07:00
Bruce A. Mah
246c1bcacd Remove some dead code. 2017-05-03 12:25:32 -07:00
Bruce A. Mah
10e2cc241e Fix various problems with summary statistics (#562)
* Untangle some problems with printing summary statistics.

There were (at least) two problems:

o The server cannot print summary statistics as seen from the
client, because the server has to generate its summaries
before receiving any statistics from the client.  This
shortcoming is somewhat hard-coded into the semantics of
messages on the control channel, and probably can't be easily
changed.

o UDP summary statistics for each stream were ambiguous in that
it wasn't clear whether they were intended to apply to the
sender or receiver.

To fix this, we split UDP summary statistics into two lines,
one for the sender side and one for the receiver side.  This
hopefully eliminates any ambiguity about the statistics.  On the
server, we don't attempt to print the (not very meaningful and
potentially misleading) statistics corresponding to the client.

Possible fix for #560.

* Try to report more accurate ending statistics.

Basically the client side was using only its measured test duration
to compute figures such as bitrate, but the server's test duration
could be different due to network delays/jitter.  So we make sure
that the test durations (for each stream) are passed in the test
results and used appropriately when we print statistics for the
sender and receiver.

Towards #560, also this could help towards #238.

* Silence a warning over an uninitialized variable.
2017-05-03 10:21:34 -07:00
Bruce A. Mah
c8531ca31f
Fix possible integer overflow in tera prefix conversions.
Follow-on commit for #402, possible fix for #561.
2017-05-02 10:21:59 -07:00
Bruce A. Mah
65ed04deb5
Fix bug introduced in 03224c9 where we fail on default UDP blocksize.
Fixes #559, follow up to #390..
2017-05-01 09:14:21 -07:00
Bruce A. Mah
7f996b5e98 Print TOS byte value.
It's at the start of the test output for human-readable output, and in
the test_start object in the JSON.

Fixes #226.
2017-04-27 12:47:03 -07:00
Bruce A. Mah
9c033cbf68 Do sanity checks on -w argument as floating point to avoid integer
overflows.  There might be some other places where this applies,
but this commit at least fixes the observed bug.  Fixes #557.
2017-04-27 11:35:56 -07:00
Gabriel Ganne
d1c64c8a36 fix invalid sizeof on pointer instead of type (#556)
This is only a coherency fix since sizeof(char*) >> sizeof(char)
There should be no functional nor stability impact whatsoever
2017-04-26 10:08:53 -07:00
Bruce A. Mah
b9478db947
Fix a problem when getting snd_cwnd on FreeBSD.
On FreeBSD, unlike Linux (and NetBSD?) snd_cwnd is expressed in
octets instead of segments.  Hilarity ensued when we erroneously
multiplied by snd_mss and integer overflows occureed.

Possible fix for #465, #475, #338.  Testing from FreeBSD users
appreciated.
2017-04-22 07:56:31 -07:00
Bruce A. Mah
89e97f05e0
Manpage fixups. Follow-up to #517. 2017-04-20 17:48:22 -07:00
Bruce A. Mah
4dfe721b10
Merge branch 'master' of git://github.com/dmdailey/iperf into dmdailey-master 2017-04-20 14:13:33 -07:00
Gabriel Ganne
5ab2132ce3 warning fixes (#551)
* fix Wstrict-prototypes warnings found by clang

also fix usage_long() call

Signed-off-by: Gabriel Ganne <gabriel.ganne@enea.com>

* fix Wunreachable-code-break warnings found by clang

Signed-off-by: Gabriel Ganne <gabriel.ganne@enea.com>

* fix Wshadow warnings found by clang

Signed-off-by: Gabriel Ganne <gabriel.ganne@enea.com>

* fix Wmissing-noreturn warning found by clang

Signed-off-by: Gabriel Ganne <gabriel.ganne@enea.com>

* ix memory leak found by clang

Signed-off-by: Gabriel Ganne <gabriel.ganne@enea.com>

* fix Wmisleading-indentation warnings raised by gcc-6

Signed-off-by: Gabriel Ganne <gabriel.ganne@enea.com>

* fix warning: Value stored to 'ptr' during its initialization is never read found by clang

Signed-off-by: Gabriel Ganne <gabriel.ganne@enea.com>

* fix warning: The left operand of '>' is a garbage value found by clang

Signed-off-by: Gabriel Ganne <gabriel.ganne@enea.com>

* fix memory leak in global cleanup

Signed-off-by: Gabriel Ganne <gabriel.ganne@enea.com>
2017-04-20 13:33:15 -07:00
Bruce A. Mah
5e52a8460b
Regen. 2017-04-20 12:38:18 -07:00
Bruce A. Mah
02d411cb02
Fix some help text. Add authentication as a feature in --version.
Follow-up to #517.
2017-04-20 12:26:39 -07:00
asavah
ac2604dda8 fix missing source files in src/Makefile.am (#554)
Follow-up fix for #517.
2017-04-20 12:09:44 -07:00
ralcini
a51045de19 Service Authentication (#517)
Add an optional mode that requires clients to authenticate with the server.

In this mode, clients need to provide a username and a password, which are checked against a password file on the server.  The authentication credentials are protected by an RSA public keypair...the encrypted credentials are sent along with the test parameters.

Operationally the use of this feature places the following additional requirements on the build and installation of iperf3:

o The presence of the OpenSSL headers and libraries to build iperf3, and the libraries available on the client and server at runtime.

o Generation of an RSA public keypair; the private part is used by the server and the public part must be distributed to the clients.

o Username/password pairs for all authorized users, to be stored in a file on the server.

o Loose time synchronization between the server and clients (to within approximately 30 seconds).

o Appropriate command-line flags given on the client and server.

Note that iperf3 can be built and run as before, without fulfilling any of these requirements.

Partial documentation for this feature is included in this commit.  It is anticipated that additional documentation text and editing will follow this merge.

Submitted by @ralcini.  First suggested by @codyhanson in pull request #242.
2017-04-20 10:01:08 -07:00
Bruce A. Mah
05600c201a
Minor follow-ups to #508.
Change the internal command-line option code for --dscp from the literal
'5' to a constant defined as OPT_DSCP.

Add manpage text for --dscp option.

Tweak help text for --dscp (while here, fix problem in --tos text).
2017-04-14 13:44:32 -07:00
Bruce A. Mah
a68712c7a8
Regen, follow up to #508. 2017-04-14 13:29:25 -07:00
Dave Täht
97c95c3be2 add support for specifying --dscp symbolically and numerically (#508)
Using a command line adding dscp (instead of tos) you can:

--dscp EF,CS1,etc.
--dscp 0x08
--dscp 63

These will provide the correct shifted left 2 tos value for these, and
for people that think in terms of dscp values, this is a goodness.

Having this option available lets an enduser clearly distinguish between
an old version of iperf with a non-working --tos facility, vs a
version where it works, with something saner that lets just specify
the dscp.

I did not come up with a good -? option for it, and used -5 internally.
2017-04-14 13:27:18 -07:00
Bruce A. Mah
e9e2d6d19c
Add support for tera- prefix [Tt] in input and output.
Also add some more unit tests for this and prune unused code
from unit test program.

Fixes #402.
2017-04-14 13:14:44 -07:00
Bruce A. Mah
d51501ef83
Make explicitly requested usage output (--help) go to stdout.
Also in this case make the process exit code 0.

Fixes #405.
2017-04-14 12:45:24 -07:00
Bruce A. Mah
b07ed14dae
Be more explicit about the direction of data during tests.
Documentation change only, no functional change.
Fixes #384.
2017-04-14 12:36:47 -07:00
Bruce A. Mah
08758a16d2 More gracefully handle the case where a congestion control
algorithm isn't available on the server.  This can happen
if the client and server machines have different sets of
congestion control algorithms loaded in kernel modules, etc.
If the requested algorithm isn't available on the server, then
print a warning on the server side, but otherwise continue to
run the test.

Towards #549.
2017-04-11 15:11:17 -07:00
Bruce A. Mah
6f414a0408
Ignore SIGPIPE signals to simplify error handling.
This is an attempt to avoid server-side crashes/exits when the
client abruptly closes its control connection, as found in some
testing for #549.

Fixes #550.
2017-04-11 15:06:01 -07:00
Bruce A. Mah
03224c9f56 Prevent specifying a UDP send size that's too small.
We need at least 16 bytes to hold counters and timestamps.
Avoids a problem noted in issue #390.
2017-04-11 09:43:41 -07:00
Tran Viet Hoang
5d14d10697 add tcp rttvar to stream info (#534)
Fixes #525.
2017-03-30 16:29:16 -07:00
Bruce A. Mah
8066a1d222
Fix divide-by-zero / weird output with -F and a zero-length file.
Fixes #361.
2017-03-30 15:33:20 -07:00
f1rebird
a8ee9c650b Fix header includes and build failures on musl (#518)
* Include stdint.h in files where its types are used

Signed-off-by: Moritz Kick <f1rebird@users.noreply.github.com>

* Fix type of len parameter passed to getsockopt

getsockopt expects socklen_t instead of int as its fifth argument

Signed-off-by: Moritz Kick <f1rebird@users.noreply.github.com>

* Remove unnecassary includes of netinet/tcp.h

also cleanup the second include of stdint.h in main.c

This commit fixes #331 and is a replacement for #344.

Signed-off-by: Moritz Kick <f1rebird@users.noreply.github.com>
2017-03-22 12:00:08 -07:00
Bruce A. Mah
b3828fed23
Change "iperf" to "iperf3" in usage strings. Fixes #529. 2017-03-17 07:59:15 -07:00
ShaunCurrier
9f28b247ba Remove unused hstrerror(), bad nanosleep() message in configure.ac (#503) (#523)
* Remove unused hstrerror(), bad nanosleep() message in configure.ac (#503)

* Remove dead code involving h_errno and hstrerror()

h_errno was formerly set as a side effect of a failed
gethostbyname(3) call, but this function has been
deprecated.
2017-03-13 09:36:45 -07:00
Bruce A. Mah
f46e2e3edc Prevent two recently added messages from spamming JSON output on UDP tests.
Stumbled on by:	@daldoyle
2017-02-02 09:23:29 -08:00
Bruce A. Mah
7c79294b5b
Fix a bug where specifying --title leaked into server JSON in future runs.
Fixes #500, based on pull request in #501 submitted by @slankes.
2017-01-25 14:42:15 -08:00
Bruce A. Mah
de3e9d49b6 Revert "Fail gracefully if --fq-rate or --no-fq-socket-pacing are specified on"
This reverts commit 9c83a707eb.

Fixes #504.
2017-01-25 13:53:49 -08:00
Bruce A. Mah
1ff12f4c3e Add 1KB to default UDP socket buffer sizes under certain circumstances.
This fixes a problem observed on FreeBSD and macOS where the MTU on
the loopback interface is larger than the default socket buffer size.
We adjusted the socket buffer size upwards to match the UDP payload
size, but that's apparently not enough and we ended up dropping packets.
This is bad.  Add a 1KB fudge factor, which seesm to avoid this problem.
Affects UDP tests only, not TCP or SCTP.

Part of #496.

(cherry picked from commit d76198944d210e8a575747d3ddbee41a886a10c9)
Signed-off-by: Bruce A. Mah <bmah@es.net>
2017-01-11 11:52:18 -08:00
Bruce A. Mah
0fd60a3686 Issue 496 (#498)
* 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.
2017-01-10 09:13:57 -08:00
Bruce A. Mah
9c83a707eb
Fail gracefully if --fq-rate or --no-fq-socket-pacing are specified on
platforms where they aren't supported.

Requested by:	@bltierney
2016-12-14 09:32:46 -08:00
Bruce A. Mah
a094d9feef Separate out application-level and fair-queueing-based pacing (#488)
* First try to fix pacing issues.  Code compiles, lightly run-tested.

Make --bandwidth only control application-level pacing, refecting
behavior of iperf 3.1.2 and earlier.

Add a new --fq-rate that controls only FQ-based per-socket pacing.
A given test can use application-level pacing, FQ pacing, both,
or neither.

Deprecate the --no-fq-socket-pacing option; specifying this generates
a warning and is equivalent to --fq-rate=0.

Towards issue #467 and related to issue #325.

* Move --fq-rate in the help text to be just below --b, tweak wording.

* Sigh.  One more tweak on help text.

Some day I probably need to review and rewrite the whole thing.

Still working towards #467.
2016-12-12 13:47:53 -08:00
Bruce A. Mah
7d2d5c41dd
Revert "Fix a bug in FQ pacing, where application pacing wasn't completely disabled."
This reverts commit 1fa41308fe.

This doesn't really do what we want.  Start over.
2016-12-08 15:25:06 -08:00
Bruce A. Mah
5307eae461
Revert "Reduce the default UDP send size to 1452 to avoid IP fragmentation"
This reverts commit f1e62c8d48.

Right idea, but it turns out to be a pretty high-impact change.
Need to rethink this, maybe with a more intelligent implementation
that checks the interface (or path?) MTU.
2016-12-08 15:23:51 -08:00
Bruce A. Mah
f1e62c8d48
Reduce the default UDP send size to 1452 to avoid IP fragmentation
with default parameters.

A UDP payload of 1452, plus an 8-byte UDP header, plus a 40-byte IPv6
header, results in a 1500 byte IP packet.  The IPv4 header is smaller
at 20 bytes.
2016-12-05 14:00:15 -08:00
Bruce A. Mah
1fa41308fe
Fix a bug in FQ pacing, where application pacing wasn't completely disabled.
It was therefore possible to have multiple levels of pacing happening,
which resulted in very nicely smoothed traffic, but wasn't really
the original design.

Do pacing correctly in iperf_check_throttle() and remove a hack in
iperf_send() where we were explicitly checking for the type of
pacing, but didn't really need to.

It turns out that with UDP and only-FQ pacing, iperf3 sends and throws
packets on the floor as fast as it can.  This isn't really desirable,
and probably not what was wanted in a test anyway, so if we're not
doing TCP tests, force the use of application-level pacing.
2016-12-05 10:37:56 -08:00
Bruce A. Mah
55598a072f
Fix socket buffer size checks. Clearly this wasn't tested well.
On Linux it's possible to set the socket buffer to one size but
(correctly it seems) get back some larger size up to 2x what you
asked for (see tcp(7)).

While here, make related debugging output more useful.

Fixes (again) #356.
2016-12-01 11:53:37 -08:00
Bruce A. Mah
a621cc263f
Improve debug output for application and fair-queue-based pacing. 2016-11-30 07:13:28 -08:00
Bruce A. Mah
d2202ee3be
After setting socket buffer sizes, verify they were set correctly.
Do this for both TCP and UDP, but not SCTP (which strangely doesn't
support --window, that's probably a bug).  Fixes #356.
2016-11-23 11:05:47 -08:00
Bruce A. Mah
6aff679e96
Fix executable name and date in the manpage heading. 2016-11-10 13:49:44 -08:00
Nevo Hed
ad2a706fd1 Replace iprintf w/ iperf_printf (cygwin conflict) (#468)
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-10-17 13:25:07 -07:00
Bruce A. Mah
d99a69f92b
Fix a buffer overflow in upstream cJSON.
This is DaveGamble/cJSON#30, and fixes issue #466.
2016-10-05 13:59:40 -07:00
Bruce A. Mah
1a756a949e Only print congestion control algorithm for a TCP test.
Properly (I think) label the two TCP instsances as "sender"
and "receiver".
2016-09-22 15:27:24 -07:00
Bruce A. Mah
7d413a5015 Fix build on FreeBSD. 2016-09-22 14:52:57 -07:00
Bruce A. Mah
7eeaa1cb07 First try at issue #461.
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.
2016-09-22 13:34:52 -07:00
Bruce A. Mah
353615b772
Fix divide-by-zero problem that can occur with a zero-length interval
(this can happen at the end of a test under certain circumstances).
Fixes #388, alternate solution from pull request in #389.
2016-09-21 13:22:54 -07:00
Bruce A. Mah
03340fe595
Prevent a double-close on the server side in some cases.
Alternate solution to a problem pointed out by @g-coder in pull request #429.
2016-09-21 11:25:18 -07:00
woody77
93c498d417 Change pacing timer from 100ms to 1ms to smoothen out microbusts as much as possible (#460) 2016-09-21 10:31:48 -07:00
woody77
14caac895c Properly setting the no_fq_socket_pacing option when support for it is not compiled in. (#459) 2016-09-21 10:21:59 -07:00
dmdailey
f7fd67d4a2 Update iperf_server_api.c
When a test in in progress and the client completely disappears, both the control socket and the stream sockets are left around forever.  Patch modified from another patch submitted by mkall to add closing of the data stream sockets.
2016-08-05 16:41:52 -04:00
Bruce A. Mah
b7ab2b4b25
Make the server more tolerant of most types of errors encountered
during tests.

We used to exit if 5 consecutive errors were encountered.  Instead,
only exit if certain types of fatal errors happen.
2016-06-03 09:26:05 -07:00
Bruce A. Mah
4dcb275b5b
Make error handling on the control channel more robust. 2016-06-03 09:25:14 -07:00
Bruce A. Mah
ed94082be2
Fix a buffer overflow / heap corruption issue that could occur if a
malformed JSON string was passed on the control channel.  This issue,
present in the cJSON library, was already fixed upstream, so was
addressed here in iperf3 by importing a newer version of cJSON (plus
local ESnet modifications).

Discovered and reported by Dave McDaniel, Cisco Talos.

Based on a patch by @dopheide-esnet, with input from @DaveGamble.

Cross-references:  TALOS-CAN-0164, ESNET-SECADV-2016-0001,
CVE-2016-4303
2016-06-03 09:23:59 -07:00
Bruce A. Mah
a5f5765c8c
Regen. 2016-05-26 09:49:16 -07:00
Bruce A. Mah
9915746a8b
Squashed commit of the following:
commit 2dc03630a736be2ae9f64823aabb5776e7074c2a
Merge: 61e325c 0da552c
Author: Bruce A. Mah <bmah@es.net>
Date:   Thu May 26 09:40:58 2016 -0700

    Merge branch 'master' into issue-325

commit 61e325c5d0a4e7a9823221ce507db0f478fc98b5
Merge: 227992f ccbcee6
Author: Bruce A. Mah <bmah@es.net>
Date:   Thu May 26 11:09:54 2016 -0400

    Merge branch 'issue-325' of github.com:esnet/iperf into issue-325

    Conflicts:
    	src/iperf3.1

commit 227992f366e7f4895b6762011576ba22a42a752e
Author: Bruce A. Mah <bmah@es.net>
Date:   Thu May 26 11:07:01 2016 -0400

    Don't set SO_MAX_PACING_RATE if the rate is 0.  Also tweak some help text.

    Towards #325, in response to feedback from @bltierney.

commit ccbcee6366d50ec632fc00eb11fde8a886f8febe
Author: Bruce A. Mah <bmah@es.net>
Date:   Tue May 24 09:19:41 2016 -0700

    Fix manpage formatting for consistency.

commit 90ac5a9ce09bd746ca5f943a8226ab864da3ebf8
Author: Bruce A. Mah <bmah@es.net>
Date:   Tue May 24 12:14:16 2016 -0400

    Add some documentation for fair-queueing per-socket pacing.

    For #325.

commit 5571059870f7aefefb574816de70b6406848888f
Author: Bruce A. Mah <bmah@es.net>
Date:   Tue May 24 11:55:44 2016 -0400

    Change the fair-queueing socket pacing logic in response to feedback.

    By default, on platforms where per-socket pacing is available, it
    will be used.  If not available, iperf3 will fall back to application-
    level pacing.

    The --no-fq-socket-pacing option can be used to forcibly disable
    fair-queueing per-socket pacing.  (The earlier --socket-pacing option
    has been removed.)

    Tested on CentOS 7, more testing on other platforms is required to
    be sure it didn't break the old application-level pacing behavior.

    For #325.

commit 3e3f506fe9f375a5771c9e3ddfe8677c1a7146e7
Merge: 50a379e 3b23112
Author: Bruce A. Mah <bmah@es.net>
Date:   Tue May 24 09:54:39 2016 -0400

    Merge branch 'master' into issue-325

commit 50a379eddfa89d1313d2aeeb62a6fbc82f00ea17
Author: Bruce A. Mah <bmah@es.net>
Date:   Sat Apr 16 02:55:42 2016 -0400

    Regen.

commit 200d3fe3917b3d298bdf52a0bde32c47cf2727b0
Author: Bruce A. Mah <bmah@es.net>
Date:   Sat Apr 16 02:41:32 2016 -0400

    Checkpoint for initial work on #325 to add socket pacing.

    This works only on Linux and depends on the availability of
    the SO_MAX_PACING_RATE socket option and the fq queue discipline.
    Use --socket-pacing to use SO_MAX_PACING_RATE instead of the
    default iperf3 user-level rate limiting; in either case, the
    --bandwidth parameter controls the desired rate.

    Lightly tested with both --tcp and --udp, normal and --reverse.
    Real testing requires analysis of packet timestamps between
    multiple hosts.
2016-05-26 09:47:48 -07:00
g-coder
0da552c390 Safe programming practice. Added va_end. (#425)
In file iperf_util.c:
Function 'va_start' is called at line:327. But, 'va_end' is not called before returning from function 'iperf_json_printf()' at line:352 and line:355. 
The va_end performs cleanup for the argp object initialized by a call to va_start. If va_end is not called before a function that calls va_start returns, the behavior is undefined.

Applied Fix: added va_end before returning from the function.
2016-05-26 09:06:16 -07:00
g-coder
8fcfc2479f DEREF_AFTER_NULL in src/iperf_error.c (#423)
DEREF_AFTER_NULL: pointer ‘test’ at line:77 is passed as an argument to function iperf_delete_pidfile(), in which it is dereferenced at iperf_api.c:2832.
Pointer ‘test’ can be NULL and dereferencing a NULL pointer causes seg-fault.

Applied Fix: pointer ‘test’ is checked for NULL before passing it to function iperf_delete_pidfile().
2016-05-26 08:47:29 -07:00
Joe McEachern
3b2311263a Add fix for #412 (#414)
* Add fix for #412
This prevents negative loss counters with UDP when omit is used

* Track the original start time and bytes omitted. This allows the
throttle function to work after the omit timer fires. This is
a fix for issue #419.

* Remove changes to switch the bandwidth to received instead of sent bandwidth

* Roll back bandwidth sent vs received changes
2016-05-20 11:40:18 -07:00
Bruce A. Mah
f88486443c
Fix build on FreeBSD 11-CURRENT, as described in issue #413.
This caused by a combination of the iperf3 build somehow using
the system queue.h on FreeBSD 11 (possibly only on this platform)
and TAILQ_END not being defined in the system queue.h.

Expanding the TAILQ_END macro to NULL seems to solve the problem.

Submitted by:	@rbgarga
2016-05-20 10:05:24 -07:00
QuaSoft
08a2de459b Add command line option --forceflush to allow user to request flushing of output at the end of each interval.
Fixes #299
2016-03-06 16:47:02 +02:00
Bruce A. Mah
670c18584b
Get rid of nan values when there were no packets in a UDP interval.
This was causing some headaches for code trying to parse JSON.
Also revise a prior partial fix that hard-coded 100% loss for the
case of zero packets.

Partially fixes #278.

Merge candidate for 3.0 and 3.1 bugfix branches.
2016-01-28 16:04:33 -08:00
Bruce A. Mah
224ae8c764
Fix a bug where we printed the incorrect value for out-of-order UDP packets.
Fixes #329, submitted by @bhegardt.

While here, add this value to the JSON output.
2015-11-20 08:31:09 -08:00
Bruce A. Mah
956d115851 Improve command error handling.
Exit with non-zero exit code if server mode has too many errors.

Properly detect complain about non-numeric arguments to -A, -L, and -S.

Implement range checks for argument to -S.

Fixes #316.
2015-11-18 09:40:24 -08:00
Bruce A. Mah
44485b5b88
Fix a bug where the -T title option was not being output correctly
in JSON output.

Fixes #292.

Patch from:	@SLX-WI
2015-11-17 10:47:47 -08:00
Bruce A. Mah
6e48bb2a5d
Markup fixes in manpages for Debian compatibility.
Fixes #291.

Merge candidate for 3.1 stable release if applicable.
2015-11-16 12:00:36 -08:00
Bruce A. Mah
7b2abbc59a
Rename the recently-added template member in the iperf_test structure
to improve C++ compatibility.

Fixes #323.
2015-11-16 11:22:15 -08:00
Bruce A. Mah
8774140404 Bump version numbers and dates for iperf 3.1. 2015-10-16 10:00:30 -07:00
Tobias Nießen
20585b9896 Fix bug in iperf_new_stream leading to EINVAL
Fix invocation of snprintf in iperf_new_stream to prevent mkstemp from producing EINVAL.
2015-10-11 15:58:52 +02:00
Bruce A. Mah
ee306250d7 Merge pull request #288 from yeahdongcn/master
Add tmp_path in order to make the template path workable on iOS.
2015-10-07 13:05:32 -07:00
R0CKSTAR
9a3775091b Change tmp_path to template and use snprintf instead of strcpy 2015-09-21 11:07:41 +08:00
Matthieu Coudron
eb3faee64f Fixes a smashing stack problem as described in https://bugzilla.kernel.org/show_bug.cgi?id=104601 2015-09-19 14:08:47 +02:00
R0CKSTAR
7baf44a8b9 Missing one file 2015-08-03 09:40:53 +08:00
R0CKSTAR
01b82c9e3c Add tmp_path in order to make the template path workable on iOS. 2015-08-03 00:01:02 +08:00
Bruce A. Mah
883a465a72
Fix tarball generation (it was missing a file) and regen build goop.
Found by:	@arlake228
2015-06-30 13:19:38 -07:00
Bruce A. Mah
b6a2021c0b
Bump version number and manpage rev dates for 3.1b1. 2015-06-19 11:27:16 -07:00
Eduardo Abinader
1c89715936 iflush for interval results
In order to keep the same behavior of stdout, iflush the results
to files as they are printed.
2015-06-06 10:44:32 -04:00
Bruce A. Mah
25eb62c7cd Handle the case where EAGAIN != EWOULDBLOCK
Fixes #268, suggested by @tvastri.
2015-05-21 10:31:17 -07:00
Bruce A. Mah
7be67e1d2c
Fix a potential syntax error if PACKAGE_BUGREPORT is undefined.
Fixes #269, solution suggested by @tvastri.
2015-05-21 09:58:41 -07:00
Bruce A. Mah
2210d55277 Merge pull request #258 from manojdelphix/master
Fix segfault in signal handler on the server if a signal arrives at the "wrong" time.

The change causes the signal handler to use a stack context whose lifetime should be valid the entire time the signal handler is active.

Fixes #257, #258.
2015-05-11 13:45:14 -07:00
Bruce A. Mah
5824381111
Make --get-server-output properly include all of the server side output.
Fixes #251, with a bug fix based on diagnosis and analysis from @nomel.
2015-05-11 10:44:06 -07:00
Bruce A. Mah
5461579d32
Regen.
This uses a newer automake, than was in use previously, although that
wasn't the main point of doing this change.
2015-05-11 10:42:44 -07:00
Manoj Joseph
9293ec2c2b 257 Segfault in the signal handler 2015-03-31 11:08:16 -07:00
Bruce A. Mah
7645027d0d Remove an extra #ifdef left behind by #248. 2015-03-13 12:59:39 -07:00
Havard Eidnes
86daf673f3 Add support for NetBSD systems which have TCP_INFO implemented. 2015-02-19 14:23:01 +01:00
Bruce A. Mah
a337b698d0 Merge pull request #247 from he32/unused-fix
Remove unused local variable.
2015-02-12 14:51:12 -08:00
Bruce A. Mah
a47aa46b05 Merge pull request #246 from he32/include-fix
Include <sys/time.h> for struct timeval definition.
2015-02-12 14:49:52 -08:00
Havard Eidnes
c95ee19c59 Fix a toupper() usage too to avoid negative signed chars. 2015-02-12 15:13:00 +01:00
Havard Eidnes
bf53fb1304 Remove unused local variable. 2015-02-12 15:07:56 +01:00
Havard Eidnes
621a152b7c Include <sys/time.h> for struct timeval definition. 2015-02-12 15:04:16 +01:00
Havard Eidnes
081ad7c08c Add casts for the two remaining tolower() uses, since
tolower() is undefined for negative character values
(except for -1).

Also simplify the existing casts for tolower() usages.
2015-02-12 14:58:54 +01:00
Bruce A. Mah
6bd4e258d0 Make the combination of -B and -P but not --cport work
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
2015-01-14 08:40:26 -08:00
Bruce A. Mah
bf32d9de66
Regen. 2015-01-06 10:40:04 -08:00
Bruce A. Mah
3b60f09017 Unbreak (partially) SCTP on Solaris.
Solaris implements an (older?) version of the API for SCTP_MAXSEG,
which takes an integer argument rather than a struct sctp_assoc_val.
We need to test for that and handle it appropriately.  There are some
signs it doesn't even work correctly if we do this, so quietly ignore
errors that happen if the OS complains it's unsupported.

Also, Solaris doesn't support SCTP_DISABLE_FRAGMENTS even though it
defines the preprocessor symbol for this.  Rather than aborting when
we try to unsuccessfully unset this option, just ignore the error.

Lightly tested with SCTP over IPv6 on localhost.
2015-01-06 10:22:00 -08:00
Bruce A. Mah
4874c4a88b
Regen. 2015-01-05 15:23:07 -08:00
Bruce A. Mah
e142062572
Add -X to restrict SCTP binding to a subset of interfaces.
Contains an alternate implementation of previously-submitted patches
to set the maximum segment size and no-delay options.

As a result of this change, SCTP functionality on Linux will generally
require the libsctp library (on CentOS and similar distributions this
is provided by the lksctp-tools RPM).

Part of #131.

Submitted by:	Bruce Simpson <bs48@st-andrews.ac.uk>
2015-01-05 15:19:57 -08:00
Bruce A. Mah
eb9a2c07c3 Unbreak master builds on CentOS 5.
The problem is that the new byte-ordering macros adopted on master
don't support CentOS 5 because they assumed that any Linux system had
endian(3) support.  CentOS 6 (and presumably newer) do, but CentOS 5
doesn't.

So instead we only do glibc endian(3) support if we're on a system
with glibc 2.9 or higher (which is when this functionality was
introduced).

For any other platform that we don't detect (which now includes older
glibc such as CentOS 5), bring back our homebrewed htonll and ntohll
implementation from iperf 3.0.x.

Fixes #224.
2015-01-05 10:42:09 -08:00
Bruce A. Mah
bebb7dea76 Merge branch 'candlerb-multisend' of https://github.com/candlerb/iperf into candlerb-candlerb-multisend 2015-01-02 10:00:37 -08:00
Bruce A. Mah
c0f4fa6ac0 Merge pull request #231 from candlerb/candlerb-sendfile-stats
Fix calculation of sendfile throughput on OSX and FreeBSD.
2015-01-02 09:54:34 -08:00
Bruce A. Mah
d275f166c8 Merge pull request #222 from hasso/timeout-udp
Timeout if UDP port isn't reachable.

This handles the case that a control connection succeeds but UDP packets are blocked by a firewall.
2014-12-23 10:39:11 -08:00
Brian Candler
a80368bb7f Drop out of multisend loop if none of the streams are accepting data 2014-12-23 09:38:50 +00:00
Bruce A. Mah
dba611dbe4 Add one-off mode, where the server serves exactly one request.
Primarily useful for bwctl integration, this is enabled with the -1
and/or --one-off flags.

Fixes #230, based on a patch by @i2aaron.

Signed-off-by: Bruce A. Mah <bmah@es.net>
2014-12-22 14:45:40 -08:00
Brian Candler
8961016f90 Ignore set_test_zerocopy if host does not support it 2014-12-22 18:04:56 +00:00
Brian Candler
588ee5223e Fix calculation of sendfile throughput on OSX
Note that sendfile can return -1 for EINTR whilst having already sent
partial results; these were not being counted previously.
2014-12-22 10:38:59 +00:00
Hasso Tepper
b83791882d Add ifdef to the SO_RCVTIMEO code
Not all platforms have a SO_RCVTIMEO socket option.
2014-12-11 12:59:02 +02:00