bind9/tests/dns
Ondřej Surý 3b10814569
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-20 12:58:32 +02:00
..
comparekeys Remove TKEY Mode 2 (Diffie-Hellman) 2023-03-08 08:36:25 +01:00
testdata Update "dns" unit test's test data .gitignore file 2022-08-09 08:19:51 +00:00
testkeys Move all the unit tests to /tests/<libname>/ 2022-05-28 14:53:02 -07:00
.gitignore Update netmgr, tasks, and applications to use isc_loopmgr 2022-08-26 09:09:24 +02:00
acl_test.c Remove do-nothing header <isc/print.h> 2023-02-15 16:44:47 +00:00
db_test.c Support for relative names in unit tests 2023-02-27 13:47:25 +00:00
dbdiff_test.c Properly adjust the srcdir vs builddir paths 2022-06-01 17:08:37 +02:00
dbiterator_test.c Properly adjust the srcdir vs builddir paths 2022-06-01 17:08:37 +02:00
dbversion_test.c Extend dns_db_allrdatasets to control interation results 2022-12-07 22:20:02 +00:00
dispatch_test.c Fix the streaming read callback shutdown logic 2023-04-20 12:58:32 +02:00
dns64_test.c dns_rdatalist_tordataset() and dns_rdatalist_fromrdataset() can not fail 2022-08-09 08:19:51 +00:00
dnstap_test.c Apply the semantic patch to remove isc_stdtime_get() 2023-03-31 13:32:56 +02:00
dst_test.c unit tests: include an OpenSSL header before including cmocka.h 2023-04-14 12:11:52 +00:00
geoip_test.c Remove do-nothing header <isc/print.h> 2023-02-15 16:44:47 +00:00
Kdh.+002+18602.key Move all the unit tests to /tests/<libname>/ 2022-05-28 14:53:02 -07:00
keytable_test.c Replace DE_CONST(k, v) with v = UNCONST(k) macro 2023-04-03 10:25:56 +00:00
Krsa.+008+29238.key Check if RSASHA1 is supported by the OS 2022-08-09 16:22:19 +02:00
Makefile.am Remove TKEY Mode 2 (Diffie-Hellman) 2023-03-08 08:36:25 +01:00
master_test.c Implement dns_db node tracing 2023-02-28 11:44:15 +01:00
mkraw.pl Move all the unit tests to /tests/<libname>/ 2022-05-28 14:53:02 -07:00
name_test.c Check dns_name_countlabels() wrt DNS_NAME_MAXLABELS 2023-04-18 13:32:09 +01:00
nsec3_test.c Properly adjust the srcdir vs builddir paths 2022-06-01 17:08:37 +02:00
nsec3param_test.c Replace DE_CONST(k, v) with v = UNCONST(k) macro 2023-04-03 10:25:56 +00:00
private_test.c Update clang to version 14 2022-06-16 17:21:11 +02:00
qp_test.c A few qp-trie cleanups 2023-04-05 12:35:04 +01:00
qpmulti_test.c A few qp-trie cleanups 2023-04-05 12:35:04 +01:00
rbt_test.c Refactor isc_time_now() to return time, and not result 2023-03-31 15:02:06 +02:00
rbtdb_test.c Move all the unit tests to /tests/<libname>/ 2022-05-28 14:53:02 -07:00
rdata_test.c Implement dns_db node tracing 2023-02-28 11:44:15 +01:00
rdataset_test.c Move all the unit tests to /tests/<libname>/ 2022-05-28 14:53:02 -07:00
rdatasetstats_test.c Remove do-nothing header <isc/print.h> 2023-02-15 16:44:47 +00:00
resolver_test.c move dispatchmgr from resolver to view 2023-02-24 08:30:33 +00:00
rsa_test.c unit tests: include an OpenSSL header before including cmocka.h 2023-04-14 12:11:52 +00:00
sigs_test.c Apply the semantic patch to remove isc_stdtime_get() 2023-03-31 13:32:56 +02:00
time_test.c Move all the unit tests to /tests/<libname>/ 2022-05-28 14:53:02 -07:00
tsig_test.c Apply the semantic patch to remove isc_stdtime_get() 2023-03-31 13:32:56 +02:00
update_test.c Remove isc_stdtime_get() macro 2023-03-31 13:33:16 +02:00
zonemgr_test.c Refactor isc_time_now() to return time, and not result 2023-03-31 15:02:06 +02:00
zt_test.c Use a qp-trie for the zone table 2023-04-05 12:38:11 +01:00