Commit Graph
33470 Commits
Author SHA1 Message Date
Mark Andrews 99bd0c346f cast (char) to (unsigned char) when calling is*() 2021-03-15 14:18:03 +11:00
Michal Nowak e391209212 Merge branch '2565-servestale-fetchlimits-crash' into 'main'
Fix servestale fetchlimits crash

Closes #2565

See merge request isc-projects/bind9!4797
2021-03-11 12:14:47 +00:00
Matthijs Mekking 87591de6f7 Fix servestale fetchlimits crash
When we query the resolver for a domain name that is in the same zone
for which is already one or more fetches outstanding, we could
potentially hit the fetch limits. If so, recursion fails immediately
for the incoming query and if serve-stale is enabled, we may try to
return a stale answer.

If the resolver is also is authoritative for the parent zone (for
example the root zone), first a delegation is found, but we first
check the cache for a better response.

Nothing is found in the cache, so we try to recurse to find the
answer to the query.

Because of fetch-limits 'dns_resolver_createfetch()' returns an error,
which 'ns_query_recurse()' propagates to the caller,
'query_delegation_recurse()'.

Because serve-stale is enabled, 'query_usestale()' is called,
setting 'qctx->db' to the cache db, but leaving 'qctx->version'
untouched. Now 'query_lookup()' is called to search for stale data
in the cache database with a non-NULL 'qctx->version'
(which is set to a zone db version), and thus we hit an assertion
in rbtdb.

This crash was introduced in 'main' by commit
8bcd7fe69e.
2021-03-11 12:16:14 +01:00
Ondřej Surý 74a0294be0 Merge branch '2568-test_client-c-error-static-declaration-of-yield-follows-non-static-declaration-on-solaris' into 'main'
Resolve "test_client.c: error: static declaration of 'yield' follows non-static declaration on Solaris"

Closes #2568

See merge request isc-projects/bind9!4795
2021-03-11 06:09:49 +00:00
Mark Andrews af0ee2c718 Rename 'yield' to 'waitforsignal' due to namespace clash 2021-03-11 11:34:15 +11:00
Michał Kępień 77ac8db0c6 Merge branch '2556-fix-documentation-for-the-max-ixfr-ratio-option' into 'main'
Fix documentation for the "max-ixfr-ratio" option

Closes #2556

See merge request isc-projects/bind9!4787
2021-03-08 11:28:37 +00:00
Michał Kępień 3878cf4ac5 Fix documentation for the "max-ixfr-ratio" option
Commit 9fb6d11abb (which converted BIND 9
documentation from DocBook to Sphinx) inadvertently removed a paragraph
from the description of the "max-ixfr-ratio" option.  Add the missing
paragraph back.
2021-03-08 12:27:39 +01:00
Ondřej Surý 8bd1da8e4e Merge branch 'ondrej/disable-github-pr-fix' into 'main'
Fix syntax error in GitHub Actions lockdown.yml file

See merge request isc-projects/bind9!4789
2021-03-08 11:25:15 +00:00
Ondřej Surý c4a4ee2db9 Fix syntax error in GitHub Actions lockdown.yml file 2021-03-08 12:24:17 +01:00
Ondřej Surý 494057b8f4 Merge branch 'ondrej/disable-github-pr' into 'main'
Add GitHub Action that immediately closes issue / PRs

See merge request isc-projects/bind9!4788
2021-03-08 11:13:24 +00:00
Ondřej Surý 2463f62c93 Add GitHub Action that immediately closes issue / PRs
Unfortunately, it's not possible to disable Pull Requests on the
mirrored repository on the GitHub, so this commit adds external action
that closes any new open Issue or Pull Requests instead letting them rot
unnoticed.
2021-03-08 12:09:14 +01:00
Ondřej Surý 42e8db9e74 Merge branch '2555-workaround-truncated-64-bit-enum-in-journal-on-windows' into 'main'
Resolve "journal test fails on Windows"

Closes #2555

