2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-08-31 06:25:31 +00:00
Commit Graph

33013 Commits

Author SHA1 Message Date
Ondřej Surý
6d63ffe46d dig: add reference counter to the dig_lookup_t object
Sometimes, the dig_lookup_t could be destroyed before the final
send_done() callback was be called, leading to dereferencing an
already freed dig_lookup_t object.  By making the dig_lookup_t
reference counted, we are ensuring that it won't be freed until
the last reference (from dig_query_t .lookup) is released.
2020-11-07 21:11:42 +01:00
Ondřej Surý
ecd70eb4b5 dig: add new debugging output
track creation, attachment and detachment of dig_query objects.
2020-11-07 20:49:53 +01:00
Ondřej Surý
a2bc627c30 dig: add reference counting to dig_query_t
add a reference counter to the dig_query object to ensure
it isn't freed until the last caller releases it.
2020-11-07 20:49:53 +01:00
Evan Hunt
5307bf64ce reduce timing dependencies in system tests
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.

also, the serve-stale system test could fail due to a race in which
it timed out after waiting ten seconds for a file to be written, and
the dig timeout was just a bit longer. this is addressed by extending
the dig timeout to 11 seconds for this test.
2020-11-07 20:49:53 +01:00
Evan Hunt
ea2b04c361 dig: use new netmgr timeout mechanism
use isc_nmhandle_settimeout() to set read/recv timeouts, and get rid
of connect_timeout() and related functions in dighost.c.
2020-11-07 20:49:53 +01:00
Evan Hunt
4be63c5b00 add isc_nmhandle_settimeout() function
this function sets the read timeout for the socket associated
with a netmgr handle and, if the timer is running, resets it.
for TCPDNS sockets it also sets the read timeout and resets the
timer on the outer TCP socket.
2020-11-07 20:49:53 +01:00
Evan Hunt
e12dc1faa2 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-11-07 20:49:53 +01:00
Evan Hunt
cde27d2d2b 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-11-07 20:49:53 +01:00
Evan Hunt
94b7988efb 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-11-07 20:49:53 +01:00
Ondřej Surý
2191d2bf44 fix nmhandle attach/detach errors in tcpdnsconnect_cb()
we need to attach to the statichandle when connecting TCPDNS sockets,
same as with UDP.
2020-11-07 20:49:53 +01:00
Artem Boldariev
d48e040035 Merge branch 'artem/fix-build-with-DEBUG-defined' into 'main'
Fix build with DEBUG defined (-DDEBUG)

See merge request isc-projects/bind9!4351
2020-11-06 10:40:33 +00:00
Artem Boldariev
a236151608 Fix build with DEBUG defined (-DDEBUG)
The problem was introduced by commit 98b55eb4.
2020-11-06 12:20:41 +02:00
Mark Andrews
9a5aa8cf3a Merge branch '2239-fctx-id-is-uninitialized-and-effectively-unused' into 'main'
Resolve "fctx:id is uninitialized and effectively unused"

Closes #2239

See merge request isc-projects/bind9!4346
2020-11-06 02:26:11 +00:00
Mark Andrews
ed783a8139 remove fctx:id field 2020-11-06 01:54:44 +00:00
Michal Nowak
d7308c86a6 Merge branch '1728-drop-big-key' into 'main'
Drop bigkey

Closes #1728

See merge request isc-projects/bind9!4350
2020-11-05 16:25:32 +00:00
Michal Nowak
ef6703351a Drop bigkey
The 'bigkey' binary is not used anywhere, therefor it's sources should
be removed.
2020-11-05 17:17:14 +01:00
Michał Kępień
cec8493af5 Merge branch 'michal/miscellaneous-windows-tweaks' into 'main'
Miscellaneous Windows tweaks

Closes images#10

See merge request isc-projects/bind9!4354
2020-11-05 14:06:43 +00:00
Michał Kępień
64a091d587 Fix detection of CMake-built libuv on Windows
As of libuv 1.36.0, CMake is the only supported build method for libuv
on Windows.  Account for that fact by adjusting the relevant paths and
DLL file names used in the win32utils/Configure script.  Update
Windows-specific documentation accordingly.
2020-11-05 11:45:19 +01:00
Michał Kępień
004ca913f2 Use "image" key in Windows GitLab CI job templates
Our GitLab Runner Custom executor scripts now use the "image" key for
determining the Windows Docker image to use for a given CI job.  Update
.gitlab-ci.yml to reflect that change.
2020-11-05 11:45:19 +01:00
Michał Kępień
f54e2e623b Merge branch 'michal/rpz-system-test-fix-fast-expire' into 'main'
"rpz" system test: fix intermittent false positive (expired RPZ zone)

