2018-08-07 10:46:53 -04:00
|
|
|
include $(top_srcdir)/Makefile.top
|
|
|
|
|
|
|
|
|
|
AM_CPPFLAGS += \
|
2022-04-27 11:41:47 -04:00
|
|
|
$(LIBISC_CFLAGS) \
|
2023-03-31 15:39:40 -04:00
|
|
|
$(LIBURCU_CFLAGS) \
|
Give the unit tests a big overhaul
The unit tests contain a lot of duplicated code and here's an attempt
to reduce code duplication.
This commit does several things:
1. Remove #ifdef HAVE_CMOCKA - we already solve this with automake
conditionals.
2. Create a set of ISC_TEST_* and ISC_*_TEST_ macros to wrap the test
implementations, test lists, and the main test routine, so we don't
have to repeat this all over again. The macros were modeled after
libuv test suite but adapted to cmocka as the test driver.
A simple example of a unit test would be:
ISC_RUN_TEST_IMPL(test1) { assert_true(true); }
ISC_TEST_LIST_START
ISC_TEST_ENTRY(test1)
ISC_TEST_LIST_END
ISC_TEST_MAIN (Discussion: Should this be ISC_TEST_RUN ?)
For more complicated examples including group setup and teardown
functions, and per-test setup and teardown functions.
3. The macros prefix the test functions and cmocka entries, so the name
of the test can now match the tested function name, and we don't have
to append `_test` because `run_test_` is automatically prepended to
the main test function, and `setup_test_` and `teardown_test_` is
prepended to setup and teardown function.
4. Update all the unit tests to use the new syntax and fix a few bits
here and there.
5. In the future, we can separate the test declarations and test
implementations which are going to greatly help with uncluttering the
bigger unit tests like doh_test and netmgr_test, because the test
implementations are not declared static (see `ISC_RUN_TEST_DECLARE`
and `ISC_RUN_TEST_IMPL` for more details.
NOTE: This heavily relies on preprocessor macros, but the result greatly
outweighs all the negatives of using the macros. There's less
duplicated code, the tests are more uniform and the implementation can
be more flexible.
2022-05-02 04:56:42 -04:00
|
|
|
$(LIBUV_CFLAGS) \
|
2022-05-03 05:37:31 -04:00
|
|
|
-I$(top_srcdir)/lib/isc
|
2018-08-07 10:46:53 -04:00
|
|
|
|
|
|
|
|
LDADD += \
|
Give the unit tests a big overhaul
The unit tests contain a lot of duplicated code and here's an attempt
to reduce code duplication.
This commit does several things:
1. Remove #ifdef HAVE_CMOCKA - we already solve this with automake
conditionals.
2. Create a set of ISC_TEST_* and ISC_*_TEST_ macros to wrap the test
implementations, test lists, and the main test routine, so we don't
have to repeat this all over again. The macros were modeled after
libuv test suite but adapted to cmocka as the test driver.
A simple example of a unit test would be:
ISC_RUN_TEST_IMPL(test1) { assert_true(true); }
ISC_TEST_LIST_START
ISC_TEST_ENTRY(test1)
ISC_TEST_LIST_END
ISC_TEST_MAIN (Discussion: Should this be ISC_TEST_RUN ?)
For more complicated examples including group setup and teardown
functions, and per-test setup and teardown functions.
3. The macros prefix the test functions and cmocka entries, so the name
of the test can now match the tested function name, and we don't have
to append `_test` because `run_test_` is automatically prepended to
the main test function, and `setup_test_` and `teardown_test_` is
prepended to setup and teardown function.
4. Update all the unit tests to use the new syntax and fix a few bits
here and there.
5. In the future, we can separate the test declarations and test
implementations which are going to greatly help with uncluttering the
bigger unit tests like doh_test and netmgr_test, because the test
implementations are not declared static (see `ISC_RUN_TEST_DECLARE`
and `ISC_RUN_TEST_IMPL` for more details.
NOTE: This heavily relies on preprocessor macros, but the result greatly
outweighs all the negatives of using the macros. There's less
duplicated code, the tests are more uniform and the implementation can
be more flexible.
2022-05-02 04:56:42 -04:00
|
|
|
$(LIBISC_LIBS) \
|
2023-03-31 15:39:40 -04:00
|
|
|
$(LIBURCU_LIBS) \
|
Give the unit tests a big overhaul
The unit tests contain a lot of duplicated code and here's an attempt
to reduce code duplication.
This commit does several things:
1. Remove #ifdef HAVE_CMOCKA - we already solve this with automake
conditionals.
2. Create a set of ISC_TEST_* and ISC_*_TEST_ macros to wrap the test
implementations, test lists, and the main test routine, so we don't
have to repeat this all over again. The macros were modeled after
libuv test suite but adapted to cmocka as the test driver.
A simple example of a unit test would be:
ISC_RUN_TEST_IMPL(test1) { assert_true(true); }
ISC_TEST_LIST_START
ISC_TEST_ENTRY(test1)
ISC_TEST_LIST_END
ISC_TEST_MAIN (Discussion: Should this be ISC_TEST_RUN ?)
For more complicated examples including group setup and teardown
functions, and per-test setup and teardown functions.
3. The macros prefix the test functions and cmocka entries, so the name
of the test can now match the tested function name, and we don't have
to append `_test` because `run_test_` is automatically prepended to
the main test function, and `setup_test_` and `teardown_test_` is
prepended to setup and teardown function.
4. Update all the unit tests to use the new syntax and fix a few bits
here and there.
5. In the future, we can separate the test declarations and test
implementations which are going to greatly help with uncluttering the
bigger unit tests like doh_test and netmgr_test, because the test
implementations are not declared static (see `ISC_RUN_TEST_DECLARE`
and `ISC_RUN_TEST_IMPL` for more details.
NOTE: This heavily relies on preprocessor macros, but the result greatly
outweighs all the negatives of using the macros. There's less
duplicated code, the tests are more uniform and the implementation can
be more flexible.
2022-05-02 04:56:42 -04:00
|
|
|
$(LIBUV_LIBS)
|
2018-08-07 10:46:53 -04:00
|
|
|
|
2021-04-21 08:22:18 -04:00
|
|
|
check_PROGRAMS = \
|
2022-06-25 10:29:54 -04:00
|
|
|
ascii_test \
|
New event loop handling API
This commit introduces new APIs for applications and signal handling,
intended to replace isc_app for applications built on top of libisc.
* isc_app will be replaced with isc_loopmgr, which handles the
starting and stopping of applications. In isc_loopmgr, the main
thread is not blocked, but is part of the working thread set.
The loop manager will start a number of threads, each with a
uv_loop event loop running. Setup and teardown functions can be
assigned which will run when the loop starts and stops, and
jobs can be scheduled to run in the meantime. When
isc_loopmgr_shutdown() is run from any the loops, all loops
will shut down and the application can terminate.
* signal handling will now be handled with a separate isc_signal unit.
isc_loopmgr only handles SIGTERM and SIGINT for application
termination, but the application may install additional signal
handlers, such as SIGHUP as a signal to reload configuration.
* new job running primitives, isc_job and isc_async, have been added.
Both units schedule callbacks (specifying a callback function and
argument) on an event loop. The difference is that isc_job unit is
unlocked and not thread-safe, so it can be used to efficiently
run jobs in the same thread, while isc_async is thread-safe and
uses locking, so it can be used to pass jobs from one thread to
another.
* isc_tid will be used to track the thread ID in isc_loop worker
threads.
* unit tests have been added for the new APIs.
2022-07-26 07:03:22 -04:00
|
|
|
async_test \
|
2018-08-07 10:46:53 -04:00
|
|
|
buffer_test \
|
|
|
|
|
counter_test \
|
2022-06-02 07:19:12 -04:00
|
|
|
dnsstream_utils_test \
|
2018-08-07 10:46:53 -04:00
|
|
|
errno_test \
|
|
|
|
|
file_test \
|
|
|
|
|
hash_test \
|
2022-06-24 02:32:12 -04:00
|
|
|
hashmap_test \
|
2018-08-07 10:46:53 -04:00
|
|
|
heap_test \
|
2023-03-08 04:55:42 -05:00
|
|
|
histo_test \
|
2018-08-07 10:46:53 -04:00
|
|
|
hmac_test \
|
|
|
|
|
ht_test \
|
New event loop handling API
This commit introduces new APIs for applications and signal handling,
intended to replace isc_app for applications built on top of libisc.
* isc_app will be replaced with isc_loopmgr, which handles the
starting and stopping of applications. In isc_loopmgr, the main
thread is not blocked, but is part of the working thread set.
The loop manager will start a number of threads, each with a
uv_loop event loop running. Setup and teardown functions can be
assigned which will run when the loop starts and stops, and
jobs can be scheduled to run in the meantime. When
isc_loopmgr_shutdown() is run from any the loops, all loops
will shut down and the application can terminate.
* signal handling will now be handled with a separate isc_signal unit.
isc_loopmgr only handles SIGTERM and SIGINT for application
termination, but the application may install additional signal
handlers, such as SIGHUP as a signal to reload configuration.
* new job running primitives, isc_job and isc_async, have been added.
Both units schedule callbacks (specifying a callback function and
argument) on an event loop. The difference is that isc_job unit is
unlocked and not thread-safe, so it can be used to efficiently
run jobs in the same thread, while isc_async is thread-safe and
uses locking, so it can be used to pass jobs from one thread to
another.
* isc_tid will be used to track the thread ID in isc_loop worker
threads.
* unit tests have been added for the new APIs.
2022-07-26 07:03:22 -04:00
|
|
|
job_test \
|
2018-08-07 10:46:53 -04:00
|
|
|
lex_test \
|
New event loop handling API
This commit introduces new APIs for applications and signal handling,
intended to replace isc_app for applications built on top of libisc.
* isc_app will be replaced with isc_loopmgr, which handles the
starting and stopping of applications. In isc_loopmgr, the main
thread is not blocked, but is part of the working thread set.
The loop manager will start a number of threads, each with a
uv_loop event loop running. Setup and teardown functions can be
assigned which will run when the loop starts and stops, and
jobs can be scheduled to run in the meantime. When
isc_loopmgr_shutdown() is run from any the loops, all loops
will shut down and the application can terminate.
* signal handling will now be handled with a separate isc_signal unit.
isc_loopmgr only handles SIGTERM and SIGINT for application
termination, but the application may install additional signal
handlers, such as SIGHUP as a signal to reload configuration.
* new job running primitives, isc_job and isc_async, have been added.
Both units schedule callbacks (specifying a callback function and
argument) on an event loop. The difference is that isc_job unit is
unlocked and not thread-safe, so it can be used to efficiently
run jobs in the same thread, while isc_async is thread-safe and
uses locking, so it can be used to pass jobs from one thread to
another.
* isc_tid will be used to track the thread ID in isc_loop worker
threads.
* unit tests have been added for the new APIs.
2022-07-26 07:03:22 -04:00
|
|
|
loop_test \
|
2018-08-07 10:46:53 -04:00
|
|
|
md_test \
|
|
|
|
|
mem_test \
|
2023-03-30 03:18:29 -04:00
|
|
|
mutex_test \
|
2018-08-07 10:46:53 -04:00
|
|
|
netaddr_test \
|
|
|
|
|
parse_test \
|
2023-03-03 09:43:15 -05:00
|
|
|
proxyheader_test \
|
2023-04-27 13:17:18 -04:00
|
|
|
proxystream_test \
|
2023-10-13 08:31:32 -04:00
|
|
|
proxyudp_test \
|
2018-08-07 10:46:53 -04:00
|
|
|
quota_test \
|
|
|
|
|
radix_test \
|
|
|
|
|
random_test \
|
2022-09-29 04:45:15 -04:00
|
|
|
ratelimiter_test\
|
2018-08-07 10:46:53 -04:00
|
|
|
regex_test \
|
|
|
|
|
result_test \
|
2023-03-30 04:08:52 -04:00
|
|
|
rwlock_test \
|
2018-08-07 10:46:53 -04:00
|
|
|
safe_test \
|
2020-06-04 13:02:27 -04:00
|
|
|
siphash_test \
|
2018-08-07 10:46:53 -04:00
|
|
|
sockaddr_test \
|
2023-03-03 03:24:13 -05:00
|
|
|
spinlock_test \
|
2021-08-19 06:14:21 -04:00
|
|
|
stats_test \
|
2018-08-07 10:46:53 -04:00
|
|
|
symtab_test \
|
2022-07-26 07:03:48 -04:00
|
|
|
tcp_test \
|
|
|
|
|
tcpdns_test \
|
2018-08-07 10:46:53 -04:00
|
|
|
time_test \
|
New event loop handling API
This commit introduces new APIs for applications and signal handling,
intended to replace isc_app for applications built on top of libisc.
* isc_app will be replaced with isc_loopmgr, which handles the
starting and stopping of applications. In isc_loopmgr, the main
thread is not blocked, but is part of the working thread set.
The loop manager will start a number of threads, each with a
uv_loop event loop running. Setup and teardown functions can be
assigned which will run when the loop starts and stops, and
jobs can be scheduled to run in the meantime. When
isc_loopmgr_shutdown() is run from any the loops, all loops
will shut down and the application can terminate.
* signal handling will now be handled with a separate isc_signal unit.
isc_loopmgr only handles SIGTERM and SIGINT for application
termination, but the application may install additional signal
handlers, such as SIGHUP as a signal to reload configuration.
* new job running primitives, isc_job and isc_async, have been added.
Both units schedule callbacks (specifying a callback function and
argument) on an event loop. The difference is that isc_job unit is
unlocked and not thread-safe, so it can be used to efficiently
run jobs in the same thread, while isc_async is thread-safe and
uses locking, so it can be used to pass jobs from one thread to
another.
* isc_tid will be used to track the thread ID in isc_loop worker
threads.
* unit tests have been added for the new APIs.
2022-07-26 07:03:22 -04:00
|
|
|
timer_test \
|
2022-07-26 07:03:48 -04:00
|
|
|
tls_test \
|
|
|
|
|
tlsdns_test \
|
|
|
|
|
udp_test \
|
New event loop handling API
This commit introduces new APIs for applications and signal handling,
intended to replace isc_app for applications built on top of libisc.
* isc_app will be replaced with isc_loopmgr, which handles the
starting and stopping of applications. In isc_loopmgr, the main
thread is not blocked, but is part of the working thread set.
The loop manager will start a number of threads, each with a
uv_loop event loop running. Setup and teardown functions can be
assigned which will run when the loop starts and stops, and
jobs can be scheduled to run in the meantime. When
isc_loopmgr_shutdown() is run from any the loops, all loops
will shut down and the application can terminate.
* signal handling will now be handled with a separate isc_signal unit.
isc_loopmgr only handles SIGTERM and SIGINT for application
termination, but the application may install additional signal
handlers, such as SIGHUP as a signal to reload configuration.
* new job running primitives, isc_job and isc_async, have been added.
Both units schedule callbacks (specifying a callback function and
argument) on an event loop. The difference is that isc_job unit is
unlocked and not thread-safe, so it can be used to efficiently
run jobs in the same thread, while isc_async is thread-safe and
uses locking, so it can be used to pass jobs from one thread to
another.
* isc_tid will be used to track the thread ID in isc_loop worker
threads.
* unit tests have been added for the new APIs.
2022-07-26 07:03:22 -04:00
|
|
|
work_test
|
2018-08-07 10:46:53 -04:00
|
|
|
|
2021-04-21 07:52:15 -04:00
|
|
|
if HAVE_LIBNGHTTP2
|
|
|
|
|
check_PROGRAMS += \
|
|
|
|
|
doh_test
|
|
|
|
|
|
2020-12-07 07:19:10 -05:00
|
|
|
doh_test_CPPFLAGS = \
|
|
|
|
|
$(AM_CPPFLAGS) \
|
2021-04-21 07:52:15 -04:00
|
|
|
$(LIBNGHTTP2_CFLAGS) \
|
2020-12-07 07:19:10 -05:00
|
|
|
$(OPENSSL_CFLAGS)
|
|
|
|
|
|
|
|
|
|
doh_test_LDADD = \
|
|
|
|
|
$(LDADD) \
|
Give the unit tests a big overhaul
The unit tests contain a lot of duplicated code and here's an attempt
to reduce code duplication.
This commit does several things:
1. Remove #ifdef HAVE_CMOCKA - we already solve this with automake
conditionals.
2. Create a set of ISC_TEST_* and ISC_*_TEST_ macros to wrap the test
implementations, test lists, and the main test routine, so we don't
have to repeat this all over again. The macros were modeled after
libuv test suite but adapted to cmocka as the test driver.
A simple example of a unit test would be:
ISC_RUN_TEST_IMPL(test1) { assert_true(true); }
ISC_TEST_LIST_START
ISC_TEST_ENTRY(test1)
ISC_TEST_LIST_END
ISC_TEST_MAIN (Discussion: Should this be ISC_TEST_RUN ?)
For more complicated examples including group setup and teardown
functions, and per-test setup and teardown functions.
3. The macros prefix the test functions and cmocka entries, so the name
of the test can now match the tested function name, and we don't have
to append `_test` because `run_test_` is automatically prepended to
the main test function, and `setup_test_` and `teardown_test_` is
prepended to setup and teardown function.
4. Update all the unit tests to use the new syntax and fix a few bits
here and there.
5. In the future, we can separate the test declarations and test
implementations which are going to greatly help with uncluttering the
bigger unit tests like doh_test and netmgr_test, because the test
implementations are not declared static (see `ISC_RUN_TEST_DECLARE`
and `ISC_RUN_TEST_IMPL` for more details.
NOTE: This heavily relies on preprocessor macros, but the result greatly
outweighs all the negatives of using the macros. There's less
duplicated code, the tests are more uniform and the implementation can
be more flexible.
2022-05-02 04:56:42 -04:00
|
|
|
$(LIBNGHTTP2_LIBS)
|
2022-06-01 02:47:00 -04:00
|
|
|
|
|
|
|
|
doh_test_SOURCES = \
|
|
|
|
|
doh_test.c \
|
|
|
|
|
uv_wrap.h
|
|
|
|
|
|
2021-04-21 07:52:15 -04:00
|
|
|
endif HAVE_LIBNGHTTP2
|
2020-12-07 07:19:10 -05:00
|
|
|
|
2022-06-02 07:19:12 -04:00
|
|
|
dnsstream_utils_test_CPPFLAGS = \
|
|
|
|
|
$(AM_CPPFLAGS)
|
|
|
|
|
|
|
|
|
|
dnsstream_utils_test_LDADD = \
|
|
|
|
|
$(LDADD)
|
|
|
|
|
|
|
|
|
|
dnsstream_utils_test_SOURCES = \
|
2022-12-21 05:37:44 -05:00
|
|
|
dnsstream_utils_test.c \
|
|
|
|
|
dnsstream_utils_test_data.h
|
2022-06-02 07:19:12 -04:00
|
|
|
|
2024-08-12 09:13:34 -04:00
|
|
|
hashmap_test_SOURCES = \
|
|
|
|
|
hashmap_test.c \
|
|
|
|
|
hashmap_nodes.h
|
|
|
|
|
|
2018-08-07 10:46:53 -04:00
|
|
|
hmac_test_CPPFLAGS = \
|
|
|
|
|
$(AM_CPPFLAGS) \
|
|
|
|
|
$(OPENSSL_CFLAGS)
|
|
|
|
|
|
|
|
|
|
hmac_test_LDADD = \
|
|
|
|
|
$(LDADD) \
|
|
|
|
|
$(OPENSSL_LIBS)
|
|
|
|
|
|
|
|
|
|
md_test_CPPFLAGS = \
|
|
|
|
|
$(AM_CPPFLAGS) \
|
|
|
|
|
$(OPENSSL_CFLAGS)
|
|
|
|
|
|
|
|
|
|
md_test_LDADD = \
|
|
|
|
|
$(LDADD) \
|
|
|
|
|
$(OPENSSL_LIBS)
|
|
|
|
|
|
2023-03-03 09:43:15 -05:00
|
|
|
proxyheader_test_CPPFLAGS = \
|
|
|
|
|
$(AM_CPPFLAGS)
|
|
|
|
|
|
|
|
|
|
proxyheader_test_LDADD = \
|
|
|
|
|
$(LDADD)
|
|
|
|
|
|
|
|
|
|
proxyheader_test_SOURCES = \
|
|
|
|
|
proxyheader_test.c \
|
|
|
|
|
proxyheader_test_data.h
|
|
|
|
|
|
2023-04-27 13:17:18 -04:00
|
|
|
proxystream_test_CPPFLAGS = \
|
2024-03-14 19:08:57 -04:00
|
|
|
$(AM_CPPFLAGS) \
|
|
|
|
|
$(OPENSSL_CFLAGS)
|
2023-04-27 13:17:18 -04:00
|
|
|
|
|
|
|
|
proxystream_test_LDADD = \
|
2024-03-14 19:08:57 -04:00
|
|
|
$(LDADD) \
|
|
|
|
|
$(OPENSSL_LIBS)
|
2023-04-27 13:17:18 -04:00
|
|
|
|
|
|
|
|
proxystream_test_SOURCES = \
|
|
|
|
|
proxystream_test.c \
|
|
|
|
|
netmgr_common.h \
|
|
|
|
|
netmgr_common.c \
|
|
|
|
|
stream_shutdown.c
|
|
|
|
|
|
2023-10-13 08:31:32 -04:00
|
|
|
proxyudp_test_CPPFLAGS = \
|
|
|
|
|
$(AM_CPPFLAGS) \
|
|
|
|
|
$(OPENSSL_CFLAGS)
|
|
|
|
|
|
|
|
|
|
proxyudp_test_LDADD = \
|
|
|
|
|
$(LDADD) \
|
|
|
|
|
$(OPENSSL_LIBS)
|
|
|
|
|
|
|
|
|
|
proxyudp_test_SOURCES = \
|
|
|
|
|
proxyudp_test.c \
|
|
|
|
|
netmgr_common.h \
|
|
|
|
|
netmgr_common.c \
|
|
|
|
|
uv_wrap.h
|
|
|
|
|
|
2018-08-07 10:46:53 -04:00
|
|
|
random_test_LDADD = \
|
|
|
|
|
$(LDADD) \
|
|
|
|
|
-lm
|
2020-04-23 19:22:21 -04:00
|
|
|
|
2022-07-26 07:03:48 -04:00
|
|
|
tcp_test_CPPFLAGS = \
|
|
|
|
|
$(AM_CPPFLAGS) \
|
|
|
|
|
$(OPENSSL_CFLAGS)
|
|
|
|
|
|
|
|
|
|
tcp_test_LDADD = \
|
|
|
|
|
$(LDADD) \
|
|
|
|
|
$(OPENSSL_LIBS)
|
|
|
|
|
|
|
|
|
|
tcp_test_SOURCES = \
|
|
|
|
|
tcp_test.c \
|
|
|
|
|
netmgr_common.h \
|
|
|
|
|
netmgr_common.c \
|
Fix the streaming read callback shutdown logic
When shutting down TCP sockets, the read callback calling logic was
flawed, it would call either one less callback or one extra. Fix the
logic in the way:
1. When isc_nm_read() has been called but isc_nm_read_stop() hasn't on
the handle, the read callback will be called with ISC_R_CANCELED to
cancel active reading from the socket/handle.
2. When isc_nm_read() has been called and isc_nm_read_stop() has been
called on the on the handle, the read callback will be called with
ISC_R_SHUTTINGDOWN to signal that the dormant (not-reading) socket
is being shut down.
3. The .reading and .recv_read flags are little bit tricky. The
.reading flag indicates if the outer layer is reading the data (that
would be uv_tcp_t for TCP and isc_nmsocket_t (TCP) for TLSStream),
the .recv_read flag indicates whether somebody is interested in the
data read from the socket.
Usually, you would expect that the .reading should be false when
.recv_read is false, but it gets even more tricky with TLSStream as
the TLS protocol might need to read from the socket even when sending
data.
Fix the usage of the .recv_read and .reading flags in the TLSStream
to their true meaning - which mostly consist of using .recv_read
everywhere and then wrapping isc_nm_read() and isc_nm_read_stop()
with the .reading flag.
4. The TLS failed read helper has been modified to resemble the TCP code
as much as possible, clearing and re-setting the .recv_read flag in
the TCP timeout code has been fixed and .recv_read is now cleared
when isc_nm_read_stop() has been called on the streaming socket.
5. The use of Network Manager in the named_controlconf, isccc_ccmsg, and
isc_httpd units have been greatly simplified due to the improved design.
6. More unit tests for TCP and TLS testing the shutdown conditions have
been added.
Co-authored-by: Ondřej Surý <ondrej@isc.org>
Co-authored-by: Artem Boldariev <artem@isc.org>
2023-04-13 11:27:50 -04:00
|
|
|
stream_shutdown.c \
|
2022-07-26 07:03:48 -04:00
|
|
|
uv_wrap.h
|
|
|
|
|
|
|
|
|
|
tcpdns_test_CPPFLAGS = \
|
|
|
|
|
$(AM_CPPFLAGS) \
|
|
|
|
|
$(OPENSSL_CFLAGS)
|
|
|
|
|
|
|
|
|
|
tcpdns_test_LDADD = \
|
|
|
|
|
$(LDADD) \
|
|
|
|
|
$(OPENSSL_LIBS)
|
|
|
|
|
|
|
|
|
|
tcpdns_test_SOURCES = \
|
|
|
|
|
tcpdns_test.c \
|
|
|
|
|
netmgr_common.h \
|
|
|
|
|
netmgr_common.c \
|
|
|
|
|
uv_wrap.h
|
|
|
|
|
|
|
|
|
|
tls_test_CPPFLAGS = \
|
|
|
|
|
$(AM_CPPFLAGS) \
|
|
|
|
|
$(OPENSSL_CFLAGS)
|
|
|
|
|
|
|
|
|
|
tls_test_LDADD = \
|
|
|
|
|
$(LDADD) \
|
|
|
|
|
$(OPENSSL_LIBS)
|
|
|
|
|
|
|
|
|
|
tls_test_SOURCES = \
|
|
|
|
|
tls_test.c \
|
|
|
|
|
netmgr_common.h \
|
|
|
|
|
netmgr_common.c \
|
Fix the streaming read callback shutdown logic
When shutting down TCP sockets, the read callback calling logic was
flawed, it would call either one less callback or one extra. Fix the
logic in the way:
1. When isc_nm_read() has been called but isc_nm_read_stop() hasn't on
the handle, the read callback will be called with ISC_R_CANCELED to
cancel active reading from the socket/handle.
2. When isc_nm_read() has been called and isc_nm_read_stop() has been
called on the on the handle, the read callback will be called with
ISC_R_SHUTTINGDOWN to signal that the dormant (not-reading) socket
is being shut down.
3. The .reading and .recv_read flags are little bit tricky. The
.reading flag indicates if the outer layer is reading the data (that
would be uv_tcp_t for TCP and isc_nmsocket_t (TCP) for TLSStream),
the .recv_read flag indicates whether somebody is interested in the
data read from the socket.
Usually, you would expect that the .reading should be false when
.recv_read is false, but it gets even more tricky with TLSStream as
the TLS protocol might need to read from the socket even when sending
data.
Fix the usage of the .recv_read and .reading flags in the TLSStream
to their true meaning - which mostly consist of using .recv_read
everywhere and then wrapping isc_nm_read() and isc_nm_read_stop()
with the .reading flag.
4. The TLS failed read helper has been modified to resemble the TCP code
as much as possible, clearing and re-setting the .recv_read flag in
the TCP timeout code has been fixed and .recv_read is now cleared
when isc_nm_read_stop() has been called on the streaming socket.
5. The use of Network Manager in the named_controlconf, isccc_ccmsg, and
isc_httpd units have been greatly simplified due to the improved design.
6. More unit tests for TCP and TLS testing the shutdown conditions have
been added.
Co-authored-by: Ondřej Surý <ondrej@isc.org>
Co-authored-by: Artem Boldariev <artem@isc.org>
2023-04-13 11:27:50 -04:00
|
|
|
stream_shutdown.c \
|
2022-07-26 07:03:48 -04:00
|
|
|
uv_wrap.h
|
|
|
|
|
|
|
|
|
|
tlsdns_test_CPPFLAGS = \
|
|
|
|
|
$(AM_CPPFLAGS) \
|
|
|
|
|
$(OPENSSL_CFLAGS)
|
|
|
|
|
|
|
|
|
|
tlsdns_test_LDADD = \
|
|
|
|
|
$(LDADD) \
|
|
|
|
|
$(OPENSSL_LIBS)
|
|
|
|
|
|
|
|
|
|
tlsdns_test_SOURCES = \
|
|
|
|
|
tlsdns_test.c \
|
|
|
|
|
netmgr_common.h \
|
|
|
|
|
netmgr_common.c \
|
|
|
|
|
uv_wrap.h
|
|
|
|
|
|
|
|
|
|
udp_test_CPPFLAGS = \
|
|
|
|
|
$(AM_CPPFLAGS) \
|
|
|
|
|
$(OPENSSL_CFLAGS)
|
|
|
|
|
|
|
|
|
|
udp_test_LDADD = \
|
|
|
|
|
$(LDADD) \
|
|
|
|
|
$(OPENSSL_LIBS)
|
|
|
|
|
|
|
|
|
|
udp_test_SOURCES = \
|
|
|
|
|
udp_test.c \
|
|
|
|
|
netmgr_common.h \
|
|
|
|
|
netmgr_common.c \
|
|
|
|
|
uv_wrap.h
|
|
|
|
|
|
2020-06-04 13:02:27 -04:00
|
|
|
EXTRA_DIST = testdata
|
|
|
|
|
|
2021-04-21 08:22:18 -04:00
|
|
|
include $(top_srcdir)/Makefile.tests
|