]> git.ipfire.org Git - thirdparty/bind9.git/log
thirdparty/bind9.git
3 years agoMerge branch 'pspacek/fix-dns_message_checksig-out-of-tree' into 'main'
Petr Špaček [Tue, 27 Sep 2022 11:22:56 +0000 (11:22 +0000)] 
Merge branch 'pspacek/fix-dns_message_checksig-out-of-tree' into 'main'

Fix dns_message_checksig fuzzer

Closes #3565

See merge request isc-projects/bind9!6822

3 years agoFix stack-use-after-scope in dns_message_checksig test
Ondřej Surý [Tue, 27 Sep 2022 11:00:09 +0000 (13:00 +0200)] 
Fix stack-use-after-scope in dns_message_checksig test

Previously stack with buffer for test dns message went out of scope
before the message was processed. For fuzz testing its better to avoid
allocation, so let's avoid allocations completely and use simplest
possible static buffer.

Fixes: #3565
3 years agoFix dns_message_checksig in out-of-tree setup
Petr Špaček [Tue, 27 Sep 2022 08:39:51 +0000 (10:39 +0200)] 
Fix dns_message_checksig in out-of-tree setup

Hardcoded path was missing FUZZDIR prefix.

Related: !5923

3 years agoDetect errors in fuzzer initialization
Petr Špaček [Tue, 27 Sep 2022 08:32:34 +0000 (10:32 +0200)] 
Detect errors in fuzzer initialization

Incomplete initialization typically causes mysterious failures later on,
so let's err out early.

3 years agoMerge branch 'mnowak/add-fedora-36' into 'main'
Michał Kępień [Tue, 27 Sep 2022 07:39:31 +0000 (07:39 +0000)] 
Merge branch 'mnowak/add-fedora-36' into 'main'

Add Fedora 36

See merge request isc-projects/bind9!6297

3 years agoAdd Fedora 36
Michal Nowak [Thu, 12 May 2022 15:09:05 +0000 (17:09 +0200)] 
Add Fedora 36

3 years agoMerge branch '3553-static-buffer-functions' into 'main'
Evan Hunt [Tue, 27 Sep 2022 07:23:06 +0000 (07:23 +0000)] 
Merge branch '3553-static-buffer-functions' into 'main'

change ISC__BUFFER macros to inline functions

See merge request isc-projects/bind9!6801

3 years agochange ISC__BUFFER macros to inline functions
Evan Hunt [Wed, 17 Aug 2022 20:39:38 +0000 (13:39 -0700)] 
change ISC__BUFFER macros to inline functions

previously, when ISC_BUFFER_USEINLINE was defined, macros were
used to implement isc_buffer primitives (isc_buffer_init(),
isc_buffer_region(), etc). these macros were missing the DbC
assertions for those primitives, which made it possible for
coding errors to go undetected.

adding the assertions to the macros caused compiler warnings on
some platforms. therefore, this commit converts the ISC__BUFFER
macros to static inline functions instead, with assertions included,
and eliminates the non-inline implementation from buffer.c.

the --enable-buffer-useinline configure option has been removed.

3 years agoMerge branch 'bug/main/doc-arm-rhel9' into 'main'
Petr Špaček [Mon, 26 Sep 2022 15:15:27 +0000 (15:15 +0000)] 
Merge branch 'bug/main/doc-arm-rhel9' into 'main'

Compatibility for building ARM on older sphinx

See merge request isc-projects/bind9!6815

3 years agoSimplify allowing warnings during ARM build
Petr Menšík [Mon, 26 Sep 2022 11:52:20 +0000 (13:52 +0200)] 
Simplify allowing warnings during ARM build

RHEL8 Sphinx does not support all features used in ARM building. But
with few emitted warnings it can build the documentation fine. Simplify
warnings acceptance by allowing make doc SPHINX_W=''.

3 years agoCompatibility for building ARM on older sphinx
Petr Menšík [Sat, 24 Sep 2022 18:22:20 +0000 (14:22 -0400)] 
Compatibility for building ARM on older sphinx

Make documentation building successful even on RHEL9 sphinx 3.4.3. It
does not like case-insensitive matching of terms, so provide lowercase
text description with Uppercase word reference.

3 years agoMerge branch 'ondrej-add-dns_message_checktsig-fuzzer' into 'main'
Petr Špaček [Mon, 26 Sep 2022 14:30:16 +0000 (14:30 +0000)] 
Merge branch 'ondrej-add-dns_message_checktsig-fuzzer' into 'main'

Add dns_message_checksig() fuzzer

See merge request isc-projects/bind9!5923

3 years agoAdd seed to reproduce issue memory leak in dns_message_checktsig
Petr Špaček [Mon, 26 Sep 2022 07:47:23 +0000 (09:47 +0200)] 
Add seed to reproduce issue memory leak in dns_message_checktsig

Related: #3547

3 years agoAdd CHANGES notes for [GL !5923]
Mark Andrews [Thu, 15 Sep 2022 03:48:46 +0000 (13:48 +1000)] 
Add CHANGES notes for [GL !5923]

