2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-08-22 01:59:26 +00:00

43165 Commits

Author SHA1 Message Date
Aydın Mercan
5cd6c173ff
replace the build system with meson
Meson is a modern build system that has seen a rise in adoption and some
version of it is available in almost every platform supported.

Compared to automake, meson has the following advantages:

* Meson provides a significant boost to the build and configuration time
  by better exploiting parallelism.

* Meson is subjectively considered to be better in readability.

These merits alone justify experimenting with meson as a way of
improving development time and ergonomics. However, there are some
compromises to ensure the transition goes relatively smooth:

* The system tests currently rely on various files within the source
  directory. Changing this requirement is a non-trivial task that can't
  be currently justified. Currently the last compiled build directory
  writes into the source tree which is in turn used by pytest.

* The minimum version supported has been fixed at 0.61. Increasing this
  value will require choosing a baseline of distributions that can
  package with meson. On the contrary, there will likely be an attempt
  to decrease this value to ensure almost universal support for building
  BIND 9 with meson.
2025-06-11 10:30:12 +03:00
Michal Nowak
24026bae48 chg: doc: Set up version for BIND 9.21.10
Merge branch 'mnowak/set-up-version-for-bind-9.21.10' into 'main'

See merge request isc-projects/bind9!10567
2025-06-11 07:23:17 +00:00
Michal Nowak
50cc787d06 Update BIND version to 9.21.10-dev 2025-06-11 09:05:07 +02:00
Ondřej Surý
59585e2294 fix: dev: Try to skip lock on fully lower names
If the name is fully lowercase, we don't need to access the case bitmap in order to set the case. Therefore, we can check for the FULLYLOWERCASE flag using only atomic operations, and skip a lock in the hot path, provided we clear the FULLYLOWERCASE flag before changing the case bitmap.

Merge branch 'alessio/skip-lock-on-fully-lower-names' into 'main'

See merge request isc-projects/bind9!10497
2025-06-04 10:48:18 +00:00
Alessio Podda
4a6d7eb4f3 Try to skip lock on fully lower names
If the name is fully lowercase, we don't need to access the case bitmap
in order to set the case. Therefore, we can check for the FULLYLOWERCASE
flag using only atomic operations, and skip a lock in the hot path,
provided we clear the FULLYLOWERCASE flag before changing the case
bitmap.
2025-06-04 10:48:08 +00:00
Arаm Sаrgsyаn
b814434836 new: usr: Redesign the unreachable primaries cache
Previously, the cache for the unreachable primary servers was limited
to 10 entries (LRU) and a fixed 10 minutes delay for each entry, unless
removed forcibly by a new entry. The cache is now redesigned to remove the
10 entry limitation and to introduce delay values with exponential
backoff time - initially an unreachable primary server is cached as
being unreachable for 10 seconds, but each time the cache entry is expired
and the same server is added again during the eligibility period of the next
120 seconds, the delay time is doubled up until to the maximum of 640
seconds.

Closes #3992

Merge branch '3992-unreachable-cache-redesign' into 'main'

See merge request isc-projects/bind9!10393
2025-06-04 10:22:38 +00:00
Aram Sargsyan
0f2fba46ad Document the new unreachable cache behavior
Update the documentaion to include information about how the cache's
exponential backoff works, and how to clear the cache.
2025-06-04 09:16:35 +00:00
Aram Sargsyan
14915b0241 Redesign the unreachable primaries cache
The cache for unreachable primaries was added to BIND 9 in 2006 via
1372e172d0e0b08996376b782a9041d1e3542489. It features a 10-slot LRU
array with 600 seconds (10 minutes) fixed delay. During this time, any
primary with a hiccup would be blocked for the whole block duration
(unless overwritten by a different entry).

As this design is not very flexible (i.e. the fixed delay and the fixed
amount of the slots), redesign it based on the badcache.c module, which
was implemented earlier for a similar mechanism.

The differences between the new code and the badcache module were large
enough to create a new module instead of trying to make the badcache
module universal, which could complicate the implementation.

The new design implements an exponential backoff for entries which are
added again soon after expiring, i.e. the next expiration happens in
double the amount of time of the previous expiration, but in no more
time than the defined maximum value.

