]> git.ipfire.org Git - thirdparty/bind9.git/log
thirdparty/bind9.git
3 years agoAdd release note for [GL #3622]
Mark Andrews [Fri, 28 Oct 2022 00:31:19 +0000 (11:31 +1100)] 
Add release note for [GL #3622]

3 years agoAdd CHANGES note for [GL #3622]
Mark Andrews [Fri, 28 Oct 2022 00:26:59 +0000 (11:26 +1100)] 
Add CHANGES note for [GL #3622]

3 years agoMove the mapping of SIG and RRSIG to ANY
Mark Andrews [Thu, 27 Oct 2022 02:22:11 +0000 (13:22 +1100)] 
Move the mapping of SIG and RRSIG to ANY

dns_db_findext() asserts if RRSIG is passed to it and
query_lookup_stale() failed to map RRSIG to ANY to prevent this.  To
avoid cases like this in the future, move the mapping of SIG and RRSIG
to ANY for qctx->type to qctx_init().

3 years agoMerge branch '3523-confidential-update-quota' into 'security-main'
Michał Kępień [Thu, 12 Jan 2023 10:56:37 +0000 (10:56 +0000)] 
Merge branch '3523-confidential-update-quota' into 'security-main'

[CVE-2022-3094] apply quotas to updates

See merge request isc-private/bind9!442

3 years agoCHANGES and release notes for [GL #3523]
Evan Hunt [Thu, 1 Sep 2022 23:34:21 +0000 (16:34 -0700)] 
CHANGES and release notes for [GL #3523]

3 years agotest failure conditions
Evan Hunt [Thu, 10 Nov 2022 05:56:16 +0000 (21:56 -0800)] 
test failure conditions

verify that updates are refused when the client is disallowed by
allow-query, and update forwarding is refused when the client is
is disallowed by update-forwarding.

verify that "too many DNS UPDATEs" appears in the log file when too
many simultaneous updates are processing.

3 years agomove update ACL and update-policy checks before quota
Evan Hunt [Wed, 9 Nov 2022 01:32:41 +0000 (17:32 -0800)] 
move update ACL and update-policy checks before quota

check allow-update, update-policy, and allow-update-forwarding before
consuming quota slots, so that unauthorized clients can't fill the
quota.

(this moves the access check before the prerequisite check, which
violates the precise wording of RFC 2136. however, RFC co-author Paul
Vixie has stated that the RFC is mistaken on this point; it should have
said that access checking must happen *no later than* the completion of
prerequisite checks, not that it must happen exactly then.)

3 years agoadd a configuration option for the update quota
Evan Hunt [Thu, 1 Sep 2022 23:22:46 +0000 (16:22 -0700)] 
add a configuration option for the update quota

add an "update-quota" option to configure the update quota.

3 years agoadd an update quota
Evan Hunt [Thu, 1 Sep 2022 23:05:04 +0000 (16:05 -0700)] 
add an update quota

limit the number of simultaneous DNS UPDATE events that can be
processed by adding a quota for update and update forwarding.
this quota currently, arbitrarily, defaults to 100.

also add a statistics counter to record when the update quota
has been exceeded.

3 years agoMerge branch 'michal/add-placeholder-entries-to-CHANGES' into 'main'
Michał Kępień [Wed, 11 Jan 2023 16:48:05 +0000 (16:48 +0000)] 
Merge branch 'michal/add-placeholder-entries-to-CHANGES' into 'main'

Add placeholder entries to CHANGES

See merge request isc-projects/bind9!7356

3 years agoAdd placeholder entries to CHANGES
Michał Kępień [Wed, 11 Jan 2023 16:44:12 +0000 (17:44 +0100)] 
Add placeholder entries to CHANGES

Add placeholders for the following issues:

  - [GL #3523]
  - [GL #3599]
  - [GL #3619]
  - [GL #3622]

3 years agoMerge branch 'aram/dns_fwdtable_addfwd-cleanup-bugfix' into 'main'
Arаm Sаrgsyаn [Wed, 11 Jan 2023 13:19:31 +0000 (13:19 +0000)] 
Merge branch 'aram/dns_fwdtable_addfwd-cleanup-bugfix' into 'main'

Fix dns_fwdtable_addfwd() error path cleanup bug

See merge request isc-projects/bind9!7205

3 years agoUse sizeof(*ptr) for allocating/freeing memory in forward.c
Aram Sargsyan [Mon, 12 Dec 2022 09:20:48 +0000 (09:20 +0000)] 
Use sizeof(*ptr) for allocating/freeing memory in forward.c

As shown in the previous commit, using sizeof(type_t) is a little
bit more error-prone when copy-pasting code, so extracting the
size information from the pointer which is being dealt with seems
like a better alternative.

3 years agoFix dns_fwdtable_addfwd() error path cleanup bug
Aram Sargsyan [Fri, 9 Dec 2022 12:41:38 +0000 (12:41 +0000)] 
Fix dns_fwdtable_addfwd() error path cleanup bug

Free 'sizeof(dns_forwarder_t)' bytes of memory instead of
'sizeof(dns_sockaddr_t)' bytes, because `fwd` is a pointer
to a 'dns_forwarder_t' type structure.

3 years agoMerge branch '3764-adjust-descriptors-for-some-unit-tests' into 'main'
Mark Andrews [Wed, 11 Jan 2023 11:04:07 +0000 (11:04 +0000)] 
Merge branch '3764-adjust-descriptors-for-some-unit-tests' into 'main'

Resolve "Adjust descriptor limit for some unit tests"

Closes #3764

See merge request isc-projects/bind9!7294

3 years agoIncrease the number of available file descriptors
Mark Andrews [Wed, 4 Jan 2023 05:59:47 +0000 (16:59 +1100)] 
Increase the number of available file descriptors

notify_test and query_test run out of descriptors on some platforms.

    % ./notify_test
    [==========] Running 1 test(s).
    [ RUN      ] notify_start
    netmgr/tcp.c:369: REQUIRE(csock->fd >= 0) failed, back trace
    0   libisc-9.19.9-dev.dylib             0x00000001045c5080 default_callback + 72
    1   libisc-9.19.9-dev.dylib             0x00000001045c4ffc isc_assertion_failed + 56
    2   libisc-9.19.9-dev.dylib             0x00000001045b8bcc start_tcp_child + 304
    3   libisc-9.19.9-dev.dylib             0x00000001045b8710 isc_nm_listentcp + 636
    4   libisc-9.19.9-dev.dylib             0x00000001045b3e0c isc_nm_listenstreamdns + 344
    5   libns-9.19.9-dev.dylib              0x0000000104b90630 ns_interface_listentcp + 152
    6   libns-9.19.9-dev.dylib              0x0000000104b8f65c interface_setup + 488
    7   libns-9.19.9-dev.dylib              0x0000000104b8de98 do_scan + 2028
    8   libns-9.19.9-dev.dylib              0x0000000104b8d640 ns_interfacemgr_scan + 212
    9   notify_test                         0x000000010418ddd0 scan_interfaces + 44
    10  libisc-9.19.9-dev.dylib             0x00000001045d5fd8 isc__job_cb + 116
    11  libuv.1.dylib                       0x000000010545afe4 uv__run_idle + 152
    12  libuv.1.dylib                       0x0000000105455cd0 uv_run + 204
    13  libisc-9.19.9-dev.dylib             0x00000001045e1120 loop_run + 460
    14  libisc-9.19.9-dev.dylib             0x00000001045df824 loop_thread + 44
    15  libisc-9.19.9-dev.dylib             0x00000001045df6dc isc_loopmgr_run + 456
    16  notify_test                         0x000000010418b900 run_test_notify_start + 88
    17  libcmocka.0.dylib                   0x00000001054968c0 cmocka_run_one_test_or_fixture + 448
    18  libcmocka.0.dylib                   0x0000000105494ca4 _cmocka_run_group_tests + 848
    19  notify_test                         0x000000010418be60 main + 120
    20  libdyld.dylib                       0x0000000181509430 start + 4
    Abort
    % ./query_test
    [==========] Running 4 test(s).
    [ RUN      ] ns__query_sfcache
    netmgr/tcp.c:369: REQUIRE(csock->fd >= 0) failed, back trace
    0   libisc-9.19.9-dev.dylib             0x000000010294d080 default_callback + 72
    1   libisc-9.19.9-dev.dylib             0x000000010294cffc isc_assertion_failed + 56
    2   libisc-9.19.9-dev.dylib             0x0000000102940bcc start_tcp_child + 304
    3   libisc-9.19.9-dev.dylib             0x0000000102940710 isc_nm_listentcp + 636
    4   libisc-9.19.9-dev.dylib             0x000000010293be0c isc_nm_listenstreamdns + 344
    5   libns-9.19.9-dev.dylib              0x00000001026cc630 ns_interface_listentcp + 152
    6   libns-9.19.9-dev.dylib              0x00000001026cb65c interface_setup + 488
    7   libns-9.19.9-dev.dylib              0x00000001026c9e98 do_scan + 2028
    8   libns-9.19.9-dev.dylib              0x00000001026c9640 ns_interfacemgr_scan + 212
    9   query_test                          0x00000001026a1018 scan_interfaces + 44
    10  libisc-9.19.9-dev.dylib             0x000000010295dfd8 isc__job_cb + 116
    11  libuv.1.dylib                       0x0000000103996fe4 uv__run_idle + 152
    12  libuv.1.dylib                       0x0000000103991cd0 uv_run + 204
    13  libisc-9.19.9-dev.dylib             0x0000000102969120 loop_run + 460
    14  libisc-9.19.9-dev.dylib             0x0000000102967824 loop_thread + 44
    15  libisc-9.19.9-dev.dylib             0x00000001029676dc isc_loopmgr_run + 456
    16  query_test                          0x000000010269cf34 run_test_ns__query_sfcache + 88
    17  libcmocka.0.dylib                   0x00000001028068c0 cmocka_run_one_test_or_fixture + 448
    18  libcmocka.0.dylib                   0x0000000102804ca4 _cmocka_run_group_tests + 848
    19  query_test                          0x000000010269eab8 main + 116
    20  libdyld.dylib                       0x0000000181509430 start + 4
    Abort
    %

expected_creads can exceed the number of file descriptors on some
platforms.

    % ./udp_test
    [==========] Running 18 test(s).
    [ RUN      ] mock_listenudp_uv_udp_open
    [       OK ] mock_listenudp_uv_udp_open
    [ RUN      ] mock_listenudp_uv_udp_bind
    [       OK ] mock_listenudp_uv_udp_bind
    [ RUN      ] mock_listenudp_uv_udp_recv_start
    [       OK ] mock_listenudp_uv_udp_recv_start
    [ RUN      ] mock_udpconnect_uv_udp_open
    [       OK ] mock_udpconnect_uv_udp_open
    [ RUN      ] mock_udpconnect_uv_udp_bind
    [       OK ] mock_udpconnect_uv_udp_bind
    [ RUN      ] mock_udpconnect_uv_udp_connect
    [       OK ] mock_udpconnect_uv_udp_connect
    [ RUN      ] mock_udpconnect_uv_recv_buffer_size
    [       OK ] mock_udpconnect_uv_recv_buffer_size
    [ RUN      ] mock_udpconnect_uv_send_buffer_size
    [       OK ] mock_udpconnect_uv_send_buffer_size
    [ RUN      ] udp_noop
    [       OK ] udp_noop
    [ RUN      ] udp_noresponse
    [       OK ] udp_noresponse
    [ RUN      ] udp_shutdown_connect
    [       OK ] udp_shutdown_connect
    [ RUN      ] udp_shutdown_read
    [       OK ] udp_shutdown_read
    [ RUN      ] udp_cancel_read
    [       OK ] udp_cancel_read
    [ RUN      ] udp_timeout_recovery
    [       OK ] udp_timeout_recovery
    [ RUN      ] udp_double_read
    [       OK ] udp_double_read
    [ RUN      ] udp_recv_one
    [       OK ] udp_recv_one
    [ RUN      ] udp_recv_two
    [       OK ] udp_recv_two
    [ RUN      ] udp_recv_send
    udp__connect_cb(0x0, too many open files, 0x0)
    udp__connect_cb(0x0, too many open files, 0x0)
    udp__connect_cb(0x0, too many open files, 0x0)
    udp__connect_cb(0x0, too many open files, 0x0)
    udp__connect_cb(0x0, too many open files, 0x0)
    udp__connect_cb(0x0, too many open files, 0x0)
    %

3 years agoMerge branch 'ondrej/use-pthread_barrier-if-available' into 'main'
Ondřej Surý [Wed, 11 Jan 2023 09:54:13 +0000 (09:54 +0000)] 
Merge branch 'ondrej/use-pthread_barrier-if-available' into 'main'

Prefer the pthread_barrier implementation over uv_barrier

See merge request isc-projects/bind9!7348

3 years agoPrefer the pthread_barrier implementation over uv_barrier
Ondřej Surý [Wed, 11 Jan 2023 08:28:10 +0000 (09:28 +0100)] 
Prefer the pthread_barrier implementation over uv_barrier

Prefer the pthread_barrier implementation on platforms where it is
available over uv_barrier implementation.  This also solves the problem
with thread sanitizer builds on macOS that doesn't have pthread barrier.

3 years agoMerge branch 'fanf-git-replay-merge-tags' into 'main'
Ondřej Surý [Wed, 11 Jan 2023 08:02:46 +0000 (08:02 +0000)] 
Merge branch 'fanf-git-replay-merge-tags' into 'main'

Auto-tag merge requests created by git-replay-merge

See merge request isc-projects/bind9!7254

3 years agoAuto-tag merge requests created by git-replay-merge
Tony Finch [Tue, 20 Dec 2022 11:38:51 +0000 (11:38 +0000)] 
Auto-tag merge requests created by git-replay-merge

The target branch is added to the title of the MR, and a "Backport"
label is added. If the target branch starts with "v" a version label
is added too.

While I am here, clean up remnants of the old gitlab API (which has
been replaced by push options for our purposes) and improve the
command-line parsing.

3 years agoMerge branch 'ondrej/remove-udp-and-tcp-listen-lock' into 'main'
Ondřej Surý [Wed, 11 Jan 2023 06:51:14 +0000 (06:51 +0000)] 
Merge branch 'ondrej/remove-udp-and-tcp-listen-lock' into 'main'

Get rid of locking during UDP and TCP listen

See merge request isc-projects/bind9!7343

3 years agoGet rid of locking during UDP and TCP listen
Ondřej Surý [Wed, 4 Jan 2023 11:21:00 +0000 (12:21 +0100)] 
Get rid of locking during UDP and TCP listen

We already have a synchronization mechanism when starting the UDP and
TCP listener children - barriers.  Change how we start the first-born
child (tid == 0), so we don't have to race for sock->parent->result and
sock->parent->fd.

3 years agoMerge branch 'ondrej/cleanup-isc_astack-usage-in-netmgr' into 'main'
Ondřej Surý [Tue, 10 Jan 2023 19:53:50 +0000 (19:53 +0000)] 
Merge branch 'ondrej/cleanup-isc_astack-usage-in-netmgr' into 'main'

Convert isc_astack usage in netmgr to mempool and ISC_LIST

See merge request isc-projects/bind9!7300

3 years agoRemove unused isc_astack unit
Ondřej Surý [Wed, 4 Jan 2023 15:06:48 +0000 (16:06 +0100)] 
Remove unused isc_astack unit

The isc_astack unit is now unused, so just remove it.

3 years agoConvert isc_astack usage in netmgr to mempool and ISC_LIST
Ondřej Surý [Wed, 4 Jan 2023 14:57:00 +0000 (15:57 +0100)] 
Convert isc_astack usage in netmgr to mempool and ISC_LIST

Change the per-socket inactive uvreq cache (implemented as isc_astack)
to per-worker memory pool.

Change the per-socket inactive nmhandle cache (implemented as
isc_astack) to unlocked per-socket ISC_LIST.

3 years agoMerge branch 'ondrej/always-track-netmgr-sockets-and-handles' into 'main'
Ondřej Surý [Tue, 10 Jan 2023 19:30:37 +0000 (19:30 +0000)] 
Merge branch 'ondrej/always-track-netmgr-sockets-and-handles' into 'main'

Simplify tracing the reference counting in isc_netmgr

See merge request isc-projects/bind9!7292

3 years agoSimplify tracing the reference counting in isc_netmgr
Ondřej Surý [Tue, 3 Jan 2023 07:27:54 +0000 (08:27 +0100)] 
Simplify tracing the reference counting in isc_netmgr

Always track the per-worker sockets in the .active_sockets field in the
isc__networker_t struct and always track the per-socket handles in the
.active_handles field ian the isc_nmsocket_t struct.

3 years agoMerge branch '3785-openssl-refactoring-19' into 'main'
Ondřej Surý [Tue, 10 Jan 2023 09:39:55 +0000 (09:39 +0000)] 
Merge branch '3785-openssl-refactoring-19' into 'main'

Add CHANGES note for [GL #3785]

Closes #3785

See merge request isc-projects/bind9!7344

3 years agoAdd CHANGES note for [GL #3785]
Ondřej Surý [Tue, 10 Jan 2023 09:07:06 +0000 (10:07 +0100)] 
Add CHANGES note for [GL #3785]

3 years agoMerge branch '3787-siphash-c-105-26-runtime-error-applying-zero-offset-to-null-pointe...
Mark Andrews [Tue, 10 Jan 2023 07:22:37 +0000 (07:22 +0000)] 
Merge branch '3787-siphash-c-105-26-runtime-error-applying-zero-offset-to-null-pointer' into 'main'

Resolve "siphash.c:105:26: runtime error: applying zero offset to null pointer"

Closes #3787

See merge request isc-projects/bind9!7339

3 years agoAccept 'in=NULL' with 'inlen=0' in isc_{half}siphash24
Mark Andrews [Tue, 10 Jan 2023 02:51:49 +0000 (13:51 +1100)] 
Accept 'in=NULL' with 'inlen=0' in isc_{half}siphash24

Arthimetic on NULL pointers is undefined.  Avoid arithmetic operations
when 'in' is NULL and require 'in' to be non-NULL if 'inlen' is not zero.

3 years agoMerge branch '3785-openssl-refactoring-18' into 'main'
Ondřej Surý [Mon, 9 Jan 2023 21:50:15 +0000 (21:50 +0000)] 
Merge branch '3785-openssl-refactoring-18' into 'main'

Resolve "OpenSSL 3 refactoring"

Closes #3785

See merge request isc-projects/bind9!7335

3 years agoIgnore the extra EVP_PKEY_get_bn_param() failures
Ondřej Surý [Mon, 9 Jan 2023 20:50:01 +0000 (21:50 +0100)] 
Ignore the extra EVP_PKEY_get_bn_param() failures

In opensslrsa_components_get(), ignore the extra EVP_PKEY_get_bn_param()
return codes as RSA key might not have all those components.

3 years agoMerge branch '3773-remove-dscp' into 'main'
Evan Hunt [Mon, 9 Jan 2023 21:04:55 +0000 (21:04 +0000)] 
Merge branch '3773-remove-dscp' into 'main'

remove nonfunctional DSCP implementation

Closes #3773

See merge request isc-projects/bind9!7305

3 years agoCHANGES and release note for [GL #3773]
Evan Hunt [Fri, 6 Jan 2023 06:47:39 +0000 (22:47 -0800)] 
CHANGES and release note for [GL #3773]

3 years agoremove nonfunctional DSCP implementation
Evan Hunt [Fri, 6 Jan 2023 06:18:55 +0000 (22:18 -0800)] 
remove nonfunctional DSCP implementation

DSCP has not been fully working since the network manager was
introduced in 9.16, and has been completely broken since 9.18.
This seems to have caused very few difficulties for anyone,
so we have now marked it as obsolete and removed the
implementation.

To ensure that old config files don't fail, the code to parse
dscp key-value pairs is still present, but a warning is logged
that the feature is obsolete and should not be used. Nothing is
done with configured values, and there is no longer any
range checking.

3 years agoMerge branch '3785-openssl-refactoring-17' into 'main'
Ondřej Surý [Mon, 9 Jan 2023 19:32:28 +0000 (19:32 +0000)] 
Merge branch '3785-openssl-refactoring-17' into 'main'

Refactor OpenSSL ECDSA public and private key export

Closes #3785

See merge request isc-projects/bind9!7334

3 years agoRefactor OpenSSL ECDSA private key export
Timo Teräs [Wed, 28 Dec 2022 21:51:57 +0000 (23:51 +0200)] 
Refactor OpenSSL ECDSA private key export

3 years agoMerge branch '3785-openssl-refactoring-16' into 'main'
Ondřej Surý [Mon, 9 Jan 2023 18:56:29 +0000 (18:56 +0000)] 
Merge branch '3785-openssl-refactoring-16' into 'main'

Refactor OpenSSL ECDSA generation to helper functions

Closes #3785

See merge request isc-projects/bind9!7333

3 years agoRefactor OpenSSL ECDSA public key export
Timo Teräs [Wed, 28 Dec 2022 21:33:51 +0000 (23:33 +0200)] 
Refactor OpenSSL ECDSA public key export

3 years agoRefactor OpenSSL ECDSA generation to helper functions
Timo Teräs [Wed, 28 Dec 2022 20:44:23 +0000 (22:44 +0200)] 
Refactor OpenSSL ECDSA generation to helper functions

Reduce the #ifdef cruft by having specific helper functions.

3 years agoMerge branch '3785-openssl-refactoring-15' into 'main'
Ondřej Surý [Mon, 9 Jan 2023 18:52:27 +0000 (18:52 +0000)] 
Merge branch '3785-openssl-refactoring-15' into 'main'

Refactor OpenSSL ECDSA to use pkeypair

Closes #3785

See merge request isc-projects/bind9!7332

3 years agoRefactor OpenSSL ECDSA to use pkeypair
Timo Teräs [Wed, 28 Dec 2022 15:13:41 +0000 (17:13 +0200)] 
Refactor OpenSSL ECDSA to use pkeypair

- Use separate EVP_PKEY for public and private keys
- On private key load, generate public key allowing better consistency
- Support OpenSSL3 providers
- Clean up key construction abstraction
- Various other clean ups

3 years agoMerge branch '3785-openssl-refactoring-14' into 'main'
Ondřej Surý [Mon, 9 Jan 2023 18:33:24 +0000 (18:33 +0000)] 
Merge branch '3785-openssl-refactoring-14' into 'main'

Make OpenSSL keypair comparation a generic helper function

Closes #3785

See merge request isc-projects/bind9!7331

3 years agoMerge branch '3785-openssl-refactoring-13' into 'main'
Ondřej Surý [Mon, 9 Jan 2023 18:31:06 +0000 (18:31 +0000)] 
Merge branch '3785-openssl-refactoring-13' into 'main'

Refactor OpenSSL ECDSA type check to opensslecdsa_valid_key_alg helper

Closes #3785

See merge request isc-projects/bind9!7330

3 years agoMake OpenSSL keypair comparation a generic helper function
Timo Teräs [Wed, 28 Dec 2022 15:11:21 +0000 (17:11 +0200)] 
Make OpenSSL keypair comparation a generic helper function

3 years agoMerge branch '3785-openssl-refactoring-12' into 'main'
Ondřej Surý [Mon, 9 Jan 2023 18:29:56 +0000 (18:29 +0000)] 
Merge branch '3785-openssl-refactoring-12' into 'main'

Implement support for OpenSSL 3 Provider API stored RSA keys

Closes #3785

See merge request isc-projects/bind9!7329

3 years agoRefactor OpenSSL ECDSA type check to opensslecdsa_valid_key_alg helper
Timo Teräs [Wed, 28 Dec 2022 13:37:33 +0000 (15:37 +0200)] 
Refactor OpenSSL ECDSA type check to opensslecdsa_valid_key_alg helper

3 years agoImplement support for OpenSSL 3 Provider API stored RSA keys
Timo Teräs [Mon, 26 Dec 2022 17:42:32 +0000 (19:42 +0200)] 
Implement support for OpenSSL 3 Provider API stored RSA keys

Allows using pkcs11-provider module for PKCS#11 keys

3 years agoMerge branch 'mnowak/abort-on-ubsan-errors' into 'main'
Michal Nowak [Mon, 9 Jan 2023 16:39:24 +0000 (16:39 +0000)] 
Merge branch 'mnowak/abort-on-ubsan-errors' into 'main'

Abort on UBSAN errors

See merge request isc-projects/bind9!6877

3 years agoAbort on UBSAN errors
Michal Nowak [Fri, 7 Oct 2022 08:16:07 +0000 (10:16 +0200)] 
Abort on UBSAN errors

Previously, UBSAN errors might slip undetected.

3 years agoMerge branch '3785-openssl-refactoring-11' into 'main'
Ondřej Surý [Mon, 9 Jan 2023 15:43:09 +0000 (15:43 +0000)] 
Merge branch '3785-openssl-refactoring-11' into 'main'

Make the OpenSSL RSA fromlabel helper a generic one

Closes #3785

See merge request isc-projects/bind9!7326

3 years agoMake the OpenSSL RSA fromlabel helper a generic one
Timo Teräs [Mon, 26 Dec 2022 17:31:26 +0000 (19:31 +0200)] 
Make the OpenSSL RSA fromlabel helper a generic one

3 years agoMerge branch '3785-openssl-refactoring-10' into 'main'
Ondřej Surý [Mon, 9 Jan 2023 15:35:24 +0000 (15:35 +0000)] 
Merge branch '3785-openssl-refactoring-10' into 'main'

Rename the global ENGINE *e to global_engine

Closes #3785

See merge request isc-projects/bind9!7325

3 years agoMerge branch '3785-openssl-refactoring-9' into 'main'
Ondřej Surý [Mon, 9 Jan 2023 15:31:46 +0000 (15:31 +0000)] 
Merge branch '3785-openssl-refactoring-9' into 'main'

Refactor OpenSSL RSA pkey building to use components struct

Closes #3785

See merge request isc-projects/bind9!7322

3 years agoRename the global ENGINE *e to global_engine
Timo Teräs [Mon, 26 Dec 2022 17:17:19 +0000 (19:17 +0200)] 
Rename the global ENGINE *e to global_engine

3 years agoRefactor OpenSSL RSA pkey building to use components struct
Timo Teräs [Mon, 26 Dec 2022 15:36:02 +0000 (17:36 +0200)] 
Refactor OpenSSL RSA pkey building to use components struct

3 years agoMerge branch 'pspacek/aclelementtype_cleanup' into 'main'
Petr Špaček [Mon, 9 Jan 2023 15:06:22 +0000 (15:06 +0000)] 
Merge branch 'pspacek/aclelementtype_cleanup' into 'main'

Remove unused dns_aclelementtype_{ipprefix,any} enum values

See merge request isc-projects/bind9!7295

3 years agoRemove unused dns_aclelementtype_{ipprefix,any} enum values
Petr Špaček [Wed, 4 Jan 2023 10:34:09 +0000 (11:34 +0100)] 
Remove unused dns_aclelementtype_{ipprefix,any} enum values

Seems like they are unused, and all system tests pass when those values
removed.

3 years agoMerge branch '3785-openssl-refactoring-8-cleanup' into 'main'
Ondřej Surý [Mon, 9 Jan 2023 15:02:55 +0000 (15:02 +0000)] 
Merge branch '3785-openssl-refactoring-8-cleanup' into 'main'

BN_free() and BN_clear_free() both accept NULL

Closes #3785

See merge request isc-projects/bind9!7323

3 years agoBN_free() and BN_clear_free() both accept NULL
Ondřej Surý [Mon, 9 Jan 2023 15:00:18 +0000 (16:00 +0100)] 
BN_free() and BN_clear_free() both accept NULL

Remove the extra check in opensslrsa_components_free() as both BN_free()
and BN_clear_free() both accepts NULL as valid argument and do nothing.

3 years agoMerge branch '3785-openssl-refactoring-8' into 'main'
Ondřej Surý [Mon, 9 Jan 2023 14:56:07 +0000 (14:56 +0000)] 
Merge branch '3785-openssl-refactoring-8' into 'main'

Refactor OpenSSL RSA components getting to a helper function

Closes #3785

See merge request isc-projects/bind9!7321

3 years agoRefactor OpenSSL RSA components getting to a helper function
Timo Teräs [Mon, 26 Dec 2022 17:07:18 +0000 (19:07 +0200)] 
Refactor OpenSSL RSA components getting to a helper function

3 years agoMerge branch '3743-unexpected-prohibited-ede' into 'main'
Matthijs Mekking [Mon, 9 Jan 2023 14:40:31 +0000 (14:40 +0000)] 
Merge branch '3743-unexpected-prohibited-ede' into 'main'

Fix unexpected "Prohibited" extended DNS error on allow-recursion mismatch

Closes #3743

See merge request isc-projects/bind9!7223

3 years agoAdd system test for #3743
Matthijs Mekking [Wed, 14 Dec 2022 10:54:19 +0000 (11:54 +0100)] 
Add system test for #3743

3 years agoAdd release note and CHANGES for #3743
Matthijs Mekking [Wed, 14 Dec 2022 10:53:28 +0000 (11:53 +0100)] 
Add release note and CHANGES for #3743

3 years agoDon't set EDE in ns_client_aclchecksilent
Matthijs Mekking [Wed, 14 Dec 2022 10:41:10 +0000 (11:41 +0100)] 
Don't set EDE in ns_client_aclchecksilent

The ns_client_aclchecksilent is used to check multiple ACLs before
the decision is made that a query is denied. It is also used to
determine if recursion is available. In those cases we should not
set the extended DNS error "Prohibited".

3 years agoMerge branch '3785-openssl-refactoring-7' into 'main'
Ondřej Surý [Mon, 9 Jan 2023 14:33:09 +0000 (14:33 +0000)] 
Merge branch '3785-openssl-refactoring-7' into 'main'

Refactor OpenSSL RSA generation to be more readable

Closes #3785

See merge request isc-projects/bind9!7320

3 years agoMerge branch '3785-openssl-refactoring-6' into 'main'
Ondřej Surý [Mon, 9 Jan 2023 14:22:22 +0000 (14:22 +0000)] 
Merge branch '3785-openssl-refactoring-6' into 'main'

Provide identical BN_GENCB_new shim

Closes #3785

See merge request isc-projects/bind9!7319

3 years agoRefactor OpenSSL RSA generation to be more readable
Timo Teräs [Mon, 26 Dec 2022 15:16:25 +0000 (17:16 +0200)] 
Refactor OpenSSL RSA generation to be more readable

No major code changes. Just reduce the ifdef clutter.

3 years agoProvide identical BN_GENCB_new shim
Timo Teräs [Mon, 26 Dec 2022 14:55:48 +0000 (16:55 +0200)] 
Provide identical BN_GENCB_new shim

Instead of trying to optimize by using a stack local variable
with additional #ifdef logic, use identical implementations of
the upstream functions to reduce #ifdef clutter.

Move the definitions from dst_openssl.h to openssl_shim.h where
rest of the shim is.

3 years agoMerge branch '3785-openssl-refactoring-5' into 'main'
Ondřej Surý [Mon, 9 Jan 2023 14:20:38 +0000 (14:20 +0000)] 
Merge branch '3785-openssl-refactoring-5' into 'main'

Refactor OpenSSL RSA private key handling

Closes #3785

See merge request isc-projects/bind9!7318

3 years agoRefactor OpenSSL RSA private key handling
Timo Teräs [Mon, 26 Dec 2022 14:29:56 +0000 (16:29 +0200)] 
Refactor OpenSSL RSA private key handling

Instead of trying to enforce one pkey to contain both a private
and a public key pair, refactor the code to have separate public
and private pkeys.

This is a prerequisite for proper openssl 3.0 providers support
and greatly simplifies the code.

3 years agoMerge branch '3768-dns_zonemgr-use-after-free' into 'main'
Ondřej Surý [Mon, 9 Jan 2023 14:14:41 +0000 (14:14 +0000)] 
Merge branch '3768-dns_zonemgr-use-after-free' into 'main'

Fix a use-after-free bug in dns_zonemgr_releasezone()

Closes #3768

See merge request isc-projects/bind9!7303

3 years agoAdd a CHANGES note for [GL #3768]
Aram Sargsyan [Thu, 5 Jan 2023 15:07:42 +0000 (15:07 +0000)] 
Add a CHANGES note for [GL #3768]

3 years agoFix a use-after-free bug in dns_zonemgr_releasezone()
Aram Sargsyan [Thu, 5 Jan 2023 15:01:35 +0000 (15:01 +0000)] 
Fix a use-after-free bug in dns_zonemgr_releasezone()

The dns_zonemgr_releasezone() function makes a decision to destroy
'zmgr' (based on its references count, after decreasing it) inside
a lock, and then destroys the object outside of the lock.

This causes a race with dns_zonemgr_detach(), which could destroy
the object in the meantime.

Change dns_zonemgr_releasezone() to detach from 'zmgr' and destroy
the object (if needed) using dns_zonemgr_detach(), outside of the
lock.

3 years agoMerge branch '3785-openssl-refactoring-4' into 'main'
Ondřej Surý [Mon, 9 Jan 2023 14:03:03 +0000 (14:03 +0000)] 
Merge branch '3785-openssl-refactoring-4' into 'main'

Remove non-sensical RSA key compare tests

Closes #3785

See merge request isc-projects/bind9!7317

3 years agoMerge branch '3785-openssl-refactoring-3' into 'main'
Ondřej Surý [Mon, 9 Jan 2023 14:00:07 +0000 (14:00 +0000)] 
Merge branch '3785-openssl-refactoring-3' into 'main'

Refactor OpenSSL RSA exponent bits checking to a helper function

Closes #3785

See merge request isc-projects/bind9!7316

3 years agoRemove non-sensical RSA key compare tests
Timo Teräs [Mon, 26 Dec 2022 20:19:17 +0000 (22:19 +0200)] 
Remove non-sensical RSA key compare tests

The keys tested are not valid RSA keys as a single private
component was modified manually. The key would not pass
basic sanity test.

3 years agoRefactor OpenSSL RSA exponent bits checking to a helper function
Timo Teräs [Mon, 26 Dec 2022 12:25:18 +0000 (14:25 +0200)] 
Refactor OpenSSL RSA exponent bits checking to a helper function

- Make it a separate opensslrsa_check_exponent_bits() function to
  clean up the code a bit
- Always use provider API first if using openssl 3.0, and fallback
  to EVP API for older openssl or if built with engine support
- Use RSA_get0_key() (with shim for openssl 1.0) to avoid memory
  allocations

3 years agoMerge branch '3785-openssl-refactoring-2' into 'main'
Ondřej Surý [Mon, 9 Jan 2023 13:34:41 +0000 (13:34 +0000)] 
Merge branch '3785-openssl-refactoring-2' into 'main'

Refactor OpenSSL RSA type check to opensslrsa_valid_key_alg helper

Closes #3785

See merge request isc-projects/bind9!7315

3 years agoRefactor OpenSSL RSA type check to opensslrsa_valid_key_alg helper
Timo Teräs [Mon, 26 Dec 2022 11:40:38 +0000 (13:40 +0200)] 
Refactor OpenSSL RSA type check to opensslrsa_valid_key_alg helper

Move the repetetive code into a small opensslrsa_valid_key_alg() helper
function.

3 years agoMerge branch '3785-openssl-refactoring-1' into 'main'
Ondřej Surý [Mon, 9 Jan 2023 13:32:59 +0000 (13:32 +0000)] 
Merge branch '3785-openssl-refactoring-1' into 'main'

Remove obsolete and unused EVP_dss1 compat #define

Closes #3785

See merge request isc-projects/bind9!7314

3 years agoRemove obsolete and unused EVP_dss1 compat #define
Timo Teräs [Mon, 26 Dec 2022 08:27:56 +0000 (10:27 +0200)] 
Remove obsolete and unused EVP_dss1 compat #define

3 years agoMerge branch '3671-override-ISC_R_EXISTS-in-findnodeintree' into 'main'
Ondřej Surý [Mon, 9 Jan 2023 12:33:12 +0000 (12:33 +0000)] 
Merge branch '3671-override-ISC_R_EXISTS-in-findnodeintree' into 'main'

Change ISC_R_EXISTS to ISC_R_SUCCESS in dns/rbtdb.c:findnodeintree()

Closes #3671

See merge request isc-projects/bind9!7312

3 years agoChange ISC_R_EXISTS to ISC_R_SUCCESS in dns/rbtdb.c:findnodeintree()
Ondřej Surý [Mon, 9 Jan 2023 11:48:19 +0000 (12:48 +0100)] 
Change ISC_R_EXISTS to ISC_R_SUCCESS in dns/rbtdb.c:findnodeintree()

In the previous refactoring, the findnodeintree() function could return
ISC_R_EXISTS (from dns_db_addnode() call) instead of ISC_R_SUCCESS
leading to node being attached, but never detached.

Change the ISC_R_EXISTS result code returned from dns_rbt_addnode() to
the ISC_R_SUCCESS in the findnodeintree() function (called internally by
dns_db_findnode() and dns_db_findnsec3node()).

3 years agoMerge branch '3678-serve-stale-servfailing-unexpectedly' into 'main'
Matthijs Mekking [Mon, 9 Jan 2023 10:09:47 +0000 (10:09 +0000)] 
Merge branch '3678-serve-stale-servfailing-unexpectedly' into 'main'

Resolve "stale-serve and RPZ put in SERVFAIL cache unexpected record"

Closes #3678

See merge request isc-projects/bind9!7231

3 years agoAdd a CHANGES note for [GL #3678]
Aram Sargsyan [Thu, 17 Nov 2022 14:21:31 +0000 (14:21 +0000)] 
Add a CHANGES note for [GL #3678]

3 years agoConsider non-stale data when in serve-stale mode
Matthijs Mekking [Thu, 17 Nov 2022 13:52:26 +0000 (13:52 +0000)] 
Consider non-stale data when in serve-stale mode

With 'stale-answer-enable yes;' and 'stale-answer-client-timeout off;',
consider the following situation:

A CNAME record and its target record are in the cache, then the CNAME
record expires, but the target record is still valid.

When a new query for the CNAME record arrives, and the query fails,
the stale record is used, and then the query "restarts" to follow
the CNAME target. The problem is that the query's multiple stale
options (like DNS_DBFIND_STALEOK) are not reset, so 'query_lookup()'
treats the restarted query as a lookup following a failed lookup,
and returns a SERVFAIL answer when there is no stale data found in the
cache, even if there is valid non-stale data there available.

With this change, query_lookup() now considers non-stale data in the
cache in the first place, and returns it if it is available.

3 years agoAdd serve-stale CNAME check with stale-answer-client-timeout off
Aram Sargsyan [Thu, 17 Nov 2022 13:48:36 +0000 (13:48 +0000)] 
Add serve-stale CNAME check with stale-answer-client-timeout off

Prime the cache with the following records:

    shortttl.cname.example. 1 IN CNAME longttl.target.example.
    longttl.target.example. 600 IN A 10.53.0.2

Wait for the CNAME record to expire, disable the authoritative server,
and query 'shortttl.cname.example' again, expecting a stale answer.

3 years agoMerge branch '3770-separate-barriers' into 'main'
Evan Hunt [Mon, 9 Jan 2023 03:00:57 +0000 (03:00 +0000)] 
Merge branch '3770-separate-barriers' into 'main'

use separate barriers for "stop" and "listen" operations

Closes #3770

See merge request isc-projects/bind9!7308

3 years agouse separate barriers for "stop" and "listen" operations
Evan Hunt [Sun, 8 Jan 2023 00:30:21 +0000 (16:30 -0800)] 
use separate barriers for "stop" and "listen" operations

On some platforms, when a synchronizing barrier is cleared, one
thread can progress while other threads are still in the process
of releasing the barrier. If a barrier is reused by the progressing
thread during this window, it can cause a deadlock. This can occur if,
for example, we stop listening immediately after we start, because the
stop and listen functions both use socket->barrier.  This has been
addressed by using separate barrier objects for stop and listen.

3 years agoMerge branch 'ondrej/dns_rbtdb-locking-fixups' into 'main'
Ondřej Surý [Sat, 7 Jan 2023 06:15:07 +0000 (06:15 +0000)] 
Merge branch 'ondrej/dns_rbtdb-locking-fixups' into 'main'

Couple of small fixes in dns_rbtdb rwlock refactoring

See merge request isc-projects/bind9!7304

3 years agoDeduplicate DNS_RBTDB_STRONG_RWLOCK_CHECK macros
Ondřej Surý [Fri, 6 Jan 2023 07:49:11 +0000 (08:49 +0100)] 
Deduplicate DNS_RBTDB_STRONG_RWLOCK_CHECK macros

There were couple of redundant macros on both sides of
DNS_RBTDB_STRONG_RWLOCK_CHECK #ifdef block.  Use a single set of
macros, but disable the extra REQUIRES if the #define is not set.

3 years agoExtend expire_header() to check node lock type
Ondřej Surý [Thu, 5 Jan 2023 21:26:23 +0000 (22:26 +0100)] 
Extend expire_header() to check node lock type

Extend the expire_header() to accept the node lock type as one of the
arguments and check whether the the node lock is always write locked +
fix that bug.

While doing that, it was found that expire_header() invocation in
rdataset_expire() passes `false` as a type of tree lock instead of
`isc_rwlocktype_none`.

(Un)fortunately, both values mapped to 0, so no harm was done, but it
has been fixed nevertheless.

3 years agoReplace repetetive _TRYUPGRADE() with _FORCEUPGRADE() macros
Ondřej Surý [Thu, 5 Jan 2023 21:18:40 +0000 (22:18 +0100)] 
Replace repetetive _TRYUPGRADE() with _FORCEUPGRADE() macros

There was a repetetive pattern:

    if (NODE_TRYUPGRADE(&nodelock->lock, nlocktypep) != ISC_R_SUCCESS)
    {
        NODE_UNLOCK(&nodelock->lock, nlocktypep);
        NODE_WRLOCK(&nodelock->lock, nlocktypep);
    }

Instead of doing that over again, introduce new NODE_FORCEUPGRADE()
and TREE_FORCEUPGRADE() that does exactly this code, and simplify
the aforementioned code with just:

    NODE_FORCEUPGRADE(&nodelock->lock, nlocktypep);

3 years agoMerge branch 'ondrej/isc_loop-reference-tracking' into 'main'
Ondřej Surý [Thu, 5 Jan 2023 12:33:19 +0000 (12:33 +0000)] 
Merge branch 'ondrej/isc_loop-reference-tracking' into 'main'

Enhance the isc_loop unit to allow reference count tracking

See merge request isc-projects/bind9!7291

3 years agoEnhance the isc_loop unit to allow reference count tracking
Ondřej Surý [Mon, 2 Jan 2023 12:26:41 +0000 (13:26 +0100)] 
Enhance the isc_loop unit to allow reference count tracking

Use ISC_REFCOUNT_TRACE_{IMPL,DECL} to allow better isc_loop reference
tracking - use `#define ISC_LOOP_TRACE 1` in <isc/loop.h> to enable.

3 years agoMerge branch 'ondrej/enforce-thread-affinity-on-dnsstream' into 'main'
Ondřej Surý [Thu, 5 Jan 2023 12:33:02 +0000 (12:33 +0000)] 
Merge branch 'ondrej/enforce-thread-affinity-on-dnsstream' into 'main'

Enforce strong thread-affinity on StreamDNS sockets

See merge request isc-projects/bind9!7301

3 years agoEnforce strong thread-affinity on StreamDNS sockets
Ondřej Surý [Wed, 4 Jan 2023 17:07:00 +0000 (18:07 +0100)] 
Enforce strong thread-affinity on StreamDNS sockets

Add a check that the isc__nm_streamdns_read(), isc__nm_streamdns_send(),
and isc__nm_streamdns_close() are being called from the matching thread.