Improve detection of IPv6 flowlabel support (Linux only).
We check at configure-time to see if IPV6_FLOWLABEL_MGR is defined in <linux/in.6>, if it is we set a HAVE_FLOWLABEL CPP symbol to turn on conditional compilation of the support for this feature.
This commit is contained in:
parent
8cb96d1405
commit
4155c45471
17
configure.ac
17
configure.ac
@ -63,4 +63,21 @@ if test "x$iperf3_cv_header_tcp_congestion" = "xyes"; then
|
|||||||
AC_DEFINE([HAVE_TCP_CONGESTION], [1], [Have TCP_CONGESTION sockopt.])
|
AC_DEFINE([HAVE_TCP_CONGESTION], [1], [Have TCP_CONGESTION sockopt.])
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Check for IPv6 flowlabel support (believed to be Linux only)
|
||||||
|
# We check for IPV6_FLOWLABEL_MGR in <linux/in6.h> even though we
|
||||||
|
# don't use that file directly (we have our own stripped-down
|
||||||
|
# copy, see src/flowlabel.h for more details).
|
||||||
|
AC_CACHE_CHECK([IPv6 flowlabel support],
|
||||||
|
[iperf3_cv_header_flowlabel],
|
||||||
|
AC_EGREP_CPP(yes,
|
||||||
|
[#include <sys/types.h>
|
||||||
|
#include <linux/in6.h>
|
||||||
|
#ifdef IPV6_FLOWLABEL_MGR
|
||||||
|
yes
|
||||||
|
#endif
|
||||||
|
],iperf3_cv_header_flowlabel=yes,iperf3_cv_header_flowlabel=no))
|
||||||
|
if test "x$iperf3_cv_header_flowlabel" = "xyes"; then
|
||||||
|
AC_DEFINE([HAVE_FLOWLABEL], [1], [Have IPv6 flowlabel support.])
|
||||||
|
fi
|
||||||
|
|
||||||
AC_OUTPUT([Makefile src/Makefile examples/Makefile])
|
AC_OUTPUT([Makefile src/Makefile examples/Makefile])
|
||||||
|
@ -562,7 +562,9 @@ iperf_parse_arguments(struct iperf_test *test, int argc, char **argv)
|
|||||||
{"version4", no_argument, NULL, '4'},
|
{"version4", no_argument, NULL, '4'},
|
||||||
{"version6", no_argument, NULL, '6'},
|
{"version6", no_argument, NULL, '6'},
|
||||||
{"tos", required_argument, NULL, 'S'},
|
{"tos", required_argument, NULL, 'S'},
|
||||||
|
#if defined(HAVE_FLOWLABEL)
|
||||||
{"flowlabel", required_argument, NULL, 'L'},
|
{"flowlabel", required_argument, NULL, 'L'},
|
||||||
|
#endif /* HAVE_FLOWLABEL */
|
||||||
{"zerocopy", no_argument, NULL, 'Z'},
|
{"zerocopy", no_argument, NULL, 'Z'},
|
||||||
{"omit", required_argument, NULL, 'O'},
|
{"omit", required_argument, NULL, 'O'},
|
||||||
{"file", required_argument, NULL, 'F'},
|
{"file", required_argument, NULL, 'F'},
|
||||||
@ -735,17 +737,17 @@ iperf_parse_arguments(struct iperf_test *test, int argc, char **argv)
|
|||||||
client_flag = 1;
|
client_flag = 1;
|
||||||
break;
|
break;
|
||||||
case 'L':
|
case 'L':
|
||||||
#if defined(linux)
|
#if defined(HAVE_FLOWLABEL)
|
||||||
test->settings->flowlabel = strtol(optarg, NULL, 0);
|
test->settings->flowlabel = strtol(optarg, NULL, 0);
|
||||||
if (test->settings->flowlabel < 1 || test->settings->flowlabel > 0xfffff) {
|
if (test->settings->flowlabel < 1 || test->settings->flowlabel > 0xfffff) {
|
||||||
i_errno = IESETFLOW;
|
i_errno = IESETFLOW;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
client_flag = 1;
|
client_flag = 1;
|
||||||
#else /* linux */
|
#else /* HAVE_FLOWLABEL */
|
||||||
i_errno = IEUNIMP;
|
i_errno = IEUNIMP;
|
||||||
return -1;
|
return -1;
|
||||||
#endif /* linux */
|
#endif /* HAVE_FLOWLABEL */
|
||||||
break;
|
break;
|
||||||
case 'Z':
|
case 'Z':
|
||||||
if (!has_sendfile()) {
|
if (!has_sendfile()) {
|
||||||
|
@ -26,9 +26,9 @@
|
|||||||
#include "iperf_tcp.h"
|
#include "iperf_tcp.h"
|
||||||
#include "net.h"
|
#include "net.h"
|
||||||
|
|
||||||
#if defined(linux)
|
#if defined(HAVE_FLOWLABEL)
|
||||||
#include "flowlabel.h"
|
#include "flowlabel.h"
|
||||||
#endif
|
#endif /* HAVE_FLOWLABEL */
|
||||||
|
|
||||||
/* iperf_tcp_recv
|
/* iperf_tcp_recv
|
||||||
*
|
*
|
||||||
@ -361,7 +361,7 @@ iperf_tcp_connect(struct iperf_test *test)
|
|||||||
}
|
}
|
||||||
printf("SO_SNDBUF is %u\n", opt);
|
printf("SO_SNDBUF is %u\n", opt);
|
||||||
}
|
}
|
||||||
#if defined(linux)
|
#if defined(HAVE_FLOWLABEL)
|
||||||
if (test->settings->flowlabel) {
|
if (test->settings->flowlabel) {
|
||||||
if (server_res->ai_addr->sa_family != AF_INET6) {
|
if (server_res->ai_addr->sa_family != AF_INET6) {
|
||||||
saved_errno = errno;
|
saved_errno = errno;
|
||||||
@ -404,7 +404,7 @@ iperf_tcp_connect(struct iperf_test *test)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif /* HAVE_FLOWLABEL */
|
||||||
|
|
||||||
#if defined(linux) && defined(TCP_CONGESTION)
|
#if defined(linux) && defined(TCP_CONGESTION)
|
||||||
if (test->congestion) {
|
if (test->congestion) {
|
||||||
|
@ -114,9 +114,9 @@ const char usage_longstr[] = "Usage: iperf [-s|-c host] [options]\n"
|
|||||||
" -4, --version4 only use IPv4\n"
|
" -4, --version4 only use IPv4\n"
|
||||||
" -6, --version6 only use IPv6\n"
|
" -6, --version6 only use IPv6\n"
|
||||||
" -S, --tos N set the IP 'type of service'\n"
|
" -S, --tos N set the IP 'type of service'\n"
|
||||||
#if defined(linux)
|
#if defined(HAVE_FLOWLABEL)
|
||||||
" -L, --flowlabel N set the IPv6 flow label (only supported on Linux)\n"
|
" -L, --flowlabel N set the IPv6 flow label (only supported on Linux)\n"
|
||||||
#endif
|
#endif /* HAVE_FLOWLABEL */
|
||||||
" -Z, --zerocopy use a 'zero copy' method of sending data\n"
|
" -Z, --zerocopy use a 'zero copy' method of sending data\n"
|
||||||
" -O, --omit N omit the first n seconds\n"
|
" -O, --omit N omit the first n seconds\n"
|
||||||
" -T, --title str prefix every output line with this string\n"
|
" -T, --title str prefix every output line with this string\n"
|
||||||
|
Loading…
Reference in New Issue
Block a user