Commit graph

38696 commits

Author SHA1 Message Date
Ondřej Surý
d664e3c612 Merge branch 'ondrej/squash-dns_name_fullhash-and-dns_name_hash' into 'main'
Squash dns_name_fullhash() and dns_name_hash()

See merge request isc-projects/bind9!7759
2023-03-31 12:43:50 +00:00
Ondřej Surý
956155f613 Squash dns_name_fullhash() and dns_name_hash()
The only place where dns_name_hash() was being used is the old hash
table in the dns_badcache unit.  Squash the dns_name_fullhash() and
dns_name_hash() into single dns_name_hash() function that's always
case-insensitive as it doesn't make to do case-sensitive hashing of the
domain names and we were not using this anywhere.
2023-03-31 12:43:30 +00:00
Ondřej Surý
1ca0fb0e02 Merge branch 'ondrej/add-isc_stdtime_now' into 'main'
Provide isc_stdtime_now(void) that returns value

See merge request isc-projects/bind9!7757
2023-03-31 11:58:13 +00:00
Ondřej Surý
a568a3d52a
Add CHANGES note for [GL !7757] 2023-03-31 13:33:18 +02:00
Ondřej Surý
4bd6096d4b
Remove isc_stdtime_get() macro
Now that isc_stdtime_get() macro is unused, remove it from the header
file.
2023-03-31 13:33:16 +02:00
Ondřej Surý
46f06c1d6e
Apply the semantic patch to remove isc_stdtime_get()
This is a simple replacement using the semantic patch from the previous
commit and as added bonus, one removal of previously undetected unused
variable in named/server.c.
2023-03-31 13:32:56 +02:00
Ondřej Surý
0ec8d7b6f3
Add a semantic patch to change isc_stdtime_get() to isc_stdtime_now
Add a simple semantic patch to rewrite all uses of isc_stdtime_get(&t)
to simpler t = isc_stdtime_now().
2023-03-31 13:16:28 +02:00
Ondřej Surý
c11af0448a
Provide isc_stdtime_now(void) that returns value
As isc_stdtime_get() cannot fail, the API seems to be too complicated,
add new isc_stdtime_now() that returns the unixtime as a return value.
2023-03-31 13:16:28 +02:00
Tony Finch
3e106b3a8f Merge branch '3970-dighost-signal-crash' into 'main'
Fix a crash when dig or host receive a signal

Closes #3970

See merge request isc-projects/bind9!7756
2023-03-31 09:54:05 +00:00
Tony Finch
194621a74e Fix a crash when dig or host receive a signal
When the loopmanager is shutting down following a signal,
`dig` and `host` should stop cleanly. Before this commit
they were oblivious to ISC_R_SHUTTINGDOWN.

The `isc_signal` callbacks now report this kind of mistake
with a stack backtrace.
2023-03-31 09:52:54 +00:00
Matthijs Mekking
aacd05be4b Merge branch 'matthijs-checkconf-kasp-test-bug' into 'main'
Fix kasp system test bug

See merge request isc-projects/bind9!7750
2023-03-31 08:33:24 +00:00
Matthijs Mekking
106497b011 Fix kasp system test bug
This test was succeeding for the wrong reason (policy not found, rather
than bad key length).
2023-03-31 08:33:01 +00:00
Ondřej Surý
aa760f997d Merge branch 'ondrej/add-maybe_unused-attribute-macro' into 'main'
Replace __attribute__((unused)) with ISC_ATTR_UNUSED attribute macro

See merge request isc-projects/bind9!7345
2023-03-30 22:16:49 +00:00
Ondřej Surý
2c0a9575d7
Replace __attribute__((unused)) with ISC_ATTR_UNUSED attribute macro
Instead of marking the unused entities with UNUSED(x) macro in the
function body, use a `ISC_ATTR_UNUSED` attribute macro that expans to
C23 [[maybe_unused]] or __attribute__((__unused__)) as fallback.
2023-03-30 23:29:25 +02:00
Ondřej Surý
1176bf0552
Use C23 attributes if available, add ISC_ATTR_UNUSED
Use C23 attribute styles if available:

  * Add new ISC_ATTR_UNUSED attribute macro that either expands to C23's
    [[maybe_unused]] or __attribute__((__unused__));

  * Add default expansion of the `noreturn` to [[noreturn]] if available;

  * Move the FALLTHROUGH from <isc/util.h> to <isc/attributes.h>
2023-03-30 22:43:39 +02:00
Michal Nowak
0086dcd4da Merge branch 'mnowak/replace-enable_dnsprs_dl-with-enable_dnsrps_dl' into 'main'
Replace enable_dnsprs_dl with enable_dnsrps_dl

See merge request isc-projects/bind9!7745
2023-03-30 17:51:42 +00:00
Michal Nowak
1dcfe6bfbd
Replace enable_dnsprs_dl with enable_dnsrps_dl
"enable_dnsprs_dl" is a typo where "enable_dnsrps_dl" was intended.
2023-03-30 19:44:34 +02:00
Artem Boldariev
f3579b1760 Merge branch 'artem-tlsstream-followup-to-2846888c573fcc610cdf71bcdd5bb6f92ffaf499' into 'main'
TLS Stream: remove incorrect/obsolete INSIST()s from tls_do_bio()

