]> git.ipfire.org Git - thirdparty/bind9.git/log
thirdparty/bind9.git
6 months agosave userconfig as text instead of a cfg_obj tree
Evan Hunt [Thu, 30 Oct 2025 20:01:44 +0000 (13:01 -0700)] 
save userconfig as text instead of a cfg_obj tree

once the user configuration has been merged into the effective
configuration, it no longer needs to be accessed as a configuration
tree, but we still want to be able to show it with 'rndc showconf -user'.

because the recursive strucure of cfg_obj objects is fairly large, the
canonical text form is a fraction of the size of the configuration
tree, so we now save it in that form instead.

6 months agofix: dev: Reduce the size of cfg_obj_t
Evan Hunt [Thu, 30 Oct 2025 22:54:49 +0000 (22:54 +0000)] 
fix: dev: Reduce the size of cfg_obj_t

Instead of having `isc_sockaddr`, `isc_netaddr`, and `isccfg_duration` members in the `cfg_obj->value`
union, we now just keep pointers to them, and allocate memory when parsing these types. This reduces the
size of `cfg_obj_t` from 112 bytes to 72.

Merge branch 'each-refactor-cfg-obj' into 'main'

See merge request isc-projects/bind9!11186

6 months agofurther shrink cfg_obj_t by using a pointer for duration
Evan Hunt [Thu, 30 Oct 2025 21:07:44 +0000 (14:07 -0700)] 
further shrink cfg_obj_t by using a pointer for duration

not storing the isccfg_duration object inside cfg_obj reduces
its size from 80 to 72 bytes.

6 months agoreduce the size of cfg_obj by using pointers for addresses
Evan Hunt [Thu, 30 Oct 2025 20:40:10 +0000 (13:40 -0700)] 
reduce the size of cfg_obj by using pointers for addresses

instead of having sockaddr and netaddr members in the cfg_obj->value
union, we now just keep pointers, and allocate memory when parsing
these types. this reduces the size of cfg_obj_t from 112 to 80 bytes.

6 months agofix: dev: Remove sun_path field from isc_netaddr
Evan Hunt [Thu, 30 Oct 2025 19:46:50 +0000 (19:46 +0000)] 
fix: dev: Remove sun_path field from isc_netaddr

The `sun_path` field is not used anymore, and consumes over a hundred bytes for every `isc_netaddr_t` object. Remove it.

As `isc_netaddr_t` is used in `cfg_obj_t`, in some huge configuration trees (e.g., a million zones), the gain is almost 1GB of resident memory.

Merge branch 'colin/remove-sun-path' into 'main'

See merge request isc-projects/bind9!11184

6 months agoremove sun_path field from isc_netaddr
Colin Vidal [Thu, 30 Oct 2025 18:37:05 +0000 (19:37 +0100)] 
remove sun_path field from isc_netaddr

The sun_path field is not used anymore, and consumes over a hundred
bytes for every isc_netaddr_t object. Remove it.

As isc_netaddr_t is used in cfg_obj_t, in some huge configuration trees
(e.g., a million zones), the gain is almost 1GB of resident memory.

6 months agonew: usr: New "rndc showconf" command
Colin Vidal [Wed, 29 Oct 2025 22:49:58 +0000 (23:49 +0100)] 
new: usr: New "rndc showconf" command

The new `rndc showconf` command prints the running server configuration. There are three options:
- `rndc showconf -user` displays the user configuration (i.e., the contents of `named.conf`).
- `rndc showconf -builtin` displays the default settings, similar to `named -H`.
- `rndc showconf -effective` displays the effective configuration. This is the merged combination of the `-user` and `-builtin` configurations.

Closes #1075

Merge branch 'colin/effective-config-rndc' into 'main'

See merge request isc-projects/bind9!11123

6 months agoadd system test for rndc showconf
Colin Vidal [Tue, 21 Oct 2025 10:10:34 +0000 (12:10 +0200)] 
add system test for rndc showconf

Add system tests covering the rndc showconf command. It doesn't
attempt to check the whole effective configuration (as any change to the
builtin configuration would break it) but instead ensures that some parts
of the user config are present, as well as some parts of the builtin
config as well.

It also checks that the effective config (in this context of running
named instance) is about static configuration: a newly added zone is not
visible in the effective configuration.

6 months agoimplement "rndc showconf"
Evan Hunt [Fri, 24 Oct 2025 07:42:33 +0000 (00:42 -0700)] 
implement "rndc showconf"

add a new rndc command to dump server configuration info:
- "rndc showconf -user" dumps the contents of named.conf
- "rndc showconf -builtin" dumps named_g_defaltconfig
- "rndc showconf -effective" dumps the effective configuration,
  i.e., the merger of the builtin and the user configurations.

6 months agorefactor newzones configuration
Evan Hunt [Thu, 23 Oct 2025 20:44:56 +0000 (13:44 -0700)] 
refactor newzones configuration

instead of using an opaque ns_cfgctx pointer to store the configuration
data to be used by addzone and modzone, there are now fields in the
dns_view object to store the view configuration and LMDB database
environment. the global configuration is now stored in the named_server
object, along with the ACL context.

6 months agonew: usr: named-checkconf -e prints the effective configuration
Colin Vidal [Wed, 29 Oct 2025 22:49:37 +0000 (23:49 +0100)] 
new: usr: named-checkconf -e prints the effective configuration

The new `named-checkconf -e` option prints the effective server configuration, including all the default settings, that would result from loading the specified configuration file into `named`.

Closes #2798

Merge branch 'colin/effective-config-checkconf' into 'main'

See merge request isc-projects/bind9!11122

6 months agoadd system test for named-checkconf -e
Colin Vidal [Tue, 21 Oct 2025 09:53:56 +0000 (11:53 +0200)] 
add system test for named-checkconf -e

Add a system test checking the command line switch -e of
named-checkconf. The test doesn't care about the whole output of the
effective configuration (in particular to avoid breaking the test for
each default statement that would change) but instead just ensure the
effective configuration is actually returned by checking the presence of
the _bind chaos builtin view as well a user provided view and option
change.

6 months agonamed-checkconf -e prints effective config
Colin Vidal [Tue, 21 Oct 2025 09:53:33 +0000 (11:53 +0200)] 
named-checkconf -e prints effective config

