Merge branch 'iperf_time' of https://github.com/accelleran/iperf into accelleran-iperf_time
diff --git a/.gitignore b/.gitignore
index 713df75..424b143 100644
--- a/.gitignore
+++ b/.gitignore
@@ -24,6 +24,7 @@
 src/t_timer
 src/t_units
 src/t_uuid
+src/t_api
 examples/.libs
 examples/Makefile
 examples/mic
diff --git a/Makefile.in b/Makefile.in
index f2503c5..0d870bf 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -1,4 +1,4 @@
-# Makefile.in generated by automake 1.16 from Makefile.am.
+# Makefile.in generated by automake 1.16.1 from Makefile.am.
 # @configure_input@
 
 # Copyright (C) 1994-2018 Free Software Foundation, Inc.
diff --git a/README.md b/README.md
index 32faeb1..675bea0 100644
--- a/README.md
+++ b/README.md
@@ -26,7 +26,7 @@
 iperf3 is principally developed by ESnet / Lawrence Berkeley National
 Laboratory.  It is released under a three-clause BSD license.
 
-For more information see: http://software.es.net/iperf
+For more information see: https://software.es.net/iperf
 
 Source code and issue tracker: https://github.com/esnet/iperf
 
@@ -35,7 +35,7 @@
 
 Downloads of iperf3 are available at:
 
-    http://downloads.es.net/pub/iperf/
+    https://downloads.es.net/pub/iperf/
 
 To check out the most recent code, clone the git repository at:
 
@@ -146,7 +146,7 @@
 
 A set of known issues is maintained on the iperf3 Web pages:
 
-http://software.es.net/iperf/dev.html#known-issues
+https://software.es.net/iperf/dev.html#known-issues
 
 Links
 -----
