2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-08-30 05:57:52 +00:00

37272 Commits

Author SHA1 Message Date
Michał Kępień
18e20f95f6 Fix startup detection after restart in start.pl
The bin/tests/system/start.pl script waits until a "running" message is
logged by a given name server instance before attempting to send a
version.bind/CH/TXT query to it.  The idea behind this was to make the
script wait until named loads all the zones it is configured to serve
before telling the system test framework that a given server is ready to
use; this prevents the need to add boilerplate code that waits for a
specific zone to be loaded to each test expecting that.

The problem is that when it looks for "running" messages, the
bin/tests/system/start.pl script assumes that the existence of any such
message in the named.run file indicates that a given named instance has
already finished loading all zones.  Meanwhile, some system tests
restart all the named instances they use throughout their lifetime (some
even do that a few times), for example to run Python-based tests.  The
bin/tests/system/start.pl script handles such a scenario incorrectly: as
soon as it finds any "running" message in the named.run file it inspects
and it gets a response to a version.bind/CH/TXT query, it tells the
system test framework that a given server is ready to use, which might
not be true - it is possible that only the "version.bind" zone is loaded
at that point and the "running" message found was logged by a
previously-shutdown named instance. This triggers intermittent failures
for Python-based tests.

Fix by improving the logic that the bin/tests/system/start.pl script
uses to detect server startup: check how many "running" lines are
present in a given named.run file before attempting to start a named
instance and only proceed with version.bind/CH/TXT queries when the
number of "running" lines found in that named.run file increases after
the server is started.
2022-10-11 11:54:57 +02:00
Michał Kępień
9146b956ae Do not truncate ns2 logs in the "rrsetorder" test
In the "rrsetorder" system test, the ns2 named instance is restarted
without passing the --restart option to bin/tests/system/start.pl.  This
causes the log file for that named instance to be needlessly truncated.
Prevent this from happening by restarting the affected named instance
in the same way as all the other named instances used in system tests.
2022-10-11 11:54:57 +02:00
Michał Kępień
d5fa1cb9dc Merge branch 'michal/set-up-version-and-release-notes-for-bind-9.19.7' into 'main'
Set up version and release notes for BIND 9.19.7

See merge request isc-projects/bind9!6884
2022-10-10 21:36:36 +00:00
Michał Kępień
87bf9b342b Set up release notes for BIND 9.19.7 2022-10-10 23:17:49 +02:00
Michał Kępień
0a758ebc95 Update BIND version to 9.19.7-dev 2022-10-10 23:17:49 +02:00
Petr Špaček
d16e0c058b Merge branch '3554-improve-dnssec-policy-inline-signing-err-msg' into 'main'
Clarify new configuration incompabitility: dnssec-policy vs. inline-signing

See merge request isc-projects/bind9!6865
2022-10-06 08:27:08 +00:00
Petr Špaček
5589d0a49c
Add Known Issue about config incompatibility 2022-10-06 10:26:33 +02:00
Petr Špaček
058c1744ba
Clarify error message about missing inline-signing & dnssec-policy 2022-10-06 10:26:30 +02:00
Mark Andrews
00f4268804 Merge branch '3577-reloads-in-ixfr-system-test-happen-too-fast' into 'main'
Resolve "reloads in ixfr system test happen too fast"

Closes #3577

See merge request isc-projects/bind9!6855
2022-10-05 21:33:04 +00:00
Mark Andrews
491a8cfe96 Add sleeps to ixfr system test
ensure that at least a second has passed since a zone was last loaded
to prevent it accidentally being skipped as up to date.
2022-10-06 08:18:03 +11:00
Evan Hunt
f2fa141668 Merge branch '3560-fix-view-resolver-layer-weak-references-violation' into 'main'
Resolve violation of weak referencing dns_view

Closes #3560

See merge request isc-projects/bind9!6848
2022-10-05 19:33:57 +00:00
Ondřej Surý
0dcbc6274b Record the 'edns-udp-size' in the view, not in the resolver
Getting the recorded value of 'edns-udp-size' from the resolver requires
strong attach to the dns_view because we are accessing `view->resolver`.
This is not the case in places (f.e. dns_zone unit) where `.udpsize` is
accessed.  By moving the .udpsize field from `struct dns_resolver` to
`struct dns_view`, we can access the value directly even with weakly
attached dns_view without the need to lock the view because `.udpsize`
can be accessed after the dns_view object has been shut down.
2022-10-05 11:59:36 -07:00
Ondřej Surý
bff3025396 Resolve violation of weak referencing dns_view
The dns_view implements weak and strong reference counting.  When strong
reference counting reaches zero, the adb, ntatable and resolver objects
are shut down and detached.

