Commit Graph

33295 Commits

Author SHA1 Message Date
Ondřej Surý
ce0083474e Cleanup the remaining of HAVE_UV_<func> macros
While cleaning up the usage of HAVE_UV_<func> macros, we forgot to
cleanup the HAVE_UV_UDP_CONNECT in the actual code and
HAVE_UV_TRANSLATE_SYS_ERROR and this was causing Windows build to fail
on uv_udp_send() because the socket was already connected and we were
falsely assuming that it was not.

The platforms with autoconf support were not affected, because we were
still checking for the functions from the configure.

(cherry picked from commit 67afea6cfc)
2021-06-02 12:01:29 +02:00
Ondřej Surý
e773ec0b6a Merge branch '2732-zone-dumping-is-blocking-the-networking-io-v9_16' into 'v9_16'
Improve the zone dumping impact on the networking (v9.16)

See merge request isc-projects/bind9!5108
2021-05-31 15:39:44 +00:00
Ondřej Surý
6ca678aca3 Add CHANGES and release note for [GL #2732]
(cherry picked from commit 3e433b87fb)
2021-05-31 16:57:20 +02:00
Ondřej Surý
e95dadb40d Indicate to the kernel that we won't be needing the zone dumps
Add a call to posix_fadvise() to indicate to the kernel, that `named`
won't be needing the dumped zone files any time soon with:

 * POSIX_FADV_DONTNEED - The specified data will not be accessed in the
   near future.

Notes:

 POSIX_FADV_DONTNEED attempts to free cached pages associated with the
 specified region. This is useful, for example, while streaming large
 files. A program may periodically request the kernel to free cached
 data that has already been used, so that more useful cached pages are
 not discarded instead.

(cherry picked from commit e83b6569da)
2021-05-31 16:57:20 +02:00
Ondřej Surý
c8eddf4f33 Refactor zone dumping code to use netmgr async threadpools
Previously, dumping the zones to the files were quantized, so it doesn't
slow down network IO processing.  With the introduction of network
manager asynchronous threadpools, we can move the IO intensive work to
use that API and we don't have to quantize the work anymore as it the
file IO won't block anything except other zone dumping processes.

(cherry picked from commit 8a5c62de83)
2021-05-31 16:57:19 +02:00
Ondřej Surý
2e849353b3 Add isc_task_getnetmgr() function
Add a function to pull the attached netmgr from inside the executed
task.  This is needed for any task that needs to call the netmgr API.

(cherry picked from commit 7670f98377)
2021-05-31 16:57:19 +02:00
Ondřej Surý
1417e39055 Add asynchronous work API to the network manager
The libuv has a support for running long running tasks in the dedicated
threadpools, so it doesn't affect networking IO.

This commit adds isc_nm_work_enqueue() wrapper that would wraps around
the libuv API and runs it on top of associated worker loop.

The only limitation is that the function must be called from inside
network manager thread, so the call to the function should be wrapped
inside a (bound) task.

(cherry picked from commit 87fe97ed91)
2021-05-31 16:57:19 +02:00
Ondřej Surý
c1703f5ce6 Use UV_VERSION_HEX to decide whether we need libuv shim functions
Instead of having a configure check for every missing function that has
been added in later version of libuv, we now use UV_VERSION_HEX to
decide whether we need the shim or not.

(cherry picked from commit 211bfefbaa)
2021-05-31 16:57:19 +02:00
Ondřej Surý
4db28d79b1 Add uv_os_getenv() and uv_os_setenv() compatibility shims
The uv_os_getenv() and uv_os_setenv() functions were introduced in the
libuv >= 1.12.0.  Add simple compatibility shims for older versions.

(cherry picked from commit 7477d1b2ed)
2021-05-31 16:57:19 +02:00
Ondřej Surý
0ce462ab8e Add uv_req_get_data() and uv_req_set_data() compatibility shims
The uv_req_get_data() and uv_req_set_data() functions were introduced in
libuv >= 1.19.0, so we need to add compatibility shims with older libuv
versions.

(cherry picked from commit f752840db3)
2021-05-31 16:57:19 +02:00
Ondřej Surý
68cb38fc60 Cleanup the uv_import check
The uv_import() is not needed anymore, so we can remove the autoconf
check for it.

(cherry picked from commit 7b02848865)
2021-05-31 16:57:19 +02:00
Michał Kępień
2ed9e86580 Merge branch 'michal/regenerate-man-pages-with-docutils-0.16-v9_16' into 'v9_16'
[v9_16] Regenerate man pages with docutils 0.16

See merge request isc-projects/bind9!5120
2021-05-31 12:55:11 +00:00
Michał Kępień
1d239012a9 Regenerate man pages with docutils 0.16
Commit 070c5fff49 updated the man pages
to contents produced using:

  - Sphinx 4.0.2
  - sphinx-rtd-theme 0.5.2
  - docutils 0.17.1

However, sphinx-rtd-theme 0.5.2 is incompatible with versions 0.17+ of
the docutils package.  This problem was addressed in the Docker image
used for building man pages by downgrading the docutils package to
version 0.16.

Regenerate the man pages again, this time using:

  - Sphinx 4.0.2
  - sphinx-rtd-theme 0.5.2
  - docutils 0.16

This is necessary to prevent the "docs" GitLab CI job from failing.

(cherry picked from commit 6a2daddf5b)
2021-05-31 14:36:11 +02:00
Evan Hunt
4a93c54b56 Merge branch 'kchen-servestale-fix-v9_16' into 'v9_16'
Several serve-stale fixes

See merge request isc-projects/bind9!5118
2021-05-30 19:53:54 +00:00
Matthijs Mekking
89b0a0aa52 Reuse rdatset->ttl when dumping ancient RRsets
Rather than having an expensive 'expired' (fka 'stale_ttl') in the
rdataset structure, that is only used to be printed in a comment on
ancient RRsets, reuse the TTL field of the RRset.

(cherry picked from commit f7f543d99b)
2021-05-30 12:30:36 -07:00
Kevin Chen
3924f78748 Several serve-stale improvements
Commit a83c8cb0af updated masterdump so
that stale records in "rndc dumpdb" output no longer shows 0 TTLs.  In
this commit we change the name of the `rdataset->stale_ttl` field to
`rdataset->expired` to make its purpose clearer, and set it to zero in
cases where it's unused.

Add 'rbtdb->serve_stale_ttl' to various checks so that stale records
are not purged from the cache when they've been stale for RBTDB_VIRTUAL
(300) seconds.

Increment 'ns_statscounter_usedstale' when a stale answer is used.

Note: There was a question of whether 'overmem_purge' should be
purging ancient records, instead of stale ones.  It is left as purging
stale records, since stale records could take up the majority of the
cache.

This submission is copyrighted Akamai Technologies, Inc. and provided
under an MPL 2.0 license.

This commit was originally authored by Kevin Chen, and was updated by
Matthijs Mekking to match recent serve-stale developments.

(cherry picked from commit 0cdf85d204)
2021-05-30 12:30:36 -07:00
Evan Hunt
5daa9066d0 Merge branch '2733-serve-stale-prefetch-crash-v9_16' into 'v9_16'
Fix crash with serve-stale in combination with prefetch

See merge request isc-projects/bind9!5117
2021-05-30 07:57:27 +00:00
Matthijs Mekking
8433a39c54 Add CHANGES and notes for [#2733]
(cherry picked from commit 7ca253818e)
2021-05-30 00:33:42 -07:00
Evan Hunt
de480dcbb6 add a system test for the prefetch bug
Ensure that if prefetch is triggered as a result of a query
restart, it won't have the TRYSTALE_ONTIMEOUT flag set.

(cherry picked from commit 8c047feb3a)
2021-05-30 00:33:42 -07:00
Matthijs Mekking
a2ec3a1e4c Reset DNS_FETCHOPT_TRYSTALE_ONTIMEOUT on resume
Once we resume a query, we should clear DNS_FETCHOPT_TRYSTALE_ONTIMEOUT
from the options to prevent triggering the stale-answer-client-timeout
on subsequent fetches.

If we don't this may cause a crash when for example when prefetch is
triggered after a query restart.

(cherry picked from commit c0dc5937c7)
2021-05-30 00:33:42 -07:00
Michal Nowak
29421ba122 Merge branch 'mnowak/add-fedora-34-v9_16' into 'v9_16'
[v9_16] Add Fedora 34

See merge request isc-projects/bind9!5113
2021-05-28 11:35:38 +00:00
Michal Nowak
f19bdd7fd4 Add Fedora 34
(cherry picked from commit 5f27aaa0ff)
2021-05-28 12:59:02 +02:00
Evan Hunt
7b37091022 Merge branch '2731-servestale-dns64-v9_16' into 'v9_16'
fix a crash when using stale data with dns64

See merge request isc-projects/bind9!5112
2021-05-27 19:54:32 +00:00
Evan Hunt
534b4d8ed3 CHANGES, release note
(cherry picked from commit d8b793760c)
2021-05-27 12:09:43 -07:00
Matthijs Mekking
61214726da Test with stale timeout cache miss, then fetch completes
Add a test case where a client request is received and the stale
timeout occurs, but it is not served stale data because there is no entry
in the cache, then is served an authoritative answer once the background
fetch completes. This ensures that a stale timeout only affects a
subsequent response if the client was answered.

(cherry picked from commit c64589bf46)
2021-05-27 12:09:43 -07:00
Evan Hunt
85ca29e5e2 clean up query correctly if already answered by serve-stale
when a serve-stale answer has been sent, the client continues waiting
for a proper answer. if a final completion event for the client does
arrive, it can just be cleaned up without sending a response, similar
to a canceled fetch.

(cherry picked from commit 8bd8e995f1)
2021-05-27 12:09:43 -07:00
Evan Hunt
74766f68cc add a test of DNS64 processing with a stale negative response
- send a query for an AAAA which will be resolved as a mapped A
- disable authoritative responses
- wait for the negative AAAA response to become stale
- send another query, wait for the stale answer
- re-enable authorative responses so that a real answer arrives
- currently, this triggers an assertion in query.c

(cherry picked from commit 453e905d7e)
2021-05-27 12:09:43 -07:00
Ondřej Surý
c4afbb8148 Merge branch '2529-add-__attribute__-malloc-for-isc_mempool_get-v9_16' into 'v9_16'
Add malloc attribute to memory allocation functions

See merge request isc-projects/bind9!5001
2021-05-27 14:19:47 +00:00
Diego Fronza
4ed22937d8 Add malloc attribute to memory allocation functions
The malloc attribute allows compiler to do some optmizations on
functions that behave like malloc/calloc, like assuming that the
returned pointer do not alias other pointers.
2021-05-27 15:42:36 +02:00
Ondřej Surý
adbdde82d7 Merge branch '2536-inline-signing-documentation-doesn-t-match-reality-v9_16' into 'v9_16'
Resolve "inline-signing documentation doesn't match reality" (v9.16)

See merge request isc-projects/bind9!5110
2021-05-27 13:31:39 +00:00
Matthijs Mekking
8079b0ae8c checkconf tests for inline-signing at options/view
(cherry picked from commit a548a450b3)
2021-05-27 15:27:03 +02:00
Mark Andrews
2ef13c984f Add Release note for [GL #2536]
(cherry picked from commit 03978a7881)
2021-05-27 15:27:03 +02:00
Mark Andrews
9f6912e64b Add CHANGES note for [GL #2536]
(cherry picked from commit 475a553e37)
2021-05-27 15:27:03 +02:00
Mark Andrews
0b8cd8f19d inline-signing should have been in zone_only_clauses
(cherry picked from commit b3301da262)
2021-05-27 15:27:03 +02:00
Ondřej Surý
1f44bb5ab1 Merge branch '2708-named-doesn-t-compile-with-gcc-10-v9_16' into 'v9_16'
Remove priority from attribute constructor/destructor

See merge request isc-projects/bind9!5104
2021-05-27 12:55:17 +00:00
Mark Andrews
0340df46ec Remove priority from attribute constructor/destructor
On some platforms, the __attribute__ constructor and destructor won't
take priorities and the compilation failed.  On such platform would be
macOS.  For this reason, the constructor/destructor in the libisc was
reworked to not use priorities, but have a single constructor and
destructor that calls the appropriate routines in correct order.

This commit removes the extra priority because it's now not needed and
it also breaks a compilation on macOS with GCC 10.

(cherry picked from commit d68b009cfe)
2021-05-27 08:26:20 +02:00
Mark Andrews
8f63856d4c Merge branch '2282-shutdown-system-test-needs-to-be-tweaked-to-account-for-recent-netmgr-changes-v9_16' into 'v9_16'
Handling NoNameservers exception

See merge request isc-projects/bind9!5103
2021-05-27 03:35:21 +00:00
Diego Fronza
65f90f2927 Handling NoNameservers exception
In the shutdown system test multiple queries are sent to a resolver
instance, in the meantime we terminate the same resolver process for
which the queries were sent to, either via rndc stop or a SIGTERM
signal, that means the resolver may not be able to answer all those
queries, since it has initiated the shutdown process.

The dnspython library raises a dns.resolver.NoNameservers exception when
a resolver object fails to receive an answer from the specified list
of nameservers (resolver.nameservers list), we need to handle this
exception as this is something that may happen since we asked the
resolver to terminate, as a result it may not answer clients even if
an answer is available, as the operation will be canceled.

(cherry picked from commit b19cd2d83b)
2021-05-27 12:58:55 +10:00
Ondřej Surý
622e6e604d Merge branch 'marka-missing-initialisations-v9_16' into 'v9_16'
Add missing initialisations (v9.16)

See merge request isc-projects/bind9!5101
2021-05-26 15:53:06 +00:00
Mark Andrews
9694554b88 Add missing initialisations
configuring with --enable-mutex-atomics flagged these incorrectly
initialised variables on systems where pthread_mutex_init doesn't
just zero out the structure.

(cherry picked from commit 715a2c7fc1)
2021-05-26 17:19:06 +02:00
Ondřej Surý
81b9c5bc10 Merge branch 'ondrej/require-cmocka-1.1.3-v9_16' into 'v9_16'
Require CMocka >= 1.1.3 to run the unit tests

See merge request isc-projects/bind9!5099
2021-05-26 14:20:52 +00:00
Ondřej Surý
935a5e2095 Require CMocka >= 1.1.3 to run the unit tests
In CMocka versions << 1.1.3, the skip() function would cause the whole
unit test to abort when CMOCKA_TEST_ABORT is set.  As this is problem
only in Debian 9 Stretch and Ubuntu 16.04 Xenial, we just require the
CMocka >= 1.1.3 and disable the unit testing on Debian 9 Stretch until
we can pull the libcmocka-dev from stretch-backports and remove the
Ubuntu 16.04 Xenial from the CI as it is reaching End of Standard
Support at the end of April 2021.
2021-05-26 16:13:20 +02:00
Ondřej Surý
283ccc232f Merge branch '2721-shutdown-race-in-interfacemgr-v9_16' into 'v9_16'
Refactor the interface handling in the netmgr (v9.16)

See merge request isc-projects/bind9!5095
2021-05-26 08:55:43 +00:00
Ondřej Surý
b009b3c50c Refactor the interface handling in the netmgr
The isc_nmiface_t type was holding just a single isc_sockaddr_t,
so we got rid of the datatype and use plain isc_sockaddr_t in place
where isc_nmiface_t was used before.  This means less type-casting and
shorter path to access isc_sockaddr_t members.

At the same time, instead of keeping the reference to the isc_sockaddr_t
that was passed to us when we start listening, we will keep a local
copy. This prevents the data race on destruction of the ns_interface_t
objects where pending nmsockets could reference the sockaddr of already
destroyed ns_interface_t object.

(cherry picked from commit 50270de8a0)
2021-05-26 10:09:47 +02:00
Mark Andrews
1004eb884d Merge branch '2685-max-ixfr-ratio-appears-to-be-forcing-axfr-very-prematurely-on-bind-9-16-15-v9_16' into 'v9_16'
Correct size calculation in dns_journal_iter_init()

See merge request isc-projects/bind9!5093
2021-05-26 00:52:56 +00:00
Mark Andrews
f6fd4ec407 Add release note for [GL #2685]
(cherry picked from commit 80ca95a95c)
2021-05-26 08:54:27 +10:00
Mark Andrews
8389380bde Add CHANGES note for [GL #2685]
(cherry picked from commit d99c312938)
2021-05-26 08:50:19 +10:00
Mark Andrews
564ab69c57 Consolidate xhdr fixups
(cherry picked from commit 0a45af2e2f)
2021-05-26 08:49:30 +10:00
Mark Andrews
264b31e786 Check that IXFR delta size is correct
(cherry picked from commit 68d203ff1c)
2021-05-26 08:49:30 +10:00
Mark Andrews
d832062986 Correct size calculation in dns_journal_iter_init()
* dns_journal_next() leaves the read point in the journal after the
transaction header so journal_seek() should be inside the loop.
* we need to recover from transaction header inconsistencies

Additionally when correcting for <size, serial0, serial1, 0> the
correct consistency check is isc_serial_gt() rather than
isc_serial_ge().  All instances updated.

(cherry picked from commit 00609f5094)
2021-05-26 08:49:30 +10:00