]> git.ipfire.org Git - thirdparty/bind9.git/log
thirdparty/bind9.git
3 years agochange ISC__BUFFER macros to inline functions each-static-buffer-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 '3520-rndc-shutdown-hang' into 'main'
Evan Hunt [Mon, 12 Sep 2022 20:34:32 +0000 (20:34 +0000)] 
Merge branch '3520-rndc-shutdown-hang' into 'main'

prevent a possible shutdown hang in rndc

See merge request isc-projects/bind9!6734

3 years agoprevent a possible shutdown hang in rndc
Evan Hunt [Tue, 6 Sep 2022 21:13:23 +0000 (14:13 -0700)] 
prevent a possible shutdown hang in rndc

In rndc_recvdone(), if 'sends' was not 0, then 'recvs' was not
decremented, in which case isc_loopmgr_shutdown() was never reached,
which could cause a hang. (This has not been observed to happen, but
the code was incorrect on examination.)

3 years agoMerge branch 'fanf-tolower' into 'main'
Tony Finch [Mon, 12 Sep 2022 12:08:06 +0000 (12:08 +0000)] 
Merge branch 'fanf-tolower' into 'main'

De-duplicate `tolower()`

See merge request isc-projects/bind9!6516

3 years agoCHANGES note for [GL !6516]
Tony Finch [Thu, 30 Jun 2022 15:31:15 +0000 (16:31 +0100)] 
CHANGES note for [GL !6516]

[cleanup] Move the duplicated ASCII case conversion tables to
isc_ascii where they can be shared, and replace the
various hot-path tolower() loops with calls to new
isc_ascii implementations.

3 years agoTests and benchmark for isc_ascii
Tony Finch [Sat, 25 Jun 2022 14:29:54 +0000 (15:29 +0100)] 
Tests and benchmark for isc_ascii

The test is to verify basic functionality. The benchmark compares a
number of alternative tolower() implementations on large and small
strings.

3 years agoGeneral-purpose unrolled ASCII tolower() loops
Tony Finch [Mon, 27 Jun 2022 11:57:28 +0000 (12:57 +0100)] 
General-purpose unrolled ASCII tolower() loops

When converting a string to lower case, the compiler is able to
autovectorize nicely, so a nice simple implementation is also very
fast, comparable to memcpy().

Comparisons are more difficult for the compiler, so we convert eight
bytes at a time using "SIMD within a register" tricks. Experiments
indicate it's best to stick to simple loops for shorter strings and
the remainder of long strings.

3 years agoConsolidate some ASCII tables in `isc/ascii` and `isc/hex`
Tony Finch [Fri, 24 Jun 2022 21:11:02 +0000 (22:11 +0100)] 
Consolidate some ASCII tables in `isc/ascii` and `isc/hex`

There were a number of places that had copies of various ASCII
tables (case conversion, hex and decimal conversion) that are intended
to be faster than the ctype.h macros, or avoid locale pollution.

Move them into libisc, and wrap the lookup tables with macros that
avoid the ctype.h gotchas.

3 years agoMerge branch '3519-macos-tests' into 'main'
Tony Finch [Mon, 12 Sep 2022 11:14:27 +0000 (11:14 +0000)] 
Merge branch '3519-macos-tests' into 'main'

System test fixes for macOS

Closes #3519

See merge request isc-projects/bind9!6719

3 years agoSkip the xfer test when Net::DNS is too old
Tony Finch [Thu, 1 Sep 2022 11:08:52 +0000 (12:08 +0100)] 
Skip the xfer test when Net::DNS is too old

This allows the system tests to run to completion on macOS
without requiring extra modules from CPAN.

3 years agoThe system tests are using another IP address
Tony Finch [Wed, 31 Aug 2022 20:09:06 +0000 (21:09 +0100)] 
The system tests are using another IP address

Reduce the number of places that know about the number of IP addresses
required by the system tests, by changing `testsock.pl` to read the
`max` from `ifconfig.sh.in`. This should make the test runner fail
early with a clear message when the interfaces have been set up by an
obsolete script.

Add comments to cross-reference `ifconfig.sh.in`, `testsock.pl`, and
`org.isc.bind.system` to make it easier to remember what needs
updating when an IP address is added.

3 years agoMerge branch '3527-dig-idna-relaxed' into 'main'
Tony Finch [Mon, 12 Sep 2022 11:09:38 +0000 (11:09 +0000)] 
Merge branch '3527-dig-idna-relaxed' into 'main'

More lenient IDNA processing in dig

Closes #3527

See merge request isc-projects/bind9!6738