In dns_zone and dns_nta the dns_view was weakly attached, but the
view->resolver reference was accessed directly leading to dereferencing
the NULL pointer.

Add dns_view_getresolver() method which attaches to view->resolver
object under the lock (if it still exists) ensuring the dns_resolver
will be kept referenced until not needed.
2022-10-05 11:59:36 -07:00
Michal Nowak
934a6a8b8f Merge branch 'mnowak/drop-flake8-ignore-lists' into 'main'
Drop flake8 ignore lists

See merge request isc-projects/bind9!6778
2022-10-05 16:05:41 +00:00
Michal Nowak
f5d9fa6ea4
Drop flake8 ignore lists
flake8 is not used in BIND 9 CI and inline ignore lists are not needed
anymore.
2022-10-05 17:56:24 +02:00
Tony Finch
eb5da6bbdb Merge branch '3580-coverity-constant-boolean-dead-code' into 'main'
Avoid dead code warning when using a constant boolean

Closes #3580

See merge request isc-projects/bind9!6862
2022-10-05 15:51:20 +00:00
Tony Finch
138908b211 Avoid dead code warning when using a constant boolean
The value of `sign_bit` is platform-dependent but constant at compile
time. Use a cast to convert the boolean `sign_bit` to 0 or 1 instead of
ternary `?:` because one branch of the conditional is dead code. (We
could leave out the cast to `size_t` but our style prefers to handle
booleans more explicitly, hence the `?:` that caused the issue.)

    *** CID 358310:  Possible Control flow issues  (DEADCODE)
    /lib/isc/resource.c: 118 in isc_resource_setlimit()
    112     		 * rlim_t, and whether rlim_t has a sign bit.
    113     		 */
    114     		isc_resourcevalue_t rlim_max = UINT64_MAX;
    115     		size_t wider = sizeof(rlim_max) - sizeof(rlim_t);
    116     		bool sign_bit = (double)(rlim_t)-1 < 0;
    117
    >>>     CID 358310:  Possible Control flow issues  (DEADCODE)
    >>>     Execution cannot reach the expression "1" inside this statement: "rlim_max >>= 8UL * wider + ...".
    118     		rlim_max >>= CHAR_BIT * wider + (sign_bit ? 1 : 0);
    119     		rlim_value = ISC_MIN(value, rlim_max);
    120     	}
    121
    122     	rl.rlim_cur = rl.rlim_max = rlim_value;
    123     	unixresult = setrlimit(unixresource, &rl);
2022-10-05 15:51:05 +00:00
Ondřej Surý
0e92878211 Merge branch 'ondrej/add-isc_mem_zero' into 'main'
Replace isc_mem_*_aligned(..., alignment) with isc_mem_*x(..., flags)

See merge request isc-projects/bind9!6398
2022-10-05 14:44:36 +00:00
Ondřej Surý
5878ff65ee
Add CHANGES note for [GL !6398] 2022-10-05 16:44:05 +02:00
Ondřej Surý
e18b6fb6a6
Use isc_mem_regetx() when appropriate
While refactoring the isc_mem_getx(...) usage, couple places were
identified where the memory was resized manually.  Use the
isc_mem_reget(...) that was introduced in [GL !5440] to resize the
arrays via function rather than a custom code.
2022-10-05 16:44:05 +02:00
Ondřej Surý
c0598d404c
Use designated initializers instead of memset()/MEM_ZERO for structs
In several places, the structures were cleaned with memset(...)) and
thus the semantic patch converted the isc_mem_get(...) to
isc_mem_getx(..., ISC_MEM_ZERO).  Use the designated initializer to
initialized the structures instead of zeroing the memory with
ISC_MEM_ZERO flag as this better matches the intended purpose.
2022-10-05 16:44:05 +02:00
Ondřej Surý
c1d26b53eb
Add and use semantic patch to replace isc_mem_get/allocate+memset
Add new semantic patch to replace the straightfoward uses of:

  ptr = isc_mem_{get,allocate}(..., size);
  memset(ptr, 0, size);

with the new API call:

  ptr = isc_mem_{get,allocate}x(..., size, ISC_MEM_ZERO);
2022-10-05 16:44:05 +02:00
Ondřej Surý
dbf5672f32
Replace isc_mem_*_aligned(..., alignment) with isc_mem_*x(..., flags)
Previously, the isc_mem_get_aligned() and friends took alignment size as
one of the arguments.  Replace the specific function with more generic
extended variant that now accepts ISC_MEM_ALIGN(alignment) for aligned
allocations and ISC_MEM_ZERO for allocations that zeroes
the (re-)allocated memory before returning the pointer to the caller.
2022-10-05 16:44:05 +02:00
Tony Finch
4d5fd50f9a Merge branch '3582-coverity-bench-siphash' into 'main'
Suppress division by zero warning