New command line switch `-e` introduced to `named-checkconf`. It acts
like `-p` but instead it print the effective configuration rather than
the user configuration.

6 months agochg: dev: Load the effective configuration
Colin Vidal [Wed, 29 Oct 2025 22:48:38 +0000 (23:48 +0100)] 
chg: dev: Load the effective configuration

The configuration mechanism for `named` has been changed: instead of loading the user configuration from `named.conf` and then, statement-by-statement, picking values from there or from the built-in default configuration, we now merge the user configuration and the default configuration together, then pass the resulting "effective configuration" to `apply_configuration()`.

The new `cfg_effective_config()` function takes a user configuration tree and the built-in default configuration tree, and returns a new effective configuration tree. It works by cloning the user configuration (see !11124) into the effective tree, then walking through the clauses defined in it. If a clause is not in the user config but is present in the defaults, the default version is cloned and attached to the effective tree. If a clause is in both trees, then depending on the statement semantics, either the user configuration overrides the default, or the two are merged. Because these semantics are now handled before `apply_configuration()` runs, that function has been substantially simplified.

Future MRs will enable the effective configuration to be printed, either by `rndc` (!11123) or `named-checkconf` (!11122). The default configuration has been moved to an include file which is accessible to both `named` and `named-checkconf`.

Merge branch 'colin/effective-config-internal' into 'main'

See merge request isc-projects/bind9!11121

6 months agoparser: add VALID_CFGOBJ macro
Colin Vidal [Tue, 28 Oct 2025 18:04:54 +0000 (19:04 +0100)] 
parser: add VALID_CFGOBJ macro

In order to harden `cfg_obj_t` usage now the configuration tree is
manipulated in various ways (cloned, merged, etc.), this introduce the
VALID_CFGOBJ macro to check the validity of a `cfg_obj_t` node.

6 months agofix delv when using the builtin trust-anchors
Colin Vidal [Mon, 13 Oct 2025 16:35:52 +0000 (18:35 +0200)] 
fix delv when using the builtin trust-anchors

Since the builtin trust-anchors are now called `builtin-trust-anchors`,
delv needs specific handling in order to be able to parse those when
they are used.

Before, delv was simply parsing a single clause (either in the case of
an overriden trust-anchors value from bindkeys file or by simply reading
the builtin value). But since the name changed, the same code can't be
shared and the builtin version is expected to be in a map.

6 months agonamed -V doesn't need to parse default options
Evan Hunt [Sat, 25 Oct 2025 07:20:58 +0000 (00:20 -0700)] 
named -V doesn't need to parse default options

instead of parsing the default configuration to extract the
geoip-directory value, we can just construct the value the same way
it's done for the defaults.

6 months agointroduce default config builtin-root-anchors
Colin Vidal [Mon, 13 Oct 2025 14:00:17 +0000 (16:00 +0200)] 
introduce default config builtin-root-anchors

Since the effective configuration tree is a "merged" configuration tree
from the user and the default configurations, the effective configuration
provides a unique configuration tree used by apply_confiuration() to
configure the server.

However, there is one specific case where the configuration code needs
to differentiate whether the configuration originally came from the
default or the user configuration: the trust-anchors. This is because
the default trust-anchors _have_ to be those for the root zone, and the
one provided by the user can be for any zone. A check enforces this.

In order to keep this difference visible from the configuration code,
with a unique configuration tree, we now introduce a default-only
`builtin-trust-anchors` statement which holds the builtin root
trust-anchors. It can't be used from the user configuration (this would
raise an error), hence it is not documented.

6 months agoenable effective configuration
Colin Vidal [Thu, 16 Oct 2025 15:25:14 +0000 (17:25 +0200)] 
enable effective configuration

The effective configuration now contains the actual named configuration
as a unified user/global single tree instance.  We now provide this to
apply_configuration() instead of the user configuration.

6 months agofix serve-stale system test after moving defconfig
Colin Vidal [Thu, 16 Oct 2025 15:15:50 +0000 (17:15 +0200)] 
fix serve-stale system test after moving defconfig

The serve-stale system test relies on sed accessing the source
file that hard-codes the default configuration. Since it moved from
bin/named/config.c into bin/include/defaultconfig.h, the test needs
the path updated.

6 months agoeffective config: specific check-names case
Colin Vidal [Thu, 16 Oct 2025 15:14:14 +0000 (17:14 +0200)] 
effective config: specific check-names case

There are multiple check-names options provided in the default
configuration, and they must "complete" those provided by the user.
This is now handled when building the effective tree.

6 months agoeffective config: specific prefetch/trigger case
Colin Vidal [Thu, 16 Oct 2025 15:00:43 +0000 (17:00 +0200)] 
effective config: specific prefetch/trigger case

The prefetch statement can be overriden by the user, but the user might
specify the prefetch without the trigger value, which needs to be
pulled from the default configuration. Handle this case by directly
getting the default value if needed from the default configuration when
building the effective configuration tree.

Also take care of keeping the values inside their bounds, and simplify
the server configuration code which then just have to read effective
configuration values.

6 months agoeffective config: specific dnssec-policy case
Colin Vidal [Thu, 16 Oct 2025 14:50:30 +0000 (16:50 +0200)] 
effective config: specific dnssec-policy case

Default dnssec-policies are not overridden by user-provided ones. Add
this specific case to make sure those are kept, and also ensure that the
default dnssec-policy is always in the first position (which is an
implicit requirement in the existing implementation).

Also simplify the server configuration code, as it only needs to build
the list of dnssec-policy based on the effective config list.

6 months agoeffective config: specific view cases
Colin Vidal [Thu, 16 Oct 2025 14:33:51 +0000 (16:33 +0200)] 
effective config: specific view cases

User specified views don't override default views. In particular, the
_bind/CH view is still active. However, the order is important: if the
user defines a foo/CH view, it must be able to override _bind/CH by
matching clients first (this is how the view is documented).

The server configuration code is now simpler; it only has to build the
views based on the effective view list, and only creates the _default
view if there are no explicit views created by the user.

