Commit Graph

32703 Commits

Author SHA1 Message Date
Evan Hunt
b10dccf4ea fixup! checkpoint: xfrin using netmgr 2020-10-06 23:50:02 -07:00
Evan Hunt
64b5662914 fixup! checkpoint: xfrin using netmgr 2020-10-06 23:50:02 -07:00
Evan Hunt
16f3479571 checkpoint: xfrin using netmgr
use isc_nm_tcpdnsconnect() in xfrin.c for zone transfers
2020-10-06 23:50:02 -07:00
Evan Hunt
4e68fb68f6 fixup! retry isc_nm_udpconnect() if it fails 2020-10-06 21:56:37 -07:00
Evan Hunt
05719575af fixup! experiment: make sock->result atomic 2020-10-06 21:53:25 -07:00
Evan Hunt
265bf814db fixup! WIP: add udp_cancelread() and udp_recv timeout support 2020-10-06 15:42:08 -07:00
Evan Hunt
90b1095635 fixup! WIP: add udp_cancelread() and udp_recv timeout support 2020-10-06 15:42:06 -07:00
Ondřej Surý
6bbadaabd8 WIP: add udp_cancelread() and udp_recv timeout support 2020-10-06 15:41:44 -07:00
Evan Hunt
81c4021178 make isc_nm_cancelread() run asynchronously
reading can be canceled in non-network threads (e.g., by a timeout),
and this was causing an assertion failure.
2020-10-06 12:03:38 -07:00
Evan Hunt
c1c040084a experiment: make sock->result atomic 2020-10-06 12:03:38 -07:00
Evan Hunt
f432ee863a don't detach handle on timeout unless we're still reading
there's a window in which the connect timeout can still run
after a recv completion, in which case we do want to clear the
query but we don't want to perform the extra handle detach.
2020-10-06 12:03:38 -07:00
Evan Hunt
cdf3e5b04e retry isc_nm_udpconnect() if it fails
On FreeBSD, we sometimes see spurious transient EADDRINUSE errors
when connecting to a UDP socket. We now try a few times to ensure
the error is real before giving up.

This commit also fixes a memory leak that occurred if an error was
encountered in isc__nm_async_udpconnect().
2020-10-06 12:03:38 -07:00
Evan Hunt
0efb8864bf reduce timing dependency in resolver test
one of the tests in the resolver system test depends on dig
getting no response to its first two query attempts, and SERVFAIL
on the third after resolution times out.

using a 5-second retry timer in dig means the SERVFAIL response
could occur while dig is discarding the second query and preparing
to send the third. in this case the server's response could be
missed.  shortening the retry interval to 4 seconds ensures that
dig has already sent the third query when the SERVFAIL response
arrives.
2020-10-06 12:03:38 -07:00
Evan Hunt
f38779c1db replace query context with a new one when resending UDP queries
resending UDP queries using the same query object could result
in a recv completion event for a previous query arriving before
the send completion event for the current one, leading to
inconsistencies that could cause crashes or hangs on shutdown.
creating a new query context for each send fixes the problem.
2020-10-06 12:03:38 -07:00
Evan Hunt
cc5d0e9ade experiment: extend dig timeout 2020-10-06 12:03:38 -07:00
Evan Hunt
3cebd43f09 ensure errors are caught when UDP send() fails 2020-10-06 12:03:38 -07:00
Evan Hunt
e4853efb9d fixup! Add isc_uv_udp_connect() shim 2020-10-06 12:03:38 -07:00
Evan Hunt
545cd3934e fixup! dig: remove "+unexpected" option 2020-10-06 12:03:38 -07:00
Evan Hunt
230085c176 fixup! Add isc_uv_udp_connect() shim 2020-10-06 12:03:38 -07:00
Evan Hunt
a68a93a1ce handle TCP read timeout in connect_timeout()
when the code to handle TCP connect timeouts was moved out of
connect_timeout(), it caused hangs when dig connected via TCP to a
server and the connection succeded but the server never sent a
response. we should add a read timeout mechanism for client TCP
connections as well as a connect timeout mechanism. in the meantime,
however, I've restored the TCP functionality in connect_timeout()
so it can handle the case of read timeouts.
2020-10-06 12:03:38 -07:00
Evan Hunt
43c4891758 fixup! kluge: prevent crash on interrupt when TCP connect is pending 2020-10-06 12:03:38 -07:00
Evan Hunt
378afa9979 kluge: prevent crash on interrupt when TCP connect is pending
- stop and clean up resources from the TCP connect timer in
  isc__nm_tcp_shutdown(), and call the connect callback with
  ISC_R_CANCELED
- don't clear TCP queries that are waiting for connect in
  clear_query(); they'll be taken care of by tcp_connected() now.
2020-10-06 12:03:38 -07:00
Ondřej Surý
9243e6d935 fixup! Clone the csock in accept_connection(), not in callback 2020-10-06 12:03:38 -07:00
Ondřej Surý
f02c68f884 fixup! Clone the csock in accept_connection(), not in callback 2020-10-06 12:03:38 -07:00
Ondřej Surý
d3c0a04ad7 Clone the csock in accept_connection(), not in callback
If we clone the csock (children socket) in TCP accept_connection() instead of
passing the ssock (server socket) to the call back and cloning it there we
unbreak the assumption that every socket is handled inside it's own worker
thread and therefore we can get rid of (at least) callback locking.
2020-10-06 12:03:33 -07:00
Evan Hunt
6521a3b69c fixup! Add isc_uv_udp_connect() shim 2020-10-06 12:03:05 -07:00
Ondřej Surý
44a431cee6 Add isc_uv_udp_connect() shim
The uv_udp_connect() function is available from libuv 1.27+, move the code to
connect to udp socket to a (limited) shim function called isc_uv_udp_connect().
2020-10-06 12:03:05 -07:00
Evan Hunt
5aee9f642b implement a TCP connect timeout
Attempting to connect dig to the wrong address via TCP caused a hang on
shutdown due to a dangling socket reference; tcp_connect_cb() was never
reached and so the TCP socket was never detached.

