2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-08-31 06:25:31 +00:00
Commit Graph

37503 Commits

Author SHA1 Message Date
Matthijs Mekking
c05034b906 Merge branch 'matthijs-fix-dnssec-signing-log-lovel' into 'main'
Change log level when doing rekey

See merge request isc-projects/bind9!6913
2022-10-18 14:25:19 +00:00
Matthijs Mekking
a1d57fc8cb 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.
2022-10-18 16:23:35 +02:00
Petr Špaček
b43f0e0674 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
2022-10-18 12:22:34 +00:00
Petr Špaček
c3e7bed1ab Fix cookie system test for builds without --enable-developer
The "connecting via TCP" message comes from FCTXTRACE which is not
available on some builds.
2022-10-18 13:54:45 +02:00
Petr Špaček
f2ed208db9 Merge branch 'pspacek/ci-no-developer-mode' into 'main'
Add CI job with --disable-developer

See merge request isc-projects/bind9!6930
2022-10-18 11:51:23 +00:00
Petr Špaček
ddf46056ca 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.
2022-10-18 13:30:16 +02:00
Petr Špaček
d6db5c5335 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.
2022-10-18 13:30:15 +02:00
Ondřej Surý
5e3e76eda9 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
2022-10-18 11:18:04 +00:00
Ondřej Surý
5e20c2ccfb 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.
2022-10-18 11:36:15 +02:00
Ondřej Surý
cb3c36b8bf 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);
2022-10-18 11:36:15 +02:00
Artem Boldariev
aaa50c5101 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
2022-10-18 09:32:25 +00:00
Artem Boldariev
5ab2c0ebb3 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.
2022-10-18 12:06:00 +03:00
Arаm Sаrgsyаn
55a184c13f Merge branch '3584-placeholder' into 'main'
Add a CHANGES placeholder for [GL #3584]

See merge request isc-projects/bind9!6927
2022-10-18 08:51:46 +00:00
Aram Sargsyan
5d5b3f9d27 Add a CHANGES placeholder for [GL #3584] 2022-10-18 08:28:53 +00:00
Petr Špaček
ad3270b1ee 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
2022-10-18 08:12:47 +00:00
Petr Špaček
c8a38d70f0 Document that nsupdate ignores server command in GSS-TSIG mode
This behavior is present since introduction of GSS-TSIG support,
commit 289ae548d5.
2022-10-18 10:12:02 +02:00
Tony Finch
3b285ee9ad Merge branch 'fanf-deduplicate-file-line' into 'main'
De-duplicate __FILE__, __LINE__ plus some error reporting cleanup

See merge request isc-projects/bind9!6914
2022-10-17 13:17:57 +00:00
Tony Finch
2ffb582d2c CHANGES for [GL !6914]
[cleanup]	Less ceremonial UNEXPECTED_ERROR() and FATAL_ERROR()
		reporting macros. [GL !6914]
2022-10-17 13:43:59 +01:00
Tony Finch
26ed03a61e 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.
2022-10-17 13:43:59 +01:00
Tony Finch
a34a2784b1 De-duplicate some calls to strerror_r()
Specifically, when reporting an unexpected or fatal error.
2022-10-17 11:58:26 +01:00
Tony Finch
ec50c58f52 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)
2022-10-17 11:58:26 +01:00
Arаm Sаrgsyаn
cf230dea7a 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
2022-10-17 09:15:13 +00:00
Aram Sargsyan
fddaebb285 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.
2022-10-17 08:45:45 +00:00
Aram Sargsyan
190aab84d7 Add a CHANGES note for [GL !6880] 2022-10-17 08:45:34 +00:00
Aram Sargsyan
dc55f1ebb9 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'.
2022-10-17 08:45:26 +00:00
Aram Sargsyan
39290bb7cd 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.
2022-10-17 08:45:18 +00:00
Aram Sargsyan
9440910187 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.
2022-10-17 08:45:09 +00:00
Ondřej Surý
a9e4e6658f Merge branch 'mnowak/fix-grep-3.8-warnings' into 'main'
Fix GNU Grep 3.8 warnings

See merge request isc-projects/bind9!6786
2022-10-17 07:09:16 +00:00
Michal Nowak
759e8a6671 Add CI check for Grep warnings 2022-10-17 09:08:15 +02:00
Michal Nowak
212c4de043 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
2022-10-17 09:08:15 +02:00
Michal Nowak
65e91ef5e6 Remove stray backslashes
GNU Grep 3.8 reports several instances of stray backslashes in matching
patterns:

    grep: warning: stray \ before /
    grep: warning: stray \ before :
2022-10-17 09:08:15 +02:00
Ondřej Surý
d04f053b49 Merge branch 'fanf-compress-smaller' into 'main'
Simplify and speed up DNS name compression

See merge request isc-projects/bind9!6517
2022-10-17 07:00:39 +00:00
Tony Finch
738c3f791c 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.
2022-10-17 08:45:44 +02:00
Tony Finch
7ab81eab1c 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`.
2022-10-17 08:45:44 +02:00
Tony Finch
18a51c89f0 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.
2022-10-17 08:45:44 +02:00
Tony Finch
45b2d8938b 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.
2022-10-17 08:45:44 +02:00
Artem Boldariev
a00333d0d8 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
2022-10-16 21:50:51 +00:00
Artem Boldariev
d62eb206f7 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.
2022-10-14 23:06:31 +03:00
Ondřej Surý
778cf872eb Merge branch 'ondrej-pthread_once-runtime-check' into 'main'
Improve reporting for pthread_once errors

See merge request isc-projects/bind9!6910
2022-10-14 14:40:31 +00:00
Ondřej Surý
cedfc97974 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).
2022-10-14 16:39:21 +02:00
Tom Krizek
2ac48846f4 Merge branch 'tkrizek/remove-system-test-delzone' into 'main'
Remove system test delzone

See merge request isc-projects/bind9!6882
2022-10-14 14:37:39 +00:00
Tom Krizek
05180154d9 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
  98b3b93791 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.
2022-10-14 16:35:20 +02:00
Ondřej Surý
2b8231dd3c Merge branch 'ondrej-refactor-isc_httpd' into 'main'
Rewrite isc_httpd using picohttpparser and isc_url_parse

See merge request isc-projects/bind9!6879
2022-10-14 10:23:21 +00:00
Ondřej Surý
e13749f138 Add CHANGES note for [GL !6879] 2022-10-14 11:26:54 +02:00
Ondřej Surý
cad2706cce 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.
2022-10-14 11:26:54 +02:00
Ondřej Surý
beecde7120 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.
2022-10-14 11:26:54 +02:00
Ondřej Surý
3a8884f024 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.
2022-10-14 11:26:54 +02:00
Petr Špaček
a2318a85a4 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
2022-10-13 16:02:33 +00:00
Petr Špaček
6af82aa83e 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
2022-10-13 18:02:08 +02:00
Petr Špaček
4fc04b6011 Merge branch 'pspacek/dns-name-attributes-struct' into 'main'
Replace #define DNS_NAMEATTR_* with struct of booleans

See merge request isc-projects/bind9!6902
2022-10-13 15:22:57 +00:00