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

36257 Commits

Author SHA1 Message Date
Ondřej Surý
c06b661130 Remove dns_lookup and unused functions in dns_byaddr
Clean up unused functions from the dns_byaddr API and completely remove
the dns_lookup API.
2022-05-25 14:44:32 +02:00
Artem Boldariev
b6f1c242a4 Merge branch '3375-cids-352848-352849-handle-deadcode-flow-errors' into 'main'
Resolve: CID 352848, CID 352849: Control flow issues (DEADCODE)

Closes #3375

See merge request isc-projects/bind9!6351
2022-05-25 10:20:05 +00:00
Artem Boldariev
98f758ed4f CID 352848: split xfrin_start() and remove dead code
This commit separates TLS context creation code from xfrin_start() as
it has become too large and hard to follow into a new
function (similarly how it is done in dighost.c)

The dead code has been removed from the cleanup section of the TLS
creation code:

* there is no way 'tlsctx' can equal 'found';
* there is no way 'sess_cache' can be non-NULL in the cleanup section.

Also, it fixes a bug in the older version of the code, where TLS
client session context fetched from the cache would not get passed to
isc_nm_tlsdnsconnect().
2022-05-25 12:38:38 +03:00
Artem Boldariev
095b608412 CID 352849: refactor get_create_tls_context() within dighost.c
This commit removes dead code from cleanup handling part of the
get_create_tls_context().

In particular, currently:

* there is no way 'found_ctx' might equal 'ctx';
* there is no way 'session_cache' might equal a non-NULL value while
cleaning up after a TLS initialisation error.
2022-05-25 12:38:38 +03:00
Ondřej Surý
06b27a54f8 Merge branch '2801-unittest-isc-netmgr-s390x' into 'main'
Fix failures in isc netmgr_test on big endian machines

Closes #2801

See merge request isc-projects/bind9!6352
2022-05-24 18:22:54 +00:00
Petr Menšík
057438cb45 Fix failures in isc netmgr_test on big endian machines
Typing from libuv structure to isc_region_t is not possible, because
their sizes differ on 64 bit architectures. Little endian machines seems
to be lucky and still result in test passed. But big endian machine such
as s390x fails the test reliably.

Fix by directly creating the buffer as isc_region_t and skipping the
type conversion. More readable and still more correct.
2022-05-24 19:51:30 +02:00
Artem Boldariev
d50cb13d4d Merge branch '3064-avoid-periodic-interface-rescans' into 'main'
Disable periodic interface re-scans on Linux

Closes #3064

