Add 1KB to default UDP socket buffer sizes under certain circumstances.
This fixes a problem observed on FreeBSD and macOS where the MTU on the loopback interface is larger than the default socket buffer size. We adjusted the socket buffer size upwards to match the UDP payload size, but that's apparently not enough and we ended up dropping packets. This is bad. Add a 1KB fudge factor, which seesm to avoid this problem. Affects UDP tests only, not TCP or SCTP. Part of #496. (cherry picked from commit d76198944d210e8a575747d3ddbee41a886a10c9) Signed-off-by: Bruce A. Mah <bmah@es.net>
Этот коммит содержится в:
родитель
69ba4e5831
Коммит
1ff12f4c3e
@ -313,6 +313,8 @@ struct iperf_test
|
||||
#define SEC_TO_NS 1000000000LL /* too big for enum/const on some platforms */
|
||||
#define MAX_RESULT_STRING 4096
|
||||
|
||||
#define UDP_BUFFER_EXTRA 1024
|
||||
|
||||
/* constants for command line arg sanity checks */
|
||||
#define MB (1024 * 1024)
|
||||
#define MAX_TCP_BUFFER (512 * MB)
|
||||
|
@ -314,9 +314,10 @@ iperf_udp_accept(struct iperf_test *test)
|
||||
*/
|
||||
if (rc > 0) {
|
||||
if (test->settings->socket_bufsize == 0) {
|
||||
int bufsize = test->settings->blksize + UDP_BUFFER_EXTRA;
|
||||
printf("Increasing socket buffer size to %d\n",
|
||||
test->settings->blksize);
|
||||
test->settings->socket_bufsize = test->settings->blksize;
|
||||
bufsize);
|
||||
test->settings->socket_bufsize = bufsize;
|
||||
rc = iperf_udp_buffercheck(test, s);
|
||||
if (rc < 0)
|
||||
return rc;
|
||||
@ -425,9 +426,10 @@ iperf_udp_connect(struct iperf_test *test)
|
||||
*/
|
||||
if (rc > 0) {
|
||||
if (test->settings->socket_bufsize == 0) {
|
||||
int bufsize = test->settings->blksize + UDP_BUFFER_EXTRA;
|
||||
printf("Increasing socket buffer size to %d\n",
|
||||
test->settings->blksize);
|
||||
test->settings->socket_bufsize = test->settings->blksize;
|
||||
bufsize);
|
||||
test->settings->socket_bufsize = bufsize;
|
||||
rc = iperf_udp_buffercheck(test, s);
|
||||
if (rc < 0)
|
||||
return rc;
|
||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user