From: Arne Schwabe Date: Thu, 15 Oct 2015 14:38:38 +0000 (+0200) Subject: Do not set the buffer size by default but rely on the operation system default. X-Git-Tag: v2.4_alpha1~216 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=f0b64e5dc00f35e3b0fe8c53a316ee74c9cbf15f;p=thirdparty%2Fopenvpn.git Do not set the buffer size by default but rely on the operation system default. Also remove SOCKET_SND_RCV_BUF_MAX since limiting the buffer to 1000k is arbitrary and all OSes impose a maximum that can be set anyway. closes trac ticket #461 V2: SOCKET_SND_RCV_BUF_MAX removal Acked-by: Gert Doering Message-Id: <1444919918-4525-1-git-send-email-arne@rfc2549.org> URL: http://article.gmane.org/gmane.network.openvpn.devel/10280 Signed-off-by: Gert Doering --- diff --git a/doc/openvpn.8 b/doc/openvpn.8 index 3a864094b..b6d5aedce 100644 --- a/doc/openvpn.8 +++ b/doc/openvpn.8 @@ -1433,12 +1433,12 @@ connection problems) with the following options: .TP .B \-\-sndbuf size Set the TCP/UDP socket send buffer size. -Currently defaults to 65536 bytes. +Defaults to operation system default. .\"********************************************************* .TP .B \-\-rcvbuf size Set the TCP/UDP socket receive buffer size. -Currently defaults to 65536 bytes. +Defaults to operation system default. .\"********************************************************* .TP .B \-\-mark value diff --git a/src/openvpn/options.c b/src/openvpn/options.c index 565483079..2f8915daa 100644 --- a/src/openvpn/options.c +++ b/src/openvpn/options.c @@ -785,10 +785,6 @@ init_options (struct options *o, const bool init_gc) #ifdef ENABLE_FEATURE_TUN_PERSIST o->persist_mode = 1; #endif -#ifndef WIN32 - o->rcvbuf = 65536; - o->sndbuf = 65536; -#endif #ifdef TARGET_LINUX o->tuntap_options.txqueuelen = 100; #endif diff --git a/src/openvpn/socket.c b/src/openvpn/socket.c index 925665c52..b24d9ad5f 100644 --- a/src/openvpn/socket.c +++ b/src/openvpn/socket.c @@ -623,12 +623,9 @@ static void socket_set_sndbuf (int sd, int size) { #if defined(HAVE_SETSOCKOPT) && defined(SOL_SOCKET) && defined(SO_SNDBUF) - if (size > 0 && size < SOCKET_SND_RCV_BUF_MAX) + if (setsockopt (sd, SOL_SOCKET, SO_SNDBUF, (void *) &size, sizeof (size)) != 0) { - if (setsockopt (sd, SOL_SOCKET, SO_SNDBUF, (void *) &size, sizeof (size)) != 0) - { - msg (M_WARN, "NOTE: setsockopt SO_SNDBUF=%d failed", size); - } + msg (M_WARN, "NOTE: setsockopt SO_SNDBUF=%d failed", size); } #endif } @@ -652,13 +649,10 @@ static bool socket_set_rcvbuf (int sd, int size) { #if defined(HAVE_SETSOCKOPT) && defined(SOL_SOCKET) && defined(SO_RCVBUF) - if (size > 0 && size < SOCKET_SND_RCV_BUF_MAX) + if (setsockopt (sd, SOL_SOCKET, SO_RCVBUF, (void *) &size, sizeof (size)) != 0) { - if (setsockopt (sd, SOL_SOCKET, SO_RCVBUF, (void *) &size, sizeof (size)) != 0) - { - msg (M_WARN, "NOTE: setsockopt SO_RCVBUF=%d failed", size); - return false; - } + msg (M_WARN, "NOTE: setsockopt SO_RCVBUF=%d failed", size); + return false; } return true; #endif diff --git a/src/openvpn/socket.h b/src/openvpn/socket.h index 49cfab680..54cdc8878 100644 --- a/src/openvpn/socket.h +++ b/src/openvpn/socket.h @@ -41,11 +41,6 @@ */ #define OPENVPN_PORT "1194" -/* - * Maximum size passed passed to setsockopt SNDBUF/RCVBUF - */ -#define SOCKET_SND_RCV_BUF_MAX 1000000 - /* * Number of seconds that "resolv-retry infinite" * represents.