2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-08-31 14:35:26 +00:00
Commit Graph

42551 Commits

Author SHA1 Message Date
Ondřej Surý
2d53796e28 Clean up 'now' usage in the cache
Unify the way we handle the 'now' argument in the cache: when it's
set to zero by the caller, it is replaced with isc_stdtime_now().
2025-02-18 20:15:00 +00:00
Ondřej Surý
3b2fe808c4 Clean up the search part in qpcache_find()
Slightly refactor the header search in qpcache_find(), so the scope
level is reduced and the cname parts are logically grouped together.
2025-02-18 20:15:00 +00:00
Ondřej Surý
bfb219ac2d Refactor the search in qpcache_findrdataset()
Add new related_headers() function that simplifies the code
flow in qpcache_findrdataset().  Also use check_stale_header() function
to remove code duplication.
2025-02-18 20:15:00 +00:00
Ondřej Surý
cf66ba02a4 Refactor simple slabheader matching
Add a helper function both_headers() that unifies the slabheader
matching for simple type: it returns true when both the type and
the matching RRSIG have been found.
2025-02-18 20:15:00 +00:00
Ondřej Surý
4cd1dd8dd7 Add new helper maybe_update_headers() function
The new maybe_update_headers() function unifies the LRU updates to the
slabheaders that was scattered all over the place.  More calls to update
headers after bindrdatasets() were also added for completeness.
2025-02-18 20:15:00 +00:00
Ondřej Surý
4448f1adb2 Add bindrdatasets() function that binds both rdatasets
This removes code duplication between the dual bindrdataset() calls.  It
also unifies the handling as there were small differences between the
calls: one variant was checking for !NEGATIVE(found) condition and one
wasn't, and it is technically ok to do the check for all variants.
2025-02-18 20:15:00 +00:00
Ondřej Surý
53d9ef5bd0 Refactor check_stale_header() function
The check_stale_header() function now updates header_prev directly
so it doesn't have to be handled in the outer loop; it's always
set to the correct value of the previous header in the chain.
2025-02-18 20:15:00 +00:00
Evan Hunt
b24981ea02 add missing "failed" message in digdelv test
there was a test case that could fail (and did) without logging
the fact.
2025-02-18 20:15:00 +00:00
Evan Hunt
5281c708d3 clean up unnecessary code in qpcache
some code was left in the cache database implementation after
it was separated from the zone database, and can be cleaned up
and refactored now:

- the DNS_SLABHEADERATTR_IGNORE flag is never set in the cache
- support for loading the cache from was removed, but the add()
  function still had a 'loading' flag that's always false
- two different macros were used for checking the
  DNS_SLABHEADERATTR_NONEXISTENT flag - EXISTS() and NONEXISTENT().
  it's clearer to just use EXISTS().
- the cache doesn't support versions, so it isn't necessary to
  walk down the 'down' pointer chain when iterating through the
  cache or looking for a header to update.  'down' now only points
  to records that are deleted from the cache but have not yet been
  purged from memory. this allows us to simplify both the iterator
  and the add() function.
2025-02-18 20:15:00 +00:00
Petr Špaček
d34414c47b new: usr: Add HTTPS record query to host command line tool
The host command was extended to also query for the HTTPS RR type by default.

Merge branch 'feature/main/host-rr-https' into 'main'

See merge request isc-projects/bind9!8642
2025-02-18 14:56:39 +00:00
Petr Menšík
82069a5700 Do HTTPS record query from host in addition
Unless explicitly specified type from host command, do fourth query for
type HTTPS RR. It is expected it will become more common and some
systems already query that record for every name.
2025-02-18 14:56:08 +00:00
Artem Boldariev
1f6a16e6d0 fix: dev: Fix wrong logging severity in do_nsfetch()
ISC_LOG_WARNING was used while ISC_LOG_DEBUG(3) was implied.

Closes #5145

Merge branch '5145-artem-fix-wrong-logging-severity-in-do_nsfetch' into 'main'

See merge request isc-projects/bind9!10017
2025-02-18 09:01:39 +00:00
Artem Boldariev
fd3beaba2e Fix wrong logging severity in do_nsfetch()
ISC_LOG_WARNING was used while ISC_LOG_DEBUG(3) was implied.
2025-02-18 10:28:23 +02:00
Matthijs Mekking
bf7efe03b0 fix: doc: Fix typo in ARM related to max-stale-ttl
The text that stale-cache-enable is set to no has no effect on
max-cache-ttl, but on max-stale-ttl.

