2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-08-30 14:07:59 +00:00

39168 Commits

Author SHA1 Message Date
Mark Andrews
21d828241b
dns_view_untrust modifies dnskey->flags when it shouldn't
Copy the structure and declare dnskey as const.
2023-04-03 17:43:43 +02:00
Mark Andrews
b5df9b8591
Handle dns_rdata_fromstruct failure dns_keytable_deletekey
dns_rdata_fromstruct in dns_keytable_deletekey can potentially
fail with ISC_R_NOSPACE.  Handle the error condition.
2023-04-03 17:43:43 +02:00
Mark Andrews
e68fecbdaa
Reduce the number of verifiations required
In selfsigned_dnskey only call dns_dnssec_verify if the signature's
key id matches a revoked key, the trust is pending and the key
matches a trust anchor.  Previously named was calling dns_dnssec_verify
unconditionally resulted in busy work.
2023-04-03 17:43:43 +02:00
Mark Andrews
7278fff579
Add new view method dns_view_istrusted
dns_view_istrusted determines if the given key is treated as
being trusted by the view.
2023-04-03 17:43:40 +02:00
Arаm Sаrgsyаn
1cda61725c Merge branch '3674-nsupdate--t-timeout-does-not-work' into 'main'
Resolve "nsupdate -t timeout does not work"

Closes #3674

