2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-08-31 06:25:31 +00:00
Commit Graph

38906 Commits

Author SHA1 Message Date
Ondřej Surý
02edb42a0a Merge branch '4015-fix-forward_cancel-from-the-wrong-loop' into 'main'
Run the forward_cancel on the appropriate zone->loop

Closes #4015

See merge request isc-projects/bind9!7835
2023-04-14 15:13:03 +00:00
Ondřej Surý
2423907b87 Add CHANGES note for [GL #4015] 2023-04-14 16:31:48 +02:00
Ondřej Surý
3df3b5efbd Run the forward_cancel on the appropriate zone->loop
If the zone forwards are canceled from dns_zonemgr_shutdown(), the
forward_cancel() would get called from the main loop, which is wrong.
It needs to be called from the matching zone->loop.

Run the dns_request_cancel() via isc_async_run() on the loop associated
with the zone instead of calling the dns_request_cancel() directly from
the main loop.
2023-04-14 16:31:33 +02:00
Ondřej Surý
36a3c87c33 Merge branch 'ondrej/remove-unused-netmgr-worker-sendbuf' into 'main'
Remove unused netmgr->worker->sendbuf

See merge request isc-projects/bind9!7841
2023-04-14 14:20:52 +00:00
Ondřej Surý
f677cf6b73 Remove unused netmgr->worker->sendbuf
By inspecting the code, it was discovered that .sendbuf member of the
isc__nm_networker_t was unused and just consuming ~64k per worker.
Remove the member and the association allocation/deallocation.
2023-04-14 16:20:14 +02:00
Arаm Sаrgsyаn
9bd88df624 Merge branch '4000-openssl-attr-malloc-vs-cmocka-define-malloc' into 'main'
unit tests: include an OpenSSL header before including cmocka.h

Closes #4000

See merge request isc-projects/bind9!7820
2023-04-14 12:12:13 +00:00
Aram Sargsyan
786b0689c6 Add a CHANGES note for [GL #4000] 2023-04-14 12:11:52 +00:00
Aram Sargsyan
87db9ea84c unit tests: include an OpenSSL header before including cmocka.h
OpenSSL 3.1.0 uses __attribute__(malloc), conflicting with a redefined
malloc in cmocka.h.

As a workaround, include an OpenSSL header file before including
cmocka.h in the unit tests where OpenSSL is used.
2023-04-14 12:11:52 +00:00
Petr Špaček
9e3f7f4d53 Merge branch 'pspacek/set-up-version-and-release-notes-for-bind-9.19.13' into 'main'
Set up version and release notes for BIND 9.19.13

See merge request isc-projects/bind9!7839
2023-04-14 09:03:19 +00:00
Petr Špaček
923eb6667f Update BIND version to 9.19.13-dev 2023-04-14 10:51:44 +02:00
Petr Špaček
0fb1e00469 Set up release notes for BIND 9.19.13 2023-04-14 10:51:23 +02:00
Arаm Sаrgsyаn
546312f06c Merge branch 'aram/dns_xfrin_create-use-after-free' into 'main'
Fix a use-after-free bug in dns_xfrin_create()

See merge request isc-projects/bind9!7832
2023-04-14 07:40:01 +00:00
Aram Sargsyan
bf8e93aee5 Add a CHANGES note for [GL !7832] 2023-04-14 07:39:38 +00:00
Aram Sargsyan
d8a207bd00 Fix a use-after-free bug in dns_xfrin_create()
'xfr' is used after detaching the only reference, which would
have destroyed the object.

Call dns_xfrin_detach() only after the final use of 'xfr'.
2023-04-14 07:39:38 +00:00
Mark Andrews
172c678f2b Merge branch '3980-add-timeouts-to-unit-tests' into 'main'
Draft: Resolve "Add timeouts to unit tests."

Closes #3980

See merge request isc-projects/bind9!7837
2023-04-14 06:34:36 +00:00
Mark Andrews
21a3d4f762 Use SIGABRT rather than SIGKILL for long running unit test
SIGABRT will produce a core dump which will allow for forensic
analysis of the unit test
2023-04-14 15:40:02 +10:00
Ondřej Surý
b6c9ac75ad Merge branch '3980-revert-unit-test-forking' into 'main'
Revert "Kill unit tests that run more than 1200 seconds"

Closes #3980

See merge request isc-projects/bind9!7833
2023-04-14 04:19:40 +00:00
Ondřej Surý
c60ce13127 Revert "Kill unit tests that run more than 1200 seconds"
This reverts commit 3d5c7cd46c which
added wrapper around all the unit tests that would run the unit test in
the forked process.

This makes any debugging of the unit tests too hard.  Futures attempts
to fix #3980 should add a custom automake test harness (log driver) that
would kill the unit test after configured timeout.
2023-04-14 06:14:19 +02:00
Mark Andrews
22fb1b115a Merge branch '4003-dump_histo-defined-but-not-used-on-fips-in-bin-named-statschannel-c' into 'main'
Resolve "'dump_histo' defined but not used on FIPS in bin/named/statschannel.c"

Closes #4003

See merge request isc-projects/bind9!7826
2023-04-12 23:49:55 +00:00
Mark Andrews
82d2434ff8 dump_histo is only used with extended stats
Wrap dump_histo with #if defined(EXTENDED_STATS)/#endif.  Reproduce
build failure with "configure --without-libxml2 --without-json-c"
2023-04-13 08:53:27 +10:00
Ondřej Surý
8117c11d09 Merge branch '3985-make-TCP-accept-a-tad-bit-faster' into 'main'
Fix the TCP accept quota code

Closes #3985

See merge request isc-projects/bind9!7823
2023-04-12 12:12:33 +00:00
Ondřej Surý
b88ed40c96 Add CHANGES note for [GL #3985] 2023-04-12 14:10:37 +02:00
Ondřej Surý
1715cad685 Refactor the isc_quota code and fix the quota in TCP accept code
In e185412872, the TCP accept quota code
became broken in a subtle way - the quota would get initialized on the
first accept for the server socket and then deleted from the server
socket, so it would never get applied again.

Properly fixing this required a bigger refactoring of the isc_quota API
code to make it much simpler.  The new code decouples the ownership of
the quota and acquiring/releasing the quota limit.

After (during) the refactoring it became more clear that we need to use
the callback from the child side of the accepted connection, and not the
server side.
2023-04-12 14:10:37 +02:00
Ondřej Surý
1768522045 Convert tls_send() callback to use isc_job_run()
The tls_send() was already using uvreq; convert this to use more direct
isc_job_run() - the on-loop no-allocation method.
2023-04-12 14:10:37 +02:00
Ondřej Surý
1302345c93 Convert isc__nm_http_send() from isc_async_run() to isc_job_run()
The isc__nm_http_send() was already using uvreq; convert this to use
more direct isc_job_run() - the on-loop no-allocation method.
2023-04-12 14:10:37 +02:00
Ondřej Surý
3adba8ce23 Use isc_job_run() for reading from StreamDNS socket
Change the reading in the StreamDNS code to use isc_job_run() instead of
using isc_async_run() for less allocations and more streamlined
execution.
2023-04-12 14:10:37 +02:00
Ondřej Surý
74cbf523b3 Run closehandle_cb on run queue instead of async queue
Instead of using isc_async_run() when closing StreamDNS handle, add
isc_job_t member to the isc_nmhandle_t structure and use isc_job_run()
to avoid allocation/deallocation on the StreamDNS hot-path.
2023-04-12 14:10:37 +02:00
Ondřej Surý
d27f6f2d68 Accept overquota TCP connection on local thread if possible
If the quota callback is called on a thread matching the socket, call
the TCP accept function directly instead of using isc_async_run() which
allocates-deallocates memory.
2023-04-12 14:10:37 +02:00
Ondřej Surý
0a468e7c9e Make isc_tid() a header-only function
The isc_tid() function is often called on the hot-path and it's the only
function is to return thread_local variable, make the isc_tid() function
a header-only to save several function calls during query-response
processing.
2023-04-12 14:10:37 +02:00
Tom Krizek
9ca151680c Merge branch 'tkrizek/dnsrps-test-replace-egrep' into 'main'
Replace egrep with grep -E in rpz tests

See merge request isc-projects/bind9!7821
2023-04-12 11:55:28 +00:00
Tom Krizek
c977b0c81d Replace egrep with grep -E in rpz tests
GNU Grep 3.8 reports the following warnings:

    egrep: warning: egrep is obsolescent; using grep -E
2023-04-12 13:32:46 +02:00
Mark Andrews
eb2c8ab213 Merge branch '3975-atomically-increase-rrn-in-add-other-data' into 'main'
atomically increase rrn in add_other_data

Closes #3975

See merge request isc-projects/bind9!7824
2023-04-11 02:45:48 +00:00
Mark Andrews
6cf8a532d4 Atomically increase rrn in add_other_data
'rrn' needs to be treated atomically as it updated from multiple threads.
2023-04-11 10:44:36 +10:00
Michal Nowak
ff34a1f117 Merge branch '3916-legacy-test-no-retries-in-resolution_fails' into 'main'
Do not retry in resolution_fails() on timeout

Closes #3916

See merge request isc-projects/bind9!7814
2023-04-06 09:39:22 +00:00
Michal Nowak
e05460c813 Do not retry in resolution_fails() on timeout
At the time of test number (19), there were 10 "sending packet to
10.53.0.7" lines in the "legacy/ns1/named.run" file; usually, only seven
are present:

    I:legacy:checking recursive lookup to edns 512 + no tcp server does not cause query loops (19)
    I:legacy:ns1 sent 10 queries to ns7, expected less than 10
    I:legacy:failed

Those three can be attributed to tests "8", "10", and "18", where the
dig of "resolution_fails()" retried after a timeout to succeed with
"status: SERVFAIL" subsequently, as seen in each of
dig.out.test{8,10,18} files.

    ;; communications error to 10.53.0.1#13093: timed out

    ; <<>> DiG 9.19.12-dev <<>> -p 13093 +tcp @10.53.0.1 edns512-notcp. TXT
    ; (1 server found)
    ;; global options: +cmd
    ;; Got answer:
    ;; ->>HEADER<<- opcode: QUERY, status: SERVFAIL, id: 5368
    ;; flags: qr rd ra; QUERY: 1, ANSWER: 0, AUTHORITY: 0, ADDITIONAL: 1

This retry is unnecessary because "resolution_fails()" considers timeout
a positive result.
2023-04-06 11:35:48 +02:00
Michal Nowak
a43519f7b8 Merge branch 'mnowak/looking-for-dig-errors-must-not-fail' into 'main'
Looking for errors in dig output files must not fail

See merge request isc-projects/bind9!7813
2023-04-06 09:03:31 +00:00
Michal Nowak
28a0df3081 Looking for errors in dig output files must not fail
If no errors in dig output files of failed tests are found, TSAN file
parsing won't occur.
2023-04-06 09:44:49 +02:00
Ondřej Surý
3f91819bd2 Merge branch '3999-histo-div-zero' into 'main'
Fix a division by zero bug in isc_histo

Closes #3999

See merge request isc-projects/bind9!7804
2023-04-05 21:29:50 +00:00
Tony Finch
3405b43fe9 Fix a division by zero bug in isc_histo
This can occur when calculating the standard deviation of an empty
histogram.
2023-04-05 23:29:21 +02:00
Evan Hunt
426eb4ffd2 Merge branch '3972-delv-coverity-fixes' into 'main'
address coverity warnings in delv

Closes #3972

See merge request isc-projects/bind9!7780
2023-04-05 20:19:16 +00:00
Evan Hunt
1850daaed8 address coverity warnings in delv
clean up coverity warnings due to recent changes to delv:
- CID 451097: failure to check return value from inet_pton()
- CID 451098, 451100: dead code
2023-04-05 11:19:22 -07:00
Tony Finch
99c07f53eb Merge branch '3998-incorrect-maxlabels' into 'main'
Correct value of DNS_NAME_MAXLABELS

Closes #3998

See merge request isc-projects/bind9!7803
2023-04-05 14:46:48 +00:00
Tony Finch
e8ff0f0c08 Correct value of DNS_NAME_MAXLABELS
It should be floor(DNS_NAME_MAXWIRE / 2) + 1 == 128

The mistake was introduced in c6bf51492d because:

  * I was refactoring an existing `DNS_MAX_LABELS` defined as 127

  * There was a longstanding bug in `dns_name_isvalid()` which
    checked the number of labels against 127U instead of 128

  * I mistakenly thought `dns_name_isvalid()` was correct and
    `dns_name_countlabels()` was incorrect, but the reverse was true.

After this commit, occurrances of `DNS_NAME_MAXLABELS` with value
128 are consistent with the use of 127 or 128 before commit
c6bf51492d except for the mistake in `dns_name_isvalid()`.
This commit adds a test case that checks the MAXLABELS case
in `dns_name_fromtext()` and `dns_name_isvalid()`.
2023-04-05 14:46:39 +00:00
Petr Špaček
3948827c0b Merge branch 'pspacek/log-roll-doc-nits' into 'main'
Log rotation doc improvements

See merge request isc-projects/bind9!7776
2023-04-05 14:02:47 +00:00
Petr Špaček
1dada31187 Remove erroneous cross-references to suffix statement
Logging section referenced to "suffix" statement definition for dns64.
2023-04-05 15:59:06 +02:00
Petr Špaček
2897a45644 Make rndc dnstap -roll docs easier to read 2023-04-05 15:58:28 +02:00
Tony Finch
edb497ce4f Merge branch 'fanf-qp-zt' into 'main'
Use a qp-trie for the zone table

See merge request isc-projects/bind9!7582
2023-04-05 12:02:38 +00:00
Tony Finch
b171cacf4f Use a qp-trie for the zone table
This change makes the zone table lock-free for reads. Previously, the
zone table used a red-black tree, which is not thread safe, so the hot
read path acquired both the per-view mutex and the per-zonetable
rwlock. (The double locking was to fix to cleanup races on shutdown.)

One visible difference is that zones are not necessarily shut down
promptly: it depends on when the qp-trie garbage collector cleans up
the zone table. The `catz` system test checks several times that zones
have been deleted; the test now checks for zones to be removed from
the server configuration, instead of being fully shut down. The catz
test does not churn through enough zones to trigger a gc, so the zones
are not fully detached until the server exits.

After this change, it is still possible to improve the way we handle
changes to the zone table, for instance, batching changes, or better
compaction heuristics.
2023-04-05 12:38:11 +01:00
Tony Finch
b3e35fd120 A few qp-trie cleanups
Revert refcount debug tracing (commit a8b29f0365), there are better
ways to do it.

Use the dns_qpmethods_t typedef where appropriate.

Some stylistic improvements.
2023-04-05 12:35:04 +01:00
Tony Finch
39f38754e2 Compact more in dns_qp_compact(DNS_QPGC_ALL)
Commit 0858514ae8 enriched dns_qp_compact() to give callers more
control over how thoroughly the trie should be compacted.

In the DNS_QPGC_ALL case, if the trie is small it might be compacted
to a new position in the same memory chunk. In this situation it will
still be holding references to old leaf objects which have been
removed from the trie but will not be completely detached until the
chunk containing the references is freed.

This change resets the qp-trie allocator to a fresh chunk before a
DNS_QPGC_ALL compaction, so all the old memory chunks will be
evacuated and old leaf objects can be detached sooner.
2023-04-05 12:35:04 +01:00