See merge request isc-projects/bind9!7751
2023-03-30 16:41:05 +00:00
Artem Boldariev
43e21d653f TLS Stream: remove incorrect/obsolete INSIST()s from tls_do_bio()
With the changes to tls_try_handshake() made in
2846888c57 there are some incorrect
INSISTS() related to handshake handling which better to be removed.
2023-03-30 18:21:50 +03:00
Ondřej Surý
696b2c8c89 Merge branch 'ondrej/reduce-atomic-use-in-netmgr' into 'main'
Refactor the use of atomics in netmgr

See merge request isc-projects/bind9!7724
2023-03-30 14:26:38 +00:00
Ondřej Surý
2846888c57
Attach the accept "client" socket to .listener member of the socket
When accepting a TCP connection in the higher layers (tlsstream,
streamdns, and http) attach to the socket the connection was accepted
on, and use this socket instead of the parent listening socket.

This has an advantage - accessing the sock->listener now doesn't break
the thread boundaries, so we can properly check whether the socket is
being closed without requiring .closing member to be atomic_bool.
2023-03-30 16:10:08 +02:00
Ondřej Surý
45365adb32
Convert sock->active to non-atomic variable, cleanup rchildren
The last atomic_bool variable sock->active was converted to non-atomic
bool by properly handling the listening socket case where we were
checking parent socket instead of children sockets.

This is no longer necessary as we properly set the .active to false on
the children sockets.

Additionally, cleanup the .rchildren - the atomic variable was used for
mutex+condition to block until all children were listening, but that's
now being handled by a barrier.

Finally, just remove dead .self and .active_child_connections members of
the netmgr socket.
2023-03-30 16:10:08 +02:00
Ondřej Surý
e1a4572fd6
Refactor the use of atomics in netmgr
Now that everything runs on their own loop and we don't cross the thread
boundaries (with few exceptions), most of the atomic_bool variables used
to track the socket state have been unatomicized because they are always
accessed from the matching thread.

The remaining few have been relaxed: a) the sock->active is now using
acquire/release memory ordering; b) the various global limits are now
using relaxed memory ordering - we don't really care about the
synchronization for those.
2023-03-30 16:10:08 +02:00
Ondřej Surý
ea8e00e7a5 Merge branch '3961-add-fast-isc_loop_run' into 'main'
Refactor isc_job_run to not-make any allocations

Closes #3961

