bind9/lib/isc
Evan Hunt 308bc46a59 Convert dispatch to netmgr
The flow of operations in dispatch is changing and will now be similar
for both UDP and TCP queries:

1) Call dns_dispatch_addresponse() to assign a query ID and register
   that we'll be listening for a response with that ID soon. the
   parameters for this function include callback functions to inform the
   caller when the socket is connected and when the message has been
   sent, as well as a task action that will be sent when the response
   arrives. (later this could become a netmgr callback, but at this
   stage to minimize disruption to the calling code, we continue to use
   isc_task for the response event.) on successful completion of this
   function, a dispatch entry object will be instantiated.

2) Call dns_dispatch_connect() on the dispatch entry. this runs
   isc_nm_udpconnect() or isc_nm_tcpdnsconnect(), as needed, and begins
   listening for responses. the caller is informed via a callback
   function when the connection is established.

3) Call dns_dispatch_send() on the dispatch entry. this runs
   isc_nm_send() to send a request.

4) Call dns_dispatch_removeresponse() to terminate listening and close
   the connection.

Implementation comments below:

- As we will be using netmgr buffers now.  code to send the length in
  TCP queries has also been removed as that is handled by the netmgr.

- TCP dispatches can be used by multiple simultaneous queries, so
  dns_dispatch_connect() now checks whether the dispatch is already
  connected before calling isc_nm_tcpdnsconnect() again.

- Running dns_dispatch_getnext() from a non-network thread caused a
  crash due to assertions in the netmgr read functions that appear to be
  unnecessary now. the assertions have been removed.

- fctx->nqueries was formerly incremented when the connection was
  successful, but is now incremented when the query is started and
  decremented if the connection fails.

- It's no longer necessary for each dispatch to have a pool of tasks, so
  there's now a single task per dispatch.

- Dispatch code to avoid UDP ports already in use has been removed.

- dns_resolver and dns_request have been modified to use netmgr callback
  functions instead of task events. some additional changes were needed
  to handle shutdown processing correctly.

- Timeout processing is not yet fully converted to use netmgr timeouts.

- Fixed a lock order cycle reported by TSAN (view -> zone-> adb -> view)
  by by calling dns_zt functions without holding the view lock.
