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

38684 Commits

Author SHA1 Message Date
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
2846888c573fcc610cdf71bcdd5bb6f92ffaf499 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
Evan Hunt
c277df8c1f add "delv +qmin"
add an option to enable or disable QNAME minimization in delv's
internal resolver.
2023-03-28 12:39:06 -07:00
Evan Hunt
152d25668e add "delv +strace"
"delv +strace" is similar to "delv +mtrace", but sets the logging
level to DEBUG(11) instead of DEBUG(10), so that packets sent
will be logged along with packets received. "delv +ns" turns
this option on by default.
2023-03-28 12:39:06 -07:00
Evan Hunt
32189f6a59 send delv +ns output to stdout
normally, the only output of delv that is sent to stdout is
the final answer to the query; all other output is sent to
stderr. this seems undesirable for delv +ns, which will
only be used to see the process of finding the answer. so,
for that case, we now send all the logging to stdout.
2023-03-28 12:39:06 -07:00
Evan Hunt
8ce33dca6a change the log level of "resolver priming query complete"
this log message, formerly at level INFO, is now DEBUG(1),
so it won't be printed when running "delv +ns +nortrace".
2023-03-28 12:39:06 -07:00
Evan Hunt
dbadc97387 on connect error, send the actual result to the caller
formerly if a connection failed in dns_request, the callback
function was called with ISC_R_CANCELED. change this to the
actual result code so the failure is correctly reported.
2023-03-28 12:39:05 -07:00
Evan Hunt
e90bb121a7 add explicit error for +trace argument
add a specific error message when someone tries to use
"delv +trace" suggesting "delv +ns" instead.
2023-03-28 12:39:05 -07:00
Evan Hunt
d541ddba66 add "delv +ns" command, for full internal resolution
"delv +ns" (name server mode) instantiates a full recursive resolver
inside delv and uses it to resolve the requested name and type, logging
every authoritative response received to iterative queries in the
process. this is intended to replace "dig +trace"; it much more
accurately duplicates the behavior of named when resolving a query
with a cold cache.
2023-03-28 12:39:05 -07:00
Evan Hunt
d91097e0c7 change ns__client_request() to ns_client_request()
in the future we'll want to call this function from outside named,
so change the name to one suitable for external access.
2023-03-28 12:38:28 -07:00
Evan Hunt
fe7ed2ba24 update stream sockets with bound address/port
when isc_nm_listenstreamdns() is called with a local port of 0,
a random port is chosen. call uv_getsockname() to determine what
the port is as soon as the socket is bound, and add a function
isc_nmsocket_getaddr() to retrieve it, so that the caller can
connect to the listening socket. this will be used in cases
where the same process is acting as both client and server.
2023-03-28 12:38:28 -07:00
Evan Hunt
4ad95e0567 add ns_interface_create()
add a public function ns_interface_create() allowing the caller
to set up a listening interface directly without having to set
up listen-on and scan network interfaces.
2023-03-28 12:38:28 -07:00
Evan Hunt
33a741f897 add dns_view_addtrustedkey()
the new dns_view_addtrustedkey() function allows a view's trust
anchors to be updated directly. this code was formerly in
dns_client_addtrustedkey(), which is now a wrapper around
dns_view_addtrustedkey().
2023-03-28 12:38:27 -07:00
Michal Nowak
2587fefbaa Merge branch 'mnowak/drop-unit-and-system-test-jobs' into 'main'
Drop tests on amd64cross32; move "unstable" unit and system jobs; drop Tumbleweed

See merge request isc-projects/bind9!7717
2023-03-28 14:33:38 +00:00