]> git.ipfire.org Git - thirdparty/bind9.git/log
thirdparty/bind9.git
3 years agoRefactor the dns_resolver fetch context hash tables and locking
Ondřej Surý [Fri, 4 Nov 2022 14:04:29 +0000 (15:04 +0100)] 
Refactor the dns_resolver fetch context hash tables and locking

This is second in the series of fixing the usage of hashtables in the
dns_adb and the dns_resolver units.

Currently, the fetch buckets (used to hold the fetch context) and zone
buckets (used to hold per-domain counters) would never get cleaned from
the memory.  Combined with the fact that the hashtable now grows as
needed (instead of using hashtable as buckets), the memory usage in the
resolver can just grow and it never drops down.

In this commit, the usage of hashtables (hashmaps) has been completely
rewritten, so there are no "buckets" and all the matching conditions are
directly mapped into the hashtable key:

 1. For per-domain counter hashtable, this is simple as the lowercase
    domain name is used directly as a counter.

 2. For fetch context hashtable, this requires copying some extra flags
    back and forth in the key.

As we don't hold the "buckets" forever, the cleaning mechanism has been
rewritten as well:

 1. For per-domain counter hashtable, this is again much simpler, as we
    only need to check whether the usage counter is still zero under the
    lock and bail-out on cleaning if the counter is in use.

 2. For fetch context hashtable, this is more complicated as the fetch
    context cannot be reused after it has been finished.  The algorithm
    is different, the fetch context is always removed from the
    hashtable, but if we find the fetch context that has been marked
    as finished in the lookup function, we help with the cleaning from
    the hashtable and try again.

Couple of additional changes have been implemented in this refactoring
as those were needed for correct functionality and could not be split
into individual commits (or would not make sense as seperate commits):

 1. The dns_resolver_createfetch() has an option to create "unshared"
    fetch.  The "unshared" fetch will never get matched, so there's
    little point in storing the "unshared" fetch in the hashtable.
    Therefore the "unshared" fetches are now detached from the
    hashtable and live just on their own.

 2. Replace the custom reference counting with ISC_REFCOUNT_DECL/IMPL
    macros for better tracing.

 3. fctx_done_detach() is idempotent, it makes the "final" detach (the
    one matching the create function) only once.  But that also means
    that it has to be called before the detach that kept the fetch
    context alive in the callback.  A new macro fctx_done_unref() has
    been added to allow this code flow:

    fctx_done_unref(fctx, result);
    fctx_detach(&fctx);

    Doing this the other way around could cause fctx to get destroyed in
    the fctx_unref() first and fctx_done_detach() would cause UAF.

 4. The resume_qmin() and resume_dslookup() callbacks have been
    refactored for more readability and simpler code paths.  The
    validated() callback has also received some of the simplifications,
    but it should be refactored in the future as it is bit of spaghetti
    now.

3 years agoMerge branch 'each-cache-use-loops' into 'main' 7148/head
Evan Hunt [Wed, 30 Nov 2022 20:12:29 +0000 (20:12 +0000)] 
Merge branch 'each-cache-use-loops' into 'main'

change cache cleaning to use loops instead of tasks

See merge request isc-projects/bind9!7136

3 years agochange dns_db_settask() to _setloop()
Evan Hunt [Thu, 27 Oct 2022 05:36:04 +0000 (22:36 -0700)] 
change dns_db_settask() to _setloop()

The mechanism for associating a worker task to a database now
uses loops rather than tasks.

For this reason, the parameters to dns_cache_create() have been
updated to take a loop manager rather than a task manager.

3 years agoMerge branch 'artem-tls-tcp-compatibility-fixes' into 'main'
Artem Boldariev [Wed, 30 Nov 2022 16:30:03 +0000 (16:30 +0000)] 
Merge branch 'artem-tls-tcp-compatibility-fixes' into 'main'

TLS Stream: TCP transport compatibility fixes

See merge request isc-projects/bind9!7127

3 years agoTLS stream: always handle send callbacks asynchronously
Artem Boldariev [Fri, 28 Oct 2022 16:08:50 +0000 (19:08 +0300)] 
TLS stream: always handle send callbacks asynchronously

This commit ensures that send callbacks are always called from within
the context of its worker thread even in the case of
shuttigdown/inactive socket, just like TCP transport does and with
which TLS attempts to be as compatible as possible.

3 years agoTLS Stream: use ISC_R_CANCELLED error when shutting down
Artem Boldariev [Thu, 27 Oct 2022 18:16:36 +0000 (21:16 +0300)] 
TLS Stream: use ISC_R_CANCELLED error when shutting down

This commit changes ISC_R_NOTCONNECTED error code to ISC_R_CANCELLED
when attempting to start reading data on the shutting down socket in
order to make its behaviour compatible with that of TCP and not break
the common code in the unit tests.

3 years agoTLS Stream: fix isc_nm_read_stop() and reading flags handling
Artem Boldariev [Thu, 27 Oct 2022 17:13:06 +0000 (20:13 +0300)] 
TLS Stream: fix isc_nm_read_stop() and reading flags handling

It turned out that after the latest Network Manager refactoring
'sock->reading' flag was not processed correctly. Due to this
isc_nm_read_stop() might not work as expected because reading from the
underlying TCP socket could have been resume in 'tls_do_bio()'
regardless of the 'sock->reading' value.

This bug did not seem to cause problems with DoH, so it was not
noticed, but Stream DNS has more strict expectations regarding the
underlying transport.

Additionally to the above, the 'sock->recv_read' flag was completely
ignored and corresponding logic was completely unimplemented. That did
not allow to implement one fine detail compared to TCP: once reading
is started, it could be satisfied by one datum reading.

This commit fixes the issues above.

3 years agoMerge branch 'matthijs-deprecate-alt-transfer-source' into 'main'
Matthijs Mekking [Wed, 30 Nov 2022 15:50:26 +0000 (15:50 +0000)] 
Merge branch 'matthijs-deprecate-alt-transfer-source' into 'main'

Deprecate alt-transfer-source and companions

Closes #3694

See merge request isc-projects/bind9!7105

3 years agoMention deprecation of alternate transfer source
Matthijs Mekking [Wed, 23 Nov 2022 07:18:32 +0000 (08:18 +0100)] 
Mention deprecation of alternate transfer source

In the CHANGES and release notes.

3 years agoAdd missing deprecated tag to max-zone-ttl
Matthijs Mekking [Wed, 23 Nov 2022 07:16:38 +0000 (08:16 +0100)] 
Add missing deprecated tag to max-zone-ttl

This option was deprecated in commit 19352dd1877 but at that time
we didn't mark it deprecated in the ARM reference.