Closes #5181

Merge branch '5181-max-stale-ttl-typo-arm' into 'main'

See merge request isc-projects/bind9!10108
2025-02-18 07:33:55 +00:00
Matthijs Mekking
b017d9fe67 Fix typo in ARM related to max-stale-ttl
The text that stale-cache-enable is set to no has no effect on
max-cache-ttl, but on max-stale-ttl.
2025-02-18 07:33:43 +00:00
Evan Hunt
d6b63210a8 fix: dev: Fix dns_qp_insert() checks in qpzone
Remove code in the QP zone database to handle failures of `dns_qp_insert()` which can't actually happen.

Closes #5171

Merge branch '5171-qpzone-insert-checks' into 'main'

See merge request isc-projects/bind9!10088
2025-02-18 05:54:33 +00:00
Evan Hunt
fffa150df3 fix dns_qp_insert() checks in qpzone
in some places there were checks for failures of dns_qp_insert()
after dns_qp_getname(). such failures could only happen if another
thread inserted a node between the two calls, and that can't happen
because the calls are serialized with dns_qpmulti_write(). we can
simplify the code and just add an INSIST.
2025-02-17 12:21:50 -08:00
Michal Nowak
766805a374 chg: test: Rewrite keyfromlabel system test to pytest
Merge branch 'mnowak/pytest_rewrite_keyfromlabel' into 'main'

See merge request isc-projects/bind9!9188
2025-02-17 19:19:32 +00:00
Michal Nowak
409f394d6e Rewrite keyfromlabel system test to pytest 2025-02-17 19:18:04 +00:00
Michal Nowak
0921e91a4b chg: test: Rewrite keepalive system test to pytest
Merge branch 'mnowak/pytest_rewrite_keepalive' into 'main'

See merge request isc-projects/bind9!9202
2025-02-17 19:16:18 +00:00
Michal Nowak
b804a70fac Rewrite keepalive system test to pytest 2025-02-17 19:16:03 +00:00
Michal Nowak
7347abd01f Add Dig interface 2025-02-17 19:16:03 +00:00
Arаm Sаrgsyаn
3f61a87be3 fix: usr: Use named Service Parameter Keys (SvcParamKeys) by default
When converting SVCB records to text representation `named` now uses named
`SvcParamKeys` values unless backward-compatible mode is activated,
in which case the values which were not defined initially in
RFC9460 and were added later (see [1]) are converted to opaque
"keyNNNN" syntax, like, for example, "key7" instead of "dohpath".

Also a new `+[no]svcparamkeycompat` option is implemented for `dig`,
which enables the backward-compatible mode and uses the opaque
syntax, if required for interoperability with other software or
scripts. By default, the compatibility mode is disabled.

[1] https://www.iana.org/assignments/dns-svcb/dns-svcb.xhtml

Closes #5156

Merge branch '5156-svcparamkey-use-named-keys-by-default' into 'main'

See merge request isc-projects/bind9!10085
2025-02-17 18:24:02 +00:00
Aram Sargsyan
9d441c93d0 Update the rdata unit test
Update the rdata unit test to accommodate the change in the default
represenation of the Service Parameter Keys (SvcParamKeys) for the
SVCB records.
2025-02-17 17:33:43 +00:00
Aram Sargsyan
3482d7e694 Test dig +svcparamkeycompat
This check in the nsupdate system test expects the opaque
representation of the "dohpath" Service Parameter Key. Use
the +svcparamkeycompat dig option to enable it.
2025-02-17 17:33:43 +00:00
Aram Sargsyan
583a838c25 Implement dig +[no]svcparamkeycompat
The new +[no]svcparamkeycompat option for dig enables the
backward-compatible mode for the Service Parameter Keys'
(SvcParamKeys) representation format. See the previous commit
for more information.
2025-02-17 17:33:43 +00:00
Aram Sargsyan
d5d63d6253 Fix a bug in generic_totext_in_svcb()
The 'sbpr_dohpath' case was missing from the switch-case. Add the
'sbpr_dohpath' case, which should work similarly as the 'sbpr_text'
case.
2025-02-17 17:33:43 +00:00
Aram Sargsyan
c6e3695478 Use named Service Parameter Keys (SvcParamKeys) by default
When converting SVCB records to text representation use named
SvcParamKeys values unless backward-compatible mode is activated,
in which case the values which were not defined initially in
RFC9460 and were added later (see [1]) are converted to opaque
"keyN" syntax, like, for example, "key7" instead of "dohpath".

