44491 Commits

Author SHA1 Message Date
Evan Hunt
9afe83c546 fix: doc: correct a double negative in the padding doc
`padding` is incompatible with TSIG and SIG(0), not with "no" TSIG
and SIG(0).

Merge branch 'each-fix-padding-doc' into 'main'

See merge request isc-projects/bind9!11333
2025-12-05 22:31:43 +00:00
Evan Hunt
d054741d92 correct a double negative in the padding doc
`padding` is incompatible with TSIG and SIG(0), not with "no" TSIG
and SIG(0).
2025-12-05 22:31:36 +00:00
Colin Vidal
8055747146 chg: usr: Add Extended DNS Error 13 (Cached Error) support
Extended DNS Error 13 (Cached Error) is now returned when the server
answers a message from a cached SERVFAIL.

See RFC 8914 section 4.14.

See #1836

Merge branch '1836-sfcache-ede' into 'main'

See merge request isc-projects/bind9!11322
2025-12-05 23:28:36 +01:00
Colin Vidal
0b9da992a5 add tests for EDE 13 support
Add system test covering EDE 13 being added in the response in case of
SERVFAIL cache hits.
2025-12-05 23:28:29 +01:00
Colin Vidal
430c0ce76a support EDE 13 (Cached Error)
Extended DNS Error 13 (Cached Error) is now returned when the server
answers a message from a cached SERVFAIL.

See RFC 8914 section 4.14.
2025-12-05 23:28:29 +01:00
Matthijs Mekking
42b0046d1e fix: usr: Make key rollovers more robust
A manual rollover when the zone is in an invalid DNSSEC state causes predecessor keys to be removed too quickly. Additional safeguards to prevent this have been added. DNSSEC records will not be removed from the zone until the underlying state machine has moved back into a valid DNSSEC state.

Closes #5458

Merge branch '5458-safeguard-against-key-rollovers-when-in-invalid-state' into 'main'

See merge request isc-projects/bind9!10813
2025-12-05 12:07:39 +00:00
Matthijs Mekking
14a243a81d Fix statschannel system test
The manykeys test case relies on keys being removed. Make sure the
zone is fully signed with the keys that will stay, so the other keys
may be removed safely.

This means the expected number of signatures generated and refreshed
will change. The CDS and CDNSKEY RRset also need to be signed now.

Configure the test case with sig-signing-signatures 100, large enough
that the entire zone is processed in a single step.
2025-12-05 12:14:14 +01:00
Matthijs Mekking
a8339be0f8 Fix nsec3 system test
The nsec3 system test has a couple of cases where the configured policy
changes the algorithm, effectively triggering an algorithm rollover. Fix
those cases to start in a valid DNSSEC state. Then fix the expected key
states, no longer should the old algorithm be removed immediately.
2025-12-05 12:14:14 +01:00
Matthijs Mekking
c756b8a505 Fix autosign system test
When creating keys, set Publish and Activate times so that keys will
be initialized as omnipresent. This way we start with a safe DNSSEC
state. In most cases at least, because some tests depend on special
key timings.

The ttl[1-4].example cases have become incorrect. With dnssec-policy
we require the TTL to match the dnskey-ttl from the policy.

The delzsk.example will have a ZSK removed from the zone. It also
requires that the DNSKEY RRset is already published. This means
that for the existing keys the, no longer "is now published"
messages will be logged.

The nsec-only.example and reconf.example zones are fixed to have a
correct matching policy.

This all means the expected count of log messages changes slightly.
2025-12-05 12:14:14 +01:00
Matthijs Mekking
67ea0e656b Fix views system test
This test case enables DNSSEC and has a mismatch in policy. Fix the
policy so that it matches the existing key set, and adjust the
expected answer count because no longer a new key is generated.
2025-12-05 12:14:14 +01:00
Matthijs Mekking
b19871f8a2 Make keymgr state machine more robust
If the keymgr state machine is in an invalid state, it tries to move
it self to a valid state. But when you do key rollovers during an
invalid state, and the next state is also an invalid state, the keymgr
will happily do the transition.

It would be good to not do key rollovers if there is not a KSK and ZSK
fully omnipresent. But also it would be good to safeguard against
unexpected transitions.

This commit does that by not moving things to unretentive (which is
the state where we would remove the corresponding record from the zone)
if the state machine is currently in an invalid state.
2025-12-05 12:14:14 +01:00
Matthijs Mekking
149ca5d46a Rollover test case for rumoured zone signatures
Test a manual rollover when zone signatures have not become omnipresent
yet. This should not immediately remove the predecessor key.
2025-12-05 12:14:14 +01:00
Matthijs Mekking
04b8747761 fix: doc: Fix sig-signing-* duplicate documentation
Merge branch 'matthijs-doc-sig-signing-options' into 'main'