3 years agoDeprecate alt-transfer-source and companions
Matthijs Mekking [Wed, 23 Nov 2022 07:13:25 +0000 (08:13 +0100)] 
Deprecate alt-transfer-source and companions

Deprecate the alternate transfer sources from BIND 8.

3 years agoMerge branch 'marka/log-type-with-stale-answer-log-messages' into 'main'
Michał Kępień [Wed, 30 Nov 2022 14:00:20 +0000 (14:00 +0000)] 
Merge branch 'marka/log-type-with-stale-answer-log-messages' into 'main'

Log type with stale answer log messages

See merge request isc-projects/bind9!7145

3 years agoAdd CHANGES entry for GL !7145
Michał Kępień [Wed, 30 Nov 2022 13:32:58 +0000 (14:32 +0100)] 
Add CHANGES entry for GL !7145

3 years agoLog type with stale answer log messages
Mark Andrews [Thu, 27 Oct 2022 22:00:45 +0000 (09:00 +1100)] 
Log type with stale answer log messages

Add more information about which query type is dealing with serve-stale.
Update the expected log messages in the serve-stale system test.

3 years agoMerge branch 'matthijs/update-serve-stale-test-messages-to-include-rrtype' into ...
Michał Kępień [Wed, 30 Nov 2022 13:29:14 +0000 (13:29 +0000)] 
Merge branch 'matthijs/update-serve-stale-test-messages-to-include-rrtype' into 'main'

Update serve-stale test messages to include RRtype

See merge request isc-projects/bind9!7140

3 years agoUpdate serve-stale test messages to include RRtype
Matthijs Mekking [Tue, 8 Nov 2022 12:22:28 +0000 (13:22 +0100)] 
Update serve-stale test messages to include RRtype

3 years agoMerge branch '3706-compress-xfer' into 'main'
Tony Finch [Wed, 30 Nov 2022 13:11:13 +0000 (13:11 +0000)] 
Merge branch '3706-compress-xfer' into 'main'

Compress zone transfers properly

Closes #3706

See merge request isc-projects/bind9!7135

3 years agoCompress zone transfers properly
Tony Finch [Tue, 29 Nov 2022 20:23:31 +0000 (20:23 +0000)] 
Compress zone transfers properly

After change 5995, zone transfers were using a small
compression context that only had space for the first
few dozen names in each message. They now use a large
compression context with enough space for every name.

3 years agoMerge branch '3707-dont-log-final-reference-detached-on-LOG_INFO' into 'main'
Ondřej Surý [Wed, 30 Nov 2022 10:46:53 +0000 (10:46 +0000)] 
Merge branch '3707-dont-log-final-reference-detached-on-LOG_INFO' into 'main'

Don't log "final reference detached" on INFO level

Closes #3707

See merge request isc-projects/bind9!7139

