iperf: allow non-ipv6 builds
authorAlexander Couzens <lynxis@fe80.eu>
Sat, 3 Nov 2018 00:22:59 +0000 (01:22 +0100)
committerJo-Philipp Wich <jo@mein.io>
Tue, 18 Dec 2018 16:48:10 +0000 (17:48 +0100)
Add configure argument --disable-ipv6 when ipv6 is deselected.
Add fix-non-ipv6-builds.patch as long there is no new upstream
release.

Signed-off-by: Alexander Couzens <lynxis@fe80.eu>
(backported from 900005ee75754ba62972ed8da6eba2d6b47e1b7f)
(rebased patches)
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
package/network/utils/iperf/Makefile
package/network/utils/iperf/patches/0003-fix-non-ipv6-builds.patch [new file with mode: 0644]

index 6facf7bea792a8bf2f0a7baa03c1d64f6adcb181..383eb07949ad4818c876f7dcdad5ca1f0f0b4f37 100644 (file)
@@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
 
 PKG_NAME:=iperf
 PKG_VERSION:=2.0.12
-PKG_RELEASE:=2
+PKG_RELEASE:=3
 
 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
 PKG_HASH:=367f651fb1264b13f6518e41b8a7e08ce3e41b2a1c80e99ff0347561eed32646
@@ -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/0003-fix-non-ipv6-builds.patch b/package/network/utils/iperf/patches/0003-fix-non-ipv6-builds.patch
new file mode 100644 (file)
index 0000000..b7b45e5
--- /dev/null
@@ -0,0 +1,20 @@
+--- a/src/Listener.cpp
++++ b/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");
+     }