]> git.ipfire.org Git - thirdparty/bind9.git/log
thirdparty/bind9.git
5 years agoRewrite isc_mem water to use single atomic exchange operation
Ondřej Surý [Wed, 7 Jul 2021 14:05:48 +0000 (16:05 +0200)] 
Rewrite isc_mem water to use single atomic exchange operation

This commit refactors the water mechanism in the isc_mem API to use
single pointer to a water_t structure that can be swapped with
atomic_exchange operation instead of having four different
values (water, water_arg, hi_water, lo_water) in the flat namespace.

This reduces the need for locking and prevents a race when water and
water_arg could be desynchronized.

5 years agoAllow size == 0 in isc_mem_{get,allocate,reallocate}
Ondřej Surý [Thu, 10 Jun 2021 08:18:24 +0000 (10:18 +0200)] 
Allow size == 0 in isc_mem_{get,allocate,reallocate}

Calls to jemalloc extended API with size == 0 ends up in undefined
behaviour.  This commit makes the isc_mem_get() and friends calls
more POSIX aligned:

  If size is 0, either a null pointer or a unique pointer that can be
  successfully passed to free() shall be returned.

We picked the easier route (which have been already supported in the old
code) and return NULL on calls to the API where size == 0.

5 years agoUse system allocator when jemalloc is unavailable
Ondřej Surý [Tue, 25 May 2021 10:46:00 +0000 (12:46 +0200)] 
Use system allocator when jemalloc is unavailable

This commit adds support for systems where the jemalloc library is not
available as a package, here's the quick summary:

  * On Linux - the jemalloc is usually available as a package, if
    configured --without-jemalloc, the shim would be used around
    malloc(), free(), realloc() and malloc_usable_size()

  * On macOS - the jemalloc is available from homebrew or macports, if
    configured --without-jemalloc, the shim would be used around
    malloc(), free(), realloc() and malloc_size()

  * On FreeBSD - the jemalloc is *the* system allocator, we just need
    to check for <malloc_np.h> header to get access to non-standard API

  * On NetBSD - the jemalloc is *the* system allocator, we just need to
    check for <jemalloc/jemalloc.h> header to get access to non-standard
    API

  * On a system hostile to users and developers (read OpenBSD) - the
    jemalloc API is emulated by using ((size_t *)ptr)[-1] field to hold
    the size information.  The OpenBSD developers care only for
    themselves, so why should we care about speed on OpenBSD?

5 years agoupdate the "memory" section of the developer doc
Evan Hunt [Mon, 24 May 2021 19:40:15 +0000 (12:40 -0700)] 
update the "memory" section of the developer doc

Information about memory allocation was outdated.

5 years agodocument the dependency on jemalloc
Evan Hunt [Sat, 22 May 2021 17:40:00 +0000 (10:40 -0700)] 
document the dependency on jemalloc

updated README and PLATFORMS with new text on build requirements.

5 years agoRemove error checks in dns_message for mem allocations
Evan Hunt [Thu, 20 May 2021 00:18:22 +0000 (17:18 -0700)] 
Remove error checks in dns_message for mem allocations

Removed error checks for several functions that can no longer fail due
to failed memory allocation.

5 years agoRemove atomic thread synchronization from the memory hot-path
Ondřej Surý [Fri, 14 May 2021 13:13:33 +0000 (15:13 +0200)] 
Remove atomic thread synchronization from the memory hot-path

This commit refactors the hi/lo-water related code to remove contention
on the hot path in the memory allocator.

5 years agoClean up isc_mempool API
Ondřej Surý [Wed, 12 May 2021 22:29:11 +0000 (00:29 +0200)] 
Clean up isc_mempool API

- isc_mempool_get() can no longer fail; when there are no more objects
  in the pool, more are always allocated. checking for NULL return is
  no longer necessary.
- the isc_mempool_setmaxalloc() and isc_mempool_getmaxalloc() functions
  are no longer used and have been removed.

5 years agoinitialize state object in test-async driver
Evan Hunt [Fri, 14 May 2021 09:35:12 +0000 (02:35 -0700)] 
initialize state object in test-async driver

the hooks system test was failing due to a block of
memory not having been zeroed after allocation.

5 years agoClean up the dns_dispatch_getudp API
Ondřej Surý [Wed, 12 May 2021 21:27:15 +0000 (23:27 +0200)] 
Clean up the dns_dispatch_getudp API

Cleanup unused parts of dns_dispatch_getudp API, remove
dns_dispatch_getudp_dup() function and related code.

5 years agoReplace locked mempools with memory contexts
Ondřej Surý [Wed, 12 May 2021 19:16:17 +0000 (21:16 +0200)] 
Replace locked mempools with memory contexts

Current mempools are kind of hybrid structures - they serve two
purposes:

 1. mempool with a lock is basically static sized allocator with
    pre-allocated free items

 2. mempool without a lock is a doubly-linked list of preallocated items

The first kind of usage could be easily replaced with jemalloc small
sized arena objects and thread-local caches.

The second usage not-so-much and we need to keep this (in
libdns:message.c) for performance reasons.

5 years agoAdd debug tracing capability to isc_mempool_create/destroy
Ondřej Surý [Tue, 11 May 2021 17:54:05 +0000 (19:54 +0200)] 
Add debug tracing capability to isc_mempool_create/destroy

