2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-08-30 05:57:52 +00:00

40924 Commits

Author SHA1 Message Date
Michal Nowak
6a301c1d35
Rewrite rrchecker system test to pytest 2024-03-15 09:40:01 +01:00
Mark Andrews
4be1db6e82 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
2024-03-14 23:42:25 +00:00
Mark Andrews
52b053537d Add OpenSSL libraries and flags to proxystream_test 2024-03-15 10:08:57 +11:00
Evan Hunt
120b4a9ef9 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
2024-03-14 18:06:54 +00:00
Evan Hunt
1f67a3f474 CHANGES for [GL #4614] 2024-03-14 10:25:12 -07:00
Evan Hunt
17186e06bb 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
2024-03-14 10:25:07 -07:00
Evan Hunt
c0fcc2899e reduce memory consumption of rpz summary database
use dynamically allocated names instead of fixednames in rpz.c
2024-03-14 10:20:52 -07:00
Evan Hunt
8b67476249 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.
2024-03-14 10:20:52 -07:00
Evan Hunt
f908d358c4 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.
2024-03-14 10:20:52 -07:00
Matthijs Mekking
78aa2fb64c 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
2024-03-14 14:12:57 +00:00
Matthijs Mekking
ad33a73f83 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     }
2024-03-14 14:01:23 +01:00
Matthijs Mekking
8d3f601a6b 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
2024-03-14 12:53:23 +00:00
Matthijs Mekking
5b5f43babc 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.
2024-03-14 12:52:42 +00:00
Matthijs Mekking
4d560d5ffd 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
2024-03-14 11:50:17 +00:00
Matthijs Mekking
659fa0cbc3 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
2024-03-14 10:42:30 +00:00
Matthijs Mekking
1102c5d552 Merge branch '4624-duration-error-checking' into 'main'
Detect invalid durations

Closes #4624

See merge request isc-projects/bind9!8844
2024-03-14 10:08:43 +00:00
Matthijs Mekking
bc600ae2a1 Add CHANGES and release note for #4624 2024-03-14 09:07:44 +01:00
Matthijs Mekking
e39de45adc 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.
2024-03-14 08:51:46 +01:00
Mark Andrews
fd49abf254 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
2024-03-14 04:16:39 +00:00
Mark Andrews
6a91862ac5 Add CHANGES note for [GL #4608] 2024-03-14 11:40:10 +11:00
Mark Andrews
229bf863e2 Check static-stub synthesised NS is not returned 2024-03-14 11:39:27 +11:00
Mark Andrews
40816e4e35 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.
2024-03-14 11:39:27 +11:00
Evan Hunt
5a17764a77 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
2024-03-14 00:15:38 +00:00
Evan Hunt
b3c8b5cfb2 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.
2024-03-13 17:15:18 -07:00
Evan Hunt
29f1c93734 support nodefullname in rbt-zonedb.c
this enables the 'dyndb' system test to pass when we
build using --with-zonedb=rbt.
2024-03-13 17:15:18 -07:00
Evan Hunt
f0b164430a 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.
2024-03-13 17:15:18 -07:00
Mark Andrews
41eed193b2 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
2024-03-13 23:40:17 +00:00
Mark Andrews
228cc557fe Only call memmove if the rdata length is non zero
This avoids undefined behaviour on zero length rdata where the
data pointer is NULL.
2024-03-13 23:04:56 +00:00
Matthijs Mekking
377bd35574 Merge branch '4552-keymgr-depends-function-bug' into 'main'
Fix bug in keymgr Depends function

Closes #4552

See merge request isc-projects/bind9!8682
2024-03-13 10:46:25 +00:00
Matthijs Mekking
32e43764dd Add CHANGES for #4552 2024-03-13 10:58:45 +01:00
Matthijs Mekking
0aac81cf80 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.
2024-03-13 10:58:24 +01:00
Michał Kępień
03c040da53 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
2024-03-13 08:59:24 +00:00
Michał Kępień
33bdbfe2f5
Set up release notes for BIND 9.19.23 2024-03-13 09:51:24 +01:00
Michał Kępień
df0229e7ee
Update BIND version to 9.19.23-dev 2024-03-13 09:51:24 +01:00
Matthijs Mekking
8a8fad0cb5 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
2024-03-12 08:12:07 +00:00
Matthijs Mekking
c357ef900c Add CHANGES for #4625 2024-03-12 09:10:58 +01:00
Matthijs Mekking
fb2f0c8168 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.
2024-03-12 09:10:41 +01:00
Matthijs Mekking
f0bfd276e0 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.
2024-03-12 09:10:41 +01:00
Evan Hunt
28536786de Merge branch 'each-qpdb-heavy' into 'main'
create dns_qpmulti-based zone database

See merge request isc-projects/bind9!8543
2024-03-11 16:45:19 +00:00
Evan Hunt
37634f2990 CHANGES for [GL #4348] 2024-03-08 15:36:56 -08:00
Evan Hunt
5709f7bad9 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".
2024-03-08 15:36:56 -08:00
Evan Hunt
e14a116ced 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.
2024-03-08 15:36:56 -08:00
Evan Hunt
ab084d8c4f 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.
2024-03-08 15:36:56 -08:00
Evan Hunt
ac2c454f4f add a nodefullname implementation for the qpzone database
this enables the 'dyndb' system test to use a qpzone database.
2024-03-08 15:36:56 -08:00
Evan Hunt
3512cf5654 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().
2024-03-08 15:36:56 -08:00
Evan Hunt
2e45866715 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.
2024-03-08 15:36:56 -08:00
Evan Hunt
55f38e34dc 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.
2024-03-08 15:36:56 -08:00
Evan Hunt
2b4133a32c 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.
2024-03-08 15:36:56 -08:00
Evan Hunt
2222728a4f 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.
2024-03-08 15:36:56 -08:00
Evan Hunt
ab13ba2438 add qpzone_test unit test
copy the non-cache-specific tests from the old rbtdb_test.c to
qpzone_test.c.
2024-03-08 15:36:56 -08:00