6 months agoeffective config: specific options/acl cases
Colin Vidal [Thu, 16 Oct 2025 14:26:06 +0000 (16:26 +0200)] 
effective config: specific options/acl cases

Implement the specific rules of ACL inheritance when buiding the
effective configuration. As those rules are directly implemented in the
configuration tree, they are removed from `apply_configuation`.

6 months agoadd cfg_effective_config() API
Colin Vidal [Thu, 16 Oct 2025 13:48:05 +0000 (15:48 +0200)] 
add cfg_effective_config() API

Add the entry point of the logic to merge the user and the default
configuration, called cfg_effective_config(). This function takes a user
configuration and a default configuration. It internally clones the user
configuration tree, then walks through the clauses recursively applying
default values if they are missing.

The newly built configuration tree, called the effective configuration
tree, is then returned.

Currently this is just the basic mechanism which is implemented (i.e.
enable to walk from clause to clause, goes into a nested clause, and so
on). The next commits will introduce the implementation of
clause-specific merge functions in order to preserve the existing
named.conf semantics.

6 months agoadd an optional merge method on cfg_clausedef_t
Colin Vidal [Thu, 16 Oct 2025 13:30:23 +0000 (15:30 +0200)] 
add an optional merge method on cfg_clausedef_t

In order to handle specific cases when merging configurations (i.e.
some specific clauses which require specific handling, not just
overriding values for instance), the cfg_clausedef_t includes an
optional merge method.

The merge function is NULL by default. If it is defined for a given
clause, and this clause is defined in both the user and default
configurations, the merge function is then called with both the user and
default clause instances. It's up the the implementation of that function
do to anything needed to keep the correct named.conf semantic.

6 months agoadd helper API calls to manipulate maps and lists
Colin Vidal [Thu, 16 Oct 2025 12:54:24 +0000 (14:54 +0200)] 
add helper API calls to manipulate maps and lists

cfg_map_addclone() is a variant of cfg_map_add which internally clones
an object and adds it to a map. It ensures that the object is an
implicit list if the map clause has the CFG_CLAUSEFLAG_MULTI set

cfg_list_addclone() clones a list (internally cloning each individual
element) and appends or preprends it to an existing target list.

Both of these will be needed to merge the default configuration
with the user configuration.

6 months agoparser firstclause/nextclause API changes
Colin Vidal [Thu, 16 Oct 2025 12:38:48 +0000 (14:38 +0200)] 
parser firstclause/nextclause API changes

In order to make upcoming configuration tree changes easier, the
cfg_map_firstclause() and _nextclause() functions have been changed
to return the clause itself rather than only the clause name.

6 months agomove default configuration to common bin/include folder
Colin Vidal [Thu, 16 Oct 2025 12:11:37 +0000 (14:11 +0200)] 
move default configuration to common bin/include folder

Two programs need to be able to provide the effective configuration:
named (through a future rndc command) and named-checkconf (though a
future command line switch). In order to calculate the effective
configuration from named-checkconf, the default configuration
needs to be accessible.

The default configuration has now been moved from bin/named/config.c
into a common include directory for binaries: bin/include/defaultconfig.h.

6 months agofix: nil: set cfgmaps correctly alessio/checkpoint-pre-effective-config
Evan Hunt [Wed, 29 Oct 2025 20:24:56 +0000 (20:24 +0000)] 
fix: nil: set cfgmaps correctly

A typo in MR !11165 caused `cfgmaps` to be set with only the top-level
configuration, not the view configuration.

Merge branch 'each-fix-cfgmaps' into 'main'

See merge request isc-projects/bind9!11173

6 months agoset cfgmaps correctly
Evan Hunt [Wed, 29 Oct 2025 19:45:31 +0000 (12:45 -0700)] 
set cfgmaps correctly

a typo in MR !11165 caused cfgmaps to be set with only the top-level
configuration, not the view configuration.

6 months agofix: dev: fix configuration bugs involving global defaults
Evan Hunt [Wed, 29 Oct 2025 18:28:45 +0000 (18:28 +0000)] 
fix: dev: fix configuration bugs involving global defaults

The configuration code for the `max-cache-size`, `dnssec-validation`, and `response-padding` options were unnecessarily complicated, and in the case of `max-cache-size`, buggy. These have been fixed. The `optionmaps` variable in `configure_view()` is no longer needed and has been removed.

Merge branch 'each-cleanup-defaultconfig' into 'main'

See merge request isc-projects/bind9!11165

6 months agofix "response-padding" configuration and remove optionmaps
Evan Hunt [Wed, 29 Oct 2025 01:45:25 +0000 (18:45 -0700)] 
fix "response-padding" configuration and remove optionmaps

Add a default "response-padding" option in the global defaults,
to disable the option, and simplify the configuration code so that
looks at the global defaults if the option is not set in named.conf.

This enables us to remove the 'optionmaps' variable in configure_view(),
which was used for options that only look in named.conf.

6 months agosimplify "dnssec-validation" configuration
Evan Hunt [Wed, 29 Oct 2025 01:34:55 +0000 (18:34 -0700)] 
simplify "dnssec-validation" configuration

In the past, "dnssec-validation" was not looked up in the global
defaults unless "dnssec-enable" was true. "dnssec-enable" has been
obsolete for several years, but dnssec-validation was still being
configured in two steps.  This commit removes the vestigial bits of
the old logic.

6 months agofix a "max-cache-size" configuration bug
Evan Hunt [Wed, 29 Oct 2025 01:28:35 +0000 (18:28 -0700)] 
fix a "max-cache-size" configuration bug

"max-cache-size default;" is allowed, according to the documentation
and the parser, but when it's configured, named crashes due to an
INSIST that the only legal string value is "unlimited". this has
been fied.

the configuration has also been simplified. previously, we checked for
max-cache-size in view and options, then determined whether to look in
the global default options based on whether the view had recursion set.
the default value set there was only applicable to views with recursion.
now, the default is an explicit "default", which affects views with
and without recursion in different ways.

the cfg type for "max-cache-size" has been changed from
cfg_type_sizeorpercent to cfg_type_maxcachesize.

6 months agochg: test: Use isctest.asyncserver in the "statistics" test
Štěpán Balážik [Wed, 29 Oct 2025 17:45:14 +0000 (17:45 +0000)] 
chg: test: Use isctest.asyncserver in the "statistics" test

