[master] dfbc77ac5 Correctly detect TCP_FASTOPEN on FreeBSD
Poul-Henning Kamp
phk at FreeBSD.org
Tue Aug 17 08:07:06 UTC 2021
commit dfbc77ac546aa1d86b6fa410bcd8f293d2453c37
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date: Tue Aug 17 08:06:34 2021 +0000
Correctly detect TCP_FASTOPEN on FreeBSD
diff --git a/configure.ac b/configure.ac
index c396a3806..df96a23ea 100644
--- a/configure.ac
+++ b/configure.ac
@@ -632,6 +632,10 @@ AC_CACHE_CHECK([for TCP_FASTOPEN socket option],
#include <netinet/in.h>
#include <netinet/tcp.h>
#include <errno.h>
+
+#ifndef SOL_TCP
+# define SOL_TCP IPPROTO_TCP
+#endif
]],[[
int s = socket(AF_INET, SOCK_STREAM, 0);
int i = 5;
diff --git a/lib/libvarnish/vtcp.c b/lib/libvarnish/vtcp.c
index 85521b8c9..1dca3c6ce 100644
--- a/lib/libvarnish/vtcp.c
+++ b/lib/libvarnish/vtcp.c
@@ -189,26 +189,23 @@ VTCP_filter_http(int sock)
/*--------------------------------------------------------------------*/
-#ifdef HAVE_TCP_FASTOPEN
int
VTCP_fastopen(int sock, int depth)
{
+#ifdef HAVE_TCP_FASTOPEN
+# ifndef SOL_TCP
+# define SOL_TCP IPPROTO_TCP
+# endif
return (setsockopt(sock, SOL_TCP, TCP_FASTOPEN, &depth, sizeof depth));
-}
-
#else
-
-int
-VTCP_fastopen(int sock, int depth)
-{
errno = EOPNOTSUPP;
(void)sock;
(void)depth;
return (-1);
+#endif
}
-#endif
/*--------------------------------------------------------------------
* Functions for controlling NONBLOCK mode.
More information about the varnish-commit
mailing list