Commit graph

11485 commits

Author SHA1 Message Date
Ondřej Surý
c8f1fa0e47
Follow the number of CPU set by taskset/cpuset
Administrators may wish to constrain the set of cores that BIND 9 runs
on via the 'taskset', 'cpuset' or 'numactl' programs (or equivalent on
other O/S), for example to achieve higher (or more stable) performance
by more closely associating threads with individual NIC rx queues. If
the admin has used taskset, it follows that BIND ought to
automatically use the given number of CPUs rather than the system wide
count.

Co-Authored-By: Ray Bellis <ray@isc.org>
(cherry picked from commit 5a2df8caf5)
2024-09-03 14:54:40 +02:00
Mark Andrews
5d81a258e3 Return partial match when requested
Return partial match from dns_db_find/dns_db_find when requested
to short circuit the closest encloser discover process.  Most of the
time this will be the actual closest encloser but may not be when
there yet to be committed / cleaned up versions of the zone with
names below the actual closest encloser.

(cherry picked from commit d42ea08f16)
2024-08-29 21:05:54 +00:00
Michal Nowak
5a802a22b5 Bump max-recursion-queries to 100 in resolver system test
With max-recursion-queries set to 50 the resolver system test was
unstable in the "checking query resolution for a domain with a valid
glueless delegation chain" check as ns1 replied with SERVFAIL.

(cherry picked from commit 8e0244d300)
2024-08-29 14:41:52 +00:00
Nicki Křížek
c75d9734e7
Revert "Mark the keyfromlabel&enginepkcs11 tests as xfail"
This reverts commit ff983ed647.
2024-08-26 10:09:41 +02:00
Matthijs Mekking
9e1bed5bdb Adjust kasp system test to get keys which signed
If there is a keytag conflict between keys with different algorithms,
we need to supply what key algorithm is used so we can get the right
public key.

For clarity, print the algorithm on the found keys after 'check_keys'.

(cherry picked from commit 7bb6d82505)
2024-08-22 10:15:01 +00:00
Michal Nowak
b5caae0633
Use clang-format-19 to update formatting 2024-08-22 10:25:22 +02:00
Evan Hunt
2b58dc89f5 check for NULL before closing batchfp
this silences a warning from clang-scan 19.
2024-08-21 21:37:51 -07:00
Nicki Křížek
9a63dd7cb6 Merge tag 'v9.18.29' into bind-9.18 2024-08-21 16:36:08 +02:00
Aram Sargsyan
3832070e92 Print the full path of the working directory in startup log messages
named now prints its initial working directory during startup and the
changed working directory when loading or reloading its configuration
file if it has a valid 'directory' option defined.

(cherry picked from commit fd8e1d161f)
2024-08-21 08:20:55 +00:00
Nicki Křížek
9a154d66ed
Allow rerun of unstable statschannel tests under TSAN
The test_traffic_json and test_traffic_xml occasionally fail when
running under TSAN. This happens in CI and is most likely a result of
some instability that doesn't seem to be easily reproduced.

(cherry picked from commit ec2fc7680a)
2024-08-19 17:54:27 +02:00
Ondřej Surý
a49079c84c Change the NS_PER_SEC (and friends) from enum to static const
New version of clang (19) has introduced a stricter checks when mixing
integer (and float types) with enums.  In this case, we used enum {}
as C17 doesn't have constexpr yet.  Change the time conversion constants
to be #defined constants because of RHEL 8 compiler doesn't consider
static const unsigned int to be constant.

(cherry picked from commit b03e90e0d4)
2024-08-19 15:32:03 +00:00
Nicki Křížek
7f057b379d Use python3 in shebang lines for util scripts
Some distributions (notably, debian bookworm) have deprecated the
`python` interpreter in favor of `python3`. Since our scripts are
python3 anyway, use the proper numbered version in shebang to make
scripts easily executable.

(cherry picked from commit 480dcdef9a)
2024-08-14 15:43:39 +00:00
Aram Sargsyan
2e6e4cdb55
Non empty 'catalog-zones' implies that 'allow-new-zones' is true
This condition in catalog zone processing functions is checked only
for sanity, so there is no meaning for a log message that normally
shouldn't be ever logged.