Reimplement the custom server using the asyncserver Python module.

Behavior change: The new server doesn't copy CD and DO flags and a client cookie to responses.

Merge branch 'stepan/statistics-asyncserver' into 'main'

See merge request isc-projects/bind9!10928

6 months agoUse isctest.asyncserver in the "statistics" test
Štěpán Balážik [Tue, 2 Sep 2025 10:39:33 +0000 (12:39 +0200)] 
Use isctest.asyncserver in the "statistics" test

Reimplement the custom server using the asyncserver Python module.

Behavior change: The new server doesn't copy CD and DO flags and a
client cookie to responses.

6 months agoAdd a response handler matching on specific QNAMEs
Michał Kępień [Thu, 18 Sep 2025 08:13:13 +0000 (10:13 +0200)] 
Add a response handler matching on specific QNAMEs

Add a new ResponseHandler subclass, QnameHandler, which enables
conveniently matching specific QNAMEs (without also matching their
subdomains like DomainHandler does).

6 months agoAllow users of AsyncDnsServer to set a default RCODE
Štěpán Balážik [Tue, 2 Sep 2025 10:35:53 +0000 (12:35 +0200)] 
Allow users of AsyncDnsServer to set a default RCODE

This is mostly for cases where no zone is set up and all response stubs
come to response handler with REFUSED as RCODE.

This commit allows to override the RCODE before QueryContext is passed
to response handlers.

6 months agochg: test: Use isctest.asyncserver in the "cookie" test
Štěpán Balážik [Wed, 29 Oct 2025 16:06:26 +0000 (16:06 +0000)] 
chg: test: Use isctest.asyncserver in the "cookie" test

Replace the custom DNS servers in the "cookie" system test with new code
based on the isctest.asyncserver module. The convoluted test logic is
split into multiple response handlers which are shared between the two
servers.

Behavior change: returned SOA records have the zone name set properly.

Merge branch 'stepan/cookie-asyncserver' into 'main'

See merge request isc-projects/bind9!10691

6 months agoUse isctest.asyncserver in the "cookie" test
Štěpán Balážik [Fri, 4 Jul 2025 08:45:22 +0000 (10:45 +0200)] 
Use isctest.asyncserver in the "cookie" test

Replace the custom DNS servers in the "cookie" system test with new code
based on the isctest.asyncserver module. The convoluted test logic is
split into multiple response handlers which are shared between the two
servers.

Behavior change: returned SOA records have the zone name set properly.

6 months agochg: test: Use isctest.asyncserver in the "rpzrecurse" test
Štěpán Balážik [Wed, 29 Oct 2025 14:45:35 +0000 (14:45 +0000)] 
chg: test: Use isctest.asyncserver in the "rpzrecurse" test

Replace the custom server with new implementation using the
AsyncDnsServer class.

Behavior changes:
- DNS cookie is not copied to the responses.
- CD, DO flags aren't set on responses.

Merge branch 'stepan/rpzrecurse-asyncserver' into 'main'

See merge request isc-projects/bind9!10916

6 months agoUse isctest.asyncserver in the "rpzrecurse" test
Štěpán Balážik [Sat, 30 Aug 2025 15:07:23 +0000 (17:07 +0200)] 
Use isctest.asyncserver in the "rpzrecurse" test

Replace the custom server with new implementation using the
AsyncDnsServer class.

Behavior changes:
- DNS cookie is not copied to the responses.
- CD, DO flags aren't set on responses.

6 months agochg: test: Use isctest.asyncserver in the "dnssec" test
Štěpán Balážik [Wed, 29 Oct 2025 13:56:15 +0000 (13:56 +0000)] 
chg: test: Use isctest.asyncserver in the "dnssec" test

Reimplement the custom server using isctest.asyncserver. Factor most of
the logic out of the server code to two (identical) zones and only
implement the non-standard behavior.

Behavior changes:
- RRSIG Expiration and Inception is now static and covering the whole
  timeline instead of being calculated everytime.
- NXDOMAIN is returned where suitable by standard.
- Returned SOA records have properly set zone names.

Merge branch 'stepan/dnssec-asyncserver' into 'main'

See merge request isc-projects/bind9!10906

6 months agoUse isctest.asyncserver in the "dnssec" test
Štěpán Balážik [Wed, 27 Aug 2025 18:50:32 +0000 (20:50 +0200)] 
Use isctest.asyncserver in the "dnssec" test

Reimplement the custom server using isctest.asyncserver. Factor most of
the logic out of the server code to two (identical) zones and only
implement the non-standard behavior.

Behavior changes:
- RRSIG Expiration and Inception is now static and covering the whole
  timeline instead of being calculated everytime.
- NXDOMAIN is returned where suitable by standard.
- Returned SOA records have properly set zone names.

6 months agofix: usr: Fix shutdown INSIST in dns_dispatchmgr_getblackhole
Mark Andrews [Mon, 27 Oct 2025 22:37:00 +0000 (09:37 +1100)] 
fix: usr: Fix shutdown INSIST in dns_dispatchmgr_getblackhole

Previously, `named` could trigger an assertion in `dns_dispatchmgr_getblackhole`
while shutting down. This has been fixed.

Closes #5525

Merge branch '5525-attach-to-dispatchmgr-to-fctx' into 'main'

See merge request isc-projects/bind9!11131

6 months agoFix "shutdown system test crashed in dns_dispatchmgr_getblackhole"
Mark Andrews [Wed, 22 Oct 2025 05:53:46 +0000 (16:53 +1100)] 
Fix "shutdown system test crashed in dns_dispatchmgr_getblackhole"

While shutting down view->dispatchmgr is no longer valid.  Attach
to it and when creates a fetch context and use that pointer instead
of view->dispatchmgr.  Use dns_view_getdispatchmgr to do the attaching
as view->dispatchmgr is it managed using rcu.

6 months agonew: dev: introduce cfg_obj_clone to clone a config tree
Colin Vidal [Mon, 27 Oct 2025 21:15:39 +0000 (22:15 +0100)] 
new: dev: introduce cfg_obj_clone to clone a config tree

