Fix build on Linux distros that don't support TCP_CONGESTION.
Apparently older kernels don't support TCP_CONGESTION, so we can't just test for defined(linux) to know if we can use this sockopt or not. This change unbreaks the build on (notably) CentOS 5.
This commit is contained in:
parent
7234074fe8
commit
0ff7575499
@ -540,7 +540,7 @@ iperf_parse_arguments(struct iperf_test *test, int argc, char **argv)
|
|||||||
{"affinity", required_argument, NULL, 'A'},
|
{"affinity", required_argument, NULL, 'A'},
|
||||||
#endif
|
#endif
|
||||||
{"title", required_argument, NULL, 'T'},
|
{"title", required_argument, NULL, 'T'},
|
||||||
#if defined(linux)
|
#if defined(linux) && defined(TCP_CONGESTION)
|
||||||
{"linux-congestion", required_argument, NULL, 'C'},
|
{"linux-congestion", required_argument, NULL, 'C'},
|
||||||
#endif
|
#endif
|
||||||
{"debug", no_argument, NULL, 'd'},
|
{"debug", no_argument, NULL, 'd'},
|
||||||
@ -747,7 +747,7 @@ iperf_parse_arguments(struct iperf_test *test, int argc, char **argv)
|
|||||||
client_flag = 1;
|
client_flag = 1;
|
||||||
break;
|
break;
|
||||||
case 'C':
|
case 'C':
|
||||||
#if defined(linux)
|
#if defined(linux) && defined(TCP_CONGESTION)
|
||||||
test->congestion = strdup(optarg);
|
test->congestion = strdup(optarg);
|
||||||
client_flag = 1;
|
client_flag = 1;
|
||||||
#else /* linux */
|
#else /* linux */
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2009-2011, The Regents of the University of California,
|
* Copyright (c) 2009-2014, The Regents of the University of California,
|
||||||
* through Lawrence Berkeley National Laboratory (subject to receipt of any
|
* through Lawrence Berkeley National Laboratory (subject to receipt of any
|
||||||
* required approvals from the U.S. Dept. of Energy). All rights reserved.
|
* required approvals from the U.S. Dept. of Energy). All rights reserved.
|
||||||
*
|
*
|
||||||
@ -184,7 +184,7 @@ iperf_tcp_listen(struct iperf_test *test)
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#if defined(linux)
|
#if defined(linux) && defined(TCP_CONGESTION)
|
||||||
if (test->congestion) {
|
if (test->congestion) {
|
||||||
if (setsockopt(s, IPPROTO_TCP, TCP_CONGESTION, test->congestion, strlen(test->congestion)) < 0) {
|
if (setsockopt(s, IPPROTO_TCP, TCP_CONGESTION, test->congestion, strlen(test->congestion)) < 0) {
|
||||||
close(s);
|
close(s);
|
||||||
@ -373,7 +373,7 @@ iperf_tcp_connect(struct iperf_test *test)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(linux)
|
#if defined(linux) && defined(TCP_CONGESTION)
|
||||||
if (test->congestion) {
|
if (test->congestion) {
|
||||||
if (setsockopt(s, IPPROTO_TCP, TCP_CONGESTION, test->congestion, strlen(test->congestion)) < 0) {
|
if (setsockopt(s, IPPROTO_TCP, TCP_CONGESTION, test->congestion, strlen(test->congestion)) < 0) {
|
||||||
close(s);
|
close(s);
|
||||||
|
Loading…
Reference in New Issue
Block a user