openwrt/package/network/utils/iperf/patches/0003-fix-non-ipv6-builds.patch

23 lines
999 B
Diff
Raw Normal View History

Index: iperf-2.0.12/src/Listener.cpp
===================================================================
--- iperf-2.0.12.orig/src/Listener.cpp
+++ iperf-2.0.12/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");
}