From: Ondřej Surý Date: Wed, 2 Dec 2020 20:54:25 +0000 (+0100) Subject: Add FreeBSD connection timeout socket option X-Git-Tag: v9.17.8~9^2~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4adeaab73d1a182ec4fed2299ec51edf76cbe2fc;p=thirdparty%2Fbind9.git Add FreeBSD connection timeout socket option On FreeBSD, the option to configure connection timeout is called TCP_KEEPINIT, use it to configure the connection timeout there. This also fixes the dangling socket problems in the unit test, so re-enable them. --- diff --git a/lib/isc/netmgr/netmgr.c b/lib/isc/netmgr/netmgr.c index 9ed966a6edc..4e654e11d83 100644 --- a/lib/isc/netmgr/netmgr.c +++ b/lib/isc/netmgr/netmgr.c @@ -2283,6 +2283,10 @@ isc__nm_socket_dontfrag(uv_os_sock_t fd, sa_family_t sa_family) { #define TIMEOUT_TYPE unsigned int #define TIMEOUT_DIV 1 #define TIMEOUT_OPTNAME TCP_USER_TIMEOUT +#elif defined(TCP_KEEPINIT) +#define TIMEOUT_TYPE int +#define TIMEOUT_DIV 1000 +#define TIMEOUT_OPTNAME TCP_KEEPINIT #endif isc_result_t diff --git a/lib/isc/tests/tcp_quota_test.c b/lib/isc/tests/tcp_quota_test.c index 0602dea28a9..849213b6772 100644 --- a/lib/isc/tests/tcp_quota_test.c +++ b/lib/isc/tests/tcp_quota_test.c @@ -9,7 +9,7 @@ * information regarding copyright ownership. */ -#if HAVE_CMOCKA && defined(__linux__) +#if HAVE_CMOCKA #include /* IWYU pragma: keep */ #include #include diff --git a/lib/isc/tests/tcp_test.c b/lib/isc/tests/tcp_test.c index 4c4fea0532d..a27ab80ebbf 100644 --- a/lib/isc/tests/tcp_test.c +++ b/lib/isc/tests/tcp_test.c @@ -9,7 +9,7 @@ * information regarding copyright ownership. */ -#if HAVE_CMOCKA && defined(__linux__) +#if HAVE_CMOCKA #include /* IWYU pragma: keep */ #include #include diff --git a/lib/isc/tests/tcpdns_test.c b/lib/isc/tests/tcpdns_test.c index c21a7cb73cb..21459645921 100644 --- a/lib/isc/tests/tcpdns_test.c +++ b/lib/isc/tests/tcpdns_test.c @@ -9,7 +9,7 @@ * information regarding copyright ownership. */ -#if HAVE_CMOCKA && defined(__linux__) +#if HAVE_CMOCKA #include /* IWYU pragma: keep */ #include #include diff --git a/lib/isc/tests/udp_test.c b/lib/isc/tests/udp_test.c index b3062cc4655..a1a99314e26 100644 --- a/lib/isc/tests/udp_test.c +++ b/lib/isc/tests/udp_test.c @@ -9,7 +9,7 @@ * information regarding copyright ownership. */ -#if HAVE_CMOCKA && defined(__linux__) +#if HAVE_CMOCKA #include /* IWYU pragma: keep */ #include #include