Closes #3582

See merge request isc-projects/bind9!6863
2022-10-05 12:10:18 +00:00
Tony Finch
cf715d488b Suppress division by zero warning
Coverity is optimistic that we might do thousands of hashes in less
than a microsecond.

    /tests/bench/siphash.c: 54 in main()
    48     			count++;
    49     		}
    50
    51     		isc_time_now_hires(&finish);
    52
    53     		us = isc_time_microdiff(&finish, &start);
    >>>     CID 358309:  Integer handling issues  (DIVIDE_BY_ZERO)
    >>>     In expression "count * 1000UL / us", division by expression "us" which may be zero has undefined behavior.
    54     		printf("%f us wide-lower len %3zu, %7llu kh/s (%llx)\n",
    55     		       (double)us / 1000000.0, len,
    56     		       (unsigned long long)(count * 1000 / us),
    57     		       (unsigned long long)sum);
    58     	}
    59
2022-10-05 12:31:42 +01:00
Petr Špaček
61b3dcc086 Merge branch '3572-fix-duplicate-link-anchor' into 'main'
Deduplicate link anchors in the ARM

See merge request isc-projects/bind9!6846
2022-10-05 09:44:15 +00:00
Petr Špaček
137e0f4e0e
Remove manually defined anchors pointing to statement definitions
This is hopefully end of duplication. This batch did not cause clashes
in Sphinx but it was pointless nonetheless as we have auto-generated
anchors for all statements.
2022-10-05 11:36:22 +02:00
Tom Krizek
ea2d213f34
Remove trailing whitespaces 2022-10-05 11:36:22 +02:00
Petr Špaček
9a7c2b370e
Deduplicate link anchors in the ARM
Some statement names like "allow-query" had manually defined link anchor
_allow-query and also implicit anchor created by
.. namedconf:statement:: syntax. This causes warnings if a ambiguous
reference is made using :any:`allow-query` syntax.

Remove (hopefully all) manually defined anchors which pointed to
identical place as the implicit anchor. This allows :any: to work.

In rare cases where manual anchor points to descriptive text separated
from statement definition the reference was disamguated by replacing
:any:`notify` with :ref:`notify` (for manual anchor)
vs. :namedconf:ref:`notify` (for statement definition).

Please note that `options` statement is a trap: It is ambiguous even
without manual anchor because rndc.conf has its own `options`. Use
:namedconf:ref:`options` vs. :rndcconf:ref:`options` to select
appropriate target.
2022-10-05 11:36:19 +02:00
Mark Andrews
952e1cb454 Merge branch '3338-zero-system-test-add-forensics' into 'main'
Add additional forensics to zero system test

See merge request isc-projects/bind9!6295
2022-10-05 08:26:00 +00:00
Mark Andrews
285351d4b2 Add additional forensics to zero system test 2022-10-05 07:46:01 +00:00
Petr Špaček
6f6f925b9f Merge branch 'pspacek/tsan-ci-artifacts-fix' into 'main'
Fix TSAN artifact gathering in CI

See merge request isc-projects/bind9!6853
2022-10-05 07:43:56 +00:00
Petr Špaček
9559eb3b21
Fix TSAN artifact gathering in CI
Fixup for 2c3b2dabe9a6b3c4a10f6498a1169f39ed031eed.

We forgot to update TSAN paths when moving all the unit tests to
/tests/.  Let's remove paths from find to make it less dependent on
exact location, and store all untracked files as we do in the normal
unit test template.

Related: !6243
2022-10-05 09:43:07 +02:00
Matthijs Mekking
faba965871 Merge branch 'matthijs-refactor-serve-stale' into 'main'
Refactor serve-stale stale-answer-client-timeout 0

See merge request isc-projects/bind9!6845
2022-10-05 07:15:27 +00:00
Matthijs Mekking
0681b15225 If refresh stale RRset times out, start stale-refresh-time
The previous commit failed some tests because we expect that if a
fetch fails and we have stale candidates in cache, the
stale-refresh-time window is started. This means that if we hit a stale
entry in cache and answering stale data is allowed, we don't bother
resolving it again for as long we are within the stale-refresh-time
window.

This is useful for two reasons:
- If we failed to fetch the RRset that we are looking for, we are not
  hammering the authoritative servers.

