]> git.ipfire.org Git - thirdparty/bind9.git/log
thirdparty/bind9.git
3 years agoAdd tests for CVE-2022-2795
Michał Kępień [Tue, 6 Sep 2022 11:36:44 +0000 (13:36 +0200)] 
Add tests for CVE-2022-2795

Add a test ensuring that the amount of work fctx_getaddresses() performs
for any encountered delegation is limited: delegate example.net to a set
of 1,000 name servers in the redirect.com zone, the names of which all
resolve to IP addresses that nothing listens on, and query for a name in
the example.net domain, checking the number of times the findname()
function gets executed in the process; fail if that count is excessively
large.

Since the size of the referral response sent by ans3 is about 20 kB, it
cannot be sent back over UDP (EMSGSIZE) on some operating systems in
their default configuration (e.g. FreeBSD - see the
net.inet.udp.maxdgram sysctl).  To enable reliable reproduction of
CVE-2022-2795 (retry patterns vary across BIND 9 versions) and avoid
false positives at the same time (thread scheduling - and therefore the
number of fetch context restarts - vary across operating systems and
across test runs), extend bin/tests/system/resolver/ans3/ans.pl so that
it also listens on TCP and make "ns1" in the "resolver" system test
always use TCP when communicating with "ans3".

Also add a test (foo.bar.sub.tld1/TXT) that ensures the new limitations
imposed on the resolution process by the mitigation for CVE-2022-2795 do
not prevent valid, glueless delegation chains from working properly.

3 years agoMerge branch 'artem-tls-listener-shutdown-accept-crash-fix' into 'main'
Artem Boldariev [Tue, 18 Oct 2022 15:58:14 +0000 (15:58 +0000)] 
Merge branch 'artem-tls-listener-shutdown-accept-crash-fix' into 'main'

[Backport] TLS Stream: handle successful TLS handshake after listener shutdown

See merge request isc-projects/bind9!6938

3 years agoTLS Stream: handle successful TLS handshake after listener shutdown
Artem Boldariev [Tue, 18 Oct 2022 11:42:10 +0000 (14:42 +0300)] 
TLS Stream: handle successful TLS handshake after listener shutdown

It was possible that accept callback can be called after listener
shutdown. In such a case the callback pointer equals NULL, leading to
segmentation fault. This commit fixes that.

3 years agoMerge branch '3493-compression-buffer-reuse-test' into 'main'
Michal Nowak [Tue, 18 Oct 2022 15:18:54 +0000 (15:18 +0000)] 
Merge branch '3493-compression-buffer-reuse-test' into 'main'

[CVE-2022-2881] test for growth of compressed pipelined responses

See merge request isc-projects/bind9!6933

3 years agotest for growth of compressed pipelined responses
Evan Hunt [Wed, 17 Aug 2022 19:46:02 +0000 (12:46 -0700)] 
test for growth of compressed pipelined responses

add a test to compare the Content-Length of successive compressed
messages on a single HTTP connection that should contain the same
data; fail if the size grows by more than 100 bytes from one query
to the next.

3 years agoMerge branch 'matthijs-fix-dnssec-signing-log-lovel' into 'main'
Matthijs Mekking [Tue, 18 Oct 2022 14:25:19 +0000 (14:25 +0000)] 
Merge branch 'matthijs-fix-dnssec-signing-log-lovel' into 'main'

Change log level when doing rekey

See merge request isc-projects/bind9!6913

3 years agoChange log level when doing rekey
Matthijs Mekking [Fri, 14 Oct 2022 14:38:25 +0000 (16:38 +0200)] 
Change log level when doing rekey

This log happens when BIND checks the parental-agents if the DS has
been published. But if you don't have parental-agents set up, the list
of keys to check will be empty and the result will be ISC_R_NOTFOUND.
This is not an error, so change the log level to debug in this case.

3 years agoMerge branch 'pspacek/cookie-test-no-developer-fixup' into 'main'
Petr Špaček [Tue, 18 Oct 2022 12:22:34 +0000 (12:22 +0000)] 
Merge branch 'pspacek/cookie-test-no-developer-fixup' into 'main'

Fix cookie system test for builds without --enable-developer

See merge request isc-projects/bind9!6904

3 years agoFix cookie system test for builds without --enable-developer
Petr Špaček [Thu, 13 Oct 2022 15:38:23 +0000 (17:38 +0200)] 
Fix cookie system test for builds without --enable-developer

The "connecting via TCP" message comes from FCTXTRACE which is not
available on some builds.

3 years agoMerge branch 'pspacek/ci-no-developer-mode' into 'main'
Petr Špaček [Tue, 18 Oct 2022 11:51:23 +0000 (11:51 +0000)] 
Merge branch 'pspacek/ci-no-developer-mode' into 'main'

Add CI job with --disable-developer

See merge request isc-projects/bind9!6930

3 years agoAllow system tests to run under root user when inside CI
Petr Špaček [Fri, 14 Oct 2022 13:01:19 +0000 (15:01 +0200)] 
Allow system tests to run under root user when inside CI

https://docs.gitlab.com/ee/ci/variables/predefined_variables.html
says variable CI_SERVER="yes" is available in all versions of Gitlab.

3 years agoBuild gcc:oraclelinux9:amd64 CI jobs with --disable-developer
Petr Špaček [Thu, 13 Oct 2022 15:49:36 +0000 (17:49 +0200)] 
Build gcc:oraclelinux9:amd64 CI jobs with --disable-developer

Purpose of this is to guard against tests which rely on querytrace or
other optional features enabled by --enable-developer switch.

3 years agoMerge branch 'ondrej-add-ISC_LIST,LINK_INITIALIZER' into 'main'
Ondřej Surý [Tue, 18 Oct 2022 11:18:04 +0000 (11:18 +0000)] 
Merge branch 'ondrej-add-ISC_LIST,LINK_INITIALIZER' into 'main'

Add ISC_{LIST,LINK}_INITIALIZER for designated initializers

See merge request isc-projects/bind9!6928

3 years agoReplace (void *)-1 with ISC_LINK_TOMBSTONE
Ondřej Surý [Tue, 18 Oct 2022 09:28:03 +0000 (11:28 +0200)] 
Replace (void *)-1 with ISC_LINK_TOMBSTONE