See merge request isc-projects/bind9!7279
2023-04-03 15:22:25 +00:00
Aram Sargsyan
98c8135692 nsupdate: set network manager default timeout values
The default values are currently set to 30 seconds, use nsupdate
default (or overriden using the -t option) timeout value instead.
2023-04-03 15:21:43 +00:00
Aram Sargsyan
ef81775e7b Add a CHANGES note for [GL #3674] 2023-04-03 15:21:43 +00:00
Aram Sargsyan
3ef2a30c75 nsupdate: use the configurable timeout and retry values for all queries
The 'nsupdate' tool, when sending SOA queries, uses a hard-coded value
3 UDP retries and of 5 seconds of timeout for UDP queries, and 100
seconds of timeout for TCP queries.

Use the timeout and retry values which can be configured using the
-t, -u, -r command line options, and which are already used for
sending the update query.
2023-04-03 15:21:43 +00:00
Aram Sargsyan
a00540ac24 Update nsupdate -t option's documentation
Add some clarifications about the -t option's behavior differences
in TCP and UDP modes.
2023-04-03 15:21:43 +00:00
Aram Sargsyan
edcdb881da Do not resend TCP requests
The req_response() function is using 'udpcount' variable to resend
the request 'udpcount' times on timeout even for TCP requests,
which does not make sense, as it would use the same connection.

Add a condition to use the resend logic only for UDP requests.
2023-04-03 15:21:43 +00:00
Aram Sargsyan
5b37359697 Perform request validation in req_response() before using the pointer
The 'request' pointer is used before it is checked. Perform the check
before using the pointer.
2023-04-03 15:21:43 +00:00
Aram Sargsyan
643abfbba7 Synchronize dns_request_createraw() and dns_request_create() UDP timeout
The dns_request_createraw() function, unlike dns_request_create(), when
calculating the UDP timeout value, doesn't check that 'udpretries' is
not zero, and that is the more logical behavior, because the calculation
formula uses division to 'udpretries + 1', where '1' is the first try.

Change the dns_request_create() function to remove the 'udpretries != 0'
condition.

Add a 'REQUIRE(udpretries != UINT_MAX)' check to protect from a division
by zero.

Make the 'request->udpcount' field to represent the number of tries,
instead of the number of retries.
2023-04-03 15:21:43 +00:00
Aram Sargsyan
0ef11c0ccb nsupdate: when set to 0, UDP timeout should be calculated by dns_request
The manual page of nsupdate's '-u udptimeout' option states that, quote:

> If zero, the interval is computed from the timeout interval and number
> of UDP retries.

However, nsupdate sets the UDP timeout value to UINT_MAX when it is 0,
thus, not behaving as documented.

Let dns_request_create() calculate the UDP timeout, if it was set to 0.
2023-04-03 15:21:43 +00:00
Aram Sargsyan
5ce2ed0688 Add nsupdate timeout tests
* nsupdate should take 12 seconds (one try and three retries with
  3 second timeout for each), UDP mode
* nsupdate -u 4 -r 1 should take 8 seconds (one try and one retry with
  4 second timeout for each), UDP mode
* nsupdate -u 0 -t 8 -r 1 should also take 8 seconds, UDP mode
* nsupdate -u 4 -t 30 -r 1 should also take 8 seconds, as -u takes
  precedence over -t, UDP mode
* nsupdate -t 8 -v should also take 8 seconds, TCP mode
2023-04-03 15:21:43 +00:00
Tony Finch
9211495ac9 Merge branch '3910-coverity-qp-tests' into 'main'
Fix Coverity complaints in the qp-trie tests

Closes #3910

See merge request isc-projects/bind9!7630
2023-04-03 15:11:03 +00:00
Tony Finch
3c333d02a0 More dns_qpkey_t safety checks
My original idea had been that the core qp-trie code would be mostly
independent of the storage for keys, so I did not make it check at run
time that key lengths are sensible. However, the qp-trie search
routines need to get keys out of leaf objects, for which they provide
storage on the stack, which is particularly dangerous for unchecked
buffer overflows. So this change checks that key lengths are in bounds
at the API boundary between the qp-trie code and the rest of BIND, and
there is no more pretence that keys might be longer.
2023-04-03 15:10:47 +00:00
Tony Finch
906d434aea Fix Coverity complaints in the qp-trie tests
The main problem was `qp_test_keytoname()` not using `qpkey_bit()`
to do bounds checking.
2023-04-03 15:10:47 +00:00
Petr Špaček
4f03804dc6 Merge branch 'bug/main/rndc-dnstap-roll' into 'main'
Document that rndc dnstap -roll number is optional

See merge request isc-projects/bind9!7755
2023-04-03 14:43:55 +00:00
Petr Menšík
0627214568 Make it obvious -roll number is optional
Manual page were updated to indicate it, but rndc -h still displays it
as required parameter. Make it look like optional.
2023-04-03 14:42:56 +00:00
Matthijs Mekking
804f1b07d5 Merge branch '3901-parental-agents-auto' into 'main'
Automatic parental-agents (checkds yes)

Closes #3901

See merge request isc-projects/bind9!7742
2023-04-03 14:01:35 +00:00
Matthijs Mekking
3551afe361 Make checkds system test more resilient
The checkds system test could fail if some parent secondary servers did
not yet loaded all the zones before ns9 started sending DS queries. This
leads to SERVFAIL responses, while the test case expects good DS
responses. In order to mitigate against this issue, call 'rndc loadkeys'
to quickly restart the checkds procedure again.

Also refactor the checkds system test, to get rid of the many zone
name duplications. Update the functions 'zone_check' and
'keystate_check' to make the zone name an FQDN so we can just pass
the 'zone' variable into the function.
2023-04-03 14:01:22 +00:00
Matthijs Mekking
03f9e40d1b Determine checkds default from config
If the 'checkds' option is not explicitly set, check if there are
'parental-agents' for the zone configured. If so, default to "explicit",
otherwise default to "yes".
2023-04-03 14:01:22 +00:00
Matthijs Mekking
92577eaf7e Make checkds yes the default
This seems to be the more common case.
2023-04-03 14:01:22 +00:00
Matthijs Mekking
47f7cb0a36 Add two checkds test servers
Add two new checkds test servers, that are hidden secondaries (hidden
as in not published in the NS RRset), that can be used specifically
for testing explicitly configured parental-agents.
2023-04-03 14:01:22 +00:00
Matthijs Mekking
a921cabb8c Remove obsoleted checkds test name servers
These resolver based parental-agents have been replaced by ns3.
2023-04-03 14:01:22 +00:00
Matthijs Mekking
148ce1f678 Add CHANGES and release notes for #3901
This is a new feature that deserves attention.
2023-04-03 14:01:22 +00:00
Matthijs Mekking
e72b0df50b Implement auto parental-agents (checkds yes)
Implement the new feature, automatic parental-agents. This is enabled
with 'checkds yes'.

When set to 'yes', instead of querying the explicit configured
parental agents, look up the parental agents by resolving the parent
NS records. The found parent NS RRset is considered to be the list
of parental agents that should be queried during a KSK rollover,
looking up the DS RRset corresponding to the key signing keys.

For each NS record, look up the addresses in the ADB. These addresses
will be used to send the DS requests. Count the number of servers and
keep track of how many good DS responses were seen.
2023-04-03 14:01:22 +00:00
Matthijs Mekking
dc651cbf3f Add test case with no empty non-terminals
The previous test cases already test the more complex case where there
are empty non-terminals between the child apex and the parent domain.

Add a test case where this is not the case, to execute the other code
path.
2023-04-03 14:01:22 +00:00
Matthijs Mekking
a2735810d9 Add test cases for 'checkds no'
Add test cases for when checkds is disabled. Copy the test cases that
would have resulted in a DSPublish or DSRemoved and make sure that
with 'checkds no' the metadata is not set.
2023-04-03 14:01:22 +00:00
Matthijs Mekking
6bb862d10f Add test cases for 'checkds yes'
Add the test cases for automatic parental-agents, i.e. when 'checkds'
is set to 'yes'. Split out the special cases that use a reference
or a resolver as parental-agent so that the common use cases can be
tested with the same function.
2023-04-03 14:01:22 +00:00
Matthijs Mekking
226b6e385e Update checkds system test
Make the checkds system test more structured with the many more test
cases to come. Add a README for clarity.

Update the 'has_signed_apex_nsec' helper function so it can take any
domain name regardless of the number of labels.

Change the DNS tree structure such that we have different TLD names
for the various test scenarios, because we need servers that respond
differently to DS queries. Note that this isn't applicable to the
existing "checkds explicit" test cases, but is preparation work for
testing "checkds yes" (automatic parental agents).

Add a trust-anchor to the server that will be querying for parent
NS records.
2023-04-03 14:01:22 +00:00
Matthijs Mekking
d842adb23f Update documenation for 'checkds' option
Add text about the 'checkds' option in the ARM reference and
DNSSEC guide.
2023-04-03 14:01:22 +00:00
Matthijs Mekking
06cd8b52db Add new 'checkds' configuration option
Add a new configuration option to set how the checkds method should
work. Acceptable values are 'yes', 'no', and 'explicit'.

When set to 'yes', the checkds method is to lookup the parental agents
by querying the NS records of the parent zone.

When set to 'no', no checkds method is enabled. Users should run
the 'rndc checkds' command to signal that DS records are published and
withdrawn.

When set to 'explicit', the parental agents are explicitly configured
with the 'parental-agents' configuration option.
2023-04-03 14:01:22 +00:00
Ondřej Surý
7d0b88ebb0 Merge branch '3930-gcc-12-static-analyzer-warning-dereference-of-null-in-in-siphash-c' into 'main'
Resolve "GCC 12 static analyzer: warning: dereference of NULL 'in' in siphash.c"

Closes #3930

See merge request isc-projects/bind9!7656
2023-04-03 13:32:53 +00:00
Mark Andrews
bf58c10dce Silence NULL pointer dereferene false positive
Only attempt to digest 'in' if it is non NULL.  This will prevent
false positives about NULL pointer dereferences against 'in' and
should also speed up the processing.
2023-04-03 13:32:40 +00:00
Ondřej Surý
94e42daa0f Merge branch '3974-rpz-testlib-test-data-c-compilation-fails-on-openbsd' into 'main'
Resolve "rpz/testlib/test-data.c compilation fails on OpenBSD"

Closes #3974

See merge request isc-projects/bind9!7748
2023-04-03 13:32:32 +00:00
Mark Andrews
da999a7a1b Define and use DLOPEN_LIBS 2023-04-03 13:31:56 +00:00
Mark Andrews
30b9ebfa2c Handle old <arpa/nameser.h> with old API
Define the types and classes we use from the new API.
2023-04-03 13:31:56 +00:00
Ondřej Surý
8c475a1d31 Merge branch 'artem-streamdns-avoid-copying-on-reading' into 'main'
Stream DNS: try to handle incoming data directly - avoid memory copying/buffer resizing when reading data

See merge request isc-projects/bind9!7280
2023-04-03 13:31:51 +00:00
Artem Boldariev
2b3a3c21dc Stream DNS: avoid memory copying/buffer resizing when reading data
This commit optimises isc_dnsstream_assembler_t in such a way that
memory copying and reallocation are avoided when receiving one or more
complete DNS messages at once. We try to handle the data from the
messages directly, without storing them in an intermediate memory
buffer.
2023-04-03 13:31:46 +00:00
Ondřej Surý
33a0588113 Merge branch '3990-remove-dead-code-from-dst_api' into 'main'
Eliminate the dead code in dst_api.c

Closes #3990

See merge request isc-projects/bind9!7773
2023-04-03 13:29:52 +00:00
Ondřej Surý
766366e934
Eliminate the dead code in dst_api.c
In write_public_key() and write_key_state(), there were left-over checks
for result, that were effectively dead code after the last refactoring.
Remove those.
2023-04-03 14:09:13 +02:00
Tony Finch
c74f389100 Merge branch 'fanf-histo' into 'main'
Add isc_histo histograms, and use it for message size statistics

Closes #3464

See merge request isc-projects/bind9!7696
2023-04-03 11:41:25 +00:00
Tony Finch
fdcbbc2a20 CHANGES note for [GL !7696]
[func]		Add isc_histo_t general-purpose log-linear histograms,
		and use them for message size statistics.
2023-04-03 12:08:37 +01:00
Tony Finch
0d353704fb Use isc_histo for the message size statistics
This should have no functional effects.

The message size stats are specified by RSSAC002 so it's best not
to mess around with how they appear in the statschannel. But it's
worth changing the implementation to use general-purpose histograms,
to reduce code size and benefit from sharded counters.
2023-04-03 12:08:05 +01:00
Tony Finch
2354e56ebb Remove obsolete code from dns_stats
It became obsolete in 2008
2023-04-03 12:08:05 +01:00
Tony Finch
cd0e7f853a Simplify histogram quantiles
The `isc_histosummary_t` functions were written in the early days of
`hg64` and carried over when I brought `hg64` into BIND. They were
intended to be useful for graphing cumulative frequency distributions
and the like, but in practice whatever draws charts is better off with
a raw histogram export. Especially because of the poor performance of
the old functions.

The replacement `isc_histo_quantiles()` function is intended for
providing a few quantile values in BIND's stats channel, when the user
does not want the full histogram. Unlike the old functions, the caller
provides all the query fractions up-front, so that the values can be
found in a single scan instead of a scan per value. The scan is from
larger values to smaller, since larger quantiles are usually more
interesting, so the scan can bail out early.
2023-04-03 12:08:05 +01:00
Tony Finch
bc2389b828 Add per-thread sharded histograms for heavy loads
Although an `isc_histo_t` is thread-safe, it can suffer
from cache contention under heavy load. To avoid this,
an `isc_histomulti_t` contains a histogram per thread,
so updates are local and low-contention.
2023-04-03 12:08:05 +01:00
Tony Finch
82213a48cf Add isc_histo for histogram statistics
This is an adaptation of my `hg64` experiments for use in BIND.

As well as renaming everything according to ISC style, I have
written some more extensive tests that ensure the edge cases are
correct and the fenceposts are in the right places.

I have added utility functions for working with precision in terms of
decimal significant figures as well as this code's native binary.
2023-04-03 12:08:05 +01:00
Ondřej Surý
4c7e773a31 Merge branch '3710-properly-document-DF-flag-on-outbound-UDP' into 'main'
Clarify the documentation about DF-flag

Closes #3710

See merge request isc-projects/bind9!7770
2023-04-03 10:28:47 +00:00