3 years agoCHANGES and release note for [GL #3527]
Tony Finch [Tue, 16 Aug 2022 15:02:45 +0000 (16:02 +0100)] 
CHANGES and release note for [GL #3527]

[func] When an international domain name is not valid, DiG will
now pass it through unchanged, instead of stopping with
an error message. [GL #3527]

3 years agoMore lenient IDNA processing in dig
Tony Finch [Mon, 5 Sep 2022 14:49:49 +0000 (15:49 +0100)] 
More lenient IDNA processing in dig

If there are any problems with IDN processing, DiG will now quietly
handle the name as if IDN were disabled. This means that international
query names are rendered verbatim on the wire, and ACE names are
printed raw without conversion to UTF8.

If you want to check the syntax of international domain names,
use the `idn2` utility.

3 years agoMerge branch '3528-catz-test-faster' into 'main'
Tony Finch [Mon, 12 Sep 2022 10:31:10 +0000 (10:31 +0000)] 
Merge branch '3528-catz-test-faster' into 'main'

Speed up the `catz` system test

Closes #3528

See merge request isc-projects/bind9!6742

3 years agoSpeed up the `catz` system test
Tony Finch [Wed, 7 Sep 2022 16:57:58 +0000 (17:57 +0100)] 
Speed up the `catz` system test

Do not delay sending NOFIFY messages, and allow catalog zones to
update every second instead of every 5 seconds.

3 years agoMerge branch '3531-initialize-struct-server' into 'main'
Tony Finch [Mon, 12 Sep 2022 10:12:42 +0000 (10:12 +0000)] 
Merge branch '3531-initialize-struct-server' into 'main'

Ensure that named_server_t is properly initialized

Closes #3531

See merge request isc-projects/bind9!6755

3 years agoEnsure that named_server_t is properly initialized
Tony Finch [Fri, 9 Sep 2022 07:21:10 +0000 (08:21 +0100)] 
Ensure that named_server_t is properly initialized

There was a ubsan error reporting an invalid value for interface_auto
(a boolean value cannot be 190) because it was not initialized. To
avoid this problem happening again, ensure the whole of the server
structure is initialized to zero before setting the (relatively few)
non-zero elements.

3 years agoMerge branch '3534-fix-error-reporting-for-posix-threads-functions' into 'main'
Michał Kępień [Fri, 9 Sep 2022 18:28:07 +0000 (18:28 +0000)] 
Merge branch '3534-fix-error-reporting-for-posix-threads-functions' into 'main'

Fix error reporting for POSIX Threads functions

See merge request isc-projects/bind9!6756

3 years agoFix error reporting for POSIX Threads functions
Michał Kępień [Fri, 9 Sep 2022 18:25:47 +0000 (20:25 +0200)] 
Fix error reporting for POSIX Threads functions

Commit 3608abc8fa6a33046e1d34a0789cf7c9547f09ad inadvertently carried
over a mistake in logging pthread_cond_init() errors to the
ERRNO_CHECK() preprocessor macro: instead of passing the value returned
by a given pthread_*() function to strerror_r(), ERRNO_CHECK() passes
the errno variable to strerror_r().  This causes bogus error reports
because POSIX Threads API functions do not set the errno variable.

Fix by passing the value returned by a given pthread_*() function
instead of the errno variable to strerror_r().  Since this change makes
the name of the affected macro (ERRNO_CHECK()) confusing, rename the
latter to PTHREADS_RUNTIME_CHECK().  Also log the integer error value
returned by a given pthread_*() function verbatim to rule out any
further confusion in runtime error reporting.

3 years agoMerge branch 'michal/set-up-version-and-release-notes-for-bind-9.19.6' into 'main'
Michał Kępień [Fri, 9 Sep 2022 18:23:08 +0000 (18:23 +0000)] 
Merge branch 'michal/set-up-version-and-release-notes-for-bind-9.19.6' into 'main'

Set up version and release notes for BIND 9.19.6

See merge request isc-projects/bind9!6758

3 years agoSet up release notes for BIND 9.19.6
Michał Kępień [Fri, 9 Sep 2022 17:56:43 +0000 (19:56 +0200)] 
Set up release notes for BIND 9.19.6

3 years agoUpdate BIND version to 9.19.6-dev
Michał Kępień [Fri, 9 Sep 2022 17:56:43 +0000 (19:56 +0200)] 
Update BIND version to 9.19.6-dev

3 years agoMerge branch 'michal/add-placeholder-entries-to-CHANGES' into 'main'
Michał Kępień [Thu, 8 Sep 2022 08:55:46 +0000 (08:55 +0000)] 
Merge branch 'michal/add-placeholder-entries-to-CHANGES' into 'main'

Add placeholder entries to CHANGES

See merge request isc-projects/bind9!6750

3 years agoAdd placeholder entries to CHANGES
Michał Kępień [Thu, 8 Sep 2022 08:42:01 +0000 (10:42 +0200)] 
Add placeholder entries to CHANGES

Add placeholders for the following issues:

  - [GL #3394]
  - [GL #3487]
  - [GL #3491]
  - [GL #3493]
  - [GL #3517]

3 years agoMerge branch '3459-rrl-wildcard-handling' into 'main'
Michał Kępień [Thu, 8 Sep 2022 07:35:43 +0000 (07:35 +0000)] 
Merge branch '3459-rrl-wildcard-handling' into 'main'

Make RRL code treat all QNAMEs subject to wildcard processing as the same name

Closes #3459

See merge request isc-projects/bind9!6744

3 years agoAdd CHANGES and release notes for [GL #3459]
Aram Sargsyan [Mon, 25 Jul 2022 14:59:41 +0000 (14:59 +0000)] 
Add CHANGES and release notes for [GL #3459]

3 years agoDocument RRL processing for wildcard names
Aram Sargsyan [Mon, 25 Jul 2022 14:13:28 +0000 (14:13 +0000)] 
Document RRL processing for wildcard names

All valid wildcard domain names are interpreted as the zone's origin
name concatenated to the "*" name.

3 years agoFix RRL responses-per-second bypass using wildcard names
Aram Sargsyan [Mon, 25 Jul 2022 13:55:03 +0000 (13:55 +0000)] 
Fix RRL responses-per-second bypass using wildcard names

It is possible to bypass Response Rate Limiting (RRL)
`responses-per-second` limitation using specially crafted wildcard
names, because the current implementation, when encountering a found
DNS name generated from a wildcard record, just strips the leftmost
label of the name before making a key for the bucket.

While that technique helps with limiting random requests like
<random>.example.com (because all those requests will be accounted
as belonging to a bucket constructed from "example.com" name), it does
not help with random names like subdomain.<random>.example.com.

The best solution would have been to strip not just the leftmost
label, but as many labels as necessary until reaching the suffix part
of the wildcard record from which the found name is generated, however,
we do not have that information readily available in the context of RRL
processing code.

Fix the issue by interpreting all valid wildcard domain names as
the zone's origin name concatenated to the "*" name, so they all will
be put into the same bucket.

3 years agoMerge branch 'matthijs-fix-intermittent-inline-system-test-failure' into 'main'
Matthijs Mekking [Wed, 7 Sep 2022 15:10:56 +0000 (15:10 +0000)] 
Merge branch 'matthijs-fix-intermittent-inline-system-test-failure' into 'main'

Fix intermittent inline system test failure

See merge request isc-projects/bind9!6708

3 years agoUpdate inline system test, zone 'retransfer3.'
Matthijs Mekking [Tue, 30 Aug 2022 08:04:16 +0000 (10:04 +0200)] 
Update inline system test, zone 'retransfer3.'

The zone 'retransfer3.' tests whether zones that 'rndc signing
-nsec3param' requests are queued even if the zone is not loaded.

The test assumes that if 'rndc signing -list' shows that the zone is
done signing with two keys, and there are no NSEC3 chains pending, the
zone is done handling the '-nsec3param' queued requests. However, it
is possible that the 'rndc signing -list' command is received before
the corresponding privatetype records are added to the zone (the records
that are used to retrieve the signing status with 'rndc signing').

This is what happens in test failure
https://gitlab.isc.org/isc-projects/bind9/-/jobs/2722752.

The 'rndc signing -list retransfer3' is thus an unreliable check.
It is simpler to just remove the check and wait for a certain amount
of time and check whether ns3 has re-signed the zone using NSEC3.

3 years agoMerge branch '3508-fix-building-without-doh-support' into 'main'
Michał Kępień [Wed, 7 Sep 2022 11:21:57 +0000 (11:21 +0000)] 
Merge branch '3508-fix-building-without-doh-support' into 'main'

Fix building without DoH support

Closes #3508

See merge request isc-projects/bind9!6737

3 years agoFix building with --disable-doh
Michał Kępień [Wed, 7 Sep 2022 10:50:08 +0000 (12:50 +0200)] 
Fix building with --disable-doh

Commit b69e783164cd50e3306364668558e460617ee8fc inadvertently caused
builds using the --disable-doh switch to fail, by putting the
declaration of the isc__nm_async_settlsctx() function inside an #ifdef
block that is only evaluated when DNS-over-HTTPS support is enabled.
This results in the following compilation errors being triggered:

    netmgr/netmgr.c:2657:1: error: no previous prototype for 'isc__nm_async_settlsctx' [-Werror=missing-prototypes]
     2657 | isc__nm_async_settlsctx(isc__networker_t *worker, isc__netievent_t *ev0) {
          | ^~~~~~~~~~~~~~~~~~~~~~~

Fix by making the declaration of the isc__nm_async_settlsctx() function
in lib/isc/netmgr/netmgr-int.h visible regardless of whether
DNS-over-HTTPS support is enabled or not.

3 years agoTest the --disable-doh switch in GitLab CI
Michał Kępień [Wed, 7 Sep 2022 10:50:08 +0000 (12:50 +0200)] 
Test the --disable-doh switch in GitLab CI

Use the --disable-doh switch for all Ubuntu 22.04 builds in GitLab CI to
immediately flag any code changes that would break such builds.

3 years agoMerge branch 'each-interface-magic' into 'main'
Evan Hunt [Wed, 7 Sep 2022 04:47:09 +0000 (04:47 +0000)] 
Merge branch 'each-interface-magic' into 'main'

when creating an interface, set magic before linking

See merge request isc-projects/bind9!6735

3 years agowhen creating an interface, set magic before linking
Evan Hunt [Wed, 7 Sep 2022 00:12:14 +0000 (17:12 -0700)] 
when creating an interface, set magic before linking

set the magic number in a newly-created interface object
before appending it to mgr->interfaces in order to prevent
a possible assertion.

3 years agoMerge branch '3364-various-coverity-issues-after-dns_message_gettemp-cleanup' into...
Mark Andrews [Tue, 6 Sep 2022 15:25:39 +0000 (15:25 +0000)] 
Merge branch '3364-various-coverity-issues-after-dns_message_gettemp-cleanup' into 'main'

Resolve "Various Coverity issues after dns_message_gettemp* cleanup"

Closes #3364

See merge request isc-projects/bind9!6588

3 years agoRemove dead code
Mark Andrews [Mon, 18 Jul 2022 08:00:30 +0000 (18:00 +1000)] 
Remove dead code

    *** CID 352817:  Control flow issues  (DEADCODE) /lib/ns/xfrout.c: 1568 in sendstream()
    1562
    1563      /* Advance lasttsig to be the last TSIG generated */
    1564      CHECK(dns_message_getquerytsig(msg, xfr->mctx, &xfr->lasttsig));
    1565
    1566     failure:
    1567      if (msgname != NULL) {
    >>>     CID 352817:  Control flow issues  (DEADCODE)
    >>>     Execution cannot reach this statement: "if (msgrds != NULL) {
      if ...".
    1568      if (msgrds != NULL) {
    1569      if (dns_rdataset_isassociated(msgrds)) {
    1570      dns_rdataset_disassociate(msgrds);
    1571      }
    1572      dns_message_puttemprdataset(msg, &msgrds);
    1573      }

3 years agoRemove dead code
Mark Andrews [Mon, 18 Jul 2022 07:39:12 +0000 (17:39 +1000)] 
Remove dead code

    *** CID 352816:  Control flow issues  (DEADCODE) /lib/ns/query.c: 8443 in query_dns64()
    8437     cleanup:
    8438      if (buffer != NULL) {
    8439      isc_buffer_free(&buffer);
    8440      }
    8441
    8442      if (dns64_rdata != NULL) {
    >>>     CID 352816:  Control flow issues  (DEADCODE)
    >>>     Execution cannot reach this statement: "dns_message_puttemprdata(cl...".
    8443      dns_message_puttemprdata(client->message, &dns64_rdata);
    8444      }
    8445
    8446      if (dns64_rdataset != NULL) {
    8447      dns_message_puttemprdataset(client->message, &dns64_rdataset);
    8448      }

3 years agoRemove dead code
Mark Andrews [Mon, 18 Jul 2022 07:34:30 +0000 (17:34 +1000)] 
Remove dead code

    *** CID 352812:  Control flow issues  (DEADCODE) /lib/ns/query.c: 8584 in query_filter64()
    8578     cleanup:
    8579      if (buffer != NULL) {
    8580      isc_buffer_free(&buffer);
    8581      }
    8582
    8583      if (myrdata != NULL) {
    >>>     CID 352812:  Control flow issues  (DEADCODE)
    >>>     Execution cannot reach this statement: "dns_message_puttemprdata(cl...".
    8584      dns_message_puttemprdata(client->message, &myrdata);
    8585      }
    8586
    8587      if (myrdataset != NULL) {
    8588      dns_message_puttemprdataset(client->message, &myrdataset);
    8589      }

3 years agoSilence REVERSE_INULL
Mark Andrews [Mon, 18 Jul 2022 07:21:25 +0000 (17:21 +1000)] 
Silence REVERSE_INULL

Remove unnecessary != NULL checks

    *** CID 352809:  Null pointer dereferences  (REVERSE_INULL) /lib/dns/message.c: 4654 in dns_message_buildopt()
    4648      if (rdata != NULL) {
    4649      dns_message_puttemprdata(message, &rdata);
    4650      }
    4651      if (rdataset != NULL) {
    4652      dns_message_puttemprdataset(message, &rdataset);
    4653      }
    >>>     CID 352809:  Null pointer dereferences  (REVERSE_INULL)
    >>>     Null-checking "rdatalist" suggests that it may be null, but it has already been dereferenced on all paths leading to the check.
    4654      if (rdatalist != NULL) {
    4655      dns_message_puttemprdatalist(message, &rdatalist);
    4656      }
    4657      return (result);
    4658     }
    4659

3 years agoRemove dead code in xfrin.c
Mark Andrews [Mon, 18 Jul 2022 06:42:00 +0000 (16:42 +1000)] 
Remove dead code in xfrin.c

also removed unnecessary 'msg != NULL' check

   *** CID 352815:  Control flow issues  (DEADCODE) /lib/dns/xfrin.c: 1363 in xfrin_send_request()
   1357      isc_nmhandle_attach(send_xfr->handle, &xfr->sendhandle);
   1358      isc_refcount_increment0(&send_xfr->sends);
   1359      isc_nm_send(xfr->handle, &region, xfrin_send_done, send_xfr);
   1360
   1361     failure:
   1362      if (qname != NULL) {
   >>>     CID 352815:  Control flow issues  (DEADCODE)
   >>>     Execution cannot reach this statement: "dns_message_puttempname(msg...".
   1363      dns_message_puttempname(msg, &qname);
   1364      }
   1365      if (qrdataset != NULL) {
   1366      dns_message_puttemprdataset(msg, &qrdataset);
   1367      }
   1368      if (msg != NULL) {

   *** CID 352819:  Control flow issues  (DEADCODE) /lib/dns/xfrin.c: 1366 in xfrin_send_request()
   1360
   1361     failure:
   1362      if (qname != NULL) {
   1363      dns_message_puttempname(msg, &qname);
   1364      }
   1365      if (qrdataset != NULL) {
   >>>     CID 352819:  Control flow issues  (DEADCODE)
   >>>     Execution cannot reach this statement: "dns_message_puttemprdataset...".
   1366      dns_message_puttemprdataset(msg, &qrdataset);
   1367      }
   1368      if (msg != NULL) {
   1369      dns_message_detach(&msg);
   1370      }
   1371      if (soatuple != NULL) {

3 years agoMerge branch '3518-libxml2-deprecated-functions' into 'main'
Arаm Sаrgsyаn [Tue, 6 Sep 2022 09:42:01 +0000 (09:42 +0000)] 
Merge branch '3518-libxml2-deprecated-functions' into 'main'

Do not use libxml2 deprecated functions

Closes #3518

See merge request isc-projects/bind9!6727

3 years agoAdd CHANGES note for [GL #3518]
Aram Sargsyan [Mon, 5 Sep 2022 10:01:33 +0000 (10:01 +0000)] 
Add CHANGES note for [GL #3518]

3 years agoDo not use libxml2 deprecated functions
Aram Sargsyan [Mon, 5 Sep 2022 09:59:44 +0000 (09:59 +0000)] 
Do not use libxml2 deprecated functions

The usage of xmlInitThreads() and xmlCleanupThreads() functions in
libxml2 is now marked as deprecated, and these functions will be made
private in the future.

Use xmlInitParser() and xmlCleanupParser() instead of them.

3 years agoMerge branch 'aram/isc_nm_listentlsdns-error-path-bugfix' into 'main'
Arаm Sаrgsyаn [Tue, 6 Sep 2022 08:25:39 +0000 (08:25 +0000)] 
Merge branch 'aram/isc_nm_listentlsdns-error-path-bugfix' into 'main'

Fix isc_nm_listentlsdns() error path bug

See merge request isc-projects/bind9!6728

3 years agoFix isc_nm_listentlsdns() error path bug
Aram Sargsyan [Mon, 5 Sep 2022 14:42:32 +0000 (14:42 +0000)] 
Fix isc_nm_listentlsdns() error path bug

The isc_nm_listentlsdns() function erroneously calls
isc__nm_tcpdns_stoplistening() instead of isc__nm_tlsdns_stoplistening()
when something goes wrong, which can cause an assertion failure.

3 years agoMerge branch '3485-dig-fallback-to-idna2003' into 'main'
Ondřej Surý [Mon, 5 Sep 2022 08:36:48 +0000 (08:36 +0000)] 
Merge branch '3485-dig-fallback-to-idna2003' into 'main'

Allow fallback to IDNA2003 processing

Closes #3485

See merge request isc-projects/bind9!6699

3 years agoAdd CHANGES and release note for [GL #3485]
Ondřej Surý [Fri, 26 Aug 2022 10:28:10 +0000 (12:28 +0200)] 
Add CHANGES and release note for [GL #3485]

3 years agoEnable the IDNA2003 domain names in the idna system test
Ondřej Surý [Fri, 26 Aug 2022 11:10:22 +0000 (13:10 +0200)] 
Enable the IDNA2003 domain names in the idna system test

Allow the IDNA2003 tests to succeed after the fallback to IDNA2003 was
implemented.

3 years agoAllow fallback to IDNA2003 processing
Ondřej Surý [Fri, 26 Aug 2022 10:24:07 +0000 (12:24 +0200)] 
Allow fallback to IDNA2003 processing

In several cases where IDNA2008 mappings do not exist whereas IDNA2003
mappings do, dig was failing to process the suplied domain name.  Take a
backwards compatible approach, and convert the domain to IDNA2008 form,
and if that fails try the IDNA2003 conversion.

3 years agoMerge branch '3515-mctx-attach-detach-for-isc_mempool_t' into 'main'
Arаm Sаrgsyаn [Fri, 2 Sep 2022 09:02:38 +0000 (09:02 +0000)] 
Merge branch '3515-mctx-attach-detach-for-isc_mempool_t' into 'main'

Add mctx attach/detach when creating/destroying a memory pool

Closes #3515

See merge request isc-projects/bind9!6712

3 years agoAdd CHANGES note for [GL #3515]
Aram Sargsyan [Wed, 31 Aug 2022 12:35:53 +0000 (12:35 +0000)] 
Add CHANGES note for [GL #3515]

3 years agoAdd mctx attach/detach when creating/destroying a memory pool
Aram Sargsyan [Wed, 31 Aug 2022 12:30:38 +0000 (12:30 +0000)] 
Add mctx attach/detach when creating/destroying a memory pool

This should make sure that the memory context is not destroyed
before the memory pool, which is using the context.

3 years agoMerge branch '3514-cid-356328-deadcode-in-server.c' into 'main'
Arаm Sаrgsyаn [Fri, 2 Sep 2022 08:14:46 +0000 (08:14 +0000)] 
Merge branch '3514-cid-356328-deadcode-in-server.c' into 'main'

Resolve "CID 356328: Control flow issues (DEADCODE) in bin/named/server.c"

Closes #3514

See merge request isc-projects/bind9!6713

3 years agoUse the return value of isc_portset_create()
Aram Sargsyan [Wed, 31 Aug 2022 13:18:39 +0000 (13:18 +0000)] 
Use the return value of isc_portset_create()

There is an omission of assigning the return value coming from the
isc_portset_create() function to the result variable.

CID 356328:

    /bin/named/server.c: 8756 in load_configuration()
    8750            "creating UDP/IPv4 port set: %s",
    8751            isc_result_totext(result));
    8752      goto cleanup_bindkeys_parser;
    8753      }
    8754      isc_portset_create(named_g_mctx, &v6portset);
    8755      if (result != ISC_R_SUCCESS) {
    >>>     CID 356328:  Control flow issues  (DEADCODE)
    >>>     Execution cannot reach this statement: "isc_log_write(named_g_lctx,...".
    8756      isc_log_write(named_g_lctx, NAMED_LOGCATEGORY_GENERAL,
    8757            NAMED_LOGMODULE_SERVER, ISC_LOG_ERROR,
    8758            "creating UDP/IPv6 port set: %s",
    8759            isc_result_totext(result));
    8760      goto cleanup_v4portset;
    8761      }

3 years agoMerge branch '3511-quote-yaml-addresses' into 'main'
Evan Hunt [Wed, 31 Aug 2022 23:16:32 +0000 (23:16 +0000)] 
Merge branch '3511-quote-yaml-addresses' into 'main'

quote addresses in YAML output

Closes #3511

See merge request isc-projects/bind9!6702

3 years agoCHANGES for [GL #3511]
Evan Hunt [Sat, 27 Aug 2022 01:00:50 +0000 (18:00 -0700)] 
CHANGES for [GL #3511]

3 years agoquote addresses in YAML output
Evan Hunt [Sat, 27 Aug 2022 00:58:55 +0000 (17:58 -0700)] 
quote addresses in YAML output

YAML strings should be quoted if they contain colon characters.
Since IPv6 addresses do, we now quote the query_address and
response_address strings in all YAML output.

3 years agoMerge branch '3501-dnstap-response' into 'main'
Evan Hunt [Wed, 31 Aug 2022 22:22:44 +0000 (22:22 +0000)] 
Merge branch '3501-dnstap-response' into 'main'

dnstap query_message field was erroneously set with responses

Closes #3501

See merge request isc-projects/bind9!6701

3 years agoCHANGES for [GL #3501]
Evan Hunt [Fri, 26 Aug 2022 23:01:31 +0000 (16:01 -0700)] 
CHANGES for [GL #3501]

3 years agodnstap query_message field was erroneously set with responses
Evan Hunt [Fri, 26 Aug 2022 22:38:34 +0000 (15:38 -0700)] 
dnstap query_message field was erroneously set with responses

The dnstap query_message field was in some cases being filled in
with response messages, along with the response_message field.
The query_message field should only be used when logging requests,
and the response_message field only when logging responses.

3 years agoMerge branch '3410-rpz-extended-errors' into 'main'
Arаm Sаrgsyаn [Wed, 31 Aug 2022 09:21:11 +0000 (09:21 +0000)] 
Merge branch '3410-rpz-extended-errors' into 'main'

RPZ Extended DNS Error Codes

Closes #3410

See merge request isc-projects/bind9!6700

3 years agoAdd CHANGES note for [GL #3410]
Aram Sargsyan [Fri, 26 Aug 2022 14:47:42 +0000 (14:47 +0000)] 
Add CHANGES note for [GL #3410]

3 years agoDocument RPZ Extended DNS Error (EDE) code configuration option
Aram Sargsyan [Fri, 26 Aug 2022 14:39:11 +0000 (14:39 +0000)] 
Document RPZ Extended DNS Error (EDE) code configuration option

Add information about the 'ede' option for response policy zones.

3 years agoAdd system tests for RPZ EDE codes
Aram Sargsyan [Fri, 26 Aug 2022 14:18:28 +0000 (14:18 +0000)] 
Add system tests for RPZ EDE codes

Check the new configuration option's syntax using the 'checkconf' system
test.

Check if the new option works by parsing DiG's output in the 'rpz'
system test.

3 years agoSet the extended DNS error code for RPZ-modified queries
Aram Sargsyan [Fri, 26 Aug 2022 14:15:16 +0000 (14:15 +0000)] 
Set the extended DNS error code for RPZ-modified queries

When enabled through a configuration option, set the configured EDE code
for the modified queries.

3 years agoAdd extended DNS error configuration option for RPZ zones
Aram Sargsyan [Fri, 26 Aug 2022 14:11:47 +0000 (14:11 +0000)] 
Add extended DNS error configuration option for RPZ zones

Implement the configuration option with its checking and parsing parts.

The option should be later used by BIND to set an extended error
code (EDE) for the queries modified in the result of RPZ processing.

3 years agoMerge branch 'aram/rpz-doc-update' into 'main'
Arаm Sаrgsyаn [Wed, 31 Aug 2022 08:52:35 +0000 (08:52 +0000)] 
Merge branch 'aram/rpz-doc-update' into 'main'

Update RPZ documentation in ARM

See merge request isc-projects/bind9!6705

3 years agoUpdate RPZ documentation
Aram Sargsyan [Fri, 26 Aug 2022 09:20:02 +0000 (09:20 +0000)] 
Update RPZ documentation

The RPZ documentation section with response policy rules and actions
is incomplete.

Add information about the 'RPZ-CLIENT-IP' rule, and 'TCP-Only' and
'DROP' actions.

3 years agoMerge branch 'ondrej-add-isc-loopmgr' into 'main'
Ondřej Surý [Fri, 26 Aug 2022 08:08:42 +0000 (08:08 +0000)] 
Merge branch 'ondrej-add-isc-loopmgr' into 'main'

Separate the event loop handling into a separate layer

Closes #3508

See merge request isc-projects/bind9!6040

3 years agoCHANGES and release note for [GL #3508]
Evan Hunt [Thu, 25 Aug 2022 22:06:33 +0000 (15:06 -0700)] 
CHANGES and release note for [GL #3508]

3 years agoClear the callbacks when isc_nm_stoplistening() is called
Ondřej Surý [Wed, 24 Aug 2022 12:59:50 +0000 (14:59 +0200)] 
Clear the callbacks when isc_nm_stoplistening() is called

When we are closing the listening sockets, there's a time window in
which the TCP connection could be accepted although the respective
stoplistening function has already returned to control to the caller.
Clear the accept callback function early, so it doesn't get called when
we are not interested in the incoming connections anymore.

3 years agoRemove the isc_app API
Ondřej Surý [Tue, 26 Jul 2022 11:03:53 +0000 (13:03 +0200)] 
Remove the isc_app API

The isc_app API is no longer used and has been removed.

3 years agoSplit netmgr_test into separate per-transport unit tests
Ondřej Surý [Tue, 26 Jul 2022 11:03:48 +0000 (13:03 +0200)] 
Split netmgr_test into separate per-transport unit tests

The netmgr_test unit test has been subdivided into tcp_test,
tcpdns_test, tls_test, tlsdns_test, and udp_test components.
These have been updated to use the new loopmgr.

3 years agoUpdate netmgr, tasks, and applications to use isc_loopmgr
Ondřej Surý [Tue, 26 Jul 2022 11:03:45 +0000 (13:03 +0200)] 
Update netmgr, tasks, and applications to use isc_loopmgr

Previously:

* applications were using isc_app as the base unit for running the
  application and signal handling.

* networking was handled in the netmgr layer, which would start a
  number of threads, each with a uv_loop event loop.

* task/event handling was done in the isc_task unit, which used
  netmgr event loops to run the isc_event calls.

In this refactoring:

* the network manager now uses isc_loop instead of maintaining its
  own worker threads and event loops.

* the taskmgr that manages isc_task instances now also uses isc_loopmgr,
  and every isc_task runs on a specific isc_loop bound to the specific
  thread.

* applications have been updated as necessary to use the new API.

* new ISC_LOOP_TEST macros have been added to enable unit tests to
  run isc_loop event loops. unit tests have been updated to use this
  where needed.

3 years agoUpdate isc_timer to use isc_loopmgr
Ondřej Surý [Tue, 26 Jul 2022 11:03:40 +0000 (13:03 +0200)] 
Update isc_timer to use isc_loopmgr

* isc_timer was rewritten using the uv_timer, and isc_timermgr_t was
  completely removed; isc_timer objects are now directly created on the
  isc_loop event loops.

* the isc_timer API has been simplified. the "inactive" timer type has
  been removed; timers are now stopped by calling isc_timer_stop()
  instead of resetting to inactive.

* isc_manager now creates a loop manager rather than a timer manager.

* modules and applications using isc_timer have been updated to use the
  new API.

3 years agoNew event loop handling API
Ondřej Surý [Tue, 26 Jul 2022 11:03:22 +0000 (13:03 +0200)] 
New event loop handling API

This commit introduces new APIs for applications and signal handling,
intended to replace isc_app for applications built on top of libisc.

* isc_app will be replaced with isc_loopmgr, which handles the
  starting and stopping of applications. In isc_loopmgr, the main
  thread is not blocked, but is part of the working thread set.
  The loop manager will start a number of threads, each with a
  uv_loop event loop running. Setup and teardown functions can be
  assigned which will run when the loop starts and stops, and
  jobs can be scheduled to run in the meantime. When
  isc_loopmgr_shutdown() is run from any the loops, all loops
  will shut down and the application can terminate.

* signal handling will now be handled with a separate isc_signal unit.
  isc_loopmgr only handles SIGTERM and SIGINT for application
  termination, but the application may install additional signal
  handlers, such as SIGHUP as a signal to reload configuration.

* new job running primitives, isc_job and isc_async, have been added.
  Both units schedule callbacks (specifying a callback function and
  argument) on an event loop. The difference is that isc_job unit is
  unlocked and not thread-safe, so it can be used to efficiently
  run jobs in the same thread, while isc_async is thread-safe and
  uses locking, so it can be used to pass jobs from one thread to
  another.

* isc_tid will be used to track the thread ID in isc_loop worker
  threads.

* unit tests have been added for the new APIs.

3 years agoSimplify the isc_event API
Ondřej Surý [Tue, 26 Jul 2022 11:03:01 +0000 (13:03 +0200)] 
Simplify the isc_event API

The ev_tag field was never used, and has now been removed.

3 years agoMerge branch '3505-missing-isc_mutex_destroy' into 'main'
Mark Andrews [Wed, 24 Aug 2022 07:00:17 +0000 (07:00 +0000)] 
Merge branch '3505-missing-isc_mutex_destroy' into 'main'

Resolve "missing isc_mutex_destroy"

Closes #3505

See merge request isc-projects/bind9!6696

3 years agoCall isc_mutex_destroy(&lasttime_mx);
Mark Andrews [Wed, 24 Aug 2022 06:41:55 +0000 (16:41 +1000)] 
Call isc_mutex_destroy(&lasttime_mx);

3 years agoMerge branch '3500-nsec3-missing-detach-node' into 'main'
Matthijs Mekking [Tue, 23 Aug 2022 10:03:28 +0000 (10:03 +0000)] 
Merge branch '3500-nsec3-missing-detach-node' into 'main'

nsec3.c: Add a missing dns_db_detachnode() call

Closes #3500

See merge request isc-projects/bind9!6692

3 years agoAdd CHANGES entry for #3500
Matthijs Mekking [Tue, 23 Aug 2022 09:04:00 +0000 (11:04 +0200)] 
Add CHANGES entry for #3500

There is no need for a release because this case was nearly impossible
to trigger (except for when 'sig-signing-type' was set to 0).

3 years agonsec3.c: Add a missing dns_db_detachnode() call
Matthijs Mekking [Tue, 23 Aug 2022 08:54:42 +0000 (10:54 +0200)] 
nsec3.c: Add a missing dns_db_detachnode() call

There is one case in 'dns_nsec3_activex()' where it returns but forgets
to detach the db node. Add the missing 'dns_db_detachnode()' call.

This case only triggers if 'sig-signing-type' (privatetype) is set to 0
(which by default is not), or if the function is called with 'complete'
is set to 'true' (which at this moment do not exist).

3 years agoMerge branch '3486-checkconf-dnssec-policy-nsec3-incompatible-algorithm' into 'main'
Matthijs Mekking [Mon, 22 Aug 2022 14:37:07 +0000 (14:37 +0000)] 
Merge branch '3486-checkconf-dnssec-policy-nsec3-incompatible-algorithm' into 'main'

Graceful dnssec-policy transition from NSEC only to NSEC3

Closes #3486

See merge request isc-projects/bind9!6647

3 years agoFix nsec3 system test issues
Matthijs Mekking [Fri, 19 Aug 2022 12:42:47 +0000 (14:42 +0200)] 
Fix nsec3 system test issues

The wait_for_zone_is_signed function was never called, which could lead
to test failures due to timing issues (where a zone was not fully signed
yet, but the test was trying to verify the zone).

Also add two missing set_nsec3param calls to ensure the ITERATIONS
value is set for these test cases.

3 years agoAdd change entry and release note for #3486
Matthijs Mekking [Wed, 10 Aug 2022 14:52:53 +0000 (16:52 +0200)] 
Add change entry and release note for #3486

News worthy.

3 years agoAdd test case for #3486
Matthijs Mekking [Wed, 10 Aug 2022 14:41:30 +0000 (16:41 +0200)] 
Add test case for #3486

Add two scenarios where we change the dnssec-policy from using RSASHA1
to something with NSEC3.

The first case should work, as the DS is still in hidden state and we
can basically do anything with DNSSEC.

The second case should fail, because the DS of the predecessor is
published and we can't immediately remove the predecessor DNSKEY. So
in this case we should keep the NSEC chain for a bit longer.

Add two more scenarios where we change the dnssec-policy from using
NSEC3 to something NSEC only. Both should work because there are no
restrictions on using NSEC when it comes to algorithms, but in the
cases where the DS is published we can't bluntly remove the predecessor.

Extend the nsec3 system test by also checking the DNSKEY RRset for the
expected DNSKEY records. This requires some "kasp system"-style setup
for each test (setting key properties and key states). Also move the
dnssec-verify check inside the check_nsec/check_nsec3 functions because
we will have to do that every time.

3 years agoWait with NSEC3 during a DNSSEC policy change
Matthijs Mekking [Wed, 10 Aug 2022 13:29:59 +0000 (15:29 +0200)] 
Wait with NSEC3 during a DNSSEC policy change

When doing a dnssec-policy reconfiguration from a zone with NSEC only
keys to a zone that uses NSEC3, figure out to wait with building the
NSEC3 chain.

Previously, BIND 9 would attempt to sign such a zone, but failed to
do so because the NSEC3 chain conflicted with existing DNSKEY records
in the zone that were not compatible with NSEC3.

There exists logic for detecting such a case in the functions
dnskey_sane() (in lib/dns/zone.c) and check_dnssec() (in
lib/ns/update.c). Both functions look very similar so refactor them
to use the same code and call the new function (called
dns_zone_check_dnskey_nsec3()).

Also update the dns_nsec_nseconly() function to take an additional
parameter 'diff' that, if provided, will be checked whether an
offending NSEC only DNSKEY will be deleted from the zone. If so,
this key will not be considered when checking the zone for NSEC only
DNSKEYs. This is needed to allow a transition from an NSEC zone with
NSEC only DNSKEYs to an NSEC3 zone.

3 years agoTest checkconf NSEC3 and incompatible algorithm
Matthijs Mekking [Wed, 10 Aug 2022 13:24:21 +0000 (15:24 +0200)] 
Test checkconf NSEC3 and incompatible algorithm

The check code for this already exists, but was untested.

3 years agoMerge branch '3463-httpd.c-non-empty-post-requests-bugfix' into 'main'
Arаm Sаrgsyаn [Fri, 19 Aug 2022 08:32:41 +0000 (08:32 +0000)] 
Merge branch '3463-httpd.c-non-empty-post-requests-bugfix' into 'main'

Fix statistics channel multiple request processing with non-empty HTTP bodies

Closes #3463

See merge request isc-projects/bind9!6597

3 years agoAdd pipelined POST requests check in the statschannel system test
Aram Sargsyan [Wed, 20 Jul 2022 13:33:40 +0000 (13:33 +0000)] 
Add pipelined POST requests check in the statschannel system test

Use `nc` to check that multiple POST requests with non-empty HTTP
body are serviced normally by the statistics channel.

3 years agoReplace expr commands with $((expression)) shell constucts
Aram Sargsyan [Wed, 20 Jul 2022 13:21:27 +0000 (13:21 +0000)] 
Replace expr commands with $((expression)) shell constucts

Update the "statschannel" system test to use the $((expression))
shell constucts instead of executing the `expr` program.

3 years agoAdd CHANGES not for [GL #3463]
Aram Sargsyan [Wed, 20 Jul 2022 10:27:29 +0000 (10:27 +0000)] 
Add CHANGES not for [GL #3463]

3 years agoFix statistics channel multiple request processing with non-empty bodies
Aram Sargsyan [Wed, 20 Jul 2022 10:18:56 +0000 (10:18 +0000)] 
Fix statistics channel multiple request processing with non-empty bodies

When the HTTP request has a body part after the HTTP headers, it is
not getting processed and is being prepended to the next request's data,
which results in an error when trying to parse it.

Improve the httpd.c:process_request() function with the following
additions:

1. Require that HTTP POST requests must have Content-Length header.
2. When Content-Length header is set, extract its value, and make sure
   that it is valid and that the whole request's body is received before
   processing the request.
3. Discard the request's body by consuming Content-Length worth of data
   in the buffer.

3 years agoEnhance the have_header() function to find the HTTP header's value
Aram Sargsyan [Wed, 20 Jul 2022 10:06:56 +0000 (10:06 +0000)] 
Enhance the have_header() function to find the HTTP header's value

Add a new `const char **fvalue` parameter to the httpd.c:have_header()
function which, when set, will point to the found header's value.

3 years agoMerge branch 'bug/main/delv-cfg_parser_reset' into 'main'
Mark Andrews [Fri, 19 Aug 2022 05:15:14 +0000 (05:15 +0000)] 
Merge branch 'bug/main/delv-cfg_parser_reset' into 'main'

Reset bind.keys parser after error on file

See merge request isc-projects/bind9!6468

3 years agoAdd CHANGES entry for [GL !6468]
Mark Andrews [Fri, 19 Aug 2022 04:38:32 +0000 (14:38 +1000)] 
Add CHANGES entry for [GL !6468]

3 years agoReset parser before parsing of internal trust anchor
Petr Menšík [Thu, 11 Aug 2022 09:41:30 +0000 (11:41 +0200)] 
Reset parser before parsing of internal trust anchor

It might be reused if /etc/bind.keys exists, but failed correct parsing.
Release traces of previous parsing attempt of different data.

3 years agoMerge branch '3499-duration-c-66-6-warning-array-subscript-is-of-type-char-on-netbsd...
Mark Andrews [Fri, 19 Aug 2022 02:28:45 +0000 (02:28 +0000)] 
Merge branch '3499-duration-c-66-6-warning-array-subscript-is-of-type-char-on-netbsd-9' into 'main'

Resolve "duration.c:66:6: warning: array subscript is of type 'char' on NetBSD 9"

Closes #3499

See merge request isc-projects/bind9!6685