]> git.ipfire.org Git - thirdparty/bind9.git/log
thirdparty/bind9.git
3 years agoDefine DNS_NAME_MAXLABELS and DNS_NAME_LABELLEN
Tony Finch [Fri, 24 Feb 2023 08:10:20 +0000 (08:10 +0000)] 
Define DNS_NAME_MAXLABELS and DNS_NAME_LABELLEN

Some qp-trie operations will need to know the maximum number of labels
in a name, so I wanted a standard macro definition with the right
value.

Replace DNS_MAX_LABELS from <dns/resolver.h with DNS_NAME_MAXLABELS in
<dns/name.h>, and add its counterpart DNS_NAME_LABELLEN.

Use these macros in `name.c` and `resolver.c`.

Fix an off-by-one error in an assertion in `dns_name_countlabels()`.

3 years agoMerge branch '3777-fix-crash-after-failed-ixfr-from-differences' into 'main'
Arаm Sаrgsyаn [Mon, 27 Feb 2023 11:25:00 +0000 (11:25 +0000)] 
Merge branch '3777-fix-crash-after-failed-ixfr-from-differences' into 'main'

Resolve "crash after failed ixfr-from-differences on a catalog zone"

Closes #3777

See merge request isc-projects/bind9!7431

3 years agoAdd a CHANGES note for [GL #3777]
Aram Sargsyan [Fri, 27 Jan 2023 09:38:33 +0000 (09:38 +0000)] 
Add a CHANGES note for [GL #3777]

3 years agocatz: unregister the db update-notify callback before detaching from db
Aram Sargsyan [Fri, 27 Jan 2023 08:47:52 +0000 (08:47 +0000)] 
catz: unregister the db update-notify callback before detaching from db

When detaching from the previous version of the database, make sure
that the update-notify callback is unregistered, otherwise there is
an INSIST check which can generate an assertion failure in free_rbtdb(),
which checks that there are no outstanding update listeners in the list.

There is a similar code already in place for RPZ.

3 years agoSearching catzs->zones requires a read lock
Aram Sargsyan [Fri, 27 Jan 2023 18:04:41 +0000 (18:04 +0000)] 
Searching catzs->zones requires a read lock

Lock the catzs->lock mutex before searching in the catzs->zones
hash table.

3 years agoProcess db callbacks in zone_loaddone() after zone_postload()
Aram Sargsyan [Thu, 26 Jan 2023 19:08:19 +0000 (19:08 +0000)] 
Process db callbacks in zone_loaddone() after zone_postload()

The zone_postload() function can fail and unregister the callbacks.

Call dns_db_endload() only after calling zone_postload() to make
sure that the registered update-notify callbacks are not called
when the zone loading has failed during zone_postload().

Also, don't ignore the return value of zone_postload().

3 years agoAdd a system test for [GL #3777]
Aram Sargsyan [Fri, 27 Jan 2023 09:22:11 +0000 (09:22 +0000)] 
Add a system test for [GL #3777]

Add the 'ixfr-from-differences yes;' option to trigger a failed
zone postload operation when a zone is updated but the serial
number is not updated, then issue two successive 'rndc reload'
commands to trigger the bug, which causes an assertion failure.

3 years agoMerge branch '3895-memory-leak-in-isc_hmac_init' into 'main'
Mark Andrews [Sun, 26 Feb 2023 23:17:35 +0000 (23:17 +0000)] 
Merge branch '3895-memory-leak-in-isc_hmac_init' into 'main'

Resolve "memory leak in isc_hmac_init"

Closes #3895

See merge request isc-projects/bind9!7588

3 years agoFix memory leak in isc_hmac_init
Mark Andrews [Fri, 24 Feb 2023 01:57:39 +0000 (12:57 +1100)] 
Fix memory leak in isc_hmac_init

If EVP_DigestSignInit failed 'pkey' was not freed.

3 years agoMerge branch 'aram/catz-do-not-destroy-catzs-before-catz' into 'main'
Arаm Sаrgsyаn [Fri, 24 Feb 2023 20:31:08 +0000 (20:31 +0000)] 
Merge branch 'aram/catz-do-not-destroy-catzs-before-catz' into 'main'

Make sure catz->catzs isn't destroyed before catz

See merge request isc-projects/bind9!7603

3 years agoMake sure catz->catzs isn't destroyed before catz
Aram Sargsyan [Fri, 24 Feb 2023 19:17:09 +0000 (19:17 +0000)] 
Make sure catz->catzs isn't destroyed before catz

Call dns_catz_unref_catzs() only after detaching 'catz'.

3 years agoMerge branch '3881-catz-offload' into 'main'
Ondřej Surý [Fri, 24 Feb 2023 16:11:58 +0000 (16:11 +0000)] 
Merge branch '3881-catz-offload' into 'main'

Resolve "Run the catalog zone update as an offloaded work"

Closes #3881

See merge request isc-projects/bind9!7560

3 years agoAdd CHANGES and release notes for [GL #3881]
Aram Sargsyan [Tue, 21 Feb 2023 14:39:27 +0000 (14:39 +0000)] 
Add CHANGES and release notes for [GL #3881]

3 years agoPause the catz dbiterator while processing the zone
Ondřej Surý [Thu, 23 Feb 2023 10:10:39 +0000 (11:10 +0100)] 
Pause the catz dbiterator while processing the zone

The dbiterator read-locks the whole zone and it stayed locked during
whole processing time when catz is being read.  Pause the iterator, so
the updates to catz zone are not being blocked while processing the catz
update.

3 years agoUnlock catzs during dns__catz_update_cb()
Ondřej Surý [Fri, 24 Feb 2023 09:46:00 +0000 (09:46 +0000)] 
Unlock catzs during dns__catz_update_cb()

Instead of holding the catzs->lock the whole time we process the catz
update, only hold it for hash table lookup and then release it.  This
should unblock any other threads that might be processing updates to
catzs triggered by extra incoming transfer.

3 years agoOffload catalog zone updates
Aram Sargsyan [Tue, 21 Feb 2023 14:23:38 +0000 (14:23 +0000)] 
Offload catalog zone updates

Offload catalog zone processing so that the network manager threads
are not interrupted by a large catalog zone update.

Introduce a new 'updaterunning' state alongside with 'updatepending',
like it is done in the RPZ module.

Note that the dns__catz_update_cb() function currently holds the
catzs->lock during the whole process, which is far from being optimal,
but the issue is going to be addressed separately.

3 years agoMerge branch 'aram/catz-add-shutdown-signaling' into 'main'
Ondřej Surý [Fri, 24 Feb 2023 14:08:20 +0000 (14:08 +0000)] 
Merge branch 'aram/catz-add-shutdown-signaling' into 'main'

Add shutdown signaling for catalog zones

See merge request isc-projects/bind9!7602

3 years agoAdd a CHANGES note for [GL !7571]
Aram Sargsyan [Tue, 21 Feb 2023 21:20:56 +0000 (21:20 +0000)] 
Add a CHANGES note for [GL !7571]

3 years agoAdd shutdown signaling for catalog zones
Aram Sargsyan [Tue, 21 Feb 2023 21:14:44 +0000 (21:14 +0000)] 
Add shutdown signaling for catalog zones

This change should make sure that catalog zone update processing
doesn't happen when the catalog zone is being shut down. This
should help avoid races when offloading the catalog zone updates
in the follow-up commit.

3 years agoMerge branch 'aram/catz-light-refactoring-and-reference-count-tracing' into 'main'
Ondřej Surý [Fri, 24 Feb 2023 14:06:06 +0000 (14:06 +0000)] 
Merge branch 'aram/catz-light-refactoring-and-reference-count-tracing' into 'main'

Implement reference count tracing for dns_catz_zone_t and dns_catz_zones_t

See merge request isc-projects/bind9!7570

3 years agoAdd a CHANGES note for [GL !7570]
Aram Sargsyan [Tue, 21 Feb 2023 21:10:17 +0000 (21:10 +0000)] 
Add a CHANGES note for [GL !7570]

3 years agoCall dns_catz_new_zones() only when it is needed
Aram Sargsyan [Thu, 23 Feb 2023 14:43:41 +0000 (14:43 +0000)] 
Call dns_catz_new_zones() only when it is needed

The configure_catz() function creates the catalog zones structure
for the view even when it is not needed, in which case it then
discards it (by detaching) later.

Instead, call dns_catz_new_zones() only when it is needed, i.e. when
there is no existing "previous" view with an existing 'catzs', that
is going to be reused.

3 years agoAdd reference count tracing for dns_catz_zone_t and dns_catz_zones_t
Aram Sargsyan [Tue, 21 Feb 2023 14:11:04 +0000 (14:11 +0000)] 
Add reference count tracing for dns_catz_zone_t and dns_catz_zones_t

Tracing can be activated by defining DNS_RPZ_TRACE in catz.h.

3 years agoLight refactoring of catz.c
Aram Sargsyan [Thu, 9 Feb 2023 10:32:33 +0000 (10:32 +0000)] 
Light refactoring of catz.c

* Change 'dns_catz_new_zones()' function's prototype (the order of the
  arguments) to synchronize it with the similar function in rpz.c.
* Rename 'refs' to 'references' in preparation of ISC_REFCOUNT_*
  macros usage for reference tracking.
* Unify dns_catz_zone_t naming to catz, and dns_catz_zones_t naming to
  catzs, following the logic of similar changes in rpz.c.
* Use C compound literals for structure initialization.
* Synchronize the "new zone version came too soon" log message with the
  one in rpz.c.
* Use more of 'sizeof(*ptr)' style instead of the 'sizeof(type_t)' style
  expressions when allocating or freeing memory for 'ptr'.

3 years agoMerge branch 'mnowak/freebsd-12.4' into 'main'
Michal Nowak [Fri, 24 Feb 2023 12:58:38 +0000 (12:58 +0000)] 
Merge branch 'mnowak/freebsd-12.4' into 'main'

Add FreeBSD 12.4

See merge request isc-projects/bind9!7169

3 years agoAdd FreeBSD 12.4
Michal Nowak [Tue, 6 Dec 2022 16:58:47 +0000 (17:58 +0100)] 
Add FreeBSD 12.4

3 years agoMerge branch 'mnowak/alpine-3.17' into 'main'
Michal Nowak [Fri, 24 Feb 2023 11:46:50 +0000 (11:46 +0000)] 
Merge branch 'mnowak/alpine-3.17' into 'main'

Add Alpine Linux 3.17

See merge request isc-projects/bind9!7586

3 years agoDrop date from "Regularly Tested Platforms" section
Michal Nowak [Tue, 3 Jan 2023 10:08:37 +0000 (11:08 +0100)] 
Drop date from "Regularly Tested Platforms" section

Changing the date is easy to forget and may be outdated.

3 years agoAdd Alpine Linux 3.17
Michal Nowak [Wed, 25 Jan 2023 15:55:46 +0000 (16:55 +0100)] 
Add Alpine Linux 3.17

3 years agoMerge branch 'fanf-prune-libirs' into 'main'
Tony Finch [Fri, 24 Feb 2023 10:01:05 +0000 (10:01 +0000)] 
Merge branch 'fanf-prune-libirs' into 'main'

Move irs_resconf into libdns and remove libirs

See merge request isc-projects/bind9!7463

3 years agoMove irs_resconf into libdns and remove libirs
Tony Finch [Fri, 16 Dec 2022 12:19:08 +0000 (12:19 +0000)] 
Move irs_resconf into libdns and remove libirs

`libirs` used to be a reference implementation of `getaddrinfo` and
related modern resolver APIs. It was stripped down in BIND 9.18
leaving only the `irs_resconf` module, which parses
`/etc/resolv.conf`. I have kept its include path and namespace prefix,
so it remains a little fragment of libirs now embedded in libdns.

3 years agoMerge branch 'ondrej-restore-sonarcloud-analysis' into 'main'
Ondřej Surý [Fri, 24 Feb 2023 08:53:45 +0000 (08:53 +0000)] 
Merge branch 'ondrej-restore-sonarcloud-analysis' into 'main'

Add SonarCloud GitHub Action

See merge request isc-projects/bind9!7589

3 years agoAdd SonarCloud GitHub Action
Ondřej Surý [Fri, 24 Feb 2023 07:41:51 +0000 (08:41 +0100)] 
Add SonarCloud GitHub Action

Add new SonarCloud GitHub Action and configuration; something (maybe
the way the builds were submitted) has apparently changed and the
project got deleted and the analysis wasn't working.

3 years agoMerge branch '3886-xfrin-dispatch' into 'main'
Evan Hunt [Fri, 24 Feb 2023 08:30:48 +0000 (08:30 +0000)] 
Merge branch '3886-xfrin-dispatch' into 'main'

refactor dns_xfrin to use dns_dispatch

Closes #3886

See merge request isc-projects/bind9!7573

3 years agoCHANGES for [GL #3886]
Evan Hunt [Wed, 22 Feb 2023 06:00:52 +0000 (22:00 -0800)] 
CHANGES for [GL #3886]

3 years agofix a bug in dns_dispatch_getnext()
Evan Hunt [Wed, 22 Feb 2023 19:04:12 +0000 (11:04 -0800)] 
fix a bug in dns_dispatch_getnext()

when a message arrives over a TCP connection matching an expected
QID, the dispatch is updated so it no longer expects that QID,
but continues reading. subsequent messages with the same QID are
ignored, unless the dispatch entry has called dns_dispatch_getnext()
or dns_dispatch_resume().

however, a coding error caused those functions to have no effect
when the dispatch was reading, so streams of messages with the same
QID could not be received over a single TCP connection, breaking *XFR.

this has been corrected by changing the order of operations in
tcp_dispatch_getnext() so that disp->reading isn't checked until
after the dispatch entry has been reactivated.

3 years agorefactor dns_xfrin to use dns_dispatch
Evan Hunt [Wed, 22 Feb 2023 04:14:30 +0000 (20:14 -0800)] 
refactor dns_xfrin to use dns_dispatch

the dns_xfrin module was still using the network manager directly to
manage TCP connections and send and receive messages.  this commit
changes it to use the dispatch manager instead.

3 years agoimplement refcount tracing in xfrin.c
Evan Hunt [Thu, 23 Feb 2023 18:29:33 +0000 (10:29 -0800)] 
implement refcount tracing in xfrin.c

use ISC_REFCOUNT_IMPL for dns_xfrin_ctx_t (which has been renamed
to dns_xfrin_t to keep the function names dns_xfrin_attach() and
dns_xfrin_detach() unchanged).

3 years agominor cleanups in dispatch.c
Evan Hunt [Wed, 22 Feb 2023 04:14:30 +0000 (20:14 -0800)] 
minor cleanups in dispatch.c

- simplified tcp_startrecv()
- removed a short function that was only called once
- removed an unnecessary if statement

3 years agolog the xfrin pointer address in xfrin_log()
Evan Hunt [Wed, 22 Feb 2023 05:09:05 +0000 (21:09 -0800)] 
log the xfrin pointer address in xfrin_log()

to make it easier to trace xfrin events in the log, include
the address of the dns_xfrin_t object in all xfrin log messages.

3 years agoremove dead code in dns_request
Evan Hunt [Wed, 22 Feb 2023 02:15:55 +0000 (18:15 -0800)] 
remove dead code in dns_request

the 'connected' variable in 'dns_request_create()` was always false.

3 years agomove dispatchmgr from resolver to view
Evan Hunt [Wed, 22 Feb 2023 00:34:41 +0000 (16:34 -0800)] 
move dispatchmgr from resolver to view

the 'dispatchmgr' member of the resolver object is used by both
the dns_resolver and dns_request modules, and may in the future
be used by others such as dns_xfrin. it doesn't make sense for it
to live in the resolver object; this commit moves it into dns_view.

3 years agoMerge branch 'mnowak/update_TEST_PARALLEL_JOBS_for_BSD' into 'main'
Michal Nowak [Fri, 24 Feb 2023 08:16:14 +0000 (08:16 +0000)] 
Merge branch 'mnowak/update_TEST_PARALLEL_JOBS_for_BSD' into 'main'

Disable OpenBSD system test parallelism in CI

See merge request isc-projects/bind9!7585

3 years agoDisable OpenBSD system test parallelism in CI
Michal Nowak [Wed, 22 Feb 2023 10:42:36 +0000 (11:42 +0100)] 
Disable OpenBSD system test parallelism in CI

Make OpenBSD system tests more stable by disabling parallelism in CI.

Accordingly, they will run 3-4 times longer.

3 years agoDo not set TEST_PARALLEL_JOBS in FreeBSD system test
Michal Nowak [Wed, 22 Feb 2023 10:38:45 +0000 (11:38 +0100)] 
Do not set TEST_PARALLEL_JOBS in FreeBSD system test

Setting TEST_PARALLEL_JOBS to 4 in FreeBSD system test jobs is a no-op
because it's already set to 4, one level above, on the global level.

3 years agoMerge branch 'fanf-qsbr' into 'main'
Tony Finch [Thu, 23 Feb 2023 16:43:56 +0000 (16:43 +0000)] 
Merge branch 'fanf-qsbr' into 'main'

QSBR: safe memory reclamation for lock-free data structures

See merge request isc-projects/bind9!7290

3 years agoQSBR: safe memory reclamation for lock-free data structures
Tony Finch [Thu, 29 Dec 2022 19:18:00 +0000 (19:18 +0000)] 
QSBR: safe memory reclamation for lock-free data structures

This "quiescent state based reclamation" module provides support for
the qp-trie module in dns/qp. It is a replacement for liburcu, written
without reference to the urcu source code, and in fact it works in a
significantly different way.

A few specifics of BIND make this variant of QSBR somewhat simpler:

  * We can require that wait-free access to a qp-trie only happens in
    an isc_loop callback. The loop provides a natural quiescent state,
    after the callbacks are done, when no qp-trie access occurs.

  * We can dispense with any API like rcu_synchronize(). In practice,
    it takes far too long to wait for a grace period to elapse for each
    write to a data structure.

  * We use the idea of "phases" (aka epochs or eras) from EBR to
    reduce the amount of bookkeeping needed to track memory that is no
    longer needed, knowing that the qp-trie does most of that work
    already.

I considered hazard pointers for safe memory reclamation. They have
more read-side overhead (updating the hazard pointers) and it wasn't
clear to me how to nicely schedule the cleanup work. Another
alternative, epoch-based reclamation, is designed for fine-grained
lock-free updates, so it needs some rethinking to work well with the
heavily read-biased design of the qp-trie. QSBR has the fastest read
side of the basic SMR algorithms (with no barriers), and fits well
into a libuv loop. More recent hybrid SMR algorithms do not appear to
have enough benefits to justify the extra complexity.

3 years agoMerge branch 'fanf-refcount-trace-tid' into 'main'
Tony Finch [Thu, 23 Feb 2023 14:28:34 +0000 (14:28 +0000)] 
Merge branch 'fanf-refcount-trace-tid' into 'main'

Include thread ID in refcount trace output

See merge request isc-projects/bind9!7584

3 years agoInclude thread ID in refcount trace output
Tony Finch [Wed, 22 Feb 2023 17:32:47 +0000 (17:32 +0000)] 
Include thread ID in refcount trace output

3 years agoMerge branch 'aram/catz-remove-unused-catzs-loop' into 'main'
Arаm Sаrgsyаn [Thu, 23 Feb 2023 09:39:17 +0000 (09:39 +0000)] 
Merge branch 'aram/catz-remove-unused-catzs-loop' into 'main'

Remove catzs->loop

See merge request isc-projects/bind9!7569

3 years agoRemove catzs->loop
Aram Sargsyan [Tue, 21 Feb 2023 20:57:02 +0000 (20:57 +0000)] 
Remove catzs->loop

The 'loop' member of the dns_catz_zones structure is not used.

3 years agoMerge branch '3778-empty-include' into 'main'
Evan Hunt [Wed, 22 Feb 2023 17:36:13 +0000 (17:36 +0000)] 
Merge branch '3778-empty-include' into 'main'

fix a crash from using an empty string for "include"

Closes #3778

See merge request isc-projects/bind9!7572

3 years agoremove isc_glob
Evan Hunt [Tue, 21 Feb 2023 22:39:43 +0000 (14:39 -0800)] 
remove isc_glob

the isc_glob module was originally needed to support posix-style glob
processing on Windows, but is now just an unnecessary wrapper around
glob(3). this commit removes it.

3 years agofix a crash from using an empty string for "include"
Evan Hunt [Tue, 21 Feb 2023 22:31:58 +0000 (14:31 -0800)] 
fix a crash from using an empty string for "include"

the parser could crash when "include" specified an empty string in place
of the filename. this has been fixed by returning ISC_R_FILENOTFOUND
when the string length is 0.

3 years agoMerge branch 'fanf-atomic-lists' into 'main'
Tony Finch [Wed, 22 Feb 2023 17:05:51 +0000 (17:05 +0000)] 
Merge branch 'fanf-atomic-lists' into 'main'

Simple lock-free singly-linked stack

See merge request isc-projects/bind9!7470

3 years agoUse atomic stack for async job queue
Ondřej Surý [Mon, 20 Feb 2023 15:16:07 +0000 (16:16 +0100)] 
Use atomic stack for async job queue

Previously, the async job queue would use a locked-list (ISC_LIST).
With introduction of atomic stack (that has to be drained at once), we
could use it to remove some contention between the threads and simplify
the async queue.

Fortunately, the reverse order still works for us - instead of append
and tail/prev operation on the list, we are now using prepend and
head/next operation on the atomic stack.

3 years agoSimple lock-free stack in <isc/stack.h>
Tony Finch [Mon, 2 Jan 2023 14:49:52 +0000 (14:49 +0000)] 
Simple lock-free stack in <isc/stack.h>

Add a singly-linked stack that supports lock-free prepend and drain (to
empty the list and clean up its elements).  Intended for use with QSBR
to collect objects that need safe memory reclamation, or any other user
that works with adding objects to the stack and then draining them in
one go like various work queues.

In <isc/atomic.h>, add an `atomic_ptr()` macro to make type
declarations a little less abominable, and clean up a duplicate
definition of `atomic_compare_exchange_strong_acq_rel()`

3 years agoMerge branch '3622-serve-stale-rrsig-test' into 'main'
Tom Krizek [Wed, 22 Feb 2023 12:57:09 +0000 (12:57 +0000)] 
Merge branch '3622-serve-stale-rrsig-test' into 'main'

[CVE-2022-3736] Test RRSIG queries with serve-stale enabled

Closes #3622

See merge request isc-projects/bind9!7578

3 years agoTest RRSIG queries with serve-stale enabled
Mark Andrews [Wed, 26 Oct 2022 07:39:37 +0000 (18:39 +1100)] 
Test RRSIG queries with serve-stale enabled

Make RRSIG queries where the existing tests trigger a DNS_EVENT_TRYSTALE
event.

3 years agoMerge branch '3619-serve-stale-client-timeout-crash-test' into 'main'
Tom Krizek [Wed, 22 Feb 2023 11:54:42 +0000 (11:54 +0000)] 
Merge branch '3619-serve-stale-client-timeout-crash-test' into 'main'

[CVE-2022-3924] Add a reproducer for the serve-stale crash when recursive clients soft quota is reached

Closes #3619

See merge request isc-projects/bind9!7575

3 years agoAdd tests for CVE-2022-3924
Aram Sargsyan [Fri, 11 Nov 2022 14:44:26 +0000 (14:44 +0000)] 
Add tests for CVE-2022-3924

Reproduce the assertion by configuring a 'named' resolver with
'recursive-clients 10;' configuration option and running 20
queries is parallel.

Also tweak the 'ans2/ans.pl' to simulate a 50ms network latency
when qname starts with "latency". This makes sure that queries
running in parallel don't get served immediately, thus allowing
the configured recursive clients quota limitation to be activated.

3 years agoMerge branch '3873-cleanup-task-timer-refs' into 'main'
Evan Hunt [Wed, 22 Feb 2023 08:13:47 +0000 (08:13 +0000)] 
Merge branch '3873-cleanup-task-timer-refs' into 'main'

remove references to obsolete isc_task/timer functions

Closes #3873

See merge request isc-projects/bind9!7568

3 years agoremove references to obsolete isc_task/timer functions
Evan Hunt [Tue, 21 Feb 2023 20:21:32 +0000 (12:21 -0800)] 
remove references to obsolete isc_task/timer functions

removed references in code comments, doc/dev documentation, etc, to
isc_task, isc_timer_reset(), and isc_timertype_inactive. also removed a
coccinelle patch related to isc_timer_reset() that was no longer needed.

3 years agoMerge branch 'each-no-sdb' into 'main'
Evan Hunt [Wed, 22 Feb 2023 06:32:37 +0000 (06:32 +0000)] 
Merge branch 'each-no-sdb' into 'main'

remove SDB API and refactor builtin databases

Closes #3882

See merge request isc-projects/bind9!7558

3 years agoCHANGES for [GL #3882]
Evan Hunt [Sat, 18 Feb 2023 02:59:59 +0000 (18:59 -0800)] 
CHANGES for [GL #3882]

3 years agomake builtin a standalone dns_db implementation
Evan Hunt [Fri, 10 Feb 2023 07:21:57 +0000 (23:21 -0800)] 
make builtin a standalone dns_db implementation

instead of using the SDB API as a wrapper to register and
unregister and provide a call framework for the builtin databases,
this commit flattens things so that the builtin databases implement
dns_db directly.

3 years agomove the dns_sdb API
Evan Hunt [Thu, 9 Feb 2023 06:22:40 +0000 (22:22 -0800)] 
move the dns_sdb API

move all dns_sdb code into bin/named/builtin.c, which is the
only place from which it's called.

(note this is temporary: later we'll refactor builtin so that it's a
standalone dns_db implementation on its own instead of using SDB
as a wrapper.)

3 years agoenable detailed db tracing
Evan Hunt [Fri, 17 Feb 2023 21:04:12 +0000 (13:04 -0800)] 
enable detailed db tracing

move database attach/detach functions to db.c, instead of
requiring them to be implemented for every database type.
instead, they must implement a 'destroy' function that is
called when references go to zero.

this enables us to use ISC_REFCOUNT_IMPL for databases,
with detailed tracing enabled by setting DNS_DB_TRACE to 1.

3 years agosimplify dns_sdb API
Evan Hunt [Fri, 17 Feb 2023 20:04:32 +0000 (12:04 -0800)] 
simplify dns_sdb API

SDB is currently (and foreseeably) only used by the named
builtin databases, so it only needs as much of its API as
those databases use.

- removed three flags defined for the SDB API that were always
  set the same by builtin databases.

- there were two different types of lookup functions defined for
  SDB, using slightly different function signatures. since backward
  compatibility is no longer a concern, we can eliminate the 'lookup'
  entry point and rename 'lookup2' to 'lookup'.

- removed the 'allnodes' entry point and all database iterator
  implementation code

- removed dns_sdb_putnamedrr() and dns_sdb_putnamedrdata() since
  they were never used.

3 years agouse member name initialization for methods
Evan Hunt [Fri, 17 Feb 2023 19:46:58 +0000 (11:46 -0800)] 
use member name initialization for methods

initialize dns_dbmethods, dns_sdbmethods and dns_rdatasetmethods
using explicit struct member names, so we don't have to keep track
of NULLs for unimplemented functions any longer.

3 years agomake fewer dns_db functions mandatory-to-implement
Evan Hunt [Fri, 17 Feb 2023 20:05:25 +0000 (12:05 -0800)] 
make fewer dns_db functions mandatory-to-implement

some dns_db functions would have crashed if the DB implementation failed
to implement them, requiring the implementations to add functions that
did nothing but return ISC_R_NOTIMPLEMENTED or some obvious default
value. we can just have the dns_db wrapper functions themselves return
those values, and clean up the implementations accordingly.

3 years agoremove rdatalist_p.h
Evan Hunt [Fri, 17 Feb 2023 19:57:05 +0000 (11:57 -0800)] 
remove rdatalist_p.h

make the private isc__rdatalist_* functions public dns_rdatalist
functions so that all the rdatalist primitives can be used by
callers to libdns. (this will be needed later for moving SDB and
SDLZ out of libdns.)

3 years agoMerge branch 'matthijs-fix-kasp-attach-detach-usage' into 'main'
Matthijs Mekking [Tue, 21 Feb 2023 15:45:12 +0000 (15:45 +0000)] 
Merge branch 'matthijs-fix-kasp-attach-detach-usage' into 'main'

Fix kasp attach detach usage

See merge request isc-projects/bind9!7563

3 years agoFix dns_kasp_attach / dns_kasp_detach usage
Mark Andrews [Tue, 21 Feb 2023 01:15:01 +0000 (12:15 +1100)] 
Fix dns_kasp_attach / dns_kasp_detach usage

The kasp pointers in dns_zone_t should consistently be changed by
dns_kasp_attach and dns_kasp_detach so the usage is balanced.

3 years agoMerge branch 'fanf-prune-libbind9' into 'main'
Tony Finch [Tue, 21 Feb 2023 13:12:44 +0000 (13:12 +0000)] 
Merge branch 'fanf-prune-libbind9' into 'main'

Move the last bits of libbind9 into libisc

See merge request isc-projects/bind9!7462

3 years agoAdd CHANGES and release note
Tony Finch [Fri, 16 Dec 2022 12:57:36 +0000 (12:57 +0000)] 
Add CHANGES and release note

[cleanup] Move bind9_getaddresses() to isc_getaddresses()
and remove the now empty libbind9.

3 years agoRemove libbind9
Tony Finch [Fri, 16 Dec 2022 10:51:36 +0000 (10:51 +0000)] 
Remove libbind9

It is now empty.

3 years agoMove bind9_getaddresses() to isc_getaddresses()
Tony Finch [Fri, 16 Dec 2022 10:19:16 +0000 (10:19 +0000)] 
Move bind9_getaddresses() to isc_getaddresses()

No need to have a whole library for one function.

3 years agoMerge branch '3884-cid-436299-null-pointer-dereference-in-lib-dns-resolver-c' into...
Mark Andrews [Tue, 21 Feb 2023 12:58:25 +0000 (12:58 +0000)] 
Merge branch '3884-cid-436299-null-pointer-dereference-in-lib-dns-resolver-c' into 'main'

Resolve "CID 436299: Null pointer dereference in lib/dns/resolver.c"

Closes #3884

See merge request isc-projects/bind9!7562

3 years agoCleanup left over 'fctx != NULL' test following refactoring
Mark Andrews [Tue, 21 Feb 2023 02:37:24 +0000 (13:37 +1100)] 
Cleanup left over 'fctx != NULL' test following refactoring

This was causing 'CID 436299: Null pointer dereferences (REVERSE_INULL)'
in Coverity.  Also removed an 'INSIST(fctx != NULL);' that should
no longer be needed.

3 years agoMerge branch '3880-fix-rpz-assertion-failure-during-failed-reconfiguration' into...
Arаm Sаrgsyаn [Tue, 21 Feb 2023 09:01:27 +0000 (09:01 +0000)] 
Merge branch '3880-fix-rpz-assertion-failure-during-failed-reconfiguration' into 'main'

Detach rpzs and catzs from the previous view

Closes #3880

See merge request isc-projects/bind9!7552

3 years agoAdd a CHANGES note for [GL #3880]
Aram Sargsyan [Fri, 17 Feb 2023 13:12:05 +0000 (13:12 +0000)] 
Add a CHANGES note for [GL #3880]

3 years agoDetach rpzs and catzs from the previous view
Aram Sargsyan [Fri, 17 Feb 2023 12:41:29 +0000 (12:41 +0000)] 
Detach rpzs and catzs from the previous view

When switching to a new view during a reconfiguration (or reverting
to the old view), detach the 'rpzs' and 'catzs' from the previuos view.

The 'catzs' case was earlier solved slightly differently, by detaching
from the new view when reverting to the old view, but we can not solve
this the same way for 'rpzs', because now in BIND 9.19 and BIND 9.18
a dns_rpz_shutdown_rpzs() call was added in view's destroy() function
before detaching the 'rpzs', so we can not leave the 'rpzs' attached to
the previous view and let it be shut down when we intend to continue
using it with the new view.

Instead, "re-fix" the issue for the 'catzs' pointer the same way as
for 'rpzs' for consistency, and also because a similar shutdown call
is likely to be implemented for 'catzs' in the near future.

3 years agoAdd an "rpz" system test check for a failed reconfiguration
Aram Sargsyan [Fri, 17 Feb 2023 12:38:40 +0000 (12:38 +0000)] 
Add an "rpz" system test check for a failed reconfiguration

The faulty "DLZ" configuration triggers a reconfiguration failure
in such a place where view reverting code is covered.

3 years agoMerge branch 'each-cleanup-gethostname' into 'main'
Evan Hunt [Sat, 18 Feb 2023 20:23:56 +0000 (20:23 +0000)] 
Merge branch 'each-cleanup-gethostname' into 'main'

remove named_os_gethostname()

See merge request isc-projects/bind9!7555

3 years agoremove named_os_gethostname()
Evan Hunt [Thu, 9 Feb 2023 20:48:07 +0000 (12:48 -0800)] 
remove named_os_gethostname()

this function was just a front-end for gethostname(). it was
needed when we supported windows, which has a different function
for looking up the hostname; it's not needed any longer.

3 years agoMerge branch '3879-hmac_createctx-fails-to-free-context-on-isc_hmac_init-failure...
Mark Andrews [Fri, 17 Feb 2023 22:29:28 +0000 (22:29 +0000)] 
Merge branch '3879-hmac_createctx-fails-to-free-context-on-isc_hmac_init-failure' into 'main'

Resolve "hmac_createctx fails to free context on isc_hmac_init failure"

Closes #3879

See merge request isc-projects/bind9!7549

3 years agoIn hmac_createctx free ctx on isc_hmac_init failure
Mark Andrews [Fri, 17 Feb 2023 00:44:45 +0000 (11:44 +1100)] 
In hmac_createctx free ctx on isc_hmac_init failure

3 years agoMerge branch 'mnowak/qa-tools-update' into 'main'
Michal Nowak [Fri, 17 Feb 2023 15:00:07 +0000 (15:00 +0000)] 
Merge branch 'mnowak/qa-tools-update' into 'main'

Python formatting updates

See merge request isc-projects/bind9!7551

3 years agoFix unnecessary "else" after "raise" with pylint 2.16.2
Michal Nowak [Fri, 17 Feb 2023 12:21:55 +0000 (13:21 +0100)] 
Fix unnecessary "else" after "raise" with pylint 2.16.2

    bin/tests/system/get_algorithms.py:225:4: R1720: Unnecessary "else" after "raise", remove the "else" and de-indent the code inside it (no-else-raise)

3 years agoAdapt to Python scripts to black 23.1.0
Michal Nowak [Fri, 17 Feb 2023 12:16:13 +0000 (13:16 +0100)] 
Adapt to Python scripts to black 23.1.0

3 years agoMerge branch 'fanf-libbind9-libisccfg' into 'main'
Tony Finch [Fri, 17 Feb 2023 12:50:39 +0000 (12:50 +0000)] 
Merge branch 'fanf-libbind9-libisccfg' into 'main'

Move bind9/check to isccfg/check

See merge request isc-projects/bind9!7461

3 years agoMove bind9/check to isccfg/check
Tony Finch [Fri, 16 Dec 2022 10:39:15 +0000 (10:39 +0000)] 
Move bind9/check to isccfg/check

Since it is part of the configuration machinery

3 years agoMerge branch 'ondrej-further-dns_validator-refactoring' into 'main'
Ondřej Surý [Fri, 17 Feb 2023 06:22:03 +0000 (06:22 +0000)] 
Merge branch 'ondrej-further-dns_validator-refactoring' into 'main'

additional refactoring of dns_validator

See merge request isc-projects/bind9!7546

3 years agoCHANGES for [GL #3797]
Evan Hunt [Thu, 16 Feb 2023 19:32:20 +0000 (11:32 -0800)] 
CHANGES for [GL #3797]

3 years agoremove validator lock
Evan Hunt [Thu, 16 Feb 2023 19:05:39 +0000 (11:05 -0800)] 
remove validator lock

as every validator function is loop-synchronized, it should no longer be
necessary to use a validator lock.

calling dns_validator_send(), dns_validator_cancel() or
dns_validator_destroy() from a thread other than the one on which the
validator is running will now cause an assertion failure; this should be
fine since the validator and resolver are tightly coupled, and the fetch
contexts and validators run in the same loops.

3 years agoImplement proper reference counting in dns_validator
Ondřej Surý [Thu, 16 Feb 2023 13:37:55 +0000 (14:37 +0100)] 
Implement proper reference counting in dns_validator

use reference counting in dns_validator to prevent use after free.

3 years agoadditional refactoring of dns_validator
Evan Hunt [Wed, 15 Feb 2023 19:32:00 +0000 (11:32 -0800)] 
additional refactoring of dns_validator

refactor validator so that the validation status object (previously
called dns_valstatus_t, which was derived from dns_validatorevent_t), is
now part of the dns_validator object.  when calling validator callbacks,
the validator itself is now sent as the argument.

(note: this necessitates caution in the callback functions that are
internal to validator.c validators spawn other validators, and it can be
confusing at times whether we need to be looking at val, val->subvalidator,
or val->parent.)

3 years agoMerge branch '3875-dont-unlink-before-expire_entry' into 'main'
Ondřej Surý [Fri, 17 Feb 2023 06:18:15 +0000 (06:18 +0000)] 
Merge branch '3875-dont-unlink-before-expire_entry' into 'main'

Don't remove ADB entry from LRU before trying to expire it

Closes #3875

See merge request isc-projects/bind9!7544

3 years agoDon't remove ADB entry from LRU before trying to expire it
Ondřej Surý [Thu, 16 Feb 2023 11:26:01 +0000 (12:26 +0100)] 
Don't remove ADB entry from LRU before trying to expire it

There was a code flow error that would remove the expired ADB entry from
the LRU list and then a check in the expire_entry() would cause
assertion error because it expect the ADB entry to be linked.

Additionally, the expire mechanism would loop for cases when we would
held only a read rwlock; in such case we need to upgrade the lock and
try again, not just try again.