This commit adds a connection timeout mechanism to isc_nm_tcpconnect()
and isc_nm_tcpdnsconnect().

NOTE: Currently this only works correctly with "dig +tries=1". If the
connection is retried, we get a segfault on shutdown in uv_walk(); I
haven't yet worked out why.
2020-10-06 12:03:05 -07:00
Evan Hunt
e70823f14a fixup! fixup! WIP: Convert the sendcount/recvcount to isc_refcount_t 2020-10-06 12:03:05 -07:00
Evan Hunt
255b180964 fixup! WIP: Convert the sendcount/recvcount to isc_refcount_t 2020-10-06 12:03:05 -07:00
Evan Hunt
91d143999e fixup! WIP: Convert the sendcount/recvcount to isc_refcount_t 2020-10-06 12:03:05 -07:00
Ondřej Surý
6bc352ea56 WIP: Convert the sendcount/recvcount to isc_refcount_t 2020-10-06 12:03:05 -07:00
Evan Hunt
795085ffc2 kluge: extra handle detach when canceling
when dig is interrupted with SIGINT while a UDP connection is still
pending, it hangs due to recv_done() never being called. adding
an extra handle detach in cancel_all() corrects this, but is probably
not the correct way to fix it.
2020-10-06 12:03:05 -07:00
Evan Hunt
e4282ad606 CHANGES and release note 2020-10-06 12:03:03 -07:00
Evan Hunt
7cd82f419f dig: setup IDN whenever printing a message
because dig now uses the netmgr, printing of response messages
happens in a different thread than setup. the IDN output filtering
procedure, which set using dns_name_settotextfilter(), is stored as
thread-local data, and so if it's set during setup, it won't be
accessible when printing. we now set it immediately before printing,
in the same thread, and clear it immedately afterward.
2020-10-06 12:02:47 -07:00
Evan Hunt
d9542cf35d dig: remove "+unexpected" option
The network manager does not support returning UDP datagrams to
clients from unexpected sources; it is therefore not possible for
dig to accept them.  The "+[no]unexpected" option has therefore
been removed from the dig command and its documentation.
2020-10-06 12:02:47 -07:00
Evan Hunt
1fa4db11d6 fixup! convert dig/host/nslookup to use the netmgr 2020-10-06 12:02:47 -07:00
Evan Hunt
569cf55243 convert dig/host/nslookup to use the netmgr
use netmgr functions instead of isc_socket for dig, host, and
nslookup. note that `dig +unexpected` is not working.
2020-10-06 12:02:47 -07:00
Evan Hunt
6831adf3df shim code for UDP connect in older libuv versions
uv_udp_connect() was added in libuv 1.27; we need a method of
connecting UDP sockets for older versions.
2020-10-06 12:02:47 -07:00
Evan Hunt
68c2ddb63a add netmgr functions to support outgoing DNS queries
- isc_nm_tcpdnsconnect() sets up up an outgoing TCP DNS connection
- isc_nm_udpconnect() sets up a connected UDP socket
- isc_nm_read() now supports UDP; it reads a single datagram and then
  stops until the next time it's called.

these functions will later be used to support outgoing queries in dig,
dispatch, etc.
2020-10-06 12:02:45 -07:00
Mark Andrews
08c996c80a Merge branch '2200-the-fuzzer-dns_message_parser-c-is-leaking-memory' into 'main'
Resolve "The fuzzer dns_message_parse.c is leaking memory."

Closes #2200

See merge request isc-projects/bind9!4239
2020-10-06 13:20:36 +00:00
Mark Andrews
0d978878c5 invalidate cctx on error 2020-10-06 23:50:01 +11:00
Mark Andrews
40e54142f8 Merge branch 'marka-create_query-fix-REVERSE_INULL' into 'main'
Silence Coverity REVERSE_INULL report

Closes #2198

See merge request isc-projects/bind9!4234
2020-10-06 12:33:56 +00:00
Mark Andrews
f0a66cb5aa Silence Coverity REVERSE_INULL report
message does not need to be tested to NULL
2020-10-06 12:11:25 +00:00
Matthijs Mekking
d2d7f2a14e Merge branch 'he32-test-fix' into 'main'
Avoid a non-standard bashism: use of "==" in "test".

See merge request isc-projects/bind9!4235
2020-10-06 08:28:12 +00:00
Havard Eidnes
1f83daa4ac Avoid a non-standard bashism: use of "==" in "test". 2020-10-06 08:27:56 +00:00
Mark Andrews
4134980448 Merge branch 'marka-render_buf-was-too-big' into 'main'
render_buf was too big

See merge request isc-projects/bind9!4231
2020-10-06 07:37:30 +00:00
Mark Andrews
8faf12eace render buf was too big
It was misdeclared as a array of pointers (uint8_t*[]) and there
where too many elements (64 * 1024) instead of (64 * 1024 - 1).
2020-10-06 09:49:28 +11:00
Ondřej Surý
50df71a881 Merge branch '2183-dns-flag-day-2020' into 'main'
Resolve "DNS Flag Day 2020"

Closes #2183

See merge request isc-projects/bind9!4179
2020-10-05 15:13:12 +00:00
Ondřej Surý
096d41b4e2 Add text describing the changes done in the MR in more detail 2020-10-05 16:21:21 +02:00