Commit Graph

36239 Commits

Author SHA1 Message Date
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 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 ba0313e649, 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
Evan Hunt
dbf867d960 Merge branch '3327-fetches-per-server-quota' into 'main'
fix the fetches-per-server quota calculation

Closes #3327

See merge request isc-projects/bind9!6268
2022-05-14 07:42:04 +00:00
Evan Hunt
3f478a3bed Add CHANGES note for [GL #3327] 2022-05-13 21:47:32 -07:00
Evan Hunt
8834c44683 Add lower bound checks to fetchlimit test
Check that the recursing client count is above a reasonable
minimum, as well as below a maximum, so that we can detect
bugs that cause recursion to fail too early or too often.
2022-05-13 21:47:32 -07:00
Evan Hunt
0201eab655 Cleanup: always count ns_statscounter_recursclients
The ns_statscounter_recursclients counter was previously only
incremented or decremented if client->recursionquota was non-NULL.
This was harmless, because that value should always be non-NULL if
recursion is enabled, but it made the code slightly confusing.
2022-05-13 21:47:27 -07:00
Evan Hunt
81deb24deb Disable EDNS for the fetchlimit test server
The fetchlimit test depends on a resolver continuing to try UDP
and timing out while the client waits for resolution to succeed.
but since commit bb990030 (flag day 2020), a fetch will always
switch to TCP after two timeouts, unless EDNS was disabled for
the query.

This commit adds "edns no;" to server statements in the fetchlimit
resolver, to restore the behavior expected by the test.
2022-05-13 21:47:27 -07:00
Evan Hunt
694bc50273 Fix the fetches-per-server quota calculation
Since commit bad5a523c2, when the fetches-per-server quota
was increased or decreased, instead of the value being set to
the newly calculated quota, it was set to the *minimum* of
the new quota or 1 - which effectively meant it was always set to 1.
it should instead have been the maximum, to prevent the value from
ever dropping to zero.
2022-05-13 21:47:27 -07:00
Evan Hunt
e73728d2cb Merge branch '3351-checkconf-overflow' into 'main'
prevent a possible buffer overflow in configuration check

Closes #3351

See merge request isc-projects/bind9!6303
2022-05-14 03:28:48 +00:00
Evan Hunt
921043b541 prevent a possible buffer overflow in configuration check
corrected code that could have allowed a buffer overfow while
parsing named.conf.
2022-05-13 19:59:58 -07:00
Evan Hunt
891c50af48 Merge branch 'each-view-cleanup' into 'main'
clean up view and related object shutdown processes

See merge request isc-projects/bind9!6278
2022-05-13 21:23:40 +00:00
Evan Hunt
578297936c CHANGES 2022-05-13 13:39:55 -07:00
Evan Hunt
3b13edc5bd attach the resolver to the ADB
the ADB depends on the resolver, but previously only accessed it
via the view. as view->resolver may now be detached before the ADB
finishes, a shutdown race was possible. attaching to the resolver
directly prevents this.
2022-05-13 13:39:55 -07:00
Evan Hunt
d7ffd897ef remove requestmgr whenshutdown events
the request manager has no direct dependency on the
view, so there's no need for a weak reference. remove the
dns_requestmgr_whenshutdown() mechanism since it is no longer
used.
2022-05-13 13:39:52 -07:00
Evan Hunt
51cd295c4b remove resolver whenshutdown events
weakly attaching and detaching when creating and destroying the
resolver obviates the need to have a callback event to do the weak
detach. remove the dns_resolver_whenshutdown() mechanism, as it is
now unused.
2022-05-13 13:36:10 -07:00
Evan Hunt
a2d491279a remove ADB whenshutdown events
weakly attaching and detaching the view when creating or destroying
the ADB obviates the need for a whenshutdown callback event to do
the detaching.  remove the dns_adb_whenshutdown() mechanism, since
it is no longer needed.
2022-05-13 13:36:10 -07:00
Evan Hunt
3027f59f6f move ADB and resolver stats out of the view object
for better object separation, ADB and resolver statistics counters
are now stored in the ADB and resolver objects themsevles, rather than
in the associated view.
2022-05-13 13:36:10 -07:00
Evan Hunt
e5e2d7814e remove view->attributes field
it's not necessary to use view attributes to determine whether
the ADB, resolver and requestmgr need to be shut down; checking
whether they're NULL is sufficient.
2022-05-13 13:36:10 -07:00
Evan Hunt
435e29c3e0 the validator can attach to the view normally
dns_view_weakattach() and _weakdetach() are used by objects that
are created by the view and need it to persist until they are
destroyed, but don't need to prevent it from being shut down. the
validator can use normal view references instead of weak references.
2022-05-13 13:36:10 -07:00
Evan Hunt
e8ab719bc2 fixed a possible reference leak in dns_resolver_create()
If an error occurred while creating the resolver, the mctx could
remain attached.
2022-05-13 13:36:10 -07:00