(cherry picked from commit 0b3c8ee55e6cda1f2de35aa15f6a4d82d072c309)
2024-08-09 08:52:25 +02:00
Aram Sargsyan
4379141fe4
Reconfigure catz member zones during named reconfiguration
During a reconfiguration named doesn't reconfigure catalog zones
member zones. Implement the necessary code to reconfigure catz
member zones.

(cherry picked from commit fd71ed5d73ae2dc968e8782ce652fb8ef257c25e)
2024-08-09 08:52:25 +02:00
Aram Sargsyan
565731ceea
Test that 'rndc reconfig' reconfigures catz member zones
Catalog zone member zones should be reconfigured as all the other
zones during a reconfiguration. Test it by checking whether the newly
added allow-query setting affects a member zone.

(cherry picked from commit cd04b89dba85781c194f22ce6fe358c972a14758)
2024-08-09 08:52:25 +02:00
Evan Hunt
2e04f0380c implement 'max-query-restarts'
implement, document, and test the 'max-query-restarts' option
which specifies the query restart limit - the number of times
we can follow CNAMEs before terminating resolution.

(cherry picked from commit 104f3b82fb)
2024-08-07 15:36:16 -07:00
Evan Hunt
a11367ade3 reduce the max-recursion-queries default to 32
the number of iterative queries that can be sent to resolve a
name now defaults to 32 rather than 100.

(cherry picked from commit 7e3b425dc2)
2024-08-07 15:36:15 -07:00
Evan Hunt
bfbc6a6c84 make "max_restarts" a configurable value
MAX_RESTARTS is no longer hard-coded; ns_server_setmaxrestarts()
and dns_client_setmaxrestarts() can now be used to modify the
max-restarts value at runtime. in both cases, the default is 11.

(cherry picked from commit c5588babaf)
2024-08-07 15:36:15 -07:00
Evan Hunt
dd88a4cdfc reduce MAX_RESTARTS to 11
the number of steps that can be followed in a CNAME chain
before terminating the lookup has been reduced from 16 to 11.
(this is a hard-coded value, but will be made configurable later.)

(cherry picked from commit 05d78671bb)
2024-08-07 15:36:14 -07:00
Nicki Křížek
fc87a96e07 Make hypothesis optional for system tests
Ensure that system tests can be executed without Python hypothesis
package.

(cherry picked from commit e6a7695600)
2024-08-07 11:00:24 +00:00
Ondřej Surý
236de53c52
Use EXIT_SUCCESS and EXIT_FAILURE
Instead of randomly using -1 or 1 as a failure status, properly utilize
the EXIT_FAILURE define that's platform specific (as it should be).

(cherry picked from commit76997983fde02d9c32aa23bda30b65f1ebd4178c)
2024-08-06 15:19:06 +02:00
Ondřej Surý
1a82a85266
Use _exit() in the fatal() function
Since the fatal() isn't a correct but rather abrupt termination of the
program, we want to skip the various atexit() calls because not all
memory might be freed during fatal() call, etc.  Using _exit() instead
of exit() has this effect - the program will end, but no destructors or
atexit routines will be called.

(cherry picked from commit 4bec711fe3)
2024-08-06 14:52:24 +02:00
Ondřej Surý
e494854523
Use LC_ALL to override all system locales
The system tests were overriding the local locale by setting LANG to C.
This does not override the locale in case there are individual LC_<*>
variables like LC_CTYPE explicitly set.

Use LC_ALL=C instead which is the proper way of overriding all currently
set locales.
2024-08-05 09:42:50 +02:00
Yedaya Katsman
1b45e64d3f Remove newlines from dighost errors calls
Not all invocations had it, and this makes it more consistent with
dighost_warning. Also remove the conditional newline when not outputting
yaml

(cherry picked from commit 1dd76fe780)
2024-08-05 03:40:41 +00:00
Yedaya Katsman
87cb888a2d Remove extra newline from +yaml output
The newlines weren't needed for the yaml syntax, and took up space.

