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

37503 Commits

Author SHA1 Message Date
Petr Špaček
53b3ceacd4 Replace #define DNS_NAMEATTR_ with struct of bools
sizeof(dns_name_t) did not change but the boolean attributes are now
separated as one-bit structure members. This allows debuggers to
pretty-print dns_name_t attributes without any special hacks, plus we
got rid of manual bit manipulation code.
2022-10-13 17:04:02 +02:00
Petr Špaček
8a3aa8bda4 Fix latent bug in RBT node attributes handling
Originally RBT node stored three lowest bits from dns_name_t attributes.
This had a curious side-effect noticed by Tony Finch:

If you create an rbt node from a DYNAMIC name then the flag will be
propagated through dns_rbt_namefromnode() ... if you subsequently call
dns_name_free() it will try to isc_mem_put() a piece of an rbt node ...
but dns_name_free() REQUIRE()s that the name is dynamic so in the usual
case where rbt nodes are created from non-dynamic names, this kind of
code will fail an assertion.

This is a bug it dates back to june 1999 when NAMEATTR_DYNAMIC was
invented.

Apparently it does not happen often :-)
I'm planning to get rid of DNS_NAMEATTR_ definitions and bit operations,
so removal of this "three-bit-subset" assignment is a first step.

We can keep only the ABSOLUTE flag in RBT node and nothing else because
names attached to rbt nodes are always readonly: The internal node_name()
function always sets the NAMEATTR_READONLY when making a dns_name that
refers to the node's name, so the READONLY flag will be set in the name
returned by dns_rbt_namefromnode().

Co-authored-by: Tony Finch <fanf@isc.org>
2022-10-13 13:08:28 +02:00
Ondřej Surý
dbc1166704 Merge branch 'artem-doth-reduce-listener-sockets-number' into 'main'
doth system test fixes - decrese the size of HTTP listener quota, increase transfer-in/out limits

Closes #3596

See merge request isc-projects/bind9!6898
2022-10-13 05:37:48 +00:00
Artem Boldariev
95a551de7b doth system test: increase transfers-in/out limits
Sometimes doth test could intermittently fail shortly after start due
to inability to complete a zone transfer in time. As it turned out, it
could happen due to transfers-in/out limits. Initially the defaults
were fine, but over time, especially when adding Strict/Mutual TLS, we
added more than 10 zones so it became possible to hit the limits.

This commit takes care of that by bumping the limits.
2022-10-12 21:52:52 +03:00
Artem Boldariev
354494cd10 doth system test - decrease HTTP listener quota size
This commit reduces the size of HTTP listener quota from 300 (default)
to 100 so that it would make hitting any global limits in case of
running multiple tests in parallel in multiple containers unlikely.

This way the need in opening many file descriptors of different
kinds (e.g. client side connections and pipes) gets significantly
reduced while the required code paths are still verified.
2022-10-12 21:46:39 +03:00
Ondřej Surý
2de8a8e8c7 Merge branch 'ondrej-restore-connrefused-for-udp_test' into 'main'
Restore ignoring ISC_R_CONNREFUSED in connect_read_cb

See merge request isc-projects/bind9!6899
2022-10-12 17:24:24 +00:00
Ondřej Surý
ed37949d5f Restore ignoring ISC_R_CONNREFUSED in connect_read_cb
In ac4cc8443d, the ISC_R_CONNREFUSED was
removed in connect_read_cb, but it can actually happen in the udp_test:

    [ RUN      ] udp_recv_send
    connect_read_cb(0x7f2c2801a270, connection refused, (nil))
2022-10-12 19:21:42 +02:00
Ondřej Surý
07a9bf4a88 Merge branch '3595-dont-set-so_reuseport-on-outgoing-udp-sockets' into 'main'
The UDP connect socket should not set REUSEPORT_LB