3 years agoAdd the ability to dig to specify the signing time
Mark Andrews [Mon, 14 Mar 2022 06:42:08 +0000 (17:42 +1100)] 
Add the ability to dig to specify the signing time

3 years agoAllow dig to SIG(0) sign a message
Mark Andrews [Mon, 14 Mar 2022 02:43:07 +0000 (13:43 +1100)] 
Allow dig to SIG(0) sign a message

3 years agoAdd a SIG(0) request seed
Mark Andrews [Mon, 14 Mar 2022 06:39:43 +0000 (17:39 +1100)] 
Add a SIG(0) request seed

3 years agoAdd TSIG reply seed
Mark Andrews [Wed, 9 Mar 2022 07:15:55 +0000 (18:15 +1100)] 
Add TSIG reply seed

3 years agoAdd TSIG request seed
Mark Andrews [Mon, 7 Mar 2022 23:32:50 +0000 (10:32 +1100)] 
Add TSIG request seed

3 years agoAdd dns_message_checksig() fuzzer
Ondřej Surý [Wed, 2 Mar 2022 10:48:26 +0000 (11:48 +0100)] 
Add dns_message_checksig() fuzzer

dns_message_checksig is called in a number of scenarios

* on requests and responses
* on multiple opcodes
* with and without signatures
* with TSIG signatures
* with SIG(0) signatures
* with and without configured TSIG keys
* with and without KEY records being present
* signing performed now, in the future and in the past

we use the first two octets of the seed to configure the calling
environment with the remainder of the seed being the rdata of the
TSIG/SIG(0) record.

3 years agoAdd the ability specify the signing / verification time
Ondřej Surý [Wed, 2 Mar 2022 10:48:26 +0000 (11:48 +0100)] 
Add the ability specify the signing / verification time

When fuzzing it is useful for all signing operations to happen
at a specific time for reproducability.  Add two variables to
the message structure (fuzzing and fuzztime) to specify if a
fixed time should be used and the value of that time.

3 years agoMerge branch 'ondrej-use-uv_random' into 'main'
Ondřej Surý [Mon, 26 Sep 2022 13:32:41 +0000 (13:32 +0000)] 
Merge branch 'ondrej-use-uv_random' into 'main'

Switch the CSPRNG function from RAND_bytes() to uv_random()

See merge request isc-projects/bind9!6803

3 years agoAdd CHANGES note for [GL !6803]
Ondřej Surý [Mon, 26 Sep 2022 07:37:28 +0000 (09:37 +0200)] 
Add CHANGES note for [GL !6803]

3 years agoSwitch the CSPRNG function from RAND_bytes() to uv_random()
Ondřej Surý [Thu, 22 Sep 2022 08:36:53 +0000 (10:36 +0200)] 
Switch the CSPRNG function from RAND_bytes() to uv_random()

The RAND_bytes() implementation differs between the OpenSSL versions and
uses the system entropy only for seeding its internal CSPRNG.  The
uv_random() on the other hand uses the system provided CSPRNG.

Switch from RAND_bytes() to uv_random() to use system provided CSPRNG.

3 years agoMerge branch '3547-dns_message_checksig-leak-fix' into 'main'
Petr Špaček [Mon, 26 Sep 2022 09:55:40 +0000 (09:55 +0000)] 
Merge branch '3547-dns_message_checksig-leak-fix' into 'main'

Fix memory leak in dns_message_checksig() - SIG(0) sigs

Closes #3547

See merge request isc-projects/bind9!6787

3 years agoStop passing mctx to dns_rdata_tostruct as it is unnecessary for SIG
Mark Andrews [Wed, 21 Sep 2022 01:54:48 +0000 (11:54 +1000)] 
Stop passing mctx to dns_rdata_tostruct as it is unnecessary for SIG

dns_rdata_tostruct doesn't need a mctx passed to it for SIG (the signer
is already expanded at this point). About the only time when mctx is
needed is when the structure is to be used after the rdata has been
destroyed.

3 years agoFix memory leak in dns_message_checksig() - SIG(0) sigs
Petr Špaček [Mon, 19 Sep 2022 07:07:51 +0000 (09:07 +0200)] 
Fix memory leak in dns_message_checksig() - SIG(0) sigs

Impact should be visible only in tests or tools because named never
uses view == NULL, which is a necessary condition to trigger this leak.

3 years agoMerge branch '1781-nsupdate-dot' into 'main'
Arаm Sаrgsyаn [Fri, 23 Sep 2022 16:10:05 +0000 (16:10 +0000)] 
Merge branch '1781-nsupdate-dot' into 'main'

Implement DoT support for nsupdate

Closes #1781

See merge request isc-projects/bind9!6752