- Successor clients don't need to wait for stale-answer-client-timeout
  to get their DNS response, only the first one to query will take
  the latency penalty.

The latter is not useful when stale-answer-client-timeout is 0 though.

So this exception code only to make sure we don't try to refresh the
RRset again if it failed to do so recently.
2022-10-05 08:20:48 +02:00
Matthijs Mekking
64d51285d5 Reuse recursion type code for refresh stale RRset
Refreshing a stale RRset is similar to prefetching an RRset, so
reuse the existing code. When refreshing an RRset we need to clear
all db options related to serve-stale so that stale RRsets in cache
are ignored during the refresh.

We no longer need to set the "nodetach" flag, because the refresh
fetch is now a "fetch and forget". So we can detach from the client
in the query_send().

This code will break some serve-stale test cases, this will be fixed
in the successor commit.

TODO: add explanation why the serve-stale test cases fail.
2022-10-05 08:20:48 +02:00
Matthijs Mekking
5fb8e555bc Add new recursion type for refreshing stale RRset
Refreshing a stale RRset is similar to a prefetch query, so we can
refactor this code to use the new recursion types introduced in !5883.
2022-10-05 08:20:48 +02:00
Ondřej Surý
d4df60179a Merge branch 'ondrej-implement-case-insensitive-siphash-2-4' into 'main'
Add a case-insensitive option directly to siphash 2-4 implementation

See merge request isc-projects/bind9!6789
2022-10-04 09:03:00 +00:00
Ondřej Surý
c14a4ac763
Add a case-insensitive option directly to siphash 2-4 implementation
Formerly, the isc_hash32() would have to change the key in a local copy
to make it case insensitive.  Change the isc_siphash24() and
isc_halfsiphash24() functions to lowercase the input directly when
reading it from the memory and converting the uint8_t * array to
64-bit (respectively 32-bit numbers).
2022-10-04 10:32:40 +02:00
Tony Finch
de10d697ab
A simple siphash benchmark
To see the effect of adding a case-insentitive option.
2022-10-04 10:32:40 +02:00
Mark Andrews
0f78fbc461 Merge branch '3544-add-dohpath-parsing-to-svbc' into 'main'
Resolve "Add dohpath parsing to SVCB"

Closes #3544

See merge request isc-projects/bind9!6774
2022-10-04 04:30:04 +00:00
Mark Andrews
5f07fe8cbb Use strnstr implementation from FreeBSD if not provided by OS 2022-10-04 14:21:41 +11:00
Mark Andrews
2f3441b40a Add release note for [GL #3544] 2022-10-04 14:21:41 +11:00
Mark Andrews
335b397e15 Add CHANGES note for [GL #3544] 2022-10-04 14:21:41 +11:00
Mark Andrews
6d561d3886 Add support for 'dohpath' to SVCB (and HTTPS)
dohpath is specfied in draft-ietf-add-svcb-dns and has a value
of 7.  It must be a relative path (start with a /), be encoded
as UTF8 and contain the variable dns ({?dns}).
2022-10-04 14:21:41 +11:00
Tony Finch
34605e9772 Merge branch '3549-isc-resource-ub' into 'main'
Avoid signed integer overflow in isc_resource_setlimit()

Closes #3549

See merge request isc-projects/bind9!6788
2022-10-03 11:38:20 +00:00
Tony Finch
4e37a6f77a Avoid signed integer overflow in isc_resource_setlimit()
On systems with signed rlim_t the old code calculated its maximum
value by shifting 1 into the sign bit, which is undefined behaviour.
Avoid the bug by using an unsigned shift.
2022-10-03 11:37:17 +00:00
Ondřej Surý
1279d2dee9 Merge branch 'ondrej-increase-the-time-to-wait-for-servers-to-gracefully-shutdown' into 'main'
Be more patient when stopping servers in the system tests

See merge request isc-projects/bind9!6847
2022-09-30 15:38:47 +00:00
Ondřej Surý
d971472321 Be more patient when stopping servers in the system tests
When the TCP test is run on the busy server, the server might take a
while to wind the server down because it might still be processing all
that 300k invalid XFR requests.

Increate the rncd wait time to 120 seconds, the SIGTERM time to 300
seconds, and reduce the time to wait for ans servers from 1200 second
to just 120 seconds.
2022-09-30 17:12:44 +02:00
Ondřej Surý
3b01b436a2 Merge branch '3571-fix-data-race-in-dns_nta' into 'main'
Don't stop timer from dns__nta_shutdown()

Closes #3571

See merge request isc-projects/bind9!6844
2022-09-30 14:18:29 +00:00