See merge request isc-projects/bind9!4784
2021-03-08 08:42:14 +00:00
Evan HuntandOndřej Surý 990dd9dbff fix automatic journal upgrade on windows
- use a value less than 2^32 for DNS_ZONEFLG_FIXJOURNAL; a larger value
  could cause problems in some build environments. the zone flag
  DNS_ZONEFLG_DIFFONRELOAD, which was no longer in use, has now been
  deleted and its value reused for _FIXJOURNAL.
2021-03-08 08:51:34 +01:00
Evan HuntandOndřej Surý 46c11726d4 add start and end serial numbers to 'named-printjournal -x'
add the starting and ending serial number from the journal
header to the output of dns_journal_print().
2021-03-08 08:51:34 +01:00
Mark Andrews bc714bc5c5 Merge branch '2559-cid-329159-logically-dead-code-in-lib-dns-journal-c' into 'main'
Resolve "CID 329159: Logically dead code in lib/dns/journal.c"

Closes #2559

See merge request isc-projects/bind9!4780
2021-03-08 05:25:17 +00:00
Mark Andrews 848e336db4 Silence CID 329159: Logically dead code in lib/dns/journal.c
*** CID 329159:    (DEADCODE)
    /lib/dns/journal.c: 1719 in dns_journal_print()
    1713     		}
    1714     		CHECK(dns_difftuple_create(
    1715     			diff.mctx, n_soa == 1 ? DNS_DIFFOP_DEL : DNS_DIFFOP_ADD,
    1716     			name, ttl, rdata, &tuple));
    1717     		dns_diff_append(&diff, &tuple);
    1718
    >>>     CID 329159:    (DEADCODE)
    >>>     Execution cannot reach the expression "printxhdr" inside this statement: "if (++n_put != 0U || printx...".
    1719     		if (++n_put != 0 || printxhdr) {
    1720     			result = dns_diff_print(&diff, file);
    1721     			dns_diff_clear(&diff);
    1722     			n_put = 0;
    1723     			if (result != ISC_R_SUCCESS) {
    1724     				break;
    /lib/dns/journal.c: 1734 in dns_journal_print()
    1728     	if (result == ISC_R_NOMORE) {
    1729     		result = ISC_R_SUCCESS;
    1730     	}
    1731     	CHECK(result);
    1732
    1733     	if (!printxhdr && n_put != 0) {
    >>>     CID 329159:    (DEADCODE)
    >>>     Execution cannot reach this statement: "result = dns_diff_print(&di...".
    1734     		result = dns_diff_print(&diff, file);
    1735     		dns_diff_clear(&diff);
    1736     	}
    1737     	goto cleanup;
    1738
    1739     failure:
2021-03-08 05:06:29 +00:00
Mark Andrews 279c8a837b Merge branch '2560-cid-329157-dereference-before-null-check-in-lib-dns-journal-c' into 'main'
Resolve "CID 329157: Dereference before null check in lib/dns/journal.c"

Closes #2560

See merge request isc-projects/bind9!4779
2021-03-08 05:06:06 +00:00
Mark Andrews 4054405909 Silence CID 329157: Dereference before null check in lib/dns/journal.c
*** CID 329157:  Null pointer dereferences  (REVERSE_INULL)
    /lib/dns/journal.c: 754 in journal_open()
    748     			    j->header.index_size * sizeof(journal_rawpos_t));
    749     	}
    750     	if (j->index != NULL) {
    751     		isc_mem_put(j->mctx, j->index,
    752     			    j->header.index_size * sizeof(journal_pos_t));
    753     	}
       CID 329157:  Null pointer dereferences  (REVERSE_INULL)
       Null-checking "j->filename" suggests that it may be null, but it has already been dereferenced on all paths leading to the check.
    754     	if (j->filename != NULL) {
    755     		isc_mem_free(j->mctx, j->filename);
    756     	}
    757     	if (j->fp != NULL) {
    758     		(void)isc_stdio_close(j->fp);
    759     	}
