Implement enabling and checking for TCP Fast Open.

This commit is contained in:
Jim Hague 2019-10-30 17:21:25 +00:00
parent ffa5d6144f
commit a46ded25b6
2 changed files with 27 additions and 1 deletions

View File

@ -106,7 +106,8 @@ option(ENABLE_DRAFT_MDNS_SUPPORT "Enable draft mdns client support.")
option(ENABLE_EDNS_COOKIES "Enable EDNS cookies." ON)
option(ENABLE_NATIVE_STUB_DNSSEC "Enable native stub DNSSEC support." ON)
option(ENABLE_POLL_EVENTLOOP "Enable default eventloop based on poll." ON)
option(ENABLE_STUB_ONLY "Restricts resolution modes to STUB." ON)
option(ENABLE_STUB_ONLY "Restrict resolution modes to STUB." ON)
option(ENABLE_TCP_FAST_OPEN "Enable use of TCP Fast Open." ON)
option(ENABLE_UNBOUND_EVENT_API "Enable usage of libunbound's event API." ON)
option(BUILD_GETDNS_QUERY "Compile and install the getdns_query tool." ON)
@ -478,6 +479,25 @@ if (HAVE_STRPTIME)
check_c_source_runs("${STRPTIME_TEST_SOURCE}" STRPTIME_WORKS)
endif ()
# TCP Fast Open.
if (NOT ENABLE_TCP_FAST_OPEN)
message(WARNING "TCP Fast Open disabled.")
else ()
if (APPLE AND HAVE_SYS_SOCKET_H)
check_symbol_exists(CONNECT_RESUME_ON_READ_WRITE "sys/socket.h" USE_OSX_TCP_FASTOPEN)
if (NOT USE_OSX_TCP_FASTOPEN)
message(WARNING "TCP Fast Open not available, continuing without.")
endif ()
else ()
check_symbol_exists(TCP_FASTOPEN "sys/socket.h;netinet/tcp.h" HAVE_DECL_TCP_FASTOPEN)
check_symbol_exists(TCP_FASTOPEN_CONNECT "sys/socket.h;netinet/tcp.h" HAVE_DECL_TCP_FASTOPEN_CONNECT)
check_symbol_exists(MSG_FASTOPEN "sys/socket.h;netinet/tcp.h" HAVE_DECL_MSG_FASTOPEN)
if (NOT TCP_FASTOPEN)
message(WARNING "TCP Fast Open not available, continuing without.")
endif ()
endif ()
endif ()
# Main library
add_library(getdns_objects OBJECT
src/anchor.c

View File

@ -127,6 +127,10 @@
#cmakedefine HAVE_DECL_SIGADDSET 1
#cmakedefine HAVE_DECL_STRPTIME 1
#cmakedefine USE_DECL_TCP_FASTOPEN 1
#cmakedefine USE_DECL_TCP_FASTOPEN_CONNECT 1
#cmakedefine USE_DECL_MSG_FASTOPEN 1
#if defined(HAVE_DECL_INET_PTON) || defined(HAVE_WIN_DECL_INET_PTON)
#undef HAVE_DECL_INET_PTON
#define HAVE_DECL_INET_PTON 1
@ -201,6 +205,8 @@
#cmakedefine USE_ED25519 1
#cmakedefine USE_ED448 1
#cmakedefine USE_OSX_TCP_FASTOPEN 1
#cmakedefine HAVE_TARGET_ENDIANNESS
#cmakedefine TARGET_IS_BIG_ENDIAN