The initial and the maximum expiration values are hard-coded, but, if
required, it should be trivial to implement configurable knobs.
2025-06-04 09:16:35 +00:00
Colin Vidal
bb1458460b fix: dev: initialize queryonacl dns_view_t property
A dns_view_t has a queryonacl property, which is supposed to hold the
ACL matching the configuration "allow-query-on". However the code
parsing this configuration ACL was missing (or removed by mistake?),
hence this property was always NULL. The ACL was still built but
individually for each zone (which checks if the property exists in the
zone definition, view definition, and finally options definition).

We now create the ACL instance at the view level, enabling zones to
share the same (identical) ACL instead of having their own copies.

Merge branch 'colin/view-allowqueryon' into 'main'

See merge request isc-projects/bind9!10551
2025-06-04 08:24:18 +00:00
Colin Vidal
48dc763949 initialize queryonacl dns_view_t property
A dns_view_t has a queryonacl property, which is supposed to hold the
ACL matching the configuration "allow-query-on". However the code
parsing this configuration ACL was missing (or removed by mistake?),
hence this property was always NULL. The ACL was still built but
individually for each zone (which checks if the property exists in the
zone definition, view definition, and finally options definition).

It now create the ACL instance at the view level, enabling zones to
share the same (identical) ACL instead of having their own copies.
2025-06-04 08:55:23 +02:00
Evan Hunt
93c44ba551 new: usr: Add support for zone templates
To simplify the configuration of multiple similar zones, BIND now supports a zone template mechanism. `template` blocks containing zone options can be defined at the top level of the configuration file; they can then be referenced in `zone` statements. A zone referencing a template will use the options in the specified `template` block as defaults. (Options locally defined in the `zone` statement override the template.)

The filename for a zone can now be generated parametrically from a format specified in the `file` option. The first occurrences of `$name`, `$type` and `$view` in `file` are replaced with the zone origin, the zone type (i.e., primary, secondary, etc), and the view name, respectively.

Primary zones can now take an `initial-file` option, specifying the path to a generic zone file that will be copied into the zone's `file` path when the zone is first loaded, if the `file` does not already exist.

For example, the following template can be used for primary zones:
```
        template primary {
                type primary;
                file "$name.db";
                initial-file "generic.db";
        };
```

With this template in place, a new primary zone could be added using a single `rndc addzone` command:

```
        $ rndc addzone example.com '{ template primary; };'
```

The zone would be created using the filename `example.com.db`, which would be copied into place from `generic.db`.

Closes #2964

Merge branch '2964-zone-templates' into 'main'

See merge request isc-projects/bind9!10407
2025-06-03 19:45:06 +00:00
Evan Hunt
b8f325ae01 Add support for zone templates
A "template" statement can contain the same configuration clauses
as a "zone" statement.  A "zone" statement can now reference a
template, and all the clauses in that template will be used as
default values for the zone. For example:

    template primary {
        type primary;
        file "$name.db";
        initial-file "primary.db";
    };

    zone example.com {
        template primary;
        file "different-name.db"; // overrides the template
    };
2025-06-03 12:03:07 -07:00
Evan Hunt
598ae3f63c Allow zone names to be generated parametrically
Special tokens can now be specified in a zone "file" option
in order to generate the filename parametrically. The first
instead of "$name" in the "file" option is replaced with the
zone origin, the first instance of "$type" is replaced with the
zone type (i.e., primary, secondary, etc), and the first instance
of "$view" is replaced with the view name..