2021-03-08 05:05:28 +00:00
Mark Andrews 27117f7b46 Merge branch 'marka-add-journal-to-conf-sh-common' into 'main'
Add journal to conf.sh.common

See merge request isc-projects/bind9!4781
2021-03-08 01:12:54 +00:00
Mark Andrews 926b9056b7 add journal to conf.sh.common 2021-03-08 11:36:00 +11:00
Artem Boldariev d6f33fcd6c Merge branch '1641-doh-dig' into 'main'
Resolve "RFC8484, DoH support in DIG (and any other relevant utilities)"

Closes #2464 and #1641

See merge request isc-projects/bind9!4672
2021-03-05 16:46:02 +00:00
Evan HuntandArtem Boldariev f3b13c6027 CHANGES, release notes 2021-03-05 18:09:42 +02:00
Evan HuntandArtem Boldariev dbffb212ce add basic DoH system tests
- rename dot to doth, as it now covers both dot and doh.
- merge xot into doth as it's closely related.
- added long-lived key and cert files (expiring 2121).
- add tests with https-get, https-post, http-plain, alternate
  endpoints, and both static and ephemeral TLS configuration.
- incidentally fixed a memory leak in dig that occurred if +https
  was specified more than once.
2021-03-05 18:09:42 +02:00
Artem Boldariev 7a59fb8207 Disable Nagle's algorithm for HTTP/2 connections
It is advisable to disable Nagle's algorithm for HTTP/2 connections
because multiple HTTP/2 streams could be multiplexed over one
transport connection. Thus, delays when delivering small packets could
bring down performance for the whole session. HTTP/2 is meant to be
used this way.
2021-03-05 18:09:42 +02:00
Artem Boldariev 66d20cf28b Fix deadlock in isc_nm_tlsconnect()
when called from within the context of a network thread,
isc_nm_tlsconnect() hangs. it is waiting for the socket's
result code to be updated, but that update is supposed to happen
asynchronously in the network thread, and if we're already blocking
in the network thread, it can never occur.

we can kluge around this by setting the socket result code
early; this works for most clients (including "dig"), but it causes
inconsistent behaviors that manifest as test failures in the DoH unit
test.

so we kluged around it even more by setting the socket result code
early *only when running in the network thread*. we need a better
solution for this problem, but this will do for now.
2021-03-05 18:09:22 +02:00
Artem Boldariev ca9a15e3bc DoH: call send callbacks after data was actually sent 2021-03-05 13:29:32 +02:00
Artem Boldariev 71668437d4 Put sane limitations in place to handle bad requests gracefully
This commit makes the server-side code polite.

It fixes the error handling code on the server side and fixes
returning error code in responses (there was a nasty bug which could
potentially crash the server).

Also, in this commit we limit max size POST request data to 96K, max
processed data size in headers to 128K (should be enough to handle any
GET requests).

If these limits are surpassed, server will terminate the request with
RST_STREAM without responding with error code. Otherwise it politely
responds with error code.

This commit also limits number of concurrent HTTP/2 streams per
transport connection on server to 100 (as nghttp2 advises by default).

Ideally, these parameters should be configurable both globally and per
every HTTP endpoint description in the configuration file, but for now
putting sane limits should be enough.
2021-03-05 13:29:32 +02:00
Evan HuntandArtem Boldariev 88752b1121 refactor outgoing HTTP connection support
- style, cleanup, and removal of unnecessary code.
- combined isc_nm_http_add_endpoint() and isc_nm_http_add_doh_endpoint()
  into one function, renamed isc_http_endpoint().
- moved isc_nm_http_connect_send_request() into doh_test.c as a helper
  function; remove it from the public API.
- renamed isc_http2 and isc_nm_http2 types and functions to just isc_http
  and isc_nm_http, for consistency with other existing names.
- shortened a number of long names.
- the caller is now responsible for determining the peer address.
  in isc_nm_httpconnect(); this eliminates the need to parse the URI
  and the dependency on an external resolver.
