aboutsummaryrefslogtreecommitdiff
path: root/src/iperf_udp.c
diff options
context:
space:
mode:
authorBruce A. Mah <bmah@es.net>2016-12-01 11:53:37 -0800
committerBruce A. Mah <bmah@es.net>2016-12-01 11:53:37 -0800
commit55598a072f681fbaeaa25a7cc884640bac8a3813 (patch)
tree02aa3803ec0ba5efa84e00f10474ea45bbaf57cb /src/iperf_udp.c
parenta621cc263f28fff724a45f6b5ae86cd9290cff5c (diff)
downloadiperf3-55598a072f681fbaeaa25a7cc884640bac8a3813.tar.gz
Fix socket buffer size checks. Clearly this wasn't tested well.
On Linux it's possible to set the socket buffer to one size but (correctly it seems) get back some larger size up to 2x what you asked for (see tcp(7)). While here, make related debugging output more useful. Fixes (again) #356.
Diffstat (limited to 'src/iperf_udp.c')
-rw-r--r--src/iperf_udp.c32
1 files changed, 16 insertions, 16 deletions
diff --git a/src/iperf_udp.c b/src/iperf_udp.c
index 03b94d7..c92be55 100644
--- a/src/iperf_udp.c
+++ b/src/iperf_udp.c
@@ -252,13 +252,13 @@ iperf_udp_accept(struct iperf_test *test)
i_errno = IESETBUF;
return -1;
}
- if (test->settings->socket_bufsize && test->settings->socket_bufsize != opt) {
+ if (test->debug) {
+ printf("SNDBUF is %u, expecting %u\n", opt, test->settings->socket_bufsize);
+ }
+ if (test->settings->socket_bufsize && test->settings->socket_bufsize > opt) {
i_errno = IESETBUF2;
return -1;
}
- if (test->debug) {
- printf("SO_SNDBUF is %u\n", opt);
- }
/* Read back and verify the receiver socket buffer size */
optlen = sizeof(opt);
@@ -266,13 +266,13 @@ iperf_udp_accept(struct iperf_test *test)
i_errno = IESETBUF;
return -1;
}
- if (test->settings->socket_bufsize && test->settings->socket_bufsize != opt) {
+ if (test->debug) {
+ printf("RCVBUF is %u, expecting %u\n", opt, test->settings->socket_bufsize);
+ }
+ if (test->settings->socket_bufsize && test->settings->socket_bufsize > opt) {
i_errno = IESETBUF2;
return -1;
}
- if (test->debug) {
- printf("SO_RCVBUF is %u\n", opt);
- }
#if defined(HAVE_SO_MAX_PACING_RATE)
/* If socket pacing is available and not disabled, try it. */
@@ -388,13 +388,13 @@ iperf_udp_connect(struct iperf_test *test)
i_errno = IESETBUF;
return -1;
}
- if (test->settings->socket_bufsize && test->settings->socket_bufsize != opt) {
+ if (test->debug) {
+ printf("SNDBUF is %u, expecting %u\n", opt, test->settings->socket_bufsize);
+ }
+ if (test->settings->socket_bufsize && test->settings->socket_bufsize > opt) {
i_errno = IESETBUF2;
return -1;
}
- if (test->debug) {
- printf("SO_SNDBUF is %u\n", opt);
- }
/* Read back and verify the receiver socket buffer size */
optlen = sizeof(opt);
@@ -402,13 +402,13 @@ iperf_udp_connect(struct iperf_test *test)
i_errno = IESETBUF;
return -1;
}
- if (test->settings->socket_bufsize && test->settings->socket_bufsize != opt) {
+ if (test->debug) {
+ printf("RCVBUF is %u, expecting %u\n", opt, test->settings->socket_bufsize);
+ }
+ if (test->settings->socket_bufsize && test->settings->socket_bufsize > opt) {
i_errno = IESETBUF2;
return -1;
}
- if (test->debug) {
- printf("SO_RCVBUF is %u\n", opt);
- }
#if defined(HAVE_SO_MAX_PACING_RATE)
/* If socket pacing is available and not disabled, try it. */