Introduce `cfg_obj_clone` which takes a `cfg_obj_t` node and clones it.
it allocates a new node, copies its scalar values and recursively
allocates child nodes, copying their scalar values as well and so on.

Internally, a new method `cfg_copyfunc_t` copy is added in `cfg_rep_t`,
which enables implementing a copy function specific for each
representation type a node can hold.

This is pre-require work for MR !11121 !11122 !11123

Merge branch 'colin/effective-config-clone' into 'main'

See merge request isc-projects/bind9!11124

6 months agoadd unit test for cfg_obj_clone
Colin Vidal [Tue, 30 Sep 2025 14:09:03 +0000 (16:09 +0200)] 
add unit test for cfg_obj_clone

Add a unit test for `cfg_obj_clone` to verify that the cloned tree
indeed has independent child nodes. The test also verifies that the
clone is semantically correct by comparing a text dump of the original
tree and the cloned one.

6 months agointroduce cfg_obj_clone to clone a config tree
Colin Vidal [Tue, 30 Sep 2025 10:41:32 +0000 (12:41 +0200)] 
introduce cfg_obj_clone to clone a config tree

Introduce `cfg_obj_clone` which takes a `cfg_obj_t` node and clones it.
it allocates a new node, copies its scalar values and recursively
allocates child nodes, copying their scalar values as well and so on.

Internally, a new method `cfg_copyfunc_t` copy is added in `cfg_rep_t`,
which enables implementing a copy function specific for each
representation type a node can hold.

6 months agofix: nil: Remove unnecessary NULL checks causing Coverity warnings
Mark Andrews [Mon, 27 Oct 2025 20:05:27 +0000 (07:05 +1100)] 
fix: nil: Remove unnecessary NULL checks causing Coverity warnings

In cfg_parse_buffer and cfg_parse_file 'pctx' was being checked
for being non-NULL when it was guaranteed to be non-NULL.  This
raised Coverity issues ID 637688 and ID 637689.

Closes #5599

Merge branch '5599-remove-unnecessary-null-checks' into 'main'

See merge request isc-projects/bind9!11154

6 months agoRemove unnecessary NULL checks in parser.c
Mark Andrews [Sun, 26 Oct 2025 23:35:35 +0000 (10:35 +1100)] 
Remove unnecessary NULL checks in parser.c

In cfg_parse_buffer and cfg_parse_file 'pctx' was being checked
for being non-NULL when it was guarenteed to be non-NULL.  This
raised Coverity issues ID 637688 and ID 637689.

6 months agofix: test: Fix "hooks/conf/good-viewzonelevel.conf.j2 has hard coded library extension"
Mark Andrews [Mon, 27 Oct 2025 19:15:32 +0000 (06:15 +1100)] 
fix: test:  Fix "hooks/conf/good-viewzonelevel.conf.j2 has hard coded library extension"

Use @DYLIB@ instead of hard coded extension "so".

Closes #5600

Merge branch '5600-fix-hooks-conf-good-viewzonelevel-conf-j2' into 'main'

See merge request isc-projects/bind9!11156

6 months agoFix "good-viewzonelevel.conf.j2 has hard coded library extension"
Mark Andrews [Mon, 27 Oct 2025 00:15:18 +0000 (11:15 +1100)] 
Fix "good-viewzonelevel.conf.j2 has hard coded library extension"

Use @DYLIB@ instead of hard coded extension "so".

6 months agonew: ci: Add tarball publication process to pipeline
Andoni Duarte [Mon, 27 Oct 2025 15:51:58 +0000 (15:51 +0000)] 
new: ci: Add tarball publication process to pipeline

Tarball uploading steps are to be included in the pipeline.

They are manual jobs that:

1. uploads a release tarball prepared by the "sign" job.
2. publish a previously staged release to a destination.
3. publishes a previously staged release to a well-known URL.

A template has been included since all three follow the same pattern.
Besides, rules commonly used by tag pipeline jobs.

Merge branch 'andoni/ci-release-process' into 'main'

See merge request isc-projects/bind9!11158

6 months agoDeduplicate triggering rules for tag pipeline jobs
Michał Kępień [Mon, 27 Oct 2025 04:15:09 +0000 (05:15 +0100)] 
Deduplicate triggering rules for tag pipeline jobs

Define and use more YAML anchors for triggering rules commonly used by
tag pipeline jobs.  This builds on top of the work done in commit
675d9c74251fee8ec034e87bdd43e7da97119a5d, improving readability and
reuse.

6 months agoAdd the "publish" job
Andoni Duarte Pintado [Thu, 23 Oct 2025 13:13:00 +0000 (15:13 +0200)] 
Add the "publish" job

Add a new SSH-confirmed GitLab CI job that publishes a previously staged
release to a well-known URL.  The details of what specifically this
entails are controlled by the staging environment.

6 months agoAdd the "publish-private" job
Andoni Duarte Pintado [Fri, 17 Oct 2025 07:52:45 +0000 (09:52 +0200)] 
Add the "publish-private" job

Add a new SSH-confirmed GitLab CI job that publishes a previously staged
release to a destination that is not a well-known URL.  The details of
what specifically this entails are controlled by the staging
environment.

6 months agoAdd the "staging" job
Andoni Duarte Pintado [Tue, 16 Sep 2025 15:10:44 +0000 (17:10 +0200)] 
Add the "staging" job

Add a new SSH-confirmed GitLab CI job that uploads a release tarball
prepared by the "sign" job to a staging environment specified using CI
variables.

6 months agoRework the "sign" job
Michał Kępień [Wed, 22 Oct 2025 07:45:29 +0000 (09:45 +0200)] 
Rework the "sign" job

Adapt the "sign" job to use the YAML template for SSH-confirmed jobs.
Make the signing process user-agnostic.

6 months agoAdd a template for SSH-confirmed jobs
Michał Kępień [Wed, 22 Oct 2025 07:45:29 +0000 (09:45 +0200)] 
Add a template for SSH-confirmed jobs

Add a YAML template for jobs that require an SSH connection to a
dedicated, locked-down runner for signing off on sensitive operations
(e.g. signing, publishing).