This simplifies the creation of zones using initial-file templates.
For example:

   $ rndc addzone <zonename> \
     { type primary; file "$name.db"; initial-file "template.db"
2025-06-03 12:03:07 -07:00
Evan Hunt
60b129da25 Add zone "initial-file" option
When loading a primary zone for the first time, if the zonefile
does not exist but an "initial-file" option has been set, then a
new file will be copied into place from the path specified by
"initial-file".

This can be used to simplify the process of adding new zones. For
instance, a template zonefile could be used by running:

    $ rndc addzone example.com \
        '{ type primary; file "example.db"; initial-file "template.db"; };'
2025-06-03 12:03:07 -07:00
Evan Hunt
2ad9516a72 fix: dev: Call zone syntax checks when running rndc addzone/modzone
The function that checks zone syntax in libisccfg was previously
only called when loading `named.conf`, not when parsing an an
`rndc addzone` or `rndc modzone` command. This has been corrected.

Closes #5338

Merge branch '5338-check-zoneconf' into 'main'

See merge request isc-projects/bind9!10520
2025-06-03 19:01:19 +00:00
Evan Hunt
0b8f943a6a normalize syntax checks between named and libisccfg
there were some duplicated syntax checks in named_zone_configure()
that are no longer needed, now that we perform those same checks
using isccfg_check_zoneconf().

there were also some syntax checks that were *only* in
named_zone_configure(), which have now been moved to
isccfg_check_zoneconf(). test cases for them have been
added to the checkconf system test.
2025-06-03 11:15:54 -07:00
Evan Hunt
2d57c1e737 call zone syntax checks when running rndc addzone/modzone
the function that checks zone syntax in libisccfg was previously
only called when loading named.conf, not when parsing an an
"rndc addzone" or "rndc modzone" command. this has been corrected.

note that some checks are still skipped: those that check for
duplication of filenames, key directories, etc.  to fix this, we'd need
to export the symbol tables that are set up when loading named.conf and
preserve them so they could be reused later.
2025-06-03 11:15:40 -07:00
Ondřej Surý
bf6caadd67 fix: dev: Fix builds for the OSS-Fuzz project
Add the `size` argument to the fuzzing version of the `chunk_get_raw()` function.

Merge branch '5353-fix-ossfuzz-build' into 'main'

See merge request isc-projects/bind9!10553
2025-06-03 18:03:51 +00:00
Miltos Allamanis
c04b840260
Fix builds for the OSS-Fuzz project
Since 70b1777d8aef75da1b184fe8155dc818ce66628a was commited the OSS-Fuzz
build was broken because the `chunk_get_raw()` was not updated in the
`FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION`-enabled area.  Add the `size`
argument to the fuzzing version of the `chunk_get_raw()` function.
2025-06-03 18:41:45 +02:00
Evan Hunt
7d1cf8f055 fix: test: Prevent .hypothesis artifacts in system test directories
Merge branch 'each-hypothesis-artifacts' into 'main'

See merge request isc-projects/bind9!10518
2025-06-03 07:35:38 +00:00
Evan Hunt
c08e78ef73 Prevent .hypothesis artifacts in system test directories
The "run.sh" script, used by "make test", changes the working
directory to the system test directory before executing pytest.
If the test drops hypothesis artifacts while running, this
can cause spurious test failures due to an apparent mismatch
between the contents of the system test directory and the
temporary pytest directory. This has been addressed by having
"run.sh" call pytest from the parent directory instead.
2025-06-03 07:35:18 +00:00
Mark Andrews
4d5aa1b907 fix: nil: Extend named-rrchecker multi-line parsing support
named-rrchecker now parses the braces which support multi-line input 
from the beginning of the input rather than only when reading the 
data fields of the record.

Closes #5336

Merge branch '5336-extend-named-rrchecker-multiline-support' into 'main'

See merge request isc-projects/bind9!10521
2025-06-03 02:27:03 +00:00
Mark Andrews
5f882f95fe Add various multi-line inputs to named-rrchecker 2025-06-03 00:27:03 +00:00
Mark Andrews
2e1f933d65 Extend named-rrchecker multi-line parsing support
named-rrchecker now parses the braces which support multi-line input
from the beginning of the input rather than only when reading the
data fields of the record.
2025-06-03 00:27:03 +00:00
Mark Andrews
029e17844b fix: nil: Silence potential divide by zero warning in qpmulti.c
Coverity flagged a potential divide by zero error in collect in
qpmulti.c when the elapsed time is zero but that is only called
once the elapsed time is greater than or equal to RUNTIME (1/4
second) so INSIST this is the case.

Closes #5329

Merge branch '5329-potential-divide-by-zero-in-qpmulti-c' into 'main'

See merge request isc-projects/bind9!10519
2025-06-02 23:40:43 +00:00
Mark Andrews
081dbb1108 Silence potential divide by zero warning in qpmulti.c
Coverity flagged a potential divide by zero error in collect in
qpmulti.c when the elapsed time is zero but that is only called
once the elapsed time is greater than or equal to RUNTIME (1/4
second) so INSIST this is the case.
2025-06-02 23:07:31 +00:00
Petr Špaček
9ee1f50de0 chg: ci: Revert Run CI danger job even if user canceled it while it was running
Unexpectedly this broke CI job generator which parses gitlab-ci.yaml
and cannot handle `!reference` YAML tags.

This reverts merge request !10490

Merge branch 'revert-0a1a599f' into 'main'

See merge request isc-projects/bind9!10540
2025-06-02 16:11:51 +00:00
Petr Špaček
304638b0b2 Revert "chg: ci: Run CI danger job even if user canceled it while it was running"
This reverts merge request !10490
2025-06-02 15:58:52 +00:00
Petr Špaček
9c0cfa357b fix: doc: named-rrchecker doc improvements
Merge branch 'pspacek/named-rrchecker-docs' into 'main'

See merge request isc-projects/bind9!10516
2025-06-02 14:20:43 +00:00
Petr Špaček
43c5b9aeb4 Fix link to TXT RRtype specification
The odd-looking "\ " escape is required to italicize <character-string>
without italicizing the final "s". See reStructuredText Markup
Specification, sections "Inline markup recognition rules" and "Escaping
Mechanism". Most importantly:

Escaped whitespace characters are removed from the output document
together with the escaping backslash. This allows for character-level
inline markup.
2025-06-02 14:19:59 +00:00
Petr Špaček
46173778ce Add exhaustive examples for named-rrchecker 2025-06-02 14:19:59 +00:00
Petr Špaček
c986d37f24 Clarify named-rrchecker return codes 2025-06-02 14:19:59 +00:00
Petr Špaček
c440c418db Clarify named-rrchecker command line parameters 2025-06-02 14:19:59 +00:00
Petr Špaček
5c370d9e6b Clarify named-rrchecker input format 2025-06-02 14:19:59 +00:00
Petr Špaček
0a1a599fb5 chg: ci: Run CI danger job even if user canceled it while it was running
Merge branch 'pspacek/always-hazard' into 'main'

See merge request isc-projects/bind9!10490
2025-06-02 11:52:35 +00:00
Petr Špaček
33bc2628b7 Run CI danger job even if user canceled it while it was running
Limitation: The after_script is not executed if the job did not start at
all, i.e. if the user canceled the job before it got onto a runner.
See https://gitlab.com/groups/gitlab-org/-/epics/10158
2025-06-02 11:40:46 +00:00
Michal Nowak
f5585b9e8c chg: test: Use "digit" class instead of character range in rndc_dumpdb()
The tr range did not work on Solaris 11.4. Let's use a class that is
defined in POSIX.

Closes #5326

Merge branch '5326-make-rndc_dumpdb-work-on-solaris' into 'main'

See merge request isc-projects/bind9!10530
2025-06-02 11:03:17 +00:00
Michal Nowak
baa5ccd795 Use "digit" class instead of character range in rndc_dumpdb()
The tr range did not work on Solaris 11.4. Let's use a class that is
defined in POSIX.
2025-06-02 11:02:52 +00:00
Matthijs Mekking
513f5ad8e0 chg: test: Rewrite kasp system test to pytest (5)
Rollover scenarios.

Merge branch 'matthijs-pytest-rewrite-kasp-system-test-5' into 'main'

See merge request isc-projects/bind9!10292
2025-06-02 09:21:21 +00:00
Nicki Křížek
c00121b4c2 Add dynamic update facility to NamedInstance
Deduplicate the code for dynamic updates and increase code clarity by
using an actual dns.update.UpdateMessage rather than an undefined
intermediary format passed around as a list of arguments.
2025-06-02 09:21:06 +00:00
Matthijs Mekking
fd290f391f Convert csk rollover test cases to pytest
Move the 'csk-roll1' and 'csk-roll2' zones to the rollover test dir and
convert CSK rollover tests to pytest.

The DS swap spans multiple steps. Only the first time we should check
if the "CDS is now published" log is there, and only the first time we
should run 'rndc dnssec -checkds' on the keys. Add a new key to the
step dictionary to disable the DS swap checks.

This made me realize that we need to check for "is not None" in case
the value in the dictionary is False. Update check_rollover_step()
accordingly, and also add a log message which step/zone we are currently
checking.
2025-06-02 09:21:06 +00:00
Matthijs Mekking
46800e407e Convert the 'three is a crowd' test case to pytest
This test shows similarities with the Double KSK rollover method, so
put the test in there.
2025-06-02 09:21:06 +00:00
Matthijs Mekking
9ff7609614 Convert ksk rollover test case to pytest
Move the 'ksk-doubleksk' zones to the rollover test dir and convert KSK
rollover test to pytest.

Since the 'ksk-doubleksk' policy publishes different CDNSKEY/CDS RRsets,
update the 'check_rollover_step' to check which CDNSKEY/CDS RRsets should
be published and which should be prohibited. Update 'isctest.kasp'
accordingly.

We are changing the ZSK lifetime to unlimited in this test case as it
is of no importance (this actually discovered a bug in setting the
next time the keymgr should run).
2025-06-02 09:21:06 +00:00
Matthijs Mekking
bd6c70bd67 Convert zsk rollover test case to pytest
Move the 'zsk-prepub' zones to the rollover test dir and convert ZSK
rollover test to pytest.

We need a way to signal a smooth rollover is going on. Signatures are
being replaced gradually during a ZSK rollover, so the existing
signatures of the predecessor ZSK are still being used. Add a smooth
operator to set the right expectations on what signatures are being
used.

Setting expected key relationships is a bit crude: a list of two
elements where the first element is the index of the expected keys that
is the predecessor, and the second element is the index of the expected
keys that is the successor.

We are changing the KSK lifetime to unlimited in this test case as it
is of no importance.
2025-06-02 09:21:06 +00:00
Matthijs Mekking
233fdb8d52 Convert enable dnssec test case to pytest
Move the 'enable-dnssec' to the rollover test dir and convert to pytest.

This requires new test functionality to check that "CDS is published"
messages are logged (or prohibited).

The setup part is slightly adapted such that it no longer needs to
set the '-P sync' value in most cases (this is then set by 'named'),
and to adjust for the inappropriate safety intervals fix.
2025-06-02 09:21:06 +00:00
Matthijs Mekking
8ee02190a5 Convert kasp multi-signer tests to pytest
Move the multi-signer test scenarios to the rollover directory and
convert tests to pytest.

- If the KeyProperties set the "legacy" to True, don't set expected
  key times, nor check them. Also, when a matching key is found, set
  key.external to True.
- External keys don't show up in the 'rndc dnssec -status' output so
  skip them in the 'check_dnssecstatus' function. External keys never
  sign RRsets, so also skip those keys in the '_check_signatures'
  function.
- Key properties strings now can set expected key tag ranges, and if
  KeyProperties have tag ranges set, they are checked.
2025-06-02 09:21:06 +00:00
Matthijs Mekking
4d08ec50d1 Move rollover test cases to separate test dir
In order to keep the kasp system test somewhat approachable, let's
move all rollover scenarios to its own test directory. Starting with
the manual rollover test cases.

A new test function is added to 'isctest.kasp', to verify that the
relationship metadata (Predecessor, Successor) is set correctly.

The configuration and setup for the zone 'manual-rollover.kasp' are
almost copied verbatim, the only exception is the keytimes. Similar
to the test kasp cases, we no longer set "SyncPublish/PublishCDS" in
the setup script. In addition to that, the offset is changed from one
day ago to one week ago, so that the key states match the timing
metadata (one day is too short to move a key from "hidden" to
"omnipresent").
2025-06-02 09:21:06 +00:00
Michal Nowak
ead7b48003 fix: dev: Allow commandline.c to compile on Solaris
commandline.c failed to compile on Solaris because NAME_MAX was
undefined.  Include 'isc/dir.h' which defines NAME_MAX for platforms
that don't define it.

    In file included from commandline.c:54:
    ./include/isc/commandline.h:31:38: error: 'NAME_MAX' undeclared here (not in a function)
       31 | extern char isc_commandline_progname[NAME_MAX];
          |                                      ^~~~~~~~

Merge branch 'mnowak/fix-solaris-commandline-h' into 'main'

See merge request isc-projects/bind9!10524
2025-06-02 09:01:09 +00:00
Michal Nowak
b5e7d96f0a Allow commandline.c to compile on Solaris
commandline.c failed to compile on Solaris because NAME_MAX was
undefined.  Include 'isc/dir.h' which defines NAME_MAX for platforms
that don't define it.

    In file included from commandline.c:54:
    ./include/isc/commandline.h:31:38: error: 'NAME_MAX' undeclared here (not in a function)
       31 | extern char isc_commandline_progname[NAME_MAX];
          |                                      ^~~~~~~~
2025-06-02 09:00:48 +00:00
Petr Špaček
d8b8db6b97 chg: doc: Add text about no bug bounties
Vicky and Ondrej have agreed that we should add text to explain that we do not give bug bounties.

Merge branch 'sgoldlust-main-bug-bounty' into 'main'

See merge request isc-projects/bind9!10246
2025-06-02 07:02:59 +00:00