Skip to contentSkip to conversation

Fix socket-flag/TCP_NODELAY on Mac OS X

PATCH In review James Bekkema 3 participants 3 messages Jun 26, 2014 – Jun 30, 2014

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Fix socket-flag/TCP_NODELAY on Mac OS X

Hi All,

OpenVPN 2.3.4 will currently throw a warning of "NOTE: setsockopt TCP_NODELAY=1 failed (No kernel support)” when attempting to use the TCP_NODELAY socket option on Mac OS X/Darwin. Kernel support is there, however the required header file where TCP_NODELAY is defined is not being included. This patch simply alters syshead.h to include <netinet/tcp.h> on Darwin platforms.

openvpn/syshead.h renamed from openvpn/syshead.h.orig +8 -0
@@ -349,6 +349,14 @@
 
 #endif /* TARGET_DRAGONFLY */
 
+#ifdef TARGET_DARWIN
+
+#ifdef HAVE_NETINET_TCP_H
+#include <netinet/tcp.h>
+#endif
+
+#endif /* TARGET_DARWIN */
+
 #ifdef WIN32
 #include <iphlpapi.h>
 #include <ntddndis.h>

Tested under 10.7 to 10.10dp2. "Socket flags: TCP_NODELAY=1 succeeded” when running with debug enabled. In addition the latest beta version of Viscosity is using a copy of OpenVPN with this patch applied: no issues have been reported from testers thus far.

Regards,
James

--
James Bekkema
SparkLabs Developer
http://www.sparklabs.com
http://www.twitter.com/sparklabs
[email protected]...

#1 lore raw

Am 26.06.14 13:40, schrieb James Bekkema:

Quoted 24 lines

Hi All,

OpenVPN 2.3.4 will currently throw a warning of "NOTE: setsockopt TCP_NODELAY=1 failed (No kernel support)” when attempting to use the TCP_NODELAY socket option on Mac OS X/Darwin. Kernel support is there, however the required header file where TCP_NODELAY is defined is not being included. This patch simply alters syshead.h to include <netinet/tcp.h> on Darwin platforms.

openvpn/syshead.h renamed from openvpn/syshead.h.orig +8 -0
@@ -349,6 +349,14 @@
 
 #endif /* TARGET_DRAGONFLY */
 
+#ifdef TARGET_DARWIN
+
+#ifdef HAVE_NETINET_TCP_H
+#include <netinet/tcp.h>
+#endif
+
+#endif /* TARGET_DARWIN */
+
 #ifdef WIN32
 #include <iphlpapi.h>
 #include <ntddndis.h>
Quoted 2 lines

Tested under 10.7 to 10.10dp2. "Socket flags: TCP_NODELAY=1 succeeded” when running with debug enabled. In addition the latest beta version of Viscosity is using a copy of OpenVPN with this patch applied: no issues have been reported from testers thus far.

Ack.

Arne

#2 lore raw
In reply to James Bekkema

Thanks. Patch has been applied to the master and release/2.3 branches.

commit 37170767a221a4847416fc339083704ae1b4c001 (master) commit 066202de18a13d67664534d10698eda1fdeab381 (release/2.3)

Author: James Bekkema
Date:   Thu Jun 26 21:40:39 2014 +1000
     Fix socket-flag/TCP_NODELAY on Mac OS X

     Acked-by: Arne Schwabe <[email protected]...>
     Message-Id: <[email protected]...>
     URL: http://article.gmane.org/gmane.network.openvpn.devel/8809
     Signed-off-by: Gert Doering <[email protected]...>

--
kind regards,

Gert Doering