You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by zw...@apache.org on 2017/02/16 20:53:12 UTC
[trafficserver] 01/02: BoringSSL doesn't have
BIO_sock_non_fatal_error()
This is an automated email from the ASF dual-hosted git repository.
zwoop pushed a commit to branch 7.1.x
in repository https://git-dual.apache.org/repos/asf/trafficserver.git
commit 04958cdf49e4f3a8b87cd84ac616b7d95d6f34b6
Author: Jack Bates <ja...@nottheoilrig.com>
AuthorDate: Fri Feb 10 11:04:02 2017 -0700
BoringSSL doesn't have BIO_sock_non_fatal_error()
Fixes #1437
(cherry picked from commit 2011c40429ff638dabe21acd0db31c83296b4b13)
---
configure.ac | 1 +
iocore/net/BIO_fastopen.cc | 61 ++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 62 insertions(+)
diff --git a/configure.ac b/configure.ac
index 34c6037..33b3e9e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1133,6 +1133,7 @@ TS_ADDTO([LIBS], ["$OPENSSL_LIBS"])
AC_CHECK_FUNCS([ \
BIO_meth_new \
+ BIO_sock_non_fatal_error \
CRYPTO_set_mem_functions \
HMAC_CTX_new \
])
diff --git a/iocore/net/BIO_fastopen.cc b/iocore/net/BIO_fastopen.cc
index 3e8095d..c8ed12b 100644
--- a/iocore/net/BIO_fastopen.cc
+++ b/iocore/net/BIO_fastopen.cc
@@ -27,6 +27,67 @@
#include "BIO_fastopen.h"
+// For BoringSSL, which for some reason doesn't have this function.
+// (In BoringSSL, sock_read() and sock_write() use the internal
+// bio_fd_non_fatal_error() instead.) #1437
+//
+// The following is copied from
+// https://github.com/openssl/openssl/blob/3befffa39dbaf2688d823fcf2bdfc07d2487be48/crypto/bio/bss_sock.c
+#ifndef HAVE_BIO_SOCK_NON_FATAL_ERROR
+int
+BIO_sock_non_fatal_error(int err)
+{
+ switch (err) {
+#if defined(OPENSSL_SYS_WINDOWS)
+#if defined(WSAEWOULDBLOCK)
+ case WSAEWOULDBLOCK:
+#endif
+#endif
+
+#ifdef EWOULDBLOCK
+#ifdef WSAEWOULDBLOCK
+#if WSAEWOULDBLOCK != EWOULDBLOCK
+ case EWOULDBLOCK:
+#endif
+#else
+ case EWOULDBLOCK:
+#endif
+#endif
+
+#if defined(ENOTCONN)
+ case ENOTCONN:
+#endif
+
+#ifdef EINTR
+ case EINTR:
+#endif
+
+#ifdef EAGAIN
+#if EWOULDBLOCK != EAGAIN
+ case EAGAIN:
+#endif
+#endif
+
+#ifdef EPROTO
+ case EPROTO:
+#endif
+
+#ifdef EINPROGRESS
+ case EINPROGRESS:
+#endif
+
+#ifdef EALREADY
+ case EALREADY:
+#endif
+ return (1);
+ /* break; */
+ default:
+ break;
+ }
+ return (0);
+}
+#endif
+
static int (*fastopen_create)(BIO *) = BIO_meth_get_create(const_cast<BIO_METHOD *>(BIO_s_socket()));
static int
--
To stop receiving notification emails like this one, please contact
"commits@trafficserver.apache.org" <co...@trafficserver.apache.org>.