Commit Graph
38885 Commits
Author SHA1 Message Date
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 FinchandOndřej Surý 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
Tony Finch 44c80c4ae1 Support for off-loop read-ony qp-trie transactions
It is sometimes necessary to access a qp-trie outside an isc_loop,
such as in tests or an isc_work callback. The best option was to use
a `dns_qpmulti_write()` transaction, but that has overheads that are
not necessary for read-only access, such as committing a new version
of the trie even when nothing changed.

So this commit adds a `dns_qpmulti_read()` transaction, which is
nearly as lightweight as a query transaction, but it takes the mutex
like a write transaction.
2023-04-05 12:35:04 +01:00
Tony Finch fa1b57ee6e Support for finding the longest parent domain in a qp-trie
This is the first of the "fancy" searches that know how the DNS
namespace maps on to the structure of a qp-trie. For example, it will
find the closest enclosing zone in the zone tree.
2023-04-05 12:35:04 +01:00
Tony Finch 8a3a216f40 Support for iterating over the leaves in a qp-trie
The iterator object records a path through the trie, in a similar
manner to the existing dns_rbtnodechain.
2023-04-05 12:35:04 +01:00
Arаm Sаrgsyаn 45893249a6 Merge branch '3993-gcc-12-fanalyzer-claim-dereference-of-NULL' into 'main'
Resolve "GCC 12 static analyzer: error: dereference of NULL 'alginfo' in openssleddsa_link.c"

Closes #3993

See merge request isc-projects/bind9!7791
2023-04-05 08:04:05 +00:00
Aram Sargsyan 48c506c274 INSIST that openssleddsa_alg_info() is successful
In the check_algorithm() function openssleddsa_alg_info() is
called with two known variants of the 'algorithm' argument, and
both are expected to return a non-NULL value.

Add an INSIST to suppress the following GCC 12 analyzer report:

    openssleddsa_link.c: In function 'raw_key_to_ossl':
    openssleddsa_link.c:92:13: error: dereference of NULL 'alginfo' [CWE-476] [-Werror=analyzer-null-dereference]
       92 |         int pkey_type = alginfo->pkey_type;
          |             ^~~~~~~~~
2023-04-05 08:03:43 +00:00
Ondřej Surý 4d1a80aea1 Merge branch '3973-dnsrps-coverity-fixes' into 'main'
silence coverity warnings

Closes #3973

See merge request isc-projects/bind9!7781
2023-04-05 07:24:44 +00:00
Evan HuntandOndřej Surý 80e2a23f9e silence coverity warnings
silence coverity warnings in the DNSPRS code:
- CID 451097, failure to check return value of rpz_ready()
- CID 451099, resource leak
2023-04-05 09:23:51 +02:00
Michal Nowak 7e17ed410e Merge branch '3996-pairwise-skip-fips-mode' into 'main'
Revert "Enable FIPS testing in Pairwise"

See merge request isc-projects/bind9!7790
2023-04-05 07:22:36 +00:00
Michal Nowak a1bd31cbae Revert "Enable FIPS testing in Pairwise"
This reverts commit e987a0c249.

--enable-fips-mode ./configure option does not work on platforms without
FIPS-enabled OpenSSL.
2023-04-05 09:20:17 +02:00
Mark Andrews 8783cd97a8 Merge branch '3994-unnecessary-null-check' into 'main'
Resolve "Unnecessary NULL check"

Closes #3994

See merge request isc-projects/bind9!7783
2023-04-05 00:25:15 +00:00
Mark Andrews 8c5539e905 Remove 'inst != NULL' from cleanup check in plugin_register
'inst' is guarenteed to be non NULL at this point.

    358        *instp = inst;
    359
    360cleanup:

    CID 281450 (#2 of 2): Dereference before null check (REVERSE_INULL)
    check_after_deref: Null-checking inst suggests that it may be null, but it has already been dereferenced on all paths leading to the check.
    361        if (result != ISC_R_SUCCESS && inst != NULL) {
    362                plugin_destroy((void **)&inst);
    363        }
    364
    365        return (result);
2023-04-04 23:51:22 +00:00
Ondřej Surý d3190485b8 Merge branch 'ondrej/require-dnspyton-2.0.0-in-shutdown-system-test' into 'main'
Bump the requirement in the shutdown test to dnspython 2.0.0

See merge request isc-projects/bind9!7796
2023-04-04 19:58:31 +00:00
Ondřej Surý 54a3f09c8f Bump the requirement in the shutdown test to dnspython 2.0.0
The dnspython.Resolve.resolve() requires at least dnspython >= 2.0.0,
this wasn't enforced in the shutdown system test leading to infinite
loop waiting for the server start due to failing resolve() call.
2023-04-04 21:31:58 +02:00
Ondřej Surý 82b52f5d72 Merge branch 'ondrej/require-dnspyton-2.0.0-in-dnstap-system-test' into 'main'
Bump the requirement in dnstap test to dnspython 2.0.0

See merge request isc-projects/bind9!7793
2023-04-04 16:44:01 +00:00
Ondřej Surý e123b76b0e Bump the requirement in dnstap test to dnspython 2.0.0
The dnspython.Resolve.resolve() requires at least dnspython >= 2.0.0,
this wasn't enforced in the dnstap system test.
2023-04-04 17:21:07 +02:00
Ondřej Surý d897ad29db Merge branch 'ondrej/add-tests-for-rpz-in-multiple-views' into 'main'
Add test for RPZ in multiple views

See merge request isc-projects/bind9!7711
2023-04-04 14:27:24 +00:00
Ondřej Surý 1734d4a33e Squash both rpzextra tests into tests_rpzextra.py
We don't need a separate module/file for every test. Both the rpz tests
could live in the same file.

The setup/teardown of servers if performed separately for each module --
unless there is a need to do that, it's better to avoid it.
2023-04-04 16:23:13 +02:00
Tom KrizekandOndřej Surý 2ed26609b8 Use more concise syntax to check responses in rpzextra tests
All the answers are expected to have exactly one resource record. Check
it directly instead of iterating over all (possible) records.
2023-04-04 16:22:26 +02:00
Ondřej Surý 1649c768e9 Add test for RPZ in multiple views
This adds rudimentary test for response-policy zones in multiple
views.  Different combinations are tested:

- two views with response-policy inherited from options {};
- two views view explicit response-policy using same RPZ zone name
- two views view explicit response-policy using secondary RPZ zone
2023-04-04 16:22:26 +02:00
Ondřej Surý 3b1756d450 Replace dnspython resolver.query() with resolver.resolve()
The resolver.query() has been deprecated in favor of resolver.resolve();
used that.
2023-04-04 16:22:26 +02:00
Ondřej Surý ba1c9f1fd1 Merge branch 'ondrej/change-dns_adbentry_overquota-to-dns_adb_overquota' into 'main'
Change dns_adbentry_overquota() to dns_adb_overquota()

See merge request isc-projects/bind9!7758
2023-04-04 14:22:20 +00:00