See merge request isc-projects/bind9!4357
2020-11-05 07:03:30 +00:00
Michał Kępień
39191052ad Wait for the "fast-expire" zone to be transferred
In order for a "fast-expire/IN: response-policy zone expired" message to
be logged in ns3/named.run, the "fast-expire" zone must first be
transferred in by that server.  However, with unfavorable timing, ns3
may be stopped before it manages to fetch the "fast-expire" zone from
ns5 and after the latter has been reconfigured to no longer serve that
zone.  In such a case, the "rpz" system test will report a false
positive for the relevant check.  Prevent that from happening by
ensuring ns3 manages to transfer the "fast-expire" zone before getting
shut down.
2020-11-05 07:53:43 +01:00
Mark Andrews
31b49a82d7 Merge branch '2243-cid-312970-incorrect-expression-copy_paste_error-in-tcp-c' into 'main'
Resolve "CID 312970: Incorrect expression (COPY_PASTE_ERROR) in tcp.c"

Closes #2243

See merge request isc-projects/bind9!4355
2020-11-05 00:32:06 +00:00
Mark Andrews
0073cb7356 Incorrect result code passed to failed_connect_cb
*** CID 312970:  Incorrect expression  (COPY_PASTE_ERROR) /lib/isc/netmgr/tcp.c: 282 in tcp_connect_cb()
    276     	}
    277
    278     	isc__nm_incstats(sock->mgr, sock->statsindex[STATID_CONNECT]);
    279     	r = uv_tcp_getpeername(&sock->uv_handle.tcp, (struct sockaddr *)&ss,
    280     			       &(int){ sizeof(ss) });
    281     	if (r != 0) {
    >>>     CID 312970:  Incorrect expression  (COPY_PASTE_ERROR)
    >>>     "status" in "isc___nm_uverr2result(status, true, "netmgr/tcp.c", 282U)" looks like a copy-paste error.
    282     		failed_connect_cb(sock, req, isc__nm_uverr2result(status));
    283     		return;
    284     	}
    285
    286     	atomic_store(&sock->connecting, false);
    287
2020-11-04 21:58:05 +00:00
Matthijs Mekking
1299630324 Merge branch 'matthijs-test-multi-signer-model' into 'main'
Add a test for RFC 8901 signer model 2

See merge request isc-projects/bind9!4306
2020-11-04 13:27:22 +00:00
Matthijs Mekking
518dd0bb17 kasp test: Use DEFAULT_ALGORITHM in tests.sh
Some setup scripts uses DEFAULT_ALGORITHM in their dnssec-policy
and/or initial signing. The tests still used the literal values
13, ECDSAP256SHA256, and 256. Replace those occurrences where
appropriate.
2020-11-04 12:41:25 +01:00
Matthijs Mekking
7e0ec9f624 Add a test for RFC 8901 signer model 2
The new 'dnssec-policy' was already compatible with multi-signer
model 2, now we also have a test for it.
2020-11-04 12:40:04 +01:00
Mark Andrews
5a8d95ea2a Merge branch '2244-nta-related-crash-after-reconfiguring-views' into 'main'
Resolve "NTA-related crash after reconfiguring views"

Closes #2244