See merge request isc-projects/bind9!6888
2022-10-12 13:38:41 +00:00
Ondřej Surý
8bddd8d357 Merge branch '3595-retry-on-timeout-in-udp_recv_one-and_udp_recv_two-unit-test' into 'main'
Retry on timeout in the UDP recv_one, udp_recv_two and double_read tests

See merge request isc-projects/bind9!6894
2022-10-12 13:36:31 +00:00
Ondřej Surý
076cdf7444 Gracefully handle ISC_R_SHUTTINGDOWN in udp__send_cb
The ISC_R_SHUTTINGDOWN should be handled the same as ISC_R_CANCELED in
the udp__send_cb(), as we might be sending the data while the
loopmgr/netmgr shutdown has been initiated.
2022-10-12 15:36:25 +02:00
Ondřej Surý
af257140e6 Make sure the unit test listening and connecting ports are different
In rare circumstances, the UDP port for the listening socket and the UDP
port for the connecting socket might be the same.  Because we use the
"reuse" port socket option, this isn't caught when binding the socket,
and thus the connected client socket could send a datagram to itself,
completely bypassing the server.  This doesn't happen under normal
operation mode because `named` is listening on a privileged port (53),
and even if not, it doesn't usually talk to itself as the tests do.

Pick an arbitrary port for listening (9153-9156) that is outside the
ephemeral port range for the network manager related unit tests (except
the `doh_test).
2022-10-12 15:36:25 +02:00
Ondřej Surý
b6b7a6886a Don't set load-balancing socket option on the UDP connect sockets
The isc_nm_udpconnect() erroneously set the reuse port with
load-balancing on the outgoing connected UDP sockets.  This socket
option makes only sense for the listening sockets.  Don't set the
load-balancing reuse port option on the outgoing UDP sockets.
2022-10-12 15:36:25 +02:00
Ondřej Surý
d7cfb7c792 Retry on timeout in the UDP recv_one, recv_two and double_read tests
Since we are testing UDP on the localhost and the same interface, the
UDP datagrams can't get lost.  Change the connect read callback, so it
starts reading again on the timeout instead of just getting stuck, and
fail when any other result codes than ISC_R_SUCCESS and ISC_R_TIMEDOUT
are received because we don't expect them to happen in these simple
tests.
2022-10-12 15:33:58 +02:00
Ondřej Surý
946cf3396f Merge branch 'artem-clear-ssl-error-queue-for-dns-transports' into 'main'
TLS: clear error queue before doing I/O or calling SSL_get_error()

See merge request isc-projects/bind9!6892
2022-10-12 13:33:38 +00:00
Artem Boldariev
070d373c56 DoH unit test: remove broken remnants of slowdown logic
This commit removes broken remnants of unit test slowdown logic, which
caused unit test hangs on platforms susceptible to "too many open
files" error, notably OpenBSD.
2022-10-12 16:24:04 +03:00
Artem Boldariev
eaebb92f3e TLS DNS: fix certificate verification error message reporting
This commit fixes TLS DNS verification error message reporting which
we probably broke during one of the recent networking code
refactorings.

This prevent e.g. dig from producing useful error messages related to
TLS certificates verification.
2022-10-12 16:24:04 +03:00
Artem Boldariev
6789b88d25 TLS: clear error queue before doing IO or calling SSL_get_error()
Ensure that TLS error is empty before calling SSL_get_error() or doing
SSL I/O so that the result will not get affected by prior error
statuses.

In particular, the improper error handling led to intermittent unit
test failure and, thus, could be responsible for some of the system
test failures and other intermittent TLS-related issues.

See here for more details:

https://www.openssl.org/docs/man3.0/man3/SSL_get_error.html

In particular, it mentions the following:

> The current thread's error queue must be empty before the TLS/SSL
> I/O operation is attempted, or SSL_get_error() will not work
> reliably.

As we use the result of SSL_get_error() to decide on I/O operations,
we need to ensure that it works reliably by cleaning the error queue.

TLS DNS: empty error queue before attempting I/O
2022-10-12 16:24:04 +03:00
Ondřej Surý
1c026f3286 Merge branch '3601-ignore-connection_reset-in-listen_send_cb' into 'main'
Ignore additional return codes in the netmgr unit tests

Closes #3601

See merge request isc-projects/bind9!6895
2022-10-12 13:19:03 +00:00
Ondřej Surý
ac4cc8443d Ignore additional return codes in the netmgr unit tests
There was inconsistency in which error codes would get accepted and
ignored in the network manager unit test callbacks.  Add following
results, so we just detach the handle instead of causing assertion
failure:

* ISC_R_SHUTTINGDOWN - when the network manager is shutting down
* ISC_R_CANCELED - the socket has been shut down
* ISC_R_EOF - the (TCP) communication has ended on the other side
* ISC_R_CONNECTIONRESET - the TCP connection was reset

This should fix some of the spurious unit test failures.
2022-10-12 15:07:53 +02:00
Arаm Sаrgsyаn
981d6ef1c0 Merge branch '3574-cid-357292-improper-use-of-negative-value-in-tcp.c' into 'main'
Resolve "CID 357292: Improper use of negative value in lib/isc/netmgr/tcp.c"

Closes #3574

See merge request isc-projects/bind9!6851
2022-10-12 09:00:21 +00:00
Aram Sargsyan
be95ba0119 Remove a superfluous check of sock->fd against -1
The check is left from when tcp_connect_direct() called isc__nm_socket()
and it was uncertain whether it had succeeded, but now isc__nm_socket()
is called before tcp_connect_direct(), so sock->fd cannot be -1.

    *** CID 357292:    (REVERSE_NEGATIVE)
    /lib/isc/netmgr/tcp.c: 309 in isc_nm_tcpconnect()
    303
    304     	atomic_store(&sock->active, true);
    305
    306     	result = tcp_connect_direct(sock, req);
    307     	if (result != ISC_R_SUCCESS) {
    308     		atomic_store(&sock->active, false);
    >>>     CID 357292:    (REVERSE_NEGATIVE)
    >>>     You might be using variable "sock->fd" before verifying that it is >= 0.
    309     		if (sock->fd != (uv_os_sock_t)(-1)) {
    310     			isc__nm_tcp_close(sock);
    311     		}
    312     		isc__nm_connectcb(sock, req, result, true);
    313     	}
    314
2022-10-12 08:21:35 +00:00
Ondřej Surý
5dbbc29632 Merge branch '3595-fix-the-intermittent-udp_test-failures' into 'main'
Handle double timeout in udp_cancel_read test

See merge request isc-projects/bind9!6889
2022-10-11 13:02:14 +00:00
Ondřej Surý
02c42a20b7 Handle double timeout in udp_cancel_read test
If sending took too long the isc_nm_read() could timeout twice, leading
to extra 'cread' counter in the udp_cancel_read test.  Increase the
cread counter only on ISC_R_EOF (canceled read) and deal with the
multiple ISC_R_TIMEOUTS gracefully.
2022-10-11 15:01:35 +02:00
Michał Kępień
c61818f3cb Merge branch '3592-fix-startup-detection-after-restart-in-start.pl' into 'main'
Fix startup detection after restart in start.pl

Closes #3592

See merge request isc-projects/bind9!6881
2022-10-11 09:55:51 +00:00
Michał Kępień
18e20f95f6 Fix startup detection after restart in start.pl
The bin/tests/system/start.pl script waits until a "running" message is
logged by a given name server instance before attempting to send a
version.bind/CH/TXT query to it.  The idea behind this was to make the
script wait until named loads all the zones it is configured to serve
before telling the system test framework that a given server is ready to
use; this prevents the need to add boilerplate code that waits for a
specific zone to be loaded to each test expecting that.

The problem is that when it looks for "running" messages, the
bin/tests/system/start.pl script assumes that the existence of any such
message in the named.run file indicates that a given named instance has
already finished loading all zones.  Meanwhile, some system tests
restart all the named instances they use throughout their lifetime (some
even do that a few times), for example to run Python-based tests.  The
bin/tests/system/start.pl script handles such a scenario incorrectly: as
soon as it finds any "running" message in the named.run file it inspects
and it gets a response to a version.bind/CH/TXT query, it tells the
system test framework that a given server is ready to use, which might
not be true - it is possible that only the "version.bind" zone is loaded
at that point and the "running" message found was logged by a
previously-shutdown named instance. This triggers intermittent failures
for Python-based tests.

Fix by improving the logic that the bin/tests/system/start.pl script
uses to detect server startup: check how many "running" lines are
present in a given named.run file before attempting to start a named
instance and only proceed with version.bind/CH/TXT queries when the
number of "running" lines found in that named.run file increases after
the server is started.
2022-10-11 11:54:57 +02:00
Michał Kępień
9146b956ae Do not truncate ns2 logs in the "rrsetorder" test
In the "rrsetorder" system test, the ns2 named instance is restarted
without passing the --restart option to bin/tests/system/start.pl.  This
causes the log file for that named instance to be needlessly truncated.
Prevent this from happening by restarting the affected named instance
in the same way as all the other named instances used in system tests.
2022-10-11 11:54:57 +02:00
Michał Kępień
d5fa1cb9dc Merge branch 'michal/set-up-version-and-release-notes-for-bind-9.19.7' into 'main'
Set up version and release notes for BIND 9.19.7

See merge request isc-projects/bind9!6884
2022-10-10 21:36:36 +00:00
Michał Kępień
87bf9b342b Set up release notes for BIND 9.19.7 2022-10-10 23:17:49 +02:00
Michał Kępień
0a758ebc95 Update BIND version to 9.19.7-dev 2022-10-10 23:17:49 +02:00
Michał Kępień
cb867d2ef0 Update BIND version for release v9.19.6 2022-10-10 09:00:58 +02:00
Michał Kępień
40432eae00 Add a CHANGES marker 2022-10-10 09:00:58 +02:00
Michał Kępień
c5ac304ee7 Merge branch 'michal/prepare-documentation-for-bind-9.19.6' into 'v9_19_6-release'
Prepare documentation for BIND 9.19.6

See merge request isc-private/bind9!463
2022-10-07 11:04:14 +00:00
Michał Kępień
f26a08b7f7 Add release note for GL #3587 2022-10-07 12:55:17 +02:00
Michał Kępień
26a8e9093d Reorder release notes 2022-10-07 12:55:17 +02:00
Michał Kępień
dfc19673c9 Tweak and reword release notes 2022-10-07 12:55:17 +02:00
Michał Kępień
73686d18bf Prepare release notes for BIND 9.19.6 2022-10-07 12:55:17 +02:00
Petr Špaček
d16e0c058b Merge branch '3554-improve-dnssec-policy-inline-signing-err-msg' into 'main'
Clarify new configuration incompabitility: dnssec-policy vs. inline-signing

See merge request isc-projects/bind9!6865
2022-10-06 08:27:08 +00:00
Petr Špaček
5589d0a49c Add Known Issue about config incompatibility 2022-10-06 10:26:33 +02:00
Petr Špaček
058c1744ba Clarify error message about missing inline-signing & dnssec-policy 2022-10-06 10:26:30 +02:00
Mark Andrews
00f4268804 Merge branch '3577-reloads-in-ixfr-system-test-happen-too-fast' into 'main'
Resolve "reloads in ixfr system test happen too fast"

Closes #3577

See merge request isc-projects/bind9!6855
2022-10-05 21:33:04 +00:00
Mark Andrews
491a8cfe96 Add sleeps to ixfr system test
ensure that at least a second has passed since a zone was last loaded
to prevent it accidentally being skipped as up to date.
2022-10-06 08:18:03 +11:00
Evan Hunt
f2fa141668 Merge branch '3560-fix-view-resolver-layer-weak-references-violation' into 'main'
Resolve violation of weak referencing dns_view

Closes #3560

See merge request isc-projects/bind9!6848
2022-10-05 19:33:57 +00:00
Ondřej Surý
0dcbc6274b Record the 'edns-udp-size' in the view, not in the resolver
Getting the recorded value of 'edns-udp-size' from the resolver requires
strong attach to the dns_view because we are accessing `view->resolver`.
This is not the case in places (f.e. dns_zone unit) where `.udpsize` is
accessed.  By moving the .udpsize field from `struct dns_resolver` to
`struct dns_view`, we can access the value directly even with weakly
attached dns_view without the need to lock the view because `.udpsize`
can be accessed after the dns_view object has been shut down.
2022-10-05 11:59:36 -07:00
Ondřej Surý
bff3025396 Resolve violation of weak referencing dns_view
The dns_view implements weak and strong reference counting.  When strong
reference counting reaches zero, the adb, ntatable and resolver objects
are shut down and detached.

In dns_zone and dns_nta the dns_view was weakly attached, but the
view->resolver reference was accessed directly leading to dereferencing
the NULL pointer.

Add dns_view_getresolver() method which attaches to view->resolver
object under the lock (if it still exists) ensuring the dns_resolver
will be kept referenced until not needed.
2022-10-05 11:59:36 -07:00
Michal Nowak
934a6a8b8f Merge branch 'mnowak/drop-flake8-ignore-lists' into 'main'
Drop flake8 ignore lists

See merge request isc-projects/bind9!6778
2022-10-05 16:05:41 +00:00
Michal Nowak
f5d9fa6ea4 Drop flake8 ignore lists
flake8 is not used in BIND 9 CI and inline ignore lists are not needed
anymore.
2022-10-05 17:56:24 +02:00
Tony Finch
eb5da6bbdb Merge branch '3580-coverity-constant-boolean-dead-code' into 'main'
Avoid dead code warning when using a constant boolean

Closes #3580

See merge request isc-projects/bind9!6862
2022-10-05 15:51:20 +00:00
Tony Finch
138908b211 Avoid dead code warning when using a constant boolean
The value of `sign_bit` is platform-dependent but constant at compile
time. Use a cast to convert the boolean `sign_bit` to 0 or 1 instead of
ternary `?:` because one branch of the conditional is dead code. (We
could leave out the cast to `size_t` but our style prefers to handle
booleans more explicitly, hence the `?:` that caused the issue.)

    *** CID 358310:  Possible Control flow issues  (DEADCODE)
    /lib/isc/resource.c: 118 in isc_resource_setlimit()
    112     		 * rlim_t, and whether rlim_t has a sign bit.
    113     		 */
    114     		isc_resourcevalue_t rlim_max = UINT64_MAX;
    115     		size_t wider = sizeof(rlim_max) - sizeof(rlim_t);
    116     		bool sign_bit = (double)(rlim_t)-1 < 0;
    117
    >>>     CID 358310:  Possible Control flow issues  (DEADCODE)
    >>>     Execution cannot reach the expression "1" inside this statement: "rlim_max >>= 8UL * wider + ...".
    118     		rlim_max >>= CHAR_BIT * wider + (sign_bit ? 1 : 0);
    119     		rlim_value = ISC_MIN(value, rlim_max);
    120     	}
    121
    122     	rl.rlim_cur = rl.rlim_max = rlim_value;
    123     	unixresult = setrlimit(unixresource, &rl);
2022-10-05 15:51:05 +00:00
Ondřej Surý
0e92878211 Merge branch 'ondrej/add-isc_mem_zero' into 'main'
Replace isc_mem_*_aligned(..., alignment) with isc_mem_*x(..., flags)

See merge request isc-projects/bind9!6398
2022-10-05 14:44:36 +00:00
Ondřej Surý
5878ff65ee Add CHANGES note for [GL !6398] 2022-10-05 16:44:05 +02:00