Compare commits

...
Author SHA1 Message Date
Evan Hunt f187c948c4 WIP: non-blocking zone lookup
- add a DNS_DBFIND_NONBLOCK option, which causes dns_db_find/findext()
  to return ISC_R_LOCKBUSY if unable to acquire a read lock on the
  database.
- use the asynchronous hook mechanism to postpone query_lookup() if
  this occurs.
2021-06-03 22:59:57 -07:00
Mark Andrews 7fef01201d Merge branch '2751-serve-stale-tests-false-negative' into 'main'
Resolve "serve-stale tests false negative"

Closes #2751

See merge request isc-projects/bind9!5143
2021-06-03 08:40:38 +00:00
Mark Andrews af95cb8ccc Address test race condition in serve-stale
the dig.out.test# files could still be being written when the
content greps where being made.
2021-06-03 18:20:14 +10:00
Mark Andrews d242ccfbdf Merge branch '2750-provide-more-insight-into-why-the-timer_test-is-failing' into 'main'
Resolve "Provide more insight into why the timer_test is failing."

Closes #2750

See merge request isc-projects/bind9!5142
2021-06-03 07:31:26 +00:00
Mark Andrews 66d1df57cb Report which assertion failed when calling set_global_error 2021-06-03 11:55:31 +10:00
Mark Andrews 5bd7caba9c Merge branch '2724-statschannel-system-test-sometimes-hangs' into 'main'
Resolve "statschannel system test sometimes hangs"

Closes #2724

See merge request isc-projects/bind9!5123
2021-06-02 22:37:10 +00:00
Mark Andrews 02726cb66e Add timeout to url get requests
to prevent the system test taking forever on failures.
2021-06-02 22:18:21 +00:00
Ondřej Surý 0dded90ae4 Merge branch '2746-fix-the-typo-in-setsockopt_off' into 'main'
Fix copy&paste error in setsockopt_off

Closes #2746

See merge request isc-projects/bind9!5138
2021-06-02 16:09:48 +00:00
Ondřej Surý 22aa929aac Add CHANGES and release note for [GL #2746] 2021-06-02 17:47:14 +02:00
Ondřej Surý f14d870d15 Fix copy&paste error in setsockopt_off
Because of copy&paste error the setsockopt_off macro would enable
the socket option instead of disabling it.
2021-06-02 17:47:14 +02:00
Michał Kępień 5e1a48a605 Merge branch '2540-check-dname-resolution-via-itself' into 'main'
Check DNAME resolution via itself

Closes #2540

See merge request isc-projects/bind9!5135
2021-06-02 12:49:05 +00:00
Mark AndrewsandMichał Kępień cbdea694e8 Check DNAME resolution via itself 2021-06-02 14:20:35 +02:00
Michał Kępień 715dc196e2 Merge branch '2467-add-a-system-test-checking-a-malformed-ixfr' into 'main'
Add a system test checking a malformed IXFR

Closes #2467

See merge request isc-projects/bind9!5132
2021-06-02 11:35:55 +00:00
Mark AndrewsandMichał Kępień 5547003a3d Add a system test checking a malformed IXFR
Make sure an incoming IXFR containing an SOA record which is not placed
at the apex of the transferred zone does not result in a broken version
of the zone being served by named and/or a subsequent crash.
2021-06-02 13:15:25 +02:00
Ondřej Surý c70d9c4e9a Merge branch 'ondrej/fix-uv_udp_connect-detection' into 'main'
Cleanup the remaining of HAVE_UV_<func> macros

See merge request isc-projects/bind9!5127
2021-06-02 09:56:20 +00:00
Ondřej Surý 67afea6cfc 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.
2021-06-02 11:23:36 +02:00
Ondřej Surý 479dc58877 Merge branch 'ondrej/add-libnghttp2-dev-to-lgtm.yml' into 'main'
Add libnghttp2-dev to .lgtm.yml

See merge request isc-projects/bind9!5125
2021-06-02 07:35:39 +00:00
Ondřej Surý d67e16ae3c Add libnghttp2-dev to .lgtm.yml
The LGTM.com configuration was missing required library, so the
"Extraction" step of the analysis was failing.
2021-06-02 09:33:27 +02:00
Artem Boldariev 2fc89e0353 Merge branch 'artem-http-write-buffering' into 'main'
HTTP/2 write buffering

See merge request isc-projects/bind9!5121
2021-06-01 18:28:34 +00:00
Artem Boldariev 35d0027f36 HTTP/2 write buffering
This commit adds the ability to consolidate HTTP/2 write requests if
there is already one in flight. If it is the case, the code will
consolidate multiple subsequent write request into a larger one
allowing to utilise the network in a more efficient way by creating
larger TCP packets as well as by reducing TLS records overhead (by
creating large TLS records instead of multiple small ones).

This optimisation is especially efficient for clients, creating many
concurrent HTTP/2 streams over a transport connection at once.  This
way, the code might create a small amount of multi-kilobyte requests
instead of many 50-120 byte ones.

In fact, it turned out to work so well that I had to add a work-around
to the code to ensure compatibility with the flamethrower, which, at
the time of writing, does not support TLS records larger than two
kilobytes. Now the code tries to flush the write buffer after 1.5
kilobyte, which is still pretty adequate for our use case.

Essentially, this commit implements a recommendation given by nghttp2
library:

https://nghttp2.org/documentation/nghttp2_session_mem_send.html
2021-06-01 21:07:45 +03:00
Ondřej Surý 5a8a21a88d Merge branch '2732-zone-dumping-is-blocking-the-networking-io' into 'main'
Improve the zone dumping impact on the networking

Closes #2732

See merge request isc-projects/bind9!5107
2021-05-31 13:51:48 +00:00
Ondřej Surý 3e433b87fb Add CHANGES and release note for [GL #2732] 2021-05-31 14:52:05 +02:00
Ondřej Surý e83b6569da 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.
2021-05-31 14:52:05 +02:00
Ondřej SurýandOndřej Surý 8a5c62de83 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.
2021-05-31 14:52:05 +02:00
Ondřej SurýandOndřej Surý 7670f98377 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.
2021-05-31 14:52:05 +02:00
Ondřej SurýandOndřej Surý 87fe97ed91 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.
2021-05-31 14:52:05 +02:00
Ondřej Surý 211bfefbaa 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.
2021-05-31 14:52:05 +02:00
Ondřej Surý 7477d1b2ed 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.
2021-05-31 14:52:05 +02:00
Ondřej Surý f752840db3 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.
2021-05-31 14:52:05 +02:00
Ondřej Surý 7b02848865 Cleanup the uv_import check
The uv_import() is not needed anymore, so we can remove the autoconf
check for it.
2021-05-31 14:52:05 +02:00
Michał Kępień db8ff45f0b Merge branch 'michal/regenerate-man-pages-with-docutils-0.16' into 'main'
Regenerate man pages with docutils 0.16

See merge request isc-projects/bind9!5119
2021-05-31 12:34:45 +00:00
Michał Kępień 6a2daddf5b Regenerate man pages with docutils 0.16
Commit bdb777b2a2 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.
2021-05-31 11:22:52 +02:00
Evan Hunt 6702f23dcd Merge branch 'kchen-servestale-fix' into 'main'
Several serve-stale fixes

See merge request isc-projects/bind9!199
2021-05-30 19:28:59 +00:00
Matthijs MekkingandEvan Hunt f7f543d99b 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.
2021-05-30 11:48:36 -07:00
Kevin ChenandEvan Hunt 0cdf85d204 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.
2021-05-30 11:45:35 -07:00
Evan Hunt fc1e3efc41 Merge branch '2733-serve-stale-prefetch-crash' into 'main'
Fix crash with serve-stale in combination with prefetch

Closes #2733

See merge request isc-projects/bind9!5111
2021-05-30 07:31:38 +00:00
Matthijs MekkingandEvan Hunt 7ca253818e Add CHANGES and notes for [#2733] 2021-05-30 00:04:01 -07:00
Evan Hunt 8c047feb3a 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.
2021-05-30 00:04:01 -07:00
Matthijs MekkingandEvan Hunt c0dc5937c7 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.
2021-05-30 00:03:51 -07:00
Michal Nowak 9fbe80d646 Merge branch 'mnowak/add-fedora-34' into 'main'
Add Fedora 34

See merge request isc-projects/bind9!5075
2021-05-28 10:50:51 +00:00
Michal Nowak 5f27aaa0ff Add Fedora 34 2021-05-28 11:57:31 +02:00
Evan Hunt 5ca27cc33d Merge branch '2731-servestale-dns64' into 'main'
fix a crash when using stale data with dns64

Closes #2731

See merge request isc-projects/bind9!5102
2021-05-27 18:52:31 +00:00
Evan Hunt d8b793760c CHANGES, release note 2021-05-27 10:37:16 -07:00
Matthijs MekkingandEvan Hunt c64589bf46 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.
2021-05-27 10:35:48 -07:00
Evan Hunt 8bd8e995f1 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.
2021-05-27 10:35:48 -07:00
Evan Hunt 453e905d7e 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
2021-05-27 10:33:31 -07:00
Ondřej Surý e7f5c9582a Merge branch '2708-named-doesn-t-compile-with-gcc-10' into 'main'
Resolve "named doesn't compile with GCC 10."

Closes #2708

See merge request isc-projects/bind9!5057
2021-05-27 06:22:14 +00:00
Mark AndrewsandOndřej Surý d68b009cfe 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.
2021-05-27 08:02:21 +02:00
Mark Andrews 728422d939 Merge branch '2282-shutdown-system-test-needs-to-be-tweaked-to-account-for-recent-netmgr-changes' into 'main'
Resolve ""shutdown" system test needs to be tweaked to account for recent netmgr changes"

Closes #2282

See merge request isc-projects/bind9!4923
2021-05-27 02:56:57 +00:00
Diego FronzaandMark Andrews b19cd2d83b 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.
2021-05-27 12:37:49 +10:00
Ondřej Surý 91cd1ef9ff Merge branch 'ondrej/revert-OpenBSD-system-wide-connection-timeout' into 'main'
Revert "Configure the system-wide TCP connection timeout on OpenBSD"

See merge request isc-projects/bind9!5100
2021-05-26 14:24:58 +00:00
Ondřej Surý a0f6275ef8 Revert "Configure the system-wide TCP connection timeout on OpenBSD"
This reverts commit 8ff15fc028.
2021-05-26 16:16:00 +02:00
Mark Andrews d3a8aa4daa Merge branch 'marka-missing-initialisations' into 'main'
Add missing initialisations

See merge request isc-projects/bind9!5097
2021-05-26 08:52:46 +00:00
Mark Andrews 715a2c7fc1 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.
2021-05-26 08:15:08 +00:00
Ondřej Surý 5a10cde89a Merge branch '2722-bad-sizeof-declaration-in-main' into 'main'
Fix the sizeof() for array holding the pointers to clientmgr

Closes #2722

See merge request isc-projects/bind9!5098
2021-05-26 08:10:45 +00:00
Ondřej Surý 2db5290579 Fix the sizeof() for array holding the pointers to clientmgr
The size of the array holding the pointers to clientmgr was created so
big it could hold the actual clientmgr objects, not just the pointer.
This commit fixes the size to be just the ncpus * sizeof(pointer).
2021-05-26 10:03:52 +02:00
Ondřej Surý da282bad6a Merge branch '2721-shutdown-race-in-interfacemgr-cleanup' into 'main'
Cleanup the struct isc_nmiface

Closes #2721

See merge request isc-projects/bind9!5096
2021-05-26 08:00:25 +00:00
Ondřej Surý a227562f13 Cleanup the struct isc_nmiface
In previous MR, I forgot to remove the `struct isc_nmiface`, this commit
rectifies that.
2021-05-26 09:55:10 +02:00
Ondřej Surý 5d325e952d Merge branch '2721-shutdown-race-in-interfacemgr' into 'main'
Make a local copy of interface address when creating new socket

Closes #2721

See merge request isc-projects/bind9!5094
2021-05-26 07:48:00 +00:00
Ondřej Surý 50270de8a0 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.
2021-05-26 09:43:12 +02:00
Mark Andrews bef3a9b01f Merge branch '2685-max-ixfr-ratio-appears-to-be-forcing-axfr-very-prematurely-on-bind-9-16-15' into 'main'
Resolve "max-ixfr-ratio appears to be forcing AXFR very prematurely on BIND 9.16.15"

Closes #2685

See merge request isc-projects/bind9!5011
2021-05-25 22:46:52 +00:00
Mark Andrews 80ca95a95c Add release note for [GL #2685] 2021-05-26 08:16:35 +10:00
Mark Andrews d99c312938 Add CHANGES note for [GL #2685] 2021-05-26 08:16:35 +10:00
Mark Andrews 0a45af2e2f Consolidate xhdr fixups 2021-05-26 08:16:35 +10:00
Mark Andrews 68d203ff1c Check that IXFR delta size is correct 2021-05-25 22:27:54 +10:00
Mark Andrews 00609f5094 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.
2021-05-25 22:27:54 +10:00
Michal Nowak b6bdeb06be Merge branch '2629-man-pages-aren-t-installed-when-building-9-17-x' into 'main'
Install man pages when sphinx-build tool is missing

Closes #2629

See merge request isc-projects/bind9!4945
2021-05-25 09:34:11 +00:00
Michal Nowak 823bf3e79b Install BIND with "make DESTDIR=<PATH> install"
BIND installation should be done by setting DESTDIR during "make
install" not by setting prefix via ./configure.

Make sure that installation with DESTDIR=<PATH> works by checking that
named binary and it's respective man page were installed and that
well-known BIND9 directories - and only them - are present in DESTDIR.

Also rename install path variable from BIND_INSTALL_PATH to
INSTALL_PATH to avoid namespace clash in stress tests which use
BIND_INSTALL_PATH variable to configure path to BIND9 binaries.
2021-05-25 11:21:33 +02:00
Michal Nowak c0566dd8d7 Install man pages when sphinx-build tool is missing
The exclusion of doc/man/ when the sphinx-build tool is missing was
excessive as some targets in doc/man/ are necessary to install man
pages.
2021-05-25 11:21:32 +02:00
Ondřej Surý 9359e1a8c0 Merge branch 'ondrej/dont-set-mctx-name-in-resolver' into 'main'
Don't set memory context name in resolver.c

See merge request isc-projects/bind9!5090
2021-05-25 05:27:59 +00:00
Ondřej Surý d0d37aa6d1 Don't set memory context name in resolver.c
We now attach to existing memory context instead of creating a new
memory context, so we should not set its name.
2021-05-25 07:25:44 +02:00
Ondřej Surý a778db3b7d Merge branch 'ondrej/replace-ubuntu-xenial-with-ubuntu-bionic' into 'main'
Replace Ubuntu 16.04 LTS with Ubuntu 18.04 LTS in the GitLab CI

See merge request isc-projects/bind9!4800
2021-05-24 19:43:15 +00:00
Ondřej SurýandOndřej Surý 4402a90bb7 Replace Ubuntu 16.04 LTS with Ubuntu 18.04 LTS in the GitLab CI
Ubuntu 16.04 (Xenial Xerus) is reaching End of Standard Support in April
2021 thus we are removing it from the list of supported platforms and
replacing it with Ubuntu 18.04 LTS (Bionic Beaver).
2021-05-24 21:34:09 +02:00
Ondřej Surý 664d8c1d24 Merge branch '2433-reduce-clientmgr-memory-contexts-and-tasks' into 'main'
Reduce the number of clientmgr objects created

Closes #2433

See merge request isc-projects/bind9!5085
2021-05-24 19:20:15 +00:00
Ondřej Surý a7241bb5b3 Add CHANGES and release note for GL #2433 2021-05-24 20:45:19 +02:00
Ondřej Surý a1c6fd5ede Adjust the fillcount and freemax for dns_message mempools
According to the measurements (recorded on GL!5085), the fillcount of 2
for namepool and fillcount of 4 for rdspool can fit 99.99% of request
for tested scenarios.

This was discovered by perf recording the single second recursive test
using flamethrower where the initial malloc lit up like a flare.
2021-05-24 20:44:58 +02:00
Ondřej Surý 28b65d8256 Reduce the number of clientmgr objects created
Previously, as a way of reducing the contention between threads a
clientmgr object would be created for each interface/IP address.

We tasks being more strictly bound to netmgr workers, this is no longer
needed and we can just create clientmgr object per worker queue (ncpus).

Each clientmgr object than would have a single task and single memory
context.
2021-05-24 20:44:54 +02:00
Ondřej Surý aad7856b8e Don't create per bucket memory contexts in resolver
Similarly, the resolver code would create hundreds of memory contexts
just on the resolver setup.  The contention will be reduced directly in
the allocator, so for now just attach to the view memory instead of
creating separate memory context for each bucket.
2021-05-24 20:02:20 +02:00
Ondřej Surý 4db5e30177 Run shutdown events with the task's existing threadid
Previously, task->threadid was reassigned to 0 while shutting
down, which caused an assertion.
2021-05-24 20:02:20 +02:00
Ondřej Surý 0be7ea78be Reduce the number of client tasks and bind them to netmgr queues
Since a client object is bound to a netmgr handle, each client
will always be processed by the same netmgr worker, so we can
simplify the code by binding client->task to the same thread as
the client. Since ns__client_request() now runs in the same event
loop as client->task events, is no longer necessary to pause the
task manager before launching them.

Also removed some functions in isc_task that were not used.
2021-05-24 20:02:20 +02:00
Ondřej Surý c07f8c5a43 Reduce the number of tasks in the clientmgr
We now use one task per CPU per dispatchmgr (that's still a lot).
2021-05-24 20:02:20 +02:00
Ondřej Surý 0719f032e1 Reduce the number of mctx created in clientmgr
The number of memory contexts created in the clientmgr was enormous.  It
could easily create thousands of memory contexts because the formula was:

    nprotocols * ncpus * ninterfaces * CLIENT_NMCTXS_PERCPU (8)

The original goal was to reduce the contention when allocating the
memory, but after a while nobody noticed that the amount of memory
context allocated would not reduce contention at all.

This commit removes the whole mctxpool and just uses the mctx from
clientmgr as the contention will be reduced directly in the allocator.
2021-05-24 20:02:20 +02:00
Michal Nowak 9f5a7a2ca4 Merge branch 'mnowak/freebsd-13' into 'main'
Add FreeBSD 13.0

See merge request isc-projects/bind9!4814
2021-05-24 16:15:35 +00:00
Michal Nowak 83617cea9a Run gcc:tarball CI job for merge requests
Running gcc:tarball CI job for merge requests is consistent with how we
run gcc:out-of-tree CI job and should help identify problems with the
build system during the review process, not once merged during daily
runs. For the sake of time, unit and system tests associated with the
gcc:tarball CI job are excluded from merge requests.
2021-05-24 17:57:53 +02:00
Michal Nowak 70eccd2952 Do not spawn FreeBSD 11 CI jobs in merge requests 2021-05-24 17:57:53 +02:00
Michal Nowak e4f88c359c Create an anchor for schedules, tags, and web rules
It's a common pattern to spawn CI jobs only for pipelines triggered by
schedules, tags, and web. There should be an anchor so that the rules
are not repeated.
2021-05-24 17:57:53 +02:00
Michal Nowak 0714fe6f40 Add FreeBSD 13.0 2021-05-24 17:54:05 +02:00
Ondřej Surý fd0f3c0af4 Merge branch '2643-fix-rndc-timeout' into 'main'
extend rndc timeout to 60 seconds

Closes #2643

See merge request isc-projects/bind9!5082
2021-05-22 09:46:27 +00:00
Evan Hunt 3ed35b3035 extend rndc timeout to 60 seconds
the idle timeout for rndc connections was set to 10 seconds, but this
caused intermittent system failures of the 'rndc' system test on slow
platforms, since 'rndc reconfig' could time out before reconfiguration
was complete.

this commit restores the original timeout value of 60 seconds, which was
changed inadvertently after rndc was updated to use the network manager.

even with this change, however, the test can still time out under
TSAN because loading the huge zone can take a very long time (upwards
of two minutes). so the test is modified here to generate a smaller zone
file when running under TSAN.
2021-05-22 01:11:31 -07:00
Evan Hunt c819762dde Merge branch 'each-rename-copynf' into 'main'
rename dns_name_copynf() to dns_name_copy()

See merge request isc-projects/bind9!5081
2021-05-22 08:10:10 +00:00
Evan Hunt d06b1ed11f CHANGES 2021-05-22 00:37:27 -07:00
Evan Hunt 1fa6f8662e update dev.md with name copying information
revise the Developer Information document with updated information
about copying names.
2021-05-22 00:37:27 -07:00
Evan Hunt f3f1cab05e clean up coccinelle patches for dns_name_copy()
no need for semantic patches to use dns_name_copynf() any longer.
2021-05-22 00:37:27 -07:00
Evan Hunt b0aadaac8e rename dns_name_copynf() to dns_name_copy()
dns_name_copy() is now the standard name-copying function.
2021-05-22 00:37:27 -07:00
Evan Hunt ea7b28f101 remove dns_name_copy() implementation
Remove dns_name_copy() and refactor the underlying code since
it will only be called by dns_name_copynf() now, and can't fail.
2021-05-22 00:22:32 -07:00
Evan Hunt b1fe1b8ae3 remove the remaining uses of dns_name_copy()
dns_name_copy() has been replaced nearly everywhere with
dns_name_copynf().  this commit changes the last two uses of
the original function.  afterward, we can remove the old
dns_name_copy() implementation, and replace it with _copynf().
2021-05-22 00:22:32 -07:00
Evan Hunt 6803f394c5 Merge branch '2713-intermittent-crashes-in-the-tkey-system-test-caused-by-broken-dns_name_t-structures' into 'main'
Use dns_name_copy() to hold the copied name

Closes #2713

See merge request isc-projects/bind9!5079
2021-05-22 04:30:19 +00:00
Ondřej SurýandEvan Hunt ce3e1abc1d Use dns_name_copynf() with dns_message_gettempname() when needed
dns_message_gettempname() returns an initialized name with a dedicated
buffer, associated with a dns_fixedname object.  Using dns_name_copynf()
to write a name into this object will actually copy the name data
from a source name. dns_name_clone() merely points target->ndata to
source->ndata, so it is faster, but it can lead to a use-after-free if
the source is freed before the target object is released via
dns_message_puttempname().

In a few places, clone was being used where copynf should have been;
this is now fixed.

As a side note, no memory was lost, because the ndata buffer used in
the dns_fixedname_t is internal to the structure, and is freed when
the dns_fixedname_t is freed regardless of the .ndata contents.
2021-05-21 21:28:10 -07:00
Brian Conry 10ced46739 Merge branch '2662-fix-broken-SYSTEMTEST_NO_CLEAN' into 'main'
Preserve SYSTEMTEST_NO_CLEAN when run.sh calls make.

Closes #2662

See merge request isc-projects/bind9!5003
2021-05-21 13:38:25 +00:00
Brian Conry 44cadaf31b Preserve additional environment variables with run.sh
When executed in "legacy mode" (i.e. without the '-r' parameter)
run.sh invokes make with a modified environment.

SYSTEMTEST_FORCE_COLOR is now preserved for use by the individual test
scripts.

CYGWIN is now preserved for named, as it controls behavior relating to
crash reporting.
2021-05-21 13:07:28 +00:00
Brian Conry 516de44c9f Preserve SYSTEMTEST_NO_CLEAN when run.sh calls make
This restores legacy behavior in bin/tests/system where running:
  SYSTEMTEST_NO_CLEAN=1 ./run.sh <testname>
would run the test and preserve the output files.

This has been broken since the change that has run.sh invoke "make",
due to SYSTEMTEST_NO_CLEAN not being preserved in the environment
that's set up for "make".

Another option would be to completely remove SYSTEMTEST_NO_CLEAN.

This seems to be the only behavior-changing environment variable
not accounted for in the call to "make".

I don't think this needs a CHANGES entry.
2021-05-21 13:07:28 +00:00
Michał Kępień 97a821399b Merge branch 'michal/regenerate-man-pages-with-sphinx-4.0.2' into 'main'
Regenerate man pages with Sphinx 4.0.2

See merge request isc-projects/bind9!5077
2021-05-21 09:26:16 +00:00
Michał Kępień 9ec83d1f63 Explicitly set "man_make_section_directory"
The default value of the "man_make_section_directory" Sphinx option was
changed in Sphinx 4.0.1, which broke building man pages in maintainer
mode as the shell code in doc/man/Makefile.am expects man pages to be
built in doc/man/_build/man/, not doc/man/_build/man/<section_number>/.
The aforementioned change in defaults was reverted in Sphinx 4.0.2, but
this issue should still be prevented from reoccurring in the future.
Ensure that by explicitly setting the "man_make_section_directory"
option to False.
2021-05-21 10:29:02 +02:00
Michał Kępień bdb777b2a2 Regenerate man pages with Sphinx 4.0.2
The man pages produced by Sphinx 4.0.2 are slightly different than those
produced by Sphinx 3.5.4.  As Sphinx 4.0.2 is now used in GitLab CI,
update all doc/man/*in files so that they reflect what that version of
Sphinx produces, in order to prevent GitLab CI job failures.
2021-05-21 10:29:02 +02:00
Ondřej Surý 596a3442a3 Merge branch '2515-improve-glue-cache-performance' into 'main'
use a fixedname buffer in dns_message_gettempname()

Closes #2515

See merge request isc-projects/bind9!5071
2021-05-20 19:04:35 +00:00
Ondřej Surý 5ee9edc4ce Optimize rdataset_getownercase not to use bitshifts
The last rdataset_getownercase() left it in a state where the code was
mix of microoptimizations (manual loop unrolling, complicated bitshifts)
with a code that would always rewrite the character even if it stayed
the same after transformation.

This commit makes sure that we modify only the characters that actually
need to change, removes the manual loop unrolling, and replaces the
weird bit arithmetics with a simple shift and bit-and.
2021-05-20 20:41:29 +02:00
Evan HuntandOndřej Surý e31cc1eeb4 use a fixedname buffer in dns_message_gettempname()
dns_message_gettempname() now returns a pointer to an initialized
name associated with a dns_fixedname_t object. it is no longer
necessary to allocate a buffer for temporary names associated with
the message object.
2021-05-20 20:41:29 +02:00
Michał Kępień 869e0feec7 Merge branch 'v9_17_13-release' into 'main'
Merge 9.17.13 release branch

See merge request isc-projects/bind9!5068
2021-05-20 10:10:37 +00:00
Michał Kępień 5a71af44b1 Set up release notes for BIND 9.17.14 2021-05-20 12:03:47 +02:00
Michał Kępień f73d41d0a0 Update BIND version to 9.17.13 2021-05-20 12:03:47 +02:00
Michał Kępień 39b739b867 Add a CHANGES marker 2021-05-20 12:03:47 +02:00
Michał Kępień c14a91f06e Merge branch 'michal/prepare-documentation-for-bind-9.17.13' into 'v9_17_13-release'
Prepare documentation for BIND 9.17.13

See merge request isc-private/bind9!293
2021-05-20 12:03:47 +02:00
Michał Kępień 8113dbe5bb Prepare release notes for BIND 9.17.13 2021-05-20 12:03:47 +02:00
Michał Kępień e49bd0906e Add release note for GL #2626 2021-05-20 12:03:47 +02:00
Michał Kępień 620cccc3fc Reorder release notes 2021-05-20 12:03:47 +02:00
Michał Kępień ced6c9b23a Tweak and reword release notes 2021-05-20 12:03:47 +02:00
Michał Kępień 43cbc773a7 Tweak and reword recent CHANGES entries 2021-05-20 12:03:47 +02:00
Michal NowakandMichał Kępień ab6060c538 Drop duplicate release note for GL #2347 2021-05-20 12:03:47 +02:00
Michal NowakandMichał Kępień 15a345626a Fix typo in doc/dnssec-guide/recipes.rst 2021-05-20 12:03:47 +02:00
Matthijs Mekking 3ecd951da8 Merge branch '1875-kasp-views-keyfile-race' into 'main'
Lock key files when looking for zone keys

Closes #1875

See merge request isc-projects/bind9!4919
2021-05-20 07:55:26 +00:00
Matthijs Mekking fa1cd0a1f1 Release notes and changes for [#1875] 2021-05-20 09:23:46 +02:00
Matthijs Mekking 252a1ae0a1 Lock kasp when looking for zone keys
We should also lock kasp when reading key files, because at the same
time the zone in another view may be updating the key file.
2021-05-20 09:15:43 +02:00
Michal Nowak 8de2d8137c Merge branch 'mnowak/openbsd-6.9' into 'main'
Add OpenBSD 6.9

See merge request isc-projects/bind9!5031
2021-05-19 17:10:53 +00:00
Michal Nowak 315b8522ba Add OpenBSD 6.9 2021-05-19 17:21:23 +02:00
Michal Nowak 38bc6c8aa3 Merge branch '2694-drop-seq-command-from-views-tests-sh' into 'main'
Replace seq command with POSIX-compliant shell code

Closes #2694

See merge request isc-projects/bind9!5061
2021-05-19 13:55:53 +00:00
Michal Nowak a4b7eb7188 Make views system test ShellCheck-clean
Also, add "set -e" to all shell scripts of the views test to exit when
any command fails or is unknown, e.g., this on OpenBSD:

    tests.sh[174]: seq: not found
2021-05-19 14:04:48 +02:00
Michal Nowak a08487ec3d Replace seq command with POSIX-compliant shell code
The seq command is not defined in the POSIX standard and is missing on
OpenBSD. Given that the system test code is meant to be POSIX-compliant
replace it with a shell construct.
2021-05-19 14:04:48 +02:00
Michał Kępień 7d6bcef66e Merge branch '2709-placeholder' into 'main'
Add placeholder for GL #2709

See merge request isc-projects/bind9!5060
2021-05-19 12:00:02 +00:00
Michał Kępień 6962335678 Add placeholder for GL #2709 2021-05-19 13:57:21 +02:00
Artem Boldariev 1a298b28e2 Merge branch 'artem/doh-quota-tests' into 'main'
Add DoH quota tests

See merge request isc-projects/bind9!5024
2021-05-19 08:30:17 +00:00
Artem Boldariev 67c50abe5a Add DoH quota tests
This commit adds unit tests which ensure that DoH code is compatible
with quota functionality.
2021-05-19 10:28:47 +03:00
Mark Andrews c2c2b0da9a Merge branch '2688-cid331478-forwardnull' into 'main'
Fix possible null dereference (coverity issue 331478)

Closes #2688

See merge request isc-projects/bind9!5034
2021-05-19 01:55:53 +00:00
Matthijs MekkingandMark Andrews 19395fd168 Fix coverity issue 331478
Move the "cannot start rollover" warning into code block that checks
if 'active_key' is not NULL.
2021-05-19 00:45:54 +00:00
Mark Andrews 954eb15052 Merge branch '2550-remove-dns_zone_setflag' into 'main'
Resolve "Remove dns_zone_setflag"

Closes #2550

See merge request isc-projects/bind9!4762
2021-05-18 23:54:35 +00:00
Mark AndrewsandEvan Hunt 314b5362a8 Remove dns_zone_setflag()
This function has never been used since it was added to the source tree
by commit 686b27bfd3 back in 1999.  As
the dns_zoneflg_t type is only defined in lib/dns/zone.c, no function
external to that file would be able to use dns_zone_setflag() properly
anyway - the DNS_ZONE_SETFLAG() and DNS_ZONE_CLRFLAG() macros should be
used instead. Zone options that can be set from outside zone.c are set
using dns_zone_setoption().
2021-05-18 16:02:18 -07:00
Matthijs Mekking b6f806e023 Merge branch '2463-kasp-views-different-policy-same-keydirectory' into 'main'
Check key-directory duplicates for kasp zones

Closes #2463

See merge request isc-projects/bind9!4989
2021-05-18 14:40:26 +00:00
Matthijs Mekking a9f4b074c4 Release notes and changes for [GL #2463]
Mention the bugfix.
2021-05-18 15:47:02 +02:00
Matthijs Mekking df1aecd5ff Add checkconf tests for [#2463]
Add two tests to make sure named-checkconf catches key-directory issues
where a zone in multiple views uses the same directory but has
different dnssec-policies. One test sets the key-directory specifically,
the other inherits the default key-directory (NULL, aka the working
directory).

Also update the good.conf test to allow zones in different views
with the same key-directory if they use the same dnssec-policy.

Also allow zones in different views with different key-directories if
they use different dnssec-policies.

Also allow zones in different views with the same key-directories if
only one view uses a dnssec-policy (the other is set to "none").

Also allow zones in different views with the same key-directories if
no views uses a dnssec-policy (zone in both views has the dnssec-policy
set to "none").
2021-05-18 15:47:02 +02:00
Matthijs Mekking 494e8b2cbd Check key-directory duplicates for kasp zones
Don't allow the same zone with different dnssec-policies in separate
views have the same key-directory.

Track zones plus key-directory in a symtab and if there is a match,
check the offending zone's dnssec-policy name. If the name is "none"
(there is no kasp for the offending zone), or if the name is the same
(the zone shares keys), it is fine, otherwise it is an error (zones
in views using different policies cannot share the same key-directory).
2021-05-18 15:47:02 +02:00
Mark Andrews 8a90139c2c Merge branch '2696-misleading-diagnostic-in-update_soa_serial-indicates-bind-will-use-increment-but-it-doesn-t' into 'main'
Resolve "Misleading diagnostic in update_soa_serial indicates BIND will use increment but it doesn't"

Closes #2696

See merge request isc-projects/bind9!5029
2021-05-18 12:51:00 +00:00
Mark Andrews 5d21042ed8 Adjust returned method from dns_updatemethod_date
if dns_updatemethod_date is used do that the returned method is only
set to dns_updatemethod_increment if the new serial does not encode
the current day (YYYYMMDDXX).
2021-05-18 12:30:22 +00:00
Michał Kępień 3dc094c8e0 Merge branch 'michal/use-context-managers-as-suggested-by-pylint-2.8.2' into 'main'
Use context managers as suggested by PyLint 2.8.2

See merge request isc-projects/bind9!5041
2021-05-18 08:56:50 +00:00
Michał Kępień a8163551ed Use context managers as suggested by PyLint 2.8.2
PyLint 2.8.2 reports the following suggestions for two Python scripts
used in the system test suite:

    ************* Module tests_rndc_deadlock
    bin/tests/system/addzone/tests_rndc_deadlock.py:71:4: R1732: Consider using 'with' for resource-allocating operations (consider-using-with)
    ************* Module tests-shutdown
    bin/tests/system/shutdown/tests-shutdown.py:68:4: R1732: Consider using 'with' for resource-allocating operations (consider-using-with)
    bin/tests/system/shutdown/tests-shutdown.py:154:8: R1732: Consider using 'with' for resource-allocating operations (consider-using-with)

Implement the above suggestions by using
concurrent.futures.ThreadPoolExecutor() and subprocess.Popen() as
context managers.
2021-05-18 10:53:17 +02:00
Mark Andrews 71284cb496 Merge branch '2706-worker-cond_prio-needs-to-be-initialised' into 'main'
Resolve "worker->cond_prio needs to be initialised"

Closes #2706

See merge request isc-projects/bind9!5048
2021-05-18 08:39:28 +00:00
Mark Andrews 7e83c6df94 initialise worker->cond_prio 2021-05-18 07:47:42 +00:00
Mark Andrews cdb8c9bd35 Merge branch '2701-gcc-10-fanalyzer-reports-dereference-of-null-label-in-lib-dns-name-c-1167' into 'main'
Resolve "gcc-10+ -fanalyzer reports: dereference of NULL ‘label’ in lib/dns/name.c:1167"

Closes #2701

See merge request isc-projects/bind9!5046
2021-05-18 06:41:56 +00:00
Mark Andrews 29f1c1e677 Silence gcc-10-fanalyzer false positive
If 'state == ft_ordinary' then 'label' can't be NULL. Add
INSIST to reflect this.
2021-05-18 15:51:51 +10:00
Mark Andrews ea305a4877 Merge branch '2702-gcc-10-fanalyzer-reports' into 'main'
Resolve "gcc-10+ -fanalyzer reports:"

Closes #2702

See merge request isc-projects/bind9!5043
2021-05-18 05:45:26 +00:00
Mark Andrews 683ad6e4bd Silence gcc-10-fanalyzer false positive
Add REQUIRE(type == dns_rdatatype_nsec3 || firstp != NULL); so
that dereferences of *firstp is not flagged as a NULL pointer
dereference.
2021-05-18 15:19:28 +10:00
Mark Andrews 3b0d6450db Merge branch '2689-cid-331477-resource-leaks-resource_leak' into 'main'
Resolve "CID 331477: Resource leaks (RESOURCE_LEAK)"

Closes #2689

See merge request isc-projects/bind9!5016
2021-05-18 00:53:38 +00:00
Mark Andrews d24ea068c8 Add CHANGES for [GL #2689] 2021-05-18 10:34:10 +10:00
Mark Andrews 8eed392add Address potential resource leak in dst_key_fromnamedfile 2021-05-18 10:33:43 +10:00
Evan Hunt 27386db7fe Merge branch 'each-bufsize-doc' into 'main'
clarify buffer size options

See merge request isc-projects/bind9!5037
2021-05-17 17:02:18 +00:00
Evan Hunt 05985f6889 clarify buffer size options
the documentation for {udp,tcp}-{send,receive}-buffer options
was not complete. also revised for grammar.
2021-05-17 09:34:08 -07:00
Michał Kępień e3b442e538 Merge branch 'michal/tweak-cve-handling-checklists' into 'main'
Tweak security incident handling checklists

See merge request isc-projects/bind9!5017
2021-05-17 12:09:44 +00:00
Michał Kępień ba1145c017 Tweak security incident handling checklists
Add an item to the CVE issue template which calls for drafting the
security advisory early in the security incident handling process.  The
intention is to ensure there is enough time to review and polish ISC
security advisories before they get published.

Tweak the release checklist to make sure we carefully consider all
confidential issues before opening them up to the public.  This change
is intended as a safeguard against accidentally disclosing too much
information about a security vulnerability before our users get a chance
to patch it.
2021-05-17 14:07:27 +02:00
Ondřej Surý f2b297a37d Merge branch 'ondrej/remove-netmgr-quantum' into 'main'
Replace netmgr quantum with loop-preventing barrier

See merge request isc-projects/bind9!5028
2021-05-17 10:05:11 +00:00
Ondřej Surý 9e3cb396b2 Replace netmgr quantum with loop-preventing barrier
Instead of using fixed quantum, this commit adds atomic counter for
number of items on each queue and uses the number of netievents
scheduled to run as the limit of maximum number of netievents for a
single process_queue() run.

This prevents the endless loops when the netievent would schedule more
netievents onto the same loop, but we don't have to pick "magic" number
for the quantum.
2021-05-17 11:59:19 +02:00
Michal Nowak 9e21b80cbd Merge branch '2693-add-py-test-to-the-list-of-tested-pytest-names' into 'main'
Add py.test to the list of tested pytest names

Closes #2693

See merge request isc-projects/bind9!5022
2021-05-17 09:23:25 +00:00
Michal Nowak 510b4b70e9 Add py.test to the list of tested pytest names
OpenBSD changed the name of the pytest script from py.test-3 in OpenBSD
6.8 to py.test in OpenBSD 6.9.

The py.test-3 name which was added in d5562a3e for the sake of OpenBSD
and CentOS is still required for CentOS.
2021-05-17 11:12:43 +02:00
Ondřej Surý d34672796c Merge branch '2313-set-RCVBUF-SNDBUF' into 'main'
Resolve "Set reasonable values to SO_RCVBUF and SO_SNDBUF"

Closes #2313

See merge request isc-projects/bind9!4460
2021-05-17 07:42:37 +00:00
Ondřej Surý 3733b4f101 Add CHANGES and release note for GL #2313 2021-05-17 08:47:09 +02:00
Ondřej Surý 4509089419 Add configuration option to set send/recv buffers on the nm sockets
This commit adds a new configuration option to set the receive and send
buffer sizes on the TCP and UDP netmgr sockets.  The default is `0`
which doesn't set any value and just uses the value set by the operating
system.

There's no magic value here - set it too small and the performance will
drop, set it too large, the buffers can fill-up with queries that have
already timeouted on the client side and nobody is interested for the
answer and this would just make the server clog up even more by making
it produce useless work.

The `netstat -su` can be used on POSIX systems to monitor the receive
and send buffer errors.
2021-05-17 08:47:09 +02:00
Michal Nowak 089bfe20f9 Merge branch '2386-check-correct-copyright-dates-in-man-pages' into 'main'
Set copyright year to the current year

Closes #2386

See merge request isc-projects/bind9!4869
2021-05-14 12:46:33 +00:00
Michal Nowak 7eb44b05c5 Set copyright year to the current year
To ensure that a release with outdated copyright year is not produced at
the beginning of a year, set copyright year to the current year.
2021-05-14 14:21:58 +02:00
Michal Nowak 6f9ac0e997 Merge branch 'mnowak/add-unit-gcc-out-of-tree-ci-job' into 'main'
Add unit:gcc:out-of-tree CI job

See merge request isc-projects/bind9!4740
2021-05-14 12:21:06 +00:00
Michal Nowak 741fdd4fe1 Add unit:gcc:out-of-tree CI job
Also extract the workspace save-and-retrieve logic to YAML anchors.
2021-05-14 13:22:09 +02:00
Michal Nowak c628f2c71b Make masterXX.data.in reachable by out-of-tree builds
Unit test run for out-of-tree builds used to fail to find
masterXX.data.in files:

    /usr/bin/perl -w /builds/mnowak/bind9/lib/dns/tests/mkraw.pl < testdata/master/master12.data.in > testdata/master/master12.data
    /bin/bash: testdata/master/master12.data.in: No such file or directory
    make[4]: *** [Makefile:1910: testdata/master/master12.data] Error 1
2021-05-14 13:22:09 +02:00
Ondřej Surý 1c5de1aa43 Merge branch 'ondrej/fix-outgoing-udp-socket-selection-on-windows' into 'main'
Fix the outgoing UDP socket selection on Windows

See merge request isc-projects/bind9!5021
2021-05-13 14:05:22 +00:00
Ondřej Surý cd413234f7 Fix the outgoing UDP socket selection on Windows
The outgoing UDP socket selection would pick unintialized children
socket on Windows, because we have more netmgr workers than we have
listening sockets.  This commit fixes the selection by keeping the
outgoing socket the same, so it's always run on existing socket.
2021-05-13 15:04:48 +02:00
Artem Boldariev d7689d8dbc Merge branch 'artem-flamethrower-fixes' into 'main'
DoH flamethrower fixes

See merge request isc-projects/bind9!5019
2021-05-13 10:01:26 +00:00
Artem Boldariev bab9309231 Fix DoH unit tests logic
This commit fixes logic bugs in DoH test suite revealed by making DoH
not to call nghttp2_session_terminate_session() in server-side code.
2021-05-13 10:42:25 +03:00
Artem Boldariev 6816a741ca Fix crash in TLS caused by improper handling of shutdown messages
The problem was found when flamethrower was accidentally run in DoT
mode against DoH port.
2021-05-13 10:42:25 +03:00
Artem Boldariev 1947f6372d Limit the number of active concurrent HTTP/2 streams
The initial intent was to limit the number of concurrent streams by
the value of 100 but due to the error when reading the documentation
it was set to the maximum possible number of streams per session.

This could lead to security issues, e.g. a remote attacker could have
taken down the BIND instance by creating lots of sessions via low
number of transport connections. This commit fixes that.
2021-05-13 10:42:25 +03:00
Artem Boldariev d80d1b0dd9 Do not allow empty DoH endpoints to be added
It was possible to specify empty DoH endpoint in BIND's configuration
file: that was an error, we should not allow doing so.
2021-05-13 10:42:25 +03:00
Artem Boldariev 9155a87528 Do not call nghttp2_session_terminate_session() in server-side code
We should not call nghttp2_session_terminate_session() in server-side
code after all of the active HTTP/2 streams are processed. The
underlying transport connection is expected to remain opened at least
for some time in this case for new HTTP/2 requests to arrive. That is
what flamethrower was expecting and it makes perfect sense from the
HTTP/2 perspective.
2021-05-13 10:42:25 +03:00
Mark Andrews 4d888458ab Merge branch '2528-check-soa-rdata' into 'main'
Check SOA rdata for consistency in AXFR.

Closes #2528

See merge request isc-projects/bind9!5014
2021-05-13 05:17:39 +00:00
Evan HuntandMark Andrews 4d94f82232 system test
Attempt a zone transfer with mismatched SOA records.
2021-05-13 03:36:50 +00:00
Mark Andrews 7e54d8d2cb Add CHANGES entry for [GL #2528] 2021-05-13 03:36:50 +00:00
Mark Andrews e86508708d Check that the first and last SOA of an AXFR are consistent 2021-05-13 03:36:50 +00:00
Mark Andrews 72da25f31f Merge branch '2656-resolver-system-test-fails-on-macos' into 'main'
Resolve "resolver system test fails on macOS"

Closes #2656

See merge request isc-projects/bind9!4947
2021-05-12 03:40:52 +00:00
Mark Andrews a83afc10f9 Add missing call to isc_app_ctxstart 2021-05-12 03:01:15 +00:00
Ondřej Surý 0860ed6f5b Merge branch 'marka/add-missing-isc_condition_init' into 'main'
initalise sock->cond

See merge request isc-projects/bind9!5013
2021-05-11 13:03:13 +00:00
Mark AndrewsandOndřej Surý 0f6ae9000a initalise sock->cond 2021-05-11 14:06:26 +02:00
Ondřej Surý 4efd1e2ac8 Merge branch 'ondrej/increase-netmgr-quantum' into 'main'
Bump the netmgr quantum to 1024

See merge request isc-projects/bind9!5009
2021-05-10 20:04:10 +00:00
Ondřej SurýandOndřej Surý 3713a38689 Bump the netmgr quantum to 1024
During the stress testing, it was discovered that the default netmgr
quantum of 128 is not enough and there was a performance drop for TCP on
FreeBSD.  Bumping the default quantum to 1024 solves the performance
issue and is still enough to prevent the endless loops.
2021-05-10 21:32:31 +02:00
Evan Hunt ee6e540004 Merge branch 'each-taskmgr-setmode' into 'main'
reset taskmgr immediately after loading zones

See merge request isc-projects/bind9!5010
2021-05-10 19:32:00 +00:00
Evan Hunt 220ada9422 reset taskmgr mode immediately after returning from zone load
all privileged tasks are complete by the time we return from
isc_task_endexclusive(), so it makes sense to reset the taskmgr
mode to non-privileged right then.
2021-05-10 12:26:27 -07:00
Ondřej Surý 1639bcb59e Merge branch 'ondrej/dereference-taskmgr-after-all-tasks-are-done' into 'main'
Destroy reference to taskmgr after all tasks are done

See merge request isc-projects/bind9!5008
2021-05-10 19:24:53 +00:00
Ondřej SurýandEvan Hunt e623c12757 Destroy reference to taskmgr after all tasks are done
We were clearing the pointer to taskmgr as soon as isc_taskmgr_destroy()
would be called and before all tasks were finished.  Unfortunately, some
tasks would use global named_g_taskmgr objects from inside the events
and this would cause either a data race or NULL pointer dereference.

This commit fixes the data race by moving the destruction of the
referenced pointer to the time after all tasks are finished.
2021-05-10 12:13:27 -07:00
Ondřej Surý d3ebd19e23 Merge branch 'ondrej/fix-missing-isc_taskmgr_detach-on-exiting' into 'main'
Add isc_taskmgr_detach when task is created while shutting down

See merge request isc-projects/bind9!5006
2021-05-10 11:33:46 +00:00
Ondřej Surý 6c57a6cc3d Add isc_taskmgr_detach when task is created while shutting down
When taskmgr is shutting down, the creating the task would attach
to the taskmgr, but don't detach on error condition.
2021-05-10 11:39:51 +02:00
Evan Hunt 0e92060833 Merge branch '2654-create-isc_managers-api' into 'main'
Destroy netmgr before destroying taskmgr

Closes #2654

See merge request isc-projects/bind9!4983
2021-05-07 21:37:01 +00:00
Evan Hunt 19431b1c83 CHANGES 2021-05-07 14:28:33 -07:00
Ondřej SurýandEvan Hunt 0133096c88 improvements to socket_test
- be more strict, but patient, waiting for event completion.
- use an atomic pointer for the socket to silence TSAN warnings.
2021-05-07 14:28:33 -07:00
Ondřej SurýandEvan Hunt 365c6a9851 ensure interlocked netmgr events run on worker[0]
Network manager events that require interlock (pause, resume, listen)
are now always executed in the same worker thread, mgr->workers[0],
to prevent races.

"stoplistening" events no longer require interlock.
2021-05-07 14:28:32 -07:00
Evan Hunt c44423127d fix shutdown deadlocks
- ensure isc_nm_pause() and isc_nm_resume() work the same whether
  run from inside or outside of the netmgr.
- promote 'stop' events to the priority event level so they can
  run while the netmgr is pausing or paused.
- when pausing, drain the priority queue before acquiring an
  interlock; this prevents a deadlock when another thread is waiting
  for us to complete a task.
- release interlock after pausing, reacquire it when resuming, so
  that stop events can happen.

some incidental changes:
- use a function to enqueue pause and resume events (this was part of a
  different change attempt that didn't work out; I kept it because I
  thought was more readable).
- make mgr->nworkers a signed int to remove some annoying integer casts.
2021-05-07 14:28:32 -07:00
Ondřej SurýandEvan Hunt 4c8f6ebeb1 Use barriers for netmgr synchronization
The netmgr listening, stoplistening, pausing and resuming functions
now use barriers for synchronization, which makes the code much simpler.

isc/barrier.h defines isc_barrier macros as a front-end for uv_barrier
on platforms where that works, and pthread_barrier where it doesn't
(including TSAN builds).
2021-05-07 14:28:32 -07:00
Ondřej SurýandEvan Hunt 2eae7813b6 Run isc__nm_http_stoplistening() synchronously in netmgr
When isc__nm_http_stoplistening() is run from inside the netmgr, we need
to make sure it's run synchronously.  This commit is just a band-aid
though, as the desired behvaior for isc_nm_stoplistening() is not always
the same:

  1. When run from outside user of the interface, the call must be
     synchronous, e.g. the calling code expects the call to really stop
     listening on the interfaces.

  2. But if there's a call from listen<proto> when listening fails,
     that needs to be scheduled to run asynchronously, because
     isc_nm_listen<proto> is being run in a paused (interlocked)
     netmgr thread and we could get stuck.

The proper solution would be to make isc_nm_stoplistening()
behave like uv_close(), i.e., to have a proper callback.
2021-05-07 14:28:32 -07:00
Evan Hunt 5c08f97791 only run tasks as privileged if taskmgr is in privileged mode
all zone loading tasks have the privileged flag, but we only want
them to run as privileged tasks when the server is being initialized;
if we privilege them the rest of the time, the server may hang for a
long time after a reload/reconfig. so now we call isc_taskmgr_setmode()
to turn privileged execution mode on or off in the task manager.

isc_task_privileged() returns true if the task's privilege flag is
set *and* the taskmgr is in privileged execution mode. this is used
to determine in which netmgr event queue the task should be run.
2021-05-07 14:28:30 -07:00
Ondřej SurýandEvan Hunt 29a208aaf7 Fix crash when allocating UDP socket fails on OpenBSD
When socket() call fails, the UDP connect code would call the connectcb
with empty req->handle.  This has been fixed.
2021-05-07 14:28:30 -07:00
Ondřej SurýandEvan Hunt 0b491913df Don't clear dig lookup if it was already cleared
This workarounds couple of races where the current_lookup would be
already detached during shutting down the dig, but still processing the
pending reads.
2021-05-07 14:28:30 -07:00
Ondřej SurýandEvan Hunt 2836bc1854 Fix wrong query accounting in the connect function in dighost.c
The start_udp() function didn't properly attach to the query and thus
a callback with ISC_R_CANCELED would end with wrong accounting on the
query object.

Usually, this doesn't happen because underlying libuv API
uv_udp_connect() is synchronous, but isc_nm_udpconnect() could return
ISC_R_CANCELED in case it's called while the netmgr is shutting down.
2021-05-07 14:28:30 -07:00
Ondřej SurýandEvan Hunt dacf586e18 Make the netmgr queue processing quantized
There was a theoretical possibility of clogging up the queue processing
with an endless loop where currently processing netievent would schedule
new netievent that would get processed immediately.  This wasn't such a
problem when only netmgr netievents were processed, but with the
addition of the tasks, there are at least two situation where this could
happen:

 1. In lib/dns/zone.c:setnsec3param() the task would get re-enqueued
    when the zone was not yet fully loaded.

 2. Tasks have internal quantum for maximum number of isc_events to be
    processed, when the task quantum is reached, the task would get
    rescheduled and then immediately processed by the netmgr queue
    processing.

As the isc_queue doesn't have a mechanism to atomically move the queue,
this commit adds a mechanism to quantize the queue, so enqueueing new
netievents will never stop processing other uv_loop_t events.
The default quantum size is 128.

Since the queue used in the network manager allows items to be enqueued
more than once, tasks are now reference-counted around task_ready()
and task_run(). task_ready() now has a public API wrapper,
isc_task_ready(), that the netmgr can use to reschedule processing
of a task if the quantum has been reached.

Incidental changes: Cleaned up some unused fields left in isc_task_t
and isc_taskmgr_t after the last refactoring, and changed atomic
flags to atomic_bools for easier manipulation.
2021-05-07 14:28:30 -07:00
Ondřej SurýandEvan Hunt b5bf58b419 Destroy netmgr before destroying taskmgr
With taskmgr running on top of netmgr, the ordering of how the tasks and
netmgr shutdown interacts was wrong as previously isc_taskmgr_destroy()
was waiting until all tasks were properly shutdown and detached.  This
responsibility was moved to netmgr, so we now need to do the following:

  1. shutdown all the tasks - this schedules all shutdown events onto
     the netmgr queue

  2. shutdown the netmgr - this also makes sure all the tasks and
     events are properly executed

  3. Shutdown the taskmgr - this now waits for all the tasks to finish
     running before returning

  4. Shutdown the netmgr - this call waits for all the netmgr netievents
     to finish before returning

This solves the race when the taskmgr object would be destroyed before
all the tasks were finished running in the netmgr loops.
2021-05-07 14:28:30 -07:00
Ondřej SurýandEvan Hunt a011d42211 Add new isc_managers API to simplify <*>mgr create/destroy
Previously, netmgr, taskmgr, timermgr and socketmgr all had their own
isc_<*>mgr_create() and isc_<*>mgr_destroy() functions.  The new
isc_managers_create() and isc_managers_destroy() fold all four into a
single function and makes sure the objects are created and destroy in
correct order.

Especially now, when taskmgr runs on top of netmgr, the correct order is
important and when the code was duplicated at many places it's easy to
make mistake.

The former isc_<*>mgr_create() and isc_<*>mgr_destroy() functions were
made private and a single call to isc_managers_create() and
isc_managers_destroy() is required at the program startup / shutdown.
2021-05-07 10:19:05 -07:00
Artem Boldariev f23afce683 Merge branch 'artem/doh-tests-fix' into 'main'
Fix flawed DoH unit tests logic and some corner cases in the DoH code. Fix doh_test failure on FreeBSD 13.0

Closes #2632

See merge request isc-projects/bind9!5005
2021-05-07 13:25:56 +00:00
Artem Boldariev 8c0ea01f34 DoH: close active server streams when finishing session
Under some circumstances a situation might occur when server-side
session gets finished while there are still active HTTP/2
streams. This would lead to isc_nm_httpsocket object leaks.

This commit fixes this behaviour as well as refactors failed_read_cb()
to allow better code reuse.
2021-05-07 15:47:24 +03:00
Artem Boldariev a9e97f28b7 Fix crash in client side DoH code
This commit fixes a situation when a cstream object could get unlinked
from the list as a result of a cstream->read_cb call. Thus, unlinking
it after the call could crash the program.
2021-05-07 15:47:24 +03:00
Artem Boldariev cd178043d9 Make some TLS tests actually use quota
A directive to check quota was missing from some of the TLS tests
which were supposed to test TLS code with quotas.
2021-05-07 15:47:24 +03:00
Artem Boldariev 22376fc69a TLS: cancel reading on the underlying TCP socket after (see below)
... the last handle has been detached after calling write
callback. That makes it possible to detach from the underlying socket
and not to keep the socket object alive for too long. This issue was
causing TLS tests with quota to fail because quota might not have been
detached on time (because it was still referenced by the underlying
TCP socket).

One could say that this commit is an ideological continuation of:

513cdb52ec.
2021-05-07 15:47:24 +03:00
Artem Boldariev 3bf331c453 Fix crashes in TLS when handling TLS shutdown messages
This commit fixes some situations which could appear in TLS code when
dealing with shutdown messages and lead to crashes.
2021-05-07 15:47:24 +03:00
Artem Boldariev 0d3f503dc9 Avoid creating connect netievents during low level failures in HTTP
This way we create less netievent objects, not bombarding NM with the
messages in case of numerous low-level errors (like too many open
files) in e.g. unit tests.
2021-05-07 15:47:24 +03:00
Artem Boldariev 0e8ac61d6e Avoid creating httpclose netievents in case of low level failures
This way we create less load on NM workers by avoiding netievent
creation.
2021-05-07 15:47:24 +03:00
Artem Boldariev 8510c5cd59 Always call TCP connect callback from within a worker context
This change ensures that a TCP connect callback is called from within
the context of a worker thread in case of a low-level error when
descriptors cannot be created (e.g. when there are too many open file
descriptors).
2021-05-07 15:47:24 +03:00
Artem Boldariev 1349142333 Got rid of tlsconnect event and corresponding code
We do not need it since we decided to not return values from connect
functions.
2021-05-07 15:47:24 +03:00
Artem Boldariev 39448c1581 Finish HTTP session on write failure
Not doing so caused client-side code to not free file descriptors as
soon as possible, that was causing unit tests to fail.
2021-05-07 15:47:24 +03:00
Artem Boldariev 4c5b36780b Fix flawed DoH unit tests logic
This commit fixes some logical mistakes in DoH unit tests logic,
causing them either to fail or not to do what they are intended to do.
2021-05-07 15:47:24 +03:00
Michal Nowak b31b29d166 Merge branch 'mnowak/add-placeholder-for-issue-2671' into 'main'
Add placeholder for #2671

See merge request isc-projects/bind9!5004
2021-05-07 11:15:42 +00:00
Michal Nowak 8cc6725280 Add placeholder for #2671
Issue #2671 was merged to 9.16 but a respective placeholder was not
added to "main".
2021-05-07 12:08:40 +02:00
Matthijs Mekking cf99c1dc85 Merge branch '2603-test-dnssec-policy-none' into 'main'
Check zonefile is untouched if dnssec-policy none

Closes #2603

See merge request isc-projects/bind9!4888
2021-05-05 17:15:58 +00:00
Matthijs Mekking 66f2cd228d Use isdigit instead of checking character range
When looking for key files, we could use isdigit rather than checking
if the character is within the range [0-9].

Use (unsigned char) cast to ensure the value is representable in the
unsigned char type (as suggested by the isdigit manpage).

Change " & 0xff" occurrences to the recommended (unsigned char) type
cast.
2021-05-05 19:15:33 +02:00
Matthijs Mekking 0c09867e96 Changes and release notes for [#2603] 2021-05-05 19:15:32 +02:00
Matthijs Mekking 511bc1b882 Check for filename clashes /w dnssec-policy zones
Just like with dynamic and/or inline-signing zones, check if no two
or more zone configurations set the same filename. In these cases,
the zone files are not read-only and named-checkconf should catch
a configuration where multiple zone statements write to the same file.

Add some bad configuration tests where KASP zones reference the same
zone file.

Update the good-kasp test to allow for two zones configure the same
file name, dnssec-policy none.
2021-05-05 19:13:55 +02:00
Matthijs Mekking 2d1b3a9899 Check zonefile is untouched if dnssec-policy none
Make sure no DNSSEC contents are added to the zonefile if dnssec-policy
is set to "none" (and no .state files exist for the zone).
2021-05-05 19:13:55 +02:00
Mark Andrews d8cc16a659 Merge branch '2670-always-set-rewrite-when-compacting-a-version-1-journal' into 'main'
Resolve "Always set 'rewrite' when compacting a version 1 journal."

Closes #2670

See merge request isc-projects/bind9!4985
2021-05-05 13:33:55 +00:00
Mark Andrews a60b54e1df Add release note for [GL #2670] 2021-05-05 23:13:55 +10:00
Mark Andrews 79da175a76 Add CHANGES note for [GL #2670] 2021-05-05 23:13:09 +10:00
Mark Andrews ae1ae07b03 Check journal compaction 2021-05-05 23:12:37 +10:00
Mark Andrews 4a8e33b9f0 Always perform a re-write when processing a version 1 journal
version 1 journals may have a mix of type 1 and type 2 transaction
headers so always use the recovery code.
2021-05-05 23:12:37 +10:00
Mark Andrews 71df4fb84c Allow named-journalprint to compact journals at a given serial 2021-05-05 23:12:37 +10:00
Matthijs Mekking cecc905b46 Merge branch 'matthijs-follow-up-2596' into 'main'
Remove double "insecure" check

See merge request isc-projects/bind9!4997
2021-05-05 10:48:38 +00:00
Matthijs Mekking 22243ac804 Remove double "insecure" check
This was a conflict between dba13d280a
and 636ff1e15c.
2021-05-05 12:45:47 +02:00
Matthijs Mekking 09ed248f60 Merge branch '2596-dnssec-policy-keys-inaccessible' into 'main'
Don't roll keys when the private key file is offline

Closes #2596

See merge request isc-projects/bind9!4885
2021-05-05 10:33:46 +00:00
Matthijs Mekking 636ff1e15c No longer need to strcmp for "none"
When we introduced "dnssec-policy insecure" we could have removed the
'strcmp' check for "none", because if it was set to "none", the 'kasp'
variable would have been set to NULL.
2021-05-05 11:23:53 +02:00
Matthijs Mekking 366ed047dd Changes and release notes for [#2596] 2021-05-05 11:14:35 +02:00
Matthijs Mekking 4a8ad0a77f Add kasp tests for offline keys
Add a test for default.kasp that if we remove the private key file,
no successor key is created for it. We need to update the kasp script
to deal with a missing private key. If this is the case, skip checks
for private key files.

Add a test with a zone for which the private key of the ZSK is missing.

Add a test with a zone for which the private key of the KSK is missing.
2021-05-05 11:14:02 +02:00
Matthijs Mekking 6a60bf637d Update smart signing when key is offline
BIND 9 is smart about when to sign with what key. If a key is offline,
BIND will delete the old signature anyway if there is another key to
sign the RRset with.

With KASP we don't want to fallback to the KSK if the ZSK is missing,
only for the SOA RRset. If the KSK is missing, but we do have a ZSK,
deleting the signature is fine. Otherwise it depends on if we use KASP
or not. Update the 'delsig_ok' function to reflect that.
2021-05-05 11:13:19 +02:00
Matthijs Mekking 3e6fc49c16 Don't roll offline keys
When checking the current DNSSEC state against the policy, consider
offline keys. If we didn't found an active key, check if the key is
offline by checking the public key list. If there is a match in the
public key list (the key data is retrieved from the .key and the
.state files), treat the key as offline and don't create a successor
key for it.
2021-05-05 11:13:19 +02:00
Matthijs Mekking b3a5859a9b rndc dnssec -status should include offline keys
The rndc command 'dnssec -status' only considered keys from
'dns_dnssec_findmatchingkeys' which only includes keys with accessible
private keys. Change it so that offline keys are also listed in the
status.
2021-05-05 11:13:19 +02:00
Matthijs Mekking 7ed089576f Try to read state when reading keylist from rdata
The function 'dns_dnssec_keylistfromrdataset()' creates a keylist from
the DNSKEY RRset. If we attempt to read the private key, we also store
the key state. However, if the private key is offline, the key state
will not be stored. To fix this, first attempt to read the public key
file. If then reading the private key file fails, and we do have a
public key, add that to the keylist, with appropriate state. If we
also failed to read the public key file, add the DNSKEY to the keylist,
as we did before.
2021-05-05 11:13:19 +02:00
Matthijs Mekking fa05c1b8da When reading public key from file, also read state
The 'dst_key_fromnamedfile()' function did not read and store the
key state from the .state file when reading a public key file.
2021-05-05 11:13:19 +02:00
Matthijs Mekking cf17698f87 Fix a kasp lock issue
The kasp lock would stay locked if 'dns_keymgr_run' failed.
2021-05-05 11:13:19 +02:00
Mark Andrews 2be319b759 Merge branch '2678-named-checkconf-doesn-t-catch-redefinition-of-dnssec-policy-insecure' into 'main'
Resolve "named-checkconf doesn't catch redefinition of dnssec-policy insecure"

Closes #2678

See merge request isc-projects/bind9!4994
2021-05-05 07:03:12 +00:00
Mark Andrews dba13d280a named-checkconf now detects redefinition of dnssec-policy 'insecure' 2021-05-05 16:23:19 +10:00
Mark Andrews 0f53872542 Merge branch '2536-inline-signing-documentation-doesn-t-match-reality' into 'main'
Resolve "inline-signing documentation doesn't match reality"

Closes #2536

See merge request isc-projects/bind9!4751
2021-05-05 00:17:40 +00:00
Matthijs MekkingandMark Andrews a548a450b3 checkconf tests for inline-signing at options/view 2021-05-04 23:35:59 +00:00
Mark Andrews 03978a7881 Add Release note for [GL #2536] 2021-05-04 23:35:59 +00:00
Mark Andrews 475a553e37 Add CHANGES note for [GL #2536] 2021-05-04 23:35:59 +00:00
Mark Andrews b3301da262 inline-signing should have been in zone_only_clauses 2021-05-04 23:35:59 +00:00
Ondřej Surý 74d9a917eb Merge branch '2675-wrong-rfc-reference-in-name-c' into 'main'
Fix RFC292 -> RFC952 typo

Closes #2675

See merge request isc-projects/bind9!4990
2021-05-04 15:22:49 +00:00
Ondřej Surý d2dba352cb Fix RFC292 -> RFC952 typo 2021-05-04 17:21:52 +02:00
Matthijs Mekking 38a422ed81 Merge branch '2624-kasp-test-failure-job-1630205' into 'main'
Fix intermittent kasp test failure

Closes #2624

See merge request isc-projects/bind9!4884
2021-05-04 08:24:43 +00:00
Matthijs MekkingandMark Andrews 572f421df4 Fix intermittent kasp test failure
The kasp system test performs for each zone a couple of checks to make
sure the zone is signed correctly. To avoid test failures caused by
timing issues, there is first a check to ensure the zone is done
signing, 'wait_for_done_signing'. This function waits with the DNSSEC
checks until a "zone_rekey done" log message is seen for a specific
key.

Unfortunately this is not sufficient to avoid test failures due to
timing issues, because there is a small amount of time in between this
log message and the newly signed zone actually being served.

Therefore, in 'check_apex', retry for three seconds the DNSKEY query
check. After that, additional checks should pass without retries,
because at that point we know for sure the zone has been resigned with
the expected keys.

Also reduce the number of redundant 'check_signatures'
2021-05-04 04:50:01 +00:00
Mark Andrews 33fd1a8437 Merge branch '2621-pull-request-to-fix-rdnc-addzone-doc' into 'main'
Resolve "Pull request to fix rdnc-addzone doc"

Closes #2621

See merge request isc-projects/bind9!4882
2021-05-04 02:37:51 +00:00
Mark Andrews 205d1bb762 Remove spurious $ and \ in addzone example 2021-05-04 02:18:34 +00:00
Ondřej Surý 44c6a69c9c Merge branch 'ondrej/add-backtrace-support-for-Windows' into 'main'
Add support for generating backtraces on Windows

See merge request isc-projects/bind9!4982
2021-05-03 18:40:30 +00:00
Ondřej Surý dfd56b84f5 Add support for generating backtraces on Windows
This commit adds support for generating backtraces on Windows and
refactors the isc_backtrace API to match the Linux/BSD API (without
the isc_ prefix)

 * isc_backtrace_gettrace() was renamed to isc_backtrace(), the third
   argument was removed and the return type was changed to int
 * isc_backtrace_symbols() was added
 * isc_backtrace_symbols_fd() was added and used as appropriate
2021-05-03 20:31:52 +02:00
Ondřej Surý c3ee539463 Merge branch 'ondrej/add-nanosleep-and-usleep-windows-shims' into 'main'
Add nanosleep and usleep Windows shims

See merge request isc-projects/bind9!4981
2021-05-03 18:25:55 +00:00
Ondřej Surý c58dc55c82 Merge branch 'ondrej/replace-CreateThreads-with-isc_thread_create' into 'main'
Add trampoline around iocompletionport_createthreads()

See merge request isc-projects/bind9!4980
2021-05-03 18:24:06 +00:00
Ondřej Surý 37c0d196e3 Use uv_sleep in the netmgr code
libuv added uv_sleep(unsigned int msec) to the API since 1.34.0.  Use that in
the netmgr code and define usleep based shim for libuv << 1.34.0.
2021-05-03 20:22:54 +02:00
Ondřej Surý c37ff5d188 Add nanosleep and usleep Windows shims
This commit adds POSIX nanosleep() and usleep() shim implementation for
Windows to help implementors use less #ifdef _WIN32 in the code.
2021-05-03 20:22:54 +02:00
Ondřej Surý cd54bbbd9a Add trampoline around iocompletionport_createthreads()
On Windows, the iocompletionport_createthreads() didn't use
isc_thread_create() to create new threads for processing IO, but just a
simple CreateThread() function that completely circumvent the
isc_trampoline mechanism to initialize global isc_tid_v.  This lead to
segmentation fault in isc_hp API because '-1' isn't valid index to the
hazard pointer array.

This commit changes the iocompletionport_createthreads() to use
isc_thread_create() instead of CreateThread() to properly initialize
isc_tid_v.
2021-05-03 20:21:15 +02:00
Diego dos Santos Fronza 9dedfcdda6 Merge branch '2627-tlsstream-c-warning-comparison-of-integer-expressions-of-different-signedness' into 'main'
Resolve "tlsstream.c: warning: comparison of integer expressions of different signedness"

Closes #2627

See merge request isc-projects/bind9!4906
2021-05-03 17:03:44 +00:00
Diego FronzaandMark Andrews 7729844150 Address comparison of integers with different signedess 2021-05-03 06:54:30 +00:00
Matthijs Mekking 7a3b6a7fb0 Merge branch 'matthijs-nsupdate-update_test' into 'main'
Update nsupdate test

See merge request isc-projects/bind9!4975
2021-04-30 12:26:12 +00:00
Matthijs Mekking 5b31811b5f Update nsupdate test
The nsupdate system test did not record failures from the
'update_test.pl' Perl script. This was because the 'ret' value was
not being saved outside the '{ $PERL ... || ret=1 } cat_i' scope.

Change this piece to store the output in a separate file and then
cat its contents. Now the 'ret' value is being saved.

Also record failures in 'update_test.pl' if sending the update
failed.

Add missing 'n' incrementals to 'nsupdate/test.sh' to keep track of
test numbers.
2021-04-30 12:25:25 +00:00
Petr Špaček 9d04a731ba Merge branch 'pspacek/rtd-sphinx-fix' into 'main'
Fix ARM build on readthedocs.org

See merge request isc-projects/bind9!4968
2021-04-30 10:57:30 +00:00
Petr Špaček 7df913aa3a Fix ARM build on readthedocs.org
By default readthedocs.org uses Sphinx 1.8.5, but MR !4563 has
introduced depedency on ReferenceRole class which is available only in
Sphinx 2.0.0.

Path to doc/arm/requirements.txt needs to be configured in
readthedocs.org.
2021-04-30 12:56:56 +02:00
Matthijs Mekking 968b9b5697 Merge branch '2645-dnssec-polic-insecure' into 'main'
Add built-in dnssec-policy "insecure"

Closes #2645

See merge request isc-projects/bind9!4929
2021-04-30 10:10:32 +00:00
Matthijs Mekking 287428e0aa Add kasp test policy goes straight to "none"
Add a test case when a dnssec-policy is reconfigured to "none",
without setting it to "insecure" first. This is unsupported behavior,
but we want to make sure the behavior is somewhat expected. The
zone should remain signed (but will go bogus once the signatures
expire).
2021-04-30 11:20:41 +02:00
Matthijs Mekking 75024736a4 Release notes and changes for [#2645]
The feature "going insecure gracefully" has been changed.
2021-04-30 11:20:40 +02:00
Matthijs Mekking fadc57d3d0 Update documentation with "insecure" policy
Update the ARM to mention the new built-in "insecure" policy.  Update
the DNSSEC guide recipe "Revert to unsigned" to add the additional
step of reconfiguring the zone to "insecure" (instead of immediately
set it to "none").
2021-04-30 11:18:38 +02:00
Matthijs Mekking 9c6ff463fd Add test for "insecure" policy
While it is meant to be used for transitioning a zone to insecure,
add a test case where a zone uses the "insecure" policy immediately.

The zone will go through DNSSEC maintenance, but the outcome should
be the same as 'dnssec-policy none;', that is the zone should be
unsigned.
2021-04-30 11:18:38 +02:00
Matthijs Mekking 17e3b056c8 Update kasp tests to "insecure" policy
The tests for going insecure should be changed to use the built-in
"insecure" policy.

The function that checks dnssec status output should again check
for the special case "none".
2021-04-30 11:18:38 +02:00
Matthijs Mekking 2710d9a11d Add built-in dnssec-policy "insecure"
Add a new built-in policy "insecure", to be used to gracefully unsign
a zone. Previously you could just remove the 'dnssec-policy'
configuration from your zone statement, or remove it.

The built-in policy "none" (or not configured) now actually means
no DNSSEC maintenance for the corresponding zone. So if you
immediately reconfigure your zone from whatever policy to "none",
your zone will temporarily be seen as bogus by validating resolvers.

This means we can remove the functions 'dns_zone_use_kasp()' and
'dns_zone_secure_to_insecure()' again. We also no longer have to
check for the existence of key state files to figure out if a zone
is transitioning to insecure.
2021-04-30 11:18:38 +02:00
Mark Andrews 1f4234ec89 Merge branch '2668-handle-net-dns-versions-that-don-t-support-nsec3param' into 'main'
Resolve "Handle Net::DNS versions that don't support NSEC3PARAM"

Closes #2668

See merge request isc-projects/bind9!4971
2021-04-30 06:25:39 +00:00
Mark Andrews 044933756a NSEC3PARAM support was added to Net::DNS in 1.00_06
Require 1.01 or later to when adding a NSEC3PARAM records.
2021-04-30 15:59:30 +10:00
Mark Andrews 7b62af4e0e Merge branch '2658-update-zonemd-now-that-rfc-8976-has-been-issued' into 'main'
Resolve "Update ZONEMD now that RFC 8976 has been issued."

Closes #2658

See merge request isc-projects/bind9!4946
2021-04-30 01:08:46 +00:00
Mark Andrews 8510ccaa54 Update ZONEMD to match RFC 8976
* The location of the digest type field has changed to where the
  reserved field was.
* The reserved field is now called scheme and is where the digest
  type field was.
* Digest type 2 has been defined (SHA256).
2021-04-30 10:43:37 +10:00
Michal Nowak c922608333 Merge branch 'mnowak/configure-with-enable-dnstap-by-default' into 'main'
Configure with --enable-dnstap by default

See merge request isc-projects/bind9!4618
2021-04-29 13:58:33 +00:00
Michal Nowak c97c6fbfea Suppress TSAN errors from libfstrm.so
dnstap_test produces TSAN errors which originate in libfstrm.so. Unless
libfstrm is TSAN clean or a workaround is placed in libfstrm sources,
suppressing TSAN coming from libfstrm is necessary to test DNSTAP under
TSAN.
2021-04-29 15:57:07 +02:00
Michal Nowak deff0ae317 Configure with --enable-dnstap by default
All platforms but OpenBSD have dnstap dependencies readily in their
respective repositories, and dnstap thus can be tested there. Given that
majority of images have dnstap dependencies available, it seems fitting
to make dnstap enabled by default.
2021-04-29 15:57:07 +02:00
Michal Nowak f11f7d0086 Merge branch 'mnowak/disable-pytest-cacheprovider-plugin' into 'main'
Disable pytest cacheprovider plugin in CI

See merge request isc-projects/bind9!4961
2021-04-29 13:43:10 +00:00
Michal Nowak e1c3034107 Disable pytest cacheprovider plugin in CI
The pytest "cacheprovider" plugin produces a .cache/v/cache/lastfailed
file, which holds a Python dictionary structure with failed tests.
However, on Ubuntu 16.04 (Xenial) the file is created even though the
test passed and the file contains just an empty dictionary ("{}").

Given that we are not interested in this feature, disabling the
"cacheprovider" plugin globally and removing per-test removals of the
.cache directory seems like the best course of action.
2021-04-29 15:29:18 +02:00
Matthijs Mekking c2f43e9516 Merge branch '2445-nsec3-iterations-resolver' into 'main'
Resolve "NSEC3 iterations"

Closes #2445

See merge request isc-projects/bind9!4957
2021-04-29 13:09:30 +00:00
Mark AndrewsandMatthijs Mekking ad236976fc Add release note for [GL #2445] 2021-04-29 13:43:40 +02:00
Mark AndrewsandMatthijs Mekking fd1f7b6480 Add CHANGES for [GL #2445] 2021-04-29 13:43:40 +02:00
Mark AndrewsandMatthijs Mekking e6e0e29fbb Check insecure responses returned with too many NSEC3 iterations 2021-04-29 13:43:40 +02:00
Mark AndrewsandMatthijs Mekking af02bbcdd6 Mark DNSSEC responses with NSEC3 records that exceed 150 as insecure 2021-04-29 13:43:40 +02:00
Michał Kępień b189defb6a Merge branch '2372-add-hyperlink-to-gl-xxxx-labels-in-documentation' into 'main'
Resolve "Add hyperlink to [GL XXXX] labels in documentation"

Closes #2372

See merge request isc-projects/bind9!4563
2021-04-29 11:35:33 +00:00
Michal NowakandMichał Kępień fe1dea6572 Update Danger check for GitLab references
Release notes now employ a custom :gl: Sphinx role for linking to GitLab
issues/MRs.  Tweak the relevant Danger checks to account for that.
2021-04-29 13:24:21 +02:00
Michał Kępień 2fadf29e6b Add a Sphinx role for linking GitLab issues/MRs
Define a :gl: Sphinx role that takes a GitLab issue/MR number as an
argument and creates a hyperlink to the relevant ISC GitLab URL.  This
makes it easy to reach ISC GitLab pages directly from the release notes.

Make all GitLab references in the release notes use the new Sphinx role.
2021-04-29 13:24:21 +02:00
Michal NowakandMichał Kępień aeb43a45ac Make use of the :rfc: role in the ARM consistent
Make sure all RFC references in the ARM use the stock :rfc: Sphinx role.
2021-04-29 13:24:21 +02:00
Ondřej Surý 9c3fac706e Merge branch 'ondrej/use-sigabrt-from-start.pl' into 'main'
Use SIGABRT instead of SIGKILL to produce cores on failed start

See merge request isc-projects/bind9!4928
2021-04-29 10:44:26 +00:00
Ondřej Surý 861a236937 Use SIGABRT instead of SIGKILL to produce cores on failed start
When the `named` would hang on startup it would be killed with SIGKILL
leaving us with no information about the state the process was in.
This commit changes the start.pl script to send SIGABRT instead, so we
can properly collect and process the coredump from the hung named
process.
2021-04-29 12:03:50 +02:00
Matthijs Mekking d8355d197d Merge branch 'matthijs-follow-up-2642-nsec3-iter-kasp' into 'main'
dnssec-policy: reduce NSEC3 iterations to 150

See merge request isc-projects/bind9!4952
2021-04-29 09:32:20 +00:00
Matthijs Mekking efa5d84dcf dnssec-policy: reduce NSEC3 iterations to 150
When reducing the number of NSEC3 iterations to 150, commit
aa26cde2ae added tests for dnssec-policy
to check that a too high iteration count is a configuration failure.

The test is not sufficient because 151 was always too high for
ECDSAP256SHA256. The test should check for a different algorithm.

There was an existing test case that checks for NSEC3 iterations.
Update the test with the new maximum values.

Update the code in 'kaspconf.c' to allow at most 150 iterations.
2021-04-29 10:41:16 +02:00
Michał Kępień 0fd3c8e48b Merge branch 'v9_17_12-release' into 'main'
Merge 9.17.12 release branch

See merge request isc-projects/bind9!4953
2021-04-29 08:37:11 +00:00
Michał Kępień 0c4694277f Set up release notes for BIND 9.17.13 2021-04-29 10:30:00 +02:00
Michał Kępień 3ea6421c49 Update BIND version to 9.17.12 2021-04-29 10:30:00 +02:00
Michał Kępień a0618507c4 Add a CHANGES marker 2021-04-29 10:30:00 +02:00
Michał Kępień 628ed23b7c Merge branch 'michal/prepare-documentation-for-bind-9.17.12' into 'security-main'
Prepare documentation for BIND 9.17.12

See merge request isc-private/bind9!280
2021-04-29 10:30:00 +02:00
Michał Kępień 9879d2a6b4 Merge branch '2540-confidential-issue-existing-dname' into 'security-main'
[CVE-2021-25215] Properly answer queries for DNAME records that require the DNAME to be processed to resolve itself

See merge request isc-private/bind9!253
2021-04-29 10:30:00 +02:00
Michał Kępień a051dd65e2 Prepare release notes for BIND 9.17.12 2021-04-29 10:30:00 +02:00
Michał Kępień df2edd67da Merge branch '2467-confidential-issue-ixfr-checks' into 'security-main'
[CVE-2021-25214] Prevent malformed incoming zone transfers from producing a zone without an SOA record

See merge request isc-private/bind9!239
2021-04-29 10:30:00 +02:00
Mark AndrewsandMichał Kępień f1d81d4e89 Add Release Notes entry for [GL #2540] 2021-04-29 10:30:00 +02:00
Michał Kępień e8d9de39ac Add release note for GL #2490 2021-04-29 10:30:00 +02:00
Mark AndrewsandMichał Kępień bd8a4a46df Add release note for [GL #2467] 2021-04-29 10:30:00 +02:00
Mark AndrewsandMichał Kępień a2954c3b57 Add CHANGES entry for [GL #2540] 2021-04-29 10:30:00 +02:00
Michał Kępień 4ac14c4a83 Reorder release notes 2021-04-29 10:30:00 +02:00
Mark AndrewsandMichał Kępień 83ab536a30 Add CHANGES entry for [GL #2467] 2021-04-29 10:30:00 +02:00
Mark AndrewsandMichał Kępień c1190a3fe0 Handle DNAME lookup via itself
When answering a query, named should never attempt to add the same RRset
to the ANSWER section more than once.  However, such a situation may
arise when chasing DNAME records: one of the DNAME records placed in the
ANSWER section may turn out to be the final answer to a client query,
but there is no way to know that in advance.  Tweak the relevant INSIST
assertion in query_respond() so that it handles this case properly.
qctx->rdataset is freed later anyway, so there is no need to clean it up
in query_respond().
2021-04-29 10:30:00 +02:00
Michał Kępień 3270ac7d9b Tweak and reword release notes 2021-04-29 10:30:00 +02:00
Mark AndrewsandMichał Kępień 5318627227 Unload a zone if a transfer breaks its SOA record
If a zone transfer results in a zone not having any NS records, named
stops serving it because such a zone is broken.  Do the same if an
incoming zone transfer results in a zone lacking an SOA record at the
apex or containing more than one SOA record.
2021-04-29 10:30:00 +02:00
Michał Kępień d9011c2a4d Tweak and reword recent CHANGES entries 2021-04-29 10:30:00 +02:00
Mark AndrewsandMichał Kępień 2ca0bd882d Address inconsistencies in checking added RRsets
loading_addrdataset() rejects SOA RRsets which are not at top of zone.
addrdataset() should similarly reject such RRsets.
2021-04-29 10:30:00 +02:00
Mark AndrewsandMichał Kępień 01209dfa49 Check SOA owner names in zone transfers
An IXFR containing SOA records with owner names different than the
transferred zone's origin can result in named serving a version of that
zone without an SOA record at the apex.  This causes a RUNTIME_CHECK
assertion failure the next time such a zone is refreshed.  Fix by
immediately rejecting a zone transfer (either an incremental or
non-incremental one) upon detecting an SOA record not placed at the apex
of the transferred zone.
2021-04-29 10:30:00 +02:00
Mark Andrews 0695a42adb Merge branch '2642-reduce-the-maximum-nsec3-iterations-that-can-be-configured' into 'main'
Resolve "Reduce the maximum NSEC3 iterations that can be configured"

Closes #2642

See merge request isc-projects/bind9!4925
2021-04-29 07:39:10 +00:00
Mark Andrews ca07b8e414 Add Release Note for [GL #2642] 2021-04-29 17:18:26 +10:00
Mark Andrews e04f06873f Add CHANGES for [GL #2642]
5625.   [func]          Reduce the supported maximum number of iterations
                        that can be configured in an NSEC3 zones to 150.
                        [GL #2642]
2021-04-29 17:18:26 +10:00
Mark Andrews 46eb21c546 Check that excessive iterations in logged by named when
loading an existing zone or transfering from the primary.
2021-04-29 17:18:26 +10:00
Mark Andrews 8ec16c378d Check NSEC3 iterations with dnssec-signzone 2021-04-29 17:18:26 +10:00
Mark Andrews 4ce8437a6e Check that named rejects excessive iterations via UPDATE 2021-04-29 17:18:26 +10:00
Mark Andrews 3fe75d9809 nsupdate: reject attempts to add NSEC3PARAM with excessive iterations 2021-04-29 17:18:26 +10:00
Mark Andrews c9f5f8a059 Warn if there is excessive NSEC3 iterations 2021-04-29 17:18:26 +10:00
Mark Andrews aa26cde2ae Check dnssec-policy nsec3param iterations limit 2021-04-29 17:18:26 +10:00
Mark Andrews 29126500d2 Reduce nsec3 max iterations to 150 2021-04-29 17:18:26 +10:00
Matthijs Mekking 51f94b8c7c Merge branch 'matthijs-nit-serve-stale-fixes' into 'main'
Serve-stale nit fixes

See merge request isc-projects/bind9!4940
2021-04-28 10:43:49 +00:00
Matthijs Mekking 104b676235 Serve-stale nit fixes
While working on the serve-stale backports, I noticed the following
oddities:

1. In the serve-stale system test, in one case we keep track of the
   time how long it took for dig to complete. In commit
   aaed7f9d8c, the code removed the
   exception to check for result == ISC_R_SUCCESS on stale found
   answers, and adjusted the test accordingly. This failed to update
   the time tracking accordingly. Move the t1/t2 time track variables
   back around the two dig commands to ensure the lookups resolved
   faster than the resolver-query-timeout.

2. We can remove the setting of NS_QUERYATTR_STALEOK and
   DNS_RDATASETATTR_STALE_ADDED on the "else if (stale_timeout)"
   code path, because they are added later when we know we have
   actually found a stale answer on a stale timeout lookup.

3. We should clear the NS_QUERYATTR_STALEOK flag from the client
   query attributes instead of DNS_RDATASETATTR_STALE_ADDED (that
   flag is set on the rdataset attributes).

4. In 'bin/named/config.c' we should set the configuration options
   in alpabetical order.

5. In the ARM, in the backports we have added "(stale)" between
   "cached" and "RRset" to make more clear a stale RRset may be
   returned in this scenario.
2021-04-28 12:24:24 +02:00
Michał Kępień 7c7b97b916 Merge branch 'michal/limit-logging-for-verbose-system-tests' into 'main'
Limit logging for verbose system tests

See merge request isc-projects/bind9!4812
2021-04-28 06:58:34 +00:00
Michał Kępień 241e85ef0c Warn when log files grow too big in system tests
Exerting excessive I/O load on the host running system tests should be
avoided in order to limit the number of false positives reported by the
system test suite.  In some cases, running named with "-d 99" (which is
the default for system tests) results in a massive amount of logs being
generated, most of which are useless.  Implement a log file size check
to draw developers' attention to overly verbose named instances used in
system tests.  The warning threshold of 200,000 lines was chosen
arbitrarily.
2021-04-28 07:56:47 +02:00
Michał Kępień 17e5c2a50e Prevent useless logging in the "tcp" system test
The regression test for CVE-2020-8620 causes a lot of useless messages
to be logged.  However, globally decreasing the log level for the
affected named instance would be a step too far as debugging information
may be useful for troubleshooting other checks in the "tcp" system test.
Starting a separate named instance for a single check should be avoided
when possible and thus is also not a good solution.  As a compromise,
run "rndc trace 1" for the affected named instance before starting the
regression test for CVE-2020-8620.
2021-04-28 07:56:47 +02:00
Michał Kępień 4a8d404876 Limit logging for verbose system tests
The system test framework starts all named instances with the "-d 99"
command line option (unless it is overridden by a named.args file in a
given instance's working directory).  This causes a lot of log messages
to be written to named.run files - currently over 5 million lines for a
single test suite run.  While debugging information preserved in the log
files is essential for troubleshooting intermittent test failures, some
system tests involve sending hundreds or even thousands of queries,
which causes the relevant log files to explode in size.  When multiple
tests (or even multiple test suites) are run in parallel, excessive
logging contributes considerably to the I/O load on the test host,
increasing the odds of intermittent test failures getting triggered.

Decrease the debug level for the seven most verbose named instances:

  - use "-d 3" for ns2 in the "cacheclean" system test (it is the lowest
    logging level at which the test still passes without the need to
    apply any changes to tests.sh),

  - use "-d 1" for the other six named instances.

This roughly halves the number of lines logged by each test suite run
while still leaving enough information in the logs to allow at least
basic troubleshooting in case of test failures.

This approach was chosen as it results in a greater decrease in the
number of lines logged than running all named instances with "-d 3",
without causing any test failures.
2021-04-28 07:56:47 +02:00
Diego dos Santos Fronza 99a4f6119a Merge branch '2529-add-__attribute__-malloc-for-isc_mempool_get' into 'main'
Resolve "Add __attribute__((malloc)) for isc_mempool_get"

Closes #2529

See merge request isc-projects/bind9!4858
2021-04-26 14:50:15 +00:00
Diego Fronza 54aa60eef8 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-04-26 11:32:17 -03:00
Diego Fronza efb9c540cd Removed unnecessary check (mpctx->items == NULL)
There is no possibility for mpctx->items to be NULL at the point where
the code was removed, since we enforce that fillcount > 0, if
mpctx->items == NULL when isc_mempool_get is called, then we will
allocate fillcount more items and add to the mpctx->items list.
2021-04-26 11:32:17 -03:00
Diego dos Santos Fronza 19df09d225 Merge branch '2564-nslookup-segfaults-for-servfail' into 'main'
Add workaround for "nslookup segfaults for SERVFAIL"

See merge request isc-projects/bind9!4796
2021-04-26 14:30:46 +00:00
Mark AndrewsandDiego Fronza f2d00069c3 Add CHANGES note for [GL #2564] 2021-04-26 11:15:25 -03:00
Diego Fronza 4d6408b823 Fix following up lookup failure if more resolvers are available
_query_detach function was incorrectly unliking the query object from
the lookup->q query list, this made it impossible to follow a query
lookup failure with the next one in the list (possibly using a separate
resolver), as the link to the next query in the list was dissolved.

Fix by unliking the node only when the query object is about to be
destroyed, i.e. there is no more references to the object.
2021-04-26 11:14:14 -03:00
Michał Kępień 3793733704 Merge branch '2650-handle-soa-rrsigs-not-at-zone-apex' into 'main'
Handle RRSIG(SOA) RRsets not at zone apex

Closes #2650

See merge request isc-projects/bind9!4936
2021-04-26 11:06:00 +00:00
Matthijs Mekking a64dd511f4 Merge branch '2628-kasp-create-multiple-key-keyid-conflict' into 'main'
Check for keyid conflicts between new keys

Closes #2628

See merge request isc-projects/bind9!4886
2021-04-26 09:29:19 +00:00
Matthijs Mekking b99ec65745 Changes and release notes for [#2628] 2021-04-26 10:43:39 +02:00
Matthijs Mekking 668301f138 Check for keyid conflicts between new keys
When the keymgr needs to create new keys, it is possible it needs to
create multiple keys. The keymgr checks for keyid conflicts with
already existing keys, but it should also check against that it just
created.
2021-04-26 10:42:46 +02:00
Michał Kępień c84399df64 Merge branch '2634-test-tkey-gssapi-credential-conditionally' into 'main'
Test "tkey-gssapi-credential" conditionally

Closes #2634

See merge request isc-projects/bind9!4938
2021-04-26 07:17:12 +00:00
Michał Kępień a3957af864 Test "--without-gssapi" in GitLab CI
GitLab CI pipelines do not currently include a Linux job that would have
GSSAPI support disabled.  Add the "--without-gssapi" option to the
./configure invocation on Debian 9 to address that deficiency and also
to continuously test that build-time switch.
2021-04-26 07:16:38 +02:00
Michał Kępień 6feac68b50 Test "tkey-gssapi-credential" conditionally
If "tkey-gssapi-credential" is set in the configuration and GSSAPI
support is not available, named will refuse to start.  As the test
system framework does not support starting named instances
conditionally, ensure that "tkey-gssapi-credential" is only present in
named.conf if GSSAPI support is available.
2021-04-26 07:16:38 +02:00
Mark Andrews a26e29896a Merge branch 'marka-shutdown-sync' into 'main'
shutdown: wait for named to start

See merge request isc-projects/bind9!4921
2021-04-24 04:36:45 +00:00
Mark Andrews 8d5870f9df Wait for named to start
If we don't wait for named to finish starting, 'rndc stop' may
fail due to the listen limit being reached in named leading
to a false negative test
2021-04-24 01:19:47 +00:00
Evan Hunt f8275c30da Merge branch 'each-timeout-recovery' into 'main'
ensure read timeouts are recoverable

See merge request isc-projects/bind9!4930
2021-04-23 17:26:05 +00:00
Artem BoldarievandEvan Hunt 62033110b9 Use a constant for timeouts in soft-timeout tests
It makes it easier to change the value should the need arise.
2021-04-23 10:01:42 -07:00
Evan Hunt 7f367b0c7f use the correct handle when calling the read callback
when calling isc_nm_read() on an HTTP socket, the read callback
was being run with the incorrect handle. this has been corrected.
2021-04-23 10:01:42 -07:00
Evan Hunt f0d75ee7c3 fix DOH timeout recovery
as with TLS, the destruction of a client stream on failed read
needs to be conditional: if we reached failed_read_cb() as a
result of a timeout on a timer which has subsequently been
reset, the stream must not be closed.
2021-04-23 10:01:42 -07:00
Michał Kępień 47a7b042e5 Add CHANGES entry 2021-04-23 14:26:48 +02:00
Michał Kępień 24bf4b946a Test handling of non-apex RRSIG(SOA) RRsets
Add a check to the "dnssec" system test which ensures that RRSIG(SOA)
RRsets present anywhere else than at the zone apex are automatically
removed after a zone containing such RRsets is loaded.
2021-04-23 14:26:48 +02:00
Mark AndrewsandMichał Kępień b7cdc3583e Be more precise with the stopping conditions in zone_resigninc
If there happens to be a RRSIG(SOA) that is not at the zone apex
for any reason it should not be considered as a stopping condition
for incremental zone signing.
2021-04-23 14:26:48 +02:00
Evan Hunt b258df8562 add HTTP timeout recovery test
NOTE: this test currently fails
2021-04-22 12:40:04 -07:00
Evan Hunt 23ec011298 fix TLS timeout recovery
the destruction of the socket in tls_failed_read_cb() needs to be
conditional; if reached due to a timeout on a timer that has
subsequently been reset, the socket must not be destroyed.
2021-04-22 12:08:04 -07:00
Evan Hunt c90da99180 fix TCP timeout recovery
removed an unnecessary assert in the failed_read_cb() function.
also renamed to isc__nm_tcp_failed_read_cb() to match the practice
in other modules.
2021-04-22 12:08:04 -07:00
Evan Hunt 25ef0547a9 add TCP and TLS timeout recovery tests
NOTE: currently these tests fail
2021-04-22 12:08:04 -07:00
Evan Hunt 52f256f9ae add TCPDNS and TLSDNS timeout recovery tests
this is similar in structure to the UDP timeout recovery test.

this commit adds a new mechanism to the netmgr test allowing the
listen socket to accept incoming TCP connections but never send
a response. this forces the client to time out on read.
2021-04-22 12:08:04 -07:00
Evan Hunt bcf5b2a675 run read callbacks synchronously on timeout
when running read callbacks, if the event result is not ISC_R_SUCCESS,
the callback is always run asynchronously. this is a problem on timeout,
because there's no chance to reset the timer before the socket has
already been destroyed. this commit allows read callbacks to run
synchronously for both ISC_R_SUCCESS and ISC_R_TIMEDOUT result codes.
2021-04-22 12:08:04 -07:00
Evan Hunt 609975ad20 add a UDP timeout recovery test
this test sets up a server socket that listens for UDP connections
but never responds. the client will always time out; it should retry
five times before giving up.
2021-04-22 12:08:04 -07:00
Evan Hunt 1f41d59a5e allow client read callback to be assignable
allow netmgr client tests to choose the function that will be
used as a read callback, without having to write a different
connect callback handler.
2021-04-22 12:08:04 -07:00
Diego dos Santos Fronza 289d7c2acc Merge branch '2626-deadlock-with-concurrent-rndc-addzone-rndc-delzone-commands' into 'main'
Resolve "Deadlock with concurrent `rndc addzone`/`rndc delzone` commands"

Closes #2626

See merge request isc-projects/bind9!4904
2021-04-22 15:47:16 +00:00
Diego Fronza 6646655067 Add CHANGES note for GL #2626 2021-04-22 15:45:55 +00:00
Diego Fronza d6224035d8 Add system test for the deadlock fix
The test spawns 4 parallel workers that keep adding, modifying and
deleting zones, the main thread repeatedly checks wheter rndc
status responds within a reasonable period.

While environment and timing issues may affect the test, in most
test cases the deadlock that was taking place before the fix used to
trigger in less than 7 seconds in a machine with at least 2 cores.
2021-04-22 15:45:55 +00:00
Diego Fronza 9298dcebbd Fix deadlock between rndc addzone/delzone/modzone
It follows a description of the steps that were leading to the deadlock:

1. `do_addzone` calls `isc_task_beginexclusive`.

2. `isc_task_beginexclusive` waits for (N_WORKERS - 1) halted tasks,
   this blocks waiting for those (no. workers -1) workers to halt.
...
isc_task_beginexclusive(isc_task_t *task0) {
    ...
	while (manager->halted + 1 < manager->workers) {
		wake_all_queues(manager);
		WAIT(&manager->halt_cond, &manager->halt_lock);
	}
```

3. It is possible that in `task.c / dispatch()` a worker is running a
   task event, if that event blocks it will not allow this worker to
   halt.

4. `do_addzone` acquires `LOCK(&view->new_zone_lock);`,

5. `rmzone` event is called from some worker's `dispatch()`, `rmzone`
   blocks waiting for the same lock.

6. `do_addzone` calls `isc_task_beginexclusive`.

7. Deadlock triggered, since:
	- `rmzone` is wating for the lock.
	- `isc_task_beginexclusive` is waiting for (no. workers - 1) to
	   be halted
	- since `rmzone` event is blocked it won't allow the worker to halt.

To fix this, we updated do_addzone code to call isc_task_beginexclusive
before the lock is acquired, we postpone locking to the nearest required
place, same for isc_task_beginexclusive.

The same could happen with rndc modzone, so that was addressed as well.
2021-04-22 15:45:55 +00:00
Petr Špaček fa6b277b8d Merge branch '2634-test-tkey-gssapi-credential' into 'main'
Add tests for the "tkey-gssapi-credential" option

See merge request isc-projects/bind9!4905
2021-04-22 15:25:36 +00:00
Petr Špaček 1746d2e84a Add tests for the "tkey-gssapi-credential" option
Four named instances in the "nsupdate" system test have GSS-TSIG support
enabled.  All of them currently use "tkey-gssapi-keytab".  Configure two
of them with "tkey-gssapi-credential" to test that option.

As "tkey-gssapi-keytab" and "tkey-gssapi-credential" both provide the
same functionality, no test modifications are required.  The difference
between the two options is that the value of "tkey-gssapi-keytab" is an
explicit path to the keytab file to acquire credentials from, while the
value of "tkey-gssapi-credential" is the name of the principal whose
credentials should be used; those credentials are looked up in the
keytab file expected by the Kerberos library, i.e. /etc/krb5.keytab by
default.  The path to the default keytab file can be overridden using by
setting the KRB5_KTNAME environment variable.  Utilize that variable to
use existing keytab files with the "tkey-gssapi-credential" option.

The KRB5_KTNAME environment variable should not interfere with the
"tkey-gssapi-keytab" option.  Nevertheless, rename one of the keytab
files used with "tkey-gssapi-keytab" to something else than the contents
of the KRB5_KTNAME environment variable in order to make sure that both
"tkey-gssapi-keytab" and "tkey-gssapi-credential" are actually tested.
2021-04-22 16:15:22 +02:00
Ondřej Surý c38bcb6968 Merge branch 'ondrej/autoconf-2.71-fixes' into 'main'
Update the configure.ac for autoconf >= 2.71 compatibility

See merge request isc-projects/bind9!4899
2021-04-22 12:41:11 +00:00
Ondřej Surý f52872c3ed Update the configure.ac for autoconf >= 2.71 compatibility
This mostly removes stuff that's either deprecated, obsolete or not used
at all:

* Update the minimal autoconf version to 2.69
* AC_PROG_CC_C99 is deprecated, just use AC_PROG_CC as we require C11
  anyway
* AC_HEADER_TIME is deprecated, both <sys/time.h> and <time.h> can be
  included at the same time, and we don't use the macros that
  AC_HEADER_TIME defines anywhere
* AC_HEADER_STDC checks for ISO C90 and we require at least C11
* Replace AC_TRY_*([]) with AC_*_IFELSE([AC_LANG_PROGRAM()])
* Update m4/ax_check_openssl.m4 from serial 10 to serial 11
* Update m4/ax_gcc_func_attribute.m4 from serial 10 to serial 13
* Update m4/ax_pthread.m4 from serial 24 to serial 30
* Add early AC_CANONICAL_TARGET call to prevent warning from AX_PTHREAD
2021-04-22 13:52:40 +02:00
Mark Andrews fdf5184bf5 Merge branch '2625-the-shutdown-system-test-is-not-capturing-enough' into 'main'
Resolve "The shutdown system test is not capturing enough"

Closes #2625

See merge request isc-projects/bind9!4883
2021-04-22 06:47:21 +00:00
Mark Andrews c3c7f5849c Abort named if 'rndc stop' or 'kill TERM' has failed to shutdown 2021-04-22 05:43:00 +00:00
Ondřej Surý 60bf42b3e1 Merge branch '2638-run-internal-tasks-on-top-of-network-manager-worker-loops' into 'main'
Refactor taskmgr to run on top of netmgr

Closes #2638

See merge request isc-projects/bind9!4918
2021-04-20 22:16:42 +00:00
Ondřej SurýandOndřej Surý f022d2db8c Add CHANGES and release note for [GL #2638] 2021-04-20 23:22:28 +02:00
Ondřej SurýandOndřej Surý b540722bc3 Refactor taskmgr to run on top of netmgr
This commit changes the taskmgr to run the individual tasks on the
netmgr internal workers.  While an effort has been put into keeping the
taskmgr interface intact, couple of changes have been made:

 * The taskmgr has no concept of universal privileged mode - rather the
   tasks are either privileged or unprivileged (normal).  The privileged
   tasks are run as a first thing when the netmgr is unpaused.  There
   are now four different queues in in the netmgr:

   1. priority queue - netievent on the priority queue are run even when
      the taskmgr enter exclusive mode and netmgr is paused.  This is
      needed to properly start listening on the interfaces, free
      resources and resume.

   2. privileged task queue - only privileged tasks are queued here and
      this is the first queue that gets processed when network manager
      is unpaused using isc_nm_resume().  All netmgr workers need to
      clean the privileged task queue before they all proceed normal
      operation.  Both task queues are processed when the workers are
      finished.

   3. task queue - only (traditional) task are scheduled here and this
      queue along with privileged task queues are process when the
      netmgr workers are finishing.  This is needed to process the task
      shutdown events.

   4. normal queue - this is the queue with netmgr events, e.g. reading,
      sending, callbacks and pretty much everything is processed here.

 * The isc_taskmgr_create() now requires initialized netmgr (isc_nm_t)
   object.

 * The isc_nm_destroy() function now waits for indefinite time, but it
   will print out the active objects when in tracing mode
   (-DNETMGR_TRACE=1 and -DNETMGR_TRACE_VERBOSE=1), the netmgr has been
   made a little bit more asynchronous and it might take longer time to
   shutdown all the active networking connections.

 * Previously, the isc_nm_stoplistening() was a synchronous operation.
   This has been changed and the isc_nm_stoplistening() just schedules
   the child sockets to stop listening and exits.  This was needed to
   prevent a deadlock as the the (traditional) tasks are now executed on
   the netmgr threads.

 * The socket selection logic in isc__nm_udp_send() was flawed, but
   fortunatelly, it was broken, so we never hit the problem where we
   created uvreq_t on a socket from nmhandle_t, but then a different
   socket could be picked up and then we were trying to run the send
   callback on a socket that had different threadid than currently
   running.
2021-04-20 23:22:28 +02:00
Ondřej Surý ae9edb1861 Merge branch '2630-tsan-error-in-xfrin-c' into 'main'
Prevent the double xfrin_fail() call

Closes #2630

See merge request isc-projects/bind9!4898
2021-04-20 12:13:35 +00:00
Ondřej Surý 30252aed88 Add CHANGES note for [GL #2630] 2021-04-20 14:12:26 +02:00
Ondřej Surý 6cf6de55bc Prevent the double xfrin_fail() call
When we are reading from the xfrin socket, and the transfer would be
shutdown, the shutdown function would call `xfrin_fail()` which in turns
calls `xfrin_cancelio()` that causes the read callback to be invoked
with `ISC_R_CANCELED` status code and that caused yet another
`xfrin_fail()` call.

The fix here is to ensure the `xfrin_fail()` would be run only once
properly using better synchronization on xfr->shuttingdown flag.
2021-04-20 14:12:26 +02:00
Ondřej Surý 27960e4208 Merge branch '2637-threadsanitizer-lock-order-inversion-potential-deadlock-in-zone_refreshkeys' into 'main'
Fix lock-order-inversion (potential deadlock) in dns_resolver_createfetch

Closes #2637

See merge request isc-projects/bind9!4909
2021-04-19 20:29:56 +00:00
Ondřej Surý 25d27851d8 Fix lock-order-inversion (potential deadlock) in dns_resolver_createfetch
There's a lock-order-inversion when running `zone_maintenance()` from
the timer while shutting down the server `shutdown_server()`.  This only
happens when the taskmgr scheduling is more relaxed and paralellized,
but the issue is real nevertheless.

The associated ThreadSanitizer warning:

    WARNING: ThreadSanitizer: lock-order-inversion (potential deadlock)
      Cycle in lock order graph: M1 (0x000000000001) => M2 (0x000000000000) => M1

      Mutex M2 acquired here while holding mutex M1 in thread T1:
	#0 pthread_mutex_lock <null>
	#1 dns_view_findzonecut lib/dns/view.c:1326:2
	#2 fctx_create lib/dns/resolver.c:5144:13
	#3 dns_resolver_createfetch lib/dns/resolver.c:10977:12
	#4 zone_refreshkeys lib/dns/zone.c:10830:13
	#5 zone_maintenance lib/dns/zone.c:11065:5
	#6 zone_timer lib/dns/zone.c:14652:2
	#7 task_run lib/isc/task.c:857:5
	#8 isc_task_run lib/isc/task.c:944:10
	#9 isc__nm_async_task lib/isc/netmgr/netmgr.c:730:24
	#10 process_netievent lib/isc/netmgr/netmgr.c
	#11 process_queue lib/isc/netmgr/netmgr.c:885:8
	#12 process_tasks_queue lib/isc/netmgr/netmgr.c:756:10
	#13 process_queues lib/isc/netmgr/netmgr.c:772:7
	#14 async_cb lib/isc/netmgr/netmgr.c:671:2
	#15 uv__async_io /home/ondrej/Projects/tsan/libuv/src/unix/async.c:163:5
	#16 uv__io_poll /home/ondrej/Projects/tsan/libuv/src/unix/linux-core.c:462:11
	#17 uv_run /home/ondrej/Projects/tsan/libuv/src/unix/core.c:392:5
	#18 nm_thread lib/isc/netmgr/netmgr.c:597:11
	#19 isc__trampoline_run lib/isc/trampoline.c:184:11

      Mutex M1 previously acquired by the same thread here:
	#0 pthread_mutex_lock <null>
	#1 zone_refreshkeys lib/dns/zone.c:10717:2
	#2 zone_maintenance lib/dns/zone.c:11065:5
	#3 zone_timer lib/dns/zone.c:14652:2
	#4 task_run lib/isc/task.c:857:5
	#5 isc_task_run lib/isc/task.c:944:10
	#6 isc__nm_async_task lib/isc/netmgr/netmgr.c:730:24
	#7 process_netievent lib/isc/netmgr/netmgr.c
	#8 process_queue lib/isc/netmgr/netmgr.c:885:8
	#9 process_tasks_queue lib/isc/netmgr/netmgr.c:756:10
	#10 process_queues lib/isc/netmgr/netmgr.c:772:7
	#11 async_cb lib/isc/netmgr/netmgr.c:671:2
	#12 uv__async_io /home/ondrej/Projects/tsan/libuv/src/unix/async.c:163:5
	#13 uv__io_poll /home/ondrej/Projects/tsan/libuv/src/unix/linux-core.c:462:11
	#14 uv_run /home/ondrej/Projects/tsan/libuv/src/unix/core.c:392:5
	#15 nm_thread lib/isc/netmgr/netmgr.c:597:11
	#16 isc__trampoline_run lib/isc/trampoline.c:184:11

      Mutex M1 acquired here while holding mutex M2 in thread T2:
	#0 pthread_mutex_lock <null>
	#1 dns_zone_flush lib/dns/zone.c:11443:2
	#2 view_flushanddetach lib/dns/view.c:657:5
	#3 dns_view_flushanddetach lib/dns/view.c:690:2
	#4 shutdown_server bin/named/server.c:10056:4
	#5 task_run lib/isc/task.c:857:5
	#6 isc_task_run lib/isc/task.c:944:10
	#7 isc__nm_async_task lib/isc/netmgr/netmgr.c:730:24
	#8 process_netievent lib/isc/netmgr/netmgr.c
	#9 process_queue lib/isc/netmgr/netmgr.c:885:8
	#10 process_tasks_queue lib/isc/netmgr/netmgr.c:756:10
	#11 process_queues lib/isc/netmgr/netmgr.c:772:7
	#12 async_cb lib/isc/netmgr/netmgr.c:671:2
	#13 uv__async_io /home/ondrej/Projects/tsan/libuv/src/unix/async.c:163:5
	#14 uv__io_poll /home/ondrej/Projects/tsan/libuv/src/unix/linux-core.c:462:11
	#15 uv_run /home/ondrej/Projects/tsan/libuv/src/unix/core.c:392:5
	#16 nm_thread lib/isc/netmgr/netmgr.c:597:11
	#17 isc__trampoline_run lib/isc/trampoline.c:184:11

      Mutex M2 previously acquired by the same thread here:
	#0 pthread_mutex_lock <null>
	#1 view_flushanddetach lib/dns/view.c:645:3
	#2 dns_view_flushanddetach lib/dns/view.c:690:2
	#3 shutdown_server bin/named/server.c:10056:4
	#4 task_run lib/isc/task.c:857:5
	#5 isc_task_run lib/isc/task.c:944:10
	#6 isc__nm_async_task lib/isc/netmgr/netmgr.c:730:24
	#7 process_netievent lib/isc/netmgr/netmgr.c
	#8 process_queue lib/isc/netmgr/netmgr.c:885:8
	#9 process_tasks_queue lib/isc/netmgr/netmgr.c:756:10
	#10 process_queues lib/isc/netmgr/netmgr.c:772:7
	#11 async_cb lib/isc/netmgr/netmgr.c:671:2
	#12 uv__async_io /home/ondrej/Projects/tsan/libuv/src/unix/async.c:163:5
	#13 uv__io_poll /home/ondrej/Projects/tsan/libuv/src/unix/linux-core.c:462:11
	#14 uv_run /home/ondrej/Projects/tsan/libuv/src/unix/core.c:392:5
	#15 nm_thread lib/isc/netmgr/netmgr.c:597:11
	#16 isc__trampoline_run lib/isc/trampoline.c:184:11

      Thread T2 (running) created by main thread at:
	#0 pthread_create <null>
	#1 isc_thread_create lib/isc/pthreads/thread.c:79:8
	#2 isc_nm_start lib/isc/netmgr/netmgr.c:303:3
	#3 create_managers bin/named/main.c:957:15
	#4 setup bin/named/main.c:1267:11
	#5 main bin/named/main.c:1558:2

      Thread T2 (running) created by main thread at:
	#0 pthread_create <null>
	#1 isc_thread_create lib/isc/pthreads/thread.c:79:8
	#2 isc_nm_start lib/isc/netmgr/netmgr.c:303:3
	#3 create_managers bin/named/main.c:957:15
	#4 setup bin/named/main.c:1267:11
	#5 main bin/named/main.c:1558:2

    SUMMARY: ThreadSanitizer: lock-order-inversion (potential deadlock) in __interceptor_pthread_mutex_lock
2021-04-19 22:29:14 +02:00
Ondřej Surý 3f0c8189e7 Merge branch 'ondrej/cleanup-ISCAPI-remnants' into 'main'
Cleanup the public vs private ISCAPI remnants

See merge request isc-projects/bind9!4911
2021-04-19 11:48:14 +00:00
Ondřej SurýandOndřej Surý 16fe0d1f41 Cleanup the public vs private ISCAPI remnants
Since all the libraries are internal now, just cleanup the ISCAPI remnants
in isc_socket, isc_task and isc_timer APIs.  This means, there's one less
layer as following changes have been done:

 * struct isc_socket and struct isc_socketmgr have been removed
 * struct isc__socket and struct isc__socketmgr have been renamed
   to struct isc_socket and struct isc_socketmgr
 * struct isc_task and struct isc_taskmgr have been removed
 * struct isc__task and struct isc__taskmgr have been renamed
   to struct isc_task and struct isc_taskmgr
 * struct isc_timer and struct isc_timermgr have been removed
 * struct isc__timer and struct isc__timermgr have been renamed
   to struct isc_timer and struct isc_timermgr
 * All the associated code that dealt with typing isc_<foo>
   to isc__<foo> and back has been removed.
2021-04-19 13:18:24 +02:00
Ondřej Surý 5937c1f787 Merge branch 'ondrej/fixup-bin/tests/system/resolve-win32-directories' into 'main'
Fixup win32 paths for moved bin/tests/system/resolve

See merge request isc-projects/bind9!4916
2021-04-19 11:15:12 +00:00
Ondřej Surý f14e678624 Fixup win32 paths for moved bin/tests/system/resolve
When resolve.c was moved from lib/samples to bin/tests/system, the
resolve.vcxproj.in would still contain old paths to the directory
root. This commit adds one more ..\ to match the directory depth.

Additionally, fixup the path in BINDInstall.vcxproj.in to be
bin/tests/system and not bin/tests/samples.
2021-04-19 12:51:33 +02:00
Ondřej Surý 11d3c475bd Merge branch '2636-timing-race-in-setnsec3param-task' into 'main'
Fix task timing race in setnsec3param()

Closes #2636

See merge request isc-projects/bind9!4908
2021-04-19 09:22:31 +00:00
Ondřej Surý 0127ba6472 Fix task timing race in setnsec3param()
When setnsec3param() is schedule from zone_postload() there's no
guarantee that `zone->db` is not `NULL` yet.  Thus when the
setnsec3param() is called, we need to check for `zone->db` existence and
reschedule the task, because calling `rss_post()` on a zone with empty
`.db` ends up with no-op (the function just returns).
2021-04-19 11:16:51 +02:00
Ondřej Surý c216ace42a Merge branch 'ondrej/cleanup-double-createinctx-constructors' into 'main'
Cleanup the isc_<*>mgr_createinc() constructors

See merge request isc-projects/bind9!4910
2021-04-19 08:26:32 +00:00
Ondřej Surý 3388ef36b3 Cleanup the isc_<*>mgr_createinc() constructors
Previously, the taskmgr, timermgr and socketmgr had a constructor
variant, that would create the mgr on top of existing appctx.  This was
no longer true and isc_<*>mgr was just calling isc_<*>mgr_create()
directly without any extra code.

This commit just cleans up the extra function.
2021-04-19 10:22:56 +02:00
Mark Andrews eb32677de5 Merge branch 'marka-initialise-resarg-lock' into 'main'
properly initialise resarg->lock

See merge request isc-projects/bind9!4907
2021-04-19 04:59:39 +00:00
Mark Andrews eadb829dac properly initialise resarg->lock 2021-04-19 14:32:40 +10:00
Ondřej Surý 48c703e3d6 Merge branch 'each-cleanup-dns_client' into 'main'
clean up dns_client and related samples

See merge request isc-projects/bind9!4835
2021-04-16 13:35:44 +00:00
Evan HuntandOndřej Surý 07e349de3c Add CHANGES note for [GL !4835] 2021-04-16 14:31:10 +02:00
Evan HuntandOndřej Surý d0ec7d1f33 move samples/resolve.c to bin/tests/system
"resolve" is used by the resolver system tests, and I'm not
certain whether delv exercises the same code, so rather than
remove it, I moved it to bin/tests/system.
2021-04-16 14:29:43 +02:00
Evan HuntandOndřej Surý 056afe7bdc remove sample-async
sample code for export libraries is no longer needed and
this code is not used for any internal tests. also, sample-gai.c
had already been removed but there were some dangling references.
2021-04-16 14:29:43 +02:00
Evan HuntandOndřej Surý 568d455c99 rename dns_client_createx() to dns_client_create()
there's no longer a need to use an alternate name.
2021-04-16 14:29:43 +02:00
Evan HuntandOndřej Surý 1beb05f3e2 remove dns_client_request() and related code
continues the cleanup of dns_client started in the previous commit.
2021-04-16 14:29:43 +02:00
Evan HuntandOndřej Surý fb2a352e7c remove dns_client_update() and related code
the libdns client API is no longer being maintained for
external use, we can remove the code that isn't being used
internally, as well as the related tests.
2021-04-16 14:29:43 +02:00
Michał Kępień 409883adbd Merge branch '2634-placeholder' into 'main'
Add placeholder for GL #2634

See merge request isc-projects/bind9!4901
2021-04-16 12:20:37 +00:00
Michał Kępień cd91f1c189 Add placeholder for GL #2634 2021-04-16 14:16:57 +02:00
Ondřej Surý 1ab099aa3b Merge branch '2623-9-16-13-overwrites-master-files-if-old-format-jnl-files-are-present' into 'main'
Resolve "9.16.13 overwrites master files if old format .jnl files are present"

Closes #2623

See merge request isc-projects/bind9!4880
2021-04-16 11:12:19 +00:00
Mark AndrewsandOndřej Surý 3df637fb83 Add CHANGES and release note for [GL #2623] 2021-04-16 12:04:06 +02:00
Ondřej Surý 55b942b4a0 Refactor dns_journal_rollforward() to work over opened journal
Too much logic was cramped inside the dns_journal_rollforward() that
made it harder to follow.  The dns_journal_rollforward() was refactored
to work over already opened journal and some of the previous logic was
moved to new static zone_journal_rollforward() that separates the
journal "rollforward" logic from the "zone" logic.
2021-04-16 12:04:06 +02:00
Mark AndrewsandOndřej Surý ec7a9af381 Fixing a recoverable journal should not result in the zone being written
when dns_journal_rollforward returned ISC_R_RECOVERABLE the distintion
between 'up to date' and 'success' was lost, as a consequence
zone_needdump() was called writing out the zone file when it shouldn't
have been.   This change restores that distintion.  Adjust system
test to reflect visible changes.
2021-04-16 11:15:46 +02:00
Artem Boldariev 10ba2a40e2 Merge branch 'artem/move-tls-tests-into-netmgr-tests' into 'main'
Merge the tls_test.c into netmgr_test.c and extend the tests suite

See merge request isc-projects/bind9!4893
2021-04-15 14:03:14 +00:00
Artem Boldariev 66432dcd65 Handle a situation when SSL shutdown messages were sent and received
It fixes a corner case which was causing dig to print annoying
messages like:

14-Apr-2021 18:48:37.099 SSL error in BIO: 1 TLS error (errno:
0). Arguments: received_data: (nil), send_data: (nil), finish: false

even when all the data was properly processed.
2021-04-15 15:49:36 +03:00
Artem Boldariev 513cdb52ec TLS: try to close TCP socket descriptor earlier when possible
Before this fix underlying TCP sockets could remain opened for longer
than it is actually required, causing unit tests to fail with lots of
ISC_R_TOOMANYOPENFILES errors.

The change also enables graceful SSL shutdown (before that it  would
happen only in the case when isc_nm_cancelread() were called).
2021-04-15 15:49:36 +03:00
Ondřej SurýandArtem Boldariev 202b1d372d Merge the tls_test.c into netmgr_test.c and extend the tests suite
This commit merges TLS tests into the common Network Manager unit
tests suite and extends the unit test framework to include support for
additional "ping-pong" style tests where all data could be sent via
lesser number of connections (the behaviour of the old test
suite). The tests for TCP and TLS were extended to make use of the new
mode, as this mode better translates to how the code is used in DoH.

Both TLS and TCP tests now share most of the unit tests' code, as they
are expected to function similarly from a users's perspective anyway.

Additionally to the above, the TLS test suite was extended to include
TLS tests using the connections quota facility.
2021-04-15 15:49:36 +03:00
Matthijs Mekking 2aad659550 Merge branch 'matthijs-keymgr2kasp-rework' into 'main'
Update keymgr2kasp system test

Closes #2631

See merge request isc-projects/bind9!4894
2021-04-15 12:45:25 +00:00
Matthijs Mekking 0de5a576c5 Fix view-related issues in the "keymgr2kasp" test
Due to the lack of "match-clients" clauses in ns4/named2.conf.in, the
same view is incorrectly chosen for all queries received by ns4 in the
"keymgr2kasp" system test.  This causes only one version of the
"view-rsasha256.kasp" zone to actually be checked.  Add "match-clients"
clauses to ns4/named2.conf.in to ensure the test really checks what it
claims to.

Use identical view names ("ext", "int") in ns4/named.conf.in and
ns4/named2.conf.in so that it is easier to quickly identify the
differences between these two files.

Update tests.sh to account for the above changes.  Also fix a copy-paste
error in a comment to prevent confusion.
2021-04-15 10:05:52 +02:00
Matthijs Mekking ee02453a2e Merge branch '1100-inline-signing-include' into 'main'
Resolve "Test inline-signing with $INCLUDE"

Closes #1100

See merge request isc-projects/bind9!4825
2021-04-14 09:35:35 +00:00
Matthijs Mekking bad5c3cf7c Document relative path of $INCLUDE
Add to the ARM from where relative paths are searched.
2021-04-14 10:04:40 +02:00
Matthijs Mekking 96583e7c40 Fix inline test with missing $INCLUDE
The test case for a zone with a missing include file was wrong for two
reasons:
1. It was loading the wrong file (master5 instead of master6)
2. It did actually not set the $ret variable to 1 if the test failed
   (it should default to ret=1 and clear the variable if the
   appropriate log is found).
2021-04-14 10:04:40 +02:00
Matthijs Mekking 6463ee0f40 Add inline-signing with $INCLUDE test
Add a test case for inline-signing for a zone with an $INCLUDE
statement. There is already a test for a missing include file, this
one adds a test for a zone with an include file that does exist.

Test if the record in the included file is loaded.
2021-04-14 10:04:40 +02:00
Matthijs Mekking bb01030252 Merge branch '2347-draft-vandijk-dnsop-nsec-ttl' into 'main'
Implement draft-vandijk-dnsop-nsec-ttl

Closes #2347

See merge request isc-projects/bind9!4506
2021-04-13 12:14:53 +00:00
Matthijs Mekking 8fcbef2423 Small refactor lib/dns/zone.c
Introduce some macros that can be reused in 'zone_load_soa_rr()' and
'zone_get_from_db()' to make those functions more readable.
2021-04-13 11:26:26 +02:00
Matthijs Mekking 032110bd2e Use designated initializer in dns_zone_create
Shorten the code and make it less prone to initialisation errors
(it is still easy to forget adding an initializer, but it now defaults
to 0).
2021-04-13 11:26:26 +02:00
Matthijs Mekking 3b68dd426f Add change entry and release note for [#2347] 2021-04-13 11:26:26 +02:00
Matthijs Mekking 9af8caa733 Implement draft-vandijk-dnsop-nsec-ttl
The draft says that the NSEC(3) TTL must have the same TTL value
as the minimum of the SOA MINIMUM field and the SOA TTL. This was
always the intended behaviour.

Update the zone structure to also track the SOA TTL. Whenever we
use the MINIMUM value to determine the NSEC(3) TTL, use the minimum
of MINIMUM and SOA TTL instead.

There is no specific test for this, however two tests need adjusting
because otherwise they failed: They were testing for NSEC3 records
including the TTL. Update these checks to use 600 (the SOA TTL),
rather than 3600 (the SOA MINIMUM).
2021-04-13 11:26:26 +02:00
Matthijs Mekking 8ffb4b0a13 Merge branch '2289-cache-dump-stale-ttl-weird-values' into 'main'
Fix nonsensical stale TTL values in cache dump

Closes #2289

See merge request isc-projects/bind9!4799
2021-04-13 08:54:49 +00:00
Matthijs Mekking a83c8cb0af Use stale TTL as RRset TTL in dumpdb
It is more intuitive to have the countdown 'max-stale-ttl' as the
RRset TTL, instead of 0 TTL. This information was already available
in a comment "; stale (will be retained for x more seconds", but
Support suggested to put it in the TTL field instead.
2021-04-13 09:48:20 +02:00
Matthijs Mekking debee6157b Check staleness in bind_rdataset
Before binding an RRset, check the time and see if this record is
stale (or perhaps even ancient). Marking a header stale or ancient
happens only when looking up an RRset in cache, but binding an RRset
can also happen on other occasions (for example when dumping the
database).

Check the time and compare it to the header. If according to the
time the entry is stale, but not ancient, set the STALE attribute.
If according to the time is ancient, set the ANCIENT attribute.

We could mark the header stale or ancient here, but that requires
locking, so that's why we only compare the current time against
the rdh_ttl.

Adjust the test to check the dump-db before querying for data. In the
dumped file the entry should be marked as stale, despite no cache
lookup happened since the initial query.
2021-04-13 09:48:20 +02:00
Matthijs Mekking 2a5e0232ed Fix nonsensical stale TTL values in cache dump
When introducing change 5149, "rndc dumpdb" started to print a line
above a stale RRset, indicating how long the data will be retained.

At that time, I thought it should also be possible to load
a cache from file. But if a TTL has a value of 0 (because it is stale),
stale entries wouldn't be loaded from file. So, I added the
'max-stale-ttl' to TTL values, and adjusted the $DATE accordingly.

Since we actually don't have a "load cache from file" feature, this
is premature and is causing confusion at operators. This commit
changes the 'max-stale-ttl' adjustments.

A check in the serve-stale system test is added for a non-stale
RRset (longttl.example) to make sure the TTL in cache is sensible.

Also, the comment above stale RRsets could have nonsensical
values. A possible reason why this may happen is when the RRset was
marked a stale but the 'max-stale-ttl' has passed (and is actually an
RRset awaiting cleanup). This would lead to the "will be retained"
value to be negative (but since it is stored in an uint32_t, you would
get a nonsensical value (e.g. 4294362497).

To mitigate against this, we now also check if the header is not
ancient. In addition we check if the stale_ttl would be negative, and
if so we set it to 0. Most likely this will not happen because the
header would already have been marked ancient, but there is a possible
race condition where the 'rdh_ttl + serve_stale_ttl' has passed,
but the header has not been checked for staleness.
2021-04-13 09:48:20 +02:00
Mark Andrews 1941ce99d4 Merge branch '2622-command-line-option-l-not-shown-with-usage-message' into 'main'
Resolve "Command-line option -L not shown with usage message"

Closes #2622

See merge request isc-projects/bind9!4881
2021-04-13 01:33:28 +00:00
Mark Andrews 38449de93b Update named's usage description 2021-04-12 12:07:44 +10:00
Michał Kępień b64af491bf Merge branch 'michal/add-placeholder-entries-to-CHANGES' into 'main'
Add placeholders for GL #2467, GL #2540, GL #2604

See merge request isc-projects/bind9!4878
2021-04-08 11:10:54 +00:00
Michał Kępień 0874242db6 Add placeholders for GL #2467, GL #2540, GL #2604 2021-04-08 13:06:57 +02:00
Michał Kępień b517108cbc Merge branch '2578-rework-get_ports.sh-to-make-it-not-use-a-lock-file' into 'main'
Rework get_ports.sh to make it not use a lock file

Closes #2578

See merge request isc-projects/bind9!4801
2021-04-08 09:37:51 +00:00
Michał Kępień c3718b926b Use the same port selection method on all systems
When system tests are run on Windows, they are assigned port ranges that
are 100 ports wide and start from port number 5000.  This is a different
port assignment method than the one used on Unix systems.  Drop the "-p"
command line option from bin/tests/system/run.sh invocations used for
starting system tests on Windows to unify the port assignment method
used across all operating systems.
2021-04-08 11:12:37 +02:00
Michał Kępień 31e5ca4bd9 Rework get_ports.sh to make it not use a lock file
The get_ports.sh script is used for determining the range of ports a
given system test should use.  It first determines the start of the port
range to return (the base port); it can either be specified explicitly
by the caller or chosen randomly.  Subsequent ports are picked
sequentially, starting from the base port.  To ensure no single port is
used by multiple tests, a state file (get_ports.state) containing the
last assigned port is maintained by the script.  Concurrent access to
the state file is protected by a lock file (get_ports.lock); if one
instance of the script holds the lock file while another instance tries
to acquire it, the latter retries its attempt to acquire the lock file
after sleeping for 1 second; this retry process can be repeated up to 10
times before the script returns an error.

There are some problems with this approach:

  - the sleep period in case of failure to acquire the lock file is
    fixed, which leads to a "thundering herd" type of problem, where
    (depending on how processes are scheduled by the operating system)
    multiple system tests try to acquire the lock file at the same time
    and subsequently sleep for 1 second, only for the same situation to
    likely happen the next time around,

  - the lock file is being locked and then unlocked for every single
    port assignment made, not just once for the entire range of ports a
    system test should use; in other words, the lock file is currently
    locked and unlocked 13 times per system test; this increases the
    odds of the "thundering herd" problem described above preventing a
    system test from getting one or more ports assigned before the
    maximum retry count is reached (assuming multiple system tests are
    run in parallel); it also enables the range of ports used by a given
    system test to be non-sequential (which is a rather cosmetic issue,
    but one that can make log interpretation harder than necessary when
    test failures are diagnosed),

  - both issues described above cause unnecessary delays when multiple
    system tests are started in parallel (due to high lock file
    contention among the system tests being started),

  - maintaining a state file requires ensuring proper locking, which
    complicates the script's source code.

Rework the get_ports.sh script so that it assigns non-overlapping port
ranges to its callers without using a state file or a lock file:

  - add a new command line switch, "-t", which takes the name of the
    system test to assign ports for,

  - ensure every instance of get_ports.sh knows how many ports all
    system tests which form the test suite are going to need in total
    (based on the number of subdirectories found in bin/tests/system/),

  - in order to ensure all instances of get_ports.sh work on the same
    global port range (so that no port range collisions happen), a
    stable (throughout the expected run time of a single system test
    suite) base port selection method is used instead of the random one;
    specifically, the base port, unless specified explicitly using the
    "-p" command line switch, is derived from the number of hours which
    passed since the Unix Epoch time,

  - use the name of the system test to assign ports for (passed via the
    new "-t" command line switch) as a unique index into the global
    system test range, to ensure all system tests use disjoint port
    ranges.
2021-04-08 11:12:37 +02:00
Michal Nowak a2484f2673 Merge branch 'mnowak/fix-missing-fromhex.pl-in-out-of-tree' into 'main'
Move fromhex.pl script to bin/tests/system/

See merge request isc-projects/bind9!4875
2021-04-08 09:07:07 +00:00
Michal Nowak cd0a34df1b Move fromhex.pl script to bin/tests/system/
The fromhex.pl script needs to be copied from the source directory to
the build directory before any test is run, otherwise the out-of-tree
fails to find it. Given that the script is used only in system test,
move it to bin/tests/system/.
2021-04-08 11:04:26 +02:00
Michał Kępień e01b3ccfaa Merge branch '2620-free-resources-when-gss_accept_sec_context-fails' into 'main'
Free resources when gss_accept_sec_context() fails

Closes #2620

See merge request isc-projects/bind9!4873
2021-04-08 08:40:27 +00:00
Michał Kępień 7eb87270a4 Add CHANGES entry 2021-04-08 10:33:44 +02:00
Michał Kępień d954e152d9 Free resources when gss_accept_sec_context() fails
Even if a call to gss_accept_sec_context() fails, it might still cause a
GSS-API response token to be allocated and left for the caller to
release.  Make sure the token is released before an early return from
dst_gssapi_acceptctx().
2021-04-08 10:33:44 +02:00
Ondřej Surý 3c5267cc5c Merge branch '2600-general-error-managed-keys-zone-dns_journal_compact-failed-no-more' into 'main'
Resolve "general: error: managed-keys-zone: dns_journal_compact failed: no more"

Closes #2600

See merge request isc-projects/bind9!4849
2021-04-07 19:28:39 +00:00
Mark AndrewsandOndřej Surý 0174098aca Add CHANGES and release note for [GL #2600] 2021-04-07 21:02:10 +02:00
Mark AndrewsandOndřej Surý bb6f0faeed Check that upgrade of managed-keys.bind.jnl succeeded
Update the system to include a recoverable managed.keys journal created
with <size,serial0,serial1,0> transactions and test that it has been
updated as part of the start up process.
2021-04-07 20:27:22 +02:00
Mark AndrewsandOndřej Surý 0fbdf189c7 Rewrite managed-key journal immediately
Both managed keys and regular zone journals need to be updated
immediately when a recoverable error is discovered.
2021-04-07 20:23:46 +02:00
Mark AndrewsandOndřej Surý 83310ffd92 Update dns_journal_compact() to handle bad transaction headers
Previously, dns_journal_begin_transaction() could reserve the wrong
amount of space.  We now check that the transaction is internally
consistent when upgrading / downgrading a journal and we also handle the
bad transaction headers.
2021-04-07 20:23:46 +02:00
Mark AndrewsandOndřej Surý 520509ac7e Compute transaction size based on journal/transaction type
previously the code assumed that it was a new transaction.
2021-04-07 20:20:57 +02:00
Mark AndrewsandOndřej Surý 5a6112ec8f Use journal_write_xhdr() to write the dummy transaction header
Instead of journal_write(), use correct format call journal_write_xhdr()
to write the dummy transaction header which looks at j->header_ver1 to
determine which transaction header to write instead of always writing a
zero filled journal_rawxhdr_t header.
2021-04-07 20:18:44 +02:00
Ondřej Surý 81c5f5e6a8 Merge branch '2401-ISC_R_TIMEDOUT-is-recoverable' into 'main'
netmgr: Make it possible to recover from ISC_R_TIMEDOUT

Closes #2401

See merge request isc-projects/bind9!4845
2021-04-07 14:34:46 +00:00
Evan HuntandOndřej Surý 5496e51a80 Add CHANGES note for GL #2401 2021-04-07 15:38:16 +02:00
Artem BoldarievandOndřej Surý 8da12738f1 Use T_CONNECT timeout constant for TCP tests (instead of 1 ms)
The netmgr_test would be failing on heavily loaded systems because the
connection timeout was set to 1 ms.  Use the global constant instead.
2021-04-07 15:37:10 +02:00
Evan HuntandOndřej Surý d2ea8f4245 Ensure dig lookup is detached on UDP connect failure
dig could hang when UDP connect failed due to a dangling lookup object.
2021-04-07 15:36:59 +02:00
Ondřej Surý 72ef5f465d Refactor async callbacks and fix the double tlsdnsconnect callback
The isc_nm_tlsdnsconnect() call could end up with two connect callbacks
called when the timeout fired and the TCP connection was aborted,
but the TLS handshake was not complete yet.  isc__nm_connecttimeout_cb()
forgot to clean up sock->tls.pending_req when the connect callback was
called with ISC_R_TIMEDOUT, leading to a second callback running later.

A new argument has been added to the isc__nm_*_failed_connect_cb and
isc__nm_*_failed_read_cb functions, to indicate whether the callback
needs to run asynchronously or not.
2021-04-07 15:36:59 +02:00
Ondřej Surý 58e75e3ce5 Skip long tls_tests in the CI
We already skip most of the recv_send tests in CI because they are
too timing-related to be run in overloaded environment.  This commit
adds a similar change to tls_test before we merge tls_test into
netmgr_test.
2021-04-07 15:36:59 +02:00
Artem BoldarievandOndřej Surý 340235c855 Prevent short TLS tests from hanging in case of errors
The tests in tls_test.c could hang in the event of a connect
error.  This commit allows the tests to bail out when such an
error occurs.
2021-04-07 15:36:59 +02:00
Evan HuntandOndřej Surý 426c40c96d rearrange nm_teardown() to check correctness after shutting down
if a test failed at the beginning of nm_teardown(), the function
would abort before isc_nm_destroy() or isc_tlsctx_free() were reached;
we would then abort when nm_setup() was run for the next test case.
rearranging the teardown function prevents this problem.
2021-04-07 15:36:59 +02:00
Ondřej Surý 86f4872dd6 isc_nm_*connect() always return via callback
The isc_nm_*connect() functions were refactored to always return the
connection status via the connect callback instead of sometimes returning
the hard failure directly (for example, when the socket could not be
created, or when the network manager was shutting down).

This commit changes the connect functions in all the network manager
modules, and also makes the necessary refactoring changes in places
where the connect functions are called.
2021-04-07 15:36:59 +02:00
Evan HuntandOndřej Surý a70cd026df move UDP connect retries from dig into isc_nm_udpconnect()
dig previously ran isc_nm_udpconnect() three times before giving
up, to work around a freebsd bug that caused connect() to return
a spurious transient EADDRINUSE. this commit moves the retry code
into the network manager itself, so that isc_nm_udpconnect() no
longer needs to return a result code.
2021-04-07 15:36:59 +02:00
Ondřej Surý ca12e25bb0 Use generic functions for reading and timers in TCP
The TCP module has been updated to use the generic functions from
netmgr.c instead of its own local copies.  This brings the module
mostly up to par with the TCPDNS and TLSDNS modules.
2021-04-07 15:36:59 +02:00
Ondřej Surý 7df8c7061c Fix and clean up handling of connect callbacks
Serveral problems were discovered and fixed after the change in
the connection timeout in the previous commits:

  * In TLSDNS, the connection callback was not called at all under some
    circumstances when the TCP connection had been established, but the
    TLS handshake hadn't been completed yet.  Additional checks have
    been put in place so that tls_cycle() will end early when the
    nmsocket is invalidated by the isc__nm_tlsdns_shutdown() call.

  * In TCP, TCPDNS and TLSDNS, new connections would be established
    even when the network manager was shutting down.  The new
    call isc__nm_closing() has been added and is used to bail out
    early even before uv_tcp_connect() is attempted.
2021-04-07 15:36:59 +02:00
Ondřej Surý 5a87c7372c Make it possible to recover from connect timeouts
Similarly to the read timeout, it's now possible to recover from
ISC_R_TIMEDOUT event by restarting the timer from the connect callback.

The change here also fixes platforms that missing the socket() options
to set the TCP connection timeout, by moving the timeout code into user
space.  On platforms that support setting the connect timeout via a
socket option, the timeout has been hardcoded to 2 minutes (the maximum
value of tcp-initial-timeout).
2021-04-07 15:36:58 +02:00
Ondřej SurýandOndřej Surý 33c00c281f Make it possible to recover from read timeouts
Previously, when the client timed out on read, the client socket would
be automatically closed and destroyed when the nmhandle was detached.
This commit changes the logic so that it's possible for the callback to
recover from the ISC_R_TIMEDOUT event by restarting the timer. This is
done by calling isc_nmhandle_settimeout(), which prevents the timeout
handling code from destroying the socket; instead, it continues to wait
for data.

One specific use case for multiple timeouts is serve-stale - the client
socket could be created with shorter timeout (as specified with
stale-answer-client-timeout), so we can serve the requestor with stale
answer, but keep the original query running for a longer time.
2021-04-07 15:36:58 +02:00
Ondřej Surý 0aad979175 Disable netmgr tests only when running under CI
The full netmgr test suite is unstable when run in CI due to various
timing issues.  Previously, we enabled the full test suite only when
CI_ENABLE_ALL_TESTS environment variable was set, but that went against
original intent of running the full suite when an individual developer
would run it locally.

This change disables the full test suite only when running in the CI and
the CI_ENABLE_ALL_TESTS is not set.
2021-04-07 15:36:58 +02:00
Matthijs Mekking ad25ca8bc6 Merge branch '2608-stale-answer-client-timeout-default-off' into 'main'
Change default stale-answer-client-timeout to off

Closes #2608

See merge request isc-projects/bind9!4862
2021-04-07 12:45:48 +00:00
Matthijs Mekking e443279bbf Change default stale-answer-client-timeout to off
Using "stale-answer-client-timeout" turns out to have unforeseen
negative consequences, and thus it is better to disable the feature
by default for the time being.
2021-04-07 14:10:31 +02:00
Diego dos Santos Fronza e8313d91ea Merge branch '2582-threadsanitizer-data-race-lib-dns-zone-c-10272-7-in-zone_maintenance' into 'main'
Resolve "ThreadSanitizer: data race lib/dns/zone.c:10272:7 in zone_maintenance"

Closes #2582

See merge request isc-projects/bind9!4864
2021-04-07 12:05:05 +00:00
Diego Fronza 6e08307bc8 Resolve TSAN data race in zone_maintenance
Fix race between zone_maintenance and dns_zone_notifyreceive functions,
zone_maintenance was attempting to read a zone flag calling
DNS_ZONE_FLAG(zone, flag) while dns_zone_notifyreceive was updating
a flag in the same zone calling DNS_ZONE_SETFLAG(zone, ...).

The code reading the flag in zone_maintenance was not protected by the
zone's lock, to avoid a race the zone's lock is now being acquired
before an attempt to read the zone flag is made.
2021-04-07 12:04:01 +00:00
Michał Kępień 2e5a6ab7fc Merge branch '2579-enforce-a-run-time-limit-on-unit-test-binaries' into 'main'
Enforce a run time limit on unit test binaries

Closes #2579

See merge request isc-projects/bind9!4802
2021-04-07 09:46:40 +00:00
Michał Kępień 6bdd55a9b3 Enforce a run time limit on unit test binaries
When a unit test binary hangs, the GitLab CI job in which it is run is
stuck until its run time limit is exceeded.  Furthermore, it is not
trivial to determine which test(s) hung in a given GitLab CI job based
on its log.  To prevent these issues, enforce a run time limit on every
binary executed by the lib/unit-test-driver.sh script.  Use a timeout of
5 minutes for consistency with older BIND 9 branches, which employed
Kyua for running unit tests.  Report an exit code of 124 when the run
time limit is exceeded for a unit test binary, for consistency with the
"timeout" tool included in GNU coreutils.
2021-04-07 11:41:45 +02:00
Artem Boldariev d1bb1b01b9 Merge branch '2611-doth-failure' into 'main'
Fix "doth" system test failure with SSL_ERROR_SYSCALL (5)

See merge request isc-projects/bind9!4863
2021-04-07 08:44:38 +00:00
Artem Boldariev ee10948e2d Remove dead code which was supposed to handle TLS shutdowns nicely
Fixes Coverity issue CID 330954 (See #2612).
2021-04-07 11:21:08 +03:00
Artem Boldariev e6062210c7 Handle buggy situations with SSL_ERROR_SYSCALL
See "BUGS" section at:

https://www.openssl.org/docs/man1.1.1/man3/SSL_get_error.html

It is mentioned there that when TLS status equals SSL_ERROR_SYSCALL
AND errno == 0 it means that underlying transport layer returned EOF
prematurely.  However, we are managing the transport ourselves, so we
should just resume reading from the TCP socket.

It seems that this case has been handled properly on modern versions
of OpenSSL. That being said, the situation goes in line with the
manual: it is briefly mentioned there that SSL_ERROR_SYSCALL might be
returned not only in a case of low-level errors (like system call
failures).
2021-04-07 11:21:08 +03:00
Mark Andrews 6b121171a5 Merge branch '2613-lib-dns-gen-is-not-deleted-on-make-clean' into 'main'
Resolve "lib/dns/gen is not deleted on make clean"

Closes #2613

See merge request isc-projects/bind9!4865
2021-04-07 07:18:53 +00:00
Mark Andrews 9c28df2204 remove lib/dns/gen when running 'make clean' 2021-04-07 08:06:49 +10:00
Matthijs Mekking 8556c7f854 Merge branch '2594-servestale-staleonly-recursion-race' into 'main'
Serve-stale "staleonly" recursion race condition

See merge request isc-projects/bind9!4859
2021-04-02 11:26:57 +00:00
Matthijs Mekking 3d3a6415f7 If RPZ config'd, bail stale-answer-client-timeout
When we are recursing, RPZ processing is not allowed. But when we are
performing a lookup due to "stale-answer-client-timeout", we are still
recursing. This effectively means that RPZ processing is disabled on
such a lookup.

In this case, bail the "stale-answer-client-timeout" lookup and wait
for recursion to complete, as we we can't perform the RPZ rewrite
rules reliably.
2021-04-02 10:02:40 +02:00
Matthijs Mekking 839df94190 Rename "staleonly"
The dboption DNS_DBFIND_STALEONLY caused confusion because it implies
we are looking for stale data **only** and ignore any active RRsets in
the cache. Rename it to DNS_DBFIND_STALETIMEOUT as it is more clear
the option is related to a lookup due to "stale-answer-client-timeout".

Rename other usages of "staleonly", instead use "lookup due to...".
Also rename related function and variable names.
2021-04-02 10:02:40 +02:00
Matthijs Mekking 3f81d79ffb Restore the RECURSIONOK attribute after staleonly
When doing a staleonly lookup we don't want to fallback to recursion.
After all, there are obviously problems with recursion, otherwise we
wouldn't do a staleonly lookup.

When resuming from recursion however, we should restore the
RECURSIONOK flag, allowing future required lookups for this client
to recurse.
2021-04-02 10:02:40 +02:00
Matthijs Mekking aaed7f9d8c Remove result exception on staleonly lookup
When implementing "stale-answer-client-timeout", we decided that
we should only return positive answers prematurely to clients. A
negative response is not useful, and in that case it is better to
wait for the recursion to complete.

To do so, we check the result and if it is not ISC_R_SUCCESS, we
decide that it is not good enough. However, there are more return
codes that could lead to a positive answer (e.g. CNAME chains).

This commit removes the exception and now uses the same logic that
other stale lookups use to determine if we found a useful stale
answer (stale_found == true).

This means we can simplify two test cases in the serve-stale system
test: nodata.example is no longer treated differently than data.example.
2021-04-02 10:02:40 +02:00
Matthijs Mekking e44bcc6f53 Add notes and changes for [#2594]
Pretty newsworthy.
2021-04-02 10:02:40 +02:00
Matthijs Mekking 3d5429f61f Remove INSIST on NS_QUERYATTR_ANSWERED
The NS_QUERYATTR_ANSWERED attribute is to prevent sending a response
twice. Without the attribute, this may happen if a staleonly lookup
found a useful answer and sends a response to the client, and later
recursion ends and also tries to send a response.

The attribute was also used to mask adding a duplicate RRset. This is
considered harmful. When we created a response to the client with a
stale only lookup (regardless if we actually have send the response),
we should clear the rdatasets that were added during that lookup.

Mark such rdatasets with the a new attribute,
DNS_RDATASETATTR_STALE_ADDED. Set a query attribute
NS_QUERYATTR_STALEOK if we may have added rdatasets during a stale
only lookup. Before creating a response on a normal lookup, check if
we can expect rdatasets to have been added during a staleonly lookup.
If so, clear the rdatasets from the message with the attribute
DNS_RDATASETATTR_STALE_ADDED set.
2021-04-02 09:15:07 +02:00
Matthijs Mekking 48b0dc159b Simplify when to detach the client
With stale-answer-client-timeout, we may send a response to the client,
but we may want to hold on to the network manager handle, because
recursion is going on in the background, or we need to refresh a
stale RRset.

Simplify the setting of 'nodetach':
* During a staleonly lookup we should not detach the nmhandle, so just
  set it prior to 'query_lookup()'.
* During a staleonly "stalefirst" lookup set the 'nodetach' to true
  if we are going to refresh the RRset.

Now there is no longer the need to clear the 'nodetach' if we go
through the "dbfind_stale", "stale_refresh_window", or "stale_only"
paths.
2021-04-02 09:14:09 +02:00
Matthijs Mekking 92f7a67892 Refactor stale lookups, ignore active RRsets
When doing a staleonly lookup, ignore active RRsets from cache. If we
don't, we may add a duplicate RRset to the message, and hit an
assertion failure in query.c because adding the duplicate RRset to the
ANSWER section failed.

This can happen on a race condition. When a client query is received,
the recursion is started. When 'stale-answer-client-timeout' triggers
around the same time the recursion completes, the following sequence
of events may happen:
1. Queue the "try stale" fetch_callback() event to the client task.
2. Add the RRsets from the authoritative response to the cache.
3. Queue the "fetch complete" fetch_callback() event to the client task.
4. Execute the "try stale" fetch_callback(), which retrieves the
   just-inserted RRset from the database.
5. In "ns_query_done()" we are still recursing, but the "staleonly"
   query attribute has already been cleared. In other words, the
   query will resume when recursion ends (it already has ended but is
   still on the task queue).
6. Execute the "fetch complete" fetch_callback(). It finds the answer
   from recursion in the cache again and tries to add the duplicate to
   the answer section.

This commit changes the logic for finding stale answers in the cache,
such that on "stale_only" lookups actually only stale RRsets are
considered. It refactors the code so that code paths for "dbfind_stale",
"stale_refresh_window", and "stale_only" are more clear.

First we call some generic code that applies in all three cases,
formatting the domain name for logging purposes, increment the
trystale stats, and check if we actually found stale data that we can
use.

The "dbfind_stale" lookup will return SERVFAIL if we didn't found a
usable answer, otherwise we will continue with the lookup
(query_gotanswer()). This is no different as before the introduction of
"stale-answer-client-timeout" and "stale-refresh-time".

The "stale_refresh_window" lookup is similar to the "dbfind_stale"
lookup: return SERVFAIL if we didn't found a usable answer, otherwise
continue with the lookup (query_gotanswer()).

Finally the "stale_only" lookup.

If the "stale_only" lookup was triggered because of an actual client
timeout (stale-answer-client-timeout > 0), and if database lookup
returned a stale usable RRset, trigger a response to the client.
Otherwise return and wait until the recursion completes (or the
resolver query times out).

If the "stale_only" lookup is a "stale-anwer-client-timeout 0" lookup,
preferring stale data over a lookup. In this case if there was no stale
data, or the data was not a positive answer, retry the lookup with the
stale options cleared, a.k.a. a normal lookup. Otherwise, continue
with the lookup (query_gotanswer()) and refresh the stale RRset. This
will trigger a response to the client, but will not detach the handle
because a fetch will be created to refresh the RRset.
2021-04-02 09:14:09 +02:00
Matthijs Mekking fee164243f Keep track of allow client detach
The stale-answer-client-timeout feature introduced a dependancy on
when a client may be detached from the handle. The dboption
DNS_DBFIND_STALEONLY was reused to track this attribute. This overloads
the meaning of this database option, and actually introduced a bug
because the option was checked in other places. In particular, in
'ns_query_done()' there is a check for 'RECURSING(qctx->client) &&
(!QUERY_STALEONLY(&qctx->client->query) || ...' and the condition is
satisfied because recursion has not completed yet and
DNS_DBFIND_STALEONLY is already cleared by that time (in
query_lookup()), because we found a useful answer and we should detach
the client from the handle after sending the response.

Add a new boolean to the client structure to keep track of client
detach from handle is allowed or not. It is only disallowed if we are
in a staleonly lookup and we didn't found a useful answer.
2021-04-02 09:14:09 +02:00
Artem Boldariev e7fe606020 Merge branch 'artem/tls-tests-and-fixes' into 'main'
TLS transport code refactoring and unit tests

See merge request isc-projects/bind9!4851
2021-04-01 15:41:52 +00:00
Artem Boldariev fa062162a7 Fix crash (regression) in DIG when handling non-DoH responses
This commit fixes crash in dig when it encounters non-expected header
value. The bug was introduced at some point late in the last DoH
development cycle. Also, refactors the relevant code a little bit to
ensure better incoming data validation for client-side DoH
connections.
2021-04-01 17:31:29 +03:00
Artem Boldariev 11ed7aac5d TLS code refactoring, fixes and unit-tests
This commit fixes numerous stability issues with TLS transport code as
well as adds unit tests for it.
2021-04-01 17:31:29 +03:00
Ondřej Surý 01cd310407 Merge branch '2607-remove-custom-spnego' into 'main'
Remove custom ISC SPNEGO implementation

Closes #2607

See merge request isc-projects/bind9!4856
2021-04-01 14:14:00 +00:00
Ondřej Surý 66bd47a129 Add CHANGES and release note for GL #2607 2021-04-01 16:08:19 +02:00
Mark Andrews 1febea6d7c Merge branch '2538-bind-9-17-build-process-leaving-files-in-unexpected-locations' into 'main'
Resolve "BIND 9.17 build process leaving files in unexpected locations?"

Closes #2538

See merge request isc-projects/bind9!4757
2021-04-01 09:34:17 +00:00
Mark Andrews 35e8f56b49 Test dynamic libraries should not be installed
Tag the libraries with check_ to prevent them being installed
by "make install".  Additionally make check requires .so to be
create which requires .lai files to be constructed which, in
turn, requires -rpath <dir> as part of "linking" the .la file.
2021-04-01 19:11:54 +11:00
Michal Nowak b34fd6d4f2 Merge branch 'mnowak/web-run-gcc-tarball-ci-job' into 'main'
Run gcc:tarball CI job in web-triggered pipelines

See merge request isc-projects/bind9!4850
2021-03-31 14:37:15 +00:00
Michal Nowak 4d5d3b75da Run gcc:tarball CI job in web-triggered pipelines
The gcc:tarball CI job may identify problems with tarballs created by
"make dist" of the tarball-create CI job. Enabling the gcc:tarball CI
job in web-triggered pipelines provides developers with a test vector.
2021-03-31 16:35:59 +02:00
Michał Kępień aaac9345eb Merge branch 'michal/include-all-pre-generated-man-pages-in-make-dist' into 'main'
Include all pre-generated man pages in "make dist"

See merge request isc-projects/bind9!4838
2021-03-29 11:08:00 +00:00
Michał Kępień 490e5cb1f1 Include all pre-generated man pages in "make dist"
Some man pages (e.g. dnstap-read.1, named-nzd2nzf.1) should only be
installed conditionally (when the relevant features are enabled in a
given BIND 9 build).  This is achieved using Automake conditionals.
However, while all source reStructuredText files are included in
tarballs produced by "make dist" (distribution tarballs) as they should
be, the list of pre-generated man pages included in distribution
tarballs incorrectly depends on the ./configure switches used for the
build for which "make dist" is run.  Meanwhile, distribution tarballs
should always contain all the files necessary to build any flavor of
BIND 9.

Here is an example scenario which fails to work as intended:

    autoreconf -i
    ./configure --disable-maintainer-mode
    make dist
    tar --extract --file bind-9.17.11.tar.xz
    cd bind-9.17.11
    ./configure --disable-maintainer-mode --enable-dnstap
    make

Fix by always including pre-generated versions of all conditionally
installed man pages in EXTRA_DIST.  While this may cause some of them to
appear in EXTRA_DIST more than once (depending on the ./configure
switches used for the build for which "make dist" is run), it seems to
not be a problem for Automake.
2021-03-29 13:06:39 +02:00
Mark Andrews 99ff8f285c Merge branch '2597-make-calling-generic-rdata-methods-consistent' into 'main'
Resolve "Make calling generic rdata methods consistent"

Closes #2597

See merge request isc-projects/bind9!4834
2021-03-26 22:27:51 +00:00
Mark Andrews a88d3963e2 Make calling generic rdata methods consistent
add matching macros to pass arguments from called methods
to generic methods.  This will reduce the amount of work
required when extending methods.

Also cleanup unnecessary UNUSED declarations.
2021-03-26 22:04:42 +00:00
Ondřej Surý 19b69e9a3b Merge branch 'bind-dyndb-ldap-v9.16.13' into 'main'
Do not require config.h to use isc/util.h

See merge request isc-projects/bind9!4840
2021-03-26 18:43:18 +00:00
Petr Mensik 81eb3396bf Do not require config.h to use isc/util.h
util.h requires ISC_CONSTRUCTOR definition, which depends on config.h
inclusion. It does not include it from isc/util.h (or any other header).
Using isc/util.h fails hard when isc/util.h is used without including
bind's config.h.

Move the check to c file, where ISC_CONSTRUCTOR is used. Ensure config.h
is included there.
2021-03-26 11:41:22 +01:00
Diego dos Santos Fronza f38069cdf8 Merge branch '2490-dig-tcp-does-not-honor-tries-1-nor-retry-0' into 'main'
Resolve "dig +tcp does not honor +tries=1 nor +retry=0"

Closes #2490

See merge request isc-projects/bind9!4682
2021-03-25 17:30:24 +00:00
Diego Fronza 04537633a7 Add CHANGES note for [GL #2490] 2021-03-25 14:12:16 -03:00
Diego Fronza 3b98c4d311 Update dig's man page
Adjusted man page entries for +tries and +retry options to reflect the
fact that now those options apply to TCP as well.
2021-03-25 14:08:40 -03:00
Diego Fronza 4f82cc41cc Added tests for tries=1 and retry=0 on TCP EOF
Added tests to ensure that dig won't retry sending a query over tcp
(+tcp) when a TCP connection is closed prematurely (EOF is read) if
either +tries=1 or retry=0 is specified on the command line.
2021-03-25 14:08:40 -03:00
Diego Fronza e680896003 Adjusted dig system tests
Now that premature EOF on tcp connections take +tries and +retry into
account, the dig system tests handling TCP EOF with +tries=1 were
expecting dig to do a second attempt in handling the tcp query, which
doesn't happen anymore.

To make the test work as expected +tries value was adjusted to 2, to
make it behave as before after the new update on dig.
2021-03-25 14:08:40 -03:00
Diego Fronza 78f6ead480 Don't retry +tcp queries on failure if tries=1 or retries=0
Before this commit, a premature EOF (connection closed) on tcp queries
was causing dig to automatically attempt to send the query again, even
if +tries=1 or +retries=0 was provided on command line.

This commit fix the problem by taking into account the no. of retries
specified by the user when processing a premature EOF on tcp
connections.
2021-03-25 14:08:39 -03:00
Michał Kępień 8bb1547208 Merge branch 'matthijs-configure-kaspsh' into 'main'
Configure kasp.sh

See merge request isc-projects/bind9!4836
2021-03-24 09:07:33 +00:00
Matthijs MekkingandMichał Kępień 93ed215065 Add kasp.sh to run.sh.in script
Add kasp.sh to the list of scripts copied from the source directory to
the build directory before any test is run. This will fix
the out-of-tree test failures introduced in commit
ecb073bdd6 on the 'main' branch.
2021-03-24 08:55:24 +01:00
Matthijs Mekking c2c5701dfe Merge branch '2488-refresh-keys-after-rndc-rollover' into 'main'
Rekey immediately after rndc checkds/rollover

Closes #2488

See merge request isc-projects/bind9!4813
2021-03-22 13:35:12 +00:00
Matthijs Mekking 82d667e1d5 Fix some intermittent kasp failures
When calling "rndc dnssec -checkds", it may take some milliseconds
before the appropriate changes have been written to the state file.
Add retry_quiet mechanisms to allow the write operation to finish.

Also retry_quiet the check for the next key event. A "rndc dnssec"
command may trigger a zone_rekey event and this will write out
a new "next key event" log line, but it may take a bit longer than
than expected in the tests.
2021-03-22 11:58:26 +01:00
Matthijs Mekking 82f72ae249 Rekey immediately after rndc checkds/rollover
Call 'dns_zone_rekey' after a 'rndc dnssec -checkds' or 'rndc dnssec
-rollover' command is received, because such a command may influence
the next key event. Updating the keys immediately avoids unnecessary
rollover delays.

The kasp system test no longer needs to call 'rndc loadkeys' after
a 'rndc dnssec -checkds' or 'rndc dnssec -rollover' command.
2021-03-22 11:58:26 +01:00
Matthijs Mekking 28923bc695 Merge branch '2517-cds-dnskey-delete-records-prevent-loading-unsigned-zone' into 'main'
Resolve "CDS and CDNSKEY DELETE records prevent (re-)loading unsigned zone"

Closes #2517

See merge request isc-projects/bind9!4810
2021-03-22 10:06:45 +00:00
Matthijs Mekking 841e90c6fc Add CHANGES and notes for [#2517] 2021-03-22 10:31:23 +01:00
Matthijs Mekking 6f31f62d69 Delete CDS/CDNSKEY records when zone is unsigned
CDS/CDNSKEY DELETE records are only useful if they are signed,
otherwise the parent cannot verify these RRsets anyway. So once the DS
has been removed (and signaled to BIND), we can remove the DNSKEY and
RRSIG records, and at this point we can also remove the CDS/CDNSKEY
records.
2021-03-22 10:30:59 +01:00
Matthijs Mekking f211c7c2a1 Allow CDS/CDNSKEY DELETE records in unsigned zone
While not useful, having a CDS/CDNSKEY DELETE record in an unsigned
zone is not an error and "named-checkzone" should not complain.
2021-03-22 10:25:30 +01:00
Matthijs Mekking 052ec16a44 Merge branch 'matthijs-test-keymgr2kasp' into 'main'
Test migrating to dnssec-policy

Closes #2544

See merge request isc-projects/bind9!4758
2021-03-22 09:09:06 +00:00
Matthijs Mekking d5531df79a Retry quiet check keys
Change the 'check_keys' function to try three times. Some intermittent
kasp test failures are because we are inspecting the key files
before the actual change has happen. The 'retry_quiet' approach allows
for a bit more time to let the write operation finish.
2021-03-22 09:50:05 +01:00
Matthijs Mekking 923c2a07bf Update copyrights for keymgr2kasp
This MR introduces a new system test 'keymgr2kasp' to test
migration to 'dnssec-policy'. It moves some existing tests from
the 'kasp' system test to here.

Also a common script 'kasp.sh', to be used in kasp specific tests,
is introduced.
2021-03-22 09:50:05 +01:00
Matthijs Mekking 27e7d5f698 Fix keymgr key init bug
The 'keymgr_key_init()' function initializes key states if they have
not been set previously. It looks at the key timing metadata and
determines using the given times whether a state should be set to
RUMOURED or OMNIPRESENT.

However, the DNSKEY and ZRRSIG states were mixed up: When looking
at the Activate timing metadata we should set the ZRRSIG state, and
when looking at the Published timing metadata we should set the
DNSKEY state.
2021-03-22 09:50:05 +01:00
Matthijs Mekking c40c1ebcb1 Test keymgr2kasp state from timing metadata
Add two test zones that migrate to dnssec-policy. Test if the key
states are set accordingly given the timing metadata.

The rumoured.kasp zone has its Publish/Active/SyncPublish times set
not too long ago so the key states should be set to RUMOURED. The
omnipresent.kasp zone has its Publish/Active/SyncPublish times set
long enough to set the key states to OMNIPRESENT.

Slightly change the init_migration_keys function to set the
key lifetime to "none" (legacy keys don't have lifetime). Then in the
test case set the expected key lifetime explicitly.
2021-03-22 09:50:05 +01:00
Matthijs Mekking f6fa254256 Editorial commit keymgr2kasp test
This commit is somewhat editorial as it does not introduce something
new nor fixes anything.

The layout in keymgr2kasp/tests.sh has been changed, with the
intention to make more clear where a test scenario ends and begins.

The publication time of some ZSKs has been changed. It makes a more
clear distinction between publication time and activation time.
2021-03-22 09:50:05 +01:00
Matthijs Mekking ecb073bdd6 Introduce kasp.sh
Add a script similar to conf.sh to include common functions and
variables for testing KASP. Currently used in kasp, keymgr2kasp, and
nsec3.
2021-03-22 09:50:05 +01:00
Matthijs Mekking 5389172111 Move kasp migration tests to different directory
The kasp system test was getting pretty large, and more tests are on
the way. Time to split up. Move tests that are related to migrating
to dnssec-policy to a separate directory 'keymgr2kasp'.
2021-03-22 09:50:05 +01:00
Michał Kępień ea26306eba Merge branch '1946-man-page-fixes' into 'main'
Man page fixes

See merge request isc-projects/bind9!4817
2021-03-22 08:39:38 +00:00
Michał Kępień 185a1a5643 Install man page for named-compilezone
The named-checkzone tool can also be invoked as named-compilezone.  Make
sure a man page is installed for that alias.  Move and rename the
"man_named-checkzone" label to prevent a Sphinx duplicate label warning
from being raised (see commit 84862e96c1
for more information).
2021-03-22 09:36:48 +01:00
Michał Kępień dcab218adc Install named-nzd2nzf man page conditionally
The named-nzd2nzf utility is only built and installed for LMDB-enabled
builds.  Adjust the relevant Makefile.am file to make sure the
named-nzd2nzf.1 man page is also only built and installed for
LMDB-enabled builds.
2021-03-22 09:36:48 +01:00
Michał Kępień ceedee0785 Install dnstap-read man page conditionally
The dnstap-read utility is only built and installed for dnstap-enabled
builds.  Adjust the relevant Makefile.am file to make sure the
dnstap-read.1 man page is also only built and installed for
dnstap-enabled builds.
2021-03-22 09:36:48 +01:00
Evan Hunt d04aa1d44e Merge branch 'placeholder' into 'main'
placeholder for #2575

See merge request isc-projects/bind9!4828
2021-03-20 19:16:16 +00:00
Evan Hunt c452c0a0a5 placeholder for #2575
Issue #2575 was merged to 9.16 only as change 5603, but a placeholder
was not added to CHANGES in the main branch. This commit adds the
placeholder and renumbers the two subsequent changes.
2021-03-20 12:11:11 -07:00
Evan Hunt 8e0902b731 Merge branch '2592-dig-clock-realtime' into 'main'
Resolve "dig -u is extremely inaccurate, especially on machines with the kernel timer tick set at 100Hz"

Closes #2592

See merge request isc-projects/bind9!4826
2021-03-20 18:58:16 +00:00
Evan Hunt 1933bcf1d3 CHANGES 2021-03-20 11:25:55 -07:00
Patrick McLeanandEvan Hunt 56cef1495f dig: Use high resolution clocks when microsecond accuracy is requested
The TIME_NOW macro calls isc_time_now which uses CLOCK_REALTIME_COARSE
for getting the current time. This is perfectly fine for millisecond,
however when the user request microsecond resolutiuon, they are going
to get very inaccurate results. This is especially true on a server
class machine where the clock ticks may be set to 100HZ.

This changes dig to use the new TIME_NOW_HIRES macro that uses the
CLOCK_MONOTONIC_RAW that is more expensive, but gets the *actual*
current time rather than the at the last kernel time tick.
2021-03-20 11:25:55 -07:00
Patrick McLeanandEvan Hunt ebced74b19 Add isc_time_now_hires function to get current time with high resolution
The current isc_time_now uses CLOCK_REALTIME_COARSE which only updates
on a timer tick. This clock is generally fine for millisecond accuracy,
but on servers with 100hz clocks, this clock is nowhere near accurate
enough for microsecond accuracy.

This commit adds a new isc_time_now_hires function that uses
CLOCK_REALTIME, which gives the current time, though it is somewhat
expensive to call. When microsecond accuracy is required, it may be
required to use extra resources for higher accuracy.
2021-03-20 11:25:55 -07:00
Ondřej Surý bee4ee931f Merge branch '2416-improve-netmgr-unit-tests-reliability' into 'main'
Improve reliability of the netmgr unit tests

Closes #2455 and #2416

See merge request isc-projects/bind9!4628
2021-03-19 16:22:22 +00:00
Ondřej Surý d96c94d754 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-03-19 16:25:28 +01:00
Ondřej SurýandOndřej Surý d016ea745f Fix compilation with NETMGR_TRACE(_VERBOSE) enabled on non-Linux
When NETMGR_TRACE(_VERBOSE) is enabled, the build would fail on some
non-Linux non-glibc platforms because:

  * Use <stdint.h> print macros because uint_fast32_t is not always
    unsigned long

  * The header <execinfo.h> is not available on non-glibc, thus commit
    adds dummy backtrace() and backtrace_symbols_fd() functions for
    platforms without HAVE_BACKTRACE
2021-03-19 16:25:28 +01:00
Ondřej SurýandOndřej Surý 42e4e3b843 Improve reliability of the netmgr unit tests
The netmgr unit tests were designed to push the system limits to maximum
by sending as many queries as possible in the busy loop from multiple
threads.  This mostly works with UDP, but in the stateful protocol where
establishing the connection takes more time, it failed quite often in
the CI.  On FreeBSD, this happened more often, because the socket() call
would fail spuriosly making the problem even worse.

This commit does several things to improve reliability:

* return value of isc_nm_<proto>connect() is always checked and retried
  when scheduling the connection fails

* The busy while loop has been slowed down with usleep(1000); so the
  netmgr threads could schedule the work and get executed.

* The isc_thread_yield() was replaced with usleep(1000); also to allow
  the other threads to do any work.

* Instead of waiting on just one variable, we wait for multiple
  variables to reach the final value

* We are wrapping the netmgr operations (connects, reads, writes,
  accepts) with reference counting and waiting for all the callbacks to
  be accounted for.

  This has two effects:

  a) the isc_nm_t is always clean of active sockets and handles when
     destroyed, so it will prevent the spurious INSIST(references == 1)
     from isc_nm_destroy()

  b) the unit test now ensures that all the callbacks are always called
     when they should be called, so any stuck test means that there was
     a missing callback call and it is always a real bug

These changes allows us to remove the workaround that would not run
certain tests on systems without port load-balancing.
2021-03-19 16:25:28 +01:00
Ondřej Surý e8cd3d3cf7 Merge branch 'ondrej/call-failed_read-from-tls_error' into 'main'
Call isc__nm_tlsdns_failed_read on tls_error to cleanup the socket

See merge request isc-projects/bind9!4824
2021-03-19 14:57:53 +00:00
Ondřej Surý e4e0e9e3c1 Call isc__nm_tlsdns_failed_read on tls_error to cleanup the socket
In tls_error(), we now call isc__nm_tlsdns_failed_read() instead of just
stopping timer and reading from the socket.  This allows us to properly
cleanup any pending operation on the socket.
2021-03-19 15:28:52 +01:00
Matthijs Mekking 085c2e3249 Merge branch 'treysis-filter-a' into 'main'
filter-a plugin

Closes #2585

See merge request isc-projects/bind9!4816
2021-03-19 09:41:02 +00:00
Matthijs Mekking 9a256347ab Add changes for filter-a plugin 2021-03-19 08:06:55 +01:00
treysisandMatthijs Mekking 6b2ea00621 Add filter-a plugin for IPv6-dominant environments
(cherry picked from commit 78f6cd57e1cc166823415438fe2d19a324cf7a67)
2021-03-19 08:06:55 +01:00
Ondřej Surý 6ae0a90583 Merge branch '2581-oldsize-assertion' into 'main'
Fix memory accounting bug in TLSDNS

Closes #2581

See merge request isc-projects/bind9!4809
2021-03-18 22:03:25 +00:00
Ondřej SurýandEvan Hunt e4b0730387 Call the isc__nm_failed_connect_cb() early when shutting down
When shutting down, calling the isc__nm_failed_connect_cb() was delayed
until the connect callback would be called.  It turned out that the
connect callback might not get called at all when the socket is being
shut down.  Call the failed_connect_cb() directly in the
tlsdns_shutdown() instead of waiting for the connect callback to call it.
2021-03-18 14:31:15 -07:00
Ondřej Surý 73c574e553 Fix typo in processbuffer() - tcpdns vs tlsdns
The processbuffer() would call isc__nm_tcpdns_processbuffer() instead of
isc__nm_tlsdns_processbuffer() for the isc_nm_tlsdnssocket type of
socket.
2021-03-18 21:35:13 +01:00
Ondřej Surý 1d64d4cde8 Fix memory accounting bug in TLSDNS
After a partial write the tls.senddata buffer would be rearranged to
contain only the data tha wasn't sent and the len part would be made
shorter, which would lead to attempt to free only part of a socket's
tls.senddata buffer.
2021-03-18 18:14:38 +01:00
Ondřej Surý 15f676f111 Merge branch 'ondrej/fix-dangling-uvreq-in-tlsdns' into 'main'
Fix dangling uvreq when data is sent from tlsdns_cycle()

See merge request isc-projects/bind9!4820
2021-03-18 17:02:18 +00:00
Ondřej Surý 5cc406a920 Fix dangling uvreq when data is sent from tlsdns_cycle()
The tlsdns_cycle() might call uv_write() to write data to the socket,
when this happens and the socket is shutdown before the callback
completes, the uvreq structure was not freed because the callback would
be called with non-zero status code.
2021-03-18 17:58:56 +01:00
Ondřej Surý 06913d3d74 Merge branch '2573-dont-timeout-when-sending-data' into 'main'
Resolve "Fix TCPDNS and TLSDNS timers"

Closes #2583 and #2573

See merge request isc-projects/bind9!4807
2021-03-18 16:01:01 +00:00
Michal Nowak 2edba8777f Merge branch 'v9_17_11-release' into 'main'
Merge 9.17.11 release branch

See merge request isc-projects/bind9!4818
2021-03-18 15:38:54 +00:00
Ondřej Surý 98f7495426 Add CHANGES and release note for GL #2573 2021-03-18 16:37:57 +01:00
Ondřej Surý 36ddefacb4 Change the isc_nm_(get|set)timeouts() to work with milliseconds
The RFC7828 specifies the keepalive interval to be 16-bit, specified in
units of 100 milliseconds and the configuration options tcp-*-timeouts
are following the suit.  The units of 100 milliseconds are very
unintuitive and while we can't change the configuration and presentation
format, we should not follow this weird unit in the API.

This commit changes the isc_nm_(get|set)timeouts() functions to work
with milliseconds and convert the values to milliseconds before passing
them to the function, not just internally.
2021-03-18 16:37:57 +01:00
Ondřej Surý 1ef232f93d Merge the common parts between udp, tcpdns and tlsdns protocol
The udp, tcpdns and tlsdns contained lot of cut&paste code or code that
was very similar making the stack harder to maintain as any change to
one would have to be copied to the the other protocols.

In this commit, we merge the common parts into the common functions
under isc__nm_<foo> namespace and just keep the little differences based
on the socket type.
2021-03-18 16:37:57 +01:00
Ondřej Surý caa5b6548a Fix TCPDNS and TLSDNS timers
After the TCPDNS refactoring the initial and idle timers were broken and
only the tcp-initial-timeout was always applied on the whole TCP
connection.

This broke any TCP connection that took longer than tcp-initial-timeout,
most often this would affect large zone AXFRs.

This commit changes the timeout logic in this way:

  * On TCP connection accept the tcp-initial-timeout is applied
    and the timer is started
  * When we are processing and/or sending any DNS message the timer is
    stopped
  * When we stop processing all DNS messages, the tcp-idle-timeout
    is applied and the timer is started again
2021-03-18 16:37:57 +01:00
Ondřej Surý 64cff61c02 Add TCP timeouts system test
The system tests were missing a test that would test tcp-initial-timeout
and tcp-idle-timeout.

This commit adds new "timeouts" system test that adds:

  * Test that waits longer than tcp-initial-timeout and then checks
    whether the socket was closed

  * Test that sends and receives DNS message then waits longer than
    tcp-initial-timeout but shorter time than tcp-idle-timeout than
    sends DNS message again than waits longer than tcp-idle-timeout
    and checks whether the socket was closed

  * Similar test, but bursting 25 DNS messages than waiting longer than
    tcp-initial-timeout and shorter than tcp-idle-timeout than do second
    25 DNS message burst

  * Check whether transfer longer than tcp-initial-timeout succeeds
2021-03-18 16:37:57 +01:00
Michal Nowak 3265dfa929 Set up release notes for BIND 9.17.12 2021-03-18 15:58:15 +01:00
Michal Nowak 8853ec09a5 Update BIND version to 9.17.11 2021-03-18 15:55:36 +01:00
Michal Nowak 9d4da23850 Add a CHANGES marker 2021-03-18 15:55:32 +01:00
Michal Nowak a8b525290f Merge branch 'mnowak/prepare-documentation-for-bind-9.17.11' into 'v9_17_11-release'
Prepare documentation for BIND 9.17.11

See merge request isc-private/bind9!252
2021-03-18 15:55:11 +01:00
Michal Nowak 924f8ceb06 Prepare release notes for BIND 9.17.11 2021-03-18 15:55:11 +01:00
Michal Nowak e6ca82b2c4 Add release notes for GL #2472 2021-03-18 15:55:10 +01:00
Michal Nowak 566b8ab85e Add release note for GL #2504 2021-03-18 15:55:10 +01:00
Michal Nowak baf79279f0 Add release note for GL #2041 2021-03-18 15:55:10 +01:00
Michal Nowak 70076fb7c8 Reorder release notes 2021-03-18 15:55:10 +01:00
Michal Nowak b66bb0c89e Tweak and reword release notes 2021-03-18 15:54:41 +01:00
Michal Nowak 188d605c2a Tweak and reword recent CHANGES entries 2021-03-18 15:53:30 +01:00
Michal Nowak 68128f2092 Release template: update the -S edition delivery tickets
Change requested by the Support team.
2021-03-18 15:53:30 +01:00
Mark Andrews ffea605679 Merge branch '2580-does-not-compile-without-deprecated-openssl-apis' into 'main'
Resolve "Does not compile without deprecated OpenSSL APIs"

Closes #2580

See merge request isc-projects/bind9!4806
2021-03-17 20:10:11 +00:00
Mark Andrews a9f883cbc2 Stop using deprecated calls in lib/isc/tls.c
from Rosen Penev @neheb
2021-03-17 20:05:47 +00:00
Matthijs Mekking 8d8373c21c Merge branch '2523-thaw-dnssec-policy-zone' into 'main'
Resolve "Unable to thaw a frozen dynamic zone when KASP is configured."

Closes #2523

See merge request isc-projects/bind9!4777
2021-03-17 10:11:13 +00:00
Matthijs Mekking 0cae3249e3 Add test for thaw dynamic kasp zone
Add a test for freezing, manually updating, and then thawing a dynamic
zone with "dnssec-policy". In the kasp system test we add parameters
to the "update_is_signed" check to signal the indicated IP addresses
for the labels "a" and "d". If set to '-', the test is skipped.

After nsupdating the dynamic.kasp zone, we revert the update (with
nsupdate) and update the zone again, but now with the freeze/thaw
approach.
2021-03-17 08:24:17 +01:00
Matthijs Mekking b90846f222 Fully sign a thawed zone
When thawing a zone, we don't know what changes have been made. If we
do DNSSEC maintenance on this zone, schedule a full sign.
2021-03-17 08:24:17 +01:00
Matthijs Mekking b518ed9f46 Fix "unable to thaw dynamic kasp zone"
Dynamic zones with dnssec-policy could not be thawed because KASP
zones were considered always dynamic. But a dynamic KASP zone should
also check whether updates are disabled.
2021-03-17 08:24:15 +01:00
Matthijs Mekking 0eb0dabdcc Merge branch '2561-dnssec-guide-signing-type' into 'main'
Fix typo in DNSSEC Guide

Closes #2561

See merge request isc-projects/bind9!4791
2021-03-16 13:37:32 +00:00
Matthijs Mekking d45af8877a Fix typo in DNSSEC Guide
The "dnssec-policy" example should say "keys" instead of "key".
2021-03-16 13:37:16 +00:00
Artem Boldariev 50eaa0f38f Merge branch '2514-tls-cert-chain' into 'main'
Load full certificate chain from a certificate chain file

Closes #2514

See merge request isc-projects/bind9!4792
2021-03-16 10:33:35 +00:00
Matthijs MekkingandArtem Boldariev c69fafdd65 Add change entry for [#2514] 2021-03-16 11:50:32 +02:00
Artem Boldariev 75363dcb7c Load full certificate chain from a certificate chain file
This commit fixes loading the certificate chain files so that the full
chain could be sent to the clients which require that for
verification. Before that fix only the top most certificate would be
loaded from the chain and sent to clients preventing some of them to
perform certificate validation (e.g. Windows 10 DoH client).
2021-03-16 11:49:04 +02:00
Matthijs Mekking 6dee5c1b28 Merge branch '2562-xot-crash' into 'main'
Fix a XoT crash

Closes #2562

See merge request isc-projects/bind9!4803
2021-03-16 09:42:18 +00:00
Matthijs Mekking ee0835d977 Fix a XoT crash
The transport should also be detached when we skip a master, otherwise
named will crash when sending a SOA query to the next master over TLS,
because the transport must be NULL when we enter
'dns_view_gettransport'.
2021-03-16 10:11:12 +01:00
Mark Andrews 24c796942f Merge branch '2569-nsupdate-on-solaris-produces-different-failure-text-than-expected' into 'main'
Resolve "nsupdate on Solaris produces different failure text than expected"

Closes #2569

See merge request isc-projects/bind9!4804
2021-03-16 00:11:02 +00:00
Mark Andrews 25d1276170 Ignore the actual error code returned by getaddrinfo
when testing if interactive mode continues or not on
invalid hostname.  We only need to detect that getaddrinfo
failed and that we continued or not.
2021-03-16 10:20:28 +11:00
Mark Andrews a9339fe7fc Merge branch '2567-warning-array-subscript-is-of-type-char-on-netbsd-9' into 'main'
Resolve "warning: array subscript is of type 'char' on NetBSD 9"

Closes #2567

See merge request isc-projects/bind9!4794
2021-03-15 03:33:21 +00:00
Mark Andrews d768336cc6 Add CHANGES for [GL #2567] 2021-03-15 14:18:46 +11:00
Mark Andrews 99bd0c346f cast (char) to (unsigned char) when calling is*() 2021-03-15 14:18:03 +11:00
Michal Nowak e391209212 Merge branch '2565-servestale-fetchlimits-crash' into 'main'
Fix servestale fetchlimits crash

Closes #2565

See merge request isc-projects/bind9!4797
2021-03-11 12:14:47 +00:00
Matthijs Mekking 87591de6f7 Fix servestale fetchlimits crash
When we query the resolver for a domain name that is in the same zone
for which is already one or more fetches outstanding, we could
potentially hit the fetch limits. If so, recursion fails immediately
for the incoming query and if serve-stale is enabled, we may try to
return a stale answer.

If the resolver is also is authoritative for the parent zone (for
example the root zone), first a delegation is found, but we first
check the cache for a better response.

Nothing is found in the cache, so we try to recurse to find the
answer to the query.

Because of fetch-limits 'dns_resolver_createfetch()' returns an error,
which 'ns_query_recurse()' propagates to the caller,
'query_delegation_recurse()'.

Because serve-stale is enabled, 'query_usestale()' is called,
setting 'qctx->db' to the cache db, but leaving 'qctx->version'
untouched. Now 'query_lookup()' is called to search for stale data
in the cache database with a non-NULL 'qctx->version'
(which is set to a zone db version), and thus we hit an assertion
in rbtdb.

This crash was introduced in 'main' by commit
8bcd7fe69e.
2021-03-11 12:16:14 +01:00
Ondřej Surý 74a0294be0 Merge branch '2568-test_client-c-error-static-declaration-of-yield-follows-non-static-declaration-on-solaris' into 'main'
Resolve "test_client.c: error: static declaration of 'yield' follows non-static declaration on Solaris"

Closes #2568

See merge request isc-projects/bind9!4795
2021-03-11 06:09:49 +00:00
Mark Andrews af0ee2c718 Rename 'yield' to 'waitforsignal' due to namespace clash 2021-03-11 11:34:15 +11:00
Michał Kępień 77ac8db0c6 Merge branch '2556-fix-documentation-for-the-max-ixfr-ratio-option' into 'main'
Fix documentation for the "max-ixfr-ratio" option

Closes #2556

See merge request isc-projects/bind9!4787
2021-03-08 11:28:37 +00:00
Michał Kępień 3878cf4ac5 Fix documentation for the "max-ixfr-ratio" option
Commit 9fb6d11abb (which converted BIND 9
documentation from DocBook to Sphinx) inadvertently removed a paragraph
from the description of the "max-ixfr-ratio" option.  Add the missing
paragraph back.
2021-03-08 12:27:39 +01:00
Ondřej Surý 8bd1da8e4e Merge branch 'ondrej/disable-github-pr-fix' into 'main'
Fix syntax error in GitHub Actions lockdown.yml file

See merge request isc-projects/bind9!4789
2021-03-08 11:25:15 +00:00
Ondřej Surý c4a4ee2db9 Fix syntax error in GitHub Actions lockdown.yml file 2021-03-08 12:24:17 +01:00
Ondřej Surý 494057b8f4 Merge branch 'ondrej/disable-github-pr' into 'main'
Add GitHub Action that immediately closes issue / PRs

See merge request isc-projects/bind9!4788
2021-03-08 11:13:24 +00:00
Ondřej Surý 2463f62c93 Add GitHub Action that immediately closes issue / PRs
Unfortunately, it's not possible to disable Pull Requests on the
mirrored repository on the GitHub, so this commit adds external action
that closes any new open Issue or Pull Requests instead letting them rot
unnoticed.
2021-03-08 12:09:14 +01:00
Ondřej Surý 42e8db9e74 Merge branch '2555-workaround-truncated-64-bit-enum-in-journal-on-windows' into 'main'
Resolve "journal test fails on Windows"

Closes #2555

See merge request isc-projects/bind9!4784
2021-03-08 08:42:14 +00:00
Evan HuntandOndřej Surý 990dd9dbff fix automatic journal upgrade on windows
- use a value less than 2^32 for DNS_ZONEFLG_FIXJOURNAL; a larger value
  could cause problems in some build environments. the zone flag
  DNS_ZONEFLG_DIFFONRELOAD, which was no longer in use, has now been
  deleted and its value reused for _FIXJOURNAL.
2021-03-08 08:51:34 +01:00
Evan HuntandOndřej Surý 46c11726d4 add start and end serial numbers to 'named-printjournal -x'
add the starting and ending serial number from the journal
header to the output of dns_journal_print().
2021-03-08 08:51:34 +01:00
Mark Andrews bc714bc5c5 Merge branch '2559-cid-329159-logically-dead-code-in-lib-dns-journal-c' into 'main'
Resolve "CID 329159: Logically dead code in lib/dns/journal.c"

Closes #2559

See merge request isc-projects/bind9!4780
2021-03-08 05:25:17 +00:00
Mark Andrews 848e336db4 Silence CID 329159: Logically dead code in lib/dns/journal.c
*** CID 329159:    (DEADCODE)
    /lib/dns/journal.c: 1719 in dns_journal_print()
    1713     		}
    1714     		CHECK(dns_difftuple_create(
    1715     			diff.mctx, n_soa == 1 ? DNS_DIFFOP_DEL : DNS_DIFFOP_ADD,
    1716     			name, ttl, rdata, &tuple));
    1717     		dns_diff_append(&diff, &tuple);
    1718
    >>>     CID 329159:    (DEADCODE)
    >>>     Execution cannot reach the expression "printxhdr" inside this statement: "if (++n_put != 0U || printx...".
    1719     		if (++n_put != 0 || printxhdr) {
    1720     			result = dns_diff_print(&diff, file);
    1721     			dns_diff_clear(&diff);
    1722     			n_put = 0;
    1723     			if (result != ISC_R_SUCCESS) {
    1724     				break;
    /lib/dns/journal.c: 1734 in dns_journal_print()
    1728     	if (result == ISC_R_NOMORE) {
    1729     		result = ISC_R_SUCCESS;
    1730     	}
    1731     	CHECK(result);
    1732
    1733     	if (!printxhdr && n_put != 0) {
    >>>     CID 329159:    (DEADCODE)
    >>>     Execution cannot reach this statement: "result = dns_diff_print(&di...".
    1734     		result = dns_diff_print(&diff, file);
    1735     		dns_diff_clear(&diff);
    1736     	}
    1737     	goto cleanup;
    1738
    1739     failure:
2021-03-08 05:06:29 +00:00
Mark Andrews 279c8a837b Merge branch '2560-cid-329157-dereference-before-null-check-in-lib-dns-journal-c' into 'main'
Resolve "CID 329157: Dereference before null check in lib/dns/journal.c"

Closes #2560

See merge request isc-projects/bind9!4779
2021-03-08 05:06:06 +00:00
Mark Andrews 4054405909 Silence CID 329157: Dereference before null check in lib/dns/journal.c
*** CID 329157:  Null pointer dereferences  (REVERSE_INULL)
    /lib/dns/journal.c: 754 in journal_open()
    748     			    j->header.index_size * sizeof(journal_rawpos_t));
    749     	}
    750     	if (j->index != NULL) {
    751     		isc_mem_put(j->mctx, j->index,
    752     			    j->header.index_size * sizeof(journal_pos_t));
    753     	}
       CID 329157:  Null pointer dereferences  (REVERSE_INULL)
       Null-checking "j->filename" suggests that it may be null, but it has already been dereferenced on all paths leading to the check.
    754     	if (j->filename != NULL) {
    755     		isc_mem_free(j->mctx, j->filename);
    756     	}
    757     	if (j->fp != NULL) {
    758     		(void)isc_stdio_close(j->fp);
    759     	}
2021-03-08 05:05:28 +00:00
Mark Andrews 27117f7b46 Merge branch 'marka-add-journal-to-conf-sh-common' into 'main'
Add journal to conf.sh.common

See merge request isc-projects/bind9!4781
2021-03-08 01:12:54 +00:00
Mark Andrews 926b9056b7 add journal to conf.sh.common 2021-03-08 11:36:00 +11:00
Artem Boldariev d6f33fcd6c Merge branch '1641-doh-dig' into 'main'
Resolve "RFC8484, DoH support in DIG (and any other relevant utilities)"

Closes #2464 and #1641

See merge request isc-projects/bind9!4672
2021-03-05 16:46:02 +00:00
Evan HuntandArtem Boldariev f3b13c6027 CHANGES, release notes 2021-03-05 18:09:42 +02:00
Evan HuntandArtem Boldariev dbffb212ce add basic DoH system tests
- rename dot to doth, as it now covers both dot and doh.
- merge xot into doth as it's closely related.
- added long-lived key and cert files (expiring 2121).
- add tests with https-get, https-post, http-plain, alternate
  endpoints, and both static and ephemeral TLS configuration.
- incidentally fixed a memory leak in dig that occurred if +https
  was specified more than once.
2021-03-05 18:09:42 +02:00
Artem Boldariev 7a59fb8207 Disable Nagle's algorithm for HTTP/2 connections
It is advisable to disable Nagle's algorithm for HTTP/2 connections
because multiple HTTP/2 streams could be multiplexed over one
transport connection. Thus, delays when delivering small packets could
bring down performance for the whole session. HTTP/2 is meant to be
used this way.
2021-03-05 18:09:42 +02:00
Artem Boldariev 66d20cf28b Fix deadlock in isc_nm_tlsconnect()
when called from within the context of a network thread,
isc_nm_tlsconnect() hangs. it is waiting for the socket's
result code to be updated, but that update is supposed to happen
asynchronously in the network thread, and if we're already blocking
in the network thread, it can never occur.

we can kluge around this by setting the socket result code
early; this works for most clients (including "dig"), but it causes
inconsistent behaviors that manifest as test failures in the DoH unit
test.

so we kluged around it even more by setting the socket result code
early *only when running in the network thread*. we need a better
solution for this problem, but this will do for now.
2021-03-05 18:09:22 +02:00
Artem Boldariev ca9a15e3bc DoH: call send callbacks after data was actually sent 2021-03-05 13:29:32 +02:00
Artem Boldariev 71668437d4 Put sane limitations in place to handle bad requests gracefully
This commit makes the server-side code polite.

It fixes the error handling code on the server side and fixes
returning error code in responses (there was a nasty bug which could
potentially crash the server).

Also, in this commit we limit max size POST request data to 96K, max
processed data size in headers to 128K (should be enough to handle any
GET requests).

If these limits are surpassed, server will terminate the request with
RST_STREAM without responding with error code. Otherwise it politely
responds with error code.

This commit also limits number of concurrent HTTP/2 streams per
transport connection on server to 100 (as nghttp2 advises by default).

Ideally, these parameters should be configurable both globally and per
every HTTP endpoint description in the configuration file, but for now
putting sane limits should be enough.
2021-03-05 13:29:32 +02:00
Evan HuntandArtem Boldariev 88752b1121 refactor outgoing HTTP connection support
- style, cleanup, and removal of unnecessary code.
- combined isc_nm_http_add_endpoint() and isc_nm_http_add_doh_endpoint()
  into one function, renamed isc_http_endpoint().
- moved isc_nm_http_connect_send_request() into doh_test.c as a helper
  function; remove it from the public API.
- renamed isc_http2 and isc_nm_http2 types and functions to just isc_http
  and isc_nm_http, for consistency with other existing names.
- shortened a number of long names.
- the caller is now responsible for determining the peer address.
  in isc_nm_httpconnect(); this eliminates the need to parse the URI
  and the dependency on an external resolver.
- the caller is also now responsible for creating the SSL client context,
  for consistency with isc_nm_tlsdnsconnect().
- added setter functions for HTTP/2 ALPN. instead of setting up ALPN in
  isc_tlsctx_createclient(), we now have a function
  isc_tlsctx_enable_http2client_alpn() that can be run from
  isc_nm_httpconnect().
- refactored isc_nm_httprequest() into separate read and send functions.
  isc_nm_send() or isc_nm_read() is called on an http socket, it will
  be stored until a corresponding isc_nm_read() or _send() arrives; when
  we have both halves of the pair the HTTP request will be initiated.
- isc_nm_httprequest() is renamed isc__nm_http_request() for use as an
  internal helper function by the DoH unit test. (eventually doh_test
  should be rewritten to use read and send, and this function should
  be removed.)
- added implementations of isc__nm_tls_settimeout() and
  isc__nm_http_settimeout().
- increased NGHTTP2 header block length for client connections to 128K.
- use isc_mem_t for internal memory allocations inside nghttp2, to
  help track memory leaks.
- send "Cache-Control" header in requests and responses. (note:
  currently we try to bypass HTTP caching proxies, but ideally we should
  interact with them: https://tools.ietf.org/html/rfc8484#section-5.1)
2021-03-05 13:29:26 +02:00
Ondřej SurýandArtem Boldariev 9c8b7a5c45 add preliminary DoH client support to dig
add options "+https", "+https-get" and "+http-plain" to
allow dig to connect over HTTP/2 channels.
2021-03-05 13:28:17 +02:00
Ondřej Surý 13d23b0c8e Merge branch '1529-add-threadsanitizer-core-dumping-flags-when-we-are-threadsanitizer-clean' into 'main'
Resolve "Add ThreadSanitizer core dumping flags when we are ThreadSanitizer-clean"

Closes #1529

See merge request isc-projects/bind9!4774
2021-03-04 15:25:00 +00:00
Ondřej Surý 4072cc2b93 Disable allow_failure for ThreadSanitizer jobs
Since the main branch is now TSAN-clean, it's a good opportunity to
enable hard failures for the TSAN system test jobs.
2021-03-04 15:32:55 +01:00
Michal NowakandOndřej Surý a730bc47f5 Add ThreadSanitizer core dumping flags
This should let us have core dumps from crashed system test when
ThreadSanitizer is enabled.
2021-03-04 15:32:50 +01:00
Ondřej Surý 80f01cbf42 Merge branch '2455-tcpdns_test-c-runtime-error-load-of-misaligned-address-for-type-uint64_t' into 'main'
Assigning uint64_t from buffer might be misaligned in netmgr tests

Closes #2455

See merge request isc-projects/bind9!4769
2021-03-04 14:28:11 +00:00
Ondřej Surý a55bdb28f9 Assigning uint64_t from buffer might be misaligned in netmgr tests
Resolve possible 8-byte unaligned access when assigning the magic
value from the received buffer.
2021-03-04 15:02:24 +01:00
Ondřej Surý cb9df06f7d Merge branch '2533-mdig-move-cleanup' into 'main'
Move cleanup of queries to later in the shutdown sequence

Closes #2533

See merge request isc-projects/bind9!4768
2021-03-04 14:01:15 +00:00
Mark AndrewsandOndřej Surý 4015af02d8 Move cleanup of queries to later in the shutdown sequence
to avoid TSAN report

    WARNING: ThreadSanitizer: data race
      Write of size 8 at 0x000000000001 by main thread:
        #0 free <null>
        #1 default_memfree lib/isc/mem.c:440
        #2 mem_put lib/isc/mem.c:363
        #3 isc__mem_free lib/isc/mem.c:1012
        #4 main bin/tools/mdig.c:2231

      Previous read of size 1 at 0x000000000005 by thread T1:
        #0 dns_name_fromtext lib/dns/name.c:1121
        #1 sendquery bin/tools/mdig.c:596
        #2 sendqueries bin/tools/mdig.c:779
        #3 dispatch lib/isc/task.c:1153
        #4 run lib/isc/task.c:1345
        #5 isc__trampoline_run lib/isc/trampoline.c:184
        #6 <null> <null>

      Thread T1 (running) created by main thread at:
        #0 pthread_create <null>
        #1 isc_thread_create pthreads/thread.c:79
        #2 isc_taskmgr_create lib/isc/task.c:1435
        #3 main bin/tools/mdig.c:2148

    SUMMARY: ThreadSanitizer: data race in __interceptor_free
2021-03-04 13:21:56 +01:00
Michal Nowak 1f8463a6e9 Merge branch '2357-add-CHANGES-entry' into 'main'
Add CHANGES entry for GL #2357

Closes #2357

See merge request isc-projects/bind9!4770
2021-03-04 11:45:06 +00:00
Michal Nowak d98f72de25 Add CHANGES entry for GL #2357 2021-03-04 12:26:58 +01:00
Ondřej Surý b532eb3029 Merge branch '2552-comparison-between-signed-and-unsigned-on-arm7' into 'main'
Fix comparison between signed and unsigned integer expressions

Closes #2552

See merge request isc-projects/bind9!4766
2021-03-04 10:24:00 +00:00
Ondřej SurýandOndřej Surý d3bb3ae64f Fix comparison between signed and unsigned integer expressions
Simple typecast to size_t should be enough to silence the warning on
ARMv7, even though the code is in fact correct, because the readlen is
checked for being < 0 in the block before the warning.
2021-03-04 11:21:43 +01:00
Ondřej Surý 2c9c16e334 Merge branch '2551-char-is-unsigned-on-arm64' into 'main'
Use int type to store result from isc_commandline_parse()

Closes #2551

See merge request isc-projects/bind9!4765
2021-03-04 10:20:18 +00:00
Ondřej Surý 8153729d3a Use int type to store result from isc_commandline_parse()
The C standard actually doesn't define char as signed or unsigned, and
it could be either according to underlying architecture.  It turns out
that while it's usually signed type, it isn't on arm64 where it's
unsigned.

isc_commandline_parse() return int, just use that instead of the char.
2021-03-04 10:43:00 +01:00
Mark Andrews fc57dd4c41 Merge branch '2298-multiple-definition-of-librpz_dnsrpzd_path' into 'main'
Resolve "multiple definition of `librpz_dnsrpzd_path'"

Closes #2298

See merge request isc-projects/bind9!4703
2021-03-04 08:22:16 +00:00
Mark Andrews e12cf5eb57 Add CHANGES for [GL #2298] 2021-03-04 19:21:44 +11:00
Mark Andrews 8f016dd57a Fixed librpz_dnsrpzd_path being a duplicate symbol
librpz_dnsrpzd_path should have been declared extern in dns/librpz.h
2021-03-04 19:20:59 +11:00
Evan Hunt add81d6480 Merge branch '2505-journal-compatibility' into 'main'
allow dns_journal_rollforward() to read old journal files

Closes #2505

See merge request isc-projects/bind9!4720
2021-03-04 03:18:42 +00:00
Evan Hunt 82b82bb821 CHANGES, release note 2021-03-03 17:54:47 -08:00
Evan Hunt a0aefa1de6 create 'journal' system test
tests that version 1 journal files containing version 1 transaction
headers are rolled forward correctly on server startup, then updated
into version 2 journals. also checks journal file consistency and
'max-journal-size' behavior.
2021-03-03 17:54:47 -08:00
Evan Hunt a4972324a6 print journal index data and test for consistency
'named-journalprint -x' now prints the journal's index table and
the offset of each transaction in the journal, so that index consistency
can be confirmed.
2021-03-03 17:54:47 -08:00
Mark AndrewsandEvan Hunt fb2d0e2897 extend named-journalprint to be able to force the journal version
named-journalprint can now upgrade or downgrade a journal file
in place; the '-u' option upgrades and the '-d' option downgrades.
2021-03-03 17:54:47 -08:00
Evan Hunt ee19966326 allow dns_journal_rollforward() to read old journal files
when the 'max-ixfr-ratio' option was added, journal transaction
headers were revised to include a count of RR's in each transaction.
this made it impossible to read old journal files after an upgrade.

this branch restores the ability to read version 1 transaction
headers. when rolling forward, printing journal contents, if
the wrong transaction header format is found, we can switch.

when dns_journal_rollforward() detects a version 1 transaction
header, it returns DNS_R_RECOVERABLE.  this triggers zone_postload()
to force a rewrite of the journal file in the new format, and
also to schedule a dump of the zone database with minimal delay.
journal repair is done by dns_journal_compact(), which rewrites
the entire journal, ignoring 'max-journal-size'. journal size is
corrected later.

newly created journal files now have "BIND LOG V9.2" in their headers
instead of "BIND LOG V9". files with the new version string cannot be
read using the old transaction header format. note that this means
newly created journal files will be rejected by older versions of named.

named-journalprint now takes a "-x" option, causing it to print
transaction header information before each delta, including its
format version.
2021-03-03 17:54:47 -08:00
Ondřej Surý 695caaf8d6 Merge branch 'ondrej/call-isc__initialize-shutdown-from-DllMain' into 'main'
Call isc__initialize()/isc__shutdown() from win32 DllMain

See merge request isc-projects/bind9!4759
2021-03-02 07:48:19 +00:00
Ondřej Surý a50f5d0cf5 Call isc__initialize()/isc__shutdown() from win32 DllMain
Call the libisc isc__initialize() constructor and isc__shutdown()
destructor from DllMain instead of having duplicate code between
those and DllMain() code.
2021-03-01 14:24:57 +01:00
Evan Hunt 8795b12c49 Merge branch 'ondrej/improve-mempool-AddressSanitizer-integration' into 'main'
Improve allocation-deallocation tracking with AddressSanitizer

See merge request isc-projects/bind9!4748
2021-02-26 18:26:28 +00:00
Ondřej SurýandEvan Hunt 888bdfc1ff Add mempool get/put tracking with AddressSanitizer
When AddressSanitizer is in use, disable the internal mempool
implementation and redirect the isc_mempool_get to isc_mem_get
(and similarly for isc_mempool_put).  This is the method recommended
by the AddressSanitizer authors for tracking allocations and
deallocations instead of custom poison/unpoison code (see
https://github.com/google/sanitizers/wiki/AddressSanitizerManualPoisoning).
2021-02-26 10:05:42 -08:00
Ondřej Surý aa8f730a22 Merge branch '2396-add-thread-trampoline-for-thread-accounting' into 'main'
Resolve "BIND 9.16 unit tests failing reliably on x86_64 NUMA machines"

Closes #2396

See merge request isc-projects/bind9!4687
2021-02-26 12:44:15 +00:00
Ondřej Surý 4f2ca15201 Add CHANGES note for GL #2396 2021-02-25 16:21:43 +01:00
Ondřej Surý a0181056a8 Change the isc_thread_self() return type to uintptr_t
The pthread_self(), thrd_current() or GetCurrentThreadId() could
actually be a pointer, so we should rather convert the value into
uintptr_t instead of unsigned long.
2021-02-25 16:21:10 +01:00
Ondřej Surý bea333f7c9 Use globally assigned thread_id in the isc_hp API
Convert the isc_hp API to use the globally available isc_tid_v instead
of locally defined tid_v.  This should solve most of the problems on
machines with many number of cores / CPUs.
2021-02-25 16:21:10 +01:00
Ondřej Surý cbbecfcc82 Add isc_trampoline API to have simple accounting around threads
The current isc_hp API uses internal tid_v variable that gets
incremented for each new thread using hazard pointers.  This tid_v
variable is then used as a index to global shared table with hazard
pointers state.  Since the tid_v is only incremented and never
decremented the table could overflow very quickly if we create set of
threads for short period of time, they finish the work and cease to
exist.  Then we create identical set of threads and so on and so on.
This is not a problem for a normal `named` operation as the set of
threads is stable, but the problematic place are the unit tests where we
test network manager or other APIs (task, timer) that create threads.

This commits adds a thin wrapper around any function called from
isc_thread_create() that adds unique-but-reusable small digit thread id
that can be used as index to f.e. hazard pointer tables.  The trampoline
wrapper ensures that the thread ids will be reused, so the highest
thread_id number doesn't grow indefinitely when threads are created and
destroyed and then created again.  This fixes the hazard pointer table
overflow on machines with many cores. [GL #2396]
2021-02-25 16:21:10 +01:00
Matthijs Mekking 6dbdffd7b8 Merge branch '2503-stale-answer-client-timeout-crash' into 'main'
Resolve "New stale-answer-client-timeout crashes BIND 9.16 and 9.17"

Closes #2503

See merge request isc-projects/bind9!4714
2021-02-25 11:03:13 +00:00
Matthijs Mekking a404eaaffd Add CHANGES and release notes for GL #2503 2021-02-25 11:32:53 +01:00
Matthijs Mekking f8b7b597e9 Don't servfail on staleonly lookups
When a staleonly lookup doesn't find a satisfying answer, it should
not try to respond to the client.

This is not true when the initial lookup is staleonly (that is when
'stale-answer-client-timeout' is set to 0), because no resolver fetch
has been created at this point. In this case continue with the lookup
normally.
2021-02-25 11:32:17 +01:00
Matthijs Mekking 9e061faaae Don't allow recursion on staleonly lookups
Fix a crash that can happen in the following scenario:

A client request is received. There is no data for it in the cache,
(not even stale data). A resolver fetch is created as part of
recursion.

Some time later, the fetch still hasn't completed, and
stale-answer-client-timeout is triggered. A staleonly lookup is
started. It will also find no data in the cache.

So 'query_lookup()' will call 'query_gotanswer()' with ISC_R_NOTFOUND,
so this will call 'query_notfound()' and this will start recursion.

We will eventually end up in 'ns_query_recurse()' and that requires
the client query fetch to be NULL:

    REQUIRE(client->query.fetch == NULL);

If the previously started fetch is still running this assertion
fails.

The crash is easily prevented by not requiring recursion for
staleonly lookups.

Also remove a redundant setting of the staleonly flag at the end of
'query_lookup_staleonly()' before destroying the query context.

Add a system test to catch this case.
2021-02-25 11:32:17 +01:00
Matthijs Mekking e53af87f2c Merge branch '2498-nsec3-dynamic-update-dnssec-policy' into 'main'
Resolve "Regression in BIND 9.16.10, DNSSEC fails due to improper NSEC3 creation witihin named"

Closes #2498

See merge request isc-projects/bind9!4739
2021-02-25 09:49:29 +00:00
Matthijs MekkingandMark Andrews 89c47b3b42 Add changes and notes for [#2498] 2021-02-25 17:21:17 +11:00
Matthijs MekkingandMark Andrews 4b176c850b Fix dnssec-policy NSEC3 on dynamic zones
When applying dnssec-policy on a dynamic zone (e.g. that allows Dynamic
Updates), the NSEC3 parameters were put on the queue, but they were
not being processed (until a reload of the zone or reconfiguration).

Process the NSEC3PARAM queue on zone postload when handling a
dynamic zone.
2021-02-25 17:21:17 +11:00
Matthijs MekkingandMark Andrews 0c0f10b53f Add tests for NSEC3 on dynamic zones
GitLab issue #2498 is a bug report on NSEC3 with dynamic zones. Tests
for it in the nsec3 system test directory were missing.
2021-02-25 17:21:17 +11:00
Mark Andrews 95cf93081c Merge branch '2507-cid-320483-api-usage-errors-lock' into 'main'
Resolve "CID 320483:  API usage errors  (LOCK)"

Closes #2507

See merge request isc-projects/bind9!4721
2021-02-25 05:54:20 +00:00
Mark Andrews 3ac53daa06 Address unbalanced lock/unlock
Also address race between reading and testing mpctx->allocated
and incrementing mpctx->allocated.
2021-02-25 13:08:07 +11:00
Ondřej Surý 965848a11a Merge branch '2519-disable-assertion-in-DLL_THREAD_ATTACH-DLL_THREAD_DETACH' into 'main'
Disable safe-guard assertion in DLL_THREAD_ATTACH/DLL_THREAD_DETACH

Closes #2519

See merge request isc-projects/bind9!4738
2021-02-24 08:03:16 +00:00
Ondřej Surý c5887c4312 Disable safe-guard assertion in DLL_THREAD_ATTACH/DLL_THREAD_DETACH
The BIND 9 libraries on Windows define DllMain() optional entry point
into a dynamic-link library (DLL).  When the system starts or terminates
a process or thread, it calls the entry-point function for each loaded
DLL using the first thread of the process.

When the DLL is being loaded into the virtual address space of the
current process as a result of the process starting up, we make a call
to DisableThreadLibraryCalls() which should disable the
DLL_THREAD_ATTACH and DLL_THREAD_DETACH notifications for the specified
dynamic-link library (DLL).

This seems not be the case because we never check the return value of
the DisableThreadLibraryCalls() call, and it could in fact fail.  The
DisableThreadLibraryCalls() function fails if the DLL specified by
hModule has active static thread local storage, or if hModule is an
invalid module handle.

In this commit, we remove the safe-guard assertion put in place for the
DLL_THREAD_ATTACH and DLL_THREAD_DETACH events and we just ignore them.
BIND 9 doesn't create/destroy enough threads for it actually to make any
difference, and in fact we do use static thread local storage in the
code.
2021-02-24 08:31:42 +01:00
Mark Andrews de00c105bb Merge branch 'marka-placeholder' into 'main'
add placeholder

See merge request isc-projects/bind9!4737
2021-02-23 22:53:34 +00:00
Mark Andrews 57c70624d9 add placeholder 2021-02-24 09:49:27 +11:00
Michal Nowak 6a21522579 Merge branch '2446-query-c-5430-16-runtime-error' into 'main'
Initialize checknames field in dns_view_create()

Closes #2446

See merge request isc-projects/bind9!4706
2021-02-23 15:43:50 +00:00
Michal Nowak 0c6fa16477 Initialize checknames field in dns_view_create()
The 'checknames' field wasn't initialized in dns_view_create(), but it
should otherwise AddressSanitizer identifies the following runtime error
in query_test.c.

    runtime error: load of value 190, which is not a valid value for type '_Bool'
2021-02-23 16:08:13 +01:00
Michal Nowak 40b6db58a1 Revert "Initialize checknames field in query_test.c"
This reverts commit c75484c4dff04698c183b456a6cc85f951264e75.
2021-02-23 16:08:13 +01:00
Michal Nowak efe11d4383 Initialize checknames field in query_test.c
'checknames' field of struct dns_view is not initialized by
dns_view_create(). ASAN identified this as runtime error:

    runtime error: load of value 190, which is not a valid value for type '_Bool'
2021-02-23 16:08:13 +01:00
Michal Nowak 63c7300f97 Merge branch 'mnowak/alpine-3.13' into 'main'
Add Alpine Linux 3.13

See merge request isc-projects/bind9!4724
2021-02-23 14:45:19 +00:00
Michal Nowak 909c85f7a9 Add Alpine Linux 3.13 2021-02-23 15:33:59 +01:00
Michal Nowak ed13fb7ad2 Merge branch 'mnowak/pairwise-pict-keep-stderr' into 'main'
Do not remove stderr from pict output

See merge request isc-projects/bind9!4727
2021-02-23 14:25:38 +00:00
Michal Nowak 079debaa10 Do not remove stderr from pict output
Removing stderr from the pict tool serves no purpose and drops valuable
information, we might use when debugging failed pairwise CI job, such
as:

    Input Error: A parameter names must be unique
2021-02-23 15:23:58 +01:00
Mark Andrews 076bb4f989 Merge branch '2508-cid-320481-null-pointer-dereferences-reverse_inull' into 'main'
Resolve "CID 320481:  Null pointer dereferences  (REVERSE_INULL)"

Closes #2508

See merge request isc-projects/bind9!4722
2021-02-23 13:04:38 +00:00
Mark Andrews 658c950d7b Silence CID 320481: Null pointer dereferences
*** CID 320481:  Null pointer dereferences  (REVERSE_INULL)
    /bin/tests/wire_test.c: 261 in main()
    255     			process_message(input);
    256     		}
    257     	} else {
    258     		process_message(input);
    259     	}
    260
       CID 320481:  Null pointer dereferences  (REVERSE_INULL)
       Null-checking "input" suggests that it may be null, but it has already been dereferenced on all paths leading to the check.
    261     	if (input != NULL) {
    262     		isc_buffer_free(&input);
    263     	}
    264
    265     	if (printmemstats) {
    266     		isc_mem_stats(mctx, stdout);
2021-02-23 12:45:45 +00:00
Mark Andrews 3e9fba94e3 Merge branch '2493-cid-281450-dereference-before-null-check-reverse_inull' into 'main'
Resolve "CID 281450: Dereference before null check (REVERSE_INULL)"

Closes #2493

See merge request isc-projects/bind9!4684
2021-02-23 12:40:56 +00:00
Mark Andrews 5fb168fab3 Silence CID 281450: Dereference before null check
remove redundant 'inst != NULL' test

    162cleanup:

    CID 281450 (#1 of 1): Dereference before null check (REVERSE_INULL)
    check_after_deref: Null-checking inst suggests that it may be null, but it has already been dereferenced on all paths leading to the check.
    163        if (result != ISC_R_SUCCESS && inst != NULL) {
    164                plugin_destroy((void **)&inst);
    165        }
2021-02-23 11:58:40 +00:00
Mark Andrews 441aadab6c Merge branch '2492-304936-dereference-before-null-check' into 'main'
Resolve "CID 304936: Dereference before null check"

Closes #2492

See merge request isc-projects/bind9!4683
2021-02-23 11:57:29 +00:00
Mark Andrews c4906be2d4 Silence CID 304936 Dereference before null check
Removed redundant 'listener != NULL' check.

    1191cleanup:

    CID 304936 (#1 of 1): Dereference before null check (REVERSE_INULL)
    check_after_deref: Null-checking listener suggests that it may be null, but it has already been dereferenced on all paths leading to the check.
    1192        if (listener != NULL) {
    1193                isc_refcount_decrement(&listener->refs);
    1194                listener->exiting = true;
    1195                free_listener(listener);
    1196        }
2021-02-23 11:39:00 +00:00
Matthijs Mekking 5cadcff801 Merge branch '2408-dnssec-policy-purge-keys' into 'main'
Resolve "kasp: Purge deleted keys"

Closes #2408

See merge request isc-projects/bind9!4665
2021-02-23 09:37:56 +00:00
Matthijs Mekking 5a99a124fb Add changes and notes for [#2408] 2021-02-23 09:17:24 +01:00
Matthijs Mekking 5be26898c0 Minor kasp test fixes
Two minor fixes in the kasp system test:

1. A wrong comment in ns3/setup.sh (we are subtracting 2 hours, not
   adding them).
2. 'get_keyids' used bad parameters "$1" "$2" when 'check_numkeys'
   failed. Also, 'check_numkeys' can use $DIR, $ZONE, and $NUMKEYS
   directly, no need to pass them.
2021-02-23 09:16:48 +01:00
Matthijs Mekking 6333ff15f0 Test purge-keys option
Add some more zones to the kasp system test to test the 'purge-keys'
option. Three zones test that the predecessor key files are removed
after the purge keys interval, one test checks that the key files
are retained if 'purge-keys' is disabled. For that, we change the
times to 90 days in the past (the default value for 'purge-keys').
2021-02-23 09:16:48 +01:00
Matthijs Mekking 8c526cb67f Purge keys implementation
On each keymgr run, we now also check if key files can be removed.
The 'purge-keys' interval determines how long keys should be retained
after they have become completely hidden.

Key files should not be removed if it has a state that is set to
something else then HIDDEN, if purge-keys is 0 (disabled), if
the key goal is set to OMNIPRESENT, or if the key is unused (a key is
unused if no timing metadata set, and no states are set or if set,
they are set to HIDDEN).

If the last changed timing metadata plus the purge-keys interval is
in the past, the key files may be removed.

Add a dst_key_t variable 'purge' to signal that the key file should
not be written to file again.
2021-02-23 09:16:48 +01:00
Matthijs Mekking 313de3a7e2 Add purge-keys config option
Add a new option 'purge-keys' to 'dnssec-policy' that will purge key
files for deleted keys. The option determines how long key files
should be retained prior to removing the corresponding files from
disk.

If set to 0, the option is disabled and 'named' will not remove key
files from disk.
2021-02-23 09:16:48 +01:00
Mark Andrews d4cb312555 Merge branch '2509-cid-281489-resource-leaks-resource_leak' into 'main'
Resolve "CID 281489:  Resource leaks  (RESOURCE_LEAK)"

Closes #2509

See merge request isc-projects/bind9!4723
2021-02-22 22:39:23 +00:00
Mark Andrews 003dd8cc70 Address theoretical resource leak in dns_dt_open()
dns_dt_open() is not currently called with mode dns_dtmode_unix.

    *** CID 281489:  Resource leaks  (RESOURCE_LEAK)
    /lib/dns/dnstap.c: 983 in dns_dt_open()
    977
    978     		if (!dnstap_file(handle->reader)) {
    979     			CHECK(DNS_R_BADDNSTAP);
    980     		}
    981     		break;
    982     	case dns_dtmode_unix:
       CID 281489:  Resource leaks  (RESOURCE_LEAK)
       Variable "handle" going out of scope leaks the storage it points to.
    983     		return (ISC_R_NOTIMPLEMENTED);
    984     	default:
    985     		INSIST(0);
    986     		ISC_UNREACHABLE();
    987     	}
    988
2021-02-22 12:22:31 +11:00
Ondřej Surý bb124d6056 Merge branch 'ondrej/add-tls_p.h-to-Makefile.am' into 'main'
Include lib/isc/tls_p.h in release tarballs

See merge request isc-projects/bind9!4716
2021-02-19 12:30:50 +00:00
Ondřej SurýandMichał Kępień f53e7ed12c Include lib/isc/tls_p.h in release tarballs
The addition of lib/isc/tls_p.h to the source tree was not accounted for
in the relevant variable in lib/isc/Makefile.am and thus the former file
is not being included in release tarballs prepared using "make dist".
Fix by tweaking the libisc_la_SOURCES list in lib/isc/Makefile.am
accordingly.
2021-02-19 13:25:18 +01:00
Michał Kępień 5d473f92ed Merge branch '2504-do-not-require-libtool-in-PATH-at-build-time' into 'main'
Do not require libtool in PATH at build time

Closes #2504

See merge request isc-projects/bind9!4715
2021-02-19 12:09:48 +00:00
Michał Kępień c8bddd2e64 Add CHANGES entry 2021-02-19 11:52:56 +01:00
Michał Kępień b630c698f9 Do not require libtool in PATH at build time
The build-time requirement for libtool was introduced inadvertently:

 1. Commit 1628f5865a added a check to
    configure.ac which claims to test whether the libtool script is
    available.  There are two problems with that check:

      - it is effectively a no-op as the AC_PROG_LIBTOOL() macro always
        sets the LIBTOOL variable [1],

      - this check was intended to be performed before autoreconf is
        run, not when ./configure is run; the libtool script is supposed
        to be dynamically generated by ./configure on the build host and
        thus there is no need for a standalone libtool script to be
        installed system-wide on every host attempting to build BIND 9
        e.g. from a tarball produced by "make dist".

 2. Commit a7982d14dd was based on the
    incorrect assumption that the AC_PROG_LIBTOOL() macro looks for the
    libtool binary in PATH and sets the LIBTOOL variable accordingly,
    which is what other AC_PROG_*() macros do.  Meanwhile, the
    AC_PROG_LIBTOOL() macro only initializes libtool for use with
    Automake.  It is not necessary for a standalone libtool script to be
    available in PATH on the build host when ./configure is run.

Do not look for libtool in PATH at build time as it prevents hosts
without a libtool script available system-wide from building BIND 9 from
source tarballs prepared using "make dist".  Note that libtool m4
macros, utilities, etc. still need to be present on a given host if
autoreconf is to be run on it.

[1] https://git.savannah.gnu.org/cgit/libtool.git/tree/m4/libtool.m4?h=v2.4.6#n89
2021-02-19 11:52:56 +01:00
Mark Andrews 0b8d2bfb4c Merge branch '2499-a-loc-record-with-a-invalid-direction-field-triggers-an-insist' into 'main'
Resolve "A LOC record with a invalid direction field triggers an INSIST"

Closes #2499

See merge request isc-projects/bind9!4704
2021-02-18 22:37:41 +00:00
Mark Andrews 3d340ecfd2 Add release note for [GL #2499] 2021-02-19 09:18:08 +11:00
Mark Andrews 6f47e0956c Add CHANGES for [GL #2499] 2021-02-19 09:18:06 +11:00
Mark Andrews 009358d77d Correctly detect when get_direction failed 2021-02-19 09:17:32 +11:00
Mark Andrews 07902d9f9d Test a LOC record with an invalid direction field 2021-02-19 09:17:32 +11:00
Ondřej Surý 3547c0c1ff Merge branch '2433-improve-memory-contention' into 'main'
Resolve "investigate and improve lock contention around mctx"

Closes #2433

See merge request isc-projects/bind9!4659
2021-02-18 20:08:09 +00:00
Ondřej SurýandOndřej Surý 0302e54892 Add CHANGES note for GL #2433 2021-02-18 19:33:54 +01:00
Ondřej Surý 494d0da522 Use library constructor/destructor to initialize OpenSSL
Instead of calling isc_tls_initialize()/isc_tls_destroy() explicitly use
gcc/clang attributes on POSIX and DLLMain on Windows to initialize and
shutdown OpenSSL library.

This resolves the issue when isc_nm_create() / isc_nm_destroy() was
called multiple times and it would call OpenSSL library destructors from
isc_nm_destroy().

At the same time, since we now have introduced the ctor/dtor for libisc,
this commit moves the isc_mem API initialization (the list of the
contexts) and changes the isc_mem_checkdestroyed() to schedule the
checking of memory context on library unload instead of executing the
code immediately.
2021-02-18 19:33:54 +01:00
Ondřej SurýandOndřej Surý 4bde4f050b Disable calling DllMain() on thread creation/destruction
Disables the DLL_THREAD_ATTACH and DLL_THREAD_DETACH notifications for
the specified dynamic-link library (DLL).  This can reduce the size of
the working set for some applications.
2021-02-18 19:33:54 +01:00
Ondřej Surý f225462055 Fix the invalid condition variable
Although harmless, the memmove() in tlsdns and tcpdns was guarded by a
current message length variable that was always bigger than 0 instead of
correct current buffer length remainder variable.
2021-02-18 19:33:54 +01:00
Ondřej Surý 4775e9f256 Move most of the OpenSSL initialization to isc_tls
Since we now require both libcrypto and libssl to be initialized for
netmgr, we move all the OpenSSL initialization code except the engine
initialization to isc_tls API.

The isc_tls_initialize() and isc_tls_destroy() has been made idempotent,
so they could be called multiple time.  However when isc_tls_destroy()
has been called, the isc_tls_initialize() could not be called again.
2021-02-18 19:33:54 +01:00
Ondřej Surý ff47b47f1a Remove overrun checking code from memory allocator
The ISC_MEM_CHECKOVERRUN would add canary byte at the end of every
allocations and check whether the canary byte hasn't been changed at the
free time.  The AddressSanitizer and valgrind memory checks surpases
simple checks like this, so there's no need to actually keep the code
inside the allocator.
2021-02-18 19:33:54 +01:00
Ondřej Surý 549e5b693a Modify the way we benchmark mem_{get,put}
Previously, the mem_{get,put} benchmark would pass the allocation size
as thread_create argument.  This has been now changed, so the allocation
size is stored and decremented (divided) in atomic variable and the
thread create routing is given a memory context.  This will allow to
write tests where each thread is given different memory context and do
the same for mempool benchmarking.
2021-02-18 19:33:54 +01:00
Ondřej Surý f34f943b16 Disable memory debugging features in non-developer build
The two memory debugging features: ISC_MEM_DEFAULTFILL
(ISC_MEMFLAG_FILL) and ISC_MEM_TRACKLINES were always enabled in all
builds and the former was only disabled in `named`.

This commits disables those two features in non-developer build to make
the memory allocator significantly faster.
2021-02-18 19:33:54 +01:00
Ondřej SurýandOndřej Surý c9fe12443f Make the mempool names unconditional
The named memory pools were default and always compiled-in.  Remove the
extra complexity by removing the #define and #ifdefs around the code.
2021-02-18 19:33:54 +01:00
Ondřej SurýandOndřej Surý b09106e93a Make the memory and mempool counters to be stdatomic types
This is yet another step into unlocking some parts of the memory
contexts.  All the regularly updated variables has been turned into
atomic types, so we can later remove the locks when updating various
counters.

Also unlock as much code as possible without breaking anything.
2021-02-18 19:33:51 +01:00
Ondřej SurýandOndřej Surý 0f44139145 Bump the maximum number of hazard pointers in tests
On 24-core machine, the tests would crash because we would run out of
the hazard pointers.  We now adjust the number of hazard pointers to be
in the <128,256> interval based on the number of available cores.

Note: This is just a band-aid and needs a proper fix.
2021-02-18 19:32:55 +01:00
Ondřej SurýandOndřej Surý 7de846977b Remove the extra level of indirection via isc_memmethods_t
Previously, the applications using libisc would be able to override the
internal memory methods with own implementation.  This was no longer
possible, but the extra level of indirection was not removed.  This
commit removes the extra level of indirection for the memory methods and
the default_memalloc() and default_memfree().
2021-02-18 19:32:55 +01:00
Ondřej SurýandOndřej Surý 55ace5d3aa Remove the internal memory allocator
The internal memory allocator had an extra code to keep a list of blocks
for small size allocation.  This would help to reduce the interactions
with the system malloc as the memory would be already allocated from the
system, but there's an extra cost associated with that - all the
allocations/deallocations must be locked, effectively eliminating any
optimizations in the system allocator targeted at multi-threaded
applications. While the isc_mem API is still using locks pretty heavily,
this is a first step into reducing the memory allocation/deallocation
contention.
2021-02-18 19:32:02 +01:00
Michal Nowak 706c57280f Merge branch 'mnowak/fix-feature-test-tool-location' into 'main'
Use FEATURETEST variable instead of a path

See merge request isc-projects/bind9!4694
2021-02-18 14:43:29 +00:00
Michal Nowak 102f012631 Use FEATURETEST variable instead of a path
feature-test tool location needs to be determined by its associated
variable; otherwise, the tool is not found on Windows:

    setup.sh: line 22: ../feature-test: No such file or directory
2021-02-18 15:41:09 +01:00
Michał Kępień da21650949 Merge branch 'michal/add-a-checklist-for-handling-cves' into 'main'
Add a checklist for handling security issues

See merge request isc-projects/bind9!3950
2021-02-18 10:16:57 +00:00
Michał Kępień 3e5efc46d4 Add a checklist for handling security issues 2021-02-18 11:11:40 +01:00
Michał Kępień a55f4106ef Merge branch 'v9_17_10-release' into 'main'
Merge 9.17.10 release branch

See merge request isc-projects/bind9!4699
2021-02-17 21:29:03 +00:00
Michał Kępień ac95a9db99 Set up release notes for BIND 9.17.11 2021-02-17 22:25:26 +01:00
Michał Kępień 2b88a255d9 Update BIND version to 9.17.10 2021-02-17 22:20:24 +01:00
Michał Kępień a02c5c350e Add a CHANGES marker 2021-02-17 22:20:24 +01:00
Michał Kępień 77026a0fc2 Merge branch 'michal/prepare-documentation-for-bind-9.17.10' into 'v9_17_10-release'
Prepare documentation for BIND 9.17.10

See merge request isc-private/bind9!237
2021-02-17 22:20:24 +01:00
Michał Kępień 48353879e5 Prepare release notes for BIND 9.17.10 2021-02-17 22:20:24 +01:00
Michał Kępień 5c15c6ab21 Add release note for GL #2073 2021-02-17 22:20:24 +01:00
Michał Kępień fc4b7e72cc Reorder release notes 2021-02-17 22:20:24 +01:00
Michał Kępień 3799e66f04 Tweak and reword release notes 2021-02-17 22:20:24 +01:00
Michał Kępień 589cbe9bad Tweak and reword recent CHANGES entries 2021-02-17 22:20:24 +01:00
Michał Kępień 234ff52725 Use :rfc:<number> references in release notes 2021-02-17 22:20:24 +01:00
Michał Kępień e63b385073 Document the build-time requirement for nghttp2 2021-02-17 22:20:24 +01:00
Michal Nowak 8836a6e2b5 Merge branch 'mnowak/system-test-check-for-file-not-removed' into 'main'
Check for "file not removed" in system test output

See merge request isc-projects/bind9!4680
2021-02-17 16:08:26 +00:00
Michal Nowak f310b75250 Prevent Git to expand $systest
CentOS 8 "git status" unexpectedly expands search directory "tsig" to
also search in the "tsiggss" directory, thus incorrectly identifying
files as "not removed" in the "tsig" directory:

$ git status -su --ignored tsig
$ touch tsiggss/ns1/{named.run,named.memstats}
$ git status -su --ignored tsig
!! tsiggss/ns1/named.memstats
!! tsiggss/ns1/named.run
2021-02-17 16:35:21 +01:00
Michal Nowak 14a104d121 Clean omitted files from system tests
Any CI job:
- I:dnssec:file dnssec/ns1/trusted.keys not removed
- I:rpzrecurse:file rpzrecurse/ns3/named.run.prev not removed

system:clang:freebsd11:amd64:
- I:tkey:file tkey/ns1/named.conf-e not removed

system:gcc:sid:amd64:
- I:mirror:file mirror/ns3/_default.nzf not removed

system:gcc:xenial:amd64:
- I:rpzextra:file rpzextra/.cache/v/cache/lastfailed not removed
- I:rpzrecurse:file rpzrecurse/ns3/named.run.prev not removed
- I:shutdown:file shutdown/.cache/v/cache/lastfailed not removed
2021-02-17 16:35:21 +01:00
Michal Nowak e48d7db13a Copy testcrypto.sh to out-of-tree directory
System tests run in out-of-tree directory fail to find testcrypto.sh and
produce:

    /bin/bash: ../testcrypto.sh: No such file or directory
2021-02-17 16:35:21 +01:00
Michal Nowak 4a2778abdf Check for "file not removed" in system test output
Run this check only when in Git repository, because the run.sh function
which produces the "file not removed" warning is run only when build
directory is the same as the source directory, that is only for in-tree
builds.
2021-02-17 16:35:21 +01:00
Michal Nowak 10bf725ee2 Add system test name to "file not removed" info 2021-02-17 16:35:21 +01:00
Michal Nowak 09acebd910 Merge branch 'mnowak/enable-dh-unit-test-to-run-under-pkcs11' into 'main'
Drop USE_OPENSSL constraint from dh_test

See merge request isc-projects/bind9!4621
2021-02-17 11:44:39 +00:00
Michal Nowak c341e7f740 Drop USE_OPENSSL constraint from dh_test
The USE_OPENSSL constraint in dh_test does not seems to be necessary
anymore, the test runs with PKCS#11 as well.
2021-02-17 12:21:41 +01:00
Ondřej Surý f8fa64b706 Merge branch '2487-rollback-setting-dontfrag-option' into 'main'
Rollback setting IP_DONTFRAG option on the UDP sockets

Closes #2466 and #2487

See merge request isc-projects/bind9!4668
2021-02-17 08:02:08 +00:00
Ondřej SurýandOndřej Surý 6d442e9c04 Add CHANGES and release notes for GL #2487 2021-02-17 08:10:45 +01:00
Ondřej SurýandOndřej Surý 66eefac78c Rollback setting IP_DONTFRAG option on the UDP sockets
In DNS Flag Day 2020, the development branch started setting the
IP_DONTFRAG option on the UDP sockets.  It turned out, that this
code was incomplete leading to dropping the outgoing UDP packets.
Henceforth this commit rolls back this setting until we have a
proper fix that would send back empty response with TC flag set.
2021-02-17 08:09:56 +01:00
Evan Hunt 0f1a4ff2b1 Merge branch 'each-note-cleanup' into 'main'
some release note corrections

See merge request isc-projects/bind9!4690
2021-02-17 00:59:01 +00:00
Evan Hunt 3126eb652d some release note corrections 2021-02-16 16:56:25 -08:00
Evan Hunt 62cf011eaa Merge branch '2472-tls-none' into 'main'
Resolve "too easy to configure unencrypted DoH"

Closes #2472

See merge request isc-projects/bind9!4653
2021-02-17 00:55:33 +00:00
Evan Hunt 5950b5c803 CHANGES 2021-02-16 16:24:52 -08:00
Evan Hunt 2b2e1a02bd allow configuration of "default" http endpoint
specifying "http default" in a listen-on statement sets up
the default "/dns-query" endpoint. tests and documentation
have been updated.
2021-02-16 16:24:35 -08:00
Evan Hunt 957052eea5 move listen-on correctness checks into check.c
errors in listen-on and listen-on-v6 can now be detected
by named-checkconf.
2021-02-16 16:24:35 -08:00
Evan Hunt fd763d7223 enable listen-on parameters to be specified in any order
updated the parser to allow the "port", "tls" and "http"
paramters to "listen-on" and "listen-on-v6" to be specified in any
order. previously the parser would throw an error if any other order
was used than port, tls, http.
2021-02-16 16:24:35 -08:00
Evan Hunt 07f525bae5 require "tls none" for unencrypted HTTP listeners
unencrypted DoH connections may be used in some operational
environments where encryption is handled by a reverse proxy,
but it's going to be relatively rare, so we shouldn't make it
easy to do by mistake.  this commit changes the syntax for
listen-on and listen-on-v6 so that if "http" is specified, "tls"
must also be specified; for unencrypted listeners, "tls none"
can be used.
2021-02-16 16:24:35 -08:00
Mark Andrews 59a0637a8f Merge branch '2402-bind-9-16-11-build-fails-with-static-openssl-library' into 'main'
Resolve "BIND 9.16.11 build fails with static OpenSSL library"

Closes #2402

See merge request isc-projects/bind9!4591
2021-02-16 23:29:53 +00:00
Mark Andrews 98dc47d351 Add CHANGES for [GL #2402] 2021-02-16 22:54:03 +00:00
Mark Andrews 9223c7d599 Fix linking order for OpenSSL libraries
As libssl depends on libcrypto, -lssl needs to precede -lcrypto in
linker invocations or else the build will fail with static OpenSSL
libraries.  Adjust m4/ax_check_openssl.m4 to prevent this issue from
getting triggered when pkg-config files for OpenSSL are not available.
2021-02-16 22:54:03 +00:00
Evan Hunt a36b0918a7 Merge branch '2484-nghttp2-version' into 'main'
report libnghttp2 version in 'named -V'

Closes #2484

See merge request isc-projects/bind9!4689
2021-02-16 22:45:52 +00:00
Evan Hunt 70da5c79cb report libnghttp2 version in 'named -V'
add lines indicating the versions of the nghttp2 library
against which named was compiled and to which it is linked.
2021-02-16 14:40:18 -08:00
Michal Nowak 1f44e6d442 Merge branch 'mnowak/consistent-use-of-SKIPPED_TEST_EXIT_CODE' into 'main'
Use SKIPPED_TEST_EXIT_CODE consistently in unit tests

See merge request isc-projects/bind9!4685
2021-02-16 13:56:18 +00:00
Michal Nowak c286341703 Use SKIPPED_TEST_EXIT_CODE consistently
Commit fa505bfb0e omitted two unit tests
while introducing the SKIP_TEST_EXIT_CODE preprocessor macro.  Fix the
outliers to make use of SKIP_TEST_EXIT_CODE consistent across all unit
tests.  Also make sure lib/dns/tests/dnstap_test returns an exit code
that indicates a skipped test when dnstap is not enabled.
2021-02-16 13:41:50 +01:00
Ondřej Surý 2be0b5b90e Merge branch '2357-cleanup-public-headers' into 'main'
Resolve "Cannot compile current versions on macOS "Catalina""

Closes #2357

See merge request isc-projects/bind9!4670
2021-02-16 12:17:30 +00:00
Ondřej SurýandMark Andrews a5d2ce79c8 Stop including gssapi.h from dst/gssapi.h header
The only reason for including the gssapi.h from the dst/gssapi.h header
was to get the typedefs of gss_cred_id_t and gss_ctx_id_t.  Instead of
using those types directly this commit introduces dns_gss_cred_id_t and
dns_gss_ctx_id_t types that are being used in the public API and
privately retyped to their counterparts when we actually call the gss
api.

This also conceals the gssapi headers, so users of the libdns library
doesn't have to add GSSAPI_CFLAGS to the Makefile when including libdns
dst API.
2021-02-16 01:04:46 +00:00
Ondřej SurýandMark Andrews 23c3bcc711 Stop including dnstap headers from <dns/dnstap.h>
The <fstrm.h> and <protobuf-c/protobuf-c.h> headers are only directly
included where used and we stopped exposing those headers from libdns
headers.
2021-02-16 01:04:46 +00:00
Ondřej SurýandMark Andrews dce292e7f4 Stop including lmdb.h from <dns/view.h>
The lmdb.h doesn't have to be included from the dns/view.h header as it
is separately included where used.  This stops exposing the inclusion of
lmdb.h from the libdns headers.
2021-02-16 01:04:46 +00:00
Ondřej SurýandMark Andrews d1448a4c2a Move the <isc/readline.h> header to bin/dig/readline.h
The <isc/readline.h> header provided a compatibility shim to use when
other non-GNU readline libraries are in use.  The two places where
readline library is being used is nslookup and nsupdate, so the header
file has been moved to bin/dig directory and it's directly included from
bin/nsupdate.

This also conceals any readline headers exposed from the libisc headers.
2021-02-16 01:04:46 +00:00
Ondřej SurýandMark Andrews 00b5f4c389 Remove the extra CFLAGS from libisc_CFLAGS and libdns_CFLAGS
The extra library CFLAGS were causing the headers to be included in
wrong order possibly pulling header files from previously installed
BIND 9 version.

This commit cleans up the extra <foo>_CFLAGS from the includes in favor
of not exposing 3rd party headers in our own header files.
2021-02-16 01:04:46 +00:00
Diego dos Santos Fronza 5f1a76c710 Merge branch '2041-bug-reconfig-auto-dnssec-high-thread-number-leak-resources-and-crash-named' into 'main'
Resolve "BUG reconfig+auto-dnssec+high thread number leak resources and crash named"

Closes #2041

See merge request isc-projects/bind9!4669
2021-02-15 18:12:17 +00:00
Diego Fronza 757be6ec16 Add CHANGES note for [GL #2041] 2021-02-15 12:02:31 -03:00
Diego Fronza 43b0b20b43 Test reconfig after adding inline signed zones won't crash named
This test ensures that named won't crash after many inline-signed zones
are added to configurarion, followed by a rndc reconfig.
2021-02-15 11:15:20 -03:00
Diego Fronza 30729c7013 Fix dangling references to outdated views after reconfig
This commit fix a leak which was happening every time an inline-signed
zone was added to the configuration, followed by a rndc reconfig.

During the reconfig process, the secure version of every inline-signed
zone was "moved" to a new view upon a reconfig and it "took the raw
version along", but only once the secure version was freed (at shutdown)
was prev_view for the raw version detached from, causing the old view to
be released as well.

This caused dangling references to be kept for the previous view, thus
keeping all resources used by that view in memory.
2021-02-15 11:15:20 -03:00
Michal Nowak fe6bd687d7 Merge branch 'mnowak/merge-skipped-and-untested-system-test-results' into 'main'
Merge UNTESTED and SKIPPED system test results

See merge request isc-projects/bind9!4517
2021-02-15 11:52:46 +00:00
Michal Nowak 3cc3f1712b Add CHANGES note for [GL !4517] 2021-02-15 11:20:18 +01:00
Michal Nowak cfd0f7d2eb Do not build geoip_test when GeoIP is not available 2021-02-15 11:19:15 +01:00
Michal Nowak fa505bfb0e Record skipped unit test as skipped in Automake framework 2021-02-15 11:18:03 +01:00
Michal Nowak 29d7c6e449 Merge UNTESTED and SKIPPED system test results
Descriptions of UNTESTED and SKIPPED system test results are very
similar to one another and it may be confusing when to pick one and
when the other. Merging these two system test results removes the
confusion and also makes system test more aligned with Automake,
which does not know about UNTESTED test result.
2021-02-15 11:15:20 +01:00
Michal Nowak fbdd464038 Record skipped test as skipped in testsuite summary
When system test execution was ported to Automake, SKIPPED and UNTESTED
system test result were not made to match Automake expectations,
therefore a skipped test is recorded by Automake as "PASS":

    $ make check TESTS=cpu V=1
    I:cpu:cpu test only runs on Linux, skipping test
    I:cpu:Prerequisites missing, skipping test.
    R:cpu:SKIPPED
    E:cpu:2020-12-16T11:36:58+0000
    PASS: cpu
    ====================================================================
    Testsuite summary for BIND 9.17.7
    ====================================================================
    # TOTAL: 1
    # PASS:  1

For a test to be recorded by Automake as skipped, the test, or it's test
driver, needs to exit with code 77:

    $ make check TESTS=cpu V=1
    I:cpu:cpu test only runs on Linux, skipping test
    I:cpu:Prerequisites missing, skipping test.
    R:cpu:SKIPPED
    E:cpu:2020-12-16T11:39:10+0000
    SKIP: cpu
    ====================================================================
    Testsuite summary for BIND 9.17.7
    ====================================================================
    # TOTAL: 1
    # PASS:  0
    # SKIP:  1
2021-02-15 11:15:20 +01:00
Mark Andrews 8c1df63312 Merge branch '2443-cid-316608-memory-corruptions-overrun' into 'main'
Resolve "CID 316608:  Memory - corruptions  (OVERRUN)"

Closes #2443

See merge request isc-projects/bind9!4623
2021-02-14 23:02:44 +00:00
Mark Andrews 59bf6e71e2 Address theoretical buffer overrun in recent change
The strlcat() call was wrong.

    *** CID 316608:  Memory - corruptions  (OVERRUN)
    /lib/dns/resolver.c: 5017 in fctx_create()
    5011     	 * Make fctx->info point to a copy of a formatted string
    5012     	 * "name/type".
    5013     	 */
    5014     	dns_name_format(name, buf, sizeof(buf));
    5015     	dns_rdatatype_format(type, typebuf, sizeof(typebuf));
    5016     	p = strlcat(buf, "/", sizeof(buf));
    >>>     CID 316608:  Memory - corruptions  (OVERRUN)
    >>>     Calling "strlcat" with "buf + p" and "1036UL" is suspicious because "buf" points into a buffer of 1036 bytes and the function call may access "(char *)(buf + p) + 1035UL". [Note: The source code implementation of the function has been overridden by a builtin model.]
    5017     	strlcat(buf + p, typebuf, sizeof(buf));
    5018     	fctx->info = isc_mem_strdup(mctx, buf);
    5019
    5020     	FCTXTRACE("create");
    5021     	dns_name_init(&fctx->name, NULL);
    5022     	dns_name_dup(name, mctx, &fctx->name);
2021-02-14 22:41:46 +00:00
Petr Špaček 1d1408567f Merge branch 'pspacek/ci-python-allthetime' into 'main'
Run Python linters in CI even outside of merge requests

See merge request isc-projects/bind9!4540
2021-02-12 13:23:47 +00:00
Petr Špaček 74d7cddc4c Run Python linters in CI even outside of merge requests
Previously it did not get run on scheduled CI pipelines.
2021-02-12 14:21:23 +01:00
Michal Nowak 11df3ef0c3 Merge branch 'mnowak/check-for-unrecognized-options' into 'main'
Check for unrecognized configure options

See merge request isc-projects/bind9!4567
2021-02-12 13:14:41 +00:00
Michal Nowak 4295c82e45 Add --enable-option-checking=fatal to ./configure in CI
The --enable-option-checking=fatal option prevents ./configure from
proceeding when an unknown option is used in the ./configure step in CI.
This change will avoid adding unsupported ./configure options or options
with typo or typo in pairwise testing "# [pairwise: ...]" marker.
2021-02-12 13:56:38 +01:00
Michal Nowak 40600d6bf6 Merge branch '2312-lint-generated-manual-pages' into 'main'
Lint manual pages

Closes #2312

See merge request isc-projects/bind9!4475
2021-02-12 11:54:18 +00:00
Michal Nowak 22fdcb30db Lint manual pages
As we generate manual pages from reStructuredText sources, we don't have
absolute control on manual page output and therefore 'mandoc -Tlint' may
always report warnings we can't eliminate. In light of this some mandoc
warnings need to be ignored.
2021-02-12 12:15:02 +01:00
Michal Nowak 2a8b4f2a79 Build man pages when "make doc" is run
Man pages are currently only generated from reStructuredText sources
when "make man" is run in the doc/man/ directory.  Tweak
doc/man/Makefile.am so that running "make doc" in the top-level
directory also causes man pages to be generated, so that all potential
documentation building problems can be detected by a single make
invocation.
2021-02-12 12:15:01 +01:00
Mark Andrews 5750f89351 Merge branch '2421-cid-316509-untrusted-value-as-argument-tainted_scalar' into 'main'
Resolve "CID 316509: Untrusted value as argument (TAINTED_SCALAR)"

Closes #2423 and #2421

See merge request isc-projects/bind9!4606
2021-02-11 23:39:18 +00:00
Mark Andrews c40133d840 Silence Insecure data handling (TAINTED_SCALAR)
Coverity assumes that the memory holding any value read using byte
swapping is tainted.  As we store the NSEC3PARAM records in wire
form and iterations is byte swapped the memory holding the record
is marked as tainted.  nsec3->salt_length is marked as tainted
transitively. To remove the taint the value need to be range checked.
For a correctly formatted record region.length should match
nsec3->salt_length and provides a convenient value to check the field
against.

    *** CID 316507:  Insecure data handling  (TAINTED_SCALAR)
    /lib/dns/rdata/generic/nsec3param_51.c: 241 in tostruct_nsec3param()
    235     	region.length = rdata->length;
    236     	nsec3param->hash = uint8_consume_fromregion(&region);
    237     	nsec3param->flags = uint8_consume_fromregion(&region);
    238     	nsec3param->iterations = uint16_consume_fromregion(&region);
    239
    240     	nsec3param->salt_length = uint8_consume_fromregion(&region);
    >>>     CID 316507:  Insecure data handling  (TAINTED_SCALAR)
    >>>     Passing tainted expression "nsec3param->salt_length" to "mem_maybedup", which uses it as an offset.
    241     	nsec3param->salt = mem_maybedup(mctx, region.base,
    242     					nsec3param->salt_length);
    243     	if (nsec3param->salt == NULL) {
    244     		return (ISC_R_NOMEMORY);
    245     	}
    246     	isc_region_consume(&region, nsec3param->salt_length);
2021-02-12 10:19:27 +11:00
Mark Andrews fd8d1337a5 Silence Untrusted value as argument (TAINTED_SCALAR)
Coverity assumes that the memory holding any value read using byte
swapping is tainted.  As we store the NSEC3 records in wire form
and iterations is byte swapped the memory holding the record is
marked as tainted.  nsec3->salt_length and nsec3->next_length are
marked as tainted transitively. To remove the taint the values need
to be range checked.  Valid values for these should never exceed
region.length so that is becomes a reasonable value to check against.

    *** CID 316509:    (TAINTED_SCALAR)
    /lib/dns/rdata/generic/nsec3_50.c: 312 in tostruct_nsec3()
    306     	if (nsec3->salt == NULL) {
    307     		return (ISC_R_NOMEMORY);
    308     	}
    309     	isc_region_consume(&region, nsec3->salt_length);
    310
    311     	nsec3->next_length = uint8_consume_fromregion(&region);
    >>>     CID 316509:    (TAINTED_SCALAR)
    >>>     Passing tainted expression "nsec3->next_length" to "mem_maybedup", which uses it as an offset.
    312     	nsec3->next = mem_maybedup(mctx, region.base, nsec3->next_length);
    313     	if (nsec3->next == NULL) {
    314     		goto cleanup;
    315     	}
    316     	isc_region_consume(&region, nsec3->next_length);
    317
    /lib/dns/rdata/generic/nsec3_50.c: 305 in tostruct_nsec3()
    299     	region.length = rdata->length;
    300     	nsec3->hash = uint8_consume_fromregion(&region);
    301     	nsec3->flags = uint8_consume_fromregion(&region);
    302     	nsec3->iterations = uint16_consume_fromregion(&region);
    303
    304     	nsec3->salt_length = uint8_consume_fromregion(&region);
    >>>     CID 316509:    (TAINTED_SCALAR)
    >>>     Passing tainted expression "nsec3->salt_length" to "mem_maybedup", which uses it as an offset.
    305     	nsec3->salt = mem_maybedup(mctx, region.base, nsec3->salt_length);
    306     	if (nsec3->salt == NULL) {
    307     		return (ISC_R_NOMEMORY);
    308     	}
    309     	isc_region_consume(&region, nsec3->salt_length);
    310
2021-02-12 10:19:21 +11:00
Michal Nowak 698d6372aa Merge branch 'mnowak/enable-libns-tests-to-run-under-asan' into 'main'
Drop AddressSanitizer constraint from libns unit tests

See merge request isc-projects/bind9!4622
2021-02-10 10:02:16 +00:00
Michal Nowak 613be8706e Drop AddressSanitizer constraint from libns unit tests
The AddressSanitizer constraint in some libns unit tests does not seem
to be necessary anymore, these tests run fine under AddressSanitizer.
2021-02-10 09:54:32 +00:00
Mark Andrews 1c428cc157 Merge branch '2460-incorrect-size-passed-to-isc_mem_put' into 'main'
Resolve "Incorrect size passed to isc_mem_put"

Closes #2460

See merge request isc-projects/bind9!4633
2021-02-09 12:49:38 +00:00
Mark Andrews 7a47262626 Add release note for [GL #2460] 2021-02-09 12:30:14 +00:00
Mark Andrews bef5e723b2 Add CHANGES note for [GL #2460] 2021-02-09 12:30:14 +00:00
Mark Andrews 0a966315b2 Fix wrong length passed to isc_mem_put
If an invalid key name (e.g. "a..b") in a primaries list in named.conf
is specified the wrong size is passed to isc_mem_put resulting in the
returned memory being put on the wrong freed list.

    *** CID 316784:  Incorrect expression  (SIZEOF_MISMATCH)
    /bin/named/config.c: 636 in named_config_getname()
    630     	isc_buffer_constinit(&b, objstr, strlen(objstr));
    631     	isc_buffer_add(&b, strlen(objstr));
    632     	dns_fixedname_init(&fname);
    633     	result = dns_name_fromtext(dns_fixedname_name(&fname), &b, dns_rootname,
    634     				   0, NULL);
    635     	if (result != ISC_R_SUCCESS) {
       CID 316784:  Incorrect expression  (SIZEOF_MISMATCH)
       Passing argument "*namep" of type "dns_name_t *" and argument "8UL /* sizeof (*namep) */" to function "isc__mem_put" is suspicious.
    636     		isc_mem_put(mctx, *namep, sizeof(*namep));
    637     		*namep = NULL;
    638     		return (result);
    639     	}
    640     	dns_name_dup(dns_fixedname_name(&fname), mctx, *namep);
    641
2021-02-09 12:30:14 +00:00
Matthijs Mekking 5c0847e997 Merge branch '1810-refactor-ecdsa-eddsa-system-tests' into 'main'
Resolve "Refactor ecdsa and eddsa tests after testcrypto.sh changes"

Closes #1810

See merge request isc-projects/bind9!4645
2021-02-09 11:59:20 +00:00
Matthijs Mekking 51827ddcd3 Update copyrights for [#1810] 2021-02-09 11:59:08 +00:00
Matthijs Mekking 650b0d4691 Refactor ecdsa system test
Similar to eddsa system test.
2021-02-09 11:59:08 +00:00
Matthijs Mekking fd7d0f7968 Enable eddsa test
It should be fixed now.
2021-02-09 11:59:08 +00:00
Matthijs Mekking 8bf31d0592 Refactor eddsa system test
Test for Ed25519 and Ed448. If both algorithms are not supported, skip
test. If only one algorithm is supported, run test, skip the
unsupported algorithm. If both are supported, run test normally.

Create new ns3. This will test Ed448 specifically, while now ns2 only
tests Ed25519. This moves some files from ns2/ to ns3/.
2021-02-09 11:59:08 +00:00
Matthijs Mekking 572d7ec3b7 Fix testcrypto.sh
Testing Ed448 was actually testing Ed25519.
2021-02-09 11:59:08 +00:00
Michal Nowak e74187a056 Merge branch 'mnowak/drop-kyua-references-in-.gitlab-ci.yml' into 'main'
Remove remnant Kyua references

See merge request isc-projects/bind9!4638
2021-02-09 11:48:07 +00:00
Michal Nowak f557480078 Remove remnant Kyua references
Unit tests were ported from Kyua to Automake.  All references to Kyua
thus should be removed from the main branch.
2021-02-09 12:45:53 +01:00
Michal Nowak 566b65e513 Merge branch 'mnowak/check-asan-errors-in-configure' into 'main'
Check config.log for ASAN errors

See merge request isc-projects/bind9!4655
2021-02-09 11:02:20 +00:00
Michal Nowak 0db934d401 Check config.log for ASAN errors
./configure checks might produce a false negative error due to ASAN
errors and thus disable some options.
2021-02-09 11:56:08 +01:00
Matthijs Mekking 8dd1106bda Merge branch '2434-fetch-limit-serve-stale-follow-up' into 'main'
Resolve "Serve stale when fetch limits are hit" (follow-up)

Closes #2434

See merge request isc-projects/bind9!4654
2021-02-08 15:01:07 +00:00
Matthijs Mekking 00f575e7ef Adjust serve-stale test
The number of queries to use in the burst can be reduced, as we have
a very low fetch limit of 1.

The dig command in 'wait_for_fetchlimits()' should time out sooner as
we expect a SERVFAIL to be returned promptly.

Enabling serve-stale can be done before hitting fetch-limits. This
reduces the chance that the resolver queries time out and fetch count
is reset. The chance of that happening is already slim because
'resolver-query-timeout' is 10 seconds, but better to first let the
data become stale rather than doing that while attempting to resolve.
2021-02-08 15:17:09 +01:00
Matthijs Mekking 8bcd7fe69e Use stale on error also when unable to recurse
The 'query_usestale()' function was only called when in
'query_gotanswer()' and an unexpected error occurred. This may have
been "quota reached", and thus we were in some cases returning
stale data on fetch-limits (and if serve-stale enabled of course).

But we can also hit fetch-limits when recursing because we are
following a referral (in 'query_notfound()' and
'query_delegation_recurse()'). Here we should also check for using
stale data in case an error occurred.

Specifically don't check for using stale data when refetching a
zero TTL RRset from cache.

Move the setting of DNS_DBFIND_STALESTART into the 'query_usestale()'
function to avoid code duplication.
2021-02-08 15:17:09 +01:00
Mark Andrews a415424339 Merge branch '2469-cid-281461-untrusted-loop-bound' into 'main'
Resolve "CID 281461: untrusted loop bound"

Closes #2469

See merge request isc-projects/bind9!4642
2021-02-08 02:55:31 +00:00
Mark Andrews 2f946c831a Attempt to silence untrusted loop bound
Assign hit_len + key_len to len and test the result
rather than recomputing and letting the compiler simplify.

    213        isc_region_consume(&region, 2); /* hit length + algorithm */
        9. tainted_return_value: Function uint16_fromregion returns tainted data. [show details]
        10. tainted_data_transitive: Call to function uint16_fromregion with tainted argument *region.base returns tainted data.
        11. tainted_return_value: Function uint16_fromregion returns tainted data.
        12. tainted_data_transitive: Call to function uint16_fromregion with tainted argument *region.base returns tainted data.
        13. var_assign: Assigning: key_len = uint16_fromregion(&region), which taints key_len.
    214        key_len = uint16_fromregion(&region);
        14. lower_bounds: Casting narrower unsigned key_len to wider signed type int effectively tests its lower bound.
        15. Condition key_len == 0, taking false branch.
    215        if (key_len == 0) {
    216                RETERR(DNS_R_FORMERR);
    217        }
        16. Condition !!(_r->length >= _l), taking true branch.
        17. Condition !!(_r->length >= _l), taking true branch.
    218        isc_region_consume(&region, 2);
        18. lower_bounds: Casting narrower unsigned key_len to wider signed type int effectively tests its lower bound.
        19. Condition region.length < (unsigned int)(hit_len + key_len), taking false branch.
    219        if (region.length < (unsigned)(hit_len + key_len)) {
    220                RETERR(DNS_R_FORMERR);
    221        }
    222
        20. lower_bounds: Casting narrower unsigned key_len to wider signed type int effectively tests its lower bound.
        21. Condition _r != 0, taking false branch.
    223        RETERR(mem_tobuffer(target, rr.base, 4 + hit_len + key_len));
        22. lower_bounds: Casting narrower unsigned key_len to wider signed type int effectively tests its lower bound.
        23. var_assign_var: Compound assignment involving tainted variable 4 + hit_len + key_len to variable source->current taints source->current.
    224        isc_buffer_forward(source, 4 + hit_len + key_len);
    225
    226        dns_decompress_setmethods(dctx, DNS_COMPRESS_NONE);

    CID 281461 (#1 of 1): Untrusted loop bound (TAINTED_SCALAR)
        24. tainted_data: Using tainted variable source->active - source->current as a loop boundary.
    Ensure that tainted values are properly sanitized, by checking that their values are within a permissible range.
    227        while (isc_buffer_activelength(source) > 0) {
    228                dns_name_init(&name, NULL);
    229                RETERR(dns_name_fromwire(&name, source, dctx, options, target));
    230        }
2021-02-08 02:02:29 +00:00
Michal Nowak 64d5dad92a Merge branch 'mnowak/check-arm-pdf-validity' into 'main'
Check PDF file structure with QPDF

See merge request isc-projects/bind9!4620
2021-02-03 16:41:06 +00:00
Michal Nowak 359708b9d6 Check PDF file structure with QPDF
"qpdf --check" checks file structure of generated ARM PDF.
2021-02-03 17:39:58 +01:00
Matthijs Mekking 3648eb2936 Merge branch '2377-allow-a-records-below-an-_spf-label-as-a-check-names-exception' into 'main'
Resolve "Allow A records below an '_spf' label as a check-names exception"

Closes #2377

See merge request isc-projects/bind9!4529
2021-02-03 16:38:48 +00:00
Mark AndrewsandMatthijs Mekking 1294918702 Add release note entry 2021-02-03 16:24:44 +01:00
Mark AndrewsandMatthijs Mekking 2b5091ac17 Add CHANGES 2021-02-03 16:24:43 +01:00
Mark AndrewsandMatthijs Mekking a3b2b86e7f Check that A record is accepted with _spf label present 2021-02-03 16:23:20 +01:00
Mark AndrewsandMatthijs Mekking 63c16c8506 Allow A records below '_spf' labels as recommend by RFC7208 2021-02-03 16:23:20 +01:00
Matthijs Mekking 5b8c86606e Merge branch '2375-dnssec-policy-three-is-a-crowd-rollover-bug' into 'main'
Resolve "three is a crowd" dnssec-policy key rollover bug

Closes #2375

See merge request isc-projects/bind9!4541
2021-02-03 15:22:47 +00:00
Matthijs Mekking 189f5a3f28 Add kasp test todo for [#2375]
This bugfix has been manually verified but is missing a unit test.
Created GL #2471 to track this.
2021-02-03 15:35:06 +01:00
Matthijs Mekking 98ace6d97d Use NUM_KEYSTATES constant where appropriate
We use the number 4 a lot when working on key states. Better to use
the NUM_KEYSTATES constant instead.
2021-02-03 15:35:06 +01:00
Matthijs Mekking 7947f7f9c6 Add change and release note for [#2375]
News worthy.
2021-02-03 15:35:06 +01:00
Matthijs Mekking 189d9a2d21 Cleanup keymgr.c
Three small cleanups:

1. Remove an unused keystr/dst_key_format.
2. Initialize a dst_key_state_t state with NA.
3. Update false comment about local policy (local policy only adds
   barrier on transitions to the RUMOURED state, not the UNRETENTIVE
   state).
2021-02-03 15:35:06 +01:00
Matthijs Mekking 291bcc3721 Fix DS/DNSKEY hidden or chained functions
There was a bug in function 'keymgr_ds_hidden_or_chained()'.

The funcion 'keymgr_ds_hidden_or_chained()' implements (3e) of rule2
as defined in the "Flexible and Robust Key Rollover" paper. The rules
says: All DS records need to be in the HIDDEN state, or if it is not
there must be a key with its DNSKEY and KRRSIG in OMNIPRESENT, and
its DS in the same state as the key in question. In human langauge,
if all keys have their DS in HIDDEN state you can do what you want,
but if a DS record is available to some validators, there must be
a chain of trust for it.

Note that the barriers on transitions first check if the current
state is valid, and then if the next state is valid too. But
here we falsely updated the 'dnskey_omnipresent' (now 'dnskey_chained')
with the next state. The next state applies to 'key' not to the state
to be checked. Updating the state here leads to (true) always, because
the key that will move its state will match the falsely updated
expected state. This could lead to the assumption that Key 2 would be
a valid chain of trust for Key 1, while clearly the presence of any
DS is uncertain.

The fix here is to check if the DNSKEY and KRRSIG are in OMNIPRESENT
state for the key that does not have its DS in the HIDDEN state, and
only if that is not the case, ensure that there is a key with the same
algorithm, that provides a valid chain of trust, that is, has its
DNSKEY, KRRSIG, and DS in OMNIPRESENT state.

The changes in 'keymgr_dnskey_hidden_or_chained()' are only cosmetical,
renaming 'rrsig_omnipresent' to 'rrsig_chained' and removing the
redundant initialization of the DST_KEY_DNSKEY expected state to NA.
2021-02-03 15:34:36 +01:00
Matthijs Mekking 600915d1b2 Update keymgr_key_is_successor() calls
The previous commit changed the function definition of
'keymgr_key_is_successor()', this commit updates the code where
this function is called.

In 'keymgr_key_exists_with_state()' the logic is also updated slightly
to become more readable. First handle the easy cases:
- If the key does not match the state, continue with the next key.
- If we found a key with matching state, and there is no need to
  check the successor relationship, return (true).
- Otherwise check the successor relationship.

In 'keymgr_key_has_successor()' it is enough to check if a key has
a direct successor, so instead of calling 'keymgr_key_is_successor()',
we can just check 'keymgr_direct_dep()'.

In 'dns_keymgr_run()', we want to make sure that there is no
dependency on the keys before retiring excess keys, so replace
'keymgr_key_is_successor()' with 'keymgr_dep()'.
2021-02-03 15:34:36 +01:00
Matthijs Mekking cc38527b63 Implement Equation(2) of "Flexible Key Rollover"
So far the key manager could only deal with two keys in a rollover,
because it used a simplified version of the successor relationship
equation from "Flexible and Robust Key Rollover" paper. The simplified
version assumes only two keys take part in the key rollover and it
for that it is enough to check the direct relationship between two
keys (is key x the direct predecessor of key z and is key z the direct
successor of key x?).

But when a third key (or more keys) comes into the equation, the key
manager would assume that one key (or more) is redundant and removed
it from the zone prematurely.

Fix by implementing Equation(2) correctly, where we check for
dependencies on keys:

z ->T x: Dep(x, T) = ∅ ∧
         (x ∈ Dep(z, T) ∨
          ∃ y ∈ Dep(z, T)(y != z ∧ y ->T x ∧ DyKyRySy = DzKzRzSz))

This says: key z is a successor of key x if:
- key x depends on key z if z is a direct successor of x,
- or if there is another key y that depends on key z that has identical
  key states as key z and key y is a successor of key x.
- Also, key x may not have any other keys depending on it.

This is still a simplified version of Equation(2) (but at least much
better), because the paper allows for a set of keys to depend on a
key. This is defined as the set Dep(x, T). Keys in the set Dep(x, T)
have a dependency on key x for record type T. The BIND implementation
can only have one key in the set Dep(x, T). The function
'keymgr_dep()' stores this key in 'uint32_t *dep' if there is a
dependency.

There are two scenarios where multiple keys can depend on a single key:

1. Rolling keys is faster than the time required to finish the
   rollover procedure. This scenario is covered by the recursive
   implementation, and checking for a chain of direct dependencies
   will suffice.

2. Changing the policy, when a zone is requested to be signed with
   a different key length for example. BIND 9 will not mark successor
   relationships in this case, but tries to move towards the new
   policy. Since there is no successor relationship, the rules are
   even more strict, and the DNSSEC reconfiguration is actually slower
   than required.

Note: this commit breaks the build, because the function definition
of 'keymgr_key_is_successor' changed. This will be fixed in the
following commit.
2021-02-03 15:34:36 +01:00
Ondřej Surý de8058e828 Merge branch '2468-cid-318094-null-pointer-dereferences-reverse_inull' into 'main'
Resolve "CID 318094:  Null pointer dereferences  (REVERSE_INULL)"

Closes #2468

See merge request isc-projects/bind9!4641
2021-02-03 12:08:52 +00:00
Mark AndrewsandOndřej Surý 456d53d1fb Remove redundant 'version == NULL' check
*** CID 318094:  Null pointer dereferences  (REVERSE_INULL)
    /lib/dns/rbtdb.c: 1389 in newversion()
    1383     	version->xfrsize = rbtdb->current_version->xfrsize;
    1384     	RWUNLOCK(&rbtdb->current_version->rwlock, isc_rwlocktype_read);
    1385     	rbtdb->next_serial++;
    1386     	rbtdb->future_version = version;
    1387     	RBTDB_UNLOCK(&rbtdb->lock, isc_rwlocktype_write);
    1388
       CID 318094:  Null pointer dereferences  (REVERSE_INULL)
       Null-checking "version" suggests that it may be null, but it has already been dereferenced on all paths leading to the check.
    1389     	if (version == NULL) {
    1390     		return (result);
    1391     	}
    1392
    1393     	*versionp = version;
    1394
2021-02-03 13:06:27 +01:00
Ondřej Surý adf5051afc Merge branch '1144-dns-over-https-server' into 'main'
Resolve "Encrypted DNS - RFC 8484, DNS over HTTPS, DOH (also DoT comments)"

Closes #1144

See merge request isc-projects/bind9!4644
2021-02-03 12:01:47 +00:00
Evan HuntandOndřej Surý 91718fe4fb CHANGES, release notes 2021-02-03 12:06:17 +01:00
Ondřej Surý 0aacabc6dc Drop gcc:sid:i386 from GitLab CI
Building sid-i386 in Docker no longer works and we don't have a viable
alternative now, so dropping gcc:sid:i386 is our only option in this
very moment.
2021-02-03 12:06:17 +01:00
Evan HuntandOndřej Surý fe99484e14 support "tls ephemeral" with https 2021-02-03 12:06:17 +01:00
Evan HuntandOndřej Surý aa9d51c494 tls and http configuration code was unnecessarily complex
removed the isc_cfg_http_t and isc_cfg_tls_t structures
and the functions that loaded and accessed them; this can
be done using normal config parser functions.
2021-02-03 12:06:17 +01:00
Ondřej Surý 1cc24a2c8b Unit-test fixes and manual page updates for DoH configuration
This commit contains fixes to unit tests to make them work well on
various platforms (in particular ones shipping old versions of
OpenSSL) and for different configurations.

It also updates the generated manpage to include DoH configuration
options.
2021-02-03 12:06:17 +01:00
Artem BoldarievandOndřej Surý 08da09bc76 Initial support for DNS-over-HTTP(S)
This commit completes the support for DNS-over-HTTP(S) built on top of
nghttp2 and plugs it into the BIND. Support for both GET and POST
requests is present, as required by RFC8484.

Both encrypted (via TLS) and unencrypted HTTP/2 connections are
supported. The latter are mostly there for debugging/troubleshooting
purposes and for the means of encryption offloading to third-party
software (as might be desirable in some environments to simplify TLS
certificates management).
2021-02-03 12:06:17 +01:00
Witold KręcickiandOndřej Surý 7a96081360 nghttp2-based HTTP layer in netmgr
This commit includes work-in-progress implementation of
DNS-over-HTTP(S).

Server-side code remains mostly untested, and there is only support
for POST requests.
2021-02-03 12:06:17 +01:00
Witold KręcickiandOndřej Surý cdf9d21731 Add isc_mem_strndup() function
This commit adds an implementation of strndup() function which
allocates memory from the supplied isc_mem_t memory context.
2021-02-03 12:06:17 +01:00
Evan HuntandOndřej Surý 931ccd225f update ARM with "http" grammar
add a link to the http statement grammar and explanations and examples
for configuring DoH listeners.
2021-02-03 12:06:17 +01:00
Evan HuntandOndřej Surý 06951472dd Add parser support for DoH configuration options
This commit adds stub parser support and tests for:
- an "http" global option for HTTP/2 endpoint configuration.
- command line options to set http or https port numbers by
  specifying -p http=PORT or -p https=PORT.  (NOTE: this change
  only affects syntax; specifying HTTP and HTTPS ports on the
  command line currently has no effect.)
- named.conf options "http-port" and "https-port"
- HTTPSPORT environment variable for use when running tests.
2021-02-03 12:06:17 +01:00
Artem BoldarievandOndřej Surý 6b9a31989c Resurrect old TLS code
This commit resurrects the old TLS code from
8f73c70d23.

It also includes numerous stability fixes and support for
isc_nm_cancelread() for the TLS layer.

The code was resurrected to be used for DoH.
2021-02-03 12:06:17 +01:00
Michał Kępień 677cc94671 Merge branch '2448-tweak-sphinx-build-invocations' into 'main'
Tweak sphinx-build invocations

Closes #2448

See merge request isc-projects/bind9!4640
2021-02-03 10:57:51 +00:00
Michał Kępień 51479ed9a3 Make sphinx-build warnings fatal
In order to prevent documentation building issues from being glossed
over, pass the -W command line switch to all sphinx-build invocations.
This causes the latter to return with a non-zero exit code whenever any
Sphinx warnings are triggered.
2021-02-03 11:44:02 +01:00
Michał Kępień 84862e96c1 Address a Sphinx duplicate label warning
Both doc/man/ddns-confgen.rst and doc/man/tsig-keygen.rst include
bin/confgen/tsig-keygen.rst, which defines a "man_tsig-keygen" label.
This triggers the following warning when running sphinx-build with the
-W command line switch in the doc/man/ directory:

    ../../bin/confgen/tsig-keygen.rst:27: WARNING: duplicate label man_tsig-keygen, other instance in /tmp/bind9/doc/man/ddns-confgen.rst

Move the offending label from bin/confgen/tsig-keygen.rst to the proper
spot in doc/arm/manpages.rst to avoid effectively defining it twice in
different source documents while still allowing the relevant man page to
be referenced in the ARM.  Also rename that label so that it more
closely matches the content it points to.  As the label no longer
immediately precedes a section title in its new location, use
:ref:`Title <label>` syntax for the only reference to the
tsig-keygen/ddns-confgen man page in the ARM.
2021-02-03 11:44:02 +01:00
Michał Kępień 33db7ea16d Use separate sphinx-build cache directories
Simultaneously starting multiple sphinx-build instances with the -d
command line switch set to a common value (which is what happens when
e.g. "make -j6 doc" is run) causes intermittent problems which we failed
to notice before because they only trigger Sphinx warnings, not errors,
e.g.:

    WARNING: toctree contains ref to nonexisting file 'reference'

The message above is not triggered because doc/arm/reference.rst is
actually missing from disk at any point, but rather because a temporary
file created by one sphinx-build instance gets truncated by another one
working in parallel (the confusing message quoted above is logged
because of an overly broad "except" statement in Sphinx code).

Prevent this problem from being triggered by making each sphinx-build
process use its own dedicated cache directory.
2021-02-03 11:44:02 +01:00
Matthijs Mekking 62af115fa9 Merge branch '2406-kasp-init-inactive-delete-metadata' into 'main'
Resolve "kasp: look at Inactive/Delete when initializing state files"

Closes #2406

See merge request isc-projects/bind9!4599
2021-02-03 08:49:14 +00:00
Matthijs Mekking 82632fa6d9 Remove initialize goal code
Since keys now have their goals initialized in 'keymgr_key_init()',
remove this redundant piece of code in 'keymgr_key_run()'.
2021-02-03 08:36:14 +01:00
Matthijs Mekking 76cf72e65a Correctly initialize old key with state file
The 'key_init()' function is used to initialize a state file for keys
that don't have one yet. This can happen if you are migrating from a
'auto-dnssec' or 'inline-signing' to a 'dnssec-policy' configuration.

It did not look at the "Inactive" and "Delete" timing metadata and so
old keys left behind in the key directory would also be considered as
a possible active key. This commit fixes this and now explicitly sets
the key goal to OMNIPRESENT for keys that have their "Active/Publish"
timing metadata in the past, but their "Inactive/Delete" timing
metadata in the future. If the "Inactive/Delete" timing metadata is
also in the past, the key goal is set to HIDDEN.

If the "Inactive/Delete" timing metadata is in the past, also the
key states are adjusted to either UNRETENTIVE or HIDDEN, depending on
how far in the past the metadata is set.
2021-02-03 08:36:01 +01:00
Matthijs Mekking d4b2b7072d Update legacy-keys kasp test
The 'legacy-keys.kasp' test checks that a zone with key files but not
yet state files is signed correctly. This test is expanded to cover
the case where old key files still exist in the key directory. This
covers bug #2406 where keys with the "Delete" timing metadata are
picked up by the keymgr as active keys.

Fix the 'legacy-keys.kasp' test, by creating the right key files
(for zone 'legacy-keys.kasp', not 'legacy,kasp').

Use a unique policy for this zone, using shorter lifetimes.

Create two more keys for the zone, and use 'dnssec-settime' to set
the timing metadata in the past, long enough ago so that the keys
should not be considered by the keymgr.

Update the 'key_unused()' test function, and consider keys with
their "Delete" timing metadata in the past as unused.

Extend the test to ensure that the keys to be used are not the old
predecessor keys (with their "Delete" timing metadata in the past).

Update the test so that the checks performed are consistent with the
newly configured policy.
2021-02-03 08:35:56 +01:00
Mark Andrews 6b79a0ce9d Merge branch '1697-isc_rwlock_init-can-no-longer-fail-in-master-clean-up-calls' into 'main'
Resolve "isc_rwlock_init can no longer fail in master, clean up calls."

Closes #2462 and #1697

See merge request isc-projects/bind9!4635
2021-02-03 02:36:24 +00:00
Mark Andrews 3b11bacbb7 Cleanup redundant isc_rwlock_init() result checks 2021-02-03 12:22:33 +11:00
625 changed files with 33218 additions and 23586 deletions
+15
View File
@@ -0,0 +1,15 @@
name: 'Lock down mirror repository'
on:
issues:
types: opened
pull_request:
types: opened
jobs:
lockdown:
runs-on: ubuntu-latest
steps:
- uses: dessant/repo-lockdown@v2
with:
github-token: ${{ github.token }}
-1
View File
@@ -56,7 +56,6 @@ Makefile
Makefile.in Makefile.in
ans.run ans.run
gen.dSYM/ gen.dSYM/
kyua.log
named.memstats named.memstats
named.run named.run
timestamp timestamp
+149 -142
View File
@@ -8,9 +8,6 @@ variables:
CCACHE_DIR: "/ccache" CCACHE_DIR: "/ccache"
SOFTHSM2_CONF: "/var/tmp/softhsm2/softhsm2.conf" SOFTHSM2_CONF: "/var/tmp/softhsm2/softhsm2.conf"
# VirtualBox driver needs to set build_dir to "/builds" in gitlab-runner.toml
KYUA_RESULT: "$CI_PROJECT_DIR/kyua.results"
GIT_DEPTH: 1 GIT_DEPTH: 1
BUILD_PARALLEL_JOBS: 6 BUILD_PARALLEL_JOBS: 6
TEST_PARALLEL_JOBS: 6 TEST_PARALLEL_JOBS: 6
@@ -25,7 +22,7 @@ variables:
# Pass run-time flags to AddressSanitizer to get core dumps on error. # Pass run-time flags to AddressSanitizer to get core dumps on error.
ASAN_OPTIONS_COMMON: abort_on_error=1:disable_coredump=0:unmap_shadow_on_exit=1 ASAN_OPTIONS_COMMON: abort_on_error=1:disable_coredump=0:unmap_shadow_on_exit=1
TSAN_OPTIONS_COMMON: "second_deadlock_stack=1 history_size=7 log_exe_name=true log_path=tsan external_symbolizer_path=/usr/lib/llvm-11/bin/llvm-symbolizer" TSAN_OPTIONS_COMMON: "disable_coredump=0 second_deadlock_stack=1 history_size=7 log_exe_name=true log_path=tsan external_symbolizer_path=/usr/lib/llvm-11/bin/llvm-symbolizer"
TARBALL_EXTENSION: xz TARBALL_EXTENSION: xz
@@ -37,11 +34,15 @@ variables:
WITH_READLINE_LIBEDIT: "--with-readline=libedit" WITH_READLINE_LIBEDIT: "--with-readline=libedit"
WITH_READLINE_READLINE: "--with-readline=readline" WITH_READLINE_READLINE: "--with-readline=readline"
BIND_INSTALL_PATH: "${CI_PROJECT_DIR}/.local" INSTALL_PATH: "${CI_PROJECT_DIR}/.local"
# In multithreaded unit tests, abort on the first failure # In multithreaded unit tests, abort on the first failure
CMOCKA_TEST_ABORT: 1 CMOCKA_TEST_ABORT: 1
# Disable pytest's "cacheprovider" plugin to prevent it from creating
# cross-testrun files as there is no need to use that feature in CI.
PYTEST_ADDOPTS: "-p no:cacheprovider"
# Default platforms to run "stress" tests on # Default platforms to run "stress" tests on
BIND_STRESS_TEST_OS: linux BIND_STRESS_TEST_OS: linux
BIND_STRESS_TEST_ARCH: amd64 BIND_STRESS_TEST_ARCH: amd64
@@ -70,11 +71,6 @@ stages:
- linux - linux
- amd64 - amd64
.linux-i386: &linux_i386
tags:
- linux
- i386
.linux-stress-amd64: &linux_stress_amd64 .linux-stress-amd64: &linux_stress_amd64
tags: tags:
- amd64 - amd64
@@ -105,8 +101,8 @@ stages:
# Alpine Linux # Alpine Linux
.alpine-3.12-amd64: &alpine_3_12_amd64_image .alpine-3.13-amd64: &alpine_3_13_amd64_image
image: "$CI_REGISTRY_IMAGE:alpine-3.12-amd64" image: "$CI_REGISTRY_IMAGE:alpine-3.13-amd64"
<<: *linux_amd64 <<: *linux_amd64
# CentOS # CentOS
@@ -133,10 +129,6 @@ stages:
image: "$CI_REGISTRY_IMAGE:debian-sid-amd64" image: "$CI_REGISTRY_IMAGE:debian-sid-amd64"
<<: *linux_amd64 <<: *linux_amd64
.debian-sid-i386: &debian_sid_i386_image
image: "$CI_REGISTRY_IMAGE:debian-sid-i386"
<<: *linux_i386
# openSUSE Tumbleweed # openSUSE Tumbleweed
.tumbleweed-latest-amd64: &tumbleweed_latest_amd64_image .tumbleweed-latest-amd64: &tumbleweed_latest_amd64_image
@@ -145,18 +137,18 @@ stages:
# Fedora # Fedora
.fedora-33-amd64: &fedora_33_amd64_image .fedora-34-amd64: &fedora_34_amd64_image
image: "$CI_REGISTRY_IMAGE:fedora-33-amd64" image: "$CI_REGISTRY_IMAGE:fedora-34-amd64"
<<: *linux_amd64 <<: *linux_amd64
.fedora-33-arm64: &fedora_33_arm64_image .fedora-34-arm64: &fedora_34_arm64_image
image: "$CI_REGISTRY_IMAGE:fedora-33-arm64" image: "$CI_REGISTRY_IMAGE:fedora-34-arm64"
<<: *linux_stress_arm64 <<: *linux_stress_arm64
# Ubuntu # Ubuntu
.ubuntu-xenial-amd64: &ubuntu_xenial_amd64_image .ubuntu-bionic-amd64: &ubuntu_bionic_amd64_image
image: "$CI_REGISTRY_IMAGE:ubuntu-xenial-amd64" image: "$CI_REGISTRY_IMAGE:ubuntu-bionic-amd64"
<<: *linux_amd64 <<: *linux_amd64
.ubuntu-focal-amd64: &ubuntu_focal_amd64_image .ubuntu-focal-amd64: &ubuntu_focal_amd64_image
@@ -185,8 +177,12 @@ stages:
image: "freebsd-12.2-x86_64" image: "freebsd-12.2-x86_64"
<<: *libvirt_amd64 <<: *libvirt_amd64
.freebsd-13-amd64: &freebsd_13_amd64_image
image: "freebsd-13.0-x86_64"
<<: *libvirt_amd64
.openbsd-amd64: &openbsd_amd64_image .openbsd-amd64: &openbsd_amd64_image
image: "openbsd-6.8-x86_64" image: "openbsd-6.9-x86_64"
<<: *libvirt_amd64 <<: *libvirt_amd64
### Job Templates ### Job Templates
@@ -207,6 +203,12 @@ stages:
- main@isc-projects/bind9 - main@isc-projects/bind9
- /^v9_[1-9][0-9]$/@isc-projects/bind9 - /^v9_[1-9][0-9]$/@isc-projects/bind9
.schedules-tags-web-triggering-rules: &schedules_tags_web_triggering_rules
only:
- schedules
- tags
- web
.precheck: &precheck_job .precheck: &precheck_job
<<: *default_triggering_rules <<: *default_triggering_rules
<<: *base_image <<: *base_image
@@ -226,12 +228,13 @@ stages:
${CONFIGURE} \ ${CONFIGURE} \
--disable-maintainer-mode \ --disable-maintainer-mode \
--enable-developer \ --enable-developer \
--enable-option-checking=fatal \
--enable-dnstap \
--with-cmocka \ --with-cmocka \
--with-libxml2 \ --with-libxml2 \
--with-json-c \ --with-json-c \
--prefix="${BIND_INSTALL_PATH}" \
$EXTRA_CONFIGURE \ $EXTRA_CONFIGURE \
|| cat config.log || (test -s config.log && cat config.log; exit 1)
.check_readline_setup: &check_readline_setup | .check_readline_setup: &check_readline_setup |
if [[ -n "${WITHOUT_READLINE}" ]]; then \ if [[ -n "${WITHOUT_READLINE}" ]]; then \
@@ -248,6 +251,18 @@ stages:
grep "^#define HAVE_READLINE_READLINE" config.h; \ grep "^#define HAVE_READLINE_READLINE" config.h; \
fi fi
# Move the out-of-tree workspace to CI project dir to save it for use in
# dependent jobs.
.save_out_of_tree_workspace: &save_out_of_tree_workspace
- test -n "${OUT_OF_TREE_WORKSPACE}" && mv "${OUT_OF_TREE_WORKSPACE}" "${CI_PROJECT_DIR}"
# Move the artifacts from the out-of-tree build job to their original
# location (the out-of-tree workspace) and then continue work in the
# out-of-tree workspace.
.retrieve_out_of_tree_workspace: &retrieve_out_of_tree_workspace
- test -n "${OUT_OF_TREE_WORKSPACE}" && mv "$(basename "${OUT_OF_TREE_WORKSPACE}")" "${OUT_OF_TREE_WORKSPACE}"
- test -n "${OUT_OF_TREE_WORKSPACE}" && cd "${OUT_OF_TREE_WORKSPACE}"
.build: &build_job .build: &build_job
<<: *default_triggering_rules <<: *default_triggering_rules
stage: build stage: build
@@ -258,11 +273,12 @@ stages:
- *configure - *configure
- *check_readline_setup - *check_readline_setup
- make -j${BUILD_PARALLEL_JOBS:-1} -k all V=1 - make -j${BUILD_PARALLEL_JOBS:-1} -k all V=1
- test -z "${RUN_MAKE_INSTALL}" || make install - test -z "${RUN_MAKE_INSTALL}" || make DESTDIR="${INSTALL_PATH}" install
- test -z "${RUN_MAKE_INSTALL}" || sh util/check-make-install - test -z "${RUN_MAKE_INSTALL}" || DESTDIR="${INSTALL_PATH}" sh util/check-make-install
- if [[ "${CFLAGS}" == *"-fsanitize=address"* ]]; then ( ! grep -F AddressSanitizer config.log ); fi
- if test -z "${OUT_OF_TREE_WORKSPACE}" && test "$(git status --porcelain | grep -Ev '\?\?' | wc -l)" -gt "0"; then git status --short; exit 1; fi - if test -z "${OUT_OF_TREE_WORKSPACE}" && test "$(git status --porcelain | grep -Ev '\?\?' | wc -l)" -gt "0"; then git status --short; exit 1; fi
after_script: after_script:
- test -n "${OUT_OF_TREE_WORKSPACE}" && mv "${OUT_OF_TREE_WORKSPACE}" "${CI_PROJECT_DIR}" - *save_out_of_tree_workspace
needs: needs:
- job: autoreconf - job: autoreconf
artifacts: true artifacts: true
@@ -285,6 +301,7 @@ stages:
"with-openssl=C:/OpenSSL" "with-openssl=C:/OpenSSL"
"with-libxml2=C:/libxml2" "with-libxml2=C:/libxml2"
"with-libuv=C:/libuv" "with-libuv=C:/libuv"
"with-nghttp2=C:/nghttp2"
"without-python" "without-python"
"with-system-tests" "with-system-tests"
x64' x64'
@@ -312,19 +329,17 @@ stages:
stage: system stage: system
before_script: before_script:
- *setup_softhsm - *setup_softhsm
# Move the artifacts from the out-of-tree build job to their original location (the out-of-tree workspace). - *retrieve_out_of_tree_workspace
- test -n "${OUT_OF_TREE_WORKSPACE}" && mv "$(basename "${OUT_OF_TREE_WORKSPACE}")" "${OUT_OF_TREE_WORKSPACE}"
# Continue work in the out-of-tree workspace.
- test -n "${OUT_OF_TREE_WORKSPACE}" && cd "${OUT_OF_TREE_WORKSPACE}"
- *setup_interfaces - *setup_interfaces
script: script:
- cd bin/tests/system - cd bin/tests/system
- make -j${TEST_PARALLEL_JOBS:-1} -k check V=1 - make -j${TEST_PARALLEL_JOBS:-1} -k check V=1
- if git rev-parse > /dev/null 2>&1; then ( ! grep "^I:.*:file.*not removed$" *.log ); fi
after_script: after_script:
- test -n "${OUT_OF_TREE_WORKSPACE}" && cd "${OUT_OF_TREE_WORKSPACE}" - test -n "${OUT_OF_TREE_WORKSPACE}" && cd "${OUT_OF_TREE_WORKSPACE}"
- test -d bind-* && cd bind-* - test -d bind-* && cd bind-*
- cat bin/tests/system/test-suite.log - cat bin/tests/system/test-suite.log
- test -n "${OUT_OF_TREE_WORKSPACE}" && mv "${OUT_OF_TREE_WORKSPACE}" "${CI_PROJECT_DIR}" - *save_out_of_tree_workspace
.system_test: &system_test_job .system_test: &system_test_job
<<: *system_test_common <<: *system_test_common
@@ -342,7 +357,6 @@ stages:
.system_test_tsan: &system_test_tsan_job .system_test_tsan: &system_test_tsan_job
<<: *system_test_common <<: *system_test_common
allow_failure: true
after_script: after_script:
- cat bin/tests/system/test-suite.log - cat bin/tests/system/test-suite.log
- find bin -name 'tsan.*' -exec python3 util/parse_tsan.py {} \; - find bin -name 'tsan.*' -exec python3 util/parse_tsan.py {} \;
@@ -351,14 +365,8 @@ stages:
untracked: true untracked: true
when: on_failure when: on_failure
.kyua_report: &kyua_report_html |
kyua --logfile /dev/null report-html \
--force \
--results-file "$KYUA_RESULT" \
--results-filter "" \
--output kyua_html
.windows_system_test: &windows_system_test_job .windows_system_test: &windows_system_test_job
<<: *schedules_tags_web_triggering_rules
stage: system stage: system
script: script:
- 'Push-Location bin/tests/system' - 'Push-Location bin/tests/system'
@@ -374,19 +382,17 @@ stages:
untracked: true untracked: true
expire_in: "1 day" expire_in: "1 day"
when: on_failure when: on_failure
only:
- schedules
- tags
- web
.unit_test_common: &unit_test_common .unit_test_common: &unit_test_common
<<: *default_triggering_rules <<: *default_triggering_rules
stage: unit stage: unit
before_script: before_script:
- if [ -n "$TCP_CONNECTIONTIMEOUT" ]; then sudo sysctl 'net.inet.tcp.keepinittime=1'; fi
- *setup_softhsm - *setup_softhsm
- *retrieve_out_of_tree_workspace
script: script:
- make -j${TEST_PARALLEL_JOBS:-1} -k unit V=1 - make -j${TEST_PARALLEL_JOBS:-1} -k unit V=1
after_script:
- *save_out_of_tree_workspace
.unit_test: &unit_test_job .unit_test: &unit_test_job
<<: *unit_test_common <<: *unit_test_common
@@ -514,8 +520,6 @@ flake8:
script: script:
- *configure - *configure
- flake8 --max-line-length=80 $(git ls-files '*.py' | grep -vE '(ans\.py|dangerfile\.py)') - flake8 --max-line-length=80 $(git ls-files '*.py' | grep -vE '(ans\.py|dangerfile\.py)')
only:
- merge_requests
pylint: pylint:
<<: *default_triggering_rules <<: *default_triggering_rules
@@ -528,8 +532,6 @@ pylint:
- *configure - *configure
- PYTHONPATH="$PYTHONPATH:$CI_PROJECT_DIR/bin/python" - PYTHONPATH="$PYTHONPATH:$CI_PROJECT_DIR/bin/python"
- pylint --rcfile $CI_PROJECT_DIR/.pylintrc $(git ls-files '*.py' | grep -vE '(ans\.py|dangerfile\.py)') - pylint --rcfile $CI_PROJECT_DIR/.pylintrc $(git ls-files '*.py' | grep -vE '(ans\.py|dangerfile\.py)')
only:
- merge_requests
tarball-create: tarball-create:
stage: precheck stage: precheck
@@ -561,6 +563,8 @@ docs:
script: script:
- *configure - *configure
- make -j${BUILD_PARALLEL_JOBS:-1} -k doc V=1 - make -j${BUILD_PARALLEL_JOBS:-1} -k doc V=1
- qpdf --check doc/arm/_build/latex/Bv9ARM.pdf
- find doc/man/ -maxdepth 1 -name "*.[0-9]" -exec mandoc -T lint "{}" \; | ( ! grep -v -e "skipping paragraph macro. sp after" -e "unknown font, skipping request. ft C" )
needs: needs:
- job: autoreconf - job: autoreconf
artifacts: true artifacts: true
@@ -584,28 +588,28 @@ push:docs:
- main@isc-projects/bind9 - main@isc-projects/bind9
- /^v9_[1-9][0-9]$/@isc-projects/bind9 - /^v9_[1-9][0-9]$/@isc-projects/bind9
# Jobs for regular GCC builds on Alpine Linux 3.12 (amd64) # Jobs for regular GCC builds on Alpine Linux 3.13 (amd64)
gcc:alpine3.12:amd64: gcc:alpine3.13:amd64:
variables: variables:
CC: gcc CC: gcc
CFLAGS: "${CFLAGS_COMMON}" CFLAGS: "${CFLAGS_COMMON}"
EXTRA_CONFIGURE: "--enable-dnstap ${WITHOUT_READLINE}" EXTRA_CONFIGURE: "${WITHOUT_READLINE}"
<<: *alpine_3_12_amd64_image <<: *alpine_3_13_amd64_image
<<: *build_job <<: *build_job
system:gcc:alpine3.12:amd64: system:gcc:alpine3.13:amd64:
<<: *alpine_3_12_amd64_image <<: *alpine_3_13_amd64_image
<<: *system_test_job <<: *system_test_job
needs: needs:
- job: gcc:alpine3.12:amd64 - job: gcc:alpine3.13:amd64
artifacts: true artifacts: true
unit:gcc:alpine3.12:amd64: unit:gcc:alpine3.13:amd64:
<<: *alpine_3_12_amd64_image <<: *alpine_3_13_amd64_image
<<: *unit_test_job <<: *unit_test_job
needs: needs:
- job: gcc:alpine3.12:amd64 - job: gcc:alpine3.13:amd64
artifacts: true artifacts: true
# Jobs for regular GCC builds on CentOS 7 (amd64) # Jobs for regular GCC builds on CentOS 7 (amd64)
@@ -614,7 +618,7 @@ gcc:centos7:amd64:
variables: variables:
CC: gcc CC: gcc
CFLAGS: "${CFLAGS_COMMON}" CFLAGS: "${CFLAGS_COMMON}"
EXTRA_CONFIGURE: "--enable-dnstap --with-libidn2" EXTRA_CONFIGURE: "--with-libidn2"
<<: *centos_centos7_amd64_image <<: *centos_centos7_amd64_image
<<: *build_job <<: *build_job
@@ -662,6 +666,7 @@ gcc:stretch:amd64:
variables: variables:
CC: gcc CC: gcc
CFLAGS: "${CFLAGS_COMMON} -O2" CFLAGS: "${CFLAGS_COMMON} -O2"
EXTRA_CONFIGURE: "--without-cmocka --without-gssapi"
<<: *debian_stretch_amd64_image <<: *debian_stretch_amd64_image
<<: *build_job <<: *build_job
@@ -685,7 +690,7 @@ gcc:buster:amd64:
variables: variables:
CC: gcc CC: gcc
CFLAGS: "${CFLAGS_COMMON} --coverage -O0" CFLAGS: "${CFLAGS_COMMON} --coverage -O0"
EXTRA_CONFIGURE: "--enable-dnstap --with-libidn2 ${WITH_READLINE_LIBEDIT}" EXTRA_CONFIGURE: "--with-libidn2 ${WITH_READLINE_LIBEDIT}"
<<: *debian_buster_amd64_image <<: *debian_buster_amd64_image
<<: *build_job <<: *build_job
@@ -721,7 +726,7 @@ scan-build:
CC: "${CLANG}" CC: "${CLANG}"
CFLAGS: "${CFLAGS_COMMON}" CFLAGS: "${CFLAGS_COMMON}"
CONFIGURE: "${SCAN_BUILD} ./configure" CONFIGURE: "${SCAN_BUILD} ./configure"
EXTRA_CONFIGURE: "--enable-dnstap --with-libidn2" EXTRA_CONFIGURE: "--with-libidn2"
script: script:
- *configure - *configure
- *scan_build - *scan_build
@@ -741,7 +746,7 @@ gcc:sid:amd64:
variables: variables:
CC: gcc CC: gcc
CFLAGS: "${CFLAGS_COMMON} -O3" CFLAGS: "${CFLAGS_COMMON} -O3"
EXTRA_CONFIGURE: "--enable-dnstap --with-libidn2 --without-lmdb" EXTRA_CONFIGURE: "--with-libidn2 --without-lmdb"
RUN_MAKE_INSTALL: 1 RUN_MAKE_INSTALL: 1
<<: *debian_sid_amd64_image <<: *debian_sid_amd64_image
<<: *build_job <<: *build_job
@@ -772,7 +777,7 @@ gcc:out-of-tree:
CC: gcc CC: gcc
CFLAGS: "${CFLAGS_COMMON} -Og" CFLAGS: "${CFLAGS_COMMON} -Og"
CONFIGURE: "${CI_PROJECT_DIR}/configure" CONFIGURE: "${CI_PROJECT_DIR}/configure"
EXTRA_CONFIGURE: "--enable-dnstap --with-libidn2 --with-lmdb" EXTRA_CONFIGURE: "--with-libidn2 --with-lmdb"
RUN_MAKE_INSTALL: 1 RUN_MAKE_INSTALL: 1
OUT_OF_TREE_WORKSPACE: /tmp/out_of_tree_workspace OUT_OF_TREE_WORKSPACE: /tmp/out_of_tree_workspace
<<: *base_image <<: *base_image
@@ -786,17 +791,24 @@ system:gcc:out-of-tree:
artifacts: true artifacts: true
<<: *base_image <<: *base_image
<<: *system_test_job <<: *system_test_job
only: <<: *schedules_tags_web_triggering_rules
- schedules
- tags unit:gcc:out-of-tree:
- web variables:
OUT_OF_TREE_WORKSPACE: /tmp/out_of_tree_workspace
needs:
- job: gcc:out-of-tree
artifacts: true
<<: *base_image
<<: *unit_test_job
<<: *schedules_tags_web_triggering_rules
# Jobs for tarball GCC builds on Debian 10 "buster" (amd64) # Jobs for tarball GCC builds on Debian 10 "buster" (amd64)
gcc:tarball: gcc:tarball:
variables: variables:
CC: gcc CC: gcc
EXTRA_CONFIGURE: "--enable-dnstap --with-libidn2" EXTRA_CONFIGURE: "--with-libidn2"
RUN_MAKE_INSTALL: 1 RUN_MAKE_INSTALL: 1
<<: *base_image <<: *base_image
<<: *build_job <<: *build_job
@@ -807,58 +819,27 @@ gcc:tarball:
needs: needs:
- job: tarball-create - job: tarball-create
artifacts: true artifacts: true
only:
- schedules
- tags
system:gcc:tarball: system:gcc:tarball:
<<: *base_image <<: *base_image
<<: *system_test_job <<: *system_test_job
<<: *schedules_tags_web_triggering_rules
before_script: before_script:
- cd bind-* - cd bind-*
- *setup_interfaces - *setup_interfaces
needs: needs:
- job: gcc:tarball - job: gcc:tarball
artifacts: true artifacts: true
only:
- schedules
- tags
unit:gcc:tarball: unit:gcc:tarball:
<<: *base_image <<: *base_image
<<: *unit_test_job <<: *unit_test_job
<<: *schedules_tags_web_triggering_rules
before_script: before_script:
- cd bind-* - cd bind-*
needs: needs:
- job: gcc:tarball - job: gcc:tarball
artifacts: true artifacts: true
only:
- schedules
- tags
# Jobs for regular GCC builds on Debian "sid" (i386)
gcc:sid:i386:
variables:
CC: gcc
CFLAGS: "${CFLAGS_COMMON}"
EXTRA_CONFIGURE: "--with-libidn2"
<<: *debian_sid_i386_image
<<: *build_job
system:gcc:sid:i386:
<<: *debian_sid_i386_image
<<: *system_test_job
needs:
- job: gcc:sid:i386
artifacts: true
unit:gcc:sid:i386:
<<: *debian_sid_i386_image
<<: *unit_test_job
needs:
- job: gcc:sid:i386
artifacts: true
# Jobs for debug GCC builds on openSUSE Tumbleweed (amd64) # Jobs for debug GCC builds on openSUSE Tumbleweed (amd64)
@@ -884,28 +865,28 @@ unit:gcc:tumbleweed:amd64:
- job: gcc:tumbleweed:amd64 - job: gcc:tumbleweed:amd64
artifacts: true artifacts: true
# Jobs for regular GCC builds on Ubuntu 16.04 Xenial Xerus (amd64) # Jobs for regular GCC builds on Ubuntu 18.04 Bionic Beaver (amd64)
gcc:xenial:amd64: gcc:bionic:amd64:
variables: variables:
CC: gcc CC: gcc
CFLAGS: "${CFLAGS_COMMON} -O2" CFLAGS: "${CFLAGS_COMMON} -O2"
EXTRA_CONFIGURE: "--disable-geoip" EXTRA_CONFIGURE: "--disable-dnstap --disable-geoip"
<<: *ubuntu_xenial_amd64_image <<: *ubuntu_bionic_amd64_image
<<: *build_job <<: *build_job
system:gcc:xenial:amd64: system:gcc:bionic:amd64:
<<: *ubuntu_xenial_amd64_image <<: *ubuntu_bionic_amd64_image
<<: *system_test_job <<: *system_test_job
needs: needs:
- job: gcc:xenial:amd64 - job: gcc:bionic:amd64
artifacts: true artifacts: true
unit:gcc:xenial:amd64: unit:gcc:bionic:amd64:
<<: *ubuntu_xenial_amd64_image <<: *ubuntu_bionic_amd64_image
<<: *unit_test_job <<: *unit_test_job
needs: needs:
- job: gcc:xenial:amd64 - job: gcc:bionic:amd64
artifacts: true artifacts: true
# Jobs for regular GCC builds on Ubuntu 20.04 Focal Fossa (amd64) # Jobs for regular GCC builds on Ubuntu 20.04 Focal Fossa (amd64)
@@ -937,7 +918,7 @@ unit:gcc:focal:amd64:
gcc:asan: gcc:asan:
variables: variables:
CC: gcc CC: gcc
CFLAGS: "${CFLAGS_COMMON} -fsanitize=address,undefined -DISC_MEM_USE_INTERNAL_MALLOC=0" CFLAGS: "${CFLAGS_COMMON} -fsanitize=address,undefined"
LDFLAGS: "-fsanitize=address,undefined" LDFLAGS: "-fsanitize=address,undefined"
EXTRA_CONFIGURE: "--with-libidn2" EXTRA_CONFIGURE: "--with-libidn2"
<<: *base_image <<: *base_image
@@ -964,7 +945,7 @@ unit:gcc:asan:
clang:asan: clang:asan:
variables: variables:
CC: ${CLANG} CC: ${CLANG}
CFLAGS: "${CFLAGS_COMMON} -fsanitize=address,undefined -DISC_MEM_USE_INTERNAL_MALLOC=0" CFLAGS: "${CFLAGS_COMMON} -fsanitize=address,undefined"
LDFLAGS: "-fsanitize=address,undefined" LDFLAGS: "-fsanitize=address,undefined"
EXTRA_CONFIGURE: "--with-libidn2" EXTRA_CONFIGURE: "--with-libidn2"
<<: *base_image <<: *base_image
@@ -995,7 +976,7 @@ gcc:tsan:
<<: *build_job <<: *build_job
variables: variables:
CC: gcc CC: gcc
CFLAGS: "${CFLAGS_COMMON} -fsanitize=thread -DISC_MEM_USE_INTERNAL_MALLOC=0" CFLAGS: "${CFLAGS_COMMON} -fsanitize=thread"
LDFLAGS: "-fsanitize=thread" LDFLAGS: "-fsanitize=thread"
EXTRA_CONFIGURE: "--with-libidn2 --enable-pthread-rwlock" EXTRA_CONFIGURE: "--with-libidn2 --enable-pthread-rwlock"
@@ -1010,7 +991,7 @@ system:gcc:tsan:
unit:gcc:tsan: unit:gcc:tsan:
variables: variables:
TSAN_OPTIONS: ${TSAN_OPTIONS_COMMON} TSAN_OPTIONS: ${TSAN_OPTIONS_COMMON} suppressions=$CI_PROJECT_DIR/tsan-suppressions.txt
<<: *base_image <<: *base_image
<<: *unit_test_tsan_job <<: *unit_test_tsan_job
needs: needs:
@@ -1022,7 +1003,7 @@ clang:tsan:
<<: *build_job <<: *build_job
variables: variables:
CC: "${CLANG}" CC: "${CLANG}"
CFLAGS: "${CFLAGS_COMMON} -fsanitize=thread -DISC_MEM_USE_INTERNAL_MALLOC=0" CFLAGS: "${CFLAGS_COMMON} -fsanitize=thread"
LDFLAGS: "-fsanitize=thread" LDFLAGS: "-fsanitize=thread"
EXTRA_CONFIGURE: "--with-libidn2 --enable-pthread-rwlock" EXTRA_CONFIGURE: "--with-libidn2 --enable-pthread-rwlock"
@@ -1037,7 +1018,7 @@ system:clang:tsan:
unit:clang:tsan: unit:clang:tsan:
variables: variables:
TSAN_OPTIONS: ${TSAN_OPTIONS_COMMON} TSAN_OPTIONS: ${TSAN_OPTIONS_COMMON} suppressions=$CI_PROJECT_DIR/tsan-suppressions.txt
<<: *base_image <<: *base_image
<<: *unit_test_tsan_job <<: *unit_test_tsan_job
needs: needs:
@@ -1049,7 +1030,7 @@ unit:clang:tsan:
gcc:mutexatomics: gcc:mutexatomics:
variables: variables:
CC: gcc CC: gcc
CFLAGS: "${CFLAGS_COMMON} -DISC_MEM_USE_INTERNAL_MALLOC=0" CFLAGS: "${CFLAGS_COMMON}"
EXTRA_CONFIGURE: "--with-libidn2 --enable-mutex-atomics" EXTRA_CONFIGURE: "--with-libidn2 --enable-mutex-atomics"
<<: *base_image <<: *base_image
<<: *build_job <<: *build_job
@@ -1115,25 +1096,25 @@ unit:gcc:softhsm2.4:
- job: gcc:softhsm2.4 - job: gcc:softhsm2.4
artifacts: true artifacts: true
# Jobs for PKCS#11-enabled GCC builds on Fedora 33 (amd64) # Jobs for PKCS#11-enabled GCC builds on Fedora 34 (amd64)
gcc:softhsm2.6: gcc:softhsm2.6:
variables: variables:
CC: gcc CC: gcc
CFLAGS: "${CFLAGS_COMMON} -O1" CFLAGS: "${CFLAGS_COMMON} -O1"
EXTRA_CONFIGURE: "--with-libidn2 --enable-native-pkcs11 --with-pkcs11=/usr/lib64/pkcs11/libsofthsm2.so" EXTRA_CONFIGURE: "--with-libidn2 --enable-native-pkcs11 --with-pkcs11=/usr/lib64/pkcs11/libsofthsm2.so"
<<: *fedora_33_amd64_image <<: *fedora_34_amd64_image
<<: *build_job <<: *build_job
system:gcc:softhsm2.6: system:gcc:softhsm2.6:
<<: *fedora_33_amd64_image <<: *fedora_34_amd64_image
<<: *system_test_job <<: *system_test_job
needs: needs:
- job: gcc:softhsm2.6 - job: gcc:softhsm2.6
artifacts: true artifacts: true
unit:gcc:softhsm2.6: unit:gcc:softhsm2.6:
<<: *fedora_33_amd64_image <<: *fedora_34_amd64_image
<<: *unit_test_job <<: *unit_test_job
needs: needs:
- job: gcc:softhsm2.6 - job: gcc:softhsm2.6
@@ -1148,10 +1129,12 @@ clang:freebsd11:amd64:
USER: gitlab-runner USER: gitlab-runner
<<: *freebsd_11_amd64_image <<: *freebsd_11_amd64_image
<<: *build_job <<: *build_job
<<: *schedules_tags_web_triggering_rules
system:clang:freebsd11:amd64: system:clang:freebsd11:amd64:
<<: *freebsd_11_amd64_image <<: *freebsd_11_amd64_image
<<: *system_test_job <<: *system_test_job
<<: *schedules_tags_web_triggering_rules
variables: variables:
USER: gitlab-runner USER: gitlab-runner
TEST_PARALLEL_JOBS: 4 TEST_PARALLEL_JOBS: 4
@@ -1162,6 +1145,7 @@ system:clang:freebsd11:amd64:
unit:clang:freebsd11:amd64: unit:clang:freebsd11:amd64:
<<: *freebsd_11_amd64_image <<: *freebsd_11_amd64_image
<<: *unit_test_job <<: *unit_test_job
<<: *schedules_tags_web_triggering_rules
needs: needs:
- job: clang:freebsd11:amd64 - job: clang:freebsd11:amd64
artifacts: true artifacts: true
@@ -1171,7 +1155,7 @@ unit:clang:freebsd11:amd64:
clang:freebsd12:amd64: clang:freebsd12:amd64:
variables: variables:
CFLAGS: "${CFLAGS_COMMON}" CFLAGS: "${CFLAGS_COMMON}"
EXTRA_CONFIGURE: "--enable-dnstap ${WITH_READLINE_EDITLINE}" EXTRA_CONFIGURE: "${WITH_READLINE_EDITLINE}"
USER: gitlab-runner USER: gitlab-runner
<<: *freebsd_12_amd64_image <<: *freebsd_12_amd64_image
<<: *build_job <<: *build_job
@@ -1193,12 +1177,40 @@ unit:clang:freebsd12:amd64:
- job: clang:freebsd12:amd64 - job: clang:freebsd12:amd64
artifacts: true artifacts: true
# Jobs for Clang builds on FreeBSD 13 (amd64)
clang:freebsd13:amd64:
variables:
CFLAGS: "${CFLAGS_COMMON}"
EXTRA_CONFIGURE: "${WITH_READLINE_LIBEDIT}"
USER: gitlab-runner
<<: *freebsd_13_amd64_image
<<: *build_job
system:clang:freebsd13:amd64:
<<: *freebsd_13_amd64_image
<<: *system_test_job
variables:
USER: gitlab-runner
TEST_PARALLEL_JOBS: 4
needs:
- job: clang:freebsd13:amd64
artifacts: true
unit:clang:freebsd13:amd64:
<<: *freebsd_13_amd64_image
<<: *unit_test_job
needs:
- job: clang:freebsd13:amd64
artifacts: true
# Jobs for Clang builds on OpenBSD (amd64) # Jobs for Clang builds on OpenBSD (amd64)
clang:openbsd:amd64: clang:openbsd:amd64:
variables: variables:
CC: clang CC: clang
USER: gitlab-runner USER: gitlab-runner
EXTRA_CONFIGURE: "--disable-dnstap"
<<: *openbsd_amd64_image <<: *openbsd_amd64_image
<<: *build_job <<: *build_job
@@ -1219,8 +1231,6 @@ unit:clang:openbsd:amd64:
<<: *unit_test_job <<: *unit_test_job
variables: variables:
USER: gitlab-runner USER: gitlab-runner
# There's no socket option on OpenBSD, so we need to set this globally
TCP_CONNECTIONTIMEOUT: 1
needs: needs:
- job: clang:openbsd:amd64 - job: clang:openbsd:amd64
artifacts: true artifacts: true
@@ -1246,12 +1256,9 @@ system:msvc:windows:amd64:
msvc-debug:windows:amd64: msvc-debug:windows:amd64:
<<: *windows_server_2016_amd64_image <<: *windows_server_2016_amd64_image
<<: *windows_build_job <<: *windows_build_job
<<: *schedules_tags_web_triggering_rules
variables: variables:
VSCONF: Debug VSCONF: Debug
only:
- schedules
- tags
- web
system:msvc-debug:windows:amd64: system:msvc-debug:windows:amd64:
<<: *windows_server_2016_amd64_image <<: *windows_server_2016_amd64_image
@@ -1343,7 +1350,7 @@ coverity:
variables: variables:
CC: gcc CC: gcc
CFLAGS: "${CFLAGS_COMMON} -Og" CFLAGS: "${CFLAGS_COMMON} -Og"
EXTRA_CONFIGURE: "--enable-dnstap --with-libidn2" EXTRA_CONFIGURE: "--with-libidn2"
script: script:
- *coverity_cache_prep - *coverity_cache_prep
- *configure - *configure
@@ -1409,10 +1416,10 @@ respdiff:
- *setup_interfaces - *setup_interfaces
- *setup_softhsm - *setup_softhsm
- make -j${BUILD_PARALLEL_JOBS:-1} -k all V=1 - make -j${BUILD_PARALLEL_JOBS:-1} -k all V=1
- make install - make DESTDIR="${INSTALL_PATH}" install
- git clone --depth 1 https://gitlab-ci-token:${CI_JOB_TOKEN}@gitlab.isc.org/isc-private/bind-qa.git - git clone --depth 1 https://gitlab-ci-token:${CI_JOB_TOKEN}@gitlab.isc.org/isc-private/bind-qa.git
- cd bind-qa/bind9/stress - cd bind-qa/bind9/stress
- DIG="${BIND_INSTALL_PATH}/bin/dig" WORKSPACE="${CI_PROJECT_DIR}" bash stress.sh - LD_LIBRARY_PATH="${INSTALL_PATH}/usr/local/lib" BIND_INSTALL_PATH="${INSTALL_PATH}/usr/local" WORKSPACE="${CI_PROJECT_DIR}" bash stress.sh
needs: needs:
- job: autoreconf - job: autoreconf
artifacts: true artifacts: true
@@ -1422,8 +1429,8 @@ respdiff:
when: always when: always
timeout: 2h timeout: 2h
stress:authoritative:fedora:33:amd64: stress:authoritative:fedora:34:amd64:
<<: *fedora_33_amd64_image <<: *fedora_34_amd64_image
<<: *linux_stress_amd64 <<: *linux_stress_amd64
<<: *stress_job <<: *stress_job
variables: variables:
@@ -1436,8 +1443,8 @@ stress:authoritative:fedora:33:amd64:
variables: variables:
- $CI_COMMIT_TAG || ($BIND_STRESS_TEST_OS =~ /linux/i && $BIND_STRESS_TEST_MODE =~ /authoritative/i && $BIND_STRESS_TEST_ARCH =~ /amd64/i) - $CI_COMMIT_TAG || ($BIND_STRESS_TEST_OS =~ /linux/i && $BIND_STRESS_TEST_MODE =~ /authoritative/i && $BIND_STRESS_TEST_ARCH =~ /amd64/i)
stress:recursive:fedora:33:amd64: stress:recursive:fedora:34:amd64:
<<: *fedora_33_amd64_image <<: *fedora_34_amd64_image
<<: *linux_stress_amd64 <<: *linux_stress_amd64
<<: *stress_job <<: *stress_job
variables: variables:
@@ -1450,8 +1457,8 @@ stress:recursive:fedora:33:amd64:
variables: variables:
- $CI_COMMIT_TAG || ($BIND_STRESS_TEST_OS =~ /linux/i && $BIND_STRESS_TEST_MODE =~ /recursive/i && $BIND_STRESS_TEST_ARCH =~ /amd64/i) - $CI_COMMIT_TAG || ($BIND_STRESS_TEST_OS =~ /linux/i && $BIND_STRESS_TEST_MODE =~ /recursive/i && $BIND_STRESS_TEST_ARCH =~ /amd64/i)
stress:authoritative:fedora:33:arm64: stress:authoritative:fedora:34:arm64:
<<: *fedora_33_arm64_image <<: *fedora_34_arm64_image
<<: *linux_stress_arm64 <<: *linux_stress_arm64
<<: *stress_job <<: *stress_job
variables: variables:
@@ -1464,8 +1471,8 @@ stress:authoritative:fedora:33:arm64:
variables: variables:
- $CI_COMMIT_TAG || ($BIND_STRESS_TEST_OS =~ /linux/i && $BIND_STRESS_TEST_MODE =~ /authoritative/i && $BIND_STRESS_TEST_ARCH =~ /arm64/i) - $CI_COMMIT_TAG || ($BIND_STRESS_TEST_OS =~ /linux/i && $BIND_STRESS_TEST_MODE =~ /authoritative/i && $BIND_STRESS_TEST_ARCH =~ /arm64/i)
stress:recursive:fedora:33:arm64: stress:recursive:fedora:34:arm64:
<<: *fedora_33_arm64_image <<: *fedora_34_arm64_image
<<: *linux_stress_arm64 <<: *linux_stress_arm64
<<: *stress_job <<: *stress_job
variables: variables:
+33
View File
@@ -0,0 +1,33 @@
<!--
THIS ISSUE TEMPLATE IS INTENDED ONLY FOR INTERNAL USE.
If the bug you are reporting is potentially security-related - for example,
if it involves an assertion failure or other crash in `named` that can be
triggered repeatedly - then please do *NOT* report it here, but send an
email to [security-officer@isc.org](security-officer@isc.org).
-->
### CVE-specific actions
- [ ] Assign a CVE identifier
- [ ] Determine CVSS score
- [ ] Determine the range of BIND versions affected (including the Subscription Edition)
- [ ] Determine whether workarounds for the problem exists
- [ ] Create a draft of the security advisory and put the information above in there
- [ ] Prepare a detailed description of the problem which should include the following by default:
- instructions for reproducing the problem (a system test is good enough)
- explanation of code flow which triggers the problem (a system test is *not* good enough)
- [ ] Prepare a private merge request containing the following items in separate commits:
- a test for the issue (may be moved to a separate merge request for deferred merging)
- a fix for the issue
- documentation updates (`CHANGES`, release notes, anything else applicable)
- [ ] Ensure the merge request from the previous step is reviewed by SWENG staff and has no outstanding discussions
- [ ] Ensure the documentation changes introduced by the merge request addressing the problem are reviewed by Support and Marketing staff
- [ ] Prepare backports of the merge request addressing the problem for all affected (and still maintained) BIND branches (backporting might affect the issue's scope and/or description)
- [ ] Prepare a standalone patch for the last stable release of each affected (and still maintained) BIND branch
### Release-specific actions
- [ ] Create/update the private issue containing links to fixes & reproducers for all CVEs fixed in a given release cycle
- [ ] Reserve a block of `CHANGES` placeholders once the complete set of vulnerabilities fixed in a given release cycle is determined
- [ ] Ensure the merge requests containing CVE fixes are merged into `security-*` branches in CVE identifier order
+4 -2
View File
@@ -71,7 +71,7 @@
- [ ] ***(Support)*** Publish links to downloads on ISC website. - [ ] ***(Support)*** Publish links to downloads on ISC website.
- [ ] ***(Support)*** Write release email to *bind-announce*. - [ ] ***(Support)*** Write release email to *bind-announce*.
- [ ] ***(Support)*** Write email to *bind-users* (if a major release). - [ ] ***(Support)*** Write email to *bind-users* (if a major release).
- [ ] ***(Support)*** Send eligible customers updated links to the Subscription Edition. - [ ] ***(Support)*** Send eligible customers updated links to the Subscription Edition (update the -S edition delivery tickets, even if those links were provided earlier via an ASN ticket).
- [ ] ***(Support)*** Update tickets in case of waiting support customers. - [ ] ***(Support)*** Update tickets in case of waiting support customers.
- [ ] ***(QA)*** Build and test any outstanding private packages. - [ ] ***(QA)*** Build and test any outstanding private packages.
- [ ] ***(QA)*** Build public packages (`*.deb`, RPMs). - [ ] ***(QA)*** Build public packages (`*.deb`, RPMs).
@@ -85,7 +85,9 @@
- [ ] ***(QA)*** Merge the automatically prepared `prep 9.x.y` commit which updates `version` and documentation on the release branch into the relevant maintenance branch (`v9_x`). - [ ] ***(QA)*** Merge the automatically prepared `prep 9.x.y` commit which updates `version` and documentation on the release branch into the relevant maintenance branch (`v9_x`).
- [ ] ***(QA)*** For each maintained branch, update the `BIND_BASELINE_VERSION` variable for the `abi-check` job in `.gitlab-ci.yml` to the latest published BIND version tag for a given branch. - [ ] ***(QA)*** For each maintained branch, update the `BIND_BASELINE_VERSION` variable for the `abi-check` job in `.gitlab-ci.yml` to the latest published BIND version tag for a given branch.
- [ ] ***(QA)*** Prepare empty release notes for the next set of releases. - [ ] ***(QA)*** Prepare empty release notes for the next set of releases.
- [ ] ***(QA)*** Sanitize all confidential issues assigned to the release milestone and make them public. - [ ] ***(QA)*** Sanitize confidential issues which are assigned to the current release milestone and do not describe a security vulnerability, then make them public.
- [ ] ***(QA)*** Sanitize confidential issues which are assigned to older release milestones and describe security vulnerabilities, then make them public if appropriate[^2].
- [ ] ***(QA)*** Update QA tools used in GitLab CI (e.g. Flake8, PyLint) by modifying the relevant `Dockerfile`. - [ ] ***(QA)*** Update QA tools used in GitLab CI (e.g. Flake8, PyLint) by modifying the relevant `Dockerfile`.
[^1]: If not, use the time remaining until the tagging deadline to ensure all outstanding issues are either resolved or moved to a different milestone. [^1]: If not, use the time remaining until the tagging deadline to ensure all outstanding issues are either resolved or moved to a different milestone.
[^2]: As a rule of thumb, security vulnerabilities which have reproducers merged to the public repository are considered okay for full disclosure.
+1
View File
@@ -13,6 +13,7 @@ extraction:
- "libidn2-dev" - "libidn2-dev"
- "libmaxminddb-dev" - "libmaxminddb-dev"
- "libuv1-dev" - "libuv1-dev"
- "libnghttp2-dev"
configure: configure:
command: command:
- "autoreconf -fi" - "autoreconf -fi"
+1
View File
@@ -5,3 +5,4 @@ disable=
C0116, # missing-function-docstring C0116, # missing-function-docstring
R0801, # duplicate-code R0801, # duplicate-code
C0103, # invalid-name C0103, # invalid-name
C0415,# import-outside-toplevel
+402 -32
View File
@@ -1,37 +1,408 @@
5574. [func] Incoming zone transfers can now use TLS. 5652. [bug] Copy and paste error caused the socket option to
Addresses in a "primaries" list take an optional be enabled instead of disabled. [GL #2746]
"tls" argument, specifying either a previously
configured "tls" block or "ephemeral"; SOA queries
and zone transfer requests will then be sent via
TLS. [GL #2392]
5573. [func] Also return stale data if an error occurred and we are 5651. [func] Refactor zone dumping to be processed asynchronously
not resuming. Only start the stale-refresh-time window via the uv_work_t thread pool API. [GL #2732]
if we timed out. [GL #2434]
5572. [bug] Address potential double free in generatexml. 5650. [bug] Prevent a crash that could occur if serve-stale
was enabled and a prefetch was triggered during a
query restart. [GL #2733]
5649. [bug] If a query was answered with stale data on a server
with DNS64 enabled, an assertion could occur if a
non-stale answer arrived afterward. [GL #2731]
5648. [bug] The calculation of the estimated IXFR transaction
size by dns_journal_iter_init() was invalid. [GL #2685]
5647. [func] The interfacemgr has been refactored to use fewer
clientmgr objects, which in turn use fewer memory
contexts and tasks. This should result in less
fragmented memory and better startup performance.
[GL #2433]
5646. [bug] The default TCP timeout for rndc has been increased
to 60 seconds. This was its original value, but it
had been inadvertently lowered to 10. [GL #2643]
5645. [cleanup] Remove the rarely-used dns_name_copy() function
and rename dns_name_copynf() to dns_name_copy().
[GL !5081]
5644. [bug] Fix a race condition in reading and writing key files
for KASP zones in multiple views. [GL #1875]
5643. [placeholder]
5642. [bug] Check "key-directory" conflicts in "named.conf" for
zones in multiple views with different "dnssec-policy".
[GL #2463].
5641. [bug] Address potential memory leak in dst_key_fromnamedfile.
[GL #2689]
5640. [func] Add new configuration option to set the operating system
receive and send buffers. [GL #2313]
5639. [bug] Check that the first and last SOA record of an AXFR
are consistent. [GL #2528]
--- 9.17.13 released ---
5638. [bug] Improvements related to network manager/task manager
integration:
- isc_managers_create() and isc_managers_destroy()
functions were added to handle setup and teardown of
netmgr, taskmgr, timermgr, and socketmgr, since these
require a precise order of operations now.
- Event queue processing is now quantized to prevent
infinite looping.
- The netmgr can now be paused from within a netmgr
thread.
- Deadlocks due to a conflict between netmgr's
pause/resume and listen/stoplistening operations were
fixed.
[GL #2654]
5637. [placeholder]
5636. [bug] named and named-checkconf did not report an error when
multiple zones with the "dnssec-policy" option set were
using the same zone file. This has been fixed.
[GL #2603]
5635. [bug] Journal compaction could fail when a journal with
invalid transaction headers was not detected at startup.
This has been fixed. [GL #2670]
5634. [bug] If "dnssec-policy" was active and a private key file was
temporarily offline during a rekey event, named could
incorrectly introduce replacement keys and break a
signed zone. This has been fixed. [GL #2596]
5633. [doc] The "inline-signing" option was incorrectly described as
being inherited from the "options"/"view" levels and was
incorrectly accepted at those levels without effect.
This has been fixed. [GL #2536]
5632. [func] Add a new built-in KASP, "insecure", which is used to
transition a zone from a signed to an unsigned state.
The existing built-in KASP "none" should no longer be
used to unsign a zone. [GL #2645]
5631. [protocol] Update the implementation of the ZONEMD RR type to match
RFC 8976. [GL #2658]
5630. [func] Treat DNSSEC responses containing NSEC3 records with
iteration counts greater than 150 as insecure.
[GL #2445]
5629. [func] Reduce the maximum supported number of NSEC3 iterations
that can be configured for a zone to 150. [GL #2642]
5628. [bug] Host and nslookup could crash upon receiving a SERVFAIL
response. This has been fixed. [GL #2564]
5627. [bug] RRSIG(SOA) RRsets placed anywhere other than at the zone
apex were triggering infinite resigning loops. This has
been fixed. [GL #2650]
5626. [bug] When generating zone signing keys, KASP now also checks
for key ID conflicts among newly created keys, rather
than just between new and existing ones. [GL #2628]
5625. [bug] A deadlock could occur when multiple "rndc addzone",
"rndc delzone", and/or "rndc modzone" commands were
invoked simultaneously for different zones. This has
been fixed. [GL #2626]
5624. [func] Task manager events are now processed inside network
manager loops. The task manager no longer needs its own
set of worker threads, which improves resolver
performance. [GL #2638]
5623. [bug] When named was shut down during an ongoing zone
transfer, xfrin_fail() could incorrectly be called
twice. This has been fixed. [GL #2630]
5622. [cleanup] The lib/samples/ directory has been removed, as export
versions of libraries are no longer maintained.
[GL !4835]
5621. [placeholder]
5620. [bug] If zone journal files written by BIND 9.16.11 or earlier
were present when BIND was upgraded, the zone file for
that zone could have been inadvertently rewritten with
the current zone contents. This caused the original zone
file structure (e.g. comments, $INCLUDE directives) to
be lost, although the zone data itself was preserved.
This has been fixed. [GL #2623]
5619. [protocol] Implement draft-vandijk-dnsop-nsec-ttl, updating the
protocol such that NSEC(3) TTL values are set to the
minimum of the SOA MINIMUM value or the SOA TTL.
[GL #2347]
5618. [bug] Change 5149 introduced some inconsistencies in the way
record TTLs were presented in cache dumps. These
inconsistencies have been eliminated. [GL #389]
[GL #2289]
--- 9.17.12 released ---
5617. [placeholder]
5616. [security] named crashed when a DNAME record placed in the ANSWER
section during DNAME chasing turned out to be the final
answer to a client query. (CVE-2021-25215) [GL #2540]
5615. [security] Insufficient IXFR checks could result in named serving a
zone without an SOA record at the apex, leading to a
RUNTIME_CHECK assertion failure when the zone was
subsequently refreshed. This has been fixed by adding an
owner name check for all SOA records which are included
in a zone transfer. (CVE-2021-25214) [GL #2467]
5614. [bug] Ensure all resources are properly cleaned up when a call
to gss_accept_sec_context() fails. [GL #2620]
5613. [bug] It was possible to write an invalid transaction header
in the journal file for a managed-keys database after
upgrading. This has been fixed. Invalid headers in
existing journal files are detected and named is able
to recover from them. [GL #2600]
5612. [bug] Continued refactoring of the network manager:
- allow recovery from read and connect timeout events,
- ensure that calls to isc_nm_*connect() always
return the connection status via a callback
function.
[GL #2401]
5611. [func] Set "stale-answer-client-timeout" to "off" by default.
[GL #2608]
5610. [bug] Prevent a crash which could happen when a lookup
triggered by "stale-answer-client-timeout" was attempted
right after recursion for a client query finished.
[GL #2594]
5609. [func] The ISC implementation of SPNEGO was removed from BIND 9
source code. It was no longer necessary as all major
contemporary Kerberos/GSSAPI libraries include support
for SPNEGO. [GL #2607]
5608. [bug] When sending queries over TCP, dig now properly handles
"+tries=1 +retry=0" by not retrying the connection when
the remote server closes the connection prematurely.
[GL #2490]
5607. [bug] As "rndc dnssec -checkds" and "rndc dnssec -rollover"
commands may affect the next scheduled key event,
reconfiguration of zone keys is now triggered after
receiving either of these commands to prevent
unnecessary key rollover delays. [GL #2488]
5606. [bug] CDS/CDNSKEY DELETE records are now removed when a zone
transitions from a secure to an insecure state.
named-checkzone also no longer reports an error when
such records are found in an unsigned zone. [GL #2517]
5605. [bug] "dig -u" now uses the CLOCK_REALTIME clock source for
more accurate time reporting. [GL #2592]
5604. [experimental] A "filter-a.so" plugin, which is similar to the
"filter-aaaa.so" plugin but which omits A records
instead of AAAA records, has been added. Thanks to
GitLab user @treysis. [GL #2585]
5603. [placeholder]
5602. [bug] Fix TCPDNS and TLSDNS timers in Network Manager. This
makes the "tcp-initial-timeout" and "tcp-idle-timeout"
options work correctly again. [GL #2583]
5601. [bug] Zones using KASP could not be thawed after they were
frozen using "rndc freeze". This has been fixed.
[GL #2523]
5600. [bug] Send a full certificate chain instead of just the leaf
certificate to DNS-over-TLS (DoT) and DNS-over-HTTPS
(DoH) clients. This makes BIND 9 DoT/DoH servers
compatible with a broader set of clients. [GL #2514]
5599. [bug] Fix a named crash which occurred after skipping a
primary server while transferring a zone over TLS.
[GL #2562]
5598. [port] Silence -Wchar-subscripts compiler warnings triggered on
some platforms due to calling character classification
functions declared in the <ctype.h> header with
arguments of type char. [GL #2567]
--- 9.17.11 released ---
5597. [bug] When serve-stale was enabled and starting the recursive
resolution process for a query failed, a named instance
could crash if it was configured as both a recursive and
authoritative server. This problem was introduced by
change 5573 and has now been fixed. [GL #2565]
5596. [func] Client-side support for DNS-over-HTTPS (DoH) has been
added to dig. "dig +https" can now query a server via
HTTP/2. [GL #1641]
5595. [cleanup] Public header files for BIND 9 libraries no longer
directly include third-party library headers. This
prevents the need to include paths to third-party header
files in CFLAGS whenever BIND 9 public header files are
used, which could cause build-time issues on hosts with
older versions of BIND 9 installed. [GL #2357]
5594. [bug] Building with --enable-dnsrps --enable-dnsrps-dl failed.
[GL #2298]
5593. [bug] Journal files written by older versions of named can now
be read when loading zones, so that journal
incompatibility does not cause problems on upgrade.
Outdated journals are updated to the new format after
loading. [GL #2505]
5592. [bug] Prevent hazard pointer table overflows on machines with
many cores, by allowing the thread IDs (serving as
indices into hazard pointer tables) of finished threads
to be reused by those created later. [GL #2396]
5591. [bug] Fix a crash that occurred when
"stale-answer-client-timeout" was triggered without any
(stale) data available in the cache to answer the query.
[GL #2503]
5590. [bug] NSEC3 records were not immediately created for dynamic
zones using NSEC3 with "dnssec-policy", resulting in
such zones going bogus. Add code to process the
NSEC3PARAM queue at zone load time so that NSEC3 records
for such zones are created immediately. [GL #2498]
5589. [placeholder]
5588. [func] Add a new "purge-keys" option for "dnssec-policy". This
option determines the period of time for which key files
are retained after they become obsolete. [GL #2408]
5587. [bug] A standalone libtool script no longer needs to be
present in PATH to build BIND 9 from a source tarball
prepared using "make dist". [GL #2504]
5586. [bug] An invalid direction field in a LOC record resulted in
an INSIST failure when a zone file containing such a
record was loaded. [GL #2499]
5585. [func] Memory contexts and memory pool implementations were
refactored to reduce lock contention for shared memory
contexts by replacing mutexes with atomic operations.
The internal memory allocator was simplified so that it
is only a thin wrapper around the system allocator. This
change made the "-M external" named option redundant and
it was therefore removed. [GL #2433]
5584. [bug] No longer set the IP_DONTFRAG option on UDP sockets, to
prevent dropping outgoing packets exceeding
"max-udp-size". [GL #2466]
5583. [func] Changes to DNS-over-HTTPS (DoH) configuration syntax:
- When "http" is specified in "listen-on" or
"listen-on-v6" statements, "tls" must also now be
specified. If an unencrypted connection is desired
(for example, when running behind a reverse proxy),
use "tls none".
- "http default" can now be specified in "listen-on" and
"listen-on-v6" statements to use the default HTTP
endpoint of "/dns-query". It is no longer necessary to
include an "http" statement in named.conf unless
overriding this value.
[GL #2472]
5582. [bug] BIND 9 failed to build when static OpenSSL libraries
were used and the pkg-config files for libssl and/or
libcrypto were unavailable. This has been fixed by
ensuring that the correct linking order for libssl and
libcrypto is always used. [GL #2402]
5581. [bug] Fix a memory leak that occurred when inline-signed zones
were added to the configuration, followed by a
reconfiguration of named. [GL #2041]
5580. [test] The system test framework no longer differentiates
between SKIPPED and UNTESTED system test results. Any
system test which is not run is now marked as SKIPPED.
[GL !4517]
5579. [bug] If an invalid key name (e.g. "a..b") was specified in a
primaries list in named.conf, the wrong size was passed
to isc_mem_put(), resulting in the returned memory being
put on the wrong free list. This prevented named from
starting up. [GL #2460]
--- 9.17.10 released ---
5578. [protocol] Make "check-names" accept A records below "_spf",
"_spf_rate", and "_spf_verify" labels in order to cater
for the "exists" SPF mechanism specified in RFC 7208
section 5.7 and appendix D.1. [GL #2377]
5577. [bug] Fix the "three is a crowd" key rollover bug in KASP by
correctly implementing Equation (2) of the "Flexible and
Robust Key Rollover" paper. [GL #2375]
5576. [experimental] Initial server-side implementation of DNS-over-HTTPS
(DoH). Support for both TLS-encrypted and unencrypted
HTTP/2 connections has been added to the network manager
and integrated into named. (Note: there is currently no
client-side support for DNS-over-HTTPS; this will be
added to dig in a future release.) [GL #1144]
5575. [bug] When migrating to KASP, BIND 9 considered keys with the
"Inactive" and/or "Delete" timing metadata to be
possible active keys. This has been fixed. [GL #2406]
5574. [func] Incoming zone transfers can now use TLS. Addresses in a
"primaries" list take an optional "tls" argument,
specifying either a previously configured "tls" block or
"ephemeral"; SOA queries and zone transfer requests are
then sent via TLS. [GL #2392]
5573. [func] When serve-stale is enabled and stale data is available,
named now returns stale answers upon encountering any
unexpected error in the query resolution process.
However, the "stale-refresh-time" window is still only
started upon a timeout. [GL #2434]
5572. [bug] Address potential double free in generatexml().
[GL #2420] [GL #2420]
5571. [bug] If a zone had a non-builtin named allow-update acl 5571. [bug] named failed to start when its configuration included a
named failed to start. [GL #2413] zone with a non-builtin "allow-update" ACL attached.
[GL #2413]
5570. [bug] Improve the performance of dnssec-verify by reducing 5570. [bug] Improve performance of the DNSSEC verification code by
the number of repeated calls to dns_dnssec_keyfromrdata. reducing the number of repeated calls to
[GL #2073] dns_dnssec_keyfromrdata(). [GL #2073]
5569. [bug] Emit useful error message when 'rndc retransfer' is 5569. [bug] Emit useful error message when "rndc retransfer" is
applied to a zone of inappropriate type. [GL #2342] applied to a zone of inappropriate type. [GL #2342]
5568. [bug] Fixed a crash in "dnssec-keyfromlabel" when using ECDSA 5568. [bug] Fixed a crash in "dnssec-keyfromlabel" when using ECDSA
keys. [GL #2178] keys. [GL #2178]
5567. [bug] Dig now reports unknown dash options while pre-parsing 5567. [bug] Dig now reports unknown dash options while pre-parsing
the options. This prevents '-multi' instead of the options. This prevents "-multi" instead of "+multi"
'+multi' reporting memory usage before ending option from reporting memory usage before ending option parsing
parsing on 'Invalid option: -lti'. [GL #2403] with "Invalid option: -lti". [GL #2403]
5566. [func] Add "stale-answer-client-timeout" option, which 5566. [func] Add "stale-answer-client-timeout" option, which is the
is the amount of time a recursive resolver waits before amount of time a recursive resolver waits before
attempting to answer the query using stale data from attempting to answer the query using stale data from
cache. [GL #2247] cache. [GL #2247]
@@ -39,26 +410,25 @@
BIND 9 version number, in an effort to tightly couple BIND 9 version number, in an effort to tightly couple
internal libraries with a specific release. [GL #2387] internal libraries with a specific release. [GL #2387]
5564. [cleanup] Refactored the network manager TLSDNS module to use 5564. [cleanup] Network manager's TLSDNS module was refactored to use
libuv and libssl directly, rather than opening a libuv and libssl directly instead of a stack of TCP/TLS
TLS/TCP socket stack. [GL #2235] sockets. [GL #2335]
5563. [cleanup] Changed several obsolete configuration options to 5563. [cleanup] Changed several obsolete configuration options to
ancient, making them into fatal errors. Also cleaned ancient, making them fatal errors. Also cleaned up the
up the number of clause flags in the configuration number of clause flags in the configuration parser.
parser. [GL #1086] [GL #1086]
5562. [placeholder] 5562. [placeholder]
5561. [bug] KASP incorrectly set signature validity to the value 5561. [bug] KASP incorrectly set signature validity to the value of
of the DNSKEY signature validity. This is now fixed. the DNSKEY signature validity. This is now fixed.
[GL #2383] [GL #2383]
5560. [func] The default value of "max-stale-ttl" has been changed 5560. [func] The default value of "max-stale-ttl" has been changed
from 12 hours to 1 day and the default value of from 12 hours to 1 day and the default value of
"stale-answer-ttl" has been changed from 1 second to "stale-answer-ttl" has been changed from 1 second to 30
30 seconds, following RFC 8767 recommendations. seconds, following RFC 8767 recommendations. [GL #2248]
[GL #2248]
--- 9.17.9 released --- --- 9.17.9 released ---
+22
View File
@@ -367,3 +367,25 @@ distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
-----------------------------------------------------------------------------
Copyright Joyent, Inc. and other Node contributors. All rights reserved.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to
deal in the Software without restriction, including without limitation the
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
sell copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
IN THE SOFTWARE.
+1
View File
@@ -10,6 +10,7 @@ AM_V_SPHINX_0 = @echo " SPHINX $@";
SPHINXBUILDDIR = $(builddir)/_build SPHINXBUILDDIR = $(builddir)/_build
common_SPHINXOPTS = \ common_SPHINXOPTS = \
-W \
-c $(srcdir) \ -c $(srcdir) \
-a \ -a \
$(SPHINX_V) $(SPHINX_V)
+3 -2
View File
@@ -3,8 +3,9 @@
AM_CPPFLAGS += \ AM_CPPFLAGS += \
$(CMOCKA_CFLAGS) \ $(CMOCKA_CFLAGS) \
-DTESTS_DIR=\"$(abs_srcdir)\" \ -DNAMED_PLUGINDIR=\"$(libdir)/named\" \
-DNAMED_PLUGINDIR=\"$(libdir)/named\" -DSKIPPED_TEST_EXIT_CODE=77 \
-DTESTS_DIR=\"$(abs_srcdir)\"
LDADD = \ LDADD = \
$(CMOCKA_LIBS) $(CMOCKA_LIBS)
-30
View File
@@ -18,11 +18,6 @@ AM_LDFLAGS += \
-Wl,-flat_namespace -Wl,-flat_namespace
endif HOST_MACOS endif HOST_MACOS
if HAVE_GSSAPI
AM_CPPFLAGS += \
$(GSSAPI_CFLAGS)
endif
LIBISC_CFLAGS = \ LIBISC_CFLAGS = \
-I$(top_srcdir)/include \ -I$(top_srcdir)/include \
-I$(top_srcdir)/lib/isc/unix/include \ -I$(top_srcdir)/lib/isc/unix/include \
@@ -30,21 +25,6 @@ LIBISC_CFLAGS = \
-I$(top_srcdir)/lib/isc/include \ -I$(top_srcdir)/lib/isc/include \
-I$(top_builddir)/lib/isc/include -I$(top_builddir)/lib/isc/include
if HAVE_JSON_C
LIBISC_CFLAGS += \
$(JSON_C_CFLAGS)
endif HAVE_JSON_C
if HAVE_LIBXML2
LIBISC_CFLAGS += \
$(LIBXML2_CFLAGS)
endif HAVE_LIBXML2
if HAVE_READLINE
LIBISC_CFLAGS += \
$(READLINE_CFLAGS)
endif HAVE_READLINE
LIBISC_LIBS = $(top_builddir)/lib/isc/libisc.la LIBISC_LIBS = $(top_builddir)/lib/isc/libisc.la
LIBDNS_CFLAGS = \ LIBDNS_CFLAGS = \
@@ -54,16 +34,6 @@ LIBDNS_CFLAGS = \
LIBDNS_LIBS = \ LIBDNS_LIBS = \
$(top_builddir)/lib/dns/libdns.la $(top_builddir)/lib/dns/libdns.la
if HAVE_DNSTAP
LIBDNS_CFLAGS += \
$(DNSTAP_CFLAGS)
endif HAVE_DNSTAP
if HAVE_LMDB
LIBDNS_CFLAGS += \
$(LMDB_CFLAGS)
endif HAVE_LMDB
LIBNS_CFLAGS = \ LIBNS_CFLAGS = \
-I$(top_srcdir)/lib/ns/include -I$(top_srcdir)/lib/ns/include
+8 -8
View File
@@ -13,7 +13,7 @@
In general, this version of BIND will build and run on any POSIX-compliant In general, this version of BIND will build and run on any POSIX-compliant
system with a C11-compliant C compiler, BSD-style sockets with RFC-compliant system with a C11-compliant C compiler, BSD-style sockets with RFC-compliant
IPv6 support, POSIX-compliant threads, the `libuv` asynchronous I/O library, IPv6 support, POSIX-compliant threads, the `libuv` asynchronous I/O library,
and the OpenSSL cryptography library. the OpenSSL cryptography library, and the `nghttp2` HTTP/2 library.
The following C11 features are used in BIND 9: The following C11 features are used in BIND 9:
@@ -46,12 +46,12 @@ As of Nov 2020, BIND 9.17 is fully supported and regularly tested on the
following systems: following systems:
* Debian 9, 10 * Debian 9, 10
* Ubuntu LTS 16.04, 20.04 * Ubuntu LTS 18.04, 20.04
* Fedora 33 * Fedora 34
* Red Hat Enterprise Linux / CentOS 7, 8 * Red Hat Enterprise Linux / CentOS 7, 8
* FreeBSD 11.4, 12.2 * FreeBSD 11.4, 12.2, 13.0
* OpenBSD 6.8 * OpenBSD 6.9
* Alpine Linux 3.12 * Alpine Linux 3.13
The amd64, i386, armhf and arm64 CPU architectures are all fully supported. The amd64, i386, armhf and arm64 CPU architectures are all fully supported.
@@ -69,7 +69,7 @@ Server 2016, none of these are tested regularly by ISC.
* Solaris 11 * Solaris 11
* NetBSD * NetBSD
* Other Linux distributions still supported by their vendors, such as: * Other Linux distributions still supported by their vendors, such as:
* Ubuntu 19.04+ * Ubuntu 20.10+
* Gentoo * Gentoo
* Arch Linux * Arch Linux
* OpenWRT/LEDE 17.01+ * OpenWRT/LEDE 17.01+
@@ -86,7 +86,7 @@ assessed against the risk of adverse effect on officially supported
platforms. platforms.
* Platforms past or close to their respective EOL dates, such as: * Platforms past or close to their respective EOL dates, such as:
* Ubuntu 14.04, 18.10 * Ubuntu 14.04, 16.04 (Ubuntu ESM releases are not supported)
* CentOS 6 * CentOS 6
* Debian Jessie * Debian Jessie
* FreeBSD 10.x * FreeBSD 10.x
+7 -7
View File
@@ -128,13 +128,13 @@ including your patch as an attachment, preferably generated by
At a minimum, BIND requires a Unix or Linux system with an ANSI C compiler, At a minimum, BIND requires a Unix or Linux system with an ANSI C compiler,
basic POSIX support, and a 64-bit integer type. BIND also requires the basic POSIX support, and a 64-bit integer type. BIND also requires the
`libuv` asynchronous I/O library, and a cryptography provider library `libuv` asynchronous I/O library, the `nghttp2` HTTP/2 library, and a
such as OpenSSL or a hardware service module supporting PKCS#11. On cryptography provider library such as OpenSSL or a hardware service
Linux, BIND requires the `libcap` library to set process privileges, module supporting PKCS#11. On Linux, BIND requires the `libcap` library
though this requirement can be overridden by disabling capability to set process privileges, though this requirement can be overridden by
support at compile time. See [Compile-time options](#opts) below disabling capability support at compile time. See [Compile-time
for details on other libraries that may be required to support options](#opts) below for details on other libraries that may be
optional features. required to support optional features.
Successful builds have been observed on many versions of Linux and Successful builds have been observed on many versions of Linux and
Unix, including RHEL/CentOS, Fedora, Debian, Ubuntu, SLES, openSUSE, Unix, including RHEL/CentOS, Fedora, Debian, Ubuntu, SLES, openSUSE,
-2
View File
@@ -21,8 +21,6 @@
.. highlight: console .. highlight: console
.. _man_named-checkzone:
named-checkzone, named-compilezone - zone file validity checking or converting tool named-checkzone, named-compilezone - zone file validity checking or converting tool
----------------------------------------------------------------------------------- -----------------------------------------------------------------------------------
-2
View File
@@ -21,8 +21,6 @@
.. highlight: console .. highlight: console
.. _man_tsig-keygen:
tsig-keygen, ddns-confgen - TSIG key generation tool tsig-keygen, ddns-confgen - TSIG key generation tool
---------------------------------------------------- ----------------------------------------------------
+8 -14
View File
@@ -34,8 +34,10 @@
#include <isc/hex.h> #include <isc/hex.h>
#include <isc/lib.h> #include <isc/lib.h>
#include <isc/log.h> #include <isc/log.h>
#include <isc/managers.h>
#include <isc/md.h> #include <isc/md.h>
#include <isc/mem.h> #include <isc/mem.h>
#include <isc/netmgr.h>
#ifdef WIN32 #ifdef WIN32
#include <isc/ntpaths.h> #include <isc/ntpaths.h>
#endif /* ifdef WIN32 */ #endif /* ifdef WIN32 */
@@ -1736,6 +1738,7 @@ main(int argc, char *argv[]) {
dns_namelist_t namelist; dns_namelist_t namelist;
unsigned int resopt; unsigned int resopt;
isc_appctx_t *actx = NULL; isc_appctx_t *actx = NULL;
isc_nm_t *netmgr = NULL;
isc_taskmgr_t *taskmgr = NULL; isc_taskmgr_t *taskmgr = NULL;
isc_socketmgr_t *socketmgr = NULL; isc_socketmgr_t *socketmgr = NULL;
isc_timermgr_t *timermgr = NULL; isc_timermgr_t *timermgr = NULL;
@@ -1759,9 +1762,8 @@ main(int argc, char *argv[]) {
isc_mem_create(&mctx); isc_mem_create(&mctx);
CHECK(isc_appctx_create(mctx, &actx)); CHECK(isc_appctx_create(mctx, &actx));
CHECK(isc_taskmgr_createinctx(mctx, 1, 0, &taskmgr)); isc_managers_create(mctx, 1, 0, 0, &netmgr, &taskmgr, &timermgr,
CHECK(isc_socketmgr_createinctx(mctx, &socketmgr)); &socketmgr);
CHECK(isc_timermgr_createinctx(mctx, &timermgr));
parse_args(argc, argv); parse_args(argc, argv);
@@ -1781,7 +1783,7 @@ main(int argc, char *argv[]) {
#endif /* ifndef WIN32 */ #endif /* ifndef WIN32 */
/* Create client */ /* Create client */
result = dns_client_createx(mctx, actx, taskmgr, socketmgr, timermgr, 0, result = dns_client_create(mctx, actx, taskmgr, socketmgr, timermgr, 0,
&client, srcaddr4, srcaddr6); &client, srcaddr4, srcaddr6);
if (result != ISC_R_SUCCESS) { if (result != ISC_R_SUCCESS) {
delv_log(ISC_LOG_ERROR, "dns_client_create: %s", delv_log(ISC_LOG_ERROR, "dns_client_create: %s",
@@ -1802,7 +1804,7 @@ main(int argc, char *argv[]) {
CHECK(convert_name(&qfn, &query_name, qname)); CHECK(convert_name(&qfn, &query_name, qname));
/* Set up resolution options */ /* Set up resolution options */
resopt = DNS_CLIENTRESOPT_ALLOWRUN | DNS_CLIENTRESOPT_NOCDFLAG; resopt = DNS_CLIENTRESOPT_NOCDFLAG;
if (no_sigs) { if (no_sigs) {
resopt |= DNS_CLIENTRESOPT_NODNSSEC; resopt |= DNS_CLIENTRESOPT_NODNSSEC;
} }
@@ -1864,15 +1866,7 @@ cleanup:
if (client != NULL) { if (client != NULL) {
dns_client_destroy(&client); dns_client_destroy(&client);
} }
if (taskmgr != NULL) { isc_managers_destroy(&netmgr, &taskmgr, &timermgr, &socketmgr);
isc_taskmgr_destroy(&taskmgr);
}
if (timermgr != NULL) {
isc_timermgr_destroy(&timermgr);
}
if (socketmgr != NULL) {
isc_socketmgr_destroy(&socketmgr);
}
if (actx != NULL) { if (actx != NULL) {
isc_appctx_destroy(&actx); isc_appctx_destroy(&actx);
} }
+5
View File
@@ -25,10 +25,15 @@ libdighost_la_SOURCES = \
bin_PROGRAMS = dig host nslookup bin_PROGRAMS = dig host nslookup
nslookup_CPPFLAGS = \
$(AM_CPPFLAGS)
nslookup_LDADD = \ nslookup_LDADD = \
$(LDADD) $(LDADD)
if HAVE_READLINE if HAVE_READLINE
nslookup_CPPFLAGS += \
$(READLINE_CFLAGS)
nslookup_LDADD += \ nslookup_LDADD += \
$(READLINE_LIBS) $(READLINE_LIBS)
endif HAVE_READLINE endif HAVE_READLINE
+92 -1
View File
@@ -228,6 +228,10 @@ help(void) {
"SERVFAIL)\n" "SERVFAIL)\n"
" +[no]header-only (Send query without a " " +[no]header-only (Send query without a "
"question section)\n" "question section)\n"
" +[no]https[=###] (DNS over HTTPS mode) "
"[/]\n"
" +[no]https-get (Use GET instead of "
"default POST method\n"
" +[no]identify (ID responders in short " " +[no]identify (ID responders in short "
"answers)\n" "answers)\n"
#ifdef HAVE_LIBIDN2 #ifdef HAVE_LIBIDN2
@@ -348,12 +352,18 @@ received(unsigned int bytes, isc_sockaddr_t *from, dig_query_t *query) {
} }
if (query->lookup->tls_mode) { if (query->lookup->tls_mode) {
proto = "TLS"; proto = "TLS";
} else if (query->lookup->https_mode) {
if (query->lookup->http_plain) {
proto = "HTTP";
} else {
proto = "HTTPS";
}
} else if (query->lookup->tcp_mode) { } else if (query->lookup->tcp_mode) {
proto = "TCP"; proto = "TCP";
} else { } else {
proto = "UDP"; proto = "UDP";
} }
printf(";; SERVER: %s(%s) (%s)\n", fromtext, query->servname, printf(";; SERVER: %s(%s) (%s)\n", fromtext, query->userarg,
proto); proto);
time(&tnow); time(&tnow);
(void)localtime_r(&tnow, &tmnow); (void)localtime_r(&tnow, &tmnow);
@@ -1066,6 +1076,17 @@ plus_option(char *option, bool is_batchfile, bool *need_clone,
(_l >= sizeof(B) || strncasecmp(cmd, B, _l) != 0)) \ (_l >= sizeof(B) || strncasecmp(cmd, B, _l) != 0)) \
goto invalid_option; \ goto invalid_option; \
} while (0) } while (0)
#define FULLCHECK6(A, B, C, D, E, F) \
do { \
size_t _l = strlen(cmd); \
if ((_l >= sizeof(A) || strncasecmp(cmd, A, _l) != 0) && \
(_l >= sizeof(B) || strncasecmp(cmd, B, _l) != 0) && \
(_l >= sizeof(C) || strncasecmp(cmd, C, _l) != 0) && \
(_l >= sizeof(D) || strncasecmp(cmd, D, _l) != 0) && \
(_l >= sizeof(E) || strncasecmp(cmd, E, _l) != 0) && \
(_l >= sizeof(F) || strncasecmp(cmd, F, _l) != 0)) \
goto invalid_option; \
} while (0)
switch (cmd[0]) { switch (cmd[0]) {
case 'a': case 'a':
@@ -1412,9 +1433,79 @@ plus_option(char *option, bool is_batchfile, bool *need_clone,
lookup->servfail_stops = state; lookup->servfail_stops = state;
break; break;
case 'h': case 'h':
switch (cmd[1]) {
case 'e': /* header-only */
FULLCHECK("header-only"); FULLCHECK("header-only");
lookup->header_only = state; lookup->header_only = state;
break; break;
case 't':
FULLCHECK6("https", "https-get", "https-post",
"http-plain", "http-plain-get",
"http-plain-post");
if (lookup->https_path != NULL) {
isc_mem_free(mctx, lookup->https_path);
lookup->https_path = NULL;
}
if (!state) {
lookup->https_mode = false;
break;
}
lookup->https_mode = true;
if (cmd[4] == '-') {
lookup->http_plain = true;
switch (cmd[10]) {
case '\0':
FULLCHECK("http-plain");
break;
case '-':
switch (cmd[6]) {
case 'p':
FULLCHECK("https-plain-post");
break;
case 'g':
FULLCHECK("https-plain-get");
lookup->https_get = true;
break;
}
break;
default:
goto invalid_option;
}
} else {
switch (cmd[5]) {
case '\0':
FULLCHECK("https");
break;
case '-':
switch (cmd[6]) {
case 'p':
FULLCHECK("https-post");
break;
case 'g':
FULLCHECK("https-get");
lookup->https_get = true;
break;
}
break;
default:
goto invalid_option;
}
}
if (!lookup->tcp_mode_set) {
lookup->tcp_mode = state;
}
if (value == NULL) {
lookup->https_path = isc_mem_strdup(
mctx, DEFAULT_HTTPS_PATH);
} else {
lookup->https_path = isc_mem_strdup(mctx,
value);
}
break;
default:
goto invalid_option;
}
break;
case 'i': case 'i':
switch (cmd[1]) { switch (cmd[1]) {
case 'd': /* identify */ case 'd': /* identify */
+36 -8
View File
@@ -349,11 +349,38 @@ abbreviation is unambiguous; for example, ``+cd`` is equivalent to
default is to add a question section. The query type and query name default is to add a question section. The query type and query name
are ignored when this is set. are ignored when this is set.
``+[no]https[=value]``
This option indicates whether to use DNS-over-HTTPS (DoH) when querying
name servers. When this option is in use, the port number defaults to 443.
The HTTP POST request mode is used when sending the query.
If ``value`` is specified, it will be used as the HTTP endpoint in the
query URI; the default is ``/dns-query``. So, for example, ``dig
@example.com +https`` will use the URI ``https://example.com/dns-query``.
``+[no]https-get[=value]``
Similar to ``+https``, except that the HTTP GET request mode is used
when sending the query.
``+[no]https-post[=value]``
Same as ``+https``.
``+[no]http-plain[=value]``
Similar to ``+https``, except that HTTP queries will be sent over a
non-encrypted channel. When this option is in use, the port number
defaults to 80 and the HTTP request mode is POST.
``+[no]http-plain-get[=value]``
Similar to ``+http-plain``, except that the HTTP request mode is GET.
``+[no]http-plain-post[=value]``
Same as ``+http-plain``.
``+[no]identify`` ``+[no]identify``
This option shows [or does not show] the IP address and port number that supplied This option shows [or does not show] the IP address and port number that
the answer, when the ``+short`` option is enabled. If short form supplied the answer, when the ``+short`` option is enabled. If short
answers are requested, the default is not to show the source address form answers are requested, the default is not to show the source
and port number of the server that provided the answer. address and port number of the server that provided the answer.
``+[no]idnin`` ``+[no]idnin``
This option processes [or does not process] IDN domain names on input. This requires This option processes [or does not process] IDN domain names on input. This requires
@@ -453,7 +480,7 @@ abbreviation is unambiguous; for example, ``+cd`` is equivalent to
``+nssearch`` or ``+trace`` query option is used. ``+nssearch`` or ``+trace`` query option is used.
``+retry=T`` ``+retry=T``
This option sets the number of times to retry UDP queries to server to ``T`` This option sets the number of times to retry UDP and TCP queries to server to ``T``
instead of the default, 2. Unlike ``+tries``, this does not include instead of the default, 2. Unlike ``+tries``, this does not include
the initial query. the initial query.
@@ -519,8 +546,9 @@ abbreviation is unambiguous; for example, ``+cd`` is equivalent to
5 seconds. An attempt to set ``T`` to less than 1 is silently set to 1. 5 seconds. An attempt to set ``T`` to less than 1 is silently set to 1.
``+[no]tls`` ``+[no]tls``
This option indicates whether to use DNS over TLS (DoT) when querying This option indicates whether to use DNS-over-TLS (DoT) when querying
name servers. name servers. When this option is in use, the port number defaults
to 853.
``+[no]topdown`` ``+[no]topdown``
This feature is related to ``dig +sigchase``, which is obsolete and This feature is related to ``dig +sigchase``, which is obsolete and
@@ -541,7 +569,7 @@ abbreviation is unambiguous; for example, ``+cd`` is equivalent to
default queries from a name server. default queries from a name server.
``+tries=T`` ``+tries=T``
This option sets the number of times to try UDP queries to server to ``T`` This option sets the number of times to try UDP and TCP queries to server to ``T``
instead of the default, 3. If ``T`` is less than or equal to zero, instead of the default, 3. If ``T`` is less than or equal to zero,
the number of tries is silently rounded up to 1. the number of tries is silently rounded up to 1.
+146 -166
View File
@@ -41,6 +41,7 @@
#include <isc/hex.h> #include <isc/hex.h>
#include <isc/lang.h> #include <isc/lang.h>
#include <isc/log.h> #include <isc/log.h>
#include <isc/managers.h>
#include <isc/netaddr.h> #include <isc/netaddr.h>
#include <isc/netdb.h> #include <isc/netdb.h>
#include <isc/nonce.h> #include <isc/nonce.h>
@@ -106,9 +107,9 @@ unsigned int timeout = 0;
unsigned int extrabytes; unsigned int extrabytes;
isc_mem_t *mctx = NULL; isc_mem_t *mctx = NULL;
isc_log_t *lctx = NULL; isc_log_t *lctx = NULL;
isc_nm_t *netmgr = NULL;
isc_taskmgr_t *taskmgr = NULL; isc_taskmgr_t *taskmgr = NULL;
isc_task_t *global_task = NULL; isc_task_t *global_task = NULL;
isc_nm_t *netmgr = NULL;
isc_sockaddr_t localaddr; isc_sockaddr_t localaddr;
isc_refcount_t sendcount = ATOMIC_VAR_INIT(0); isc_refcount_t sendcount = ATOMIC_VAR_INIT(0);
isc_refcount_t recvcount = ATOMIC_VAR_INIT(0); isc_refcount_t recvcount = ATOMIC_VAR_INIT(0);
@@ -226,8 +227,9 @@ void (*dighost_shutdown)(void);
/* forward declarations */ /* forward declarations */
#define cancel_lookup(l) _cancel_lookup(l, __FILE__, __LINE__)
static void static void
cancel_lookup(dig_lookup_t *lookup); _cancel_lookup(dig_lookup_t *lookup, const char *file, unsigned int line);
static void static void
recv_done(isc_nmhandle_t *handle, isc_result_t eresult, isc_region_t *region, recv_done(isc_nmhandle_t *handle, isc_result_t eresult, isc_region_t *region,
@@ -603,102 +605,43 @@ clone_server_list(dig_serverlist_t src, dig_serverlist_t *dest) {
dig_lookup_t * dig_lookup_t *
make_empty_lookup(void) { make_empty_lookup(void) {
dig_lookup_t *looknew; dig_lookup_t *looknew;
#ifdef HAVE_LIBIDN2
bool idn_allowed = isatty(1) ? (getenv("IDN_DISABLE") == NULL) : false;
#endif /* HAVE_LIBIDN2 */
debug("make_empty_lookup()"); debug("make_empty_lookup()");
INSIST(!free_now); INSIST(!free_now);
looknew = isc_mem_allocate(mctx, sizeof(struct dig_lookup)); looknew = isc_mem_allocate(mctx, sizeof(*looknew));
looknew->pending = true; *looknew = (dig_lookup_t){
looknew->textname[0] = 0; .pending = true,
looknew->cmdline[0] = 0; .rdtype = dns_rdatatype_a,
looknew->rdtype = dns_rdatatype_a; .qrdtype = dns_rdatatype_a,
looknew->qrdtype = dns_rdatatype_a; .rdclass = dns_rdataclass_in,
looknew->rdclass = dns_rdataclass_in; .servfail_stops = true,
looknew->rdtypeset = false; .besteffort = true,
looknew->rdclassset = false; .opcode = dns_opcode_query,
looknew->sendspace = NULL; .badcookie = true,
looknew->sendmsg = NULL;
looknew->name = NULL;
looknew->oname = NULL;
looknew->xfr_q = NULL;
looknew->current_query = NULL;
looknew->doing_xfr = false;
looknew->ixfr_serial = 0;
looknew->trace = false;
looknew->trace_root = false;
looknew->identify = false;
looknew->identify_previous_line = false;
looknew->ignore = false;
looknew->servfail_stops = true;
looknew->besteffort = true;
looknew->dns64prefix = false;
looknew->dnssec = false;
looknew->ednsflags = 0;
looknew->opcode = dns_opcode_query;
looknew->expire = false;
looknew->nsid = false;
looknew->tcp_keepalive = false;
looknew->padding = 0;
looknew->header_only = false;
looknew->sendcookie = false;
looknew->seenbadcookie = false;
looknew->badcookie = true;
looknew->multiline = false;
looknew->nottl = false;
looknew->noclass = false;
looknew->onesoa = false;
looknew->use_usec = false;
looknew->nocrypto = false;
looknew->ttlunits = false;
looknew->expandaaaa = false;
looknew->qr = false;
#ifdef HAVE_LIBIDN2 #ifdef HAVE_LIBIDN2
looknew->idnin = isatty(1) ? (getenv("IDN_DISABLE") == NULL) : false; .idnin = idn_allowed,
looknew->idnout = looknew->idnin; .idnout = idn_allowed,
#else /* ifdef HAVE_LIBIDN2 */
looknew->idnin = false;
looknew->idnout = false;
#endif /* HAVE_LIBIDN2 */ #endif /* HAVE_LIBIDN2 */
looknew->udpsize = -1; .udpsize = -1,
looknew->edns = -1; .edns = -1,
looknew->recurse = true; .recurse = true,
looknew->aaonly = false; .retries = tries,
looknew->adflag = false; .comments = true,
looknew->cdflag = false; .stats = true,
looknew->raflag = false; .section_question = true,
looknew->tcflag = false; .section_answer = true,
looknew->print_unknown_format = false; .section_authority = true,
looknew->zflag = false; .section_additional = true,
looknew->setqid = false; .ednsneg = true,
looknew->qid = 0; .mapped = true,
looknew->ns_search_only = false; .dscp = -1,
looknew->origin = NULL; };
looknew->tsigctx = NULL;
looknew->querysig = NULL;
looknew->retries = tries;
looknew->nsfound = 0;
looknew->tcp_mode = false;
looknew->tcp_mode_set = false;
looknew->tls_mode = false;
looknew->comments = true;
looknew->stats = true;
looknew->section_question = true;
looknew->section_answer = true;
looknew->section_authority = true;
looknew->section_additional = true;
looknew->new_search = false;
looknew->done_as_is = false;
looknew->need_search = false;
looknew->ecs_addr = NULL;
looknew->cookie = NULL;
looknew->ednsopts = NULL;
looknew->ednsoptscnt = 0;
looknew->ednsneg = true;
looknew->mapped = true;
looknew->dscp = -1;
looknew->rrcomments = 0;
looknew->eoferr = 0;
dns_fixedname_init(&looknew->fdomain); dns_fixedname_init(&looknew->fdomain);
ISC_LINK_INIT(looknew, link); ISC_LINK_INIT(looknew, link);
ISC_LIST_INIT(looknew->q); ISC_LIST_INIT(looknew->q);
@@ -787,6 +730,12 @@ clone_lookup(dig_lookup_t *lookold, bool servers) {
looknew->nsid = lookold->nsid; looknew->nsid = lookold->nsid;
looknew->tcp_keepalive = lookold->tcp_keepalive; looknew->tcp_keepalive = lookold->tcp_keepalive;
looknew->header_only = lookold->header_only; looknew->header_only = lookold->header_only;
looknew->https_mode = lookold->https_mode;
if (lookold->https_path != NULL) {
looknew->https_path = isc_mem_strdup(mctx, lookold->https_path);
}
looknew->https_get = lookold->https_get;
looknew->http_plain = lookold->http_plain;
looknew->sendcookie = lookold->sendcookie; looknew->sendcookie = lookold->sendcookie;
looknew->seenbadcookie = lookold->seenbadcookie; looknew->seenbadcookie = lookold->seenbadcookie;
looknew->badcookie = lookold->badcookie; looknew->badcookie = lookold->badcookie;
@@ -848,7 +797,7 @@ clone_lookup(dig_lookup_t *lookold, bool servers) {
memmove(looknew->ecs_addr, lookold->ecs_addr, len); memmove(looknew->ecs_addr, lookold->ecs_addr, len);
} }
dns_name_copynf(dns_fixedname_name(&lookold->fdomain), dns_name_copy(dns_fixedname_name(&lookold->fdomain),
dns_fixedname_name(&looknew->fdomain)); dns_fixedname_name(&looknew->fdomain));
if (servers) { if (servers) {
@@ -1401,7 +1350,7 @@ setup_libs(void) {
} }
isc_mem_create(&mctx); isc_mem_create(&mctx);
isc_mem_setname(mctx, "dig", NULL); isc_mem_setname(mctx, "dig");
isc_log_create(mctx, &lctx, &logconfig); isc_log_create(mctx, &lctx, &logconfig);
isc_log_setcontext(lctx); isc_log_setcontext(lctx);
@@ -1413,10 +1362,7 @@ setup_libs(void) {
isc_log_setdebuglevel(lctx, 0); isc_log_setdebuglevel(lctx, 0);
netmgr = isc_nm_start(mctx, 1); isc_managers_create(mctx, 1, 0, 0, &netmgr, &taskmgr, NULL, NULL);
result = isc_taskmgr_create(mctx, 1, 0, netmgr, &taskmgr);
check_result(result, "isc_taskmgr_create");
result = isc_task_create(taskmgr, 0, &global_task); result = isc_task_create(taskmgr, 0, &global_task);
check_result(result, "isc_task_create"); check_result(result, "isc_task_create");
@@ -1594,12 +1540,13 @@ _destroy_lookup(dig_lookup_t *lookup) {
dig_server_t *s; dig_server_t *s;
void *ptr; void *ptr;
REQUIRE(lookup != NULL);
REQUIRE(ISC_LIST_EMPTY(lookup->q));
debug("destroy_lookup"); debug("destroy_lookup");
isc_refcount_destroy(&lookup->references); isc_refcount_destroy(&lookup->references);
REQUIRE(ISC_LIST_EMPTY(lookup->q));
s = ISC_LIST_HEAD(lookup->my_server_list); s = ISC_LIST_HEAD(lookup->my_server_list);
while (s != NULL) { while (s != NULL) {
debug("freeing server %p belonging to %p", s, lookup); debug("freeing server %p belonging to %p", s, lookup);
@@ -1638,6 +1585,10 @@ _destroy_lookup(dig_lookup_t *lookup) {
isc_mem_free(mctx, lookup->ednsopts); isc_mem_free(mctx, lookup->ednsopts);
} }
if (lookup->https_path) {
isc_mem_free(mctx, lookup->https_path);
}
isc_mem_free(mctx, lookup); isc_mem_free(mctx, lookup);
} }
@@ -1740,14 +1691,16 @@ _query_detach(dig_query_t **queryp, const char *file, unsigned int line) {
query_detach(&lookup->current_query); query_detach(&lookup->current_query);
} }
if (ISC_LINK_LINKED(query, link)) {
ISC_LIST_UNLINK(lookup->q, query, link);
}
debug("%s:%u:query_detach(%p) = %" PRIuFAST32, file, line, query, debug("%s:%u:query_detach(%p) = %" PRIuFAST32, file, line, query,
isc_refcount_current(&query->references) - 1); isc_refcount_current(&query->references) - 1);
if (isc_refcount_decrement(&query->references) == 1) { if (isc_refcount_decrement(&query->references) == 1) {
INSIST(query->readhandle == NULL);
INSIST(query->sendhandle == NULL);
if (ISC_LINK_LINKED(query, link)) {
ISC_LIST_UNLINK(lookup->q, query, link);
}
destroy_query(query, file, line); destroy_query(query, file, line);
} }
} }
@@ -1801,13 +1754,18 @@ start_lookup(void) {
* decremented, current_lookup will not be set to NULL.) * decremented, current_lookup will not be set to NULL.)
*/ */
static void static void
clear_current_lookup() { clear_current_lookup(void) {
dig_lookup_t *lookup = current_lookup; dig_lookup_t *lookup = current_lookup;
INSIST(!free_now); INSIST(!free_now);
debug("clear_current_lookup()"); debug("clear_current_lookup()");
if (lookup == NULL) {
debug("current_lookup is already detached");
return;
}
if (ISC_LIST_HEAD(lookup->q) != NULL) { if (ISC_LIST_HEAD(lookup->q) != NULL) {
debug("still have a worker"); debug("still have a worker");
return; return;
@@ -1932,7 +1890,7 @@ followup_lookup(dns_message_t *msg, dig_query_t *query, dns_section_t section) {
lookup->recurse = false; lookup->recurse = false;
} }
domain = dns_fixedname_name(&lookup->fdomain); domain = dns_fixedname_name(&lookup->fdomain);
dns_name_copynf(name, domain); dns_name_copy(name, domain);
} }
debug("adding server %s", namestr); debug("adding server %s", namestr);
num = getaddresses(lookup, namestr, &lresult); num = getaddresses(lookup, namestr, &lresult);
@@ -2107,7 +2065,6 @@ insert_soa(dig_lookup_t *lookup) {
result = dns_message_gettempname(lookup->sendmsg, &soaname); result = dns_message_gettempname(lookup->sendmsg, &soaname);
check_result(result, "dns_message_gettempname"); check_result(result, "dns_message_gettempname");
dns_name_init(soaname, NULL);
dns_name_clone(lookup->name, soaname); dns_name_clone(lookup->name, soaname);
ISC_LIST_INIT(soaname->list); ISC_LIST_INIT(soaname->list);
ISC_LIST_APPEND(soaname->list, rdataset, link); ISC_LIST_APPEND(soaname->list, rdataset, link);
@@ -2205,7 +2162,6 @@ setup_lookup(dig_lookup_t *lookup) {
} }
result = dns_message_gettempname(lookup->sendmsg, &lookup->name); result = dns_message_gettempname(lookup->sendmsg, &lookup->name);
check_result(result, "dns_message_gettempname"); check_result(result, "dns_message_gettempname");
dns_name_init(lookup->name, NULL);
isc_buffer_init(&lookup->namebuf, lookup->name_space, isc_buffer_init(&lookup->namebuf, lookup->name_space,
sizeof(lookup->name_space)); sizeof(lookup->name_space));
@@ -2249,7 +2205,6 @@ setup_lookup(dig_lookup_t *lookup) {
result = dns_message_gettempname(lookup->sendmsg, result = dns_message_gettempname(lookup->sendmsg,
&lookup->oname); &lookup->oname);
check_result(result, "dns_message_gettempname"); check_result(result, "dns_message_gettempname");
dns_name_init(lookup->oname, NULL);
/* XXX Helper funct to conv char* to name? */ /* XXX Helper funct to conv char* to name? */
origin = lookup->origin->origin; origin = lookup->origin->origin;
#ifdef HAVE_LIBIDN2 #ifdef HAVE_LIBIDN2
@@ -2289,9 +2244,7 @@ setup_lookup(dig_lookup_t *lookup) {
name, lookup->oname, name, lookup->oname,
lookup->name, &lookup->namebuf); lookup->name, &lookup->namebuf);
} else { } else {
result = dns_name_copy( dns_name_copy(name, lookup->name);
name, lookup->name,
&lookup->namebuf);
} }
} }
if (result != ISC_R_SUCCESS) { if (result != ISC_R_SUCCESS) {
@@ -2720,11 +2673,12 @@ send_done(isc_nmhandle_t *handle, isc_result_t eresult, void *arg) {
/*% /*%
* Cancel a lookup, sending canceling reads on all existing sockets. * Cancel a lookup, sending canceling reads on all existing sockets.
*/ */
static void static void
cancel_lookup(dig_lookup_t *lookup) { _cancel_lookup(dig_lookup_t *lookup, const char *file, unsigned int line) {
dig_query_t *query, *next; dig_query_t *query, *next;
debug("cancel_lookup()"); debug("%s:%u:%s()", file, line, __func__);
query = ISC_LIST_HEAD(lookup->q); query = ISC_LIST_HEAD(lookup->q);
while (query != NULL) { while (query != NULL) {
REQUIRE(DIG_VALID_QUERY(query)); REQUIRE(DIG_VALID_QUERY(query));
@@ -2760,7 +2714,20 @@ start_tcp(dig_query_t *query) {
* For TLS connections, we want to override the default * For TLS connections, we want to override the default
* port number. * port number.
*/ */
port = port_set ? port : (query->lookup->tls_mode ? 853 : 53); if (!port_set) {
if (query->lookup->tls_mode) {
port = 853;
} else if (query->lookup->https_mode &&
!query->lookup->http_plain) {
port = 443;
} else if (query->lookup->https_mode) {
port = 80;
} else {
port = 53;
}
}
debug("query->servname = %s\n", query->servname);
result = get_address(query->servname, port, &query->sockaddr); result = get_address(query->servname, port, &query->sockaddr);
if (result != ISC_R_SUCCESS) { if (result != ISC_R_SUCCESS) {
@@ -2830,18 +2797,32 @@ start_tcp(dig_query_t *query) {
if (query->lookup->tls_mode) { if (query->lookup->tls_mode) {
result = isc_tlsctx_createclient(&query->tlsctx); result = isc_tlsctx_createclient(&query->tlsctx);
RUNTIME_CHECK(result == ISC_R_SUCCESS); RUNTIME_CHECK(result == ISC_R_SUCCESS);
result = isc_nm_tlsdnsconnect( isc_nm_tlsdnsconnect(netmgr, &localaddr,
netmgr, (isc_nmiface_t *)&localaddr, &query->sockaddr, tcp_connected,
(isc_nmiface_t *)&query->sockaddr, query, local_timeout, 0,
tcp_connected, query, local_timeout, 0,
query->tlsctx); query->tlsctx);
check_result(result, "isc_nm_tcpdnsconnect"); } else if (query->lookup->https_mode) {
char uri[4096] = { 0 };
snprintf(uri, sizeof(uri), "https://%s:%u%s",
query->userarg, (uint16_t)port,
query->lookup->https_path);
if (!query->lookup->http_plain) {
result =
isc_tlsctx_createclient(&query->tlsctx);
RUNTIME_CHECK(result == ISC_R_SUCCESS);
isc_tlsctx_enable_http2client_alpn(
query->tlsctx);
}
isc_nm_httpconnect(netmgr, &localaddr, &query->sockaddr,
uri, !query->lookup->https_get,
tcp_connected, query, query->tlsctx,
local_timeout, 0);
} else { } else {
result = isc_nm_tcpdnsconnect( isc_nm_tcpdnsconnect(netmgr, &localaddr,
netmgr, (isc_nmiface_t *)&localaddr, &query->sockaddr, tcp_connected,
(isc_nmiface_t *)&query->sockaddr, query, local_timeout, 0);
tcp_connected, query, local_timeout, 0);
check_result(result, "isc_nm_tcpdnsconnect");
} }
/* XXX: set DSCP */ /* XXX: set DSCP */
@@ -2882,7 +2863,11 @@ send_udp(dig_query_t *query) {
isc_buffer_usedregion(&query->sendbuf, &r); isc_buffer_usedregion(&query->sendbuf, &r);
debug("sending a request"); debug("sending a request");
if (query->lookup->use_usec) {
TIME_NOW_HIRES(&query->time_sent);
} else {
TIME_NOW(&query->time_sent); TIME_NOW(&query->time_sent);
}
isc_nmhandle_attach(query->handle, &query->sendhandle); isc_nmhandle_attach(query->handle, &query->sendhandle);
@@ -2912,13 +2897,16 @@ udp_ready(isc_nmhandle_t *handle, isc_result_t eresult, void *arg) {
query_detach(&query); query_detach(&query);
return; return;
} else if (eresult != ISC_R_SUCCESS) { } else if (eresult != ISC_R_SUCCESS) {
dig_lookup_t *l = query->lookup;
if (eresult != ISC_R_CANCELED) { if (eresult != ISC_R_CANCELED) {
debug("udp setup failed: %s", debug("udp setup failed: %s",
isc_result_totext(eresult)); isc_result_totext(eresult));
} }
if (query->tries == 0) {
cancel_lookup(l);
lookup_detach(&l);
query_detach(&query); query_detach(&query);
}
return; return;
} }
@@ -2954,6 +2942,7 @@ static void
start_udp(dig_query_t *query) { start_udp(dig_query_t *query) {
isc_result_t result; isc_result_t result;
dig_query_t *next = NULL; dig_query_t *next = NULL;
dig_query_t *connectquery = NULL;
REQUIRE(DIG_VALID_QUERY(query)); REQUIRE(DIG_VALID_QUERY(query));
@@ -3005,24 +2994,10 @@ start_udp(dig_query_t *query) {
} }
} }
query->tries = 3; query_attach(query, &connectquery);
do { isc_nm_udpconnect(netmgr, &localaddr, &query->sockaddr, udp_ready,
int local_timeout = timeout * 1000; connectquery,
if (local_timeout == 0) { (timeout ? timeout : UDP_TIMEOUT) * 1000, 0);
local_timeout = UDP_TIMEOUT * 1000;
}
/*
* On FreeBSD the UDP connect() call sometimes results
* in a spurious transient EADDRINUSE. Try a few more times
* before giving up.
*/
debug("isc_nm_udpconnect(): %d tries left", --query->tries);
result = isc_nm_udpconnect(netmgr, (isc_nmiface_t *)&localaddr,
(isc_nmiface_t *)&query->sockaddr,
udp_ready, query, local_timeout, 0);
} while (result != ISC_R_SUCCESS && query->tries > 0);
check_result(result, "isc_nm_udpconnect");
} }
/*% /*%
@@ -3129,7 +3104,8 @@ force_next(dig_query_t *query) {
*/ */
static void static void
requeue_or_update_exitcode(dig_lookup_t *lookup) { requeue_or_update_exitcode(dig_lookup_t *lookup) {
if (lookup->eoferr == 0U) { if (lookup->eoferr == 0U && lookup->retries > 1) {
--lookup->retries;
/* /*
* Peer closed the connection prematurely for the first time * Peer closed the connection prematurely for the first time
* for this lookup. Try again, keeping track of this failure. * for this lookup. Try again, keeping track of this failure.
@@ -3188,7 +3164,12 @@ launch_next_query(dig_query_t *query) {
if (!query->first_soa_rcvd) { if (!query->first_soa_rcvd) {
dig_query_t *sendquery = NULL; dig_query_t *sendquery = NULL;
debug("sending a request in launch_next_query"); debug("sending a request in launch_next_query");
if (query->lookup->use_usec) {
TIME_NOW_HIRES(&query->time_sent);
} else {
TIME_NOW(&query->time_sent); TIME_NOW(&query->time_sent);
}
query_attach(query, &sendquery); query_attach(query, &sendquery);
isc_buffer_usedregion(&query->sendbuf, &r); isc_buffer_usedregion(&query->sendbuf, &r);
if (keep != NULL) { if (keep != NULL) {
@@ -3211,6 +3192,7 @@ launch_next_query(dig_query_t *query) {
} }
} }
} }
lookup_detach(&l); lookup_detach(&l);
return; return;
} }
@@ -3582,25 +3564,31 @@ recv_done(isc_nmhandle_t *handle, isc_result_t eresult, isc_region_t *region,
isc_sockaddr_t peer; isc_sockaddr_t peer;
REQUIRE(DIG_VALID_QUERY(query)); REQUIRE(DIG_VALID_QUERY(query));
INSIST(query->readhandle != NULL); REQUIRE(query->readhandle != NULL);
INSIST(handle == query->readhandle);
INSIST(!free_now); INSIST(!free_now);
debug("recv_done(%p, %s, %p, %p)", handle, isc_result_totext(eresult), debug("recv_done(%p, %s, %p, %p)", handle, isc_result_totext(eresult),
region, arg); region, arg);
LOCK_LOOKUP; LOCK_LOOKUP;
lookup_attach(query->lookup, &l);
isc_refcount_decrement0(&recvcount); isc_refcount_decrement0(&recvcount);
debug("recvcount=%" PRIuFAST32, isc_refcount_current(&recvcount)); debug("recvcount=%" PRIuFAST32, isc_refcount_current(&recvcount));
if (eresult == ISC_R_CANCELED) { if (eresult == ISC_R_CANCELED) {
debug("recv_done: cancel"); debug("recv_done: cancel");
goto detach_query; isc_nmhandle_detach(&query->readhandle);
query_detach(&query);
return;
} }
lookup_attach(query->lookup, &l);
if (query->lookup->use_usec) {
TIME_NOW_HIRES(&query->time_recv);
} else {
TIME_NOW(&query->time_recv); TIME_NOW(&query->time_recv);
}
if (eresult == ISC_R_TIMEDOUT && !l->tcp_mode && l->retries > 1) { if (eresult == ISC_R_TIMEDOUT && !l->tcp_mode && l->retries > 1) {
dig_query_t *newq = NULL; dig_query_t *newq = NULL;
@@ -4206,20 +4194,24 @@ cancel_all(void) {
return; return;
} }
atomic_store(&cancel_now, true); atomic_store(&cancel_now, true);
if (current_lookup != NULL) { while (current_lookup != NULL) {
for (q = ISC_LIST_HEAD(current_lookup->q); q != NULL; q = nq) { for (q = ISC_LIST_HEAD(current_lookup->q); q != NULL; q = nq) {
nq = ISC_LIST_NEXT(q, link); nq = ISC_LIST_NEXT(q, link);
debug("canceling pending query %p, belonging to %p", q, debug("canceling pending query %p, belonging to %p", q,
current_lookup); current_lookup);
if (q->readhandle != NULL) { if (q->readhandle != NULL) {
isc_refcount_decrement0(&recvcount); isc_nm_cancelread(q->readhandle);
debug("recvcount=%" PRIuFAST32,
isc_refcount_current(&recvcount));
} }
query_detach(&q); query_detach(&q);
} }
/*
* current_lookup could have been detached via query_detach().
*/
if (current_lookup != NULL) {
lookup_detach(&current_lookup); lookup_detach(&current_lookup);
} }
}
l = ISC_LIST_HEAD(lookup_list); l = ISC_LIST_HEAD(lookup_list);
while (l != NULL) { while (l != NULL) {
n = ISC_LIST_NEXT(l, link); n = ISC_LIST_NEXT(l, link);
@@ -4244,20 +4236,8 @@ destroy_libs(void) {
debug("freeing task"); debug("freeing task");
isc_task_detach(&global_task); isc_task_detach(&global_task);
} }
/*
* The taskmgr_destroy() and isc_nm_destroy() calls block until
* all events are cleared.
*/
if (taskmgr != NULL) {
debug("freeing taskmgr");
isc_taskmgr_destroy(&taskmgr);
}
debug("closing down netmgr"); isc_managers_destroy(&netmgr, &taskmgr, NULL, NULL);
isc_nm_closedown(netmgr);
debug("destroy netmgr");
isc_nm_destroy(&netmgr);
LOCK_LOOKUP; LOCK_LOOKUP;
isc_refcount_destroy(&recvcount); isc_refcount_destroy(&recvcount);
+9 -1
View File
@@ -76,6 +76,9 @@
#define DEFAULT_EDNS_VERSION 0 #define DEFAULT_EDNS_VERSION 0
#define DEFAULT_EDNS_BUFSIZE 1232 #define DEFAULT_EDNS_BUFSIZE 1232
#define DEFAULT_HTTPS_PATH "/dns-query"
#define DEFAULT_HTTPS_QUERY "?dns="
/*% /*%
* Lookup_limit is just a limiter, keeping too many lookups from being * Lookup_limit is just a limiter, keeping too many lookups from being
* created. It's job is mainly to prevent the program from running away * created. It's job is mainly to prevent the program from running away
@@ -168,6 +171,12 @@ struct dig_lookup {
int rrcomments; int rrcomments;
unsigned int eoferr; unsigned int eoferr;
uint16_t qid; uint16_t qid;
struct {
bool http_plain;
bool https_mode;
bool https_get;
char *https_path;
};
}; };
/*% The dig_query structure */ /*% The dig_query structure */
@@ -199,7 +208,6 @@ struct dig_query {
isc_time_t time_recv; isc_time_t time_recv;
uint64_t byte_count; uint64_t byte_count;
isc_timer_t *timer; isc_timer_t *timer;
uint8_t tries;
isc_tlsctx_t *tlsctx; isc_tlsctx_t *tlsctx;
}; };
+6 -2
View File
@@ -151,7 +151,11 @@ received(unsigned int bytes, isc_sockaddr_t *from, dig_query_t *query) {
if (!short_form) { if (!short_form) {
char fromtext[ISC_SOCKADDR_FORMATSIZE]; char fromtext[ISC_SOCKADDR_FORMATSIZE];
isc_sockaddr_format(from, fromtext, sizeof(fromtext)); isc_sockaddr_format(from, fromtext, sizeof(fromtext));
if (query->lookup->use_usec) {
TIME_NOW_HIRES(&now);
} else {
TIME_NOW(&now); TIME_NOW(&now);
}
diff = (int)isc_time_microdiff(&now, &query->time_sent); diff = (int)isc_time_microdiff(&now, &query->time_sent);
printf("Received %u bytes from %s in %d ms\n", bytes, fromtext, printf("Received %u bytes from %s in %d ms\n", bytes, fromtext,
diff / 1000); diff / 1000);
@@ -375,7 +379,7 @@ chase_cnamechain(dns_message_t *msg, dns_name_t *qname) {
dns_rdataset_current(rdataset, &rdata); dns_rdataset_current(rdataset, &rdata);
result = dns_rdata_tostruct(&rdata, &cname, NULL); result = dns_rdata_tostruct(&rdata, &cname, NULL);
check_result(result, "dns_rdata_tostruct"); check_result(result, "dns_rdata_tostruct");
dns_name_copynf(&cname.cname, qname); dns_name_copy(&cname.cname, qname);
dns_rdata_freestruct(&cname); dns_rdata_freestruct(&cname);
} }
} }
@@ -438,7 +442,7 @@ printmessage(dig_query_t *query, const isc_buffer_t *msgbuf, dns_message_t *msg,
/* Add AAAA and MX lookups. */ /* Add AAAA and MX lookups. */
name = dns_fixedname_initname(&fixed); name = dns_fixedname_initname(&fixed);
dns_name_copynf(query->lookup->name, name); dns_name_copy(query->lookup->name, name);
chase_cnamechain(msg, name); chase_cnamechain(msg, name);
dns_name_format(name, namestr, sizeof(namestr)); dns_name_format(name, namestr, sizeof(namestr));
lookup = clone_lookup(query->lookup, false); lookup = clone_lookup(query->lookup, false);
-1
View File
@@ -1 +0,0 @@
../../../.clang-format.headers
+3 -3
View File
@@ -22,7 +22,6 @@
#include <isc/netaddr.h> #include <isc/netaddr.h>
#include <isc/parseint.h> #include <isc/parseint.h>
#include <isc/print.h> #include <isc/print.h>
#include <isc/readline.h>
#include <isc/string.h> #include <isc/string.h>
#include <isc/task.h> #include <isc/task.h>
#include <isc/util.h> #include <isc/util.h>
@@ -38,6 +37,7 @@
#include <dns/rdatatype.h> #include <dns/rdatatype.h>
#include "dighost.h" #include "dighost.h"
#include "readline.h"
static bool short_form = true, tcpmode = false, tcpmode_set = false, static bool short_form = true, tcpmode = false, tcpmode_set = false,
identify = false, stats = true, comments = true, identify = false, stats = true, comments = true,
@@ -391,7 +391,7 @@ chase_cnamechain(dns_message_t *msg, dns_name_t *qname) {
dns_rdataset_current(rdataset, &rdata); dns_rdataset_current(rdataset, &rdata);
result = dns_rdata_tostruct(&rdata, &cname, NULL); result = dns_rdata_tostruct(&rdata, &cname, NULL);
check_result(result, "dns_rdata_tostruct"); check_result(result, "dns_rdata_tostruct");
dns_name_copynf(&cname.cname, qname); dns_name_copy(&cname.cname, qname);
dns_rdata_freestruct(&cname); dns_rdata_freestruct(&cname);
} }
} }
@@ -448,7 +448,7 @@ printmessage(dig_query_t *query, const isc_buffer_t *msgbuf, dns_message_t *msg,
/* Add AAAA lookup. */ /* Add AAAA lookup. */
name = dns_fixedname_initname(&fixed); name = dns_fixedname_initname(&fixed);
dns_name_copynf(query->lookup->name, name); dns_name_copy(query->lookup->name, name);
chase_cnamechain(msg, name); chase_cnamechain(msg, name);
dns_name_format(name, namestr, sizeof(namestr)); dns_name_format(name, namestr, sizeof(namestr));
lookup = clone_lookup(query->lookup, false); lookup = clone_lookup(query->lookup, false);
+1 -1
View File
@@ -215,7 +215,7 @@ loadkey(char *filename, unsigned char *key_buf, unsigned int key_buf_size,
rdclass = dst_key_class(key); rdclass = dst_key_class(key);
name = dns_fixedname_initname(&fixed); name = dns_fixedname_initname(&fixed);
dns_name_copynf(dst_key_name(key), name); dns_name_copy(dst_key_name(key), name);
dst_key_free(&key); dst_key_free(&key);
} }
+1 -1
View File
@@ -185,7 +185,7 @@ loadkey(char *filename, unsigned char *key_buf, unsigned int key_buf_size,
rdclass = dst_key_class(key); rdclass = dst_key_class(key);
name = dns_fixedname_initname(&fixed); name = dns_fixedname_initname(&fixed);
dns_name_copynf(dst_key_name(key), name); dns_name_copy(dst_key_name(key), name);
dst_key_free(&key); dst_key_free(&key);
} }
+26 -23
View File
@@ -40,6 +40,7 @@
#include <isc/file.h> #include <isc/file.h>
#include <isc/hash.h> #include <isc/hash.h>
#include <isc/hex.h> #include <isc/hex.h>
#include <isc/managers.h>
#include <isc/md.h> #include <isc/md.h>
#include <isc/mem.h> #include <isc/mem.h>
#include <isc/mutex.h> #include <isc/mutex.h>
@@ -144,6 +145,7 @@ static unsigned int nsigned = 0, nretained = 0, ndropped = 0;
static unsigned int nverified = 0, nverifyfailed = 0; static unsigned int nverified = 0, nverifyfailed = 0;
static const char *directory = NULL, *dsdir = NULL; static const char *directory = NULL, *dsdir = NULL;
static isc_mutex_t namelock, statslock; static isc_mutex_t namelock, statslock;
static isc_nm_t *netmgr = NULL;
static isc_taskmgr_t *taskmgr = NULL; static isc_taskmgr_t *taskmgr = NULL;
static dns_db_t *gdb; /* The database */ static dns_db_t *gdb; /* The database */
static dns_dbversion_t *gversion; /* The database version */ static dns_dbversion_t *gversion; /* The database version */
@@ -177,8 +179,9 @@ static bool remove_orphansigs = false;
static bool remove_inactkeysigs = false; static bool remove_inactkeysigs = false;
static bool output_dnssec_only = false; static bool output_dnssec_only = false;
static bool output_stdout = false; static bool output_stdout = false;
bool set_maxttl = false; static bool set_maxttl = false;
static dns_ttl_t maxttl = 0; static dns_ttl_t maxttl = 0;
static bool no_max_check = false;
#define INCSTAT(counter) \ #define INCSTAT(counter) \
if (printstats) { \ if (printstats) { \
@@ -198,7 +201,7 @@ savezonecut(dns_fixedname_t *fzonecut, dns_name_t *name) {
dns_name_t *result; dns_name_t *result;
result = dns_fixedname_initname(fzonecut); result = dns_fixedname_initname(fzonecut);
dns_name_copynf(name, result); dns_name_copy(name, result);
return (result); return (result);
} }
@@ -1334,8 +1337,8 @@ get_soa_ttls(void) {
result = dns_rdataset_first(&soaset); result = dns_rdataset_first(&soaset);
check_result(result, "dns_rdataset_first"); check_result(result, "dns_rdataset_first");
dns_rdataset_current(&soaset, &rdata); dns_rdataset_current(&soaset, &rdata);
zone_soa_min_ttl = dns_soa_getminimum(&rdata);
soa_ttl = soaset.ttl; soa_ttl = soaset.ttl;
zone_soa_min_ttl = ISC_MIN(dns_soa_getminimum(&rdata), soa_ttl);
if (set_maxttl) { if (set_maxttl) {
zone_soa_min_ttl = ISC_MIN(zone_soa_min_ttl, maxttl); zone_soa_min_ttl = ISC_MIN(zone_soa_min_ttl, maxttl);
soa_ttl = ISC_MIN(soa_ttl, maxttl); soa_ttl = ISC_MIN(soa_ttl, maxttl);
@@ -2394,7 +2397,7 @@ nsec3ify(unsigned int hashalg, dns_iterations_t iterations,
break; break;
} }
if (result == ISC_R_NOMORE) { if (result == ISC_R_NOMORE) {
dns_name_copynf(gorigin, nextname); dns_name_copy(gorigin, nextname);
done = true; done = true;
} else if (result != ISC_R_SUCCESS) { } else if (result != ISC_R_SUCCESS) {
fatal("iterating through the database failed: %s", fatal("iterating through the database failed: %s",
@@ -2531,7 +2534,7 @@ nsec3ify(unsigned int hashalg, dns_iterations_t iterations,
break; break;
} }
if (result == ISC_R_NOMORE) { if (result == ISC_R_NOMORE) {
dns_name_copynf(gorigin, nextname); dns_name_copy(gorigin, nextname);
done = true; done = true;
} else if (result != ISC_R_SUCCESS) { } else if (result != ISC_R_SUCCESS) {
fatal("iterating through the database failed: %s", fatal("iterating through the database failed: %s",
@@ -3438,6 +3441,12 @@ main(int argc, char *argv[]) {
case 'H': case 'H':
set_iter = true; set_iter = true;
/* too-many is NOT DOCUMENTED */
if (strcmp(isc_commandline_argument, "too-many") == 0) {
nsec3iter = 151;
no_max_check = true;
break;
}
nsec3iter = strtoul(isc_commandline_argument, &endp, 0); nsec3iter = strtoul(isc_commandline_argument, &endp, 0);
if (*endp != '\0') { if (*endp != '\0') {
fatal("iterations must be numeric"); fatal("iterations must be numeric");
@@ -3806,11 +3815,7 @@ main(int argc, char *argv[]) {
* of keys rather early. * of keys rather early.
*/ */
ISC_LIST_INIT(keylist); ISC_LIST_INIT(keylist);
result = isc_rwlock_init(&keylist_lock, 0, 0); isc_rwlock_init(&keylist_lock, 0, 0);
if (result != ISC_R_SUCCESS) {
fatal("could not initialize keylist_lock: %s",
isc_result_totext(result));
}
/* /*
* Fill keylist with: * Fill keylist with:
@@ -3860,7 +3865,6 @@ main(int argc, char *argv[]) {
warnifallksk(gdb); warnifallksk(gdb);
if (IS_NSEC3) { if (IS_NSEC3) {
unsigned int max;
bool answer; bool answer;
hash_length = dns_nsec3_hashlength(dns_hash_sha1); hash_length = dns_nsec3_hashlength(dns_hash_sha1);
@@ -3879,12 +3883,15 @@ main(int argc, char *argv[]) {
"NSEC-only DNSKEY"); "NSEC-only DNSKEY");
} }
result = dns_nsec3_maxiterations(gdb, NULL, mctx, &max); if (nsec3iter > dns_nsec3_maxiterations()) {
check_result(result, "dns_nsec3_maxiterations()"); if (no_max_check) {
if (nsec3iter > max) { fprintf(stderr,
fatal("NSEC3 iterations too big for weakest DNSKEY " "Ignoring max iterations check.\n");
"strength. Maximum iterations allowed %u.", } else {
max); fatal("NSEC3 iterations too big. Maximum "
"iterations allowed %u.",
dns_nsec3_maxiterations());
}
} }
} else { } else {
hashlist_init(&hashlist, 0, 0); /* silence clang */ hashlist_init(&hashlist, 0, 0); /* silence clang */
@@ -3957,11 +3964,7 @@ main(int argc, char *argv[]) {
print_time(outfp); print_time(outfp);
print_version(outfp); print_version(outfp);
result = isc_taskmgr_create(mctx, ntasks, 0, NULL, &taskmgr); isc_managers_create(mctx, ntasks, 0, 0, &netmgr, &taskmgr, NULL, NULL);
if (result != ISC_R_SUCCESS) {
fatal("failed to create task manager: %s",
isc_result_totext(result));
}
master = NULL; master = NULL;
result = isc_task_create(taskmgr, 0, &master); result = isc_task_create(taskmgr, 0, &master);
@@ -4012,7 +4015,7 @@ main(int argc, char *argv[]) {
for (i = 0; i < (int)ntasks; i++) { for (i = 0; i < (int)ntasks; i++) {
isc_task_detach(&tasks[i]); isc_task_detach(&tasks[i]);
} }
isc_taskmgr_destroy(&taskmgr); isc_managers_destroy(&netmgr, &taskmgr, NULL, NULL);
isc_mem_put(mctx, tasks, ntasks * sizeof(isc_task_t *)); isc_mem_put(mctx, tasks, ntasks * sizeof(isc_task_t *));
postsign(); postsign();
TIME_NOW(&sign_finish); TIME_NOW(&sign_finish);
+9 -3
View File
@@ -94,6 +94,8 @@ options {\n\
# pid-file \"" NAMED_LOCALSTATEDIR "/run/named/named.pid\"; \n\ # pid-file \"" NAMED_LOCALSTATEDIR "/run/named/named.pid\"; \n\
port 53;\n\ port 53;\n\
tls-port 853;\n\ tls-port 853;\n\
http-port 80;\n\
https-port 443;\n\
prefetch 2 9;\n\ prefetch 2 9;\n\
recursing-file \"named.recursing\";\n\ recursing-file \"named.recursing\";\n\
recursive-clients 1000;\n\ recursive-clients 1000;\n\
@@ -121,6 +123,8 @@ options {\n\
tcp-initial-timeout 300;\n\ tcp-initial-timeout 300;\n\
tcp-keepalive-timeout 300;\n\ tcp-keepalive-timeout 300;\n\
tcp-listen-queue 10;\n\ tcp-listen-queue 10;\n\
tcp-receive-buffer 0;\n\
tcp-send-buffer 0;\n\
# tkey-dhkey <none>\n\ # tkey-dhkey <none>\n\
# tkey-domain <none>\n\ # tkey-domain <none>\n\
# tkey-gssapi-credential <none>\n\ # tkey-gssapi-credential <none>\n\
@@ -131,6 +135,8 @@ options {\n\
# treat-cr-as-space <obsolete>;\n\ # treat-cr-as-space <obsolete>;\n\
trust-anchor-telemetry yes;\n\ trust-anchor-telemetry yes;\n\
# use-id-pool <obsolete>;\n\ # use-id-pool <obsolete>;\n\
udp-receive-buffer 0;\n\
udp-send-buffer 0;\n\
\n\ \n\
/* view */\n\ /* view */\n\
allow-new-zones no;\n\ allow-new-zones no;\n\
@@ -193,8 +199,8 @@ options {\n\
root-key-sentinel yes;\n\ root-key-sentinel yes;\n\
servfail-ttl 1;\n\ servfail-ttl 1;\n\
# sortlist <none>\n\ # sortlist <none>\n\
stale-answer-client-timeout off;\n\
stale-answer-enable false;\n\ stale-answer-enable false;\n\
stale-answer-client-timeout 1800; /* in milliseconds */\n\
stale-answer-ttl 30; /* 30 seconds */\n\ stale-answer-ttl 30; /* 30 seconds */\n\
stale-cache-enable false;\n\ stale-cache-enable false;\n\
stale-refresh-time 30; /* 30 seconds */\n\ stale-refresh-time 30; /* 30 seconds */\n\
@@ -223,7 +229,7 @@ options {\n\
dnssec-update-mode maintain;\n\ dnssec-update-mode maintain;\n\
# forward <none>\n\ # forward <none>\n\
# forwarders <none>\n\ # forwarders <none>\n\
inline-signing no;\n\ # inline-signing no;\n\
ixfr-from-differences false;\n\ ixfr-from-differences false;\n\
# maintain-ixfr-base <obsolete>;\n\ # maintain-ixfr-base <obsolete>;\n\
# max-ixfr-log-size <obsolete>\n\ # max-ixfr-log-size <obsolete>\n\
@@ -633,7 +639,7 @@ named_config_getname(isc_mem_t *mctx, const cfg_obj_t *obj,
result = dns_name_fromtext(dns_fixedname_name(&fname), &b, dns_rootname, result = dns_name_fromtext(dns_fixedname_name(&fname), &b, dns_rootname,
0, NULL); 0, NULL);
if (result != ISC_R_SUCCESS) { if (result != ISC_R_SUCCESS) {
isc_mem_put(mctx, *namep, sizeof(*namep)); isc_mem_put(mctx, *namep, sizeof(**namep));
*namep = NULL; *namep = NULL;
return (result); return (result);
} }
+4 -6
View File
@@ -1164,10 +1164,9 @@ add_listener(named_controls_t *cp, controllistener_t **listenerp,
} }
#endif #endif
CHECK(isc_nm_listentcp(named_g_nm, (isc_nmiface_t *)&listener->address, CHECK(isc_nm_listentcp(
control_newconn, listener, named_g_netmgr, &listener->address, control_newconn, listener,
sizeof(controlconnection_t), 5, NULL, sizeof(controlconnection_t), 5, NULL, &listener->sock));
&listener->sock));
#if 0 #if 0
/* XXX: no unix socket support yet */ /* XXX: no unix socket support yet */
if (type == isc_socktype_unix) { if (type == isc_socktype_unix) {
@@ -1189,11 +1188,9 @@ add_listener(named_controls_t *cp, controllistener_t **listenerp,
return; return;
cleanup: cleanup:
if (listener != NULL) {
isc_refcount_decrement(&listener->refs); isc_refcount_decrement(&listener->refs);
listener->exiting = true; listener->exiting = true;
free_listener(listener); free_listener(listener);
}
if (control != NULL) { if (control != NULL) {
cfg_obj_log(control, named_g_lctx, ISC_LOG_WARNING, cfg_obj_log(control, named_g_lctx, ISC_LOG_WARNING,
@@ -1469,6 +1466,7 @@ named_controls_create(named_server_t *server, named_controls_t **ctrlsp) {
ISC_LIST_INIT(controls->listeners); ISC_LIST_INIT(controls->listeners);
atomic_init(&controls->shuttingdown, false);
isc_mutex_init(&controls->symtab_lock); isc_mutex_init(&controls->symtab_lock);
LOCK(&controls->symtab_lock); LOCK(&controls->symtab_lock);
result = isccc_cc_createsymtab(&controls->symtab); result = isccc_cc_createsymtab(&controls->symtab);
+3 -1
View File
@@ -62,7 +62,7 @@ EXTERN bool named_g_run_done INIT(false);
*/ */
EXTERN isc_timermgr_t *named_g_timermgr INIT(NULL); EXTERN isc_timermgr_t *named_g_timermgr INIT(NULL);
EXTERN isc_socketmgr_t *named_g_socketmgr INIT(NULL); EXTERN isc_socketmgr_t *named_g_socketmgr INIT(NULL);
EXTERN isc_nm_t *named_g_nm INIT(NULL); EXTERN isc_nm_t *named_g_netmgr INIT(NULL);
EXTERN cfg_parser_t *named_g_parser INIT(NULL); EXTERN cfg_parser_t *named_g_parser INIT(NULL);
EXTERN cfg_parser_t *named_g_addparser INIT(NULL); EXTERN cfg_parser_t *named_g_addparser INIT(NULL);
EXTERN const char *named_g_version INIT(PACKAGE_VERSION); EXTERN const char *named_g_version INIT(PACKAGE_VERSION);
@@ -73,6 +73,8 @@ EXTERN const char *named_g_configargs INIT(PACKAGE_CONFIGARGS);
EXTERN const char *named_g_builder INIT(PACKAGE_BUILDER); EXTERN const char *named_g_builder INIT(PACKAGE_BUILDER);
EXTERN in_port_t named_g_port INIT(0); EXTERN in_port_t named_g_port INIT(0);
EXTERN in_port_t named_g_tlsport INIT(0); EXTERN in_port_t named_g_tlsport INIT(0);
EXTERN in_port_t named_g_httpsport INIT(0);
EXTERN in_port_t named_g_httpport INIT(0);
EXTERN isc_dscp_t named_g_dscp INIT(-1); EXTERN isc_dscp_t named_g_dscp INIT(-1);
EXTERN named_server_t *named_g_server INIT(NULL); EXTERN named_server_t *named_g_server INIT(NULL);
+51 -92
View File
@@ -18,6 +18,10 @@
#include <string.h> #include <string.h>
#include <uv.h> #include <uv.h>
#ifdef HAVE_DNSTAP
#include <protobuf-c/protobuf-c.h>
#endif
#include <isc/app.h> #include <isc/app.h>
#include <isc/attributes.h> #include <isc/attributes.h>
#include <isc/backtrace.h> #include <isc/backtrace.h>
@@ -27,6 +31,7 @@
#include <isc/hash.h> #include <isc/hash.h>
#include <isc/hp.h> #include <isc/hp.h>
#include <isc/httpd.h> #include <isc/httpd.h>
#include <isc/managers.h>
#include <isc/netmgr.h> #include <isc/netmgr.h>
#include <isc/os.h> #include <isc/os.h>
#include <isc/platform.h> #include <isc/platform.h>
@@ -96,6 +101,7 @@
#ifdef HAVE_ZLIB #ifdef HAVE_ZLIB
#include <zlib.h> #include <zlib.h>
#endif /* ifdef HAVE_ZLIB */ #endif /* ifdef HAVE_ZLIB */
#include <nghttp2/nghttp2.h>
/* /*
* Include header files for database drivers here. * Include header files for database drivers here.
*/ */
@@ -200,8 +206,6 @@ assertion_failed(const char *file, int line, isc_assertiontype_t type,
const char *cond) { const char *cond) {
void *tracebuf[BACKTRACE_MAXFRAME]; void *tracebuf[BACKTRACE_MAXFRAME];
int nframes; int nframes;
isc_result_t result;
const char *logsuffix = "";
/* /*
* Handle assertion failures. * Handle assertion failures.
@@ -214,32 +218,23 @@ assertion_failed(const char *file, int line, isc_assertiontype_t type,
*/ */
isc_assertion_setcallback(NULL); isc_assertion_setcallback(NULL);
result = isc_backtrace_gettrace(tracebuf, BACKTRACE_MAXFRAME, nframes = isc_backtrace(tracebuf, BACKTRACE_MAXFRAME);
&nframes);
if (result == ISC_R_SUCCESS && nframes > 0) {
logsuffix = ", back trace";
}
isc_log_write(named_g_lctx, NAMED_LOGCATEGORY_GENERAL, isc_log_write(named_g_lctx, NAMED_LOGCATEGORY_GENERAL,
NAMED_LOGMODULE_MAIN, ISC_LOG_CRITICAL, NAMED_LOGMODULE_MAIN, ISC_LOG_CRITICAL,
"%s:%d: %s(%s) failed%s", file, line, "%s:%d: %s(%s) failed%s", file, line,
isc_assertion_typetotext(type), cond, logsuffix); isc_assertion_typetotext(type), cond,
if (result == ISC_R_SUCCESS) { (nframes > 0) ? ", back trace" : "");
#if HAVE_BACKTRACE_SYMBOLS if (nframes > 0) {
char **strs = backtrace_symbols(tracebuf, nframes); char **strs = isc_backtrace_symbols(tracebuf, nframes);
if (strs != NULL) {
for (int i = 0; i < nframes; i++) { for (int i = 0; i < nframes; i++) {
isc_log_write(named_g_lctx, isc_log_write(named_g_lctx,
NAMED_LOGCATEGORY_GENERAL, NAMED_LOGCATEGORY_GENERAL,
NAMED_LOGMODULE_MAIN, NAMED_LOGMODULE_MAIN,
ISC_LOG_CRITICAL, "%s", strs[i]); ISC_LOG_CRITICAL, "%s",
strs[i]);
} }
#else /* HAVE_BACKTRACE_SYMBOLS */
for (int i = 0; i < nframes; i++) {
isc_log_write(
named_g_lctx, NAMED_LOGCATEGORY_GENERAL,
NAMED_LOGMODULE_MAIN, ISC_LOG_CRITICAL,
"#%d %p in ??", i, tracebuf[i]);
} }
#endif /* HAVE_BACKTRACE_SYMBOLS */
} }
isc_log_write(named_g_lctx, NAMED_LOGCATEGORY_GENERAL, isc_log_write(named_g_lctx, NAMED_LOGCATEGORY_GENERAL,
NAMED_LOGMODULE_MAIN, ISC_LOG_CRITICAL, NAMED_LOGMODULE_MAIN, ISC_LOG_CRITICAL,
@@ -325,11 +320,14 @@ library_unexpected_error(const char *file, int line, const char *format,
static void static void
usage(void) { usage(void) {
fprintf(stderr, "usage: named [-4|-6] [-c conffile] [-d debuglevel] " fprintf(stderr, "usage: named [-4|-6] [-c conffile] [-d debuglevel] "
"[-E engine] [-f|-g]\n" "[-D comment] [-E engine]\n"
" [-n number_of_cpus] [-p port] [-s] " " [-f|-g] [-L logfile] [-n number_of_cpus] "
"[-S sockets] [-t chrootdir]\n" "[-p port] [-s]\n"
" [-u username] [-U listeners] " " [-S sockets] [-t chrootdir] [-u "
"[-m {usage|trace|record|size|mctx}]\n" "username] [-U listeners]\n"
" [-X lockfile] [-m "
"{usage|trace|record|size|mctx}]\n"
" [-M fill|nofill]\n"
"usage: named [-v|-V]\n"); "usage: named [-v|-V]\n");
} }
@@ -435,8 +433,7 @@ static struct flag_def {
{ "size", ISC_MEM_DEBUGSIZE, false }, { "size", ISC_MEM_DEBUGSIZE, false },
{ "mctx", ISC_MEM_DEBUGCTX, false }, { "mctx", ISC_MEM_DEBUGCTX, false },
{ NULL, 0, false } }, { NULL, 0, false } },
mem_context_flags[] = { { "external", ISC_MEMFLAG_INTERNAL, true }, mem_context_flags[] = { { "fill", ISC_MEMFLAG_FILL, false },
{ "fill", ISC_MEMFLAG_FILL, false },
{ "nofill", ISC_MEMFLAG_FILL, true }, { "nofill", ISC_MEMFLAG_FILL, true },
{ NULL, 0, false } }; { NULL, 0, false } };
@@ -488,6 +485,7 @@ printversion(bool verbose) {
cfg_obj_t *config = NULL; cfg_obj_t *config = NULL;
const cfg_obj_t *defaults = NULL, *obj = NULL; const cfg_obj_t *defaults = NULL, *obj = NULL;
#endif /* if defined(HAVE_GEOIP2) */ #endif /* if defined(HAVE_GEOIP2) */
nghttp2_info *nginfo = NULL;
printf("%s%s <id:%s>\n", PACKAGE_STRING, PACKAGE_DESCRIPTION, printf("%s%s <id:%s>\n", PACKAGE_STRING, PACKAGE_DESCRIPTION,
PACKAGE_SRCID); PACKAGE_SRCID);
@@ -529,6 +527,9 @@ printversion(bool verbose) {
printf("compiled with libuv version: %d.%d.%d\n", UV_VERSION_MAJOR, printf("compiled with libuv version: %d.%d.%d\n", UV_VERSION_MAJOR,
UV_VERSION_MINOR, UV_VERSION_PATCH); UV_VERSION_MINOR, UV_VERSION_PATCH);
printf("linked to libuv version: %s\n", uv_version_string()); printf("linked to libuv version: %s\n", uv_version_string());
printf("compiled with libnghttp2 version: %s\n", NGHTTP2_VERSION);
nginfo = nghttp2_version(1);
printf("linked to libnghttp2 version: %s\n", nginfo->version_str);
#ifdef HAVE_LIBXML2 #ifdef HAVE_LIBXML2
printf("compiled with libxml2 version: %s\n", LIBXML_DOTTED_VERSION); printf("compiled with libxml2 version: %s\n", LIBXML_DOTTED_VERSION);
printf("linked to libxml2 version: %s\n", xmlParserVersion); printf("linked to libxml2 version: %s\n", xmlParserVersion);
@@ -705,7 +706,7 @@ parse_T_opt(char *option) {
static void static void
parse_port(char *arg) { parse_port(char *arg) {
enum { DNSPORT, TLSPORT } ptype = DNSPORT; enum { DNSPORT, TLSPORT, HTTPSPORT, HTTPPORT } ptype = DNSPORT;
char *value = arg; char *value = arg;
int port; int port;
@@ -714,6 +715,12 @@ parse_port(char *arg) {
} else if (strncmp(arg, "tls=", 4) == 0) { } else if (strncmp(arg, "tls=", 4) == 0) {
value = arg + 4; value = arg + 4;
ptype = TLSPORT; ptype = TLSPORT;
} else if (strncmp(arg, "https=", 6) == 0) {
value = arg + 6;
ptype = HTTPSPORT;
} else if (strncmp(arg, "http=", 5) == 0) {
value = arg + 6;
ptype = HTTPPORT;
} }
port = parse_int(value, "port"); port = parse_int(value, "port");
@@ -728,6 +735,12 @@ parse_port(char *arg) {
case TLSPORT: case TLSPORT:
named_g_tlsport = port; named_g_tlsport = port;
break; break;
case HTTPSPORT:
named_g_httpsport = port;
break;
case HTTPPORT:
named_g_httpport = port;
break;
default: default:
INSIST(0); INSIST(0);
ISC_UNREACHABLE(); ISC_UNREACHABLE();
@@ -925,45 +938,17 @@ create_managers(void) {
"using %u UDP listener%s per interface", named_g_udpdisp, "using %u UDP listener%s per interface", named_g_udpdisp,
named_g_udpdisp == 1 ? "" : "s"); named_g_udpdisp == 1 ? "" : "s");
/* result = isc_managers_create(named_g_mctx, named_g_cpus,
* We have ncpus network threads, ncpus worker threads, ncpus 0 /* quantum */, maxsocks, &named_g_netmgr,
* old network threads - make it 4x just to be safe. The memory &named_g_taskmgr, &named_g_timermgr,
* impact is negligible. &named_g_socketmgr);
*/ if (result != ISC_R_SUCCESS) {
isc_hp_init(4 * named_g_cpus); return (result);
named_g_nm = isc_nm_start(named_g_mctx, named_g_cpus);
if (named_g_nm == NULL) {
UNEXPECTED_ERROR(__FILE__, __LINE__, "isc_nm_start() failed");
return (ISC_R_UNEXPECTED);
} }
result = isc_taskmgr_create(named_g_mctx, named_g_cpus, 0, named_g_nm,
&named_g_taskmgr);
if (result != ISC_R_SUCCESS) {
UNEXPECTED_ERROR(__FILE__, __LINE__,
"isc_taskmgr_create() failed: %s",
isc_result_totext(result));
return (ISC_R_UNEXPECTED);
}
result = isc_timermgr_create(named_g_mctx, &named_g_timermgr);
if (result != ISC_R_SUCCESS) {
UNEXPECTED_ERROR(__FILE__, __LINE__,
"isc_timermgr_create() failed: %s",
isc_result_totext(result));
return (ISC_R_UNEXPECTED);
}
result = isc_socketmgr_create2(named_g_mctx, &named_g_socketmgr,
maxsocks, named_g_cpus);
if (result != ISC_R_SUCCESS) {
UNEXPECTED_ERROR(__FILE__, __LINE__,
"isc_socketmgr_create() failed: %s",
isc_result_totext(result));
return (ISC_R_UNEXPECTED);
}
isc_socketmgr_maxudp(named_g_socketmgr, maxudp); isc_socketmgr_maxudp(named_g_socketmgr, maxudp);
isc_nm_maxudp(named_g_nm, maxudp); isc_nm_maxudp(named_g_netmgr, maxudp);
result = isc_socketmgr_getmaxsockets(named_g_socketmgr, &socks); result = isc_socketmgr_getmaxsockets(named_g_socketmgr, &socks);
if (result == ISC_R_SUCCESS) { if (result == ISC_R_SUCCESS) {
isc_log_write(named_g_lctx, NAMED_LOGCATEGORY_GENERAL, isc_log_write(named_g_lctx, NAMED_LOGCATEGORY_GENERAL,
@@ -976,25 +961,8 @@ create_managers(void) {
static void static void
destroy_managers(void) { destroy_managers(void) {
/* isc_managers_destroy(&named_g_netmgr, &named_g_taskmgr,
* isc_nm_closedown() closes all active connections, freeing &named_g_timermgr, &named_g_socketmgr);
* attached clients and other resources and preventing new
* connections from being established, but it not does not
* stop all processing or destroy the netmgr yet.
*/
isc_nm_closedown(named_g_nm);
/*
* isc_taskmgr_destroy() will block until all tasks have exited.
*/
isc_taskmgr_destroy(&named_g_taskmgr);
isc_timermgr_destroy(&named_g_timermgr);
isc_socketmgr_destroy(&named_g_socketmgr);
/*
* At this point is safe to destroy the netmgr.
*/
isc_nm_destroy(&named_g_nm);
} }
static void static void
@@ -1504,15 +1472,6 @@ main(int argc, char *argv[]) {
pk11_result_register(); pk11_result_register();
#endif /* if USE_PKCS11 */ #endif /* if USE_PKCS11 */
#if !ISC_MEM_DEFAULTFILL
/*
* Update the default flags to remove ISC_MEMFLAG_FILL
* before we parse the command line. If disabled here,
* it can be turned back on with -M fill.
*/
isc_mem_defaultflags &= ~ISC_MEMFLAG_FILL;
#endif /* if !ISC_MEM_DEFAULTFILL */
parse_command_line(argc, argv); parse_command_line(argc, argv);
#ifdef ENABLE_AFL #ifdef ENABLE_AFL
@@ -1543,7 +1502,7 @@ main(int argc, char *argv[]) {
} }
isc_mem_create(&named_g_mctx); isc_mem_create(&named_g_mctx);
isc_mem_setname(named_g_mctx, "main", NULL); isc_mem_setname(named_g_mctx, "main");
setup(); setup();
+20 -4
View File
@@ -71,6 +71,7 @@ DNSSEC-POLICY
parent-ds-ttl duration; parent-ds-ttl duration;
parent-propagation-delay duration; parent-propagation-delay duration;
publish-safety duration; publish-safety duration;
purge-keys duration;
retire-safety duration; retire-safety duration;
signatures-refresh duration; signatures-refresh duration;
signatures-validity duration; signatures-validity duration;
@@ -86,6 +87,15 @@ DYNDB
dyndb string quoted_string { dyndb string quoted_string {
unspecified-text }; unspecified-text };
HTTP
^^^^
::
http string {
endpoints { quoted_string; ... };
};
KEY KEY
^^^ ^^^
@@ -264,7 +274,8 @@ OPTIONS
glue-cache boolean;// deprecated glue-cache boolean;// deprecated
heartbeat-interval integer; heartbeat-interval integer;
hostname ( quoted_string | none ); hostname ( quoted_string | none );
inline-signing boolean; http-port integer;
https-port integer;
interface-interval duration; interface-interval duration;
ipv4only-contact string; ipv4only-contact string;
ipv4only-enable boolean; ipv4only-enable boolean;
@@ -275,10 +286,12 @@ OPTIONS
key-directory quoted_string; key-directory quoted_string;
lame-ttl duration; lame-ttl duration;
listen-on [ port integer ] [ dscp listen-on [ port integer ] [ dscp
integer ] [ tls string ] { integer ] [ tls string ] [ http
string ] {
address_match_element; ... }; address_match_element; ... };
listen-on-v6 [ port integer ] [ dscp listen-on-v6 [ port integer ] [ dscp
integer ] [ tls string ] { integer ] [ tls string ] [ http
string ] {
address_match_element; ... }; address_match_element; ... };
lmdb-mapsize sizeval; lmdb-mapsize sizeval;
lock-file ( quoted_string | none ); lock-file ( quoted_string | none );
@@ -419,6 +432,8 @@ OPTIONS
tcp-initial-timeout integer; tcp-initial-timeout integer;
tcp-keepalive-timeout integer; tcp-keepalive-timeout integer;
tcp-listen-queue integer; tcp-listen-queue integer;
tcp-receive-buffer integer;
tcp-send-buffer integer;
tkey-dhkey quoted_string integer; tkey-dhkey quoted_string integer;
tkey-domain quoted_string; tkey-domain quoted_string;
tkey-gssapi-credential quoted_string; tkey-gssapi-credential quoted_string;
@@ -435,6 +450,8 @@ OPTIONS
transfers-per-ns integer; transfers-per-ns integer;
trust-anchor-telemetry boolean; // experimental trust-anchor-telemetry boolean; // experimental
try-tcp-refresh boolean; try-tcp-refresh boolean;
udp-receive-buffer integer;
udp-send-buffer integer;
update-check-ksk boolean; update-check-ksk boolean;
use-alt-transfer-source boolean; use-alt-transfer-source boolean;
use-v4-udp-ports { portrange; ... }; use-v4-udp-ports { portrange; ... };
@@ -652,7 +669,6 @@ VIEW
forwarders [ port integer ] [ dscp integer ] { ( ipv4_address forwarders [ port integer ] [ dscp integer ] { ( ipv4_address
| ipv6_address ) [ port integer ] [ dscp integer ]; ... }; | ipv6_address ) [ port integer ] [ dscp integer ]; ... };
glue-cache boolean;// deprecated glue-cache boolean;// deprecated
inline-signing boolean;
ipv4only-contact string; ipv4only-contact string;
ipv4only-enable boolean; ipv4only-enable boolean;
ipv4only-server string; ipv4only-server string;
+4
View File
@@ -115,6 +115,10 @@ Options
``portnum``; if not not specified, the default is port 53. If ``portnum``; if not not specified, the default is port 53. If
``value`` is of the form ``tls=<portnum>``, the server will ``value`` is of the form ``tls=<portnum>``, the server will
listen for TLS queries on ``portnum``; the default is 853. listen for TLS queries on ``portnum``; the default is 853.
If ``value`` is of the form ``https=<portnum>``, the server will
listen for HTTPS queries on ``portnum``; the default is 443.
If ``value`` is of the form ``http=<portnum>``, the server will
listen for HTTP queries on ``portnum``; the default is 80.
``-s`` ``-s``
This option writes memory usage statistics to ``stdout`` on exit. This option writes memory usage statistics to ``stdout`` on exit.
+445 -163
View File
File diff suppressed because it is too large Load Diff
+1 -1
View File
@@ -3612,7 +3612,7 @@ add_listener(named_server_t *server, named_statschannel_t **listenerp,
CHECK(ISC_R_FAMILYNOSUPPORT); CHECK(ISC_R_FAMILYNOSUPPORT);
} }
CHECK(isc_httpdmgr_create(named_g_nm, server->mctx, addr, client_ok, CHECK(isc_httpdmgr_create(named_g_netmgr, server->mctx, addr, client_ok,
destroy_listener, listener, destroy_listener, listener,
&listener->httpdmgr)); &listener->httpdmgr));
+1 -1
View File
@@ -64,7 +64,7 @@ add_doh_transports(const cfg_obj_t *transportlist, dns_transport_list_t *list) {
create_name(dohid, &dohname); create_name(dohid, &dohname);
transport = dns_transport_new(&dohname, DNS_TRANSPORT_DOH, transport = dns_transport_new(&dohname, DNS_TRANSPORT_HTTP,
list); list);
parse_transport_option(doh, transport, "key-file", parse_transport_option(doh, transport, "key-file",
+1 -1
View File
@@ -379,7 +379,7 @@ all_digits(const char *s) {
return (false); return (false);
} }
while (*s != '\0') { while (*s != '\0') {
if (!isdigit((*s) & 0xff)) { if (!isdigit((unsigned char)(*s))) {
return (false); return (false);
} }
s++; s++;
+4 -4
View File
@@ -67,7 +67,7 @@
<ProgramDataBaseFileName>$(OutDir)$(TargetName).pdb</ProgramDataBaseFileName> <ProgramDataBaseFileName>$(OutDir)$(TargetName).pdb</ProgramDataBaseFileName>
<BrowseInformation>true</BrowseInformation> <BrowseInformation>true</BrowseInformation>
<ForcedIncludeFiles>..\..\..\config.h</ForcedIncludeFiles> <ForcedIncludeFiles>..\..\..\config.h</ForcedIncludeFiles>
<AdditionalIncludeDirectories>@LIBUV_INC@@OPENSSL_INC@@GSSAPI_INC@@GEOIP_INC@.\;..\..\..\;@LIBXML2_INC@..\win32\include;..\include;..\..\..\lib\isc\win32;..\..\..\lib\isc\win32\include;..\..\..\lib\isc\include;..\..\..\lib\dns\include;..\..\..\lib\isccc\include;..\..\..\lib\isccfg\include;..\..\..\lib\bind9\include;..\..\..\lib\ns\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> <AdditionalIncludeDirectories>@LIBUV_INC@@NGHTTP2_INC@@OPENSSL_INC@@GSSAPI_INC@@GEOIP_INC@.\;..\..\..\;@LIBXML2_INC@..\win32\include;..\include;..\..\..\lib\isc\win32;..\..\..\lib\isc\win32\include;..\..\..\lib\isc\include;..\..\..\lib\dns\include;..\..\..\lib\isccc\include;..\..\..\lib\isccfg\include;..\..\..\lib\bind9\include;..\..\..\lib\ns\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<CompileAs>CompileAsC</CompileAs> <CompileAs>CompileAsC</CompileAs>
</ClCompile> </ClCompile>
<Link> <Link>
@@ -75,7 +75,7 @@
<GenerateDebugInformation>true</GenerateDebugInformation> <GenerateDebugInformation>true</GenerateDebugInformation>
<OutputFile>..\..\..\Build\$(Configuration)\$(TargetName)$(TargetExt)</OutputFile> <OutputFile>..\..\..\Build\$(Configuration)\$(TargetName)$(TargetExt)</OutputFile>
<AdditionalLibraryDirectories>..\..\..\lib\isc\win32\$(Configuration);..\..\..\lib\dns\win32\$(Configuration);..\..\..\lib\isccc\win32\$(Configuration);..\..\..\lib\isccfg\win32\$(Configuration);..\..\..\lib\bind9\win32\$(Configuration);..\..\..\lib\ns\win32\$(Configuration);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> <AdditionalLibraryDirectories>..\..\..\lib\isc\win32\$(Configuration);..\..\..\lib\dns\win32\$(Configuration);..\..\..\lib\isccc\win32\$(Configuration);..\..\..\lib\isccfg\win32\$(Configuration);..\..\..\lib\bind9\win32\$(Configuration);..\..\..\lib\ns\win32\$(Configuration);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<AdditionalDependencies>@LIBUV_LIB@@OPENSSL_LIBCRYPTO@@OPENSSL_LIBSSL@@LIBXML2_LIB@@GSSAPI_LIB@@GEOIP_LIB@libisc.lib;libdns.lib;libisccc.lib;libisccfg.lib;libbind9.lib;libns.lib;version.lib;ws2_32.lib;%(AdditionalDependencies)</AdditionalDependencies> <AdditionalDependencies>@LIBUV_LIB@@NGHTTP2_LIB@@OPENSSL_LIBCRYPTO@@OPENSSL_LIBSSL@@LIBXML2_LIB@@GSSAPI_LIB@@GEOIP_LIB@libisc.lib;libdns.lib;libisccc.lib;libisccfg.lib;libbind9.lib;libns.lib;version.lib;ws2_32.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link> </Link>
<PreBuildEvent> <PreBuildEvent>
<Command>cd .. <Command>cd ..
@@ -103,7 +103,7 @@ perl -e "print \";\";" &gt;&gt; xsl.c
<ObjectFileName>.\$(Configuration)\</ObjectFileName> <ObjectFileName>.\$(Configuration)\</ObjectFileName>
<ProgramDataBaseFileName>$(OutDir)$(TargetName).pdb</ProgramDataBaseFileName> <ProgramDataBaseFileName>$(OutDir)$(TargetName).pdb</ProgramDataBaseFileName>
<ForcedIncludeFiles>..\..\..\config.h</ForcedIncludeFiles> <ForcedIncludeFiles>..\..\..\config.h</ForcedIncludeFiles>
<AdditionalIncludeDirectories>@LIBUV_INC@@OPENSSL_INC@@GSSAPI_INC@@GEOIP_INC@.\;..\..\..\;@LIBXML2_INC@..\win32\include;..\include;..\..\..\lib\isc\win32;..\..\..\lib\isc\win32\include;..\..\..\lib\isc\include;..\..\..\lib\dns\include;..\..\..\lib\isccc\include;..\..\..\lib\isccfg\include;..\..\..\lib\bind9\include;..\..\..\lib\ns\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> <AdditionalIncludeDirectories>@LIBUV_INC@@NGHTTP2_INC@@OPENSSL_INC@@GSSAPI_INC@@GEOIP_INC@.\;..\..\..\;@LIBXML2_INC@..\win32\include;..\include;..\..\..\lib\isc\win32;..\..\..\lib\isc\win32\include;..\..\..\lib\isc\include;..\..\..\lib\dns\include;..\..\..\lib\isccc\include;..\..\..\lib\isccfg\include;..\..\..\lib\bind9\include;..\..\..\lib\ns\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<CompileAs>CompileAsC</CompileAs> <CompileAs>CompileAsC</CompileAs>
</ClCompile> </ClCompile>
<Link> <Link>
@@ -114,7 +114,7 @@ perl -e "print \";\";" &gt;&gt; xsl.c
<OutputFile>..\..\..\Build\$(Configuration)\$(TargetName)$(TargetExt)</OutputFile> <OutputFile>..\..\..\Build\$(Configuration)\$(TargetName)$(TargetExt)</OutputFile>
<LinkTimeCodeGeneration>Default</LinkTimeCodeGeneration> <LinkTimeCodeGeneration>Default</LinkTimeCodeGeneration>
<AdditionalLibraryDirectories>..\..\..\lib\isc\win32\$(Configuration);..\..\..\lib\dns\win32\$(Configuration);..\..\..\lib\isccc\win32\$(Configuration);..\..\..\lib\isccfg\win32\$(Configuration);..\..\..\lib\bind9\win32\$(Configuration);..\..\..\lib\ns\win32\$(Configuration);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> <AdditionalLibraryDirectories>..\..\..\lib\isc\win32\$(Configuration);..\..\..\lib\dns\win32\$(Configuration);..\..\..\lib\isccc\win32\$(Configuration);..\..\..\lib\isccfg\win32\$(Configuration);..\..\..\lib\bind9\win32\$(Configuration);..\..\..\lib\ns\win32\$(Configuration);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<AdditionalDependencies>@LIBUV_LIB@@OPENSSL_LIBCRYPTO@@OPENSSL_LIBSSL@@LIBXML2_LIB@@GSSAPI_LIB@@GEOIP_LIB@libisc.lib;libdns.lib;libisccc.lib;libisccfg.lib;libbind9.lib;libns.lib;version.lib;ws2_32.lib;%(AdditionalDependencies)</AdditionalDependencies> <AdditionalDependencies>@LIBUV_LIB@@NGHTTP2_LIB@@OPENSSL_LIBCRYPTO@@OPENSSL_LIBSSL@@LIBXML2_LIB@@GSSAPI_LIB@@GEOIP_LIB@libisc.lib;libdns.lib;libisccc.lib;libisccfg.lib;libbind9.lib;libns.lib;version.lib;ws2_32.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link> </Link>
<PreBuildEvent> <PreBuildEvent>
<Command>cd .. <Command>cd ..
+17 -20
View File
@@ -272,7 +272,7 @@ configure_zone_ssutable(const cfg_obj_t *zconfig, dns_zone_t *zone,
dns_fixedname_init(&fname); dns_fixedname_init(&fname);
if (usezone) { if (usezone) {
dns_name_copynf(dns_zone_getorigin(zone), dns_name_copy(dns_zone_getorigin(zone),
dns_fixedname_name(&fname)); dns_fixedname_name(&fname));
} else { } else {
str = cfg_obj_asstring(dname); str = cfg_obj_asstring(dname);
@@ -1249,15 +1249,23 @@ named_zone_configure(const cfg_obj_t *config, const cfg_obj_t *vconfig,
result = named_config_get(maps, "dnssec-policy", &obj); result = named_config_get(maps, "dnssec-policy", &obj);
if (result == ISC_R_SUCCESS) { if (result == ISC_R_SUCCESS) {
kaspname = cfg_obj_asstring(obj); kaspname = cfg_obj_asstring(obj);
result = dns_kasplist_find(kasplist, kaspname, &kasp); if (strcmp(kaspname, "none") != 0) {
result = dns_kasplist_find(kasplist, kaspname,
&kasp);
if (result != ISC_R_SUCCESS) { if (result != ISC_R_SUCCESS) {
cfg_obj_log(obj, named_g_lctx, ISC_LOG_ERROR, cfg_obj_log(
"'dnssec-policy '%s' not found ", obj, named_g_lctx,
ISC_LOG_ERROR,
"dnssec-policy '%s' not found ",
kaspname); kaspname);
RETERR(result); RETERR(result);
} }
dns_zone_setkasp(zone, kasp); dns_zone_setkasp(zone, kasp);
use_kasp = dns_zone_use_kasp(zone); use_kasp = true;
}
}
if (!use_kasp) {
dns_zone_setkasp(zone, NULL);
} }
obj = NULL; obj = NULL;
@@ -1671,10 +1679,11 @@ named_zone_configure(const cfg_obj_t *config, const cfg_obj_t *vconfig,
obj = NULL; obj = NULL;
result = cfg_map_get(zoptions, "auto-dnssec", &obj); result = cfg_map_get(zoptions, "auto-dnssec", &obj);
if (kasp != NULL && strcmp(dns_kasp_getname(kasp), "none") != 0) if (kasp != NULL) {
{ bool s2i = (strcmp(dns_kasp_getname(kasp),
"insecure") != 0);
dns_zone_setkeyopt(zone, DNS_ZONEKEY_ALLOW, true); dns_zone_setkeyopt(zone, DNS_ZONEKEY_ALLOW, true);
dns_zone_setkeyopt(zone, DNS_ZONEKEY_CREATE, true); dns_zone_setkeyopt(zone, DNS_ZONEKEY_CREATE, !s2i);
dns_zone_setkeyopt(zone, DNS_ZONEKEY_MAINTAIN, true); dns_zone_setkeyopt(zone, DNS_ZONEKEY_MAINTAIN, true);
} else if (result == ISC_R_SUCCESS) { } else if (result == ISC_R_SUCCESS) {
const char *arg = cfg_obj_asstring(obj); const char *arg = cfg_obj_asstring(obj);
@@ -1691,11 +1700,6 @@ named_zone_configure(const cfg_obj_t *config, const cfg_obj_t *vconfig,
dns_zone_setkeyopt(zone, DNS_ZONEKEY_ALLOW, allow); dns_zone_setkeyopt(zone, DNS_ZONEKEY_ALLOW, allow);
dns_zone_setkeyopt(zone, DNS_ZONEKEY_CREATE, false); dns_zone_setkeyopt(zone, DNS_ZONEKEY_CREATE, false);
dns_zone_setkeyopt(zone, DNS_ZONEKEY_MAINTAIN, maint); dns_zone_setkeyopt(zone, DNS_ZONEKEY_MAINTAIN, maint);
} else {
bool s2i = dns_zone_secure_to_insecure(zone, false);
dns_zone_setkeyopt(zone, DNS_ZONEKEY_ALLOW, s2i);
dns_zone_setkeyopt(zone, DNS_ZONEKEY_CREATE, false);
dns_zone_setkeyopt(zone, DNS_ZONEKEY_MAINTAIN, s2i);
} }
} }
@@ -2216,13 +2220,6 @@ named_zone_inlinesigning(dns_zone_t *zone, const cfg_obj_t *zconfig,
dns_zone_log(zone, ISC_LOG_DEBUG(1), dns_zone_log(zone, ISC_LOG_DEBUG(1),
"inline-signing: " "inline-signing: "
"implicitly through dnssec-policy"); "implicitly through dnssec-policy");
} else {
inline_signing = dns_zone_secure_to_insecure(zone,
true);
dns_zone_log(
zone, ISC_LOG_DEBUG(1), "inline-signing: %s",
inline_signing ? "transitioning to insecure"
: "no");
} }
} }
+6 -1
View File
@@ -7,7 +7,8 @@ AM_CPPFLAGS += \
$(LIBIRS_CFLAGS) \ $(LIBIRS_CFLAGS) \
$(LIBBIND9_CFLAGS) \ $(LIBBIND9_CFLAGS) \
$(GSSAPI_CFLAGS) \ $(GSSAPI_CFLAGS) \
$(KRB5_CFLAGS) $(KRB5_CFLAGS) \
$(READLINE_CFLAGS)
AM_CPPFLAGS += \ AM_CPPFLAGS += \
-DSESSION_KEYFILE=\"${localstatedir}/run/named/session.key\" -DSESSION_KEYFILE=\"${localstatedir}/run/named/session.key\"
@@ -27,3 +28,7 @@ LDADD += \
endif endif
bin_PROGRAMS = nsupdate bin_PROGRAMS = nsupdate
nsupdate_SOURCES = \
nsupdate.c \
../dig/readline.h
+25 -28
View File
@@ -29,6 +29,7 @@
#include <isc/hash.h> #include <isc/hash.h>
#include <isc/lex.h> #include <isc/lex.h>
#include <isc/log.h> #include <isc/log.h>
#include <isc/managers.h>
#include <isc/mem.h> #include <isc/mem.h>
#include <isc/nonce.h> #include <isc/nonce.h>
#include <isc/parseint.h> #include <isc/parseint.h>
@@ -36,7 +37,6 @@
#include <isc/portset.h> #include <isc/portset.h>
#include <isc/print.h> #include <isc/print.h>
#include <isc/random.h> #include <isc/random.h>
#include <isc/readline.h>
#include <isc/region.h> #include <isc/region.h>
#include <isc/sockaddr.h> #include <isc/sockaddr.h>
#include <isc/socket.h> #include <isc/socket.h>
@@ -58,6 +58,7 @@
#include <dns/masterdump.h> #include <dns/masterdump.h>
#include <dns/message.h> #include <dns/message.h>
#include <dns/name.h> #include <dns/name.h>
#include <dns/nsec3.h>
#include <dns/rcode.h> #include <dns/rcode.h>
#include <dns/rdata.h> #include <dns/rdata.h>
#include <dns/rdataclass.h> #include <dns/rdataclass.h>
@@ -95,6 +96,8 @@
#include <bind9/getaddresses.h> #include <bind9/getaddresses.h>
#include "../dig/readline.h"
#define MAXCMD (128 * 1024) #define MAXCMD (128 * 1024)
#define MAXWIRE (64 * 1024) #define MAXWIRE (64 * 1024)
#define PACKETSIZE ((64 * 1024) - 1) #define PACKETSIZE ((64 * 1024) - 1)
@@ -124,6 +127,7 @@ static bool usegsstsig = false;
static bool use_win2k_gsstsig = false; static bool use_win2k_gsstsig = false;
static bool tried_other_gsstsig = false; static bool tried_other_gsstsig = false;
static bool local_only = false; static bool local_only = false;
static isc_nm_t *netmgr = NULL;
static isc_taskmgr_t *taskmgr = NULL; static isc_taskmgr_t *taskmgr = NULL;
static isc_task_t *global_task = NULL; static isc_task_t *global_task = NULL;
static isc_event_t *global_event = NULL; static isc_event_t *global_event = NULL;
@@ -920,14 +924,8 @@ setup_system(void) {
result = dns_dispatchmgr_create(gmctx, &dispatchmgr); result = dns_dispatchmgr_create(gmctx, &dispatchmgr);
check_result(result, "dns_dispatchmgr_create"); check_result(result, "dns_dispatchmgr_create");
result = isc_socketmgr_create(gmctx, &socketmgr); isc_managers_create(gmctx, 1, 0, 0, &netmgr, &taskmgr, &timermgr,
check_result(result, "dns_socketmgr_create"); &socketmgr);
result = isc_timermgr_create(gmctx, &timermgr);
check_result(result, "dns_timermgr_create");
result = isc_taskmgr_create(gmctx, 1, 0, NULL, &taskmgr);
check_result(result, "isc_taskmgr_create");
result = isc_task_create(taskmgr, 0, &global_task); result = isc_task_create(taskmgr, 0, &global_task);
check_result(result, "isc_task_create"); check_result(result, "isc_task_create");
@@ -1266,7 +1264,6 @@ static uint16_t
parse_name(char **cmdlinep, dns_message_t *msg, dns_name_t **namep) { parse_name(char **cmdlinep, dns_message_t *msg, dns_name_t **namep) {
isc_result_t result; isc_result_t result;
char *word; char *word;
isc_buffer_t *namebuf = NULL;
isc_buffer_t source; isc_buffer_t source;
word = nsu_strsep(cmdlinep, " \t\r\n"); word = nsu_strsep(cmdlinep, " \t\r\n");
@@ -1277,10 +1274,6 @@ parse_name(char **cmdlinep, dns_message_t *msg, dns_name_t **namep) {
result = dns_message_gettempname(msg, namep); result = dns_message_gettempname(msg, namep);
check_result(result, "dns_message_gettempname"); check_result(result, "dns_message_gettempname");
isc_buffer_allocate(gmctx, &namebuf, DNS_NAME_MAXWIRE);
dns_name_init(*namep, NULL);
dns_name_setbuffer(*namep, namebuf);
dns_message_takebuffer(msg, &namebuf);
isc_buffer_init(&source, word, strlen(word)); isc_buffer_init(&source, word, strlen(word));
isc_buffer_add(&source, strlen(word)); isc_buffer_add(&source, strlen(word));
result = dns_name_fromtext(*namep, &source, dns_rootname, 0, NULL); result = dns_name_fromtext(*namep, &source, dns_rootname, 0, NULL);
@@ -1964,6 +1957,19 @@ parseclass:
} }
} }
if (!isdelete && rdata->type == dns_rdatatype_nsec3param) {
dns_rdata_nsec3param_t nsec3param;
result = dns_rdata_tostruct(rdata, &nsec3param, NULL);
check_result(result, "dns_rdata_tostruct");
if (nsec3param.iterations > dns_nsec3_maxiterations()) {
fprintf(stderr,
"NSEC3PARAM has excessive iterations (> %u)\n",
dns_nsec3_maxiterations());
goto failure;
}
}
doneparsing: doneparsing:
result = dns_message_gettemprdatalist(updatemsg, &rdatalist); result = dns_message_gettemprdatalist(updatemsg, &rdatalist);
@@ -2062,7 +2068,6 @@ setzone(dns_name_t *zonename) {
if (zonename != NULL) { if (zonename != NULL) {
result = dns_message_gettempname(updatemsg, &name); result = dns_message_gettempname(updatemsg, &name);
check_result(result, "dns_message_gettempname"); check_result(result, "dns_message_gettempname");
dns_name_init(name, NULL);
dns_name_clone(zonename, name); dns_name_clone(zonename, name);
result = dns_message_gettemprdataset(updatemsg, &rdataset); result = dns_message_gettemprdataset(updatemsg, &rdataset);
check_result(result, "dns_message_gettemprdataset"); check_result(result, "dns_message_gettemprdataset");
@@ -2725,7 +2730,7 @@ lookforsoa:
* address. * address.
*/ */
zname = dns_fixedname_initname(&fzname); zname = dns_fixedname_initname(&fzname);
dns_name_copynf(name, zname); dns_name_copy(name, zname);
} }
if (debugging) { if (debugging) {
@@ -2900,7 +2905,7 @@ failed_gssrequest(void) {
static void static void
start_gssrequest(dns_name_t *master) { start_gssrequest(dns_name_t *master) {
gss_ctx_id_t context; dns_gss_ctx_id_t context;
isc_buffer_t buf; isc_buffer_t buf;
isc_result_t result; isc_result_t result;
uint32_t val = 0; uint32_t val = 0;
@@ -3045,7 +3050,7 @@ recvgss(isc_task_t *task, isc_event_t *event) {
nsu_gssinfo_t *reqinfo; nsu_gssinfo_t *reqinfo;
dns_message_t *tsigquery = NULL; dns_message_t *tsigquery = NULL;
isc_sockaddr_t *addr; isc_sockaddr_t *addr;
gss_ctx_id_t context; dns_gss_ctx_id_t context;
isc_buffer_t buf; isc_buffer_t buf;
dns_name_t *servname; dns_name_t *servname;
dns_fixedname_t fname; dns_fixedname_t fname;
@@ -3237,7 +3242,6 @@ start_update(void) {
dns_rdataset_makequestion(rdataset, getzoneclass(), dns_rdatatype_soa); dns_rdataset_makequestion(rdataset, getzoneclass(), dns_rdatatype_soa);
if (userzone != NULL) { if (userzone != NULL) {
dns_name_init(name, NULL);
dns_name_clone(userzone, name); dns_name_clone(userzone, name);
} else { } else {
dns_rdataset_t *tmprdataset; dns_rdataset_t *tmprdataset;
@@ -3256,7 +3260,6 @@ start_update(void) {
} }
firstname = NULL; firstname = NULL;
dns_message_currentname(updatemsg, section, &firstname); dns_message_currentname(updatemsg, section, &firstname);
dns_name_init(name, NULL);
dns_name_clone(firstname, name); dns_name_clone(firstname, name);
/* /*
* Looks to see if the first name references a DS record * Looks to see if the first name references a DS record
@@ -3307,18 +3310,12 @@ cleanup(void) {
dst_key_free(&sig0key); dst_key_free(&sig0key);
} }
ddebug("Shutting down task manager"); ddebug("Shutting down managers");
isc_taskmgr_destroy(&taskmgr); isc_managers_destroy(&netmgr, &taskmgr, &timermgr, &socketmgr);
ddebug("Destroying event"); ddebug("Destroying event");
isc_event_free(&global_event); isc_event_free(&global_event);
ddebug("Shutting down socket manager");
isc_socketmgr_destroy(&socketmgr);
ddebug("Shutting down timer manager");
isc_timermgr_destroy(&timermgr);
#ifdef HAVE_GSSAPI #ifdef HAVE_GSSAPI
/* /*
* Cleanup GSSAPI resources after taskmgr has been destroyed. * Cleanup GSSAPI resources after taskmgr has been destroyed.
+3
View File
@@ -7,6 +7,9 @@ AM_CPPFLAGS += \
$(LIBISCCFG_CFLAGS) $(LIBISCCFG_CFLAGS)
pkglib_LTLIBRARIES = filter-aaaa.la pkglib_LTLIBRARIES = filter-aaaa.la
pkglib_LTLIBRARIES += filter-a.la
filter_aaaa_la_SOURCES = filter-aaaa.c filter_aaaa_la_SOURCES = filter-aaaa.c
filter_a_la_SOURCES = filter-a.c
filter_aaaa_la_LDFLAGS = -avoid-version -module -shared -export-dynamic filter_aaaa_la_LDFLAGS = -avoid-version -module -shared -export-dynamic
filter_a_la_LDFLAGS = -avoid-version -module -shared -export-dynamic
+906
View File
@@ -0,0 +1,906 @@
/*
* Copyright (C) Internet Systems Consortium, Inc. ("ISC")
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, you can obtain one at https://mozilla.org/MPL/2.0/.
*
* See the COPYRIGHT file distributed with this work for additional
* information regarding copyright ownership.
*/
/*! \file */
/* aliases for the exported symbols */
#include <inttypes.h>
#include <stdbool.h>
#include <string.h>
#include <isc/buffer.h>
#include <isc/hash.h>
#include <isc/ht.h>
#include <isc/lib.h>
#include <isc/log.h>
#include <isc/mem.h>
#include <isc/netaddr.h>
#include <isc/result.h>
#include <isc/types.h>
#include <isc/util.h>
#include <dns/acl.h>
#include <dns/db.h>
#include <dns/enumtype.h>
#include <dns/log.h>
#include <dns/message.h>
#include <dns/rdataset.h>
#include <dns/result.h>
#include <dns/types.h>
#include <dns/view.h>
#include <isccfg/aclconf.h>
#include <isccfg/cfg.h>
#include <isccfg/grammar.h>
#include <ns/client.h>
#include <ns/hooks.h>
#include <ns/log.h>
#include <ns/query.h>
#include <ns/types.h>
#define CHECK(op) \
do { \
result = (op); \
if (result != ISC_R_SUCCESS) { \
goto cleanup; \
} \
} while (0)
/*
* Possible values for the settings of filter-a-on-v6 and
* filter-a-on-v4: "no" is NONE, "yes" is FILTER, "break-dnssec"
* is BREAK_DNSSEC.
*/
typedef enum { NONE = 0, FILTER = 1, BREAK_DNSSEC = 2 } filter_a_t;
/*
* Persistent data for use by this module. This will be associated
* with client object address in the hash table, and will remain
* accessible until the client object is detached.
*/
typedef struct filter_data {
filter_a_t mode;
uint32_t flags;
} filter_data_t;
typedef struct filter_instance {
ns_plugin_t *module;
isc_mem_t *mctx;
/*
* Memory pool for use with persistent data.
*/
isc_mempool_t *datapool;
isc_mutex_t plock;
/*
* Hash table associating a client object with its persistent data.
*/
isc_ht_t *ht;
isc_mutex_t hlock;
/*
* Values configured when the module is loaded.
*/
filter_a_t v4_a;
filter_a_t v6_a;
dns_acl_t *a_acl;
} filter_instance_t;
/*
* Per-client flags set by this module
*/
#define FILTER_A_RECURSING 0x0001 /* Recursing for AAAA */
#define FILTER_A_FILTERED 0x0002 /* A was removed from answer */
/*
* Client attribute tests.
*/
#define WANTDNSSEC(c) (((c)->attributes & NS_CLIENTATTR_WANTDNSSEC) != 0)
#define RECURSIONOK(c) (((c)->query.attributes & NS_QUERYATTR_RECURSIONOK) != 0)
/*
* Forward declarations of functions referenced in install_hooks().
*/
static ns_hookresult_t
filter_qctx_initialize(void *arg, void *cbdata, isc_result_t *resp);
static ns_hookresult_t
filter_respond_begin(void *arg, void *cbdata, isc_result_t *resp);
static ns_hookresult_t
filter_respond_any_found(void *arg, void *cbdata, isc_result_t *resp);
static ns_hookresult_t
filter_prep_response_begin(void *arg, void *cbdata, isc_result_t *resp);
static ns_hookresult_t
filter_query_done_send(void *arg, void *cbdata, isc_result_t *resp);
static ns_hookresult_t
filter_qctx_destroy(void *arg, void *cbdata, isc_result_t *resp);
/*%
* Register the functions to be called at each hook point in 'hooktable', using
* memory context 'mctx' for allocating copies of stack-allocated structures
* passed to ns_hook_add(). Make sure 'inst' will be passed as the 'cbdata'
* argument to every callback.
*/
static void
install_hooks(ns_hooktable_t *hooktable, isc_mem_t *mctx,
filter_instance_t *inst) {
const ns_hook_t filter_init = {
.action = filter_qctx_initialize,
.action_data = inst,
};
const ns_hook_t filter_respbegin = {
.action = filter_respond_begin,
.action_data = inst,
};
const ns_hook_t filter_respanyfound = {
.action = filter_respond_any_found,
.action_data = inst,
};
const ns_hook_t filter_prepresp = {
.action = filter_prep_response_begin,
.action_data = inst,
};
const ns_hook_t filter_donesend = {
.action = filter_query_done_send,
.action_data = inst,
};
const ns_hook_t filter_destroy = {
.action = filter_qctx_destroy,
.action_data = inst,
};
ns_hook_add(hooktable, mctx, NS_QUERY_QCTX_INITIALIZED, &filter_init);
ns_hook_add(hooktable, mctx, NS_QUERY_RESPOND_BEGIN, &filter_respbegin);
ns_hook_add(hooktable, mctx, NS_QUERY_RESPOND_ANY_FOUND,
&filter_respanyfound);
ns_hook_add(hooktable, mctx, NS_QUERY_PREP_RESPONSE_BEGIN,
&filter_prepresp);
ns_hook_add(hooktable, mctx, NS_QUERY_DONE_SEND, &filter_donesend);
ns_hook_add(hooktable, mctx, NS_QUERY_QCTX_DESTROYED, &filter_destroy);
}
/**
** Support for parsing of parameters and configuration of the module.
**/
/*
* Support for parsing of parameters.
*/
static const char *filter_a_enums[] = { "break-dnssec", NULL };
static isc_result_t
parse_filter_a(cfg_parser_t *pctx, const cfg_type_t *type, cfg_obj_t **ret) {
return (cfg_parse_enum_or_other(pctx, type, &cfg_type_boolean, ret));
}
static void
doc_filter_a(cfg_printer_t *pctx, const cfg_type_t *type) {
cfg_doc_enum_or_other(pctx, type, &cfg_type_boolean);
}
static cfg_type_t cfg_type_filter_a = {
"filter_a", parse_filter_a, cfg_print_ustring,
doc_filter_a, &cfg_rep_string, filter_a_enums,
};
static cfg_clausedef_t param_clauses[] = {
{ "filter-a", &cfg_type_bracketed_aml, 0 },
{ "filter-a-on-v6", &cfg_type_filter_a, 0 },
{ "filter-a-on-v4", &cfg_type_filter_a, 0 },
};
static cfg_clausedef_t *param_clausesets[] = { param_clauses, NULL };
static cfg_type_t cfg_type_parameters = { "filter-a-params", cfg_parse_mapbody,
cfg_print_mapbody, cfg_doc_mapbody,
&cfg_rep_map, param_clausesets };
static isc_result_t
parse_filter_a_on(const cfg_obj_t *param_obj, const char *param_name,
filter_a_t *dstp) {
const cfg_obj_t *obj = NULL;
isc_result_t result;
result = cfg_map_get(param_obj, param_name, &obj);
if (result != ISC_R_SUCCESS) {
return (ISC_R_SUCCESS);
}
if (cfg_obj_isboolean(obj)) {
if (cfg_obj_asboolean(obj)) {
*dstp = FILTER;
} else {
*dstp = NONE;
}
} else if (strcasecmp(cfg_obj_asstring(obj), "break-dnssec") == 0) {
*dstp = BREAK_DNSSEC;
} else {
result = ISC_R_UNEXPECTED;
}
return (result);
}
static isc_result_t
check_syntax(cfg_obj_t *fmap, const void *cfg, isc_mem_t *mctx, isc_log_t *lctx,
void *actx) {
isc_result_t result = ISC_R_SUCCESS;
const cfg_obj_t *aclobj = NULL;
dns_acl_t *acl = NULL;
filter_a_t f4 = NONE, f6 = NONE;
cfg_map_get(fmap, "filter-a", &aclobj);
if (aclobj == NULL) {
return (result);
}
CHECK(cfg_acl_fromconfig(aclobj, (const cfg_obj_t *)cfg, lctx,
(cfg_aclconfctx_t *)actx, mctx, 0, &acl));
CHECK(parse_filter_a_on(fmap, "filter-a-on-v6", &f6));
CHECK(parse_filter_a_on(fmap, "filter-a-on-v4", &f4));
if ((f4 != NONE || f6 != NONE) && dns_acl_isnone(acl)) {
cfg_obj_log(aclobj, lctx, ISC_LOG_WARNING,
"\"filter-a\" is 'none;' but "
"either filter-a-on-v6 or filter-a-on-v4 "
"is enabled");
result = ISC_R_FAILURE;
} else if (f4 == NONE && f6 == NONE && !dns_acl_isnone(acl)) {
cfg_obj_log(aclobj, lctx, ISC_LOG_WARNING,
"\"filter-a\" is set but "
"neither filter-a-on-v6 or filter-a-on-v4 "
"is enabled");
result = ISC_R_FAILURE;
}
cleanup:
if (acl != NULL) {
dns_acl_detach(&acl);
}
return (result);
}
static isc_result_t
parse_parameters(filter_instance_t *inst, const char *parameters,
const void *cfg, const char *cfg_file, unsigned long cfg_line,
isc_mem_t *mctx, isc_log_t *lctx, void *actx) {
isc_result_t result = ISC_R_SUCCESS;
cfg_parser_t *parser = NULL;
cfg_obj_t *param_obj = NULL;
const cfg_obj_t *obj = NULL;
isc_buffer_t b;
CHECK(cfg_parser_create(mctx, lctx, &parser));
isc_buffer_constinit(&b, parameters, strlen(parameters));
isc_buffer_add(&b, strlen(parameters));
CHECK(cfg_parse_buffer(parser, &b, cfg_file, cfg_line,
&cfg_type_parameters, 0, &param_obj));
CHECK(check_syntax(param_obj, cfg, mctx, lctx, actx));
CHECK(parse_filter_a_on(param_obj, "filter-a-on-v6", &inst->v6_a));
CHECK(parse_filter_a_on(param_obj, "filter-a-on-v4", &inst->v4_a));
result = cfg_map_get(param_obj, "filter-a", &obj);
if (result == ISC_R_SUCCESS) {
CHECK(cfg_acl_fromconfig(obj, (const cfg_obj_t *)cfg, lctx,
(cfg_aclconfctx_t *)actx, mctx, 0,
&inst->a_acl));
} else {
CHECK(dns_acl_any(mctx, &inst->a_acl));
}
cleanup:
if (param_obj != NULL) {
cfg_obj_destroy(parser, &param_obj);
}
if (parser != NULL) {
cfg_parser_destroy(&parser);
}
return (result);
}
/**
** Mandatory plugin API functions:
**
** - plugin_destroy
** - plugin_register
** - plugin_version
** - plugin_check
**/
/*
* Called by ns_plugin_register() to initialize the plugin and
* register hook functions into the view hook table.
*/
isc_result_t
plugin_register(const char *parameters, const void *cfg, const char *cfg_file,
unsigned long cfg_line, isc_mem_t *mctx, isc_log_t *lctx,
void *actx, ns_hooktable_t *hooktable, void **instp) {
filter_instance_t *inst = NULL;
isc_result_t result;
isc_log_write(lctx, NS_LOGCATEGORY_GENERAL, NS_LOGMODULE_HOOKS,
ISC_LOG_INFO,
"registering 'filter-a' "
"module from %s:%lu, %s parameters",
cfg_file, cfg_line, parameters != NULL ? "with" : "no");
inst = isc_mem_get(mctx, sizeof(*inst));
memset(inst, 0, sizeof(*inst));
isc_mem_attach(mctx, &inst->mctx);
if (parameters != NULL) {
CHECK(parse_parameters(inst, parameters, cfg, cfg_file,
cfg_line, mctx, lctx, actx));
}
isc_mempool_create(mctx, sizeof(filter_data_t), &inst->datapool);
CHECK(isc_ht_init(&inst->ht, mctx, 16));
isc_mutex_init(&inst->hlock);
/*
* Fill the mempool with 1K filter_a state objects at
* a time; ideally after a single allocation, the mempool will
* have enough to handle all the simultaneous queries the system
* requires and it won't be necessary to allocate more.
*
* We don't set any limit on the number of free state objects
* so that they'll always be returned to the pool and not
* freed until the pool is destroyed on shutdown.
*/
isc_mempool_setfillcount(inst->datapool, 1024);
isc_mempool_setfreemax(inst->datapool, UINT_MAX);
isc_mutex_init(&inst->plock);
isc_mempool_associatelock(inst->datapool, &inst->plock);
/*
* Set hook points in the view's hooktable.
*/
install_hooks(hooktable, mctx, inst);
*instp = inst;
cleanup:
if (result != ISC_R_SUCCESS && inst != NULL) {
plugin_destroy((void **)&inst);
}
return (result);
}
isc_result_t
plugin_check(const char *parameters, const void *cfg, const char *cfg_file,
unsigned long cfg_line, isc_mem_t *mctx, isc_log_t *lctx,
void *actx) {
isc_result_t result = ISC_R_SUCCESS;
cfg_parser_t *parser = NULL;
cfg_obj_t *param_obj = NULL;
isc_buffer_t b;
CHECK(cfg_parser_create(mctx, lctx, &parser));
isc_buffer_constinit(&b, parameters, strlen(parameters));
isc_buffer_add(&b, strlen(parameters));
CHECK(cfg_parse_buffer(parser, &b, cfg_file, cfg_line,
&cfg_type_parameters, 0, &param_obj));
CHECK(check_syntax(param_obj, cfg, mctx, lctx, actx));
cleanup:
if (param_obj != NULL) {
cfg_obj_destroy(parser, &param_obj);
}
if (parser != NULL) {
cfg_parser_destroy(&parser);
}
return (result);
}
/*
* Called by ns_plugins_free(); frees memory allocated by
* the module when it was registered.
*/
void
plugin_destroy(void **instp) {
filter_instance_t *inst = (filter_instance_t *)*instp;
if (inst->ht != NULL) {
isc_ht_destroy(&inst->ht);
isc_mutex_destroy(&inst->hlock);
}
if (inst->datapool != NULL) {
isc_mempool_destroy(&inst->datapool);
isc_mutex_destroy(&inst->plock);
}
if (inst->a_acl != NULL) {
dns_acl_detach(&inst->a_acl);
}
isc_mem_putanddetach(&inst->mctx, inst, sizeof(*inst));
*instp = NULL;
return;
}
/*
* Returns plugin API version for compatibility checks.
*/
int
plugin_version(void) {
return (NS_PLUGIN_VERSION);
}
/**
** "filter-a" feature implementation begins here.
**/
/*%
* Structure describing the filtering to be applied by process_section().
*/
typedef struct section_filter {
query_ctx_t *qctx;
filter_a_t mode;
dns_section_t section;
const dns_name_t *name;
dns_rdatatype_t type;
bool only_if_aaaa_exists;
} section_filter_t;
/*
* Check whether this is an IPv4 client.
*/
static bool
is_v4_client(ns_client_t *client) {
if (isc_sockaddr_pf(&client->peeraddr) == AF_INET) {
return (true);
}
if (isc_sockaddr_pf(&client->peeraddr) == AF_INET6 &&
IN6_IS_ADDR_V4MAPPED(&client->peeraddr.type.sin6.sin6_addr))
{
return (true);
}
return (false);
}
/*
* Check whether this is an IPv6 client.
*/
static bool
is_v6_client(ns_client_t *client) {
if (isc_sockaddr_pf(&client->peeraddr) == AF_INET6 &&
!IN6_IS_ADDR_V4MAPPED(&client->peeraddr.type.sin6.sin6_addr))
{
return (true);
}
return (false);
}
static filter_data_t *
client_state_get(const query_ctx_t *qctx, filter_instance_t *inst) {
filter_data_t *client_state = NULL;
isc_result_t result;
LOCK(&inst->hlock);
result = isc_ht_find(inst->ht, (const unsigned char *)&qctx->client,
sizeof(qctx->client), (void **)&client_state);
UNLOCK(&inst->hlock);
return (result == ISC_R_SUCCESS ? client_state : NULL);
}
static void
client_state_create(const query_ctx_t *qctx, filter_instance_t *inst) {
filter_data_t *client_state;
isc_result_t result;
client_state = isc_mempool_get(inst->datapool);
if (client_state == NULL) {
return;
}
client_state->mode = NONE;
client_state->flags = 0;
LOCK(&inst->hlock);
result = isc_ht_add(inst->ht, (const unsigned char *)&qctx->client,
sizeof(qctx->client), client_state);
UNLOCK(&inst->hlock);
RUNTIME_CHECK(result == ISC_R_SUCCESS);
}
static void
client_state_destroy(const query_ctx_t *qctx, filter_instance_t *inst) {
filter_data_t *client_state = client_state_get(qctx, inst);
isc_result_t result;
if (client_state == NULL) {
return;
}
LOCK(&inst->hlock);
result = isc_ht_delete(inst->ht, (const unsigned char *)&qctx->client,
sizeof(qctx->client));
UNLOCK(&inst->hlock);
RUNTIME_CHECK(result == ISC_R_SUCCESS);
isc_mempool_put(inst->datapool, client_state);
}
/*%
* Mark 'rdataset' and 'sigrdataset' as rendered, gracefully handling NULL
* pointers and non-associated rdatasets.
*/
static void
mark_as_rendered(dns_rdataset_t *rdataset, dns_rdataset_t *sigrdataset) {
if (rdataset != NULL && dns_rdataset_isassociated(rdataset)) {
rdataset->attributes |= DNS_RDATASETATTR_RENDERED;
}
if (sigrdataset != NULL && dns_rdataset_isassociated(sigrdataset)) {
sigrdataset->attributes |= DNS_RDATASETATTR_RENDERED;
}
}
/*%
* Check whether an RRset of given 'type' is present at given 'name'. If
* it is found and either it is not signed or the combination of query
* flags and configured processing 'mode' allows it, mark the RRset and its
* associated signatures as already rendered to prevent them from appearing
* in the response message stored in 'qctx'. If 'only_if_aaaa_exists' is
* true, an RRset of type AAAA must also exist at 'name' in order for the
* above processing to happen.
*/
static bool
process_name(query_ctx_t *qctx, filter_a_t mode, const dns_name_t *name,
dns_rdatatype_t type, bool only_if_aaaa_exists) {
dns_rdataset_t *rdataset = NULL, *sigrdataset = NULL;
isc_result_t result;
bool modified = false;
if (only_if_aaaa_exists) {
CHECK(dns_message_findtype(name, dns_rdatatype_aaaa, 0, NULL));
}
(void)dns_message_findtype(name, type, 0, &rdataset);
(void)dns_message_findtype(name, dns_rdatatype_rrsig, type,
&sigrdataset);
if (rdataset != NULL &&
(sigrdataset == NULL || !WANTDNSSEC(qctx->client) ||
mode == BREAK_DNSSEC))
{
/*
* An RRset of given 'type' was found at 'name' and at least
* one of the following is true:
*
* - the RRset is not signed,
* - the client did not set the DO bit in its request,
* - configuration allows us to tamper with signed responses.
*
* This means it is okay to filter out this RRset and its
* signatures, if any, from the response.
*/
mark_as_rendered(rdataset, sigrdataset);
modified = true;
}
cleanup:
return (modified);
}
/*%
* Apply the requested section filter, i.e. prevent (when possible, as
* determined by process_name()) RRsets of given 'type' from being rendered
* in the given 'section' of the response message stored in 'qctx'. Clear
* the AD bit if the answer and/or authority section was modified. If
* 'name' is NULL, all names in the given 'section' are processed;
* otherwise, only 'name' is. 'only_if_aaaa_exists' is passed through to
* process_name().
*/
static void
process_section(const section_filter_t *filter) {
query_ctx_t *qctx = filter->qctx;
filter_a_t mode = filter->mode;
dns_section_t section = filter->section;
const dns_name_t *name = filter->name;
dns_rdatatype_t type = filter->type;
bool only_if_aaaa_exists = filter->only_if_aaaa_exists;
dns_message_t *message = qctx->client->message;
isc_result_t result;
for (result = dns_message_firstname(message, section);
result == ISC_R_SUCCESS;
result = dns_message_nextname(message, section))
{
dns_name_t *cur = NULL;
dns_message_currentname(message, section, &cur);
if (name != NULL && !dns_name_equal(name, cur)) {
/*
* We only want to process 'name' and this is not it.
*/
continue;
}
if (!process_name(qctx, mode, cur, type, only_if_aaaa_exists)) {
/*
* Response was not modified, do not touch the AD bit.
*/
continue;
}
if (section == DNS_SECTION_ANSWER ||
section == DNS_SECTION_AUTHORITY) {
message->flags &= ~DNS_MESSAGEFLAG_AD;
}
}
}
/*
* Initialize filter state, fetching it from a memory pool and storing it
* in a hash table keyed according to the client object; this enables us to
* retrieve persistent data related to a client query for as long as the
* object persists.
*/
static ns_hookresult_t
filter_qctx_initialize(void *arg, void *cbdata, isc_result_t *resp) {
query_ctx_t *qctx = (query_ctx_t *)arg;
filter_instance_t *inst = (filter_instance_t *)cbdata;
filter_data_t *client_state;
*resp = ISC_R_UNSET;
client_state = client_state_get(qctx, inst);
if (client_state == NULL) {
client_state_create(qctx, inst);
}
return (NS_HOOK_CONTINUE);
}
/*
* Determine whether this client should have A filtered or not, based on
* the client address family and the settings of filter-a-on-v6 and
* filter-a-on-v4.
*/
static ns_hookresult_t
filter_prep_response_begin(void *arg, void *cbdata, isc_result_t *resp) {
query_ctx_t *qctx = (query_ctx_t *)arg;
filter_instance_t *inst = (filter_instance_t *)cbdata;
filter_data_t *client_state = client_state_get(qctx, inst);
isc_result_t result;
*resp = ISC_R_UNSET;
if (client_state == NULL) {
return (NS_HOOK_CONTINUE);
}
if (inst->v4_a != NONE || inst->v6_a != NONE) {
result = ns_client_checkaclsilent(qctx->client, NULL,
inst->a_acl, true);
if (result == ISC_R_SUCCESS && inst->v4_a != NONE &&
is_v4_client(qctx->client)) {
client_state->mode = inst->v4_a;
} else if (result == ISC_R_SUCCESS && inst->v6_a != NONE &&
is_v6_client(qctx->client))
{
client_state->mode = inst->v6_a;
}
}
return (NS_HOOK_CONTINUE);
}
/*
* Hide A rrsets if there is a matching AAAA. Trigger recursion if
* necessary to find out whether an AAAA exists.
*
* (This version is for processing answers to explicit A queries; ANY
* queries are handled in filter_respond_any_found().)
*/
static ns_hookresult_t
filter_respond_begin(void *arg, void *cbdata, isc_result_t *resp) {
query_ctx_t *qctx = (query_ctx_t *)arg;
filter_instance_t *inst = (filter_instance_t *)cbdata;
filter_data_t *client_state = client_state_get(qctx, inst);
isc_result_t result = ISC_R_UNSET;
*resp = ISC_R_UNSET;
if (client_state == NULL) {
return (NS_HOOK_CONTINUE);
}
if (client_state->mode != BREAK_DNSSEC &&
(client_state->mode != FILTER ||
(WANTDNSSEC(qctx->client) && qctx->sigrdataset != NULL &&
dns_rdataset_isassociated(qctx->sigrdataset))))
{
return (NS_HOOK_CONTINUE);
}
if (qctx->qtype == dns_rdatatype_a) {
dns_rdataset_t *trdataset;
trdataset = ns_client_newrdataset(qctx->client);
result = dns_db_findrdataset(
qctx->db, qctx->node, qctx->version, dns_rdatatype_aaaa,
0, qctx->client->now, trdataset, NULL);
if (dns_rdataset_isassociated(trdataset)) {
dns_rdataset_disassociate(trdataset);
}
ns_client_putrdataset(qctx->client, &trdataset);
/*
* We found an A. If we also found an AAAA, then the A
* must not be rendered.
*
* If the AAAA is not in our cache, then any result other than
* DNS_R_DELEGATION or ISC_R_NOTFOUND means there is no AAAAA,
* and so AAAAs are okay.
*
* We assume there is no AAAA if we can't recurse for this
* client. That might be the wrong answer, but what else
* can we do? Besides, the fact that we have the A and
* are using this mechanism in the first place suggests
* that we care more about AAAAs than As, and would have
* cached an AAAA if it existed.
*/
if (result == ISC_R_SUCCESS) {
mark_as_rendered(qctx->rdataset, qctx->sigrdataset);
qctx->client->message->flags &= ~DNS_MESSAGEFLAG_AD;
client_state->flags |= FILTER_A_FILTERED;
} else if (!qctx->authoritative && RECURSIONOK(qctx->client) &&
(result == DNS_R_DELEGATION ||
result == ISC_R_NOTFOUND))
{
/*
* This is an ugly kludge to recurse
* for the AAAA and discard the result.???
*
* Continue to add the A now.
* We'll make a note to not render it
* if the recursion for the AAAA succeeds.
*/
result = ns_query_recurse(qctx->client,
dns_rdatatype_aaaa,
qctx->client->query.qname,
NULL, NULL, qctx->resuming);
if (result == ISC_R_SUCCESS) {
client_state->flags |= FILTER_A_RECURSING;
qctx->client->query.attributes |=
NS_QUERYATTR_RECURSING;
}
}
} else if (qctx->qtype == dns_rdatatype_aaaa &&
(client_state->flags & FILTER_A_RECURSING) != 0)
{
const section_filter_t filter_answer = {
.qctx = qctx,
.mode = client_state->mode,
.section = DNS_SECTION_ANSWER,
.name = qctx->fname,
.type = dns_rdatatype_a,
};
process_section(&filter_answer);
client_state->flags &= ~FILTER_A_RECURSING;
result = ns_query_done(qctx);
*resp = result;
return (NS_HOOK_RETURN);
}
*resp = result;
return (NS_HOOK_CONTINUE);
}
/*
* When answering an ANY query, remove A if AAAA is present.
*/
static ns_hookresult_t
filter_respond_any_found(void *arg, void *cbdata, isc_result_t *resp) {
query_ctx_t *qctx = (query_ctx_t *)arg;
filter_instance_t *inst = (filter_instance_t *)cbdata;
filter_data_t *client_state = client_state_get(qctx, inst);
*resp = ISC_R_UNSET;
if (client_state != NULL && client_state->mode != NONE) {
/*
* If we are authoritative, require an AAAA record to be
* present before filtering out A records; otherwise,
* just assume an AAAA record exists even if it was not in the
* cache (and therefore is not in the response message),
* thus proceeding with filtering out A records.
*/
const section_filter_t filter_answer = {
.qctx = qctx,
.mode = client_state->mode,
.section = DNS_SECTION_ANSWER,
.name = qctx->tname,
.type = dns_rdatatype_a,
.only_if_aaaa_exists = qctx->authoritative,
};
process_section(&filter_answer);
}
return (NS_HOOK_CONTINUE);
}
/*
* Hide A rrsets in the additional section if there is a matching AAAA, and
* hide NS in the authority section if A was filtered in the answer
* section.
*/
static ns_hookresult_t
filter_query_done_send(void *arg, void *cbdata, isc_result_t *resp) {
query_ctx_t *qctx = (query_ctx_t *)arg;
filter_instance_t *inst = (filter_instance_t *)cbdata;
filter_data_t *client_state = client_state_get(qctx, inst);
*resp = ISC_R_UNSET;
if (client_state != NULL && client_state->mode != NONE) {
const section_filter_t filter_additional = {
.qctx = qctx,
.mode = client_state->mode,
.section = DNS_SECTION_ADDITIONAL,
.type = dns_rdatatype_a,
.only_if_aaaa_exists = true,
};
process_section(&filter_additional);
if ((client_state->flags & FILTER_A_FILTERED) != 0) {
const section_filter_t filter_authority = {
.qctx = qctx,
.mode = client_state->mode,
.section = DNS_SECTION_AUTHORITY,
.type = dns_rdatatype_ns,
};
process_section(&filter_authority);
}
}
return (NS_HOOK_CONTINUE);
}
/*
* If the client is being detached, then we can delete our persistent data
* from hash table and return it to the memory pool.
*/
static ns_hookresult_t
filter_qctx_destroy(void *arg, void *cbdata, isc_result_t *resp) {
query_ctx_t *qctx = (query_ctx_t *)arg;
filter_instance_t *inst = (filter_instance_t *)cbdata;
*resp = ISC_R_UNSET;
if (!qctx->detach_client) {
return (NS_HOOK_CONTINUE);
}
client_state_destroy(qctx, inst);
return (NS_HOOK_CONTINUE);
}
+95
View File
@@ -0,0 +1,95 @@
..
Copyright (C) Internet Systems Consortium, Inc. ("ISC")
This Source Code Form is subject to the terms of the Mozilla Public
License, v. 2.0. If a copy of the MPL was not distributed with this
file, you can obtain one at https://mozilla.org/MPL/2.0/.
See the COPYRIGHT file distributed with this work for additional
information regarding copyright ownership.
..
Copyright (C) Internet Systems Consortium, Inc. ("ISC")
This Source Code Form is subject to the terms of the Mozilla Public
License, v. 2.0. If a copy of the MPL was not distributed with this
file, You can obtain one at http://mozilla.org/MPL/2.0/.
See the COPYRIGHT file distributed with this work for additional
information regarding copyright ownership.
.. highlight: console
.. _man_filter-a:
filter-a.so - filter A in DNS responses when AAAA is present
---------------------------------------------------------------
Synopsis
~~~~~~~~
:program:`plugin query` "filter-a.so" [{ parameters }];
Description
~~~~~~~~~~~
``filter-a.so`` is a query plugin module for ``named``, enabling
``named`` to omit some IPv4 addresses when responding to clients.
For example:
::
plugin query "/usr/local/lib/filter-a.so" {
filter-a-on-v6 yes;
filter-a-on-v4 yes;
filter-a { 192.0.2.1; 2001:db8:2::1; };
};
This module is intended to aid transition from IPv4 to IPv6 by
withholding IPv4 addresses from DNS clients which are not connected to
the IPv4 Internet, when the name being looked up has an IPv6 address
available. Use of this module is not recommended unless absolutely
necessary.
Note: This mechanism can erroneously cause other servers not to give
A records to their clients. If a recursing server with both IPv6 and
IPv4 network connections queries an authoritative server using this
mechanism via IPv6, it is denied A records even if its client is
using IPv4.
Options
~~~~~~~
``filter-a``
This option specifies a list of client addresses for which A filtering is to
be applied. The default is ``any``.
``filter-a-on-v6``
If set to ``yes``, this option indicates that the DNS client is at an IPv6 address, in
``filter-a``. If the response does not include DNSSEC
signatures, then all A records are deleted from the response. This
filtering applies to all responses, not only authoritative
ones.
If set to ``break-dnssec``, then A records are deleted even when
DNSSEC is enabled. As suggested by the name, this causes the response
to fail to verify, because the DNSSEC protocol is designed to detect
deletions.
This mechanism can erroneously cause other servers not to give A
records to their clients. If a recursing server with both IPv6 and IPv4
network connections queries an authoritative server using this
mechanism via IPv6, it is denied A records even if its client is
using IPv4.
``filter-a-on-v4``
This option is identical to ``filter-a-on-v6``, except that it filters A responses
to queries from IPv4 clients instead of IPv6 clients. To filter all
responses, set both options to ``yes``.
See Also
~~~~~~~~
BIND 9 Administrator Reference Manual.
+6 -14
View File
@@ -22,6 +22,7 @@
#include <isc/commandline.h> #include <isc/commandline.h>
#include <isc/file.h> #include <isc/file.h>
#include <isc/log.h> #include <isc/log.h>
#include <isc/managers.h>
#include <isc/mem.h> #include <isc/mem.h>
#include <isc/net.h> #include <isc/net.h>
#include <isc/netmgr.h> #include <isc/netmgr.h>
@@ -59,6 +60,7 @@
const char *progname = NULL; const char *progname = NULL;
bool verbose; bool verbose;
static isc_nm_t *netmgr = NULL;
static isc_taskmgr_t *taskmgr = NULL; static isc_taskmgr_t *taskmgr = NULL;
static isc_task_t *rndc_task = NULL; static isc_task_t *rndc_task = NULL;
@@ -72,7 +74,6 @@ static bool local4set = false, local6set = false;
static int nserveraddrs; static int nserveraddrs;
static int currentaddr = 0; static int currentaddr = 0;
static unsigned int remoteport = 0; static unsigned int remoteport = 0;
static isc_nm_t *netmgr = NULL;
static isc_buffer_t *databuf = NULL; static isc_buffer_t *databuf = NULL;
static isccc_ccmsg_t rndc_ccmsg; static isccc_ccmsg_t rndc_ccmsg;
static uint32_t algorithm; static uint32_t algorithm;
@@ -574,7 +575,6 @@ rndc_connected(isc_nmhandle_t *handle, isc_result_t result, void *arg) {
static void static void
rndc_startconnect(isc_sockaddr_t *addr) { rndc_startconnect(isc_sockaddr_t *addr) {
isc_result_t result;
char socktext[ISC_SOCKADDR_FORMATSIZE]; char socktext[ISC_SOCKADDR_FORMATSIZE];
isc_sockaddr_t *local = NULL; isc_sockaddr_t *local = NULL;
@@ -600,10 +600,8 @@ rndc_startconnect(isc_sockaddr_t *addr) {
} }
atomic_fetch_add_relaxed(&connects, 1); atomic_fetch_add_relaxed(&connects, 1);
DO("create connection", isc_nm_tcpconnect(netmgr, local, addr, rndc_connected, &rndc_ccmsg,
isc_nm_tcpconnect(netmgr, (isc_nmiface_t *)local, 60000, 0);
(isc_nmiface_t *)addr, rndc_connected, &rndc_ccmsg,
10000, 0));
} }
static void static void
@@ -1033,9 +1031,7 @@ main(int argc, char **argv) {
serial = isc_random32(); serial = isc_random32();
isc_mem_create(&rndc_mctx); isc_mem_create(&rndc_mctx);
netmgr = isc_nm_start(rndc_mctx, 1); isc_managers_create(rndc_mctx, 1, 0, 0, &netmgr, &taskmgr, NULL, NULL);
DO("create task manager",
isc_taskmgr_create(rndc_mctx, 1, 0, netmgr, &taskmgr));
DO("create task", isc_task_create(taskmgr, 0, &rndc_task)); DO("create task", isc_task_create(taskmgr, 0, &rndc_task));
isc_log_create(rndc_mctx, &log, &logconfig); isc_log_create(rndc_mctx, &log, &logconfig);
isc_log_setcontext(log); isc_log_setcontext(log);
@@ -1092,9 +1088,7 @@ main(int argc, char **argv) {
} }
isc_task_detach(&rndc_task); isc_task_detach(&rndc_task);
isc_taskmgr_destroy(&taskmgr); isc_managers_destroy(&netmgr, &taskmgr, NULL, NULL);
isc_nm_closedown(netmgr);
/* /*
* Note: when TCP connections are shut down, there will be a final * Note: when TCP connections are shut down, there will be a final
@@ -1104,8 +1098,6 @@ main(int argc, char **argv) {
*/ */
isccc_ccmsg_invalidate(&rndc_ccmsg); isccc_ccmsg_invalidate(&rndc_ccmsg);
isc_nm_destroy(&netmgr);
isc_log_destroy(&log); isc_log_destroy(&log);
isc_log_setcontext(NULL); isc_log_setcontext(NULL);
+1 -1
View File
@@ -136,7 +136,7 @@ Currently supported commands are:
This sample ``addzone`` command adds the zone ``example.com`` to This sample ``addzone`` command adds the zone ``example.com`` to
the default view: the default view:
``$ \ rndc addzone example.com '{ type master; file "example.com.db"; };'`` ``rndc addzone example.com '{ type master; file "example.com.db"; };'``
(Note the brackets around and semi-colon after the zone configuration (Note the brackets around and semi-colon after the zone configuration
text.) text.)
+2 -2
View File
@@ -1,3 +1,4 @@
.cache
__pycache__ __pycache__
dig.out* dig.out*
rndc.out* rndc.out*
@@ -13,8 +14,7 @@ named.run
parallel.mk parallel.mk
/*.log /*.log
/*.trs /*.trs
/get_ports.state /resolve
/get_ports.lock
/run.sh /run.sh
/run.log /run.log
/start.sh /start.sh
+14 -10
View File
@@ -23,6 +23,7 @@ check_PROGRAMS = \
feature-test \ feature-test \
makejournal \ makejournal \
pipelined/pipequeries \ pipelined/pipequeries \
resolve \
rndc/gencheck \ rndc/gencheck \
rpz/dnsrps \ rpz/dnsrps \
tkey/keycreate \ tkey/keycreate \
@@ -48,6 +49,14 @@ pipelined_pipequeries_LDADD = \
$(LDADD) \ $(LDADD) \
$(LIBDNS_LIBS) $(LIBDNS_LIBS)
resolve_CPPFLAGS = \
$(AM_CPPFLAGS) \
$(LIBISC_CFLAGS) \
$(LIBDNS_CFLAGS) \
$(LIBIRS_CFLAGS)
resolve_LDADD = $(LIBISC_LIBS) $(LIBIRS_LIBS) $(LIBDNS_LIBS)
tkey_keycreate_CPPFLAGS = \ tkey_keycreate_CPPFLAGS = \
$(AM_CPPFLAGS) \ $(AM_CPPFLAGS) \
$(LIBDNS_CFLAGS) $(LIBDNS_CFLAGS)
@@ -95,10 +104,12 @@ TESTS += \
dlz \ dlz \
dlzexternal \ dlzexternal \
dns64 \ dns64 \
doth \
dscp \ dscp \
dsdigest \ dsdigest \
dyndb \ dyndb \
ecdsa \ ecdsa \
eddsa \
ednscompliance \ ednscompliance \
emptyzones \ emptyzones \
filter-aaaa \ filter-aaaa \
@@ -110,6 +121,7 @@ TESTS += \
inline \ inline \
integrity \ integrity \
hooks \ hooks \
journal \
keepalive \ keepalive \
legacy \ legacy \
limits \ limits \
@@ -151,12 +163,8 @@ TESTS += \
views \ views \
wildcard \ wildcard \
xferquota \ xferquota \
xot \
zonechecks zonechecks
# eddsa test is broken
# TESTS += eddsa
# The "stress" test is not run by default since it creates enough # The "stress" test is not run by default since it creates enough
# load on the machine to make it unusable to other users. # load on the machine to make it unusable to other users.
# The "dialup", "delzone", and "dupsigs" tests are also not run by # The "dialup", "delzone", and "dupsigs" tests are also not run by
@@ -177,7 +185,6 @@ TESTS += \
nsupdate \ nsupdate \
resolver \ resolver \
statistics \ statistics \
dot \
upforwd \ upforwd \
zero zero
@@ -200,10 +207,10 @@ endif HAVE_PERLMOD_NET_DNS_NAMESERVER
endif HAVE_PERLMOD_NET_DNS endif HAVE_PERLMOD_NET_DNS
if HAVE_PYTHON if HAVE_PYTHON
TESTS += kasp tcp pipelined TESTS += kasp keymgr2kasp tcp pipelined
if HAVE_PYMOD_DNS if HAVE_PYMOD_DNS
TESTS += qmin cookie TESTS += qmin cookie timeouts
if HAVE_PERLMOD_NET_DNS if HAVE_PERLMOD_NET_DNS
TESTS += dnssec TESTS += dnssec
@@ -243,7 +250,4 @@ AM_LOG_FLAGS = -r
$(TESTS): run.sh $(TESTS): run.sh
clean-local:
-rm -f get_ports.state get_ports.lock
test-local: check test-local: check
+3 -6
View File
@@ -214,9 +214,6 @@ This indicates the type of message. This is one of:
FAIL The test failed FAIL The test failed
SKIPPED The test was not run, usually because some SKIPPED The test was not run, usually because some
prerequisites required to run the test are missing. prerequisites required to run the test are missing.
UNTESTED The test was not run for some other reason, e.g. a
prerequisite is available but is not compatible with
the platform on which the test is run.
<test-name> <test-name>
This is the name of the test from which the message emanated, which is also the This is the name of the test from which the message emanated, which is also the
@@ -270,9 +267,9 @@ As noted above, each test is in a separate directory. To interact with the
test framework, the directories contain the following standard files: test framework, the directories contain the following standard files:
prereq.sh Run at the beginning to determine whether the test can be run at prereq.sh Run at the beginning to determine whether the test can be run at
all; if not, we see a result of R:SKIPPED or R:UNTESTED. This file all; if not, we see a R:SKIPPED result. This file is optional:
is optional: if not present, the test is assumed to have all its if not present, the test is assumed to have all its prerequisites
prerequisites met. met.
setup.sh Run after prereq.sh, this sets up the preconditions for the tests. setup.sh Run after prereq.sh, this sets up the preconditions for the tests.
Although optional, virtually all tests will require such a file to Although optional, virtually all tests will require such a file to
+2
View File
@@ -0,0 +1,2 @@
@ IN SOA localhost. localhost.localhost. 1 10800 3600 605800 86400
@ IN NS localhost.
+89
View File
@@ -0,0 +1,89 @@
############################################################################
# Copyright (C) Internet Systems Consortium, Inc. ("ISC")
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, you can obtain one at https://mozilla.org/MPL/2.0/.
#
# See the COPYRIGHT file distributed with this work for additional
# information regarding copyright ownership.
############################################################################
import concurrent.futures
import os
import subprocess
import time
def run_rndc(server, rndc_command):
'''
Send the specified 'rndc_command' to 'server' with a timeout of 2 seconds
'''
rndc = os.getenv('RNDC')
port = os.getenv('CONTROLPORT')
cmdline = [rndc, '-c', '../common/rndc.conf', '-p', port, '-s', server]
cmdline.extend(rndc_command)
subprocess.check_output(cmdline, stderr=subprocess.STDOUT, timeout=2)
def rndc_loop(test_state, domain):
'''
Run "rndc addzone", "rndc modzone", and "rndc delzone" in a tight loop
until the test is considered finished, ignoring errors
'''
rndc_commands = [
['addzone', domain,
'{ type master; file "example.db"; };'],
['modzone', domain,
'{ type master; file "example.db"; allow-transfer { any; }; };'],
['delzone', domain],
]
while not test_state['finished']:
for command in rndc_commands:
try:
run_rndc('10.53.0.3', command)
except subprocess.SubprocessError:
pass
def check_if_server_is_responsive():
'''
Check if server status can be successfully retrieved using "rndc status"
'''
try:
run_rndc('10.53.0.3', ['status'])
return True
except subprocess.SubprocessError:
return False
def test_rndc_deadlock():
'''
Test whether running "rndc addzone", "rndc modzone", and "rndc delzone"
commands concurrently does not trigger a deadlock
'''
test_state = {'finished': False}
# Create 4 worker threads running "rndc" commands in a loop.
with concurrent.futures.ThreadPoolExecutor() as executor:
for i in range(1, 5):
domain = 'example%d' % i
executor.submit(rndc_loop, test_state, domain)
# Run "rndc status" in 1-second intervals for a maximum of 10 seconds.
# If any "rndc status" command fails, the loop will be interrupted.
server_is_responsive = True
attempts = 10
while server_is_responsive and attempts > 0:
server_is_responsive = check_if_server_is_responsive()
attempts -= 1
time.sleep(1)
# Signal worker threads that the test is finished.
test_state['finished'] = True
# Check whether all "rndc status" commands succeeded.
assert server_is_responsive
+1 -1
View File
@@ -1590,7 +1590,7 @@ status=`expr $status + $ret`
echo_i "check that DNAME at apex with NSEC3 is correctly signed (auto-dnssec maintain) ($n)" echo_i "check that DNAME at apex with NSEC3 is correctly signed (auto-dnssec maintain) ($n)"
ret=0 ret=0
$DIG $DIGOPTS txt dname-at-apex-nsec3.example @10.53.0.3 > dig.out.ns3.test$n || ret=1 $DIG $DIGOPTS txt dname-at-apex-nsec3.example @10.53.0.3 > dig.out.ns3.test$n || ret=1
grep "RRSIG NSEC3 7 3 3600" dig.out.ns3.test$n > /dev/null || ret=1 grep "RRSIG NSEC3 7 3 600" dig.out.ns3.test$n > /dev/null || ret=1
n=`expr $n + 1` n=`expr $n + 1`
if [ $ret != 0 ]; then echo_i "failed"; fi if [ $ret != 0 ]; then echo_i "failed"; fi
status=`expr $status + $ret` status=`expr $status + $ret`
@@ -0,0 +1 @@
-m record,size,mctx -c named.conf -d 1 -D cacheclean-ns1 -X named.lock -g -T maxcachesize=2097152
@@ -0,0 +1 @@
-m record,size,mctx -c named.conf -d 3 -D cacheclean-ns2 -X named.lock -g -T maxcachesize=2097152
+28
View File
@@ -80,6 +80,34 @@ sub reply_handler {
$rr = new Net::DNS::RR("$synth2 $ttl $qclass DNAME ."); $rr = new Net::DNS::RR("$synth2 $ttl $qclass DNAME .");
push @ans, $rr; push @ans, $rr;
$rcode = "NOERROR"; $rcode = "NOERROR";
# The following three code branches referring to the "example.dname"
# zone are necessary for the resolver variant of the CVE-2021-25215
# regression test to work. A named instance cannot be used for
# serving the DNAME records below as a version of BIND vulnerable to
# CVE-2021-25215 would crash while answering the queries asked by
# the tested resolver.
} elsif ($qname eq "ns3.example.dname") {
if ($qtype eq "A") {
my $rr = new Net::DNS::RR("$qname $ttl $qclass A 10.53.0.3");
push @ans, $rr;
}
if ($qtype eq "AAAA") {
my $rr = new Net::DNS::RR("example.dname. $ttl $qclass SOA . . 0 0 0 0 $ttl");
push @auth, $rr;
}
$rcode = "NOERROR";
} elsif ($qname eq "self.example.self.example.dname") {
my $rr = new Net::DNS::RR("self.example.dname. $ttl $qclass DNAME dname.");
push @ans, $rr;
$rr = new Net::DNS::RR("$qname $ttl $qclass CNAME self.example.dname.");
push @ans, $rr;
$rcode = "NOERROR";
} elsif ($qname eq "self.example.dname") {
if ($qtype eq "DNAME") {
my $rr = new Net::DNS::RR("$qname $ttl $qclass DNAME dname.");
push @ans, $rr;
}
$rcode = "NOERROR";
} else { } else {
$rcode = "REFUSED"; $rcode = "REFUSED";
} }
+4
View File
@@ -24,6 +24,10 @@ ns2.example. A 10.53.0.2
example.broken. NS ns3.example.broken. example.broken. NS ns3.example.broken.
ns3.example.broken. A 10.53.0.3 ns3.example.broken. A 10.53.0.3
; for the resolver variant of the CVE-2021-25215 regression test
example.dname. NS ns3.example.dname.
ns3.example.dname. A 10.53.0.3
domain0.nil. NS ns2.domain0.nil domain0.nil. NS ns2.domain0.nil
domain1.nil. NS ns2.domain0.nil domain1.nil. NS ns2.domain0.nil
domain2.nil. NS ns2.domain0.nil domain2.nil. NS ns2.domain0.nil
+2
View File
@@ -16,3 +16,5 @@ ns2 86400 AAAA fd92:7065:b8e:ffff::2
@ 86400 AAAA 1:2:3::4 @ 86400 AAAA 1:2:3::4
* 86400 A 1.2.3.4 * 86400 A 1.2.3.4
* 86400 AAAA 1:2:3::4 * 86400 AAAA 1:2:3::4
; CVE-2021-25215 regression test data
self 86400 DNAME nil.
+18
View File
@@ -295,5 +295,23 @@ grep 'status: NOERROR' dig.out.7.$n > /dev/null 2>&1 || ret=1
if [ $ret != 0 ]; then echo_i "failed"; fi if [ $ret != 0 ]; then echo_i "failed"; fi
status=`expr $status + $ret` status=`expr $status + $ret`
# Regression test for CVE-2021-25215 (authoritative server).
n=`expr $n + 1`
echo_i "checking DNAME resolution via itself (authoritative) ($n)"
ret=0
$DIG $DIGOPTS @10.53.0.2 DNAME self.domain0.self.domain0.nil. > dig.out.2.$n 2>&1
grep 'status: NOERROR' dig.out.2.$n > /dev/null 2>&1 || ret=1
if [ $ret != 0 ]; then echo_i "failed"; fi
status=`expr $status + $ret`
# Regression test for CVE-2021-25215 (recursive resolver).
n=`expr $n + 1`
echo_i "checking DNAME resolution via itself (recursive) ($n)"
ret=0
$DIG $DIGOPTS @10.53.0.7 DNAME self.example.self.example.dname. > dig.out.7.$n 2>&1
grep 'status: NOERROR' dig.out.7.$n > /dev/null 2>&1 || ret=1
if [ $ret != 0 ]; then echo_i "failed"; fi
status=`expr $status + $ret`
echo_i "exit status: $status" echo_i "exit status: $status"
[ $status -eq 0 ] || exit 1 [ $status -eq 0 ] || exit 1
+24
View File
@@ -0,0 +1,24 @@
/*
* Copyright (C) Internet Systems Consortium, Inc. ("ISC")
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* See the COPYRIGHT file distributed with this work for additional
* information regarding copyright ownership.
*/
tls local-tls {
key-file "key.pem";
cert-file "cert.pem";
};
http local-http-server {
endpoints { "/dns-query"; };
};
# undefined 'tls' specification
options {
listen-on port 8080 http local-http-server tls unknown { 10.53.0.1; };
};
+20
View File
@@ -0,0 +1,20 @@
/*
* Copyright (C) Internet Systems Consortium, Inc. ("ISC")
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* See the COPYRIGHT file distributed with this work for additional
* information regarding copyright ownership.
*/
tls local-tls {
key-file "key.pem";
cert-file "cert.pem";
};
# undefined 'http' specification
options {
listen-on port 8080 http unknown tls local-tls { 10.53.0.1; };
};
+19
View File
@@ -0,0 +1,19 @@
/*
* Copyright (C) Internet Systems Consortium, Inc. ("ISC")
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* See the COPYRIGHT file distributed with this work for additional
* information regarding copyright ownership.
*/
http local-http-server {
endpoints { "/dns-query"; };
};
# no 'tls' specification
options {
listen-on port 8080 http unknown { 10.53.0.1; };
};
+15
View File
@@ -0,0 +1,15 @@
/*
* Copyright (C) Internet Systems Consortium, Inc. ("ISC")
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* See the COPYRIGHT file distributed with this work for additional
* information regarding copyright ownership.
*/
# undefined 'tls' specification
options {
listen-on port 853 tls local-tls { 10.53.0.1; };
};
@@ -9,20 +9,14 @@
* information regarding copyright ownership. * information regarding copyright ownership.
*/ */
/*
* inline-signing not allowed at options level.
*/
options { options {
port @PORT@; inline-signing yes;
tls-port @TLSPORT@;
pid-file "named.pid";
listen-on { 10.53.0.1; };
listen-on-v6 { none; };
listen-on tls ephemeral { 10.53.0.1; };
recursion no;
notify no;
statistics-file "named.stats";
}; };
zone "." { zone "." {
type primary; type primary;
file "root.db"; file "root.db";
allow-transfer { any; };
}; };
@@ -0,0 +1,29 @@
/*
* Copyright (C) Internet Systems Consortium, Inc. ("ISC")
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* See the COPYRIGHT file distributed with this work for additional
* information regarding copyright ownership.
*/
/*
* inline-signing not allowed at view level.
*/
view "a" {
inline-signing yes;
zone "." {
type primary;
file "root.db.signed";
};
};
view "b" {
zone "." {
type primary;
file "root.db";
};
};
@@ -9,7 +9,7 @@
* information regarding copyright ownership. * information regarding copyright ownership.
*/ */
// Using the keyword 'default' is not allowed. // 'default' is a built-in policy, redefinition not allowed.
dnssec-policy "default" { dnssec-policy "default" {
signatures-refresh P5D; signatures-refresh P5D;
}; };
@@ -19,4 +19,3 @@ zone "example.net" {
file "example.db"; file "example.db";
dnssec-policy "default"; dnssec-policy "default";
}; };
@@ -0,0 +1,21 @@
/*
* Copyright (C) Internet Systems Consortium, Inc. ("ISC")
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* See the COPYRIGHT file distributed with this work for additional
* information regarding copyright ownership.
*/
// 'insecure' is a built-in policy, redefinition not allowed.
dnssec-policy "insecure" {
signatures-refresh P5D;
};
zone "example.net" {
type master;
file "example.db";
dnssec-policy "insecure";
};
@@ -9,7 +9,7 @@
* information regarding copyright ownership. * information regarding copyright ownership.
*/ */
// Using the keyword 'none' is not allowed. // 'none' is a built-in policy, redefinition not allowed.
dnssec-policy "none" { dnssec-policy "none" {
signatures-refresh P5D; signatures-refresh P5D;
}; };
@@ -19,4 +19,3 @@ zone "example.net" {
file "example.db"; file "example.db";
dnssec-policy "none"; dnssec-policy "none";
}; };
@@ -0,0 +1,42 @@
/*
* Copyright (C) Internet Systems Consortium, Inc. ("ISC")
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* See the COPYRIGHT file distributed with this work for additional
* information regarding copyright ownership.
*/
key "keyforview1" {
algorithm "hmac-sha1";
secret "YPfMoAk6h+3iN8MDRQC004iSNHY=";
};
key "keyforview2" {
algorithm "hmac-sha1";
secret "4xILSZQnuO1UKubXHkYUsvBRPu8=";
};
view "example1" {
match-clients { key "keyforview1"; };
zone "example.net" {
type primary;
dnssec-policy "default";
key-directory ".";
file "example1.db";
};
};
view "example2" {
match-clients { key "keyforview2"; };
zone "example.net" {
type primary;
dnssec-policy "insecure";
key-directory ".";
file "example2.db";
};
};
@@ -0,0 +1,40 @@
/*
* Copyright (C) Internet Systems Consortium, Inc. ("ISC")
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* See the COPYRIGHT file distributed with this work for additional
* information regarding copyright ownership.
*/
key "keyforview1" {
algorithm "hmac-sha1";
secret "YPfMoAk6h+3iN8MDRQC004iSNHY=";
};
key "keyforview2" {
algorithm "hmac-sha1";
secret "4xILSZQnuO1UKubXHkYUsvBRPu8=";
};
view "example1" {
match-clients { key "keyforview1"; };
zone "example.net" {
type primary;
dnssec-policy "default";
file "example1.db";
};
};
view "example2" {
match-clients { key "keyforview2"; };
zone "example.net" {
type primary;
dnssec-policy "insecure";
file "example2.db";
};
};
@@ -0,0 +1,26 @@
/*
* Copyright (C) Internet Systems Consortium, Inc. ("ISC")
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* See the COPYRIGHT file distributed with this work for additional
* information regarding copyright ownership.
*/
// One zone with dnssec-policy 'none', one zone with dnssec-policy 'insecure',
// both using the same zone file.
zone "example1.net" {
type master;
file "example.db";
dnssec-policy "none";
};
zone "example2.net" {
type master;
file "example.db";
dnssec-policy "insecure";
};
@@ -0,0 +1,26 @@
/*
* Copyright (C) Internet Systems Consortium, Inc. ("ISC")
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* See the COPYRIGHT file distributed with this work for additional
* information regarding copyright ownership.
*/
// One zone with a dnssec-policy, the other with allow-update,
// with the same zone file.
zone "example1.net" {
type master;
file "example.db";
dnssec-policy "default";
};
zone "example2.net" {
type master;
file "example.db";
allow-update { any; };
};
@@ -0,0 +1,28 @@
/*
* Copyright (C) Internet Systems Consortium, Inc. ("ISC")
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* See the COPYRIGHT file distributed with this work for additional
* information regarding copyright ownership.
*/
// One zone with a dnssec-policy, the other with update-policy,
// with the same zone file.
zone "example1.net" {
type master;
file "example.db";
dnssec-policy "default";
};
zone "example2.net" {
type master;
file "example.db";
update-policy {
grant * self * TXT;
};
};
@@ -0,0 +1,26 @@
/*
* Copyright (C) Internet Systems Consortium, Inc. ("ISC")
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* See the COPYRIGHT file distributed with this work for additional
* information regarding copyright ownership.
*/
// One zone transitioning to insecure, the other with allow-update,
// with the same zone file.
zone "example1.net" {
type master;
file "example.db";
dnssec-policy "insecure";
};
zone "example2.net" {
type master;
file "example.db";
allow-update { any; };
};
+25
View File
@@ -0,0 +1,25 @@
/*
* Copyright (C) Internet Systems Consortium, Inc. ("ISC")
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* See the COPYRIGHT file distributed with this work for additional
* information regarding copyright ownership.
*/
// Two zones with dnssec-policy with the same zone file.
zone "example1.net" {
type master;
file "example.db";
dnssec-policy "default";
};
zone "example2.net" {
type master;
file "example.db";
dnssec-policy "default";
};
+26
View File
@@ -0,0 +1,26 @@
/*
* Copyright (C) Internet Systems Consortium, Inc. ("ISC")
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* See the COPYRIGHT file distributed with this work for additional
* information regarding copyright ownership.
*/
// Two zones with dnssec-policy 'insecure' (transitioning to insecure)
// with the same zone file.
zone "example1.net" {
type master;
file "example.db";
dnssec-policy "insecure";
};
zone "example2.net" {
type master;
file "example.db";
dnssec-policy "insecure";
};
+26
View File
@@ -0,0 +1,26 @@
/*
* Copyright (C) Internet Systems Consortium, Inc. ("ISC")
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* See the COPYRIGHT file distributed with this work for additional
* information regarding copyright ownership.
*/
// One zone with dnssec-policy, the other zone has 'dnssec-policy none',
// both with the same zone file.
zone "example1.net" {
type master;
file "example.db";
dnssec-policy "default";
};
zone "example2.net" {
type master;
file "example.db";
dnssec-policy "none";
};
+26
View File
@@ -0,0 +1,26 @@
/*
* Copyright (C) Internet Systems Consortium, Inc. ("ISC")
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* See the COPYRIGHT file distributed with this work for additional
* information regarding copyright ownership.
*/
// One zone with dnssec-policy, the other zone has 'dnssec-policy insecure'
// (transitioning to inseure), both with the same zone file.
zone "example1.net" {
type master;
file "example.db";
dnssec-policy "default";
};
zone "example2.net" {
type master;
file "example.db";
dnssec-policy "insecure";
};
@@ -0,0 +1,27 @@
/*
* Copyright (C) Internet Systems Consortium, Inc. ("ISC")
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* See the COPYRIGHT file distributed with this work for additional
* information regarding copyright ownership.
*/
tls local-tls {
key-file "key.pem";
cert-file "cert.pem";
};
http local-http-server {
endpoints { "/dns-query"; };
};
options {
listen-on { 10.53.0.1; };
http-port 80;
https-port 443;
listen-on port 443 tls local-tls http local-http-server { 10.53.0.1; };
listen-on port 8080 tls none http local-http-server { 10.53.0.1; };
};
@@ -0,0 +1,27 @@
/*
* Copyright (C) Internet Systems Consortium, Inc. ("ISC")
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* See the COPYRIGHT file distributed with this work for additional
* information regarding copyright ownership.
*/
tls local-tls {
key-file "key.pem";
cert-file "cert.pem";
};
http local-http-server {
endpoints { "/dns-query"; };
};
options {
listen-on { 10.53.0.1; };
http-port 80;
https-port 443;
listen-on port 443 http local-http-server tls local-tls { 10.53.0.1; };
listen-on port 8080 tls none http local-http-server { 10.53.0.1; };
};
@@ -0,0 +1,17 @@
/*
* Copyright (C) Internet Systems Consortium, Inc. ("ISC")
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* See the COPYRIGHT file distributed with this work for additional
* information regarding copyright ownership.
*/
options {
listen-on { 10.53.0.1; };
http-port 80;
https-port 443;
listen-on port 8080 tls none http default { 10.53.0.1; };
};
@@ -0,0 +1,19 @@
/*
* Copyright (C) Internet Systems Consortium, Inc. ("ISC")
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* See the COPYRIGHT file distributed with this work for additional
* information regarding copyright ownership.
*/
tls local-tls {
key-file "key.pem";
cert-file "cert.pem";
};
options {
listen-on port 853 tls local-tls { 10.53.0.1; };
};
+7 -2
View File
@@ -49,8 +49,13 @@ zone "example3" {
file "example3.db"; file "example3.db";
dnssec-policy "default"; dnssec-policy "default";
}; };
zone "example4" { zone "dnssec-policy-none-shared-zonefile1" {
type master; type master;
file "example4.db"; file "shared.db";
dnssec-policy "none";
};
zone "dnssec-policy-none-shared-zonefile2" {
type master;
file "shared.db";
dnssec-policy "none"; dnssec-policy "none";
}; };
+47
View File
@@ -26,6 +26,7 @@ dnssec-policy "test" {
parent-ds-ttl 7200; parent-ds-ttl 7200;
parent-propagation-delay PT1H; parent-propagation-delay PT1H;
publish-safety PT3600S; publish-safety PT3600S;
purge-keys P90D;
retire-safety PT3600S; retire-safety PT3600S;
signatures-refresh P3D; signatures-refresh P3D;
signatures-validity P2W; signatures-validity P2W;
@@ -191,7 +192,53 @@ view "fourth" {
file "dnssec-none.db"; file "dnssec-none.db";
dnssec-policy "none"; dnssec-policy "none";
}; };
zone "dnssec-view1" {
type master;
file "dnssec-view41.db";
dnssec-policy "test";
};
zone "dnssec-view2" {
type master;
file "dnssec-view42.db";
};
zone "dnssec-view3" {
type master;
file "dnssec-view43.db";
dnssec-policy "none";
key-directory "keys";
};
zone "dnssec-view4" {
type master;
file "dnssec-view44.db";
dnssec-policy "none";
};
dnssec-policy "default"; dnssec-policy "default";
key-directory ".";
};
view "fifth" {
zone "dnssec-view1" {
type master;
file "dnssec-view51.db";
dnssec-policy "test";
};
zone "dnssec-view2" {
type master;
file "dnssec-view52.db";
dnssec-policy "test";
key-directory "keys";
};
zone "dnssec-view3" {
type master;
file "dnssec-view53.db";
dnssec-policy "default";
key-directory "keys";
};
zone "dnssec-view4" {
type master;
file "dnssec-view54.db";
dnssec-policy "none";
};
key-directory ".";
}; };
view "chaos" chaos { view "chaos" chaos {
zone "hostname.bind" chaos { zone "hostname.bind" chaos {
+8
View File
@@ -13,4 +13,12 @@ dnssec-test IN fourth master
dnssec-default IN fourth master dnssec-default IN fourth master
dnssec-inherit IN fourth master dnssec-inherit IN fourth master
dnssec-none IN fourth master dnssec-none IN fourth master
dnssec-view1 IN fourth master
dnssec-view2 IN fourth master
dnssec-view3 IN fourth master
dnssec-view4 IN fourth master
dnssec-view1 IN fifth master
dnssec-view2 IN fifth master
dnssec-view3 IN fifth master
dnssec-view4 IN fifth master
hostname.bind chaos chaos master hostname.bind chaos chaos master
@@ -27,28 +27,28 @@ dnssec-policy "rsasha256" {
keys { keys {
csk lifetime P10Y algorithm rsasha256 2048; csk lifetime P10Y algorithm rsasha256 2048;
}; };
nsec3param iterations 500; nsec3param iterations 150;
}; };
dnssec-policy "rsasha256-bad" { dnssec-policy "rsasha256-bad" {
keys { keys {
csk lifetime P10Y algorithm rsasha256 2048; csk lifetime P10Y algorithm rsasha256 2048;
}; };
nsec3param iterations 501; nsec3param iterations 151;
}; };
dnssec-policy "rsasha512" { dnssec-policy "rsasha512" {
keys { keys {
csk lifetime P10Y algorithm rsasha512 4096; csk lifetime P10Y algorithm rsasha512 4096;
}; };
nsec3param iterations 2500; nsec3param iterations 150;
}; };
dnssec-policy "rsasha512-bad" { dnssec-policy "rsasha512-bad" {
keys { keys {
csk lifetime P10Y algorithm rsasha512 4096; csk lifetime P10Y algorithm rsasha512 4096;
}; };
nsec3param iterations 2501; nsec3param iterations 151;
}; };
zone "example.net" { zone "example.net" {
+4 -2
View File
@@ -12,6 +12,8 @@
status=0 status=0
n=0 n=0
mkdir keys
n=`expr $n + 1` n=`expr $n + 1`
echo_i "checking that named-checkconf handles a known good config ($n)" echo_i "checking that named-checkconf handles a known good config ($n)"
ret=0 ret=0
@@ -495,8 +497,6 @@ echo_i "checking named-checkconf kasp nsec3 iterations errors ($n)"
ret=0 ret=0
$CHECKCONF kasp-bad-nsec3-iter.conf > checkconf.out$n 2>&1 && ret=1 $CHECKCONF kasp-bad-nsec3-iter.conf > checkconf.out$n 2>&1 && ret=1
grep "dnssec-policy: nsec3 iterations value 151 out of range" < checkconf.out$n > /dev/null || ret=1 grep "dnssec-policy: nsec3 iterations value 151 out of range" < checkconf.out$n > /dev/null || ret=1
grep "dnssec-policy: nsec3 iterations value 501 out of range" < checkconf.out$n > /dev/null || ret=1
grep "dnssec-policy: nsec3 iterations value 2501 out of range" < checkconf.out$n > /dev/null || ret=1
lines=$(wc -l < "checkconf.out$n") lines=$(wc -l < "checkconf.out$n")
if [ $lines != 3 ]; then ret=1; fi if [ $lines != 3 ]; then ret=1; fi
if [ $ret != 0 ]; then echo_i "failed"; fi if [ $ret != 0 ]; then echo_i "failed"; fi
@@ -551,5 +551,7 @@ grep "exceeds 100%" < checkconf.out$n > /dev/null || ret=1
if [ $ret != 0 ]; then echo_i "failed"; ret=1; fi if [ $ret != 0 ]; then echo_i "failed"; ret=1; fi
status=`expr $status + $ret` status=`expr $status + $ret`
rmdir keys
echo_i "exit status: $status" echo_i "exit status: $status"
[ $status -eq 0 ] || exit 1 [ $status -eq 0 ] || exit 1
+1 -1
View File
@@ -17,7 +17,7 @@ do
echo_i "checking $db ($n)" echo_i "checking $db ($n)"
ret=0 ret=0
case $db in case $db in
zones/good-gc-msdcs.db) zones/good-gc-msdcs.db|zones/good-spf-exception.db)
$CHECKZONE -k fail -i local example $db > test.out.$n 2>&1 || ret=1 $CHECKZONE -k fail -i local example $db > test.out.$n 2>&1 || ret=1
;; ;;
zones/good-dns-sd-reverse.db) zones/good-dns-sd-reverse.db)
@@ -0,0 +1,5 @@
example. 0 SOA . . 0 0 0 0 0
example. 0 NS .
example. 0 CDS 0 0 0 00
example. 0 CDNSKEY 0 3 0 AA==
@@ -0,0 +1,16 @@
; Copyright (C) Internet Systems Consortium, Inc. ("ISC")
;
; This Source Code Form is subject to the terms of the Mozilla Public
; License, v. 2.0. If a copy of the MPL was not distributed with this
; file, You can obtain one at http://mozilla.org/MPL/2.0/.
;
; See the COPYRIGHT file distributed with this work for additional
; information regarding copyright ownership.
$TTL 600
@ SOA ns hostmaster 2011012708 3600 1200 604800 1200
NS ns
ns A 192.0.2.1
a._spf A 192.0.2.2
a._spf_rate A 192.0.2.2
a._spf_verify A 192.0.2.2
+4 -1
View File
@@ -86,6 +86,7 @@ include-multiplecfg
inline inline
integrity integrity
ixfr ixfr
journal
keepalive keepalive
limits limits
masterfile masterfile
@@ -668,6 +669,8 @@ copy_setports() {
atsign="@" atsign="@"
sed -e "s/${atsign}PORT${atsign}/${PORT}/g" \ sed -e "s/${atsign}PORT${atsign}/${PORT}/g" \
-e "s/${atsign}TLSPORT${atsign}/${TLSPORT}/g" \ -e "s/${atsign}TLSPORT${atsign}/${TLSPORT}/g" \
-e "s/${atsign}HTTPPORT${atsign}/${HTTPPORT}/g" \
-e "s/${atsign}HTTPSPORT${atsign}/${HTTPSPORT}/g" \
-e "s/${atsign}EXTRAPORT1${atsign}/${EXTRAPORT1}/g" \ -e "s/${atsign}EXTRAPORT1${atsign}/${EXTRAPORT1}/g" \
-e "s/${atsign}EXTRAPORT2${atsign}/${EXTRAPORT2}/g" \ -e "s/${atsign}EXTRAPORT2${atsign}/${EXTRAPORT2}/g" \
-e "s/${atsign}EXTRAPORT3${atsign}/${EXTRAPORT3}/g" \ -e "s/${atsign}EXTRAPORT3${atsign}/${EXTRAPORT3}/g" \
@@ -710,6 +713,7 @@ export KEYGEN
export KEYSETTOOL export KEYSETTOOL
export KEYSIGNER export KEYSIGNER
export KRB5_CONFIG export KRB5_CONFIG
export KRB5_KTNAME
export MAKEJOURNAL export MAKEJOURNAL
export MDIG export MDIG
export NAMED export NAMED
@@ -727,7 +731,6 @@ export PYTHON
export RESOLVE export RESOLVE
export RNDC export RNDC
export RRCHECKER export RRCHECKER
export SAMPLEUPDATE
export SIGNER export SIGNER
export SUBDIRS export SUBDIRS
export TMPDIR export TMPDIR
+4 -2
View File
@@ -51,7 +51,7 @@ NZD2NZF=$TOP_BUILDDIR/bin/tools/named-nzd2nzf
PK11DEL="$TOP_BUILDDIR/bin/pkcs11/pkcs11-destroy -s ${SLOT:-0} -p ${HSMPIN:-1234} -w 0" PK11DEL="$TOP_BUILDDIR/bin/pkcs11/pkcs11-destroy -s ${SLOT:-0} -p ${HSMPIN:-1234} -w 0"
PK11GEN="$TOP_BUILDDIR/bin/pkcs11/pkcs11-keygen -q -s ${SLOT:-0} -p ${HSMPIN:-1234}" PK11GEN="$TOP_BUILDDIR/bin/pkcs11/pkcs11-keygen -q -s ${SLOT:-0} -p ${HSMPIN:-1234}"
PK11LIST="$TOP_BUILDDIR/bin/pkcs11/pkcs11-list -s ${SLOT:-0} -p ${HSMPIN:-1234}" PK11LIST="$TOP_BUILDDIR/bin/pkcs11/pkcs11-list -s ${SLOT:-0} -p ${HSMPIN:-1234}"
RESOLVE=$TOP_BUILDDIR/lib/samples/resolve RESOLVE=$TOP_BUILDDIR/bin/tests/system/resolve
REVOKE=$TOP_BUILDDIR/bin/dnssec/dnssec-revoke REVOKE=$TOP_BUILDDIR/bin/dnssec/dnssec-revoke
RNDC=$TOP_BUILDDIR/bin/rndc/rndc RNDC=$TOP_BUILDDIR/bin/rndc/rndc
RNDCCONFGEN=$TOP_BUILDDIR/bin/confgen/rndc-confgen RNDCCONFGEN=$TOP_BUILDDIR/bin/confgen/rndc-confgen
@@ -68,10 +68,11 @@ KEYCREATE=$TOP_BUILDDIR/bin/tests/system/tkey/keycreate
KEYDELETE=$TOP_BUILDDIR/bin/tests/system/tkey/keydelete KEYDELETE=$TOP_BUILDDIR/bin/tests/system/tkey/keydelete
MAKEJOURNAL=$TOP_BUILDDIR/bin/tests/system/makejournal MAKEJOURNAL=$TOP_BUILDDIR/bin/tests/system/makejournal
PIPEQUERIES=$TOP_BUILDDIR/bin/tests/system/pipelined/pipequeries PIPEQUERIES=$TOP_BUILDDIR/bin/tests/system/pipelined/pipequeries
SAMPLEUPDATE=$TOP_BUILDDIR/lib/samples/sample-update
# we don't want a KRB5_CONFIG setting breaking the tests # we don't want a KRB5_CONFIG setting breaking the tests
KRB5_CONFIG=/dev/null KRB5_CONFIG=/dev/null
# use local keytab instead of default /etc/krb5.keytab
KRB5_KTNAME=dns.keytab
# #
# Construct the lists of tests to run # Construct the lists of tests to run
@@ -87,6 +88,7 @@ dnssec
dyndb dyndb
filter-aaaa filter-aaaa
kasp kasp
keymgr2kasp
legacy legacy
logfileconfig logfileconfig
nzd2nzf nzd2nzf
+1 -3
View File
@@ -51,12 +51,10 @@ NZD2NZF=$TOP_BUILDDIR/Build/$VSCONF/named-nzd2nzf@EXEEXT@
PK11DEL="$TOP_BUILDDIR/Build/$VSCONF/pkcs11-destroy@EXEEXT@ -s ${SLOT:-0} -p ${HSMPIN:-1234} -w 0" PK11DEL="$TOP_BUILDDIR/Build/$VSCONF/pkcs11-destroy@EXEEXT@ -s ${SLOT:-0} -p ${HSMPIN:-1234} -w 0"
PK11GEN="$TOP_BUILDDIR/Build/$VSCONF/pkcs11-keygen@EXEEXT@ -q -s ${SLOT:-0} -p ${HSMPIN:-1234}" PK11GEN="$TOP_BUILDDIR/Build/$VSCONF/pkcs11-keygen@EXEEXT@ -q -s ${SLOT:-0} -p ${HSMPIN:-1234}"
PK11LIST="$TOP_BUILDDIR/Build/$VSCONF/pkcs11-list@EXEEXT@ -s ${SLOT:-0} -p ${HSMPIN:-1234}" PK11LIST="$TOP_BUILDDIR/Build/$VSCONF/pkcs11-list@EXEEXT@ -s ${SLOT:-0} -p ${HSMPIN:-1234}"
RESOLVE=$TOP_BUILDDIR/lib/samples/resolve
REVOKE=$TOP_BUILDDIR/Build/$VSCONF/dnssec-revoke@EXEEXT@ REVOKE=$TOP_BUILDDIR/Build/$VSCONF/dnssec-revoke@EXEEXT@
RNDC=$TOP_BUILDDIR/Build/$VSCONF/rndc@EXEEXT@ RNDC=$TOP_BUILDDIR/Build/$VSCONF/rndc@EXEEXT@
RNDCCONFGEN=$TOP_BUILDDIR/Build/$VSCONF/rndc-confgen@EXEEXT@ RNDCCONFGEN=$TOP_BUILDDIR/Build/$VSCONF/rndc-confgen@EXEEXT@
RRCHECKER=$TOP_BUILDDIR/Build/$VSCONF/named-rrchecker@EXEEXT@ RRCHECKER=$TOP_BUILDDIR/Build/$VSCONF/named-rrchecker@EXEEXT@
SAMPLEUPDATE=$TOP_BUILDDIR/Build/$VSCONF/update@EXEEXT@
SETTIME=$TOP_BUILDDIR/Build/$VSCONF/dnssec-settime@EXEEXT@ SETTIME=$TOP_BUILDDIR/Build/$VSCONF/dnssec-settime@EXEEXT@
SIGNER=$TOP_BUILDDIR/Build/$VSCONF/dnssec-signzone@EXEEXT@ SIGNER=$TOP_BUILDDIR/Build/$VSCONF/dnssec-signzone@EXEEXT@
TSIGKEYGEN=$TOP_BUILDDIR/Build/$VSCONF/tsig-keygen@EXEEXT@ TSIGKEYGEN=$TOP_BUILDDIR/Build/$VSCONF/tsig-keygen@EXEEXT@
@@ -71,7 +69,7 @@ KEYCREATE=$TOP_BUILDDIR/Build/$VSCONF/keycreate@EXEEXT@
KEYDELETE=$TOP_BUILDDIR/Build/$VSCONF/keydelete@EXEEXT@ KEYDELETE=$TOP_BUILDDIR/Build/$VSCONF/keydelete@EXEEXT@
MAKEJOURNAL=$TOP_BUILDDIR/Build/$VSCONF/makejournal@EXEEXT@ MAKEJOURNAL=$TOP_BUILDDIR/Build/$VSCONF/makejournal@EXEEXT@
PIPEQUERIES=$TOP_BUILDDIR/Build/$VSCONF/pipequeries@EXEEXT@ PIPEQUERIES=$TOP_BUILDDIR/Build/$VSCONF/pipequeries@EXEEXT@
# to port SAMPLEUPDATE=$TOP_BUILDDIR/lib/samples/sample-update RESOLVE=$TOP_BUILDDIR/Build/$VSCONF/resolve@EXEEXT@
# we don't want a KRB5_CONFIG setting breaking the tests # we don't want a KRB5_CONFIG setting breaking the tests
KRB5_CONFIG=NUL KRB5_CONFIG=NUL
+25 -6
View File
@@ -801,7 +801,7 @@ if [ -x "$DIG" ] ; then
echo_i "checking exit code for a retry upon TCP EOF (immediate -> immediate) ($n)" echo_i "checking exit code for a retry upon TCP EOF (immediate -> immediate) ($n)"
ret=0 ret=0
echo "no_response no_response" | sendcmd 10.53.0.5 echo "no_response no_response" | sendcmd 10.53.0.5
dig_with_opts @10.53.0.5 example AXFR +tries=1 > dig.out.test$n 2>&1 && ret=1 dig_with_opts @10.53.0.5 example AXFR +tries=2 > dig.out.test$n 2>&1 && ret=1
# Sanity check: ensure ans5 behaves as expected. # Sanity check: ensure ans5 behaves as expected.
[ `grep "communications error.*end of file" dig.out.test$n | wc -l` -eq 2 ] || ret=1 [ `grep "communications error.*end of file" dig.out.test$n | wc -l` -eq 2 ] || ret=1
if [ $ret -ne 0 ]; then echo_i "failed"; fi if [ $ret -ne 0 ]; then echo_i "failed"; fi
@@ -811,7 +811,7 @@ if [ -x "$DIG" ] ; then
echo_i "checking exit code for a retry upon TCP EOF (partial AXFR -> partial AXFR) ($n)" echo_i "checking exit code for a retry upon TCP EOF (partial AXFR -> partial AXFR) ($n)"
ret=0 ret=0
echo "partial_axfr partial_axfr" | sendcmd 10.53.0.5 echo "partial_axfr partial_axfr" | sendcmd 10.53.0.5
dig_with_opts @10.53.0.5 example AXFR +tries=1 > dig.out.test$n 2>&1 && ret=1 dig_with_opts @10.53.0.5 example AXFR +tries=2 > dig.out.test$n 2>&1 && ret=1
# Sanity check: ensure ans5 behaves as expected. # Sanity check: ensure ans5 behaves as expected.
[ `grep "communications error.*end of file" dig.out.test$n | wc -l` -eq 2 ] || ret=1 [ `grep "communications error.*end of file" dig.out.test$n | wc -l` -eq 2 ] || ret=1
if [ $ret -ne 0 ]; then echo_i "failed"; fi if [ $ret -ne 0 ]; then echo_i "failed"; fi
@@ -821,7 +821,7 @@ if [ -x "$DIG" ] ; then
echo_i "checking exit code for a retry upon TCP EOF (immediate -> partial AXFR) ($n)" echo_i "checking exit code for a retry upon TCP EOF (immediate -> partial AXFR) ($n)"
ret=0 ret=0
echo "no_response partial_axfr" | sendcmd 10.53.0.5 echo "no_response partial_axfr" | sendcmd 10.53.0.5
dig_with_opts @10.53.0.5 example AXFR +tries=1 > dig.out.test$n 2>&1 && ret=1 dig_with_opts @10.53.0.5 example AXFR +tries=2 > dig.out.test$n 2>&1 && ret=1
# Sanity check: ensure ans5 behaves as expected. # Sanity check: ensure ans5 behaves as expected.
[ `grep "communications error.*end of file" dig.out.test$n | wc -l` -eq 2 ] || ret=1 [ `grep "communications error.*end of file" dig.out.test$n | wc -l` -eq 2 ] || ret=1
if [ $ret -ne 0 ]; then echo_i "failed"; fi if [ $ret -ne 0 ]; then echo_i "failed"; fi
@@ -831,7 +831,7 @@ if [ -x "$DIG" ] ; then
echo_i "checking exit code for a retry upon TCP EOF (partial AXFR -> immediate) ($n)" echo_i "checking exit code for a retry upon TCP EOF (partial AXFR -> immediate) ($n)"
ret=0 ret=0
echo "partial_axfr no_response" | sendcmd 10.53.0.5 echo "partial_axfr no_response" | sendcmd 10.53.0.5
dig_with_opts @10.53.0.5 example AXFR +tries=1 > dig.out.test$n 2>&1 && ret=1 dig_with_opts @10.53.0.5 example AXFR +tries=2 > dig.out.test$n 2>&1 && ret=1
# Sanity check: ensure ans5 behaves as expected. # Sanity check: ensure ans5 behaves as expected.
[ `grep "communications error.*end of file" dig.out.test$n | wc -l` -eq 2 ] || ret=1 [ `grep "communications error.*end of file" dig.out.test$n | wc -l` -eq 2 ] || ret=1
if [ $ret -ne 0 ]; then echo_i "failed"; fi if [ $ret -ne 0 ]; then echo_i "failed"; fi
@@ -841,7 +841,7 @@ if [ -x "$DIG" ] ; then
echo_i "checking exit code for a retry upon TCP EOF (immediate -> complete AXFR) ($n)" echo_i "checking exit code for a retry upon TCP EOF (immediate -> complete AXFR) ($n)"
ret=0 ret=0
echo "no_response complete_axfr" | sendcmd 10.53.0.5 echo "no_response complete_axfr" | sendcmd 10.53.0.5
dig_with_opts @10.53.0.5 example AXFR +tries=1 > dig.out.test$n 2>&1 || ret=1 dig_with_opts @10.53.0.5 example AXFR +tries=2 > dig.out.test$n 2>&1 || ret=1
# Sanity check: ensure ans5 behaves as expected. # Sanity check: ensure ans5 behaves as expected.
[ `grep "communications error.*end of file" dig.out.test$n | wc -l` -eq 1 ] || ret=1 [ `grep "communications error.*end of file" dig.out.test$n | wc -l` -eq 1 ] || ret=1
if [ $ret -ne 0 ]; then echo_i "failed"; fi if [ $ret -ne 0 ]; then echo_i "failed"; fi
@@ -851,7 +851,26 @@ if [ -x "$DIG" ] ; then
echo_i "checking exit code for a retry upon TCP EOF (partial AXFR -> complete AXFR) ($n)" echo_i "checking exit code for a retry upon TCP EOF (partial AXFR -> complete AXFR) ($n)"
ret=0 ret=0
echo "partial_axfr complete_axfr" | sendcmd 10.53.0.5 echo "partial_axfr complete_axfr" | sendcmd 10.53.0.5
dig_with_opts @10.53.0.5 example AXFR +tries=1 > dig.out.test$n 2>&1 || ret=1 dig_with_opts @10.53.0.5 example AXFR +tries=2 > dig.out.test$n 2>&1 || ret=1
# Sanity check: ensure ans5 behaves as expected.
[ `grep "communications error.*end of file" dig.out.test$n | wc -l` -eq 1 ] || ret=1
if [ $ret -ne 0 ]; then echo_i "failed"; fi
status=$((status+ret))
n=$((n+1))
echo_i "checking +tries=1 won't retry twice upon TCP EOF ($n)"
ret=0
echo "no_response no_response" | sendcmd 10.53.0.5
dig_with_opts @10.53.0.5 example AXFR +tries=1 > dig.out.test$n 2>&1 && ret=1
# Sanity check: ensure ans5 behaves as expected.
[ `grep "communications error.*end of file" dig.out.test$n | wc -l` -eq 1 ] || ret=1
if [ $ret -ne 0 ]; then echo_i "failed"; fi
status=$((status+ret))
n=$((n+1))
echo_i "checking +retry=0 won't retry twice upon TCP EOF ($n)"
ret=0
dig_with_opts @10.53.0.5 example AXFR +retry=0 > dig.out.test$n 2>&1 && ret=1
# Sanity check: ensure ans5 behaves as expected. # Sanity check: ensure ans5 behaves as expected.
[ `grep "communications error.*end of file" dig.out.test$n | wc -l` -eq 1 ] || ret=1 [ `grep "communications error.*end of file" dig.out.test$n | wc -l` -eq 1 ] || ret=1
if [ $ret -ne 0 ]; then echo_i "failed"; fi if [ $ret -ne 0 ]; then echo_i "failed"; fi
@@ -4,11 +4,10 @@ AM_CPPFLAGS += \
$(LIBISC_CFLAGS) \ $(LIBISC_CFLAGS) \
$(LIBDNS_CFLAGS) $(LIBDNS_CFLAGS)
dlzexternal_LTLIBRARIES = dlzexternal.la check_LTLIBRARIES = dlzexternal.la
dlzexternaldir = $(abs_builddir)
dlzexternal_la_SOURCES = \ dlzexternal_la_SOURCES = \
driver.c \ driver.c \
driver.h driver.h
dlzexternal_la_LDFLAGS = -avoid-version -module -shared -export-dynamic dlzexternal_la_LDFLAGS = -avoid-version -module -shared -export-dynamic -rpath $(abs_builddir)
+2
View File
@@ -25,6 +25,7 @@ rm -f ./canonical?.*
rm -f ./delv.out* rm -f ./delv.out*
rm -f ./delve.out* rm -f ./delve.out*
rm -f ./dig.out.* rm -f ./dig.out.*
rm -f ./ns2/too-many-iterations.db
rm -f ./dnssectools.out* rm -f ./dnssectools.out*
rm -f ./dsfromkey.out.* rm -f ./dsfromkey.out.*
rm -f ./keygen.err rm -f ./keygen.err
@@ -35,6 +36,7 @@ rm -f ./ns*/managed-keys.bind* ./ns*/*.mkeys*
rm -f ./ns*/named.lock rm -f ./ns*/named.lock
rm -f ./ns1/managed.key.id rm -f ./ns1/managed.key.id
rm -f ./ns1/root.db ./ns2/example.db ./ns2/managed.db ./ns2/trusted.db rm -f ./ns1/root.db ./ns2/example.db ./ns2/managed.db ./ns2/trusted.db
rm -f ./ns1/trusted.keys
rm -f ./ns2/algroll.db rm -f ./ns2/algroll.db
rm -f ./ns2/badparam.db ./ns2/badparam.db.bad rm -f ./ns2/badparam.db ./ns2/badparam.db.bad
rm -f ./ns2/cdnskey-kskonly.secure.db rm -f ./ns2/cdnskey-kskonly.secure.db
+2
View File
@@ -31,3 +31,5 @@ ns6.optout-tld. A 10.53.0.6
in-addr.arpa. NS ns2.example. in-addr.arpa. NS ns2.example.
inprogress. NS ns10.inprogress. inprogress. NS ns10.inprogress.
ns10.inprogress. A 10.53.0.10 ns10.inprogress. A 10.53.0.10
too-many-iterations. NS ns2.too-many-iterations.
ns2.too-many-iterations. A 10.53.0.2
+1
View File
@@ -26,6 +26,7 @@ echo_i "ns1/sign.sh"
cp "../ns2/dsset-example$TP" . cp "../ns2/dsset-example$TP" .
cp "../ns2/dsset-in-addr.arpa$TP" . cp "../ns2/dsset-in-addr.arpa$TP" .
cp "../ns2/dsset-too-many-iterations$TP" .
grep "$DEFAULT_ALGORITHM_NUMBER [12] " "../ns2/dsset-algroll$TP" > "dsset-algroll$TP" grep "$DEFAULT_ALGORITHM_NUMBER [12] " "../ns2/dsset-algroll$TP" > "dsset-algroll$TP"
cp "../ns6/dsset-optout-tld$TP" . cp "../ns6/dsset-optout-tld$TP" .
@@ -191,4 +191,9 @@ zone "hours-vs-days" {
allow-update { any; }; allow-update { any; };
}; };
zone "too-many-iterations" {
type master;
file "too-many-iterations.db.signed";
};
include "trusted.conf"; include "trusted.conf";

Some files were not shown because too many files have changed in this diff Show More