[OpenWrt-Devel] [PATCH] package/iperf: fix build for non-ipv6 builds
Alexander Couzens
lynxis at fe80.eu
Thu Jul 12 10:58:00 EDT 2018
Signed-off-by: Alexander Couzens <lynxis at fe80.eu>
---
package/network/utils/iperf/Makefile | 6 +++-
.../patches/0001-fix-non-ipv6-builds.patch | 36 +++++++++++++++++++
2 files changed, 41 insertions(+), 1 deletion(-)
create mode 100644 package/network/utils/iperf/patches/0001-fix-non-ipv6-builds.patch
diff --git a/package/network/utils/iperf/Makefile b/package/network/utils/iperf/Makefile
index 606ba218def7..dd9ade95bf3f 100644
--- a/package/network/utils/iperf/Makefile
+++ b/package/network/utils/iperf/Makefile
@@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
PKG_NAME:=iperf
PKG_VERSION:=2.0.11
-PKG_RELEASE:=1
+PKG_RELEASE:=2
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_HASH:=b7d650d07c6bb0e357b5938a20e4ac33876012fddb952299c5d321e6958da5d2
@@ -40,6 +40,10 @@ endef
TARGET_CFLAGS += -D_GNU_SOURCE
CONFIGURE_ARGS += --disable-multicast
+ifeq ($(CONFIG_IPV6),)
+ CONFIGURE_ARGS += --disable-ipv6
+endif
+
CONFIGURE_VARS += CXXFLAGS="$$$$CXXFLAGS -fno-rtti"
CONFIGURE_VARS += LIBS="-lpthread -lm"
diff --git a/package/network/utils/iperf/patches/0001-fix-non-ipv6-builds.patch b/package/network/utils/iperf/patches/0001-fix-non-ipv6-builds.patch
new file mode 100644
index 000000000000..a6a51570f48e
--- /dev/null
+++ b/package/network/utils/iperf/patches/0001-fix-non-ipv6-builds.patch
@@ -0,0 +1,36 @@
+Index: iperf-2.0.11/src/Listener.cpp
+===================================================================
+--- iperf-2.0.11.orig/src/Listener.cpp
++++ iperf-2.0.11/src/Listener.cpp
+@@ -670,6 +670,7 @@ int Listener::L2_setup (void) {
+
+ // Now optimize packet flow up the raw socket
+ // Establish the flow BPF to forward up only "connected" packets to this raw socket
++#ifdef HAVE_IPV6
+ if (l->sa_family == AF_INET6) {
+ struct in6_addr *v6peer = SockAddr_get_in6_addr(&server->peer);
+ struct in6_addr *v6local = SockAddr_get_in6_addr(&server->local);
+@@ -682,6 +683,9 @@ int Listener::L2_setup (void) {
+ WARN_errno( rc == SOCKET_ERROR, "l2 v4in6 connect ip bpf");
+ }
+ } else {
++#else
++ {
++#endif
+ rc = SockAddr_v4_Connect_BPF(server->mSock, ((struct sockaddr_in *)(l))->sin_addr.s_addr, ((struct sockaddr_in *)(p))->sin_addr.s_addr, ((struct sockaddr_in *)(l))->sin_port, ((struct sockaddr_in *)(p))->sin_port);
+ WARN_errno( rc == SOCKET_ERROR, "l2 connect ip bpf");
+ }
+Index: iperf-2.0.11/src/SocketAddr.c
+===================================================================
+--- iperf-2.0.11.orig/src/SocketAddr.c
++++ iperf-2.0.11/src/SocketAddr.c
+@@ -317,7 +317,8 @@ void SockAddr_setAddressAny( iperf_socka
+ * ------------------------------------------------------------------- */
+
+ void SockAddr_incrAddress( iperf_sockaddr *inSockAddr, int value ) {
+- if (inSockAddr->ss_family == AF_INET)
++ struct sockaddr_storage *storage = inSockAddr;
++ if (storage->ss_family == AF_INET)
+ ((struct sockaddr_in *)inSockAddr)->sin_addr.s_addr += htonl(value);
+ #if defined(HAVE_IPV6)
+ else {
--
2.18.0
_______________________________________________
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel
More information about the openwrt-devel
mailing list