Instead of having "arbitrary" (void *)-1 to define non-linked, add a
ISC_LINK_TOMBSTONE(type) macro that replaces the "magic" value with a
define.

3 years agoAdd ISC_{LIST,LINK}_INITIALIZER for designated initializers
Ondřej Surý [Tue, 18 Oct 2022 09:15:57 +0000 (11:15 +0200)] 
Add ISC_{LIST,LINK}_INITIALIZER for designated initializers

Since we are using designated initializers, we were missing initializers
for ISC_LIST and ISC_LINK, add them, so you can do

    *foo = (foo_t){ .list = ISC_LIST_INITIALIZER };

Instead of:

    *foo = (foo_t){ 0 };
    ISC_LIST_INIT(foo->list);

3 years agoMerge branch 'artem-sync-multilayer-stoplistening' into 'main'
Artem Boldariev [Tue, 18 Oct 2022 09:32:25 +0000 (09:32 +0000)] 
Merge branch 'artem-sync-multilayer-stoplistening' into 'main'

Synchronise stop listening operation for multi-layer transports

Closes #3606

See merge request isc-projects/bind9!6917

3 years agoSynchronise stop listening operation for multi-layer transports
Artem Boldariev [Fri, 14 Oct 2022 17:45:40 +0000 (20:45 +0300)] 
Synchronise stop listening operation for multi-layer transports

This commit introduces a primitive isc__nmsocket_stop() which performs
shutting down on a multilayered socket ensuring the proper order of
the operations.

The shared data within the socket object can be destroyed after the
call completed, as it is guaranteed to not be used from within the
context of other worker threads.

3 years agoMerge branch '3584-placeholder' into 'main'
Arаm Sаrgsyаn [Tue, 18 Oct 2022 08:51:46 +0000 (08:51 +0000)] 
Merge branch '3584-placeholder' into 'main'