2021-10-02 11:39:56 -07:00
..
include Convert dispatch to netmgr 2021-10-02 11:39:56 -07:00
netmgr netmgr fixes needed for dispatch 2021-10-02 11:39:56 -07:00
tests Dispatch API simplification 2021-10-02 10:21:49 +02:00
.gitignore [master] update gitignore files; use rev-parse to get srcid 2014-06-17 13:49:30 -07:00
aes.c The isc/platform.h header has been completely removed 2021-07-06 05:33:48 +00:00
app.c Remove support for external applications to register libisc 2021-08-30 08:47:39 +02:00
assertions.c The isc/platform.h header has been completely removed 2021-07-06 05:33:48 +00:00
astack.c update all copyright headers to eliminate the typo 2020-09-14 16:20:40 -07:00
backtrace.c The isc/platform.h header has been completely removed 2021-07-06 05:33:48 +00:00
base32.c update all copyright headers to eliminate the typo 2020-09-14 16:20:40 -07:00
base64.c update all copyright headers to eliminate the typo 2020-09-14 16:20:40 -07:00
bind9.c Remove support for external applications to register libisc 2021-08-30 08:47:39 +02:00
buffer.c Use isc_mem_reget() when growing buffer dynamically 2021-09-23 22:17:15 +02:00
commandline.c Remove LIB<*>_EXTERNAL_DATA defines 2021-07-06 05:33:48 +00:00
condition.c Completely remove BIND 9 Windows support 2021-06-09 14:35:14 +02:00
counter.c update all copyright headers to eliminate the typo 2020-09-14 16:20:40 -07:00
crc64.c update all copyright headers to eliminate the typo 2020-09-14 16:20:40 -07:00
dir.c Completely remove BIND 9 Windows support 2021-06-09 14:35:14 +02:00
entropy.c update all copyright headers to eliminate the typo 2020-09-14 16:20:40 -07:00
entropy_private.h update all copyright headers to eliminate the typo 2020-09-14 16:20:40 -07:00
errno.c Completely remove BIND 9 Windows support 2021-06-09 14:35:14 +02:00
errno2result.c The isc/platform.h header has been completely removed 2021-07-06 05:33:48 +00:00
errno2result.h Completely remove BIND 9 Windows support 2021-06-09 14:35:14 +02:00
error.c update all copyright headers to eliminate the typo 2020-09-14 16:20:40 -07:00
event.c update all copyright headers to eliminate the typo 2020-09-14 16:20:40 -07:00
file.c Remove the mastefile-format map option 2021-09-17 07:09:50 +02:00
fsaccess.c Completely remove BIND 9 Windows support 2021-06-09 14:35:14 +02:00
fsaccess_common.c update all copyright headers to eliminate the typo 2020-09-14 16:20:40 -07:00
fsaccess_common_p.h update all copyright headers to eliminate the typo 2020-09-14 16:20:40 -07:00
glob.c Completely remove BIND 9 Windows support 2021-06-09 14:35:14 +02:00
hash.c Completely remove BIND 9 Windows support 2021-06-09 14:35:14 +02:00
heap.c update all copyright headers to eliminate the typo 2020-09-14 16:20:40 -07:00
hex.c update all copyright headers to eliminate the typo 2020-09-14 16:20:40 -07:00
hmac.c The isc/platform.h header has been completely removed 2021-07-06 05:33:48 +00:00
hp.c Add new isc_managers API to simplify <*>mgr create/destroy 2021-05-07 10:19:05 -07:00
ht.c update all copyright headers to eliminate the typo 2020-09-14 16:20:40 -07:00
httpd.c Refactor the interface handling in the netmgr 2021-05-26 09:43:12 +02:00
interfaceiter.c Completely remove BIND 9 Windows support 2021-06-09 14:35:14 +02:00
iterated_hash.c update all copyright headers to eliminate the typo 2020-09-14 16:20:40 -07:00
jemalloc_shim.h Use assertions to check for failed allocations 2021-09-30 13:54:55 +02:00
lex.c Add support for parsing <tag>[=<value>] 2021-08-18 13:49:48 +10:00
lib.c Remove support for external applications to register libisc 2021-08-30 08:47:39 +02:00
log.c The isc/platform.h header has been completely removed 2021-07-06 05:33:48 +00:00
Makefile.am Remove native PKCS#11 support 2021-09-09 15:35:39 +02:00
managers.c Convert dispatch to netmgr 2021-10-02 11:39:56 -07:00
md.c update all copyright headers to eliminate the typo 2020-09-14 16:20:40 -07:00
mem.c Use assertions to check for failed allocations 2021-09-30 13:54:55 +02:00
mem_p.h Use library constructor/destructor to initialize OpenSSL 2021-02-18 19:33:54 +01:00
meminfo.c Completely remove BIND 9 Windows support 2021-06-09 14:35:14 +02:00
mutex.c Completely remove BIND 9 Windows support 2021-06-09 14:35:14 +02:00
mutexblock.c update all copyright headers to eliminate the typo 2020-09-14 16:20:40 -07:00
net.c Completely remove BIND 9 Windows support 2021-06-09 14:35:14 +02:00
netaddr.c Completely remove BIND 9 Windows support 2021-06-09 14:35:14 +02:00
netmgr_p.h Destroy netmgr before destroying taskmgr 2021-05-07 14:28:30 -07:00
netscope.c update all copyright headers to eliminate the typo 2020-09-14 16:20:40 -07:00
nonce.c update all copyright headers to eliminate the typo 2020-09-14 16:20:40 -07:00
openssl_shim.c Refactor TLSDNS module to work with libuv/ssl directly 2021-01-25 09:19:22 +01:00
openssl_shim.h Refactor TLSDNS module to work with libuv/ssl directly 2021-01-25 09:19:22 +01:00
os.c Cache the isc_os_ncpu() result 2021-07-13 09:12:04 +02:00
parseint.c update all copyright headers to eliminate the typo 2020-09-14 16:20:40 -07:00
pool.c update all copyright headers to eliminate the typo 2020-09-14 16:20:40 -07:00
portset.c update all copyright headers to eliminate the typo 2020-09-14 16:20:40 -07:00
queue.c update all copyright headers to eliminate the typo 2020-09-14 16:20:40 -07:00
quota.c Add (http-)listener-clients option (DoH quota mechanism) 2021-07-16 11:50:20 +03:00
radix.c update all copyright headers to eliminate the typo 2020-09-14 16:20:40 -07:00
random.c The isc/platform.h header has been completely removed 2021-07-06 05:33:48 +00:00
ratelimiter.c update all copyright headers to eliminate the typo 2020-09-14 16:20:40 -07:00
regex.c Reformat sources using clang-format-11 2020-12-08 18:36:23 +01:00
region.c Reformat sources using clang-format-11 2020-12-08 18:36:23 +01:00
resource.c The isc/platform.h header has been completely removed 2021-07-06 05:33:48 +00:00
result.c Remove support for external applications to register libisc 2021-08-30 08:47:39 +02:00
rwlock.c Fix unchecked return of isc_rwlock_lock and isc_rwlock_unlock 2021-07-12 13:26:29 +10:00
safe.c update all copyright headers to eliminate the typo 2020-09-14 16:20:40 -07:00
serial.c update all copyright headers to eliminate the typo 2020-09-14 16:20:40 -07:00
siphash.c update all copyright headers to eliminate the typo 2020-09-14 16:20:40 -07:00
sockaddr.c Completely remove BIND 9 Windows support 2021-06-09 14:35:14 +02:00
socket.c Convert dispatch to netmgr 2021-10-02 11:39:56 -07:00
socket_p.h Completely remove BIND 9 Windows support 2021-06-09 14:35:14 +02:00
stats.c Add a function isc_stats_resize 2021-08-24 09:07:15 +02:00
stdio.c Completely remove BIND 9 Windows support 2021-06-09 14:35:14 +02:00
stdtime.c Completely remove BIND 9 Windows support 2021-06-09 14:35:14 +02:00
string.c Completely remove BIND 9 Windows support 2021-06-09 14:35:14 +02:00
symtab.c update all copyright headers to eliminate the typo 2020-09-14 16:20:40 -07:00
syslog.c Completely remove BIND 9 Windows support 2021-06-09 14:35:14 +02:00
task.c The isc/platform.h header has been completely removed 2021-07-06 05:33:48 +00:00
task_p.h Destroy netmgr before destroying taskmgr 2021-05-07 14:28:30 -07:00
taskpool.c Refactor taskmgr to run on top of netmgr 2021-04-20 23:22:28 +02:00
thread.c Completely remove BIND 9 Windows support 2021-06-09 14:35:14 +02:00
time.c The isc/platform.h header has been completely removed 2021-07-06 05:33:48 +00:00
timer.c The isc/platform.h header has been completely removed 2021-07-06 05:33:48 +00:00
timer_p.h Add new isc_managers API to simplify <*>mgr create/destroy 2021-05-07 10:19:05 -07:00
tls.c Add "session-tickets" options to the "tls" clause 2021-10-01 15:50:43 +03:00
tls_p.h Use library constructor/destructor to initialize OpenSSL 2021-02-18 19:33:54 +01:00
tm.c Use isdigit instead of checking character range 2021-05-05 19:15:33 +02:00
trampoline.c Synchronize the isc_trampoline API with changes needed in v9_16 2021-09-01 10:44:21 +02:00
trampoline_p.h Synchronize the isc_trampoline API with changes needed in v9_16 2021-09-01 10:44:21 +02:00
url.c cast (char) to (unsigned char) when calling is*() 2021-03-15 14:18:03 +11:00
utf8.c update all copyright headers to eliminate the typo 2020-09-14 16:20:40 -07:00