See merge request isc-projects/bind9!6111
2022-05-24 13:55:33 +00:00
Artem Boldariev
dad38620e5 Modify CHANGES [GL #3064]
Mention that "interface-interval" might be ignored if a reliable,
event-based mechanism to detect interface state changes is available.
2022-05-24 15:26:35 +03:00
Artem Boldariev
b58c4b8462 Disable periodic interface re-scans on modern platforms
This commit disables periodic interface re-scans timer on Linux where
a kernel-based dynamic interface mechanisms make it a thing of the
past in most cases.
2022-05-24 15:26:35 +03:00
Artem Boldariev
9da576c2ba Merge branch '3376-fix-openssl-1.1.0-unimplementable-SSL-SESSION-is-resumable' into 'main'
Resolve #3376: Do not provide a shim for SSL_SESSION_is_resumable()

Closes #3376

See merge request isc-projects/bind9!6346
2022-05-24 10:52:06 +00:00
Artem Boldariev
40be3c9263 Do not provide a shim for SSL_SESSION_is_resumable()
The recently added TLS client session cache used
SSL_SESSION_is_resumable() to avoid polluting the cache with
non-resumable sessions. However, it turned out that we cannot provide
a shim for this function across the whole range of OpenSSL versions
due to the fact that OpenSSL 1.1.0 does uses opaque pointers for
SSL_SESSION objects.

The commit replaces the shim for SSL_SESSION_is_resumable() with a non
public approximation of it on systems shipped with OpenSSL 1.1.0. It
is not turned into a proper shim because it does not fully emulate the
behaviour of SSL_SESSION_is_resumable(), but in our case it is good
enough, as it still helps to protect the cache from pollution.

For systems shipped with OpenSSL 1.0.X and derivatives (e.g. older
versions of LibreSSL), the provided replacement perfectly mimics the
function it is intended to replace.
2022-05-23 18:25:18 +03:00
Matthijs Mekking
31f937cb05 Merge branch '3341-servestale-extendederrors-test-failure' into 'main'
Tweak timings in serve-stale system test

Closes #3341

See merge request isc-projects/bind9!6276
2022-05-23 14:01:47 +00:00
Matthijs Mekking
f764cee136 Tweak timings in serve-stale system test
Give a little bit more time if we wait on a time out from the
authoritative (aka resolver failure), and give up after one try
(because the second attempt will likely result in a different EDE).
2022-05-23 14:23:07 +02:00
Matthijs Mekking
9a3dc23c66 Merge branch '3354-cid-352776-missing_lock' into 'main'
Fix CID 352776: Concurrent data access violations

Closes #3354

See merge request isc-projects/bind9!6315
2022-05-23 10:27:29 +00:00
Matthijs Mekking
888ec4e0d4 Require valid key for dst_key functions
Make sure that the key structure is valid when calling the following
functions:
- dst_key_setexternal
- dst_key_isexternal
- dst_key_setmodified
- dst_key_ismodified
2022-05-23 11:36:36 +02:00
Matthijs Mekking
1fa24d0afb Fix CID 352776: Concurrent data access violations
*** CID 352776:  Concurrent data access violations  (MISSING_LOCK)
/lib/dns/dst_api.c: 474 in dst_key_setmodified()
468     dst_key_isexternal(dst_key_t *key) {
469		return (key->external);
470     }
471
472     void
473     dst_key_setmodified(dst_key_t *key, bool value) {
>>>     CID 352776:  Concurrent data access violations  (MISSING_LOCK)
>>>     Accessing "key->modified" without holding lock
>>>	"dst_key.mdlock". Elsewhere, "dst_key.modified" is accessed with
>>>	"dst_key.mdlock" held 8 out of 11 times (8 of these accesses
>>>	strongly imply that it is necessary).
474		key->modified = value;
475     }
476
477     bool
478     dst_key_ismodified(dst_key_t *key) {
479		return (key->modified);
2022-05-23 11:36:13 +02:00
Artem Boldariev
0a19bb3bf3 Merge branch 'artem-client-tls-sessions-reuse' into 'main'
TLS session resumption support

See merge request isc-projects/bind9!6274
2022-05-20 17:53:33 +00:00
Artem Boldariev
90c52ca12b Dig: Do not call isc_nm_cancelread() for HTTP sockets
This commit ensures that isc_nm_cancelread() is not called from within
dig code for HTTP sockets, as these lack its implementation.

It does not have much sense to have it due to transactional nature of
HTTP.

Every HTTP request-response pair is represented by a virtual socket,
where read callback is called only when full DNS message is received
or when an error code is being passed there. That is, there is nothing
to cancel at the time of the call.
2022-05-20 20:18:40 +03:00
Artem Boldariev
9abb00bb5f Fix an abort in DoH (client-side) when writing on closing sock
The commit fixes a corner case in client-side DoH code, when a write
attempt is done on a closing socket (session).

The change ensures that the write call-back will be called with a
proper error code (see failed_send_cb() call in client_httpsend()).
2022-05-20 20:18:40 +03:00
Artem Boldariev
245f7cec2e Avoid aborting when uv_timer_start() is used on a closing socket
In such a case it will return UV_EINVAL (-EINVAL), leading to
aborting, as the code expects the function to succeed.
2022-05-20 20:18:40 +03:00
Artem Boldariev
aa8c258fba Modify CHANGES
Mention that TLS session resumption is now fully supported in the
client side code.
2022-05-20 20:18:38 +03:00
Artem Boldariev
35338b4105 Add SSL_SESSION_is_resumable() implementation shim
This commit adds SSL_SESSION_is_resumable() implementation if it is
missing.
2022-05-20 20:17:48 +03:00
Artem Boldariev
86465c1dac DoT: implement TLS client session resumption
This commit extends DoT code with TLS client session resumption
support implemented on top of the TLS client session cache.
2022-05-20 20:17:48 +03:00
Artem Boldariev
90bc13a5d5 TLS stream/DoH: implement TLS client session resumption
This commit extends TLS stream code and DoH code with TLS client
session resumption support implemented on top of the TLS client
session cache.
2022-05-20 20:17:45 +03:00
Artem Boldariev
987892d113 Extend TLS context cache with TLS client session cache
This commit extends TLS context cache with TLS client session cache so
that an associated session cache can be stored alongside the TLS
context within the context cache.
2022-05-20 20:13:20 +03:00
Artem Boldariev
4ef40988f3 Add TLS client session cache implementation
This commit adds an implementation of a client TLS session cache. TLS
client session cache is an object which allows efficient storing and
retrieval of previously saved TLS sessions so that they can be
resumed. This object is supposed to be a foundation for implementing
TLS session resumption - a standard technique to reduce the cost of
re-establishing a connection to the remote server endpoint.

OpenSSL does server-side TLS session caching transparently by
default. However, on the client-side, a TLS session to resume must be
manually specified when establishing the TLS connection. The TLS
client session cache is precisely the foundation for that.
2022-05-20 20:13:20 +03:00
Ondřej Surý
7d59a6f0ed Merge branch '3344-threadsanitizer-data-race-in-isc__nm_tcpdns_send' into 'main'
Move setting the sock->write_timeout to the async_*send

Closes #3344

See merge request isc-projects/bind9!6320
2022-05-19 20:37:16 +00:00
Ondřej Surý
61117840c1 Move setting the sock->write_timeout to the async_*send
Setting the sock->write_timeout from the TCP, TCPDNS, and TLSDNS send
functions could lead to (harmless) data race when setting the value for
the first time when the isc_nm_send() function would be called from
thread not-matching the socket we are sending to.  Move the setting the
sock->write_timeout to the matching async function which is always
called from the matching thread.
2022-05-19 22:36:47 +02:00
Ondřej Surý
c0d62c9287 Merge branch '3371-check-for-__attribute__-fallthrough-support-is-sometimes-incorrect' into 'main'
Use C2x [[fallthrough]] when supported by LLVM/clang

Closes #3371

See merge request isc-projects/bind9!6338
2022-05-19 20:01:06 +00:00
Ondřej Surý
14c8d43863 Use C2x [[fallthrough]] when supported by LLVM/clang
Clang added support for the gcc-style fallthrough
attribute (i.e. __attribute__((fallthrough))) in version 10.  However,
__has_attribute(fallthrough) will return 1 in C mode in older versions,
even though they only support the C++11 fallthrough attribute. At best,
the unsupported attribute is simply ignored; at worst, it causes errors.

The C2x fallthrough attribute has the advantages of being supported in
the broadest range of clang versions (added in version 9) and being easy
to check for support. Use C2x [[fallthrough]] attribute if possible, and
fall back to not using an attribute for clang versions that don't have
it.

Courtesy of Joshua Root
2022-05-19 21:40:24 +02:00
Michal Nowak
c9aca34b1e BIND 9.19.1
-----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCAAdFiEEIz+ZTe/bbr1Q+/5RJKPoRjruXlYFAmJ42nYACgkQJKPoRjru
 XlYtjA/8Dm/V5GSluMEoOiYXzqJ48qkdZk9sGpj+nlrnKSGY9UISZdB+9cc9JsvG
 D8c0a4JVYy4+Rcu6ivTc/iL7jrS7ypg5FFRFxOrWEugmCyOEJQ8tnhjvtQpzWyce
 m3PHtPn8s5HBojfmW4DJG5A+1CtbzStzGGdtZY6+uE9LcXynDyIjf0ebrYn7prVH
 E3UC+cYOMhq/v9AsOBvphc/3KpEWkTLeYLknPzD4el1MpCX7bTvEgnOPE8RgeVtm
 SGkXoEn2+EvfJf0UMJU6i4gqKJ4HFG2gwqk7H5XmEi61U3qerAExqgz81r9/pFzC
 PupeB7qjtHB0QO1QN3q++CW9sQJ4Xy0BrbcDWe0dgY7Kt8UgrM+CDV+qm4ueryem
 d6gqmT1WKFeS2NevHPnOoqoSJa2IhEWR07/DoZVUXF0ADtFeswANaRVDTv+fGy1j
 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YXzQO5OhY=
 =Kjz0
 -----END PGP SIGNATURE-----

Merge tag 'v9_19_1'

BIND 9.19.1
2022-05-19 10:55:42 +02:00
Evan Hunt
0e0d39bfdb Merge branch 'each-resolver-hash-tables' into 'main'
Use self-resizing hash tables for resolver

See merge request isc-projects/bind9!6271
2022-05-19 07:49:11 +00:00
Evan Hunt
be841577f1 CHANGES for [GL !6271] 2022-05-19 00:48:06 -07:00
Evan Hunt
6936db2f59 Always use the number of CPUS for resolver->ntasks
Since the fctx hash table is now self-resizing, and resolver tasks are
selected to match the thread that created the fetch context, there
shouldn't be any significant advantage to having multiple tasks per CPU;
a single task per thread should be sufficient.

Additionally, the fetch context is always pinned to the calling netmgr
thread to minimize the contention just to coalesced fetches - if two
threads starts the same fetch, it will be pinned to the first one to get
the bucket.
2022-05-19 09:27:33 +02:00
Evan Hunt
857f3bede3 Use automatically-resizing hash table for resolver buckets
Replace the statically-sized hash table used for the resolver
fetch contexts with an isc_ht_t.
2022-05-19 09:27:28 +02:00
Evan Hunt
1595304312 Use automatically-resizing hash table for fetches-per-zone
Replace the statically-sized hash table used for fcount_incr()
and fcount_decr() with an isc_ht_t.
2022-05-19 09:27:23 +02:00
Evan Hunt
5731a3d7f0 Merge branch '3350-rndc-dnssec-checkds-doc' into 'main'
specify time format in the documentation for 'rdnc dnssec -checkds'

Closes #3350

See merge request isc-projects/bind9!6302
2022-05-18 22:28:39 +00:00
Evan Hunt
83f9466d61 specify time format in the documentation for 'rdnc dnssec -checkds'
also clarified the writing in the surrounding paragraph.
2022-05-18 15:24:54 -07:00
Michal Nowak
da7d0a7ea3 Merge branch 'mnowak/fix-typo-in-ednscompliance-test' into 'main'
Fix typo in ednscompliance test

See merge request isc-projects/bind9!6323
2022-05-18 17:15:04 +00:00
Michal Nowak
9de2c06a21
Fix typo in ednscompliance test
Caused by ba0313e649b9de3d746cc8a748cd02da75f258bd, an incomplete fix of
spelling errors.
2022-05-18 19:13:30 +02:00
Ondřej Surý
6842733018 Merge branch '3366-configure-fails-to-find-uv-h-on-bsd' into 'main'
Use libuv CFLAGS and LIBS when checking for features

Closes #3366

See merge request isc-projects/bind9!6326
2022-05-18 17:04:31 +00:00
Ondřej Surý
f063ee276e Use libuv CFLAGS and LIBS when checking for features
When autoconf was checking for libuv features, the LIBUV_CFLAGS was not
added to CFLAGS and LIBUV_LIBS to LIBS which resulted in false
negatives.

Use AX_SAVE_FLAGS and AX_RESTORE_FLAGS to temporarily add LIBUV_CFLAGS
and LIBUV_LIBS to their respective variables.
2022-05-18 14:10:58 +02:00
Mark Andrews
2cfef0f72d Merge branch '3356-wrong-path-for-geoip-directory' into 'main'
Resolve "wrong path for geoip-directory"

Closes #3356

See merge request isc-projects/bind9!6316
2022-05-17 18:56:17 +00:00
Mark Andrews
686d691fa9 Remove extraneous '$' in AS_VAR_COPY([MAXMINDDB_PREFIX], [with_maxminddb]) 2022-05-17 18:37:00 +00:00
Tony Finch
6795a346b4 Merge branch '3361-dnssec-settime-unset' into 'main'
Teach dnssec-settime to read unset times that it writes

Closes #3361

See merge request isc-projects/bind9!6317
2022-05-17 15:33:29 +00:00
Tony Finch
4c96efac5c Teach dnssec-settime to read unset times that it writes
When there is no time in a key file, `dnssec-settime` will print
"UNSET", but to unset a time the user must specify "none" or "never".
This change allows "unset" or "UNSET" as well as "none" or "never".
The "UNSET" output remains the same to avoid compatibility problems
with wrapper scripts.

I have also re-synchronized the "Timing Options" sections of the man
pages.
2022-05-17 16:28:40 +02:00
Ondřej Surý
9903a1defb Merge branch 'ondrej-cleanup-dns_message_gettemp' into 'main'
Cleanup dns_message_gettemp*() functions - they cannot fail

See merge request isc-projects/bind9!6311
2022-05-17 11:12:06 +00:00
Ondřej Surý
33ba0057a7 Cleanup dns_message_gettemp*() functions - they cannot fail
The dns_message_gettempname(), dns_message_gettemprdata(),
dns_message_gettemprdataset(), and dns_message_gettemprdatalist() always
succeeds because the memory allocation cannot fail now.  Change the API
to return void and cleanup all the use of aforementioned functions.
2022-05-17 12:39:25 +02:00
Matthijs Mekking
edbb52c95c Merge branch '3352-kasp-test-broken-on-freebsd' into 'main'
Fix "kasp test broken on freebsd"

Closes #3352

See merge request isc-projects/bind9!6310
2022-05-16 16:15:01 +00:00
Matthijs Mekking
fe601c5915 Replace stat with PERL stat in kasp system test
7249bad7 introduced the -c option to stat(1) command, but BSD systems
do not know about it. Replace the stat(1) command with a PERL script
that achieves the same.

Why PERL? For consistency purposes, there are more places in the
system test where we use the same method.
2022-05-16 17:20:46 +02:00