Add a CHANGES placeholder for [GL #3584]

See merge request isc-projects/bind9!6927

3 years agoAdd a CHANGES placeholder for [GL #3584]
Aram Sargsyan [Tue, 18 Oct 2022 08:28:53 +0000 (08:28 +0000)] 
Add a CHANGES placeholder for [GL #3584]

3 years agoMerge branch 'pspacek/doc-nsupdate-server-gsstsig' into 'main'
Petr Špaček [Tue, 18 Oct 2022 08:12:47 +0000 (08:12 +0000)] 
Merge branch 'pspacek/doc-nsupdate-server-gsstsig' into 'main'

Document that nsupdate ignores server command in GSS-TSIG mode

See merge request isc-projects/bind9!6878

3 years agoDocument that nsupdate ignores server command in GSS-TSIG mode
Petr Špaček [Fri, 7 Oct 2022 11:40:05 +0000 (13:40 +0200)] 
Document that nsupdate ignores server command in GSS-TSIG mode

This behavior is present since introduction of GSS-TSIG support,
commit 289ae548d52bc8f982d9823af64cafda7bd92232.

3 years agoMerge branch 'fanf-deduplicate-file-line' into 'main'
Tony Finch [Mon, 17 Oct 2022 13:17:57 +0000 (13:17 +0000)] 
Merge branch 'fanf-deduplicate-file-line' into 'main'

De-duplicate __FILE__, __LINE__ plus some error reporting cleanup

See merge request isc-projects/bind9!6914

3 years agoCHANGES for [GL !6914]
Tony Finch [Fri, 14 Oct 2022 16:48:43 +0000 (17:48 +0100)] 
CHANGES for [GL !6914]

[cleanup] Less ceremonial UNEXPECTED_ERROR() and FATAL_ERROR()
reporting macros. [GL !6914]

3 years agoInclude the function name when reporting unexpected errors
Tony Finch [Fri, 14 Oct 2022 16:37:47 +0000 (17:37 +0100)] 
Include the function name when reporting unexpected errors

I.e. print the name of the function in BIND that called the system
function that returned an error. Since it was useful for pthreads
code, it seems worthwhile doing so everywhere.

3 years agoDe-duplicate some calls to strerror_r()
Tony Finch [Fri, 14 Oct 2022 16:18:07 +0000 (17:18 +0100)] 
De-duplicate some calls to strerror_r()

Specifically, when reporting an unexpected or fatal error.

3 years agoDe-duplicate __FILE__, __LINE__
Tony Finch [Fri, 14 Oct 2022 15:07:07 +0000 (16:07 +0100)] 
De-duplicate __FILE__, __LINE__

Mostly generated automatically with the following semantic patch,
except where coccinelle was confused by #ifdef in lib/isc/net.c

@@ expression list args; @@
- UNEXPECTED_ERROR(__FILE__, __LINE__, args)
+ UNEXPECTED_ERROR(args)
@@ expression list args; @@
- FATAL_ERROR(__FILE__, __LINE__, args)
+ FATAL_ERROR(args)

3 years agoMerge branch 'aram/cfg_print_duration-uninitialized-length' into 'main'
Arаm Sаrgsyаn [Mon, 17 Oct 2022 09:15:13 +0000 (09:15 +0000)] 
Merge branch 'aram/cfg_print_duration-uninitialized-length' into 'main'

Fix a logical bug in cfg_print_duration()

See merge request isc-projects/bind9!6880

3 years agoHandle large numbers when parsing/printing a duration
Aram Sargsyan [Mon, 17 Oct 2022 08:45:45 +0000 (08:45 +0000)] 
Handle large numbers when parsing/printing a duration

The isccfg_duration_fromtext() function is truncating large numbers
to 32 bits instead of capping or rejecting them, i.e. 64424509445,
which is 0xf00000005, gets parsed as 32-bit value 5 (0x00000005).

Fail parsing a duration if any of its components is bigger than
32 bits. Using those kind of big numbers has no practical use case
for a duration.

The isccfg_duration_toseconds() function can overflow the 32 bit
seconds variable when calculating the duration from its component
parts.

To avoid that, use 64-bit calculation and return UINT32_MAX if the
calculated value is bigger than UINT32_MAX. Again, a number this big
has no practical use case anyway.

The buffer for the generated duration string is limited to 64 bytes,
which, in theory, is smaller than the longest possible generated
duration string.

Use 80 bytes instead, calculated by the '7 x (10 + 1) + 3' formula,
where '7' is the count of the duration's parts (year, month, etc.), '10'
is their maximum length when printed as a decimal number, '1' is their
indicator character (Y, M, etc.), and 3 is two more indicators (P and T)
and the terminating NUL character.

3 years agoAdd a CHANGES note for [GL !6880]
Aram Sargsyan [Mon, 17 Oct 2022 08:45:34 +0000 (08:45 +0000)] 
Add a CHANGES note for [GL !6880]

3 years agoFix an off-by-one error in cfg_print_duration()
Aram Sargsyan [Mon, 17 Oct 2022 08:45:26 +0000 (08:45 +0000)] 
Fix an off-by-one error in cfg_print_duration()

The cfg_print_duration() checks added previously in the 'duration_test'
unit test uncovered a bug in cfg_print_duration().

When calculating the current 'str' pointer of the generated text in the
buffer 'buf', it erroneously adds 1 byte to compensate for that part's
indicator character. For example, to add 12 minutes, it needs to add
2 + 1 = 3 characters, where 2 is the length of "12", and 1 is the length
of "M" (for minute). The mistake was that the length of the indicator
is already included in 'durationlen[i]', so there is no need to
calculate it again.

In the result of this mistake the current pointer can advance further
than needed and end up after the zero-byte instead of right on it, which
essentially cuts off any further generated text. For example, for a
5 minutes and 30 seconds duration, instead of having this:

    'P', 'T', '5', 'M', '3', '0', 'S', '\0'

The function generates this:

    'P', 'T', '5', 'M', '\0', '3', '0', 'S', '\0'

Fix the bug by adding to 'str' just 'durationlen[i]' instead of
'durationlen[i] + 1'.

3 years agoTest cfg_print_duration() in duration_test.c
Aram Sargsyan [Mon, 17 Oct 2022 08:45:18 +0000 (08:45 +0000)] 
Test cfg_print_duration() in duration_test.c

Currently the 'duration_test' unit test checks only the
cfg_obj_asduration() function.

Extend the test so it checks also the reverse operation using the
cfg_print_duration() function, which is used in named-checkconf.

3 years agoFix a logical bug in cfg_print_duration()
Aram Sargsyan [Mon, 17 Oct 2022 08:45:09 +0000 (08:45 +0000)] 
Fix a logical bug in cfg_print_duration()

The cfg_print_duration() function prints a ISO 8601 duration value
converted from an array of integers, where the parts of the date and
time are stored.

durationlen[6], which holds the "seconds" part of the duration, has
a special case in cfg_print_duration() to ensure that when there are
no values in the duration, the result still can be printed as "PT0S",
instead of just "P", so it can be a valid ISO 8601 duration value.

There is a logical error in one of the two special case code paths,
when it checks that no value from the "date" part is defined, and no
"hour" or "minute" from the "time" part are defined.

Because of the error, durationlen[6] can be used uninitialized, in
which case the second parameter passed to snprintf() (which is the
maximum allowed length) can contain a garbage value.

This can not be exploited because the buffer is still big enough to
hold the maximum possible amount of characters generated by the "%u%c"
format string.

Fix the logical bug, and initialize the 'durationlen' array to zeros
to be a little safer from other similar errors.

3 years agoMerge branch 'mnowak/fix-grep-3.8-warnings' into 'main'
Ondřej Surý [Mon, 17 Oct 2022 07:09:16 +0000 (07:09 +0000)] 
Merge branch 'mnowak/fix-grep-3.8-warnings' into 'main'

Fix GNU Grep 3.8 warnings

See merge request isc-projects/bind9!6786

3 years agoAdd CI check for Grep warnings
Michal Nowak [Fri, 16 Sep 2022 10:05:46 +0000 (12:05 +0200)] 
Add CI check for Grep warnings

3 years agoReplace fgrep and egrep with grep -F/-E
Michal Nowak [Fri, 16 Sep 2022 10:13:52 +0000 (12:13 +0200)] 
Replace fgrep and egrep with grep -F/-E

GNU Grep 3.8 reports the following warnings:

    egrep: warning: egrep is obsolescent; using grep -E
    fgrep: warning: fgrep is obsolescent; using grep -F

3 years agoRemove stray backslashes
Michal Nowak [Fri, 16 Sep 2022 09:50:37 +0000 (11:50 +0200)] 
Remove stray backslashes

GNU Grep 3.8 reports several instances of stray backslashes in matching
patterns:

    grep: warning: stray \ before /
    grep: warning: stray \ before :

3 years agoMerge branch 'fanf-compress-smaller' into 'main'
Ondřej Surý [Mon, 17 Oct 2022 07:00:39 +0000 (07:00 +0000)] 
Merge branch 'fanf-compress-smaller' into 'main'

Simplify and speed up DNS name compression

See merge request isc-projects/bind9!6517

3 years agoCHANGES note for [GL !6517]
Tony Finch [Thu, 30 Jun 2022 16:19:54 +0000 (17:19 +0100)] 
CHANGES note for [GL !6517]

[performance] A new algorithm for DNS name compression based on a
hash set of message offsets. Name compression is now
more complete as well as being generally faster, and
the implementation is less complicated and requires
much less memory.

3 years agoA couple of compression microbenchmarks
Tony Finch [Sat, 25 Jun 2022 14:29:54 +0000 (15:29 +0100)] 
A couple of compression microbenchmarks

The `render` benchmark loads some binary DNS message dumps and
repeatedly passes them to `dns_message_render`.

The `compress` benchmark loads a list of domain names and packs them
into 4KiB chunks using `dns_name_towire`.

3 years agoTest compression context hash set collisions
Tony Finch [Fri, 16 Sep 2022 17:55:48 +0000 (18:55 +0100)] 
Test compression context hash set collisions

Check that names are correctly added and deleted in the compression
context. Use many names with differing numerical prefixes to make it
relatively easy to identify and debug problems.

3 years agoSimplify and speed up DNS name compression
Tony Finch [Thu, 23 Jun 2022 20:53:46 +0000 (21:53 +0100)] 
Simplify and speed up DNS name compression

All we need for compression is a very small hash set of compression
offsets, because most of the information we need (the previously added
names) can be found in the message using the compression offsets.

This change combines dns_compress_find() and dns_compress_add() into
one function dns_compress_name() that both finds any existing suffix,
and adds any new prefix to the table. The old split led to performance
problems caused by duplicate names in the compression context.

Compression contexts are now either small or large, which the caller
chooses depending on the expected size of the message. There is no
dynamic resizing.

There is a behaviour change: compression now acts on all the labels in
each name, instead of just the last few.

A small benchmark suggests this is about 2x faster.

3 years agoMerge branch 'artem-isc_nmsocket_set_tlsctx-loopmgr-fix' into 'main'
Artem Boldariev [Sun, 16 Oct 2022 21:50:51 +0000 (21:50 +0000)] 
Merge branch 'artem-isc_nmsocket_set_tlsctx-loopmgr-fix' into 'main'

Fix isc_nmsocket_set_tlsctx() broken during loopmgr refactroing

See merge request isc-projects/bind9!6915

3 years agoFix isc_nmsocket_set_tlsctx()
Artem Boldariev [Fri, 14 Oct 2022 18:36:51 +0000 (21:36 +0300)] 
Fix isc_nmsocket_set_tlsctx()

During loop manager refactoring isc_nmsocket_set_tlsctx() was not
properly adapted. The function is expected to broadcast the new TLS
context for every worker, but this behaviour was accidentally broken.

3 years agoMerge branch 'ondrej-pthread_once-runtime-check' into 'main'
Ondřej Surý [Fri, 14 Oct 2022 14:40:31 +0000 (14:40 +0000)] 
Merge branch 'ondrej-pthread_once-runtime-check' into 'main'

Improve reporting for pthread_once errors

See merge request isc-projects/bind9!6910

3 years agoImprove reporting for pthread_once errors
Ondřej Surý [Fri, 14 Oct 2022 14:10:41 +0000 (16:10 +0200)] 
Improve reporting for pthread_once errors

Replace all uses of RUNTIME_CHECK() in lib/isc/include/isc/once.h with
PTHEADS_RUNTIME_CHECK(), in order to improve error reporting for any
once-related run-time failures (by augmenting error messages with
file/line/caller information and the error string corresponding to
errno).

3 years agoMerge branch 'tkrizek/remove-system-test-delzone' into 'main'
Tom Krizek [Fri, 14 Oct 2022 14:37:39 +0000 (14:37 +0000)] 
Merge branch 'tkrizek/remove-system-test-delzone' into 'main'

Remove system test delzone

See merge request isc-projects/bind9!6882

3 years agoRemove system test delzone
Tom Krizek [Mon, 10 Oct 2022 11:28:29 +0000 (13:28 +0200)] 
Remove system test delzone

There are multiple reasons to remove this test as obsolete:

- The test may not possibly work for over 2.5 years, since
  98b3b93791777218c04a67ddaef22619162249f7 removed the rndc.py python
  tool on which this test relies.
- It isn't part of the test suite either in CI or locally unless it is
  explicitly enabled. As a result, there are many issues which prevent
  the test from being executed caused by various refactoring efforts
  accumulated over time.
- Even if the test could be executed, it has no clear failure condition.
  If the python script(s) fail, the test still passes.

3 years agoMerge branch 'ondrej-refactor-isc_httpd' into 'main'
Ondřej Surý [Fri, 14 Oct 2022 10:23:21 +0000 (10:23 +0000)] 
Merge branch 'ondrej-refactor-isc_httpd' into 'main'

Rewrite isc_httpd using picohttpparser and isc_url_parse

See merge request isc-projects/bind9!6879

3 years agoAdd CHANGES note for [GL !6879]
Ondřej Surý [Fri, 7 Oct 2022 13:58:43 +0000 (15:58 +0200)] 
Add CHANGES note for [GL !6879]

3 years agoReplace the statschannel truncated tests with two new tests
Ondřej Surý [Thu, 6 Oct 2022 10:56:25 +0000 (12:56 +0200)] 
Replace the statschannel truncated tests with two new tests

Now that the artificial limit on the recv buffer has been removed, the
current system test always fails because it tests if the truncation has
happened.

Add test that sending more than 10 headers makes the connection to
closed; and add test that sending huge HTTP request makes the connection
to be closed.

3 years agoRewrite isc_httpd using picohttpparser and isc_url_parse
Ondřej Surý [Thu, 6 Oct 2022 10:56:25 +0000 (12:56 +0200)] 
Rewrite isc_httpd using picohttpparser and isc_url_parse

Rewrite the isc_httpd to be more robust.

1. Replace the hand-crafted HTTP request parser with picohttpparser for
   parsing the whole HTTP/1.0 and HTTP/1.1 requests.  Limit the number
   of allowed headers to 10 (arbitrary number).

2. Replace the hand-crafted URL parser with isc_url_parse for parsing
   the URL from the HTTP request.

3. Increase the receive buffer to match the isc_netmgr buffers, so we
   can at least receive two full isc_nm_read()s.  This makes the
   truncation processing much simpler.

4. Process the received buffer from single isc_nm_read() in a single
   loop and schedule the sends to be independent of each other.

The first two changes makes the code simpler and rely on already
existing libraries that we already had (isc_url based on nodejs) or are
used elsewhere (picohttpparser).

The second two changes remove the artificial "truncation" limit on
parsing multiple request.  Now only a request that has too many
headers (currently 10) or is too big (so, the receive buffer fills up
without reaching end of the request) will end the connection.

We can be benevolent here with the limites, because the statschannel
channel is by definition private and access must be allowed only to
administrators of the server.  There are no timers, no rate-limiting, no
upper limit on the number of requests that can be served, etc.

3 years agoAdd picohttpparser.{c.h} from https://github.com/h2o/picohttpparser
Ondřej Surý [Fri, 7 Oct 2022 13:48:26 +0000 (15:48 +0200)] 
Add picohttpparser.{c.h} from https://github.com/h2o/picohttpparser

PicoHTTPParser is a tiny, primitive, fast HTTP request/response parser.

Unlike most parsers, it is stateless and does not allocate memory by
itself. All it does is accept pointer to buffer and the output
structure, and setups the pointers in the latter to point at the
necessary portions of the buffer.

3 years agoMerge branch 'pspacek/git-blame-ignore-revs' into 'main'
Petr Špaček [Thu, 13 Oct 2022 16:02:33 +0000 (16:02 +0000)] 
Merge branch 'pspacek/git-blame-ignore-revs' into 'main'

Add list of meaningless commits to .git-blame-ignore-revs

See merge request isc-projects/bind9!6903

3 years agoAdd list of meaningless commits to .git-blame-ignore-revs
Petr Špaček [Thu, 13 Oct 2022 12:33:52 +0000 (14:33 +0200)] 
Add list of meaningless commits to .git-blame-ignore-revs

Works nicely together with:
    git config --add blame.ignoreRevsFile .git-blame-ignore-revs

The list was generated by hand-picking from git log --oneline augmented
with:
    --author=tbox
    --grep=clang-format
    --grep=copyright
    --grep=reformat
    --grep=whitespace
plus
    git log --format='commit %H %s' --stat | grep -E 'commit|changed' | grep -B1 '[0-9][0-9][0-9] files changed'
plus some sanity checking.

Comments were added with:
    for COMMIT in $(cat .git-blame-ignore-revs)
        do git log -1 --format="# %s" "$COMMIT"
        echo $COMMIT
    done

3 years agoMerge branch 'pspacek/dns-name-attributes-struct' into 'main'
Petr Špaček [Thu, 13 Oct 2022 15:22:57 +0000 (15:22 +0000)] 
Merge branch 'pspacek/dns-name-attributes-struct' into 'main'

Replace #define DNS_NAMEATTR_* with struct of booleans

See merge request isc-projects/bind9!6902

3 years agoReplace #define DNS_NAMEATTR_ with struct of bools
Petr Špaček [Thu, 13 Oct 2022 08:33:41 +0000 (10:33 +0200)] 
Replace #define DNS_NAMEATTR_ with struct of bools

sizeof(dns_name_t) did not change but the boolean attributes are now
separated as one-bit structure members. This allows debuggers to
pretty-print dns_name_t attributes without any special hacks, plus we
got rid of manual bit manipulation code.

3 years agoFix latent bug in RBT node attributes handling
Petr Špaček [Thu, 13 Oct 2022 11:08:22 +0000 (13:08 +0200)] 
Fix latent bug in RBT node attributes handling

Originally RBT node stored three lowest bits from dns_name_t attributes.
This had a curious side-effect noticed by Tony Finch:

If you create an rbt node from a DYNAMIC name then the flag will be
propagated through dns_rbt_namefromnode() ... if you subsequently call
dns_name_free() it will try to isc_mem_put() a piece of an rbt node ...
but dns_name_free() REQUIRE()s that the name is dynamic so in the usual
case where rbt nodes are created from non-dynamic names, this kind of
code will fail an assertion.

This is a bug it dates back to june 1999 when NAMEATTR_DYNAMIC was
invented.

Apparently it does not happen often :-)
I'm planning to get rid of DNS_NAMEATTR_ definitions and bit operations,
so removal of this "three-bit-subset" assignment is a first step.

We can keep only the ABSOLUTE flag in RBT node and nothing else because
names attached to rbt nodes are always readonly: The internal node_name()
function always sets the NAMEATTR_READONLY when making a dns_name that
refers to the node's name, so the READONLY flag will be set in the name
returned by dns_rbt_namefromnode().

Co-authored-by: Tony Finch <fanf@isc.org>
3 years agoMerge branch 'artem-doth-reduce-listener-sockets-number' into 'main'
Ondřej Surý [Thu, 13 Oct 2022 05:37:48 +0000 (05:37 +0000)] 
Merge branch 'artem-doth-reduce-listener-sockets-number' into 'main'

doth system test fixes - decrese the size of HTTP listener quota, increase transfer-in/out limits

Closes #3596

See merge request isc-projects/bind9!6898

3 years agodoth system test: increase transfers-in/out limits
Artem Boldariev [Wed, 24 Aug 2022 17:44:47 +0000 (20:44 +0300)] 
doth system test: increase transfers-in/out limits

Sometimes doth test could intermittently fail shortly after start due
to inability to complete a zone transfer in time. As it turned out, it
could happen due to transfers-in/out limits. Initially the defaults
were fine, but over time, especially when adding Strict/Mutual TLS, we
added more than 10 zones so it became possible to hit the limits.

This commit takes care of that by bumping the limits.

3 years agodoth system test - decrease HTTP listener quota size
Artem Boldariev [Wed, 12 Oct 2022 15:46:54 +0000 (18:46 +0300)] 
doth system test - decrease HTTP listener quota size

This commit reduces the size of HTTP listener quota from 300 (default)
to 100 so that it would make hitting any global limits in case of
running multiple tests in parallel in multiple containers unlikely.

This way the need in opening many file descriptors of different
kinds (e.g. client side connections and pipes) gets significantly
reduced while the required code paths are still verified.

3 years agoMerge branch 'ondrej-restore-connrefused-for-udp_test' into 'main'
Ondřej Surý [Wed, 12 Oct 2022 17:24:24 +0000 (17:24 +0000)] 
Merge branch 'ondrej-restore-connrefused-for-udp_test' into 'main'

Restore ignoring ISC_R_CONNREFUSED in connect_read_cb

See merge request isc-projects/bind9!6899

3 years agoRestore ignoring ISC_R_CONNREFUSED in connect_read_cb
Ondřej Surý [Wed, 12 Oct 2022 17:21:42 +0000 (19:21 +0200)] 
Restore ignoring ISC_R_CONNREFUSED in connect_read_cb

In ac4cc8443dddc8e900188b4beae54c7ca222094c, the ISC_R_CONNREFUSED was
removed in connect_read_cb, but it can actually happen in the udp_test:

    [ RUN      ] udp_recv_send
    connect_read_cb(0x7f2c2801a270, connection refused, (nil))

3 years agoMerge branch '3595-dont-set-so_reuseport-on-outgoing-udp-sockets' into 'main'
Ondřej Surý [Wed, 12 Oct 2022 13:38:41 +0000 (13:38 +0000)] 
Merge branch '3595-dont-set-so_reuseport-on-outgoing-udp-sockets' into 'main'

The UDP connect socket should not set REUSEPORT_LB

See merge request isc-projects/bind9!6888

3 years agoMerge branch '3595-retry-on-timeout-in-udp_recv_one-and_udp_recv_two-unit-test' into...
Ondřej Surý [Wed, 12 Oct 2022 13:36:31 +0000 (13:36 +0000)] 
Merge branch '3595-retry-on-timeout-in-udp_recv_one-and_udp_recv_two-unit-test' into 'main'

Retry on timeout in the UDP recv_one, udp_recv_two and double_read tests

See merge request isc-projects/bind9!6894

3 years agoGracefully handle ISC_R_SHUTTINGDOWN in udp__send_cb
Ondřej Surý [Tue, 11 Oct 2022 10:29:48 +0000 (12:29 +0200)] 
Gracefully handle ISC_R_SHUTTINGDOWN in udp__send_cb

The ISC_R_SHUTTINGDOWN should be handled the same as ISC_R_CANCELED in
the udp__send_cb(), as we might be sending the data while the
loopmgr/netmgr shutdown has been initiated.

3 years agoMake sure the unit test listening and connecting ports are different
Ondřej Surý [Tue, 11 Oct 2022 10:03:17 +0000 (12:03 +0200)] 
Make sure the unit test listening and connecting ports are different

In rare circumstances, the UDP port for the listening socket and the UDP
port for the connecting socket might be the same.  Because we use the
"reuse" port socket option, this isn't caught when binding the socket,
and thus the connected client socket could send a datagram to itself,
completely bypassing the server.  This doesn't happen under normal
operation mode because `named` is listening on a privileged port (53),
and even if not, it doesn't usually talk to itself as the tests do.

Pick an arbitrary port for listening (9153-9156) that is outside the
ephemeral port range for the network manager related unit tests (except
the `doh_test).

3 years agoDon't set load-balancing socket option on the UDP connect sockets
Ondřej Surý [Tue, 11 Oct 2022 07:10:16 +0000 (09:10 +0200)] 
Don't set load-balancing socket option on the UDP connect sockets

The isc_nm_udpconnect() erroneously set the reuse port with
load-balancing on the outgoing connected UDP sockets.  This socket
option makes only sense for the listening sockets.  Don't set the
load-balancing reuse port option on the outgoing UDP sockets.

3 years agoRetry on timeout in the UDP recv_one, recv_two and double_read tests
Ondřej Surý [Wed, 12 Oct 2022 07:43:56 +0000 (09:43 +0200)] 
Retry on timeout in the UDP recv_one, recv_two and double_read tests

Since we are testing UDP on the localhost and the same interface, the
UDP datagrams can't get lost.  Change the connect read callback, so it
starts reading again on the timeout instead of just getting stuck, and
fail when any other result codes than ISC_R_SUCCESS and ISC_R_TIMEDOUT
are received because we don't expect them to happen in these simple
tests.

3 years agoMerge branch 'artem-clear-ssl-error-queue-for-dns-transports' into 'main'
Ondřej Surý [Wed, 12 Oct 2022 13:33:38 +0000 (13:33 +0000)] 
Merge branch 'artem-clear-ssl-error-queue-for-dns-transports' into 'main'

TLS: clear error queue before doing I/O or calling SSL_get_error()

See merge request isc-projects/bind9!6892

3 years agoDoH unit test: remove broken remnants of slowdown logic
Artem Boldariev [Wed, 12 Oct 2022 12:26:06 +0000 (15:26 +0300)] 
DoH unit test: remove broken remnants of slowdown logic

This commit removes broken remnants of unit test slowdown logic, which
caused unit test hangs on platforms susceptible to "too many open
files" error, notably OpenBSD.

3 years agoTLS DNS: fix certificate verification error message reporting
Artem Boldariev [Tue, 11 Oct 2022 18:00:04 +0000 (21:00 +0300)] 
TLS DNS: fix certificate verification error message reporting

This commit fixes TLS DNS verification error message reporting which
we probably broke during one of the recent networking code
refactorings.

This prevent e.g. dig from producing useful error messages related to
TLS certificates verification.

3 years agoTLS: clear error queue before doing IO or calling SSL_get_error()
Artem Boldariev [Tue, 4 Oct 2022 18:03:23 +0000 (21:03 +0300)] 
TLS: clear error queue before doing IO or calling SSL_get_error()

Ensure that TLS error is empty before calling SSL_get_error() or doing
SSL I/O so that the result will not get affected by prior error
statuses.

In particular, the improper error handling led to intermittent unit
test failure and, thus, could be responsible for some of the system
test failures and other intermittent TLS-related issues.

See here for more details:

https://www.openssl.org/docs/man3.0/man3/SSL_get_error.html

In particular, it mentions the following:

> The current thread's error queue must be empty before the TLS/SSL
> I/O operation is attempted, or SSL_get_error() will not work
> reliably.

As we use the result of SSL_get_error() to decide on I/O operations,
we need to ensure that it works reliably by cleaning the error queue.

TLS DNS: empty error queue before attempting I/O

3 years agoMerge branch '3601-ignore-connection_reset-in-listen_send_cb' into 'main'
Ondřej Surý [Wed, 12 Oct 2022 13:19:03 +0000 (13:19 +0000)] 
Merge branch '3601-ignore-connection_reset-in-listen_send_cb' into 'main'

Ignore additional return codes in the netmgr unit tests

Closes #3601

See merge request isc-projects/bind9!6895

3 years agoIgnore additional return codes in the netmgr unit tests
Ondřej Surý [Wed, 12 Oct 2022 12:40:49 +0000 (14:40 +0200)] 
Ignore additional return codes in the netmgr unit tests

There was inconsistency in which error codes would get accepted and
ignored in the network manager unit test callbacks.  Add following
results, so we just detach the handle instead of causing assertion
failure:

* ISC_R_SHUTTINGDOWN - when the network manager is shutting down
* ISC_R_CANCELED - the socket has been shut down
* ISC_R_EOF - the (TCP) communication has ended on the other side
* ISC_R_CONNECTIONRESET - the TCP connection was reset

This should fix some of the spurious unit test failures.

3 years agoMerge branch '3574-cid-357292-improper-use-of-negative-value-in-tcp.c' into 'main'
Arаm Sаrgsyаn [Wed, 12 Oct 2022 09:00:21 +0000 (09:00 +0000)] 
Merge branch '3574-cid-357292-improper-use-of-negative-value-in-tcp.c' into 'main'

Resolve "CID 357292: Improper use of negative value in lib/isc/netmgr/tcp.c"

Closes #3574

See merge request isc-projects/bind9!6851

3 years agoRemove a superfluous check of sock->fd against -1
Aram Sargsyan [Wed, 12 Oct 2022 08:21:35 +0000 (08:21 +0000)] 
Remove a superfluous check of sock->fd against -1

The check is left from when tcp_connect_direct() called isc__nm_socket()
and it was uncertain whether it had succeeded, but now isc__nm_socket()
is called before tcp_connect_direct(), so sock->fd cannot be -1.

    *** CID 357292:    (REVERSE_NEGATIVE)
    /lib/isc/netmgr/tcp.c: 309 in isc_nm_tcpconnect()
    303
    304      atomic_store(&sock->active, true);
    305
    306      result = tcp_connect_direct(sock, req);
    307      if (result != ISC_R_SUCCESS) {
    308      atomic_store(&sock->active, false);
    >>>     CID 357292:    (REVERSE_NEGATIVE)
    >>>     You might be using variable "sock->fd" before verifying that it is >= 0.
    309      if (sock->fd != (uv_os_sock_t)(-1)) {
    310      isc__nm_tcp_close(sock);
    311      }
    312      isc__nm_connectcb(sock, req, result, true);
    313      }
    314

3 years agoMerge branch '3595-fix-the-intermittent-udp_test-failures' into 'main'
Ondřej Surý [Tue, 11 Oct 2022 13:02:14 +0000 (13:02 +0000)] 
Merge branch '3595-fix-the-intermittent-udp_test-failures' into 'main'

Handle double timeout in udp_cancel_read test

See merge request isc-projects/bind9!6889

3 years agoHandle double timeout in udp_cancel_read test
Ondřej Surý [Tue, 11 Oct 2022 07:06:37 +0000 (09:06 +0200)] 
Handle double timeout in udp_cancel_read test

If sending took too long the isc_nm_read() could timeout twice, leading
to extra 'cread' counter in the udp_cancel_read test.  Increase the
cread counter only on ISC_R_EOF (canceled read) and deal with the
multiple ISC_R_TIMEOUTS gracefully.

3 years agoMerge branch '3592-fix-startup-detection-after-restart-in-start.pl' into 'main'
Michał Kępień [Tue, 11 Oct 2022 09:55:51 +0000 (09:55 +0000)] 
Merge branch '3592-fix-startup-detection-after-restart-in-start.pl' into 'main'

Fix startup detection after restart in start.pl

Closes #3592

See merge request isc-projects/bind9!6881

3 years agoFix startup detection after restart in start.pl
Michał Kępień [Tue, 11 Oct 2022 09:54:57 +0000 (11:54 +0200)] 
Fix startup detection after restart in start.pl

The bin/tests/system/start.pl script waits until a "running" message is
logged by a given name server instance before attempting to send a
version.bind/CH/TXT query to it.  The idea behind this was to make the
script wait until named loads all the zones it is configured to serve
before telling the system test framework that a given server is ready to
use; this prevents the need to add boilerplate code that waits for a
specific zone to be loaded to each test expecting that.

The problem is that when it looks for "running" messages, the
bin/tests/system/start.pl script assumes that the existence of any such
message in the named.run file indicates that a given named instance has
already finished loading all zones.  Meanwhile, some system tests
restart all the named instances they use throughout their lifetime (some
even do that a few times), for example to run Python-based tests.  The
bin/tests/system/start.pl script handles such a scenario incorrectly: as
soon as it finds any "running" message in the named.run file it inspects
and it gets a response to a version.bind/CH/TXT query, it tells the
system test framework that a given server is ready to use, which might
not be true - it is possible that only the "version.bind" zone is loaded
at that point and the "running" message found was logged by a
previously-shutdown named instance. This triggers intermittent failures
for Python-based tests.

Fix by improving the logic that the bin/tests/system/start.pl script
uses to detect server startup: check how many "running" lines are
present in a given named.run file before attempting to start a named
instance and only proceed with version.bind/CH/TXT queries when the
number of "running" lines found in that named.run file increases after
the server is started.

3 years agoDo not truncate ns2 logs in the "rrsetorder" test
Michał Kępień [Tue, 11 Oct 2022 09:54:57 +0000 (11:54 +0200)] 
Do not truncate ns2 logs in the "rrsetorder" test

In the "rrsetorder" system test, the ns2 named instance is restarted
without passing the --restart option to bin/tests/system/start.pl.  This
causes the log file for that named instance to be needlessly truncated.
Prevent this from happening by restarting the affected named instance
in the same way as all the other named instances used in system tests.

3 years agoMerge branch 'michal/set-up-version-and-release-notes-for-bind-9.19.7' into 'main'
Michał Kępień [Mon, 10 Oct 2022 21:36:36 +0000 (21:36 +0000)] 
Merge branch 'michal/set-up-version-and-release-notes-for-bind-9.19.7' into 'main'

Set up version and release notes for BIND 9.19.7

See merge request isc-projects/bind9!6884

3 years agoSet up release notes for BIND 9.19.7
Michał Kępień [Mon, 10 Oct 2022 21:17:49 +0000 (23:17 +0200)] 
Set up release notes for BIND 9.19.7

3 years agoUpdate BIND version to 9.19.7-dev
Michał Kępień [Mon, 10 Oct 2022 21:17:49 +0000 (23:17 +0200)] 
Update BIND version to 9.19.7-dev

3 years agoMerge branch '3554-improve-dnssec-policy-inline-signing-err-msg' into 'main'
Petr Špaček [Thu, 6 Oct 2022 08:27:08 +0000 (08:27 +0000)] 
Merge branch '3554-improve-dnssec-policy-inline-signing-err-msg' into 'main'

Clarify new configuration incompabitility: dnssec-policy vs. inline-signing

See merge request isc-projects/bind9!6865

3 years agoAdd Known Issue about config incompatibility
Petr Špaček [Wed, 5 Oct 2022 13:21:36 +0000 (15:21 +0200)] 
Add Known Issue about config incompatibility

3 years agoClarify error message about missing inline-signing & dnssec-policy
Petr Špaček [Wed, 5 Oct 2022 12:44:09 +0000 (14:44 +0200)] 
Clarify error message about missing inline-signing & dnssec-policy

3 years agoMerge branch '3577-reloads-in-ixfr-system-test-happen-too-fast' into 'main'
Mark Andrews [Wed, 5 Oct 2022 21:33:04 +0000 (21:33 +0000)] 
Merge branch '3577-reloads-in-ixfr-system-test-happen-too-fast' into 'main'

Resolve "reloads in ixfr system test happen too fast"

Closes #3577

See merge request isc-projects/bind9!6855

3 years agoAdd sleeps to ixfr system test
Mark Andrews [Wed, 5 Oct 2022 05:26:24 +0000 (16:26 +1100)] 
Add sleeps to ixfr system test

ensure that at least a second has passed since a zone was last loaded
to prevent it accidentally being skipped as up to date.

3 years agoMerge branch '3560-fix-view-resolver-layer-weak-references-violation' into 'main'
Evan Hunt [Wed, 5 Oct 2022 19:33:57 +0000 (19:33 +0000)] 
Merge branch '3560-fix-view-resolver-layer-weak-references-violation' into 'main'

Resolve violation of weak referencing dns_view

Closes #3560

See merge request isc-projects/bind9!6848

3 years agoRecord the 'edns-udp-size' in the view, not in the resolver
Ondřej Surý [Tue, 4 Oct 2022 15:07:19 +0000 (17:07 +0200)] 
Record the 'edns-udp-size' in the view, not in the resolver

Getting the recorded value of 'edns-udp-size' from the resolver requires
strong attach to the dns_view because we are accessing `view->resolver`.
This is not the case in places (f.e. dns_zone unit) where `.udpsize` is
accessed.  By moving the .udpsize field from `struct dns_resolver` to
`struct dns_view`, we can access the value directly even with weakly
attached dns_view without the need to lock the view because `.udpsize`
can be accessed after the dns_view object has been shut down.

3 years agoResolve violation of weak referencing dns_view
Ondřej Surý [Mon, 3 Oct 2022 13:54:12 +0000 (15:54 +0200)] 
Resolve violation of weak referencing dns_view

The dns_view implements weak and strong reference counting.  When strong
reference counting reaches zero, the adb, ntatable and resolver objects
are shut down and detached.

In dns_zone and dns_nta the dns_view was weakly attached, but the
view->resolver reference was accessed directly leading to dereferencing
the NULL pointer.

Add dns_view_getresolver() method which attaches to view->resolver
object under the lock (if it still exists) ensuring the dns_resolver
will be kept referenced until not needed.

3 years agoMerge branch 'mnowak/drop-flake8-ignore-lists' into 'main'
Michal Nowak [Wed, 5 Oct 2022 16:05:41 +0000 (16:05 +0000)] 
Merge branch 'mnowak/drop-flake8-ignore-lists' into 'main'

Drop flake8 ignore lists

See merge request isc-projects/bind9!6778

3 years agoDrop flake8 ignore lists
Michal Nowak [Thu, 15 Sep 2022 08:50:47 +0000 (10:50 +0200)] 
Drop flake8 ignore lists

flake8 is not used in BIND 9 CI and inline ignore lists are not needed
anymore.

3 years agoMerge branch '3580-coverity-constant-boolean-dead-code' into 'main'
Tony Finch [Wed, 5 Oct 2022 15:51:20 +0000 (15:51 +0000)] 
Merge branch '3580-coverity-constant-boolean-dead-code' into 'main'

Avoid dead code warning when using a constant boolean

Closes #3580

See merge request isc-projects/bind9!6862

3 years agoAvoid dead code warning when using a constant boolean
Tony Finch [Wed, 5 Oct 2022 11:11:41 +0000 (12:11 +0100)] 
Avoid dead code warning when using a constant boolean

The value of `sign_bit` is platform-dependent but constant at compile
time. Use a cast to convert the boolean `sign_bit` to 0 or 1 instead of
ternary `?:` because one branch of the conditional is dead code. (We
could leave out the cast to `size_t` but our style prefers to handle
booleans more explicitly, hence the `?:` that caused the issue.)

    *** CID 358310:  Possible Control flow issues  (DEADCODE)
    /lib/isc/resource.c: 118 in isc_resource_setlimit()
    112       * rlim_t, and whether rlim_t has a sign bit.
    113       */
    114      isc_resourcevalue_t rlim_max = UINT64_MAX;
    115      size_t wider = sizeof(rlim_max) - sizeof(rlim_t);
    116      bool sign_bit = (double)(rlim_t)-1 < 0;
    117
    >>>     CID 358310:  Possible Control flow issues  (DEADCODE)
    >>>     Execution cannot reach the expression "1" inside this statement: "rlim_max >>= 8UL * wider + ...".
    118      rlim_max >>= CHAR_BIT * wider + (sign_bit ? 1 : 0);
    119      rlim_value = ISC_MIN(value, rlim_max);
    120      }
    121
    122      rl.rlim_cur = rl.rlim_max = rlim_value;
    123      unixresult = setrlimit(unixresource, &rl);

3 years agoMerge branch 'ondrej/add-isc_mem_zero' into 'main'
Ondřej Surý [Wed, 5 Oct 2022 14:44:36 +0000 (14:44 +0000)] 
Merge branch 'ondrej/add-isc_mem_zero' into 'main'

Replace isc_mem_*_aligned(..., alignment) with isc_mem_*x(..., flags)

See merge request isc-projects/bind9!6398

3 years agoAdd CHANGES note for [GL !6398]
Ondřej Surý [Fri, 26 Aug 2022 10:04:32 +0000 (12:04 +0200)] 
Add CHANGES note for [GL !6398]

3 years agoUse isc_mem_regetx() when appropriate
Ondřej Surý [Fri, 26 Aug 2022 09:58:51 +0000 (11:58 +0200)] 
Use isc_mem_regetx() when appropriate

While refactoring the isc_mem_getx(...) usage, couple places were
identified where the memory was resized manually.  Use the
isc_mem_reget(...) that was introduced in [GL !5440] to resize the
arrays via function rather than a custom code.

3 years agoUse designated initializers instead of memset()/MEM_ZERO for structs
Ondřej Surý [Fri, 26 Aug 2022 09:58:51 +0000 (11:58 +0200)] 
Use designated initializers instead of memset()/MEM_ZERO for structs

In several places, the structures were cleaned with memset(...)) and
thus the semantic patch converted the isc_mem_get(...) to
isc_mem_getx(..., ISC_MEM_ZERO).  Use the designated initializer to
initialized the structures instead of zeroing the memory with
ISC_MEM_ZERO flag as this better matches the intended purpose.