These jobs all follow a similar scheme:

 1. Runner prepares the necessary files in a well-known location (/tmp).
 2. Runner generates a shell script to be run by an authorized user.
 3. Runner sleeps while waiting for a signal that the script was run.
 4. Authorized user logs in to the runner over SSH and runs the script.
 5. Runner collects the relevant files and logs as job artifacts.

One additional complication is that each of the above steps needs to be
carried out under the assumption that GitLab Runner is running under a
different user account than the one used for logging in over SSH,
necessitating careful file permission handling.

Having a YAML template for jobs that need to follow the above scheme
significantly improves readability and reuse as each job only needs to
define (via the "variables" YAML key):

  - SSH_SCRIPT_RUNNER_PRE: the code the runner should execute before an
    authorized user logs in over SSH (typically: setting up files in a
    well-known location),

  - SSH_SCRIPT_CLIENT: contents of the shell script to be run by an
    authorized user,

  - SSH_SCRIPT_RUNNER_POST: the code the runner should execute after an
    authorized user runs the script over SSH (typically: artifact
    collection and cleanup).

6 months agoRevise release directory naming
Michał Kępień [Wed, 22 Oct 2025 07:45:29 +0000 (09:45 +0200)] 
Revise release directory naming

Include the Git tag in the name of the release directory rather than
just the version number.  Revise the script for the "release" job
accordingly.  This enables using the $CI_COMMIT_TAG variable in job
scripts without the need to resort to string manipulation to strip the
leading "v", improving readability.  The only place where string
manipulation is applied to the Git tag is now the "release" job itself,
to verify that the Git tag matches the version number embedded in the
source tarball name.

6 months agofix: test: test-syncplugin.c:plugin_register was broken
Mark Andrews [Mon, 27 Oct 2025 12:46:39 +0000 (23:46 +1100)] 
fix: test: test-syncplugin.c:plugin_register was broken

The variables example2com, example3com, and example4com where not
being initalised on all paths leading to Coverity issues ID 637690,
ID 637691 and ID 637692 being raised.  In addition the tests to free
them were wrong as they depended on the unintialised variables. This
has been fixed.

Closes #5598

Merge branch '5598-properly-determine-if-name-is-dynamic' into 'main'

See merge request isc-projects/bind9!11155

6 months agotest-syncplugin.c:plugin_register was broken
Mark Andrews [Mon, 27 Oct 2025 00:07:35 +0000 (11:07 +1100)] 
test-syncplugin.c:plugin_register was broken

The variables example2com, example3com, and example4com where not
being initalised on all paths leading to Coverity issues ID 637690,
ID 637691 and ID 637692 being raised.  In addition the tests to free
them were wrong as they depended on the unintialised variables. This
has been fixed.

6 months agochg: dev: Stop prettifying JSON statistics
Michał Kępień [Mon, 27 Oct 2025 09:57:58 +0000 (10:57 +0100)] 
chg: dev: Stop prettifying JSON statistics

Passing the JSON_C_TO_STRING_PRETTY flag to
json_object_to_json_string_ext() makes the latter produce prettified
JSON output.  This results in a huge amount of redundant whitespace
being inserted into each HTTP response (whitespace amounts to about 40%
of the entire JSON payload).

The bandwidth cost can be amortized by enabling HTTP compression on the
client side ("Accept-Encoding: deflate"), but that does not affect the
size of data at rest.

Use the JSON_C_TO_STRING_PLAIN flag instead of JSON_C_TO_STRING_PRETTY
to minimize the size of JSON responses sent via the statistics channel.
External tools should be used for prettifying JSON data.

Closes #3304

Merge branch '3304-stop-prettifying-json-statistics' into 'main'

See merge request isc-projects/bind9!10786

6 months agoStop prettifying JSON statistics
Michał Kępień [Mon, 27 Oct 2025 09:56:38 +0000 (10:56 +0100)] 
Stop prettifying JSON statistics

Passing the JSON_C_TO_STRING_PRETTY flag to
json_object_to_json_string_ext() makes the latter produce prettified
JSON output.  This results in a huge amount of redundant whitespace
being inserted into each HTTP response (whitespace amounts to about 40%
of the entire JSON payload).

The bandwidth cost can be amortized by enabling HTTP compression on the
client side ("Accept-Encoding: deflate"), but that does not affect the
size of data at rest.

Use the JSON_C_TO_STRING_PLAIN flag instead of JSON_C_TO_STRING_PRETTY
to minimize the size of JSON responses sent via the statistics channel.
External tools should be used for prettifying JSON data.

6 months agochg: test: Properly process JSON and XML in tests
Michał Kępień [Sat, 25 Oct 2025 06:00:41 +0000 (08:00 +0200)] 
chg: test: Properly process JSON and XML in tests

Processing JSON and XML using `grep` and `sed` is error-prone, overly
lax in some ways, overly strict in others, and neither accurate nor
expressive.  Use `jq` and `xmllint` with XPath expressions to make
things right in system tests.

See #3304

Merge branch '3304-properly-process-json-and-xml-in-tests' into 'main'

See merge request isc-projects/bind9!10942

6 months agoRemove unused Perl scripts
Michał Kępień [Sat, 25 Oct 2025 05:37:48 +0000 (07:37 +0200)] 
Remove unused Perl scripts

The traffic-json.pl and traffic-xml.pl scripts that were used in the
"statschannel" system test in the past became dead code when commit
1202fd912a1baa9c299f17caf4494bc21234da85 rewrote parts of that test to
Python.  Remove those scripts.

6 months agoRemove unused xmllint-html.sh script
Michał Kępień [Sat, 25 Oct 2025 05:37:48 +0000 (07:37 +0200)] 
Remove unused xmllint-html.sh script

There are no longer any HTML files in the BIND 9 source repository.
Remove the xmllint-html.sh script that was used in the past to check
those for errors.

6 months agoUse xmllint in system tests inspecting XML data
Michał Kępień [Sat, 25 Oct 2025 05:37:48 +0000 (07:37 +0200)] 
Use xmllint in system tests inspecting XML data

Inspecting XML data using sed and grep is error-prone, overly lax in
some ways, overly strict in others, and neither accurate nor expressive.
Use xmllint and XPath expressions for inspecting XML data in the
"statistics", "statschannel", and "synthfromdnssec" system tests to
address these deficiencies.