See merge request isc-projects/bind9!4345
2020-11-03 12:47:43 +00:00
Mark Andrews
2ef0f252a8 Add CHANGES for [GL #2244] 2020-11-03 12:29:04 +00:00
Mark Andrews
ea956976d1 Call nta_detach() before dns_view_weakdetach() so view is available. 2020-11-03 12:29:04 +00:00
Mark Andrews
1be2a83c67 Merge branch 'marka-fixup-dnssec' into 'main'
dnssec system test needs python and perl

See merge request isc-projects/bind9!4342
2020-11-03 00:48:58 +00:00
Mark Andrews
40ae128922 dnssec system test needs python and perl 2020-11-03 11:22:36 +11:00
Ondřej Surý
3ec9b5f1d9 Merge branch '2227-tcp-connection-closed-second-fix' into 'main'
Fix improper closed connection handling in tcpdns.

Closes #2227

See merge request isc-projects/bind9!4341
2020-11-02 22:52:01 +00:00
Ondřej Surý
c14c1fdd2c Put up additional safe guards to not use inactive/closed tcpdns socket
When we are operating on the tcpdns socket, we need to double check
whether the socket or its outerhandle or its listener or its mgr is
still active and when not, bail out early.
2020-11-02 20:58:00 +01:00
Ondřej Surý
cea4b4db8f Add CHANGES note for [GL #2227] 2020-11-02 15:10:28 +01:00
Witold Kręcicki
3ab3d90de0 Fix improper closed connection handling in tcpdns.
If dnslisten_readcb gets a read callback it needs to verify that the
outer socket wasn't closed in the meantime, and issue a CANCELED callback
if it was.
2020-11-02 15:10:28 +01:00
Michał Kępień
f8730ae1a2 Merge branch '2237-placeholder' into 'main'
Add placeholder for #2237

See merge request isc-projects/bind9!4343
2020-11-02 11:25:30 +00:00
Michał Kępień
2a33e5bf60 Add placeholder for #2237 2020-11-02 12:24:11 +01:00
Ondřej Surý
c933fa8d47 Merge branch '2235-add-netmgr-functions-to-support-outgoing-dns-queries' into 'main'
Resolve "Add netmgr functions to support outgoing DNS queries"

Closes #2235

See merge request isc-projects/bind9!4318
2020-10-30 13:40:18 +00:00
Evan Hunt
3a2dc05c92 CHANGES 2020-10-30 11:11:54 +01:00
Evan Hunt
8fcad58ea6 check return value from uv_tcp_getpeername() when connecting
if we can't determine the peer, the connect should fail.
2020-10-30 11:11:54 +01:00
Ondřej Surý
14f54d13dc add a netmgr unit test
tests of UDP and TCP cases including:
- sending and receiving
- closure sockets without reading or sending
- closure of sockets at various points while sending and receiving
- since the teste is multithreaded, cmocka now aborts tests on the
  first failure, so that failures in subthreads are caught and
  reported correctly.
2020-10-30 11:11:54 +01:00
Evan Hunt
26a3a22895 set REUSEPORT and REUSEADDR on TCP sockets if needed
When binding a TCP socket, if bind() fails with EADDRINUSE,
try again with REUSEPORT/REUSEADDR (or the equivalent options).
2020-10-30 11:11:54 +01:00
Ondřej Surý
ed3ab63f74 Fix more races between connect and shutdown
There were more races that could happen while connecting to a
socket while closing or shutting down the same socket.  This
commit introduces a .closing flag to guard the socket from
being closed twice.
2020-10-30 11:11:54 +01:00
Ondřej Surý
6cfadf9db0 Fix a race between isc__nm_async_shutdown() and new sends/reads
There was a data race where a new event could be scheduled after
isc__nm_async_shutdown() had cleaned up all the dangling UDP/TCP
sockets from the loop.
2020-10-30 11:11:54 +01:00
Ondřej Surý
5fcd52209a Refactor udp_recv_cb()
- more logical code flow.
- propagate errors back to the caller.
- add a 'reading' flag and call the callback from failed_read_cb()
  only when it the socket was actively reading.
2020-10-30 11:11:54 +01:00
Ondřej Surý
cdccac4993 Fix netmgr read/connect timeout issues
- don't bother closing sockets that are already closing.
- UDP read timeout timer was not stopped after reading.
- improve handling of TCP connection failures.
2020-10-30 11:11:54 +01:00
Ondřej Surý
7a6056bc8f Add isc__nm_udp_shutdown() function
This function will be called during isc_nm_closedown() to ensure
that all UDP sockets are closed and detached.
2020-10-30 11:11:54 +01:00
Evan Hunt
5dcdc00b93 add netmgr functions to support outgoing DNS queries
- isc_nm_tcpdnsconnect() sets up up an outgoing TCP DNS connection.
- isc_nm_tcpconnect(), _udpconnect() and _tcpdnsconnect() now take a
  timeout argument to ensure connections time out and are correctly
  cleaned up on failure.
- isc_nm_read() now supports UDP; it reads a single datagram and then
  stops until the next time it's called.
- isc_nm_cancelread() now runs asynchronously to prevent assertion
  failure if reading is interrupted by a non-network thread (e.g.
  a timeout).
- isc_nm_cancelread() can now apply to UDP sockets.
- added shim code to support UDP connection in versions of libuv
  prior to 1.27, when uv_udp_connect() was added

all these functions will be used to support outgoing queries in dig,
xfrin, dispatch, etc.
2020-10-30 11:11:54 +01:00
Michał Kępień
2111ea05cd Merge branch 'mnowak/OpenBSD_6.8' into 'main'
Add OpenBSD 6.8

See merge request isc-projects/bind9!4298
2020-10-30 09:39:33 +00:00
Michal Nowak
773649f413 Update to OpenBSD 6.8 2020-10-30 10:11:06 +01:00