Previously, we only had capability to trace the mempool gets and puts,
but for debugging, it's sometimes also important to keep track how many
and where do the memory pools get created and destroyed.  This commit
adds such tracking capability.

5 years agoReplace isc_mem_allocate() usage with isc_mem_get() in netmgr.c
Ondřej Surý [Tue, 11 May 2021 12:37:18 +0000 (14:37 +0200)] 
Replace isc_mem_allocate() usage with isc_mem_get() in netmgr.c

The isc_mem_allocate() comes with additional cost because of the memory
tracking.  In this commit, we replace the usage with isc_mem_get()
because we track the allocated sizes anyway, so it's possible to also
replace isc_mem_free() with isc_mem_put().

5 years agoReplace internal memory calls with non-standard jemalloc API
Ondřej Surý [Tue, 11 May 2021 12:00:12 +0000 (14:00 +0200)] 
Replace internal memory calls with non-standard jemalloc API

The jemalloc non-standard API fits nicely with our memory contexts, so
just rewrite the memory context internals to use the non-public API.

There's just one caveat - since we no longer track the size of the
allocation for isc_mem_allocate/isc_mem_free combination, we need to use
sallocx() to get real allocation size in both allocator and deallocator
because otherwise the sizes would not match.

5 years agoRemove ISC_MEM_DEBUGSIZE and ISC_MEM_DEBUGRECORD
Ondřej Surý [Tue, 11 May 2021 10:59:35 +0000 (12:59 +0200)] 
Remove ISC_MEM_DEBUGSIZE and ISC_MEM_DEBUGRECORD

The ISC_MEM_DEBUGSIZE and ISC_MEM_DEBUGCTX did sanity checks on matching
size and memory context on the memory returned to the allocator.  Those
will no longer needed when most of the allocator will be replaced with
jemalloc.

5 years agoRemove default_memalloc and default_memfree
Ondřej Surý [Tue, 11 May 2021 10:40:42 +0000 (12:40 +0200)] 
Remove default_memalloc and default_memfree

Now that we have xmalloc:true enabled, we can remove our xmalloc-like
wrappers around malloc and free.

5 years agoAdd recommended jemalloc configuration for our load
Ondřej Surý [Tue, 11 May 2021 10:33:31 +0000 (12:33 +0200)] 
Add recommended jemalloc configuration for our load

There's global variable called `malloc_conf` that can be used to
configure jemalloc behaviour at the program startup.  We use following
configuration:

  * xmalloc:true - abort-on-out-of-memory enabled.

  * background_thread:true - Enable internal background worker threads
    to handle purging asynchronously.

  * metadata_thp:auto - allow jemalloc to use transparent huge page
    (THP) for internal metadata initially, but may begin to do so when
    metadata usage reaches certain level.

  * dirty_decay_ms:30000 - Approximate time in milliseconds from the
    creation of a set of unused dirty pages until an equivalent set of
    unused dirty pages is purged and/or reused.

  * muzzy_decay_ms:30000 - Approximate time in milliseconds from the
    creation of a set of unused muzzy pages until an equivalent set of
    unused muzzy pages is purged and/or reused.

More information about the specific meaning can be found in the jemalloc
manpage or online at http://jemalloc.net/jemalloc.3.html

5 years agoCompile with jemalloc to reduce memory allocator contention
Ondřej Surý [Tue, 11 May 2021 10:29:57 +0000 (12:29 +0200)] 
Compile with jemalloc to reduce memory allocator contention

The jemalloc allocator is scalable high performance allocator, this is
the first in the series of commits that will add jemalloc as a memory
allocator for BIND 9.

This commit adds configure.ac check and Makefile modifications to use
jemalloc as BIND 9 allocator.

5 years agoAdd debug tracing capability to isc_mem_create/isc_mem_destroy
Ondřej Surý [Tue, 11 May 2021 10:18:56 +0000 (12:18 +0200)] 
Add debug tracing capability to isc_mem_create/isc_mem_destroy

Previously, we only had capability to trace the memory gets and puts,
but for debugging, it's sometimes also important to keep track how many
and where do the memory contexts get created and destroyed.  This commit
adds such tracking capability.

5 years agoReturn HTTP status code for small/malformed requests
Artem Boldariev [Tue, 6 Jul 2021 13:36:17 +0000 (16:36 +0300)] 
Return HTTP status code for small/malformed requests

This commit makes BIND return HTTP status codes for malformed or too
small requests.

DNS request processing code would ignore such requests. Such an
approach works well for other DNS transport but does not make much
sense for HTTP, not allowing it to complete the request/response
sequence.

Suppose execution has reached the point where DNS message handling
code has been called. In that case, it means that the HTTP request has
been successfully processed, and, thus, we are expected to respond to
it either with a message containing some DNS payload or at least to
return an error status code. This commit ensures that BIND behaves
this way.

5 years agomodify CHANGES
Artem Boldariev [Mon, 5 Jul 2021 13:32:44 +0000 (16:32 +0300)] 
modify CHANGES

Add a note to changes regarding ignoring the "Accept" HTTP header.

