2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-08-30 05:57:52 +00:00

Make isc_nm_tlssocket unit tests available in non DoH-enabled builds

This commit ensures that generic TLS unit tests are available in non
DoH-enabled builds, as isc_nm_tlssocket is not tied exclusively to the
DoH implementation anymore.
This commit is contained in:
Artem Boldariev 2022-08-23 22:15:54 +03:00
parent 4524bf4083
commit 4860b66fba
2 changed files with 1 additions and 12 deletions

View File

@ -560,22 +560,18 @@ tcp_connect(isc_nm_t *nm) {
connect_connect_cb, NULL, T_CONNECT);
}
#if HAVE_LIBNGHTTP2
static void
tls_connect(isc_nm_t *nm) {
isc_nm_tlsconnect(nm, &tcp_connect_addr, &tcp_listen_addr,
connect_connect_cb, NULL, tcp_connect_tlsctx,
tcp_tlsctx_client_sess_cache, T_CONNECT);
}
#endif
stream_connect_function
get_stream_connect_function(void) {
#if HAVE_LIBNGHTTP2
if (stream_use_TLS) {
return (tls_connect);
}
#endif
return (tcp_connect);
}
@ -584,7 +580,6 @@ stream_listen(isc_nm_accept_cb_t accept_cb, void *accept_cbarg, int backlog,
isc_quota_t *quota, isc_nmsocket_t **sockp) {
isc_result_t result = ISC_R_SUCCESS;
#if HAVE_LIBNGHTTP2
if (stream_use_TLS) {
result = isc_nm_listentls(listen_nm, ISC_NM_LISTEN_ALL,
&tcp_listen_addr, accept_cb,
@ -592,7 +587,6 @@ stream_listen(isc_nm_accept_cb_t accept_cb, void *accept_cbarg, int backlog,
tcp_listen_tlsctx, sockp);
return (result);
}
#endif
result = isc_nm_listentcp(listen_nm, ISC_NM_LISTEN_ALL,
&tcp_listen_addr, accept_cb, accept_cbarg,
backlog, quota, sockp);
@ -603,7 +597,7 @@ stream_listen(isc_nm_accept_cb_t accept_cb, void *accept_cbarg, int backlog,
void
stream_connect(isc_nm_cb_t cb, void *cbarg, unsigned int timeout) {
isc_refcount_increment0(&active_cconnects);
#if HAVE_LIBNGHTTP2
if (stream_use_TLS) {
isc_nm_tlsconnect(connect_nm, &tcp_connect_addr,
&tcp_listen_addr, cb, cbarg,
@ -611,7 +605,6 @@ stream_connect(isc_nm_cb_t cb, void *cbarg, unsigned int timeout) {
tcp_tlsctx_client_sess_cache, timeout);
return;
}
#endif
isc_nm_tcpconnect(connect_nm, &tcp_connect_addr, &tcp_listen_addr, cb,
cbarg, timeout);
}

View File

@ -38,7 +38,6 @@
#include <tests/isc.h>
#if HAVE_LIBNGHTTP2
ISC_LOOP_TEST_IMPL(tls_noop) {
stream_noop(arg);
return;
@ -96,11 +95,9 @@ ISC_LOOP_TEST_IMPL(tls_recv_send_quota_sendback) {
atomic_store(&check_listener_quota, true);
stream_recv_send(arg);
}
#endif
ISC_TEST_LIST_START
#if HAVE_LIBNGHTTP2
/* TLS */
ISC_TEST_ENTRY_CUSTOM(tls_noop, stream_noop_setup, stream_noop_teardown)
ISC_TEST_ENTRY_CUSTOM(tls_noresponse, stream_noresponse_setup,
@ -125,7 +122,6 @@ ISC_TEST_ENTRY_CUSTOM(tls_recv_send_quota, stream_recv_send_setup,
stream_recv_send_teardown)
ISC_TEST_ENTRY_CUSTOM(tls_recv_send_quota_sendback, stream_recv_send_setup,
stream_recv_send_teardown)
#endif
ISC_TEST_LIST_END