(cherry picked from commit 8986dda74a)
2024-08-05 03:40:41 +00:00
Mark Andrews
0dbda6661d Prevent overflow of bufsize
If bufsize overflows we will have an infinite loop.  In practice
this will not happen unless we have made a coding error.  Add an
INSIST to detect this condition.

    181retry:
    182        isc_buffer_allocate(mctx, &b, bufsize);
    183        result = dns_rdata_totext(rdata, NULL, b);
    184        if (result == ISC_R_NOSPACE) {
    185                isc_buffer_free(&b);

    CID 498031: (#1 of 1): Overflowed constant (INTEGER_OVERFLOW)
    overflow_const: Expression bufsize, which is equal to 0, overflows
    the type that receives it, an unsigned integer 32 bits wide.
    186                bufsize *= 2;
    187                goto retry;
    188        }

(cherry picked from commit 20ac13fb23)
2024-08-04 23:52:20 +00:00
Mark Andrews
02cb4823db Prevent overflow of size
If size overflows we will have an infinite loop.  In practice
this will not happen unless we have made a coding error.  Add
an INSIST to detect this condition.

    181        while (!done) {
    182                isc_buffer_allocate(mctx, &b, size);
    183                result = dns_rdata_totext(rdata, NULL, b);
    184                if (result == ISC_R_SUCCESS) {
    185                        printf("%.*s\n", (int)isc_buffer_usedlength(b),
    186                               (char *)isc_buffer_base(b));
    187                        done = true;
    188                } else if (result != ISC_R_NOSPACE) {
    189                        check_result(result, "dns_rdata_totext");
    190                }
    191                isc_buffer_free(&b);

    CID 498025: (#1 of 1): Overflowed constant (INTEGER_OVERFLOW)
    overflow_const: Expression size, which is equal to 0, overflows the type that
    receives it, an unsigned integer 32 bits wide.
    192                size *= 2;
    193        }

(cherry picked from commit e7ef0a60ab)
2024-08-04 23:52:20 +00:00
Štěpán Balážik
4196b92f02 Add a helper for uncompressed length of dnspython's dns.name.Name
This is useful for generating using hypothesis but also for other
cases.

(cherry picked from commit 9584a7bdcd)
2024-08-02 11:22:56 +00:00
Štěpán Balážik
df01e5d788 Move hypothesis strategies to isctest for later reuse
`isctest.hypothesis` seems to be a nice place to have these.

(cherry picked from commit bb1e5cfa09)
2024-08-02 11:22:56 +00:00
Štěpán Balážik
d0288545f3 Disable deadlines for hypothesis tests when running in CI
The times it takes to run tests CI vary significantly enough
that it makes hypothesis test reach their deadlines and fail randomly
marking the tests as flaky.

This commit disables the deadlines when running in CI.

(cherry picked from commit f55cacbbfd)
2024-08-02 11:22:56 +00:00
Štěpán Balážik
2ae0e31138 Test nested wildcard special case in the respective system test
See final remark of RFC 4592 2.2.1. for details.

(cherry picked from commit 9943172566)
2024-08-02 11:22:56 +00:00
Štěpán Balážik
132357101e Expand the wildcard system test with wider use of hypothesis
The queries are now generated more generally (i. e. they have
multiple labels, etc.).

(cherry picked from commit d0cfbd398e)
2024-08-02 11:22:56 +00:00
Štěpán Balážik
f78e41c231 Add hypothesis strategies for generating DNS names and company
The most important being `dns_names` that generates dns.name.Name
objects based on given paramaters.

No guarantees are given when it comes the uniformity of generated
samples, however it plays nicely with the hypothesis' shrinking
algorithm.

Once we use hypothesis more widely (in at least one more test) this file
should be moved for it to be reused easily.

(cherry picked from commit 5d738cd9ed)
2024-08-02 11:22:56 +00:00
Štěpán Balážik
3aac716a46 Extend isctest package with more utility functions
Check for more rcodes and various properties needed in the wildcard
test. Add a `name` module for various dns.name.Name operations (with
`prepend_label` function only now).

Expose `timeout` as a parameter of `query.tcp`/`query.udp`.

(cherry picked from commit e7d46ad8ba)
2024-08-02 11:22:56 +00:00
Mark Andrews
cb180bf4ea Reset 'ret' to zero at start of tests
(cherry picked from commit 2dc2abd00d)
2024-08-02 03:01:48 +00:00
Mark Andrews
80a21e75b8 check 'update-policy 6to4-self' over IPv6
(cherry picked from commit 3b0de4773b)
2024-08-02 00:09:17 +00:00
Mark Andrews
799f677313 check 'update-policy 6to4-self' over IPv4
(cherry picked from commit b28e5ff721)
2024-08-02 00:09:17 +00:00
Mark Andrews
4649e85e3b Test that false positive "success resolving" is not logged
(cherry picked from commit 111e285214)
2024-08-01 15:58:16 +10:00
Mark Andrews
4eb6db47ac Test yaml output with yaml specials
(cherry picked from commit fadf461761)
2024-08-01 03:48:13 +00:00
Mark Andrews
de4a087673 resolver system test didn't record all failures
(cherry picked from commit 5843b29f47)
2024-08-01 12:41:45 +10:00
Mark Andrews
a8d86f0531 Check invalid alpn empty value
(cherry picked from commit fa35c67301)
2024-08-01 01:10:53 +00:00
Mark Andrews
74a8cc9db6 Check invalid alpn produced due to missing double escapes
(cherry picked from commit a49b2a3568)
2024-08-01 01:10:53 +00:00
Aram Sargsyan
6bad06ea2e Update the chain test
Update the CNAME chain test to correspond to the changed behavior,
because now named returns SERVFAIL when hitting the maximum query
restarts limit (e.g. happening when following a long CNAME chain).

In the current test auth will hit the limit and return partial data
with a SERVFAIL code, while the resolver will return no data with
a SERVFAIL code after auth returns SERVFAIL to it.

(cherry picked from commit 7751c7eca6)
2024-07-31 15:14:43 +00:00
Aram Sargsyan
27f6fc915c Test that a long CNAME chain causes SERVFAIL
Also check that the expected partial answer in returned too.

(cherry picked from commit 580f872fe1)
2024-07-31 15:14:43 +00:00
Mark Andrews
3af3ef53a0 Disable post zone verification for manykeys
As the expiration time is now+1 the RRSIG records may expire before
the verification step happens.

(cherry picked from commit 0d69afd764)
2024-07-31 15:04:31 +10:00
Matthijs Mekking
d376d314af Fix kasp system test
In 9.18, 'inline-signing yes;' must also be configured explicitly for
zones using dnssec-policy without a configured 'allow-update' or
'update-policy'.
2024-07-30 15:57:28 +02:00
Matthijs Mekking
8ec554e3de No longer update key lifetime if key is retired
The key lifetime should no longer be adjusted if the key is being
retired earlier, for example because a manual rollover was started.

This would falsely be seen as a dnssec-policy lifetime reconfiguration,
and would adjust the retire/removed time again.

This also means we should update the status output, and the next
rollover scheduled is now calculated using (retire-active) instead of
key lifetime.

(cherry picked from commit 129973ebb0)
2024-07-30 13:38:04 +02:00
Matthijs Mekking
55f79b34b6 Test updating dnssec-policy key lifetime
Check if the key lifetime is updated in the key files. Make sure the
inactive and removed timing metadata are adjusted accordingly.

(cherry picked from commit 2237895bb4)
2024-07-30 10:22:53 +00:00
Matthijs Mekking
6c0380db8a Move dnssec-policy to kasp-fips.conf.in
All dnssec-policy configurations are here, so why not this one?

(cherry picked from commit 93326e3e18)
2024-07-30 10:22:53 +00:00
Matthijs Mekking
1f2faa8470 Fix dig connection timeout argument when using DOH
bin/dig/dighost.c calls isc_nm_httpconnect. The timeout setting
(local_timeout) is passed as the 11th argument, but the function in
lib/isc/netmgr/http.c has the timeout argument as the 11th argument.
The 10th and 11th argument were reversed. This commit fixes that.

Thanks to Nicolas Dehaine for reporting and providing the fix.
2024-07-30 08:52:05 +00:00