See merge request isc-projects/bind9!7722
2023-03-30 14:09:50 +00:00
Ondřej Surý
5d64306b72
Add CHANGES for [GL #3961] 2023-03-30 16:07:41 +02:00
Ondřej Surý
f5fc224af3
Add isc_async_current() macro to run job on current loop
Previously, isc_job_run() could have been used to run the job on the
current loop and the isc_job_run() would take care of allocating and
deallocating the job.  After the change in this MR, the isc_job_run()
is more complicated to use, so we introduce the isc_async_current()
macro to suplement isc_async_run() when we need to run the job on the
current loop.
2023-03-30 16:07:41 +02:00
Ondřej Surý
1844590ad9
Refactor isc_job_run to not-make any allocations
Change the isc_job_run() to not-make any allocations.  The caller must
make sure that it allocates isc_job_t - usually as part of the argument
passed to the callback.

For simple jobs, using isc_async_run() is advised as it allocates its
own separate isc_job_t.
2023-03-30 16:00:52 +02:00
Ondřej Surý
639d5065a3
Refactor the isc__nm_uvreq_t to have idle callback
Change the isc__nm_uvreq_t to have the idle callback as a separate
member as we always need to use it to properly close the uvreq.

Slightly refactor uvreq_put and uvreq_get to remove the unneeded
arguments - in uvreq_get(), we always use sock->worker, and in
uvreq_put, we always use req->sock, so there's not reason to pass those
extra arguments.
2023-03-29 21:16:44 +02:00
Ondřej Surý
476198f26c
Use uv_idle API for calling asynchronous connect/read/send callback
Instead of using isc_job_run() that's quite heavy as it allocates memory
for every new job, add uv_idle_t to uvreq union, and use uv_idle API
directly to execute the connect/read/send callback without any
additional allocations.
2023-03-29 21:16:44 +02:00
Ondřej Surý
670df3da74
Re-add the comment to streamdns_readmore()
Put the comment back, so it's more obvious that we are only restarting
timer when there's a last handle attached to the socket; there has to be
always at least one.
2023-03-29 21:16:44 +02:00
Matthijs Mekking
e0dc92b6ec Merge branch '3967-linkfix-dnssec-guide' into 'main'
Remove dead link to resolver test

Closes #3967

See merge request isc-projects/bind9!7737
2023-03-29 13:28:57 +00:00
Matthijs Mekking
5a879028fe Add CHANGES for #3967 2023-03-29 15:28:29 +02:00
Matthijs Mekking
8e78f8fc0f Remove dead link to resolver test
The doc file doc/dnssec-guide/validation.rst points to a resolver test
site that is now down. Remove the dead link.
2023-03-29 15:28:10 +02:00
Tony Finch
1365edaf0c Merge branch 'fanf-backtrace-log' into 'main'
Ad-hoc backtrace logging with isc_backtrace_log()

See merge request isc-projects/bind9!7743
2023-03-29 11:13:32 +00:00
Tony Finch
295e7c80e8 Ad-hoc backtrace logging with isc_backtrace_log()
It's sometimes helpful to get a quick idea of the call stack when
debugging. This change factors out the backtrace logging from named's
fatal error handler so that it's easy to use in other places too.
2023-03-29 10:47:53 +00:00
Ondřej Surý
cc8b9c1ff1 Merge branch 'ondrej/fix-isc_nm_httpconnect-to-check-for-shuttingdown' into 'main'
Fix isc_nm_httpconnect to check for shuttindown condition

See merge request isc-projects/bind9!7736
2023-03-29 05:50:01 +00:00
Ondřej Surý
665f8bb78d Fix isc_nm_httpconnect to check for shuttindown condition
The isc_nm_httpconnect() would succeed even if the netmgr would be
already shuttingdown.  This has been fixed and the unit test has been
updated to cope with fact that the handle would be NULL when
isc_nm_httpconnect() returns with an error.
2023-03-29 05:49:57 +00:00
Mark Andrews
9317aa9608 Merge branch '3926-dns_qp-fuzz-test-is-failing-to-build-under-clusterfuzz' into 'main'
Remove unnecessary conditionals in fuzz/Makefile.am

Closes #3926

See merge request isc-projects/bind9!7649
2023-03-29 03:20:03 +00:00
Mark Andrews
64c0065986 Build libtest even if CMOCKA is not available
Be more selective about what is not built when CMOCKA is not available
so that fuzz/dns_qp and fuzz/dns_qpkey_name can link against it.
2023-03-29 02:29:18 +00:00
Evan Hunt
eeba1b8793 Merge branch 'each-dnsrps-testlib' into 'main'
use a test library for DNSRPS

See merge request isc-projects/bind9!7693
2023-03-29 02:03:17 +00:00
Evan Hunt
a83358c6aa CHANGES for [GL !7693] 2023-03-28 18:41:17 -07:00
Evan Hunt
b573d4abf8 add --enable-dnsrps to gitlab CI
enable DNSRPS in the continuous integration tests

this triggered a build failure in OpenBSD; building with DNSRPS
causes arpa/nameser.h to be included, which defines the value
STATUS. that value was then reused in server.c  renaming the
value to STAT corrects the error.
2023-03-28 18:41:17 -07:00
Evan Hunt
f43de96460 update the rpz tests to use the dummyrpz library
when testing the DNSRPS API, instead of linking to an installed
librpz.so from fastrpz, we now link to the test library. code that
ran dnsrpzd and checked the fastrpz license is now unnecessary and
has been removed.

two dnsrps-specific test cases in rpz (qname_as_ns and ip_as_ns) have
been removed, because they were only supported by fastrpz and do not
work in the test library. in rpzrecurse, nsip-wait-recurse and
nsdname-wait-recurse are now only tested in native mode, due to those
tests being specific to the native implementation.
2023-03-28 18:41:17 -07:00
Mark Andrews
b8b6b10ad2 clean up library
address style issues, unfreed memory, etc.
2023-03-28 18:41:17 -07:00
Evan Hunt
bed8f85ff2 import libdummyrpz test library for DNSRPS
libdummyrpz is a limited version of the fastrpz library for use in
testing the dnsrps API.
2023-03-28 15:44:31 -07:00
Evan Hunt
f2855cb664 allow configuration of dnsrps library path
for testing purposes, we need to be able to specify a library path from
which to load the dnsrps implementation. this can now be done with the
"dnsrps-library" option.

DNSRPS can now be enabled in configure regardless of whether librpz.so
is currently installed on the system.
2023-03-28 15:44:31 -07:00
Evan Hunt
bd7f85c7e1 Merge branch '3842-delv-ns' into 'main'
implement "delv +ns"

Closes #3842

See merge request isc-projects/bind9!7477
2023-03-28 20:08:34 +00:00
Evan Hunt
155f6a2996 CHANGES and release note for [GL #3842] 2023-03-28 12:41:32 -07:00
Evan Hunt
8806abcaaa test "delv +ns"
add tests for "delv +ns", with and without +qmin and with and without
validation.
2023-03-28 12:41:32 -07:00
Evan Hunt
15fd74f466 add "delv +hint"
Add the ablity to specify a hints file from which to load root
name server addresses, so that "delv +ns" can be used with test
name servers.
2023-03-28 12:39:06 -07:00