1
1

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.
Этот коммит содержится в:
Bruce A. Mah 2014-04-10 11:20:36 -07:00
родитель 8cb96d1405
Коммит 4155c45471
4 изменённых файлов: 28 добавлений и 9 удалений

Просмотреть файл

@ -63,4 +63,21 @@ if test "x$iperf3_cv_header_tcp_congestion" = "xyes"; then
AC_DEFINE([HAVE_TCP_CONGESTION], [1], [Have TCP_CONGESTION sockopt.])
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])

Просмотреть файл

@ -562,7 +562,9 @@ iperf_parse_arguments(struct iperf_test *test, int argc, char **argv)
{"version4", no_argument, NULL, '4'},
{"version6", no_argument, NULL, '6'},
{"tos", required_argument, NULL, 'S'},
#if defined(HAVE_FLOWLABEL)
{"flowlabel", required_argument, NULL, 'L'},
#endif /* HAVE_FLOWLABEL */
{"zerocopy", no_argument, NULL, 'Z'},
{"omit", required_argument, NULL, 'O'},
{"file", required_argument, NULL, 'F'},
@ -735,17 +737,17 @@ iperf_parse_arguments(struct iperf_test *test, int argc, char **argv)
client_flag = 1;
break;
case 'L':
#if defined(linux)
#if defined(HAVE_FLOWLABEL)
test->settings->flowlabel = strtol(optarg, NULL, 0);
if (test->settings->flowlabel < 1 || test->settings->flowlabel > 0xfffff) {
i_errno = IESETFLOW;
return -1;
}
client_flag = 1;
#else /* linux */
#else /* HAVE_FLOWLABEL */
i_errno = IEUNIMP;
return -1;
#endif /* linux */
#endif /* HAVE_FLOWLABEL */
break;
case 'Z':
if (!has_sendfile()) {

Просмотреть файл

@ -26,9 +26,9 @@
#include "iperf_tcp.h"
#include "net.h"
#if defined(linux)
#if defined(HAVE_FLOWLABEL)
#include "flowlabel.h"
#endif
#endif /* HAVE_FLOWLABEL */
/* iperf_tcp_recv
*
@ -361,7 +361,7 @@ iperf_tcp_connect(struct iperf_test *test)
}
printf("SO_SNDBUF is %u\n", opt);
}
#if defined(linux)
#if defined(HAVE_FLOWLABEL)
if (test->settings->flowlabel) {
if (server_res->ai_addr->sa_family != AF_INET6) {
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 (test->congestion) {

Просмотреть файл

@ -114,9 +114,9 @@ const char usage_longstr[] = "Usage: iperf [-s|-c host] [options]\n"
" -4, --version4 only use IPv4\n"
" -6, --version6 only use IPv6\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"
#endif
#endif /* HAVE_FLOWLABEL */
" -Z, --zerocopy use a 'zero copy' method of sending data\n"
" -O, --omit N omit the first n seconds\n"
" -T, --title str prefix every output line with this string\n"