5 years agoReturn "Bad Request" (400) in a case of Base64 decoding error
Artem Boldariev [Mon, 5 Jul 2021 13:48:54 +0000 (16:48 +0300)] 
Return "Bad Request" (400) in a case of Base64 decoding error

This error code fits better than the more generic "Internal Server
Error" (500) which implies that the problem is on the server.

Also, do not end the whole HTTP/2 session on a bad request.

5 years agoIgnore an "Accept" HTTP header value
Artem Boldariev [Mon, 5 Jul 2021 13:03:50 +0000 (16:03 +0300)] 
Ignore an "Accept" HTTP header value

We were too strict regarding the value and presence of "Accept" HTTP
header, slightly breaking compatibility with the specification.

According to RFC8484 client SHOULD add "Accept" header to the requests
but MUST be able to handle "application/dns-message" media type
regardless of the value of the header. That basically suggests we
ignore its value.

Besides, verifying the value of the "Accept" header is a bit tricky
because it could contain multiple media types, thus requiring proper
parsing. That is doable but does not provide us with any benefits.

Among other things, not verifying the value also fixes compatibility
with clients, which could advertise multiple media types as supported,
which we should accept. For example, it is possible for a perfectly
valid request to contain "application/dns-message", "application/*",
and "*/*" in the "Accept" header value. Still, we would treat such a
request as invalid.

5 years agoMerge branch 'artem/doh-hang-on-stop-fix' into 'main'
Artem Boldariev [Fri, 9 Jul 2021 13:03:40 +0000 (13:03 +0000)] 
Merge branch 'artem/doh-hang-on-stop-fix' into 'main'

Fix BIND hanging when browsers end HTTP/2 streams prematurely

See merge request isc-projects/bind9!5245

5 years agoModify CHANGES
Artem Boldariev [Mon, 5 Jul 2021 10:10:53 +0000 (13:10 +0300)] 
Modify CHANGES

Document that BIND hanging in a case HTTP/2 streams been ended
prematurely is fixed.

5 years agoFix BIND hanging when browsers end HTTP/2 streams prematurely
Artem Boldariev [Fri, 2 Jul 2021 15:25:17 +0000 (18:25 +0300)] 
Fix BIND hanging when browsers end HTTP/2 streams prematurely

The commit fixes BIND hanging when browsers end HTTP/2 streams
prematurely (for example, by sending RST_STREAM). It ensures that
isc__nmsocket_prep_destroy() will be called for an HTTP/2 stream,
allowing it to be properly disposed.

The problem was impossible to reproduce using dig or DoH benchmarking
software (e.g. flamethrower) because these do not tend to end HTTP/2
streams prematurely.

5 years agoMove the code which calls server read callback into a separate func
Artem Boldariev [Thu, 1 Jul 2021 09:04:47 +0000 (12:04 +0300)] 
Move the code which calls server read callback into a separate func

This commit moves the code which calls server read callback into a
separate function to avoid code repetition.

5 years agoMerge branch '2478-consider-making-the-build-time-dependency-on-nghttp2-optional...
Ondřej Surý [Wed, 7 Jul 2021 08:15:26 +0000 (08:15 +0000)] 
Merge branch '2478-consider-making-the-build-time-dependency-on-nghttp2-optional' into 'main'

Make the DNS over HTTPS support optional

Closes #2478

See merge request isc-projects/bind9!4926