[1] https://www.iana.org/assignments/dns-svcb/dns-svcb.xhtml

Co-authored-by: sdomi <ja@sdomi.pl>
2025-02-17 17:33:43 +00:00
Alessio Podda
5559539eb0 chg: dev: Refactor and simplify isc_symtab
This commit does several changes to isc_symtab:

1. Rewrite the isc_symtab to internally use isc_hashmap instead of
   hand-stiched hashtable.

2. Create a new isc_symtab_define_and_return() api, which returns
   the already defined symvalue on ISC_R_EXISTS; this allows users
   of the API to skip the isc_symtab_lookup()+isc_symtab_define()
   calls and directly call isc_symtab_define_and_return().

3. Merge isccc_symtab into isc_symtab - the only missing function
   was isccc_symtab_foreach() that was merged into isc_symtab API.

4. Add full set of unit tests for the isc_symtab API.

Closes #5103

Merge branch '5103-use-isc_hashmap-for-isc_symtab' into 'main'

See merge request isc-projects/bind9!9921
2025-02-17 12:30:24 +00:00
alessio
53991ecc14 Refactor and simplify isc_symtab
This commit does several changes to isc_symtab:

1. Rewrite the isc_symtab to internally use isc_hashmap instead of
   hand-stiched hashtable.

2. Create a new isc_symtab_define_and_return() api, which returns
   the already defined symvalue on ISC_R_EXISTS; this allows users
   of the API to skip the isc_symtab_lookup()+isc_symtab_define()
   calls and directly call isc_symtab_define_and_return().

3. Merge isccc_symtab into isc_symtab - the only missing function
   was isccc_symtab_foreach() that was merged into isc_symtab API.

4. Add full set of unit tests for the isc_symtab API.
2025-02-17 11:43:19 +01:00
Mark Andrews
ebf1606f38 fix: usr: Fix deferred validation of unsigned DS and DNSKEY records
When processing a query with the "checking disabled" bit set (CD=1), `named` stores the unvalidated result in the cache, marked "pending". When the same query is sent with CD=0, the cached data is validated, and either accepted as an answer, or ejected from the cache as invalid. This deferred validation was not attempted for DS and DNSKEY records if they had no cached signatures, causing spurious validation failures. We now complete the deferred validation in this scenario.

Also, if deferred validation fails, we now re-query the data to find out whether the zone has been corrected since the invalid data was cached.

Closes #5066

Merge branch '5066-fix-strip-dnssec-rrsigs' into 'main'

See merge request isc-projects/bind9!10104
2025-02-16 23:36:25 +00:00
Mark Andrews
04b1484ed8 Re-fetch pending records that failed validation
If a deferred validation on data that was originally queried with
CD=1 fails, we now repeat the query, since the zone data may have
changed in the meantime.
2025-02-17 08:57:58 +11:00
Mark Andrews
8b900d1808 Complete the deferred validation if there are no RRSIGs
When a query is made with CD=1, we store the result in the
cache marked pending so that it can be validated later, at
which time it will either be accepted as an answer or removed
from the cache as invalid.  Deferred validation was not
attempted when there were no cached RRSIGs for DNSKEY and
DS.  We now complete the deferred validation in this scenario.
2025-02-17 08:57:58 +11:00
Mark Andrews
66f293a952 Add stripped DS RRSIG senario 2025-02-17 08:57:58 +11:00
Mark Andrews
a71b617566 Add stripped DNSKEY RRSIG senario 2025-02-17 08:57:58 +11:00
Mark Andrews
b694acbe45 fix: usr: "CNAME and other data check" not applied to all types
An incorrect optimization caused "CNAME and other data" errors not to be detected if certain types were at the same node as a CNAME.  This has been fixed.

Closes #5150