3 years agoAdd a release note for [GL #1781]
Aram Sargsyan [Wed, 21 Sep 2022 15:15:26 +0000 (15:15 +0000)] 
Add a release note for [GL #1781]

3 years agoAdd a CHANGES note for [GL #1781]
Aram Sargsyan [Wed, 21 Sep 2022 15:11:22 +0000 (15:11 +0000)] 
Add a CHANGES note for [GL #1781]

3 years agoDocument nsupdate options related to DoT
Aram Sargsyan [Wed, 21 Sep 2022 15:05:11 +0000 (15:05 +0000)] 
Document nsupdate options related to DoT

Add documentation for the newly implemented DoT feature of the
nsupdate program.

3 years agoExtend the nsupdate system test with DoT-related checks
Aram Sargsyan [Wed, 21 Sep 2022 13:15:50 +0000 (13:15 +0000)] 
Extend the nsupdate system test with DoT-related checks

Add a simple test PKI based on the existing one in the doth test.

Check ephemeral, forward-secrecy, and forward-secrecy-mutual-tls
TLS configurations with different scenarios.

3 years agoFix a typo in doth system test's CA.cfg
Aram Sargsyan [Wed, 21 Sep 2022 08:25:52 +0000 (08:25 +0000)] 
Fix a typo in doth system test's CA.cfg

The comments in CA.cfg file serve as a good tutorial for setting up
a simple PKI for a system test. There is a typo in one of the presented
commands, which results in openssl not exiting with an error message
instead of generating a certificate.

Fix the typo.

3 years agoImplement DoT support for nsupdate
Aram Sargsyan [Wed, 21 Sep 2022 08:20:22 +0000 (08:20 +0000)] 
Implement DoT support for nsupdate

Implement DNS-over-TLS support for nsupdate. Use DiG's DoT
implementation as a model for the newly added features.

3 years agoMerge branch 'bug/main/sha1-disabled-fedora-rhbz2122841' into 'main'
Mark Andrews [Fri, 23 Sep 2022 03:50:50 +0000 (03:50 +0000)] 
Merge branch 'bug/main/sha1-disabled-fedora-rhbz2122841' into 'main'

Engine pkcs11 cannot work with OSSL_PARAM on OpenSSL 3.0

See merge request isc-projects/bind9!6711

3 years agoAdd release note for [GL !6711]
Mark Andrews [Wed, 14 Sep 2022 02:53:42 +0000 (12:53 +1000)] 
Add release note for [GL !6711]

3 years agoAdd a CHANGES note for [GL !6711]
Mark Andrews [Wed, 14 Sep 2022 02:50:40 +0000 (12:50 +1000)] 
Add a CHANGES note for [GL !6711]

3 years agoReport how named was built
Mark Andrews [Wed, 14 Sep 2022 02:08:00 +0000 (12:08 +1000)] 
Report how named was built

3 years agoBuild against OpenSSL 3.0 in OpenSSL 1.1.0 compatibility mode
Mark Andrews [Wed, 14 Sep 2022 01:49:18 +0000 (11:49 +1000)] 
Build against OpenSSL 3.0 in OpenSSL 1.1.0 compatibility mode

3 years agoLet Debian sid image leverage PKCS#11 with OpenSSL 3
Michal Nowak [Tue, 13 Sep 2022 17:44:37 +0000 (19:44 +0200)] 
Let Debian sid image leverage PKCS#11 with OpenSSL 3

3 years agoUpdate reference to point to doc/arm/build.inc.rst
Mark Andrews [Tue, 13 Sep 2022 07:09:55 +0000 (17:09 +1000)] 
Update reference to point to doc/arm/build.inc.rst

3 years agoDocument -DOPENSSL_API_COMPAT=10100 in OPTIONS.md
Mark Andrews [Tue, 13 Sep 2022 07:06:52 +0000 (17:06 +1000)] 
Document -DOPENSSL_API_COMPAT=10100 in OPTIONS.md

3 years agoRemove engine related parts for OpenSSL 3.0
Petr Menšík [Thu, 8 Sep 2022 14:33:38 +0000 (16:33 +0200)] 
Remove engine related parts for OpenSSL 3.0

OpenSSL just cannot work with mixing ENGINE_* api mixed with OSSL_PARAM
builders. But it can be built in legacy mode, where deprecated but still
working API would be used.

It can work under OpenSSL 3.0, but only if using legacy code paths
matching OpenSSL 1.1 calls and functions.

Remove fromlabel processing by OpenSSL 3.0 only functions. They can
return later with a proper provider support for pkcs11.

3 years agoDo not use OSSL_PARAM when engine API is compiled
Petr Menšík [Thu, 8 Sep 2022 15:19:20 +0000 (17:19 +0200)] 
Do not use OSSL_PARAM when engine API is compiled

OpenSSL has deprecated many things in version 3.0. If pkcs11 engine
should work then no builder from OpenSSL 3.0 API can be used.

Allow switching to OpenSSL 1.1 like calls even on OpenSSL 3.0 when
OPENSSL_API_COMPAT=10100 is defined. It would still compile and allow
working keys loading from the engine passed on command line.

3 years agoAdd ENGINE_init and ENGINE_finish calls
Petr Menšík [Wed, 7 Sep 2022 11:46:31 +0000 (13:46 +0200)] 
Add ENGINE_init and ENGINE_finish calls

According to manual page of ENGINE_init, it should be called explicitly
before any key operations happens. Make it active whole lifetime.

3 years agoMerge branch 'pspacek/fix-out-of-tree-junit' into 'main'
Petr Špaček [Thu, 22 Sep 2022 14:16:05 +0000 (14:16 +0000)] 
Merge branch 'pspacek/fix-out-of-tree-junit' into 'main'

Improve JUnit test status generator for Gitlab CI

See merge request isc-projects/bind9!6166

3 years agoUnify Python interpreter used by TSAN and JUnit helpers
Petr Špaček [Wed, 1 Jun 2022 11:46:02 +0000 (13:46 +0200)] 
Unify Python interpreter used by TSAN and JUnit helpers

Reportedly we don't have python2-enabled TSAN builds, so we can remove
one more hardcoded python3 call from .gitlab-ci.yaml.

3 years agoFix JUnit test status generator for out-of-tree system tests
Petr Špaček [Fri, 22 Apr 2022 15:35:56 +0000 (17:35 +0200)] 
Fix JUnit test status generator for out-of-tree system tests

- Use separate paths for tests results and test script
- For tarball tests include the conversion script in the `make dist`

3 years agoMerge branch 'ondrej-loopmgr-cleanup-tcp-implementation' into 'main'
Ondřej Surý [Thu, 22 Sep 2022 12:58:32 +0000 (12:58 +0000)] 
Merge branch 'ondrej-loopmgr-cleanup-tcp-implementation' into 'main'

Cleanup the asychronous code in the TCP implementation

See merge request isc-projects/bind9!6703

3 years agoCleanup the asychronous code in the stream implementations
Ondřej Surý [Mon, 29 Aug 2022 08:55:10 +0000 (10:55 +0200)] 
Cleanup the asychronous code in the stream implementations

After the loopmgr work has been merged, we can now cleanup the TCP and
TLS protocols a little bit, because there are stronger guarantees that
the sockets will be kept on the respective loops/threads.  We only need
asynchronous call for listening sockets (start, stop) and reading from
the TCP (because the isc_nm_read() might be called from read callback
again.

This commit does the following changes (they are intertwined together):

1. Cleanup most of the asynchronous events in the TCP code, and add
   comments for the events that needs to be kept asynchronous.

2. Remove isc_nm_resumeread() from the netmgr API, and replace
   isc_nm_resumeread() calls with existing isc_nm_read() calls.

3. Remove isc_nm_pauseread() from the netmgr API, and replace
   isc_nm_pauseread() calls with a new isc_nm_read_stop() call.

4. Disable the isc_nm_cancelread() for the streaming protocols, only the
   datagram-like protocols can use isc_nm_cancelread().

5. Add isc_nmhandle_close() that can be used to shutdown the socket
  earlier than after the last detach.  Formerly, the socket would be
  closed only after all reading and sending would be finished and the
  last reference would be detached.  The new isc_nmhandle_close() can
  be used to close the underlying socket earlier, so all the other
  asynchronous calls would call their respective callbacks immediately.

Co-authored-by: Ondřej Surý <ondrej@isc.org>
Co-authored-by: Artem Boldariev <artem@isc.org>
3 years agoMerge branch '1967-prevent-generating-broken-glueless-referrals' into 'main'
Michał Kępień [Thu, 22 Sep 2022 12:23:22 +0000 (12:23 +0000)] 
Merge branch '1967-prevent-generating-broken-glueless-referrals' into 'main'

Prevent generating broken glueless referrals

Closes #1967

See merge request isc-projects/bind9!4122

3 years agoAdd CHANGES and release notes for [GL #1967]
Michał Kępień [Thu, 22 Sep 2022 12:03:17 +0000 (14:03 +0200)] 
Add CHANGES and release notes for [GL #1967]

3 years agoEnsure required cached glue is rendered
Michał Kępień [Thu, 22 Sep 2022 12:03:17 +0000 (14:03 +0200)] 
Ensure required cached glue is rendered

When looking for required glue, dns_message_rendersection() only
processes the first rdataset associated with the first name added to the
ADDITIONAL section.  If the DNS_RDATASETATTR_REQUIRED attribute is set
for an rdataset which is located somewhere else (i.e. the name it is
associated with is preceded by another name in the ADDITIONAL section),
it will not be honored, i.e. the TC bit will not be set even if the
rdataset does not fit into the response.

Check the attributes of each processed rdataset while appending names to
a referral response based on a glue cache entry.  If a given rdataset is
marked with DNS_RDATASETATTR_REQUIRED, make sure the name it is
associated with is added to the response at the beginning of the
ADDITIONAL section, not its end.

Note that using ISC_LIST_PREPEND() instead of ISC_LIST_APPEND() is not
necessary when associating the rdataset with its owner name because the
dns_name_t structures are initialized just before the glue rdatasets are
associated with them and therefore they are empty at that point, which
means no other (non-required) rdataset can precede the glue rdatasets
within the dns_name_t structure owning them.

3 years agoMark required glue during glue cache processing
Michał Kępień [Thu, 22 Sep 2022 12:03:17 +0000 (14:03 +0200)] 
Mark required glue during glue cache processing

If an NS RRset at the parent side of a delegation point only contains
in-bailiwick NS records, at least one glue record should be included in
every referral response sent for such a delegation point or else clients
will need to send follow-up queries in order to determine name server
addresses.  In certain edge cases (when the total size of a referral
response without glue records was just below to the UDP packet size
limit), named failed to adhere to that rule by sending non-truncated,
glueless referral responses.

Fix the problem by marking all in-bailiwick NS records processed by
glue_nsdname_cb() (the dns_rdataset_additionaldata() callback used by
RBTDB code while iterating over an NS RRset when dns_rdataset_addglue()
is called) with the DNS_RDATASETATTR_REQUIRED flag.  Note that for
simplicity, glue RRsets for all in-bailiwick NS records are marked this
way, even though dns_message_rendersection() only checks the attributes
for the first rdataset associated with the first name added to the
ADDITIONAL section.

3 years agoAdd tests for broken glueless referrals
Michał Kępień [Thu, 22 Sep 2022 12:03:17 +0000 (14:03 +0200)] 
Add tests for broken glueless referrals

If an NS RRset at the parent side of a delegation point only contains
in-bailiwick NS records, at least one glue record should be included in
every referral response sent for such a delegation point or else clients
will need to send follow-up queries in order to determine name server
addresses.  In certain edge cases (when the total size of a referral
response without glue records was just below to the UDP packet size
limit), named failed to adhere to that rule by sending non-truncated,
glueless referral responses.

Add tests attempting to trigger that bug in several different scenarios,
covering all possible combinations of the following factors:

  - type of zone (signed, unsigned),
  - glue record type (A, AAAA, both).

3 years agoClean up the "glue" system test
Michał Kępień [Thu, 22 Sep 2022 12:03:17 +0000 (14:03 +0200)] 
Clean up the "glue" system test

Bring the "glue" system test up to speed with other system tests: add
check numbering, ensure test artifacts are preserved upon failure,
improve error reporting, make the test fail upon unexpected errors,
address ShellCheck warnings.

3 years agoMerge branch '3548-without-system-jemalloc' into 'main'
Tony Finch [Thu, 22 Sep 2022 08:40:02 +0000 (08:40 +0000)] 
Merge branch '3548-without-system-jemalloc' into 'main'

A more helpful error when --without-jemalloc is impossible

Closes #3548

See merge request isc-projects/bind9!6796

3 years agoA more helpful error when --without-jemalloc is impossible
Tony Finch [Wed, 21 Sep 2022 16:44:48 +0000 (17:44 +0100)] 
A more helpful error when --without-jemalloc is impossible

When jemalloc is the system allocator (on FreeBSD and NetBSD), trying
to build --without-jemalloc caused an obscure compiler error. Instead,
complain at configure time that --without-jemalloc cannot work. (It
needs to remain an error because it is vexing when configure quietly
ignores an explicit direction.)

3 years agoMerge branch '3202-convert-isc_timer-to-use-uv_loop' into 'main'
Ondřej Surý [Thu, 22 Sep 2022 08:21:35 +0000 (08:21 +0000)] 
Merge branch '3202-convert-isc_timer-to-use-uv_loop' into 'main'

Resolve "Convert the isc_timer API to use isc_nm loops"

Closes #3202 and #3532

See merge request isc-projects/bind9!6763

3 years agoAdd CHANGES note for [GL #3202]
Ondřej Surý [Tue, 13 Sep 2022 15:33:55 +0000 (17:33 +0200)] 
Add CHANGES note for [GL #3202]

3 years agoAdd more unit tests for isc_timer
Ondřej Surý [Thu, 22 Sep 2022 07:43:19 +0000 (09:43 +0200)] 
Add more unit tests for isc_timer

Add more tests that deal with rescheduling and restarting the existing
timer and measure that the timer fired at the expected intervals.

3 years agoWait for the telemetry check to finish
Ondřej Surý [Thu, 22 Sep 2022 07:45:54 +0000 (09:45 +0200)] 
Wait for the telemetry check to finish

Instead of expecting that telemetry check has already finished,
wait for it for maximum of three seconds, because named is run with
-tat=3, so the telemetry check must happen with 3 second window.

Co-authored-by: Evan Hunt <each@isc.org>
3 years agoRequire isc_timer to be manipulated on the timer loop
Ondřej Surý [Mon, 12 Sep 2022 09:06:09 +0000 (11:06 +0200)] 
Require isc_timer to be manipulated on the timer loop

Each isc_timer needs to be created, started and destroyed on the current
loop.  The isc_timer_stop() can be run on any loop, but when run from
different loop than the one associated with the timer, the request to
stop the timer will be recorded in atomic variable and the underlying
uv_timer_t will be stopped on next uv_timer_t callback call.  This
allows any thread to stop the timer.

3 years agoCreate the negative trust anchor timer on the current loop
Ondřej Surý [Mon, 12 Sep 2022 14:36:30 +0000 (16:36 +0200)] 
Create the negative trust anchor timer on the current loop

Instead of always creating the trust anchor timer (dns_nta_t) on the
main loop, create the timer on the current loop and associate each
dns_nta_t object to the loop it was created on.  This simplifies the
timer handling as everything is run on the associated loop.

During the change, the dns_nta_t structure was renamed to dns__nta_t
and changed to be fully internal to the nta.c compilation unit, and the
dns_ntatable_t structure was made opaque.  This required no change to
code using the API as dns_nta_t never had any external users and the
dns_ntatable_t was properly accessed only by using function calls.

3 years agoCreate the response policy zones update timer on demand
Ondřej Surý [Mon, 12 Sep 2022 14:36:24 +0000 (16:36 +0200)] 
Create the response policy zones update timer on demand

Instead of creating the response policy zone deferred update timer when
creating the response policy zone object, create it on demand on the
current loop and destroy it as soon as the timer has finished its job.
There's a side-effect - the processing of the response policy zone
update is now done on the current loop - previously, it was always on
the main loop.

3 years agoCreate the catalog zones update timer on demand
Ondřej Surý [Mon, 12 Sep 2022 14:36:19 +0000 (16:36 +0200)] 
Create the catalog zones update timer on demand

Instead of creating the catalog zone deferred update timer when creating
the catalog zone object, create it on demand on the current loop and
destroy it as soon as the timer has finished its job.  There's a
side-effect - the processing of the catalog zone update is now done on
the current loop - previously, it was always on the main loop.

3 years agoCreate the spillattimer when needed and destroy it early
Ondřej Surý [Mon, 12 Sep 2022 12:51:33 +0000 (14:51 +0200)] 
Create the spillattimer when needed and destroy it early

Instead of creating dns_resolver .spillattimer when the dns_resolver_t
object is created, create it on the current loop as needed and destroy
it as soon as the timer has finished its job.  This avoids the need to
manipulate the timer from a different thread.

3 years agoCreate the fetch context timer on the matching thread
Ondřej Surý [Mon, 12 Sep 2022 11:22:38 +0000 (13:22 +0200)] 
Create the fetch context timer on the matching thread

In the dns_resolver API, delay creating the fetch context timer, so it
is created on the thread/loop associated to the fetch context.

3 years agoCreate the zone timers on the zone->loop
Ondřej Surý [Mon, 12 Sep 2022 09:18:41 +0000 (11:18 +0200)] 
Create the zone timers on the zone->loop

Instead of creating the zone timers at the zone creation time (which
could be any thread), create the zone timer from the isc_loop that has
beena assigned to the zone (zone->loop);

3 years agoConvert isc_ratelimiter API to use on-loop timers
Ondřej Surý [Mon, 12 Sep 2022 09:05:22 +0000 (11:05 +0200)] 
Convert isc_ratelimiter API to use on-loop timers

In preparation for the on-loop timers, the isc_ratelimiter API was
converted to use the timer on main loop and start and stop the timer
asynchronously on the main loop.

3 years agoAdd isc_timer_async_destroy() helper function
Ondřej Surý [Mon, 12 Sep 2022 14:35:55 +0000 (16:35 +0200)] 
Add isc_timer_async_destroy() helper function

As it sometimes happens that the object using isc_timer_t is destroyed
via detaching all the references with no guarantee that the last thread
will be matching thread, add a helper isc_timer_async_destroy() function
that stops the timer and runs the destroy function via isc_async_run()
on the matching thread.

3 years agoMerge branch '3553-httpd-cleanup' into 'main'
Evan Hunt [Wed, 21 Sep 2022 19:53:50 +0000 (19:53 +0000)] 
Merge branch '3553-httpd-cleanup' into 'main'

additional code cleanups in httpd.c

See merge request isc-projects/bind9!6798

3 years agoadditional code cleanups in httpd.c
Evan Hunt [Tue, 16 Aug 2022 23:26:02 +0000 (16:26 -0700)] 
additional code cleanups in httpd.c

- use isc_buffer functions when appropriate, rather than converting
  to and from isc_region unnecessarily
- use the zlib total_out value instead of calculating it
- use c99 struct initialization

3 years agoMerge branch 'fanf-random-init-fuzz' into 'main'
Tony Finch [Wed, 21 Sep 2022 15:02:04 +0000 (15:02 +0000)] 
Merge branch 'fanf-random-init-fuzz' into 'main'

Ensure the first random number is non-zero when fuzzing

See merge request isc-projects/bind9!6794

3 years agoEnsure the first random number is non-zero when fuzzing
Tony Finch [Wed, 21 Sep 2022 11:21:32 +0000 (12:21 +0100)] 
Ensure the first random number is non-zero when fuzzing

In fuzzing mode, `isc_random` uses a fixed seed for reproducibility.
The particular seed chosen happened to produce zero as its first
number, however commit bd251de0 introduced an initialization check in
`random_test` that required it to be non-zero. This change adjusts the
seed to avoid spurious test failures.

Also, remove the temporary variable that was used for initialization
because it did not match the type of the thread-local seed array.

3 years agoMerge tag 'v9_19_5'
Michał Kępień [Wed, 21 Sep 2022 11:04:58 +0000 (13:04 +0200)] 
Merge tag 'v9_19_5'

BIND 9.19.5

3 years agoMerge branch '3529-tls-transport-support-in-dns_request-and-dns_dispatch' into 'main'
Arаm Sаrgsyаn [Mon, 19 Sep 2022 17:14:18 +0000 (17:14 +0000)] 
Merge branch '3529-tls-transport-support-in-dns_request-and-dns_dispatch' into 'main'

Resolve "Implement TLS transport support for dns_request"

Closes #3529

See merge request isc-projects/bind9!6751

3 years agoAdd CHANGES note for [GL #3529]
Aram Sargsyan [Mon, 19 Sep 2022 14:14:50 +0000 (14:14 +0000)] 
Add CHANGES note for [GL #3529]

3 years agoTest TLS transport in dispatch_test.c
Aram Sargsyan [Mon, 19 Sep 2022 12:33:32 +0000 (12:33 +0000)] 
Test TLS transport in dispatch_test.c

Add a new check in dispatch_test.c unit test to confirm that sending
and receiving data using TLS transport works.

3 years agoImplement TLS transport support for dns_request and dns_dispatch
Aram Sargsyan [Mon, 19 Sep 2022 11:04:22 +0000 (11:04 +0000)] 
Implement TLS transport support for dns_request and dns_dispatch

This change prepares ground for sending DNS requests using DoT,
which, in particular, will be used for forwarding dynamic updates
to TLS-enabled primaries.

3 years agoConvert xfrin.c:get_create_tlsctx() into a library function
Aram Sargsyan [Mon, 19 Sep 2022 10:24:20 +0000 (10:24 +0000)] 
Convert xfrin.c:get_create_tlsctx() into a library function

In order to make xfrin.c:get_create_tlsctx() reusable, move the function
into transport.c, and make changes into its prototype to not use the
'dns_xfrin_ctx_t' type, thus making it more universal.

This change prepares ground for adding transport support into the
dispatch manager.

Also, move the typedefs for 'dns_transport_t' and 'dns_transport_list_t'
from transport.h into types.h.

3 years agoMerge branch 'ondrej-move-random-number-re-seeding-out-of-the-hot-path' into 'main'
Ondřej Surý [Mon, 19 Sep 2022 14:47:38 +0000 (14:47 +0000)] 
Merge branch 'ondrej-move-random-number-re-seeding-out-of-the-hot-path' into 'main'

Move random number re-seeding out of the hot path

See merge request isc-projects/bind9!6173

3 years agoMove random number re-seeding out of the hot path
Tony Finch [Fri, 22 Apr 2022 13:35:36 +0000 (14:35 +0100)] 
Move random number re-seeding out of the hot path

Instead of checking if we need to re-seed for every isc_random call,
seed the random number generator in the libisc global initializer
and the per-thread initializer.

3 years agoMerge branch 'ondrej-unsigned-to-unsigned_int' into 'main'
Ondřej Surý [Mon, 19 Sep 2022 14:02:00 +0000 (14:02 +0000)] 
Merge branch 'ondrej-unsigned-to-unsigned_int' into 'main'

Add semantic patch to use 'unsigned int' instead of 'unsigned'

See merge request isc-projects/bind9!6741

3 years agoUse the semantic patch to do the unsigned -> unsigned int change
Ondřej Surý [Wed, 7 Sep 2022 15:22:47 +0000 (17:22 +0200)] 
Use the semantic patch to do the unsigned -> unsigned int change

Apply the semantic patch on the whole code base to get rid of 'unsigned'
usage in favor of explicit 'unsigned int'.

3 years agoAdd semantic patch to use 'unsigned int' instead of 'unsigned'
Ondřej Surý [Wed, 7 Sep 2022 15:16:17 +0000 (17:16 +0200)] 
Add semantic patch to use 'unsigned int' instead of 'unsigned'

Add a very simple patch to enforce usage of 'unsigned int' instead of
just 'unsigned' for the consistency through the whole source code.

3 years agoMerge branch '3510-disable-stringop-overread' into 'main'
Ondřej Surý [Mon, 19 Sep 2022 13:51:16 +0000 (13:51 +0000)] 
Merge branch '3510-disable-stringop-overread' into 'main'

Disable stringop-overread with gcc-11+ Address Sanitizer

Closes #3510

See merge request isc-projects/bind9!6747

3 years agoDisable stringop-overread with gcc-11+ Address Sanitizer
Ondřej Surý [Thu, 8 Sep 2022 05:33:31 +0000 (07:33 +0200)] 
Disable stringop-overread with gcc-11+ Address Sanitizer

When Address Sanitizer is enabled in gcc-11+, number of false positives
might appear like this:

    netmgr/udp.c: In function 'isc__nm_udp_send':
    netmgr/udp.c:729:13: warning: 'uv_udp_send' reading 16 bytes from a region of size 8 [-Wstringop-overread]
      729 |         r = uv_udp_send(&uvreq->uv_req.udp_send, &sock->uv_handle.udp,
  |             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      730 |                         &uvreq->uvbuf, 1, sa, udp_send_cb);
          |                         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    netmgr/udp.c:729:13: note: referencing argument 3 of type 'const uv_buf_t[0]'
    In file included from ./include/isc/uv.h:17,
                     from ./include/isc/barrier.h:31,
                     from netmgr/udp.c:17:
    /usr/include/uv.h:711:15: note: in a call to function 'uv_udp_send'
      711 | UV_EXTERN int uv_udp_send(uv_udp_send_t* req,
          |               ^~~~~~~~~~~

Disable the warning globally in the autoconf, instead of just locally in
a single CI job, as it might affect people outside our GitLab CI.

3 years agoMerge branch 'ondrej-netmgr-simplify-uv_close' into 'main'
Ondřej Surý [Mon, 19 Sep 2022 12:43:39 +0000 (12:43 +0000)] 
Merge branch 'ondrej-netmgr-simplify-uv_close' into 'main'

Reorder the uv_close() calls to close the socket immediately

See merge request isc-projects/bind9!6704

3 years agoAdd missing isc_refcount_destroy() for isc__nmsocket_t
Ondřej Surý [Mon, 29 Aug 2022 11:42:14 +0000 (13:42 +0200)] 
Add missing isc_refcount_destroy() for isc__nmsocket_t

The destructor for the isc__nmsocket_t was missing call to the
isc_refcount_destroy() on the reference counter, which might lead to
spurious ThreadSanitizer data race warnings if we ever change the
acquire-release memory order in the isc_refcount_decrement().

3 years agoReorder the uv_close() calls to close the socket immediately
Ondřej Surý [Mon, 29 Aug 2022 10:11:37 +0000 (12:11 +0200)] 
Reorder the uv_close() calls to close the socket immediately

Simplify the closing code - during the loopmgr implementation, it was
discovered that the various lists used by the uv_loop_t aren't FIFO, but
LIFO.  See doc/dev/libuv.md for more details.

With this knowledge, we can close the protocol handles (uv_udp_t and
uv_tcp_t) and uv_timer_t at the same time by reordering the uv_close()
calls, and thus making sure that after calling the
isc__nm_stoplistening(), the code will not issue any additional callback
calls (accept, read) on the socket that stopped listening.

This might help with the TLS and DoH shutting down sequence as described
in the [GL #3509] as we now stop the reading, stop the timer and call
the uv_close() as earliest as possible.

3 years agoAdd developer note for the libuv quirks
Ondřej Surý [Mon, 29 Aug 2022 12:30:54 +0000 (14:30 +0200)] 
Add developer note for the libuv quirks

3 years agoMerge branch '3545-prevent-unexpected-client-read-callbacks' into 'main'
Ondřej Surý [Mon, 19 Sep 2022 12:38:04 +0000 (12:38 +0000)] 
Merge branch '3545-prevent-unexpected-client-read-callbacks' into 'main'

Prevent unexpected UDP client read callbacks

Closes #3545

See merge request isc-projects/bind9!6777

3 years agoAdd CHANGES note for [GL #3545]
Ondřej Surý [Thu, 15 Sep 2022 08:17:42 +0000 (10:17 +0200)] 
Add CHANGES note for [GL #3545]

3 years agoImprove the udp_shutdown_read and udp_cancel_read tests
Ondřej Surý [Mon, 19 Sep 2022 09:40:15 +0000 (11:40 +0200)] 
Improve the udp_shutdown_read and udp_cancel_read tests

In the udp_shutdown_read unit test, delay the isc_loopmgr_shutdown() to
the send callback, and in the udp_cancel_read test wait for a single
timed out test, then read again, send an UDP packet and cancel the read
from the send callback.

3 years agoPrevent unexpected UDP client read callbacks
Ondřej Surý [Thu, 15 Sep 2022 07:48:34 +0000 (09:48 +0200)] 
Prevent unexpected UDP client read callbacks

The network manager UDP code was misinterpreting when the libuv called
the udp_recv_cb with nrecv == 0 and addr == NULL -> this doesn't really
mean that the "stream" has ended, but the libuv indicates that the
receive buffer can be freed.  This could lead to assertion failure in
the code that calls isc_nm_read() from the network manager read callback
due to the extra spurious callbacks.

Properly handle the extra callback calls from the libuv in the client
read callback, and refactor the UDP isc_nm_read() implementation to be
synchronous, so no datagram is lost between the time that we stop the
reading from the UDP socket and we restart it again in the asychronous
udpread event.

Add a unit test that tests the isc_nm_read() call from the read
callback to receive two datagrams.

3 years agoMerge branch '3522-update-detach' into 'main'
Evan Hunt [Thu, 15 Sep 2022 18:33:51 +0000 (18:33 +0000)] 
Merge branch '3522-update-detach' into 'main'

fix an incorrect detach in update processing

Closes #3522

See merge request isc-projects/bind9!6722

3 years agoCHANGES for [GL #3522]
Evan Hunt [Fri, 2 Sep 2022 21:47:12 +0000 (14:47 -0700)] 
CHANGES for [GL #3522]

3 years agofix an incorrect detach in update processing
Evan Hunt [Fri, 2 Sep 2022 21:44:58 +0000 (14:44 -0700)] 
fix an incorrect detach in update processing

when processing UDPATE requests, hold the request handle until
we either drop the request or respond to it.

3 years agoMerge branch '3427-tcp-system-test-bump-socket.create_connection-timeout' into 'main'
Michal Nowak [Thu, 15 Sep 2022 10:19:51 +0000 (10:19 +0000)] 
Merge branch '3427-tcp-system-test-bump-socket.create_connection-timeout' into 'main'

Bump socket.create_connection() timeout to 10 seconds

Closes #3427

See merge request isc-projects/bind9!6757