See merge request isc-projects/bind9!11324
2025-12-05 10:52:37 +00:00
Matthijs Mekking
c3951cdec0 Fix sig-signing-* duplicate documentation 2025-12-05 11:17:06 +01:00
Colin Vidal
38ce29066b chg: dev: Shrunk cfgobj down from 72 bytes to 48 bytes
Make all non-scalar properties of `cfg_obj_t` allocated values, which
ensures the union size is the width of one pointer. Also reorder the
fields inside `cfg_obj_t` to avoid alignment padding that would increase
the size. As a result, a `cfg_obj_t` instance is now 48 bytes on a
64-bit platform.

Add a static assertion to avoid increasing the size of the struct by
mistake.

The function `parse_sockaddrsub` was taking advantage of the fact that
both sockaddr and sockaddrtls were in the same position, and used to
initialize the sockaddr field independently if this was a -tls one or
not. This doesn't work anymore now that all fields are allocated,
so it has been slightly rewritten to take both cases into account
separately.

Merge branch 'colin/cfgobj-48bytes' into 'main'

See merge request isc-projects/bind9!11239
2025-12-05 09:35:58 +01:00
Colin Vidal
77e0104cf4 shrunk cfgobj down to 48bytes
Make all non-scalar properties of `cfg_obj_t` allocated values, which
ensures the union size is the width of one pointer. Also reorder the
fields inside `cfg_obj_t` to avoid alignment padding that would increase
the size. As a result, a `cfg_obj_t` instance is now 48 bytes on a
64-bit platform.

Add a static assertion to avoid increasing the size of the struct by
mistake.

The function `parse_sockaddrsub` was taking advantage of the fact that
both sockaddr and sockaddrtls were in the same position, and used to
initialize the sockaddr field independently if this was a -tls one or
not. This doesn't work anymore now that all fields are allocated,
so it has been slightly rewritten to take both cases into account
separately.
2025-12-05 08:59:53 +01:00
Colin Vidal
b97991463e chg: dev: Remove memory context form cfg_obj_t
Removes the `cfg_obj_t` memory context pointer, as the parser always uses `isc_g_mctx`. This simplifies the parser API/configuration tree API (no need to pass the memory context); and the `cfg_obj_t` size goes down from 80 bytes to 72 bytes.

