You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by ma...@apache.org on 2017/02/10 23:29:03 UTC

[trafficserver] branch master updated: BoringSSL doesn't have BIO_sock_non_fatal_error()

This is an automated email from the ASF dual-hosted git repository.

masaori pushed a commit to branch master
in repository https://git-dual.apache.org/repos/asf/trafficserver.git

The following commit(s) were added to refs/heads/master by this push:
       new  2011c40   BoringSSL doesn't have BIO_sock_non_fatal_error()
2011c40 is described below

commit 2011c40429ff638dabe21acd0db31c83296b4b13
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
---
 configure.ac               |  1 +
 iocore/net/BIO_fastopen.cc | 61 ++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 62 insertions(+)

diff --git a/configure.ac b/configure.ac
index 305e432..831a55f 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 \
   X509_get0_signature \
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>'].