5 years agoAdd CHANGES and release notes for [GL #2478]
Ondřej Surý [Wed, 21 Apr 2021 13:13:30 +0000 (15:13 +0200)] 
Add CHANGES and release notes for [GL #2478]

5 years agoMake the DNS over HTTPS support optional
Ondřej Surý [Wed, 21 Apr 2021 11:52:15 +0000 (13:52 +0200)] 
Make the DNS over HTTPS support optional

This commit adds two new autoconf options `--enable-doh` (enabled by
default) and `--with-libnghttp2` (mandatory when DoH is enabled).

When DoH support is disabled the library is not linked-in and support
for http(s) protocol is disabled in the netmgr, named and dig.

5 years agoMerge branch '2756-rndc-multiple-algorithm' into 'main'
Evan Hunt [Tue, 6 Jul 2021 18:43:53 +0000 (18:43 +0000)] 
Merge branch '2756-rndc-multiple-algorithm' into 'main'

allow multiple key algorithms in the same control listener

Closes #2756

See merge request isc-projects/bind9!5153

5 years agoCHANGES
Evan Hunt [Wed, 9 Jun 2021 03:38:53 +0000 (20:38 -0700)] 
CHANGES

5 years agoallow multiple key algorithms in the same control listener
Evan Hunt [Wed, 9 Jun 2021 03:28:31 +0000 (20:28 -0700)] 
allow multiple key algorithms in the same control listener

if a control channel listener was configured with more than one
key algorithm, message verification would be attempted with each
algorithm in turn. if the first key failed due to the wrong
signature length, the entire verification process was aborted,
rather than continuing on to try with another key.

5 years agoMerge branch 'ondrej/remove-platform.h-header' into 'main'
Ondřej Surý [Tue, 6 Jul 2021 05:53:30 +0000 (05:53 +0000)] 
Merge branch 'ondrej/remove-platform.h-header' into 'main'

Remove isc/platform.h

See merge request isc-projects/bind9!5162

5 years agoThe isc/platform.h header has been completely removed
Ondřej Surý [Thu, 10 Jun 2021 06:19:13 +0000 (08:19 +0200)] 
The isc/platform.h header has been completely removed

The isc/platform.h header was left empty which things either already
moved to config.h or to appropriate headers.  This is just the final
cleanup commit.

5 years agoMove NAME_MAX and PATH_MAX from isc/platform.h to isc/dir.h
Ondřej Surý [Thu, 10 Jun 2021 06:14:57 +0000 (08:14 +0200)] 
Move NAME_MAX and PATH_MAX from isc/platform.h to isc/dir.h

The last remaining defines needed for platforms without NAME_MAX and
PATH_MAX (I'm looking at you, GNU Hurd) were moved to isc/dir.h where
it's prevalently used.

5 years agoMove ISC_STRERRORSIZE to isc/strerr.h header
Ondřej Surý [Thu, 10 Jun 2021 06:08:09 +0000 (08:08 +0200)] 
Move ISC_STRERRORSIZE to isc/strerr.h header

The ISC_STRERRORSIZE was defined in isc/platform.h header as the
value was different between Windows and POSIX platforms.  Now that
Windows is gone, move the define to where it belongs.

5 years agoRemove LIB<*>_EXTERNAL_DATA defines
Ondřej Surý [Thu, 10 Jun 2021 06:06:48 +0000 (08:06 +0200)] 
Remove LIB<*>_EXTERNAL_DATA defines

After Windows has been removed, the LIB<*>_EXTERNAL_DATA defines
were just dummy leftovers.  Remove them.

5 years agoMerge branch 'marka-xmllint-html' into 'main'
Mark Andrews [Fri, 2 Jul 2021 02:06:56 +0000 (02:06 +0000)] 
Merge branch 'marka-xmllint-html' into 'main'

Check for errors in html files

See merge request isc-projects/bind9!5242

5 years agoCheck for errors in html files
Mark Andrews [Fri, 2 Jul 2021 00:38:40 +0000 (10:38 +1000)] 
Check for errors in html files

xmllint doesn't know about the HTML 5 <section> tag so filter
those out.

5 years agoMerge branch '1126-checkds-followup-cid332468' into 'main'
Matthijs Mekking [Thu, 1 Jul 2021 14:27:36 +0000 (14:27 +0000)] 
Merge branch '1126-checkds-followup-cid332468' into 'main'

Fix CID 332468: Memory - illegal accesses (UNINIT)

Closes #1126

See merge request isc-projects/bind9!5241

5 years agoFix CID 332468: Memory - illegal accesses (UNINIT)
Matthijs Mekking [Thu, 1 Jul 2021 12:56:22 +0000 (14:56 +0200)] 
Fix CID 332468: Memory - illegal accesses (UNINIT)

*** CID 332468:  Memory - illegal accesses  (UNINIT)
/lib/dns/zone.c: 6613 in dns_zone_getdnsseckeys()
6607                 ISC_LIST_UNLINK(dnskeys, k1, link);
6608                 ISC_LIST_APPEND(*keys, k1, link);
6609             }
6610         }
6611     6612     failure:
>>>     CID 332468:  Memory - illegal accesses  (UNINIT)
>>>     Using uninitialized value "keyset.methods" when calling
>>>     "dns_rdataset_isassociated".
6613         if (dns_rdataset_isassociated(&keyset)) {
6614             dns_rdataset_disassociate(&keyset);
6615         }
6616         if (node != NULL) {
6617             dns_db_detachnode(db, &node);
6618         }

Fix by initializing the 'keyset' with 'dns_rdataset_init'.

5 years agoMerge branch '2786-keyfile-locking-race-condition-deadlock' into 'main'
Matthijs Mekking [Thu, 1 Jul 2021 09:27:54 +0000 (09:27 +0000)] 
Merge branch '2786-keyfile-locking-race-condition-deadlock' into 'main'

Fix possible deadlock when locking key files

Closes #2786

See merge request isc-projects/bind9!5210

5 years agoAdd release note and change for [#2786]
Matthijs Mekking [Wed, 23 Jun 2021 13:07:11 +0000 (15:07 +0200)] 
Add release note and change for [#2786]

5 years agoMerge branch '2769-journal-rollforward-failed-journal-out-of-sync-with-zone' into...
Mark Andrews [Thu, 1 Jul 2021 04:54:11 +0000 (04:54 +0000)] 
Merge branch '2769-journal-rollforward-failed-journal-out-of-sync-with-zone' into 'main'

Resolve "journal rollforward failed: journal out of sync with zone"

Closes #2769, #2728, and #2686

See merge request isc-projects/bind9!5177

5 years agoAdd CHANGES note for [GL #2769]
Mark Andrews [Tue, 15 Jun 2021 01:56:44 +0000 (11:56 +1000)] 
Add CHANGES note for [GL #2769]

5 years agoHandle placeholder KEYDATA record
Mark Andrews [Tue, 15 Jun 2021 01:50:52 +0000 (11:50 +1000)] 
Handle placeholder KEYDATA record

A placeholder keydata record can appear in a zone file.  Allow them
to be read back in.

5 years agoMerge branch '1126-checkds' into 'main'
Matthijs Mekking [Wed, 30 Jun 2021 15:49:42 +0000 (15:49 +0000)] 
Merge branch '1126-checkds' into 'main'

checkds

Closes #1126

See merge request isc-projects/bind9!5234

5 years agoMove private_type_record() to conf.sh.common
Matthijs Mekking [Wed, 30 Jun 2021 07:23:56 +0000 (09:23 +0200)] 
Move private_type_record() to conf.sh.common

The function 'private_type_record()' is now used in multiple system
setup scripts and should be moved to the common configuration script
conf.sh.common.

5 years agoAdd change and release note for [#1126]
Matthijs Mekking [Fri, 25 Jun 2021 09:43:29 +0000 (11:43 +0200)] 
Add change and release note for [#1126]

Seems pretty newsworthy.

5 years agoUpdate documentation
Matthijs Mekking [Fri, 25 Jun 2021 09:38:37 +0000 (11:38 +0200)] 
Update documentation

Update ARM and DNSSEC guide with the new checkds feature.

5 years agoProtect dst key metadata with lock
Matthijs Mekking [Fri, 25 Jun 2021 08:51:21 +0000 (10:51 +0200)] 
Protect dst key metadata with lock

The DST key metadata can be written by several threads in parralel.
Protect the dst_key_get* and dst_key_set* functions with a mutex.

5 years agoReplace zone keyflock with zonemgr keymgmt
Matthijs Mekking [Tue, 22 Jun 2021 13:43:42 +0000 (15:43 +0200)] 
Replace zone keyflock with zonemgr keymgmt

The old approach where each zone structure has its own mutex that
a thread needs to obtain multiple locks to do safe keyfile I/O
operations lead to a race condition ending in a possible deadlock.

Consider a zone in two views. Each such zone is stored in a separate
zone structure. A thread that needs to read or write the key files for
this zone needs to obtain both mutexes in seperate structures. If
another thread is working on the same zone in a different view, they
race to get the locks. It would be possible that thread1 grabs the
lock of the zone in view1, while thread2 wins the race for the lock
of the zone in view2. Now both threads try to get the other lock,  both
of them are already locked.

Ideally, when a thread wants to do key file operations, it only needs
to lock a single mutex. This commit introduces a key management hash
table, stored in the zonemgr structure. Each time a zone is being
managed, an object is added to the hash table (and removed when the
zone is being released). This object is identified by the zone name
and contains a mutex that needs to be locked prior to reading or
writing key files.

(cherry-picked from commit ef4619366d49efd46f9fae5f75c4a67c246ba2e6)

5 years agoAdd checkds code
Matthijs Mekking [Thu, 24 Jun 2021 15:01:42 +0000 (17:01 +0200)] 
Add checkds code

Similar to notify, add code to send and keep track of checkds requests.

On every zone_rekey event, we will check the DS at parental agents
(but we will only actually query parental agents if theree is a DS
scheduled to be published/withdrawn).

On a zone_rekey event, we will first clear the ongoing checkds requests.
Reset the counter, to avoid continuing KSK rollover premature.

This has the risk that if zone_rekey events happen too soon after each
other, there are redundant DS queries to the parental agents. But
if TTLs and the configured durations in the dnssec-policy are sane (as
in not ridiculous short) the chance of this happening is low.

5 years agoAdd checkds log notice
Matthijs Mekking [Thu, 24 Jun 2021 14:26:06 +0000 (16:26 +0200)] 
Add checkds log notice

When the checkds published/withdrawn is activated, log a notice. Can
be used for testing, but also operationally useful.

5 years agoAdd key metadata for DS published/withdrawn
Matthijs Mekking [Thu, 24 Jun 2021 14:22:22 +0000 (16:22 +0200)] 
Add key metadata for DS published/withdrawn

In order to keep track of how many parents have the DS for a given key
published or withdrawn, keep a counter.

5 years agoAdd missing VERIFY export
Matthijs Mekking [Thu, 24 Jun 2021 14:17:00 +0000 (16:17 +0200)] 
Add missing VERIFY export

This makes the 'dnssec-verify' tool visible to the test environment.

5 years agoSlightly improved dnssec tools fatal message
Matthijs Mekking [Thu, 24 Jun 2021 14:15:38 +0000 (16:15 +0200)] 
Slightly improved dnssec tools fatal message

Return the offending key state identifier.

5 years agoAdd helpful function 'dns_zone_getdnsseckeys'
Matthijs Mekking [Wed, 19 May 2021 13:32:56 +0000 (15:32 +0200)] 
Add helpful function 'dns_zone_getdnsseckeys'

This code gathers DNSSEC keys from key files and from the DNSKEY RRset.
It is used for the 'rndc dnssec -status' command, but will also be
needed for "checkds". Turn it into a function.

5 years agoAdd "parental-source[-v6]" config option
Matthijs Mekking [Fri, 14 May 2021 09:33:51 +0000 (11:33 +0200)] 
Add "parental-source[-v6]" config option

Similar to "notify-source" and "transfer-source", add options to
set the source address when querying parental agents for DS records.

5 years agoAdd dst_key_role function
Matthijs Mekking [Wed, 12 May 2021 09:09:33 +0000 (11:09 +0200)] 
Add dst_key_role function

Change the static function 'get_ksk_zsk' to a library function that
can be used to determine the role of a dst_key. Add checks if the
boolean parameters to store the role are not NULL. Rename to
'dst_key_role'.

5 years agoParse "parental-agents" configuration
Matthijs Mekking [Tue, 11 May 2021 12:46:38 +0000 (14:46 +0200)] 
Parse "parental-agents" configuration

Parse the new "parental-agents" configuration and store it in the zone
structure.

5 years agoMake "primaries" config parsing generic
Matthijs Mekking [Tue, 11 May 2021 12:43:02 +0000 (14:43 +0200)] 
Make "primaries" config parsing generic

Make the code to parse "primaries" configuration more generic so
it can be reused for "parental-agents".

5 years agoRemove stray "setup zone" in kasp system setup
Matthijs Mekking [Tue, 11 May 2021 12:40:23 +0000 (14:40 +0200)] 
Remove stray "setup zone" in kasp system setup

5 years agoAdd checkds system test
Matthijs Mekking [Tue, 11 May 2021 12:40:04 +0000 (14:40 +0200)] 
Add checkds system test

Add a Pytest based system test for the 'checkds' feature. There is
one nameserver (ns9, because it should be started the latest) that
has configured several zones with dnssec-policy. The zones are set
in such a state that they are waiting for DS publication or DS
withdrawal.

Then several other name servers act as parent servers that either have
the DS for these published, or not. Also one server in the mix is
to test a badly configured parental-agent.

There are tests for DS publication, DS publication error handling,
DS withdrawal and DS withdrawal error handling.

The tests ensures that the zone is DNSSEC valid, and that the
DSPublish/DSRemoved key metadata is set (or not in case of the error
handling).

It does not test if the rollover continues, this is already tested in
the kasp system test (that uses 'rndc -dnssec checkds' to set the
DSPublish/DSRemoved key metadata).

5 years agoCheck parental-agents config
Matthijs Mekking [Fri, 7 May 2021 12:27:25 +0000 (14:27 +0200)] 
Check parental-agents config

Add checks for "parental-agents" configuration, checking for the option
being at wrong type of zone (only allowed for primaries and
secondaries), duplicate definitions, duplicate references, and
undefined parental clauses (the name referenced in the zone clause
does not have a matching "parental-agent" clause).

5 years agoAdd parental-agents configuration
Matthijs Mekking [Fri, 7 May 2021 09:36:40 +0000 (11:36 +0200)] 
Add parental-agents configuration

Introduce a way to configure parental agents that can be used to
query DS records to be used in automatic key rollovers.

5 years agoChange primaries objects to remote-servers
Matthijs Mekking [Fri, 7 May 2021 09:31:15 +0000 (11:31 +0200)] 
Change primaries objects to remote-servers

Change the primaries configuration objects to the more generic
remote-servers, that we can reuse for other purposes (such as
parental-agents).

5 years agoMerge branch '2797-cfg-net-buf-sizes' into 'main'
Petr Špaček [Mon, 28 Jun 2021 10:15:12 +0000 (10:15 +0000)] 
Merge branch '2797-cfg-net-buf-sizes' into 'main'

fix tcp-send-buffer, udp-receive-buffer, udp-send-buffer limits

Closes #2797

See merge request isc-projects/bind9!5235

5 years agofix tcp-send-buffer, udp-receive-buffer, udp-send-buffer limits
Petr Špaček [Fri, 25 Jun 2021 15:53:26 +0000 (17:53 +0200)] 
fix tcp-send-buffer, udp-receive-buffer, udp-send-buffer limits

5 years agoMerge branch '2791-busy-wait-setnsec3param-shutdown-hang' into 'main'
Matthijs Mekking [Mon, 28 Jun 2021 09:01:02 +0000 (09:01 +0000)] 
Merge branch '2791-busy-wait-setnsec3param-shutdown-hang' into 'main'

Fix setnsec3param shutdown hang

Closes #2791

See merge request isc-projects/bind9!5219

5 years agoAdd changes for [#2791]
Matthijs Mekking [Wed, 23 Jun 2021 09:58:54 +0000 (11:58 +0200)] 
Add changes for [#2791]

5 years agoFix setnsec3param hang on shutdown
Matthijs Mekking [Wed, 23 Jun 2021 09:20:43 +0000 (11:20 +0200)] 
Fix setnsec3param hang on shutdown

When performing the 'setnsec3param' task, zones that are not loaded will have
their task rescheduled. We should do this only if the zone load is still
pending, this prevents zones that failed to load get stuck in a busy wait and
causing a hang on shutdown.

5 years agoAdd configuration that causes setnsec3param hang
Matthijs Mekking [Wed, 23 Jun 2021 09:17:02 +0000 (11:17 +0200)] 
Add configuration that causes setnsec3param hang

Add a zone to the configuration file that uses NSEC3 with dnssec-policy
and fails to load. This will cause setnsec3param to go into a busy wait
and will cause a hang on shutdown.

5 years agoMerge branch 'ondrej/fix-the-CFLAGS-order-in-tests' into 'main'
Ondřej Surý [Thu, 24 Jun 2021 13:49:03 +0000 (13:49 +0000)] 
Merge branch 'ondrej/fix-the-CFLAGS-order-in-tests' into 'main'

Move the include Makefile.tests to the bottom of Makefile.am(s)

See merge request isc-projects/bind9!4927

5 years agoMove the include Makefile.tests to the bottom of Makefile.am(s)
Ondřej Surý [Wed, 21 Apr 2021 12:22:18 +0000 (14:22 +0200)] 
Move the include Makefile.tests to the bottom of Makefile.am(s)

The Makefile.tests was modifying global AM_CFLAGS and LDADD and could
accidentally pull /usr/include to be listed before the internal
libraries, which is known to cause problems if the headers from the
previous version of BIND 9 has been installed on the build machine.

5 years agoMerge branch 'ondrej/remove-the-cvs-cruft' into 'main'
Ondřej Surý [Thu, 24 Jun 2021 09:45:48 +0000 (09:45 +0000)] 
Merge branch 'ondrej/remove-the-cvs-cruft' into 'main'

Remove unused or outdated utils, developer and design documentation

Closes #2745

See merge request isc-projects/bind9!5131

5 years agoRemove HISTORY file
Matthijs Mekking [Wed, 2 Jun 2021 10:26:56 +0000 (12:26 +0200)] 
Remove HISTORY file

We should drop the HISTORY file because it's confusing and the same
information is covered by the release notes for .0 releases (or at
least they should be).

Remove references to the HISTORY file, update the README to tell
people go look somewhere else.

5 years agoAdd steps to update copyrights
Matthijs Mekking [Wed, 2 Jun 2021 13:42:29 +0000 (15:42 +0200)] 
Add steps to update copyrights

This was written down in the outdated doc/dev/release documentation.
Since the rest of that file can go, add these steps to a separate file
and update it to current standards (e.g. use git commands).

5 years agoRemove unused or outdated utils, developer and design documentation
Ondřej Surý [Wed, 2 Jun 2021 10:48:18 +0000 (12:48 +0200)] 
Remove unused or outdated utils, developer and design documentation

The util/, doc/design/, and doc/dev/ directories included couple of
tools or documents there were completely outdated because they either
refered the the VCS we no longer use (cvs) or described processes that
have been redesigned and they are documented elsewhere.

5 years agoMerge branch '2780-checkconf-dnssec-policy-inheritance' into 'main'
Matthijs Mekking [Thu, 24 Jun 2021 08:40:52 +0000 (08:40 +0000)] 
Merge branch '2780-checkconf-dnssec-policy-inheritance' into 'main'

Fix checkconf dnssec-policy inheritance bug

Closes #2780

See merge request isc-projects/bind9!5199

5 years agoAdd change and release note for [#2780]
Matthijs Mekking [Fri, 18 Jun 2021 09:03:39 +0000 (11:03 +0200)] 
Add change and release note for [#2780]

5 years agoFix checkconf dnssec-policy inheritance bug
Matthijs Mekking [Fri, 18 Jun 2021 09:00:23 +0000 (11:00 +0200)] 
Fix checkconf dnssec-policy inheritance bug

Similar to #2778, the check for 'dnssec-policy' failed to account for
it being inheritable.

5 years agoMerge branch '2183-tweak-the-safe-edns-udp-size-to-1432' into 'main'
Ondřej Surý [Wed, 23 Jun 2021 19:00:59 +0000 (19:00 +0000)] 
Merge branch '2183-tweak-the-safe-edns-udp-size-to-1432' into 'main'

Change the safe edns-udp-size from 1400 to 1432

Closes #2183

See merge request isc-projects/bind9!5228

5 years agoChange the safe edns-udp-size from 1400 to 1432
Ondřej Surý [Wed, 23 Jun 2021 18:54:20 +0000 (20:54 +0200)] 
Change the safe edns-udp-size from 1400 to 1432

When backporting the Don't Fragment UDP socket option, it was noticed
that the edns-udp-size probing uses 1432 as one of the values to be
probed and the documentation would be recommending 1400 as the safe
value.  As the safe value can be from the 1400-1500 interval, the
documentation has been changed to match the probed value, so we do not
skip it.

5 years agoMerge branch '2758-nsupdate-refused' into 'main'
Evan Hunt [Wed, 23 Jun 2021 16:01:55 +0000 (16:01 +0000)] 
Merge branch '2758-nsupdate-refused' into 'main'

nsupdate: try next server on REFUSED

Closes #2758

See merge request isc-projects/bind9!5158

5 years agoCHANGES
Evan Hunt [Wed, 9 Jun 2021 21:58:48 +0000 (14:58 -0700)] 
CHANGES

5 years agoadd test for server failover on REFUSED
Evan Hunt [Wed, 9 Jun 2021 21:19:46 +0000 (14:19 -0700)] 
add test for server failover on REFUSED

- add an 'nsupdate -C' option to override resolv.conf file for nsupdate
- set resolv.conf to use two test servers, the first one of which will
  return REFUSED for a query for 'example'.

5 years agonsupdate: try next server on REFUSED
Evan Hunt [Wed, 9 Jun 2021 20:37:20 +0000 (13:37 -0700)] 
nsupdate: try next server on REFUSED

when nsupdate sends an SOA query to a resolver, if it fails
with REFUSED, nsupdate will now try the next server rather than
aborting the update completely.

5 years agoMerge branch '2790-properly-handle-oversized-messages-in-isc_nm_send' into 'main'
Ondřej Surý [Wed, 23 Jun 2021 15:55:52 +0000 (15:55 +0000)] 
Merge branch '2790-properly-handle-oversized-messages-in-isc_nm_send' into 'main'

Handle `UV_EMSGSIZE` in the uv_udp_send() callback

Closes #2790

See merge request isc-projects/bind9!5212

5 years agoAdd CHANGES and release note for [GL #2790]
Ondřej Surý [Wed, 23 Jun 2021 06:56:26 +0000 (08:56 +0200)] 
Add CHANGES and release note for [GL #2790]

5 years agoDisable IP fragmentation on the UDP sockets
Ondřej Surý [Tue, 22 Jun 2021 14:12:44 +0000 (16:12 +0200)] 
Disable IP fragmentation on the UDP sockets

In DNS Flag Day 2020, we started setting the DF (Don't Fragment socket
option on the UDP sockets.  It turned out, that this code was incomplete
leading to dropping the outgoing UDP packets.

This has been now remedied, so it is possible to disable the
fragmentation on the UDP sockets again as the sending error is now
handled by sending back an empty response with TC (truncated) bit set.

This reverts commit 66eefac78c92b64b6689a1655cc677a2b1d13496.

5 years agoHandle UDP send errors when sending DNS message larger than MTU
Evan Hunt [Tue, 22 Jun 2021 15:01:35 +0000 (17:01 +0200)] 
Handle UDP send errors when sending DNS message larger than MTU

When the fragmentation is disabled on UDP sockets, the uv_udp_send()
call can fail with UV_EMSGSIZE for messages larger than path MTU.
Previously, this error would end with just discarding the response.  In
this commit, a proper handling of such case is added and on such error,
a new DNS response with truncated bit set is generated and sent to the
client.

This change allows us to disable the fragmentation on the UDP
sockets again.

5 years agoMerge branch 'matthijs-2778-more-tests' into 'main'
Matthijs Mekking [Wed, 23 Jun 2021 15:30:04 +0000 (15:30 +0000)] 
Merge branch 'matthijs-2778-more-tests' into 'main'

Add more test cases for #2778

See merge request isc-projects/bind9!5198

5 years agoAdd more test cases for #2778
Matthijs Mekking [Fri, 18 Jun 2021 08:30:56 +0000 (10:30 +0200)] 
Add more test cases for #2778

Add three more test cases that detect a configuration error if the
key-directory is inherited but has the same value for a zone in a
different view with a deviating DNSSEC policy.

5 years agoMerge branch '2788-add-rbtdb-ownercase-unittest' into 'main'
Ondřej Surý [Wed, 23 Jun 2021 15:13:09 +0000 (15:13 +0000)] 
Merge branch '2788-add-rbtdb-ownercase-unittest' into 'main'

Add rbtdb setownercase/getownercase unit test

Closes #2788

See merge request isc-projects/bind9!5223

5 years agoAdd rbtdb setownercase/getownercase unit test
Ondřej Surý [Wed, 23 Jun 2021 13:29:22 +0000 (15:29 +0200)] 
Add rbtdb setownercase/getownercase unit test

This commit adds a unittest that tests private rdataset_getownercase()
and rdataset_setownercase() methods from rbtdb.c.  The test setups
minimal mock dns_rbtdb_t and dns_rbtdbnode_t data structures.

As the rbtdb methods are generally hidden behind layers and layers, we
include the "rbtdb.c" directly from rbtdb_test.c, and thus we can use
the private methods and data structures directly.  This also opens up
opportunity to add more unittest for the rbtdb private functions without
going through all the layers.

5 years agoMerge branch '2765-servestale-intermittent-test-failure-144' into 'main'
Matthijs Mekking [Wed, 23 Jun 2021 13:10:28 +0000 (13:10 +0000)] 
Merge branch '2765-servestale-intermittent-test-failure-144' into 'main'

Resolve intermittent serve-stale test failure (144)

Closes #2765

See merge request isc-projects/bind9!5167

5 years agoBump wait time in servestale test with 1 second
Matthijs Mekking [Thu, 10 Jun 2021 07:55:17 +0000 (09:55 +0200)] 
Bump wait time in servestale test with 1 second

This check intermittently failed:

I:serve-stale:check not in cache longttl.example times out...
I:serve-stale:failed

This corresponds to this query in the test:

$DIG -p ${PORT} +tries=1 +timeout=3  @10.53.0.3 longttl.example TXT

Looking at the dig output for a failed test, the query actually got a
response from the authoritative server (in one specific example the
query time was 2991 msec, close to 3 seconds).

After doing the query for the test, we enable the authoritative
server after a sleep of three seconds. If we bump this sleep to 4
seconds, the race will be more in favor of the query timing out,
making it unlikely that this test will fail intermittently.

Bump the subsequent wait_for_log checks also with one second.

5 years agoMerge branch 'v9_17_15-release' into 'main'
Michał Kępień [Wed, 23 Jun 2021 11:02:05 +0000 (11:02 +0000)] 
Merge branch 'v9_17_15-release' into 'main'

Merge 9.17.15 release branch

See merge request isc-projects/bind9!5220