Merge branch '5150-cname-and-other-data-check-not-applied-to-all-types' into 'main'

See merge request isc-projects/bind9!10033
2025-02-14 02:23:52 +00:00
Mark Andrews
559fac329a Move SVCB and HTTPS to be in type code order 2025-02-14 01:51:38 +00:00
Mark Andrews
dfc367f52c Test cname-and-other-data against various types 2025-02-14 01:51:38 +00:00
Mark Andrews
5e49a9e4ae Fix "CNAME and other data" detection
prio_type was being used in the wrong place to optimize cname_and_other.
We have to first exclude and accepted types and we also have to
determine that the record exists before we can check if we are at
a point where a later CNAME cannot appear.
2025-02-14 01:51:38 +00:00
Michal Nowak
bd4729e13b chg: test: Rewrite nzd2nzf system test to pytest
Merge branch 'mnowak/pytest_rewrite_nzd2nzf' into 'main'

See merge request isc-projects/bind9!9160
2025-02-13 18:29:07 +00:00
Michal Nowak
38e751d9ac Rename assert_custom_named_is_alive to named_alive 2025-02-13 18:43:47 +01:00
Michal Nowak
7c499d1689 Rewrite nzd2nzf system test to pytest 2025-02-13 18:43:47 +01:00
Michal Nowak
42a7b6aedf chg: test: Rewrite names system test to pytest
Merge branch 'mnowak/pytest_rewrite_names' into 'main'

See merge request isc-projects/bind9!8759
2025-02-13 16:56:31 +00:00
Michal Nowak
5250ad8720 Rewrite names system test to pytest
dnspython 2.7.0 or newer is needed because of wire().
2025-02-13 16:55:38 +00:00
Michal Nowak
7b3dc7ab32 chg: test: Generate TSAN unit stress tests
This is a complement to the already present system test "stress" test.

Merge branch 'mnowak/generate-tsan-unit-stress-tests' into 'main'

See merge request isc-projects/bind9!9474
2025-02-13 16:40:25 +00:00
Michal Nowak
a03c4b4cf9 Generate TSAN unit stress tests 2025-02-13 16:39:27 +00:00
Andoni Duarte
3d3247109c chg: doc: Set up version for BIND 9.21.6
Merge branch 'andoni/set-up-version-for-bind-9.21.6' into 'main'

See merge request isc-projects/bind9!10093
2025-02-13 16:10:39 +00:00
Andoni Duarte Pintado
259678df11 Update BIND version to 9.21.6-dev 2025-02-13 15:55:46 +01:00
Michal Nowak
9b15715558 fix: ci: Do not evaluate $CI_PROJECT_DIR in generate-stress-test-configs.py
GitLab CI Runner's $builds_dir variable is set to "/builds" by default.
For technical reasons, the FreeBSD Runners, using the "instance"
executor, sets the path differently.

The value of $CI_PROJECT_DIR is based on $builds_dir, so if the
generate-stress-test-configs.py script generates jobs with
$CI_PROJECT_DIR (or variables like $INSTALL_PATH that are based on it)
evaluated, it is calcified to whatever was the value in the particular
environment, disregarding the FreeBSD "instance" executor specifics in
the child pipeline.

Instead of evaluating $CI_PROJECT_DIR in the script, evaluate it in the
runtime environment.

Merge branch 'mnowak/fix-CI_PROJECT_DIR-variable-evaluation' into 'main'

See merge request isc-projects/bind9!10075
2025-02-05 15:01:03 +00:00
Michal Nowak
dab7d28b09 Do not evaluate $CI_PROJECT_DIR in generate-stress-test-configs.py
GitLab CI Runner's $builds_dir variable is set to "/builds" by default.
For technical reasons, the FreeBSD Runners, using the "instance"
executor, sets the path differently.

The value of $CI_PROJECT_DIR is based on $builds_dir, so if the
generate-stress-test-configs.py script generates jobs with
$CI_PROJECT_DIR (or variables like $INSTALL_PATH that are based on it)
evaluated, it is calcified to whatever was the value in the particular
environment, disregarding the FreeBSD "instance" executor specifics in
the child pipeline.

Instead of evaluating $CI_PROJECT_DIR in the script, evaluate it in the
runtime environment.
2025-02-05 15:46:14 +01:00