While not directly related to the changes, also remove the `cfg_parser_t` `references` field as it is not used anymore (since the `cfg_obj_t` types doesn't reference it anymore).

Merge branch 'colin/remove-memctx-cfgobj' into 'main'

See merge request isc-projects/bind9!11199
2025-12-04 16:42:42 +01:00
Colin Vidal
c3b7b56dd0 document usage of BIND9 constructors/destructors
Document the way `__attribute__((__constructor__))` and
`__attribute__((__destructor__))` must be used in BIND9 libraries in
order to avoid unexpected behaviors with other third-party libraries.
2025-12-04 16:09:40 +01:00
Colin Vidal
15aa160e2e remove --memstats from cfg_test
The `--memstats` option from cfg_test is unused, and even if used, does
nothing because `--memstats` relies on `isc_mem_stats` which dump memory
pools statistics, which are not used at all for configuration.

Also, dropping the option avoid to add a parser API to get the memory
stats (as the parser now uses the global memory context).
2025-12-04 16:09:40 +01:00
Colin Vidal
93f8b2f5bf remove memory context from parser context
As the isccfg library now uses the global memory context, it is now
used directly instead of passing the parser context around to grab its
memory context.

Also remove the memory context from the parser, as well as from
`cfg_obj_t`, as it's now useless.
2025-12-04 16:09:40 +01:00
Colin Vidal
f7b64e2e87 cfg_parse_ API doesn't need memory context
Because the parser now uses global memory context, the cfg_parse_* API
doesn't take a memory context anymore.
2025-12-04 16:09:40 +01:00
Colin Vidal
bc82db7b82 remove references from cfg_parser_t
The parser used to be referenced by `cfg_obj_t`, but not anymore.
Removing the reference counter from `cfg_parser_t`.
2025-12-04 16:09:40 +01:00
Colin Vidal
870b7329f8 parser: add cfg_string_create() API
The parser has a static function `create_string()` used
internally. But there was duplicate code to create a string node
in `namedconf.c`.  Instead of implementing the same logic twice,
`create_string()` is now publicly exposed as `cfg_string_create()`.
2025-12-04 16:09:40 +01:00
Andoni Duarte
48f11cb784 chg: doc: Set up version for BIND 9.21.17
Merge branch 'andoni/set-up-version-for-bind-9.21.17' into 'main'

See merge request isc-projects/bind9!11319
2025-12-04 09:34:57 +00:00
Andoni Duarte Pintado
65dc0ceab6 Update BIND version to 9.21.17-dev 2025-12-04 09:57:25 +01:00
Evan Hunt
a45d253882 fix: dev: Standardize CHECK and RETERR macros
Previously, there were over 40 separate definitions of `CHECK` macros, of
which most used `goto cleanup`, and the rest `goto failure` or `goto out`.
There were another 10 definitions of `RETERR`, of which most were identical
to `CHECK`, but some simply returned a result code instead
of jumping to a cleanup label.

This has now been standardized throughout the code base: `RETERR` is for
returning an error code in the case of an error, and `CHECK` is for jumping
to a cleanup tag, which is now always called `cleanup`. Both macros are
defined in `isc/util.h`.

Merge branch 'each-check-and-cleanup' into 'main'

See merge request isc-projects/bind9!10472
2025-12-04 03:15:12 +00:00
Evan Hunt
d4ebea1037 use a standard CLEANUP macro
CLEANUP is a macro similar to CHECK but unconditional, jumping
to cleanup even if the result is ISC_R_SUCCESS. It is now used
in place of DST_RET, CLEANUP_WITH, and CHECK(<non-success constant>).
2025-12-03 13:45:43 -08:00
Evan Hunt
1d83601c58 add coccinelle script
add a semantic patch to prevent (most) future uses of the
CHECK and RETERR patterns.
2025-12-03 13:45:43 -08:00
Mark Andrews
6c0f1b212e Remove unreachable code
Remove some code checking for return values that are not possible.
2025-12-03 13:45:43 -08:00
Mark Andrews
5bd9f16ec0 Use isc_result_t more consistently
Some functions to check private data when parsing keys previously
used integer return codes, and have been updated to use isc_result_t.
2025-12-03 13:45:43 -08:00
Mark Andrews
0e230c86d2 Rename isc_result_t ret; to isc_result_t result;
Standardize result variable naming by using 'result' in most places.
2025-12-03 13:45:43 -08:00
Evan Hunt
6b33b7fc77 switch to RETERR where it wasn't being used
replace all instances of the pattern:

        result = <statement>
        if (result != ISC_R_SUCCESS) {
                return result;
        }

with:

        RETERR(<statement>);
2025-12-03 13:45:43 -08:00
Evan Hunt
38e94cc7da switch to CHECK where it wasn't being used
replace all instances of the pattern:

        result = <statement>
        if (result != ISC_R_SUCCESS) {
                goto cleanup;
        }

with:

        CHECK(<statement>);
2025-12-03 13:45:42 -08:00
Evan Hunt
52bba5cc34 standardize CHECK and RETERR macros
previously, there were over 40 separate definitions of CHECK macros, of
which most used "goto cleanup", and the rest "goto failure" or "goto
out". there were another 10 definitions of RETERR, of which most were
identical to CHECK, but some simply returned a result code instead of
jumping to a cleanup label.

this has now been standardized throughout the code base: RETERR is for
returning an error code in the case of an error, and CHECK is for jumping
to a cleanup tag, which is now always called "cleanup". both macros are
defined in isc/util.h.
2025-12-03 13:26:28 -08:00
Colin Vidal
2955bb90c8 chg: dev: Add RRSIG if required as soon as they are found
When EDNS DO flag (`dig +dnssec`) flag is set, an rdataset is allocated
to hold the RRSIG of an RR, if present in DB. However, this allocation
is not done if the zone DB is not considered as secure
(`dns_db_issecure() == false`). Changes this behaviour by allocating the
rdataset anyway, so the RRSIG can be associated in the answer section of
the response as soon it is found from the DB.

The fact we attach the rrsig potentially more often (though it probably
occurs in edge cases) doesn't seems to affect performance in any ways:

Merge branch 'colin/rrsig-nonsecure-db' into 'main'

See merge request isc-projects/bind9!11317
2025-12-03 16:26:22 +01:00
Colin Vidal
6998fe42e3 test for RRSIG provided as soon as they are found
Add a system test which checks that a server authoritative on zone which
is not fully signed (here, it is missing the DNSKEY records as well as the
RRSIG on the RR `b`) still return the RRSIG associated with an RR if
provided in the zone.
2025-12-03 15:49:47 +01:00
Colin Vidal
3048b2a578 add RRSIG if required as soon as they are found
When EDNS DO flag (`dig +dnssec`) flag is set, an rdataset is allocated
to hold the RRSIG of an RR, if present in DB. However, this allocation
is not done if the zone DB is not considered as secure
(`dns_db_issecure() == false`). Changes this behaviour by allocating the
rdataset anyway, so the RRSIG can be associated in the answer section of
the response as soon it is found from the DB.
2025-12-03 15:49:47 +01:00
Arаm Sаrgsyаn
93fa62c3e0 fix: test: Fix an issue with unreachable cache's unit test
The isc_stdtime_now() function used by dns_unreachcache_find() to
check if the entry needs to be expired has a one-second resolution,
and the test sleeps for 1 second and then for the amount of the
expiration interval, which in a worst-case scenario can cause the
test to fail, because the entry was expected to be expired but it
wasn't. Sleep for 2 seconds instead of 1 to avoid the timing
resolution issue.

Closes #5601

Merge branch '5601-unreachable-cache-expire-test-fix' into 'main'

See merge request isc-projects/bind9!11224
2025-12-03 10:16:08 +00:00
Aram Sargsyan
8c8bf4e45d Fix an issue with unreachable cache's unit test
The isc_stdtime_now() function used by dns_unreachcache_find() to
check if the entry needs to be expired has a one-second resolution,
and the test sleeps for 1 second and then for the amount of the
expiration interval, which in a worst-case scenario can cause the
test to fail, because the entry was expected to be expired but it
wasn't. Sleep for 2 seconds instead of 1 to avoid the timing
resolution issue.
2025-12-02 16:03:26 +00:00
Mark Andrews
b378336155 fix: nil: Fix mislocated 'break;'
Closes #5665

Merge branch '5665-miss-located-break' into 'main'

See merge request isc-projects/bind9!11311
2025-12-02 14:24:47 +11:00
Mark Andrews
99c848e4a4 Fix mislocated break 2025-12-02 14:24:25 +11:00
Mark Andrews
e78e6150e5 new: usr: Add +[no]showtruncated and +[no]showallmessages to dig
The dig option +showtruncated adds the ability to display
the truncated message before retrying the query over TCP.

The dig option +showallmessages add a short cut which is
the equivalent of "dig +qr +showbadcookie +showbadversion
+showtruncated".

Closes #5657

Merge branch '5657-add-showtruncated-to-dig' into 'main'

See merge request isc-projects/bind9!11275
2025-12-02 10:11:49 +11:00
Mark Andrews
21b1ee5f80 Add +showallmessages to dig
This is equivalent to "dig +qr +showbadcookie +showbadversion
+showtruncated".
2025-12-02 09:34:13 +11:00
Mark Andrews
472cade02b check that dig +showtruncated works 2025-12-02 09:34:13 +11:00
Mark Andrews
44f12f9e61 Add +[no]showtruncated to dig
Adds the ability to display the truncated message before retrying
the query over TCP.
2025-12-02 09:34:13 +11:00
Michał Kępień
1c55e76b92 chg: doc: Update CVE checklist
Account for the recent nomenclature change in the CVE checklist.

Add a placeholder for a link to an Earliest Notification draft for every
vulnerability handled.

Use consistent Markdown reference names for all URLs in the summary
table.  Provide a template for all URLs to indicate naming expectations.

Merge branch 'michal/update-cve-checklist' into 'main'

See merge request isc-projects/bind9!11313
2025-12-01 14:43:23 +01:00
Michał Kępień
d95095e9dc Clean up URL templates in the summary table
Use consistent Markdown reference names for all URLs in the summary
table.  Provide a template for all URLs to indicate naming expectations.
2025-12-01 14:31:39 +01:00
Michał Kępień
fe68307aad Add Earliest Notification row to the summary table
Add a placeholder for a link to an Earliest Notification draft for every
vulnerability handled.
2025-12-01 14:31:39 +01:00
Michał Kępień
bb04e5e6e0 Replace "ASN" with "EVN" in the CVE checklist
Account for the recent nomenclature change in the CVE checklist.
2025-12-01 14:31:39 +01:00
Matthijs Mekking
edcbcdd081 chg: test: Wait for log zone_needdump is more reliable
Closes #5648

Merge branch '5648-need-dump-instead-of-sending-notifies' into 'main'

See merge request isc-projects/bind9!11265
2025-12-01 13:17:59 +00:00