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

32840 Commits

Author SHA1 Message Date
Mark Andrews
157e3a98f2 Add CHANGES not for [GL #2252] 2020-11-10 06:15:46 +00:00
Mark Andrews
2b7128fede Check that DNSTAP captures forwarded UPDATE responses 2020-11-10 06:15:46 +00:00
Mark Andrews
b09727a765 Implement DNSTAP support in ns_client_sendraw()
ns_client_sendraw() is currently only used to relay UPDATE
responses back to the client.  dns_dt_send() is called with
this assumption.
2020-11-10 06:15:46 +00:00
Mark Andrews
a66b638d41 Merge branch '2259-zone_namerd_tostr-called-w-o-lock-being-held' into 'main'
Resolve "zone_namerd_tostr called w/o lock being held"

Closes #2259

See merge request isc-projects/bind9!4376
2020-11-10 06:14:21 +00:00
Mark Andrews
84f43903da Lock zone before calling zone_namerd_tostr()
WARNING: ThreadSanitizer: data race
    Read of size 8 at 0x000000000001 by thread T1:
    #0 inline_raw lib/dns/zone.c:1375
    #1 zone_namerd_tostr lib/dns/zone.c:15316
    #2 dns_zone_name lib/dns/zone.c:15391
    #3 xfrin_log lib/dns/xfrin.c:1605
    #4 xfrin_destroy lib/dns/xfrin.c:1477
    #5 dns_xfrin_detach lib/dns/xfrin.c:739
    #6 xfrin_connect_done lib/dns/xfrin.c:970
    #7 tcpdnsconnect_cb netmgr/tcpdns.c:786
    #8 tcp_connect_cb netmgr/tcp.c:292
    #9 <null> <null>
    #10 <null> <null>

    Previous write of size 8 at 0x000000000001 by thread T2 (mutexes: write M1):
    #0 zone_shutdown lib/dns/zone.c:14462
    #1 dispatch lib/isc/task.c:1152
    #2 run lib/isc/task.c:1344
    #3 <null> <null>

    Location is heap block of size 2769 at 0x000000000013 allocated by thread T3:
    #0 malloc <null>
    #1 default_memalloc lib/isc/mem.c:713
    #2 mem_get lib/isc/mem.c:622
    #3 mem_allocateunlocked lib/isc/mem.c:1268
    #4 isc___mem_allocate lib/isc/mem.c:1288
    #5 isc__mem_allocate lib/isc/mem.c:2453
    #6 isc___mem_get lib/isc/mem.c:1037
    #7 isc__mem_get lib/isc/mem.c:2432
    #8 dns_zone_create lib/dns/zone.c:984
    #9 configure_zone bin/named/server.c:6502
    #10 do_addzone bin/named/server.c:13391
    #11 named_server_changezone bin/named/server.c:13788
    #12 named_control_docommand bin/named/control.c:207
    #13 control_command bin/named/controlconf.c:392
    #14 dispatch lib/isc/task.c:1152
    #15 run lib/isc/task.c:1344
    #16 <null> <null>
2020-11-10 15:56:13 +11:00
Mark Andrews
bd3cc31f2b Merge branch '2230-legacy-system-test-fails-intermittently' into 'main'
Resolve "legacy system test fails intermittently"

Closes #2207

See merge request isc-projects/bind9!4295
2020-11-09 22:18:29 +00:00
Mark Andrews
06db7a153f Retry edns512 multiple times to trigger fallback to edns at 512
We want named to have slow resolving (multiple retries) when
there is a very small working MTU
2020-11-09 21:45:44 +00:00
Mark Andrews
b5145f46dc Fixup legacy test to account for not falling back to EDNS 512 lookups.
The SOA lookup for edns512 could succeed if the negative response
for ns.edns512/AAAA completed before all the edns512/SOA query
attempts are made.  The ns.edns512/AAAA lookup returns tc=1 and
the SOA record is cached after processing the NODATA response.
Lookup a TXT record at edns512 and look it up instead of the
SOA record.

Removed 'checking that TCP failures do not influence EDNS statistics
in the ADB' as it is no longer appropriate.
2020-11-09 21:45:44 +00:00
Evan Hunt
45f1df5412 Merge branch '2258-xfrin-shutdown-race' into 'main'
address some possible shutdown races in xfrin

Closes #2258

See merge request isc-projects/bind9!4374
2020-11-09 21:45:14 +00:00
Evan Hunt
e011521ef1 address some possible shutdown races in xfrin
there were two failures during observed in testing, both occurring
when 'rndc halt' was run rather than 'rndc stop' - the latter dumps
zone contents to disk and presumably introduced enough delay to
prevent the races:

- a failure when the zone was shut down and called dns_xfrin_detach()
  before the xfrin had finished connecting; the connect timeout
  terminated without detaching its handle
- a failure when the tcpdns socket timer fired after the outerhandle
  had already been cleared.

this commit incidentally addresses a failure observed in mutexatomic
due to a variable having been initialized incorrectly.
2020-11-09 12:33:37 -08:00
Ondřej Surý
ce58a149ce Merge branch '1840-netmgr-tls-layer-link-with-libssl' into 'main'
Add support to link with libssl

See merge request isc-projects/bind9!4373
2020-11-09 15:38:22 +00:00
Ondřej Surý
127ba7e930 Add libssl libraries to Windows build
This commit extends the perl Configure script to also check for libssl
in addition to libcrypto and change the vcxproj source files to link
with both libcrypto and libssl.
2020-11-09 16:00:28 +01:00
Witold Kręcicki
9a2065e2f4 autoconf: link with libssl
This is prerequisite to adding DoT and DoH support to BIND 9.
2020-11-09 15:59:01 +01:00
Ondřej Surý
c62f3af395 Merge branch '2016-xfrin-netmgr' into 'main'
use netmgr for xfrin

Closes #2016

See merge request isc-projects/bind9!4246
2020-11-09 14:45:17 +00:00
Evan Hunt
42d94614e4 CHANGES and release notes 2020-11-09 14:50:48 +01:00
Ondřej Surý
934d6c6f92 Refactor the xfrin reference counting
Previously, the xfrin object relied on four different reference counters
(`refs`, `connects`, `sends`, `recvs`) and destroyed the xfrin object
only if all of them were zero.  This commit reduces the reference
counting only to the `references` (renamed from `refs`) counter.  We
keep the existing `connects`, `sends` and `recvs` as safe guards, but
they are not formally needed.
2020-11-09 14:50:48 +01:00
Evan Hunt
1170a52f48 remove isc_task from xfrin
since the network manager is now handling timeouts, xfrin doesn't
need an isc_task object.

it may be necessary to revert this later if we find that it's
important for zone_xfrdone() to be executed in the zone task context.
currently things seem to be working well without that, though.
2020-11-09 13:45:43 +01:00
Evan Hunt
a8d28881d1 remove isc_timer from xfrin
the network manager can now handle timeouts, so it isn't
necessary for xfrin to use isc_timer for the purpose any
longer.
2020-11-09 13:45:43 +01:00
Evan Hunt
49d53a4aa9 use netmgr for xfrin
Use isc_nm_tcpdnsconnect() in xfrin.c for zone transfers.
2020-11-09 13:45:43 +01:00
Michal Nowak
917e365159 Merge branch 'mnowak/test-with-DDEBUG' into 'main'
Enable debug build on Tumbleweed in CI

See merge request isc-projects/bind9!4367
2020-11-09 12:36:24 +00:00
Michal Nowak
59a09b5db8 Enable debug build on Tumbleweed in CI 2020-11-09 13:34:51 +01:00
Evan Hunt
f6d967db54 Merge branch '2140-dig-netmgr' into 'main'
Resolve "convert dig and friends to use the netmgr"

Closes #2140

See merge request isc-projects/bind9!4115
2020-11-08 22:06:04 +00:00
Evan Hunt
3ff0ee568d CHANGES and release note 2020-11-08 13:36:12 -08:00
Ondřej Surý
8af7f81d6c netmgr: Don't crash if socket() returns an error in udpconnect
socket() call can return an error - e.g. EMFILE, so we need to handle
this nicely and not crash.

Additionally wrap the socket() call inside a platform independent helper
function as the Socket data type on Windows is unsigned integer:

> This means, for example, that checking for errors when the socket and
> accept functions return should not be done by comparing the return
> value with –1, or seeing if the value is negative (both common and
> legal approaches in UNIX). Instead, an application should use the
> manifest constant INVALID_SOCKET as defined in the Winsock2.h header
> file.
2020-11-08 13:36:12 -08:00
Ondřej Surý
b558eca633 dig: Refactor recv_done, so there's less exit paths
The recv_done() callback had many exit paths with different conditions,
and every path had it's own set of destructors.  The refactored code now
has unified exit path with descriptive goto labels matching the intent:

 - cancel_lookup
 - next_lookup
 - detach_query
 - keep_query

The only exception to the rule is check_for_more_data() path, where the
part of the query gets reused, so the query->readhandle and query gets
detached on it's own, and by going to the keep_query, we are just
skipping calling the destructors again.
2020-11-08 13:36:12 -08:00
Ondřej Surý
050258bda4 netmgr: Always load the result from async socket
Because we use result earlier for setting the loadbalancing on the
socket, we could be left with a ISC_R_NOTIMPLEMENTED value stored in the
variable and when the UDP connection would succeed, we would
errorneously return this value instead of ISC_R_SUCCESS.
2020-11-07 21:12:08 +01:00
Evan Hunt
88f5f3915b dig: prevent query from being detached if udpconnect fails on first attempt
FreeBSD sometimes returns spurious errors in UDP connect() attempts,
so we try a few times before giving up. However, each failed attempt
triggers a call to udp_ready() in dighost.c, and that was causing
the query object to be detached prematurely.
2020-11-07 21:11:58 +01:00
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