6 months agoDetect xmllint at build time
Michał Kępień [Sat, 25 Oct 2025 05:37:48 +0000 (07:37 +0200)] 
Detect xmllint at build time

Detect whether and where the xmllint utility is available at build time,
so that it can be used in system tests.  If the tool is not found,
specific checks employing it will be skipped.

6 months agoUse jq in system tests inspecting JSON data
Michał Kępień [Sat, 25 Oct 2025 05:37:48 +0000 (07:37 +0200)] 
Use jq in system tests inspecting JSON data

Inspecting JSON data using grep is error-prone, overly lax in some ways,
overly strict in others, and neither accurate nor expressive.  Use jq
for inspecting JSON data in the "statschannel" and "synthfromdnssec"
system tests to address these deficiencies.

6 months agoDetect jq at build time
Michał Kępień [Sat, 25 Oct 2025 05:37:48 +0000 (07:37 +0200)] 
Detect jq at build time

Detect whether and where the jq utility is available at build time, so
that it can be used in system tests.  If the tool is not found, specific
checks employing it will be skipped.

6 months agochg: dev: Fix assertion failure from arc4random_uniform with invalid limit
Ondřej Surý [Fri, 24 Oct 2025 20:20:51 +0000 (22:20 +0200)] 
chg: dev: Fix assertion failure from arc4random_uniform with invalid limit

When the arc4random_uniform() is called on NetBSD with upper_bound that
makes no sense statistically (0 or 1), the call crashes the calling
program.  Fix this by returning 0 when upper bound is < 2 as does Linux,
FreeBSD and NetBSD.  (Hint: System CSPRNG should never crash.)

Closes #5596

Merge branch '5596-fix-isc_random_uniform-on-NetBSD' into 'main'

See merge request isc-projects/bind9!11147

6 months agoFix assertion failure from arc4random_uniform with invalid limit
Ondřej Surý [Fri, 24 Oct 2025 08:34:33 +0000 (11:34 +0300)] 
Fix assertion failure from arc4random_uniform with invalid limit

When the arc4random_uniform() is called on NetBSD with upper_bound that
makes no sense statistically (0 or 1), the call crashes the calling
program.  Fix this by returning 0 when upper bound is < 2 as does Linux,
FreeBSD and NetBSD.  (Hint: System CSPRNG should never crash.)

6 months agorem: test: Drop the unit test for testing randomness
Ondřej Surý [Fri, 24 Oct 2025 19:17:08 +0000 (21:17 +0200)] 
rem: test: Drop the unit test for testing randomness

Since we are using system routines for randomness, there's no point
in spending time and run the statistical suite for testing PRNG.

Merge branch 'ondrej/drop-random-unit-test' into 'main'

See merge request isc-projects/bind9!11137

6 months agoDrop the unit test for testing randomness
Ondřej Surý [Wed, 22 Oct 2025 16:25:18 +0000 (18:25 +0200)] 
Drop the unit test for testing randomness

Since we are using system routines for randomness, there's no point
in spending time and run the statistical suite for testing PRNG.

6 months agochg: pkg: minimal meson version required is 1.3.0
Michal Nowak [Fri, 24 Oct 2025 16:35:00 +0000 (18:35 +0200)] 
chg: pkg: minimal meson version required is 1.3.0

The minimal required meson version is 1.3.0.

Where distribution repositories don't provide meson 1.3.0 or newer, meson from PyPI may be used instead.

Merge branch 'aydin/meson-bump-version' into 'main'

See merge request isc-projects/bind9!10997

6 months agoadd muon's static analyzer to CI
Aydın Mercan [Mon, 20 Oct 2025 10:42:48 +0000 (13:42 +0300)] 
add muon's static analyzer to CI

Muon features a basic static analyzer that is functional enough to have
caught several meson mistakes.

6 months agoDrop the NO_BUILD_TEST_PREREQ hack
Michal Nowak [Wed, 8 Oct 2025 18:37:24 +0000 (20:37 +0200)] 
Drop the NO_BUILD_TEST_PREREQ hack

With the updated meson, jammy does not need to avoid the
"meson-test-prereq" target.

6 months agoget rid of unused meson variables
Aydın Mercan [Fri, 19 Sep 2025 08:06:07 +0000 (10:06 +0200)] 
get rid of unused meson variables

Found by muon's own static analyzer.

6 months agobump the minimum meson version to 1.3.0
Aydın Mercan [Thu, 18 Sep 2025 11:07:08 +0000 (13:07 +0200)] 
bump the minimum meson version to 1.3.0

After a couple releases, it appears that the minimum version can be
increased without much trouble.

Because meson only requires python 3.7 or greater, most supported
distributions can run a newer meson without having to deal with
additional dependencies or a new python version.

6 months agofix: pkg: fix fuzzing builds
Michal Nowak [Fri, 24 Oct 2025 13:37:36 +0000 (15:37 +0200)] 
fix: pkg: fix fuzzing builds

Previously fuzzing builds were broken due to some typos in the `meson.build`.

Merge branch 'aydin/fuzz-meson-fix' into 'main'

See merge request isc-projects/bind9!11052

6 months agoDrop doh and geoip from pairwise testing exclusion list
Michal Nowak [Wed, 22 Oct 2025 17:27:06 +0000 (19:27 +0200)] 
Drop doh and geoip from pairwise testing exclusion list

doh and geoip features can be part of pairwise testing. Their exclusion
was a misunderstanding.

6 months agofix fuzzing
Aydın Mercan [Fri, 3 Oct 2025 12:37:01 +0000 (15:37 +0300)] 
fix fuzzing

The fuzzing binary builds have been fixed and now is run as a part of
the test suite for sanity checks.

The `oss-fuzz` backend has been made functional with the addition of the
`oss-fuzz-args` option. It allows the setup script to pass the
LIB_FUZZING_ENGINE environment variable to meson.

6 months agofix: dev: Make libcap mandatory on Linux again
Michal Nowak [Fri, 24 Oct 2025 09:24:45 +0000 (11:24 +0200)] 
fix: dev: Make libcap mandatory on Linux again

