iperf3: update to 3.3 and refresh patches

Taking the same patchset I've submitted upstream for inclusion.

Signed-off-by: Philip Prindeville <philipp@redfish-solutions.com>
owl
Philip Prindeville 2017-10-31 14:19:51 -06:00 committed by John Crispin
parent bd60c9063d
commit e03dcf494e
4 changed files with 302 additions and 60 deletions

View File

@ -8,12 +8,12 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=iperf
PKG_VERSION:=3.2
PKG_VERSION:=3.3
PKG_RELEASE:=1
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=http://downloads.es.net/pub/iperf
PKG_HASH:=f207b36f861485845dbdf09f909c62f3d2222a3cf3d2682095aede8213cd9c1d
PKG_HASH:=6f596271251056bffc11bbb8f17d4244ad9a7d4a317c2459fdbb853ae51284d8
PKG_MAINTAINER:=Felix Fietkau <nbd@nbd.name>
PKG_LICENSE:=BSD-3-Clause

View File

@ -1,41 +0,0 @@
commit 3fd1a2ae907bff2d7593c0bb9944aa05eca7b58d
Author: ralcini <roberto.alcini@gmail.com>
Date: Mon Aug 14 22:43:38 2017 +0200
fix for issue #624 - force build without openssl (#631)
* fix: now --without-openssl configure flags works
enh: if openssl support is required and no valid installation is found, now it raise an error
* enh: added warning if building without openssl (iperf_auth disabled)
diff --git a/configure.ac b/configure.ac
index 3c56cb3..79f3869 100644
--- a/configure.ac
+++ b/configure.ac
@@ -101,13 +101,18 @@ AC_CHECK_HEADERS([netinet/sctp.h],
#endif
])
-# Check for OPENSSL support
-AX_CHECK_OPENSSL(
- AC_DEFINE([HAVE_SSL], [1], [OpenSSL Is Available])
-)
-LDFLAGS="$LDFLAGS $OPENSSL_LDFLAGS"
-LIBS="$OPENSSL_LIBS $LIBS"
-CPPFLAGS="$OPENSSL_INCLUDES $CPPFLAGS"
+if test "x$with_openssl" = "xno"; then
+ AC_MSG_WARN( [Building without OpenSSL; disabling iperf_auth functionality.] )
+else
+ # Check for OPENSSL support
+ AX_CHECK_OPENSSL(
+ [ AC_DEFINE([HAVE_SSL], [1], [OpenSSL Is Available]) ],
+ [ AC_MSG_FAILURE([--with-openssl was given, but test for openssl failed]) ]
+ )
+ LDFLAGS="$LDFLAGS $OPENSSL_LDFLAGS"
+ LIBS="$OPENSSL_LIBS $LIBS"
+ CPPFLAGS="$OPENSSL_INCLUDES $CPPFLAGS"
+fi
# Check for TCP_CONGESTION sockopt (believed to be Linux and FreeBSD only)
AC_CACHE_CHECK([TCP_CONGESTION socket option],

View File

@ -0,0 +1,300 @@
The following patches are taken directly from:
https://github.com/esnet/iperf/pull/664
as an upstream submission.
commit b63d41b25f49a76d0be66edfb61bd4cb68921d55
Author: Philip Prindeville <philipp@redfish-solutions.com>
Date: Tue Oct 31 13:41:08 2017 -0600
Fix warnings about _GNU_SOURCE being redefined.
Signed-off-by: Philip Prindeville <philipp@redfish-solutions.com>
diff --git a/src/iperf.h b/src/iperf.h
index bb951dc..b656784 100755
--- a/src/iperf.h
+++ b/src/iperf.h
@@ -36,7 +36,9 @@
#endif
#include <sys/select.h>
#include <sys/socket.h>
-#define _GNU_SOURCE
+#ifndef _GNU_SOURCE
+# define _GNU_SOURCE
+#endif
#include <netinet/tcp.h>
#if defined(HAVE_CPUSET_SETAFFINITY)
diff --git a/src/iperf_api.c b/src/iperf_api.c
index ab30b93..9e41238 100755
--- a/src/iperf_api.c
+++ b/src/iperf_api.c
@@ -24,7 +24,9 @@
* This code is distributed under a BSD style license, see the LICENSE file
* for complete information.
*/
-#define _GNU_SOURCE
+#ifndef _GNU_SOURCE
+# define _GNU_SOURCE
+#endif
#define __USE_GNU
#include "iperf_config.h"
commit 315254cfc5f5682627f4a46ade3100bc3c64cfcc
Author: Philip Prindeville <philipp@redfish-solutions.com>
Date: Tue Oct 31 13:42:58 2017 -0600
Fix warnings of format-specified mismatching type
Signed-off-by: Philip Prindeville <philipp@redfish-solutions.com>
diff --git a/src/iperf_tcp.c b/src/iperf_tcp.c
index 91cf032..6f86d5d 100644
--- a/src/iperf_tcp.c
+++ b/src/iperf_tcp.c
@@ -24,8 +24,6 @@
* This code is distributed under a BSD style license, see the LICENSE
* file for complete information.
*/
-#include "iperf_config.h"
-
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -44,6 +42,12 @@
#include "net.h"
#include "cjson.h"
+#if defined(HAVE_INTTYPES_H)
+# include <inttypes.h>
+#else
+# define PRIu64 "llu"
+#endif
+
#if defined(HAVE_FLOWLABEL)
#include "flowlabel.h"
#endif /* HAVE_FLOWLABEL */
@@ -90,7 +94,7 @@ iperf_tcp_send(struct iperf_stream *sp)
sp->result->bytes_sent_this_interval += r;
if (sp->test->debug)
- printf("sent %d bytes of %d, total %llu\n", r, sp->settings->blksize, sp->result->bytes_sent);
+ printf("sent %d bytes of %d, total %" PRIu64 "\n", r, sp->settings->blksize, sp->result->bytes_sent);
return r;
}
diff --git a/src/iperf_udp.c b/src/iperf_udp.c
index a2ea6d0..d04ae44 100644
--- a/src/iperf_udp.c
+++ b/src/iperf_udp.c
@@ -48,6 +48,12 @@
#include "cjson.h"
#include "portable_endian.h"
+#if defined(HAVE_INTTYPES_H)
+# include <inttypes.h>
+#else
+# define PRIu64 "llu"
+#endif
+
/* iperf_udp_recv
*
* receives the data for UDP
@@ -98,7 +104,7 @@ iperf_udp_recv(struct iperf_stream *sp)
}
if (sp->test->debug)
- fprintf(stderr, "pcount %llu packet_count %d\n", pcount, sp->packet_count);
+ fprintf(stderr, "pcount %" PRIu64 " packet_count %d\n", pcount, sp->packet_count);
/*
* Try to handle out of order packets. The way we do this
@@ -141,7 +147,7 @@ iperf_udp_recv(struct iperf_stream *sp)
/* Log the out-of-order packet */
if (sp->test->debug)
- fprintf(stderr, "OUT OF ORDER - incoming packet sequence %llu but expected sequence %d on stream %d", pcount, sp->packet_count, sp->socket);
+ fprintf(stderr, "OUT OF ORDER - incoming packet sequence %" PRIu64 " but expected sequence %d on stream %d", pcount, sp->packet_count, sp->socket);
}
/*
@@ -220,7 +226,7 @@ iperf_udp_send(struct iperf_stream *sp)
sp->result->bytes_sent_this_interval += r;
if (sp->test->debug)
- printf("sent %d bytes of %d, total %llu\n", r, sp->settings->blksize, sp->result->bytes_sent);
+ printf("sent %d bytes of %d, total %" PRIu64 "\n", r, sp->settings->blksize, sp->result->bytes_sent);
return r;
}
commit 9a66b3b0349e0a158bb4940b668a5cbc7c245762
Author: Philip Prindeville <philipp@redfish-solutions.com>
Date: Tue Oct 31 13:44:34 2017 -0600
Simplify endianness checks
Linux can be built with too many types of C run-time library and it's
not reasonable to have to enumerate all of them, especially since at
least one of them (MUSL) goes out of its way to not be easily
detectable.
Instead, leverage autoconf better for Linux/BSD to detect either
<endian.h> or <sys/endian.h> directly.
Signed-off-by: Philip Prindeville <philipp@redfish-solutions.com>
diff --git a/configure.ac b/configure.ac
index f57e83f..cfb42ac 100644
--- a/configure.ac
+++ b/configure.ac
@@ -101,6 +101,14 @@ AC_CHECK_HEADERS([netinet/sctp.h],
#endif
])
+AC_CHECK_HEADER([endian.h],
+ AC_DEFINE([HAVE_ENDIAN_H], [1], [Define to 1 if you have the <endian.h> header file.]),
+ AC_CHECK_HEADER([sys/endian.h],
+ AC_DEFINE([HAVE_SYS_ENDIAN_H], [1], [Define to 1 if you have the <sys/endian.h> header file.]),
+ AC_MSG_WARN([Couldn't find endian.h or sys/endian.h files: doing compile-time tests.])
+ )
+ )
+
if test "x$with_openssl" = "xno"; then
AC_MSG_WARN( [Building without OpenSSL; disabling iperf_auth functionality.] )
else
diff --git a/src/iperf_config.h.in b/src/iperf_config.h.in
index bd03935..a9e51ec 100644
--- a/src/iperf_config.h.in
+++ b/src/iperf_config.h.in
@@ -9,6 +9,9 @@
/* Define to 1 if you have the <dlfcn.h> header file. */
#undef HAVE_DLFCN_H
+/* Define to 1 if you have the <endian.h> header file. */
+#undef HAVE_ENDIAN_H
+
/* Have IPv6 flowlabel support. */
#undef HAVE_FLOWLABEL
@@ -54,6 +57,9 @@
/* Define to 1 if the system has the type `struct sctp_assoc_value'. */
#undef HAVE_STRUCT_SCTP_ASSOC_VALUE
+/* Define to 1 if you have the <sys/endian.h> header file. */
+#undef HAVE_SYS_ENDIAN_H
+
/* Define to 1 if you have the <sys/socket.h> header file. */
#undef HAVE_SYS_SOCKET_H
diff --git a/src/portable_endian.h b/src/portable_endian.h
index b86d37a..5dbc6e5 100644
--- a/src/portable_endian.h
+++ b/src/portable_endian.h
@@ -10,14 +10,33 @@
#endif
-// GLIBC / Linux with endian(3) support, which was added in glibc 2.9.
-// Intended to support CentOS 6 and newer.
-#if defined(__linux__) && \
- ((__GLIBC__ > 3) || \
- (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 9))
-
+#if defined(HAVE_ENDIAN_H)
# include <endian.h>
+#elif defined(HAVE_SYS_ENDIAN_H)
+# include <sys/endian.h>
+
+# if defined(__OpenBSD__)
+
+# define be16toh(x) betoh16(x)
+# define le16toh(x) letoh16(x)
+
+# define be32toh(x) betoh32(x)
+# define le32toh(x) letoh32(x)
+
+# define be64toh(x) betoh64(x)
+# define le64toh(x) letoh64(x)
+
+# elif defined(__sgi)
+
+# include <netinet/in.h>
+# include <inttypes.h>
+
+# define be64toh(x) (x)
+# define htobe64(x) (x)
+
+# endif
+
#elif defined(__CYGWIN__)
# include <endian.h>
@@ -46,32 +65,6 @@
# define __LITTLE_ENDIAN LITTLE_ENDIAN
# define __PDP_ENDIAN PDP_ENDIAN
-#elif defined(__OpenBSD__)
-
-# include <sys/endian.h>
-
-# define be16toh(x) betoh16(x)
-# define le16toh(x) letoh16(x)
-
-# define be32toh(x) betoh32(x)
-# define le32toh(x) letoh32(x)
-
-# define be64toh(x) betoh64(x)
-# define le64toh(x) letoh64(x)
-
-#elif defined(__NetBSD__) || defined(__FreeBSD__) || defined(__DragonFly__)
-
-# include <sys/endian.h>
-
-#elif defined(__sgi)
-
-# include <sys/endian.h>
-# include <netinet/in.h>
-# include <inttypes.h>
-
-# define be64toh(x) (x)
-# define htobe64(x) (x)
-
#elif defined(__sun) && defined(__SVR4)
# include <sys/types.h>
commit 7e7285d0daf92ef7beda8f78a6f63cc647a77f38
Author: Philip Prindeville <philipp@redfish-solutions.com>
Date: Tue Oct 31 13:48:06 2017 -0600
Sys headers should not be included directly
There's usually a top-level header which then includes the sys/
descendent.
Signed-off-by: Philip Prindeville <philipp@redfish-solutions.com>
diff --git a/src/net.c b/src/net.c
index af456cb..afd0022 100644
--- a/src/net.c
+++ b/src/net.c
@@ -31,13 +31,12 @@
#include <errno.h>
#include <sys/socket.h>
#include <sys/types.h>
-#include <sys/errno.h>
#include <netinet/in.h>
#include <netinet/tcp.h>
#include <assert.h>
#include <netdb.h>
#include <string.h>
-#include <sys/fcntl.h>
+#include <fcntl.h>
#ifdef HAVE_SENDFILE
#ifdef linux

View File

@ -1,17 +0,0 @@
commit 31d5b6b580a356c5149dbc4f53118b7f83c60822
Author: Philip Prindeville <philipp@redfish-solutions.com>
Date: Sun Jul 30 18:54:46 2017 -0600
Subject: Add required RSA header for OpenSSL
Signed-off-by: Philip Prindeville <philipp@redfish-solutions.com>
--- a/src/iperf_auth.c 2017-06-26 11:42:56.000000000 -0600
+++ b/src/iperf_auth.c 2017-07-30 17:42:43.070447875 -0600
@@ -40,6 +40,7 @@
#include <openssl/pem.h>
#include <openssl/sha.h>
#include <openssl/buffer.h>
+#include <openssl/rsa.h>
void sha256(const char *string, char outputBuffer[65])
{