summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjsing <jsing@openbsd.org>2014-06-24 17:30:00 +0000
committerjsing <jsing@openbsd.org>2014-06-24 17:30:00 +0000
commit37aae7a4401c06f6f0d96f20113c2905b525b39e (patch)
tree679dbfdfb8d11c2360dcd482e74b48760b9ae3ed
parentThe Perl close() function, when called on pipe file descriptors, (diff)
downloadwireguard-openbsd-37aae7a4401c06f6f0d96f20113c2905b525b39e.tar.xz
wireguard-openbsd-37aae7a4401c06f6f0d96f20113c2905b525b39e.zip
Actually make BIO_set_tcp_ndelay() work - TCP_NODELAY will not magically
appear by itself. ok beck@ miod@
-rw-r--r--lib/libcrypto/bio/b_sock.c19
-rw-r--r--lib/libssl/src/crypto/bio/b_sock.c19
2 files changed, 6 insertions, 32 deletions
diff --git a/lib/libcrypto/bio/b_sock.c b/lib/libcrypto/bio/b_sock.c
index ec28ba2e82f..62d545a1299 100644
--- a/lib/libcrypto/bio/b_sock.c
+++ b/lib/libcrypto/bio/b_sock.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: b_sock.c,v 1.41 2014/06/22 16:47:08 jsing Exp $ */
+/* $OpenBSD: b_sock.c,v 1.42 2014/06/24 17:30:00 jsing Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
@@ -60,6 +60,7 @@
#include <sys/socket.h>
#include <netinet/in.h>
+#include <netinet/tcp.h>
#include <errno.h>
#include <netdb.h>
@@ -509,21 +510,7 @@ end:
int
BIO_set_tcp_ndelay(int s, int on)
{
- int ret = 0;
-#if defined(TCP_NODELAY) && (defined(IPPROTO_TCP) || defined(SOL_TCP))
- int opt;
-
-#ifdef SOL_TCP
- opt = SOL_TCP;
-#else
-#ifdef IPPROTO_TCP
- opt = IPPROTO_TCP;
-#endif
-#endif
-
- ret = setsockopt(s, opt, TCP_NODELAY, (char *)&on, sizeof(on));
-#endif
- return (ret == 0);
+ return (setsockopt(s, IPPROTO_TCP, TCP_NODELAY, &on, sizeof(on)) == 0);
}
int
diff --git a/lib/libssl/src/crypto/bio/b_sock.c b/lib/libssl/src/crypto/bio/b_sock.c
index ec28ba2e82f..62d545a1299 100644
--- a/lib/libssl/src/crypto/bio/b_sock.c
+++ b/lib/libssl/src/crypto/bio/b_sock.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: b_sock.c,v 1.41 2014/06/22 16:47:08 jsing Exp $ */
+/* $OpenBSD: b_sock.c,v 1.42 2014/06/24 17:30:00 jsing Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
@@ -60,6 +60,7 @@
#include <sys/socket.h>
#include <netinet/in.h>
+#include <netinet/tcp.h>
#include <errno.h>
#include <netdb.h>
@@ -509,21 +510,7 @@ end:
int
BIO_set_tcp_ndelay(int s, int on)
{
- int ret = 0;
-#if defined(TCP_NODELAY) && (defined(IPPROTO_TCP) || defined(SOL_TCP))
- int opt;
-
-#ifdef SOL_TCP
- opt = SOL_TCP;
-#else
-#ifdef IPPROTO_TCP
- opt = IPPROTO_TCP;
-#endif
-#endif
-
- ret = setsockopt(s, opt, TCP_NODELAY, (char *)&on, sizeof(on));
-#endif
- return (ret == 0);
+ return (setsockopt(s, IPPROTO_TCP, TCP_NODELAY, &on, sizeof(on)) == 0);
}
int