3 years agoAdd CHANGES and release note for [GL #3707]
Ondřej Surý [Wed, 30 Nov 2022 09:56:52 +0000 (10:56 +0100)] 
Add CHANGES and release note for [GL #3707]

3 years agoDon't log "final reference detached" on INFO level
Ondřej Surý [Wed, 30 Nov 2022 09:46:40 +0000 (10:46 +0100)] 
Don't log "final reference detached" on INFO level

The "final reference detached" message was meant to be DEBUG(1), but was
instead kept at INFO level.  Move it to the DEBUG(1) logging level, so
it's not printed under normal operations.

3 years agoMerge branch '3239-fix-cleaning-of-adb-buckets' into 'main'
Ondřej Surý [Wed, 30 Nov 2022 09:35:18 +0000 (09:35 +0000)] 
Merge branch '3239-fix-cleaning-of-adb-buckets' into 'main'

Refactor the dns_adb unit

Closes #3239, #3238, #2615, #2078, #2437, #3312, and #2441

See merge request isc-projects/bind9!7138

3 years agoAdd CHANGES note for [GL #3239]
Ondřej Surý [Wed, 30 Nov 2022 09:13:29 +0000 (10:13 +0100)] 
Add CHANGES note for [GL #3239]

3 years agoKeep the unlink adb entries until expiration
Ondřej Surý [Wed, 23 Nov 2022 08:56:19 +0000 (09:56 +0100)] 
Keep the unlink adb entries until expiration

Currently, the ADB uses TTL of 0 for ADB names that the server is
authoritative for and TTL of 10 seconds for HINT and GLUE ADB names.

This requires the unlinked ADB entries to be kept around, because they
would disappear too quickly.  This especially affect the root zone as
the trust level is "ultimate" for the root zone nameservers.

This commit restores the ability to keep the unlinked ADB entries in the
database for later reuse, restores printing the unlinked entries and
adds some extra cleaning of the unlinked ADB entries on the tail of the
LRU list (similar to what we are doing for the ADB names).

3 years agoRefactor the dns_adb unit
Ondřej Surý [Thu, 13 Oct 2022 10:00:54 +0000 (12:00 +0200)] 
Refactor the dns_adb unit

The dns_adb unit has been refactored to be much simpler.  Following
changes have been made:

1. Simplify the ADB to always allow GLUE and hints

   There were only two places where dns_adb_createfind() was used - in
   the dns_resolver unit where hints and GLUE addresses were ok, and in
   the dns_zone where dns_adb_createfind() would be called without
   DNS_ADBFIND_HINTOK and DNS_ADBFIND_GLUEOK set.

   Simplify the logic by allowing hint and GLUE addresses when looking
   up the nameserver addresses to notify.  The difference is negligible
   and would cause a difference in the notified addresses only when
   there's mismatch between the parent and child addresses and we
   haven't cached the child addresses yet.

2. Drop the namebuckets and entrybuckets

   Formerly, the namebuckets and entrybuckets were used to reduced the
   lock contention when accessing the double-linked lists stored in each
   bucket.  In the previous refactoring, the custom hashtable for the
   buckets has been replaced with isc_ht/isc_hashmap, so only a single
   item (mostly, see below) would end up in each bucket.

   Removing the entrybuckets has been straightforward, the only matching
   was done on the isc_sockaddr_t member of the dns_adbentry.

   Removing the zonebuckets required GLUEOK and HINTOK bits to be
   removed because the find could match entries with-or-without the bits
   set, and creating a custom key that stores the
   DNS_ADBFIND_STARTATZONE in the first byte of the key, so we can do a
   straightforward lookup into the hashtable without traversing a list
   that contains items with different flags.

3. Remove unassociated entries from ADB database

   Previously, the adbentries could live in the ADB database even after
   unlinking them from dns_adbnames.  Such entries would show up as
   "Unassociated entries" in the ADB dump.  The benefit of keeping such
   entries is little - the chance that we link such entry to a adbname
   is small, and it's simpler to evict unlinked entries from the ADB
   cache (and the hashtable) than create second LRU cleaning mechanism.

   Unlinked ADB entries are now directly deleted from the hash
   table (hashmap) upon destruction.

4. Cleanup expired entries from the hash table

   When buckets were still in place, the code would keep the buckets
   always allocated and never shrink the hash table (hashmap).  With
   proper reference counting in place, we can delete the adbnames from
   the hash table and the LRU list.

5. Stop purging the names early when we hit the time limit

   Because the LRU list is now time ordered, we can stop purging the
   names when we find a first entry that doesn't fullfil our time-based
   eviction criteria because no further entry on the LRU list will meet
   the criteria.

Future work:

1. Lock contention

   In this commit, the focus was on correctness of the data structure,
   but in the future, the lock contention in the ADB database needs to
   be addressed.  Currently, we use simple mutex to lock the hash
   tables, because we almost always need to use a write lock for
   properly purging the hashtables.  The ADB database needs to be
   sharded (similar to the effect that buckets had in the past).  Each
   shard would contain own hashmap and own LRU list.

2. Time-based purging

   The ADB names and entries stay intact when there are no lookups.
   When we add separate shards, a timer needs to be added for time-based
   cleaning in case there's no traffic hashing to the inactive shard.

3. Revisit the 30 minutes limit

   The ADB cache is capped at 30 minutes.  This needs to be revisited,
   and at least the limit should be configurable (in both directions).

3 years agoCreate per-thread task for dns_adb resolver fetches
Ondřej Surý [Thu, 13 Oct 2022 06:11:30 +0000 (08:11 +0200)] 
Create per-thread task for dns_adb resolver fetches

The dns_adb would serialize all fetches on a single task.  Create a
per-thread task, so the fetches will stay local to the thread that
initiated the fetch.

3 years agoExpire namehooks when purging stale ADB names
Ondřej Surý [Mon, 1 Aug 2022 14:33:30 +0000 (16:33 +0200)] 
Expire namehooks when purging stale ADB names

Instead of trying to expire entries from adbentrybuckets, expire the
namehooks while purging the stale ADB names.

3 years agoPurge stale ADB names globaly, not per bucket
Ondřej Surý [Mon, 1 Aug 2022 07:07:38 +0000 (09:07 +0200)] 
Purge stale ADB names globaly, not per bucket

Before the refactoring, there was only few buckets with many names in
them, so cleaning up stale ADB names per-bucket made sense.  After the
refactoring, each bucket directly maps to ADB name, so purging has been
effectively disabled.

Create a global LRU list for ADB names (and ADB entries) and purge the
stale ADB names globally.

3 years agodns_adb: Remove deadnames and deadentries
Ondřej Surý [Wed, 27 Jul 2022 11:45:15 +0000 (13:45 +0200)] 
dns_adb: Remove deadnames and deadentries

Previously, the name and entry buckets were much larger, so the dead
names and entries were moved to a secondary list to be cleaned
later (f.e. after the already running fetch has been canceled).  After
the last refactoring, the bucket now contains only the name (entry)
itself and thus the extra list has a little use.  Remove the .deadnames
and .deadentries from dns_adbnamebucket_t and dns_adbentrybucket_t
structures.

3 years agoMerge branch 'ondrej-eliminitate-rpzs-irefs' into 'main'
Ondřej Surý [Wed, 30 Nov 2022 09:01:12 +0000 (09:01 +0000)] 
Merge branch 'ondrej-eliminitate-rpzs-irefs' into 'main'

Refactor dns_rpz unit to use single reference counting

See merge request isc-projects/bind9!6864

3 years agoRefactor dns_rpz unit to use single reference counting
Ondřej Surý [Wed, 5 Oct 2022 09:21:28 +0000 (11:21 +0200)] 
Refactor dns_rpz unit to use single reference counting

The dns_rpz_zones structure was using .refs and .irefs for strong and
weak reference counting.  Rewrite the unit to use just a single
reference counting + shutdown sequence (dns_rpz_destroy_rpzs) that must
be called by the creator of the dns_rpz_zones_t object.  Remove the
reference counting from the dns_rpz_zone structure as it is not needed
because the zone objects are fully embedded into the dns_rpz_zones
structure and dns_rpz_zones_t object must never be destroyed before all
dns_rpz_zone_t objects.

The dns_rps_zones_t reference counting uses the new ISC_REFCOUNT_TRACE
capability - enable by defining DNS_RPZ_TRACE in the dns/rpz.h header.

Additionally, add magic numbers to the dns_rpz_zone and dns_rpz_zones
structures.

3 years agoAdd extra set of ISC_REFCOUNT_TRACE_{IMPL,DECL} macros
Ondřej Surý [Wed, 5 Oct 2022 09:19:52 +0000 (11:19 +0200)] 
Add extra set of ISC_REFCOUNT_TRACE_{IMPL,DECL} macros

The new ISC_REFCOUNT_TRACE_{IMPL,DECL} macros can be used to add a
reference tracing capability to any unit using the reference counting.
It requires a little bit of extra work in each header as you can't have
a define from inside a define (see rpz.h), but it's fairly easy to add
tracing to any struct using reference counting with these macros.

3 years agoMerge branch '3639-remove-cache_cleaner-from-dns_cache-api' into 'main'
Ondřej Surý [Wed, 30 Nov 2022 06:15:46 +0000 (06:15 +0000)] 
Merge branch '3639-remove-cache_cleaner-from-dns_cache-api' into 'main'

Remove the unused cache cleaning mechanism from dns_cache API

Closes #3639

See merge request isc-projects/bind9!7011

3 years agoAdd CHANGES note for [GL #3639]
Ondřej Surý [Mon, 28 Nov 2022 14:43:31 +0000 (15:43 +0100)] 
Add CHANGES note for [GL #3639]

3 years agoRemove the unused cache cleaning mechanism from dns_cache API
Ondřej Surý [Wed, 2 Nov 2022 10:40:19 +0000 (11:40 +0100)] 
Remove the unused cache cleaning mechanism from dns_cache API

The dns_cache API contained a cache cleaning mechanism that would be
disabled for 'rbt' based cache.  As named doesn't have any other cache
implementations, remove the cache cleaning mechanism from dns_cache API.

3 years agoRemove the dead external cache cleaning mechanism from RBTDB
Ondřej Surý [Wed, 2 Nov 2022 10:40:19 +0000 (11:40 +0100)] 
Remove the dead external cache cleaning mechanism from RBTDB

The RBTDB has own cache cleaning mechanism and therefor the iterator
.cleaning member would never be set to true.  Remove the code that
checks for iterator->cleaning from the RBTDB.

3 years agoMerge branch 'artem-tcp-use-uv_try_write' into 'main'
Artem Boldariev [Tue, 29 Nov 2022 12:47:21 +0000 (12:47 +0000)] 
Merge branch 'artem-tcp-use-uv_try_write' into 'main'

TCP: use uv_try_write() to optimise sends

See merge request isc-projects/bind9!7129

3 years agoTCP: use uv_try_write() to optimise sends
Artem Boldariev [Thu, 10 Nov 2022 19:05:00 +0000 (21:05 +0200)] 
TCP: use uv_try_write() to optimise sends

This commit make TCP code use uv_try_write() on best effort basis,
just like TCP DNS and TLS DNS code does.

This optimisation was added in
'caa5b6548a11da6ca772d6f7e10db3a164a18f8d' but, similar change was
mistakenly omitted for generic TCP code. This commit fixes that.

3 years agoMerge branch 'mnowak/llvm-15' into 'main'
Michal Nowak [Tue, 29 Nov 2022 08:04:22 +0000 (08:04 +0000)] 
Merge branch 'mnowak/llvm-15' into 'main'

Update clang to version 15

See merge request isc-projects/bind9!6754

3 years agoUpdate sources to Clang 15 formatting
Michal Nowak [Wed, 2 Nov 2022 18:33:14 +0000 (19:33 +0100)] 
Update sources to Clang 15 formatting

3 years agoUpdate clang to version 15
Michal Nowak [Thu, 8 Sep 2022 18:47:09 +0000 (20:47 +0200)] 
Update clang to version 15

3 years agoMerge branch '3702-man-page-dig-1-typo-in-options' into 'main'
Mark Andrews [Mon, 28 Nov 2022 22:43:01 +0000 (22:43 +0000)] 
Merge branch '3702-man-page-dig-1-typo-in-options' into 'main'

Resolve "man page dig(1): Typo in options"

Closes #3702

See merge request isc-projects/bind9!7131

3 years agoFix typo in dig man page '+qr' should be '+noqr'
Mark Andrews [Mon, 28 Nov 2022 21:47:18 +0000 (08:47 +1100)] 
Fix typo in dig man page '+qr' should be '+noqr'

Reported by Fabian P. Schmidt

3 years agoMerge branch 'fanf-gen-faster' into 'main'
Tony Finch [Mon, 28 Nov 2022 10:03:44 +0000 (10:03 +0000)] 
Merge branch 'fanf-gen-faster' into 'main'

Speed up lib/dns/gen.c

See merge request isc-projects/bind9!7121

3 years agoSpeed up lib/dns/gen.c
Tony Finch [Thu, 24 Nov 2022 17:38:16 +0000 (17:38 +0000)] 
Speed up lib/dns/gen.c

The `gen` program was causing a lengthy single-threaded pause in
the BIND build. When generating RDATATYPE_FROMTEXT_SW(), `gen` hit
the inner loop of `find_typename()` over 1.2 billion times. This
change avoids long deeply-nested loops, so `gen` now runs in less
than 10ms, about 300x faster.

No changes to the output.

3 years agoMerge branch '3693-crash-when-restarting-server-with-active-statschannel-connection...
Ondřej Surý [Fri, 25 Nov 2022 16:15:08 +0000 (16:15 +0000)] 
Merge branch '3693-crash-when-restarting-server-with-active-statschannel-connection' into 'main'

Be more resilient when destroying the httpd requests

Closes #3693

See merge request isc-projects/bind9!7120

3 years agoAdd CHANGES and release note for [GL #3693]
Ondřej Surý [Wed, 23 Nov 2022 13:23:40 +0000 (14:23 +0100)] 
Add CHANGES and release note for [GL #3693]

3 years agoBe more resilient when destroying the httpd requests
Ondřej Surý [Thu, 24 Nov 2022 14:03:23 +0000 (15:03 +0100)] 
Be more resilient when destroying the httpd requests

Don't restart reading in the send callback after the httpdmgr has been
shut down, and call httpd_request(..., ISC_R_SHUTDOWN, ...) when
shutting down the httpdmgr to reduce code duplication.

3 years agoMerge branch '3696-make-the-read-and-send-callbacks-more-synchronous' into 'main'
Ondřej Surý [Fri, 25 Nov 2022 15:19:51 +0000 (15:19 +0000)] 
Merge branch '3696-make-the-read-and-send-callbacks-more-synchronous' into 'main'

Make the netmgr read callback to be asynchronous only when needed

Closes #3696

See merge request isc-projects/bind9!7119

3 years agoMake the netmgr send callback to be asynchronous only when needed
Ondřej Surý [Thu, 24 Nov 2022 16:11:22 +0000 (17:11 +0100)] 
Make the netmgr send callback to be asynchronous only when needed

Previously, the send callback would be synchronous only on success.  Add
an option (similar to what other callbacks have) to decide whether we
need the asynchronous send callback on a higher level.

On a general level, we need the asynchronous callbacks to happen only
when we are invoking the callback from the public API.  If the path to
the callback went through the libuv callback or netmgr callback, we are
already on asynchronous path, and there's no need to make the call to
the callback asynchronous again.

For the send callback, this means we need the asynchronous path for
failure paths inside the isc_nm_send() (which calls isc__nm_udp_send(),
isc__nm_tcp_send(), etc...) - all other invocations of the send callback
could be synchronous, because those are called from the respective libuv
send callbacks.

3 years agoMake the netmgr read callback to be asynchronous only when needed
Ondřej Surý [Wed, 23 Nov 2022 13:03:23 +0000 (14:03 +0100)] 
Make the netmgr read callback to be asynchronous only when needed

Previously, the read callback would be synchronous only on success or
timeout.  Add an option (similar to what other callbacks have) to decide
whether we need the asynchronous read callback on a higher level.

On a general level, we need the asynchronous callbacks to happen only
when we are invoking the callback from the public API.  If the path to
the callback went through the libuv callback or netmgr callback, we are
already on asynchronous path, and there's no need to make the call to
the callback asynchronous again.

For the read callback, this means we need the asynchronous path for
failure paths inside the isc_nm_read() (which calls isc__nm_udp_read(),
isc__nm_tcp_read(), etc...) - all other invocations of the read callback
could be synchronous, because those are called from the respective libuv
or netmgr read callbacks.

3 years agoMerge branch 'fanf-deduplicate-time-units' into 'main'
Tony Finch [Fri, 25 Nov 2022 13:47:15 +0000 (13:47 +0000)] 
Merge branch 'fanf-deduplicate-time-units' into 'main'

Deduplicate time unit conversion factors

See merge request isc-projects/bind9!7033

3 years agoDeduplicate time unit conversion factors
Tony Finch [Fri, 4 Nov 2022 12:02:33 +0000 (12:02 +0000)] 
Deduplicate time unit conversion factors

The various factors like NS_PER_MS are now defined in a single place
and the names are no longer inconsistent. I chose the _PER_SEC names
rather than _PER_S because it is slightly more clear in isolation;
but the smaller units are always NS, US, and MS.

3 years agoMerge branch 'tkrizek/system-tests-start-stop-helpers' into 'main'
Tom Krizek [Fri, 25 Nov 2022 11:55:55 +0000 (11:55 +0000)] 
Merge branch 'tkrizek/system-tests-start-stop-helpers' into 'main'

Simplify start/stop helper func in system tests

See merge request isc-projects/bind9!7123

3 years agoSimplify start/stop helper func in system tests
Tom Krizek [Thu, 24 Nov 2022 16:42:43 +0000 (17:42 +0100)] 
Simplify start/stop helper func in system tests

The system test should never attempt to start or stop any other server
than those that belong to that system test. Therefore, it is not
necessary to specify the system test name in function calls.

Additionally, this makes it possible to run the test inside a
differently named directory, as its name is automatically detected with
the $SYSTESTDIR variable. This enables running the system tests inside a
temporary directory.

Direct use of stop.pl was replaced with a more systematic approach to
use stop_servers helper function.

3 years agoMerge branch '3638-tls-settings-for-primaries-not-saved-for-catalog-zone-entries...
Mark Andrews [Thu, 24 Nov 2022 22:52:53 +0000 (22:52 +0000)] 
Merge branch '3638-tls-settings-for-primaries-not-saved-for-catalog-zone-entries' into 'main'

Resolve "TLS settings for primaries not saved for catalog zone entries."

Closes #3638

See merge request isc-projects/bind9!7010

3 years agoAdd release note for [GL #3638]
Mark Andrews [Fri, 18 Nov 2022 05:57:47 +0000 (16:57 +1100)] 
Add release note for [GL #3638]

3 years agoAdd CHANGES note for [GL #3638]
Mark Andrews [Fri, 18 Nov 2022 05:54:34 +0000 (16:54 +1100)] 
Add CHANGES note for [GL #3638]

3 years agoAdd catalog zone that requires TLS for all transfers
Mark Andrews [Fri, 18 Nov 2022 04:44:27 +0000 (15:44 +1100)] 
Add catalog zone that requires TLS for all transfers

Both the catalog zone (catalog-tls.example) the zone managed using
the catalog zone (tls1.example) require TLS and a TSIG for zone
transfers.

3 years agoFix log messages incorrectly logged at error
Mark Andrews [Thu, 17 Nov 2022 06:33:15 +0000 (17:33 +1100)] 
Fix log messages incorrectly logged at error

The log message "got TLS configuration for zone transfer" is not
an error, setting to info.

3 years agoTLS setting of primaries with catalog zones where being ignored
Mark Andrews [Wed, 2 Nov 2022 06:55:52 +0000 (06:55 +0000)] 
TLS setting of primaries with catalog zones where being ignored

Extract the tlss values if present from the ipkeylist entry and add
the resulting tls setting to the constructed configuration for the
primary.

When comparing catalog zone entries for reuse also check the
masters.tlss values for equality.

3 years agoMerge branch '3680-remove-nupdates' into 'main'
Evan Hunt [Thu, 24 Nov 2022 00:01:56 +0000 (00:01 +0000)] 
Merge branch '3680-remove-nupdates' into 'main'

remove unused 'nupdates' field from client

Closes #3680

See merge request isc-projects/bind9!7098

3 years agoremove unused 'nupdates' field from client
Evan Hunt [Mon, 21 Nov 2022 06:02:38 +0000 (22:02 -0800)] 
remove unused 'nupdates' field from client

the 'nupdates' field was originally used to track whether a client
was ready to shut down, along with other similar counters nreads,
nrecvs, naccepts and nsends. this is now tracked differently, but
nupdates was overlooked when the other counters were removed.

3 years agoMerge branch '3310-build-contrib-in-ci' into 'main'
Michal Nowak [Wed, 23 Nov 2022 17:14:00 +0000 (17:14 +0000)] 
Merge branch '3310-build-contrib-in-ci' into 'main'

Build contrib in CI & associated fixes

Closes #3310

See merge request isc-projects/bind9!6363

3 years agoHelp gcovr find contrib files
Michal Nowak [Mon, 30 May 2022 19:23:47 +0000 (21:23 +0200)] 
Help gcovr find contrib files

3 years agoAdd install target for Perl DLZ module
Michal Nowak [Mon, 30 May 2022 18:55:30 +0000 (20:55 +0200)] 
Add install target for Perl DLZ module

Perl DLZ module Makefile lacked "install" target, add it as we want to
test DLZ module installation in the CI.

3 years agoDisable compound-token-split-by-macro warning with Clang
Michal Nowak [Mon, 30 May 2022 16:53:09 +0000 (18:53 +0200)] 
Disable compound-token-split-by-macro warning with Clang

Perl DLZ module compilation with Clang produces the following warning:

    /usr/lib/x86_64-linux-gnu/perl/5.32/CORE/zaphod32_hash.h:150:5: warning: '(' and '{' tokens introducing statement expression appear in different macro expansion contexts [-Wcompound-token-split-by-macro]
        ZAPHOD32_SCRAMBLE32(state[0],0x9fade23b);
        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    /usr/lib/x86_64-linux-gnu/perl/5.32/CORE/zaphod32_hash.h:80:38: note: expanded from macro 'ZAPHOD32_SCRAMBLE32'
    #define ZAPHOD32_SCRAMBLE32(v,prime) STMT_START {  \
                                         ^~~~~~~~~~
    /usr/lib/x86_64-linux-gnu/perl/5.32/CORE/perl.h:666:29: note: expanded from macro 'STMT_START'
    #   define STMT_START   (void)( /* gcc supports "({ STATEMENTS; })" */
                                  ^
    /usr/lib/x86_64-linux-gnu/perl/5.32/CORE/zaphod32_hash.h:150:5: note: '{' token is here
        ZAPHOD32_SCRAMBLE32(state[0],0x9fade23b);
        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    /usr/lib/x86_64-linux-gnu/perl/5.32/CORE/zaphod32_hash.h:80:49: note: expanded from macro 'ZAPHOD32_SCRAMBLE32'
    #define ZAPHOD32_SCRAMBLE32(v,prime) STMT_START {  \
                                                    ^

3 years agoBuild contrib dlz modules in the CI
Michal Nowak [Mon, 30 May 2022 14:20:53 +0000 (16:20 +0200)] 
Build contrib dlz modules in the CI

3 years agoLeverage CFLAGS from environment in contrib Makefiles
Michal Nowak [Mon, 30 May 2022 13:50:15 +0000 (15:50 +0200)] 
Leverage CFLAGS from environment in contrib Makefiles

3 years agoFix statement may fall through warnings in dlz_ldap_dynamic.c
Michal Nowak [Mon, 30 May 2022 13:49:34 +0000 (15:49 +0200)] 
Fix statement may fall through warnings in dlz_ldap_dynamic.c

    dlz_ldap_dynamic.c: In function ‘dlz_create’:
    dlz_ldap_dynamic.c:971:20: warning: this statement may fall through [-Wimplicit-fallthrough=]
      971 |                 if (result != ISC_R_SUCCESS) {
          |                    ^
    dlz_ldap_dynamic.c:974:9: note: here
      974 |         case 11:
          |         ^~~~
    dlz_ldap_dynamic.c:976:20: warning: this statement may fall through [-Wimplicit-fallthrough=]
      976 |                 if (result != ISC_R_SUCCESS) {
          |                    ^
    dlz_ldap_dynamic.c:979:9: note: here
      979 |         case 10:
          |         ^~~~
    dlz_ldap_dynamic.c:980:20: warning: this statement may fall through [-Wimplicit-fallthrough=]
      980 |                 if (strlen(argv[9]) > 0) {
          |                    ^
    dlz_ldap_dynamic.c:987:9: note: here
      987 |         case 9:
          |         ^~~~

3 years agoFix compilation warnings in dlz_wildcard_dynamic.c
Michal Nowak [Mon, 30 May 2022 13:42:16 +0000 (15:42 +0200)] 
Fix compilation warnings in dlz_wildcard_dynamic.c

    dlz_wildcard_dynamic.c: In function ‘dlz_lookup’:
    dlz_wildcard_dynamic.c:227:14: warning: variable ‘origin’ set but not used [-Wunused-but-set-variable]
      227 |         bool origin = true;
          |              ^~~~~~
    dlz_wildcard_dynamic.c: In function ‘dlz_lookup’:
    dlz_wildcard_dynamic.c:252:28: warning: assignment discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
      252 |                 cd->record = "@";
          |                            ^
    dlz_wildcard_dynamic.c: In function ‘dlz_authority’:
    dlz_wildcard_dynamic.c:328:22: warning: unused variable ‘origin’ [-Wunused-variable]
      328 |                 bool origin;
          |                      ^~~~~~
    dlz_wildcard_dynamic.c:312:25: warning: unused variable ‘name’ [-Wunused-variable]
      312 |         const char *p, *name = "@";
          |                         ^~~~
    dlz_wildcard_dynamic.c: In function ‘dlz_create’:
    dlz_wildcard_dynamic.c:441:23: warning: comparison of integer expressions of different signedness: ‘int’ and ‘unsigned int’ [-Wsign-compare]
      441 |         for (i = 4; i < argc; i += 4) {
          |                       ^

3 years agoFix compilation warnings in dlz_sqlite3_dynamic.c
Michal Nowak [Mon, 30 May 2022 13:23:45 +0000 (15:23 +0200)] 
Fix compilation warnings in dlz_sqlite3_dynamic.c

    dlz_sqlite3_dynamic.c: In function ‘dlz_sqlite3_fetch_row’:
    dlz_sqlite3_dynamic.c:447:31: warning: comparison of integer expressions of different signedness: ‘int’ and ‘unsigned int’ [-Wsign-compare]
      447 |                 if (rs->pnRow > 0U && rs->curRow < rs->pnRow) {
          |                               ^
    dlz_sqlite3_dynamic.c:447:50: warning: comparison of integer expressions of different signedness: ‘unsigned int’ and ‘int’ [-Wsign-compare]
      447 |                 if (rs->pnRow > 0U && rs->curRow < rs->pnRow) {
          |                                                  ^

3 years agoFix warnings in dlz_mysqldyn_mod.c
Michal Nowak [Mon, 30 May 2022 12:36:49 +0000 (14:36 +0200)] 
Fix warnings in dlz_mysqldyn_mod.c

    dlz_mysqldyn_mod.c: In function ‘dlz_findzonedb’:
    dlz_mysqldyn_mod.c:1079:73: warning: unused parameter ‘methods’ [-Wunused-parameter]
     1079 | dlz_findzonedb(void *dbdata, const char *name, dns_clientinfomethods_t *methods,
          |                                                ~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~
    dlz_mysqldyn_mod.c:1080:34: warning: unused parameter ‘clientinfo’ [-Wunused-parameter]
     1080 |                dns_clientinfo_t *clientinfo) {
          |                ~~~~~~~~~~~~~~~~~~^~~~~~~~~~
    dlz_mysqldyn_mod.c: In function ‘dlz_lookup’:
    dlz_mysqldyn_mod.c:1111:63: warning: unused parameter ‘methods’ [-Wunused-parameter]
     1111 |            dns_sdlzlookup_t *lookup, dns_clientinfomethods_t *methods,
          |                                      ~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~
    dlz_mysqldyn_mod.c: In function ‘build_query’:
    dlz_mysqldyn_mod.c:465:19: warning: pointer ‘item’ used after ‘free’ [-Wuse-after-free]
      465 |              item = DLZ_LIST_NEXT(item, link))
    dlz_mysqldyn_mod.c:470:17: note: call to ‘free’ here
      470 |                 free(item);
          |                 ^~~~~~~~~~

3 years agoFix compilation warnings in dlz_perl_driver.c
Michal Nowak [Mon, 30 May 2022 10:36:27 +0000 (12:36 +0200)] 
Fix compilation warnings in dlz_perl_driver.c

    dlz_perl_driver.c: In function ‘dlz_version’:
    dlz_perl_driver.c:116:27: warning: unused parameter ‘flags’ [-Wunused-parameter]
      116 | dlz_version(unsigned int *flags) {
          |             ~~~~~~~~~~~~~~^~~~~
    In file included from /usr/lib64/perl5/CORE/perl.h:5685,
                     from dlz_perl_driver.c:33:
    dlz_perl_driver.c: In function ‘dlz_allnodes’:
    /usr/lib64/perl5/CORE/pp.h:162:26: warning: value computed is not used [-Wunused-value]
      162 | #define POPs            (*sp--)
          |                         ~^~~~~~
    dlz_perl_driver.c:151:17: note: in expansion of macro ‘POPs’
      151 |                 POPs;
          |                 ^~~~
    dlz_perl_driver.c: In function ‘dlz_allowzonexfr’:
    /usr/lib64/perl5/CORE/pp.h:162:26: warning: value computed is not used [-Wunused-value]
      162 | #define POPs            (*sp--)
          |                         ~^~~~~~
    dlz_perl_driver.c:251:17: note: in expansion of macro ‘POPs’
      251 |                 POPs;
          |                 ^~~~
    dlz_perl_driver.c: In function ‘dlz_findzonedb’:
    /usr/lib64/perl5/CORE/pp.h:162:26: warning: value computed is not used [-Wunused-value]
      162 | #define POPs            (*sp--)
          |                         ~^~~~~~
    dlz_perl_driver.c:328:17: note: in expansion of macro ‘POPs’
      328 |                 POPs;
          |                 ^~~~
    dlz_perl_driver.c: In function ‘dlz_lookup’:
    /usr/lib64/perl5/CORE/pp.h:162:26: warning: value computed is not used [-Wunused-value]
      162 | #define POPs            (*sp--)
          |                         ~^~~~~~
    dlz_perl_driver.c:407:17: note: in expansion of macro ‘POPs’
      407 |                 POPs;
          |                 ^~~~
    dlz_perl_driver.c:472:1: error: no previous prototype for ‘missing_perl_method’ [-Werror=missing-prototypes]
      472 | missing_perl_method(const char *perl_class_name, PerlInterpreter *my_perl)
          | ^~~~~~~~~~~~~~~~~~~
    dlz_perl_driver.c: In function ‘missing_perl_method’:
    dlz_perl_driver.c:485:9: error: ISO C90 forbids array ‘full_name’ whose size cannot be evaluated [-Werror=vla]
      485 |         char full_name[BUF_LEN];
          |         ^~~~
    dlz_perl_driver.c: In function ‘dlz_create’:
    dlz_perl_driver.c:613:13: warning: suggest parentheses around assignment used as truth value [-Wparentheses]
      613 |         if (missing_method_name = missing_perl_method(perl_class_name, my_perl))
          |             ^~~~~~~~~~~~~~~~~~~
    /usr/lib64/perl5/CORE/pp.h:162:26: warning: value computed is not used [-Wunused-value]
      162 | #define POPs            (*sp--)
          |                         ~^~~~~~
    dlz_perl_driver.c:657:17: note: in expansion of macro ‘POPs’
      657 |                 POPs;
          |                 ^~~~
    dlz_perl_driver.c:502:15: warning: unused variable ‘init_args’ [-Wunused-variable]
      502 |         char *init_args[] = { NULL, NULL };
          |               ^~~~~~~~~

3 years agoMerge branch 'mnowak/gcovr-cleanup' into 'main'
Michal Nowak [Wed, 23 Nov 2022 14:03:27 +0000 (14:03 +0000)] 
Merge branch 'mnowak/gcovr-cleanup' into 'main'

Various gcovr clean-ups

See merge request isc-projects/bind9!7104

3 years agoRestructure inline-function helpers for code coverage
Michal Nowak [Mon, 21 Nov 2022 16:34:50 +0000 (17:34 +0100)] 
Restructure inline-function helpers for code coverage

3 years agoDrop redundant code coverage helper
Michal Nowak [Mon, 21 Nov 2022 16:26:44 +0000 (17:26 +0100)] 
Drop redundant code coverage helper

The "hash.h" file does not need to be copied to "lib/dns/" for the gcovr
tool to generate the code coverage report, as it has been copied
already.

3 years agoDrop buffer.h helper for fuzz directory
Michal Nowak [Mon, 21 Nov 2022 16:20:37 +0000 (17:20 +0100)] 
Drop buffer.h helper for fuzz directory

The "fuzz" directory is no longer included in the code coverage report
and the associated buffer.h helper is no longer needed.

3 years agoExclude fuzz directory from code coverage report
Michal Nowak [Fri, 18 Nov 2022 12:30:32 +0000 (13:30 +0100)] 
Exclude fuzz directory from code coverage report

gcovr fails to process fuzz/old.gcda and fuzz/old.gcno files after !7045
MR with:

    (WARNING) GCOV produced the following errors processing /builds/isc-projects/bind9/fuzz/old.gcda:
     Cannot open source file ../../fuzz/old.c
    Cannot open source file ../../lib/dns/include/dns/compress.h
    Cannot open source file ../../lib/isc/include/isc/buffer.h
    ...
    (gcovr could not infer a working directory that resolved it.)

Given that code coverage inspection is meant only for BIND 9 code and
not its tests and auxiliary tools, the "fuzz" directory should be
excluded from being included in the code coverage report.

3 years agoMerge branch '3667-deprecate-auto-dnssec' into 'main'
Matthijs Mekking [Wed, 23 Nov 2022 10:00:33 +0000 (10:00 +0000)] 
Merge branch '3667-deprecate-auto-dnssec' into 'main'

Deprecate auto-dnssec

Closes #3667

See merge request isc-projects/bind9!7075

3 years agoAdd CHANGES and release note for GL #3667
Matthijs Mekking [Fri, 11 Nov 2022 13:43:36 +0000 (14:43 +0100)] 
Add CHANGES and release note for GL #3667

Announce deprecation of 'auto-dnssec'.

3 years agoDeprecate auto-dnssec
Matthijs Mekking [Fri, 11 Nov 2022 13:39:07 +0000 (14:39 +0100)] 
Deprecate auto-dnssec

Deprecate auto-dnssec, add specific log warning to migrate to
dnssec-policy.

3 years agoMerge branch 'mnowak/fedora-37' into 'main'
Michal Nowak [Mon, 21 Nov 2022 12:46:52 +0000 (12:46 +0000)] 
Merge branch 'mnowak/fedora-37' into 'main'

Add Fedora 37

See merge request isc-projects/bind9!7062

3 years agoAdd Fedora 37
Michal Nowak [Tue, 8 Nov 2022 19:04:02 +0000 (20:04 +0100)] 
Add Fedora 37

3 years agoMerge branch 'matthijs-remove-key-operations-after-update' into 'main'
Matthijs Mekking [Fri, 18 Nov 2022 10:24:35 +0000 (10:24 +0000)] 
Merge branch 'matthijs-remove-key-operations-after-update' into 'main'

Remove dynamic update DNSSEC management

Closes #3686

See merge request isc-projects/bind9!7043

3 years agoAdd CHANGES and release note for removed feature
Matthijs Mekking [Mon, 7 Nov 2022 13:47:33 +0000 (14:47 +0100)] 
Add CHANGES and release note for removed feature

Also mention that 'dnssec-secure-to-insecure' is obsoleted.

3 years agoObsolete dnssec-secure-to-insecure option
Matthijs Mekking [Mon, 7 Nov 2022 13:40:28 +0000 (14:40 +0100)] 
Obsolete dnssec-secure-to-insecure option

Now that the key management operations using dynamic updates feature
has been removed, the 'dnssec-secure-to-insecure' option has become
obsoleted.

3 years agoRemove dynamic update key management documentation
Matthijs Mekking [Mon, 7 Nov 2022 12:40:41 +0000 (13:40 +0100)] 
Remove dynamic update key management documentation

Remove the text from the ARM and DNSSEC guide that describes how to do
key and denial of existence operations using dynamic update. Add a new
section about DNSSEC multi-signer models, but no longer suggest using
dynamic update and auto-dnssec allow.

3 years agoRemove dynamic update key management code
Matthijs Mekking [Mon, 7 Nov 2022 12:31:34 +0000 (13:31 +0100)] 
Remove dynamic update key management code

Remove code that triggers key and denial of existence management
operations. Dynamic update should no longer be used to do DNSSEC
maintenance (other than that of course signatures need to be
created for the new zone contents).

3 years agoRemove dynamic update key management tests
Matthijs Mekking [Mon, 7 Nov 2022 12:24:08 +0000 (13:24 +0100)] 
Remove dynamic update key management tests

Remove test cases that rely upon key and denial of existence
management operations triggered by dynamic updates.

The autosign system test needed a bit more care than just removing
because the test cases are dependent on each other, so there are some
additional tweaks such as setting the NSEC3PARAM via rndc signing,
and renaming zone input files. In the process, some additional
debug output files have been added, and a 'ret' fail case overwrite
was fixed.

3 years agoMerge branch '3655-decompress-faster' into 'main'
Tony Finch [Thu, 17 Nov 2022 09:06:12 +0000 (09:06 +0000)] 
Merge branch '3655-decompress-faster' into 'main'

Simplify and speed up DNS name decompression

Closes #3655

See merge request isc-projects/bind9!7045

3 years agoFuzzing and benchmarking for dns_name_fromwire()
Tony Finch [Mon, 7 Nov 2022 16:22:48 +0000 (16:22 +0000)] 
Fuzzing and benchmarking for dns_name_fromwire()

Since this is very sensitive code which has often had security
problems in many DNS implementations, it needs a decent amount of
validation. This fuzzer ensures that the new code has the same output
as the old code, and that it doesn't take longer than a second.

The benchmark uses the fuzzer's copy of the old dns_name_fromwire()
code to compare a number of scenarios: many compression pointers, many
labels, long labels, random data, with/without downcasing.

3 years agoSimplify and speed up DNS name decompression
Tony Finch [Mon, 7 Nov 2022 14:00:45 +0000 (14:00 +0000)] 
Simplify and speed up DNS name decompression

The aim is to do less work per byte:

  * Check the bounds for each label, instead of checking the
    bounds for each character.

  * Instead of copying one character at a time from the wire to
    the name, copy entire runs of sequential labels using memmove()
    to make the most of its fast loop.

  * To remember where the name ends, we only need to set the end
    marker when we see a compression pointer or when we reach the
    root label. There is no need to check if we jumped back and
    conditionally update the counter for every character.

  * To parse a compression pointer, we no longer take a diversion
    around the outer loop in between reading the upper byte of the
    pointer and the lower byte.

  * The parser state machine is now implicit in the instruction
    pointer, instead of being an explicit variable. Similarly,
    when we reach the root label we break directly out of the loop
    instead of setting a second state machine variable.

  * DNS_NAME_DOWNCASE is never used with dns_name_fromwire() so
    that option is no longer supported.

I have removed this comment which dated from January 1999 when
dns_name_fromwire() was first introduced:

   /*
    * Note:  The following code is not optimized for speed, but
    * rather for correctness.  Speed will be addressed in the future.
    */

No functional change, apart from removing support for the unused
DNS_NAME_DOWNCASE option. The new code is about 2x faster than the
old code: best case 11x faster, worst case 1.4x faster.

3 years agoClean up remnants of label types
Tony Finch [Wed, 9 Nov 2022 16:51:34 +0000 (16:51 +0000)] 
Clean up remnants of label types

There were a few comments referring obliquely to different kinds of
labels, which became obsolete a long time ago.

3 years agoAvoid unspecified behaviour in name_test
Tony Finch [Wed, 9 Nov 2022 17:32:05 +0000 (17:32 +0000)] 
Avoid unspecified behaviour in name_test

C does not make any guarantees about the value of padding in a
structure, so bytewise comparison of two semantically equal structures
with padding can be spuriously non-equal due to non-equal padding
bytes.

Compare each member of name.attributes individually to avoid this
problem.

3 years agoMerge branch '3607-apex-in-name_external-may-be-invalid-when-using-dual-stack-servers...
Mark Andrews [Thu, 17 Nov 2022 01:50:10 +0000 (01:50 +0000)] 
Merge branch '3607-apex-in-name_external-may-be-invalid-when-using-dual-stack-servers' into 'main'

Resolve "apex in name_external may be invalid when using dual stack servers"

Closes #3607

See merge request isc-projects/bind9!6924

3 years agoAdd CHANGES note for [GL #3607]
Mark Andrews [Mon, 17 Oct 2022 23:46:48 +0000 (10:46 +1100)] 
Add CHANGES note for [GL #3607]

3 years agoAdd system test for dual-stack-servers with possible DNAME response
Mark Andrews [Wed, 19 Oct 2022 05:53:11 +0000 (16:53 +1100)] 
Add system test for dual-stack-servers with possible DNAME response

Create a zone that triggers DNAME owner name checks in a zone that
is only reachable using a dual stack server.  The answer contains
a name that is higher in the tree than the query name.

e.g.
foo.v4only.net. CNAME v4only.net.
v4only.net. A 10.0.0.1

ns4 is serving the test zone (ipv4-only)
ns6 is the root server for this test (dual stacked)
ns7 is acting as the dual stack server (dual stacked)
ns9 is the server under test (ipv6-only)

3 years agoSupport starting and stopping IPv6 only servers
Mark Andrews [Tue, 18 Oct 2022 01:19:35 +0000 (12:19 +1100)] 
Support starting and stopping IPv6 only servers

Look for $testdir/$server/named.ipv6-only and use
fd92:7065:b8e:ffff::$n instead of 10.53.0.$n to
communicate with the server.

3 years agoSelect the appropriate namespace when using a dual stack server
Mark Andrews [Mon, 17 Oct 2022 23:02:08 +0000 (10:02 +1100)] 
Select the appropriate namespace when using a dual stack server

When using dual-stack-servers the covering namespace to check whether
answers are in scope or not should be fctx->domain.  To do this we need
to be able to distingish forwarding due to forwarders clauses and
dual-stack-servers.  A new flag FCTX_ADDRINFO_DUALSTACK has been added
to signal this.