From 1ac522ec39d5838a0dbe127046c5d843947701e5 Mon Sep 17 00:00:00 2001 From: sethdelliott Date: Thu, 8 Jul 2010 22:41:22 +0000 Subject: [PATCH] Fixed a bug where the server died on client interrupt. Also updated README, TODO, and man page. --- README | 35 +++++++++++- TODO | 12 ++-- src/iperf.1 | 122 +++++++++++++---------------------------- src/iperf_api.c | 2 +- src/iperf_server_api.c | 12 +++- 5 files changed, 84 insertions(+), 99 deletions(-) diff --git a/README b/README index d774f0e40..10bcc6a45 100644 --- a/README +++ b/README @@ -1,7 +1,15 @@ +Summary +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +iperf3 is a tool for measuring Internet bandwidth performance. This is iperf3, a tool for measuring Internet bandwidth performance. -iperf3 should work on Linux, FreeBSD, and Mac OSX +Supported platforms: + iperf3 should work on Linux, FreeBSD, and Mac OSX + + +Building iperf3 +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Prerequisites: libuuid: this is not installed by default for Debian/Ubuntu Systems @@ -9,7 +17,28 @@ Prerequisites: To build, just type 'make' (or 'gmake' on FreeBSD) -For more information see: http://code.google.com/p/iperf/ -Note that iperf3 is NOT backwards compatible with iperf2. +Release Notes +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +iperf - Version 3, beta 1 + +New in this version: + * TCP control socket now manages messages between client and server + * Dynamic server (gets test parameters from client) + - Server can now set test options dynamically without having to restart. + Currently supported options: -l, -t, -n, -P, -R + Future options: -u, -b, -w, -M, -N, -I, -T, -Z, -6 + * Results exchange + - Client can now see server results (and vice versa) + * Reverse mode (-R) + - Server sends, client receives + +Note: iperf3 is NOT backwards compatible with iperf2. + + +Documentation +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +For more information see: http://code.google.com/p/iperf/ diff --git a/TODO b/TODO index 9b4c7217f..73a36add6 100644 --- a/TODO +++ b/TODO @@ -3,18 +3,16 @@ Current list of things to fix/add to iperf3 - readd -Z option (linux tcp congestion control algoritm) - readd flag to set IP_TOS (-S) -- finish adding verbose and debug options -- separate iperf_api.c into iperf_client.c and iperf_utils.c +- support for setting TCP options (MSS, no delay, etc.) +- add verbose and debug options +- separate iperf_api.c into iperf_client.c and iperf_utils.c +- add full iperf API support and documentation - look for 'XXX' in code and address - much better/standard error handling throughout - better packaging/makefile, README, LICENCE, etc files -- finish/fix receive_result_from_server() - - should this be called for TCP too, or only UDP (currently its both, - but I think it should be UDP only, or maybe a command line option for TCP - document and verify the 'state machine'. Is it an error to send messages in the wrong order? - e.g.: what is "STREAM_RUNNING" vs "TEST_RUNNING"?? -- cleanup/fix/test UDP mode - add TCP control socket? +- add/test UDP mode use clock_nanosleep() for more accurate timing in Linux? (http://www.kernel.org/doc/man-pages/online/pages/man2/clock_nanosleep.2.html) fix server to handle both TCP and UDP diff --git a/src/iperf.1 b/src/iperf.1 index b6e4ce58a..aac07fe7d 100644 --- a/src/iperf.1 +++ b/src/iperf.1 @@ -1,4 +1,4 @@ -.TH IPERF 1 "APRIL 2008" NLANR/DAST "User Manuals" +.TH IPERF 1 "July 2010" NLANR/DAST "User Manuals" .SH NAME iperf \- perform network throughput tests .SH SYNOPSIS @@ -12,129 +12,79 @@ iperf \- perform network throughput tests .I options .B ] -.B iperf -u -s [ -.I options -.B ] -.B iperf -u -c -.I server -.B [ -.I options -.B ] .SH DESCRIPTION iperf is a tool for performing network throughput measurements. It can test either TCP or UDP throughput. To perform an iperf test the user must -establish both a server (to discard traffic) and a client (to generate -traffic). +establish both a server and a client. + + .SH "GENERAL OPTIONS" .TP +.BR -p ", " --port " \fIn\fR" +set server port to listen on/connect to to \fIn\fR (default 5201) +.TP .BR -f ", " --format " " [kmKM] format to report: Kbits, Mbits, KBytes, MBytes .TP -.BR -h ", " --help " " -print a help synopsis -.TP .BR -i ", " --interval " \fIn\fR" pause \fIn\fR seconds between periodic bandwidth reports .TP -.BR -l ", " --len " \fIn\fR[KM]" -set length read/write buffer to \fIn\fR (default 8 KB) -.TP .BR -m ", " --print_mss " " print TCP maximum segment size (MTU - TCP/IP header) .TP -.BR -o ", " --output " " -output the report or error message to this specified file -.TP -.BR -p ", " --port " \fIn\fR" -set server port to listen on/connect to to \fIn\fR (default 5001) -.TP -.BR -u ", " --udp " " -use UDP rather than TCP -.TP -.BR -w ", " --window " \fIn\fR[KM]" -TCP window size (socket buffer size) -.TP -.BR -B ", " --bind " " -bind to , an interface or multicast address -.TP -.BR -C ", " --compatibility " " -for use with older versions does not sent extra msgs -.TP -.BR -M ", " --mss " \fIn\fR" -set TCP maximum segment size (MTU - 40 bytes) -.TP -.BR -N ", " --nodelay " " -set TCP no delay, disabling Nagle's Algorithm +.BR -h ", " --help " " +print a help synopsis .TP .BR -v ", " --version " " print version information and quit -.TP -.BR -V ", " --IPv6Version " " -Set the domain to IPv6 -.TP -.BR -x ", " --reportexclude " " -[CDMSV] exclude C(connection) D(data) M(multicast) S(settings) V(server) reports -.TP -.BR -y ", " --reportstyle " C|c" -if set to C or c report results as CSV (comma separated values) + + .SH "SERVER SPECIFIC OPTIONS" .TP .BR -s ", " --server " " run in server mode -.TP -.BR -U ", " --single_udp " " -run in single threaded UDP mode -.TP -.BR -D ", " --daemon " " -run the server as a daemon + + .SH "CLIENT SPECIFIC OPTIONS" .TP -.BR -b ", " --bandwidth " \fIn\fR[KM]" -set target bandwidth to \fIn\fR bits/sec (default 1 Mbit/sec). -This setting requires UDP (-u). -.TP .BR -c ", " --client " " run in client mode, connecting to .TP -.BR -d ", " --dualtest " " -Do a bidirectional test simultaneously -.TP -.BR -n ", " --num " \fIn\fR[KM]" -number of bytes to transmit (instead of -t) -.TP -.BR -r ", " --tradeoff " " -Do a bidirectional test individually -.TP .BR -t ", " --time " \fIn\fR" time in seconds to transmit for (default 10 secs) .TP -.BR -F ", " --fileinput " " -input the data to be transmitted from a file -.TP -.BR -I ", " --stdin " " -input the data to be transmitted from stdin +.BR -n ", " --num " \fIn\fR[KM]" +number of bytes to transmit (instead of -t) .TP -.BR -L ", " --listenport " \fIn\fR" -port to recieve bidirectional tests back on +.BR -l ", " --len " \fIn\fR[KM]" +set length read/write buffer to \fIn\fR (default 128 KB) .TP .BR -P ", " --parallel " \fIn\fR" -number of parallel client threads to run +number of parallel client streams to run +.TP +.BR -R ", " --reverse +run in reverse mode (server sends, client receives) .TP -.BR -T ", " --ttl " \fIn\fR" -time-to-live, for multicast (default 1) +.BR -w ", " --window " \fIn\fR[KM]" +TCP window size (socket buffer size) .TP -.BR -Z ", " --linux-congestion " " -set TCP congestion control algorithm (Linux only) -.SH ENVIRONMENT +.BR -M ", " --mss " \fIn\fR" +set TCP maximum segment size (MTU - 40 bytes) .TP -.BR TCP_WINDOW_SIZE -Controls the size of TCP buffers. +.BR -N ", " --nodelay " " +set TCP no delay, disabling Nagle's Algorithm + + .SH DIAGNOSTICS This section needs to be filled in. + + .SH BUGS Exit statuses are inconsistent. -The threading implementation is rather heinous. +Could possibly block indefinitely under some circumstances. + + .SH AUTHORS Iperf was originally written by Mark Gates and Alex Warshavsky. Man page and maintence by Jon Dugan . @@ -144,5 +94,7 @@ Kevin Gibbs, John Estabrook , Andrew Gallatin , Stephen Hemminger + + .SH "SEE ALSO" -http://iperf.sourceforge.net/ +http://code.google.com/p/iperf/ diff --git a/src/iperf_api.c b/src/iperf_api.c index 496b0f11f..84fa8ae1c 100644 --- a/src/iperf_api.c +++ b/src/iperf_api.c @@ -1151,7 +1151,7 @@ iperf_run_client(struct iperf_test * test) signal(SIGINT, sig_handler); if (setjmp(env)) { - fprintf(stderr, "Interrupt received. Exiting...\n"); + fprintf(stderr, "Exiting...\n"); test->state = CLIENT_TERMINATE; if (Nwrite(test->ctrl_sck, &test->state, sizeof(char), Ptcp) < 0) { fprintf(stderr, "Unable to send CLIENT_TERMINATE message to serer\n"); diff --git a/src/iperf_server_api.c b/src/iperf_server_api.c index b04ec3707..0e4737bf6 100644 --- a/src/iperf_server_api.c +++ b/src/iperf_server_api.c @@ -267,8 +267,14 @@ iperf_handle_message_server(struct iperf_test *test) case IPERF_DONE: break; case CLIENT_TERMINATE: - fprintf(stderr, "The client has terminated. Exiting...\n"); - exit(1); + fprintf(stderr, "The client has terminated.\n"); + for (sp = test->streams; sp; sp = sp->next) { + FD_CLR(sp->socket, &test->read_set); + FD_CLR(sp->socket, &test->write_set); + close(sp->socket); + } + test->state = IPERF_DONE; + break; default: // XXX: This needs to be replaced by actual error handling fprintf(stderr, "Unrecognized state: %d\n", test->state); @@ -343,7 +349,7 @@ iperf_run_server(struct iperf_test *test) signal(SIGINT, sig_handler); if (setjmp(env)) { - fprintf(stderr, "Interrupt received. Exiting...\n"); + fprintf(stderr, "Exiting...\n"); test->state = SERVER_TERMINATE; if (test->ctrl_sck >= 0) { if (Nwrite(test->ctrl_sck, &test->state, sizeof(char), Ptcp) < 0) {