- the caller is also now responsible for creating the SSL client context,
  for consistency with isc_nm_tlsdnsconnect().
- added setter functions for HTTP/2 ALPN. instead of setting up ALPN in
  isc_tlsctx_createclient(), we now have a function
  isc_tlsctx_enable_http2client_alpn() that can be run from
  isc_nm_httpconnect().
- refactored isc_nm_httprequest() into separate read and send functions.
  isc_nm_send() or isc_nm_read() is called on an http socket, it will
  be stored until a corresponding isc_nm_read() or _send() arrives; when
  we have both halves of the pair the HTTP request will be initiated.
- isc_nm_httprequest() is renamed isc__nm_http_request() for use as an
  internal helper function by the DoH unit test. (eventually doh_test
  should be rewritten to use read and send, and this function should
  be removed.)
- added implementations of isc__nm_tls_settimeout() and
  isc__nm_http_settimeout().
- increased NGHTTP2 header block length for client connections to 128K.
- use isc_mem_t for internal memory allocations inside nghttp2, to
  help track memory leaks.
- send "Cache-Control" header in requests and responses. (note:
  currently we try to bypass HTTP caching proxies, but ideally we should
  interact with them: https://tools.ietf.org/html/rfc8484#section-5.1)
2021-03-05 13:29:26 +02:00
Ondřej SurýandArtem Boldariev 9c8b7a5c45 add preliminary DoH client support to dig
add options "+https", "+https-get" and "+http-plain" to
allow dig to connect over HTTP/2 channels.
2021-03-05 13:28:17 +02:00
Ondřej Surý 13d23b0c8e Merge branch '1529-add-threadsanitizer-core-dumping-flags-when-we-are-threadsanitizer-clean' into 'main'
Resolve "Add ThreadSanitizer core dumping flags when we are ThreadSanitizer-clean"

Closes #1529

See merge request isc-projects/bind9!4774
2021-03-04 15:25:00 +00:00
Ondřej Surý 4072cc2b93 Disable allow_failure for ThreadSanitizer jobs
Since the main branch is now TSAN-clean, it's a good opportunity to
enable hard failures for the TSAN system test jobs.
2021-03-04 15:32:55 +01:00
Michal NowakandOndřej Surý a730bc47f5 Add ThreadSanitizer core dumping flags
This should let us have core dumps from crashed system test when
ThreadSanitizer is enabled.
2021-03-04 15:32:50 +01:00
Ondřej Surý 80f01cbf42 Merge branch '2455-tcpdns_test-c-runtime-error-load-of-misaligned-address-for-type-uint64_t' into 'main'
Assigning uint64_t from buffer might be misaligned in netmgr tests

Closes #2455

See merge request isc-projects/bind9!4769
2021-03-04 14:28:11 +00:00
Ondřej Surý a55bdb28f9 Assigning uint64_t from buffer might be misaligned in netmgr tests
Resolve possible 8-byte unaligned access when assigning the magic
value from the received buffer.
2021-03-04 15:02:24 +01:00
Ondřej Surý cb9df06f7d Merge branch '2533-mdig-move-cleanup' into 'main'
Move cleanup of queries to later in the shutdown sequence

Closes #2533

See merge request isc-projects/bind9!4768
2021-03-04 14:01:15 +00:00
Mark AndrewsandOndřej Surý 4015af02d8 Move cleanup of queries to later in the shutdown sequence
to avoid TSAN report

    WARNING: ThreadSanitizer: data race
      Write of size 8 at 0x000000000001 by main thread:
        #0 free <null>
        #1 default_memfree lib/isc/mem.c:440
        #2 mem_put lib/isc/mem.c:363
        #3 isc__mem_free lib/isc/mem.c:1012
        #4 main bin/tools/mdig.c:2231

      Previous read of size 1 at 0x000000000005 by thread T1:
        #0 dns_name_fromtext lib/dns/name.c:1121
        #1 sendquery bin/tools/mdig.c:596
        #2 sendqueries bin/tools/mdig.c:779
        #3 dispatch lib/isc/task.c:1153
        #4 run lib/isc/task.c:1345
        #5 isc__trampoline_run lib/isc/trampoline.c:184
        #6 <null> <null>

      Thread T1 (running) created by main thread at:
        #0 pthread_create <null>
        #1 isc_thread_create pthreads/thread.c:79
        #2 isc_taskmgr_create lib/isc/task.c:1435
        #3 main bin/tools/mdig.c:2148

    SUMMARY: ThreadSanitizer: data race in __interceptor_free
2021-03-04 13:21:56 +01:00
Michal Nowak 1f8463a6e9 Merge branch '2357-add-CHANGES-entry' into 'main'
Add CHANGES entry for GL #2357

Closes #2357

See merge request isc-projects/bind9!4770
2021-03-04 11:45:06 +00:00
Michal Nowak d98f72de25 Add CHANGES entry for GL #2357 2021-03-04 12:26:58 +01:00
Ondřej Surý b532eb3029 Merge branch '2552-comparison-between-signed-and-unsigned-on-arm7' into 'main'
Fix comparison between signed and unsigned integer expressions

Closes #2552

See merge request isc-projects/bind9!4766
2021-03-04 10:24:00 +00:00
Ondřej SurýandOndřej Surý d3bb3ae64f Fix comparison between signed and unsigned integer expressions
Simple typecast to size_t should be enough to silence the warning on
ARMv7, even though the code is in fact correct, because the readlen is
checked for being < 0 in the block before the warning.
2021-03-04 11:21:43 +01:00
Ondřej Surý 2c9c16e334 Merge branch '2551-char-is-unsigned-on-arm64' into 'main'
Use int type to store result from isc_commandline_parse()

Closes #2551

See merge request isc-projects/bind9!4765
2021-03-04 10:20:18 +00:00
Ondřej Surý 8153729d3a Use int type to store result from isc_commandline_parse()
The C standard actually doesn't define char as signed or unsigned, and
it could be either according to underlying architecture.  It turns out
that while it's usually signed type, it isn't on arm64 where it's
unsigned.

isc_commandline_parse() return int, just use that instead of the char.
2021-03-04 10:43:00 +01:00
Mark Andrews fc57dd4c41 Merge branch '2298-multiple-definition-of-librpz_dnsrpzd_path' into 'main'
Resolve "multiple definition of `librpz_dnsrpzd_path'"

Closes #2298

See merge request isc-projects/bind9!4703
2021-03-04 08:22:16 +00:00
Mark Andrews e12cf5eb57 Add CHANGES for [GL #2298] 2021-03-04 19:21:44 +11:00
Mark Andrews 8f016dd57a Fixed librpz_dnsrpzd_path being a duplicate symbol
librpz_dnsrpzd_path should have been declared extern in dns/librpz.h
2021-03-04 19:20:59 +11:00
Evan Hunt add81d6480 Merge branch '2505-journal-compatibility' into 'main'
allow dns_journal_rollforward() to read old journal files

Closes #2505

See merge request isc-projects/bind9!4720
2021-03-04 03:18:42 +00:00
Evan Hunt 82b82bb821 CHANGES, release note 2021-03-03 17:54:47 -08:00
Evan Hunt a0aefa1de6 create 'journal' system test
tests that version 1 journal files containing version 1 transaction
headers are rolled forward correctly on server startup, then updated
into version 2 journals. also checks journal file consistency and
'max-journal-size' behavior.
2021-03-03 17:54:47 -08:00
Evan Hunt a4972324a6 print journal index data and test for consistency
'named-journalprint -x' now prints the journal's index table and
the offset of each transaction in the journal, so that index consistency
can be confirmed.
2021-03-03 17:54:47 -08:00
Mark AndrewsandEvan Hunt fb2d0e2897 extend named-journalprint to be able to force the journal version
named-journalprint can now upgrade or downgrade a journal file
in place; the '-u' option upgrades and the '-d' option downgrades.
2021-03-03 17:54:47 -08:00