diff --git a/RELEASE_NOTES b/RELEASE_NOTES
index 7cd90cc..6d4b98b 100644
--- a/RELEASE_NOTES
+++ b/RELEASE_NOTES
@@ -1,3 +1,34 @@
+== iperf 3.6 2018-06-25 ==
+
+* Notable user-visible changes
+
+ * A new --extra-data option can be used to fill in a user-defined
+   string field that appears in JSON output.  (#600 / #729)
+
+ * A new --repeating-payload option makes iperf3 use a payload pattern
+   similar to that used by iperf2, which could help in recreating
+   results that might be affected by payload entropy (for example,
+   compression).  (#726)
+
+ * -B now works properly with SCTP tests.  (#678 / #715)
+
+ * A compile fix for Solaris 10 was added.  (#711)
+
+ * Some minor bug fixes for JSON output.  In particular, warnings for
+   debug and/or verbose modes with --json output (#737) and a fix for
+   JSON output on CentOS 6 (#727 / #744).
+
+ * software.es.net and downloads.es.net now support HTTPS, so URLs in
+   documentation that refer to those two hosts now use https://
+   instead of http:// URLs. (#759)
+
+* Notable developer-visible changes
+
+ * Functions related to authenticated iperf3 connections have been
+   exposed via libiperf.  (#712 / #713)
+
+ * The ToS byte is now exposed in the libiperf API. (#719)
+
 == iperf 3.5 2018-03-02 ==
 
 * Notable user-visible changes
@@ -10,8 +41,6 @@
     paths.  Many thanks to @FuzzyStatic for providing access to a test
     environment for diagnosing this issue (#692).
 
-* Notable developer-visible changes
-
 == iperf 3.4 2018-02-14 ==
 
 * Notable user-visible changes
diff --git a/aclocal.m4 b/aclocal.m4
index d92fafb..107b3a9 100644
--- a/aclocal.m4
+++ b/aclocal.m4
@@ -1,4 +1,4 @@
-# generated automatically by aclocal 1.16 -*- Autoconf -*-
+# generated automatically by aclocal 1.16.1 -*- Autoconf -*-
 
 # Copyright (C) 1996-2018 Free Software Foundation, Inc.
 
@@ -9064,7 +9064,7 @@
 [am__api_version='1.16'
 dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
 dnl require some minimum version.  Point them to the right macro.
-m4_if([$1], [1.16], [],
+m4_if([$1], [1.16.1], [],
       [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
 ])
 
@@ -9080,7 +9080,7 @@
 # Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
 # This function is AC_REQUIREd by AM_INIT_AUTOMAKE.
 AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
-[AM_AUTOMAKE_VERSION([1.16])dnl
+[AM_AUTOMAKE_VERSION([1.16.1])dnl
 m4_ifndef([AC_AUTOCONF_VERSION],
   [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
 _AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
diff --git a/bootstrap.sh b/bootstrap.sh
index 73511fb..b0ffdc3 100755
--- a/bootstrap.sh
+++ b/bootstrap.sh
@@ -49,6 +49,6 @@
 $libtoolize --copy --force --automake
 aclocal -I config
 autoheader
-automake --foreign --add-missing --copy
+automake --add-missing --copy
 autoconf
 rm -rf config.cache
diff --git a/config/compile b/config/compile
index 0bb9d0f..99e5052 100755
--- a/config/compile
+++ b/config/compile
@@ -1,7 +1,7 @@
 #! /bin/sh
 # Wrapper for compilers which do not understand '-c -o'.
 
-scriptversion=2017-09-16.17; # UTC
+scriptversion=2018-03-07.03; # UTC
 
 # Copyright (C) 1999-2018 Free Software Foundation, Inc.
 # Written by Tom Tromey <tromey@cygnus.com>.
@@ -340,7 +340,7 @@
 # Local Variables:
 # mode: shell-script
 # sh-indentation: 2
-# eval: (add-hook 'write-file-hooks 'time-stamp)
+# eval: (add-hook 'before-save-hook 'time-stamp)
 # time-stamp-start: "scriptversion="
 # time-stamp-format: "%:y-%02m-%02d.%02H"
 # time-stamp-time-zone: "UTC0"
diff --git a/config/depcomp b/config/depcomp
index 49eb4bf..65cbf70 100755
--- a/config/depcomp
+++ b/config/depcomp
@@ -1,7 +1,7 @@
 #! /bin/sh
 # depcomp - compile a program generating dependencies as side-effects
 
-scriptversion=2017-09-16.17; # UTC
+scriptversion=2018-03-07.03; # UTC
 
 # Copyright (C) 1999-2018 Free Software Foundation, Inc.
 
@@ -783,7 +783,7 @@
 # Local Variables:
 # mode: shell-script
 # sh-indentation: 2
-# eval: (add-hook 'write-file-hooks 'time-stamp)
+# eval: (add-hook 'before-save-hook 'time-stamp)
 # time-stamp-start: "scriptversion="
 # time-stamp-format: "%:y-%02m-%02d.%02H"
 # time-stamp-time-zone: "UTC0"
diff --git a/config/missing b/config/missing
index 38e4fcb..625aeb1 100755
--- a/config/missing
+++ b/config/missing
@@ -1,7 +1,7 @@
 #! /bin/sh
 # Common wrapper for a few potentially missing GNU programs.
 
-scriptversion=2018-01-04.22; # UTC
+scriptversion=2018-03-07.03; # UTC
 
 # Copyright (C) 1996-2018 Free Software Foundation, Inc.
 # Originally written by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996.
@@ -207,7 +207,7 @@
 exit $st
 
 # Local variables:
-# eval: (add-hook 'write-file-hooks 'time-stamp)
+# eval: (add-hook 'before-save-hook 'time-stamp)
 # time-stamp-start: "scriptversion="
 # time-stamp-format: "%:y-%02m-%02d.%02H"
 # time-stamp-time-zone: "UTC0"
diff --git a/configure b/configure
index 5914466..9f9023e 100755
--- a/configure
+++ b/configure
@@ -1,6 +1,6 @@
 #! /bin/sh
 # Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.69 for iperf 3.5+.
+# Generated by GNU Autoconf 2.69 for iperf 3.6+.
 #
 # Report bugs to <https://github.com/esnet/iperf>.
 #
@@ -590,10 +590,10 @@
 # Identity of this package.
 PACKAGE_NAME='iperf'
 PACKAGE_TARNAME='iperf'
-PACKAGE_VERSION='3.5+'
-PACKAGE_STRING='iperf 3.5+'
+PACKAGE_VERSION='3.6+'
+PACKAGE_STRING='iperf 3.6+'
 PACKAGE_BUGREPORT='https://github.com/esnet/iperf'
-PACKAGE_URL='http://software.es.net/iperf/'
+PACKAGE_URL='https://software.es.net/iperf/'
 
 # Factoring default headers for most tests.
 ac_includes_default="\
@@ -639,6 +639,8 @@
 OPENSSL_LIBS
 OPENSSL_INCLUDES
 PKG_CONFIG
+ENABLE_PROFILING_FALSE
+ENABLE_PROFILING_TRUE
 CPP
 LT_SYS_LIBRARY_PATH
 OTOOL64
@@ -769,6 +771,7 @@
 with_gnu_ld
 with_sysroot
 enable_libtool_lock
+enable_profiling
 with_openssl
 '
       ac_precious_vars='build_alias
@@ -1321,7 +1324,7 @@
   # Omit some internal or obsolete options to make the list less imposing.
   # This message is too long to be a string in the A/UX 3.1 sh.
   cat <<_ACEOF
-\`configure' configures iperf 3.5+ to adapt to many kinds of systems.
+\`configure' configures iperf 3.6+ to adapt to many kinds of systems.
 
 Usage: $0 [OPTION]... [VAR=VALUE]...
 
@@ -1391,7 +1394,7 @@
 
 if test -n "$ac_init_help"; then
   case $ac_init_help in
-     short | recursive ) echo "Configuration of iperf 3.5+:";;
+     short | recursive ) echo "Configuration of iperf 3.6+:";;
    esac
   cat <<\_ACEOF
 
@@ -1413,6 +1416,7 @@
   --enable-fast-install[=PKGS]
                           optimize for fast installation [default=yes]
   --disable-libtool-lock  avoid locking (might break parallel builds)
+  --disable-profiling     Disable iperf profiling binary
 
 Optional Packages:
   --with-PACKAGE[=ARG]    use PACKAGE [ARG=yes]
@@ -1443,7 +1447,7 @@
 it to find libraries and programs with nonstandard names/locations.
 
 Report bugs to <https://github.com/esnet/iperf>.
-iperf home page: <http://software.es.net/iperf/>.
+iperf home page: <https://software.es.net/iperf/>.
 _ACEOF
 ac_status=$?
 fi
@@ -1506,7 +1510,7 @@
 test -n "$ac_init_help" && exit $ac_status
 if $ac_init_version; then
   cat <<\_ACEOF
-iperf configure 3.5+
+iperf configure 3.6+
 generated by GNU Autoconf 2.69
 
 Copyright (C) 2012 Free Software Foundation, Inc.
@@ -1875,7 +1879,7 @@
 This file contains any messages produced by compilers while
 running configure, to aid debugging if configure makes a mistake.
 
-It was created by iperf $as_me 3.5+, which was
+It was created by iperf $as_me 3.6+, which was
 generated by GNU Autoconf 2.69.  Invocation command line was
 
   $ $0 $@
@@ -2807,7 +2811,7 @@
 
 # Define the identity of the package.
  PACKAGE='iperf'
- VERSION='3.5+'
+ VERSION='3.6+'
 
 
 cat >>confdefs.h <<_ACEOF
@@ -12131,6 +12135,23 @@
   CFLAGS="$CFLAGS -Wall"
 fi
 
+# Check if profiling must be disabled
+# Check whether --enable-profiling was given.
+if test "${enable_profiling+set}" = set; then :
+  enableval=$enable_profiling; :
+else
+  enable_profiling=yes
+fi
+
+ if test x$enable_profiling = xyes; then
+  ENABLE_PROFILING_TRUE=
+  ENABLE_PROFILING_FALSE='#'
+else
+  ENABLE_PROFILING_TRUE='#'
+  ENABLE_PROFILING_FALSE=
+fi
+
+
 # Checks for header files.
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5
 $as_echo_n "checking for ANSI C header files... " >&6; }
@@ -13298,6 +13319,10 @@
   as_fn_error $? "conditional \"am__fastdepCC\" was never defined.
 Usually this means the macro was only invoked conditionally." "$LINENO" 5
 fi
+if test -z "${ENABLE_PROFILING_TRUE}" && test -z "${ENABLE_PROFILING_FALSE}"; then
+  as_fn_error $? "conditional \"ENABLE_PROFILING\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
 
 : "${CONFIG_STATUS=./config.status}"
 ac_write_fail=0
@@ -13695,7 +13720,7 @@
 # report actual input values of CONFIG_FILES etc. instead of their
 # values after options handling.
 ac_log="
-This file was extended by iperf $as_me 3.5+, which was
+This file was extended by iperf $as_me 3.6+, which was
 generated by GNU Autoconf 2.69.  Invocation command line was
 
   CONFIG_FILES    = $CONFIG_FILES
@@ -13756,13 +13781,13 @@
 $config_commands
 
 Report bugs to <https://github.com/esnet/iperf>.
-iperf home page: <http://software.es.net/iperf/>."
+iperf home page: <https://software.es.net/iperf/>."
 
 _ACEOF
 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
 ac_cs_version="\\
-iperf config.status 3.5+
+iperf config.status 3.6+
 configured by $0, generated by GNU Autoconf 2.69,
   with options \\"\$ac_cs_config\\"
 
diff --git a/configure.ac b/configure.ac
index 428ed30..7e36a1d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -24,7 +24,7 @@
 # file for complete information.
 
 # Initialize the autoconf system for the specified tool, version and mailing list
-AC_INIT(iperf, 3.5+, https://github.com/esnet/iperf, iperf, http://software.es.net/iperf/)
+AC_INIT(iperf, 3.6+, https://github.com/esnet/iperf, iperf, https://software.es.net/iperf/)
 m4_include([config/ax_check_openssl.m4])
 AC_LANG(C)
 
@@ -34,7 +34,7 @@
 
 
 # Initialize the automake system
-AM_INIT_AUTOMAKE
+AM_INIT_AUTOMAKE([foreign])
 AM_MAINTAINER_MODE
 AM_CONFIG_HEADER(src/iperf_config.h)
 
@@ -52,6 +52,13 @@
   CFLAGS="$CFLAGS -Wall"
 fi
 
+# Check if profiling must be disabled
+AC_ARG_ENABLE([profiling],
+    AS_HELP_STRING([--disable-profiling], [Disable iperf profiling binary]),
+    [:],
+    [enable_profiling=yes])
+AM_CONDITIONAL([ENABLE_PROFILING], [test x$enable_profiling = xyes])
+
 # Checks for header files.
 AC_HEADER_STDC
 
diff --git a/docs/conf.py b/docs/conf.py
index d26579a..e865374 100644
--- a/docs/conf.py
+++ b/docs/conf.py
@@ -52,10 +52,10 @@
 # built documents.
 #
 # The short X.Y version.
-version = '3.5'
+version = '3.6'
 # The full version, including alpha/beta/rc tags.
 
-release = '3.5'
+release = '3.6'
 
 # The language for content autogenerated by Sphinx. Refer to documentation
 # for a list of supported languages.
diff --git a/docs/faq.rst b/docs/faq.rst
index 095b5b9..babf528 100644
--- a/docs/faq.rst
+++ b/docs/faq.rst
@@ -72,9 +72,13 @@
 
 How can I build on a system that doesn't support profiled executables?
   This problem has been noted by users attempting to build iperf3 for
-  Android systems.  There are three workarounds. In order from least
+  Android systems.  There are several workarounds. In order from least
   effort to most effort:
 
+  #. Beginning with iperf-3.6, the ``--disable-profiling`` flag can be
+     passed to ``configure`` to disable the building of profiled
+     object files and the profiled executable.
+
   #. At the time the linking of the iperf3 profiled executable fails,
      the "normal" iperf3 executable is probably already created. So if
      you are willing to accept the error exit from the make process
diff --git a/docs/index.rst b/docs/index.rst
index bc5b864..1094028 100644
--- a/docs/index.rst
+++ b/docs/index.rst
@@ -41,13 +41,13 @@
 -----------------------
 
 Project homepage and documentation hosted on GitHub Pages:
-http://software.es.net/iperf/
+https://software.es.net/iperf/
 
 Project site (source code repository, issue tracker) hosted on GitHub:
 https://github.com/esnet/iperf
 
 Source code downloads:
-http://downloads.es.net/pub/iperf/
+https://downloads.es.net/pub/iperf/
 
 Contents
 --------
diff --git a/docs/invoking.rst b/docs/invoking.rst
index c049293..3f20f32 100644
--- a/docs/invoking.rst
+++ b/docs/invoking.rst
@@ -349,18 +349,30 @@
           -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
+                 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
-                 --json flag, the output will be in  JSON  format,  otherwise  it
-                 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.
+                 --json  flag,  the  output  will be in JSON format, otherwise it
+                 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.
+   
+          --repeating-payload
+                 Use  repeating pattern in payload, instead of random bytes.  The
+                 same payload is used in iperf2  (ASCII  '0..9'  repeating).   It
+                 might  help  to test and reveal problems in networking gear with
+                 hardware compression (including some WiFi access points),  where
+                 iperf2  and  iperf3  perform  differently, just based on payload
+                 entropy.
    
           --username username
                  username to use for authentication to the iperf server (if built
@@ -368,17 +380,17 @@
                  actively when the test is run.
    
           --rsa-public-key-path file
-                 path  to  the RSA public key used to encrypt authentication cre-
+                 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 requires an RSA public keypair.  The pub-
-          lic key is used to encrypt the authentication token containing the user
-          credentials, while the private key is used to decrypt  the  authentica-
-          tion  token.   An  example  of a set of UNIX/Linux commands to generate
-          correct keypair follows:
+          The  authentication  feature  of iperf3 requires an RSA public keypair.
+          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.  An example of a set of  UNIX/Linux  commands  to
+          generate correct keypair follows:
    
                > openssl genrsa -des3 -out private.pem 2048
                > openssl rsa -in private.pem -outform PEM -pubout -out public.pem
@@ -411,15 +423,15 @@
    
    AUTHORS
           A list of the contributors to iperf3 can be found within the documenta-
-          tion located at http://software.es.net/iperf/dev.html#authors.
+          tion located at https://software.es.net/iperf/dev.html#authors.
    
    
    SEE ALSO
-          libiperf(3), http://software.es.net/iperf
+          libiperf(3), https://software.es.net/iperf
    
    
    
-   ESnet                             March 2018                         IPERF3(1)
+   ESnet                              June 2018                         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 7914cbd..35cce4f 100644
--- a/docs/news.rst
+++ b/docs/news.rst
@@ -1,6 +1,15 @@
 iperf3 Project News
 ===================
 
+2018-06-25:  iperf-3.6 released
+-------------------------------
+
+| URL:  https://downloads.es.net/pub/iperf/iperf-3.6.tar.gz
+| SHA256:  ``de5d51e46dc460cc590fb4d44f95e7cad54b74fea1eba7d6ebd6f8887d75946e  iperf-3.6.tar.gz``
+
+iperf 3.6 adds the ``--extra-data`` and ``--repeating-payload``
+options and fixes some minor bugs.
+
 2018-03-02:  iperf-3.5 released
 -------------------------------
 
diff --git a/docs/obtaining.rst b/docs/obtaining.rst
index 227e708..11300c5 100644
--- a/docs/obtaining.rst
+++ b/docs/obtaining.rst
@@ -34,7 +34,7 @@
 Source distributions of iperf are available as compressed (gzip)
 tarballs at:
 
-http://downloads.es.net/pub/iperf/
+https://downloads.es.net/pub/iperf/
 
 **Note:**  Due to a software packaging error, the 3.0.2 release
 tarball was not compressed, even though its filename had a ``.tar.gz``
diff --git a/examples/Makefile.in b/examples/Makefile.in
index 0ca1685..b0049bc 100644
--- a/examples/Makefile.in
+++ b/examples/Makefile.in
@@ -1,4 +1,4 @@
-# Makefile.in generated by automake 1.16 from Makefile.am.
+# Makefile.in generated by automake 1.16.1 from Makefile.am.
 # @configure_input@
 
 # Copyright (C) 1994-2018 Free Software Foundation, Inc.
diff --git a/iperf3.spec.in b/iperf3.spec.in
index f2f1573..602364d 100644
--- a/iperf3.spec.in
+++ b/iperf3.spec.in
@@ -5,8 +5,8 @@
 
 Group:	 Applications/Internet	
 License: BSD	
-URL:	 http://github.com/esnet/iperf
-Source0: http://stats.es.net/software/iperf-%{version}.tar.gz
+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)
 
 %if 0%{?el5}
diff --git a/src/Makefile.am b/src/Makefile.am
index 32a7b43..5be8562 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -1,7 +1,11 @@
 lib_LTLIBRARIES         = libiperf.la                                   # Build and install an iperf library
 bin_PROGRAMS            = iperf3                                        # Build and install an iperf binary
-noinst_PROGRAMS         = t_timer t_units t_uuid iperf3_profile         # Build, but don't install the test programs and a profiled version of iperf3
-include_HEADERS         = iperf_api.h # Defines the headers that get installed with the program
+if ENABLE_PROFILING
+noinst_PROGRAMS         = t_timer t_units t_uuid t_api iperf3_profile   # Build, but don't install the test programs and a profiled version of iperf3
+else
+noinst_PROGRAMS         = t_timer t_units t_uuid t_api                  # Build, but don't install the test programs
+endif
+include_HEADERS         = iperf_api.h                                   # Defines the headers that get installed with the program
 
 
 # Specify the source files and flags for the iperf library
@@ -15,7 +19,7 @@
                         iperf_error.c \
                         iperf_auth.h \
                         iperf_auth.c \
-			iperf_client_api.c \
+                        iperf_client_api.c \
                         iperf_locale.c \
                         iperf_locale.h \
                         iperf_server_api.c \
@@ -23,8 +27,8 @@
                         iperf_tcp.h \
                         iperf_udp.c \
                         iperf_udp.h \
-			iperf_sctp.c \
-	                iperf_sctp.h \
+                        iperf_sctp.c \
+                        iperf_sctp.h \
                         iperf_util.c \
                         iperf_util.h \
                         iperf_time.c \
@@ -32,7 +36,7 @@
 			dscp.c \
                         net.c \
                         net.h \
-			portable_endian.h \
+                        portable_endian.h \
                         queue.h \
                         tcp_info.c \
                         timer.c \
@@ -47,14 +51,17 @@
 iperf3_LDADD            = libiperf.la
 iperf3_LDFLAGS          = -g
 
+if ENABLE_PROFILING
+# If the iperf-profiled-binary is enabled (and this condition is true by default)
 # Specify the sources and various flags for the profiled iperf binary. This
 # binary recompiles all the source files to make sure they are all profiled.
 iperf3_profile_SOURCES  = main.c \
-						  $(libiperf_la_SOURCES)
+                          $(libiperf_la_SOURCES)
 
 iperf3_profile_CFLAGS   = -pg -g
 iperf3_profile_LDADD    = libiperf.la
 iperf3_profile_LDFLAGS  = -pg -g
+endif
 
 # Specify the sources and various flags for the test cases
 t_timer_SOURCES         = t_timer.c
@@ -72,6 +79,10 @@
 t_uuid_LDFLAGS          =
 t_uuid_LDADD            = libiperf.la
 
+t_api_SOURCES           = t_api.c
+t_api_CFLAGS            = -g
+t_api_LDFLAGS           =
+t_api_LDADD             = libiperf.la
 
 
 
@@ -79,6 +90,7 @@
 TESTS                   = \
                         t_timer \
                         t_units \
-                        t_uuid
+                        t_uuid  \
+                        t_api
 
 dist_man_MANS          = iperf3.1 libiperf.3
diff --git a/src/Makefile.in b/src/Makefile.in
index a26b94e..d6950b0 100644
--- a/src/Makefile.in
+++ b/src/Makefile.in
@@ -1,4 +1,4 @@
-# Makefile.in generated by automake 1.16 from Makefile.am.
+# Makefile.in generated by automake 1.16.1 from Makefile.am.
 # @configure_input@
 
 # Copyright (C) 1994-2018 Free Software Foundation, Inc.
@@ -91,9 +91,14 @@
 build_triplet = @build@
 host_triplet = @host@
 bin_PROGRAMS = iperf3$(EXEEXT)
-noinst_PROGRAMS = t_timer$(EXEEXT) t_units$(EXEEXT) t_uuid$(EXEEXT) \
-	iperf3_profile$(EXEEXT)
-TESTS = t_timer$(EXEEXT) t_units$(EXEEXT) t_uuid$(EXEEXT)
+@ENABLE_PROFILING_FALSE@noinst_PROGRAMS = t_timer$(EXEEXT) \
+@ENABLE_PROFILING_FALSE@	t_units$(EXEEXT) t_uuid$(EXEEXT) \
+@ENABLE_PROFILING_FALSE@	t_api$(EXEEXT)
+@ENABLE_PROFILING_TRUE@noinst_PROGRAMS = t_timer$(EXEEXT) \
+@ENABLE_PROFILING_TRUE@	t_units$(EXEEXT) t_uuid$(EXEEXT) \
+@ENABLE_PROFILING_TRUE@	t_api$(EXEEXT) iperf3_profile$(EXEEXT)
+TESTS = t_timer$(EXEEXT) t_units$(EXEEXT) t_uuid$(EXEEXT) \
+	t_api$(EXEEXT)
 subdir = src
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
 am__aclocal_m4_deps = $(top_srcdir)/config/ax_check_openssl.m4 \
@@ -155,6 +160,13 @@
 iperf3_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
 	$(LIBTOOLFLAGS) --mode=link $(CCLD) $(iperf3_CFLAGS) $(CFLAGS) \
 	$(iperf3_LDFLAGS) $(LDFLAGS) -o $@
+am__iperf3_profile_SOURCES_DIST = main.c cjson.c cjson.h flowlabel.h \
+	iperf.h iperf_api.c iperf_api.h iperf_error.c iperf_auth.h \
+	iperf_auth.c iperf_client_api.c iperf_locale.c iperf_locale.h \
+	iperf_server_api.c iperf_tcp.c iperf_tcp.h iperf_udp.c \
+	iperf_udp.h iperf_sctp.c iperf_sctp.h iperf_util.c \
+	iperf_util.h dscp.c net.c net.h portable_endian.h queue.h \
+	tcp_info.c timer.c timer.h units.c units.h version.h
 am__objects_1 = iperf3_profile-cjson.$(OBJEXT) \
 	iperf3_profile-iperf_api.$(OBJEXT) \
 	iperf3_profile-iperf_error.$(OBJEXT) \
@@ -170,14 +182,21 @@
 	iperf3_profile-dscp.$(OBJEXT) iperf3_profile-net.$(OBJEXT) \
 	iperf3_profile-tcp_info.$(OBJEXT) \
 	iperf3_profile-timer.$(OBJEXT) iperf3_profile-units.$(OBJEXT)
-am_iperf3_profile_OBJECTS = iperf3_profile-main.$(OBJEXT) \
-	$(am__objects_1)
+@ENABLE_PROFILING_TRUE@am_iperf3_profile_OBJECTS =  \
+@ENABLE_PROFILING_TRUE@	iperf3_profile-main.$(OBJEXT) \
+@ENABLE_PROFILING_TRUE@	$(am__objects_1)
 iperf3_profile_OBJECTS = $(am_iperf3_profile_OBJECTS)
-iperf3_profile_DEPENDENCIES = libiperf.la
+@ENABLE_PROFILING_TRUE@iperf3_profile_DEPENDENCIES = libiperf.la
 iperf3_profile_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \
 	$(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \
 	$(iperf3_profile_CFLAGS) $(CFLAGS) $(iperf3_profile_LDFLAGS) \
 	$(LDFLAGS) -o $@
+am_t_api_OBJECTS = t_api-t_api.$(OBJEXT)
+t_api_OBJECTS = $(am_t_api_OBJECTS)
+t_api_DEPENDENCIES = libiperf.la
+t_api_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
+	$(LIBTOOLFLAGS) --mode=link $(CCLD) $(t_api_CFLAGS) $(CFLAGS) \
+	$(t_api_LDFLAGS) $(LDFLAGS) -o $@
 am_t_timer_OBJECTS = t_timer-t_timer.$(OBJEXT)
 t_timer_OBJECTS = $(am_t_timer_OBJECTS)
 t_timer_DEPENDENCIES = libiperf.la
@@ -233,9 +252,9 @@
 	./$(DEPDIR)/iperf_auth.Plo ./$(DEPDIR)/iperf_client_api.Plo \
 	./$(DEPDIR)/iperf_error.Plo ./$(DEPDIR)/iperf_locale.Plo \
 	./$(DEPDIR)/iperf_sctp.Plo ./$(DEPDIR)/iperf_server_api.Plo \
-	./$(DEPDIR)/iperf_tcp.Plo ./$(DEPDIR)/iperf_time.Plo \
-	./$(DEPDIR)/iperf_udp.Plo ./$(DEPDIR)/iperf_util.Plo \
-	./$(DEPDIR)/net.Plo ./$(DEPDIR)/t_timer-t_timer.Po \
+	./$(DEPDIR)/iperf_tcp.Plo ./$(DEPDIR)/iperf_udp.Plo \
+	./$(DEPDIR)/iperf_util.Plo ./$(DEPDIR)/net.Plo \
+	./$(DEPDIR)/t_api-t_api.Po ./$(DEPDIR)/t_timer-t_timer.Po \
 	./$(DEPDIR)/t_units-t_units.Po ./$(DEPDIR)/t_uuid-t_uuid.Po \
 	./$(DEPDIR)/tcp_info.Plo ./$(DEPDIR)/timer.Plo \
 	./$(DEPDIR)/units.Plo
@@ -259,11 +278,11 @@
 am__v_CCLD_0 = @echo "  CCLD    " $@;
 am__v_CCLD_1 = 
 SOURCES = $(libiperf_la_SOURCES) $(iperf3_SOURCES) \
-	$(iperf3_profile_SOURCES) $(t_timer_SOURCES) \
+	$(iperf3_profile_SOURCES) $(t_api_SOURCES) $(t_timer_SOURCES) \
 	$(t_units_SOURCES) $(t_uuid_SOURCES)
 DIST_SOURCES = $(libiperf_la_SOURCES) $(iperf3_SOURCES) \
-	$(iperf3_profile_SOURCES) $(t_timer_SOURCES) \
-	$(t_units_SOURCES) $(t_uuid_SOURCES)
+	$(am__iperf3_profile_SOURCES_DIST) $(t_api_SOURCES) \
+	$(t_timer_SOURCES) $(t_units_SOURCES) $(t_uuid_SOURCES)
 am__can_run_installinfo = \
   case $$AM_UPDATE_INFO_DIR in \
     n|no|NO) false;; \
@@ -598,7 +617,7 @@
 top_builddir = @top_builddir@
 top_srcdir = @top_srcdir@
 lib_LTLIBRARIES = libiperf.la                                   # Build and install an iperf library
-include_HEADERS = iperf_api.h # Defines the headers that get installed with the program
+include_HEADERS = iperf_api.h                                   # Defines the headers that get installed with the program
 
 # Specify the source files and flags for the iperf library
 libiperf_la_SOURCES = \
@@ -611,7 +630,7 @@
                         iperf_error.c \
                         iperf_auth.h \
                         iperf_auth.c \
-			iperf_client_api.c \
+                        iperf_client_api.c \
                         iperf_locale.c \
                         iperf_locale.h \
                         iperf_server_api.c \
@@ -619,8 +638,8 @@
                         iperf_tcp.h \
                         iperf_udp.c \
                         iperf_udp.h \
-			iperf_sctp.c \
-	                iperf_sctp.h \
+                        iperf_sctp.c \
+                        iperf_sctp.h \
                         iperf_util.c \
                         iperf_util.h \
                         iperf_time.c \
@@ -628,7 +647,7 @@
 			dscp.c \
                         net.c \
                         net.h \
-			portable_endian.h \
+                        portable_endian.h \
                         queue.h \
                         tcp_info.c \
                         timer.c \
@@ -644,14 +663,15 @@
 iperf3_LDADD = libiperf.la
 iperf3_LDFLAGS = -g
 
+# If the iperf-profiled-binary is enabled (and this condition is true by default)
 # Specify the sources and various flags for the profiled iperf binary. This
 # binary recompiles all the source files to make sure they are all profiled.
-iperf3_profile_SOURCES = main.c \
-						  $(libiperf_la_SOURCES)
+@ENABLE_PROFILING_TRUE@iperf3_profile_SOURCES = main.c \
+@ENABLE_PROFILING_TRUE@                          $(libiperf_la_SOURCES)
 
-iperf3_profile_CFLAGS = -pg -g
-iperf3_profile_LDADD = libiperf.la
-iperf3_profile_LDFLAGS = -pg -g
+@ENABLE_PROFILING_TRUE@iperf3_profile_CFLAGS = -pg -g
+@ENABLE_PROFILING_TRUE@iperf3_profile_LDADD = libiperf.la
+@ENABLE_PROFILING_TRUE@iperf3_profile_LDFLAGS = -pg -g
 
 # Specify the sources and various flags for the test cases
 t_timer_SOURCES = t_timer.c
@@ -666,6 +686,10 @@
 t_uuid_CFLAGS = -g
 t_uuid_LDFLAGS = 
 t_uuid_LDADD = libiperf.la
+t_api_SOURCES = t_api.c
+t_api_CFLAGS = -g
+t_api_LDFLAGS = 
+t_api_LDADD = libiperf.la
 dist_man_MANS = iperf3.1 libiperf.3
 all: iperf_config.h
 	$(MAKE) $(AM_MAKEFLAGS) all-am
@@ -823,6 +847,10 @@
 	@rm -f iperf3_profile$(EXEEXT)
 	$(AM_V_CCLD)$(iperf3_profile_LINK) $(iperf3_profile_OBJECTS) $(iperf3_profile_LDADD) $(LIBS)
 
+t_api$(EXEEXT): $(t_api_OBJECTS) $(t_api_DEPENDENCIES) $(EXTRA_t_api_DEPENDENCIES) 
+	@rm -f t_api$(EXEEXT)
+	$(AM_V_CCLD)$(t_api_LINK) $(t_api_OBJECTS) $(t_api_LDADD) $(LIBS)
+
 t_timer$(EXEEXT): $(t_timer_OBJECTS) $(t_timer_DEPENDENCIES) $(EXTRA_t_timer_DEPENDENCIES) 
 	@rm -f t_timer$(EXEEXT)
 	$(AM_V_CCLD)$(t_timer_LINK) $(t_timer_OBJECTS) $(t_timer_LDADD) $(LIBS)
@@ -874,6 +902,7 @@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/iperf_udp.Plo@am__quote@ # am--include-marker
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/iperf_util.Plo@am__quote@ # am--include-marker
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/net.Plo@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t_api-t_api.Po@am__quote@ # am--include-marker
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t_timer-t_timer.Po@am__quote@ # am--include-marker
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t_units-t_units.Po@am__quote@ # am--include-marker
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t_uuid-t_uuid.Po@am__quote@ # am--include-marker
@@ -1174,6 +1203,20 @@
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCC_FALSE@	$(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(iperf3_profile_CFLAGS) $(CFLAGS) -c -o iperf3_profile-units.obj `if test -f 'units.c'; then $(CYGPATH_W) 'units.c'; else $(CYGPATH_W) '$(srcdir)/units.c'; fi`
 
+t_api-t_api.o: t_api.c
+@am__fastdepCC_TRUE@	$(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(t_api_CFLAGS) $(CFLAGS) -MT t_api-t_api.o -MD -MP -MF $(DEPDIR)/t_api-t_api.Tpo -c -o t_api-t_api.o `test -f 't_api.c' || echo '$(srcdir)/'`t_api.c
+@am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/t_api-t_api.Tpo $(DEPDIR)/t_api-t_api.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='t_api.c' object='t_api-t_api.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@	$(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(t_api_CFLAGS) $(CFLAGS) -c -o t_api-t_api.o `test -f 't_api.c' || echo '$(srcdir)/'`t_api.c
+
+t_api-t_api.obj: t_api.c
+@am__fastdepCC_TRUE@	$(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(t_api_CFLAGS) $(CFLAGS) -MT t_api-t_api.obj -MD -MP -MF $(DEPDIR)/t_api-t_api.Tpo -c -o t_api-t_api.obj `if test -f 't_api.c'; then $(CYGPATH_W) 't_api.c'; else $(CYGPATH_W) '$(srcdir)/t_api.c'; fi`
+@am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/t_api-t_api.Tpo $(DEPDIR)/t_api-t_api.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='t_api.c' object='t_api-t_api.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@	$(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(t_api_CFLAGS) $(CFLAGS) -c -o t_api-t_api.obj `if test -f 't_api.c'; then $(CYGPATH_W) 't_api.c'; else $(CYGPATH_W) '$(srcdir)/t_api.c'; fi`
+
 t_timer-t_timer.o: t_timer.c
 @am__fastdepCC_TRUE@	$(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(t_timer_CFLAGS) $(CFLAGS) -MT t_timer-t_timer.o -MD -MP -MF $(DEPDIR)/t_timer-t_timer.Tpo -c -o t_timer-t_timer.o `test -f 't_timer.c' || echo '$(srcdir)/'`t_timer.c
 @am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/t_timer-t_timer.Tpo $(DEPDIR)/t_timer-t_timer.Po
@@ -1543,6 +1586,13 @@
 	--log-file $$b.log --trs-file $$b.trs \
 	$(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
 	"$$tst" $(AM_TESTS_FD_REDIRECT)
+t_api.log: t_api$(EXEEXT)
+	@p='t_api$(EXEEXT)'; \
+	b='t_api'; \
+	$(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
+	--log-file $$b.log --trs-file $$b.trs \
+	$(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
+	"$$tst" $(AM_TESTS_FD_REDIRECT)
 .test.log:
 	@p='$<'; \
 	$(am__set_b); \
@@ -1674,6 +1724,7 @@
 	-rm -f ./$(DEPDIR)/iperf_udp.Plo
 	-rm -f ./$(DEPDIR)/iperf_util.Plo
 	-rm -f ./$(DEPDIR)/net.Plo
+	-rm -f ./$(DEPDIR)/t_api-t_api.Po
 	-rm -f ./$(DEPDIR)/t_timer-t_timer.Po
 	-rm -f ./$(DEPDIR)/t_units-t_units.Po
 	-rm -f ./$(DEPDIR)/t_uuid-t_uuid.Po
@@ -1758,6 +1809,7 @@
 	-rm -f ./$(DEPDIR)/iperf_udp.Plo
 	-rm -f ./$(DEPDIR)/iperf_util.Plo
 	-rm -f ./$(DEPDIR)/net.Plo
+	-rm -f ./$(DEPDIR)/t_api-t_api.Po
 	-rm -f ./$(DEPDIR)/t_timer-t_timer.Po
 	-rm -f ./$(DEPDIR)/t_units-t_units.Po
 	-rm -f ./$(DEPDIR)/t_uuid-t_uuid.Po
diff --git a/src/iperf3.1 b/src/iperf3.1
index 538e93c..b9085e4 100644
--- a/src/iperf3.1
+++ b/src/iperf3.1
@@ -1,4 +1,4 @@
-.TH IPERF3 1 "March 2018" ESnet "User Manuals"
+.TH IPERF3 1 "June 2018" ESnet "User Manuals"
 .SH NAME
 iperf3 \- perform network throughput tests
 .SH SYNOPSIS
@@ -353,6 +353,13 @@
 in a JSON object; otherwise it is appended at the bottom of the
 human-readable output.
 .TP
+.BR --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.
+.TP
 .BR --repeating-payload
 Use repeating pattern in payload, instead of random bytes.
 The same payload is used in iperf2 (ASCII '0..9' repeating).
@@ -419,8 +426,8 @@
 .SH AUTHORS
 A list of the contributors to iperf3 can be found within the
 documentation located at
-\fChttp://software.es.net/iperf/dev.html#authors\fR.
+\fChttps://software.es.net/iperf/dev.html#authors\fR.
 
 .SH "SEE ALSO"
 libiperf(3),
-http://software.es.net/iperf
+https://software.es.net/iperf
diff --git a/src/iperf_api.c b/src/iperf_api.c
index 1046526..d6c4717 100755
--- a/src/iperf_api.c
+++ b/src/iperf_api.c
@@ -166,6 +166,24 @@
 }
 
 int
+iperf_get_test_pacing_timer(struct iperf_test *ipt)
+{
+    return ipt->settings->pacing_timer;
+}
+
+uint64_t
+iperf_get_test_bytes(struct iperf_test *ipt)
+{
+    return (uint64_t) ipt->settings->bytes;
+}
+
+uint64_t
+iperf_get_test_blocks(struct iperf_test *ipt)
+{
+    return (uint64_t) ipt->settings->blocks;
+}
+
+int
 iperf_get_test_burst(struct iperf_test *ipt)
 {
     return ipt->settings->burst;
@@ -303,6 +321,13 @@
     return ipt->extra_data;
 }
 
+static const char iperf_version[] = IPERF_VERSION;
+char *
+iperf_get_iperf_version(void)
+{
+    return (char*)iperf_version;
+}
+
 /************** Setter routines for some fields inside iperf_test *************/
 
 void
@@ -366,6 +391,24 @@
 }
 
 void
+iperf_set_test_pacing_timer(struct iperf_test *ipt, int pacing_timer)
+{
+    ipt->settings->pacing_timer = pacing_timer;
+}
+
+void
+iperf_set_test_bytes(struct iperf_test *ipt, uint64_t bytes)
+{
+    ipt->settings->bytes = (iperf_size_t) bytes;
+}
+
+void
+iperf_set_test_blocks(struct iperf_test *ipt, uint64_t blocks)
+{
+    ipt->settings->blocks = (iperf_size_t) blocks;
+}
+
+void
 iperf_set_test_burst(struct iperf_test *ipt, int burst)
 {
     ipt->settings->burst = burst;
@@ -427,6 +470,10 @@
 iperf_set_test_reverse(struct iperf_test *ipt, int reverse)
 {
     ipt->reverse = reverse;
+    if (ipt->role == 'c')
+        ipt->sender = 1;
+    else
+        ipt->sender = 0;
     if (ipt->reverse)
         ipt->sender = ! ipt->sender;
     check_sender_has_retransmits(ipt);
@@ -560,7 +607,7 @@
 iperf_on_test_start(struct iperf_test *test)
 {
     if (test->json_output) {
-	cJSON_AddItemToObject(test->json_start, "test_start", iperf_json_printf("protocol: %s  num_streams: %d  blksize: %d  omit: %d  duration: %d  bytes: %d  blocks: %d  reverse: %d  tos: %d", test->protocol->name, (int64_t) test->num_streams, (int64_t) test->settings->blksize, (int64_t) test->omit, (int64_t) test->duration, (int64_t) test->settings->bytes, (int64_t) test->settings->blocks, test->reverse?(int64_t)1:(int64_t)0, test->settings->tos));
+	cJSON_AddItemToObject(test->json_start, "test_start", iperf_json_printf("protocol: %s  num_streams: %d  blksize: %d  omit: %d  duration: %d  bytes: %d  blocks: %d  reverse: %d  tos: %d", test->protocol->name, (int64_t) test->num_streams, (int64_t) test->settings->blksize, (int64_t) test->omit, (int64_t) test->duration, (int64_t) test->settings->bytes, (int64_t) test->settings->blocks, test->reverse?(int64_t)1:(int64_t)0, (int64_t) test->settings->tos));
     } else {
 	if (test->verbose) {
 	    if (test->settings->bytes)
@@ -645,7 +692,9 @@
 	    else {
 		cJSON_AddNumberToObject(test->json_start, "tcp_mss_default", test->ctrl_sck_mss);
 	    }
-	}
+        if (test->settings->rate)
+            cJSON_AddNumberToObject(test->json_start, "target_bitrate", test->settings->rate);
+        }
     } else if (test->verbose) {
         iperf_printf(test, report_cookie, test->cookie);
         if (test->protocol->id == SOCK_STREAM) {
@@ -655,7 +704,8 @@
                 iperf_printf(test, "      TCP MSS: %d (default)\n", test->ctrl_sck_mss);
             }
         }
-
+        if (test->settings->rate)
+            iperf_printf(test, "      Target Bitrate: %llu\n", test->settings->rate);
     }
 }
 
@@ -1231,6 +1281,14 @@
         warning("Report format (-f) flag ignored with JSON output (-J)");
     }
 
+    /* Show warning if JSON output is used with verbose or debug flags */
+    if (test->json_output && test->verbose) {
+        warning("Verbose output (-v) may interfere with JSON output (-J)");
+    }
+    if (test->json_output && test->debug) {
+        warning("Debug output (-d) may interfere with JSON output (-J)");
+    }
+
     return 0;
 }
 
@@ -1673,6 +1731,8 @@
 #endif //HAVE_SSL
 	if (test->sender && test->protocol->id == Ptcp && has_tcpinfo_retransmits())
 	    test->sender_has_retransmits = 1;
+    if (test->settings->rate)
+        cJSON_AddNumberToObject(test->json_start, "target_bitrate", test->settings->rate);
 	cJSON_Delete(j);
     }
     return r;
@@ -2451,7 +2511,7 @@
         rp->bytes_sent_omit = rp->bytes_sent;
         rp->bytes_received = 0;
         rp->bytes_sent_this_interval = rp->bytes_received_this_interval = 0;
-	if (test->sender && test->sender_has_retransmits) {
+	if (test->sender_has_retransmits == 1) {
 	    struct iperf_interval_results ir; /* temporary results structure */
 	    save_tcpinfo(sp, &ir);
 	    rp->stream_prev_total_retrans = get_total_retransmits(&ir);
@@ -2496,7 +2556,7 @@
 	if (test->protocol->id == Ptcp) {
 	    if ( has_tcpinfo()) {
 		save_tcpinfo(sp, &temp);
-		if (test->sender && test->sender_has_retransmits) {
+		if (test->sender_has_retransmits == 1) {
 		    long total_retrans = get_total_retransmits(&temp);
 		    temp.interval_retrans = total_retrans - rp->stream_prev_total_retrans;
 		    rp->stream_retrans += temp.interval_retrans;
@@ -2633,7 +2693,7 @@
 	}
         bytes += irp->bytes_transferred;
 	if (test->protocol->id == Ptcp) {
-	    if (test->sender && test->sender_has_retransmits) {
+	    if (test->sender_has_retransmits == 1) {
 		retransmits += irp->interval_retrans;
 	    }
 	} else {
@@ -2659,7 +2719,7 @@
 	    iperf_time_diff(&sp->result->start_time,&irp->interval_end_time, &temp_time);
 	    end_time = iperf_time_in_secs(&temp_time);
 	if (test->protocol->id == Ptcp || test->protocol->id == Psctp) {
-	    if (test->sender && test->sender_has_retransmits) {
+	    if (test->sender_has_retransmits == 1) {
 		/* Interval sum, TCP with retransmits. */
 		if (test->json_output)
 		    cJSON_AddItemToObject(json_interval, "sum", iperf_json_printf("start: %f  end: %f  seconds: %f  bytes: %d  bits_per_second: %f  retransmits: %d  omitted: %b", (double) start_time, (double) end_time, (double) irp->interval_duration, (int64_t) bytes, bandwidth * 8, (int64_t) retransmits, irp->omitted)); /* XXX irp->omitted or test->omitting? */
@@ -3013,7 +3073,7 @@
 	    else
 	        if (test->role == 's' && test->sender) {
 		    if (test->verbose) 
-		        iperf_printf(test, report_receiver_not_available_format, sp->socket);
+		        iperf_printf(test, report_receiver_not_available_summary_format, "SUM");
 		}
 		else {
 		    iperf_printf(test, report_sum_bw_format, start_time, receiver_time, ubuf, nbuf, report_receiver);
@@ -3171,7 +3231,7 @@
 	    */
 	    if (iperf_time_compare(&sp->result->start_time, &irp->interval_start_time) == 0) {
 		if (test->protocol->id == Ptcp || test->protocol->id == Psctp) {
-		    if (test->sender && test->sender_has_retransmits)
+		    if (test->sender_has_retransmits == 1)
 			iperf_printf(test, "%s", report_bw_retrans_cwnd_header);
 		    else
 			iperf_printf(test, "%s", report_bw_header);
@@ -3201,7 +3261,7 @@
     et = iperf_time_in_secs(&temp_time);
     
     if (test->protocol->id == Ptcp || test->protocol->id == Psctp) {
-	if (test->sender && test->sender_has_retransmits) {
+	if (test->sender_has_retransmits == 1) {
 	    /* Interval, TCP with retransmits. */
 	    if (test->json_output)
 		cJSON_AddItemToArray(json_interval_streams, iperf_json_printf("socket: %d  start: %f  end: %f  seconds: %f  bytes: %d  bits_per_second: %f  retransmits: %d  snd_cwnd:  %d  rtt:  %d  rttvar: %d  pmtu: %d  omitted: %b", (int64_t) sp->socket, (double) st, (double) et, (double) irp->interval_duration, (int64_t) irp->bytes_transferred, bandwidth * 8, (int64_t) irp->interval_retrans, (int64_t) irp->snd_cwnd, (int64_t) irp->rtt, (int64_t) irp->rttvar, (int64_t) irp->pmtu, irp->omitted));
diff --git a/src/iperf_api.h b/src/iperf_api.h
index f0818bd..54936ab 100755
--- a/src/iperf_api.h
+++ b/src/iperf_api.h
@@ -102,6 +102,9 @@
 int	iperf_get_test_blksize( struct iperf_test* ipt );
 FILE*	iperf_get_test_outfile( struct iperf_test* ipt );
 uint64_t iperf_get_test_rate( struct iperf_test* ipt );
+int iperf_get_test_pacing_timer( struct iperf_test* ipt );
+uint64_t iperf_get_test_bytes( struct iperf_test* ipt );
+uint64_t iperf_get_test_blocks( struct iperf_test* ipt );
 int     iperf_get_test_burst( struct iperf_test* ipt );
 int	iperf_get_test_socket_bufsize( struct iperf_test* ipt );
 double	iperf_get_test_reporter_interval( struct iperf_test* ipt );
@@ -120,6 +123,7 @@
 int	iperf_get_test_one_off( struct iperf_test* ipt );
 int iperf_get_test_tos( struct iperf_test* ipt );
 char*	iperf_get_extra_data( struct iperf_test* ipt );
+char*	iperf_get_iperf_version(void);
 
 /* Setter routines for some fields inside iperf_test. */
 void	iperf_set_verbose( struct iperf_test* ipt, int verbose );
@@ -131,6 +135,9 @@
 void	iperf_set_test_state( struct iperf_test* ipt, signed char state );
 void	iperf_set_test_blksize( struct iperf_test* ipt, int blksize );
 void	iperf_set_test_rate( struct iperf_test* ipt, uint64_t rate );
+void    iperf_set_test_pacing_timer( struct iperf_test* ipt, int pacing_timer );
+void    iperf_set_test_bytes( struct iperf_test* ipt, uint64_t bytes );
+void    iperf_set_test_blocks( struct iperf_test* ipt, uint64_t blocks );
 void	iperf_set_test_burst( struct iperf_test* ipt, int burst );
 void	iperf_set_test_server_port( struct iperf_test* ipt, int server_port );
 void	iperf_set_test_socket_bufsize( struct iperf_test* ipt, int socket_bufsize );
diff --git a/src/iperf_client_api.c b/src/iperf_client_api.c
index 30fa2ac..aca6826 100644
--- a/src/iperf_client_api.c
+++ b/src/iperf_client_api.c
@@ -347,22 +347,22 @@
     socklen_t len;
 
     len = sizeof(opt);
-	if (getsockopt(test->ctrl_sck, IPPROTO_TCP, TCP_MAXSEG, &opt, &len) < 0) {
-		test->ctrl_sck_mss = 0;
-	}
-	else {
-		if (opt > 0 && opt <= MAX_UDP_BLOCKSIZE) {
-			test->ctrl_sck_mss = opt;
-		}
-		else {
-			char str[128];
-			snprintf(str, sizeof(str),
-				"Ignoring nonsense TCP MSS %d", opt);
-			warning(str);
+    if (getsockopt(test->ctrl_sck, IPPROTO_TCP, TCP_MAXSEG, &opt, &len) < 0) {
+        test->ctrl_sck_mss = 0;
+    }
+    else {
+        if (opt > 0 && opt <= MAX_UDP_BLOCKSIZE) {
+            test->ctrl_sck_mss = opt;
+        }
+        else {
+            char str[128];
+            snprintf(str, sizeof(str),
+                     "Ignoring nonsense TCP MSS %d", opt);
+            warning(str);
 
-			test->ctrl_sck_mss = 0;
-		}
-	}
+            test->ctrl_sck_mss = 0;
+        }
+    }
 
     if (test->verbose) {
 	printf("Control connection MSS %d\n", test->ctrl_sck_mss);
diff --git a/src/iperf_locale.c b/src/iperf_locale.c
index a1a240c..115adf2 100644
--- a/src/iperf_locale.c
+++ b/src/iperf_locale.c
@@ -396,6 +396,7 @@
 const char report_sender_not_available_format[] = "[%3d] (sender statistics not available)\n";
 const char report_sender_not_available_summary_format[] = "[%3s] (sender statistics not available)\n";
 const char report_receiver_not_available_format[] = "[%3d] (receiver statistics not available)\n";
+const char report_receiver_not_available_summary_format[] = "[%3s] (receiver statistics not available)\n";
 
 #if defined(linux)
 const char report_tcpInfo[] =
diff --git a/src/iperf_locale.h b/src/iperf_locale.h
index ddd38fa..e1ceaf7 100644
--- a/src/iperf_locale.h
+++ b/src/iperf_locale.h
@@ -98,6 +98,7 @@
 extern const char report_sender_not_available_format[];
 extern const char report_sender_not_available_summary_format[];
 extern const char report_receiver_not_available_format[];
+extern const char report_receiver_not_available_summary_format[];
 
 extern const char report_tcpInfo[] ;
 extern const char report_tcpInfo[] ;
diff --git a/src/iperf_server_api.c b/src/iperf_server_api.c
index 272db82..78c7099 100644
--- a/src/iperf_server_api.c
+++ b/src/iperf_server_api.c
@@ -1,5 +1,5 @@
 /*
- * iperf, Copyright (c) 2014, 2015, 2016, 2017, The Regents of the University of
+ * iperf, Copyright (c) 2014-2018 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
  * Energy).  All rights reserved.
@@ -89,10 +89,10 @@
     if (!test->json_output) {
 	iperf_printf(test, "-----------------------------------------------------------\n");
 	iperf_printf(test, "Server listening on %d\n", test->server_port);
-    }
-
-    if (!test->json_output)
 	iperf_printf(test, "-----------------------------------------------------------\n");
+	if (test->forceflush)
+	    iflush(test);
+    }
 
     FD_ZERO(&test->read_set);
     FD_ZERO(&test->write_set);
diff --git a/src/libiperf.3 b/src/libiperf.3
index b54bb3e..e88516d 100644
--- a/src/libiperf.3
+++ b/src/libiperf.3
@@ -1,4 +1,4 @@
-.TH LIBIPERF 3 "April 2018" ESnet "User Manuals"
+.TH LIBIPERF 3 "June 2018" ESnet "User Manuals"
 .SH NAME
 libiperf \- API for iperf3 network throughput tester
 
@@ -106,8 +106,8 @@
 .SH AUTHORS
 A list of the contributors to iperf3 can be found within the
 documentation located at
-\fChttp://software.es.net/iperf/dev.html#authors\fR.
+\fChttps://software.es.net/iperf/dev.html#authors\fR.
 
 .SH "SEE ALSO"
 iperf3(1),
-http://software.es.net/iperf/
+https://software.es.net/iperf/
diff --git a/src/t_api.c b/src/t_api.c
new file mode 100644
index 0000000..0669917
--- /dev/null
+++ b/src/t_api.c
@@ -0,0 +1,53 @@
+/*
+ * iperf, Copyright (c) 2017, 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
+ * Energy).  All rights reserved.
+ *
+ * If you have questions about your rights to use or distribute this
+ * software, please contact Berkeley Lab's Technology Transfer
+ * Department at TTD@lbl.gov.
+ *
+ * NOTICE.  This software is owned by the U.S. Department of Energy.
+ * As such, the U.S. Government has been granted for itself and others
+ * acting on its behalf a paid-up, nonexclusive, irrevocable,
+ * worldwide license in the Software to reproduce, prepare derivative
+ * works, and perform publicly and display publicly.  Beginning five
+ * (5) years after the date permission to assert copyright is obtained
+ * from the U.S. Department of Energy, and subject to any subsequent
+ * five (5) year renewals, the U.S. Government is granted for itself
+ * and others acting on its behalf a paid-up, nonexclusive,
+ * irrevocable, worldwide license in the Software to reproduce,
+ * prepare derivative works, distribute copies to the public, perform
+ * publicly and display publicly, and to permit others to do so.
+ *
+ * This code is distributed under a BSD style license, see the LICENSE
+ * file for complete information.
+ */
+
+
+#include <assert.h>
+#ifdef HAVE_STDINT_H
+#include <stdint.h>
+#endif
+#include <stdio.h>
+#include <string.h>
+
+#include "iperf.h"
+#include "iperf_api.h"
+
+#include "version.h"
+
+#include "units.h"
+
+
+int
+main(int argc, char **argv)
+{
+    const char *ver;
+
+    ver = iperf_get_iperf_version();
+    assert(strcmp(ver, IPERF_VERSION) == 0);
+
+    return 0;
+}