When refactoring the BIND 9.21 build system to meson, libcap was
unintentionally made optional on Linux.

Closes #5590

Merge branch '5590-make-libcap-mandatory-on-linux-again' into 'main'

See merge request isc-projects/bind9!11136

6 months agoMake libcap mandatory on Linux again
Michal Nowak [Wed, 22 Oct 2025 14:13:27 +0000 (16:13 +0200)] 
Make libcap mandatory on Linux again

When refactoring the BIND 9.21 build system to meson, libcap was
unintentionally made optional on Linux.

6 months agonew: ci: Automatically trigger rebase of -sub branches
Michał Kępień [Fri, 24 Oct 2025 02:47:26 +0000 (04:47 +0200)] 
new: ci: Automatically trigger rebase of -sub branches

After a merge into the public project, trigger automatic rebase in the respective private branch of the private project.

Merge branch 'pspacek/auto-rebase-sub-branches' into 'main'

See merge request isc-projects/bind9!11012

6 months agoApply special git tag rules only in the private project
Petr Špaček [Thu, 25 Sep 2025 12:24:45 +0000 (14:24 +0200)] 
Apply special git tag rules only in the private project

We do not want to re-release tags we create in the private project
anyway. Moreover pushing tags back into the public project after release
caused to Gitlab to create tag pipelines which never finished, which was
only confusing thing.

6 months agoTrigger rebase in private project after merge into the public one
Petr Špaček [Thu, 18 Sep 2025 14:15:05 +0000 (16:15 +0200)] 
Trigger rebase in private project after merge into the public one

Actual rebase and push is handled by pipeline inside the private project.

6 months agoDo not fail post-merge jobs if merge request reference is missing
Petr Špaček [Thu, 25 Sep 2025 11:21:23 +0000 (13:21 +0200)] 
Do not fail post-merge jobs if merge request reference is missing

Push without merge request reference on top happens when merging tags
back into the public project so these failures would produce log noise.

6 months agoDo not fail post-merge jobs after force-push
Petr Špaček [Thu, 25 Sep 2025 10:22:41 +0000 (12:22 +0200)] 
Do not fail post-merge jobs after force-push

Rebase happens in -sub branches regularly so these failures would
produce log noice.

6 months agoDeduplicate Git NAME and EMAIL variables
Petr Špaček [Thu, 25 Sep 2025 10:20:24 +0000 (12:20 +0200)] 
Deduplicate Git NAME and EMAIL variables

As an additional perk, I hope JOB_ID will make it easier to debug it
something goes wrong with automated commits.

6 months agochg: dev: Refactoring in lib/isccfg
Evan Hunt [Thu, 23 Oct 2025 20:43:07 +0000 (20:43 +0000)] 
chg: dev: Refactoring in lib/isccfg

`cfg_obj_t` objects no longer depend on the `cfg_parser_t` life-cycle; they can now persist until the last reference is detached. The `file` field, which was previously a pointer to memory allocated in the parser, is now a pointer to a subsidiary `cfg_obj_t` of type string. The API calls for creating and detaching these objects have been simplified accordingly.

Since `cfg_obj_t` is now long-lived, a zone can hold a reference to its own configuration data, making it possible to use `rndc showzone` even if `allow-new-zones` is disabled.

Several API calls related to the parser have been removed or hidden. The `cfg_parse_file()` and `cfg_parse_buffer()` functions now internally create and destroy their own parsers, eliminating the need for the caller to do so.

Most of these changes are intended to simplify dumping of running configuration data in a future commit.

Merge branch 'colin/hide-cfg-parser' into 'main'

See merge request isc-projects/bind9!11132

6 months agorestore the former change_directory logging
Evan Hunt [Thu, 23 Oct 2025 18:44:15 +0000 (11:44 -0700)] 
restore the former change_directory logging

change_directory() now lives in libisccfg. when it was moved,
the logging behavior changed: previously it had been logged
by named only, in the general logging category, and without the
named.conf filename and line number. it was not logged by
named-checkconf. this behavior has now been restored.

6 months agotest rndc showzone works for named.conf zones
Colin Vidal [Thu, 23 Oct 2025 08:54:32 +0000 (10:54 +0200)] 
test rndc showzone works for named.conf zones

Since the zone now has a reference to their respective configuration
tree, `rndc showzone` can be used for any zones (including those
defined in namedconf), without `allow-new-zones` being enabled.
Add a test for this.

The test is part of the addzone suite because showzone used to be
related to addzone, but this could be moved elsewhere in the future
if more specific tests are needed for showzone.

6 months agoensure parser/cfg_obj log includes the line number
Colin Vidal [Thu, 23 Oct 2025 08:12:38 +0000 (10:12 +0200)] 
ensure parser/cfg_obj log includes the line number

Since the `file` property of cfg_obj_t can now be null (instead of
"none"), cfg_obj_t would take a fallback flow where the line was not
logged. This fixes it.

Also, add the log line when parser_complain is called and `file` is null
(which might happend when parsing buffer only) to also include the line
number.

6 months agosimplify and regularize cfg_* functions
Evan Hunt [Wed, 22 Oct 2025 21:51:15 +0000 (14:51 -0700)] 
simplify and regularize cfg_* functions

- several functions that can no longer fail have been changed to
  type void, and unnecessary 'cleanup' sections were removed
- renamed cfg_create_obj() to cfg_obj_create(), and cfg_create_tuple()
  to cfg_tuple_create(), to match typical nomenclature.
- fixed a memory leak bug, in which an element could be removed
  from a list in delete_zoneconf() without being freed. this has
  been addressed by adding a cfg_list_unlink() function.
  list elements are now allocated based on the list they will
  be stored in, using the same mctx.

6 months agosimplify cfg_parser API
Evan Hunt [Wed, 22 Oct 2025 17:41:05 +0000 (10:41 -0700)] 
simplify cfg_parser API

- the cfg_parser_create() and cfg_parser_destroy() calls are no
  longer used outside parser.c, so they are now static functions
- cfg_parser_attach(), cfg_parser_reset(), and cfg_parser_setflags()
  are no longer used at all, and have been removed.
- cfg_parser_mapadd() has been renamed for clarity to cfg_map_add().