diff --git a/.travis.yml b/.travis.yml index 1a37a5f..67ba082 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,7 +6,7 @@ os: - linux - osx - freebsd - + notifications: slack: secure: ImUmX7hcYotHWCDBfOcIvF6H7kkeGqiaUCy7SVPFtgPbz33ttpbRd94E7oxWVmZMLKb+i6+JCujTEWGwGBimzH+DjL0LLWs0ShzXZIUa1UzEPTc4hgV6VAxucYKFg2WrbXgOPWbulkMG1VZ6pX7GlAEGf0qyNqn44F7S2ay9m18= diff --git a/README.md b/README.md index cf52e4a..45edfe2 100644 --- a/README.md +++ b/README.md @@ -60,7 +60,7 @@ Invoking iperf3 iperf3 includes a manual page listing all of the command-line options. The manual page is the most up-to-date reference to the various flags and parameters. -For sample command line usage, see: +For sample command line usage, see: https://fasterdata.es.net/performance-testing/network-troubleshooting-tools/iperf/ @@ -119,7 +119,7 @@ Some iperf2 options are not available in iperf3: -r, --tradeoff Do a bidirectional test individually -T, --ttl time-to-live, for multicast (default 1) - -x, --reportexclude [CDMSV] exclude C(connection) D(data) M(multicast) + -x, --reportexclude [CDMSV] exclude C(connection) D(data) M(multicast) S(settings) V(server) reports -y, --reportstyle C report as a Comma-Separated Values diff --git a/contrib/iperf3.gp b/contrib/iperf3.gp index 0bf49ea..898422c 100644 --- a/contrib/iperf3.gp +++ b/contrib/iperf3.gp @@ -1,7 +1,7 @@ # # sample Gnuplot command file for iperf3 results set term x11 -#set term png +#set term png #set term postscript landscape color set key width -12 @@ -19,11 +19,11 @@ set grid linewidth 1 set title "TCP performance: 40G to 10G host" set xlabel "time (seconds)" set ylabel "Bandwidth (Gbits/second)" -set xrange [0:60] -set yrange [0:15] +set xrange [0:60] +set yrange [0:15] set ytics nomirror set y2tics -set y2range [0:2500] +set y2range [0:2500] # dont plot when retransmits = 0 set datafile missing '0' set pointsize 1.6 @@ -34,4 +34,3 @@ plot "40Gto10G.old.dat" using 1:3 title '3.10 kernel' with linespoints lw 3 pt 5 #plot "iperf3.old.dat" using 1:3 title '3.10 kernel' with linespoints lw 3 pt 5, \ # "iperf3.new.dat" using 1:3 title '4.2 kernel' with linespoints lw 3 pt 7 - diff --git a/docs/2017-04-27.txt b/docs/2017-04-27.txt index 4bd4fcb..dc8206e 100644 --- a/docs/2017-04-27.txt +++ b/docs/2017-04-27.txt @@ -7,7 +7,7 @@ State of the iperf3 World, as seen from ESnet... ------------------------------------------------ iperf3 was originally written to be a "better", more maintainable -follow-on to iperf2. This was seen to be necessary to fill the +follow-on to iperf2. This was seen to be necessary to fill the requirements for the perfSONAR project (http://www.perfsonar.net). In the past few years, iperf2 development has been restarted by Bob diff --git a/docs/building.rst b/docs/building.rst index 6f6dab1..9494d00 100644 --- a/docs/building.rst +++ b/docs/building.rst @@ -24,4 +24,3 @@ help to run ``./bootstrap.sh`` first from the top-level directory. By default, the ``libiperf`` library is built in both shared and static forms. Either can be suppressed by using the ``--disabled-shared`` or ``--disable-static`` configure-time options. - diff --git a/docs/dev.rst b/docs/dev.rst index a2ff60c..3cfab78 100644 --- a/docs/dev.rst +++ b/docs/dev.rst @@ -25,7 +25,7 @@ Bug Reports ----------- Before submitting a bug report, try checking out the latest version of -the code, and confirm that it's not already fixed. Also see the :doc:`faq`. +the code, and confirm that it's not already fixed. Also see the :doc:`faq`. Then submit to the iperf3 issue tracker on GitHub: https://github.com/esnet/iperf/issues @@ -47,7 +47,7 @@ for a complete list of iperf3 options):: -T, --title str prefix every output line with this string -F, --file name xmit/recv the specified file -A, --affinity n/n,m set CPU affinity (Linux and FreeBSD only) - -k, --blockcount #[KMG] number of blocks (packets) to transmit (instead + -k, --blockcount #[KMG] number of blocks (packets) to transmit (instead of -t or -n) -L, --flowlabel set IPv6 flow label (Linux only) @@ -62,7 +62,7 @@ Deprecated flags (currently no plans to support):: -d, --dualtest Do a bidirectional test simultaneously -r, --tradeoff Do a bidirectional test individually -T, --ttl time-to-live, for multicast (default 1) - -x, --reportexclude [CDMSV] exclude C(connection) D(data) M(multicast) + -x, --reportexclude [CDMSV] exclude C(connection) D(data) M(multicast) S(settings) V(server) reports -y, --reportstyle C report as a Comma-Separated Values @@ -176,7 +176,7 @@ Release Engineering Checklist 7. For extra points, actually try downloading, compiling, and smoke-testing the results of the tarball on all supported platforms. - + 8. Plug the SHA256 checksum into the release announcement. 9. PGP-sign the release announcement text using ``gpg --clearsign``. @@ -233,7 +233,7 @@ Code Authors The main authors of iperf3 are (in alphabetical order): Jon Dugan, Seth Elliott, Bruce A. Mah, Jeff Poskanzer, Kaustubh Prabhu. Additional code contributions have come from (also in alphabetical -order): Mark Ashley, Aaron Brown, Aeneas Jaißle, Susant Sahani, +order): Mark Ashley, Aaron Brown, Aeneas Jaißle, Susant Sahani, Bruce Simpson, Brian Tierney. iperf3 contains some original code from iperf2. The authors of iperf2 diff --git a/docs/faq.rst b/docs/faq.rst index 7d7234d..7b70026 100644 --- a/docs/faq.rst +++ b/docs/faq.rst @@ -13,27 +13,27 @@ What is the history of iperf3, and what is the difference between iperf2 and ipe threaded, and not worry about backwards compatibility with iperf2. Many of the feature requests for iperf3 came from the perfSONAR project (http://www.perfsonar.net). - + Then in 2014, Bob (Robert) McMahon from Broadcom restarted development of iperf2 (See https://sourceforge.net/projects/iperf2/). He fixed many of the problems with iperf2, and added a number of new features similar to - iperf3. iperf2.0.8, released in 2015, made iperf2 a useful tool. iperf2's + iperf3. iperf2.0.8, released in 2015, made iperf2 a useful tool. iperf2's current development is focused is on using UDP for latency testing, as well as broad platform support. - + As of this writing (2017), both iperf2 and iperf3 are being actively (although independently) developed. We recommend being familiar with both tools, and use whichever tool’s features best match your needs. - + A feature comparison of iperf2, iperf3, and nuttcp is available at: https://fasterdata.es.net/performance-testing/network-troubleshooting-tools/throughput-tool-comparision/ - + iperf3 parallel stream performance is much less than iperf2. Why? iperf3 is single threaded, and iperf2 is multi-threaded. We recommend using iperf2 for parallel streams. If you want to use multiple iperf3 streams use the method described `here `_. - + I’m trying to use iperf3 on Windows, but having trouble. What should I do? iperf3 is not officially supported on Windows, but iperf2 is. We recommend you use iperf2. @@ -41,7 +41,7 @@ I’m trying to use iperf3 on Windows, but having trouble. What should I do? Some people are using Cygwin to run iperf3 in Windows, but not all options will work. Some community-provided binaries of iperf3 for Windows exist. - + How can I build a statically-linked executable of iperf3? There are a number of reasons for building an iperf3 executable with no dependencies on any shared libraries. Unfortunately this isn't @@ -123,10 +123,10 @@ I'm seeing quite a bit of unexpected UDP loss. Why? issue with the default UDP send size that was fixed in 3.1.5. Second, try adding the flag ``-w2M`` to increase the socket buffer sizes. That seems to make a big difference on some hosts. - + iperf3 UDP does not seem to work at bandwidths less than 100Kbps. Why? You'll need to reduce the default packet length to get UDP rates of less that 100Kbps. Try ``-l100``. - + TCP throughput drops to (almost) zero during a test, what's going on? A drop in throughput to almost zero, except maybe for the first reported interval(s), may be related to problems in NIC TCP Offload, @@ -184,13 +184,13 @@ What congestion control algorithms are supported? On Linux, run this command to see the available congestion control algorithms (note that some algorithms are packaged as kernel modules, which must be loaded before they can be used):: - + /sbin/sysctl net.ipv4.tcp_available_congestion_control On FreeBSD, the equivalent command is:: /sbin/sysctl net.inet.tcp.cc.available - + I’m using the ``--logfile`` option. How do I see file output in real time? Use the ``--forceflush`` flag. @@ -252,5 +252,3 @@ I have a question regarding iperf3...what's the best way to get help? We discourage the use of the iperf3 issue tracker on GitHub for support questions. Actual bug reports, enhancement requests, or pull requests are encouraged, however. - - diff --git a/docs/index.rst b/docs/index.rst index 1094028..0f4b4c6 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -68,4 +68,3 @@ Indices and tables * :ref:`genindex` * :ref:`modindex` * :ref:`search` - diff --git a/docs/invoking.rst b/docs/invoking.rst index 9726d69..1b4e434 100644 --- a/docs/invoking.rst +++ b/docs/invoking.rst @@ -4,7 +4,7 @@ Invoking iperf3 iperf3 includes a manual page listing all of the command-line options. The manual page is the most up-to-date reference to the various flags and parameters. -For sample command line usage, see: +For sample command line usage, see: https://fasterdata.es.net/performance-testing/network-troubleshooting-tools/iperf/ @@ -28,72 +28,72 @@ the executable. :: IPERF3(1) User Manuals IPERF3(1) - - - + + + NAME iperf3 - perform network throughput tests - + SYNOPSIS iperf3 -s [ options ] iperf3 -c server [ options ] - - + + DESCRIPTION iperf3 is a tool for performing network throughput measurements. It can test TCP, UDP, or SCTP throughput. To perform an iperf3 test the user must establish both a server and a client. - + The iperf3 executable contains both client and server functionality. An iperf3 server can be started using either of the -s or --server com- mand-line parameters, for example: - + iperf3 -s - + iperf3 --server - + Note that many iperf3 parameters have both short (-s) and long (--server) forms. In this section we will generally use the short form of command-line flags, unless only the long form of a flag is avail- able. - + By default, the iperf3 server listens on TCP port 5201 for connections from an iperf3 client. A custom port can be specified by using the -p flag, for example: - + iperf3 -s -p 5002 - + After the server is started, it will listen for connections from iperf3 clients (in other words, the iperf3 program run in client mode). The client mode can be started using the -c command-line option, which also requires a host to which iperf3 should connect. The host can by speci- fied by hostname, IPv4 literal, or IPv6 literal: - + iperf3 -c iperf3.example.com - + iperf3 -c 192.0.2.1 - + iperf3 -c 2001:db8::1 - + If the iperf3 server is running on a non-default TCP port, that port number needs to be specified on the client as well: - + iperf3 -c iperf3.example.com -p 5002 - + The initial TCP connection is used to exchange test parameters, control the start and end of the test, and to exchange test results. This is sometimes referred to as the "control connection". The actual test data is sent over a separate TCP connection, as a separate flow of UDP packets, or as an independent SCTP connection, depending on what proto- col was specified by the client. - + Normally, the test data is sent from the client to the server, and mea- sures the upload speed of the client. Measuring the download speed from the server can be done by specifying the -R flag on the client. This causes data to be sent from the server to the client. - + iperf3 -c iperf3.example.com -p 5202 -R - + Results are displayed on both the client and server. There will be at least one line of output per measurement interval (by default a mea- surement interval lasts for one second, but this can be changed by the @@ -103,43 +103,43 @@ the executable. measurement interval are taken from the point of view of the endpoint process emitting that output (in other words, the output on the client shows the measurement interval data for the client. - + At the end of the test is a set of statistics that shows (at least as much as possible) a summary of the test as seen by both the sender and the receiver, with lines tagged accordingly. Recall that by default the client is the sender and the server is the receiver, although as indicated above, use of the -R flag will reverse these roles. - + The client can be made to retrieve the server-side output for a given test by specifying the --get-server-output flag. - + Either the client or the server can produce its output in a JSON struc- ture, useful for integration with other programs, by passing it the -J flag. Because the contents of the JSON structure are only competely known after the test has finished, no JSON output will be emitted until the end of the test. - + iperf3 has a (overly) large set of command-line options that can be used to set the parameters of a test. They are given in the "GENERAL OPTIONS" section of the manual page below, as well as summarized in iperf3's help output, which can be viewed by running iperf3 with the -h flag. - + GENERAL OPTIONS -p, --port n set server port to listen on/connect to to n (default 5201) - + -f, --format [kmgtKMGT] format to report: Kbits/Mbits/Gbits/Tbits - + -i, --interval n pause n seconds between periodic throughput reports; default is 1, use 0 to disable - + -I, --pidfile file write a file with the process ID, most useful when running as a daemon. - + -F, --file name Use a file as the source (on the sender) or sink (on the receiver) of data, rather than just generating random data or @@ -148,7 +148,7 @@ the executable. It does not turn iperf3 into a file transfer tool. The length, attributes, and in some cases contents of the received file may not match those of the original file. - + -A, --affinity n/n,m Set the CPU affinity, if possible (Linux, FreeBSD, and Windows only). On both the client and server you can set the local @@ -158,26 +158,26 @@ the executable. argument. Note that when using this feature, a process will only be bound to a single CPU (as opposed to a set containing potentialy multiple CPUs). - + -B, --bind host bind to the specific interface associated with address host. --bind-dev dev.ft R bind to the specified network interface. This option uses SO_BINDTODEVICE, and may require root permis- sions. (Available on Linux and possibly other systems.) - + -V, --verbose give more detailed output - + -J, --json output in JSON format - + --logfile file send output to a log file. - + --forceflush force flushing output at every interval. Used to avoid buffer- ing when sending output to pipe. - + --timestamps[=format] prepend a timestamp at the start of each output line. By default, timestamps have the format emitted by ctime(1). @@ -185,33 +185,33 @@ the executable. to customize the timestamps, see strftime(3). If this optional format is given, the = must immediately follow the --timestamps option with no whitespace intervening. - + --rcv-timeout # set idle timeout for receiving data during active tests. The receiver will halt a test if no data is received from the sender for this number of ms (default to 12000 ms, or 2 minutes). - + -d, --debug emit debugging output. Primarily (perhaps exclusively) of use to developers. - + -v, --version show version information and quit - + -h, --help show a help synopsis - - + + SERVER SPECIFIC OPTIONS -s, --server run in server mode - + -D, --daemon run the server in background as a daemon - + -1, --one-off handle one client connection, then exit. - + --server-bitrate-limit n[KMGT] set a limit on the server side, which will cause a test to abort if the client specifies a test of more than n bits per second, @@ -221,41 +221,41 @@ the executable. over which to average the data rate is 5 seconds by default, but can be specified by adding a '/' and a number to the bitrate specifier. - + --rsa-private-key-path file path to the RSA private key (not password-protected) used to decrypt authentication credentials from the client (if built with OpenSSL support). - + --authorized-users-path file path to the configuration file containing authorized users cre- dentials to run iperf tests (if built with OpenSSL support). The file is a comma separated list of usernames and password hashes; more information on the structure of the file can be found in the EXAMPLES section. - + --time-skew-thresholdsecond seconds time skew threshold (in seconds) between the server and client during the authentication process. - + CLIENT SPECIFIC OPTIONS -c, --client host run in client mode, connecting to the specified server. By default, a test consists of sending data from the client to the server, unless the -R flag is specified. - + --sctp use SCTP rather than TCP (FreeBSD and Linux) - + -u, --udp use UDP rather than TCP - + --connect-timeout n set timeout for establishing the initial control connection to the server, in milliseconds. The default behavior is the oper- ating system's timeout for TCP connection establishment. Pro- viding a shorter value may speed up detection of a down iperf3 server. - + -b, --bitrate n[KMGT] set target bitrate to n bits/sec (default 1 Mbit/sec for UDP, unlimited for TCP/SCTP). If there are multiple streams (-P @@ -269,7 +269,7 @@ the executable. inside iperf3, and is available on all platforms. Compare with the --fq-rate flag. This option replaces the --bandwidth flag, which is now deprecated but (at least for now) still accepted. - + --pacing-timer n[KMGT] set pacing timer interval in microseconds (default 1000 microseconds, or 1 ms). This controls iperf3's internal pacing @@ -278,7 +278,7 @@ the executable. timer parameter smooth out the traffic emitted by iperf3, but potentially at the cost of performance due to more frequent timer processing. - + --fq-rate n[KMGT] Set a rate to be used with fair-queueing based socket-level pac- ing, in bits per second. This pacing (if specified) will be in @@ -287,72 +287,72 @@ the executable. test. Only available on platforms supporting the SO_MAX_PAC- ING_RATE socket option (currently only Linux). The default is no fair-queueing based pacing. - + --no-fq-socket-pacing This option is deprecated and will be removed. It is equivalent to specifying --fq-rate=0. - + -t, --time n time in seconds to transmit for (default 10 secs) - + -n, --bytes n[KMGT] number of bytes to transmit (instead of -t) - + -k, --blockcount n[KMGT] number of blocks (packets) to transmit (instead of -t or -n) - + -l, --length n[KMGT] length of buffer to read or write. For TCP tests, the default value is 128KB. In the case of UDP, iperf3 tries to dynamically determine a reasonable sending size based on the path MTU; if that cannot be determined it uses 1460 bytes as a sending size. For SCTP tests, the default size is 64KB. - + --cport port bind data streams to a specific client port (for TCP and UDP only, default is to use an ephemeral port) - + -P, --parallel n number of parallel client streams to run. Note that iperf3 is single threaded, so if you are CPU bound, this will not yield higher throughput. - + -R, --reverse reverse the direction of a test, so that the server sends data to the client - + --bidir test in both directions (normal and reverse), with both the client and server sending and receiving data simultaneously - + -w, --window n[KMGT] window size / socket buffer size (this gets sent to the server and used on that side too) - + -M, --set-mss n set TCP/SCTP maximum segment size (MTU - 40 bytes) - + -N, --no-delay set TCP/SCTP no delay, disabling Nagle's Algorithm - + -4, --version4 only use IPv4 - + -6, --version6 only use IPv6 - + -S, --tos n set the IP type of service. The usual prefixes for octal and hex can be used, i.e. 52, 064 and 0x34 all specify the same value. - + --dscp dscp set the IP DSCP bits. Both numeric and symbolic values are accepted. Numeric values can be specified in decimal, octal and hex (see --tos above). - + -L, --flowlabel n set the IPv6 flow label (currently only supported on Linux) - + -X, --xbind name Bind SCTP associations to a specific subset of links using sctp_bindx(3). The --B flag will be ignored if this flag is @@ -366,30 +366,30 @@ the executable. resolved using getaddrinfo(3). If the --4 or --6 flags are specified, names which do not resolve to addresses within the specified protocol family will be ignored. - + --nstreams n Set number of SCTP streams. - + -Z, --zerocopy Use a "zero copy" method of sending data, such as sendfile(2), instead of the usual write(2). - + -O, --omit n Omit the first n seconds of the test, to skip past the TCP slow- start period. - + -T, --title str Prefix every output line with this string. - + --extra-data str Specify an extra data string field to be included in JSON out- put. - + -C, --congestion algo Set the congestion control algorithm (Linux and FreeBSD only). An older --linux-congestion synonym for this flag is accepted but is deprecated. - + --get-server-output Get the output from the server. The output format is determined by the server (in particular, if the server was invoked with the @@ -397,14 +397,14 @@ the executable. will be in human-readable format). If the client is run with --json, the server output is included in a JSON object; other- wise it is appended at the bottom of the human-readable output. - + --udp-counters-64bit Use 64-bit counters in UDP test packets. The use of this option can help prevent counter overflows during long or high-bitrate UDP tests. Both client and server need to be running at least version 3.1 for this option to work. It may become the default behavior at some point in the future. - + --repeating-payload Use repeating pattern in payload, instead of random bytes. The same payload is used in iperf2 (ASCII '0..9' repeating). It @@ -412,11 +412,11 @@ the executable. hardware compression (including some WiFi access points), where iperf2 and iperf3 perform differently, just based on payload entropy. - + --dont-fragment Set the IPv4 Don't Fragment (DF) bit on outgoing packets. Only applicable to tests doing UDP over IPv4. - + --username username username to use for authentication to the iperf server (if built with OpenSSL support). The password will be prompted for inter- @@ -424,12 +424,12 @@ the executable. also be specified via the IPERF3_PASSWORD environment variable. If this variable is present, the password prompt will be skipped. - + --rsa-public-key-path file path to the RSA public key used to encrypt authentication cre- dentials (if built with OpenSSL support) - - + + EXAMPLES Authentication - RSA Keypair The authentication feature of iperf3 requires an RSA public keypair. @@ -440,16 +440,16 @@ the executable. format and use SubjectPrefixKeyInfo encoding. An example of a set of UNIX/Linux commands using OpenSSL to generate a correctly-formed key- pair follows: - + > openssl genrsa -des3 -out private.pem 2048 > openssl rsa -in private.pem -outform PEM -pubout -out public.pem > openssl rsa -in private.pem -out private_not_protected.pem -out- form PEM - + After these commands, the public key will be contained in the file pub- lic.pem and the private key will be contained in the file pri- vate_not_protected.pem. - + Authentication - Authorized users configuration file A simple plaintext file must be provided to the iperf3 server in order to specify the authorized user credentials. The file is a simple list @@ -458,31 +458,30 @@ the executable. word". The file can also contain commented lines (starting with the # character). An example of commands to generate the password hash on a UNIX/Linux system is given below: - + > S_USER=mario S_PASSWD=rossi > echo -n "{$S_USER}$S_PASSWD" | sha256sum | awk '{ print $1 }' - + An example of a password file (with an entry corresponding to the above username and password) is given below: > cat credentials.csv # file format: username,sha256 mario,bf7a49a846d44b454a5d11e7acfaf13d138bbe0b7483aa3e050879700572709b - - - + + + AUTHORS A list of the contributors to iperf3 can be found within the documenta- tion located at https://software.es.net/iperf/dev.html#authors. - - + + SEE ALSO libiperf(3), https://software.es.net/iperf - - - + + + ESnet February 2021 IPERF3(1) The iperf3 manual page will typically be installed in manual section 1. - diff --git a/docs/news.rst b/docs/news.rst index 1f18f67..7f82f1a 100644 --- a/docs/news.rst +++ b/docs/news.rst @@ -412,4 +412,3 @@ During development, there were various distributions of the source code unofficially released carrying a 3.0.0 version number. Because of the possibility for confusion, this first public release of iperf3 was numbered 3.0.1. - diff --git a/iperf3.spec.in b/iperf3.spec.in index 602364d..ea63635 100644 --- a/iperf3.spec.in +++ b/iperf3.spec.in @@ -3,8 +3,8 @@ Version: @VERSION@ Release: 1%{?dist} Summary: Measurement tool for TCP/UDP bandwidth performance -Group: Applications/Internet -License: BSD +Group: Applications/Internet +License: BSD URL: https://github.com/esnet/iperf Source0: https://downloads.es.net/pub/iperf/iperf-%{version}.tar.gz BuildRoot: %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX) @@ -98,9 +98,8 @@ rm -rf $RPM_BUILD_ROOT - Rebuilt for https://fedoraproject.org/wiki/Fedora_17_Mass_Rebuild * Wed Apr 06 2011 G.Balaji 3.0b4-2 -- Changed the Spec name, removed static libs generation and devel +- Changed the Spec name, removed static libs generation and devel - package. * Sat Mar 26 2011 G.Balaji 3.0b4-1 - Initial Version - diff --git a/src/flowlabel.h b/src/flowlabel.h index 1d5e013..df0a434 100644 --- a/src/flowlabel.h +++ b/src/flowlabel.h @@ -30,8 +30,8 @@ #include -/* - It is just a stripped copy of the Linux kernel header "linux/in6.h" +/* + It is just a stripped copy of the Linux kernel header "linux/in6.h" "Flow label" things are still not defined in "netinet/in*.h" headers, but we cannot use "linux/in6.h" immediately because it currently conflicts with "netinet/in.h" . diff --git a/src/iperf.h b/src/iperf.h index f50e1bb..6de2343 100644 --- a/src/iperf.h +++ b/src/iperf.h @@ -183,7 +183,7 @@ struct iperf_stream int socket; int id; int sender; - /* XXX: is settings just a pointer to the same struct in iperf_test? if not, + /* XXX: is settings just a pointer to the same struct in iperf_test? if not, should it be? */ struct iperf_settings *settings; /* pointer to structure settings */ @@ -325,7 +325,7 @@ struct iperf_test fd_set read_set; /* set of read sockets */ fd_set write_set; /* set of write sockets */ - /* Interval related members */ + /* Interval related members */ int omitting; double stats_interval; double reporter_interval; diff --git a/src/iperf3.1 b/src/iperf3.1 index 21066a3..aa4f4f2 100644 --- a/src/iperf3.1 +++ b/src/iperf3.1 @@ -6,7 +6,7 @@ iperf3 \- perform network throughput tests .I options .B ] .br -.B iperf3 -c +.B iperf3 -c .I server .B [ .I options @@ -148,7 +148,7 @@ This option uses SO_BINDTODEVICE, and may require root permissions. (Available on Linux and possibly other systems.) .TP .BR -V ", " --verbose " " -give more detailed output +give more detailed output .TP .BR -J ", " --json " " output in JSON format @@ -213,12 +213,12 @@ the data rate is 5 seconds by default, but can be specified by adding a '/' and a number to the bitrate specifier. .TP .BR --rsa-private-key-path " \fIfile\fR" -path to the RSA private key (not password-protected) used to decrypt +path to the RSA private key (not password-protected) used to decrypt authentication credentials from the client (if built with OpenSSL support). -.TP +.TP .BR --authorized-users-path " \fIfile\fR" -path to the configuration file containing authorized users credentials to run +path to the configuration file containing authorized users credentials to run iperf tests (if built with OpenSSL support). The file is a comma separated list of usernames and password hashes; more information on the structure of the file can be found in the @@ -418,41 +418,41 @@ perform differently, just based on payload entropy. Set the IPv4 Don't Fragment (DF) bit on outgoing packets. Only applicable to tests doing UDP over IPv4. .TP -.BR --username " \fIusername\fR" +.BR --username " \fIusername\fR" username to use for authentication to the iperf server (if built with OpenSSL support). The password will be prompted for interactively when the test is run. Note, the password to use can also be specified via the IPERF3_PASSWORD environment variable. If this variable is present, the password prompt will be skipped. .TP -.BR --rsa-public-key-path " \fIfile\fR" +.BR --rsa-public-key-path " \fIfile\fR" path to the RSA public key used to encrypt authentication credentials (if built with OpenSSL support) .SH EXAMPLES .SS "Authentication - RSA Keypair" The authentication feature of iperf3 requires an RSA public keypair. -The public key is used to encrypt the authentication token containing the +The public key is used to encrypt the authentication token containing the user credentials, while the private key is used to decrypt the authentication token. The private key must be in PEM format and additionally must not have a password set. The public key must be in PEM format and use SubjectPrefixKeyInfo encoding. An example of a set of UNIX/Linux commands using OpenSSL to generate a correctly-formed keypair follows: -.sp 1 +.sp 1 .in +.5i > openssl genrsa -des3 -out private.pem 2048 .sp 0 > openssl rsa -in private.pem -outform PEM -pubout -out public.pem .sp 0 -> openssl rsa -in private.pem -out private_not_protected.pem -outform PEM +> openssl rsa -in private.pem -out private_not_protected.pem -outform PEM .in -.5i .sp 1 After these commands, the public key will be contained in the file public.pem and the private key will be contained in the file private_not_protected.pem. .SS "Authentication - Authorized users configuration file" -A simple plaintext file must be provided to the iperf3 server in order to specify +A simple plaintext file must be provided to the iperf3 server in order to specify the authorized user credentials. The file is a simple list of comma-separated pairs of a username and a corresponding password hash. @@ -461,7 +461,7 @@ The file can also contain commented lines (starting with the \fC#\fR character). An example of commands to generate the password hash on a UNIX/Linux system is given below: -.sp 1 +.sp 1 .in +.5i > S_USER=mario S_PASSWD=rossi .sp 0 diff --git a/src/iperf_api.c b/src/iperf_api.c index 95ac3f0..cd6b15d 100644 --- a/src/iperf_api.c +++ b/src/iperf_api.c @@ -1202,7 +1202,7 @@ iperf_parse_arguments(struct iperf_test *test, int argc, char **argv) break; case 'w': // XXX: This is a socket buffer, not specific to TCP - // Do sanity checks as double-precision floating point + // Do sanity checks as double-precision floating point // to avoid possible integer overflows. farg = unit_atof(optarg); if (farg > (double) MAX_TCP_BUFFER) { @@ -1349,7 +1349,7 @@ iperf_parse_arguments(struct iperf_test *test, int argc, char **argv) case 'A': #if defined(HAVE_CPU_AFFINITY) test->affinity = strtol(optarg, &endptr, 0); - if (endptr == optarg || + if (endptr == optarg || test->affinity < 0 || test->affinity > 1024) { i_errno = IEAFFINITY; return -1; @@ -1478,7 +1478,7 @@ iperf_parse_arguments(struct iperf_test *test, int argc, char **argv) if (test->role == 's' && (client_username || client_rsa_public_key)){ i_errno = IECLIENTONLY; return -1; - } else if (test->role == 'c' && (client_username || client_rsa_public_key) && + } else if (test->role == 'c' && (client_username || client_rsa_public_key) && !(client_username && client_rsa_public_key)) { i_errno = IESETCLIENTAUTH; return -1; @@ -1492,7 +1492,7 @@ iperf_parse_arguments(struct iperf_test *test, int argc, char **argv) else if (iperf_getpass(&client_password, &s, stdin) < 0){ i_errno = IESETCLIENTAUTH; return -1; - } + } if (test_load_pubkey_from_file(client_rsa_public_key) < 0){ iperf_err(test, "%s\n", ERR_error_string(ERR_get_error(), NULL)); i_errno = IESETCLIENTAUTH; @@ -1515,7 +1515,7 @@ iperf_parse_arguments(struct iperf_test *test, int argc, char **argv) } else if (test->role == 'c' && rcv_timeout_flag && test->mode == SENDER){ i_errno = IERVRSONLYRCVTIMEOUT; return -1; - } else if (test->role == 's' && (server_rsa_private_key || test->server_authorized_users) && + } else if (test->role == 's' && (server_rsa_private_key || test->server_authorized_users) && !(server_rsa_private_key && test->server_authorized_users)) { i_errno = IESETSERVERAUTH; return -1; @@ -1544,7 +1544,7 @@ iperf_parse_arguments(struct iperf_test *test, int argc, char **argv) else blksize = DEFAULT_TCP_BLKSIZE; } - if ((test->protocol->id != Pudp && blksize <= 0) + if ((test->protocol->id != Pudp && blksize <= 0) || blksize > MAX_BLOCKSIZE) { i_errno = IEBLOCKSIZE; return -1; @@ -1563,8 +1563,8 @@ iperf_parse_arguments(struct iperf_test *test, int argc, char **argv) /* if no bytes or blocks specified, nor a duration_flag, and we have -F, ** get the file-size as the bytes count to be transferred */ - if (test->settings->bytes == 0 && - test->settings->blocks == 0 && + if (test->settings->bytes == 0 && + test->settings->blocks == 0 && ! duration_flag && test->diskfile_name != (char*) 0 && test->role == 'c' @@ -1572,12 +1572,12 @@ iperf_parse_arguments(struct iperf_test *test, int argc, char **argv) struct stat st; if( stat(test->diskfile_name, &st) == 0 ){ iperf_size_t file_bytes = st.st_size; - test->settings->bytes = file_bytes; + test->settings->bytes = file_bytes; if (test->debug) printf("End condition set to file-size: %d bytes\n", test->settings->bytes); } // if failing to read file stat, it should fallback to default duration mode - } + } if ((test->settings->bytes != 0 || test->settings->blocks != 0) && ! duration_flag) test->duration = 0; @@ -1687,7 +1687,7 @@ iperf_check_total_rate(struct iperf_test *test, iperf_size_t last_interval_bytes if (test->done || test->settings->bitrate_limit == 0) // Continue only if check should be done return; - + /* Add last inetrval's transferred bytes to the array */ if (++test->bitrate_limit_last_interval_index >= test->settings->bitrate_limit_stats_per_interval) test->bitrate_limit_last_interval_index = 0; @@ -1697,7 +1697,7 @@ iperf_check_total_rate(struct iperf_test *test, iperf_size_t last_interval_bytes test->bitrate_limit_stats_count += 1; if (test->bitrate_limit_stats_count < test->settings->bitrate_limit_stats_per_interval) return; - + /* Calculating total bytes traffic to be averaged */ for (total_bytes = 0, i = 0; i < test->settings->bitrate_limit_stats_per_interval; i++) { total_bytes += test->bitrate_limit_intervals_traffic_bytes[i]; @@ -2062,7 +2062,7 @@ send_parameters(struct iperf_test *test) i_errno = IESENDPARAMS; return -1; } - + cJSON_AddStringToObject(j, "authtoken", test->settings->authtoken); } #endif // HAVE_SSL @@ -2595,7 +2595,7 @@ iperf_new_test() i_errno = IENEWTEST; return NULL; } - memset(test->bitrate_limit_intervals_traffic_bytes, 0, sizeof(sizeof(iperf_size_t) * MAX_INTERVAL)); + memset(test->bitrate_limit_intervals_traffic_bytes, 0, sizeof(sizeof(iperf_size_t) * MAX_INTERVAL)); /* By default all output goes to stdout */ test->outfile = stdout; @@ -2622,7 +2622,7 @@ protocol_new(void) void protocol_free(struct protocol *proto) { - free(proto); + free(proto); } /**************************************************************************/ @@ -2827,7 +2827,7 @@ iperf_free_test(struct iperf_test *test) /* Free protocol list */ while (!SLIST_EMPTY(&test->protocols)) { prot = SLIST_FIRST(&test->protocols); - SLIST_REMOVE_HEAD(&test->protocols, protocols); + SLIST_REMOVE_HEAD(&test->protocols, protocols); free(prot); } @@ -2929,7 +2929,7 @@ iperf_reset_test(struct iperf_test *test) CPU_ZERO(&test->cpumask); #endif /* HAVE_CPUSET_SETAFFINITY */ test->state = 0; - + test->ctrl_sck = -1; test->prot_listener = -1; @@ -2954,7 +2954,7 @@ iperf_reset_test(struct iperf_test *test) FD_ZERO(&test->read_set); FD_ZERO(&test->write_set); - + test->num_streams = 1; test->settings->socket_bufsize = 0; test->settings->blksize = DEFAULT_TCP_BLKSIZE; @@ -3061,7 +3061,7 @@ iperf_stats_callback(struct iperf_test *test) // Total bytes transferred this interval total_interval_bytes_transferred += rp->bytes_sent_this_interval + rp->bytes_received_this_interval; - + irp = TAILQ_LAST(&rp->interval_results, irlisthead); /* result->end_time contains timestamp of previous interval */ if ( irp != NULL ) /* not the 1st interval */ @@ -3086,7 +3086,7 @@ iperf_stats_callback(struct iperf_test *test) if (temp.snd_cwnd > rp->stream_max_snd_cwnd) { rp->stream_max_snd_cwnd = temp.snd_cwnd; } - + temp.snd_wnd = get_snd_wnd(&temp); if (temp.snd_wnd > rp->stream_max_snd_wnd) { rp->stream_max_snd_wnd = temp.snd_wnd; @@ -3843,8 +3843,8 @@ iperf_print_results(struct iperf_test *test) /** * Main report-printing callback. - * Prints results either during a test (interval report only) or - * after the entire test has been run (last interval report plus + * Prints results either during a test (interval report only) or + * after the entire test has been run (last interval report plus * overall summary). */ void @@ -3861,7 +3861,7 @@ iperf_reporter_callback(struct iperf_test *test) iperf_print_intermediate(test); iperf_print_results(test); break; - } + } } @@ -3939,12 +3939,12 @@ print_interval_results(struct iperf_test *test, struct iperf_stream *sp, cJSON * bandwidth = 0.0; } unit_snprintf(nbuf, UNIT_LEN, bandwidth, test->settings->unit_format); - + iperf_time_diff(&sp->result->start_time, &irp->interval_start_time, &temp_time); st = iperf_time_in_secs(&temp_time); iperf_time_diff(&sp->result->start_time, &irp->interval_end_time, &temp_time); et = iperf_time_in_secs(&temp_time); - + if (test->protocol->id == Ptcp || test->protocol->id == Psctp) { if (test->sender_has_retransmits == 1 && sp->sender) { /* Interval, TCP with retransmits. */ @@ -4052,7 +4052,7 @@ iperf_new_stream(struct iperf_test *test, int s, int sender) memset(sp->result, 0, sizeof(struct iperf_stream_result)); TAILQ_INIT(&sp->result->interval_results); - + /* Create and randomize the buffer */ sp->buffer_fd = mkstemp(template); if (sp->buffer_fd == -1) { @@ -4246,20 +4246,20 @@ diskfile_send(struct iperf_stream *sp) buffer_left += r; rtot += r; if (sp->test->debug) { - printf("read %d bytes from file, %d total\n", r, rtot); + printf("read %d bytes from file, %d total\n", r, rtot); } // If the buffer doesn't contain a full buffer at this point, // adjust the size of the data to send. if (buffer_left != sp->test->settings->blksize) { - if (sp->test->debug) + if (sp->test->debug) printf("possible eof\n"); - // setting data size to be sent, - // which is less than full block/buffer size + // setting data size to be sent, + // which is less than full block/buffer size // (to be used by iperf_tcp_send, etc.) - sp->pending_size = buffer_left; + sp->pending_size = buffer_left; } - + // If there's no work left, we're done. if (buffer_left == 0) { sp->test->done = 1; @@ -4268,9 +4268,9 @@ diskfile_send(struct iperf_stream *sp) } } - // If there's no data left in the file or in the buffer, we're done. - // No more data available to be sent. - // Return without sending data to the network + // If there's no data left in the file or in the buffer, we're done. + // No more data available to be sent. + // Return without sending data to the network if( sp->test->done || buffer_left == 0 ){ if (sp->test->debug) printf("already done\n"); @@ -4391,10 +4391,10 @@ iperf_create_pidfile(struct iperf_test *test) } } } - + /* - * File didn't exist, we couldn't read it, or it didn't correspond to - * a running process. Try to create it. + * File didn't exist, we couldn't read it, or it didn't correspond to + * a running process. Try to create it. */ fd = open(test->pidfile, O_WRONLY | O_CREAT | O_TRUNC, S_IRUSR|S_IWUSR); if (fd < 0) { diff --git a/src/iperf_api.h b/src/iperf_api.h index cb4a86d..ff35d00 100644 --- a/src/iperf_api.h +++ b/src/iperf_api.h @@ -429,7 +429,7 @@ enum { /* Stream errors */ IECREATESTREAM = 200, // Unable to create a new stream (check herror/perror) IEINITSTREAM = 201, // Unable to initialize stream (check herror/perror) - IESTREAMLISTEN = 202, // Unable to start stream listener (check perror) + IESTREAMLISTEN = 202, // Unable to start stream listener (check perror) IESTREAMCONNECT = 203, // Unable to connect stream (check herror/perror) IESTREAMACCEPT = 204, // Unable to accepte stream connection (check perror) IESTREAMWRITE = 205, // Unable to write to stream socket (check perror) diff --git a/src/iperf_auth.c b/src/iperf_auth.c index cf85c4c..867c55f 100644 --- a/src/iperf_auth.c +++ b/src/iperf_auth.c @@ -163,11 +163,11 @@ EVP_PKEY *load_pubkey_from_file(const char *file) { if (file) { key = BIO_new_file(file, "r"); pkey = PEM_read_bio_PUBKEY(key, NULL, NULL, NULL); - + BIO_free(key); } return (pkey); -} +} EVP_PKEY *load_pubkey_from_base64(const char *buffer) { unsigned char *key = NULL; @@ -250,14 +250,14 @@ int encrypt_rsa_message(const char *plaintext, EVP_PKEY *public_key, unsigned ch fprintf(stderr, "%s\n", ERR_error_string(ERR_get_error(), NULL)); } - return encryptedtext_len; + return encryptedtext_len; } int decrypt_rsa_message(const unsigned char *encryptedtext, const int encryptedtext_len, EVP_PKEY *private_key, unsigned char **plaintext) { RSA *rsa = NULL; unsigned char *rsa_buffer = NULL, pad = RSA_PKCS1_PADDING; int plaintext_len, rsa_buffer_len, keysize; - + rsa = EVP_PKEY_get1_RSA(private_key); keysize = RSA_size(rsa); @@ -385,5 +385,3 @@ ssize_t iperf_getpass (char **lineptr, size_t *n, FILE *stream) { return nread; } - - diff --git a/src/iperf_client_api.c b/src/iperf_client_api.c index e7031b3..fd148c5 100644 --- a/src/iperf_client_api.c +++ b/src/iperf_client_api.c @@ -78,7 +78,7 @@ iperf_create_streams(struct iperf_test *test, int sender) errno = saved_errno; i_errno = IESETCONGESTION; return -1; - } + } } { socklen_t len = TCP_CA_NAME_MAX; @@ -172,7 +172,7 @@ create_client_timers(struct iperf_test * test) i_errno = IEINITTEST; return -1; } - } + } if (test->stats_interval != 0) { test->stats_timer = tmr_create(&now, client_stats_timer_proc, cd, test->stats_interval * SEC_TO_US, 1); if (test->stats_timer == NULL) { @@ -548,7 +548,7 @@ iperf_run_client(struct iperf_test * test) } } - + if (result > 0) { if (rcv_timeout_us > 0) { iperf_time_now(&last_receive_time); diff --git a/src/iperf_error.c b/src/iperf_error.c index bb985bc..552fcb3 100644 --- a/src/iperf_error.c +++ b/src/iperf_error.c @@ -400,7 +400,7 @@ iperf_strerror(int int_errno) perr = 1; break; case IESETCONGESTION: - snprintf(errstr, len, "unable to set TCP_CONGESTION: " + snprintf(errstr, len, "unable to set TCP_CONGESTION: " "Supplied congestion control algorithm not supported on this host"); break; case IEPIDFILE: diff --git a/src/iperf_locale.c b/src/iperf_locale.c index 6a43e27..284daac 100644 --- a/src/iperf_locale.c +++ b/src/iperf_locale.c @@ -1,4 +1,4 @@ -/*--------------------------------------------------------------- +/*--------------------------------------------------------------- * iperf, Copyright (c) 2014-2021, The Regents of the University of * California, through Lawrence Berkeley National Laboratory (subject * to receipt of any required approvals from the U.S. Dept. of @@ -27,49 +27,49 @@ * Based on code that is: * * Copyright (c) 1999,2000,2001,2002,2003 - * The Board of Trustees of the University of Illinois - * All Rights Reserved. - *--------------------------------------------------------------- - * Permission is hereby granted, free of charge, to any person - * obtaining a copy of this software (Iperf) and associated - * documentation files (the "Software"), to deal in the Software - * without restriction, including without limitation the - * rights to use, copy, modify, merge, publish, distribute, - * sublicense, and/or sell copies of the Software, and to permit + * The Board of Trustees of the University of Illinois + * All Rights Reserved. + *--------------------------------------------------------------- + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software (Iperf) and associated + * documentation files (the "Software"), to deal in the Software + * without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, + * sublicense, and/or sell copies of the Software, and to permit * persons to whom the Software is furnished to do - * so, subject to the following conditions: + * so, subject to the following conditions: * - * - * Redistributions of source code must retain the above - * copyright notice, this list of conditions and - * the following disclaimers. * - * - * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimers in the documentation and/or other materials - * provided with the distribution. - * - * - * Neither the names of the University of Illinois, NCSA, - * nor the names of its contributors may be used to endorse + * Redistributions of source code must retain the above + * copyright notice, this list of conditions and + * the following disclaimers. + * + * + * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimers in the documentation and/or other materials + * provided with the distribution. + * + * + * Neither the names of the University of Illinois, NCSA, + * nor the names of its contributors may be used to endorse * or promote products derived from this Software without - * specific prior written permission. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES - * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - * NONINFRINGEMENT. IN NO EVENT SHALL THE CONTIBUTORS OR COPYRIGHT - * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, - * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * specific prior written permission. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE CONTIBUTORS OR COPYRIGHT + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, * ARISING FROM, OUT OF OR IN CONNECTION WITH THE - * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * ________________________________________________________________ - * National Laboratory for Applied Network Research - * National Center for Supercomputing Applications - * University of Illinois at Urbana-Champaign + * National Laboratory for Applied Network Research + * National Center for Supercomputing Applications + * University of Illinois at Urbana-Champaign * http://www.ncsa.uiuc.edu - * ________________________________________________________________ + * ________________________________________________________________ * * Locale.c * by Ajay Tirumala @@ -115,7 +115,7 @@ const char usage_longstr[] = "Usage: iperf3 [-s|-c host] [options]\n" " --forceflush force flushing output at every interval\n" " --timestamps<=format> emit a timestamp at the start of each output line\n" " (optional \"=\" and format string as per strftime(3))\n" - + " --rcv-timeout # idle timeout for receiving data\n" " (default %d ms)\n" " -d, --debug emit debugging output\n" @@ -201,7 +201,7 @@ const char usage_longstr[] = "Usage: iperf3 [-s|-c host] [options]\n" " --rsa-public-key-path path to the RSA public key used to encrypt\n" " authentication credentials\n" #endif //HAVESSL - + #ifdef NOT_YET_SUPPORTED /* still working on these */ #endif diff --git a/src/iperf_sctp.c b/src/iperf_sctp.c index 0686fd9..ceccdc1 100644 --- a/src/iperf_sctp.c +++ b/src/iperf_sctp.c @@ -82,7 +82,7 @@ iperf_sctp_recv(struct iperf_stream *sp) } -/* iperf_sctp_send +/* iperf_sctp_send * * sends the data for SCTP */ @@ -94,7 +94,7 @@ iperf_sctp_send(struct iperf_stream *sp) r = Nwrite(sp->socket, sp->buffer, sp->settings->blksize, Psctp); if (r < 0) - return r; + return r; sp->result->bytes_sent += r; sp->result->bytes_sent_this_interval += r; @@ -165,7 +165,7 @@ iperf_sctp_listen(struct iperf_test *test) int s, opt, saved_errno; close(test->listener); - + snprintf(portstr, 6, "%d", test->server_port); memset(&hints, 0, sizeof(hints)); /* @@ -227,13 +227,13 @@ iperf_sctp_listen(struct iperf_test *test) } #if defined(IPV6_V6ONLY) && !defined(__OpenBSD__) - if (res->ai_family == AF_INET6 && (test->settings->domain == AF_UNSPEC || + if (res->ai_family == AF_INET6 && (test->settings->domain == AF_UNSPEC || test->settings->domain == AF_INET6)) { if (test->settings->domain == AF_UNSPEC) opt = 0; else opt = 1; - if (setsockopt(s, IPPROTO_IPV6, IPV6_V6ONLY, + if (setsockopt(s, IPPROTO_IPV6, IPV6_V6ONLY, (char *) &opt, sizeof(opt)) < 0) { saved_errno = errno; close(s); @@ -280,7 +280,7 @@ iperf_sctp_listen(struct iperf_test *test) } test->listener = s; - + return s; #else i_errno = IENOSCTP; diff --git a/src/iperf_server_api.c b/src/iperf_server_api.c index 480c930..18771f0 100644 --- a/src/iperf_server_api.c +++ b/src/iperf_server_api.c @@ -141,14 +141,14 @@ iperf_accept(struct iperf_test *test) return -1; if (iperf_exchange_parameters(test) < 0) return -1; - if (test->server_affinity != -1) + if (test->server_affinity != -1) if (iperf_setaffinity(test, test->server_affinity) != 0) return -1; if (test->on_connect) test->on_connect(test); } else { /* - * Don't try to read from the socket. It could block an ongoing test. + * Don't try to read from the socket. It could block an ongoing test. * Just send ACCESS_DENIED. * Also, if sending failed, don't return an error, as the request is not related * to the ongoing test, and returning an error will terminate the test. @@ -325,7 +325,7 @@ create_server_timers(struct iperf_test * test) static void server_omit_timer_proc(TimerClientData client_data, struct iperf_time *nowP) -{ +{ struct iperf_test *test = client_data.p; test->omit_timer = NULL; @@ -345,7 +345,7 @@ static int create_server_omit_timer(struct iperf_test * test) { struct iperf_time now; - TimerClientData cd; + TimerClientData cd; if (test->omit == 0) { test->omit_timer = NULL; @@ -353,11 +353,11 @@ create_server_omit_timer(struct iperf_test * test) } else { if (iperf_time_now(&now) < 0) { i_errno = IEINITTEST; - return -1; + return -1; } test->omitting = 1; cd.p = test; - test->omit_timer = tmr_create(&now, server_omit_timer_proc, cd, test->omit * SEC_TO_US, 0); + test->omit_timer = tmr_create(&now, server_omit_timer_proc, cd, test->omit * SEC_TO_US, 0); if (test->omit_timer == NULL) { i_errno = IEINITTEST; return -1; @@ -439,7 +439,7 @@ iperf_run_server(struct iperf_test *test) if (iperf_open_logfile(test) < 0) return -1; - if (test->affinity != -1) + if (test->affinity != -1) if (iperf_setaffinity(test, test->affinity) != 0) return -2; @@ -475,7 +475,7 @@ iperf_run_server(struct iperf_test *test) if (test->bitrate_limit_exceeded) { cleanup_server(test); i_errno = IETOTALRATE; - return -1; + return -1; } memcpy(&read_set, &test->read_set, sizeof(fd_set)); @@ -576,12 +576,12 @@ iperf_run_server(struct iperf_test *test) cleanup_server(test); return -1; } - FD_CLR(test->ctrl_sck, &read_set); + FD_CLR(test->ctrl_sck, &read_set); } if (test->state == CREATE_STREAMS) { if (FD_ISSET(test->prot_listener, &read_set)) { - + if ((s = test->protocol->accept(test)) < 0) { cleanup_server(test); return -1; @@ -613,7 +613,7 @@ iperf_run_server(struct iperf_test *test) i_errno = IESETCONGESTION; return -1; } - } + } } { socklen_t len = TCP_CA_NAME_MAX; @@ -628,7 +628,7 @@ iperf_run_server(struct iperf_test *test) i_errno = IESETCONGESTION; return -1; } - /* + /* * If not the first connection, discard prior * congestion algorithm name so we don't leak * duplicated strings. We probably don't need @@ -696,7 +696,7 @@ iperf_run_server(struct iperf_test *test) if (test->protocol->id != Ptcp) { FD_CLR(test->prot_listener, &test->read_set); close(test->prot_listener); - } else { + } else { if (test->no_delay || test->settings->mss || test->settings->socket_bufsize) { FD_CLR(test->listener, &test->read_set); close(test->listener); @@ -794,11 +794,11 @@ iperf_run_server(struct iperf_test *test) if (test->json_output) { if (iperf_json_finish(test) < 0) return -1; - } + } iflush(test); - if (test->server_affinity != -1) + if (test->server_affinity != -1) if (iperf_clearaffinity(test) != 0) return -1; diff --git a/src/iperf_tcp.c b/src/iperf_tcp.c index ef0ef72..d5b5b78 100644 --- a/src/iperf_tcp.c +++ b/src/iperf_tcp.c @@ -76,7 +76,7 @@ iperf_tcp_recv(struct iperf_stream *sp) } -/* iperf_tcp_send +/* iperf_tcp_send * * sends the data for TCP */ @@ -282,9 +282,9 @@ iperf_tcp_listen(struct iperf_test *test) if (res->ai_family == AF_INET6 && (test->settings->domain == AF_UNSPEC || test->settings->domain == AF_INET)) { if (test->settings->domain == AF_UNSPEC) opt = 0; - else + else opt = 1; - if (setsockopt(s, IPPROTO_IPV6, IPV6_V6ONLY, + if (setsockopt(s, IPPROTO_IPV6, IPV6_V6ONLY, (char *) &opt, sizeof(opt)) < 0) { saved_errno = errno; close(s); @@ -314,7 +314,7 @@ iperf_tcp_listen(struct iperf_test *test) test->listener = s; } - + /* Read back and verify the sender socket buffer size */ optlen = sizeof(sndbuf_actual); if (getsockopt(s, SOL_SOCKET, SO_SNDBUF, &sndbuf_actual, &optlen) < 0) { @@ -589,7 +589,7 @@ iperf_tcp_connect(struct iperf_test *test) errno = saved_errno; i_errno = IESETFLOW; return -1; - } + } } } #endif /* HAVE_FLOWLABEL */ diff --git a/src/iperf_time.c b/src/iperf_time.c index 5f94dc0..a435dd3 100644 --- a/src/iperf_time.c +++ b/src/iperf_time.c @@ -89,13 +89,13 @@ iperf_time_in_usecs(struct iperf_time *time) double iperf_time_in_secs(struct iperf_time *time) { - return time->secs + time->usecs / 1000000.0; + return time->secs + time->usecs / 1000000.0; } /* iperf_time_compare * * Compare two timestamps - * + * * Returns -1 if time1 is earlier, 1 if time1 is later, * or 0 if the timestamps are equal. */ @@ -121,7 +121,7 @@ iperf_time_compare(struct iperf_time *time1, struct iperf_time *time2) * * Returns 1 if the time1 is less than or equal to time2, otherwise 0. */ -int +int iperf_time_diff(struct iperf_time *time1, struct iperf_time *time2, struct iperf_time *diff) { int past = 0; @@ -132,7 +132,7 @@ iperf_time_diff(struct iperf_time *time1, struct iperf_time *time2, struct iperf diff->secs = 0; diff->usecs = 0; past = 1; - } + } else if (cmp == 1) { diff->secs = time1->secs - time2->secs; diff->usecs = time1->usecs; diff --git a/src/iperf_udp.c b/src/iperf_udp.c index 126cd63..18c4b93 100644 --- a/src/iperf_udp.c +++ b/src/iperf_udp.c @@ -150,7 +150,7 @@ iperf_udp_recv(struct iperf_stream *sp) sp->packet_count = pcount; } else { - /* + /* * Sequence number went backward (or was stationary?!?). * This counts as an out-of-order packet. */ @@ -164,9 +164,9 @@ iperf_udp_recv(struct iperf_stream *sp) */ if (sp->cnt_error > 0) sp->cnt_error--; - + /* Log the out-of-order packet */ - if (sp->test->debug) + if (sp->test->debug) fprintf(stderr, "OUT OF ORDER - incoming packet sequence %" PRIu64 " but expected sequence %d on stream %d", pcount, sp->packet_count + 1, sp->socket); } @@ -228,11 +228,11 @@ iperf_udp_send(struct iperf_stream *sp) sec = htonl(before.secs); usec = htonl(before.usecs); pcount = htobe64(sp->packet_count); - + memcpy(sp->buffer, &sec, sizeof(sec)); memcpy(sp->buffer+4, &usec, sizeof(usec)); memcpy(sp->buffer+8, &pcount, sizeof(pcount)); - + } else { @@ -241,11 +241,11 @@ iperf_udp_send(struct iperf_stream *sp) sec = htonl(before.secs); usec = htonl(before.usecs); pcount = htonl(sp->packet_count); - + memcpy(sp->buffer, &sec, sizeof(sec)); memcpy(sp->buffer+4, &usec, sizeof(usec)); memcpy(sp->buffer+8, &pcount, sizeof(pcount)); - + } r = Nwrite(sp->socket, sp->buffer, size, Pudp); @@ -291,7 +291,7 @@ iperf_udp_buffercheck(struct iperf_test *test, int s) */ int opt; socklen_t optlen; - + if ((opt = test->settings->socket_bufsize)) { if (setsockopt(s, SOL_SOCKET, SO_RCVBUF, &opt, sizeof(opt)) < 0) { i_errno = IESETBUF; @@ -412,7 +412,7 @@ iperf_udp_accept(struct iperf_test *test) return rc; } } - + #if defined(HAVE_SO_MAX_PACING_RATE) /* If socket pacing is specified, try it. */ if (test->settings->fqrate) { @@ -524,7 +524,7 @@ iperf_udp_connect(struct iperf_test *test) return rc; } } - + #if defined(HAVE_SO_MAX_PACING_RATE) /* If socket pacing is available and not disabled, try it. */ if (test->settings->fqrate) { @@ -562,7 +562,7 @@ iperf_udp_connect(struct iperf_test *test) */ buf = 123456789; /* this can be pretty much anything */ if (write(s, &buf, sizeof(buf)) < 0) { - // XXX: Should this be changed to IESTREAMCONNECT? + // XXX: Should this be changed to IESTREAMCONNECT? i_errno = IESTREAMWRITE; return -1; } diff --git a/src/iperf_util.c b/src/iperf_util.c index 8155270..d5795ee 100644 --- a/src/iperf_util.c +++ b/src/iperf_util.c @@ -128,7 +128,7 @@ make_cookie(const char *cookie) /* is_closed * * Test if the file descriptor fd is closed. - * + * * Iperf uses this function to test whether a TCP stream socket * is closed, because accepting and denying an invalid connection * in iperf_tcp_accept is not considered an error. @@ -176,7 +176,7 @@ double timeval_diff(struct timeval * tv0, struct timeval * tv1) { double time1, time2; - + time1 = tv0->tv_sec + (tv0->tv_usec / 1000000.0); time2 = tv1->tv_sec + (tv1->tv_usec / 1000000.0); @@ -232,7 +232,7 @@ get_system_info(void) memset(buf, 0, 1024); uname(&uts); - snprintf(buf, sizeof(buf), "%s %s %s %s %s", uts.sysname, uts.nodename, + snprintf(buf, sizeof(buf), "%s %s %s %s %s", uts.sysname, uts.nodename, uts.release, uts.version, uts.machine); return buf; @@ -249,44 +249,44 @@ get_optional_features(void) #if defined(HAVE_CPU_AFFINITY) if (numfeatures > 0) { - strncat(features, ", ", + strncat(features, ", ", sizeof(features) - strlen(features) - 1); } - strncat(features, "CPU affinity setting", + strncat(features, "CPU affinity setting", sizeof(features) - strlen(features) - 1); numfeatures++; #endif /* HAVE_CPU_AFFINITY */ - + #if defined(HAVE_FLOWLABEL) if (numfeatures > 0) { - strncat(features, ", ", + strncat(features, ", ", sizeof(features) - strlen(features) - 1); } - strncat(features, "IPv6 flow label", + strncat(features, "IPv6 flow label", sizeof(features) - strlen(features) - 1); numfeatures++; #endif /* HAVE_FLOWLABEL */ - + #if defined(HAVE_SCTP_H) if (numfeatures > 0) { - strncat(features, ", ", + strncat(features, ", ", sizeof(features) - strlen(features) - 1); } - strncat(features, "SCTP", + strncat(features, "SCTP", sizeof(features) - strlen(features) - 1); numfeatures++; #endif /* HAVE_SCTP_H */ - + #if defined(HAVE_TCP_CONGESTION) if (numfeatures > 0) { - strncat(features, ", ", + strncat(features, ", ", sizeof(features) - strlen(features) - 1); } - strncat(features, "TCP congestion algorithm setting", + strncat(features, "TCP congestion algorithm setting", sizeof(features) - strlen(features) - 1); numfeatures++; #endif /* HAVE_TCP_CONGESTION */ - + #if defined(HAVE_SENDFILE) if (numfeatures > 0) { strncat(features, ", ", @@ -338,7 +338,7 @@ get_optional_features(void) #endif /* HAVE_DONT_FRAGMENT */ if (numfeatures == 0) { - strncat(features, "None", + strncat(features, "None", sizeof(features) - strlen(features) - 1); } @@ -476,8 +476,8 @@ int daemon(int nochdir, int noclose) /* * Fork again to avoid becoming a session leader. - * This might only matter on old SVr4-derived OSs. - * Note in particular that glibc and FreeBSD libc + * This might only matter on old SVr4-derived OSs. + * Note in particular that glibc and FreeBSD libc * only fork once. */ pid = fork(); diff --git a/src/main.c b/src/main.c index c2dbd2e..0b3b20a 100644 --- a/src/main.c +++ b/src/main.c @@ -74,7 +74,7 @@ main(int argc, char **argv) fprintf(stderr, "setting priority to valid level\n"); rc = setpriority(PRIO_PROCESS, 0, 0); } - + /* setting the affinity of the process */ cpu_set_t cpu_set; int affinity = -1; diff --git a/src/net.c b/src/net.c index 2c3aaf3..f73ae28 100644 --- a/src/net.c +++ b/src/net.c @@ -241,7 +241,7 @@ netannounce(int domain, int proto, const char *local, const char *bind_dev, int snprintf(portstr, 6, "%d", port); memset(&hints, 0, sizeof(hints)); - /* + /* * If binding to the wildcard address with no explicit address * family specified, then force us to get an AF_INET6 socket. On * CentOS 6 and MacOS, getaddrinfo(3) with AF_UNSPEC in ai_family, @@ -262,7 +262,7 @@ netannounce(int domain, int proto, const char *local, const char *bind_dev, int hints.ai_socktype = proto; hints.ai_flags = AI_PASSIVE; if ((gerror = getaddrinfo(local, portstr, &hints, &res)) != 0) - return -1; + return -1; s = socket(res->ai_family, proto, 0); if (s < 0) { @@ -285,7 +285,7 @@ netannounce(int domain, int proto, const char *local, const char *bind_dev, int } opt = 1; - if (setsockopt(s, SOL_SOCKET, SO_REUSEADDR, + if (setsockopt(s, SOL_SOCKET, SO_REUSEADDR, (char *) &opt, sizeof(opt)) < 0) { saved_errno = errno; close(s); @@ -307,7 +307,7 @@ netannounce(int domain, int proto, const char *local, const char *bind_dev, int opt = 0; else opt = 1; - if (setsockopt(s, IPPROTO_IPV6, IPV6_V6ONLY, + if (setsockopt(s, IPPROTO_IPV6, IPV6_V6ONLY, (char *) &opt, sizeof(opt)) < 0) { saved_errno = errno; close(s); @@ -327,7 +327,7 @@ netannounce(int domain, int proto, const char *local, const char *bind_dev, int } freeaddrinfo(res); - + if (proto == SOCK_STREAM) { if (listen(s, INT_MAX) < 0) { saved_errno = errno; diff --git a/src/portable_endian.h b/src/portable_endian.h index 85a6147..6b996b3 100644 --- a/src/portable_endian.h +++ b/src/portable_endian.h @@ -49,12 +49,12 @@ # define htole16(x) OSSwapHostToLittleInt16(x) # define be16toh(x) OSSwapBigToHostInt16(x) # define le16toh(x) OSSwapLittleToHostInt16(x) - + # define htobe32(x) OSSwapHostToBigInt32(x) # define htole32(x) OSSwapHostToLittleInt32(x) # define be32toh(x) OSSwapBigToHostInt32(x) # define le32toh(x) OSSwapLittleToHostInt32(x) - + # define htobe64(x) OSSwapHostToBigInt64(x) # define htole64(x) OSSwapHostToLittleInt64(x) # define be64toh(x) OSSwapBigToHostInt64(x) @@ -95,12 +95,12 @@ # define htole16(x) (x) # define be16toh(x) ntohs(x) # define le16toh(x) (x) - + # define htobe32(x) htonl(x) # define htole32(x) (x) # define be32toh(x) ntohl(x) # define le32toh(x) (x) - + # define htobe64(x) htonll(x) # define htole64(x) (x) # define be64toh(x) ntohll(x) @@ -113,12 +113,12 @@ # define htole16(x) __builtin_bswap16(x) # define be16toh(x) (x) # define le16toh(x) __builtin_bswap16(x) - + # define htobe32(x) (x) # define htole32(x) __builtin_bswap32(x) # define be32toh(x) (x) # define le32toh(x) __builtin_bswap32(x) - + # define htobe64(x) (x) # define htole64(x) __builtin_bswap64(x) # define be64toh(x) (x) @@ -173,4 +173,3 @@ #endif #endif - diff --git a/src/queue.h b/src/queue.h index 38130e0..f741a4c 100644 --- a/src/queue.h +++ b/src/queue.h @@ -36,7 +36,7 @@ #define _SYS_QUEUE_H_ /* - * This file defines five types of data structures: singly-linked lists, + * This file defines five types of data structures: singly-linked lists, * lists, simple queues, tail queues, and circular queues. * * @@ -95,15 +95,15 @@ struct name { \ struct type *slh_first; /* first element */ \ } - + #define SLIST_HEAD_INITIALIZER(head) \ { NULL } - + #define SLIST_ENTRY(type) \ struct { \ struct type *sle_next; /* next element */ \ } - + /* * Singly-linked List access methods. */ @@ -318,8 +318,8 @@ struct { \ struct type **tqe_prev; /* address of previous next element */ \ } -/* - * tail queue access methods +/* + * tail queue access methods */ #define TAILQ_FIRST(head) ((head)->tqh_first) #define TAILQ_END(head) NULL @@ -426,7 +426,7 @@ struct { \ } /* - * Circular queue access methods + * Circular queue access methods */ #define CIRCLEQ_FIRST(head) ((head)->cqh_first) #define CIRCLEQ_LAST(head) ((head)->cqh_last) diff --git a/src/t_auth.c b/src/t_auth.c index ff9cffe..22c78ae 100644 --- a/src/t_auth.c +++ b/src/t_auth.c @@ -54,7 +54,7 @@ main(int argc, char **argv) const char sha256String[] = "This is a SHA256 test."; const char sha256Digest[] = "4816482f8b4149f687a1a33d61a0de6b611364ec0fb7adffa59ff2af672f7232"; /* echo -n "This is a SHA256 test." | shasum -a256 */ char sha256Output[65]; - + sha256(sha256String, sha256Output); assert(strcmp(sha256Output, sha256Digest) == 0); diff --git a/src/t_timer.c b/src/t_timer.c index 9598594..8eec7d8 100644 --- a/src/t_timer.c +++ b/src/t_timer.c @@ -48,7 +48,7 @@ timer_proc( TimerClientData client_data, struct iperf_time* nowP ) } -int +int main(int argc, char **argv) { Timer *tp; diff --git a/src/t_units.c b/src/t_units.c index 8fd8bd9..73f21a9 100644 --- a/src/t_units.c +++ b/src/t_units.c @@ -34,7 +34,7 @@ #include "iperf.h" #include "units.h" -int +int main(int argc, char **argv) { iperf_size_t llu; diff --git a/src/tcp_info.c b/src/tcp_info.c index 63c7bbc..6b75384 100644 --- a/src/tcp_info.c +++ b/src/tcp_info.c @@ -27,9 +27,9 @@ /* * routines related to collection TCP_INFO using getsockopt() - * + * * Brian Tierney, ESnet (bltierney@es.net) - * + * * Note that this is only really useful on Linux. * XXX: only standard on linux versions 2.4 and later # @@ -75,7 +75,7 @@ has_tcpinfo_retransmits(void) #if defined(linux) && defined(TCP_MD5SIG) /* TCP_MD5SIG doesn't actually have anything to do with TCP ** retransmits, it just showed up in the same rev of the header - ** file. If it's present then struct tcp_info has the + ** file. If it's present then struct tcp_info has the ** tcpi_total_retrans field that we need; if not, not. */ return 1; @@ -220,7 +220,7 @@ build_tcpinfo_message(struct iperf_interval_results *r, char *message) #if defined(linux) && defined(TCP_INFO) sprintf(message, report_tcpInfo, r->tcpInfo.tcpi_snd_cwnd, r->tcpInfo.tcpi_snd_ssthresh, r->tcpInfo.tcpi_rcv_ssthresh, r->tcpInfo.tcpi_unacked, r->tcpInfo.tcpi_sacked, - r->tcpInfo.tcpi_lost, r->tcpInfo.tcpi_retrans, r->tcpInfo.tcpi_fackets, + r->tcpInfo.tcpi_lost, r->tcpInfo.tcpi_retrans, r->tcpInfo.tcpi_fackets, r->tcpInfo.tcpi_rtt, r->tcpInfo.tcpi_reordering); #endif #if defined(__FreeBSD__) && defined(TCP_INFO) diff --git a/src/timer.c b/src/timer.c index 33923c7..644eeab 100644 --- a/src/timer.c +++ b/src/timer.c @@ -203,7 +203,7 @@ void tmr_reset( struct iperf_time* nowP, Timer* t ) { struct iperf_time now; - + getnow( nowP, &now ); t->time = now; iperf_time_add_usecs( &t->time, t->usecs ); diff --git a/test_commands.sh b/test_commands.sh index abb9197..4026ebd 100755 --- a/test_commands.sh +++ b/test_commands.sh @@ -1,7 +1,7 @@ #!/bin/sh # # This is a set of commands to run and verify they work before doing a new release. -# Eventually they should also use the -J flag to generate JSON output, and a program should +# Eventually they should also use the -J flag to generate JSON output, and a program should # be written to check the output. # Be sure to test both client and server on Linux, BSD, and OSX # @@ -35,7 +35,7 @@ host=$1 # SCTP ./src/iperf3 -c "$host" --sctp -V -t 5 # parallel streams -./src/iperf3 -c "$host" -P 3 -t 5 +./src/iperf3 -c "$host" -P 3 -t 5 ./src/iperf3 -c "$host" -u -P 3 -t 5 # reverse mode ./src/iperf3 -c "$host" -P 2 -t 5 -R @@ -44,12 +44,12 @@ host=$1 ./src/iperf3 -c "$host" -P 2 -t 5 --bidir ./src/iperf3 -c "$host" -u -P 2 -t 5 --bidir # zero copy -./src/iperf3 -c "$host" -Z -t 5 +./src/iperf3 -c "$host" -Z -t 5 ./src/iperf3 -c "$host" -Z -t 5 -R # window size -./src/iperf3 -c "$host" -t 5 -w 8M +./src/iperf3 -c "$host" -t 5 -w 8M # -n flag -./src/iperf3 -c "$host" -n 5M +./src/iperf3 -c "$host" -n 5M ./src/iperf3 -c "$host" -n 5M -u -b1G # -n flag with -R ./src/iperf3 -c "$host" -n 5M -R @@ -57,7 +57,7 @@ host=$1 # conflicting -n -t flags ./src/iperf3 -c "$host" -n 5M -t 5 # -k mode -./src/iperf3 -c "$host" -k 1K +./src/iperf3 -c "$host" -k 1K ./src/iperf3 -c "$host" -k 1K -u -b1G # -k mode with -R ./src/iperf3 -c "$host" -k 1K -R @@ -71,5 +71,3 @@ host=$1 ./src/iperf3 -c "$host" -M 1000 -V # test congestion control option (linux only) ./src/iperf3 -c "$host" -C reno -V - -