]> git.ipfire.org Git - thirdparty/bind9.git/log
thirdparty/bind9.git
2 years agoRemove remenants of cache support from qpzone.c
Mark Andrews [Tue, 19 Mar 2024 06:02:56 +0000 (17:02 +1100)] 
Remove remenants of cache support from qpzone.c

These where leading to Coverity errors being reported.

2 years agoMerge branch 'mnowak/pytest_rewrite_glue' into 'main'
Michal Nowak [Tue, 19 Mar 2024 19:16:53 +0000 (19:16 +0000)] 
Merge branch 'mnowak/pytest_rewrite_glue' into 'main'

Rewrite glue system test to pytest

See merge request isc-projects/bind9!8846

2 years agoUse bitwise operation to remove RD from default flags
Michal Nowak [Tue, 19 Mar 2024 11:35:48 +0000 (12:35 +0100)] 
Use bitwise operation to remove RD from default flags

2 years agoRewrite glue system test to pytest
Michal Nowak [Thu, 7 Mar 2024 13:58:38 +0000 (14:58 +0100)] 
Rewrite glue system test to pytest

Limit dnspython to version 2.0.0+
(https://github.com/rthalley/dnspython/pull/503), otherwise the test
fails with:

    E   AttributeError: module 'dns.edns' has no attribute 'OptionType'

2 years agoMerge branch 'mnowak/pytest_rewrite_masterfile' into 'main'
Michal Nowak [Tue, 19 Mar 2024 10:38:07 +0000 (10:38 +0000)] 
Merge branch 'mnowak/pytest_rewrite_masterfile' into 'main'

Rewrite masterfile system test to pytest

See merge request isc-projects/bind9!8791

2 years agoRewrite masterfile system test to pytest
Michal Nowak [Tue, 19 Mar 2024 09:31:38 +0000 (10:31 +0100)] 
Rewrite masterfile system test to pytest

2 years agoAdd zones_equal() with optional TTL comparison
Michal Nowak [Tue, 19 Mar 2024 09:49:19 +0000 (10:49 +0100)] 
Add zones_equal() with optional TTL comparison

2 years agoModify rrsets_equal() to optionally compare TTL
Michal Nowak [Tue, 19 Mar 2024 09:45:59 +0000 (10:45 +0100)] 
Modify rrsets_equal() to optionally compare TTL

2 years agoMerge branch 'mnowak/pytest_rewrite_limits' into 'main'
Michal Nowak [Mon, 18 Mar 2024 15:32:47 +0000 (15:32 +0000)] 
Merge branch 'mnowak/pytest_rewrite_limits' into 'main'

Rewrite limits system test to pytest

See merge request isc-projects/bind9!8798

2 years agoRewrite limits system test to pytest
Michal Nowak [Wed, 28 Feb 2024 15:41:32 +0000 (16:41 +0100)] 
Rewrite limits system test to pytest

Also, tweak the IP ranges of A RRsets so they are more easily processed
by for loops.

2 years agoMerge branch 'mnowak/freebsd-13.3' into 'main'
Michal Nowak [Mon, 18 Mar 2024 14:59:33 +0000 (14:59 +0000)] 
Merge branch 'mnowak/freebsd-13.3' into 'main'

Add FreeBSD 13.3

See merge request isc-projects/bind9!8826

2 years agoAdd FreeBSD 13.3
Michal Nowak [Tue, 5 Mar 2024 19:22:47 +0000 (20:22 +0100)] 
Add FreeBSD 13.3

2 years agoMerge branch '4641-dig-ednsflags-does-not-re-enable-edns' into 'main'
Mark Andrews [Sun, 17 Mar 2024 03:06:22 +0000 (03:06 +0000)] 
Merge branch '4641-dig-ednsflags-does-not-re-enable-edns' into 'main'

Resolve "dig +ednsflags does not re-enable EDNS"

Closes #4641

See merge request isc-projects/bind9!8874

2 years agoAdd CHANGES for [GL #4641
Mark Andrews [Sat, 16 Mar 2024 05:26:47 +0000 (16:26 +1100)] 
Add CHANGES for [GL #4641

2 years agoTest +noedns +ednsflags=non-zero-value
Mark Andrews [Sat, 16 Mar 2024 05:26:17 +0000 (16:26 +1100)] 
Test +noedns +ednsflags=non-zero-value

2 years agoRe-enable EDNS if an EDNS flag gets set to 1 by +ednsflags
Mark Andrews [Sat, 16 Mar 2024 04:55:37 +0000 (15:55 +1100)] 
Re-enable EDNS if an EDNS flag gets set to 1 by +ednsflags

This is consistent with +dnssec and +nsid which only re-enable
EDNS if do is set to 1 or nsid is requested.

2 years agoMerge branch 'mnowak/move-stress-tests-to-freebsd-13' into 'main'
Michal Nowak [Fri, 15 Mar 2024 11:12:11 +0000 (11:12 +0000)] 
Merge branch 'mnowak/move-stress-tests-to-freebsd-13' into 'main'

FreeBSD "stress" tests now run on FreeBSD 13.2

See merge request isc-projects/bind9!8689

2 years agoFreeBSD "stress" tests now run on FreeBSD 13.2
Michal Nowak [Thu, 1 Feb 2024 15:09:05 +0000 (16:09 +0100)] 
FreeBSD "stress" tests now run on FreeBSD 13.2

2 years agoMerge branch 'mnowak/pytest_rewrite_rrchecker' into 'main'
Michal Nowak [Fri, 15 Mar 2024 09:05:20 +0000 (09:05 +0000)] 
Merge branch 'mnowak/pytest_rewrite_rrchecker' into 'main'

Rewrite rrchecker system test to pytest

See merge request isc-projects/bind9!8832

2 years agoRewrite rrchecker system test to pytest
Michal Nowak [Wed, 6 Mar 2024 14:57:24 +0000 (15:57 +0100)] 
Rewrite rrchecker system test to pytest

2 years agoMerge branch '4639-add-openssl-flags-to-proxystream_test' into 'main'
Mark Andrews [Thu, 14 Mar 2024 23:42:25 +0000 (23:42 +0000)] 
Merge branch '4639-add-openssl-flags-to-proxystream_test' into 'main'

Resolve "Add OpenSSL Flags to proxystream_test"

Closes #4639

See merge request isc-projects/bind9!8869

2 years agoAdd OpenSSL libraries and flags to proxystream_test
Mark Andrews [Thu, 14 Mar 2024 23:08:57 +0000 (10:08 +1100)] 
Add OpenSSL libraries and flags to proxystream_test

2 years agoMerge branch '4614-qpdb-excess-memory' into 'main'
Evan Hunt [Thu, 14 Mar 2024 18:06:54 +0000 (18:06 +0000)] 
Merge branch '4614-qpdb-excess-memory' into 'main'

reduce memory consumption of QP zone and cache databases

Closes #4614

See merge request isc-projects/bind9!8849

2 years agoCHANGES for [GL #4614]
Evan Hunt [Tue, 12 Mar 2024 01:57:16 +0000 (18:57 -0700)] 
CHANGES for [GL #4614]

2 years agoreduce memory consumption of the remaining QP databases
Evan Hunt [Wed, 13 Mar 2024 20:42:57 +0000 (13:42 -0700)] 
reduce memory consumption of the remaining QP databases

use dynamically allocated names instead of fixednames in
forward.c, keytable.c, nametree.c, and nta.c

2 years agoreduce memory consumption of rpz summary database
Evan Hunt [Tue, 12 Mar 2024 05:10:41 +0000 (22:10 -0700)] 
reduce memory consumption of rpz summary database

use dynamically allocated names instead of fixednames in rpz.c

2 years agoreduce memory consumption of qpcache database
Evan Hunt [Tue, 12 Mar 2024 01:53:49 +0000 (18:53 -0700)] 
reduce memory consumption of qpcache database

as with qpzone, use a dynamically-allocated dns_name instead
of a dns_fixedname object to store node names in the QP database.

2 years agoreduce memory consumption of qpzone database
Evan Hunt [Tue, 12 Mar 2024 01:47:01 +0000 (18:47 -0700)] 
reduce memory consumption of qpzone database

every node of a QP database contains a copy of the nodename,
which is used as the key for the QP-trie. previously, the name
was stored as a dns_fixedname object, which has room for up to
255 characters. we can reduce the space consumed by dynamically
allocating a dns_name object that's just long enough for the name
to be stored.

2 years agoMerge branch '4629-cid-487882-error-handling-issues' into 'main'
Matthijs Mekking [Thu, 14 Mar 2024 14:12:57 +0000 (14:12 +0000)] 
Merge branch '4629-cid-487882-error-handling-issues' into 'main'

Resolve "CID 487882: Error handling issues in lib/dns/qpzone.c"

Closes #4629

See merge request isc-projects/bind9!8852

2 years agoFix Coverity CID 487882: Error handling issues
Matthijs Mekking [Tue, 12 Mar 2024 10:59:38 +0000 (11:59 +0100)] 
Fix Coverity CID 487882: Error handling issues

The dns_qpiter_next() was called without checking the return value. If
we cannot move the iterator forward, there is no use in calling the
step() function.

/lib/dns/qpzone.c: 2804 in activeempty()
2798       * of the name we were searching for. Step the iterator
2799       * forward, then step() will continue forward until it
2800       * finds a node with active data. If that node is a
2801       * subdomain of the one we were looking for, then we're
2802       * at an active empty nonterminal node.
2803       */
>>>     CID 487882:  Error handling issues  (CHECKED_RETURN)
>>>     Calling "dns_qpiter_next" without checking return value (as is done elsewhere 26 out of 27 times).
2804      dns_qpiter_next(it, NULL, NULL, NULL);
2805      return (step(search, it, FORWARD, next) &&
2806      dns_name_issubdomain(next, current));
2807     }

2 years agoMerge branch 'matthijs-add-rfc-9460-to-arm' into 'main'
Matthijs Mekking [Thu, 14 Mar 2024 12:53:23 +0000 (12:53 +0000)] 
Merge branch 'matthijs-add-rfc-9460-to-arm' into 'main'

Add RFC 9460 to list of supported RFCs

See merge request isc-projects/bind9!8847

2 years agoAdd RFC 9460 to list of supported RFCs
Matthijs Mekking [Mon, 11 Mar 2024 07:55:26 +0000 (08:55 +0100)] 
Add RFC 9460 to list of supported RFCs

The specification was implemented (#1132) when it was a draft. Now that
it is RFC, add the RFC to the list of supported RFCs.

2 years agoMerge branch '4631-cid-487884-dead-code-in-qpcache' into 'main'
Matthijs Mekking [Thu, 14 Mar 2024 11:50:17 +0000 (11:50 +0000)] 
Merge branch '4631-cid-487884-dead-code-in-qpcache' into 'main'

Resolve "CID 487884: Dead code in qpcache.c"

Closes #4631

See merge request isc-projects/bind9!8853

2 years agoFix Coverity CID 487884: Dead code in qpcache.c
Matthijs Mekking [Tue, 12 Mar 2024 13:12:23 +0000 (14:12 +0100)] 
Fix Coverity CID 487884: Dead code in qpcache.c

Adding a changed record is zonedb related and does not belong in
the cache code. This is a leftover dead code and can be safely
removed.

/lib/dns/qpcache.c: 3459 in add()
3453      }
3454      newheader->next = topheader->next;
3455      newheader->down = topheader;
3456      topheader->next = newheader;
3457      qpnode->dirty = 1;
3458      if (changed != NULL) {
>>>     CID 487884:    (DEADCODE)
>>>     Execution cannot reach this statement: "changed->dirty = true;".
3459      changed->dirty = true;
3460      }
3461      } else {
3462      /*
3463       * No rdatasets of the given type exist at the node.
3464       */
/lib/dns/qpcache.c: 3409 in add()
3403      }
3404      newheader->next = topheader->next;
3405      newheader->down = topheader;
3406      topheader->next = newheader;
3407      qpnode->dirty = 1;
3408      if (changed != NULL) {
>>>     CID 487884:    (DEADCODE)
>>>     Execution cannot reach this statement: "changed->dirty = true;".
3409      changed->dirty = true;
3410      }
3411      mark_ancient(header);
3412      if (sigheader != NULL) {
3413      mark_ancient(sigheader);
3414

2 years agoMerge branch '4624-duration-error-checking' into 'main'
Matthijs Mekking [Thu, 14 Mar 2024 10:08:43 +0000 (10:08 +0000)] 
Merge branch '4624-duration-error-checking' into 'main'

Detect invalid durations

Closes #4624

See merge request isc-projects/bind9!8844

2 years agoAdd CHANGES and release note for #4624
Matthijs Mekking [Fri, 8 Mar 2024 11:23:40 +0000 (12:23 +0100)] 
Add CHANGES and release note for #4624

2 years agoDetect invalid durations
Matthijs Mekking [Fri, 8 Mar 2024 11:12:50 +0000 (12:12 +0100)] 
Detect invalid durations

Be stricter in durations that are accepted. Basically we accept ISO 8601
formats, but fail to detect garbage after the integers in such strings.

For example, 'P7.5D' will be treated as 7 days. Pass 'endptr' to
'strtoll' and check if the endptr is at the correct suffix.

2 years agoMerge branch '4608-ensure-static-stub-ns-records-are-not-returned' into 'main'
Mark Andrews [Thu, 14 Mar 2024 04:16:39 +0000 (04:16 +0000)] 
Merge branch '4608-ensure-static-stub-ns-records-are-not-returned' into 'main'

Resolve "Ensure static stub NS records are not returned"

Closes #4608

See merge request isc-projects/bind9!8790

2 years agoAdd CHANGES note for [GL #4608]
Mark Andrews [Thu, 29 Feb 2024 06:17:52 +0000 (17:17 +1100)] 
Add CHANGES note for [GL #4608]

2 years agoCheck static-stub synthesised NS is not returned
Mark Andrews [Thu, 29 Feb 2024 06:14:43 +0000 (17:14 +1100)] 
Check static-stub synthesised NS is not returned

2 years agoDon't use static stub when returning best NS
Mark Andrews [Wed, 28 Feb 2024 07:01:55 +0000 (18:01 +1100)] 
Don't use static stub when returning best NS

If we find a static stub zone in query_addbestns look for a parent
zone which isn't a static stub.

2 years agoMerge branch '4630-deadcode-fix' into 'main'
Evan Hunt [Thu, 14 Mar 2024 00:15:38 +0000 (00:15 +0000)] 
Merge branch '4630-deadcode-fix' into 'main'

Resolve "CID 487883: Null pointer dereference in lib/dns/qpzone.c"

Closes #4630

See merge request isc-projects/bind9!8854

2 years agoremove dead code in rbtdb.c
Evan Hunt [Tue, 12 Mar 2024 18:51:53 +0000 (11:51 -0700)] 
remove dead code in rbtdb.c

dns_db_addrdataset() enforces a requirement that version can only
be NULL for a cache database. code that checks for zone semantics
and version == NULL can never be reached.

2 years agosupport nodefullname in rbt-zonedb.c
Evan Hunt [Tue, 12 Mar 2024 18:46:15 +0000 (11:46 -0700)] 
support nodefullname in rbt-zonedb.c

this enables the 'dyndb' system test to pass when we
build using --with-zonedb=rbt.

2 years agoremove dead code in qpzone.c
Evan Hunt [Tue, 12 Mar 2024 18:32:29 +0000 (11:32 -0700)] 
remove dead code in qpzone.c

qpzone does not support cache semantics, so dns_db_addrdataset(),
_deleterdataset() and _subtractrdataset() can't be run with
version == NULL; there's no need to check for it.

we can also clean up free_qpdb() a bit since current_version
is always non-NULL.

2 years agoMerge branch '4633-undefined-behaviour-in-rdataslab-c' into 'main'
Mark Andrews [Wed, 13 Mar 2024 23:40:17 +0000 (23:40 +0000)] 
Merge branch '4633-undefined-behaviour-in-rdataslab-c' into 'main'

Resolve "Undefined behaviour in rdataslab.c"

Closes #4633

See merge request isc-projects/bind9!8855

2 years agoOnly call memmove if the rdata length is non zero
Mark Andrews [Tue, 12 Mar 2024 23:15:03 +0000 (10:15 +1100)] 
Only call memmove if the rdata length is non zero

This avoids undefined behaviour on zero length rdata where the
data pointer is NULL.

2 years agoMerge branch '4552-keymgr-depends-function-bug' into 'main'
Matthijs Mekking [Wed, 13 Mar 2024 10:46:25 +0000 (10:46 +0000)] 
Merge branch '4552-keymgr-depends-function-bug' into 'main'

Fix bug in keymgr Depends function

Closes #4552

See merge request isc-projects/bind9!8682

2 years agoAdd CHANGES for #4552
Matthijs Mekking [Wed, 31 Jan 2024 11:37:12 +0000 (12:37 +0100)] 
Add CHANGES for #4552

2 years agoFix bug in keymgr Depends function
Matthijs Mekking [Wed, 31 Jan 2024 11:25:29 +0000 (12:25 +0100)] 
Fix bug in keymgr Depends function

The Depends relation refers to types of rollovers in which a certain
record type is going to be swapped. Specifically, the Depends relation
says there should be no dependency on the predecessor key (the set
Dep(x, T) must be empty).

But if the key is phased out (all its states are in HIDDEN), there is
no longer a dependency. Since the relationship is still maintained
(Predecessor and Successor metadata), the keymgr_dep function still
returned true. In other words, the set Dep(x, T) is not considered
empty.

This slows down key rollovers, only retiring keys when the successor
key has been fully propagated.

2 years agoMerge branch 'michal/set-up-version-and-release-notes-for-bind-9.19.23' into 'main'
Michał Kępień [Wed, 13 Mar 2024 08:59:24 +0000 (08:59 +0000)] 
Merge branch 'michal/set-up-version-and-release-notes-for-bind-9.19.23' into 'main'

Set up version and release notes for BIND 9.19.23

See merge request isc-projects/bind9!8856

2 years agoSet up release notes for BIND 9.19.23
Michał Kępień [Wed, 13 Mar 2024 08:51:24 +0000 (09:51 +0100)] 
Set up release notes for BIND 9.19.23

2 years agoUpdate BIND version to 9.19.23-dev
Michał Kępień [Wed, 13 Mar 2024 08:51:24 +0000 (09:51 +0100)] 
Update BIND version to 9.19.23-dev

2 years agoUpdate BIND version for release v9.19.22
Michał Kępień [Tue, 12 Mar 2024 08:33:06 +0000 (09:33 +0100)] 
Update BIND version for release

2 years agoAdd a CHANGES marker
Michał Kępień [Tue, 12 Mar 2024 08:33:06 +0000 (09:33 +0100)] 
Add a CHANGES marker

2 years agoMerge branch 'pspacek/prepare-documentation-for-bind-9.19.22' into 'v9.19.22-release'
Michał Kępień [Tue, 12 Mar 2024 08:31:48 +0000 (08:31 +0000)] 
Merge branch 'pspacek/prepare-documentation-for-bind-9.19.22' into 'v9.19.22-release'

Prepare documentation for BIND 9.19.22

See merge request isc-private/bind9!671

2 years agoTweak and reword release notes
Petr Špaček [Thu, 7 Mar 2024 17:29:23 +0000 (18:29 +0100)] 
Tweak and reword release notes

2 years agoAdd release note for GL #4591
Petr Špaček [Thu, 7 Mar 2024 17:28:15 +0000 (18:28 +0100)] 
Add release note for GL #4591

2 years agoReorder release notes
Petr Špaček [Thu, 7 Mar 2024 17:26:52 +0000 (18:26 +0100)] 
Reorder release notes

2 years agoAdd release note for GL #4413
Petr Špaček [Thu, 7 Mar 2024 17:16:05 +0000 (18:16 +0100)] 
Add release note for GL #4413

2 years agoPrepare release notes for BIND 9.19.22
Petr Špaček [Thu, 7 Mar 2024 17:07:04 +0000 (18:07 +0100)] 
Prepare release notes for BIND 9.19.22

2 years agoMerge branch '4625-broken-trust-chain-on-corner-case-secure-chain-fixup-keytrap'...
Matthijs Mekking [Tue, 12 Mar 2024 08:12:07 +0000 (08:12 +0000)] 
Merge branch '4625-broken-trust-chain-on-corner-case-secure-chain-fixup-keytrap' into 'main'

Fix validate_dnskey_dsset when KSK is not signing

Closes #4625

See merge request isc-projects/bind9!8848

2 years agoAdd CHANGES for #4625
Matthijs Mekking [Mon, 11 Mar 2024 09:57:59 +0000 (10:57 +0100)] 
Add CHANGES for #4625

2 years agoFix validate_dnskey_dsset when KSK is not signing
Matthijs Mekking [Mon, 11 Mar 2024 09:51:20 +0000 (10:51 +0100)] 
Fix validate_dnskey_dsset when KSK is not signing

When there is a secure chain of trust with a KSK that is not actively
signing the DNSKEY RRset, the code for validating the DNSKEY RRset
against the DS RRset could potentially skip DS records, thinking the
chain of trust is broken while there is a valid DS with corresponding
DNSKEY record present.

This is because we pass the result ISC_R_NOMORE on when we are done
checking for signatures, but then treat it as "no more DS records".

Chaning the return value to something else (DNS_R_NOVALIDSIG seems the
most appropriate here) fixes the issue.

2 years agoTest secure chain that includes inactive KSK
Matthijs Mekking [Mon, 11 Mar 2024 10:52:03 +0000 (11:52 +0100)] 
Test secure chain that includes inactive KSK

Add a regression test case for the scenario where a secure chain of
trust includes an inactive KSK, that is a KSK that is not signing the
DNSKEY RRset.

2 years agoMerge branch 'each-qpdb-heavy' into 'main'
Evan Hunt [Mon, 11 Mar 2024 16:45:19 +0000 (16:45 +0000)] 
Merge branch 'each-qpdb-heavy' into 'main'

create dns_qpmulti-based zone database

See merge request isc-projects/bind9!8543

2 years agoCHANGES for [GL #4348]
Evan Hunt [Thu, 7 Mar 2024 02:33:59 +0000 (18:33 -0800)] 
CHANGES for [GL #4348]

2 years agorename qpdb to qpcache
Evan Hunt [Thu, 7 Mar 2024 01:54:37 +0000 (17:54 -0800)] 
rename qpdb to qpcache

move qpdb.c to qpcache.c and rename the "qp" database implementation
to "qpcache", in order to make it more clearly distinguishable from
"qpzone".

2 years agocollapse qpdb implementation down to one file
Evan Hunt [Thu, 7 Mar 2024 01:33:37 +0000 (17:33 -0800)] 
collapse qpdb implementation down to one file

the code in qpdb.c was previously shared by qp-cachedb.c and
qp-zonedb.c.  since qp-zonedb.c no longer exists, it's not necessary
to keep these separate any longer. the two files have been merged,
and functions that were previously globally accessible have been
changed to static and renamed.

2 years agoremove qp-zonedb.c and associated code
Evan Hunt [Wed, 6 Mar 2024 23:04:20 +0000 (15:04 -0800)] 
remove qp-zonedb.c and associated code

now that "qpzone" databases are available for use in zones, we no
longer need to retain the zone semantics in the "qp" database.

all zone-specific code has been removed from QPDB, and "configure
--with-zonedb" once again takes two values, rbt and qp.

some database API methods that are never used with a cache have
been removed from qpdb.c and qp-cachedb.c; these include newversion,
closeversion, subtractrdataset, and nodefullname.

2 years agoadd a nodefullname implementation for the qpzone database
Evan Hunt [Wed, 6 Mar 2024 23:34:39 +0000 (15:34 -0800)] 
add a nodefullname implementation for the qpzone database

this enables the 'dyndb' system test to use a qpzone database.

2 years agoadd setup/commit functions to rdatacallbacks
Evan Hunt [Tue, 6 Feb 2024 00:11:16 +0000 (16:11 -0800)] 
add setup/commit functions to rdatacallbacks

because dns_qpmulti_commit() can be time consuming, it's inefficient
to open and commit a qpmulti transaction for each rdataset being loaded
into a database.  we can improve load time by opening a qpmulti
transaction before adding a group of rdatasets and then committing it
afterward.

this commit adds 'setup' and 'commit' functions to dns_rdatacallbacks_t,
which can be called before and after the loops in which 'add' is
called in dns_master_load() and axfr_apply().

2 years agouse DNS_DB_NONSEC3 flag when copying non-dnssec records
Evan Hunt [Sun, 3 Dec 2023 05:01:06 +0000 (21:01 -0800)] 
use DNS_DB_NONSEC3 flag when copying non-dnssec records

when copying the non-dnssec records in receive_secure_db(),
use DNS_DB_NONSEC3 so we don't accidentally create nodes in
the main tree for NSEC3 records. this was a long-standing error
in the code, but was harmless in the RBTDB.

2 years agoimprove node reference counting
Evan Hunt [Sat, 2 Dec 2023 09:04:28 +0000 (01:04 -0800)] 
improve node reference counting

QP database node data is not reference counted the same way RBT nodes
were: in the RBT, node->references could be zero if the node was in the
tree but was not in use by any caller, whereas in the QP trie, the
database itself uses reference counting of nodes internally.

this caused some subtle errors. in RBTDB, when the newref() function is
called and the node reference count was zero, the node lock reference
counter would also be incremented. in the QP trie, this can never
happen - because as long as the node is in the database its reference
count cannot be zero - and so the node lock reference counter was never
incremented.

this has been addressed by maintaining a separate "erefs" counter for
external references to the node. this is the same approach used in the
"qpdb-lite" database in commit e91fbd8dea.

while troubleshooting this issue, some compile errors were discovered
when building with DNS_DB_NODETRACE; those have also been fixed.

2 years agoswitch default zone database from "qp" to "qpzone"
Evan Hunt [Wed, 6 Mar 2024 21:05:16 +0000 (13:05 -0800)] 
switch default zone database from "qp" to "qpzone"

use the dns_qpmulti-based "qpzone" by default throughout BIND,
instead of the existing dns_qp-based "qp", when creating zone
databases. (cache databases still use "qp".)

the "--with-zonedb" option has been updated in configure.ac to permit
the use of both "qp" and "qpzone" databases.

in zone.c there was a test that prevented any database type other than
"qp" from hosting an RPZ. this was outdated, and has been removed.

2 years agorelease RCU in dns_qpmulti_snapshot()
Evan Hunt [Tue, 28 Nov 2023 23:05:55 +0000 (15:05 -0800)] 
release RCU in dns_qpmulti_snapshot()

previously, an RCU critical section was held open for the duration
of a snapshot. this should not be necessary, as the snapshot makes
local copies of QP trie metadata, and it causes problems when a
DB iterator is held open between two loop events.  we now call
rcu_read_unlock() after setting up the snapshot.

2 years agoadd qpzone_test unit test
Evan Hunt [Wed, 29 Nov 2023 21:29:08 +0000 (13:29 -0800)] 
add qpzone_test unit test

copy the non-cache-specific tests from the old rbtdb_test.c to
qpzone_test.c.

2 years agocomplete the qpzone database API implementation
Evan Hunt [Tue, 28 Nov 2023 21:31:15 +0000 (13:31 -0800)] 
complete the qpzone database API implementation

finish importing the database API methods from RBTDB to qpzone:
issecure, nodecount, getnsec3parameters, findnsec3node, setsigningtime,
getsigningtime, getsize, setgluecachestats, locknode, unlocknode, and
addglue.

2 years agoallow updating of records in a qpzone database
Evan Hunt [Sun, 19 Nov 2023 08:00:49 +0000 (00:00 -0800)] 
allow updating of records in a qpzone database

add database API methods needed to apply updates to an existing zone
database (newversion, addrdataset, subtractrdataset and deleterdataset).

it is now possible to apply journals to zone databases after loading, so
named-checkzone -J works correctly.

2 years agomake the qpzone database dumpable
Evan Hunt [Wed, 15 Nov 2023 16:55:18 +0000 (08:55 -0800)] 
make the qpzone database dumpable

add database API method implementations needed to iterate and dump
a qpzone database to a file (createiterator, allrdatasets and
attachversion, plus dbiterator and rdatasetiter methods).

named-checkzone -D can now dump the contents of most zones,
but zone cuts are not correctly detected.

2 years agomake the qpzone database loadable
Evan Hunt [Sat, 4 Nov 2023 14:40:49 +0000 (15:40 +0100)] 
make the qpzone database loadable

add database API methods needed for loading rdatasets into memory
(currentversion, beginload, endload), plus the methods used by
zone_postload() for zone consistency checks (getoriginnode, find,
findnode, findrdataset, attachnode, detachnode, deletedata).

the QP trie doesn't support the find callback mechanism available
in dns_rbt_findnode() which allows examination of intermediate nodes
while searching, so the detection of wildcard and delegation nodes
is now done by scanning QP chains after calling dns_qp_lookup().

Note that the lookup in previous_closest_nsec() cannot return
ISC_R_NOTFOUND. In RBTDB, we checked for this return value and
ovewrote the result with ISC_R_NOMORE if it occurred. In the
qpzone implementation, we insist that this return value cannot happen.
dns_qp_lookup() would only return ISC_R_NOTFOUND if we asked for a
name outside the zone's authoritative domain, and we never do that
when looking up a predecessor NSEC record.

named-checkzone is now able to load a zone and check it for errors,
but cannot dump it.

2 years agouse "qpzone" by default in named-checkzone
Evan Hunt [Sun, 5 Nov 2023 09:37:01 +0000 (10:37 +0100)] 
use "qpzone" by default in named-checkzone

this is for testing of database loading/dumping features.
it doesn't work yet.

2 years agostub dns_qpmulti-based zone database implementation
Evan Hunt [Wed, 4 Oct 2023 01:55:24 +0000 (18:55 -0700)] 
stub dns_qpmulti-based zone database implementation

created files for a dns_qpmulti-based zone database, "qpzone".
currently this only has create and destroy functions.

2 years agoMerge branch '4623-dns_db_setloop-at-wrong-place-in-cache_create_db' into 'main'
Mark Andrews [Thu, 7 Mar 2024 02:50:22 +0000 (02:50 +0000)] 
Merge branch '4623-dns_db_setloop-at-wrong-place-in-cache_create_db' into 'main'

Resolve "dns_db_setloop at wrong place in cache_create_db"

Closes #4623

See merge request isc-projects/bind9!8838

2 years agodns_db_setloop called at wrong place on wrong db
Mark Andrews [Thu, 7 Mar 2024 02:10:23 +0000 (13:10 +1100)] 
dns_db_setloop called at wrong place on wrong db

In cache_create_db, dns_db_setloop should be called on the newly
created db only if the database creation succeeded.

2 years agoMerge branch '4621-fix-cache-pruning-after-rndc-flush' into 'main'
Ondřej Surý [Wed, 6 Mar 2024 18:17:25 +0000 (18:17 +0000)] 
Merge branch '4621-fix-cache-pruning-after-rndc-flush' into 'main'

Move the dns_db_setloop into cache_create_db()

Closes #4621

See merge request isc-projects/bind9!8834

2 years agoAdd CHANGES and release note for [GL #4621]
Ondřej Surý [Wed, 6 Mar 2024 12:39:25 +0000 (13:39 +0100)] 
Add CHANGES and release note for [GL #4621]

2 years agoMove the dns_db_setloop into cache_create_db()
Ondřej Surý [Wed, 6 Mar 2024 17:14:32 +0000 (18:14 +0100)] 
Move the dns_db_setloop into cache_create_db()

The dns_cache_flush() drops the old database and creates a new one, but
it forgets to pass the loop that runs the node pruning and cleaning
the rbtdb when flushing it next time.  This causes the cleaning to skip
cleaning the parent nodes (with .down == NULL) leading to increased
memory usage over time until the database is unable to keep up and just
stays overmem all the time.

2 years agoMerge branch '4621-placeholder' into 'main'
Ondřej Surý [Wed, 6 Mar 2024 17:33:08 +0000 (17:33 +0000)] 
Merge branch '4621-placeholder' into 'main'

Add placeholder CHANGES note for [GL #4621]

See merge request isc-projects/bind9!8828

2 years agoAdd placeholder CHANGES note for [GL #4621]
Ondřej Surý [Wed, 6 Mar 2024 12:30:43 +0000 (13:30 +0100)] 
Add placeholder CHANGES note for [GL #4621]

2 years agoMerge branch 'ondrej/fix-load_names-rbt-name' into 'main'
Ondřej Surý [Wed, 6 Mar 2024 16:55:25 +0000 (16:55 +0000)] 
Merge branch 'ondrej/fix-load_names-rbt-name' into 'main'

Revert the s/rbt/qp/ change in load_names, it is still rbt

See merge request isc-projects/bind9!8833

2 years agoRevert the s/rbt/qp/ change in load_names, it is still rbt
Ondřej Surý [Wed, 6 Mar 2024 16:54:05 +0000 (17:54 +0100)] 
Revert the s/rbt/qp/ change in load_names, it is still rbt

2 years agoMerge branch 'ondrej/restore-prune_tree-behaviour' into 'main'
Ondřej Surý [Wed, 6 Mar 2024 12:04:39 +0000 (12:04 +0000)] 
Merge branch 'ondrej/restore-prune_tree-behaviour' into 'main'

Restore the parent cleaning logic in prune_tree()

See merge request isc-projects/bind9!8823

2 years agoRestore the parent cleaning logic in prune_tree()
Ondřej Surý [Mon, 4 Mar 2024 06:34:34 +0000 (07:34 +0100)] 
Restore the parent cleaning logic in prune_tree()

Reconstruct the variant of the prune_tree() parent cleaning to consider
all elibible parents in a single loop as we were doing before all the
changes that led to this commit.

Update code comments so that they more precisely describe what the
relevant bits of code actually do.

2 years agoMerge branch '4411-qpdb-lite' into 'main'
Matthijs Mekking [Wed, 6 Mar 2024 10:19:36 +0000 (10:19 +0000)] 
Merge branch '4411-qpdb-lite' into 'main'

Replace rbt with qp

Closes #4411

See merge request isc-projects/bind9!8726

2 years agoadd a compile-time option to select default zone and cache DB
Evan Hunt [Wed, 6 Mar 2024 00:17:33 +0000 (16:17 -0800)] 
add a compile-time option to select default zone and cache DB

by default, QPDB is the database used by named and all tools and
unit tests. the old default of RBTDB can now be restored by using
"configure --with-zonedb=rbt --with-cachedb=rbt".

some tests have been fixed so they will work correctly with either
database.

CHANGES and release notes have been updated to reflect this change.

2 years agoFix xferquota system test
Matthijs Mekking [Thu, 29 Feb 2024 10:12:50 +0000 (11:12 +0100)] 
Fix xferquota system test

The change from RBT to QP has changed the contents of generated zone
files slightly: node names are now always absolute, so instead of using
$ORIGIN and relative names, generated zone files use full names for all
records.

This caused a failure in the xferquota system test, which was looking
for a relative name in secondary zone files. Replace the string
matching with a regular expression to fix the test.

2 years agoFix race condition crash
Matthijs Mekking [Mon, 19 Feb 2024 11:05:34 +0000 (12:05 +0100)] 
Fix race condition crash

When running resolver benchmark pipeline, a crash occurred:

https://gitlab.isc.org/isc-projects/bind9-shotgun-ci/-/pipelines/163946

In the code we are doing a lookup, it fails (meaning there is no node
with lookup name), we create the node and insert it and it fails.
But dns_qp_insert can only return ISC_R_SUCCESS or ISC_R_EXISTS.
So it must have been inserted in between. This is a race condition bug.

The first lookup only requires a write lock and if the lookup failed
the lock gets upgraded to a write lock and we insert the missing data.

To fix the race condition bug, we need to do a lookup again after we
have upgraded the lock to make sure it wasn't inserted in the mean
time.

2 years agoRemove pruning tree code
Matthijs Mekking [Mon, 19 Feb 2024 10:45:05 +0000 (11:45 +0100)] 
Remove pruning tree code

Since qp-tries does not store interior nodes, we can remove all code
related to pruning the tree.

2 years agoUpdate qpdb.c to make coccinelle happy
Matthijs Mekking [Mon, 12 Feb 2024 15:09:34 +0000 (16:09 +0100)] 
Update qpdb.c to make coccinelle happy

Applying semantic patch cocci/isc_mem_cget.spatch...
150 files match
diff -u -p a/lib/dns/qpdb.c b/lib/dns/qpdb.c
--- a/lib/dns/qpdb.c
+++ b/lib/dns/qpdb.c
@@ -3801,16 +3801,15 @@ dns__qpdb_create(isc_mem_t *mctx, const
goto cleanup_tree_lock;
}
INSIST(qpdb->node_lock_count < (1 << DNS_RBT_LOCKLENGTH));
- qpdb->node_locks = isc_mem_get(mctx, qpdb->node_lock_count *
-       sizeof(db_nodelock_t));
+ qpdb->node_locks = isc_mem_cget(mctx, qpdb->node_lock_count,
+  sizeof(db_nodelock_t));

qpdb->common.update_listeners = cds_lfht_new(16, 16, 0, 0, NULL);

if (IS_CACHE(qpdb)) {
dns_rdatasetstats_create(mctx, &qpdb->rrsetstats);
- qpdb->lru = isc_mem_get(mctx,
-  qpdb->node_lock_count *
-  sizeof(dns_slabheaderlist_t));
+ qpdb->lru = isc_mem_cget(mctx, qpdb->node_lock_count,
+   sizeof(dns_slabheaderlist_t));
for (i = 0; i < (int)qpdb->node_lock_count; i++) {
ISC_LIST_INIT(qpdb->lru[i]);
}
@@ -3819,8 +3818,8 @@ dns__qpdb_create(isc_mem_t *mctx, const
/*
 * Create the heaps.
 */
- qpdb->heaps = isc_mem_get(hmctx, qpdb->node_lock_count *
-   sizeof(isc_heap_t *));
+ qpdb->heaps = isc_mem_cget(hmctx, qpdb->node_lock_count,
+     sizeof(isc_heap_t *));
for (i = 0; i < (int)qpdb->node_lock_count; i++) {
qpdb->heaps[i] = NULL;
}
@@ -3834,8 +3833,8 @@ dns__qpdb_create(isc_mem_t *mctx, const
/*
 * Create deadnode lists.
 */
- qpdb->deadnodes = isc_mem_get(mctx, qpdb->node_lock_count *
-      sizeof(dns_qpdatalist_t));
+ qpdb->deadnodes = isc_mem_cget(mctx, qpdb->node_lock_count,
+ sizeof(dns_qpdatalist_t));
for (i = 0; i < (int)qpdb->node_lock_count; i++) {
ISC_LIST_INIT(qpdb->deadnodes[i]);
}