Compare commits

...
Author SHA1 Message Date
Tony Finch 128a2c80a9 sketchy design for a concurrent hash set 2023-03-07 11:18:20 +00:00
Tony Finch e1c4e29b1b Revert !7538, simplify locking in dns_view_detach()
This reverts commit eb6b31b6, which led to a null pointer dereference
in adb when the resolver tried to use it after it was detached.

Closes #3898
2023-02-28 12:57:29 +00:00
Michał Kępień 20428f4c77 Merge branch 'michal/add-a-dnsrps-enabled-build-to-regular-ci-pipelines' into 'main'
Add a DNSRPS-enabled build to regular CI pipelines

See merge request isc-projects/bind9!7601
2023-02-28 11:56:27 +00:00
Michał Kępień a4d6f5f6fd Add a DNSRPS-enabled build to regular CI pipelines
DNSRPS-enabled builds have recently been silently broken a few times due
to that feature not being tested in regular CI pipelines.  Add the
--enable-dnsrps --enable-dnsrps-dl switches to the ./configure
invocation in one of the CI jobs run for all merge requests so that
DNSRPS-related build issues can be detected in advance.

It is important to note that this change by itself does NOT enable
actual testing of the DNSRPS feature as doing that requires a DNSRPS
provider library to be present on the test host.
2023-02-28 12:54:02 +01:00
Michał Kępień b396f55586 (Mostly) fix building bin/tests/system/rpz/dnsrps
Building the bin/tests/system/rpz/dnsrps helper binary is currently not
possible at all as the necessary compiler and linker flag definitions
are missing from bin/tests/system/Makefile.am.  Add these as a basis for
addressing the problem.

Unfortunately, this is where the "mostly" bit mentioned in this commit's
subject line comes into play.  The dlopen() parts of DNSRPS code have
not yet been reworked to use libuv's dlopen() API (uv_dlopen() etc.)
(See commit 37b9511ce1 for prior work in
this area.)  While it is certainly possible to do that, implementing
such a change without testing it in practice against a usable librpz.so
(i.e. a DNSRPS provider library) is bound to cause more trouble and
confusion than keeping the code the way it is right now.  However,
making that code buildable as-is requires linking against a C standard
library that exports the dlopen(), dlsym(), and dlclose() symbols used
by the DNSRPS dynamic loading code.  glibc 2.34+ satisfies that
requirement, but older glibc versions do not (these come with a separate
libdl shared library that would need to be linked in as well).  (Other
C standard library implementations have not been examined.)  Since the
long-term plan is to rely on libuv's dlopen() API exclusively and
detecting the shared object containing dlopen() & friends would only
pull in build system complexity for no good reason, assume for now that
the target system provides the dlopen() API in its C standard library.

This change enables the system test suite to be run for a BIND 9 build
prepared using --enable-dnsrps --enable-dnsrps-dl (on systems satisfying
the requirement explained above).  However, it is important to note that
this change by itself does NOT enable actual testing of the DNSRPS
feature as doing that requires a DNSRPS provider library to be present
on the test host.
2023-02-28 12:54:02 +01:00
Ondřej Surý dcbc659550 Merge branch 'ondrej/implement-dns_rbtnode_t-reference-tracing' into 'main'
Implement dns_db node tracing

See merge request isc-projects/bind9!7313
2023-02-28 10:45:01 +00:00
Ondřej Surý cd632ad31d Implement dns_db node tracing
This implements node reference tracing that passes all the internal
layers from dns_db API (and friends) to increment_reference() and
decrement_reference().

It can be enabled by #defining DNS_DB_NODETRACE in <dns/trace.h> header.

The output then looks like this:

    incr:node:check_address_records:rootns.c:409:0x7f67f5a55a40->references = 1
    decr:node:check_address_records:rootns.c:449:0x7f67f5a55a40->references = 0

    incr:nodelock:check_address_records:rootns.c:409:0x7f67f5a55a40:0x7f68304d7040->references = 1
    decr:nodelock:check_address_records:rootns.c:449:0x7f67f5a55a40:0x7f68304d7040->references = 0

There's associated python script to find the missing detach located at:
https://gitlab.isc.org/isc-projects/bind9/-/snippets/1038
2023-02-28 11:44:15 +01:00
Michal Nowak 5737f7bc8f Merge branch 'mnowak/make-openbsd-allow_failure-true' into 'main'
Do not fail pipeline because of failed OpenBSD system test

See merge request isc-projects/bind9!7609
2023-02-28 10:27:17 +00:00
Michal Nowak fc26da6d89 Do not fail pipeline because of failed OpenBSD system test
System test on OpenBSD is unstable even when test parallelism is
disabled.
2023-02-28 11:23:14 +01:00
Michal Nowak a9d3ec33b3 Revert "Disable OpenBSD system test parallelism in CI"
This reverts commit d73eba57bd.
2023-02-28 11:23:13 +01:00
Matthijs Mekking 36681e2c0a Merge branch '3837-cds-digest-type' into 'main'
Add cds-digest-type configuration option

Closes #3837

See merge request isc-projects/bind9!7457
2023-02-28 10:01:50 +00:00
Matthijs Mekking 78e6b8646a Test dnssec-signzone -G digests
Add test cases for the new dnssec-signzone -G option.
2023-02-28 09:38:31 +01:00
Matthijs Mekking 6c76a99c24 Require to be dereferenced arguments are non-NULL
The function 'dns_dnssec_syncupdate()' is dereferencing arguments
'keys' and 'rmkeys'. There should be a REQUIRE that those are not
null pointers.
2023-02-28 09:38:31 +01:00
Matthijs Mekking b1633b71b0 dnssec-signzone can now create multiple CDS RRs
Change the commandline option -G to take a string that determines what
sync records should be published. It is a comma-separated string with
each element being either "cdnskey", or "cds:<algorithm>", where
<algorithm> is a valid digest type. Duplicates are suppressed.
2023-02-28 09:38:31 +01:00
Matthijs Mekking ea4130d6bd Update syncupdate() function to disable CDNSKEY
Add a new function argument so you can choose whether the CDNSKEY
record should be published or not.
2023-02-28 09:38:17 +01:00
Mark AndrewsandMatthijs Mekking 59cd228216 Fix dns_kasp_attach / dns_kasp_detach usage
The kasp pointers in dns_zone_t should consistently be changed by
dns_kasp_attach and dns_kasp_detach so the usage is balanced.
2023-02-28 09:38:17 +01:00
Matthijs Mekking 28cde5cac2 Suppress duplicate digest types
When adding CDS digest types to the kasp structure, check for
duplicates.
2023-02-28 09:38:17 +01:00
Matthijs Mekking f2c0c4ed4e Add 'dns_dnssec_syncupdate' argument descriptions 2023-02-28 09:38:17 +01:00
Matthijs Mekking c0b606885e Make cds-digest-type plural
Allow for configuring multiple CDS records with different digest
types (currently only SHA-256 and SHA-384 are allowed).
2023-02-28 09:38:17 +01:00
Matthijs Mekking 06e64821f5 New option to dnssec-signzone to ignore sync rrs
By default, CDS and CDNSKEY records are generated from the given
key list. In some cases you don't want that.
2023-02-28 09:37:38 +01:00
Matthijs Mekking e5841856f8 Add release note and change for cds-digest-type 2023-02-28 09:37:37 +01:00
Matthijs Mekking 8d20c4e95f Update code to publish CDS with other digest type
Now that we can configure a different digest type, update the code
to honor the configuration. Update 'dns_dnssec_syncupdate' so that
the correct CDS record is published, and also when deleting CDS records,
ensure that all possible CDS records are removed from the zone.
2023-02-28 09:36:50 +01:00
Matthijs Mekking 9f3e3fcfc8 Add test case for different digest type
Change one of the test cases to use a different digest type (4).  The
system tests and kasp script need to be updated to take into account
the new algorithm (instead of the hard coded 2).
2023-02-28 09:36:50 +01:00
Matthijs Mekking f1ec02a359 Test cds-digest-type configuration
Add tests for good and bad configuration values in the checkconf system
test.
2023-02-28 09:36:50 +01:00
Matthijs Mekking 2742fe656f Add configuration cds-digest-type
Add the 'cds-digest-type' configuration option to 'dnssec-policy'.
2023-02-28 09:36:49 +01:00
Matthijs Mekking 32114afc46 Add functions to set CDS digest-type
BIND dnssec-policy currently only supports CDS digest-type 2. Add
API functions to allow other digest-types.
2023-02-28 09:36:39 +01:00
Matthijs Mekking dc7818ebcb Fix CDS/CDSNKEY publication logging
The CDS and CDNSKEY "is published" logs were mixed up (CDNSKEY was
logged when CDS was published and vice versa).
2023-02-28 09:36:39 +01:00
Michał Kępień 2ef43afa5a Merge branch '3891-fix-dnsrps-code' into 'main'
Fix DNSRPS code after struct dns_db refactoring

Closes #3891

See merge request isc-projects/bind9!7595
2023-02-28 08:17:30 +00:00
Michał Kępień df3062ed52 Fix DNSRPS code after struct dns_db refactoring
Commits ffa4757c79 and
77e7eac54c inadvertently broke
DNSRPS-enabled builds:

  - the new member of struct dns_db that holds a reference count for the
    database is called 'references', not 'refcount',

  - a syntax error was introduced in the designated initializer for
    'rpsdb_rdataset_methods',

  - rpsdb_destroy() no longer takes a 'dbp' argument.

Address all of the above issues to make DNSRPS-enabled builds work
again.
2023-02-28 09:16:05 +01:00
Mark Andrews cdbdb5fcec Merge branch '3902-fetchlimit-system-test-failed' into 'main'
Resolve "'fetchlimit' system test failed"

Closes #3902

See merge request isc-projects/bind9!7615
2023-02-28 07:23:00 +00:00
Mark Andrews c7ae975ecf Fix 'checking drop statistics' test
Wait for the desired log message to appear in ns3/named.stats rather
than the creation of the file.
2023-02-28 17:46:14 +11:00
Mark Andrews af47090d99 Fix 'lame server clients are dropped below the hard limit' test
The test was setting a minimum count for recursive clients which
was not always being met (e.g. 91 instead of 100) producing a false
positive.  Lower the lower bound on recursive clients for this
test to 1.
2023-02-28 17:45:59 +11:00
Tony Finch 19cffc4972 Merge branch 'fanf-qp-import' into 'main'
Import a qp-trie implementation

See merge request isc-projects/bind9!7130
2023-02-27 14:11:05 +00:00
Tony Finch 0858514ae8 Improve qp-trie compaction in write transactions
In general, it's better to do one thorough compaction when a batch of
work is complete, which is the way that `update` transactions work.
Conversely, `write` transactions are designed so that lots of little
transactions are not too inefficient, but they need explicit
compaction. This changes `dns_qp_compact()` so that it is easier to
compact any time that makes sense, if there isn't a better way to
schedule compaction. And `dns_qpmulti_commit()` only recycles garbage
when there is enough to make it worthwhile.
2023-02-27 13:47:57 +00:00
Tony Finch a8b29f0365 Improve qp-trie refcount debugging
Add some qp-trie tracing macros which can be enabled by a
developer. These print a message when a leaf is attached or
detached, indicating which part of the qp-trie implementation
did so. The refcount methods must now return the refcount value
so it can be printed by the trace macros.
2023-02-27 13:47:57 +00:00
Tony Finch 7dcde5d2fc Make the qp-trie stats logging quieter
Only log when useful work was done
2023-02-27 13:47:57 +00:00
Tony Finch 4b5ec07bb7 Refactor qp-trie to use QSBR
The first working multi-threaded qp-trie was stuck with an unpleasant
trade-off:

  * Use `isc_rwlock`, which has acceptable write performance, but
    terrible read scalability because the qp-trie made all accesses
    through a single lock.

  * Use `liburcu`, which has great read scalability, but terrible
    write performance, because I was relying on `rcu_synchronize()`
    which is rather slow. And `liburcu` is LGPL.

To get the best of both worlds, we need our own scalable read side,
which we now have with `isc_qsbr`. And we need to modify the write
side so that it is not blocked by readers.

Better write performance requires an async cleanup function like
`call_rcu()`, instead of the blocking `rcu_synchronize()`. (There
is no blocking cleanup in `isc_qsbr`, because I have concluded
that it would be an attractive nuisance.)

Until now, all my multithreading qp-trie designs have been based
around two versions, read-only and mutable. This is too few to
work with asynchronous cleanup. The bare minimum (as in epoch
based reclamation) is three, but it makes more sense to support an
arbitrary number. Doing multi-version support "properly" makes
fewer assumptions about how safe memory reclamation works, and it
makes snapshots and rollbacks simpler.

To avoid making the memory management even more complicated, I
have introduced a new kind of "packed reader node" to anchor the
root of a version of the trie. This is simpler because it re-uses
the existing chunk lifetime logic - see the discussion under
"packed reader nodes" in `qp_p.h`.

I have also made the chunk lifetime logic simpler. The idea of a
"generation" is gone; instead, chunks are either mutable or
immutable. And the QSBR phase number is used to indicate when a
chunk can be reclaimed.

Instead of the `shared_base` flag (which was basically a one-bit
reference count, with a two version limit) the base array now has a
refcount, which replaces the confusing ad-hoc lifetime logic with
something more familiar and systematic.
2023-02-27 13:47:55 +00:00
Tony Finch 549854f63b Some minor qp-trie improvements
Adjust the dns_qp_memusage() and dns_qp_compact() functions
to be more informative and flexible about handling fragmentation.

Avoid wasting space in runt chunks.

Switch from twigs_mutable() to cells_immutable() because that is the
sense we usually want.

Drop the redundant evacuate() function and rename evacuate_twigs() to
evacuate(). Move some chunk test functions closer to their point of
use.

Clarify compact_recursive(). Some small cleanups to comments.

Use isc_time_monotonic() for qp-trie timing stats.

Use #define constants to control debug logging.

Set up DNS name label offsets in dns_qpkey_fromname() so it is easier
to use in cases where the name is not fully hydrated.
2023-02-27 13:47:25 +00:00
Tony Finch 4b09c9a6ae qp-trie naming improvements
Adjust to typename_operation style
	s/VALID_QP/QP_VALID/g
	s/QP_VALIDMULTI/QPMULTI_VALID/g

Improved greppability
	s/\bctx\b/uctx/g

Less cluttered logging
	s/QP_TRACE/TRACE/g
	s/QP_LOG_STATS/LOG_STATS/g
2023-02-27 13:47:25 +00:00
Tony Finch a9d57b91db Benchmarks for the qp-trie
The main benchmark is `qpmulti`, which exercizes the qp-trie
transactional API with differing numbers of threads and differing data
sizes, to get some idea of how its performance scales.

The `load-names` benchmark compares the times to populate and query
and the memory used by various BIND data structures: qp-trie, hash
table (chained), hash map (closed), and red-black tree.

The `qp-dump` program is a test utility rather than a benchmark. It
populates a qp-trie and prints it out, either in an ad-hoc text
format, or as input to the graphviz `dot` program.
2023-02-27 13:47:25 +00:00
Tony Finch b06f6ef75a Fuzz testing the qp-trie
Ensure dns_qpkey_fromname() and dns_qpkey_toname() are inverses.

Excercise a single-threaded dns_qp_t with a fixed set of random keys
and a small chunk size. Use the table of names to ensure that the trie
is behaving as expected. This is (in effect) randomized testing like
the `qpmulti` unit test, but making use of coverage-guided fuzzing
and (in principle) test case minimization.
2023-02-27 13:47:25 +00:00
Tony Finch fbdb8b502a Test the qp-trie transactional API
Randomized testing with intensive consistency and correctness checks
make it much easier to get good coverage and to shake out bugs than
hand-written unit tests for specific cases.

These tests only run in a single thread, but each test transaction
uses both a write/update and a query/snapshot, to ensure that
modifications are not visible to concurrent readers.
2023-02-27 13:47:25 +00:00
Tony Finch c1c679b1a9 Test infrastructure for the qp-trie
This change adds a number of support routines for the unit tests, and
for benchmarks and fuzz tests to be added later. It isn't necessary to
include the support routines in libdns, since they are not needed by
BIND's installed programs. So `libtest` seems like the best place for
them.

The tests themselves verify that dns_qpkey_fromname() behaves as
expected.
2023-02-27 13:47:25 +00:00
Tony Finch df6747ee70 Fix qp-trie refcounting mistake
The error occurred when:

  * The bump chunk was re-used across multiple write transactions.
    In this situation the bump chunk is marked immutable, but the
    immutable flag is disregarded for cells after the fender, which
    were allocated in the current transaction.

  * The bump chunk fills up during an insert operation, so that the
    enlarged twigs vector is allocated from a new bump chunk.

  * Before this happened, we should have (but didn't) made the twigs
    vector mutable. This would have adjusted its refcounts as necessary.

  * However, moving to a new bump chunk has a side effect: twigs that
    were previously considered mutable because they are after the
    fender become immutable.

  * Because of this, the old twigs vector was not destroyed as expected.

  * So leaves were duplicated without their refcounts being increased.

The effect is that the refcounts were lower than they should have
been, and underflowed. The tests failed to check for refcount
underflow, so this mistake was detected much later than it ideally
could have been.

After the fix, it is now correct not to ensure the twigs are mutable,
because they are about to be copied to a larger vector. Instead, we
need to find out whether `squash_twigs()` destroyed the old twigs, and
adjust the refcounts accordingly.
2023-02-27 13:47:25 +00:00
Tony Finch 6b9ddbd1ce Add a qp-trie data structure
A qp-trie is a kind of radix tree that is particularly well-suited to
DNS servers. I invented the qp-trie in 2015, based on Dan Bernstein's
crit-bit trees and Phil Bagwell's HAMT. https://dotat.at/prog/qp/

This code incorporates some new ideas that I prototyped using
NLnet Labs NSD in 2020 (optimizations for DNS names as keys)
and 2021 (custom allocator and garbage collector).
https://dotat.at/cgi/git/nsd.git

The BIND version of my qp-trie code has a number of improvements
compared to the prototype developed for NSD.

  * The main omission in the prototype was the very sketchy outline of
    how locking might work. Now the locking has been implemented,
    using a reader/writer lock and a mutex. However, it is designed to
    benefit from liburcu if that is available.

  * The prototype was designed for two-version concurrency, one
    version for readers and one for the writer. The new code supports
    multiversion concurrency, to provide a basis for BIND's dbversion
    machinery, so that updates are not blocked by long-running zone
    transfers.

  * There are now two kinds of transaction that modify the trie: an
    `update` aims to support many very small zones without wasting
    memory; a `write` avoids unnecessary allocation to help the
    performance of many small changes to the cache.

  * There is also a single-threaded interface for situations where
    concurrent access is not necessary.

  * The API makes better use of types to make it more clear which
    operations are permitted when.

  * The lookup table used to convert a DNS name to a qp-trie key is
    now initialized by a run-time constructor instead of a programmer
    using copy-and-paste. Key conversion is more flexible, so the
    qp-trie can be used with keys other than DNS names.

  * There has been much refactoring and re-arranging things to improve
    the terminology and order of presentation in the code, and the
    internal documentation has been moved from a comment into a file
    of its own.

Some of the required functionality has been stripped out, to be
brought back later after the basics are known to work.

  * Garbage collector performance statistics are missing.

  * Fancy searches are missing, such as longest match and
    nearest match.

  * Iteration is missing.

  * Search for update is missing, for cases where the caller needs to
    know if the value object is mutable or not.
2023-02-27 13:47:25 +00:00
Evan Hunt 7975b785fd Support for relative names in unit tests
The dns_test_namefromstring() function can now generate relative
names, and all the tests that used it before it have been updated
to use FQDNs.
2023-02-27 13:47:25 +00:00
Arаm Sаrgsyаn 0165fdba5e Merge branch '3900-placeholder' into 'main'
Add a CHANGES placeholder for [GL #3900]

See merge request isc-projects/bind9!7606
2023-02-27 13:20:19 +00:00
Aram Sargsyan 4c22aae748 Add a CHANGES placeholder for [GL #3900] 2023-02-27 13:10:22 +00:00
Tony Finch 5f2f43e684 Merge branch 'fanf-dns-name-maxlabels' into 'main'
Define DNS_NAME_MAXLABELS and DNS_NAME_LABELLEN

See merge request isc-projects/bind9!7598
2023-02-27 12:08:52 +00:00
Tony Finch c6bf51492d Define DNS_NAME_MAXLABELS and DNS_NAME_LABELLEN
Some qp-trie operations will need to know the maximum number of labels
in a name, so I wanted a standard macro definition with the right
value.

Replace DNS_MAX_LABELS from <dns/resolver.h with DNS_NAME_MAXLABELS in
<dns/name.h>, and add its counterpart DNS_NAME_LABELLEN.

Use these macros in `name.c` and `resolver.c`.

Fix an off-by-one error in an assertion in `dns_name_countlabels()`.
2023-02-27 11:27:12 +00:00
Arаm Sаrgsyаn c3ae4e125c Merge branch '3777-fix-crash-after-failed-ixfr-from-differences' into 'main'
Resolve "crash after failed ixfr-from-differences on a catalog zone"

Closes #3777

See merge request isc-projects/bind9!7431
2023-02-27 11:25:00 +00:00
Aram Sargsyan 46b1c558ce Add a CHANGES note for [GL #3777] 2023-02-27 10:06:32 +00:00
Aram Sargsyan cf79692a66 catz: unregister the db update-notify callback before detaching from db
When detaching from the previous version of the database, make sure
that the update-notify callback is unregistered, otherwise there is
an INSIST check which can generate an assertion failure in free_rbtdb(),
which checks that there are no outstanding update listeners in the list.

There is a similar code already in place for RPZ.
2023-02-27 10:06:32 +00:00
Aram Sargsyan 0ef0c86632 Searching catzs->zones requires a read lock
Lock the catzs->lock mutex before searching in the catzs->zones
hash table.
2023-02-27 10:06:32 +00:00
Aram Sargsyan ed268b46f1 Process db callbacks in zone_loaddone() after zone_postload()
The zone_postload() function can fail and unregister the callbacks.

Call dns_db_endload() only after calling zone_postload() to make
sure that the registered update-notify callbacks are not called
when the zone loading has failed during zone_postload().

Also, don't ignore the return value of zone_postload().
2023-02-27 10:06:32 +00:00
Aram Sargsyan a73b67456e Add a system test for [GL #3777]
Add the 'ixfr-from-differences yes;' option to trigger a failed
zone postload operation when a zone is updated but the serial
number is not updated, then issue two successive 'rndc reload'
commands to trigger the bug, which causes an assertion failure.
2023-02-27 10:06:32 +00:00
Mark Andrews 01cd25efd8 Merge branch '3895-memory-leak-in-isc_hmac_init' into 'main'
Resolve "memory leak in isc_hmac_init"

Closes #3895

See merge request isc-projects/bind9!7588
2023-02-26 23:17:35 +00:00
Mark Andrews cf5f133679 Fix memory leak in isc_hmac_init
If EVP_DigestSignInit failed 'pkey' was not freed.
2023-02-26 22:56:07 +00:00
Arаm Sаrgsyаn 664bfb1cb6 Merge branch 'aram/catz-do-not-destroy-catzs-before-catz' into 'main'
Make sure catz->catzs isn't destroyed before catz

See merge request isc-projects/bind9!7603
2023-02-24 20:31:08 +00:00
Aram Sargsyan 030ffbf475 Make sure catz->catzs isn't destroyed before catz
Call dns_catz_unref_catzs() only after detaching 'catz'.
2023-02-24 19:40:34 +00:00
Ondřej Surý 56c543a3bc Merge branch '3881-catz-offload' into 'main'
Resolve "Run the catalog zone update as an offloaded work"

Closes #3881

See merge request isc-projects/bind9!7560
2023-02-24 16:11:58 +00:00
Aram SargsyanandOndřej Surý cb1cd67bea Add CHANGES and release notes for [GL #3881] 2023-02-24 17:06:18 +01:00
Ondřej Surý 4e7187601f Pause the catz dbiterator while processing the zone
The dbiterator read-locks the whole zone and it stayed locked during
whole processing time when catz is being read.  Pause the iterator, so
the updates to catz zone are not being blocked while processing the catz
update.
2023-02-24 17:06:18 +01:00
Ondřej Surý b1cd4a066a Unlock catzs during dns__catz_update_cb()
Instead of holding the catzs->lock the whole time we process the catz
update, only hold it for hash table lookup and then release it.  This
should unblock any other threads that might be processing updates to
catzs triggered by extra incoming transfer.
2023-02-24 17:04:33 +01:00
Aram SargsyanandOndřej Surý 0b96c9234f Offload catalog zone updates
Offload catalog zone processing so that the network manager threads
are not interrupted by a large catalog zone update.

Introduce a new 'updaterunning' state alongside with 'updatepending',
like it is done in the RPZ module.

Note that the dns__catz_update_cb() function currently holds the
catzs->lock during the whole process, which is far from being optimal,
but the issue is going to be addressed separately.
2023-02-24 15:18:02 +01:00
Ondřej Surý afdb16dc01 Merge branch 'aram/catz-add-shutdown-signaling' into 'main'
Add shutdown signaling for catalog zones

See merge request isc-projects/bind9!7602
2023-02-24 14:08:20 +00:00
Aram SargsyanandOndřej Surý c76cc58803 Add a CHANGES note for [GL !7571] 2023-02-24 15:07:14 +01:00
Aram SargsyanandOndřej Surý 246b7084d6 Add shutdown signaling for catalog zones
This change should make sure that catalog zone update processing
doesn't happen when the catalog zone is being shut down. This
should help avoid races when offloading the catalog zone updates
in the follow-up commit.
2023-02-24 15:06:54 +01:00
Ondřej Surý 94ee6f6672 Merge branch 'aram/catz-light-refactoring-and-reference-count-tracing' into 'main'
Implement reference count tracing for dns_catz_zone_t and dns_catz_zones_t

See merge request isc-projects/bind9!7570
2023-02-24 14:06:06 +00:00
Aram SargsyanandOndřej Surý c29299aa15 Add a CHANGES note for [GL !7570] 2023-02-24 15:00:44 +01:00
Aram SargsyanandOndřej Surý 2a52d30660 Call dns_catz_new_zones() only when it is needed
The configure_catz() function creates the catalog zones structure
for the view even when it is not needed, in which case it then
discards it (by detaching) later.

Instead, call dns_catz_new_zones() only when it is needed, i.e. when
there is no existing "previous" view with an existing 'catzs', that
is going to be reused.
2023-02-24 15:00:26 +01:00
Aram SargsyanandOndřej Surý 53f0c5a9ac Add reference count tracing for dns_catz_zone_t and dns_catz_zones_t
Tracing can be activated by defining DNS_RPZ_TRACE in catz.h.
2023-02-24 15:00:26 +01:00
Aram SargsyanandOndřej Surý 8cb79fec9d Light refactoring of catz.c
* Change 'dns_catz_new_zones()' function's prototype (the order of the
  arguments) to synchronize it with the similar function in rpz.c.
* Rename 'refs' to 'references' in preparation of ISC_REFCOUNT_*
  macros usage for reference tracking.
* Unify dns_catz_zone_t naming to catz, and dns_catz_zones_t naming to
  catzs, following the logic of similar changes in rpz.c.
* Use C compound literals for structure initialization.
* Synchronize the "new zone version came too soon" log message with the
  one in rpz.c.
* Use more of 'sizeof(*ptr)' style instead of the 'sizeof(type_t)' style
  expressions when allocating or freeing memory for 'ptr'.
2023-02-24 15:00:26 +01:00
Michal Nowak 52c9a5b2f5 Merge branch 'mnowak/freebsd-12.4' into 'main'
Add FreeBSD 12.4

See merge request isc-projects/bind9!7169
2023-02-24 12:58:38 +00:00
Michal Nowak 2307661b1a Add FreeBSD 12.4 2023-02-24 13:40:30 +01:00
Michal Nowak 5f805417cf Merge branch 'mnowak/alpine-3.17' into 'main'
Add Alpine Linux 3.17

See merge request isc-projects/bind9!7586
2023-02-24 11:46:50 +00:00
Michal Nowak 5783280b10 Drop date from "Regularly Tested Platforms" section
Changing the date is easy to forget and may be outdated.
2023-02-24 11:50:57 +01:00
Michal Nowak 345089ad23 Add Alpine Linux 3.17 2023-02-24 11:50:57 +01:00
Tony Finch d2a450d308 Merge branch 'fanf-prune-libirs' into 'main'
Move irs_resconf into libdns and remove libirs

See merge request isc-projects/bind9!7463
2023-02-24 10:01:05 +00:00
Tony Finch 330ff06d4a Move irs_resconf into libdns and remove libirs
`libirs` used to be a reference implementation of `getaddrinfo` and
related modern resolver APIs. It was stripped down in BIND 9.18
leaving only the `irs_resconf` module, which parses
`/etc/resolv.conf`. I have kept its include path and namespace prefix,
so it remains a little fragment of libirs now embedded in libdns.
2023-02-24 09:38:59 +00:00
Ondřej Surý 5ad1fe3570 Merge branch 'ondrej-restore-sonarcloud-analysis' into 'main'
Add SonarCloud GitHub Action

See merge request isc-projects/bind9!7589
2023-02-24 08:53:45 +00:00
Ondřej Surý 4bfbb4ddf7 Add SonarCloud GitHub Action
Add new SonarCloud GitHub Action and configuration; something (maybe
the way the builds were submitted) has apparently changed and the
project got deleted and the analysis wasn't working.
2023-02-24 08:53:41 +00:00
Evan Hunt 14bba4688c Merge branch '3886-xfrin-dispatch' into 'main'
refactor dns_xfrin to use dns_dispatch

Closes #3886

See merge request isc-projects/bind9!7573
2023-02-24 08:30:48 +00:00
Evan Hunt 55f00de18e CHANGES for [GL #3886] 2023-02-24 08:30:33 +00:00
Evan Hunt 4e93d44c74 fix a bug in dns_dispatch_getnext()
when a message arrives over a TCP connection matching an expected
QID, the dispatch is updated so it no longer expects that QID,
but continues reading. subsequent messages with the same QID are
ignored, unless the dispatch entry has called dns_dispatch_getnext()
or dns_dispatch_resume().

however, a coding error caused those functions to have no effect
when the dispatch was reading, so streams of messages with the same
QID could not be received over a single TCP connection, breaking *XFR.

this has been corrected by changing the order of operations in
tcp_dispatch_getnext() so that disp->reading isn't checked until
after the dispatch entry has been reactivated.
2023-02-24 08:30:33 +00:00
Evan Hunt f0c766abec refactor dns_xfrin to use dns_dispatch
the dns_xfrin module was still using the network manager directly to
manage TCP connections and send and receive messages.  this commit
changes it to use the dispatch manager instead.
2023-02-24 08:30:33 +00:00
Evan Hunt a4c8decc6a implement refcount tracing in xfrin.c
use ISC_REFCOUNT_IMPL for dns_xfrin_ctx_t (which has been renamed
to dns_xfrin_t to keep the function names dns_xfrin_attach() and
dns_xfrin_detach() unchanged).
2023-02-24 08:30:33 +00:00
Evan Hunt d72419d1f5 minor cleanups in dispatch.c
- simplified tcp_startrecv()
- removed a short function that was only called once
- removed an unnecessary if statement
2023-02-24 08:30:33 +00:00
Evan Hunt 1dd42a80d6 log the xfrin pointer address in xfrin_log()
to make it easier to trace xfrin events in the log, include
the address of the dns_xfrin_t object in all xfrin log messages.
2023-02-24 08:30:33 +00:00
Evan Hunt 9d37621012 remove dead code in dns_request
the 'connected' variable in 'dns_request_create()` was always false.
2023-02-24 08:30:33 +00:00
Evan Hunt ae5ba54fbe move dispatchmgr from resolver to view
the 'dispatchmgr' member of the resolver object is used by both
the dns_resolver and dns_request modules, and may in the future
be used by others such as dns_xfrin. it doesn't make sense for it
to live in the resolver object; this commit moves it into dns_view.
2023-02-24 08:30:33 +00:00
Michal Nowak ec33efe351 Merge branch 'mnowak/update_TEST_PARALLEL_JOBS_for_BSD' into 'main'
Disable OpenBSD system test parallelism in CI

See merge request isc-projects/bind9!7585
2023-02-24 08:16:14 +00:00
Michal Nowak d73eba57bd Disable OpenBSD system test parallelism in CI
Make OpenBSD system tests more stable by disabling parallelism in CI.

Accordingly, they will run 3-4 times longer.
2023-02-24 08:59:18 +01:00
Michal Nowak cf46addf51 Do not set TEST_PARALLEL_JOBS in FreeBSD system test
Setting TEST_PARALLEL_JOBS to 4 in FreeBSD system test jobs is a no-op
because it's already set to 4, one level above, on the global level.
2023-02-24 08:59:18 +01:00
Tony Finch dfed03f094 Merge branch 'fanf-qsbr' into 'main'
QSBR: safe memory reclamation for lock-free data structures

See merge request isc-projects/bind9!7290
2023-02-23 16:43:56 +00:00
Tony Finch 9b7aa536ba QSBR: safe memory reclamation for lock-free data structures
This "quiescent state based reclamation" module provides support for
the qp-trie module in dns/qp. It is a replacement for liburcu, written
without reference to the urcu source code, and in fact it works in a
significantly different way.

A few specifics of BIND make this variant of QSBR somewhat simpler:

  * We can require that wait-free access to a qp-trie only happens in
    an isc_loop callback. The loop provides a natural quiescent state,
    after the callbacks are done, when no qp-trie access occurs.

  * We can dispense with any API like rcu_synchronize(). In practice,
    it takes far too long to wait for a grace period to elapse for each
    write to a data structure.

  * We use the idea of "phases" (aka epochs or eras) from EBR to
    reduce the amount of bookkeeping needed to track memory that is no
    longer needed, knowing that the qp-trie does most of that work
    already.

I considered hazard pointers for safe memory reclamation. They have
more read-side overhead (updating the hazard pointers) and it wasn't
clear to me how to nicely schedule the cleanup work. Another
alternative, epoch-based reclamation, is designed for fine-grained
lock-free updates, so it needs some rethinking to work well with the
heavily read-biased design of the qp-trie. QSBR has the fastest read
side of the basic SMR algorithms (with no barriers), and fits well
into a libuv loop. More recent hybrid SMR algorithms do not appear to
have enough benefits to justify the extra complexity.
2023-02-23 15:57:53 +00:00
Tony Finch 5e8aa4982b Merge branch 'fanf-refcount-trace-tid' into 'main'
Include thread ID in refcount trace output

See merge request isc-projects/bind9!7584
2023-02-23 14:28:34 +00:00
Tony Finch 63cd73d43e Include thread ID in refcount trace output 2023-02-23 14:28:27 +00:00
Arаm Sаrgsyаn 4e1bddc6e0 Merge branch 'aram/catz-remove-unused-catzs-loop' into 'main'
Remove catzs->loop

See merge request isc-projects/bind9!7569
2023-02-23 09:39:17 +00:00
Aram Sargsyan 18d67fa916 Remove catzs->loop
The 'loop' member of the dns_catz_zones structure is not used.
2023-02-23 08:56:37 +00:00
Evan Hunt 211ec73f41 Merge branch '3778-empty-include' into 'main'
fix a crash from using an empty string for "include"

Closes #3778

See merge request isc-projects/bind9!7572
2023-02-22 17:36:13 +00:00
Evan Hunt dc27552c30 remove isc_glob
the isc_glob module was originally needed to support posix-style glob
processing on Windows, but is now just an unnecessary wrapper around
glob(3). this commit removes it.
2023-02-22 17:35:29 +00:00
Evan Hunt 4dfc3f056d fix a crash from using an empty string for "include"
the parser could crash when "include" specified an empty string in place
of the filename. this has been fixed by returning ISC_R_FILENOTFOUND
when the string length is 0.
2023-02-22 17:35:29 +00:00
Tony Finch 7aa0ee4f5e Merge branch 'fanf-atomic-lists' into 'main'
Simple lock-free singly-linked stack

See merge request isc-projects/bind9!7470
2023-02-22 17:05:51 +00:00
Ondřej SurýandTony Finch 6eb1340d1b Use atomic stack for async job queue
Previously, the async job queue would use a locked-list (ISC_LIST).
With introduction of atomic stack (that has to be drained at once), we
could use it to remove some contention between the threads and simplify
the async queue.

Fortunately, the reverse order still works for us - instead of append
and tail/prev operation on the list, we are now using prepend and
head/next operation on the atomic stack.
2023-02-22 16:13:37 +00:00
Tony Finch 36e56923ce Simple lock-free stack in <isc/stack.h>
Add a singly-linked stack that supports lock-free prepend and drain (to
empty the list and clean up its elements).  Intended for use with QSBR
to collect objects that need safe memory reclamation, or any other user
that works with adding objects to the stack and then draining them in
one go like various work queues.

In <isc/atomic.h>, add an `atomic_ptr()` macro to make type
declarations a little less abominable, and clean up a duplicate
definition of `atomic_compare_exchange_strong_acq_rel()`
2023-02-22 16:13:37 +00:00
Tom Krizek 29a7507b04 Merge branch '3622-serve-stale-rrsig-test' into 'main'
[CVE-2022-3736] Test RRSIG queries with serve-stale enabled

Closes #3622

See merge request isc-projects/bind9!7578
2023-02-22 12:57:09 +00:00
Mark AndrewsandTom Krizek add40273df Test RRSIG queries with serve-stale enabled
Make RRSIG queries where the existing tests trigger a DNS_EVENT_TRYSTALE
event.
2023-02-22 13:22:02 +01:00
Tom Krizek af33cd479b Merge branch '3619-serve-stale-client-timeout-crash-test' into 'main'
[CVE-2022-3924] Add a reproducer for the serve-stale crash when recursive clients soft quota is reached

Closes #3619

See merge request isc-projects/bind9!7575
2023-02-22 11:54:42 +00:00
Aram SargsyanandTom Krizek 4b52b0b4a9 Add tests for CVE-2022-3924
Reproduce the assertion by configuring a 'named' resolver with
'recursive-clients 10;' configuration option and running 20
queries is parallel.

Also tweak the 'ans2/ans.pl' to simulate a 50ms network latency
when qname starts with "latency". This makes sure that queries
running in parallel don't get served immediately, thus allowing
the configured recursive clients quota limitation to be activated.
2023-02-22 10:39:06 +01:00
Evan Hunt 1fb5d42416 Merge branch '3873-cleanup-task-timer-refs' into 'main'
remove references to obsolete isc_task/timer functions

Closes #3873

See merge request isc-projects/bind9!7568
2023-02-22 08:13:47 +00:00
Evan Hunt b058f99cb8 remove references to obsolete isc_task/timer functions
removed references in code comments, doc/dev documentation, etc, to
isc_task, isc_timer_reset(), and isc_timertype_inactive. also removed a
coccinelle patch related to isc_timer_reset() that was no longer needed.
2023-02-22 08:13:30 +00:00
Evan Hunt ee186855bf Merge branch 'each-no-sdb' into 'main'
remove SDB API and refactor builtin databases

Closes #3882

See merge request isc-projects/bind9!7558
2023-02-22 06:32:37 +00:00
Evan Hunt dee4939299 CHANGES for [GL #3882] 2023-02-21 10:13:34 -08:00
Evan Hunt aea4f10817 make builtin a standalone dns_db implementation
instead of using the SDB API as a wrapper to register and
unregister and provide a call framework for the builtin databases,
this commit flattens things so that the builtin databases implement
dns_db directly.
2023-02-21 10:13:10 -08:00
Evan Hunt 603cdb6332 move the dns_sdb API
move all dns_sdb code into bin/named/builtin.c, which is the
only place from which it's called.

(note this is temporary: later we'll refactor builtin so that it's a
standalone dns_db implementation on its own instead of using SDB
as a wrapper.)
2023-02-21 10:13:10 -08:00
Evan Hunt 77e7eac54c enable detailed db tracing
move database attach/detach functions to db.c, instead of
requiring them to be implemented for every database type.
instead, they must implement a 'destroy' function that is
called when references go to zero.

this enables us to use ISC_REFCOUNT_IMPL for databases,
with detailed tracing enabled by setting DNS_DB_TRACE to 1.
2023-02-21 10:13:10 -08:00
Evan Hunt 8da43bb7f5 simplify dns_sdb API
SDB is currently (and foreseeably) only used by the named
builtin databases, so it only needs as much of its API as
those databases use.

- removed three flags defined for the SDB API that were always
  set the same by builtin databases.

- there were two different types of lookup functions defined for
  SDB, using slightly different function signatures. since backward
  compatibility is no longer a concern, we can eliminate the 'lookup'
  entry point and rename 'lookup2' to 'lookup'.

- removed the 'allnodes' entry point and all database iterator
  implementation code

- removed dns_sdb_putnamedrr() and dns_sdb_putnamedrdata() since
  they were never used.
2023-02-21 10:13:10 -08:00
Evan Hunt ffa4757c79 use member name initialization for methods
initialize dns_dbmethods, dns_sdbmethods and dns_rdatasetmethods
using explicit struct member names, so we don't have to keep track
of NULLs for unimplemented functions any longer.
2023-02-21 10:13:10 -08:00
Evan Hunt 8036412aaa make fewer dns_db functions mandatory-to-implement
some dns_db functions would have crashed if the DB implementation failed
to implement them, requiring the implementations to add functions that
did nothing but return ISC_R_NOTIMPLEMENTED or some obvious default
value. we can just have the dns_db wrapper functions themselves return
those values, and clean up the implementations accordingly.
2023-02-21 10:13:10 -08:00
Evan Hunt c90fafa45d remove rdatalist_p.h
make the private isc__rdatalist_* functions public dns_rdatalist
functions so that all the rdatalist primitives can be used by
callers to libdns. (this will be needed later for moving SDB and
SDLZ out of libdns.)
2023-02-21 10:13:10 -08:00
Matthijs Mekking c283850cc3 Merge branch 'matthijs-fix-kasp-attach-detach-usage' into 'main'
Fix kasp attach detach usage

See merge request isc-projects/bind9!7563
2023-02-21 15:45:12 +00:00
Mark AndrewsandMatthijs Mekking b41882cc75 Fix dns_kasp_attach / dns_kasp_detach usage
The kasp pointers in dns_zone_t should consistently be changed by
dns_kasp_attach and dns_kasp_detach so the usage is balanced.
2023-02-21 15:47:44 +01:00
Tony Finch caafb15e1e Merge branch 'fanf-prune-libbind9' into 'main'
Move the last bits of libbind9 into libisc

See merge request isc-projects/bind9!7462
2023-02-21 13:12:44 +00:00
Tony Finch 8bb5f37fd4 Add CHANGES and release note
[cleanup]	Move bind9_getaddresses() to isc_getaddresses()
		and remove the now empty libbind9.
2023-02-21 13:12:26 +00:00
Tony Finch 4da9c582b8 Remove libbind9
It is now empty.
2023-02-21 13:12:26 +00:00
Tony Finch 3fef7c626a Move bind9_getaddresses() to isc_getaddresses()
No need to have a whole library for one function.
2023-02-21 13:12:26 +00:00
Mark Andrews b2923ce356 Merge branch '3884-cid-436299-null-pointer-dereference-in-lib-dns-resolver-c' into 'main'
Resolve "CID 436299: Null pointer dereference in lib/dns/resolver.c"

Closes #3884

See merge request isc-projects/bind9!7562
2023-02-21 12:58:25 +00:00
Mark Andrews 9c17f4353b Cleanup left over 'fctx != NULL' test following refactoring
This was causing 'CID 436299: Null pointer dereferences (REVERSE_INULL)'
in Coverity.  Also removed an 'INSIST(fctx != NULL);' that should
no longer be needed.
2023-02-21 12:22:27 +00:00
Arаm Sаrgsyаn 69b39899d5 Merge branch '3880-fix-rpz-assertion-failure-during-failed-reconfiguration' into 'main'
Detach rpzs and catzs from the previous view

Closes #3880

See merge request isc-projects/bind9!7552
2023-02-21 09:01:27 +00:00
Aram Sargsyan b086374b1d Add a CHANGES note for [GL #3880] 2023-02-21 08:23:59 +00:00
Aram Sargsyan 121a095a22 Detach rpzs and catzs from the previous view
When switching to a new view during a reconfiguration (or reverting
to the old view), detach the 'rpzs' and 'catzs' from the previuos view.

The 'catzs' case was earlier solved slightly differently, by detaching
from the new view when reverting to the old view, but we can not solve
this the same way for 'rpzs', because now in BIND 9.19 and BIND 9.18
a dns_rpz_shutdown_rpzs() call was added in view's destroy() function
before detaching the 'rpzs', so we can not leave the 'rpzs' attached to
the previous view and let it be shut down when we intend to continue
using it with the new view.

Instead, "re-fix" the issue for the 'catzs' pointer the same way as
for 'rpzs' for consistency, and also because a similar shutdown call
is likely to be implemented for 'catzs' in the near future.
2023-02-21 08:23:13 +00:00
Aram Sargsyan 95f4bac002 Add an "rpz" system test check for a failed reconfiguration
The faulty "DLZ" configuration triggers a reconfiguration failure
in such a place where view reverting code is covered.
2023-02-21 08:23:13 +00:00
Evan Hunt 1efbca6856 Merge branch 'each-cleanup-gethostname' into 'main'
remove named_os_gethostname()

See merge request isc-projects/bind9!7555
2023-02-18 20:23:56 +00:00
Evan Hunt 197334464e remove named_os_gethostname()
this function was just a front-end for gethostname(). it was
needed when we supported windows, which has a different function
for looking up the hostname; it's not needed any longer.
2023-02-18 20:23:41 +00:00
Mark Andrews 345dc4d505 Merge branch '3879-hmac_createctx-fails-to-free-context-on-isc_hmac_init-failure' into 'main'
Resolve "hmac_createctx fails to free context on isc_hmac_init failure"

Closes #3879

See merge request isc-projects/bind9!7549
2023-02-17 22:29:28 +00:00
Mark Andrews d22257a370 In hmac_createctx free ctx on isc_hmac_init failure 2023-02-17 21:58:56 +00:00
Michal Nowak b131c60bf5 Merge branch 'mnowak/qa-tools-update' into 'main'
Python formatting updates

See merge request isc-projects/bind9!7551
2023-02-17 15:00:07 +00:00
Michal Nowak 8064ac6bec Fix unnecessary "else" after "raise" with pylint 2.16.2
bin/tests/system/get_algorithms.py:225:4: R1720: Unnecessary "else" after "raise", remove the "else" and de-indent the code inside it (no-else-raise)
2023-02-17 15:31:52 +01:00
Michal Nowak 3cd2cc6254 Adapt to Python scripts to black 23.1.0 2023-02-17 15:31:52 +01:00
Tony Finch 000f885614 Merge branch 'fanf-libbind9-libisccfg' into 'main'
Move bind9/check to isccfg/check

See merge request isc-projects/bind9!7461
2023-02-17 12:50:39 +00:00
Tony Finch dcb54af220 Move bind9/check to isccfg/check
Since it is part of the configuration machinery
2023-02-17 12:13:37 +00:00
Ondřej Surý 6ba2579c67 Merge branch 'ondrej-further-dns_validator-refactoring' into 'main'
additional refactoring of dns_validator

See merge request isc-projects/bind9!7546
2023-02-17 06:22:03 +00:00
Evan HuntandOndřej Surý e49350721f CHANGES for [GL #3797] 2023-02-17 07:18:25 +01:00
Evan HuntandOndřej Surý 1ee30be7ce remove validator lock
as every validator function is loop-synchronized, it should no longer be
necessary to use a validator lock.

calling dns_validator_send(), dns_validator_cancel() or
dns_validator_destroy() from a thread other than the one on which the
validator is running will now cause an assertion failure; this should be
fine since the validator and resolver are tightly coupled, and the fetch
contexts and validators run in the same loops.
2023-02-17 07:18:25 +01:00
Ondřej Surý 7da99414c0 Implement proper reference counting in dns_validator
use reference counting in dns_validator to prevent use after free.
2023-02-17 07:18:25 +01:00
Evan HuntandOndřej Surý b4715a34a0 additional refactoring of dns_validator
refactor validator so that the validation status object (previously
called dns_valstatus_t, which was derived from dns_validatorevent_t), is
now part of the dns_validator object.  when calling validator callbacks,
the validator itself is now sent as the argument.

(note: this necessitates caution in the callback functions that are
internal to validator.c validators spawn other validators, and it can be
confusing at times whether we need to be looking at val, val->subvalidator,
or val->parent.)
2023-02-17 07:18:25 +01:00
Ondřej Surý da0f154bc7 Merge branch '3875-dont-unlink-before-expire_entry' into 'main'
Don't remove ADB entry from LRU before trying to expire it

Closes #3875

See merge request isc-projects/bind9!7544
2023-02-17 06:18:15 +00:00
Ondřej Surý 668d287d01 Don't remove ADB entry from LRU before trying to expire it
There was a code flow error that would remove the expired ADB entry from
the LRU list and then a check in the expire_entry() would cause
assertion error because it expect the ADB entry to be linked.

Additionally, the expire mechanism would loop for cases when we would
held only a read rwlock; in such case we need to upgrade the lock and
try again, not just try again.
2023-02-17 07:16:50 +01:00
Ondřej Surý 51e0b8994e Merge branch '3797-part9-remove-isc_task-completely' into 'main'
remove isc_task completely

Closes #3797

See merge request isc-projects/bind9!7537
2023-02-16 17:35:49 +00:00
Evan HuntandOndřej Surý a52b17d39b remove isc_task completely
as there is no further use of isc_task in BIND, this commit removes
it, along with isc_taskmgr, isc_event, and all other related types.

functions that accepted taskmgr as a parameter have been cleaned up.
as a result of this change, some functions can no longer fail, so
they've been changed to type void, and their callers have been
updated accordingly.

the tasks table has been removed from the statistics channel and
the stats version has been updated. dns_dyndbctx has been changed
to reference the loopmgr instead of taskmgr, and DNS_DYNDB_VERSION
has been udpated as well.
2023-02-16 18:35:32 +01:00
Ondřej Surý b7952c6fa7 Merge branch '3797-part8-catz-delzone-refactoring' into 'main'
refactor catz and addzone/delzone to use task

See merge request isc-projects/bind9!7373
2023-02-16 17:35:09 +00:00
Evan HuntandOndřej Surý a9f9041fe6 refactor dns_catz to use loop callbacks
catz events are now scheduled using isc_task_async() instead
of isc_task_send().
2023-02-16 17:51:55 +01:00
Evan HuntandOndřej Surý 9bdf982ea6 refactor delzone to use loop callbacks
the rmzone() function is now posted using isc_async_run().

dns_zone_gettask() is no longer used anywhere, and has been
removed.
2023-02-16 17:51:55 +01:00
Evan HuntandOndřej Surý f58e7c28cd switch to using isc_loopmgr_pause() instead of task exclusive
change functions using isc_taskmgr_beginexclusive() to use
isc_loopmgr_pause() instead.

also, removed an unnecessary use of exclusive mode in
named_server_tcptimeouts().

most functions that were implemented as task events because they needed
to be running in a task to use exclusive mode have now been changed
into loop callbacks instead. (the exception is catz, which is being
changed in a separate commit because it's a particularly complex change.)
2023-02-16 17:51:55 +01:00
Ondřej Surý 5a028a40b6 Merge branch '3797-part7-resolver-refactoring' into 'main'
refactor dns_resolver to use loop callbacks

See merge request isc-projects/bind9!7372
2023-02-16 16:50:46 +00:00
Evan HuntandOndřej Surý 0312789129 refactor dns_resolver to use loop callbacks
callback events from dns_resolver_createfetch() are now posted
using isc_async_run.

other modules which called the resolver and maintained task/taskmgr
objects for this purpose have been cleaned up.
2023-02-16 17:27:59 +01:00
Ondřej Surý 8f90424d12 Merge branch '3797-part6-refactor-callbacks' into 'main'
refactor various callbacks

See merge request isc-projects/bind9!7371
2023-02-16 16:20:26 +00:00
Evan HuntandOndřej Surý bba46be63d refactor dns_client to use loop callbacks
dns_client now uses isc_async_run() internally to post
client-resume events. (a task is still used for
dns_resolver_createfetch(), however.)
2023-02-16 17:16:42 +01:00
Evan HuntandOndřej Surý 83593167cd refactor dyndb sample driver to use loop callbacks
the syncptr function in the dyndb sample driver now uses
isc_async_run().
2023-02-16 17:16:42 +01:00
Evan HuntandOndřej Surý b061c7e27f refactor plugin hook resumption to use loop callbacks
plugins supporting asynchronous operation now use a loop callback
to resume operation in query_hookresume() rather than a task.
2023-02-16 17:16:41 +01:00
Evan HuntandOndřej Surý 773d47c95c refactor TAT queries to use loop callbacks
trust anchor telemetry events are now posted via isc_async_run().
(an isc_task is still used for dns_resolver_createfetch().)
2023-02-16 17:16:41 +01:00
Ondřej Surý 90544bd5f9 Merge branch '3797-part5-update-processing' into 'main'
refactor update processing to use loop callbacks

See merge request isc-projects/bind9!7370
2023-02-16 16:11:53 +00:00
Evan HuntandOndřej Surý 327b95566d refactor update processing to use loop callbacks
update processing now uses loop callbacks instead of task events.
2023-02-16 16:34:20 +01:00
Ondřej Surý 6d7fdb884c Merge branch '3797-part3-request-refactoring' into 'main'
refactor libdns modules to use loop callbacks

See merge request isc-projects/bind9!7367
2023-02-16 15:15:18 +00:00
Evan HuntandOndřej Surý 7a78a85b35 refactor dns_validator to use loop callbacks
The validator now uses loop callbacks to post its completion
events. (A task is still used for the fetches.)
2023-02-16 14:55:06 +01:00
Evan HuntandOndřej Surý 31aee2ef9c refactor dns_adb to use loop callbacks
The callbacks from dns_abd_createfind() are now posted using
isc_async_run() instead of isc_task_send().  ADB event types
have been replaced with a new dns_adbstatus_t type which is
included as find->status.

(The ADB still uses a task for dns_resolver_createfetch().)
2023-02-16 14:55:06 +01:00
Evan HuntandOndřej Surý 106da9c190 refactor dns_request to use loopmgr callbacks
dns_request_create() and _createraw() now take a 'loop' parameter
and run the callback event on the specified loop.

as the task manager is no longer used, it has been removed from
the dns_requestmgr structure.  the dns_resolver_taskmgr() function
is also no longer used and has been removed.
2023-02-16 14:55:06 +01:00
Tony Finch d3e2b680d0 Merge branch 'fanf-simplify-view-detach' into 'main'
Simplify locking in dns_view_detach()

See merge request isc-projects/bind9!7538
2023-02-16 13:44:28 +00:00
Tony FinchandTony Finch eb6b31b6f2 Simplify locking in dns_view_detach()
Lock just once, and shut down the resolver, adb, and requestmgr after
unlocking, like the zone table, managed keys zone, and redirect zone.
2023-02-16 13:44:17 +00:00
Tony Finch 97663836ea Merge branch 'fanf-avoid-fortify-source-redefinition' into 'main'
Avoid redefining _FORTIFY_SOURCE

See merge request isc-projects/bind9!7539
2023-02-16 13:43:56 +00:00
Tony Finch b0377f798f Avoid redefining _FORTIFY_SOURCE
Some compilers have a built-in definition of the _FORTIFY_SOURCE macro
that differs from BIND's preferred setting. This causes errors like
the one quoted below. The solution is to undefine the macro before
defining it. A similar fix was recently committed to glibc.

    <command line>: error: '_FORTIFY_SOURCE' macro redefined
    #define _FORTIFY_SOURCE 2
            ^
    <built-in>: note: previous definition is here
    #define _FORTIFY_SOURCE 0
	    ^

https://sourceware.org/git/glibc.git/commitdiff/35bcb08eaa953c9b
2023-02-16 13:43:40 +00:00
Michal Nowak 3203d6c549 Merge tag 'v9_19_10'
BIND 9.19.10
2023-02-16 13:38:33 +01:00
Mark Andrews cf002b41b0 Merge branch '3869-dig-fails-to-cleanup-openssl-references' into 'main'
Resolve "Dig fails to cleanup OpenSSL references"

Closes #3869

See merge request isc-projects/bind9!7535
2023-02-16 00:16:49 +00:00
Mark Andrews e27fc4bbc5 Cleanup OpenSSL reference on bad option
Another exit path that needs to be cleaned up.
2023-02-16 10:55:42 +11:00
Mark Andrews 4c2525c418 Cleanup OpenSSL reference on bad domain name
Free/detach tsigkey and sig0key when exiting and then call
dst_lib_destroy if we have previously called dst_lib_init.  This will,
in theory, allow OPENSSL_cleanup to free all memory.
2023-02-16 10:55:41 +11:00
Tony Finch 997fde6179 Merge branch 'fanf-prune-isc-headers' into 'main'
Remove several do-nothing headers from libisc

See merge request isc-projects/bind9!7464
2023-02-15 16:45:51 +00:00
Tony Finch 9892ac791c Add CHANGES note
[cleanup]	Several nugatory headers have been removed from libisc
2023-02-15 16:44:47 +00:00
Tony Finch f9c725d7d4 Remove do-nothing header <isc/stat.h>
Use <sys/stat.h> instead
2023-02-15 16:44:47 +00:00
Tony Finch 6927a30926 Remove do-nothing header <isc/print.h>
This one really truly did nothing. No lines added!
2023-02-15 16:44:47 +00:00
Tony Finch c7615bc28d Remove do-nothing header <isc/offset.h>
And replace all uses of isc_offset_t with standard off_t
2023-02-15 16:44:47 +00:00
Tony Finch bed09c1676 Remove do-nothing header <isc/netdb.h>
Not needed since we dropped Windows support
2023-02-15 16:44:47 +00:00
Tony Finch 9bcc434dad Merge branch 'fanf-clarify-strerror' into 'main'
Explain <isc/strerr.h> a little more

See merge request isc-projects/bind9!7465
2023-02-15 16:44:30 +00:00
Tony Finch b0893ae09a Explain <isc/strerr.h> a little more
The purpose of the `strerror_r()` wrapper was not obvious.
2023-02-15 16:44:09 +00:00
Tony Finch fe8e7e5958 Merge branch 'fanf-deprecate-deprecated' into 'main'
Deprecate <isc/deprecated.h>

See merge request isc-projects/bind9!7466
2023-02-15 16:04:28 +00:00
Tony FinchandTony Finch 75f7a85a39 Deprecate <isc/deprecated.h>
We refactor more freely these days.
2023-02-15 15:36:20 +00:00
Tony FinchandTony Finch 97b64f4970 Remove deprecated dns_db_rpz_*() methods
As well as the function wrappers, their slots have been removed from
the dns_dbmethods table.
2023-02-15 15:35:50 +00:00
Ondřej Surý 137bb3cf8f Merge branch '1609-add-modified-C-RW-WP-rwlock' into 'main'
Add the reader-writer synchronization with modified C-RW-WP

Closes #1609

See merge request isc-projects/bind9!7528
2023-02-15 09:22:15 +00:00
Ondřej Surý 459db4462f Add CHANGES note for [GL #1609] 2023-02-15 09:30:21 +01:00
Ondřej Surý c194ff5d77 Use C-RW-WP lock in the dns_adb unit
Replace the isc_mutex in the dns_adb unit with isc_rwlock for better
performance.  Both ADB names and ADB entries hashtables and LRU are now
using isc_rwlock.
2023-02-15 09:30:04 +01:00
Ondřej Surý 3d3d3b8c58 Use C-RW-WP lock in the dns_resolver unit
Replace the isc_mutex with isc_rwlock in the dns_resolver unit,
specifically, both fetch context and fetch counters now uses the C-RW-WP
locks.
2023-02-15 09:30:04 +01:00
Ondřej SurýandOndřej Surý 6ffda5920e Add the reader-writer synchronization with modified C-RW-WP
This changes the internal isc_rwlock implementation to:

  Irina Calciu, Dave Dice, Yossi Lev, Victor Luchangco, Virendra
  J. Marathe, and Nir Shavit.  2013.  NUMA-aware reader-writer locks.
  SIGPLAN Not. 48, 8 (August 2013), 157–166.
  DOI:https://doi.org/10.1145/2517327.24425

(The full article available from:
  http://mcg.cs.tau.ac.il/papers/ppopp2013-rwlocks.pdf)

The implementation is based on the The Writer-Preference Lock (C-RW-WP)
variant (see the 3.4 section of the paper for the rationale).

The implemented algorithm has been modified for simplicity and for usage
patterns in rbtdb.c.

The changes compared to the original algorithm:

  * We haven't implemented the cohort locks because that would require a
    knowledge of NUMA nodes, instead a simple atomic_bool is used as
    synchronization point for writer lock.

  * The per-thread reader counters are not being used - this would
    require the internal thread id (isc_tid_v) to be always initialized,
    even in the utilities; the change has a slight performance penalty,
    so we might revisit this change in the future.  However, this change
    also saves a lot of memory, because cache-line aligned counters were
    used, so on 32-core machine, the rwlock would be 4096+ bytes big.

  * The readers use a writer_barrier that will raise after a while when
    readers lock can't be acquired to prevent readers starvation.

  * Separate ingress and egress readers counters queues to reduce both
    inter and intra-thread contention.
2023-02-15 09:30:04 +01:00
Ondřej Surý af12241f67 Add missing <isc/atomic.h> include to dns/badcache.c
The dns_badcache was pulling the <isc/atomic.h> header only indirectly
via <isc/rwlock.h>, add the direct include as the <isc/rwlock.h> no
longer pulls the header when pthread_rwlock is used.
2023-02-15 09:30:04 +01:00
Ondřej Surý 28fe8104ee Add isc_hashmap_find() DbC check for valuep
This adds DbC check, so we don't pass non-NULL memory for a valued to
the isc_hashmap_find() function.
2023-02-15 09:30:04 +01:00
Mark Andrews 998252c6dc Merge branch 'feature/main/fips-tests' into 'main'
FIPS tests changes for RHEL

Closes #3871

See merge request isc-projects/bind9!7417
2023-02-15 08:16:52 +00:00
Mark Andrews 55a6b15087 Add CHANGES note for [GL !7417] 2023-02-15 18:55:18 +11:00
Petr MenšíkandMark Andrews 6ad794a8cd FIPS tests changes for RHEL
Include MD5 feature detection in featuretest tool and use it in some
places. When RHEL distribution or Fedora ELN is in FIPS mode, then MD5
algorithm is unavailable completely and even hmac-md5 algorithm usage
will always fail. Work that around by checking MD5 works and if not,
skipping its usage.

Those changes were dragged as downstream patch bind-9.11-fips-tests.patch
in Fedora and RHEL.
2023-02-15 15:44:28 +11:00
Ondřej Surý 4787adfd33 Merge branch '3862-recusive-stress-crash' into 'main'
Fix change 6093 which broke rbtdb when it grew too large

Closes #3862

See merge request isc-projects/bind9!7533
2023-02-14 18:19:54 +00:00
Tony FinchandOndřej Surý 9d7b224201 Fix change 6093 which broke rbtdb when it grew too large
I misunderstood the purpose of the `heap_index` rdataset header
member; I thought it identified which heap to use, and could therefore
be smaller, the same size as `locknum` indexes. But in fact it is a
position within a heap, so it needs to be able to count up to the
total number of rdatasets in the rbtdb.

So this changes `heap_index` from `uint16_t` back to `unsigned int`.

To avoid re-embiggening the rdatasetheader, shrink the `count` member
from `uint32` to `uint16`. The `count` is used to rotate RRsets in
`dns_rdataset_towiresorted()`, so 16 bits is more than large enough.
This change also means we no longer need to avoid colliding with
`DNS_RDATASET_COUNT_UNDEFINED` i.e. UINT32_MAX.

Closes #3862
2023-02-14 18:19:46 +00:00
Tony Finch 49db4fb60f Merge branch 'fanf-arm-spinloop' into 'main'
Improve the spinloop pause / yield hint

See merge request isc-projects/bind9!7469
2023-02-14 17:53:26 +00:00
Tony Finch 436b76bb17 Improve the spinloop pause / yield hint
Unfortunately, C still lacks a standard function for pause (x86,
sparc) or yeild (arm) instructions, for use in spin lock or CAS loops.
BIND has its own based on vendor intrinsics or inline asm.

Previously, it was buried in the `isc_rwlock` implementation. This
commit renames `isc_rwlock_pause()` to `isc_pause()` and moves
it into <isc/pause.h>.

This commit also fixes the configure script so that it detects ARM
yield support on systems that identify as `aarch*` instead of `arm*`.

On 64-bit ARM systems we now use the ISB (instruction synchronization
barrier) instruction in preference to yield. The ISB instruction
pauses the CPU for longer, several nanoseconds, which is more like the
x86 pause instruction. There are more details in a Rust pull request,
which also refers to MySQL making the same change:
https://github.com/rust-lang/rust/pull/84725
2023-02-14 17:13:24 +00:00
Tom Krizek f32d334e41 Merge branch '3849-relax-diff-on-dig-short-output' into 'main'
Ignore dig errors in +short comparisons in tests

Closes #3849

See merge request isc-projects/bind9!7488
2023-02-14 12:39:38 +00:00
Tom Krizek bd1ef66f83 Ignore dig errors in +short comparisons in tests
Tests using diff to compare outputs of dig +short shall ignore lines
starting with ";". In dig +short output, such lines should only be
present for errors such as network issues. Since we utilize dig's
default timeout/retry mechanisms, these transitory issues should be
ignored and only the final output should be considered during the diff
comparison.
2023-02-14 13:10:49 +01:00
Arаm Sаrgsyаn f5b77e734a Merge branch '3866-fix-rpz-reference-counting-bug' into 'main'
Fix RPZ reference counting error on shutdown

Closes #3866

See merge request isc-projects/bind9!7526
2023-02-14 09:59:41 +00:00
Aram Sargsyan a5927f1151 Add a CHANGES note for [GL #3866] 2023-02-14 09:13:18 +00:00
Aram Sargsyan afbe63565f Fix RPZ reference counting error on shutdown
A dns_rpz_unref_rpzs() call is missing when taking the 'goto unlock;'
path on shutdown, in order to compensate for the earlier
dns_rpz_ref_rpzs() call.

Move the dns_rpz_ref_rpzs() call after the shutdown check.
2023-02-14 09:12:53 +00:00
Mark Andrews b274d388f1 Merge branch '3662-extend-mkeys-system-test-to-handle-islands-of-trust' into 'main'
Resolve "Extend mkeys system test to handle islands of trust"

Closes #3662

See merge request isc-projects/bind9!7049
2023-02-13 23:32:05 +00:00
Mark Andrews 2928f21733 Add CHANGES note for [GL #3662] 2023-02-14 10:10:39 +11:00
Mark Andrews 41bdb5b9fe Add islands of trust to mkeys test
This adds an island of trust that is reachable from the root
where the trust anchors are added to island.conf.

This add an island of trust that is not reachable from the root
where the trust anchors are added to private.conf.
2023-02-14 10:10:05 +11:00
Mark Andrews fb7b7ac495 Report the key name that failed in retry_keyfetch
When there are multiple managed trust anchors we need to know the
name of the trust anchor that is failing.  Extend the error message
to include the trust anchor name.
2023-02-14 10:10:05 +11:00
Evan Hunt 2f54ba3977 Merge branch '2971-cleanup-dead-functions' into 'main'
remove some unused functions

Closes #2971

See merge request isc-projects/bind9!7521
2023-02-13 19:52:05 +00:00
Evan Hunt 3a1bb8dac8 remove some unused functions
removed some functions that are no longer used and unlikely to
be resurrected, and also some that were only used to support Windows
and can now be replaced with generic versions.
2023-02-13 11:50:59 -08:00
Tom Krizek 6b8b9c0b02 Merge branch '3848-increase-wait-time-runtime-test' into 'main'
Increase named startup wait time for runtime test

Closes #3848

See merge request isc-projects/bind9!7487
2023-02-13 14:22:24 +00:00
Tom Krizek b8bb4233e8 Increase named startup wait time for runtime test
Occasionally, the allotted 10 seconds for the "running" line to appear
in log after named is started proved insufficient in CI, especially
during increased load. Give named up to 60 seconds to start up to
mitigate this issue.
2023-02-13 14:54:12 +01:00
Michal Nowak e9272f3cdc Merge branch 'mnowak/pairwise-test-auth-recursive-servers' into 'main'
Test authoritative and recursive servers in pairwise

See merge request isc-projects/bind9!7397
2023-02-13 12:24:25 +00:00
Michal Nowak a708c2f93d Start named as auth and recursive server in pairwise
The script will start the named process configured as both an
authoritative and recursive server for each pairwise ./configure
configuration. The test is considered successful if the named process
runs until the 5-second timeout is triggered, and there is no named.lock
file present, indicating that named did not crash on shutdown.
2023-02-13 12:45:20 +01:00
Ondřej Surý 18f6213dc7 Merge branch '3814-tighten-the-locking-around-fctxcount' into 'main'
Add magic to fctxcount and replace the atomics with integers

Closes #3814

See merge request isc-projects/bind9!7515
2023-02-11 20:22:01 +00:00
Ondřej Surý 70439e2494 Add magic to fctxcount and replace the atomics with integers
Add magic value to the fctxcount, to check for completely invalid
counters, or counters that have been already destroyed.

Improve the locking around the counters, and because of that we can drop
the atomics and use simple integers - the counters were already locked
and the tiny bits that used the atomics were not worth the extra effort.
2023-02-11 20:21:47 +00:00
Evan Hunt ffeb8b3b2b Merge branch '3780-deprecated-obsolete-cleanup' into 'main'
clean up some deprecated/obsolete options and doc

Closes #3780

See merge request isc-projects/bind9!7506
2023-02-10 17:55:40 +00:00
Evan Hunt 362ba054cf clean up some deprecated/obsolete options and doc
- removed documentation of -S option from named man page
- removed documentation of reserved-sockets from ARM
- simplified documentation of dnssec-secure-to-insecure - it
  now just says it's obsolete rather than describing what it
  doesn't do anymore
- marked three formerly obsolete options as ancient:
  parent-registration-delay, reserved-sockets, and
  suppress-initial-notify
2023-02-10 09:52:27 -08:00
Ondřej Surý 06872bdd4e Merge branch 'pspacek/make-manin-on-dist' into 'main'
Remove pregenerated manpages from the repo

See merge request isc-projects/bind9!6520
2023-02-10 11:02:03 +00:00
Ondřej Surý 8f2e1e15cc Test the pre-generated man pages in GitLab CI
Add an extra job for a build from tarball, but without sphinx-build and
enable RUN_MAKE_INSTALL to check that man pages were generated and
installed.

Disable the RUN_MAKE_INSTALL on the systems without sphinx-build (sid).
2023-02-10 11:33:49 +01:00
Petr ŠpačekandOndřej Surý 9110465194 Remove pregenerated manpages from the repo
We don't need them in the repo, it's sufficient if we pregenerate them
while preparing the tarball.  That way we don't have overhead while
modifying them but they are still available for installations without
Sphinx.

I assume that this will make rebases and cherry-picks across branches
easier, with less trial and error churn required in the CI.

It's implemented in the way that we build the manpages only when we
either have pregenerated pages available at the configure time or
sphinx-build is installed and working.
2023-02-10 11:24:03 +01:00
Evan Hunt daf78318ed Merge branch 'each-remove-bind9-refvar' into 'main'
remove isc_bind9 variable

See merge request isc-projects/bind9!7508
2023-02-09 18:01:48 +00:00
Evan Hunt 935879ed11 remove isc_bind9 variable
isc_bind9 was a global bool used to indicate whether the library
was being used internally by BIND or by an external caller. external
use is no longer supported, but the variable was retained for use
by dyndb, which needed it only when being built without libtool.
building without libtool is *also* no longer supported, so the variable
can go away.
2023-02-09 18:00:13 +00:00
Michał Kępień 1db5dc456a Merge branch '3840-avoid-libuv-with-broken-recvmmsg' into 'main'
Avoid libuv 1.35 and 1.36 that have broken recvmmsg implementation

Closes #3840

See merge request isc-projects/bind9!7480
2023-02-09 14:10:19 +00:00
Ondřej SurýandMichał Kępień 6fa48c963e Add CHANGES and release note for [GL #3840] 2023-02-09 15:04:52 +01:00
Ondřej SurýandMichał Kępień d4d57f16c3 Sync compile-time & run-time libuv requirements
Bump the minimum libuv version required at runtime so that it matches
the compile-time requirements.
2023-02-09 15:04:52 +01:00
Ondřej SurýandMichał Kępień 735d09bffe Enforce version drift limits for libuv
libuv support for receiving multiple UDP messages in a single system
call (recvmmsg()) has been tweaked several times between libuv versions
1.35.0 and 1.40.0.  Mixing and matching libuv versions within that span
may lead to assertion failures and is therefore considered harmful, so
try to limit potential damage be preventing users from mixing libuv
versions with distinct sets of recvmmsg()-related flags.
2023-02-09 15:04:52 +01:00
Ondřej SurýandMichał Kępień 251f411fc3 Avoid libuv 1.35 and 1.36 that have broken recvmmsg implementation
The implementation of UDP recvmmsg in libuv 1.35 and 1.36 is
incomplete and could cause assertion failure under certain
circumstances.

Modify the configure and runtime checks to report a fatal error when
trying to compile or run with the affected versions.
2023-02-09 15:04:52 +01:00
Tony Finch e239e97a0d Merge branch 'fanf-another-bitstring-remnant' into 'main'
Remove another remnant of bitstring labels

See merge request isc-projects/bind9!7511
2023-02-09 14:03:17 +00:00
Tony FinchandTony Finch 174e56a251 Fix CHANGES numbering
Oops, I broke it
2023-02-09 13:41:04 +00:00
Tony FinchandTony Finch 1637721ee9 Remove another remnant of bitstring labels
A comment referred to the mysterious label type 01000001
2023-02-09 12:16:46 +00:00
Tony Finch d39f666c7e Merge branch 'fanf-smaller-rdatasetheader' into 'main'
Reduce the size of rdatasetheader_t by 16 bytes

See merge request isc-projects/bind9!7505
2023-02-09 09:09:05 +00:00
Tony FinchandTony Finch 9721fa2153 Reduce the size of rdatasetheader_t by 16 bytes
Re-order the fields to avoid padding, and change the type of
`heap_index` to `uint16_t` to match `dns_rbtnode_t->locknum`.
2023-02-09 09:07:30 +00:00
Mark Andrews ab4f4b4df0 Merge branch '3857-notify-source-port-test-is-not-reliable' into 'main'
Resolve "Notify source port test is not reliable"

Closes #3857

See merge request isc-projects/bind9!7509
2023-02-09 08:38:12 +00:00
Mark Andrews e7e1f59a3a Make notify source port test reliable
Send the test message from ns3 to ns2 instead of ns2 to ns3 as ns2
is started first and therefore the test doesn't have to wait on the
resend of the the NOTIFY message to be successful.
2023-02-09 15:11:24 +11:00
Mark Andrews d838b9f5cf Merge branch '3851-cleanup-nsupdate-system-test' into 'main'
Resolve "cleanup nsupdate system test"

Closes #3851

See merge request isc-projects/bind9!7490
2023-02-08 22:39:51 +00:00
Mark Andrews df7f3c47c6 Send grep output to /dev/null in nsupdate test 2023-02-08 22:20:21 +00:00
Mark Andrews 3a38782485 Merge branch '3831-dnssec-cds-failed-to-cleanup-properly-on-some-non-error-paths' into 'main'
Resolve "dnssec-cds failed to cleanup properly on some non error paths"

Closes #3831

See merge request isc-projects/bind9!7445
2023-02-08 21:56:11 +00:00
Mark Andrews ae26fcb8f5 Add CHANGES note for [GL #3831] 2023-02-09 08:35:27 +11:00
Mark Andrews 13f9d29954 dnssec-checkds: cleanup memory on error paths
Move and give unique names to the dns_db_t, dns_dbnode_t and
dns_dbversion_t pointers, so they have global scope and therefore
are visible to cleanup.  Unique names are not strictly necessary,
as none of the functions involved call each other.

Change free_db to handle NULL pointers and also an optional
(dns_dbversion_t **).

In match_keyset_dsset and free_keytable, ki to be handled
differently to prevent a false positive NULL pointer dereference
warning from scan.

In formatset moved dns_master_styledestroy earlier and freed
buf before calling check_result to prevent memory leak.

In append_new_ds_set freed ds on the default path before
calling check_result to prevent memory leak.
2023-02-09 08:35:27 +11:00
Mark Andrews 81bde388e4 dnssec-cds failed to cleanup on non error paths
dnssec-cds failed to cleanup on non error paths which meant that
the OpenSSL libraries could not cleanup properly.
2023-02-09 08:29:43 +11:00
Mark Andrews ddc4d1fca4 Define DNS_RDATASET_INIT for static initialisation 2023-02-09 08:29:43 +11:00
Ondřej Surý 4ebf27bc19 Merge branch '3729-drop-RHEL-7-and-clones-support' into 'main'
Drop RHEL / CentOS / Oracle Linux 7 support

Closes #3729

See merge request isc-projects/bind9!7346
2023-02-08 20:34:01 +00:00
Ondřej Surý 72cfca9b3b Add CHANGES and release notes for [GL #3729] 2023-02-08 21:33:23 +01:00
Ondřej Surý baced007af Require C11 Atomic Operations via <stdatomic.h>
Make the C11 Atomic Operations mandatory and drop the Gcc __atomic
builtin shims.
2023-02-08 21:33:23 +01:00
Ondřej Surý 1c456c0284 Require C11 thread_local keyword and <threads.h> header
Change the autoconf check to require C11 <threads.h> header and
thread_local keyword.
2023-02-08 21:33:23 +01:00
Ondřej Surý 20fd0cc60b Drop RHEL / CentOS / Oracle Linux 7 support
The RHEL (and clones) 7 will reach EOL in June 2024, shortly after BIND
9.20 will be released.  Drop the support for building on those
platforms, so we can use features of modern operating systems - newer
compiler that supports at least subset of C23 and OpenSSL 1.1/3.0.

This will simplify some of the code that we are using in BIND 9.
2023-02-08 21:33:22 +01:00
Evan Hunt 87ec418e04 Merge branch '3113-clientinfo-refactor' into 'main'
refactor dns_clientinfo_init(); use separate function to set ECS

Closes #3113

See merge request isc-projects/bind9!5782
2023-02-08 08:10:20 +00:00
Evan Hunt ff3fdaa424 refactor dns_clientinfo_init(); use separate function to set ECS
Instead of using an extra rarely-used paramater to dns_clientinfo_init()
to set ECS information for a client, this commit adds a function
dns_clientinfo_setecs() which can be called only when ECS is needed.
2023-02-07 23:48:22 -08:00
Evan Hunt 0792544872 Merge branch '3846-nsupdate-test-fix' into 'main'
increase simultaneous updates for quota test

Closes #3846

See merge request isc-projects/bind9!7500
2023-02-08 07:40:35 +00:00
Evan Hunt 06b1faf068 increase simultaneous updates for quota test
the nsupdate system test was intermittently failing due to the update
quota not being exceeded when it should have been.  this is most likely
a timing issue: the client is sending updates too slowly, or the server
is processing them too quickly, for the quota to fill. this commit
attempts to make that the failure less likely by increasing the number
of update transactions from 10 to 20.
2023-02-07 23:36:02 -08:00
Evan Hunt 9ecda9bdb2 Merge branch '854-spurious-keytype-warning' into 'main'
silence a spurious warning during key generation

Closes #854

See merge request isc-projects/bind9!7501
2023-02-08 07:29:46 +00:00
Evan Hunt 82503bec99 silence a spurious warning during key generation
when generating a key, if a DH key already existed for the same
name, a spurious warning message was generated saying "bad key
type". this is fixed.
2023-02-07 12:37:47 -08:00
Mark Andrews de6dfc1eeb Merge branch '3852-follow-up-from-9-18-merge-branch-3790-use-configured-udp-port-into-main' into 'main'
Resolve "Wait longer for rndc reconfig effects to complete"

Closes #3852

See merge request isc-projects/bind9!7493
2023-02-07 13:40:22 +00:00
Mark Andrews 71dbd09796 Allow some time to the root trust anchor to appear
Following deleting the root trust anchor and reconfiguring the
server it takes some time to for trust anchor to appear in 'rndc
managed-keys status' output.  Retry several times.
2023-02-07 12:59:49 +00:00
Mark Andrews 5746232b02 Merge branch '3836-missing-ossl_store_info_free-calls-in-dst__openssl_fromlabel_provider-on-error-path' into 'main'
Resolve "Missing OSSL_STORE_INFO_free calls in dst__openssl_fromlabel_provider on error path"

Closes #3836

See merge request isc-projects/bind9!7456
2023-02-07 12:59:06 +00:00
Mark Andrews 7f12c0884f Call OSSL_STORE_INFO_free on error path 2023-02-07 12:29:34 +00:00
Arаm Sаrgsyаn 80b88df4d3 Merge branch '3839-fix-resume_dslookup-bug' into 'main'
Fix a bug in resolver's resume_dslookup() function

Closes #3839

See merge request isc-projects/bind9!7476
2023-02-07 12:22:31 +00:00
Mark AndrewsandArаm Sаrgsyаn 4d465e9c0c check that delv handles REFUSED when chasing DS records 2023-02-07 10:41:21 +00:00
Aram Sargsyan 2a1f937536 Add a CHANGES note for [GL #3839] 2023-02-07 10:41:21 +00:00
Aram Sargsyan 410fcbfcfe Fix a bug in resolver's resume_dslookup() function
A recent refactoring in 7e4e125e5e
had introduced a logical error which could result in calling the
dns_resolver_createfetch() function with 'nameservers' pointer set
to NULL, but with 'domain' not set to NULL, which is not allowed
by the function.

Make sure 'domain' is set only when 'nsrdataset' is valid.
2023-02-07 10:41:21 +00:00
Michal Nowak 351aef8c3a Merge branch 'mnowak/set-up-version-and-release-notes-for-bind-9.19.11' into 'main'
Set up version and release notes for bind 9.19.11

See merge request isc-projects/bind9!7495
2023-02-07 10:03:17 +00:00
Michal Nowak 8e7fc75a3d Set up release notes for BIND 9.19.11 2023-02-07 10:25:44 +01:00
Michal Nowak 8965002255 Update BIND version to 9.19.11-dev 2023-02-07 10:22:26 +01:00
Mark Andrews 7e6611da8f Merge branch '3838-named-rrchecker-should-cleanup-when-it-detects-an-error' into 'main'
Resolve "named-rrchecker should cleanup when it detects an error"

Closes #3838

See merge request isc-projects/bind9!7473
2023-02-07 00:00:54 +00:00
Mark Andrews dbe82813e6 named-rrchecker: have fatal cleanup
It is trivial to fully cleanup memory on all the error paths in
named-rrchecker, many of which are triggered by bad user input.
This involves freeing lex and mctx if they exist when fatal is
called.
2023-02-06 23:29:12 +00:00
Evan Hunt a9cc88b8d6 Merge branch '3790-use-configured-udp-port' into 'main'
use configured source ports for UDP requests

Closes #3790

See merge request isc-projects/bind9!7479
2023-02-06 23:28:13 +00:00
Evan Hunt 4f50854e7a CHANGES for [GL #3790] 2023-02-06 15:04:24 -08:00
Evan Hunt 9cffd5c431 add source port configuration tests
check in the log files of receiving servers that the originating
ports for notify and SOA query messages were set correctly from
configured notify-source and transfer-source options.
2023-02-06 15:03:58 -08:00
Evan Hunt 4d50c912ba use configured source ports for UDP requests
the optional 'port' option, when used with notify-source,
transfer-source, etc, is used to set up UDP dispatches with a
particular source port, but when the actual UDP connection was
established the port would be overridden with a random one. this
has been fixed.

(configuring source ports is deprecated in 9.20 and slated for
removal in 9.22, but should still work correctly until then.)
2023-02-06 15:03:58 -08:00
Evan Hunt e46d5d84fc Merge branch 'each-remove-bindkeys' into 'main'
remove /etc/bind.keys

Closes #3850

See merge request isc-projects/bind9!7484
2023-02-06 23:03:08 +00:00
Evan Hunt c144fd2871 CHANGES for [GL #3850] 2023-02-06 14:39:43 -08:00
Evan Hunt 9bb46262af remove /etc/bind.keys
the built-in trust anchors in named and delv are sufficent for
validation. named still needs to be able to load trust anchors from
a bind.keys file for testing purposes, but it doesn't need to be
the default behavior.

we now only load trust anchors from a file if explicitly specified
via the "bindkeys-file" option in named or the "-a" command line
argument to delv. documentation has been cleaned up to remove references
to /etc/bind.keys.

Closes #3850.
2023-02-06 14:39:31 -08:00
Evan Hunt f291b77cd2 Merge branch '3673-delay-trust-anchor-management' into 'main'
delay trust anchor management until zones are loaded

Closes #3673

See merge request isc-projects/bind9!7441
2023-02-06 22:12:32 +00:00
Evan Hunt bafbbd2465 delay trust anchor management until zones are loaded
it was possible for a managed trust anchor needing to send a key
refresh query to be unable to do so because an authoritative zone
was not yet loaded. this has been corrected by delaying the
synchronization of managed-keys zones until after all zones are
loaded.
2023-02-06 13:50:03 -08:00
Tony Finch 7e8e2d55b0 Merge branch 'fanf-unused-fromwire-downcase' into 'main'
Remove unused support for fromwire(DNS_NAME_DOWNCASE)

See merge request isc-projects/bind9!7467
2023-02-06 14:20:42 +00:00
Tony FinchandTony Finch 50ab648f8a Remove unused support for fromwire(DNS_NAME_DOWNCASE)
Most of this change is fixing dns_rdata_fromwire() so
it does not propagate the unused options variable.
2023-02-06 13:26:36 +00:00
Tony Finch ecd428240b Merge branch 'fanf-bitstring-cleanup' into 'main'
Remove some remnants of bitstring labels

See merge request isc-projects/bind9!7196
2023-02-06 13:23:46 +00:00
Tony Finch c70bb3deb5 Remove some remnants of bitstring labels
* rbt node chains were sized to allow for bitstring labels, so they
  had 256 levels; but in the absence of bistrings, 128 is enough.

* dns_byaddr_createptrname() had a redundant options argument,
  and a very outdated doc comment.

* A number of comments referred to bitstring labels in a way that is
  no longer helpful. (A few informative comments remain.)
2023-02-06 13:22:30 +00:00
Tony Finch 8088728c90 Merge branch 'fanf-named-compilezone-stray-backtick' into 'main'
Fix the reference to RFC 1035 in named-compilezone(1)

See merge request isc-projects/bind9!7485
2023-02-06 12:31:08 +00:00
Tony Finch ef1170b3fc Fix the reference to RFC 1035 in named-compilezone(1)
There was a stray backquote
2023-02-06 12:31:01 +00:00
Tony Finch 10ff56b345 Merge branch 'fanf-time-monotonic' into 'main'
Add isc_time_monotonic()

See merge request isc-projects/bind9!7486
2023-02-06 12:23:14 +00:00
Tony FinchandTony Finch ff63b53ff4 Add isc_time_monotonic()
This is to simplify measurements of how long things take.
2023-02-06 12:14:51 +00:00
Tony Finch 89a3ff1d06 Merge branch '3845-mem-zero-non-zero' into 'main'
Fix ISC_MEM_ZERO on allocators with malloc_usable_size()

Closes #3845

See merge request isc-projects/bind9!7481
2023-02-06 12:09:28 +00:00
Tony Finch b8e71f9580 Fix ISC_MEM_ZERO on allocators with malloc_usable_size()
ISC_MEM_ZERO requires great care to use when the space returned by
the allocator is larger than the requested space, and when memory is
reallocated. You must ensure that _every_ call to allocate or
reallocate a particular block of memory uses ISC_MEM_ZERO, to ensure
that the extra space is zeroed as expected. (When ISC_MEMFLAG_FILL
is set, the extra space will definitely be non-zero.)

When BIND is built without jemalloc, ISC_MEM_ZERO is implemented in
`jemalloc_shim.h`. This had a bug on systems that have malloc_size()
or malloc_usable_size(): memory was only zeroed up to the requested
size, not the allocated size. When an oversized allocation was
returned, and subsequently reallocated larger, memory between the
original requested size and the original allocated size could
contain unexpected nonzero junk. The realloc call does not know the
original requested size and only zeroes from the original allocated
size onwards.

After this change, `jemalloc_shim.h` always zeroes up to the
allocated size, not the requested size.
2023-02-06 11:21:12 +00:00
Michal Nowak 789be8ef62 Update BIND version for release 2023-02-03 11:56:29 +01:00
Michal Nowak ba798c7c69 Add a CHANGES marker 2023-02-03 11:55:36 +01:00
Michal Nowak 0f7bed378f Merge branch 'michal/prepare-documentation-for-bind-9.19.10' into 'v9_19_10-release'
Prepare documentation for BIND 9.19.10

See merge request isc-private/bind9!495
2023-02-03 10:52:17 +00:00
Michał KępieńandMichal Nowak 1c441aa535 Add release note for GL #3827 2023-02-03 11:10:23 +01:00
Michał KępieńandMichal Nowak 0b1eb418de Reorder release notes 2023-02-03 11:10:06 +01:00
Michał KępieńandMichal Nowak 8388cc2404 Tweak and reword release notes 2023-02-03 11:07:36 +01:00
Michał Kępień d949e31b14 Prepare release notes for BIND 9.19.10 2023-02-03 09:38:25 +01:00
Michał Kępień 319dd1d9e8 Bump statistics channels versions
GL !7412 updated the set of counters exposed via the XML & JSON
statistics channels.  Apply a corresponding version bump, which was
not included in that merge request.
2023-02-03 09:38:25 +01:00
Tom KrizekandMichał Kępień 4b4bc897e1 Add container rebuild step to release checklist
It was agreed that the monthly CI container image rebuild should be done
manually rather than be automated. This allows us to have control over
when things could break and the end of the release cycle is the most
convenient time to have that happen.
2023-02-03 09:38:25 +01:00
Tom KrizekandMichał Kępień c46e040f4f Update docs to reflect 9.18 has become ESV 2023-02-03 09:38:25 +01:00
Michał Kępień a695d14150 Merge branch '3827-fix-dnsrps-builds' into 'main'
Fix DNSRPS builds

Closes #3827

See merge request isc-projects/bind9!7450
2023-02-01 10:24:22 +00:00
Michał Kępień 493eadd1ae Add CHANGES entry for GL #3827 2023-02-01 11:22:59 +01:00
Michał Kępień 183cd1bbe5 Fix 'view' variable scope in load_configuration()
Commit b69e783164 changed the scope of the
local 'view' variable in load_configuration(), but the code section
guarded by the #ifdef USE_DNSRPS directive was not adjusted accordingly,
causing build errors for DNSRPS-enabled builds.  Fix the latter by
declaring the 'view' variable inside the loop in the DNSRPS-specific
block of code.
2023-02-01 11:22:59 +01:00
Michał Kępień f3def4e4ed Handle iterator options in rpsdb_allrdatasets()
Commit 7695c36a5d added a new parameter,
'options', to the prototype of the 'allrdatasets' function pointer in
struct dns_dbmethods.  Handle this new parameter accordingly in
rpsdb_allrdatasets().
2023-02-01 11:22:59 +01:00
Michał Kępień e688ca5316 Add DNSRPS builds to pairwise testing
The --enable-dnsrps-dl switch for ./configure enables preparing a
DNSRPS-enabled build of BIND 9 that is not directly linked against a
DNSRPS provider library (dlopen() at runtime is used instead).  Employ
this switch to test DNSRPS-enabled builds in the pairwise testing job in
GitLab CI.
2023-02-01 11:22:59 +01:00
Evan Hunt 6398059af3 Merge branch '3797-part2-ratelimiter-refactoring' into 'main'
refactor isc_ratelimiter to use loop callbacks

See merge request isc-projects/bind9!7366
2023-02-01 09:05:38 +00:00
Evan Hunt 7fd78344e0 refactor isc_ratelimiter to use loop callbacks
the rate limter now uses loop callbacks rather than task events.
the API for isc_ratelimiter_enqueue() has been changed; we now pass
in a loop, a callback function and a callback argument, and
receive back a rate limiter event object (isc_rlevent_t). it
is no longer necessary for the caller to allocate the event.

the callback argument needs to include a pointer to the rlevent
object so that it can be freed using isc_rlevent_free(), or by
dequeueing.
2023-01-31 21:41:19 -08:00
Mark Andrews d6c3d9e04a Merge branch '3828-fuzz-dns_message_checksig-c-fails-to-call-dst_lib_destroy' into 'main'
Resolve "fuzz/dns_message_checksig.c fails to call dst_lib_destroy"

Closes #3828

See merge request isc-projects/bind9!7442
2023-01-31 14:16:41 +00:00
Mark Andrews 13e0dfbae2 Add CHANGES for [GL #3828] 2023-02-01 00:35:11 +11:00
Mark Andrews 897e0cd6f4 Call dst_lib_destroy if we have called dst_lib_init
This returns BIGNUMs to OpenSSL allowing libcrypto to fully clean up.
2023-02-01 00:34:33 +11:00
Mark Andrews 41f3466307 Merge branch '3830-nsupdate-failed-to-handle-primary-server-address-lookup-gracefully' into 'main'
Resolve "nsupdate failed to handle primary server address lookup gracefully"

Closes #3830

See merge request isc-projects/bind9!7444
2023-01-31 13:13:18 +00:00
Mark Andrews fda7858e74 Add CHANGES for [GL #3830] 2023-01-31 23:52:19 +11:00
Mark Andrews f1387514c6 Handle address lookup failure more gracefully
If the address lookup of the primary server fails just abort
the current update request rather than calling exit.  This allows
nsupdate to cleanup gracefully.
2023-01-31 23:51:44 +11:00
Mark Andrews fa21157bc1 Merge branch '3829-named-v-leaks-memory-when-shutting-down' into 'main'
Resolve "'named -V' leaks memory when shutting down"

Closes #3829

See merge request isc-projects/bind9!7443
2023-01-30 23:02:51 +00:00
Mark Andrews 1d258e2fb8 Add CHANGES for [GL #3829] 2023-01-30 22:26:50 +00:00
Mark Andrews 8b3c018f54 Call dns_lib_destroy in bin/named/main.c:printversion
There were unbalanced calls to dns_lib_init and dns_lib_destroy
leading to an OpenSSL memory leak.
2023-01-30 22:26:50 +00:00
Ondřej Surý cd03a842b4 Merge branch '3806-give-named-log-memory-context-a-name' into 'main'
Properly name ADB hashmap and named log memory contexts

Closes #3806

See merge request isc-projects/bind9!7449
2023-01-30 11:56:39 +00:00
Ondřej Surý acab74882c Properly name ADB hashmap and named log memory contexts
The ADB hashmaps are stored in extra memory contexts, so the hash
tables are excluded from the overmem accounting.  The new memory
context was unnamed, give it a proper name.

Same thing has happened with extra memory context used for named
global log context - give the extra memory context a proper name.
2023-01-30 12:54:57 +01:00
Ondřej Surý a90b3c040f Merge branch '3806-give-ADB-heap-memory-context-a-name' into 'main'
Properly name ADB hashmap memory context

Closes #3806

See merge request isc-projects/bind9!7447
2023-01-30 11:37:34 +00:00
Ondřej Surý 3cda9f9f14 Properly name ADB hashmap and named log memory contexts
The ADB hashmaps are stored in extra memory contexts, so the hash
tables are excluded from the overmem accounting.  The new memory
context was unnamed, give it a proper name.

Same thing has happened with extra memory context used for named
global log context - give the extra memory context a proper name.
2023-01-30 11:52:53 +01:00
Matthijs Mekking b942fea872 Merge branch '3822-rndc-dnssec-checkds-force-ds-state' into 'main'
Force set DS state after 'rndc dnssec -checkds'

Closes #3822

See merge request isc-projects/bind9!7423
2023-01-27 15:07:33 +00:00
Matthijs Mekking 38ffe5acf3 Add CHANGES for #3822 2023-01-27 15:07:26 +00:00
Matthijs Mekking ee42f66fbe Force set DS state after 'rndc dnssec -checkds'
Set the DS state after issuing 'rndc dnssec -checkds'. If the DS
was published, it should go in RUMOURED state, regardless whether it
is already safe to do so according to the state machine.

Leaving it in HIDDEN (or if it was magically already in OMNIPRESENT or
UNRETENTIVE) would allow for easy shoot in the foot situations.

Similar, if the DS was withdrawn, the state should be set to
UNRETENTIVE. Leaving it in OMNIPRESENT (or RUMOURED/HIDDEN)
would also allow for easy shoot in the foot situations.
2023-01-27 15:07:26 +00:00
Tom Krizek 837da85ef7 Merge branch 'tkrizek/danger-improvements' into 'main'
danger: refine existing rules

See merge request isc-projects/bind9!7428
2023-01-27 13:47:51 +00:00
Tom Krizek 79ae467973 danger: relax rules for single-line commits
The following are not also accepted as single-line commits without
generating warnings:
- CHANGES/release note may appear in the beginning of the commit message
- Release note may be capitalized
- Allow commits with "GL #" (e.g. Update documentation for [GL #XXXX])
2023-01-27 14:17:06 +01:00
Tom Krizek 1939e585c0 danger: update CHANGES rule to work with -S edition
When updating the -S edition, the CHANGES.SE file is modified. Make sure
danger accepts that.
2023-01-27 14:17:04 +01:00
Michał Kępień e68ca96db2 Merge branch 'michal/rework-the-security-incident-handling-checklist' into 'main'
Rework the Security Incident Handling Checklist

See merge request isc-projects/bind9!6980
2023-01-27 13:10:23 +00:00
Michał Kępień 9565d09f1c Update release checklist
Update the release checklist to incorporate some minor tweaks that we
have been applying manually for the past few months as a result of
release process evolution.
2023-01-27 14:10:09 +01:00
Michał Kępień 2c20f23b69 Rework the Security Incident Handling Checklist
Rework the Security Incident Handling Checklist so that it does not only
contain the SWENG-side steps for handling a security incident, but also
all the other steps required by ISC procedures.
2023-01-27 14:10:09 +01:00
Michał Kępień 0185e0874c Merge branch 'michal/extend-artifact-lifetime-for-release-related-jobs' into 'main'
Extend artifact lifetime for release-related jobs

See merge request isc-projects/bind9!7432
2023-01-27 12:29:06 +00:00
Michał Kępień 71c9d69145 Extend artifact lifetime for release-related jobs
Artifacts of the "stress" jobs in GitLab CI are used for generating the
QA summary for a given set of releases.  It happened in the past that
these artifacts were purged before the QA summary was prepared,
unnecessarily prolonging the release process.  A complete set of
artifacts from all such jobs for a single pipeline should be less than 1
GB in size, so extend their lifetime from one day to one week as a more
reasonable compromise between availability and disk space usage.  (Note:
these jobs are also run in scheduled pipelines, but that is expected to
be acceptable in the context of artifact lifetime.)

Artifacts of the "release" jobs in GitLab CI are what we eventually
publish on the FTP server.  It happened in the past that these artifacts
were purged before we copied them to their destination, unnecessarily
prolonging the release process, even though we usually press the "Keep"
button for the "release" jobs manually to keep them around indefinitely
(as they are the source of what we publish in other places).  Since
there is only one "release" job per tag pipeline and its artifacts only
take up tens of megabytes of space, keep the artifacts of the "release"
jobs around indefinitely by default.
2023-01-27 13:25:30 +01:00
Mark Andrews 98757aaf34 Merge branch '3824-teach-danger-about-amend' into 'main'
Resolve "Teach danger about amend!"

Closes #3824

See merge request isc-projects/bind9!7430
2023-01-27 11:39:12 +00:00
Mark Andrews 9b12473292 Teach danger about amend
commit --fixup=amend:<hash> produces a subject starting with amend!
by default.  Have danger look for this to ensure that it is squashed
before merging.
2023-01-27 19:14:32 +11:00
Michal Nowak 0727c033e9 Merge branch 'mnowak/pkgdiff' into 'main'
Add release tarball comparison script

See merge request isc-projects/bind9!7419
2023-01-26 13:05:14 +00:00
Michal Nowak 5487226586 Add release tarball comparison script
The util/release-tarball-comparison.sh script compares a release-ready
BIND 9 tarball to a temporary BIND 9 tarball created from the same
signed Git tag to ensure that their content does not differ
(significantly).
2023-01-26 13:59:42 +01:00
Michał Kępień 4e934bae0b Merge tag 'v9_19_9'
BIND 9.19.9
2023-01-25 21:16:00 +01:00
Ondřej Surý 897deb69e6 Merge branch 'tt-improve-rsa-extraction' into 'main'
Improve OpenSSL RSA key extraction

See merge request isc-projects/bind9!7424
2023-01-25 19:29:23 +00:00
Timo Teräs 91c4bca866 Improve OpenSSL RSA key extraction
Add check for extracting the public 'n' component on OpenSSL 3.0
path. This is mandatory component, and it's presence is checked
already on the other code path.

Also document the reason why private key component getting errors
are ignored.
2023-01-25 21:04:27 +02:00
Ondřej Surý cdae45e9cf Merge branch '3718-reduce-the-memory-statistics' into 'main'
Reduce the memory statistics to a bare minimum

Closes #3718

See merge request isc-projects/bind9!7412
2023-01-24 17:57:21 +00:00
Ondřej Surý 122737ace6 Add CHANGES and release note for [GL #3718] 2023-01-24 17:57:16 +00:00
Ondřej Surý a0f322a38b Remove BlockSize from bind9.xsl
The BlockSize counter doesn't exist anymore (for some time now).
2023-01-24 17:57:16 +00:00
Ondřej Surý 3d674ccc1d Restore Malloced memory counter as InUse alias + little cleanups
This restores the Malloced memory counter and it's now always equal to
InUse counter.  This is only for backwards compatibility reason and
there is no separate counter.

The commit also cleanups little things like structure with a single
item (summary.inuse), and shuts up a wrong cppcheck warning (the
notorious NULL check after assignment).
2023-01-24 17:57:16 +00:00
Ondřej Surý 474279e5f1 Remove ContextSize memory counter
Again, this was an internal allocator counter, now it's useless.
2023-01-24 17:57:16 +00:00
Ondřej Surý 863b2b8bf3 Make the all inuse memory counter atomic operations relaxed
Instead of enforcing stronger synchronization between threads, make all
the atomic operations relaxed.  We are not really interested in exact
numbers at all times - the single place where we need the exact number
is when the memory context is being destroyed.  Even when there's a
overmem counter, we don't care about exact ordering or exact number.
2023-01-24 17:57:16 +00:00
Ondřej Surý a08e2d37ed Cleanup the ptr argument from mem_putstats()
The ptr argument was unneeded and unused.
2023-01-24 17:57:16 +00:00
Ondřej Surý 699736b7bb Remove the Lost memory counter
The Lost memory counter would count the memory "lost" by external
libraries.  There's really no such thing as `named` require the memory
contexts to be clean on destroy.
2023-01-24 17:57:16 +00:00
Ondřej Surý 7588cd5cb1 Remove stats buckets memory counters
The stats buckets were again more useful for internal allocator, because
we would see the individual "block" caches where the allocations would
fall into.  Remove the stats buckets, and if needed, we can pull more
detailed statistics out of the jemalloc.
2023-01-24 17:57:16 +00:00
Ondřej Surý 1ea8894626 Remove the 'totalgets' memory counter
The totalgets falls into the same category as other "total" and "max"
numbers - it's just a big number with no meaning to end user.
2023-01-24 17:57:16 +00:00
Ondřej Surý 3d4e41d076 Remove the total memory counter
The total memory counter had again little or no meaning when we removed
the internal memory allocator.  It was just a monotonic counter that
would count add the allocation sizes but never subtracted anything, so
it would be just a "big number".
2023-01-24 17:57:16 +00:00
Ondřej Surý 91e349433f Remove maxinuse memory counter
The maxinuse memory counter indicated the highest amount of
memory allocated in the past. Checking and updating this high-
water mark value every time memory was allocated had an impact
on server performance, so it has been removed. Memory size can
be monitored more efficiently via an external tool logging RSS.
2023-01-24 17:57:16 +00:00
Ondřej Surý 971df0b4ed Remove malloced and maxmalloced memory counter
The malloced and maxmalloced memory counters were mostly useless since
we removed the internal allocator blocks - it would only differ from
inuse by the memory context size itself.
2023-01-24 17:57:16 +00:00
Ondřej Surý 7d8aa63026 Make {increment,decrement}_malloced() return void
The return value was only used in a single place and only for
decrement_malloced() and we can easily replace that with atomic_load().
2023-01-24 17:57:16 +00:00
Artem Boldariev 3634c4285a Merge branch 'artem-cookie-use-reuseport-socket-option-in-python-mock-server' into 'main'
Use SO_REUSEADDR for "ans9" mock server in "cookie" test

See merge request isc-projects/bind9!7418
2023-01-24 14:07:03 +00:00
Artem Boldariev 8fdf7bad76 Use SO_REUSEADDR for "ans9" mock server in "cookie" system test
This commit ensures that it is possible to run the 'cookie' test
multiple times in a row.
2023-01-24 14:39:49 +02:00
Evan Hunt fa6801cc03 Merge branch '3797-part1-zone-task-refactoring' into 'main'
refactor zone.c to use loop callbacks

See merge request isc-projects/bind9!7365
2023-01-23 21:06:49 +00:00
Ondřej SurýandEvan Hunt 7a692cb136 Enforce receive_secure_serial() and setnsec3param() serialization
Both receive_secure_serial() and setnsec3param() run on the same zone
loop, therefore they are serialized.  Remove the mechanism to enqueue
the nsec3param and secure serial updates in case one of them is
running (as they can not) and replace it with sanity check.
2023-01-23 12:36:12 -08:00
Ondřej SurýandEvan Hunt 838850612f Replace the dns_io_t mechanism with offloaded threads
Previously, the zone loading and dumping was effectively serialized by
the dns_io_t mechanism.  In theory, more IO operations could be run in
parallel, but the zone manager .iolimit was set to 1 and never increased
as dns_zonemgr_setiolimit() was never ever called.

As the dns_master asynchronous load and dump was already offloaded to
non-worker threads with isc_work mechanism, drop the whole dns_io_t
and just rely on the isc_work to do the load and dump scheduling.
2023-01-23 12:36:07 -08:00
Evan Hunt 59f670bba9 refactor inline signing processing to use loop callbacks
receive_secure_serial() and receive_secure_db() now use
loop callbacks instead of task events.
2023-01-22 17:55:02 -08:00
Evan Hunt ef0b126b9b refactor setnsec3param() to use loop callbacks
dynamic nsec3param update processing now uses loop callbacks
instead of task events.
2023-01-22 17:55:02 -08:00
Evan Hunt 539dc2a116 refactor asynchronous zone functions to use loop callbacks
Use loopmgr callbacks for:
- dns_zone_keydone() (also added missing documentation)
- dns_zone_setserial()
- zmgr_start_xfrin_ifquota()
2023-01-22 17:55:02 -08:00
Evan Hunt 599bdb1369 refactor dns_io to use loop callbacks
The zonemgr_getio() system now uses loopmgr callbacks instead of
task events. As zone->loadtasks is now no longer used, it has been
removed.
2023-01-22 17:55:02 -08:00
Ondřej Surý faaf3f98d8 Merge branch '3793-fix-serialized-signing-in-dnssec-signzone' into 'main'
Refactor dnssec-signzone to use loop callbacks

Closes #3793

See merge request isc-projects/bind9!7359
2023-01-22 20:52:10 +00:00
Ondřej Surý 53e835130e Allow interrupting dnssec-signzone during signing
The signal handler in the isc_loop would wait for all the work to finish
before interrupting the signing.  Add teardown handlers via
isc_loopmgr_teardown() to signal the assignwork() it should stop signing
and bail-out early.

NOTE: The dnssec-signzone binary still can't be interrupted during zone
loading, zone cleaning, nsec(3) chain generation or zone writing.  This
might get addressed in the future if it becomes a problem.
2023-01-22 20:44:18 +01:00
Ondřej Surý f5095e6c34 Dump the signed zone in the text format at the end of dnssec-signzone
Instead of dumping the signed zone contents node by node during the
signing, dump the entire zone at the end.  This was already done for the
raw zone format, but it shows that the IO is better utilized when the
zone dump is done in one single write rather than in small chunks.

A side effect of dumping node by node was that all names were printed
relative to the zone origin rather than being grouped under different
$ORIGINs as would normally be the case when dumping a zone. Also, state
was not maintained from one node to the next regarding whether the CLASS
has already been printed, so it was always included with the first
record of each node.

Since dnssec-signzone uses the dns_master_style_explicittl text format
style, and is the only application that does so, we can revise that
style and add a new DNS_STYLEFLAG_CLASS_PERNAME flag to get the output
back to what it was before this change.
2023-01-22 20:44:07 +01:00
Evan Hunt a2d773fb98 Refactor dnssec-signzone to use loop callbacks
Use isc_job_run() instead of isc_task_send() for dnssec-signzone
worker threads.

Also fix the issue where the additional assignwork() would be run only
from the main thread effectively serializing all the signing.
2023-01-21 23:39:09 -08:00
Evan Hunt 630724684a Merge branch 'each-cleanup-netmgr-trace' into 'main'
complete change of NETMGR_TRACE to ISC_NETMGR_TRACE

See merge request isc-projects/bind9!7390
2023-01-20 21:12:49 +00:00
Evan Hunt 301f8b23e1 complete change of NETMGR_TRACE to ISC_NETMGR_TRACE
some references to the old ifdef were still in place.
2023-01-20 12:46:34 -08:00
Arаm Sаrgsyаn 46c0b349ed Merge branch '3726-query-forward-dot' into 'main'
Resolve "Forward queries via DoT"

Closes #3726

See merge request isc-projects/bind9!7199
2023-01-20 15:24:40 +00:00
Aram Sargsyan 73e9390715 Add CHANGES and release notes for [GL #3726] 2023-01-20 14:45:30 +00:00
Aram Sargsyan d02be5e693 Fix nsupdate system test CA certificate signing validity days
The validity default days value of 1 was used for debugging and
left as such accidentally.

Use 10950 days, as used elsewhere (for example, in doth test CA).

This does not affect anything, the value will be effective when
generating new test certificates in the future.
2023-01-20 14:45:30 +00:00
Aram Sargsyan 154cdbd861 Test query forwarding to DoT-enabled upstream servers
Change the 'forward' system test to enable DoT on ns2 server,
and test that forwarding from ns4 to the DoT-enabled ns2 works.

In order to test different scenarios, create a test CA (based on
similar CAs for 'doth' and 'nsupdate' system tests), and test
both insecure (no certificate validation) and secure (also with
mutual TLS) TLS configurations, as well as a configuration with an
expired certificate.
2023-01-20 14:45:30 +00:00
Aram Sargsyan 6ea05ac3fe Resolver query forwarding to DoT-enabled upstream servers
Implement TLS transport usage in the resolver.

Use the configured TLS transport for the forwarders in the resolver.
2023-01-20 14:45:30 +00:00
Aram Sargsyan 3aa2d84880 Load and validate the configured TLS transport for forwarders
Add support for loading and validating the 'tls' parameter from
the forwarders' configuration.

This prepares ground for adding support to forward queries to
DoT-enabled upstream servers.
2023-01-20 14:45:30 +00:00
Aram Sargsyan e1dd86aa07 Add 'tls' configuration support for the 'forwarders' option
A 'tls' statement can be specified both for individual addresses
and for the whole list (as a default value when an individual
address doesn't have its own 'tls' set), just as it was done
before for the 'port' value.

Create a new function 'print_rawqstring()' to print a string residing
in a 'isc_textregion_t' type parameter.

Create a new function 'copy_string()' to copy a string from a
'cfg_obj_t' object into a 'isc_textregion_t'.
2023-01-20 14:45:30 +00:00
Mark Andrews 0c14e59215 Merge branch 'marka-mock-openbsd' into 'main'
Enable mock tests for OpenBSD

See merge request isc-projects/bind9!7309
2023-01-20 13:53:16 +00:00
Mark Andrews 5c06c67001 Remove conditional around mock tests for OpenBSD
We now use multiple barriers.
2023-01-20 13:32:25 +00:00
Mark Andrews 1873ad4a06 Merge branch '3800-macos-address-in-use-not-handled-gracefully' into 'main'
Resolve "MacOS address in use not handled gracefully"

Closes #3800

See merge request isc-projects/bind9!7381
2023-01-20 13:29:19 +00:00
Mark Andrews e706fb81ca Add CHANGES note for [GL #3800] 2023-01-20 11:06:08 +11:00
Mark Andrews b74dd2e8c2 Use INSIST rather then REQUIRE to meet DBC usage rules 2023-01-20 11:05:24 +11:00
Mark Andrews 08c39736a9 isc_nm_listentcp: treat socket failures gracefully
The old code didn't handle race conditions and errors on systems
with non load balancing sockets gracefully.  Look for an error on
any child socket and if found close all the child sockets and return
an error.
2023-01-20 11:05:24 +11:00
Mark Andrews 624f5a0dae isc_nm_listenudp: treat socket failures gracefully
The old code didn't handle race conditions and errors on systems
with non load balancing sockets gracefully.  Look for an error on
any child socket and if found close all the child sockets and return
an error.
2023-01-20 11:05:24 +11:00
Artem Boldariev fa7fd32a00 Merge branch 'artem-fix-building-on-dragonflybsd' into 'main'
Fix building BIND on DragonFly BSD

Closes #3796

See merge request isc-projects/bind9!7379
2023-01-19 22:55:45 +00:00
Artem Boldariev 942569a1bb Fix building BIND on DragonFly BSD (on both older an newer versions)
This commit ensures that BIND and supplementary tools still can be
built on newer versions of DragonFly BSD. It used to be the case, but
somewhere between versions 6.2 and 6.4 the OS developers rearranged
headers and moved some function definitions around.

Before that the fact that it worked was more like a coincidence, this
time we, at least, looked at the related man pages included with the
OS.

No in depth testing has been done on this OS as we do not really
support this platform - so it is more like a goodwill act. We can,
however, use this platform for testing purposes, too. Also, we know
that the OS users do use BIND, as it is included in its ports
directory.

Building with './configure' and './configure --without-jemalloc' have
been fixed and are known to work at the time the commit is made.
2023-01-20 00:19:12 +02:00
Mark Andrews 65e3527e66 Merge branch '3799-tsan-race-between-dns_rbtnode_t-bitfields' into 'main'
Add missing lock when setting node->wild

Closes #3799

See merge request isc-projects/bind9!7392
2023-01-19 13:24:32 +00:00
Mark Andrews 5c471c5d2c Add CHANGES for [GL #3799] 2023-01-19 23:52:37 +11:00
Mark Andrews 81c24b8da2 Add missing node lock when setting node->wild in rbtdb.c
The write node lock needs to be held when setting node->wild in
add_wildcard_magic except when being called from loading_addrdataset
which is used to load the zone without locking during its initial
load.
2023-01-19 23:52:08 +11:00
Arаm Sаrgsyаn 1a0b36d8a2 Merge branch '3808-refactor-isc_nm_xfr_allowed' into 'main'
Refactor isc_nm_xfr_allowed()

Closes #3808

See merge request isc-projects/bind9!7395
2023-01-19 11:21:19 +00:00
Aram Sargsyan 5a1707aa8d Add a CHANGES note for [GL #3808] 2023-01-19 10:24:36 +00:00
Aram Sargsyan 41dc48bfd7 Refactor isc_nm_xfr_allowed()
Return 'isc_result_t' type value instead of 'bool' to indicate
the actual failure. Rename the function to something not suggesting
a boolean type result. Make changes in the places where the API
function is being used to check for the result code instead of
a boolean value.
2023-01-19 10:24:08 +00:00
Matthijs Mekking b0b6b47696 Merge branch '3783-parental-ds-requests-need-rd-bit-set' into 'main'
Set RD=1 on DS requests to parental-agents

Closes #3783

See merge request isc-projects/bind9!7361
2023-01-19 10:20:35 +00:00
Matthijs Mekking dbbacd910f Add CHANGES and release note for GL #3783
News worthy.
2023-01-19 10:19:43 +00:00
Matthijs Mekking e34722ed43 Set RD bit on checkds requests
It is allowed to point parental-agents to a resolver. Therefore, the
RD bit should be set on requests.

Upon receiving a DS response, ensure that the message has either the
AA or the RA bit set.
2023-01-19 10:19:43 +00:00
Matthijs Mekking 0b9a9f9955 Add checkds test case with resolver parental-agent
Add a test case for a server that uses a resolver as an parental-agent.

We need two root servers, ns1 and ns10, one that delegates to the
'checkds' tld with the DS published (ns2), and one that delegates to
the 'checkds' tld with the DS removed (ns5). Both root zones are
being setup in the 'ns1/setup.sh' script.

We also need two resolvers, ns3 and ns8, that use different root hints
(one uses ns1 address as a hint, the other uses ns10).

Then add the checks to test_checkds.py is similar to the existing tests.

Update 'types' because for zones that have the DS withdrawn (or to be
withdrawn), the CDS and CDNSKEY records should not be published and
thus should not be in the NSEC bitmap.
2023-01-19 10:19:43 +00:00
Ondřej Surý e54215e048 Merge branch '3801-reduce-memory-bloat-caused-by-delayed-view-detach-lock-order-inversion' into 'main'
Detach the zone views outside of the zone lock

Closes #3801

See merge request isc-projects/bind9!7402
2023-01-19 09:21:18 +00:00
Ondřej Surý 978a0ef84c Detach the zone views outside of the zone lock
Detaching the views in the zone_shutdown() could lead to
lock-order-inversion between adb->namelocks[bucket], adb->lock,
view->lock and zone->lock.  Detach the views outside of the section that
zone-locked.
2023-01-19 09:21:10 +00:00
Ondřej Surý 5c7c1182c0 Merge branch 'ondrej/replace-lgtm-with-codeql-add-python-ply' into 'main'
Add python3-ply for ./configure to succeed on BIND 9.16 branch

See merge request isc-projects/bind9!7405
2023-01-19 09:11:56 +00:00
Ondřej Surý 0622d11366 Add python3-ply to GitHub CodeQL configuration
BIND 9.16 needs Python and PLY packages for configure to succeed.
Unless we want to tweak the build script to exclude python, we need to
add python3-ply package to the CodeQL configuration.
2023-01-19 10:03:37 +01:00
Ondřej Surý d8f98cec48 Merge branch 'ondrej/replace-lgtm-with-codeql' into 'main'
Add CodeQL GitHub Action

See merge request isc-projects/bind9!7393
2023-01-19 08:45:07 +00:00
Ondřej Surý 77abe612a1 Add CodeQL GitHub Action
Replace the decommissioned LGTM service with CodeQL GitHub action.
2023-01-19 09:43:32 +01:00
Ondřej Surý bb60d6ab6d Merge branch '3795-speed-up-EVP_DigestInit_ex-fixup' into 'main'
Use thread_local EVP_MD in isc_iterated_hash()

Closes #3795

See merge request isc-projects/bind9!7401
2023-01-18 23:32:06 +00:00
Ondřej Surý 5abbcdadaf Use thread_local EVP_MD in isc_iterated_hash()
Cherry-pick small fixup commit from 9.18/9.16 branches needed for
thread-safety.  This fixup commit is not needed for 9.19+ because of
reworked application setup, but it decouples isc_iterated_hash and
isc_md units and keeps all the branches in sync.
2023-01-18 23:33:43 +01:00
Ondřej Surý 35e2842d00 Merge branch '3795-speed-up-EVP_DigestInit_ex' into 'main'
Avoid implicit algorithm fetch for OpenSSL EVP_MD family

See merge request isc-projects/bind9!7375
2023-01-18 19:24:29 +00:00
Ondřej Surý 401294cf60 Add CHANGES and release note for [GL #3795] 2023-01-18 19:36:26 +01:00
Ondřej Surý f3753d591f Use thread_local EVP_MD_CTX in isc_iterated_hash()
As this code is on hot path (NSEC3) this introduces an additional
optimization of the EVP_MD API - instead of calling EVP_MD_CTX_new() on
every call to isc_iterated_hash(), we create two thread_local objects
for each thread - a basectx and mdctx, initialize basectx once and then
use EVP_MD_CTX_copy_ex() to flip the initialized state into mdctx.  This
saves us couple more valuable microseconds from the isc_iterated_hash()
call.
2023-01-18 19:36:21 +01:00
Ondřej Surý 25db8d0103 Use OpenSSL 1.x SHA_CTX API in isc_iterated_hash()
If the OpenSSL SHA1_{Init,Update,Final} API is still available, use it.
The API has been deprecated in OpenSSL 3.0, but it is significantly
faster than EVP_MD API, so make an exception here and keep using it
until we can't.
2023-01-18 19:36:17 +01:00
Ondřej Surý 36654df732 Use OpenSSL EVP_MD API directly in isc_iterated_hash()
Instead of going through another layer, use OpenSSL EVP_MD API directly
in the isc_iterated_hash() implementation.  This shaves off couple of
microseconds in the microbenchmark.
2023-01-18 18:32:57 +01:00
Ondřej Surý e6bfb8e456 Avoid implicit algorithm fetch for OpenSSL EVP_MD family
The implicit algorithm fetch causes a lock contention and significant
slowdown for small input buffers.  For more details, see:

https://github.com/openssl/openssl/issues/19612

Instead of using EVP_DigestInit_ex() initialize empty MD_CTX objects for
each algorithm and use EVP_MD_CTX_copy_ex() to initialize MD_CTX from a
static copy.  Additionally avoid implicit algorithm fetching by using
EVP_MD_fetch() for OpenSSL 3.0.
2023-01-18 18:32:57 +01:00
Ondřej Surý cfbe01c62f Add microbenchmark for isc_iterated_hash()
Add microbenchmark for isc_iterated_hash() to measure the speed of NSEC3
per second.
2023-01-18 18:32:57 +01:00
Ondřej Surý 05b60f9cd8 Merge branch 'ondrej/openssl3-no-deprecated' into 'main'
Enable OpenSSL 3.x build with -DOPENSSL_NO_DEPRECATED=1

See merge request isc-projects/bind9!7394
2023-01-18 17:18:09 +00:00
Ondřej Surý 61ad7a59e0 Enable OpenSSL 3.x build with -DOPENSSL_NO_DEPRECATED=1
Add a CI job where we explicitly disable any use of OpenSSL functions
that have been deprecated in OpenSSL 3.x.
2023-01-18 11:13:19 +01:00
Evan Hunt 680fdce937 Merge branch 'each-remove-reserved-dispatches' into 'main'
remove dead code for reserved dispatches

See merge request isc-projects/bind9!7391
2023-01-18 02:53:40 +00:00
Evan Hunt d79a3823ad remove dead code for reserved dispatches
named formerly reserved a set of dispatch objects for use when
sending requests from user-specified source ports. this objects
are no longer used and have been removed.
2023-01-17 18:23:52 -08:00
Evan Hunt 1070f1f56a Merge branch '3781-deprecate-source-port' into 'main'
mark "port" as deprecated for source address options

Closes #3781

See merge request isc-projects/bind9!7307
2023-01-18 01:51:43 +00:00
Evan Hunt 22d1951aa6 CHANGES and release note for [GL #3781] 2023-01-17 17:29:43 -08:00
Matthijs MekkingandEvan Hunt 531914e660 Test deprecate source port configuration
Add 'port' token to deprecated.conf. Also add options
'use-v4-udp-ports', 'use-v6-udp-ports', 'avoid-v4-udp-ports',
and 'avoid-v6-udp-ports'.

All of these should trigger warnings (except when deprecation warnings
are being ignored).
2023-01-17 17:29:31 -08:00
Evan Hunt 470ccbc8ed mark "port" as deprecated for source address options
Deprecate the use of "port" when configuring query-source(-v6),
transfer-source(-v6), notify-source(-v6), parental-source(-v6),
etc. Also deprecate use-{v4,v6}-udp-ports and avoid-{v4,v6}udp-ports.
2023-01-17 17:29:21 -08:00
Evan Hunt 175ee6b22e Merge branch '3789-remove-dscp' into 'main'
fully remove DSCP

Closes #3789

See merge request isc-projects/bind9!7338
2023-01-18 00:47:24 +00:00
Evan Hunt d6768d6000 CHANGES and release note revision for [GL #3789] 2023-01-17 16:18:21 -08:00
Evan Hunt 287722ac12 fully remove DSCP
The "dscp" option is now marked as "ancient" and it is a configuration
error to use it or to configure DSCP values for any source-address
option.
2023-01-17 16:18:21 -08:00
Ondřej Surý 71f13b9ad9 Merge branch '3801-reduce-memory-bloat-caused-by-delayed-view-detach' into 'main'
Detach the views in zone_shutdown(), not in zone_free()

Closes #3801

See merge request isc-projects/bind9!7382
2023-01-17 21:47:14 +00:00
Ondřej Surý b049e329ef Add CHANGES and release note for [GL #3801] 2023-01-17 21:48:30 +01:00
Ondřej Surý 7e8b53720d Commit the change of view for view->managed_keys
When we change the view in the view->managed_keys, we never commit the
change, keeping the previous view possibly attached forever.

Call the dns_zone_setviewcommit() immediately after changing the view as
we are detaching the previous view anyway and there's no way to recover
from that.
2023-01-17 21:48:30 +01:00
Ondřej Surý 13bb821280 Detach the views in zone_shutdown(), not in zone_free()
The .view (and possibly .prev_view) would be kept attached to the
removed zone until the zone is fully removed from the memory in
zone_free().  If this process is delayed because server is busy
something else like doing constant `rndc reconfig`, it could take
seconds to detach the view, possibly keeping multiple dead views in the
memory.  This could quickly lead to a massive memory bloat.

Release the views early in the zone_shutdown() call, and don't wait
until the zone is freed.
2023-01-17 21:48:30 +01:00
Artem Boldariev 42ab66b971 Merge branch '3767-dot-no-alpn-transfer-shutdown-crash' into 'main'
XoT: properly handle the case when checking for ALPN failed

Closes #3767

See merge request isc-projects/bind9!7360
2023-01-17 18:50:10 +00:00
Artem Boldariev 16fa692b56 Modify CHANGES [GL #3767]
Mention that downloading a zone via TLS- from a server which does not
negotiate "dot" ALPN tag could have crashed BIND on shutdown.
2023-01-17 19:00:19 +02:00
Artem Boldariev 34a1aab1cb XoT: properly handle the case when checking for ALPN failed
During XoT it is important to check for "dot" ALPN tag to be
negotiated (according to the RFC 9103). We were doing that, however, the
situation was not handled properly, leading to non-cancelled zone
transfers that would crash (abort()) BIND on shutdown.

In this particular case 'result' might equal 'ISC_R_SUCCESS'. When
this is the case, the part of the code supposed to handle failures
will not cancel the zone transfer.

This situation cannot happen when BIND is a secondary of other BIND
instance. Only primaries following the RFC not closely enough could
trigger such a behaviour.
2023-01-17 19:00:19 +02:00
Tom Krizek 9c32089fa9 Merge branch '3804-fix-feature-detection-in-pytests' into 'main'
Fix feature detection for pytest markers in tests

Closes #3804

See merge request isc-projects/bind9!7383
2023-01-17 13:48:57 +00:00
Tom Krizek 473cb530f4 Fix feature detection for pytest markers in tests
The condition was accidentally reversed during refactoring in
9730ac4c56 . It would result in skipped
tests on builds with proper support and false negatives on builds
without proper feature support.

Credit for reporting the issue and the fix goes to Stanislav Levin.
2023-01-17 14:18:22 +01:00
Tony Finch 2b89ef56a8 Merge branch 'fanf-time-backwards' into 'main'
Fix a typo in the NS_PER_ macros

See merge request isc-projects/bind9!7380
2023-01-17 09:01:32 +00:00
Tony FinchandTony Finch 290899661d Fix a typo in the NS_PER_ macros
Milliseconds and microseconds were swapped.
2023-01-16 20:33:57 +00:00
Ondřej Surý d7bcdf8bd6 Merge branch 'feature/main/zt-rwlock.h' into 'main'
Include isc_rwlocktype_t type definition in zt.h

See merge request isc-projects/bind9!7376
2023-01-16 11:06:48 +00:00
Petr Menšík 395d6fca26 Include isc_rwlocktype_t type definition in zt.h
After changes zt.h uses rwlock type, which is not enforced to be always
defined. Ensure full type definition is ready by including appropriate
header.
2023-01-16 11:45:31 +01:00
Tom Krizek 0bc0cabaa1 Merge branch 'tkrizek/system-tests-pytest-prep' into 'main'
Various tweaks of system test framework

See merge request isc-projects/bind9!7347
2023-01-16 09:13:01 +00:00
Tom Krizek 03d7b45d81 Update the TEST_PARALLEL_JOBS value in CI
The authoritative source for this value is in the project's CI/CD
Variables Setting. The reason to keep it in .gitlab-ci.yaml as well is
to have functional testing in forks without the need to manually specify
this variable in Settings.

The tests have been executed with 4 jobs for some time now. This
"change" only brings .gitlab-ci.yaml file up to date, it doesn't
actually change the number of jobs we currently use to test.
2023-01-13 17:01:30 +01:00
Tom Krizek 9593ff9347 Tweak dupsigs test output
Use a different visual separator, since "====", "----" and "____" is
used by pytest to separate the log output.
2023-01-13 17:01:30 +01:00
Tom Krizek e24d3b21d0 Look for ifconfig.sh.in in testsock.pl parent dir
Instead of using the current working directory to find the ifconfig.sh
script, look for the ifconfig.sh.in template in the directory where the
testsock.pl script is located. This enables the testsock.pl script to be
called from any working directory.

Using the ifconfig.sh.in template is sufficient, since it contains
the necessary information to be extracted: the max= value (which is
hard-coded in the template).
2023-01-13 17:01:30 +01:00
Tom Krizek d9a97200d5 Factor out script to handle system test core dumps
Move the core dump detection functionality for system test runs into a
separate script. This enables reuse by the pytest runner. The
functionality remains the same.
2023-01-13 17:01:30 +01:00
Tom Krizek 61330a7863 testcrypto.sh: run in TMPDIR if possible
Avoid creating any temporary files in the current workdir.

Additional/changing files in the bin/tests/system directory are
problematic for pytest/xdist collection phase, which assumes the list of
files doesn't change between the collection phase of the main pytest
thread and the subsequent collection phase of the xdist worker threads.

Since the testcrypto.sh is also called during pytest initialization
through conf.sh.common (to detect feature support), this could
occasionally cause a race condition when the list of files would be
different for the main pytest thread and the xdist worker.
2023-01-13 17:01:28 +01:00
Michał Kępień 6f0c821c48 Merge branch 'michal/set-up-version-and-release-notes-for-bind-9.19.10' into 'main'
Set up version and release notes for BIND 9.19.10

See merge request isc-projects/bind9!7362
2023-01-13 14:47:05 +00:00
Michał Kępień bf14b1a74c Set up release notes for BIND 9.19.10 2023-01-13 15:35:32 +01:00
Michał Kępień 2f39be23b1 Update BIND version to 9.19.10-dev 2023-01-13 15:35:32 +01:00
Michał Kępień a752887dce Update BIND version for release 2023-01-12 22:43:01 +01:00
Michał Kępień a48b5a2935 Add a CHANGES marker 2023-01-12 22:43:01 +01:00
Michał Kępień 978c57e54d Merge branch 'michal/prepare-documentation-for-bind-9.19.9' into 'security-main'
Prepare documentation for BIND 9.19.9

See merge request isc-private/bind9!492
2023-01-12 21:41:52 +00:00
Michał Kępień fadbbb94b3 Add release note for GL #3678 2023-01-12 21:39:37 +01:00
Michał Kępień fcd4905007 Reorder release notes 2023-01-12 21:39:37 +01:00
Michał Kępień 950870dd9e Tweak and reword release notes 2023-01-12 21:39:37 +01:00
Michał Kępień ac18df0591 Prepare release notes for BIND 9.19.9 2023-01-12 21:39:37 +01:00
Michał Kępień ad57bbb411 Update documentation for GL #3212 2023-01-12 21:39:37 +01:00
Michał Kępień b70313d96d Fix a typo in the DNSSEC Guide 2023-01-12 21:39:37 +01:00
Michał Kępień ee1e3c2afd Merge branch '3619-security-serve-stale-client-timeout-crash' into 'security-main'
[CVE-2022-3924] Fix the serve-stale crash when recursive clients soft quota is reached

See merge request isc-private/bind9!475
2023-01-12 11:45:50 +00:00
Aram SargsyanandMichał Kępień d08a478b42 Add CHANGES and release notes for [GL #3619] 2023-01-12 12:43:32 +01:00
Aram SargsyanandMichał Kępień ec2098ca35 Cancel all fetch events in dns_resolver_cancelfetch()
Although 'dns_fetch_t' fetch can have two associated events, one for
each of 'DNS_EVENT_FETCHDONE' and 'DNS_EVENT_TRYSTALE' types, the
dns_resolver_cancelfetch() function is designed in a way that it
expects only one existing event, which it must cancel, and when it
happens so that 'stale-answer-client-timeout' is enabled and there
are two events, only one of them is canceled, and it results in an
assertion in dns_resolver_destroyfetch(), when it finds a dangling
event.

Change the logic of dns_resolver_cancelfetch() function so that it
cancels both the events (if they exist), and in the right order.
2023-01-12 12:43:32 +01:00
Michał Kępień 80ed02f935 Merge branch '3622-serve-stale-rrsig-fix-security' into 'security-main'
[CVE-2022-3736] Properly handle stale RRSIG lookups

See merge request isc-private/bind9!470
2023-01-12 11:25:54 +00:00
Mark AndrewsandMichał Kępień 42c42be9a9 Add release note for [GL #3622] 2023-01-12 12:22:58 +01:00
Mark AndrewsandMichał Kępień 8ca018b5ec Add CHANGES note for [GL #3622] 2023-01-12 12:22:58 +01:00
Mark AndrewsandMichał Kępień 56eae06418 Move the mapping of SIG and RRSIG to ANY
dns_db_findext() asserts if RRSIG is passed to it and
query_lookup_stale() failed to map RRSIG to ANY to prevent this.  To
avoid cases like this in the future, move the mapping of SIG and RRSIG
to ANY for qctx->type to qctx_init().
2023-01-12 12:22:58 +01:00
Michał Kępień c28ea3ce2b Merge branch '3523-confidential-update-quota' into 'security-main'
[CVE-2022-3094] apply quotas to updates

See merge request isc-private/bind9!442
2023-01-12 10:56:37 +00:00
Evan HuntandMichał Kępień 991de0aa76 CHANGES and release notes for [GL #3523] 2023-01-12 11:52:48 +01:00
Evan HuntandMichał Kępień b91339b80e test failure conditions
verify that updates are refused when the client is disallowed by
allow-query, and update forwarding is refused when the client is
is disallowed by update-forwarding.

verify that "too many DNS UPDATEs" appears in the log file when too
many simultaneous updates are processing.
2023-01-12 11:52:48 +01:00
Evan HuntandMichał Kępień 964f559edb move update ACL and update-policy checks before quota
check allow-update, update-policy, and allow-update-forwarding before
consuming quota slots, so that unauthorized clients can't fill the
quota.

(this moves the access check before the prerequisite check, which
violates the precise wording of RFC 2136. however, RFC co-author Paul
Vixie has stated that the RFC is mistaken on this point; it should have
said that access checking must happen *no later than* the completion of
prerequisite checks, not that it must happen exactly then.)
2023-01-12 11:52:48 +01:00
Evan HuntandMichał Kępień f57758a730 add a configuration option for the update quota
add an "update-quota" option to configure the update quota.
2023-01-12 11:52:48 +01:00
Evan HuntandMichał Kępień 7c47254a14 add an update quota
limit the number of simultaneous DNS UPDATE events that can be
processed by adding a quota for update and update forwarding.
this quota currently, arbitrarily, defaults to 100.

also add a statistics counter to record when the update quota
has been exceeded.
2023-01-12 11:52:48 +01:00
Michał Kępień 6ecc0a2693 Merge branch 'michal/add-placeholder-entries-to-CHANGES' into 'main'
Add placeholder entries to CHANGES

See merge request isc-projects/bind9!7356
2023-01-11 16:48:05 +00:00
Michał Kępień a2cc802060 Add placeholder entries to CHANGES
Add placeholders for the following issues:

  - [GL #3523]
  - [GL #3599]
  - [GL #3619]
  - [GL #3622]
2023-01-11 17:44:12 +01:00
Arаm Sаrgsyаn a5e23c3158 Merge branch 'aram/dns_fwdtable_addfwd-cleanup-bugfix' into 'main'
Fix dns_fwdtable_addfwd() error path cleanup bug

See merge request isc-projects/bind9!7205
2023-01-11 13:19:31 +00:00
Aram Sargsyan cf4003fa58 Use sizeof(*ptr) for allocating/freeing memory in forward.c
As shown in the previous commit, using sizeof(type_t) is a little
bit more error-prone when copy-pasting code, so extracting the
size information from the pointer which is being dealt with seems
like a better alternative.
2023-01-11 12:41:06 +00:00
Aram Sargsyan 0cc1b06d98 Fix dns_fwdtable_addfwd() error path cleanup bug
Free 'sizeof(dns_forwarder_t)' bytes of memory instead of
'sizeof(dns_sockaddr_t)' bytes, because `fwd` is a pointer
to a 'dns_forwarder_t' type structure.
2023-01-11 12:41:06 +00:00
Mark Andrews 40077f6f75 Merge branch '3764-adjust-descriptors-for-some-unit-tests' into 'main'
Resolve "Adjust descriptor limit for some unit tests"

Closes #3764

See merge request isc-projects/bind9!7294
2023-01-11 11:04:07 +00:00
Mark Andrews cdcd605ede Increase the number of available file descriptors
notify_test and query_test run out of descriptors on some platforms.

    % ./notify_test
    [==========] Running 1 test(s).
    [ RUN      ] notify_start
    netmgr/tcp.c:369: REQUIRE(csock->fd >= 0) failed, back trace
    0   libisc-9.19.9-dev.dylib             0x00000001045c5080 default_callback + 72
    1   libisc-9.19.9-dev.dylib             0x00000001045c4ffc isc_assertion_failed + 56
    2   libisc-9.19.9-dev.dylib             0x00000001045b8bcc start_tcp_child + 304
    3   libisc-9.19.9-dev.dylib             0x00000001045b8710 isc_nm_listentcp + 636
    4   libisc-9.19.9-dev.dylib             0x00000001045b3e0c isc_nm_listenstreamdns + 344
    5   libns-9.19.9-dev.dylib              0x0000000104b90630 ns_interface_listentcp + 152
    6   libns-9.19.9-dev.dylib              0x0000000104b8f65c interface_setup + 488
    7   libns-9.19.9-dev.dylib              0x0000000104b8de98 do_scan + 2028
    8   libns-9.19.9-dev.dylib              0x0000000104b8d640 ns_interfacemgr_scan + 212
    9   notify_test                         0x000000010418ddd0 scan_interfaces + 44
    10  libisc-9.19.9-dev.dylib             0x00000001045d5fd8 isc__job_cb + 116
    11  libuv.1.dylib                       0x000000010545afe4 uv__run_idle + 152
    12  libuv.1.dylib                       0x0000000105455cd0 uv_run + 204
    13  libisc-9.19.9-dev.dylib             0x00000001045e1120 loop_run + 460
    14  libisc-9.19.9-dev.dylib             0x00000001045df824 loop_thread + 44
    15  libisc-9.19.9-dev.dylib             0x00000001045df6dc isc_loopmgr_run + 456
    16  notify_test                         0x000000010418b900 run_test_notify_start + 88
    17  libcmocka.0.dylib                   0x00000001054968c0 cmocka_run_one_test_or_fixture + 448
    18  libcmocka.0.dylib                   0x0000000105494ca4 _cmocka_run_group_tests + 848
    19  notify_test                         0x000000010418be60 main + 120
    20  libdyld.dylib                       0x0000000181509430 start + 4
    Abort
    % ./query_test
    [==========] Running 4 test(s).
    [ RUN      ] ns__query_sfcache
    netmgr/tcp.c:369: REQUIRE(csock->fd >= 0) failed, back trace
    0   libisc-9.19.9-dev.dylib             0x000000010294d080 default_callback + 72
    1   libisc-9.19.9-dev.dylib             0x000000010294cffc isc_assertion_failed + 56
    2   libisc-9.19.9-dev.dylib             0x0000000102940bcc start_tcp_child + 304
    3   libisc-9.19.9-dev.dylib             0x0000000102940710 isc_nm_listentcp + 636
    4   libisc-9.19.9-dev.dylib             0x000000010293be0c isc_nm_listenstreamdns + 344
    5   libns-9.19.9-dev.dylib              0x00000001026cc630 ns_interface_listentcp + 152
    6   libns-9.19.9-dev.dylib              0x00000001026cb65c interface_setup + 488
    7   libns-9.19.9-dev.dylib              0x00000001026c9e98 do_scan + 2028
    8   libns-9.19.9-dev.dylib              0x00000001026c9640 ns_interfacemgr_scan + 212
    9   query_test                          0x00000001026a1018 scan_interfaces + 44
    10  libisc-9.19.9-dev.dylib             0x000000010295dfd8 isc__job_cb + 116
    11  libuv.1.dylib                       0x0000000103996fe4 uv__run_idle + 152
    12  libuv.1.dylib                       0x0000000103991cd0 uv_run + 204
    13  libisc-9.19.9-dev.dylib             0x0000000102969120 loop_run + 460
    14  libisc-9.19.9-dev.dylib             0x0000000102967824 loop_thread + 44
    15  libisc-9.19.9-dev.dylib             0x00000001029676dc isc_loopmgr_run + 456
    16  query_test                          0x000000010269cf34 run_test_ns__query_sfcache + 88
    17  libcmocka.0.dylib                   0x00000001028068c0 cmocka_run_one_test_or_fixture + 448
    18  libcmocka.0.dylib                   0x0000000102804ca4 _cmocka_run_group_tests + 848
    19  query_test                          0x000000010269eab8 main + 116
    20  libdyld.dylib                       0x0000000181509430 start + 4
    Abort
    %

expected_creads can exceed the number of file descriptors on some
platforms.

    % ./udp_test
    [==========] Running 18 test(s).
    [ RUN      ] mock_listenudp_uv_udp_open
    [       OK ] mock_listenudp_uv_udp_open
    [ RUN      ] mock_listenudp_uv_udp_bind
    [       OK ] mock_listenudp_uv_udp_bind
    [ RUN      ] mock_listenudp_uv_udp_recv_start
    [       OK ] mock_listenudp_uv_udp_recv_start
    [ RUN      ] mock_udpconnect_uv_udp_open
    [       OK ] mock_udpconnect_uv_udp_open
    [ RUN      ] mock_udpconnect_uv_udp_bind
    [       OK ] mock_udpconnect_uv_udp_bind
    [ RUN      ] mock_udpconnect_uv_udp_connect
    [       OK ] mock_udpconnect_uv_udp_connect
    [ RUN      ] mock_udpconnect_uv_recv_buffer_size
    [       OK ] mock_udpconnect_uv_recv_buffer_size
    [ RUN      ] mock_udpconnect_uv_send_buffer_size
    [       OK ] mock_udpconnect_uv_send_buffer_size
    [ RUN      ] udp_noop
    [       OK ] udp_noop
    [ RUN      ] udp_noresponse
    [       OK ] udp_noresponse
    [ RUN      ] udp_shutdown_connect
    [       OK ] udp_shutdown_connect
    [ RUN      ] udp_shutdown_read
    [       OK ] udp_shutdown_read
    [ RUN      ] udp_cancel_read
    [       OK ] udp_cancel_read
    [ RUN      ] udp_timeout_recovery
    [       OK ] udp_timeout_recovery
    [ RUN      ] udp_double_read
    [       OK ] udp_double_read
    [ RUN      ] udp_recv_one
    [       OK ] udp_recv_one
    [ RUN      ] udp_recv_two
    [       OK ] udp_recv_two
    [ RUN      ] udp_recv_send
    udp__connect_cb(0x0, too many open files, 0x0)
    udp__connect_cb(0x0, too many open files, 0x0)
    udp__connect_cb(0x0, too many open files, 0x0)
    udp__connect_cb(0x0, too many open files, 0x0)
    udp__connect_cb(0x0, too many open files, 0x0)
    udp__connect_cb(0x0, too many open files, 0x0)
    %
2023-01-11 10:44:07 +00:00
Ondřej Surý 5bcfd46523 Merge branch 'ondrej/use-pthread_barrier-if-available' into 'main'
Prefer the pthread_barrier implementation over uv_barrier

See merge request isc-projects/bind9!7348
2023-01-11 09:54:13 +00:00
Ondřej Surý d07c4a98da Prefer the pthread_barrier implementation over uv_barrier
Prefer the pthread_barrier implementation on platforms where it is
available over uv_barrier implementation.  This also solves the problem
with thread sanitizer builds on macOS that doesn't have pthread barrier.
2023-01-11 09:51:02 +01:00
Ondřej Surý 5139b04e27 Merge branch 'fanf-git-replay-merge-tags' into 'main'
Auto-tag merge requests created by git-replay-merge

See merge request isc-projects/bind9!7254
2023-01-11 08:02:46 +00:00
Tony FinchandOndřej Surý 434e25c098 Auto-tag merge requests created by git-replay-merge
The target branch is added to the title of the MR, and a "Backport"
label is added. If the target branch starts with "v" a version label
is added too.

While I am here, clean up remnants of the old gitlab API (which has
been replaced by push options for our purposes) and improve the
command-line parsing.
2023-01-11 08:02:29 +00:00
Ondřej Surý 2037b1d944 Merge branch 'ondrej/remove-udp-and-tcp-listen-lock' into 'main'
Get rid of locking during UDP and TCP listen

See merge request isc-projects/bind9!7343
2023-01-11 06:51:14 +00:00
Ondřej Surý d06602f036 Get rid of locking during UDP and TCP listen
We already have a synchronization mechanism when starting the UDP and
TCP listener children - barriers.  Change how we start the first-born
child (tid == 0), so we don't have to race for sock->parent->result and
sock->parent->fd.
2023-01-11 07:17:46 +01:00
Ondřej Surý 7900cbd9a9 Merge branch 'ondrej/cleanup-isc_astack-usage-in-netmgr' into 'main'
Convert isc_astack usage in netmgr to mempool and ISC_LIST

See merge request isc-projects/bind9!7300
2023-01-10 19:53:50 +00:00
Ondřej Surý 10f884a5b8 Remove unused isc_astack unit
The isc_astack unit is now unused, so just remove it.
2023-01-10 20:31:24 +01:00
Ondřej Surý 359faf2ff7 Convert isc_astack usage in netmgr to mempool and ISC_LIST
Change the per-socket inactive uvreq cache (implemented as isc_astack)
to per-worker memory pool.

Change the per-socket inactive nmhandle cache (implemented as
isc_astack) to unlocked per-socket ISC_LIST.
2023-01-10 20:31:24 +01:00
Ondřej Surý 8de2c73fd5 Merge branch 'ondrej/always-track-netmgr-sockets-and-handles' into 'main'
Simplify tracing the reference counting in isc_netmgr

See merge request isc-projects/bind9!7292
2023-01-10 19:30:37 +00:00
Ondřej Surý 5bbba0d1a1 Simplify tracing the reference counting in isc_netmgr
Always track the per-worker sockets in the .active_sockets field in the
isc__networker_t struct and always track the per-socket handles in the
.active_handles field ian the isc_nmsocket_t struct.
2023-01-10 19:57:39 +01:00
Ondřej Surý 56d7e01334 Merge branch '3785-openssl-refactoring-19' into 'main'
Add CHANGES note for [GL #3785]

Closes #3785

See merge request isc-projects/bind9!7344
2023-01-10 09:39:55 +00:00
Ondřej Surý 41870dccba Add CHANGES note for [GL #3785] 2023-01-10 10:07:06 +01:00
Mark Andrews 6734b0f063 Merge branch '3787-siphash-c-105-26-runtime-error-applying-zero-offset-to-null-pointer' into 'main'
Resolve "siphash.c:105:26: runtime error: applying zero offset to null pointer"

Closes #3787

See merge request isc-projects/bind9!7339
2023-01-10 07:22:37 +00:00
Mark Andrews 349c23dbb7 Accept 'in=NULL' with 'inlen=0' in isc_{half}siphash24
Arthimetic on NULL pointers is undefined.  Avoid arithmetic operations
when 'in' is NULL and require 'in' to be non-NULL if 'inlen' is not zero.
2023-01-10 17:52:56 +11:00
Ondřej Surý a14946817e Merge branch '3785-openssl-refactoring-18' into 'main'
Resolve "OpenSSL 3 refactoring"

Closes #3785

See merge request isc-projects/bind9!7335
2023-01-09 21:50:15 +00:00
Ondřej Surý 504f3282e3 Ignore the extra EVP_PKEY_get_bn_param() failures
In opensslrsa_components_get(), ignore the extra EVP_PKEY_get_bn_param()
return codes as RSA key might not have all those components.
2023-01-09 22:10:17 +01:00
Evan Hunt 51093a834b Merge branch '3773-remove-dscp' into 'main'
remove nonfunctional DSCP implementation

Closes #3773

See merge request isc-projects/bind9!7305
2023-01-09 21:04:55 +00:00
Evan Hunt 34a7166029 CHANGES and release note for [GL #3773] 2023-01-09 12:15:28 -08:00
Evan Hunt 916ea26ead remove nonfunctional DSCP implementation
DSCP has not been fully working since the network manager was
introduced in 9.16, and has been completely broken since 9.18.
This seems to have caused very few difficulties for anyone,
so we have now marked it as obsolete and removed the
implementation.

To ensure that old config files don't fail, the code to parse
dscp key-value pairs is still present, but a warning is logged
that the feature is obsolete and should not be used. Nothing is
done with configured values, and there is no longer any
range checking.
2023-01-09 12:15:21 -08:00
Ondřej Surý f362cc0bf3 Merge branch '3785-openssl-refactoring-17' into 'main'
Refactor OpenSSL ECDSA public and private key export

Closes #3785

See merge request isc-projects/bind9!7334
2023-01-09 19:32:28 +00:00
Timo TeräsandOndřej Surý 8b62e7ed99 Refactor OpenSSL ECDSA private key export 2023-01-09 19:56:31 +01:00
Ondřej Surý ddce412489 Merge branch '3785-openssl-refactoring-16' into 'main'
Refactor OpenSSL ECDSA generation to helper functions

Closes #3785

See merge request isc-projects/bind9!7333
2023-01-09 18:56:29 +00:00
Timo TeräsandOndřej Surý 83b2e45600 Refactor OpenSSL ECDSA public key export 2023-01-09 19:56:27 +01:00
Timo TeräsandOndřej Surý 560d21a8b3 Refactor OpenSSL ECDSA generation to helper functions
Reduce the #ifdef cruft by having specific helper functions.
2023-01-09 19:52:56 +01:00
Ondřej Surý a0d15e4e07 Merge branch '3785-openssl-refactoring-15' into 'main'
Refactor OpenSSL ECDSA to use pkeypair

Closes #3785

See merge request isc-projects/bind9!7332
2023-01-09 18:52:27 +00:00
Timo TeräsandOndřej Surý a3b6729a88 Refactor OpenSSL ECDSA to use pkeypair
- Use separate EVP_PKEY for public and private keys
- On private key load, generate public key allowing better consistency
- Support OpenSSL3 providers
- Clean up key construction abstraction
- Various other clean ups
2023-01-09 19:33:48 +01:00
Ondřej Surý f6f807319c Merge branch '3785-openssl-refactoring-14' into 'main'
Make OpenSSL keypair comparation a generic helper function

Closes #3785

See merge request isc-projects/bind9!7331
2023-01-09 18:33:24 +00:00
Ondřej Surý 326e85e08d Merge branch '3785-openssl-refactoring-13' into 'main'
Refactor OpenSSL ECDSA type check to opensslecdsa_valid_key_alg helper

Closes #3785

See merge request isc-projects/bind9!7330
2023-01-09 18:31:06 +00:00
Timo TeräsandOndřej Surý 02efa591ef Make OpenSSL keypair comparation a generic helper function 2023-01-09 19:30:49 +01:00
Ondřej Surý 608ca9b140 Merge branch '3785-openssl-refactoring-12' into 'main'
Implement support for OpenSSL 3 Provider API stored RSA keys

Closes #3785

See merge request isc-projects/bind9!7329
2023-01-09 18:29:56 +00:00
Timo TeräsandOndřej Surý 96b8ad21f6 Refactor OpenSSL ECDSA type check to opensslecdsa_valid_key_alg helper 2023-01-09 19:29:38 +01:00
Timo TeräsandOndřej Surý 5fd6cfc625 Implement support for OpenSSL 3 Provider API stored RSA keys
Allows using pkcs11-provider module for PKCS#11 keys
2023-01-09 19:22:40 +01:00
Michal Nowak 370acd1f0a Merge branch 'mnowak/abort-on-ubsan-errors' into 'main'
Abort on UBSAN errors

See merge request isc-projects/bind9!6877
2023-01-09 16:39:24 +00:00
Michal Nowak 1451bb7390 Abort on UBSAN errors
Previously, UBSAN errors might slip undetected.
2023-01-09 17:19:19 +01:00
Ondřej Surý 29de02e0ec Merge branch '3785-openssl-refactoring-11' into 'main'
Make the OpenSSL RSA fromlabel helper a generic one

Closes #3785

See merge request isc-projects/bind9!7326
2023-01-09 15:43:09 +00:00
Timo TeräsandOndřej Surý a0404696d7 Make the OpenSSL RSA fromlabel helper a generic one 2023-01-09 16:35:30 +01:00
Ondřej Surý 56614a722a Merge branch '3785-openssl-refactoring-10' into 'main'
Rename the global ENGINE *e to global_engine

Closes #3785

See merge request isc-projects/bind9!7325
2023-01-09 15:35:24 +00:00
Ondřej Surý 11692467cd Merge branch '3785-openssl-refactoring-9' into 'main'
Refactor OpenSSL RSA pkey building to use components struct

Closes #3785

See merge request isc-projects/bind9!7322
2023-01-09 15:31:46 +00:00
Timo TeräsandOndřej Surý 9e417f9815 Rename the global ENGINE *e to global_engine 2023-01-09 16:31:40 +01:00
Timo TeräsandOndřej Surý 451edf3242 Refactor OpenSSL RSA pkey building to use components struct 2023-01-09 15:31:24 +00:00
Petr Špaček 1d52a4cffd Merge branch 'pspacek/aclelementtype_cleanup' into 'main'
Remove unused dns_aclelementtype_{ipprefix,any} enum values

See merge request isc-projects/bind9!7295
2023-01-09 15:06:22 +00:00
Petr Špaček f5fa9b2965 Remove unused dns_aclelementtype_{ipprefix,any} enum values
Seems like they are unused, and all system tests pass when those values
removed.
2023-01-09 16:05:41 +01:00
Ondřej Surý 4d374786f9 Merge branch '3785-openssl-refactoring-8-cleanup' into 'main'
BN_free() and BN_clear_free() both accept NULL

Closes #3785

See merge request isc-projects/bind9!7323
2023-01-09 15:02:55 +00:00
Ondřej Surý 9e185cd611 BN_free() and BN_clear_free() both accept NULL
Remove the extra check in opensslrsa_components_free() as both BN_free()
and BN_clear_free() both accepts NULL as valid argument and do nothing.
2023-01-09 16:00:18 +01:00
Ondřej Surý edd1b44d0b Merge branch '3785-openssl-refactoring-8' into 'main'
Refactor OpenSSL RSA components getting to a helper function

Closes #3785

See merge request isc-projects/bind9!7321
2023-01-09 14:56:07 +00:00
Timo TeräsandOndřej Surý b31d9f0b42 Refactor OpenSSL RSA components getting to a helper function 2023-01-09 15:55:07 +01:00
Matthijs Mekking 05b781e2f0 Merge branch '3743-unexpected-prohibited-ede' into 'main'
Fix unexpected "Prohibited" extended DNS error on allow-recursion mismatch

Closes #3743

See merge request isc-projects/bind9!7223
2023-01-09 14:40:31 +00:00
Matthijs Mekking 8db8ec1f6e Add system test for #3743 2023-01-09 15:39:57 +01:00
Matthijs Mekking e43a26fd1e Add release note and CHANGES for #3743 2023-01-09 15:39:57 +01:00
Matthijs Mekking 798c8f57d4 Don't set EDE in ns_client_aclchecksilent
The ns_client_aclchecksilent is used to check multiple ACLs before
the decision is made that a query is denied. It is also used to
determine if recursion is available. In those cases we should not
set the extended DNS error "Prohibited".
2023-01-09 15:38:35 +01:00
Ondřej Surý 680921c4ef Merge branch '3785-openssl-refactoring-7' into 'main'
Refactor OpenSSL RSA generation to be more readable

Closes #3785

See merge request isc-projects/bind9!7320
2023-01-09 14:33:09 +00:00
Ondřej Surý 1ce3f2eb7e Merge branch '3785-openssl-refactoring-6' into 'main'
Provide identical BN_GENCB_new shim

Closes #3785

See merge request isc-projects/bind9!7319
2023-01-09 14:22:22 +00:00
Timo TeräsandOndřej Surý 0881d7fbf5 Refactor OpenSSL RSA generation to be more readable
No major code changes. Just reduce the ifdef clutter.
2023-01-09 15:22:18 +01:00
Timo TeräsandOndřej Surý 307f95d72f Provide identical BN_GENCB_new shim
Instead of trying to optimize by using a stack local variable
with additional #ifdef logic, use identical implementations of
the upstream functions to reduce #ifdef clutter.

Move the definitions from dst_openssl.h to openssl_shim.h where
rest of the shim is.
2023-01-09 15:20:49 +01:00
Ondřej Surý 220267f241 Merge branch '3785-openssl-refactoring-5' into 'main'
Refactor OpenSSL RSA private key handling

Closes #3785

See merge request isc-projects/bind9!7318
2023-01-09 14:20:38 +00:00
Timo TeräsandOndřej Surý 74361b0b6e Refactor OpenSSL RSA private key handling
Instead of trying to enforce one pkey to contain both a private
and a public key pair, refactor the code to have separate public
and private pkeys.

This is a prerequisite for proper openssl 3.0 providers support
and greatly simplifies the code.
2023-01-09 15:19:37 +01:00
Ondřej Surý 471a2a3ffb Merge branch '3768-dns_zonemgr-use-after-free' into 'main'
Fix a use-after-free bug in dns_zonemgr_releasezone()

Closes #3768

See merge request isc-projects/bind9!7303
2023-01-09 14:14:41 +00:00
Aram SargsyanandOndřej Surý d50cb1d45d Add a CHANGES note for [GL #3768] 2023-01-09 14:14:31 +00:00
Aram SargsyanandOndřej Surý c1fc212253 Fix a use-after-free bug in dns_zonemgr_releasezone()
The dns_zonemgr_releasezone() function makes a decision to destroy
'zmgr' (based on its references count, after decreasing it) inside
a lock, and then destroys the object outside of the lock.

This causes a race with dns_zonemgr_detach(), which could destroy
the object in the meantime.

Change dns_zonemgr_releasezone() to detach from 'zmgr' and destroy
the object (if needed) using dns_zonemgr_detach(), outside of the
lock.
2023-01-09 14:14:31 +00:00
Ondřej Surý 6675731adf Merge branch '3785-openssl-refactoring-4' into 'main'
Remove non-sensical RSA key compare tests

Closes #3785

See merge request isc-projects/bind9!7317
2023-01-09 14:03:03 +00:00
Ondřej Surý d92bf40e23 Merge branch '3785-openssl-refactoring-3' into 'main'
Refactor OpenSSL RSA exponent bits checking to a helper function

Closes #3785

See merge request isc-projects/bind9!7316
2023-01-09 14:00:07 +00:00
Timo TeräsandOndřej Surý b2eefba387 Remove non-sensical RSA key compare tests
The keys tested are not valid RSA keys as a single private
component was modified manually. The key would not pass
basic sanity test.
2023-01-09 14:59:56 +01:00
Timo TeräsandOndřej Surý c8bcf3a34e Refactor OpenSSL RSA exponent bits checking to a helper function
- Make it a separate opensslrsa_check_exponent_bits() function to
  clean up the code a bit
- Always use provider API first if using openssl 3.0, and fallback
  to EVP API for older openssl or if built with engine support
- Use RSA_get0_key() (with shim for openssl 1.0) to avoid memory
  allocations
2023-01-09 14:58:55 +01:00
Ondřej Surý e78d61e2f5 Merge branch '3785-openssl-refactoring-2' into 'main'
Refactor OpenSSL RSA type check to opensslrsa_valid_key_alg helper

Closes #3785

See merge request isc-projects/bind9!7315
2023-01-09 13:34:41 +00:00
Timo TeräsandOndřej Surý 8bc52f836c Refactor OpenSSL RSA type check to opensslrsa_valid_key_alg helper
Move the repetetive code into a small opensslrsa_valid_key_alg() helper
function.
2023-01-09 14:33:09 +01:00
Ondřej Surý df2b767d45 Merge branch '3785-openssl-refactoring-1' into 'main'
Remove obsolete and unused EVP_dss1 compat #define

Closes #3785

See merge request isc-projects/bind9!7314
2023-01-09 13:32:59 +00:00
Timo TeräsandOndřej Surý 04c7f30690 Remove obsolete and unused EVP_dss1 compat #define 2023-01-09 14:21:41 +01:00
Ondřej Surý 2d3d44d59e Merge branch '3671-override-ISC_R_EXISTS-in-findnodeintree' into 'main'
Change ISC_R_EXISTS to ISC_R_SUCCESS in dns/rbtdb.c:findnodeintree()

Closes #3671

See merge request isc-projects/bind9!7312
2023-01-09 12:33:12 +00:00
Ondřej Surý e3d4d34744 Change ISC_R_EXISTS to ISC_R_SUCCESS in dns/rbtdb.c:findnodeintree()
In the previous refactoring, the findnodeintree() function could return
ISC_R_EXISTS (from dns_db_addnode() call) instead of ISC_R_SUCCESS
leading to node being attached, but never detached.

Change the ISC_R_EXISTS result code returned from dns_rbt_addnode() to
the ISC_R_SUCCESS in the findnodeintree() function (called internally by
dns_db_findnode() and dns_db_findnsec3node()).
2023-01-09 12:48:19 +01:00
Matthijs Mekking e18a24f7e7 Merge branch '3678-serve-stale-servfailing-unexpectedly' into 'main'
Resolve "stale-serve and RPZ put in SERVFAIL cache unexpected record"

Closes #3678

See merge request isc-projects/bind9!7231
2023-01-09 10:09:47 +00:00
Aram SargsyanandMatthijs Mekking 40dee61a1e Add a CHANGES note for [GL #3678] 2023-01-09 10:44:20 +01:00
Matthijs Mekking 91a1a8efc5 Consider non-stale data when in serve-stale mode
With 'stale-answer-enable yes;' and 'stale-answer-client-timeout off;',
consider the following situation:

A CNAME record and its target record are in the cache, then the CNAME
record expires, but the target record is still valid.

When a new query for the CNAME record arrives, and the query fails,
the stale record is used, and then the query "restarts" to follow
the CNAME target. The problem is that the query's multiple stale
options (like DNS_DBFIND_STALEOK) are not reset, so 'query_lookup()'
treats the restarted query as a lookup following a failed lookup,
and returns a SERVFAIL answer when there is no stale data found in the
cache, even if there is valid non-stale data there available.

With this change, query_lookup() now considers non-stale data in the
cache in the first place, and returns it if it is available.
2023-01-09 10:44:01 +01:00
Aram SargsyanandMatthijs Mekking 537187bf2f Add serve-stale CNAME check with stale-answer-client-timeout off
Prime the cache with the following records:

    shortttl.cname.example.	1	IN	CNAME	longttl.target.example.
    longttl.target.example.	600	IN	A	10.53.0.2

Wait for the CNAME record to expire, disable the authoritative server,
and query 'shortttl.cname.example' again, expecting a stale answer.
2023-01-09 10:44:01 +01:00
Evan Hunt 7a677e45d1 Merge branch '3770-separate-barriers' into 'main'
use separate barriers for "stop" and "listen" operations

Closes #3770

See merge request isc-projects/bind9!7308
2023-01-09 03:00:57 +00:00
Evan Hunt 9c577e10c3 use separate barriers for "stop" and "listen" operations
On some platforms, when a synchronizing barrier is cleared, one
thread can progress while other threads are still in the process
of releasing the barrier. If a barrier is reused by the progressing
thread during this window, it can cause a deadlock. This can occur if,
for example, we stop listening immediately after we start, because the
stop and listen functions both use socket->barrier.  This has been
addressed by using separate barrier objects for stop and listen.
2023-01-07 16:30:21 -08:00
Ondřej Surý f0bba87db0 Merge branch 'ondrej/dns_rbtdb-locking-fixups' into 'main'
Couple of small fixes in dns_rbtdb rwlock refactoring

See merge request isc-projects/bind9!7304
2023-01-07 06:15:07 +00:00
Ondřej Surý 44135371df Deduplicate DNS_RBTDB_STRONG_RWLOCK_CHECK macros
There were couple of redundant macros on both sides of
DNS_RBTDB_STRONG_RWLOCK_CHECK #ifdef block.  Use a single set of
macros, but disable the extra REQUIRES if the #define is not set.
2023-01-06 08:56:31 +01:00
Ondřej Surý d693c2e7a0 Extend expire_header() to check node lock type
Extend the expire_header() to accept the node lock type as one of the
arguments and check whether the the node lock is always write locked +
fix that bug.

While doing that, it was found that expire_header() invocation in
rdataset_expire() passes `false` as a type of tree lock instead of
`isc_rwlocktype_none`.

(Un)fortunately, both values mapped to 0, so no harm was done, but it
has been fixed nevertheless.
2023-01-06 08:43:16 +01:00
Ondřej Surý 20670ee22d Replace repetetive _TRYUPGRADE() with _FORCEUPGRADE() macros
There was a repetetive pattern:

    if (NODE_TRYUPGRADE(&nodelock->lock, nlocktypep) != ISC_R_SUCCESS)
    {
        NODE_UNLOCK(&nodelock->lock, nlocktypep);
        NODE_WRLOCK(&nodelock->lock, nlocktypep);
    }

Instead of doing that over again, introduce new NODE_FORCEUPGRADE()
and TREE_FORCEUPGRADE() that does exactly this code, and simplify
the aforementioned code with just:

    NODE_FORCEUPGRADE(&nodelock->lock, nlocktypep);
2023-01-05 22:18:40 +01:00
Ondřej Surý 15f2f90bda Merge branch 'ondrej/isc_loop-reference-tracking' into 'main'
Enhance the isc_loop unit to allow reference count tracking

See merge request isc-projects/bind9!7291
2023-01-05 12:33:19 +00:00
Ondřej Surý 6613f89c62 Enhance the isc_loop unit to allow reference count tracking
Use ISC_REFCOUNT_TRACE_{IMPL,DECL} to allow better isc_loop reference
tracking - use `#define ISC_LOOP_TRACE 1` in <isc/loop.h> to enable.
2023-01-05 12:33:15 +00:00
Ondřej Surý 5e956d3cba Merge branch 'ondrej/enforce-thread-affinity-on-dnsstream' into 'main'
Enforce strong thread-affinity on StreamDNS sockets

See merge request isc-projects/bind9!7301
2023-01-05 12:33:02 +00:00
Ondřej Surý 6553927d27 Enforce strong thread-affinity on StreamDNS sockets
Add a check that the isc__nm_streamdns_read(), isc__nm_streamdns_send(),
and isc__nm_streamdns_close() are being called from the matching thread.
2023-01-05 09:43:09 +01:00
Ondřej Surý 06b70e0927 Merge branch '3766-pin-TCP-dispatch-to-threads' into 'main'
Pin the dns_dispatch to threads when reusing

Closes #3766

See merge request isc-projects/bind9!7299
2023-01-05 08:12:41 +00:00
Ondřej Surý 1a999353cd Pin the dns_dispatch to threads when reusing
Previously, dns_dispatch_gettcp() could pick a TCP connection created by
different thread - this breaks our contractual promise to DNS dispatch
by using the TCP connection on a different thread than it was created.
Add .tid member to the dns_dispatch_t struct and skip the dispatches
from other threads when looking up a TCP dispatch that we can reuse in
dns_request.

NOTE: This is going to be properly refactored, but this change could be
also backported to 9.18 for better stability and thread-affinity.
2023-01-05 09:11:42 +01:00
Evan Hunt 480b5c7ca7 Merge branch '3640-fix-control-flow' into 'main'
Fix control flow issues in zone.c

Closes #3640

See merge request isc-projects/bind9!7013
2023-01-04 22:48:16 +00:00
Evan Hunt 24a81fefe6 Fix control flow issues in zone.c
Since dns_master_dump() can no longer return DNS_R_CONTINUE,
the error recovery code in synchronous calls to zone_dump() had
branches that could no longer be reached. This has been cleaned
up by using a boolean variable to determine whether the write
is asynchronous rather than depending on the result code.
2023-01-04 14:14:42 -08:00
Tony Finch 0e489b9ed4 Merge branch '3745-delzone-catz' into 'main'
Don't crash when rndc delzone encounters a catz member

Closes #3745

See merge request isc-projects/bind9!7232
2023-01-04 17:04:48 +00:00
Tony FinchandTony Finch 9fa20d6f6c Don't crash when rndc delzone encounters a catz member
This bug was masked in the tests because the `catz` test script did an
`rndc addzone` before an `rndc delzone`. The `addzone` autovivified
the NZF config, so `delzone` worked OK.

This commit swaps the order of two sections of the `catz` test script
so that it uses `delzone` before `addzone`, which provokes a crash
when `delzone` requires a non-NULL NZF config.

To fix the crash, we now try to remove the zone from the NZF config
only if it was dynamically added but not by a catalog zone.
2023-01-04 14:04:22 +00:00
Matthijs Mekking a4063f7d20 Merge branch '3760-cid-432259-sizeof-not-portable-in-lib-dns-remote' into 'main'
Fix CID 432259: Sizeof not portable (remote.c)

Closes #3760

See merge request isc-projects/bind9!7288
2023-01-04 07:58:12 +00:00
Matthijs Mekking abd8c1cad0 Fix CID 432259: Sizeof not portable (remote.c)
The following report suggests that the 'size' parameter in the two
calls to 'isc_mem_get()' should be set to the
'count * sizeof(*tlsnames)' and 'count * sizeof(*keynames)'
respectively.

/lib/dns/remote.c: 117 in dns_remote_init()
111		}
112	} else {
113		remote->keynames = NULL;
114	}
115
116	if (tlsnames != NULL) {

>>>     CID 432259:    (SIZEOF_MISMATCH)
>>>     Passing argument "count * 8UL /* sizeof (tlsnames) */" to
>>>	function "isc__mem_get" and then casting the return value to
>>>	"dns_name_t **" is suspicious.  In this particular case
>>>	"sizeof (dns_name_t **)" happens to be equal to
>>>	"sizeof (dns_name_t *)", but this is not a portable assumption.

117	remote->tlsnames = isc_mem_get(mctx, count * sizeof(tlsnames));
118		for (i = 0; i < count; i++) {
119			remote->tlsnames[i] = NULL;
120		}
121		for (i = 0; i < count; i++) {
122			if (tlsnames[i] != NULL) {

/lib/dns/remote.c: 99 in dns_remote_init()
93		memmove(remote->dscps, dscp, count * sizeof(isc_dscp_t));
94	} else {
95		remote->dscps = NULL;
96	}
97
98	if (keynames != NULL) {

>>>     CID 432259:    (SIZEOF_MISMATCH)
>>>     Passing argument "count * 8UL /* sizeof (keynames) */" to
>>>	function "isc__mem_get" and then casting the return value to
>>>	"dns_name_t **" is suspicious.  In this particular case
>>>	"sizeof (dns_name_t **)" happens to be equal to "sizeof
>>>	(dns_name_t *)", but this is not a portable assumption.

99	 remote->keynames = isc_mem_get(mctx, count * sizeof(keynames));
100	 for (i = 0; i < count; i++) {
101		remote->keynames[i] = NULL;
102	 }
103	 for (i = 0; i < count; i++) {
104		if (keynames[i] != NULL) {
2023-01-03 16:47:57 +01:00
Arаm Sаrgsyаn 0667cd6cc4 Merge branch '3735-fix-rpz-shutdown-bugs' into 'main'
Fix shutdown and error path bugs in the rpz unit

Closes #3735

See merge request isc-projects/bind9!7289
2023-01-03 15:11:08 +00:00
Aram Sargsyan 2824422e78 Add a CHANGES note for [GL #3735] 2023-01-03 14:21:17 +00:00
Aram Sargsyan ef4f15d2d1 Fix an error path bug in rpz.c:update_nodes()
When dns_db_createiterator() fails, 'updbit' should not be destroyed
for obvious reasons, i.e. it is NULL.
2023-01-03 14:21:17 +00:00
Aram Sargsyan d36728e42f Fix a shutdown and error path bugs in rpz.c:update_nodes()
When shutting down, or when dns_dbiterator_current() fails, 'node'
shouldn't be detached, because it is NULL at that point.
2023-01-03 14:21:17 +00:00
Aram Sargsyan 975d16230b Fix a shutdown bug in update_rpz_cb()
When shutting down, the cleanup path should not try to destroy
'newnodes', because it is NULL at that point.

Introduce another label for the "shuttingdown" scenario.
2023-01-03 13:27:43 +00:00
Arаm Sаrgsyаn ca2d2568b1 Merge branch '3754-adb-maybe_expire_entry-called-unlocked-bug' into 'main'
Don't expire an ADB entry without holding the entries lock

Closes #3754

See merge request isc-projects/bind9!7275
2023-01-03 09:01:18 +00:00
Aram Sargsyan 268154f899 Add a CHANGES note for [GL #3754] 2023-01-03 08:23:23 +00:00
Aram Sargsyan da7c448988 Don't expire an ADB entry without holding the entries lock
The clean_namehooks() function does't hold the 'adb->entries_lock'
lock, so calling maybe_expire_entry() is not thread-safe.

Instead of adding a lock/unlock, leave the expiration to later,
e.g. by the get_attached_and_locked_entry() function.

Also fix a couple of comment typos.
2023-01-03 08:21:52 +00:00
Mark Andrews 2e1e398e7d Merge branch '3761-ubsan-error-in-isc_buffer_reserve' into 'main'
Resolve "UBSAN error in isc_buffer_reserve"

Closes #3761

See merge request isc-projects/bind9!7285
2023-01-03 07:30:21 +00:00
Mark Andrews 096b280b1c Do not pass NULL pointer to memmove - undefined behaviour
Check if 'old_base' is NULL and if so skip calling memmove.
2023-01-03 14:40:30 +11:00
Michał Kępień b2d08c514d Merge branch 'michal/update-copyright-year-to-2023' into 'main'
Update copyright year to 2023

See merge request isc-projects/bind9!7282
2023-01-02 13:06:36 +00:00
Michał Kępień 1a5d707f52 Update copyright year to 2023 2023-01-02 13:58:00 +01:00
Artem Boldariev b78829a3f8 Merge branch 'artem-tls-use-isc-buffer' into 'main'
TLS: use isc_buffer_t for send requests, reuse isc_buffer_t during send requests

See merge request isc-projects/bind9!7281
2022-12-30 18:35:53 +00:00
Artem Boldariev fbf1546fb8 TLS: use isc_buffer_t for send requests
This commit replaces ad-hoc code for send requests buffer management
within TLS with the one based on isc_buffer_t.

Previous version of the code was trying to use pre-allocated small
buffers to avoid extra allocations. The code would allocate a larger
dynamic buffer when needed. There is no need to have ad-hoc code for
this, as isc_buffer_t now provides this functionality internally.

Additionally to the above, the old version of the code lacked any
logic to reuse the dynamically allocated buffers. Now, as we do not
manage memory buffers, but isc_buffer_t objects, we can implement this
strategy. It can be in particular helpful for longer lasting
connections, as in this case the buffer will adjust itself to the size
of the messages being transferred. That is, it is in particular useful
for XoT, as Stream DNS happen to order send requests in such a way
that the send request will get reused.
2022-12-30 19:56:25 +02:00
Arаm Sаrgsyаn 0c252fdfc5 Merge branch 'aram/dns_dispatch_createtcp-bugfix' into 'main'
Don't pass a NULL pointer to isc_sockaddr_format()

See merge request isc-projects/bind9!7277
2022-12-28 14:18:52 +00:00
Aram Sargsyan 41ca9d419e Don't pass a NULL pointer to isc_sockaddr_format()
The 'localaddr' pointer can be NULL, which causes an assertion failure.

Use '&disp->local' instead when printing a debug log message.
2022-12-28 12:10:09 +00:00
Matthijs Mekking eb7275e933 Merge branch '3714-remove-alt-transfer-source' into 'main'
Remove setting alternate transfer source

Closes #3714

See merge request isc-projects/bind9!7163
2022-12-23 15:11:25 +00:00
Matthijs Mekking e277f1f757 Add CHANGES and release notes for #3714
Update release notes, remove the deprecation entry and add a new
removed feature entry.
2022-12-23 15:32:12 +01:00
Matthijs Mekking d8e98d4bba Remove unused dns_remote_t functions
Now that setting alternate transfer sources is removed, the functions
to check whether all addresses are considered good have become obsolete.
2022-12-23 15:17:54 +01:00
Matthijs Mekking 8640e70616 Remove setting alternate transfer source from doc
Remove any reference to 'alt-transfer-source', 'alt-transfer-source-v6',
and 'use-alt-transfer-source' from the documentation and manual pages.
2022-12-23 14:44:48 +01:00
Matthijs Mekking 5954ae6458 Remove setting alternate transfer source
Remove parsing the configuration options 'alt-transfer-source',
'alt-transfer-source-v6', and 'use-alt-transfer-source', and remove
the corresponding code that implements the feature.
2022-12-23 14:39:59 +01:00
Matthijs Mekking 2638a2a29c Merge branch 'matthijs-remote-server-refactor' into 'main'
Refactor remote servers (primaries, parental agents) in zone.c

See merge request isc-projects/bind9!7110
2022-12-23 13:37:14 +00:00
Matthijs Mekking 80178c2134 Add release notes
The refactor introduces a new way to configure source addresses for
primaries and parental-agents, a new thingy that we should make people
aware of.
2022-12-23 13:36:50 +00:00
Matthijs Mekking 34636576d0 Add CHANGES
Mention the refactor of zone.c
2022-12-23 13:36:50 +00:00
Matthijs Mekking c4bffb3e64 Use 'source[-v6]' for transfer, notify, checkds
Use the configured 'source' and 'source-v6' when initiating a zone
transfer, sending a notify, or when checking for the DS. Remove the
special code for using alternate transfer sources.

Update some system tests to use the new configuration and make sure
the tests still work.
2022-12-23 13:36:50 +00:00
Matthijs Mekking a92b9e40ce Small comment change in remote.h header file
The documentation for 'dns_remote_addr()' was incorrect (copy paste
error).
2022-12-23 13:36:50 +00:00
Matthijs Mekking 17e16c7a34 Parse and store new 'source[-v6]' option
Parse the new 'source' and 'source-v6' options and store them with
the corresponding remote servers (parental-agents, primaries, ...).
2022-12-23 13:36:50 +00:00
Matthijs Mekking ad248f2261 Add new 'source[-v6]' option for remote servers
Add a new way to configure the preferred source address when talking to
remote servers such as primaries and parental-agents. This will
eventually deprecate options such as 'parental-source',
'parental-source-v6', 'transfer-source', etc.

Example of the new configuration:

    parental-agents "parents" port 5353 \
        source 10.10.10.10 port 5354 dscp 54 \
        source-v6 2001:db8::10 port 5355 dscp 55 {
	10.10.10.11;
	2001:db8::11;
    };
2022-12-23 13:36:50 +00:00
Matthijs Mekking c444c6d806 Remove functions named_config_[get|put]iplist
They are unused.
2022-12-23 13:36:50 +00:00
Matthijs Mekking bf1dd57242 Refactor zone.c, use dns_remote_t structure
Use the new dns_remote_t structure for remote server communication to
primaries, parental agents, etc.
2022-12-23 13:36:50 +00:00
Matthijs Mekking 0300295944 Add new files for remote server communication
The dns_remote_t structure is intended to replace the variables in
the structure that deals with remote server communication to primaries,
parental agents, forwarders, etc.
2022-12-23 13:36:50 +00:00
Tom Krizek 8c35815513 Merge branch 'tkrizek/gitignore-fixes' into 'main'
Don't track gitignored files in the repo

See merge request isc-projects/bind9!7264
2022-12-23 13:29:12 +00:00
Michał KępieńandTom Krizek 5b28da7ea0 Detect "ignored yet tracked" files in GitLab CI
Ensure that no .gitignore file in the tree contains patterns matching
files tracked by Git by adding a simple script that detects such
situations and running that script as part of the "misc" job in the
"precheck" stage of every GitLab CI pipeline.
2022-12-23 13:44:18 +01:00
Tom Krizek a02da6cf21 Remove obsolete gitignore file in mysqldyn
The Makefile used to be autogenerated prior to
67f76b1269 which is the reason why the
.gitignore existed in the first place. Since then, a static Makefile is
used and is supposed to be tracked in the git repo.
2022-12-23 13:44:18 +01:00
Tom Krizek e03daf22ec Make gitignore matching in rpzrecurse more precise
The pre-defined test cases use named.$TESTCASE.conf naming convention,
where TESTCASE is a human readable name contaning actual word(s). The
autogenerated test cases' names always start with a number from 1 to 6.
2022-12-23 13:44:18 +01:00
Tom Krizek b8616e457f Remove ans.pl system test files from gitignore
The ans*.pl scripts are part of system tests and should be part of the
repository. The gitignore entires for these files have been removed.
2022-12-23 13:44:18 +01:00
Tom Krizek c5708044e7 Rename dig reference files in the rrsetorder test
bin/tests/system/rrsetorder/dig.out* files match a gitignore expression
present in bin/tests/system/.gitignore.  Since these are meant to be
reference files that are compared to the files generated when the
"rrsetorder" system test is run, rename them to avoid listing tracked
files in .gitignore files.
2022-12-23 13:44:18 +01:00
Arаm Sаrgsyаn 14957c95b0 Merge branch '3752-resolver-adb-quota-bug' into 'main'
Fix an ADB quota management bug in the resolver

Closes #3752

See merge request isc-projects/bind9!7266
2022-12-23 10:23:29 +00:00
Aram Sargsyan a4def095f3 Add CHANGES and release notes for [GL #3752] 2022-12-23 09:45:20 +00:00
Aram Sargsyan 53afe1f978 Fix an ADB quota management error in the resolver
Normally, when a 'resquery_t' object is created in fctx_query(),
we call dns_adb_beginudpfetch() (which increases the ADB quota)
only if it's a UDP query. Then, in fctx_cancelquery(), we call
dns_adb_endudpfetch() to decreases back the ADB quota, again only
if it's a UDP query.

The problem is that a UDP query can become a TCP query, preventing
the quota from adjusting back in fctx_cancelquery() later.

Call dns_adb_beginudpfetch() also when switching the query type
from UDP to TCP.
2022-12-23 09:45:20 +00:00
Aram Sargsyan c7ba26c3d6 INSIST that active quota is 0 in destroy_adbentry()
This should catch ADB quota management errors in the resolver.
2022-12-23 09:45:20 +00:00
Artem Boldariev c4097ec5d5 Merge branch '3748-rename-tls-caches-creation-functions' into 'main'
Rename isc_tlsctx_cache_new() to isc_tlsctx_cache_create(), tlsctx_client_session_cache_new() to tlsctx_client_session_create()

Closes #3748

See merge request isc-projects/bind9!7269
2022-12-23 09:13:56 +00:00
Artem Boldariev 7962e7f575 tlsctx_client_session_cache_new() -> tlsctx_client_session_create()
Additionally to renaming, it changes the function definition so that
it accepts a pointer to pointer instead of returning a pointer to the
new object.

It is mostly done to make it in line with other functions in the
module.
2022-12-23 11:10:11 +02:00
Artem Boldariev f102df96b8 Rename isc_tlsctx_cache_new() -> isc_tlsctx_cache_create()
Additionally to renaming, it changes the function definition so that
it accepts a pointer to pointer instead of returning a pointer to the
new object.

It is mostly done to make it in line with other functions in the
module.
2022-12-23 11:10:11 +02:00
Tom Krizek 6dede665c7 Merge branch 'tkrizek/dangerfile-backport-tweaks' into 'main'
danger CI: tweak backport check and add Affects label check

See merge request isc-projects/bind9!7253
2022-12-23 08:50:10 +00:00
Tom Krizek 64d71a1f5f danger: check the Affects labels are set
Unless the MR is a backport, the Affects labels should be used to
indicate which versions are affected by the issue that prompted the MR.
2022-12-23 09:44:56 +01:00
Tom Krizek d1172e011c danger: check version in MR title
Enforce the version indicator to be at the start of the MR title.
2022-12-23 09:44:56 +01:00
Tom Krizek a3fcfe3d71 Merge tag 'v9_19_8'
BIND 9.19.8
2022-12-22 10:13:38 +01:00
Arаm Sаrgsyаn df0584b547 Merge branch '3750-legacy-system-test-dig-timed-out-fix' into 'main'
Fix DiG "timed out" message check in "legacy" system test

Closes #3750

See merge request isc-projects/bind9!7259
2022-12-21 14:40:43 +00:00
Aram Sargsyan 35988748f3 Fix DiG "timed out" message check in "legacy" system test
The test expects a "connection timed out" message from DiG when it
experiences a timeout, while the current version of DiG prints just
a "timed out" message, like below:

    ;; communications error to 10.53.0.1#11314: timed out
    ;; communications error to 10.53.0.1#11314: timed out
    ;; communications error to 10.53.0.1#11314: timed out

    ; <<>> DiG 9.19.9-dev <<>> -p 11314 +tries +time +tcp +tries +time @10.53.0.1 dropedns. TXT
    ; (1 server found)
    ;; global options: +cmd
    ;; no servers could be reached

Change the expected string to match the current DiG output.

Use the '-F' switch for "grep" for matching a fixed string.
2022-12-21 13:52:22 +00:00
Tom Krizek 91b8d20f29 Merge branch 'tkrizek/system-tests-conventions' into 'main'
Unify system tests naming conventions

See merge request isc-projects/bind9!7150
2022-12-21 12:42:27 +00:00
Tom Krizek 4145068bfa Update tests gitignore file
The .mypy_cache was added to the system test dir gitignore, since it
should be ignored.
2022-12-21 13:40:10 +01:00
Tom Krizek 62eea511db Rename engine_pkcs11 system test
In order to have a common naming convention for system tests, rename the
only outlier "engine_pkcs11" to "enginepkcs11", which was the only
system test using an underscore in its name.

The only allowed word separators for system test names are either dash
or no separator.
2022-12-21 13:40:10 +01:00
Tom Krizek f6409ee6ac Use common name convention for pytest files
It is better to use consistent file names to avoid issue with sorting
etc.

Using underscore in filenames as opposed to dash was chosen because it
seems more common in pytest/python to use underscore for filenames.

Also rename the bin/tests/system/timeouts/tests-tcp.py file to
bin/tests/system/timeouts/tests_tcp_timeouts.py to avoid pytest name
collision (there can't be two files named tests_tcp.py).
2022-12-21 13:40:09 +01:00
Artem Boldariev 5d92e99cfa Merge branch 'artem-add-missing-dnsstream-test-header-to-the-makefile-am' into 'main'
Add missing "dnsstream_utils_test_data.h" to the Makefile.am

See merge request isc-projects/bind9!7256
2022-12-21 12:18:36 +00:00
Artem Boldariev 5a4861aff6 Add missing "dnsstream_utils_test_data.h" to the Makefile.am
This commit ensures that "dnsstream_utils_test_data.h" is referenced
by Makefile.am and, thus, is not missing from a created tarball.
2022-12-21 14:18:04 +02:00
Ondřej Surý 333f24ee56 Merge branch '3178-dispatch-race-fix' into 'main'
Fix more issues in the dns_dispatch unit

Closes #3178

See merge request isc-projects/bind9!7252
2022-12-21 11:49:09 +00:00
Ondřej Surý 9dd8deaf01 Call the connected dns_dispatch callback asynchronously
The dns_request code is very sensitive about calling the connected and
deadlocks when the timing is "right" in several places.  Move the call
to the connected callback to the (udp|tcp)_connected() functions, so
they are called asynchronously instead of directly from
the (udp|tcp)_dispentry_cancel() functions.
2022-12-21 12:13:35 +01:00
Ondřej Surý 3fac4ca57e Ignore TCP dispatches that have zero references
The TCP dispatches are removed from the dispatchmgr->list in the
dispatch_destroy() and there's a brief period of time where
dns_dispatch_gettcp() can find a dispatch in connected state that's
being destroyed.

Set the dispatch state to DNS_DISPATCHSTATE_NONE in the TCP connection
callback if there are no responses waiting, and ignore TCP dispatches
with zero references in dns_dispatch_gettcp().
2022-12-21 12:13:35 +01:00
Ondřej Surý 90cd14f620 Fix assignment vs comparison typo in tcp_connected()
In tcp_connected() a typo has turned a DbC check into an assignment
breaking the state machine and making the dns_dispatch_gettcp() try to
attach to dispatch in process of destruction.
2022-12-21 12:13:20 +01:00
Ondřej Surý 7310e2b424 Don't remove dispatches in CANCELED state from the list
In dns_dispatch_gettcp(), we can't remove canceled dispatches from the
mgr->list because ISC_LIST_NEXT() would fail in the next iteration.
2022-12-21 12:13:20 +01:00
Ondřej Surý 6d22d03208 Ignore TCP dispatches in DNS_DISPATCHSTATE_NONE state
The TCP dispatches in DNS_DISPATCHSTATE_NONE could be either very
fresh or those could be dispatches that failed connecting to the
destination.  Ignore them when trying to connect to an existing
TCP dispatch via dns_dispatch_gettcp().
2022-12-21 12:13:20 +01:00
Tom Krizek ad587f473e Merge branch 'tkrizek/default-alg-fixups' into 'main'
Fix minor issues with DEFAULT_ALGORITHM selection in system tests

Closes #3747

See merge request isc-projects/bind9!7059
2022-12-21 09:39:56 +00:00
Tom Krizek 56416ebd65 Make Python interpreter required for system tests
This introduces a Python dependency for running system tests. It is
needed in order to:
  - write new test control scripts in Python
  - gradually rewrite old Perl scripts into Python if needed
  - eventually introduce pytest as the new test runner framework

This commit is not intended to be backported to 9.16.
2022-12-21 10:09:49 +01:00
Tom Krizek 084d72d1d5 Make Perl interpreter required for system tests
This change has no practical impact, as Perl was already required for
all system tests, this check only makes it more explicit.
2022-12-21 10:09:49 +01:00
Tom Krizek 492992dca8 Ensure test interpreters are defined before common config
Nothing from conf.sh.common is required to set these values. On the
contrary, a Python interpreter needs to be set in order to randomize the
algorithm set (which happens in conf.sh.common).
2022-12-21 10:09:49 +01:00
Tom Krizek ba35a6df9c Force quiet mode when using testcrypto.sh directly
When testcrypto.sh is used as a standalone script, always use quiet mode
to avoid using undefined commands (such as echo_i) which require
inclusion of the entire conf.sh machinery.
2022-12-21 10:09:47 +01:00
Artem Boldariev 92bef0ab56 Merge branch 'artem-stream-dns' into 'main'
StreamDNS - unified transport for DNS over TLS and DNS over TCP (and possibly more)

Closes #3374

See merge request isc-projects/bind9!6707
2022-12-20 20:59:50 +00:00
Ondřej SurýandArtem Boldariev 6cb6373b5a Convert Stream DNS to use isc_buffer API
Drop the whole isc_dnsbuffer API and use new improved isc_buffer API
that provides same functionality as the isc_dnsbuffer unit now.
2022-12-20 22:13:53 +02:00
Artem Boldariev 849d7292ad Modify release notes [GL #3374]
Mention that DNS over TCP and DNS over TLS transports are superseded.
2022-12-20 22:13:53 +02:00
Artem Boldariev 7b062961ed Modify CHANGES [GL #3374]
Mention that DNS over TCP and DNS over TLS transports are superseded.
2022-12-20 22:13:53 +02:00
Artem Boldariev daa23840c5 Modify AUTHORS
Add "Artem Boldariev" to the list of BIND9 authors.
2022-12-20 22:13:53 +02:00
Artem Boldariev 0a7e83feea StreamDNS: Use isc__nm_senddns() to send DNS messages
This commit modifies the Stream DNS message so that it uses the
optimised code path (isc__nm_senddns()) for sending DNS messages over
the underlying transport. This way we avoid allocating any
intermediate memory buffers needed to render a DNS message with its
length pre-pended ahead of the contents (TCP DNS message format).
2022-12-20 22:13:53 +02:00
Artem Boldariev cb6f3dc3c8 TLS: isc__nm_senddns() support
This commit adds support for isc_nm_senddns() to the generic TLS code.
2022-12-20 22:13:53 +02:00
Artem Boldariev ad876a65af Add isc__nm_senddns()
The new internal function works in the same way as isc_nm_send()
except that it sends a DNS message size ahead of the DNS message
data (the format used in DNS over TCP).

The intention is to provide a fast path for sending DNS messages over
streams protocols - that is, without allocating any intermediate
memory buffers.
2022-12-20 22:13:53 +02:00
Artem Boldariev 56732ac2a0 TLS: try to avoid allocating send request objects
This commit optimises TLS send request object allocation to enable
send request object reuse, somewhat reducing pressure on the memory
manager. It is especially helpful in the case when Stream DNS uses the
TLS implementation as the transport.
2022-12-20 22:13:53 +02:00
Artem Boldariev 4277eeeb9c Remove TLS DNS transport (and parts common with TCP DNS)
This commit removes TLS DNS transport superseded by Stream DNS.
2022-12-20 22:13:53 +02:00
Artem Boldariev e5649710d3 Remove TCP DNS transport
This commit removes TCP DNS transport superseded by Stream DNS.
2022-12-20 22:13:53 +02:00
Artem Boldariev a07e798df6 Make dispatch unit tests use Stream DNS
This commit replaces usage of TCP DNS and TLS DNS in the dispatch unit
tests with Stream DNS transport.
2022-12-20 22:13:53 +02:00
Artem Boldariev 4860b66fba Make isc_nm_tlssocket unit tests available in non DoH-enabled builds
This commit ensures that generic TLS unit tests are available in non
DoH-enabled builds, as isc_nm_tlssocket is not tied exclusively to the
DoH implementation anymore.
2022-12-20 22:13:53 +02:00
Artem Boldariev 4524bf4083 Make isc_nm_tlssocket non-optional
This commit unties generic TLS code (isc_nm_tlssocket) from DoH, so
that it will be available regardless of the fact if BIND was built
with DNS over HTTP support or not.
2022-12-20 22:13:53 +02:00
Artem Boldariev efe4267044 DoH: use isc_nmhandle_set_tcp_nodelay()
This commit replaces ad-hoc code for disabling Nagle's algorithm with
a call to isc_nmhandle_set_tcp_nodelay().
2022-12-20 22:13:53 +02:00
Artem Boldariev e89575ddce StreamDNS: opportunistically disable Nagle's algorithm
This commit ensures that Stream DNS code attempts to disable Nagle's
algorithm regardless of underlying stream transport (TCP or TLS), as
we are not interested in trading latency for throughout when dealing
with DNS messages.
2022-12-20 22:13:53 +02:00
Artem Boldariev 05cfb27b80 Disable Nagle's algorithm for TLS connections by default
This commit ensures that Nagle's algorithm is disabled by default for
TLS connections on best effort basis, just like other networking
software (e.g. NGINX) does, as, in the case of TLS, we are not
interested in trading latency for throughput, rather vice versa.

We attempt to disable it as early as we can, right after TCP
connections establishment, as an attempt to speed up handshake
handling.
2022-12-20 22:13:53 +02:00
Artem Boldariev 371b02f37a TCP: make it possible to set Nagle's algorithms state via handle
This commit adds ability to turn the Nagle's algorithm on or off via
connections handle. It adds the isc_nmhandle_set_tcp_nodelay()
function as the public interface for this functionality.
2022-12-20 22:13:53 +02:00
Artem Boldariev 4606384345 Extend isc__nm_socket_tcp_nodelay() to accept value
This makes it possible to both enable and disable Nagle's algorithm
for a TCP socket descriptor, before the change it was possible only to
disable it.
2022-12-20 22:13:53 +02:00
Artem Boldariev cce52fa4a2 BIND: use Stream DNS for DNS over TCP connections
This commit makes BIND use the new Stream DNS transport for DNS over
TCP.
2022-12-20 22:13:53 +02:00
Artem Boldariev 03e33a014c BIND: use Stream DNS for DNS over TLS connections
This commit makes BIND use the new Stream DNS transport for DNS over
TLS.
2022-12-20 22:13:52 +02:00
Artem Boldariev 83f399b852 Use Stream DNS in dig for DNS over TCP
This commit makes dig use the new Stream DNS transport for DNS over
TCP.
2022-12-20 22:13:52 +02:00
Artem Boldariev 2b7e85591f Use Stream DNS in dig for DNS over TLS
This commit makes dig use the new Stream DNS transport for DNS over
TLS.
2022-12-20 22:13:52 +02:00
Artem Boldariev 85cefb80f8 Re-purpose TLS DNS and TCP DNS unit tests for Stream DNS
This commit modifies the existing unit tests for TLS DNS and TCP DNS
in such a way that the new Stream DNS transport is used as it is
intended to be a drop-in replacement for these two transports.
2022-12-20 22:13:52 +02:00
Artem Boldariev f395cd4b3e Add isc_nm_streamdnssocket (aka Stream DNS)
This commit adds an initial implementation of isc_nm_streamdnssocket
transport: a unified transport for DNS over stream protocols messages,
which is capable of replacing both TCP DNS and TLS DNS
transports. Currently, the interface it provides is a unified set of
interfaces provided by both of the transports it attempts to replace.

The transport is built around "isc_dnsbuffer_t" and
"isc_dnsstream_assembler_t" objects and attempts to minimise both the
number of memory allocations during network transfers as well as
memory usage.
2022-12-20 22:13:51 +02:00
Artem Boldariev ae63471e50 Add a set of unit tests for dnsbuffer_t and dnsstream_assembler_t
This commit adds a set of unit tests for isc_dnsbuffer_t and
isc_dnsstream_assembler_t which help to verify that they work as
expected.
2022-12-20 21:24:45 +02:00
Artem Boldariev 338cf3e467 Add isc_dnsstream_assembler_t implementation
This commit adds the implementation for an "isc_dnsstream_assembler_t"
object. The object is built on top of "isc_dnsbuffer_t" and is
intended to encapsulate the state machine used for handling DNS
messages received in the format used for messages transmitted over
TCP.

The idea is that the object accepts the input data received from a
socket, tries to assemble DNS messages from the incoming data and
calls the callback which contains the status of the incoming data as
well as a pointer to the memory region referencing the data of the
assembled message. It is capable of assembling DNS messages no matter
how torn apart they are when sent over network.

The following statuses might be passed to the callback:

* ISC_R_SUCCESS - a message has been successfully assembled;
* ISC_R_NOMORE  - not enough data has been processed to assemble a
message;
* ISC_R_RANGE - there was an attempt to process a zero-sized DNS
message (someone attempts to send us junk data).

One could say that the object replaces the implementation of
"isc__nm_*_processbuffer()" functions used by the old TCP DNS and TLS
DNS transports with a better defined state machine completely
decoupled from the networking code itself.

Such a design makes it trivial to write unit tests for it, leading to
better verification of its correctness.

Another important difference is directly related to the fact that it
is built on top of "isc_dnsbuffer_t", which tries to manage memory in
a smart way. In particular:

* It tries to use a static buffer for smaller messages, reducing
pressure on the memory manager (hot path);
* When allocating dynamic memory for larger messages, it tries to
allocate memory conservatively (generic path).

These characteristics is a significant upgrade over the older logic
where a 64KB(+2 bytes) buffer was allocated from dynamic memory
regardless of the fact if we need a buffer this large or not. That is,
lesser memory usage is expected in a generic case for DNS transports
built on top of "isc_dnsstream_assembler_t."
2022-12-20 21:24:44 +02:00
Artem Boldariev cbb758abd4 Add isc_dnsbuffer_t implementation
This commit adds "isc_dnsbuffer_t" object implementation, a thin
wrapper on top of "isc_buffer_t" which has the following
characteristics:

* provides interface specifically atuned for handling/generating DNS
messages, especially in the format used for DNS messages over TCP;
* avoids allocating dynamic memory when handling small DNS messages,
while transparently switching to using dynamic memory when handling
larger messages. This approach significantly reduces pressure on the
memory allocator, as most of the DNS messages are small.
2022-12-20 21:24:44 +02:00
Artem Boldariev c0c59b55ab TLS: add an internal function isc__nmhandle_get_selected_alpn()
The added function provides the interface for getting an ALPN tag
negotiated during TLS connection establishment.

The new function can be used by higher level transports.
2022-12-20 21:24:44 +02:00
Artem Boldariev 15e626f1ca TLS: add manual read timer control mode
This commit adds manual read timer control mode, similarly to TCP.
This way the read timer can be controlled manually using:

* isc__nmsocket_timer_start();
* isc__nmsocket_timer_stop();
* isc__nmsocket_timer_restart().

The change is required to make it possible to implement more
sophisticated read timer control policies in DNS transports, built on
top of TLS.
2022-12-20 21:24:44 +02:00
Artem Boldariev 9aabd55725 TCP: add manual read timer control mode
This commit adds a manual read timer control mode to the TCP
code (adding isc__nmhandle_set_manual_timer() as the interface to it).

Manual read timer control mode suppresses read timer restarting the
read timer when receiving any amount of data. This way the read timer
can be controlled manually using:

* isc__nmsocket_timer_start();
* isc__nmsocket_timer_stop();
* isc__nmsocket_timer_restart().

The change is required to make it possible to implement more
sophisticated read timer control policies in DNS transports, built on
top of TCP.
2022-12-20 21:24:44 +02:00
Artem Boldariev f4760358f8 TLS: expose the ability to (re)start and stop underlying read timer
This commit adds implementation of isc__nmsocket_timer_restart() and
isc__nmsocket_timer_stop() for generic TLS code in order to make its
interface more compatible with that of TCP.
2022-12-20 21:24:44 +02:00
Artem Boldariev f18a9b3743 TLS: add isc__nmsocket_timer_running() support
This commit adds isc__nmsocket_timer_running() support to the generic
TLS code in order to make it more compatible with TCP.
2022-12-20 21:24:44 +02:00
Artem Boldariev c0808532e1 TLS: isc_nm_bad_request() and isc__nmsocket_reset() support
This commit adds implementations of isc_nm_bad_request() and
isc__nmsocket_reset() to the generic TLS stream code in order to make
it more compatible with TCP code.
2022-12-20 21:24:44 +02:00
Ondřej Surý 858e06e58d Merge branch 'ondrej-refactor-isc_buffer-for-dnsstream' into 'main'
Change the isc_buffer_reserve() to take just buffer pointer

See merge request isc-projects/bind9!7235
2022-12-20 19:22:12 +00:00
Artem Boldariev 94e650ce89 Use 'restrict' and 'const' for 'isc_buffer_t'
The purpose of this commit is to aid compiler in generating better
code when working with `isc_buffer_t` objects by using restricted
pointers (and, to a lesser extent, 'const' modifier for read-only
arguments).

This way we, basically, instruct the compiler that the members of
structured passed by pointers into the functions can be treated as
local variables in the scope of a function. That should reduce the
number of load/store operations emitted by compilers when accessing
objects (e.g. 'isc_buffer_t') via pointers.
2022-12-20 21:01:27 +02:00
Ondřej Surý 460afcda18 Add isc_buffer_trycompact() function needed for StreamDNS
Add isc_buffer_trycompact() that's an optimization; it will compact the
buffer only when the remaining length is smaller than used length.
2022-12-20 19:13:48 +01:00
Ondřej Surý e6062ee3ae Add isc_buffer_setmctx() and isc_buffer_clearmctx() function
Add two extra functions needed by StreamDNS:

1. isc_buffer_setmctx() sets the buffer internal memory context, so we
   can use isc_buffer_reserve() on the buffer.  For this, we also need
   to track whether the .base was dynamically allocated or not.  This
   needs to be called after isc_buffer_init() and before first
   isc_buffer_reserve() call.

2. isc_buffer_clearmctx() clears the buffer internal memory context, and
   frees any dynamically allocated buffer.  This needs to be called
   after the last isc_buffer_reserve() call and before calling the
   isc_buffer_invalidate()
2022-12-20 19:13:48 +01:00
Ondřej Surý 8e3a86f6dd Make the isc_buffer unit header-only
The isc_buffer is often used in the hot-path, so make it header-only
implementation.
2022-12-20 19:13:48 +01:00
Ondřej Surý 302bc50340 Cleanup the isc_buffer_reserve() usage in put*() helpers
There are couple places where we use putstr(), putmem(), ... helpers
that tries to reserve space and only if successful puts the data onto
the buffer.  Cleanup the double reference as it's not needed there.
2022-12-20 19:13:48 +01:00
Ondřej Surý 2ddea1e41c Add a static pre-allocated buffer to isc_buffer_t
When the buffer is allocated via isc_buffer_allocate() and the size is
smaller or equal ISC_BUFFER_STATIC_SIZE (currently 512 bytes), the
buffer will be allocated as a flexible array member in the buffer
structure itself instead of allocating it on the heap.  This should help
when the buffer is used on the hot-path with small allocations.
2022-12-20 19:13:48 +01:00
Ondřej Surý 6bd2b34180 Enable auto-reallocation for all isc_buffer_allocate() buffers
When isc_buffer_t buffer is created with isc_buffer_allocate() assume
that we want it to always auto-reallocate instead of having an extra
call to enable auto-reallocation.
2022-12-20 19:13:48 +01:00
Ondřej Surý 135ec7a0f0 Remove single use isc_buffer_putdecint() function
The isc_buffer_putdecint() could be easily replaced with
isc_buffer_printf() with just a small overhead of calling vsnprintf()
twice instead once.  This is not on a hot-path (dns_catz unit), so we
can ignore the overhead and instead have less single-use code in favor
of using reusable more generic function.
2022-12-20 19:13:48 +01:00
Ondřej Surý 2a94123d5b Refactor the isc_buffer_{get,put}uintN, add isc_buffer_peekuintN
The Stream DNS implementation needs a peek methods that read the value
from the buffer, but it doesn't advance the current position.  Add
isc_buffer_peekuintX methods, refactor the isc_buffer_{get,put}uintN
methods to modern integer types, and move the isc_buffer_getuintN to the
header as static inline functions.
2022-12-20 19:13:48 +01:00
Ondřej Surý a1d45685e6 Move and extend the uint8_t low-endian to uint{32,64}t to endian.h
Move the U8TO{32,64}_LE and U{32,64}TO8_LE macros to endian.h and extend
the macros for 16-bit and Big-Endian variants.

Use the macros both in isc_siphash (LE) and isc_buffer (BE) units.
2022-12-20 19:13:48 +01:00
Ondřej Surý aea251f3bc Change the isc_buffer_reserve() to take just buffer pointer
The isc_buffer_reserve() would be passed a reference to the buffer
pointer, which was unnecessary as the pointer would never be changed
in the current implementation.  Remove the extra dereference.
2022-12-20 19:13:48 +01:00
Ondřej Surý 9fd83ea971 Merge branch '3178-dispatch-race' into 'main'
Fix the thread safety in the dns_dispatch unit

Closes #3178

See merge request isc-projects/bind9!7025
2022-12-19 12:07:12 +00:00
Ondřej Surý 2df311eb21 Add CHANGES and release note for [GL #3178] and [GL #3636] 2022-12-19 11:42:50 +01:00
Ondřej Surý 6f317f27ea Fix the thread safety in the dns_dispatch unit
The dispatches are not thread-bound, and used freely between various
threads (see the dns_resolver and dns_request units for details).

This refactoring make sure that all non-const dns_dispatch_t and
dns_dispentry_t members are accessed under a lock, and both object now
track their internal state (NONE, CONNECTING, CONNECTED, CANCELED)
instead of guessing the state from the state of various struct members.

During the refactoring, the artificial limit DNS_DISPATCH_SOCKSQUOTA on
UDP sockets per dispatch was removed as the limiting needs to happen and
happens on in dns_resolver and limiting the number of UDP sockets
artificially in dispatch could lead to unpredictable behaviour in case
one dispatch has the limit exhausted by others are idle.

The TCP artificial limit of DNS_DISPATCH_MAXREQUESTS makes even less
sense as the TCP connections are only reused in the dns_request API
that's not a heavy user of the outgoing connections.

As a side note, the fact that UDP and TCP dispatch pretends to be same
thing, but in fact the connected UDP is handled from dns_dispentry_t and
dns_dispatch_t acts as a broker, but connected TCP is handled from
dns_dispatch_t and dns_dispatchmgr_t acts as a broker doesn't really
help the clarity of this unit.

This refactoring kept to API almost same - only dns_dispatch_cancel()
and dns_dispatch_done() were merged into dns_dispatch_done() as we need
to cancel active netmgr handles in any case to not leave dangling
connections around.  The functions handling UDP and TCP have been mostly
split to their matching counterparts and the dns_dispatch_<function>
functions are now thing wrappers that call <udp|tcp>_dispatch_<function>
based on the socket type.

More debugging-level logging was added to the unit to accomodate for
this fact.
2022-12-19 11:42:13 +01:00
Ondřej Surý 5b79127780 Merge branch '3712-fix-reference-counting-in-dns_adb-get_attached_entry-v2' into 'main'
Fix reference counting in get_attached_entry (again)

Closes #3712

See merge request isc-projects/bind9!7250
2022-12-16 20:49:49 +00:00
Ondřej Surý 32ff134eeb Fix reference counting in get_attached_entry (again)
When get_attached_entry() encounters entry that would be expired, it
needs to get reference to the entry before calling maybe_expire_entry(),
so the ADB entry doesn't get destroyed inside the its own lock.

This creeped into the code base again during review, so I am adding
an extra comment to prevent this.
2022-12-16 21:48:43 +01:00
Tom Krizek 096b047628 Merge branch 'tkrizek/danger-backports' into 'main'
Check backport workflow in danger CI

See merge request isc-projects/bind9!7243
2022-12-16 13:18:01 +00:00
Tom Krizek e8a5ebaee5 danger: remove obsolete check for cherry pick msg
With proper backport commit detection, this check has been made
redundant.
2022-12-16 13:37:12 +01:00
Tom Krizek c617f97784 danger: check backport commits for original commit IDs
A full backport must have all the commit from the original MR and the
original commit IDs must be referenced in the backport commit messages.

If the criteria above is not met, the MR should be marked as a partial
backport. In that case, any discrepencies are only logged as informative
messages rather than failures.
2022-12-16 13:37:12 +01:00
Tom Krizek 89530f1a1c danger: check that original MR has been merged
When checking a backport MR, ensure that the original MR has been merged
already. This is vital for followup checks that verify commit IDs from
original commits are present in backport commit messages.
2022-12-16 13:37:12 +01:00
Tom Krizek 12e0b05738 danger: check backport links to the original MR
When doing archeology, it is much easier to find stuff if it's properly
linked. This check ensures that backport MR are linked to their original
MR via a "Backport of !XXXX" message.

The regular expression is fairly broad and has been tested to accept the
following variants of the message:
Backport of MR !XXXX
Backport of: !XXXX
backport of mr !XXXX
Backport of   !XXXX
Backport of https://gitlab.isc.org/isc-projects/bind9/-/merge_requests/XXXX
2022-12-16 13:37:12 +01:00
Tom Krizek 14b027cf83 danger: ensure target branch is in the MR title
Having the MR title clearly marked in its title can be very useful when
looking through older issues/MRs.

This check also ensures that the version from the version label matches
the proper version branch (i.e. v9.16 must be marked with [v9_16]).
2022-12-16 13:37:11 +01:00
Tom Krizek 1c0c1ba8b9 danger: support partial backport label
Treat the Backport::Partial label as a backport as well.
2022-12-16 13:37:10 +01:00
Tony Finch 94f2da42e0 Merge branch '3740-rpz-reconfig' into 'main'
A couple of RPZ options were not reconfigured as expected

Closes #3740

See merge request isc-projects/bind9!7230
2022-12-16 09:48:35 +00:00
Tony FinchandTony Finch d8a3d328db A couple of RPZ options were not reconfigured as expected
[bug]	Changes to the RPZ response-policy min-update-interval
	and add-soa options now take effect as expected when
	named is reconfigured. [GL #3740]
2022-12-15 16:21:38 +00:00
Ondřej Surý 1af9aa849e Merge branch '3739-adb-cleans-overzealously-under-memory-pressure' into 'main'
Exclude the ADB hashmaps from ADB overmem accounting

Closes #3739

See merge request isc-projects/bind9!7228
2022-12-15 15:44:01 +00:00
Ondřej Surý 11df7f02fd Add CHANGES and release note for [GL #3739] 2022-12-15 16:15:39 +01:00
Ondřej Surý 0b661b6f95 Don't expire fresh ADB names and entries
The overmem cleaning in ADB could become overzealous and clean fresh ADB
names and entries.  Add a safety check to not clean any ADB names and
entries that are below ADB_CACHE_MINIMUM threshold.
2022-12-15 16:15:19 +01:00
Ondřej Surý 59dee0b078 Exclude the ADB hashmaps from ADB overmem accounting
The ADB overmem accounting would include the memory used by hashtables
thus vastly reducing the space that can be used for ADB names and
entries when the hashtables would grow.  Create own memory context for
the ADB names and entries hash tables.
2022-12-15 16:14:16 +01:00
Ondřej Surý f74841fab7 Merge branch 'ondrej-fix-data-race-in-dns_adb' into 'main'
Lock the adbname and adbentry prior to unlocking hash locks

See merge request isc-projects/bind9!7216
2022-12-15 14:58:56 +00:00
Ondřej Surý a27ea1bba0 Lock the adbname and adbentry prior to unlocking hash locks
There was a datarace that could expire a freshly created ADB names and
entries between the return from get_attached_{name,entry} and locking it
again.  Lock the ADB name and ADB entry inside the hash table lock, so
they won't get expired until the full initialization has been complete.
2022-12-15 15:19:22 +01:00
Arаm Sаrgsyаn b8a915b0ac Merge branch '3742-catz-update-log-incorrect-soa-serial-representation' into 'main'
Fix an incorrect SOA serial representation in catz

Closes #3742

See merge request isc-projects/bind9!7229
2022-12-15 13:51:18 +00:00
Aram Sargsyan ac7149aa88 Add a CHANGES note for [GL #3742] 2022-12-15 13:27:09 +00:00
Aram Sargsyan 72b1760ea6 Fix logging a uint32_t SOA serial value in dns_catz_update_from_db()
The dns_catz_update_from_db() function prints serial number as a signed
number (with "%d" in the format string), but the `vers` variable's type
is 'uint32_t'. This breaks serials bigger than 2^31.

Use PRIu32 instead of "d" in the format string.
2022-12-15 13:24:58 +00:00
Aram Sargsyan de232ab446 Add big SOA serial logging check into the catz system test
Check that the SOA serial numbers printed when updating a catalog zone
is represented correctly for numbers bigger than 2^31.
2022-12-15 13:24:58 +00:00
Arаm Sаrgsyаn 3600e0f491 Merge branch 'aram/dns_adb_getcookie-cleanup' into 'main'
Clean up and refactor dns_adb_getcookie()

See merge request isc-projects/bind9!7211
2022-12-15 13:22:54 +00:00
Aram Sargsyan 03442d922b Clean up and refactor dns_adb_getcookie()
The dns_adb_getcookie() doesn't use the 'adb' parameter, remove it.

Refactor the dns_adb_getcookie() function to just return the size of
the cookie when the caller passes 'NULL' as the 'cookie' argument.
2022-12-15 12:34:26 +00:00
Ondřej Surý 5266444e35 Merge branch 'ondrej-use-isc_hashmap-for-zonemgr_keymgmt' into 'main'
Replace zonemgr_keymgmt own hash table with isc_hashmap

See merge request isc-projects/bind9!7191
2022-12-14 18:39:41 +00:00
Ondřej Surý 578de673b1 Replace zonemgr_keymgmt own hash table with isc_hashmap
Instead of maintaining own hashtable implementation for zonemgr_keymgmt,
use isc_hashmap that already can resize (grow and shrink).
2022-12-14 19:37:07 +01:00
Ondřej Surý ea88da8692 Merge branch 'ondrej-add-more-logging-to-netmgr' into 'main'
Add internal logging functions to the netmgr

See merge request isc-projects/bind9!7233
2022-12-14 18:35:17 +00:00
Ondřej Surý 52307f8116 Add internal logging functions to the netmgr
Add internal logging functions isc__netmgr_log, isc__nmsocket_log(), and
isc__nmhandle_log() that can be used to add logging messages to the
netmgr, and change all direct use of isc_log_write() to use those
logging functions to properly prefix them with netmgr, nmsocket and
nmsocket+nmhandle.
2022-12-14 19:34:48 +01:00
Ondřej Surý eeb545a2a9 Merge branch '3637-try-next-server-on-resolver-timeout' into 'main'
Try next server on resolver timeout

Closes #3637

See merge request isc-projects/bind9!7212
2022-12-14 17:52:32 +00:00
Ondřej Surý d1f1db2f5a Add CHANGES and release notes for [GL #3637] 2022-12-14 18:49:54 +01:00
Ondřej Surý b8c7dc2dc2 Expire names in shutdown_names() under the lock
Since there could be fetches running, we need to run expire_name() under
the lock when shutting down the names.
2022-12-14 18:49:18 +01:00
Ondřej Surý 32c2acf6fc Add comment why statistics/ns3 has misconfigure root.hints
To count pending queries in the statistics, we need the ns3 to be
misconfigured.  Document the fact in the statistics/ns3/root.hints.
2022-12-14 18:49:18 +01:00
Ondřej Surý b679640950 Revert the statistics system test change after we fixed the resolver
When the resolver was refactored, the statistics system test had to be
adjusted in c6b4d82557.  Unfortunately,
this change had to be done because of an error in the resolver
refactoring where timeout would not retry next server, but keep trying
the same server.  As we have now fixed this bug, revert the change to
the test back to the previous state.
2022-12-14 18:49:18 +01:00
Ondřej Surý 5466a48fc9 Try next server on resolver timeout
Instead of resending to the same server on the (dispatch) timeout in the
resolver, try the next server.
2022-12-14 18:49:18 +01:00
Ondřej Surý d0d4a7ede7 Merge branch 'ondrej-allow-zero-length-keys-in-isc_hashmap' into 'main'
Allow zero length keys in isc_hashmap

See merge request isc-projects/bind9!7198
2022-12-14 17:01:54 +00:00
Ondřej Surý 7cefcb6184 Allow zero length keys in isc_hashmap
In case, we are trying to hash the empty key into the hashmap, the key
is going to have zero length.  This might happen in the unit test.
Allow this and add a unit test to ensure the empty zero-length key
doesn't hash to slot 0 as SipHash 2-4 (our hash function of choice) has
no problem with zero-length inputs.
2022-12-14 17:59:07 +01:00
Artem Boldariev 8a35d52807 Merge branch '3725-mutual-tls-session-resumption-fix' into 'main'
Fix TLS session resumption via IDs when Mutual TLS is used

Closes #3725

See merge request isc-projects/bind9!7215
2022-12-14 16:36:53 +00:00
Artem Boldariev 67d74e228f Update Release notes [GL #3725]
Mention that TLS session resumption for Mutual TLS has been fixed.
2022-12-14 18:08:51 +02:00
Artem Boldariev d8e04cdbc7 Update CHANGES [GL #3725]
Mention that TLS session resumption for Mutual TLS has been fixed.
2022-12-14 18:07:03 +02:00
Artem Boldariev d5d31c6ba1 Extend the 'doth' system test with a Mutual TLS resumption check
This commit adds a simple check to the 'doth' system test which
ensures that session resumption when Mutual TLS is used works as
expected.
2022-12-14 18:06:20 +02:00
Artem Boldariev 837fef78b1 Fix TLS session resumption via IDs when Mutual TLS is used
This commit fixes TLS session resumption via session IDs when
client certificates are used. To do so it makes sure that session ID
contexts are set within server TLS contexts. See OpenSSL documentation
for 'SSL_CTX_set_session_id_context()', the "Warnings" section.
2022-12-14 18:06:20 +02:00
Tony Finch 39e57ab133 Merge branch 'fanf-dnssec-algorithm-loglevel' into 'main'
List supported DNSSEC algorithms at log level NOTICE

See merge request isc-projects/bind9!7217
2022-12-14 11:02:15 +00:00
Tony FinchandTony Finch 72f8d03cad List supported DNSSEC algorithms at log level NOTICE
NOTICE matches the other startup messages. WARNING weirdly
suggests the list is a problem.
2022-12-14 11:01:22 +00:00
Ondřej Surý 27376b9a8e Merge branch '3736-fix-intermittent-memory-leak-in-forward-system-test' into 'main'
Fix intermittent memory leak in dns_resolver unit

Closes #3736

See merge request isc-projects/bind9!7214
2022-12-14 09:48:37 +00:00
Ondřej Surý 7292ee6d92 Fix intermittent memory leak in dns_resolver unit
A rdataset could have been left unassociated on the error path in the
resume_dslookup() in the dns_resolver unit.  Clone the rdataset after
the error check, so it's not cloned before we check whether we can make
further progress chasing DS records.
2022-12-14 10:48:06 +01:00
Mark Andrews 282d4ea645 Merge branch '3737-fix-initialisation-of-local-in-isdotlocal-in-dig' into 'main'
Resolve "fix initialisation of local. in isdotlocal in dig"

Closes #3737

See merge request isc-projects/bind9!7213
2022-12-13 23:27:50 +00:00
Mark Andrews 8ce163bbc5 Properly initialise local_ndata in isdotlocal in dig
Remove the trailing '\0' so that the length field of the dns_name_t
structure is correct.  The old data just happens to work with
dns_name_issubdomain but would fail with dns_name_equal.
2022-12-13 23:05:30 +00:00
Tony Finch 5f6ec1fbe3 Merge branch 'fanf-rsasha236' into 'main'
Fix a typo RSASHA236 -> RSASHA256

See merge request isc-projects/bind9!7206
2022-12-13 16:58:59 +00:00
Tony Finch c18a9a208d Fix a typo RSASHA236 -> RSASHA256
Use dns_secalg_format() to avoid error-prone repetition.
2022-12-13 16:58:02 +00:00
Tom Krizek baf9c9f1ee Merge branch 'tkrizek/set-up-version-and-release-notes-for-bind-9.19.9' into 'main'
Set up version and release notes for bind  9.19.9

See merge request isc-projects/bind9!7218
2022-12-13 16:18:03 +00:00
Tom Krizek 0e16e9e8d1 Set up release notes for BIND 9.19.9 2022-12-13 16:45:13 +01:00
Tom Krizek 38a9338fe4 Update BIND version to 9.19.9-dev 2022-12-13 16:44:52 +01:00
Tom Krizek eac4314684 Update BIND version for release 2022-12-12 14:20:08 +01:00
Tom Krizek 1b03cf1503 Add a CHANGES marker 2022-12-12 14:02:56 +01:00
Tom Krizek 0e2f297986 Merge branch 'michal/prepare-documentation-for-bind-9.19.8' into 'v9_19_8-release'
Prepare documentation for BIND 9.19.8

See merge request isc-private/bind9!487
2022-12-12 12:56:59 +00:00
Michał Kępień bd71684f07 Add release note for GL #3721 2022-12-12 12:11:01 +01:00
Michał Kępień 815694d018 Reorder release notes 2022-12-12 12:11:01 +01:00
Michał Kępień d4801a9163 Tweak and reword release notes 2022-12-12 12:11:01 +01:00
Michał Kępień 64985af9fc Prepare release notes for BIND 9.19.8 2022-12-12 12:11:01 +01:00
Michał Kępień 98bb01a22b Restore release note for GL #3570 2022-12-12 12:11:01 +01:00
Ondřej Surý b432a2e6b9 Merge branch '3731-attach-keyfileio-to-zone' into 'main'
Implement proper reference counting for dns_keyfileio_t

Closes #3731

See merge request isc-projects/bind9!7203
2022-12-09 14:14:25 +00:00
Ondřej Surý 79115a0c3b Implement proper reference counting for dns_keyfileio_t
Instead of relying on hash table search when using the keys, implement a
proper reference counting in dns_keyfileio_t objects, and attach/detach
the objects to the zone.
2022-12-09 14:27:44 +01:00
Petr Špaček 9dea2b99ee Merge branch 'pspacek/configure-doh-help-fix' into 'main'
Fix configure --disable-doh help text

See merge request isc-projects/bind9!7118
2022-12-08 09:49:27 +00:00
Petr Špaček 5ec272007d Fix configure --disable-doh help text
This is technically fixup for 2bb454182b.

Related: !4926
2022-12-08 10:48:24 +01:00
Tom Krizek 91c9f1d087 Merge branch 'tkrizek/revert-3678-serve-stale-servfail' into 'main'
Revert "Merge branch '3678-serve-stale-servfailing-unexpectedly' into 'main'"

See merge request isc-projects/bind9!7183
2022-12-08 09:31:29 +00:00
Tom Krizek ba1607747c Revert "Merge branch '3678-serve-stale-servfailing-unexpectedly' into 'main'"
This reverts commit 629f66ea8e, reversing
changes made to 84a7be327e.

It also removes release note 6038, since the fix is reverted.
2022-12-08 10:30:44 +01:00
Ondřej Surý 855498ee6b Merge branch '3727-fix-off-by-one-reference-counting-in-zonemgr_keymgmt_delete' into 'main'
Release unused key file IO lock objects

Closes #3727

See merge request isc-projects/bind9!7178
2022-12-08 09:24:10 +00:00
Ondřej Surý 56a997b0b5 Add CHANGES and release note for [GL #3727] 2022-12-08 08:32:59 +01:00
Ondřej Surý fb1acd6736 Release unused key file IO lock objects
Due to off-by-one error in zonemgr_keymgmt_delete, unused key file IO
lock objects were never freed and they were kept until the server
shutdown.  Adjust the returned value by -1 to accomodate the fact that
the atomic_fetch_*() functions return the value before the operation and
not current value after the operation.
2022-12-08 08:30:30 +01:00
Mark Andrews 26cc205334 Merge branch '3613-redo-dumping-expired-rdatasets' into 'main'
Resolve "TTL issue with resolver's cached and expired results for qtype ANY queries"

Closes #3613

See merge request isc-projects/bind9!7085
2022-12-07 22:46:45 +00:00
Mark Andrews 485e968087 Add CHANGES note for [GL #3613] 2022-12-07 22:20:02 +00:00
Mark Andrews 1a39328feb Remove different zero TTL handling for rdataset iterator
Zero TTL handling does not need to be different for 'rdatasetiter_first'
and 'rdatasetiter_next' and it interacts badly with 'bind_rdatadataset'
which makes different determinations.
2022-12-07 22:20:02 +00:00
Mark Andrews 85048ddeee Add dns_db_allrdatasets options
'DNS_DB_STALEOK' returns stale rdatasets as well as current rdatasets.

'DNS_DB_EXPIREDOK' returns expired rdatasets as well as current
rdatasets. This option is currently only set when DNS_DB_STALEOK is
also set.
2022-12-07 22:20:02 +00:00
Mark Andrews 7695c36a5d Extend dns_db_allrdatasets to control interation results
Add an options parameter to control what rdatasets are returned when
iteratating over the node.  Specific modes will be added later.
2022-12-07 22:20:02 +00:00
Mark Andrews 3bdab2d111 Properly select active rdatasets when iterating across node
Active rdatasets where not being properly selected in rdatasetiter_first
and rdatasetiter_next.
2022-12-07 22:20:02 +00:00
Mark Andrews e49f83499a Check TTLs of mixed TTL ANY response with expired records 2022-12-07 22:20:02 +00:00
Mark Andrews 90249e4aa5 Revert "Fix rndc dumpdb -expired for stuck cache contents"
This reverts commit f8d866c6ef.
2022-12-07 22:20:02 +00:00
Mark Andrews bc64205c58 Merge branch '3724-update-dig-tcp-documentation' into 'main'
Resolve "Update dig +tcp documentation"

Closes #3724

See merge request isc-projects/bind9!7172
2022-12-07 21:59:25 +00:00
Mark Andrews b5951f0411 Add reference to +tcp for +ignore 2022-12-07 21:38:18 +00:00
Ondřej Surý 7dc6984367 Merge branch '3676-remove-operating-system-resource-limits' into 'main'
Mark setting operating system limits from named.conf as ancient

Closes #3676

See merge request isc-projects/bind9!7079
2022-12-07 18:50:30 +00:00
Ondřej Surý 01c58e6d40 Add CHANGES and release note for [GL #3676] 2022-12-07 19:42:55 +01:00
Ondřej Surý e2262c2112 Remove isc_resource API and set limits directly in named_os unit
The only function left in the isc_resource API was setting the file
limit.  Replace the whole unit with a simple getrlimit to check the
maximum value of RLIMIT_NOFILE and set the maximum back to rlimit_cur.

This is more compatible than trying to set RLIMIT_UNLIMITED on the
RLIMIT_NOFILE as it doesn't work on Linux (see man 5 proc on
/proc/sys/fs/nr_open), neither it does on Darwin kernel (see man 2
getrlimit).

The only place where the maximum value could be raised under privileged
user would be BSDs, but the `named_os_adjustnofile()` were not called
there before.  We would apply the increased limits only on Linux and Sun
platforms.
2022-12-07 19:40:00 +01:00
Ondřej Surý 0c62c0bdb7 Mark setting operating system limits from named.conf as ancient
After deprecating the operating system limits settings (coresize,
datasize, files and stacksize), mark them as ancient and remove the code
that sets the values from config.
2022-12-07 19:40:00 +01:00
Ondřej Surý 0d3936646d Merge branch 'ondrej-fix-missing-zone_check-in-checkds-system-test' into 'main'
Fix missing zone_check() call in checkds test

See merge request isc-projects/bind9!7161
2022-12-07 18:14:34 +00:00
Ondřej Surý 718831bfcc Fix missing zone_check() call in checkds test
The bad2-dswithdrawn.checkds tests were missing call to the
zone_checks() contributing to intermittent timing failures of the
checkds system test.
2022-12-07 19:14:10 +01:00
Ondřej Surý fd97400586 Merge branch '3708-remove-dead-code-from-dns_cache-unit' into 'main'
Remove dead code from dns_cache_flush()

Closes #3708

See merge request isc-projects/bind9!7141
2022-12-07 18:11:32 +00:00
Ondřej Surý 715343c31d Remove dead code from dns_cache_flush()
After removing the cache cleaning mechanism, we don't need to db
iterator in dns_cache_flush() anymore.
2022-12-07 19:11:08 +01:00
Ondřej Surý 3df650f3b4 Merge branch '3183-send-shutdown-to-ns_client-on-shutdown' into 'main'
Propagate the shutdown event to the recursing ns_client(s)

Closes #3183

See merge request isc-projects/bind9!7027
2022-12-07 17:08:24 +00:00
Ondřej Surý 48059a1bc2 Add CHANGES and release notes for [GL #3183] 2022-12-07 18:06:35 +01:00
Ondřej Surý 5111258e7a Propagate the shutdown event to the recursing ns_client(s)
Send the ns_query_cancel() on the recursing clients when we initiate the
named shutdown for faster shutdown.

When we are shutting down the resolver, we cancel all the outstanding
fetches, and the ISC_R_CANCEL events doesn't propagate to the ns_client
callback.

In the future, the better solution how to fix this would be to look at
the shutdown paths and let them all propagate from bottom (loopmgr) to
top (f.e. ns_client).
2022-12-07 18:05:36 +01:00
Ondřej Surý 198b815e0b Merge branch '3712-fix-reference-counting-in-dns_adb-get_attached_entry' into 'main'
Fix reference counting in get_attached_entry

Closes #3712

See merge request isc-projects/bind9!7168
2022-12-07 15:16:50 +00:00
Ondřej Surý c2be97eeff Fix reference counting in get_attached_entry
When get_attached_entry() encounters entry that would be expired, it
needs to get reference to the entry before calling maybe_expire_entry(),
so the ADB entry doesn't get destroyed inside the its own lock.
2022-12-07 16:16:22 +01:00
Matthijs Mekking 406de85309 Merge branch 'matthijs-document-ns-minimal-responses' into 'main'
Document NS queries are excempt from minimal-responses

See merge request isc-projects/bind9!7072
2022-12-07 11:19:20 +00:00
Matthijs Mekking f7b477f6ea Document NS queries are excempt from minimal-responses
Also document that DNSKEY, DS, CDNSKEY, and CDS never do additional
section processing.
2022-12-07 11:37:55 +01:00
Michal Nowak e5afd7c50c Merge branch 'mnowak/asan-tsan-respdiff-jobs' into 'main'
Add ASAN- and TSAN-enabled respdiff jobs

See merge request isc-projects/bind9!7115
2022-12-07 07:26:21 +00:00
Michal Nowak 4f23de554c Add ASAN- and TSAN-enabled respdiff jobs
Neither of the new CI jobs can reliably pass at the moment; hence they
are defined with "allow_failure: true" until issues in the code base are
resolved.
2022-12-07 07:28:03 +01:00
Michal Nowak 9856296666 Extract TSAN parsing code 2022-12-07 07:28:03 +01:00
Mark Andrews 8f6a0c85ea Merge branch '3683-use-after-free-in-catalog-zone-processing' into 'main'
Resolve "use after free in catalog zone processing"

Closes #3683

See merge request isc-projects/bind9!7137
2022-12-06 22:29:46 +00:00
Mark Andrews 9843da3423 Add release note for [GL #3683] 2022-12-07 09:04:49 +11:00
Mark Andrews 72402e1710 Add CHANGES note for [GL #3683] 2022-12-07 09:04:48 +11:00
Mark Andrews bca84c8601 Check that restored catalog zone works
Using a restored catalog zone excercised a use-after-free bug.
The test checks that the use-after-free bug is gone and is just
a reasonable behaviour check in its own right.
2022-12-07 09:04:08 +11:00
Mark Andrews b1086a5561 Add missing DbC magic checks
Checking for value != NULL is not sufficient to detect use after
free errors.
2022-12-07 09:04:08 +11:00
Mark Andrews 35839e91d8 Call dns_db_updatenotify_unregister earlier
dns_db_updatenotify_unregister needed to be called earlier to ensure
that listener->onupdate_arg always points to a valid object.  The
existing lazy cleanup in rbtdb_free did not ensure that.
2022-12-07 09:04:08 +11:00
Mark Andrews f13e71e551 Suppress duplicate dns_db_updatenotify_register registrations
Duplicate dns_db_updatenotify_register registrations need to be
suppressed to ensure that dns_db_updatenotify_unregister is successful.
2022-12-07 09:04:08 +11:00
Arаm Sаrgsyаn 629f66ea8e Merge branch '3678-serve-stale-servfailing-unexpectedly' into 'main'
Resolve "stale-serve and RPZ put in SERVFAIL cache unexpected record"

Closes #3678

See merge request isc-projects/bind9!7096
2022-12-06 14:53:16 +00:00
Aram Sargsyan 5b5f3a0ea7 Add a CHANGES note for [GL #3678] 2022-12-06 13:28:49 +00:00
Matthijs MekkingandAram Sargsyan 86a80e723f Consider non-stale data when in serve-stale mode
With 'stale-answer-enable yes;' and 'stale-answer-client-timeout off;',
consider the following situation:

A CNAME record and its target record are in the cache, then the CNAME
record expires, but the target record is still valid.

When a new query for the CNAME record arrives, and the query fails,
the stale record is used, and then the query "restarts" to follow
the CNAME target. The problem is that the query's multiple stale
options (like DNS_DBFIND_STALEOK) are not reset, so 'query_lookup()'
treats the restarted query as a lookup following a failed lookup,
and returns a SERVFAIL answer when there is no stale data found in the
cache, even if there is valid non-stale data there available.

With this change, query_lookup() now considers non-stale data in the
cache in the first place, and returns it if it is available.
2022-12-06 13:26:53 +00:00
Aram Sargsyan 21faf44ef7 Add serve-stale CNAME check with stale-answer-client-timeout off
Prime the cache with the following records:

    shortttl.cname.example.	1	IN	CNAME	longttl.target.example.
    longttl.target.example.	600	IN	A	10.53.0.2

Wait for the CNAME record to expire, disable the authoritative server,
and query 'shortttl.cname.example' again, expecting a stale answer.
2022-12-06 13:26:53 +00:00
Mark Andrews 84a7be327e Merge branch '3697-reject-zones-with-ds-records-not-at-delegations' into 'main'
Resolve "Reject zones with DS records not at delegations"

Closes #3697

See merge request isc-projects/bind9!7116
2022-12-06 13:07:00 +00:00
Mark Andrews fbb2f67e8d Add CHANGES note for [GL #3697] 2022-12-06 23:28:11 +11:00
Mark Andrews e8e40e2e01 Check that DS records are only present at delegations
This extends the integrity check to look for stray DS records
in the zone.
2022-12-06 23:27:40 +11:00
Mark Andrews 8ab496b6e1 Merge branch '3721-the-nslookup-command-does-not-obey-the-port-option-when-record-type-any-is-used' into 'main'
Resolve "The nslookup command does not obey the port option when record type ANY is used."

Closes #3721

See merge request isc-projects/bind9!7162
2022-12-05 22:19:23 +00:00
Mark Andrews 27168dbf43 Add CHANGES note for [GL #3721] 2022-12-06 08:58:58 +11:00
Mark Andrews 8caa94bdf1 Remember that the port was set in host and nslookup
Set 'port_set = true;' so that the TCP/DOT/DOH code doesn't reset
the port when making connections.
2022-12-06 08:58:58 +11:00
Mark Andrews e9c4192ee5 Add checks for 'host' 2022-12-06 08:58:58 +11:00
Mark Andrews c367dd1b0b Check ANY lookup using nslookup 2022-12-06 08:57:48 +11:00
Mark Andrews 3914aba26d Merge branch '3633-cid-361427-error-handling-issues-in-lib-dns-rdata-c' into 'main'
Resolve "CID 361427: Error handling issues in lib/dns/rdata.c"

Closes #3633

See merge request isc-projects/bind9!7056
2022-12-04 23:16:53 +00:00
Mark Andrews 94008863de Add RUNTIME_CHECK for dns_rdata_tostruct 2022-12-04 21:41:02 +00:00
Artem Boldariev e3ffe756dc Merge branch 'artem-tls-check-for-recv_cb' into 'main'
TLS: check for sock->recv_cb when handling received data

See merge request isc-projects/bind9!7158
2022-12-02 12:11:41 +00:00
Artem Boldariev bed5e2bb08 TLS: check for sock->recv_cb when handling received data
This commit adds a check if 'sock->recv_cb' might have been nullified
during the call to 'sock->recv_cb'. That could happen, e.g. by an
indirect call to 'isc_nmhandle_close()' from within the callback when
wrapping up.

In this case, let's close the TLS connection.
2022-12-02 13:20:37 +02:00
Artem Boldariev 69db33e7a5 Merge branch 'artem-tls-doh-listeners-avoid-acessing-non-atomic-flags-on-handshake-or-accept' into 'main'
TLS and DoH: Avoid accessing non-atomic listener socket flags during HS/when accepting a caonnection

See merge request isc-projects/bind9!7155
2022-12-02 11:18:56 +00:00
Artem Boldariev 8b7e123528 DoH: Avoid accessing non-atomic listener socket flags when accepting
This commit ensures that the non-atomic flags inside a DoH listener
socket object (and associated worker) are accessed when doing accept
for a connection only from within the context of the dedicated thread,
but not other worker threads.

The purpose of this commit is to avoid TSAN errors during
isc__nmsocket_closing() calls. It is a continuation of
4b5559cd8f.
2022-12-02 12:16:12 +02:00
Artem Boldariev 4d0c226375 TLS: Avoid accessing non-atomic listener socket flags during HS
This commit ensures that the non-atomic flags inside a TLS listener
socket object (and associated worker) are accessed when doing
handshake for a connection only from within the context of the
dedicated thread, but not other worker threads.

The purpose of this commit is to avoid TSAN errors during
isc__nmsocket_closing() calls. It is a continuation of
4b5559cd8f.
2022-12-02 12:16:12 +02:00
Tom Krizek fc991fa79d Merge branch 'tkrizek/system-tests-prereqs' into 'main'
Unify system test feature detection and add missing prerequisites

See merge request isc-projects/bind9!7151
2022-12-02 09:44:29 +00:00
Tom Krizek 9846c920c3 Add dnstap prerequisite for dnstap system test 2022-12-02 10:23:52 +01:00
Tom Krizek f514604613 Add libnghttp2 prerequisite for doth system test
While some of these tests are for DoT which doesn't require nghttp2,
the server configs won't allow the server to start without nghttp2
support during compile time.

It might be possible to split these tests into DoT and DoH and only
require nghttp2 for DoH tests, but since almost all of our CI jobs are
compiled with nghttp2, we wouldn't gain a lot of coverage, so it's
probably not worth the effort.
2022-12-02 10:23:52 +01:00
Tom Krizek b1e011e158 Add lmdb prerequisite for nzd2nzf system test 2022-12-02 10:23:52 +01:00
Tom Krizek e9d9f11539 Check for pkcs11-tool in keyfromlabel system test
pkcs11-tool which is typically part of the opensc package is required
for the keyfromlabel test.
2022-12-02 10:23:52 +01:00
Tom Krizek 9730ac4c56 Use feature-test feature detection in pytests
Avoid using the environment variables for feature detection and use the
feature-test utility instead.

Remove the obsolete environment variables from conf.sh, since they're no
longer used anywhere.
2022-12-02 10:23:52 +01:00
Tom Krizek d24fb1122e Use feature-test to detect feature support in system tests
Previously, there were two different ways to detect feature support.
Either through an environment variable set by configure in conf.sh, or
using the feature-test utility.

It is more simple and consistent to have only one way of detecting the
feature support. Using the feature-test utility seems superior the the
environment variables set by configure.
2022-12-02 10:23:51 +01:00
Tom Krizek e22d27da71 Add missing options to feature-test utility 2022-12-02 10:23:49 +01:00
Artem Boldariev 89d7970072 Merge branch 'artem-tls-listener-avoid-acessing-flags-on-accept' into 'main'
TLS: Avoid accessing listener socket flags from other threads when accepting a connection

See merge request isc-projects/bind9!7154
2022-12-01 20:00:35 +00:00
Artem Boldariev 4b5559cd8f TLS: Avoid accessing listener socket flags from other threads
This commit ensures that the flags inside a TLS listener socket
object (and associated worker) are accessed when accepting a
connection only from within the context of the dedicated thread, but
not other worker threads.
2022-12-01 21:07:49 +02:00
Ondřej Surý 052200cc2b Merge branch 'ondrej-fix-single-read-tlsdns-client' into 'main'
Honour single read per client isc_nm_read() call in the TLSDNS

See merge request isc-projects/bind9!7152
2022-12-01 18:06:45 +00:00
Ondřej Surý e3c628d562 Honour single read per client isc_nm_read() call in the TLSDNS
The TLSDNS transport was not honouring the single read callback for
TLSDNS client.  It would call the read callbacks repeatedly in case the
single TLS read would result in multiple DNS messages in the decoded
buffer.
2022-12-01 18:31:05 +01:00
Ondřej Surý 5383363ba9 Merge branch '3709-fix-dns_resolver-hash-tables' into 'main'
Refactor the dns_resolver fetch context hash tables and locking

Closes #3709

See merge request isc-projects/bind9!7142
2022-12-01 13:35:08 +00:00
Ondřej Surý dbc2542ef3 Add CHANGES note for [GL #3709] 2022-12-01 11:42:46 +01:00
Ondřej Surý 7e4e125e5e Refactor the dns_resolver fetch context hash tables and locking
This is second in the series of fixing the usage of hashtables in the
dns_adb and the dns_resolver units.

Currently, the fetch buckets (used to hold the fetch context) and zone
buckets (used to hold per-domain counters) would never get cleaned from
the memory.  Combined with the fact that the hashtable now grows as
needed (instead of using hashtable as buckets), the memory usage in the
resolver can just grow and it never drops down.

In this commit, the usage of hashtables (hashmaps) has been completely
rewritten, so there are no "buckets" and all the matching conditions are
directly mapped into the hashtable key:

 1. For per-domain counter hashtable, this is simple as the lowercase
    domain name is used directly as a counter.

 2. For fetch context hashtable, this requires copying some extra flags
    back and forth in the key.

As we don't hold the "buckets" forever, the cleaning mechanism has been
rewritten as well:

 1. For per-domain counter hashtable, this is again much simpler, as we
    only need to check whether the usage counter is still zero under the
    lock and bail-out on cleaning if the counter is in use.

 2. For fetch context hashtable, this is more complicated as the fetch
    context cannot be reused after it has been finished.  The algorithm
    is different, the fetch context is always removed from the
    hashtable, but if we find the fetch context that has been marked
    as finished in the lookup function, we help with the cleaning from
    the hashtable and try again.

Couple of additional changes have been implemented in this refactoring
as those were needed for correct functionality and could not be split
into individual commits (or would not make sense as seperate commits):

 1. The dns_resolver_createfetch() has an option to create "unshared"
    fetch.  The "unshared" fetch will never get matched, so there's
    little point in storing the "unshared" fetch in the hashtable.
    Therefore the "unshared" fetches are now detached from the
    hashtable and live just on their own.

 2. Replace the custom reference counting with ISC_REFCOUNT_DECL/IMPL
    macros for better tracing.

 3. fctx_done_detach() is idempotent, it makes the "final" detach (the
    one matching the create function) only once.  But that also means
    that it has to be called before the detach that kept the fetch
    context alive in the callback.  A new macro fctx_done_unref() has
    been added to allow this code flow:

    fctx_done_unref(fctx, result);
    fctx_detach(&fctx);

    Doing this the other way around could cause fctx to get destroyed in
    the fctx_unref() first and fctx_done_detach() would cause UAF.

 4. The resume_qmin() and resume_dslookup() callbacks have been
    refactored for more readability and simpler code paths.  The
    validated() callback has also received some of the simplifications,
    but it should be refactored in the future as it is bit of spaghetti
    now.
2022-12-01 11:42:46 +01:00
Evan Hunt fbc9d14149 Merge branch 'each-cache-use-loops' into 'main'
change cache cleaning to use loops instead of tasks

See merge request isc-projects/bind9!7136
2022-11-30 20:12:29 +00:00
Evan Hunt 09ee254514 change dns_db_settask() to _setloop()
The mechanism for associating a worker task to a database now
uses loops rather than tasks.

For this reason, the parameters to dns_cache_create() have been
updated to take a loop manager rather than a task manager.
2022-11-30 11:47:35 -08:00
Artem Boldariev 73d36a3901 Merge branch 'artem-tls-tcp-compatibility-fixes' into 'main'
TLS Stream: TCP transport compatibility fixes

See merge request isc-projects/bind9!7127
2022-11-30 16:30:03 +00:00
Artem Boldariev 2bfc079946 TLS stream: always handle send callbacks asynchronously
This commit ensures that send callbacks are always called from within
the context of its worker thread even in the case of
shuttigdown/inactive socket, just like TCP transport does and with
which TLS attempts to be as compatible as possible.
2022-11-30 18:09:52 +02:00
Artem Boldariev ef659365ce TLS Stream: use ISC_R_CANCELLED error when shutting down
This commit changes ISC_R_NOTCONNECTED error code to ISC_R_CANCELLED
when attempting to start reading data on the shutting down socket in
order to make its behaviour compatible with that of TCP and not break
the common code in the unit tests.
2022-11-30 18:09:52 +02:00
Artem Boldariev fb9955a372 TLS Stream: fix isc_nm_read_stop() and reading flags handling
It turned out that after the latest Network Manager refactoring
'sock->reading' flag was not processed correctly. Due to this
isc_nm_read_stop() might not work as expected because reading from the
underlying TCP socket could have been resume in 'tls_do_bio()'
regardless of the 'sock->reading' value.

This bug did not seem to cause problems with DoH, so it was not
noticed, but Stream DNS has more strict expectations regarding the
underlying transport.

Additionally to the above, the 'sock->recv_read' flag was completely
ignored and corresponding logic was completely unimplemented. That did
not allow to implement one fine detail compared to TCP: once reading
is started, it could be satisfied by one datum reading.

This commit fixes the issues above.
2022-11-30 18:09:52 +02:00
Matthijs Mekking f9e58dc929 Merge branch 'matthijs-deprecate-alt-transfer-source' into 'main'
Deprecate alt-transfer-source and companions

Closes #3694

See merge request isc-projects/bind9!7105
2022-11-30 15:50:26 +00:00
Matthijs Mekking 7920347077 Mention deprecation of alternate transfer source
In the CHANGES and release notes.
2022-11-30 16:30:06 +01:00
Matthijs Mekking 13a16c1f4d Add missing deprecated tag to max-zone-ttl
This option was deprecated in commit 19352dd187 but at that time
we didn't mark it deprecated in the ARM reference.
2022-11-30 16:29:46 +01:00
Matthijs Mekking 105465d316 Deprecate alt-transfer-source and companions
Deprecate the alternate transfer sources from BIND 8.
2022-11-30 16:29:46 +01:00
Michał Kępień 423f2f1eb3 Merge branch 'marka/log-type-with-stale-answer-log-messages' into 'main'
Log type with stale answer log messages

See merge request isc-projects/bind9!7145
2022-11-30 14:00:20 +00:00
Michał Kępień 2c99ab6faa Add CHANGES entry for GL !7145 2022-11-30 14:32:58 +01:00
Mark AndrewsandMichał Kępień bce1cf6c62 Log type with stale answer log messages
Add more information about which query type is dealing with serve-stale.
Update the expected log messages in the serve-stale system test.
2022-11-30 14:32:58 +01:00
Michał Kępień e8ef7f644d Merge branch 'matthijs/update-serve-stale-test-messages-to-include-rrtype' into 'main'
Update serve-stale test messages to include RRtype

See merge request isc-projects/bind9!7140
2022-11-30 13:29:14 +00:00
Matthijs MekkingandMichał Kępień 45f7a15785 Update serve-stale test messages to include RRtype 2022-11-30 14:28:38 +01:00
Tony Finch 43c05cd084 Merge branch '3706-compress-xfer' into 'main'
Compress zone transfers properly

Closes #3706

See merge request isc-projects/bind9!7135
2022-11-30 13:11:13 +00:00
Tony FinchandTony Finch a8f1d0c19c Compress zone transfers properly
After change 5995, zone transfers were using a small
compression context that only had space for the first
few dozen names in each message. They now use a large
compression context with enough space for every name.
2022-11-30 12:16:09 +00:00
Ondřej Surý d38b49d696 Merge branch '3707-dont-log-final-reference-detached-on-LOG_INFO' into 'main'
Don't log "final reference detached" on INFO level

Closes #3707

See merge request isc-projects/bind9!7139
2022-11-30 10:46:53 +00:00
Ondřej Surý 116d1b94a9 Add CHANGES and release note for [GL #3707] 2022-11-30 11:46:09 +01:00
Ondřej Surý 1816244725 Don't log "final reference detached" on INFO level
The "final reference detached" message was meant to be DEBUG(1), but was
instead kept at INFO level.  Move it to the DEBUG(1) logging level, so
it's not printed under normal operations.
2022-11-30 11:04:45 +01:00
Ondřej Surý a9cbf84e0f Merge branch '3239-fix-cleaning-of-adb-buckets' into 'main'
Refactor the dns_adb unit

Closes #3239, #3238, #2615, #2078, #2437, #3312, and #2441

See merge request isc-projects/bind9!7138
2022-11-30 09:35:18 +00:00
Ondřej Surý d6bd97354f Add CHANGES note for [GL #3239] 2022-11-30 10:13:29 +01:00
Ondřej Surý 35d8d72dd8 Keep the unlink adb entries until expiration
Currently, the ADB uses TTL of 0 for ADB names that the server is
authoritative for and TTL of 10 seconds for HINT and GLUE ADB names.

This requires the unlinked ADB entries to be kept around, because they
would disappear too quickly.  This especially affect the root zone as
the trust level is "ultimate" for the root zone nameservers.

This commit restores the ability to keep the unlinked ADB entries in the
database for later reuse, restores printing the unlinked entries and
adds some extra cleaning of the unlinked ADB entries on the tail of the
LRU list (similar to what we are doing for the ADB names).
2022-11-30 10:03:24 +01:00
Ondřej Surý 50f357cb36 Refactor the dns_adb unit
The dns_adb unit has been refactored to be much simpler.  Following
changes have been made:

1. Simplify the ADB to always allow GLUE and hints

   There were only two places where dns_adb_createfind() was used - in
   the dns_resolver unit where hints and GLUE addresses were ok, and in
   the dns_zone where dns_adb_createfind() would be called without
   DNS_ADBFIND_HINTOK and DNS_ADBFIND_GLUEOK set.

   Simplify the logic by allowing hint and GLUE addresses when looking
   up the nameserver addresses to notify.  The difference is negligible
   and would cause a difference in the notified addresses only when
   there's mismatch between the parent and child addresses and we
   haven't cached the child addresses yet.

2. Drop the namebuckets and entrybuckets

   Formerly, the namebuckets and entrybuckets were used to reduced the
   lock contention when accessing the double-linked lists stored in each
   bucket.  In the previous refactoring, the custom hashtable for the
   buckets has been replaced with isc_ht/isc_hashmap, so only a single
   item (mostly, see below) would end up in each bucket.

   Removing the entrybuckets has been straightforward, the only matching
   was done on the isc_sockaddr_t member of the dns_adbentry.

   Removing the zonebuckets required GLUEOK and HINTOK bits to be
   removed because the find could match entries with-or-without the bits
   set, and creating a custom key that stores the
   DNS_ADBFIND_STARTATZONE in the first byte of the key, so we can do a
   straightforward lookup into the hashtable without traversing a list
   that contains items with different flags.

3. Remove unassociated entries from ADB database

   Previously, the adbentries could live in the ADB database even after
   unlinking them from dns_adbnames.  Such entries would show up as
   "Unassociated entries" in the ADB dump.  The benefit of keeping such
   entries is little - the chance that we link such entry to a adbname
   is small, and it's simpler to evict unlinked entries from the ADB
   cache (and the hashtable) than create second LRU cleaning mechanism.

   Unlinked ADB entries are now directly deleted from the hash
   table (hashmap) upon destruction.

4. Cleanup expired entries from the hash table

   When buckets were still in place, the code would keep the buckets
   always allocated and never shrink the hash table (hashmap).  With
   proper reference counting in place, we can delete the adbnames from
   the hash table and the LRU list.

5. Stop purging the names early when we hit the time limit

   Because the LRU list is now time ordered, we can stop purging the
   names when we find a first entry that doesn't fullfil our time-based
   eviction criteria because no further entry on the LRU list will meet
   the criteria.

Future work:

1. Lock contention

   In this commit, the focus was on correctness of the data structure,
   but in the future, the lock contention in the ADB database needs to
   be addressed.  Currently, we use simple mutex to lock the hash
   tables, because we almost always need to use a write lock for
   properly purging the hashtables.  The ADB database needs to be
   sharded (similar to the effect that buckets had in the past).  Each
   shard would contain own hashmap and own LRU list.

2. Time-based purging

   The ADB names and entries stay intact when there are no lookups.
   When we add separate shards, a timer needs to be added for time-based
   cleaning in case there's no traffic hashing to the inactive shard.

3. Revisit the 30 minutes limit

   The ADB cache is capped at 30 minutes.  This needs to be revisited,
   and at least the limit should be configurable (in both directions).
2022-11-30 10:03:24 +01:00
Ondřej Surý 66d8bb03cb Create per-thread task for dns_adb resolver fetches
The dns_adb would serialize all fetches on a single task.  Create a
per-thread task, so the fetches will stay local to the thread that
initiated the fetch.
2022-11-30 10:03:24 +01:00
Ondřej Surý 0d4ef6fcd7 Expire namehooks when purging stale ADB names
Instead of trying to expire entries from adbentrybuckets, expire the
namehooks while purging the stale ADB names.
2022-11-30 10:03:23 +01:00
Ondřej Surý 557a71a6f9 Purge stale ADB names globaly, not per bucket
Before the refactoring, there was only few buckets with many names in
them, so cleaning up stale ADB names per-bucket made sense.  After the
refactoring, each bucket directly maps to ADB name, so purging has been
effectively disabled.

Create a global LRU list for ADB names (and ADB entries) and purge the
stale ADB names globally.
2022-11-30 10:03:23 +01:00
Ondřej Surý 327768e280 dns_adb: Remove deadnames and deadentries
Previously, the name and entry buckets were much larger, so the dead
names and entries were moved to a secondary list to be cleaned
later (f.e. after the already running fetch has been canceled).  After
the last refactoring, the bucket now contains only the name (entry)
itself and thus the extra list has a little use.  Remove the .deadnames
and .deadentries from dns_adbnamebucket_t and dns_adbentrybucket_t
structures.
2022-11-30 10:03:23 +01:00
Ondřej Surý f4229a92c9 Merge branch 'ondrej-eliminitate-rpzs-irefs' into 'main'
Refactor dns_rpz unit to use single reference counting

See merge request isc-projects/bind9!6864
2022-11-30 09:01:12 +00:00
Ondřej Surý 77659e7392 Refactor dns_rpz unit to use single reference counting
The dns_rpz_zones structure was using .refs and .irefs for strong and
weak reference counting.  Rewrite the unit to use just a single
reference counting + shutdown sequence (dns_rpz_destroy_rpzs) that must
be called by the creator of the dns_rpz_zones_t object.  Remove the
reference counting from the dns_rpz_zone structure as it is not needed
because the zone objects are fully embedded into the dns_rpz_zones
structure and dns_rpz_zones_t object must never be destroyed before all
dns_rpz_zone_t objects.

The dns_rps_zones_t reference counting uses the new ISC_REFCOUNT_TRACE
capability - enable by defining DNS_RPZ_TRACE in the dns/rpz.h header.

Additionally, add magic numbers to the dns_rpz_zone and dns_rpz_zones
structures.
2022-11-30 09:59:35 +01:00
Ondřej SurýandEvan Hunt 118ae66976 Add extra set of ISC_REFCOUNT_TRACE_{IMPL,DECL} macros
The new ISC_REFCOUNT_TRACE_{IMPL,DECL} macros can be used to add a
reference tracing capability to any unit using the reference counting.
It requires a little bit of extra work in each header as you can't have
a define from inside a define (see rpz.h), but it's fairly easy to add
tracing to any struct using reference counting with these macros.
2022-11-29 23:57:40 -08:00
Ondřej Surý bcfeaa98bc Merge branch '3639-remove-cache_cleaner-from-dns_cache-api' into 'main'
Remove the unused cache cleaning mechanism from dns_cache API

Closes #3639

See merge request isc-projects/bind9!7011
2022-11-30 06:15:46 +00:00
Ondřej SurýandEvan Hunt 576580eb3c Add CHANGES note for [GL #3639] 2022-11-29 13:48:33 -08:00
Ondřej SurýandEvan Hunt fa275a59da Remove the unused cache cleaning mechanism from dns_cache API
The dns_cache API contained a cache cleaning mechanism that would be
disabled for 'rbt' based cache.  As named doesn't have any other cache
implementations, remove the cache cleaning mechanism from dns_cache API.
2022-11-29 13:48:33 -08:00
Ondřej SurýandEvan Hunt 5e4a26856c Remove the dead external cache cleaning mechanism from RBTDB
The RBTDB has own cache cleaning mechanism and therefor the iterator
.cleaning member would never be set to true.  Remove the code that
checks for iterator->cleaning from the RBTDB.
2022-11-29 13:48:33 -08:00
Artem Boldariev 532615baf8 Merge branch 'artem-tcp-use-uv_try_write' into 'main'
TCP: use uv_try_write() to optimise sends

See merge request isc-projects/bind9!7129
2022-11-29 12:47:21 +00:00
Artem Boldariev 9b1c8c03fd TCP: use uv_try_write() to optimise sends
This commit make TCP code use uv_try_write() on best effort basis,
just like TCP DNS and TLS DNS code does.

This optimisation was added in
'caa5b6548a11da6ca772d6f7e10db3a164a18f8d' but, similar change was
mistakenly omitted for generic TCP code. This commit fixes that.
2022-11-29 13:41:10 +02:00
Michal Nowak 1b2ee33d20 Merge branch 'mnowak/llvm-15' into 'main'
Update clang to version 15

See merge request isc-projects/bind9!6754
2022-11-29 08:04:22 +00:00
Michal Nowak afdb41a5aa Update sources to Clang 15 formatting 2022-11-29 08:54:34 +01:00
Michal Nowak 26a42ed1ac Update clang to version 15 2022-11-29 08:54:34 +01:00
Mark Andrews eb8b22da4c Merge branch '3702-man-page-dig-1-typo-in-options' into 'main'
Resolve "man page dig(1): Typo in options"

Closes #3702

See merge request isc-projects/bind9!7131
2022-11-28 22:43:01 +00:00
Mark Andrews 3769266318 Fix typo in dig man page '+qr' should be '+noqr'
Reported by Fabian P. Schmidt
2022-11-29 08:47:18 +11:00
Tony Finch 64cff22109 Merge branch 'fanf-gen-faster' into 'main'
Speed up lib/dns/gen.c

See merge request isc-projects/bind9!7121
2022-11-28 10:03:44 +00:00
Tony FinchandTony Finch 96b6d78f75 Speed up lib/dns/gen.c
The `gen` program was causing a lengthy single-threaded pause in
the BIND build. When generating RDATATYPE_FROMTEXT_SW(), `gen` hit
the inner loop of `find_typename()` over 1.2 billion times. This
change avoids long deeply-nested loops, so `gen` now runs in less
than 10ms, about 300x faster.

No changes to the output.
2022-11-28 09:44:26 +00:00
Ondřej Surý 6e9e4cdcb2 Merge branch '3693-crash-when-restarting-server-with-active-statschannel-connection' into 'main'
Be more resilient when destroying the httpd requests

Closes #3693

See merge request isc-projects/bind9!7120
2022-11-25 16:15:08 +00:00
Ondřej Surý 32e0df2a13 Add CHANGES and release note for [GL #3693] 2022-11-25 16:22:07 +01:00
Ondřej Surý d8df29e37d Be more resilient when destroying the httpd requests
Don't restart reading in the send callback after the httpdmgr has been
shut down, and call httpd_request(..., ISC_R_SHUTDOWN, ...) when
shutting down the httpdmgr to reduce code duplication.
2022-11-25 16:20:34 +01:00
Ondřej Surý 249704228d Merge branch '3696-make-the-read-and-send-callbacks-more-synchronous' into 'main'
Make the netmgr read callback to be asynchronous only when needed

Closes #3696

See merge request isc-projects/bind9!7119
2022-11-25 15:19:51 +00:00
Ondřej Surý f3004da3a5 Make the netmgr send callback to be asynchronous only when needed
Previously, the send callback would be synchronous only on success.  Add
an option (similar to what other callbacks have) to decide whether we
need the asynchronous send callback on a higher level.

On a general level, we need the asynchronous callbacks to happen only
when we are invoking the callback from the public API.  If the path to
the callback went through the libuv callback or netmgr callback, we are
already on asynchronous path, and there's no need to make the call to
the callback asynchronous again.

For the send callback, this means we need the asynchronous path for
failure paths inside the isc_nm_send() (which calls isc__nm_udp_send(),
isc__nm_tcp_send(), etc...) - all other invocations of the send callback
could be synchronous, because those are called from the respective libuv
send callbacks.
2022-11-25 15:46:25 +01:00
Ondřej Surý 5ca49942a3 Make the netmgr read callback to be asynchronous only when needed
Previously, the read callback would be synchronous only on success or
timeout.  Add an option (similar to what other callbacks have) to decide
whether we need the asynchronous read callback on a higher level.

On a general level, we need the asynchronous callbacks to happen only
when we are invoking the callback from the public API.  If the path to
the callback went through the libuv callback or netmgr callback, we are
already on asynchronous path, and there's no need to make the call to
the callback asynchronous again.

For the read callback, this means we need the asynchronous path for
failure paths inside the isc_nm_read() (which calls isc__nm_udp_read(),
isc__nm_tcp_read(), etc...) - all other invocations of the read callback
could be synchronous, because those are called from the respective libuv
or netmgr read callbacks.
2022-11-25 15:46:15 +01:00
Tony Finch c1305baece Merge branch 'fanf-deduplicate-time-units' into 'main'
Deduplicate time unit conversion factors

See merge request isc-projects/bind9!7033
2022-11-25 13:47:15 +00:00
Tony FinchandTony Finch 00307fe318 Deduplicate time unit conversion factors
The various factors like NS_PER_MS are now defined in a single place
and the names are no longer inconsistent. I chose the _PER_SEC names
rather than _PER_S because it is slightly more clear in isolation;
but the smaller units are always NS, US, and MS.
2022-11-25 13:23:36 +00:00
Tom Krizek fdb285d95b Merge branch 'tkrizek/system-tests-start-stop-helpers' into 'main'
Simplify start/stop helper func in system tests

See merge request isc-projects/bind9!7123
2022-11-25 11:55:55 +00:00
Tom Krizek c100308b7d Simplify start/stop helper func in system tests
The system test should never attempt to start or stop any other server
than those that belong to that system test. Therefore, it is not
necessary to specify the system test name in function calls.

Additionally, this makes it possible to run the test inside a
differently named directory, as its name is automatically detected with
the $SYSTESTDIR variable. This enables running the system tests inside a
temporary directory.

Direct use of stop.pl was replaced with a more systematic approach to
use stop_servers helper function.
2022-11-25 09:27:33 +01:00
Mark Andrews 6678f672ab Merge branch '3638-tls-settings-for-primaries-not-saved-for-catalog-zone-entries' into 'main'
Resolve "TLS settings for primaries not saved for catalog zone entries."

Closes #3638

See merge request isc-projects/bind9!7010
2022-11-24 22:52:53 +00:00
Mark Andrews 7e223f5e55 Add release note for [GL #3638] 2022-11-25 08:51:09 +11:00
Mark Andrews de3bd0d3d6 Add CHANGES note for [GL #3638] 2022-11-25 08:51:07 +11:00
Mark Andrews bb66ef2a47 Add catalog zone that requires TLS for all transfers
Both the catalog zone (catalog-tls.example) the zone managed using
the catalog zone (tls1.example) require TLS and a TSIG for zone
transfers.
2022-11-25 08:50:36 +11:00
Mark Andrews b95d089751 Fix log messages incorrectly logged at error
The log message "got TLS configuration for zone transfer" is not
an error, setting to info.
2022-11-25 08:50:36 +11:00
Mark Andrews 65f2512315 TLS setting of primaries with catalog zones where being ignored
Extract the tlss values if present from the ipkeylist entry and add
the resulting tls setting to the constructed configuration for the
primary.

When comparing catalog zone entries for reuse also check the
masters.tlss values for equality.
2022-11-25 08:50:36 +11:00
Evan Hunt e2bbf38cdb Merge branch '3680-remove-nupdates' into 'main'
remove unused 'nupdates' field from client

Closes #3680

See merge request isc-projects/bind9!7098
2022-11-24 00:01:56 +00:00
Evan Hunt 18606f5276 remove unused 'nupdates' field from client
the 'nupdates' field was originally used to track whether a client
was ready to shut down, along with other similar counters nreads,
nrecvs, naccepts and nsends. this is now tracked differently, but
nupdates was overlooked when the other counters were removed.
2022-11-23 23:44:10 +00:00
Michal Nowak 55491d6b0a Merge branch '3310-build-contrib-in-ci' into 'main'
Build contrib in CI & associated fixes

Closes #3310

See merge request isc-projects/bind9!6363
2022-11-23 17:14:00 +00:00
Michal Nowak 445a90fb78 Help gcovr find contrib files 2022-11-23 17:18:46 +01:00
Michal Nowak 35e44978b5 Add install target for Perl DLZ module
Perl DLZ module Makefile lacked "install" target, add it as we want to
test DLZ module installation in the CI.
2022-11-23 17:17:15 +01:00
Michal Nowak 69b7e4362d Disable compound-token-split-by-macro warning with Clang
Perl DLZ module compilation with Clang produces the following warning:

    /usr/lib/x86_64-linux-gnu/perl/5.32/CORE/zaphod32_hash.h:150:5: warning: '(' and '{' tokens introducing statement expression appear in different macro expansion contexts [-Wcompound-token-split-by-macro]
        ZAPHOD32_SCRAMBLE32(state[0],0x9fade23b);
        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    /usr/lib/x86_64-linux-gnu/perl/5.32/CORE/zaphod32_hash.h:80:38: note: expanded from macro 'ZAPHOD32_SCRAMBLE32'
    #define ZAPHOD32_SCRAMBLE32(v,prime) STMT_START {  \
                                         ^~~~~~~~~~
    /usr/lib/x86_64-linux-gnu/perl/5.32/CORE/perl.h:666:29: note: expanded from macro 'STMT_START'
    #   define STMT_START   (void)( /* gcc supports "({ STATEMENTS; })" */
                                  ^
    /usr/lib/x86_64-linux-gnu/perl/5.32/CORE/zaphod32_hash.h:150:5: note: '{' token is here
        ZAPHOD32_SCRAMBLE32(state[0],0x9fade23b);
        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    /usr/lib/x86_64-linux-gnu/perl/5.32/CORE/zaphod32_hash.h:80:49: note: expanded from macro 'ZAPHOD32_SCRAMBLE32'
    #define ZAPHOD32_SCRAMBLE32(v,prime) STMT_START {  \
                                                    ^
2022-11-23 17:17:15 +01:00
Michal Nowak 4a4a91b012 Build contrib dlz modules in the CI 2022-11-23 17:17:15 +01:00
Michal Nowak 4affc436d3 Leverage CFLAGS from environment in contrib Makefiles 2022-11-23 17:17:15 +01:00
Michal Nowak 99912ed2f7 Fix statement may fall through warnings in dlz_ldap_dynamic.c
dlz_ldap_dynamic.c: In function ‘dlz_create’:
    dlz_ldap_dynamic.c:971:20: warning: this statement may fall through [-Wimplicit-fallthrough=]
      971 |                 if (result != ISC_R_SUCCESS) {
          |                    ^
    dlz_ldap_dynamic.c:974:9: note: here
      974 |         case 11:
          |         ^~~~
    dlz_ldap_dynamic.c:976:20: warning: this statement may fall through [-Wimplicit-fallthrough=]
      976 |                 if (result != ISC_R_SUCCESS) {
          |                    ^
    dlz_ldap_dynamic.c:979:9: note: here
      979 |         case 10:
          |         ^~~~
    dlz_ldap_dynamic.c:980:20: warning: this statement may fall through [-Wimplicit-fallthrough=]
      980 |                 if (strlen(argv[9]) > 0) {
          |                    ^
    dlz_ldap_dynamic.c:987:9: note: here
      987 |         case 9:
          |         ^~~~
2022-11-23 17:17:15 +01:00
Michal Nowak 76c8c58d54 Fix compilation warnings in dlz_wildcard_dynamic.c
dlz_wildcard_dynamic.c: In function ‘dlz_lookup’:
    dlz_wildcard_dynamic.c:227:14: warning: variable ‘origin’ set but not used [-Wunused-but-set-variable]
      227 |         bool origin = true;
          |              ^~~~~~
    dlz_wildcard_dynamic.c: In function ‘dlz_lookup’:
    dlz_wildcard_dynamic.c:252:28: warning: assignment discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
      252 |                 cd->record = "@";
          |                            ^
    dlz_wildcard_dynamic.c: In function ‘dlz_authority’:
    dlz_wildcard_dynamic.c:328:22: warning: unused variable ‘origin’ [-Wunused-variable]
      328 |                 bool origin;
          |                      ^~~~~~
    dlz_wildcard_dynamic.c:312:25: warning: unused variable ‘name’ [-Wunused-variable]
      312 |         const char *p, *name = "@";
          |                         ^~~~
    dlz_wildcard_dynamic.c: In function ‘dlz_create’:
    dlz_wildcard_dynamic.c:441:23: warning: comparison of integer expressions of different signedness: ‘int’ and ‘unsigned int’ [-Wsign-compare]
      441 |         for (i = 4; i < argc; i += 4) {
          |                       ^
2022-11-23 17:17:15 +01:00
Michal Nowak 60f68dc0d6 Fix compilation warnings in dlz_sqlite3_dynamic.c
dlz_sqlite3_dynamic.c: In function ‘dlz_sqlite3_fetch_row’:
    dlz_sqlite3_dynamic.c:447:31: warning: comparison of integer expressions of different signedness: ‘int’ and ‘unsigned int’ [-Wsign-compare]
      447 |                 if (rs->pnRow > 0U && rs->curRow < rs->pnRow) {
          |                               ^
    dlz_sqlite3_dynamic.c:447:50: warning: comparison of integer expressions of different signedness: ‘unsigned int’ and ‘int’ [-Wsign-compare]
      447 |                 if (rs->pnRow > 0U && rs->curRow < rs->pnRow) {
          |                                                  ^
2022-11-23 17:17:15 +01:00
Michal Nowak 587ea10567 Fix warnings in dlz_mysqldyn_mod.c
dlz_mysqldyn_mod.c: In function ‘dlz_findzonedb’:
    dlz_mysqldyn_mod.c:1079:73: warning: unused parameter ‘methods’ [-Wunused-parameter]
     1079 | dlz_findzonedb(void *dbdata, const char *name, dns_clientinfomethods_t *methods,
          |                                                ~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~
    dlz_mysqldyn_mod.c:1080:34: warning: unused parameter ‘clientinfo’ [-Wunused-parameter]
     1080 |                dns_clientinfo_t *clientinfo) {
          |                ~~~~~~~~~~~~~~~~~~^~~~~~~~~~
    dlz_mysqldyn_mod.c: In function ‘dlz_lookup’:
    dlz_mysqldyn_mod.c:1111:63: warning: unused parameter ‘methods’ [-Wunused-parameter]
     1111 |            dns_sdlzlookup_t *lookup, dns_clientinfomethods_t *methods,
          |                                      ~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~
    dlz_mysqldyn_mod.c: In function ‘build_query’:
    dlz_mysqldyn_mod.c:465:19: warning: pointer ‘item’ used after ‘free’ [-Wuse-after-free]
      465 |              item = DLZ_LIST_NEXT(item, link))
    dlz_mysqldyn_mod.c:470:17: note: call to ‘free’ here
      470 |                 free(item);
          |                 ^~~~~~~~~~
2022-11-23 17:17:15 +01:00
Michal Nowak be928dbba2 Fix compilation warnings in dlz_perl_driver.c
dlz_perl_driver.c: In function ‘dlz_version’:
    dlz_perl_driver.c:116:27: warning: unused parameter ‘flags’ [-Wunused-parameter]
      116 | dlz_version(unsigned int *flags) {
          |             ~~~~~~~~~~~~~~^~~~~
    In file included from /usr/lib64/perl5/CORE/perl.h:5685,
                     from dlz_perl_driver.c:33:
    dlz_perl_driver.c: In function ‘dlz_allnodes’:
    /usr/lib64/perl5/CORE/pp.h:162:26: warning: value computed is not used [-Wunused-value]
      162 | #define POPs            (*sp--)
          |                         ~^~~~~~
    dlz_perl_driver.c:151:17: note: in expansion of macro ‘POPs’
      151 |                 POPs;
          |                 ^~~~
    dlz_perl_driver.c: In function ‘dlz_allowzonexfr’:
    /usr/lib64/perl5/CORE/pp.h:162:26: warning: value computed is not used [-Wunused-value]
      162 | #define POPs            (*sp--)
          |                         ~^~~~~~
    dlz_perl_driver.c:251:17: note: in expansion of macro ‘POPs’
      251 |                 POPs;
          |                 ^~~~
    dlz_perl_driver.c: In function ‘dlz_findzonedb’:
    /usr/lib64/perl5/CORE/pp.h:162:26: warning: value computed is not used [-Wunused-value]
      162 | #define POPs            (*sp--)
          |                         ~^~~~~~
    dlz_perl_driver.c:328:17: note: in expansion of macro ‘POPs’
      328 |                 POPs;
          |                 ^~~~
    dlz_perl_driver.c: In function ‘dlz_lookup’:
    /usr/lib64/perl5/CORE/pp.h:162:26: warning: value computed is not used [-Wunused-value]
      162 | #define POPs            (*sp--)
          |                         ~^~~~~~
    dlz_perl_driver.c:407:17: note: in expansion of macro ‘POPs’
      407 |                 POPs;
          |                 ^~~~
    dlz_perl_driver.c:472:1: error: no previous prototype for ‘missing_perl_method’ [-Werror=missing-prototypes]
      472 | missing_perl_method(const char *perl_class_name, PerlInterpreter *my_perl)
          | ^~~~~~~~~~~~~~~~~~~
    dlz_perl_driver.c: In function ‘missing_perl_method’:
    dlz_perl_driver.c:485:9: error: ISO C90 forbids array ‘full_name’ whose size cannot be evaluated [-Werror=vla]
      485 |         char full_name[BUF_LEN];
          |         ^~~~
    dlz_perl_driver.c: In function ‘dlz_create’:
    dlz_perl_driver.c:613:13: warning: suggest parentheses around assignment used as truth value [-Wparentheses]
      613 |         if (missing_method_name = missing_perl_method(perl_class_name, my_perl))
          |             ^~~~~~~~~~~~~~~~~~~
    /usr/lib64/perl5/CORE/pp.h:162:26: warning: value computed is not used [-Wunused-value]
      162 | #define POPs            (*sp--)
          |                         ~^~~~~~
    dlz_perl_driver.c:657:17: note: in expansion of macro ‘POPs’
      657 |                 POPs;
          |                 ^~~~
    dlz_perl_driver.c:502:15: warning: unused variable ‘init_args’ [-Wunused-variable]
      502 |         char *init_args[] = { NULL, NULL };
          |               ^~~~~~~~~
2022-11-23 17:17:14 +01:00
Michal Nowak 1517e4c114 Merge branch 'mnowak/gcovr-cleanup' into 'main'
Various gcovr clean-ups

See merge request isc-projects/bind9!7104
2022-11-23 14:03:27 +00:00
Michal Nowak fdad6ff7c7 Restructure inline-function helpers for code coverage 2022-11-23 14:54:54 +01:00
Michal Nowak 6b1dd7d6b1 Drop redundant code coverage helper
The "hash.h" file does not need to be copied to "lib/dns/" for the gcovr
tool to generate the code coverage report, as it has been copied
already.
2022-11-23 14:54:54 +01:00
Michal Nowak 8b9c04342d Drop buffer.h helper for fuzz directory
The "fuzz" directory is no longer included in the code coverage report
and the associated buffer.h helper is no longer needed.
2022-11-23 14:54:54 +01:00
Michal Nowak 3b5e9666c6 Exclude fuzz directory from code coverage report
gcovr fails to process fuzz/old.gcda and fuzz/old.gcno files after !7045
MR with:

    (WARNING) GCOV produced the following errors processing /builds/isc-projects/bind9/fuzz/old.gcda:
    	Cannot open source file ../../fuzz/old.c
    Cannot open source file ../../lib/dns/include/dns/compress.h
    Cannot open source file ../../lib/isc/include/isc/buffer.h
    ...
    (gcovr could not infer a working directory that resolved it.)

Given that code coverage inspection is meant only for BIND 9 code and
not its tests and auxiliary tools, the "fuzz" directory should be
excluded from being included in the code coverage report.
2022-11-23 14:54:54 +01:00
Matthijs Mekking f9018a63cf Merge branch '3667-deprecate-auto-dnssec' into 'main'
Deprecate auto-dnssec

Closes #3667

See merge request isc-projects/bind9!7075
2022-11-23 10:00:33 +00:00
Matthijs Mekking fde1d89d03 Add CHANGES and release note for GL #3667
Announce deprecation of 'auto-dnssec'.
2022-11-23 09:46:16 +01:00
Matthijs Mekking f9845dd128 Deprecate auto-dnssec
Deprecate auto-dnssec, add specific log warning to migrate to
dnssec-policy.
2022-11-23 09:46:16 +01:00
Michal Nowak 9128e540f0 Merge branch 'mnowak/fedora-37' into 'main'
Add Fedora 37

See merge request isc-projects/bind9!7062
2022-11-21 12:46:52 +00:00
Michal Nowak b293b2c638 Add Fedora 37 2022-11-21 12:48:40 +01:00
Matthijs Mekking 70bc6cc554 Merge branch 'matthijs-remove-key-operations-after-update' into 'main'
Remove dynamic update DNSSEC management

Closes #3686

See merge request isc-projects/bind9!7043
2022-11-18 10:24:35 +00:00
Matthijs Mekking c7cae33cc3 Add CHANGES and release note for removed feature
Also mention that 'dnssec-secure-to-insecure' is obsoleted.
2022-11-18 11:05:11 +01:00
Matthijs Mekking f71a6692db Obsolete dnssec-secure-to-insecure option
Now that the key management operations using dynamic updates feature
has been removed, the 'dnssec-secure-to-insecure' option has become
obsoleted.
2022-11-18 11:04:17 +01:00
Matthijs Mekking 93441714ad Remove dynamic update key management documentation
Remove the text from the ARM and DNSSEC guide that describes how to do
key and denial of existence operations using dynamic update. Add a new
section about DNSSEC multi-signer models, but no longer suggest using
dynamic update and auto-dnssec allow.
2022-11-18 11:04:17 +01:00
Matthijs Mekking b6c2776df5 Remove dynamic update key management code
Remove code that triggers key and denial of existence management
operations. Dynamic update should no longer be used to do DNSSEC
maintenance (other than that of course signatures need to be
created for the new zone contents).
2022-11-18 11:04:17 +01:00
Matthijs Mekking cd2f619842 Remove dynamic update key management tests
Remove test cases that rely upon key and denial of existence
management operations triggered by dynamic updates.

The autosign system test needed a bit more care than just removing
because the test cases are dependent on each other, so there are some
additional tweaks such as setting the NSEC3PARAM via rndc signing,
and renaming zone input files. In the process, some additional
debug output files have been added, and a 'ret' fail case overwrite
was fixed.
2022-11-18 11:04:17 +01:00
Tony Finch 8272cc23a3 Merge branch '3655-decompress-faster' into 'main'
Simplify and speed up DNS name decompression

Closes #3655

See merge request isc-projects/bind9!7045
2022-11-17 09:06:12 +00:00
Tony FinchandTony Finch 04f3000dfc Fuzzing and benchmarking for dns_name_fromwire()
Since this is very sensitive code which has often had security
problems in many DNS implementations, it needs a decent amount of
validation. This fuzzer ensures that the new code has the same output
as the old code, and that it doesn't take longer than a second.

The benchmark uses the fuzzer's copy of the old dns_name_fromwire()
code to compare a number of scenarios: many compression pointers, many
labels, long labels, random data, with/without downcasing.
2022-11-17 08:45:17 +00:00
Tony FinchandTony Finch 1c0f607811 Simplify and speed up DNS name decompression
The aim is to do less work per byte:

  * Check the bounds for each label, instead of checking the
    bounds for each character.

  * Instead of copying one character at a time from the wire to
    the name, copy entire runs of sequential labels using memmove()
    to make the most of its fast loop.

  * To remember where the name ends, we only need to set the end
    marker when we see a compression pointer or when we reach the
    root label. There is no need to check if we jumped back and
    conditionally update the counter for every character.

  * To parse a compression pointer, we no longer take a diversion
    around the outer loop in between reading the upper byte of the
    pointer and the lower byte.

  * The parser state machine is now implicit in the instruction
    pointer, instead of being an explicit variable. Similarly,
    when we reach the root label we break directly out of the loop
    instead of setting a second state machine variable.

  * DNS_NAME_DOWNCASE is never used with dns_name_fromwire() so
    that option is no longer supported.

I have removed this comment which dated from January 1999 when
dns_name_fromwire() was first introduced:

   /*
    * Note:  The following code is not optimized for speed, but
    * rather for correctness.  Speed will be addressed in the future.
    */

No functional change, apart from removing support for the unused
DNS_NAME_DOWNCASE option. The new code is about 2x faster than the
old code: best case 11x faster, worst case 1.4x faster.
2022-11-17 08:45:15 +00:00
Tony FinchandTony Finch e0c9692341 Clean up remnants of label types
There were a few comments referring obliquely to different kinds of
labels, which became obsolete a long time ago.
2022-11-17 08:44:27 +00:00
Tony FinchandTony Finch 2bb6208c57 Avoid unspecified behaviour in name_test
C does not make any guarantees about the value of padding in a
structure, so bytewise comparison of two semantically equal structures
with padding can be spuriously non-equal due to non-equal padding
bytes.

Compare each member of name.attributes individually to avoid this
problem.
2022-11-17 08:44:27 +00:00
Mark Andrews 2001a0cdeb Merge branch '3607-apex-in-name_external-may-be-invalid-when-using-dual-stack-servers' into 'main'
Resolve "apex in name_external may be invalid when using dual stack servers"

Closes #3607

See merge request isc-projects/bind9!6924
2022-11-17 01:50:10 +00:00
Mark Andrews 8a2149f502 Add CHANGES note for [GL #3607] 2022-11-17 12:23:45 +11:00
Mark Andrews f946133ec9 Add system test for dual-stack-servers with possible DNAME response
Create a zone that triggers DNAME owner name checks in a zone that
is only reachable using a dual stack server.  The answer contains
a name that is higher in the tree than the query name.

e.g.
	foo.v4only.net.	CNAME	v4only.net.
	v4only.net.	A	10.0.0.1

ns4 is serving the test zone (ipv4-only)
ns6 is the root server for this test (dual stacked)
ns7 is acting as the dual stack server (dual stacked)
ns9 is the server under test (ipv6-only)
2022-11-17 12:23:45 +11:00
Mark Andrews a35c34e10f Support starting and stopping IPv6 only servers
Look for $testdir/$server/named.ipv6-only and use
fd92:7065:b8e:ffff::$n instead of 10.53.0.$n to
communicate with the server.
2022-11-17 12:23:45 +11:00
Mark Andrews dfbffd77f9 Select the appropriate namespace when using a dual stack server
When using dual-stack-servers the covering namespace to check whether
answers are in scope or not should be fctx->domain.  To do this we need
to be able to distingish forwarding due to forwarders clauses and
dual-stack-servers.  A new flag FCTX_ADDRINFO_DUALSTACK has been added
to signal this.
2022-11-17 12:23:45 +11:00
Mark Andrews 3921181e0d Merge branch '1905-check-wildcard-in-checkconf-z' into 'main'
Fix 'named-checkconf -z' was ignoring check-wildcard settings in named.conf

See merge request isc-projects/bind9!7063
2022-11-16 22:55:00 +00:00
Mark Andrews 708dadac59 Check 'named-checkconf -z' and check-wildcard
Add tests to check the behavior of 'named-checkconf -z' and
check-wildcard setting in named.conf.
2022-11-17 09:35:03 +11:00
Mark Andrews dfc5c1e018 named-checkzone -z ignored the check-wildcard option
Lookup and set the wildcard option according to the configuration
settings.  The default is on as per bin/named/config.c.
2022-11-17 09:35:00 +11:00
Michal Nowak 0b5a58202e Merge tag 'v9_19_7'
BIND 9.19.7
2022-11-16 15:10:51 +01:00
Michal Nowak 736738a72c Merge branch 'mnowak/openbsd-7.2' into 'main'
Add OpenBSD 7.2

See merge request isc-projects/bind9!7034
2022-11-15 07:31:46 +00:00
Michal Nowak b239e6870d Add OpenBSD 7.2 2022-11-15 08:06:37 +01:00
Michal Nowak b1c273d73c Merge branch '2265-fix-and-check-bashisms' into 'main'
Fix and check bashisms in system test

Closes #2265

See merge request isc-projects/bind9!6630
2022-11-14 19:59:19 +00:00
Michal Nowak 47a7c5123a Add checkbashisms CI job 2022-11-14 19:54:42 +00:00
Michal Nowak d34c7ae227 Replace "sha1sum" with "openssl sha1 -r"
"sha1sum" is part of GNU Coreutils, neither BIND 9 dependency nor POSIX.
Replace it with "openssl sha1 -r" as OpenSSL is BIND 9 dependency.
2022-11-14 19:54:42 +00:00
Michal Nowak ae33a8ddea Rename $HOSTNAME to $HOST_NAME to silence checkbashisms
checkbashisms warns about possible reliance on HOSTNAME environmental
variable which Bash sets to the name of the current host, and some
commands may leverage it:

    possible bashism in builtin/tests.sh line 199 ($HOST(TYPE|NAME)):
    grep "^\"$HOSTNAME\"$" dig.out.ns1.$n > /dev/null || ret=1
    possible bashism in builtin/tests.sh line 221 ($HOST(TYPE|NAME)):
    grep "^\"$HOSTNAME\"$" dig.out.ns2.$n > /dev/null || ret=1
    possible bashism in builtin/tests.sh line 228 ($HOST(TYPE|NAME)):
    grep "^; NSID: .* (\"$HOSTNAME\")$" dig.out.ns2.$n > /dev/null || ret=1

We don't use the variable this way but rename it to HOST_NAME to silence
the tool.
2022-11-14 19:54:42 +00:00
Michal Nowak 00c3b1e309 Remove no-op assignment from kasp/tests.sh
"next_key_event_threshold" is assigned with
"next_key_event_threshold+i", but "i" is empty (never set, nor used
afterwards).

posh, the Policy-compliant Ordinary SHell, failed on this assignment
with:

    tests.sh:253: : unexpected `end of expression'
2022-11-14 19:54:42 +00:00
Michal Nowak 02a4a95395 Remove unused $@ array from cds/setup.sh
posh, the Policy-compliant Ordinary SHell, failed with:

    setup.sh:57: @: parameter not set
2022-11-14 19:54:42 +00:00
Michal Nowak ac3fcb612d Drop interpolated string replacement
Interpolated string is Bashism:

    possible bashism in bin/tests/system/engine_pkcs11/setup.sh line 34 ($'...' should be "$(printf '...')"):
            pkcs11-tool --module $SOFTHSM2_MODULE --token-label "softhsm2-engine_pkcs11" -l -k --key-type $type:$bits --label "${label}" --id "${p11id//$'\n'/}" --pin $(cat $PWD/pin) > pkcs11-tool.out.$zone.$id 2> pkcs11-tool.err.$zone.$id || return 1
    possible bashism in bin/tests/system/engine_pkcs11/setup.sh line 34 (${parm/?/pat[/str]}):
            pkcs11-tool --module $SOFTHSM2_MODULE --token-label "softhsm2-engine_pkcs11" -l -k --key-type $type:$bits --label "${label}" --id "${p11id//$'\n'/}" --pin $(cat $PWD/pin) > pkcs11-tool.out.$zone.$id 2> pkcs11-tool.err.$zone.$id || return 1
    possible bashism in bin/tests/system/keyfromlabel/tests.sh line 27 ($'...' should be "$(printf '...')"):
            pkcs11-tool --module $SOFTHSM2_MODULE --token-label "softhsm2-keyfromlabel" -l -k --key-type $type:$bits --label "${label}" --id "${p11id//$'\n'/}" --pin $(cat $PWD/pin) > pkcs11-tool.out.$zone.$id || return 1
    possible bashism in bin/tests/system/keyfromlabel/tests.sh line 27 (${parm/?/pat[/str]}):
            pkcs11-tool --module $SOFTHSM2_MODULE --token-label "softhsm2-keyfromlabel" -l -k --key-type $type:$bits --label "${label}" --id "${p11id//$'\n'/}" --pin $(cat $PWD/pin) > pkcs11-tool.out.$zone.$id || return 1

The replacement is actually not needed as $p11id holds only one line.

Also see https://www.shellcheck.net/wiki/SC3003 and
https://www.shellcheck.net/wiki/SC3060.
2022-11-14 19:54:42 +00:00
Michal Nowak 9eb2f6b0e8 Join two rndc lines not to confuse checkbashisms
checkbashisms gets confused by the rndc command being on two lines:

    possible bashism in bin/tests/system/nzd2nzf/tests.sh line 37 (type):
    rndccmd 10.53.0.1 addzone "added.example { type primary; file \"added.db\";
2022-11-14 19:54:42 +00:00
Michal Nowak 7640fc5b39 Replace string comparisons with integer comparisons
checkbashisms reports Bash-style ("==") string comparisons inside test/[
command:

    possible bashism in bin/tests/system/checkconf/tests.sh line 105 (should be 'b = a'):
                    if [ $? == 0 ]; then echo_i "failed"; ret=1; fi
    possible bashism in bin/tests/system/keyfromlabel/tests.sh line 62 (should be 'b = a'):
                    test $ret == 0 || continue
    possible bashism in bin/tests/system/keyfromlabel/tests.sh line 79 (should be 'b = a'):
                    test $ret == 0 || continue
2022-11-14 19:54:42 +00:00
Michal Nowak 9e68997cbb Add shell interpreter line where missing
The checkbashisms script reports errors like this one:

    script util/check-line-length.sh does not appear to have a #! interpreter line;
    you may get strange results
2022-11-14 19:54:42 +00:00
Ondřej Surý 845aa359a5 Merge branch '3676-deprecate-operating-system-resource-limits' into 'main'
Deprecate setting operating system limits from named.conf

Closes #3676

See merge request isc-projects/bind9!7078
2022-11-14 17:18:52 +00:00
Ondřej Surý 65156afb8c Add CHANGES and release note [GL #3676] 2022-11-14 16:48:52 +01:00
Ondřej Surý 379929e052 Deprecate setting operating system limits from named.conf
It was possible to set operating system limits (RLIMIT_DATA,
RLIMIT_STACK, RLIMIT_CORE and RLIMIT_NOFILE) from named.conf.  It's
better to leave these untouched as setting these is responsibility of
the operating system and/or supervisor.

Deprecate the configuration options and remove them in future BIND 9
release.
2022-11-14 16:48:52 +01:00
Ondřej Surý 9625426dd9 Merge branch '3664-remote-with-tuning-large' into 'main'
Remove the last remnants of --with-tuning=large

Closes #3664

See merge request isc-projects/bind9!7052
2022-11-14 09:03:28 +00:00
Ondřej Surý 24bda93dde Add CHANGES and release note for [GL #3664] 2022-11-14 10:01:36 +01:00
Ondřej Surý 76725718f4 Update the build requirements in the ARM
The build requirements have been updated to state that libcap is now
required on Linux and removed mention of --with-tuning configure option.
2022-11-14 10:01:20 +01:00
Ondřej Surý 0bf7014f85 Remove the last remnants of --with-tuning=large
The small/large tuning has been completely removed from the code with
last remnant of the dead code in ns_interfacemgr.  Remove the dead code
and the configure option.
2022-11-14 10:01:20 +01:00
Mark Andrews 4613dca35b Merge branch '3468-statistics-xml-rendering-does-not-seem-to-protect-against-concurrent-changes' into 'main'
Resolve "Statistics XML rendering does not seem to protect against concurrent changes"

Closes #3468

See merge request isc-projects/bind9!6695
2022-11-11 15:56:04 +00:00
Mark Andrews a4383c906c Add CHANGES note for [GL #3468] 2022-11-11 15:26:46 +00:00
Mark Andrews f053d5b414 Have dns_zt_apply lock the zone table
There were a number of places where the zone table should have been
locked, but wasn't, when dns_zt_apply was called.

Added a isc_rwlocktype_t type parameter to dns_zt_apply and adjusted
all calls to using it.  Removed locks in callers.
2022-11-11 15:26:11 +00:00
Matthijs Mekking 849785cc20 Merge branch 'matthijs-tweak-kasp-test' into 'main'
Tweak kasp system test script

See merge request isc-projects/bind9!7064
2022-11-11 14:03:46 +00:00
Matthijs Mekking 6ef0417274 Tweak kasp system test script
The retry 3 times when checking signatures did not make sense because
at this point the input file does not change.

Raise the number of retries when checking the apex DNSKEY response to
reduce the number of intermittent failures due to unexpected delays.
2022-11-11 15:02:44 +01:00
Michal Nowak c6877fe053 Merge branch 'mnowak/add-git-fsck' into 'main'
Verify Git repo validity

See merge request isc-projects/bind9!7048
2022-11-11 13:39:01 +00:00
Michal Nowak be83e203ce Verify Git repo validity
This check should help catching issues like [1] early.

[1] https://gitlab.isc.org/isc-projects/bind9/-/wikis/%22main%22-branch-partial-history-rewrite-in-August-2022
2022-11-11 13:55:05 +01:00
Matthijs Mekking 9e6c449f7b Merge branch '3570-nsec3param-ttl-default-soa-minimum' into 'main'
Change default NSEC3PARAM TTL

Closes #3570

See merge request isc-projects/bind9!6897
2022-11-11 11:07:15 +00:00
Matthijs Mekking 16c827599f Test NSEC3PARAM TTL is not preserved
Now that we are setting the NSEC3PARAM TTL to SOA MINIMUM, we should
not preserve the TTL, otherwise a SOA MINIMUM change would not be
picked up.
2022-11-11 12:06:33 +01:00
Matthijs Mekking 0f99020748 Add change and release note for #3570
Feature change.
2022-11-11 12:06:33 +01:00
Matthijs Mekking 53eab06083 Change default TTL of NSEC3PARAM to SOA MINIMUM
Despite the RFC says that the NSEC3PARAM is not something that is
intended for the resolver to be cached, and thus the TTL of 0 is most
logical, a zero TTL RRset can be abused by bad actors.

Change the default to SOA MINIMUM.
2022-11-11 12:06:33 +01:00
Matthijs Mekking f51901eaca Add test that checks NSEC3PARAM TTL
The TTL should be equal to the SOA MINIMUM by default.
2022-11-11 12:06:33 +01:00
Ondřej Surý 9eaa7e7d37 Merge branch 'ondrej-dns_view-resolver-can-be-NULL' into 'main'
Don't use view->resolver directly when priming in dns_view_find()

See merge request isc-projects/bind9!7065
2022-11-11 10:49:35 +00:00
Ondřej Surý 417097450a Check view->adb in dns_view_flushcache()
The call to dns_view_flushcache() is done under exclusive mode, but we
still need to check if view->adb is still attached before calling
dns_adb_flush() because the shutdown might have been already
initialized.  This most likely only a theoretical problem on shutdown
because there's either no way how to initiate cache flush when shutting
down or very slim window where the `rndc flush` would have to hit the
slim time during named shutdown.
2022-11-11 11:47:44 +01:00
Ondřej Surý a8ba240325 Don't use view->resolver directly when priming in dns_view_find()
When starting priming from dns_view_find(), the dns_view shutdown could
be initiated by different thread, detaching from the resolver.  Use
dns_view_getresolver() to attach to the resolver under view->lock, so we
don't try to call dns_resolver_prime() with NULL pointer.

There are more accesses to view->resolver, (and also view->adb and
view->requestmgr that suffer from the same problem) in the dns_view
module, but they are all done in exclusive mode or under a view->lock.
2022-11-11 11:47:44 +01:00
Petr Špaček 54a425ab57 Merge branch '3669-update-policy-external-synchronous-doc' into 'main'
Document that update-policy external is synchronous

See merge request isc-projects/bind9!7066
2022-11-11 09:37:40 +00:00
Petr Špaček 7d352741a0 Document that update-policy external is synchronous 2022-11-11 10:32:14 +01:00
Ondřej Surý ba5bd5f104 Merge branch '3670-fix-http-headers-test' into 'main'
Update the HTTP headers test to check for 101 headers

Closes #3670

See merge request isc-projects/bind9!7070
2022-11-11 09:23:43 +00:00
Ondřej Surý 9e5edb0b26 Update the HTTP headers test to check for 101 headers
When we bumped the number of allowed HTTP headers to 100, we forgot to
bump the number in the system test.  Bump the number in the system test
too.
2022-11-11 09:19:41 +01:00
Ondřej Surý d1d0c93ac0 Merge branch '3670-bump-statschannel-headers' into 'main'
Bump the allowed HTTP headers in statschannel to 100

Closes #3670

See merge request isc-projects/bind9!7068
2022-11-10 18:27:44 +00:00
Ondřej Surý c65666dc97 Add CHANGES and release note for [GL #3670] 2022-11-10 16:41:25 +01:00
Ondřej Surý e4654d1a6a Bump the allowed HTTP headers in statschannel to 100
Firefox 90+ apparently sends more than 10 headers, so we need to bump
the number to some higher number.  Bump it to 100 just to be on a save
side, this is for internal use only anyway.
2022-11-10 16:34:26 +01:00
Ondřej Surý 48a926536e Merge branch 'ondrej-add-isc_hashmap' into 'main'
Add isc_hashmap API that implements Robin Hood hashing

See merge request isc-projects/bind9!6790
2022-11-10 14:08:30 +00:00
Ondřej Surý 86f3cba854 Add CHANGES note for [GL !6790] 2022-11-10 15:07:19 +01:00
Ondřej Surý b7eabb6394 Use isc_hashmap instead of isc_ht in the dns_resolver API
Replace the use of isc_ht API with isc_hashmap API in the dns_resolver
implementation.  This requires extending the fctxbucket_t structure to
include keysize and copy of the key because the isc_hashmap API needs
the raw key in case of resizing the hashmap table.
2022-11-10 15:07:19 +01:00
Ondřej Surý e1220a2d4f Use isc_hashmap instead of isc_ht in the dns_adb API
Replace the use of isc_ht API with isc_hashmap API in the dns_adb
database implementation.  This requires extending the
dns_adbnamebucket_t and dns_adbentrybucket_t structures to include
keysize and copy of the key because the isc_hashmap API needs the raw
key in case of resizing the hashmap table.
2022-11-10 15:07:19 +01:00
Ondřej Surý f46ce447a6 Add isc_hashmap API that implements Robin Hood hashing
Add new isc_hashmap API that differs from the current isc_ht API in
several aspects:

1. It implements Robin Hood Hashing which is open-addressing hash table
   algorithm (e.g. no linked-lists)

2. No memory allocations - the array to store the nodes is made of
   isc_hashmap_node_t structures instead of just pointers, so there's
   only allocation on resize.

3. The key is not copied into the hashmap node and must be also stored
   externally, either as part of the stored value or in any other
   location that's valid as long the value is stored in the hashmap.

This makes the isc_hashmap_t a little less universal because of the key
storage requirements, but the inserts and deletes are faster because
they don't require memory allocation on isc_hashmap_add() and memory
deallocation on isc_hashmap_delete().
2022-11-10 15:07:19 +01:00
Mark Andrews 0744ebe220 Merge branch '3630-nextpart-is-not-compatible-with-set-x' into 'main'
Resolve "'nextpart' is not compatible with 'set -x'"

Closes #3630

See merge request isc-projects/bind9!6995
2022-11-08 16:42:13 +00:00
Mark Andrews 10f67938db Use file descriptor 3 to save file.prev
If 'set -x' is in effect file.prev gets populated with debugging output.
To prevent this open descriptor 3 and redirect stderr from the awk
command to descriptor 3. Debugging output will stay directed to stderr.
2022-11-08 15:35:28 +00:00
Tom Krizek 2ea0eaacd6 Merge branch 'tkrizek/danger-approve' into 'main'
ci: add danger checks - approve workflow & wip commits

Closes #3651

See merge request isc-projects/bind9!7041
2022-11-08 13:37:33 +00:00
Tom Krizek 5ecb277090 Check for cherry pick message in backport commits in danger CI
Using the -x option for cherry pick makes it easy to link commits across
branches and it is recommended to use for all backport commits (with
exceptions -- thus a warning level rather than failure).
2022-11-08 14:34:58 +01:00
Tom Krizek 402b11431c Detect work-in-progress commits in danger CI
To avoid accidentally merging unfinished work, detect prohibited
keywords at the start of the subject line. If the first word is any of
the following, fail the check:
WIP, wip, DROP, drop, TODO, todo

The only slightly controversial is the lowercase "drop" which might have
a legitimate use - seems like four commits in the history used it as a
start of a sentence. However, since people commonly use "drop" to
indicate a commit should be dropped before merging, let's prohibit it as
well. In case of false-positive, "Drop" with a capitalized first letter
can always be used.
2022-11-08 14:34:58 +01:00
Tom Krizek e901342dd9 Use approve button workflow in danger CI
Since the LGTM label was deprecated in favor of using the Approve button
in gitlab, adjust the detection in danger bot.

Unfortunately, danger-python seems no longer maintained since 2020 and
MR approvals aren't available in its Python API (even though they're
supported in its Ruby/JS APIs). Going forward, let's use the more
comprehensive python-gitlab API.

It still makes sense to utilize the danger-python, since it handles the
integration with gitlab which doesn't need to be reimplemented as long
as it works - same with the other checks.
2022-11-08 14:34:56 +01:00
Ondřej Surý 0f46bcc86e Merge branch 'ondrej-name-loop-memory-contexts' into 'main'
Properly name the loop->mctx

See merge request isc-projects/bind9!7046
2022-11-08 12:33:17 +00:00
Ondřej Surý 9d2f22e666 Properly name the loop->mctx
The per loop memory context were unnamed, properly name them as
'loop<tid>'.
2022-11-08 13:32:13 +01:00
Michał Kępień 2c37b3f01b Merge branch 'michal/set-up-version-and-release-notes-for-bind-9.19.8' into 'main'
Set up version and release notes for BIND 9.19.8

See merge request isc-projects/bind9!7053
2022-11-08 12:30:09 +00:00
Michał Kępień 85ffcccd86 Set up release notes for BIND 9.19.8 2022-11-08 13:21:29 +01:00
Michał Kępień bcc6a125ea Update BIND version to 9.19.8-dev 2022-11-08 13:21:29 +01:00
Michał Kępień 83b4004d71 Update BIND version for release 2022-11-07 22:17:02 +01:00
Michał Kępień e2570e0c40 Add a CHANGES marker 2022-11-07 22:17:02 +01:00
Michał Kępień 3df7053b75 Merge branch 'michal/prepare-documentation-for-bind-9.19.7' into 'v9_19_7-release'
Prepare documentation for BIND 9.19.7

See merge request isc-private/bind9!471
2022-11-07 21:14:43 +00:00
Michał Kępień 260b77c784 Add release note for GL #3661 2022-11-07 22:07:08 +01:00
Michał Kępień 94482c1d3d Add release note for GL #3603 2022-11-07 22:07:08 +01:00
Michał Kępień 5ba4cd5dad Add release note for GL #3247 2022-11-07 22:07:08 +01:00
Michał Kępień fa3403d3e3 Reorder release notes 2022-11-07 22:07:08 +01:00
Michał Kępień ab0cb94489 Tweak and reword release notes 2022-11-07 22:07:08 +01:00
Michał Kępień a8129353f4 Prepare release notes for BIND 9.19.7 2022-11-07 22:07:08 +01:00
Michał Kępień 53a90756a1 Remove CHANGES entry 6012
The code change that entry 6012 describes (introduced in commit
be204bf4c7) was reverted shortly after (in
commit c429b52533).  Remove that entry
from CHANGES as it is misleading.
2022-11-07 22:07:08 +01:00
Michał Kępień 6967973568 Merge branch 'pspacek/doc-known-issues-reshuffle' into 'main'
Repeat Known Issues at the top of Release Notes page

See merge request isc-projects/bind9!7040
2022-11-07 13:42:13 +00:00
Petr ŠpačekandMichał Kępień c58dd2790a Repeat Known Issues at the top of Release Notes page
From now on all per-version notes link to the global list
of Known Issues. If there is a new note it should be listed twice:
In the per-version list, and in the global list.
2022-11-07 14:03:15 +01:00
Michał Kępień f6cc87c5f7 Merge branch '3652-reference-manual-update-policies-unmatched-parenthesis' into 'main'
Resolve "reference manual update-policies unmatched parenthesis"

Closes #3652

See merge request isc-projects/bind9!7030
2022-11-07 12:48:41 +00:00
Mark Andrews 044c3b2bb8 Add missing closing ')' to update-policy documentation
The opening '(' before local was not being matched by a closing
')' after the closing '};'.
2022-11-04 10:37:47 +00:00
Mark Andrews c5a79caa26 Merge branch '3654-main-doesn-t-compile-on-macos' into 'main'
Resolve "Main doesn't compile on MacOS"

Closes #3654

See merge request isc-projects/bind9!7031
2022-11-04 10:36:40 +00:00
Mark Andrews 93e8d06385 Fix local getresuid and getresuid implementations 2022-11-04 06:26:19 +00:00
Ondřej Surý fdd146983e Merge branch '3645-dont-release-the-read-lock-when-iterating' into 'main'
Don't release the tree read lock in dereference_iter_node()

Closes #3645

See merge request isc-projects/bind9!7023
2022-11-03 14:30:49 +00:00
Ondřej Surý 96e7bf76e7 Don't release the tree read lock in dereference_iter_node()
Previously, the tree read lock could be upgraded to a write lock in
decrement_reference() and then downgraded back to read lock in
dereference_iter_node().  When the use of isc_rwlock_downgrade() was
removed, the downgrade was changed to a simple unlock+lock. This allows
some delete operations to sneak in and delete nodes that the iterator
expects to be in place.

Expand decrement_reference() so the caller can indicate whether the
tree read lock should be upgraded, and disallow the upgrade when
calling from dereference_iter_node(), so there will be no need to
release the lock afterward.
2022-11-03 14:07:44 +00:00
Ondřej Surý cfe42dfb68 Merge branch '3643-dont-use-dns_zone_attach-in-zone_refreshkeys' into 'main'
Don't use dns_zone_attach() in zone_refreshkeys()

Closes #3643

See merge request isc-projects/bind9!7022
2022-11-03 13:53:07 +00:00
Ondřej Surý 80e66fbd2d Don't use dns_zone_attach() in zone_refreshkeys()
The zone_refreshkeys() could run before the zone_shutdown(), but after
the last .erefs has been "detached" causing assertion failure when doing
dns_zone_attach().  Remove the use of .erefs (dns_zone_attach/detach)
and replace it with using the .irefs and additional checks whether the
zone is exiting in the callbacks.
2022-11-03 14:29:32 +01:00
Matthijs Mekking bb3852d71e Merge branch '3591-nsec3-crash-dynamic-to-inline-signing' into 'main'
Fix crash where dnssec-policy zone with NSEC3 crashes when inline-signing is turned on

Closes #3591

See merge request isc-projects/bind9!6905
2022-11-03 10:41:32 +00:00
Matthijs Mekking 1cf2f6fe68 Add release note and change for GL #3591
Breaking news.
2022-11-03 11:20:56 +01:00
Matthijs Mekking 4d143f2cc4 If a zone is not reusable, trigger full sign
If after a reconfig a zone is not reusable because inline-signing
was turned on/off, trigger a full resign. This is necessary because
otherwise the zone maintenance may decide to only apply the changes
in the journal, leaving the zone in an inconsistent DNSSEC state.
2022-11-03 10:20:05 +01:00
Matthijs Mekking 332b98ae49 Don't allow DNSSEC records in the raw zone
There was an exception for dnssec-policy that allowed DNSSEC in the
unsigned version of the zone. This however causes a crash if the
zone switches from dynamic to inline-signing in the case of NSEC3,
because we are now trying to add an NSEC3 record to a non-NSEC3 node.
This is because BIND expects none of the records in the unsigned
version of the zone to be NSEC3.

Remove the exception for dnssec-policy when copying non DNSSEC
records, but do allow for DNSKEY as this may be a published DNSKEY
from a different provider.
2022-11-03 10:20:05 +01:00
Matthijs Mekking bc703a12e7 Remove checks when going to dnssec-policy none
The changes in the code have the side effect that the CDNSKEY and CDS
records in the secure version of the zone are not reusable and thus
are thrashed from the zone. Remove the apex checks for this use case.
We only care about that the zone is not immediately goes bogus, but
a user really should use the built-in "insecure" policy when unsigning
a zone.
2022-11-03 10:20:05 +01:00
Matthijs Mekking ef1cb9935c Add nsec3 system test that transfers in NSEC3
Similar to an attempt to add NSEC through dynamic update, add a test
case that tries to add NSEC3 through zone transfer.
2022-11-03 10:20:05 +01:00
Matthijs Mekking 4cd8e8e9c3 Add two more nsec3 system tests
Add one more case that tests reconfiguring a zone to turn off
inline-signing. It should still be a valid DNSSEC zone and the NSEC3
parameters should not change.

Add another test to ensure that you cannot update the zone with a
NSEC3 record.
2022-11-03 10:20:05 +01:00
Matthijs Mekking 57ea9e08c6 Update kasp system test to work with .signed files
We no longer accept copying DNSSEC records from the raw zone to
the secure zone, so update the kasp system test that relies on this
accordingly.

Also add more debugging and store the dnssec-verify results in a file.
2022-11-03 10:20:05 +01:00
Matthijs Mekking 9018fbb205 Test changing from dynamic to inline-signing
Add a kasp system test that reconfigures a dnssec-policy zone from
maintaining DNSSEC records directly to the zone to using inline-signing.

Add a similar test case to the nsec3 system test, testing the same
thing but now with NSEC3 in use.
2022-11-03 10:20:05 +01:00
Ondřej Surý 52cf8205a0 Merge branch '3646-use-after-free-triggers-a-crash-in-reactivate_node' into 'main'
Don't cleanup the dead nodes when pruning the tree

Closes #3646

See merge request isc-projects/bind9!7018
2022-11-03 08:09:28 +00:00
Ondřej Surý c429b52533 Don't cleanup the dead nodes when pruning the tree
The dead nodes might get reactivated during the db iterator walks the
version of the tree, so we can't cleanup the dead nodes while the db
version is open.  Restore the previous behaviour that cleaned up the
dead nodes when we are closing the version.
2022-11-03 09:06:08 +01:00
Ondřej Surý 7f19af2622 Merge branch '3641-cleanup-dead_nodes-from-prune_tree' into 'main'
Cleanup the dead nodes when pruning the tree

Closes #3641

See merge request isc-projects/bind9!7012
2022-11-02 18:08:42 +00:00
Ondřej Surý 625c6fd16f Add CHANGES for [GL #3641] 2022-11-02 13:10:42 +01:00
Ondřej Surý be204bf4c7 Cleanup the dead nodes when pruning the tree
While sending the node to prune_tree(), we can also cleanup dead nodes
because we already hold the tree and node bucket write locks.
2022-11-02 13:06:52 +01:00
Ondřej Surý 0e04156f4b Merge branch 'ondrej-rework-pthread-rwlock-3' into 'main'
Make the pthread_rwlock implementation header-only macros [3/3]

See merge request isc-projects/bind9!6909
2022-11-02 09:56:33 +00:00
Ondřej Surý 0492bbf590 Make the pthread_rwlock implementation header-only macros [2/2]
While using mutrace, the phtread-rwlock based isc_rwlock implementation
would be all tracked in the rwlock.c unit losing all useful information
as all rwlocks would be traced in a single place.  Rewrite the
pthread_rwlock based implementation to be header-only macros, so we can
use mutrace to properly track the rwlock contention without heavily
patching mutrace to understand the libisc synchronization primitives.
2022-11-02 10:34:10 +01:00
Ondřej Surý 6bd201ccec Remove one level of indirection from isc_rwlock [1/2]
Instead of checking the PTHREAD_RUNTIME_CHECK from the header, move it
to the pthread_rwlock implementation functions.  The internal isc_rwlock
actually cannot fail, so the checks in the header was useless anyway.
2022-11-02 10:27:09 +01:00
Ondřej Surý 68cfbd238c Merge branch 'ondrej-rework-pthread-rwlock-2' into 'main'
Remove isc_rwlock_downgrade() from isc_rwlock [2/3]

See merge request isc-projects/bind9!6908
2022-11-02 08:52:27 +00:00
Ondřej Surý 1d448de802 Merge branch 'ondrej-rework-pthread-rwlock-1' into 'main'
Remove isc_rwlock_downgrade usage in rbtdb.c [1/3]

See merge request isc-projects/bind9!6907
2022-11-02 08:05:38 +00:00
Ondřej Surý 98b7a93772 Remove isc_rwlock_downgrade() from isc_rwlock
The isc_rwlock_downgrade() is not used anywhere, so we can remove it and
make the pthread_rwlock implementation simpler.
2022-11-02 09:05:37 +01:00
Ondřej Surý e5f7fe1f65 Add strong rwlock consistency checks to dns_rbtdb
The dns_rbtdb unit already tracks the state of the node and tree rwlocks
during the top level function and passes the states of the locks to the
called functions.

Add the tree locking family of macros modeled after node locking macros,
and expand both to track the state of the lock in an external variable.
Additionally, in developer mode, add precondition to the macros, so the
lock is in required state - this should cause an assertion failure on
double locking instead of the thread getting stuck.
2022-11-02 08:45:48 +01:00
Ondřej Surý 006a7f0cb6 Remove isc_rwlock_downgrade usage in rbtdb.c
The only place where isc_rwlock_downgrade was being used was the
decrement_reference() where the code tries either relocks the node
rwlock to write and then tries to upgrade the tree lock.  When returning
from the function it tries to restore the locks into a previous state
which is nice, but kind of moot, because at every use of
decrement_reference() the node locks is immediately or almost
immeditately unlocked, and same holds for the tree lock.

Instead of trying to restore the node and tree lock into the initial
state, the decrement_reference now returns the state of the locks, so
the caller can then use the right unlock operation (read or write).
Only when the tree lock was originally unlocked, the decrement_reference
unlocks the tree lock before returning to the caller.
2022-11-02 08:45:48 +01:00
Ondřej Surý 395a5576b4 Merge branch '3583-make-libcap-mandatory-on-linux' into 'main'
Refactor the privilege dropping

Closes #3583

See merge request isc-projects/bind9!6873
2022-11-01 14:32:34 +00:00
Ondřej Surý 9ed03164ad Add CHANGES and release note for [GL #3583] 2022-11-01 14:37:30 +01:00
Ondřej Surý 576345a447 Refactor the privilege dropping
On Linux, the libcap is now mandatory.  It makes things simpler for us.

System without {set,get}res{uid,gid} now have compatibility shim using
setreuid/setregid or seteuid/setegid to setup effective UID/GID, so the
same code can be called all the time (including on Linux).
2022-11-01 14:37:30 +01:00
Artem Boldariev 64a26f54b0 Merge branch 'artem-fix-tlsdns-tcpdns-unit-tests-connect-func-passing' into 'main'
Fix TCP and TLS DNS tests: properly pass connection callback

See merge request isc-projects/bind9!6986
2022-11-01 13:24:23 +00:00
Artem Boldariev cad73b95bf TLS DNS unit tests: do not share the port with TCP DNS tests
TLS DNS unit tests were sharing the port with TCP DNS tests by
mistake. That could have caused conflicts between the two, when
running the unit tests in parallel. This commit fixes that.
2022-11-01 14:42:08 +02:00
Artem Boldariev 5167cc5982 TCP and TLS DNS tests: properly pass connection callback
After the loop manager refactoring TCP DNS and TLS DNS unit tests
ended up broken.

The problem is that in these unit tests the code is written in such a
way that for establishing a new connection tcpdns_connect() and
tlsdns_connect() functions are used. However, in these tests as a
connection callback function connect_connect_cb() is used. The
function logic is responsible for determining the function for
establishing subsequent connection.

To do so, it called get_stream_connect_function() ... which can return
only tcp_connect() or tls_connect(), not tcpdns_connect() or
tlsdns_connect(). That is definitely *not* what was implied.

All this time the unit tests were testing something, but now what was
intended.

This commit fixes the problem by passing the tcpdns_connect() and
tlsdns_connect() function pointers to connect_connect_cb().
2022-11-01 14:42:08 +02:00
Ondřej Surý 53d6a0dab0 Merge branch '3583-bind-to-interfaces-early' into 'main'
Rescan interfaces before dropping privileges

Closes #3583

See merge request isc-projects/bind9!6875
2022-11-01 10:50:33 +00:00
Ondřej Surý 3b9295fcd9 Add CHANGES note for [GL #3583] 2022-11-01 11:49:21 +01:00
Ondřej Surý 04a5477eb2 Rescan interfaces before dropping privileges
The ns_interfacemgr_scan() now requires the loopmgr to be running, so we
need to end exclusive mode for the rescan and then begin it again.

This is relatively safe operation (because the scan happens on the timer
anyway), but we need to ensure that we won't load the configuration from
different threads.  This is already the case because the initial load
happens on the main thread and the control channel also listens just on
the main loop.
2022-11-01 11:48:56 +01:00
Arаm Sаrgsyаn f7f13f430b Merge branch '2895-named-can-create-unrecoverable-managed-keys' into 'main'
Don't trust a placeholder KEYDATA record

Closes #2895

See merge request isc-projects/bind9!7003
2022-11-01 10:48:18 +00:00
Aram Sargsyan 3bf4bc7336 Add CHANGES and release notes for [GL #2895] 2022-11-01 09:51:28 +00:00
Aram Sargsyan 354ae2d7e3 Don't trust a placeholder KEYDATA record
When named starts it creates an empty KEYDATA record in the managed-keys
zone as a placeholder, then schedules a key refresh. If key refresh
fails for some reason (e.g. connectivity problems), named will load the
placeholder key into secroots as a trusted key during the next startup,
which will break the chain of trust, and named will never recover from
that state until managed-keys.bind and managed-keys.bind.jnl files are
manually deleted before (re)starting named again.

Before calling load_secroots(), check that we are not dealing with a
placeholder.
2022-11-01 09:50:34 +00:00
Aram Sargsyan 8c48eabbc1 Test managed-keys placeholder
Add a dnssec test to make sure that named can correctly process a
managed-keys zone with a placeholder KEYDATA record.
2022-11-01 09:50:34 +00:00
Evan Hunt faad579301 Merge branch '3617-keyfetch-race' into 'main'
call dns_resolver_createfetch() asynchronously in zone_refreshkeys()

Closes #3617

See merge request isc-projects/bind9!6971
2022-11-01 06:28:04 +00:00
Evan Hunt 1ab97cd41b CHANGES for [GL #3617] 2022-10-31 14:40:40 -07:00
Evan Hunt 31c53235dd Call dns_resolver_createfetch() asynchronously in zone_refreshkeys()
Because dns_resolver_createfetch() locks the view, it was necessary
to unlock the zone in zone_refreshkeys() before calling it in order
to maintain the lock order, and relock afterward. this permitted a race
with dns_zone_synckeyzone().

This commit moves the call to dns_resolver_createfetch() into a separate
function which is called asynchronously after the zone has been
unlocked.

The keyfetch object now attaches to the zone to ensure that
it won't be shut down before the asynchronous call completes.

This necessitated refactoring dns_zone_detach() so it always runs
unlocked. For managed zones it now schedules zone_shutdown() to
run asynchronously, and for unmanaged zones, it requires the last
dns_zone_detach() to be run without loopmgr running.
2022-10-31 14:34:12 -07:00
Ondřej Surý 16be88d14f Merge branch '3634-dont-enforce-jemalloc-on-NetBSD' into 'main'
Don't enforce jemalloc on NetBSD

Closes #3634

See merge request isc-projects/bind9!7004
2022-10-31 15:14:37 +00:00
Ondřej Surý fdf1e226fd Add CHANGES note for [GL #3634] 2022-10-31 14:48:08 +00:00
Ondřej Surý feea72414b Don't enforce jemalloc on NetBSD
The NetBSD system allocator is in fact based on the jemalloc, but it
doesn't export the extended interface, so we can't use that.  Remove
the jemalloc enforcement for the NetBSD.
2022-10-31 14:46:30 +00:00
Evan Hunt 07e2b57152 Merge branch '3632-async-backwards' into 'main'
isc_async_run() runs events in reverse order

Closes #3632

See merge request isc-projects/bind9!7000
2022-10-31 13:24:38 +00:00
Evan Hunt dc878e3098 isc_async_run() runs events in reverse order
when more than one event was scheduled in the isc_aysnc queue,
they were executed in reverse order. we need to pull events
off the back of queue instead the front, so that uv_loop will
run them in the right order.

note that isc_job_run() has the same behavior, because it calls
uv_idle_start() directly. in that case we just document it so
it'll be less surprising in the future.
2022-10-31 05:43:45 -07:00
Evan Hunt 0f4af13906 Merge branch 'each-fix-fuzz' into 'main'
fix build error in fuzz tests

See merge request isc-projects/bind9!6997
2022-10-31 11:28:38 +00:00
Evan Hunt 428eac45ba fix build error in fuzz tests
a missing include file caused dns_message_checksig.c to fail
to build on some platforms. this has been fixed.
2022-10-31 04:28:01 -07:00
Evan Hunt 792d69855a Merge branch 'each-dupsigs-test' into 'main'
make dupsigs test less timing-sensitive

See merge request isc-projects/bind9!6998
2022-10-31 11:23:41 +00:00
Evan Hunt d9b85cbaae make dupsigs test less timing-sensitive
the dupsigs test is prone to failing on slow CI machines
because the first test can occur before the zone is fully
signed.

instead of just waiting ten seconds arbitrarily, we now
check every second, and allow up to 30 seconds before giving
up.
2022-10-31 04:03:01 -07:00
Ondřej Surý a69ba0b6bf Merge branch '3628-cleanup-task-from-dns_masterdump' into 'main'
Refactor zone loading and dumping to use offloaded work

Closes #3628

See merge request isc-projects/bind9!6990
2022-10-31 10:30:49 +00:00
Ondřej Surý 8fc229c17a Add CHANGES note for [GL #3628] 2022-10-31 10:30:27 +00:00
Ondřej Surý 04670889bc Refactor dns_master_dump*async() to use offloaded work
The dns_master_dump*async() functions were using isc_async_run() to
schedule work on the active loop; use isc_work_enqueue() instead.
2022-10-31 10:30:27 +00:00
Evan HuntandOndřej Surý b54c721894 refactor dns_master_dump*async() to use loop callbacks
Asynchronous zone dumping now uses loop callbacks instead of
task events.
2022-10-31 10:30:27 +00:00
Evan Hunt d63f742b42 Merge branch '3631-fix-zone-maintenance-race' into 'main'
fix a potential data race in zone_maintenance()

Closes #3631

See merge request isc-projects/bind9!6999
2022-10-31 10:24:24 +00:00
Evan Hunt f92b946df3 fix a potential data race in zone_maintenance()
zone_maintenance() accessed zone timer information without locking.
2022-10-31 02:54:40 -07:00
Ondřej Surý a20d0008da Merge branch '3625-run-zone-loading-as-offloaded-task' into 'main'
Move the zone loading to the offloaded threads

Closes #3625

See merge request isc-projects/bind9!6985
2022-10-31 06:24:23 +00:00
Ondřej SurýandEvan Hunt c59750bfbc Add CHANGES note for [GL #3625] 2022-10-30 14:56:55 -07:00
Ondřej SurýandEvan Hunt 77aeed6231 Move the zone loading to the offloaded threads
Instead of doing incremental zone loading with fixed quantum - 100
loaded lines per event, move the zone loading process to the offloaded
libuv threads using isc_work_enqueue() API.

This has the advantage that the thread scheduling is given back to the
operating system that understands blocking operations, and the zone
loading operation doesn't block the networking threads directly.
2022-10-30 14:56:40 -07:00
Evan Hunt dcc4c3e3ec Refactor dns_master_loadfileinc() to use loopmgr instead of tasks
Incremental file loads now use loopmgr events instead of task events.

The dns_master_loadstreaminc(), _loadbufferinc(), _loadlexer() and
_loadlexerinc() functions were not used in BIND, and have been removed.
2022-10-30 14:56:40 -07:00
Mark Andrews 0fc0d485da Merge branch '3576-check-_dns-svcb-records-additional-constraints' into 'main'
Resolve "Check _dns SVCB records additional constraints in primary zones."

Closes #3576

See merge request isc-projects/bind9!6856
2022-10-28 20:49:45 +00:00
Mark Andrews 94c4d5b23d Add release note for [GL #3576] 2022-10-29 07:03:15 +11:00
Mark Andrews ae37a48638 Add CHANGES for [GL #3576] 2022-10-29 07:03:15 +11:00
Mark Andrews 1244a2ffb9 Test named's check-svcb behaviour with UPDATE
Checks that malformed _dns SVCB records are rejected unless
check-svcb is set to no, in which case they are accepted. Both
missing ALPN and missing DOHPATH are checked for.
2022-10-29 00:22:54 +11:00
Mark Andrews c040e82c82 Check check-svcb processing in nsupdate 2022-10-29 00:22:54 +11:00
Mark Andrews 7782c78d15 Add various zones containing bad _dns SVCB records 2022-10-29 00:22:54 +11:00
Mark Andrews da6359345e Add check-svcb to named
check-svcb signals whether to perform additional contraint tests
when loading / update primary zone files.
2022-10-29 00:22:54 +11:00
Mark Andrews f857006cd9 Add checking of _dns SVCB records constraints to nsupdate
_dns SVBC records have additional constrains which should be checked
when records are being added.  This adds those constraint checks but
allows the user to override them using 'check-svcb no'.
2022-10-29 00:22:54 +11:00
Mark Andrews 3881afeb15 Add dns_rdata_checksvcb
dns_rdata_checksvcb performs data entry checks on SVCB records.
In particular that _dns SVBC record have an 'alpn' and if that 'alpn'
parameter indicates HTTP is in use that 'dophath' is present.
2022-10-29 00:22:54 +11:00
Mark Andrews f1043f19dd Add dns_name_isdnssvcb
dns_name_isdnssvcb looks for a name which starts with the label
_dns or _<port>._dns labels.
2022-10-29 00:22:54 +11:00
Matthijs Mekking f8a741c104 Merge branch 'matthijs-fix-bug-tls-dynamic-update-forwarding' into 'main'
Fix update forwarding bug

See merge request isc-projects/bind9!6982
2022-10-27 11:38:15 +00:00
Matthijs Mekking 218c661b41 Fix update forwarding bug
The wrong tls configuration was picked here. It should be of the
primary that is selected by forward->which, not zone->curprimary.

This bug may cause BIND to select the wrong primary when retrieving
the TLS settings, or cause a crash in case the wrongly selected primary
has no TLS settings.
2022-10-27 12:22:23 +02:00
Matthijs Mekking 72530d2f9c Add new upforwd system test
Add a new upforwd system test that checks if update forwarding still
works if the first primary is badly configured.

We cannot reuse the 'example.' zone for this test because that
checks if update forwarding works for DoT. What transport is used
in the new test is of no relevance.

Update the system test to use different known good file names for
the different zones that are being tested.
2022-10-27 12:22:23 +02:00
Tom Krizek 549b153d2b Merge branch '3503-random-default-algorithm-in-tests' into 'main'
Random selection of DEFAULT_ALGORITHM in system tests at runtime

Closes #3503

See merge request isc-projects/bind9!6989
2022-10-27 10:15:05 +00:00
Tom Krizek f65f276f98 Randomize algorithm selection for mkeys test
Use the ALGORITHM_SET option to use randomly selected default algorithm
in this test. Make sure the test works by using variables instead of
hard-coding values.
2022-10-27 12:14:29 +02:00
Tom Krizek 69b608ee9f Set algorithms for system tests at runtime
Use the get_algorithms.py script to detect supported algorithms and
select random algorithms to use for the tests.

Make sure to load common.conf.sh after KEYGEN env var is exported.
2022-10-27 12:14:29 +02:00
Tom Krizek 5f480c8485 Script for random algorithm selection in system tests
Multiple algorithm sets can be defined in this script. These can be
selected via the ALGORITHM_SET environment variable. For compatibility
reasons, "stable" set contains the currently used algorithms, since our
system tests need some changes before being compatible with randomly
selected algorithms.

The script operation is similar to the get_ports.py - environment
variables are created and then printed out as `export NAME=VALUE`
commands, to be interpreted by shell. Once we support pytest runner for
system tests, this should be a fixture instead.
2022-10-27 12:14:29 +02:00
Tom Krizek 37d14c69c0 Export env variables in system tests
Certain variables have to be exported in order for the system tests to
work. It makes little sense to export the variables in one place/script
while they're defined in another place.

Since it makes no harm, export all the variables to make the behaviour
more predictable and consistent. Previously, some variables were
exported as environment variables, while others were just shell
variables which could be used once the configuration was sourced from
another script. However, they wouldn't be exposed to spawned processes.

For simplicity sake (and for the upcoming effort to run system tests
with pytest), export all variables that are used. TESTS, PARALLEL_UNIX
and SUBDIRS variables are automake-specific, aren't used anywhere else
and thus not exported.
2022-10-27 12:14:29 +02:00
Tom Krizek bb1c6bbdc7 Support testcrypto.sh usage without including conf.sh
The only variable really needed for the script to work is the path to
the $KEYGEN binary. Allow setting this via an environment variable to
avoid loading conf.sh (and causing a chicken-egg problem). Also make
testcrypto.sh executable to allow its use from conf.sh.
2022-10-27 12:14:29 +02:00
Tom Krizek 01b293b055 Unify indentation level in testcrypto.sh 2022-10-27 12:14:27 +02:00
Matthijs Mekking 7f844be555 Merge branch '3627-inheritance-bug-remote-server-port' into 'main'
Fix inheritance bug when setting port in remote server configuration

Closes #3627

See merge request isc-projects/bind9!6988
2022-10-27 10:13:48 +00:00
Matthijs Mekking 5585256bf6 Add release note and change entry for [GL #3627] 2022-10-27 11:39:34 +02:00
Matthijs Mekking 72d3bf8e4e Fix config bug related to port setting
There are three levels there for the port value, with increasing
priority:

1. The default ports, defined by 'port' and 'tls-port' config options.
2. The primaries-level default port: primaries port <number>  { ... };
3. The primaries element-level port: primaries { <address> port
   <number>; ... };"

In 'named_config_getipandkeylist()', the 'def_port' and 'def_tlsport'
variables are extracted from level 1. The 'port' variable is extracted
from the level 2. Currently if that is unset, it defaults to the
default port ('def_port' or 'def_tlsport' depending on the transport
used), but overrides the level 2 port setting for the next primaries in
the list.

Update the code such that we inherit the port only if the level 3 port
is not set, and inherit from the default ports if the level 2 port is
also not set.
2022-10-27 11:39:34 +02:00
Matthijs Mekking 622a499027 Add xfer system test case
Add a test case that if the first primary fails, the fallback of a
second primary on plain DNS works. This is mainly to test that the port
configuration inheritance works correctly.
2022-10-27 11:39:34 +02:00
Ondřej Surý e004ca4f6c Merge branch 'ondrej-cleanup-isc_lex_create' into 'main'
Change the return type of isc_lex_create() to void

See merge request isc-projects/bind9!6983
2022-10-26 17:11:23 +00:00
Ondřej Surý 6ba0a22627 Change the return type of isc_lex_create() to void
The isc_lex_create() cannot fail, so cleanup the return type from
isc_result_t to void.
2022-10-26 12:55:06 +02:00
Petr Špaček 75137645c7 Merge branch 'pspacek/tsec-cleanup' into 'main'
Remove unused lib/dns/tsec

See merge request isc-projects/bind9!6874
2022-10-25 08:54:41 +00:00
Petr Špaček baa71c5181 Remove unused lib/dns/tsec
dns_tsec API is not referenced anywhere, remove it.
This is a leftover after dns_client cleanup.

Related: !4835
2022-10-25 10:35:07 +02:00
Evan Hunt d43041b45b Merge branch '3620-disable-doh-crash' into 'main'
Fix an error when building with --disable-doh

Closes #3620

See merge request isc-projects/bind9!6978
2022-10-25 04:54:56 +00:00
Evan Hunt 67c0128ebb Fix an error when building with --disable-doh
The netievent handler for isc_nmsocket_set_tlsctx() was inadvertently
ifdef'd out when BIND was built with --disable-doh, resulting in an
assertion failure on startup when DoT was configured.
2022-10-24 13:54:39 -07:00
Tom Krizek b586aac433 Merge branch '3517-serve-stale-cache-timeout-0-test' into 'main'
[CVE-2022-3080] Test serve stale cache with timeout 0 and CNAME

See merge request isc-projects/bind9!6975
2022-10-24 12:50:51 +00:00
Tom Krizek 6295572b05 Remove misleading comment from serve-stale test
The stale-answer-client-timeout option is not set to 0 in the config
neither is it the default value. This was probably caused by a
copy-paste error.
2022-10-24 14:23:27 +02:00
Tom Krizek a4d72a57f9 Test serve stale cache with timeout 0 and CNAME
Add a couple of tests that verify the serve-stale behavior when
stale-answer-client-timeout is set to 0 and a (stale) CNAME record is
queried.

Related #3517
2022-10-24 14:23:26 +02:00
Michał Kępień 52731a91b6 Merge branch 'michal/bump-sphinx-version-to-5.3.0' into 'main'
Bump Sphinx version to 5.3.0

See merge request isc-projects/bind9!6972
2022-10-24 09:46:07 +00:00
Michał Kępień a8f0ab7df6 Bump Sphinx version to 5.3.0
Make the Sphinx version listed in doc/arm/requirements.txt match the
version currently used in GitLab CI, so that Read the Docs builds the
documentation using the same Python software versions as those used in
GitLab CI.
2022-10-24 11:05:02 +02:00
Arаm Sаrgsyаn 004e7d8301 Merge branch '3603-resolver-prefetch-eligibility-edge-case-bug' into 'main'
Synchronize prefetch "trigger" and "eligibility" code and documentation

Closes #3603

See merge request isc-projects/bind9!6937
2022-10-21 11:28:44 +00:00
Aram Sargsyan 0227565cf1 Getting the "prefetch" setting from the configuration cannot fail
The "prefetch" setting is in "defaultconf" so it cannot fail, use
INSIST to confirm that.

The 'trigger' and 'eligible' variables are now prefixed with
'prefetch_' and their declaration moved to an upper level, because
there is no more additional code block after this change.
2022-10-21 10:19:54 +00:00
Aram Sargsyan ef344b1f52 Fix prefetch "trigger" value's documentation in ARM
For the prefetch "trigger" parameter ARM states that when a cache
record with a lower TTL value is encountered during query processing,
it is refreshed. But in reality, the record is refreshed when the TTL
value is lower or equal to the configured "trigger" value.

Fix the documentation to make it match with with the code.
2022-10-21 10:19:53 +00:00
Aram Sargsyan 041ffac0d7 Add a CHANGES note for [GL #3603] 2022-10-21 10:19:53 +00:00
Aram Sargsyan 863f51466e Match prefetch eligibility behavior with ARM
ARM states that the "eligibility" TTL is the smallest original TTL
value that is accepted for a record to be eligible for prefetching,
but the code, which implements the condition doesn't behave in that
manner for the edge case when the TTL is equal to the configured
eligibility value.

Fix the code to check that the TTL is greater than, or equal to the
configured eligibility value, instead of just greater than it.
2022-10-21 10:19:23 +00:00
Aram Sargsyan 89fa9a6592 Add another prefetch check in the resolver system test
The test triggers a prefetch, but fails to check if it acutally
happened, which prevented it from catching a bug when the record's
TTL value matches the configured prefetch eligibility value.

Check that prefetch happened by comparing the TTL values.
2022-10-21 10:17:03 +00:00
Tony Finch 87efea8955 Merge branch '3611-bench-render' into 'main'
Delete the `render` benchmark

Closes #3611

See merge request isc-projects/bind9!6947
2022-10-21 09:53:09 +00:00
Tony Finch c51fda86ac Delete the render benchmark
Instead of fixing a Coverity complaint (and other style nits),
delete it because it needs input data that can't be generated
with the tools that ship with BIND.
2022-10-21 09:52:40 +00:00
Arаm Sаrgsyаn 2bd3b452cf Merge branch '3598-adb-quota-might-not-be-decremented' into 'main'
Resolve "ADB quota might not be decremented"

Closes #3598

See merge request isc-projects/bind9!6893
2022-10-21 08:50:53 +00:00
Aram Sargsyan 6f50972e5f Add CHANGES and release notes for [GL #3598] 2022-10-21 08:25:31 +00:00
Aram Sargsyan 5da79e2be0 Call dns_adb_endudpfetch() on error path, if required
For UDP queries, after calling dns_adb_beginudpfetch() in fctx_query(),
make sure that dns_adb_endudpfetch() is also called on error path, in
order to adjust the quota back.
2022-10-21 08:08:55 +00:00
Aram Sargsyan e4569373ca Always call dns_adb_endudpfetch() in fctx_cancelquery() for UDP queries
It is currently possible that dns_adb_endudpfetch() is not
called in fctx_cancelquery() for a UDP query, which results
in quotas not being adjusted back.

Always call dns_adb_endudpfetch() for UDP queries.
2022-10-21 08:08:47 +00:00
Aram Sargsyan ac889684c7 Unlink the query under cleanup_query
In the cleanup code of fctx_query() function there is a code path
where 'query' is linked to 'fctx' and it is being destroyed.

Make sure that 'query' is unlinked before destroying it.
2022-10-21 08:08:37 +00:00
Ondřej Surý 442215dc6b Merge branch '3563-fix-named-startup-on-manycore-solaris-systems' into 'main'
Fix named failing to start on Solaris systems with hundreds of CPUs

Closes #3563

See merge request isc-projects/bind9!6955
2022-10-20 12:02:04 +00:00
Artem BoldarievandOndřej Surý 2c9400f116 Modify release notes [GL #3563]
Mention that a startup problem on manycore Solaris systems is fixed.
2022-10-20 14:01:28 +02:00
Artem BoldarievandOndřej Surý 03ee132e28 Modify CHANGES [GL #3563]
Mention that a startup problem on manycore Solaris systems is fixed.
2022-10-20 14:01:28 +02:00
Artem BoldarievandOndřej Surý fff01fe7eb Fix named failing to start on Solaris systems with hundreds of CPUs
This commit fixes a startup issue on Solaris systems with
many (reportedly > 510) CPUs by bumping RLIMIT_NOFILE. This appears to
be a regression from 9.11.
2022-10-20 14:01:28 +02:00
Ondřej Surý afd1908aa3 Merge branch '3270-use-curl-in-statschannel-system-test' into 'main'
Replace raw nc usage in statschannel system test with curl

Closes #3270

See merge request isc-projects/bind9!6946
2022-10-20 12:00:54 +00:00
Ondřej Surý cd0e5c5784 Replace some raw nc usage in statschannel system test with curl
For tests where the TCP connection might get interrupted abruptly,
replace the nc with curl as the data sent from server to client might
get lost because of abrupt TCP connection.  This happens when the TCP
connection gets closed during sending the large request to the server.

As we already require curl for other system tests, replace the nc usage
in the statschannel test with curl that actually understands the
HTTP/1.1 protocol, so the same connection is reused for sending the
consequtive requests, but without client-side "pipelining".

For the record, the server doesn't support parallel processing of the
pipelined request, so it's a bit misnomer here, because what we are
actually testing is that we process all requests received in a single
TCP read callback.
2022-10-20 12:23:34 +02:00
Michal Nowak 97b9a7eb56 Merge tag 'v9_19_6'
BIND 9.19.6
2022-10-20 11:01:27 +02:00
Evan Hunt 6c8bc44bc4 Merge branch '3247-rpz-ip-cd' into 'main'
ensure RPZ lookups handle CD=1 correctly

Closes #3247

See merge request isc-projects/bind9!6944
2022-10-19 20:11:26 +00:00
Evan Hunt 3676f6394b CHANGES for [GL #3247] 2022-10-19 11:36:11 -07:00
Evan Hunt 575a924b1a add a test with CD=1 query for pending data
this is a regression test for [GL #3247].
2022-10-19 11:36:11 -07:00
Evan Hunt 305a50dbe1 ensure RPZ lookups handle CD=1 correctly
RPZ rewrites called dns_db_findext() without passing through the
client database options; as as result, if the client set CD=1,
DNS_DBFIND_PENDINGOK was not used as it should have been, and
cache lookups failed, resulting in failure of the rewrite.
2022-10-19 11:36:11 -07:00
Ondřej Surý 0bcff38391 Merge branch '3270-serialize-statschannel-http-requests' into 'main'
Serialize the HTTP/1.1 statschannel requests

Closes #3270

See merge request isc-projects/bind9!6954
2022-10-19 12:47:06 +00:00
Ondřej Surý 13959781cb Serialize the HTTP/1.1 statschannel requests
The statschannel truncated test still terminates abruptly sometimes and
it doesn't return the answer for the first query.  This might happen
when the second process_request() discovers there's not enough space
before the sending is complete and the connection is terminated before
the client gets the data.

Change the isc_http, so it pauses the reading when it receives the data
and resumes it only after the sending has completed or there's
incomplete request waiting for more data.

This makes the request processing slightly less efficient, but also less
taxing for the server, because previously all requests that has been
received via single TCP read would be processed in the loop and the
sends would be queued after the read callback has processed a full
buffer.
2022-10-19 14:45:36 +02:00
Ondřej Surý edb0e756bc Merge branch '3612-fix-mem-functions-with-openssl-1.0.2' into 'main'
Fix the non-developer build with OpenSSL 1.0.2

Closes #3612

See merge request isc-projects/bind9!6952
2022-10-19 12:42:20 +00:00
Ondřej Surý dfaae53b9a Fix the non-developer build with OpenSSL 1.0.2
In non-developer build, a wrong condition prevented the
isc__tls_malloc_ex, isc__tls_realloc_ex and isc__tls_free_ex to be
defined.  This was causing FTBFS on platforms with OpenSSL 1.0.2.
2022-10-19 14:41:10 +02:00
Ondřej Surý a08a84695a Merge branch '3270-remove-time-requirement-for-statschannel-truncated-test' into 'main'
Remove the time requirement for the statschannel truncated test

Closes #3270

See merge request isc-projects/bind9!6951
2022-10-19 12:35:38 +00:00
Ondřej Surý 0f56a53d66 Remove the time requirement for the statschannel truncated test
The 5 seconds requirement to finish the 'pipelined with truncated
stream' was causing spurious failures in the CI because the job runners
might be very busy and sending 128k of data might simply take some time.

Remove the time requirement altogether, there's actually no reason why
the test SHOULD or even MUST finish under 5 seconds.
2022-10-19 14:08:24 +02:00
Tom Krizek a8c1ac7f92 Merge branch 'tkrizek/system-tests-fixes' into 'main'
Update various system tests and add them to default test suite

See merge request isc-projects/bind9!6942
2022-10-19 11:01:26 +00:00
Tom Krizek cbd0355328 Remove generated controls.conf file from system tests
The controls.conf file shouldn't be used directly without templating it
first. Remove this no longer used hard-coded file to avoid confusion.
2022-10-19 12:59:27 +02:00
Tom Krizek cb0a2ae1dd Revive dupsigs system test
Correctly source conf.sh in dupsigs test scripts (fix issue introduced
by 093af1c00a).

Update dupsigs test for dnssec-dnskey-kskonly default. Since v9.17.20,
the dnssec-dnskey-kskonly is set to yes. Update the test to not expect
the additional RRSIG with ZSK for DNSKEY.

Speed up the test from 20 minutes to 2.5 minutes and make it part of the
default test suite executed in CI.
- decrease number of records to sign from 2000 to 500
- decrease the signing interval by a factor of 6
- shorten the final part of the test after last signing (since nothing
  new happens there)

Finally, clarify misleading comments about (in)sufficient time for zone
re-signing. The time used in the test is in fact sufficient for the
re-signing to happen. If it wasn't, the previous ZSK would end up being
deleted while its signatures would still be present, which is a
situation where duplicate signatures can still happen.
2022-10-19 12:59:27 +02:00
Tom Krizek 7495deea3e Revive the stress system test
Ensure the port numbers are dynamically filled in with copy_setports.

Clarify test fail condition.

Make the stress test part of the default test suite since it doesn't
seem to run too long or interfere with other tests any more (the
original note claiming so is more than 20 years old).

Related !6883
2022-10-19 12:59:27 +02:00
Tom Krizek 235ae5f344 Revive dialup system test
Properly template the port number in config files with copy_setports.

The test takes two minutes on my machine which doesn't seem like a
proper justification to exclude it from the test suite, especially
considering we run these tests in parallel nowadays. The resource usage
doesn't seems significantly increased so it shouldn't interfere with
other system tests.

There also exists a precedent for longer running system tests that are
already part of the default system test suite (e.g. serve-stale takes
almost three minutes on the same machine).
2022-10-19 12:59:27 +02:00
Tom Krizek 1e7d832342 Make digdelv test work in different network envs
When a target server is unreachable, the varying network conditions may
cause different ICMP message (or no message). The host unreachable
message was discovered when attempting to run the test locally while
connected to a VPN network which handles all traffic.

Extend the dig output check with "host unreachable" message to avoid a
false negative test result in certain network environments.
2022-10-19 12:59:25 +02:00
Michal Nowak 3d968b4a4c Merge branch '3394-cve-2022-2795-test' into 'main'
Add tests for CVE-2022-2795

Closes #3394

See merge request isc-projects/bind9!6945
2022-10-19 10:31:56 +00:00
Michał KępieńandMichal Nowak 604d8f0b96 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.
2022-10-19 11:53:08 +02:00
Artem Boldariev 64287e4889 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
2022-10-18 15:58:14 +00:00
Artem Boldariev 09dcc914b4 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.
2022-10-18 18:30:24 +03:00
Michal Nowak 9b8a72735b 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
2022-10-18 15:18:54 +00:00
Evan HuntandMichal Nowak 3c11fafadf 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.
2022-10-18 17:16:00 +02:00
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 NowakandOndřej Surý 759e8a6671 Add CI check for Grep warnings 2022-10-17 09:08:15 +02:00
Michal NowakandOndřej Surý 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 NowakandOndřej Surý 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 FinchandOndřej Surý 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 FinchandOndřej Surý 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 FinchandOndřej Surý 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 FinchandOndřej Surý 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
Petr Špaček 53b3ceacd4 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.
2022-10-13 17:04:02 +02:00
Petr ŠpačekandTony Finch 8a3aa8bda4 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>
2022-10-13 13:08:28 +02:00
Ondřej Surý dbc1166704 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
2022-10-13 05:37:48 +00:00
Artem Boldariev 95a551de7b 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.
2022-10-12 21:52:52 +03:00
Artem Boldariev 354494cd10 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.
2022-10-12 21:46:39 +03:00
Ondřej Surý 2de8a8e8c7 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
2022-10-12 17:24:24 +00:00
Ondřej Surý ed37949d5f Restore ignoring ISC_R_CONNREFUSED in connect_read_cb
In ac4cc8443d, 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))
2022-10-12 19:21:42 +02:00
Ondřej Surý 07a9bf4a88 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
2022-10-12 13:38:41 +00:00
Ondřej Surý 8bddd8d357 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
2022-10-12 13:36:31 +00:00
Ondřej Surý 076cdf7444 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.
2022-10-12 15:36:25 +02:00
Ondřej Surý af257140e6 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).
2022-10-12 15:36:25 +02:00
Ondřej Surý b6b7a6886a 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.
2022-10-12 15:36:25 +02:00
Ondřej Surý d7cfb7c792 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.
2022-10-12 15:33:58 +02:00
Ondřej Surý 946cf3396f 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
2022-10-12 13:33:38 +00:00
Artem Boldariev 070d373c56 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.
2022-10-12 16:24:04 +03:00
Artem Boldariev eaebb92f3e 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.
2022-10-12 16:24:04 +03:00
Artem Boldariev 6789b88d25 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
2022-10-12 16:24:04 +03:00
Ondřej Surý 1c026f3286 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
2022-10-12 13:19:03 +00:00
Ondřej Surý ac4cc8443d 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.
2022-10-12 15:07:53 +02:00
Arаm Sаrgsyаn 981d6ef1c0 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
2022-10-12 09:00:21 +00:00
Aram Sargsyan be95ba0119 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
2022-10-12 08:21:35 +00:00
Ondřej Surý 5dbbc29632 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
2022-10-11 13:02:14 +00:00
Ondřej Surý 02c42a20b7 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.
2022-10-11 15:01:35 +02:00
Michał Kępień c61818f3cb 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
2022-10-11 09:55:51 +00:00
Michał Kępień 18e20f95f6 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.
2022-10-11 11:54:57 +02:00
Michał Kępień 9146b956ae 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.
2022-10-11 11:54:57 +02:00
Michał Kępień d5fa1cb9dc 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
2022-10-10 21:36:36 +00:00
Michał Kępień 87bf9b342b Set up release notes for BIND 9.19.7 2022-10-10 23:17:49 +02:00
Michał Kępień 0a758ebc95 Update BIND version to 9.19.7-dev 2022-10-10 23:17:49 +02:00
Michał Kępień cb867d2ef0 Update BIND version for release 2022-10-10 09:00:58 +02:00
Michał Kępień 40432eae00 Add a CHANGES marker 2022-10-10 09:00:58 +02:00
Michał Kępień c5ac304ee7 Merge branch 'michal/prepare-documentation-for-bind-9.19.6' into 'v9_19_6-release'
Prepare documentation for BIND 9.19.6

See merge request isc-private/bind9!463
2022-10-07 11:04:14 +00:00
Michał Kępień f26a08b7f7 Add release note for GL #3587 2022-10-07 12:55:17 +02:00
Michał Kępień 26a8e9093d Reorder release notes 2022-10-07 12:55:17 +02:00
Michał Kępień dfc19673c9 Tweak and reword release notes 2022-10-07 12:55:17 +02:00
Michał Kępień 73686d18bf Prepare release notes for BIND 9.19.6 2022-10-07 12:55:17 +02:00
Petr Špaček d16e0c058b 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
2022-10-06 08:27:08 +00:00
Petr Špaček 5589d0a49c Add Known Issue about config incompatibility 2022-10-06 10:26:33 +02:00
Petr Špaček 058c1744ba Clarify error message about missing inline-signing & dnssec-policy 2022-10-06 10:26:30 +02:00
Mark Andrews 00f4268804 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
2022-10-05 21:33:04 +00:00
Mark Andrews 491a8cfe96 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.
2022-10-06 08:18:03 +11:00
Evan Hunt f2fa141668 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
2022-10-05 19:33:57 +00:00
Ondřej SurýandEvan Hunt 0dcbc6274b 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.
2022-10-05 11:59:36 -07:00
Ondřej SurýandEvan Hunt bff3025396 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.
2022-10-05 11:59:36 -07:00
Michal Nowak 934a6a8b8f Merge branch 'mnowak/drop-flake8-ignore-lists' into 'main'
Drop flake8 ignore lists

See merge request isc-projects/bind9!6778
2022-10-05 16:05:41 +00:00
Michal Nowak f5d9fa6ea4 Drop flake8 ignore lists
flake8 is not used in BIND 9 CI and inline ignore lists are not needed
anymore.
2022-10-05 17:56:24 +02:00
Tony Finch eb5da6bbdb 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
2022-10-05 15:51:20 +00:00
Tony FinchandTony Finch 138908b211 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);
2022-10-05 15:51:05 +00:00
Ondřej Surý 0e92878211 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
2022-10-05 14:44:36 +00:00
Ondřej Surý 5878ff65ee Add CHANGES note for [GL !6398] 2022-10-05 16:44:05 +02:00
Ondřej Surý e18b6fb6a6 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.
2022-10-05 16:44:05 +02:00
Ondřej Surý c0598d404c 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.
2022-10-05 16:44:05 +02:00
Ondřej Surý c1d26b53eb Add and use semantic patch to replace isc_mem_get/allocate+memset
Add new semantic patch to replace the straightfoward uses of:

  ptr = isc_mem_{get,allocate}(..., size);
  memset(ptr, 0, size);

with the new API call:

  ptr = isc_mem_{get,allocate}x(..., size, ISC_MEM_ZERO);
2022-10-05 16:44:05 +02:00
Ondřej Surý dbf5672f32 Replace isc_mem_*_aligned(..., alignment) with isc_mem_*x(..., flags)
Previously, the isc_mem_get_aligned() and friends took alignment size as
one of the arguments.  Replace the specific function with more generic
extended variant that now accepts ISC_MEM_ALIGN(alignment) for aligned
allocations and ISC_MEM_ZERO for allocations that zeroes
the (re-)allocated memory before returning the pointer to the caller.
2022-10-05 16:44:05 +02:00
Tony Finch 4d5fd50f9a Merge branch '3582-coverity-bench-siphash' into 'main'
Suppress division by zero warning

Closes #3582

See merge request isc-projects/bind9!6863
2022-10-05 12:10:18 +00:00
Tony Finch cf715d488b Suppress division by zero warning
Coverity is optimistic that we might do thousands of hashes in less
than a microsecond.

    /tests/bench/siphash.c: 54 in main()
    48     			count++;
    49     		}
    50
    51     		isc_time_now_hires(&finish);
    52
    53     		us = isc_time_microdiff(&finish, &start);
    >>>     CID 358309:  Integer handling issues  (DIVIDE_BY_ZERO)
    >>>     In expression "count * 1000UL / us", division by expression "us" which may be zero has undefined behavior.
    54     		printf("%f us wide-lower len %3zu, %7llu kh/s (%llx)\n",
    55     		       (double)us / 1000000.0, len,
    56     		       (unsigned long long)(count * 1000 / us),
    57     		       (unsigned long long)sum);
    58     	}
    59
2022-10-05 12:31:42 +01:00
Petr Špaček 61b3dcc086 Merge branch '3572-fix-duplicate-link-anchor' into 'main'
Deduplicate link anchors in the ARM

See merge request isc-projects/bind9!6846
2022-10-05 09:44:15 +00:00
Petr Špaček 137e0f4e0e Remove manually defined anchors pointing to statement definitions
This is hopefully end of duplication. This batch did not cause clashes
in Sphinx but it was pointless nonetheless as we have auto-generated
anchors for all statements.
2022-10-05 11:36:22 +02:00
Tom KrizekandPetr Špaček ea2d213f34 Remove trailing whitespaces 2022-10-05 11:36:22 +02:00
Petr Špaček 9a7c2b370e Deduplicate link anchors in the ARM
Some statement names like "allow-query" had manually defined link anchor
_allow-query and also implicit anchor created by
.. namedconf:statement:: syntax. This causes warnings if a ambiguous
reference is made using :any:`allow-query` syntax.

Remove (hopefully all) manually defined anchors which pointed to
identical place as the implicit anchor. This allows :any: to work.

In rare cases where manual anchor points to descriptive text separated
from statement definition the reference was disamguated by replacing
:any:`notify` with :ref:`notify` (for manual anchor)
vs. :namedconf:ref:`notify` (for statement definition).

Please note that `options` statement is a trap: It is ambiguous even
without manual anchor because rndc.conf has its own `options`. Use
:namedconf:ref:`options` vs. :rndcconf:ref:`options` to select
appropriate target.
2022-10-05 11:36:19 +02:00
Mark Andrews 952e1cb454 Merge branch '3338-zero-system-test-add-forensics' into 'main'
Add additional forensics to zero system test

See merge request isc-projects/bind9!6295
2022-10-05 08:26:00 +00:00
Mark Andrews 285351d4b2 Add additional forensics to zero system test 2022-10-05 07:46:01 +00:00
Petr Špaček 6f6f925b9f Merge branch 'pspacek/tsan-ci-artifacts-fix' into 'main'
Fix TSAN artifact gathering in CI

See merge request isc-projects/bind9!6853
2022-10-05 07:43:56 +00:00
Petr Špaček 9559eb3b21 Fix TSAN artifact gathering in CI
Fixup for 2c3b2dabe9.

We forgot to update TSAN paths when moving all the unit tests to
/tests/.  Let's remove paths from find to make it less dependent on
exact location, and store all untracked files as we do in the normal
unit test template.

Related: !6243
2022-10-05 09:43:07 +02:00
Matthijs Mekking faba965871 Merge branch 'matthijs-refactor-serve-stale' into 'main'
Refactor serve-stale stale-answer-client-timeout 0

See merge request isc-projects/bind9!6845
2022-10-05 07:15:27 +00:00
Matthijs Mekking 0681b15225 If refresh stale RRset times out, start stale-refresh-time
The previous commit failed some tests because we expect that if a
fetch fails and we have stale candidates in cache, the
stale-refresh-time window is started. This means that if we hit a stale
entry in cache and answering stale data is allowed, we don't bother
resolving it again for as long we are within the stale-refresh-time
window.

This is useful for two reasons:
- If we failed to fetch the RRset that we are looking for, we are not
  hammering the authoritative servers.

- Successor clients don't need to wait for stale-answer-client-timeout
  to get their DNS response, only the first one to query will take
  the latency penalty.

The latter is not useful when stale-answer-client-timeout is 0 though.

So this exception code only to make sure we don't try to refresh the
RRset again if it failed to do so recently.
2022-10-05 08:20:48 +02:00
Matthijs Mekking 64d51285d5 Reuse recursion type code for refresh stale RRset
Refreshing a stale RRset is similar to prefetching an RRset, so
reuse the existing code. When refreshing an RRset we need to clear
all db options related to serve-stale so that stale RRsets in cache
are ignored during the refresh.

We no longer need to set the "nodetach" flag, because the refresh
fetch is now a "fetch and forget". So we can detach from the client
in the query_send().

This code will break some serve-stale test cases, this will be fixed
in the successor commit.

TODO: add explanation why the serve-stale test cases fail.
2022-10-05 08:20:48 +02:00
Matthijs Mekking 5fb8e555bc Add new recursion type for refreshing stale RRset
Refreshing a stale RRset is similar to a prefetch query, so we can
refactor this code to use the new recursion types introduced in !5883.
2022-10-05 08:20:48 +02:00
Ondřej Surý d4df60179a Merge branch 'ondrej-implement-case-insensitive-siphash-2-4' into 'main'
Add a case-insensitive option directly to siphash 2-4 implementation

See merge request isc-projects/bind9!6789
2022-10-04 09:03:00 +00:00
Ondřej Surý c14a4ac763 Add a case-insensitive option directly to siphash 2-4 implementation
Formerly, the isc_hash32() would have to change the key in a local copy
to make it case insensitive.  Change the isc_siphash24() and
isc_halfsiphash24() functions to lowercase the input directly when
reading it from the memory and converting the uint8_t * array to
64-bit (respectively 32-bit numbers).
2022-10-04 10:32:40 +02:00
Tony FinchandOndřej Surý de10d697ab A simple siphash benchmark
To see the effect of adding a case-insentitive option.
2022-10-04 10:32:40 +02:00
Mark Andrews 0f78fbc461 Merge branch '3544-add-dohpath-parsing-to-svbc' into 'main'
Resolve "Add dohpath parsing to SVCB"

Closes #3544

See merge request isc-projects/bind9!6774
2022-10-04 04:30:04 +00:00
Mark Andrews 5f07fe8cbb Use strnstr implementation from FreeBSD if not provided by OS 2022-10-04 14:21:41 +11:00
Mark Andrews 2f3441b40a Add release note for [GL #3544] 2022-10-04 14:21:41 +11:00
Mark Andrews 335b397e15 Add CHANGES note for [GL #3544] 2022-10-04 14:21:41 +11:00
Mark Andrews 6d561d3886 Add support for 'dohpath' to SVCB (and HTTPS)
dohpath is specfied in draft-ietf-add-svcb-dns and has a value
of 7.  It must be a relative path (start with a /), be encoded
as UTF8 and contain the variable dns ({?dns}).
2022-10-04 14:21:41 +11:00
Tony Finch 34605e9772 Merge branch '3549-isc-resource-ub' into 'main'
Avoid signed integer overflow in isc_resource_setlimit()

Closes #3549

See merge request isc-projects/bind9!6788
2022-10-03 11:38:20 +00:00
Tony Finch 4e37a6f77a Avoid signed integer overflow in isc_resource_setlimit()
On systems with signed rlim_t the old code calculated its maximum
value by shifting 1 into the sign bit, which is undefined behaviour.
Avoid the bug by using an unsigned shift.
2022-10-03 11:37:17 +00:00
Ondřej Surý 1279d2dee9 Merge branch 'ondrej-increase-the-time-to-wait-for-servers-to-gracefully-shutdown' into 'main'
Be more patient when stopping servers in the system tests

See merge request isc-projects/bind9!6847
2022-09-30 15:38:47 +00:00
Ondřej Surý d971472321 Be more patient when stopping servers in the system tests
When the TCP test is run on the busy server, the server might take a
while to wind the server down because it might still be processing all
that 300k invalid XFR requests.

Increate the rncd wait time to 120 seconds, the SIGTERM time to 300
seconds, and reduce the time to wait for ans servers from 1200 second
to just 120 seconds.
2022-09-30 17:12:44 +02:00
Ondřej Surý 3b01b436a2 Merge branch '3571-fix-data-race-in-dns_nta' into 'main'
Don't stop timer from dns__nta_shutdown()

Closes #3571

See merge request isc-projects/bind9!6844
2022-09-30 14:18:29 +00:00
Ondřej Surý 01f0f9dcdc Don't stop timer from dns__nta_shutdown()
The dns__nta_shutdown() could be run from different threads and it was
accessing nta->timer unlocked.  Don't check and stop the timer from
dns__nta_shutdown() directly, but leave it for the async callback.
2022-09-30 15:24:20 +02:00
Ondřej Surý 9beb68513b Merge branch '3555-refactor-isc_ratelimiter-API' into 'main'
Refactor isc_ratelimiter API

Closes #3555

See merge request isc-projects/bind9!6842
2022-09-30 13:23:31 +00:00
Ondřej Surý 477eb22c12 Refactor isc_ratelimiter API
Because the dns_zonemgr_create() was run before the loopmgr was started,
the isc_ratelimiter API was more complicated that it had to be.  Move
the dns_zonemgr_create() to run_server() task which is run on the main
loop, and simplify the isc_ratelimiter API implementation.

The isc_timer is now created in the isc_ratelimiter_create() and
starting the timer is now separate async task as is destroying the timer
in case it's not launched from the loop it was created on.  The
ratelimiter tick now doesn't have to create and destroy timer logic and
just stops the timer when there's no more work to do.

This should also solve all the races that were causing the
isc_ratelimiter to be left dangling because the timer was stopped before
the last reference would be detached.
2022-09-30 10:36:30 +02:00
Ondřej Surý f7fc48a2ba Add isc_ratelimiter API unit tests
The isc_ratelimiter API was missing unit tests.

Add a new set of unit tests for the isc_ratelimiter API.
2022-09-30 10:36:30 +02:00
Ondřej Surý 09b50d2237 Fix small problems in the isc_ratelimiter 2022-09-30 09:50:17 +02:00
Ondřej Surý 1e2ededb07 Add missing DbC check for name##_detach in ISC_REFCOUNT_IMPL macro
The detach function in the ISC_REFCOUNT_IMPL macro was missing DbC
checks, add them.
2022-09-30 09:50:17 +02:00
Mark Andrews b242790e1d Merge branch '3569-dns-message-checksig-create-test-key-directory' into 'main'
Resolve "dns_message_checksig under oss_fuzz is not seeing the data files"

Closes #3569

See merge request isc-projects/bind9!6840
2022-09-30 02:42:18 +00:00
Mark Andrews 1849a8a526 Add CHANGES note for [GL #3569] 2022-09-30 02:19:52 +00:00
Mark Andrews 033057ba9d Create a key directory in /tmp
Access to the source tree is not available with oss_fuzz.  Have
fuzz/dns_message_checksig build and populate a key directory for
the fuzzer to use.  This contains a key pair and a zone file which
has the public key from the key pair.  Clean it up on shutdown.
2022-09-30 02:19:52 +00:00
Ondřej Surý 39ae4a145b Merge branch 'ondrej-remove-debug-print-from-run_server' into 'main'
Remove debugging fprintf from run_server()

See merge request isc-projects/bind9!6843
2022-09-29 12:23:11 +00:00
Ondřej Surý 36cdeb7656 Remove debugging fprintf from run_server()
In the loopmgr branch, we forgot the scissors^Hdebugging output in the
patient^Hnamed, remove it.
2022-09-29 14:22:58 +02:00
Tony Finch 2ffeb0248b Merge branch 'fanf-free-non-null' into 'main'
Improve DBC in isc_mem_free

See merge request isc-projects/bind9!6839
2022-09-29 10:07:46 +00:00
Tony Finch a4930e1969 Improve DBC in isc_mem_free
Unlike standard free(), isc_mem_free() is not a no-op when passed a
NULL pointer. For size accounting purposes it calls sallocx(), which
crashes when passed a NULL pointer. To get more helpful diagnostics,
REQUIRE() that the pointer is not NULL so that when the programmer
makes a mistake they get a backtrace that shows what went wrong.
2022-09-29 10:07:34 +00:00
Ondřej Surý 05d60071a7 Merge branch '3534-make-the-isc_nm_udp_send-on-shutdown-callback-asynchronous' into 'main'
Call the isc__nm_udp_send() callbacks asynchronously on shutdown

Closes #3534

See merge request isc-projects/bind9!6828
2022-09-29 10:04:40 +00:00
Ondřej Surý b4a43bf2f2 Add developer documentation on the netmgr callbacks
Extra care must be taken when executing the callbacks to prevent the
deadlocks on the caller's side.  Add a paragraph that addresses when we
can and when we cannot call the callbacks directly.
2022-09-29 11:12:15 +02:00
Ondřej Surý 173c352452 Call the isc__nm_udp_send() callbacks asynchronously on shutdown
The isc__nm_udp_send() callback would be called synchronously when
shutting down or when the socket has been closed.  This could lead to
double locking in the calling code and thus those callbacks needs to be
called asynchronously.
2022-09-29 11:06:58 +02:00
Arаm Sаrgsyаn cd32969138 Merge branch '3512-xot-breaks-ddns-update-forwarding' into 'main'
Resolve "XoT breaks DDNS update forwarding"

Closes #3512

See merge request isc-projects/bind9!6710
2022-09-28 10:28:05 +00:00
Aram Sargsyan 504529dfa9 Add a release note for [GL #3512] 2022-09-28 09:36:24 +00:00
Aram Sargsyan aa4319f263 Add a CHANGES note for [GL #3512] 2022-09-28 09:36:24 +00:00
Aram Sargsyan ae4296729c Test dynamic update forwarding when using a TLS-enabled primary
Add several test cases in the 'upforwd' system test to make sure
that different scenarios of Dynamic DNS update forwarding are
tested, in particular when both the original and forwarded requests
are over Do53, or DoT, or they use different transports.
2022-09-28 09:36:24 +00:00
Aram Sargsyan 3d7103bd21 Fix dynamic update forwarding when using a TLS-enabled primary
Now that the 'dns_request' supports using TLS transport, implement
dynamic update forwarding using DoT when the primary server is
configured to use a TLS transport.

Previously, when using such configuration, the dynamic update forwarding
feature was broken.
2022-09-28 09:01:05 +00:00
Mark Andrews 445aeee58d Merge branch '3562-assign-default-value-to-suffix' into 'main'
Resolve "suffix may be used before being assigned in qmin/ans3/ans.py"

Closes #3562

See merge request isc-projects/bind9!6811
2022-09-28 00:09:28 +00:00
Mark Andrews 432064f63c Suffix may be used before it is assigned a value
CID 350722 (#5 of 7): Bad use of null-like value (FORWARD_NULL)
        12. invalid_operation: Invalid operation on null-like value suffix.
    145        r.authority.append(
    146            dns.rrset.from_text(
    147                "icky.ptang.zoop.boing." + suffix,
    148                1,
    149                IN,
    150                NS,
    151                "a.bit.longer.ns.name." + suffix,
    152            )
    153        )
2022-09-27 23:47:12 +00:00
Mark Andrews edc804b9b8 Merge branch '3551-missing-rsa_free-call-in-opensslrsa_verify2' into 'main'
Resolve "Missing RSA_free call in opensslrsa_verify2"

Closes #3551

See merge request isc-projects/bind9!6810
2022-09-27 23:46:26 +00:00
Mark Andrews 1e3680193a Add CHANGES note for [GL #3551] 2022-09-28 09:25:13 +10:00
Mark Andrews a47235f4f5 Check BN_dup results in rsa_check 2022-09-28 09:24:34 +10:00
Mark Andrews 483c5a1978 Free 'n' on error path in rsa_check 2022-09-28 09:24:34 +10:00
Mark Andrews db70c30213 Check that 'e' and 'n' are allocated in opensslrsa_fromdns 2022-09-28 09:24:34 +10:00
Mark Andrews 5603cd69d1 Check that 'e' and 'n' are non-NULL in opensslrsa_todns 2022-09-28 09:24:34 +10:00
Mark Andrews a2b51ca6ac Free 'rsa' if 'e' is NULL in opensslrsa_verify2 2022-09-28 09:24:34 +10:00
Ondřej Surý 1f670f4b69 Merge branch '3559-provide-custom-isc_mem-based-allocators-for-external-libraries' into 'main'
Use custom isc_mem based allocator for libuv, OpenSSL, and libxml2

Closes #3559

See merge request isc-projects/bind9!6807
2022-09-27 15:55:09 +00:00
Ondřej Surý be3a159b54 Add CHANGES note for [GL #3559] 2022-09-27 17:53:04 +02:00
Ondřej Surý 3b31f7f563 Add autoconf option to enable memory leak detection in libraries
There's a known memory leak in the engine_pkcs11 at the time of writing
this and it interferes with the named ability to check for memory leaks
in the OpenSSL memory context by default.

Add an autoconf option to explicitly enable the memory leak detection,
and use it in the CI except for pkcs11 enabled builds.  When this gets
fixed in the engine_pkc11, the option can be enabled by default.
2022-09-27 17:53:04 +02:00
Ondřej Surý d1cc847ab0 Check the libuv, OpenSSL and libxml2 memory context on exit
As we can't check the deallocations done in the library memory contexts
by default because it would always fail on non-clean exit (that happens
on error or by calling exit() early), we just want to enable the checks
to be done on normal exit.
2022-09-27 17:10:42 +02:00
Ondřej Surý e537fea861 Use custom isc_mem based allocator for libxml2
The libxml2 library provides a way to replace the default allocator with
user supplied allocator (malloc, realloc, strdup and free).

Create a memory context specifically for libxml2 to allow tracking the
memory usage that has originated from within libxml2.  This will provide
a separate memory context for libxml2 to track the allocations and when
shutting down the application it will check that all libxml2 allocations
were returned to the allocator.

Additionally, move the xmlInitParser() and xmlCleanupParser() calls from
bin/named/main.c to library constructor/destructor in libisc library.
2022-09-27 17:10:42 +02:00
Ondřej Surý 236d4b7739 Use custom isc_mem based allocator for OpenSSL
The OpenSSL library provides a way to replace the default allocator with
user supplied allocator (malloc, realloc, and free).

Create a memory context specifically for OpenSSL to allow tracking the
memory usage that has originated from within OpenSSL.  This will provide
a separate memory context for OpenSSL to track the allocations and when
shutting down the application it will check that all OpenSSL allocations
were returned to the allocator.
2022-09-27 17:10:42 +02:00
Ondřej Surý a32d06dd42 Use custom isc_mem based allocator for libuv
The libuv library provides a way to replace the default allocator with
user supplied allocator (malloc, realloc, calloc and free).

Create a memory context specifically for libuv to allow tracking the
memory usage that has originated from within libuv.  This requires
libuv >= 1.38.0 which provides uv_library_shutdown() function that
assures no more allocations will be made.
2022-09-27 17:10:42 +02:00
Ondřej Surý a30e75db86 Check for working __builtin_mul_overflow() implementation
Instead of using generic HAVE_BUILTIN_OVERFLOW, we need to check whether
the overflow functions actually work as there was a bug in GCC that it
would not detect mul overflow when compiled with `-m32` option without
optimizations and the bug was fixed only for GCC 6.5+ and 7.3+/8+.

For further details see: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82274
2022-09-27 17:10:42 +02:00
Ondřej Surý 2d2022a509 Make the debugging flags local to the memory context
Previously, the isc_mem_debugging would be single global variable that
would affect the behavior of the memory context whenever it would be
changed which could be after some allocation were already done.

Change the memory debugging options to be local to the memory context
and immutable, so all allocations within the same memory context are
treated the same.
2022-09-27 17:10:41 +02:00
Ondřej Surý 56f9c886aa Merge branch '3567-bump-the-minimal-libuv-version-to-1.34.0' into 'main'
Bump the libuv requirement to libuv >= 1.34.0

Closes #3567

See merge request isc-projects/bind9!6826
2022-09-27 15:09:53 +00:00
Ondřej Surý 178e0317a6 Add CHANGES and release note for [GL #3567] 2022-09-27 17:09:11 +02:00
Ondřej Surý 0086ebf3fc Bump the libuv requirement to libuv >= 1.34.0
By bumping the minimum libuv version to 1.34.0, it allows us to remove
all libuv shims we ever had and makes the code much cleaner.  The
up-to-date libuv is available in all distributions supported by BIND
9.19+ either natively or as a backport.
2022-09-27 17:09:10 +02:00
Ondřej Surý d5bead54c0 Drop Ubuntu 18.04 bionic from the CI
The Ubuntu 18.04 bionic will go EOL in April 2023 before the next stable
BIND 9 release, so we can drop this for the next stable BIND 9 release.
2022-09-27 17:09:10 +02:00
Ondřej Surý 7238c85c88 Drop Debian buster from the CI
The Debian buster is official EOL and in the LTS mode, so we can drop
this for the next stable BIND 9 release.
2022-09-27 17:09:10 +02:00
Matthijs Mekking 444461e9b1 Merge branch 'matthijs-dnssec-guide-dnssec-policy-requires-inline-signing' into 'main'
Add dnssec-policy inline-signing requirement to documentation

See merge request isc-projects/bind9!6823
2022-09-27 15:08:03 +00:00
Matthijs Mekking 18d230a584 Add inline-signing to config examples
Add 'inline-signing yes;' to configuration examples to have working
copy paste configurations.
2022-09-27 17:06:30 +02:00
Matthijs Mekking 5d454a7158 Update inline-signing requirement to ARM
This change was made in !6403, but the appropriate documentation
changes were not applied to the ARM.
2022-09-27 17:06:30 +02:00
Matthijs Mekking 09522c8d73 Add inline-signing requirement to DNSSEC Guide
This change was made in !6403, but the appropriate documentation
changes were not applied to the DNSSEC Guide.
2022-09-27 17:06:30 +02:00
Petr Špaček 489320e961 Merge branch '3541-have-named-v-report-supported-algorithms' into 'main'
Report supported crypto algorithms

Closes #3541

See merge request isc-projects/bind9!6771
2022-09-27 14:55:11 +00:00
Petr Špaček c138a8aa59 Add release note for new crypto algorithm logging 2022-09-27 16:54:39 +02:00
Petr Špaček c648e280e4 Document list of crypto algorithms in named -V output 2022-09-27 16:54:39 +02:00
Mark AndrewsandPetr Špaček d34ecdb366 Deduplicate string formating 2022-09-27 16:54:39 +02:00
Mark AndrewsandPetr Špaček e876de442e Add CHANGES entry for [GL #3541] 2022-09-27 16:54:39 +02:00
Mark AndrewsandPetr Špaček 3156d36495 silence scan-build false positive 2022-09-27 16:54:39 +02:00
Mark AndrewsandPetr Špaček cb1515e71f Report algorithms supported by named at startup 2022-09-27 16:54:39 +02:00
Mark AndrewsandPetr Špaček b308f866c0 Have 'named -V' report supported algorithms
These cover DNSSEC, DS, HMAC and TKEY algorithms.
2022-09-27 16:54:39 +02:00
Mark AndrewsandPetr Špaček 151cc2fff9 Replace alg_totext with dst_hmac_algorithm_totext
The new library function will be reused by subsequent commits.
2022-09-27 16:54:39 +02:00
Mark AndrewsandPetr Špaček 09f7e0607a Convert DST_ALG defines to enum and group HMAC algorithms
The HMACs and GSSAPI are just using unallocated values.
Moving them around shouldn't cause issues.
Only the dnssec system test knew the internal number in use for hmacmd5.
2022-09-27 16:54:36 +02:00
Arаm Sаrgsyаn a84c422fc8 Merge branch '3513-cid-356329-error-handling-in-dnssec-signzone.c' into 'main'
Resolve "CID 356329: Error handling issues in bin/dnssec/dnssec-signzone.c"

Closes #3513

See merge request isc-projects/bind9!6714
2022-09-27 14:34:23 +00:00
Aram Sargsyan 4509c4f1bd Use the return value of isc_task_create()
Improve the error handling by checking the isc_task_create()
function's return value.

CID 356329:

    /bin/dnssec/dnssec-signzone.c: 3732 in main()
    3726     	if (directory == NULL) {
    3727     		directory = ".";
    3728     	}
    3729
    3730     	isc_managers_create(&mctx, ntasks, &loopmgr, &netmgr, &taskmgr);
    3731
    >>>     CID 356329:  Error handling issues  (CHECKED_RETURN)
    >>>     Calling "isc__task_create" without checking return value (as is done elsewhere 16 out of 18 times).
    3732     	isc_task_create(taskmgr, &write_task, 0);
    3733
    3734     	result = dst_lib_init(mctx, engine);
    3735     	if (result != ISC_R_SUCCESS) {
    3736     		fatal("could not initialize dst: %s",
    3737
2022-09-27 12:22:34 +00:00
Mark Andrews eb7b068bf8 Merge branch '3557-catalog-zone-check-key-names' into 'main'
Resolve "Catalog zone processing failed to detect TSIG key changes for primaries"

Closes #3557

See merge request isc-projects/bind9!6806
2022-09-27 12:17:08 +00:00
Mark Andrews eacf41a20a Add release note for [GL #3557] 2022-09-27 21:54:02 +10:00
Mark Andrews 0774dacf2d Add CHANGES note for [GL #3557] 2022-09-27 21:54:02 +10:00
Mark Andrews 176e172210 Check that changing the TSIG key is successful
Switch the primary to require 'next_key' for zone transfers then
update the catalog zone to say to use 'next_key'.  Next update the
zones contents then check that those changes are seen on the
secondary.
2022-09-27 21:54:02 +10:00
Mark Andrews 9172bd9b5a Check that primary key names have not changed
When looking for changes in a catalog zone member zone we need to
also check if the TSIG key name associated with a primary server
has be added, removed or changed.
2022-09-27 21:54:02 +10:00
Petr Špaček 75424ec23a Merge branch 'pspacek/fix-dns_message_checksig-out-of-tree' into 'main'
Fix dns_message_checksig fuzzer

Closes #3565

See merge request isc-projects/bind9!6822
2022-09-27 11:22:56 +00:00
Ondřej SurýandPetr Špaček 16377100ae Fix stack-use-after-scope in dns_message_checksig test
Previously stack with buffer for test dns message went out of scope
before the message was processed. For fuzz testing its better to avoid
allocation, so let's avoid allocations completely and use simplest
possible static buffer.

Fixes: #3565
2022-09-27 13:06:01 +02:00
Petr Špaček 4108d79c9a Fix dns_message_checksig in out-of-tree setup
Hardcoded path was missing FUZZDIR prefix.

Related: !5923
2022-09-27 11:21:42 +02:00
Petr Špaček d102c59b96 Detect errors in fuzzer initialization
Incomplete initialization typically causes mysterious failures later on,
so let's err out early.
2022-09-27 11:21:38 +02:00
Michał Kępień 547f15ff11 Merge branch 'mnowak/add-fedora-36' into 'main'
Add Fedora 36

See merge request isc-projects/bind9!6297
2022-09-27 07:39:31 +00:00
Michal NowakandMichał Kępień a313c49a3b Add Fedora 36 2022-09-27 09:37:09 +02:00
Evan Hunt df51d22726 Merge branch '3553-static-buffer-functions' into 'main'
change ISC__BUFFER macros to inline functions

See merge request isc-projects/bind9!6801
2022-09-27 07:23:06 +00:00
Evan Hunt 1926ddc987 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.
2022-09-26 23:49:27 -07:00
Petr Špaček c42d980d4a Merge branch 'bug/main/doc-arm-rhel9' into 'main'
Compatibility for building ARM on older sphinx

See merge request isc-projects/bind9!6815
2022-09-26 15:15:27 +00:00
Petr MenšíkandPetr Špaček 3db7e241d2 Simplify allowing warnings during ARM build
RHEL8 Sphinx does not support all features used in ARM building. But
with few emitted warnings it can build the documentation fine. Simplify
warnings acceptance by allowing make doc SPHINX_W=''.
2022-09-26 17:09:56 +02:00
Petr MenšíkandPetr Špaček bc6c6b1184 Compatibility for building ARM on older sphinx
Make documentation building successful even on RHEL9 sphinx 3.4.3. It
does not like case-insensitive matching of terms, so provide lowercase
text description with Uppercase word reference.
2022-09-26 17:09:51 +02:00
Petr Špaček 12bce9e69b Merge branch 'ondrej-add-dns_message_checktsig-fuzzer' into 'main'
Add dns_message_checksig() fuzzer

See merge request isc-projects/bind9!5923
2022-09-26 14:30:16 +00:00
Petr Špaček 983822abcf Add seed to reproduce issue memory leak in dns_message_checktsig
Related: #3547
2022-09-26 16:29:36 +02:00
Mark AndrewsandPetr Špaček 6237273205 Add CHANGES notes for [GL !5923] 2022-09-26 16:29:35 +02:00
Mark AndrewsandPetr Špaček 805e2ba31d Add the ability to dig to specify the signing time 2022-09-26 16:28:23 +02:00
Mark AndrewsandPetr Špaček 4d248ee78e Allow dig to SIG(0) sign a message 2022-09-26 16:28:23 +02:00
Mark AndrewsandPetr Špaček c127a2aefc Add a SIG(0) request seed 2022-09-26 16:28:23 +02:00
Mark AndrewsandPetr Špaček 3c28608c9f Add TSIG reply seed 2022-09-26 16:28:23 +02:00
Mark AndrewsandPetr Špaček f3d47bc8e0 Add TSIG request seed 2022-09-26 16:28:23 +02:00
Ondřej SurýandPetr Špaček 4da0180ba2 Add dns_message_checksig() fuzzer
dns_message_checksig is called in a number of scenarios

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

we use the first two octets of the seed to configure the calling
environment with the remainder of the seed being the rdata of the
TSIG/SIG(0) record.
2022-09-26 16:28:23 +02:00
Ondřej SurýandPetr Špaček 3e85d8c3d6 Add the ability specify the signing / verification time
When fuzzing it is useful for all signing operations to happen
at a specific time for reproducability.  Add two variables to
the message structure (fuzzing and fuzztime) to specify if a
fixed time should be used and the value of that time.
2022-09-26 16:28:12 +02:00
Ondřej Surý 7ea6796a3e Merge branch 'ondrej-use-uv_random' into 'main'
Switch the CSPRNG function from RAND_bytes() to uv_random()

See merge request isc-projects/bind9!6803
2022-09-26 13:32:41 +00:00
Ondřej Surý b4e131ac77 Add CHANGES note for [GL !6803] 2022-09-26 15:13:11 +02:00
Ondřej Surý 1baed21688 Switch the CSPRNG function from RAND_bytes() to uv_random()
The RAND_bytes() implementation differs between the OpenSSL versions and
uses the system entropy only for seeding its internal CSPRNG.  The
uv_random() on the other hand uses the system provided CSPRNG.

Switch from RAND_bytes() to uv_random() to use system provided CSPRNG.
2022-09-26 15:13:11 +02:00
Petr Špaček 126c9c7419 Merge branch '3547-dns_message_checksig-leak-fix' into 'main'
Fix memory leak in dns_message_checksig() - SIG(0) sigs

Closes #3547

See merge request isc-projects/bind9!6787
2022-09-26 09:55:40 +00:00
Mark AndrewsandPetr Špaček d6ad56bd9e Stop passing mctx to dns_rdata_tostruct as it is unnecessary for SIG
dns_rdata_tostruct doesn't need a mctx passed to it for SIG (the signer
is already expanded at this point). About the only time when mctx is
needed is when the structure is to be used after the rdata has been
destroyed.
2022-09-26 10:30:57 +02:00
Petr Špaček 69256b3553 Fix memory leak in dns_message_checksig() - SIG(0) sigs
Impact should be visible only in tests or tools because named never
uses view == NULL, which is a necessary condition to trigger this leak.
2022-09-26 10:30:51 +02:00
Arаm Sаrgsyаn d1508a13cb Merge branch '1781-nsupdate-dot' into 'main'
Implement DoT support for nsupdate

Closes #1781

See merge request isc-projects/bind9!6752
2022-09-23 16:10:05 +00:00
Aram Sargsyan 34f06fd2b5 Add a release note for [GL #1781] 2022-09-23 13:27:44 +00:00
Aram Sargsyan 7ea4e4a1ce Add a CHANGES note for [GL #1781] 2022-09-23 13:27:44 +00:00
Aram Sargsyan bd8299d7b5 Document nsupdate options related to DoT
Add documentation for the newly implemented DoT feature of the
nsupdate program.
2022-09-23 13:27:44 +00:00
Aram Sargsyan f2bb80d6ae Extend the nsupdate system test with DoT-related checks
Add a simple test PKI based on the existing one in the doth test.

Check ephemeral, forward-secrecy, and forward-secrecy-mutual-tls
TLS configurations with different scenarios.
2022-09-23 13:23:49 +00:00
Aram Sargsyan 60f1a73754 Fix a typo in doth system test's CA.cfg
The comments in CA.cfg file serve as a good tutorial for setting up
a simple PKI for a system test. There is a typo in one of the presented
commands, which results in openssl not exiting with an error message
instead of generating a certificate.

Fix the typo.
2022-09-23 13:23:49 +00:00
Aram Sargsyan 13000c28c2 Implement DoT support for nsupdate
Implement DNS-over-TLS support for nsupdate. Use DiG's DoT
implementation as a model for the newly added features.
2022-09-23 13:23:49 +00:00
Mark Andrews 73cc9a3232 Merge branch 'bug/main/sha1-disabled-fedora-rhbz2122841' into 'main'
Engine pkcs11 cannot work with OSSL_PARAM on OpenSSL 3.0

See merge request isc-projects/bind9!6711
2022-09-23 03:50:50 +00:00
Mark Andrews e27b063f67 Add release note for [GL !6711] 2022-09-23 13:18:29 +10:00
Mark Andrews 54916b4e45 Add a CHANGES note for [GL !6711] 2022-09-23 13:18:28 +10:00
Mark Andrews 979062ee5d Report how named was built 2022-09-23 13:17:55 +10:00
Mark Andrews 9b13dd7b4d Build against OpenSSL 3.0 in OpenSSL 1.1.0 compatibility mode 2022-09-23 13:17:55 +10:00
Michal NowakandMark Andrews 3dec2deebc Let Debian sid image leverage PKCS#11 with OpenSSL 3 2022-09-23 13:17:55 +10:00
Mark Andrews 6d668b8c34 Update reference to point to doc/arm/build.inc.rst 2022-09-23 13:17:55 +10:00
Mark Andrews f32c52c5ca Document -DOPENSSL_API_COMPAT=10100 in OPTIONS.md 2022-09-23 13:17:55 +10:00
Petr MenšíkandMark Andrews 6c55ea17c6 Remove engine related parts for OpenSSL 3.0
OpenSSL just cannot work with mixing ENGINE_* api mixed with OSSL_PARAM
builders. But it can be built in legacy mode, where deprecated but still
working API would be used.

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

Remove fromlabel processing by OpenSSL 3.0 only functions. They can
return later with a proper provider support for pkcs11.
2022-09-23 13:17:55 +10:00
Petr MenšíkandMark Andrews f92950bb64 Do not use OSSL_PARAM when engine API is compiled
OpenSSL has deprecated many things in version 3.0. If pkcs11 engine
should work then no builder from OpenSSL 3.0 API can be used.

Allow switching to OpenSSL 1.1 like calls even on OpenSSL 3.0 when
OPENSSL_API_COMPAT=10100 is defined. It would still compile and allow
working keys loading from the engine passed on command line.
2022-09-23 13:17:53 +10:00
Petr MenšíkandMark Andrews 71a8f1e7cd Add ENGINE_init and ENGINE_finish calls
According to manual page of ENGINE_init, it should be called explicitly
before any key operations happens. Make it active whole lifetime.
2022-09-23 13:15:16 +10:00
Petr Špaček 5bfec15ad4 Merge branch 'pspacek/fix-out-of-tree-junit' into 'main'
Improve JUnit test status generator for Gitlab CI

See merge request isc-projects/bind9!6166
2022-09-22 14:16:05 +00:00
Petr Špaček 8d095550a8 Unify Python interpreter used by TSAN and JUnit helpers
Reportedly we don't have python2-enabled TSAN builds, so we can remove
one more hardcoded python3 call from .gitlab-ci.yaml.
2022-09-22 15:20:26 +02:00
Petr Špaček c46ad4aec2 Fix JUnit test status generator for out-of-tree system tests
- Use separate paths for tests results and test script
- For tarball tests include the conversion script in the `make dist`
2022-09-22 15:20:23 +02:00
Ondřej Surý e5ff78dfbd Merge branch 'ondrej-loopmgr-cleanup-tcp-implementation' into 'main'
Cleanup the asychronous code in the TCP implementation

See merge request isc-projects/bind9!6703
2022-09-22 12:58:32 +00:00
Ondřej SurýandArtem Boldariev fffd444440 Cleanup the asychronous code in the stream implementations
After the loopmgr work has been merged, we can now cleanup the TCP and
TLS protocols a little bit, because there are stronger guarantees that
the sockets will be kept on the respective loops/threads.  We only need
asynchronous call for listening sockets (start, stop) and reading from
the TCP (because the isc_nm_read() might be called from read callback
again.

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

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

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

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

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

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

Co-authored-by: Ondřej Surý <ondrej@isc.org>
Co-authored-by: Artem Boldariev <artem@isc.org>
2022-09-22 14:51:15 +02:00
Michał Kępień 62813df44b Merge branch '1967-prevent-generating-broken-glueless-referrals' into 'main'
Prevent generating broken glueless referrals

Closes #1967

See merge request isc-projects/bind9!4122
2022-09-22 12:23:22 +00:00
Michał Kępień 07721836a4 Add CHANGES and release notes for [GL #1967] 2022-09-22 14:03:17 +02:00
Michał Kępień 68a004501a Ensure required cached glue is rendered
When looking for required glue, dns_message_rendersection() only
processes the first rdataset associated with the first name added to the
ADDITIONAL section.  If the DNS_RDATASETATTR_REQUIRED attribute is set
for an rdataset which is located somewhere else (i.e. the name it is
associated with is preceded by another name in the ADDITIONAL section),
it will not be honored, i.e. the TC bit will not be set even if the
rdataset does not fit into the response.

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

Note that using ISC_LIST_PREPEND() instead of ISC_LIST_APPEND() is not
necessary when associating the rdataset with its owner name because the
dns_name_t structures are initialized just before the glue rdatasets are
associated with them and therefore they are empty at that point, which
means no other (non-required) rdataset can precede the glue rdatasets
within the dns_name_t structure owning them.
2022-09-22 14:03:17 +02:00
Michał Kępień d977eae211 Mark required glue during glue cache processing
If an NS RRset at the parent side of a delegation point only contains
in-bailiwick NS records, at least one glue record should be included in
every referral response sent for such a delegation point or else clients
will need to send follow-up queries in order to determine name server
addresses.  In certain edge cases (when the total size of a referral
response without glue records was just below to the UDP packet size
limit), named failed to adhere to that rule by sending non-truncated,
glueless referral responses.

Fix the problem by marking all in-bailiwick NS records processed by
glue_nsdname_cb() (the dns_rdataset_additionaldata() callback used by
RBTDB code while iterating over an NS RRset when dns_rdataset_addglue()
is called) with the DNS_RDATASETATTR_REQUIRED flag.  Note that for
simplicity, glue RRsets for all in-bailiwick NS records are marked this
way, even though dns_message_rendersection() only checks the attributes
for the first rdataset associated with the first name added to the
ADDITIONAL section.
2022-09-22 14:03:17 +02:00
Michał Kępień 1814349374 Add tests for broken glueless referrals
If an NS RRset at the parent side of a delegation point only contains
in-bailiwick NS records, at least one glue record should be included in
every referral response sent for such a delegation point or else clients
will need to send follow-up queries in order to determine name server
addresses.  In certain edge cases (when the total size of a referral
response without glue records was just below to the UDP packet size
limit), named failed to adhere to that rule by sending non-truncated,
glueless referral responses.

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

  - type of zone (signed, unsigned),
  - glue record type (A, AAAA, both).
2022-09-22 14:03:17 +02:00
Michał Kępień 791d26b99e Clean up the "glue" system test
Bring the "glue" system test up to speed with other system tests: add
check numbering, ensure test artifacts are preserved upon failure,
improve error reporting, make the test fail upon unexpected errors,
address ShellCheck warnings.
2022-09-22 14:03:17 +02:00
Tony Finch ea57da8717 Merge branch '3548-without-system-jemalloc' into 'main'
A more helpful error when --without-jemalloc is impossible

Closes #3548

See merge request isc-projects/bind9!6796
2022-09-22 08:40:02 +00:00
Tony Finch f0e79458be A more helpful error when --without-jemalloc is impossible
When jemalloc is the system allocator (on FreeBSD and NetBSD), trying
to build --without-jemalloc caused an obscure compiler error. Instead,
complain at configure time that --without-jemalloc cannot work. (It
needs to remain an error because it is vexing when configure quietly
ignores an explicit direction.)
2022-09-22 08:39:47 +00:00
Ondřej Surý c7e2263ec0 Merge branch '3202-convert-isc_timer-to-use-uv_loop' into 'main'
Resolve "Convert the isc_timer API to use isc_nm loops"

Closes #3202 and #3532

See merge request isc-projects/bind9!6763
2022-09-22 08:21:35 +00:00
Ondřej Surý e2043768b6 Add CHANGES note for [GL #3202] 2022-09-22 09:46:25 +02:00
Ondřej Surý 8d7f173e7c Add more unit tests for isc_timer
Add more tests that deal with rescheduling and restarting the existing
timer and measure that the timer fired at the expected intervals.
2022-09-22 09:46:25 +02:00
Ondřej SurýandEvan Hunt 6797ca49cf Wait for the telemetry check to finish
Instead of expecting that telemetry check has already finished,
wait for it for maximum of three seconds, because named is run with
-tat=3, so the telemetry check must happen with 3 second window.

Co-authored-by: Evan Hunt <each@isc.org>
2022-09-22 09:45:54 +02:00
Ondřej SurýandEvan Hunt 5319d4f6c5 Require isc_timer to be manipulated on the timer loop
Each isc_timer needs to be created, started and destroyed on the current
loop.  The isc_timer_stop() can be run on any loop, but when run from
different loop than the one associated with the timer, the request to
stop the timer will be recorded in atomic variable and the underlying
uv_timer_t will be stopped on next uv_timer_t callback call.  This
allows any thread to stop the timer.
2022-09-21 14:25:33 -07:00
Ondřej SurýandEvan Hunt 5a473b305d Create the negative trust anchor timer on the current loop
Instead of always creating the trust anchor timer (dns_nta_t) on the
main loop, create the timer on the current loop and associate each
dns_nta_t object to the loop it was created on.  This simplifies the
timer handling as everything is run on the associated loop.

During the change, the dns_nta_t structure was renamed to dns__nta_t
and changed to be fully internal to the nta.c compilation unit, and the
dns_ntatable_t structure was made opaque.  This required no change to
code using the API as dns_nta_t never had any external users and the
dns_ntatable_t was properly accessed only by using function calls.
2022-09-21 14:25:33 -07:00
Ondřej SurýandEvan Hunt a93882b50c Create the response policy zones update timer on demand
Instead of creating the response policy zone deferred update timer when
creating the response policy zone object, create it on demand on the
current loop and destroy it as soon as the timer has finished its job.
There's a side-effect - the processing of the response policy zone
update is now done on the current loop - previously, it was always on
the main loop.
2022-09-21 14:25:33 -07:00
Ondřej SurýandEvan Hunt 1c7295af46 Create the catalog zones update timer on demand
Instead of creating the catalog zone deferred update timer when creating
the catalog zone object, create it on demand on the current loop and
destroy it as soon as the timer has finished its job.  There's a
side-effect - the processing of the catalog zone update is now done on
the current loop - previously, it was always on the main loop.
2022-09-21 14:25:33 -07:00
Ondřej SurýandEvan Hunt a56f9d5061 Create the spillattimer when needed and destroy it early
Instead of creating dns_resolver .spillattimer when the dns_resolver_t
object is created, create it on the current loop as needed and destroy
it as soon as the timer has finished its job.  This avoids the need to
manipulate the timer from a different thread.
2022-09-21 14:25:33 -07:00
Ondřej SurýandEvan Hunt f16c46173c Create the fetch context timer on the matching thread
In the dns_resolver API, delay creating the fetch context timer, so it
is created on the thread/loop associated to the fetch context.
2022-09-21 14:25:33 -07:00
Ondřej SurýandEvan Hunt 76be9a329a Create the zone timers on the zone->loop
Instead of creating the zone timers at the zone creation time (which
could be any thread), create the zone timer from the isc_loop that has
beena assigned to the zone (zone->loop);
2022-09-21 14:25:33 -07:00
Ondřej SurýandEvan Hunt 869c6d77a2 Convert isc_ratelimiter API to use on-loop timers
In preparation for the on-loop timers, the isc_ratelimiter API was
converted to use the timer on main loop and start and stop the timer
asynchronously on the main loop.
2022-09-21 14:25:33 -07:00
Ondřej SurýandEvan Hunt 27d1e498b8 Add isc_timer_async_destroy() helper function
As it sometimes happens that the object using isc_timer_t is destroyed
via detaching all the references with no guarantee that the last thread
will be matching thread, add a helper isc_timer_async_destroy() function
that stops the timer and runs the destroy function via isc_async_run()
on the matching thread.
2022-09-21 14:25:33 -07:00
Evan Hunt 3a735998bc Merge branch '3553-httpd-cleanup' into 'main'
additional code cleanups in httpd.c

See merge request isc-projects/bind9!6798
2022-09-21 19:53:50 +00:00
Evan Hunt 4b7248545e additional code cleanups in httpd.c
- use isc_buffer functions when appropriate, rather than converting
  to and from isc_region unnecessarily
- use the zlib total_out value instead of calculating it
- use c99 struct initialization
2022-09-21 11:45:12 -07:00
Tony Finch 7f4889e159 Merge branch 'fanf-random-init-fuzz' into 'main'
Ensure the first random number is non-zero when fuzzing

See merge request isc-projects/bind9!6794
2022-09-21 15:02:04 +00:00
Tony Finch 4b9af22830 Ensure the first random number is non-zero when fuzzing
In fuzzing mode, `isc_random` uses a fixed seed for reproducibility.
The particular seed chosen happened to produce zero as its first
number, however commit bd251de0 introduced an initialization check in
`random_test` that required it to be non-zero. This change adjusts the
seed to avoid spurious test failures.

Also, remove the temporary variable that was used for initialization
because it did not match the type of the thread-local seed array.
2022-09-21 12:47:26 +01:00
Michał Kępień 2ee16067c5 Merge tag 'v9_19_5'
BIND 9.19.5
2022-09-21 13:04:58 +02:00
Arаm Sаrgsyаn b574904041 Merge branch '3529-tls-transport-support-in-dns_request-and-dns_dispatch' into 'main'
Resolve "Implement TLS transport support for dns_request"

Closes #3529

See merge request isc-projects/bind9!6751
2022-09-19 17:14:18 +00:00
Aram Sargsyan f113bc8142 Add CHANGES note for [GL #3529] 2022-09-19 16:36:29 +00:00
Aram Sargsyan 91a0595019 Test TLS transport in dispatch_test.c
Add a new check in dispatch_test.c unit test to confirm that sending
and receiving data using TLS transport works.
2022-09-19 16:36:28 +00:00
Aram Sargsyan 90959f6166 Implement TLS transport support for dns_request and dns_dispatch
This change prepares ground for sending DNS requests using DoT,
which, in particular, will be used for forwarding dynamic updates
to TLS-enabled primaries.
2022-09-19 16:36:28 +00:00
Aram Sargsyan 881747218b Convert xfrin.c:get_create_tlsctx() into a library function
In order to make xfrin.c:get_create_tlsctx() reusable, move the function
into transport.c, and make changes into its prototype to not use the
'dns_xfrin_ctx_t' type, thus making it more universal.

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

Also, move the typedefs for 'dns_transport_t' and 'dns_transport_list_t'
from transport.h into types.h.
2022-09-19 15:50:06 +00:00
Ondřej Surý 1d153a8db4 Merge branch 'ondrej-move-random-number-re-seeding-out-of-the-hot-path' into 'main'
Move random number re-seeding out of the hot path

See merge request isc-projects/bind9!6173
2022-09-19 14:47:38 +00:00
Tony FinchandOndřej Surý bd251de035 Move random number re-seeding out of the hot path
Instead of checking if we need to re-seed for every isc_random call,
seed the random number generator in the libisc global initializer
and the per-thread initializer.
2022-09-19 16:27:12 +02:00
Ondřej Surý de75595575 Merge branch 'ondrej-unsigned-to-unsigned_int' into 'main'
Add semantic patch to use 'unsigned int' instead of 'unsigned'

See merge request isc-projects/bind9!6741
2022-09-19 14:02:00 +00:00
Ondřej Surý f6e4f620b3 Use the semantic patch to do the unsigned -> unsigned int change
Apply the semantic patch on the whole code base to get rid of 'unsigned'
usage in favor of explicit 'unsigned int'.
2022-09-19 15:56:02 +02:00
Ondřej Surý 7e74e441a5 Add semantic patch to use 'unsigned int' instead of 'unsigned'
Add a very simple patch to enforce usage of 'unsigned int' instead of
just 'unsigned' for the consistency through the whole source code.
2022-09-19 15:52:08 +02:00
Ondřej Surý 28dfa9adcc Merge branch '3510-disable-stringop-overread' into 'main'
Disable stringop-overread with gcc-11+ Address Sanitizer

Closes #3510

See merge request isc-projects/bind9!6747
2022-09-19 13:51:16 +00:00
Ondřej Surý eae4947cc5 Disable stringop-overread with gcc-11+ Address Sanitizer
When Address Sanitizer is enabled in gcc-11+, number of false positives
might appear like this:

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

Disable the warning globally in the autoconf, instead of just locally in
a single CI job, as it might affect people outside our GitLab CI.
2022-09-19 15:50:29 +02:00
Ondřej Surý 60e5d75bf1 Merge branch 'ondrej-netmgr-simplify-uv_close' into 'main'
Reorder the uv_close() calls to close the socket immediately

See merge request isc-projects/bind9!6704
2022-09-19 12:43:39 +00:00
Ondřej Surý b1026dd4c1 Add missing isc_refcount_destroy() for isc__nmsocket_t
The destructor for the isc__nmsocket_t was missing call to the
isc_refcount_destroy() on the reference counter, which might lead to
spurious ThreadSanitizer data race warnings if we ever change the
acquire-release memory order in the isc_refcount_decrement().
2022-09-19 14:38:56 +02:00
Ondřej Surý 9b8d432403 Reorder the uv_close() calls to close the socket immediately
Simplify the closing code - during the loopmgr implementation, it was
discovered that the various lists used by the uv_loop_t aren't FIFO, but
LIFO.  See doc/dev/libuv.md for more details.

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

This might help with the TLS and DoH shutting down sequence as described
in the [GL #3509] as we now stop the reading, stop the timer and call
the uv_close() as earliest as possible.
2022-09-19 14:38:56 +02:00
Ondřej Surý 23800ecd86 Add developer note for the libuv quirks 2022-09-19 14:38:56 +02:00
Ondřej Surý 88f6f30c3d Merge branch '3545-prevent-unexpected-client-read-callbacks' into 'main'
Prevent unexpected UDP client read callbacks

Closes #3545

See merge request isc-projects/bind9!6777
2022-09-19 12:38:04 +00:00
Ondřej Surý 845d7ef69b Add CHANGES note for [GL #3545] 2022-09-19 14:16:07 +02:00
Ondřej Surý 014da8599f Improve the udp_shutdown_read and udp_cancel_read tests
In the udp_shutdown_read unit test, delay the isc_loopmgr_shutdown() to
the send callback, and in the udp_cancel_read test wait for a single
timed out test, then read again, send an UDP packet and cancel the read
from the send callback.
2022-09-19 14:16:07 +02:00
Ondřej Surý eac8bc5c1a Prevent unexpected UDP client read callbacks
The network manager UDP code was misinterpreting when the libuv called
the udp_recv_cb with nrecv == 0 and addr == NULL -> this doesn't really
mean that the "stream" has ended, but the libuv indicates that the
receive buffer can be freed.  This could lead to assertion failure in
the code that calls isc_nm_read() from the network manager read callback
due to the extra spurious callbacks.

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

Add a unit test that tests the isc_nm_read() call from the read
callback to receive two datagrams.
2022-09-19 12:20:41 +02:00
Evan Hunt 94b32f2e0b Merge branch '3522-update-detach' into 'main'
fix an incorrect detach in update processing

Closes #3522

See merge request isc-projects/bind9!6722
2022-09-15 18:33:51 +00:00
Evan Hunt fdc35928eb CHANGES for [GL #3522] 2022-09-15 10:34:25 -07:00
Evan Hunt 00e0758e12 fix an incorrect detach in update processing
when processing UDPATE requests, hold the request handle until
we either drop the request or respond to it.
2022-09-15 10:33:42 -07:00
Michal Nowak 9f7a514e49 Merge branch '3427-tcp-system-test-bump-socket.create_connection-timeout' into 'main'
Bump socket.create_connection() timeout to 10 seconds

Closes #3427

See merge request isc-projects/bind9!6757
2022-09-15 10:19:51 +00:00
Michal Nowak 658cae9fad Bump socket.create_connection() timeout to 10 seconds
The tcp Pytest on OpenBSD fairly reliably fails when receive_tcp()
on a socket is attempted:

    >           (response, rtime) = dns.query.receive_tcp(sock, timeout())

    tests-tcp.py:50:
    _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
    /usr/local/lib/python3.9/site-packages/dns/query.py:659: in receive_tcp
        ldata = _net_read(sock, 2, expiration)
    _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

    sock = <socket.socket [closed] fd=-1, family=AddressFamily.AF_INET, type=SocketKind.SOCK_STREAM, proto=6>
    count = 2, expiration = 1662719959.8106785

        def _net_read(sock, count, expiration):
            """Read the specified number of bytes from sock.  Keep trying until we
            either get the desired amount, or we hit EOF.
            A Timeout exception will be raised if the operation is not completed
            by the expiration time.
            """
            s = b''
            while count > 0:
                try:
    >               n = sock.recv(count)
    E               socket.timeout: timed out

This is because the socket is already closed.

Bump the socket connection timeout to 10 seconds.
2022-09-15 11:13:36 +02:00
Ondřej Surý 1362ffed1f Merge branch '3542-gracefuly-handle-cancelled-http-read-during-sending' into 'main'
Handle canceled read during sending data over stats channel

Closes #3542

See merge request isc-projects/bind9!6773
2022-09-15 08:57:19 +00:00
Ondřej Surý e29563173b Add CHANGES and release note for [GL #3542] 2022-09-15 10:29:58 +02:00
Ondřej Surý 6869c98d36 Provide stronger wording about the security of statistics channel
Add more text about the importance of properly securing the statistics
channel and what is and what is not considered a security vulnerability.
2022-09-15 10:29:38 +02:00
Ondřej Surý 6562227cc8 Handle canceled read during sending data over stats channel
An assertion failure would be triggered when the TCP connection
is canceled during sending the data back to the client.

Don't require the state to be `RECV` on non successful read to
gracefully handle canceled TCP connection during the SEND state of the
HTTPD channel.
2022-09-15 10:29:37 +02:00
Petr Špaček 0ffa8d1a9c Merge branch '1176-add-support-for-sd_notify-interface-to-better-integrate-on-linux' into 'main'
Add support for reporting status via sd_notify()

Closes #1176

See merge request isc-projects/bind9!5514
2022-09-15 08:17:20 +00:00
Ondřej SurýandPetr Špaček 1eb848d71a Add CHANGES and release note for [GL #1176] 2022-09-15 10:12:50 +02:00
Ondřej SurýandPetr Špaček 52b62b7890 Add support for reporting status via sd_notify()
sd_notify() may be called by a service to notify the service manager
about state changes. It can be used to send arbitrary information,
encoded in an environment-block-like string. Most importantly, it can be
used for start-up completion notification.

Add libsystemd check to autoconf script and when the library is detected
add calls to sd_notify() around the server->reload_status changes.

Co-authored-by: Petr Špaček <pspacek@isc.org>
2022-09-15 10:12:15 +02:00
Petr Špaček 0b7f082060 Merge branch 'pspacek/log-no-recursion-reason' into 'main'
Log reasons why ACL denied recursion or cache peek

See merge request isc-projects/bind9!6669
2022-09-15 07:40:17 +00:00
Evan HuntandPetr Špaček a2bbe578bf Add tests for the new log messages with refusal reason
Update the allow-query test to check for the new log messages.
2022-09-15 06:50:57 +02:00
Petr Špaček 67c3a3439b CHANGES note for [GL !6669] 2022-09-15 06:50:55 +02:00
Petr Špaček fdf7456643 Log reason why cache peek is not available
Log which ACL caused RD=0 query into cache to be refused.
Expected performance impact is negligible.
2022-09-15 06:50:13 +02:00
Petr Špaček 95fc05c454 Log reason why recursion is not available
Log which ACL caused RA=0 condition.
Expected performance impact is negligible.
2022-09-15 06:50:13 +02:00
Mark Andrews 5c5f6964ff Merge branch '3525-key-id-clashes-across-algorithms-cause-problems-with-statistics' into 'main'
Resolve "key id clashes across algorithms cause problems with statistics"

Closes #3525

See merge request isc-projects/bind9!6745
2022-09-15 01:04:17 +00:00
Mark Andrews 91488a9b6d Add a release note for [GL #3525] 2022-09-15 09:09:35 +10:00
Mark Andrews b15309e10d Add a CHANGES note for [GL #3525] 2022-09-15 08:44:28 +10:00
Mark Andrews b1ef1ded69 Emit key algorithm + key id in dnssec signing statsistics
If there was a collision of key id across algorithms it was not
possible to determine where counter applies to which algorithm for
xml statistics while for json only one of the values was emitted.
The key names are now "<algorithm-number>+<id>" (e.g. "8+54274").
2022-09-15 08:42:45 +10:00
Evan Hunt 491ead7820 Merge branch 'each-remove-resolve' into 'main'
remove 'resolve' test binary

See merge request isc-projects/bind9!6733
2022-09-14 17:20:52 +00:00
Evan Hunt d99076ede4 remove 'resolve' test binary
the 'resolve' binary was added for testing dns_client as part of
the export library. the export libraries are no longer supported,
and tests using 'delv' provide the same coverage, so 'resolve' can
be removed now.
2022-09-14 10:17:06 -07:00
Evan Hunt e73317d4f3 Merge branch 'each-cleanup-dns_request' into 'main'
remove dns_request_create()

See merge request isc-projects/bind9!6753
2022-09-14 17:14:01 +00:00
Evan Hunt ebf7b31aa3 merge dns_request_createvia() into dns_request_create()
dns_request_create() was a front-end to dns_request_createvia() that
was only used by test binaries. dns_request_createvia() has been
renamed to dns_request_create(), and the test programs that formerly
used dns_request_create() have been updated to use the new parameters.
2022-09-14 09:51:08 -07:00
Evan Hunt 05c1d2d365 Merge branch '3399-random-device-ancient' into 'main'
flag "random-device" as ancient

Closes #3399

See merge request isc-projects/bind9!6769
2022-09-14 16:41:15 +00:00
Evan Hunt 0cc6c9f0b8 CHANGES for [GL #3399] 2022-09-14 09:36:58 -07:00
Evan Hunt 9730f21f83 flag "random-device" as ancient
the "random-device" option was made non-functional in 9.13. this commit
removes it from the configuration parser; setting it is now an error.
2022-09-14 09:36:58 -07:00
Tony Finch fade14c809 Merge branch '3537-idna-test' into 'main'
Fix dig idna test on Debian 10 "buster"

Closes #3537

See merge request isc-projects/bind9!6767
2022-09-14 12:39:08 +00:00
Tony Finch 5c1aed2881 Fix dig idna test on Debian 10 "buster"
The test expected `xn--ah-` to be treated as a syntax error (punycode
requires letters after the last hyphen) but libidn2 on buster
converted the label to `ah` instead. To avoid this bug, change the
invalid label to `xn--0000h` which translates to an out-of-range
unicode codepoint (beyond the maximum value) which is corectly
trated as invalid in older libidn2.
2022-09-14 11:59:42 +01:00
Tony Finch 83f27b6f3b Merge branch '3536-out-of-tree' into 'main'
Fix out-of-tree tests

Closes #3536

See merge request isc-projects/bind9!6766
2022-09-14 10:23:29 +00:00
Tony Finch 2a0b81d6da Fix out-of-tree tests
The change to `testsock.pl` in commit 258a896a broke the system
tests in out-of-tree builds because `ifconfig.sh.in` is not
copied to the worktree. Use `ifconfig.sh` instead.
2022-09-14 10:02:58 +01:00
Mark Andrews 44235cd2cf Merge branch '2295-add-the-ability-to-specify-that-a-server-supports-cookies' into 'main'
Resolve "Add the ability to specify that a server supports COOKIES."

Closes #2295

See merge request isc-projects/bind9!4410
2022-09-14 01:36:42 +00:00
Mark Andrews b22df206d4 Add CHANGES and release notes for [GL #2295] 2022-09-13 12:07:13 +10:00
Mark Andrews 9d893d55e0 Check "require-cookie yes;" triggers TCP fallback on no cookie 2022-09-13 12:07:13 +10:00
Mark Andrews 7751e5e039 Add server clause require-cookie
Specifies if an UDP response requires a DNS COOKIE or not.
Fallback to TCP if not present and not TSIG signed.
2022-09-13 12:07:13 +10:00
Michał Kępień 5b2fed25f4 Update BIND version for release 2022-09-08 14:00:21 +02:00
Michał Kępień e46709eb07 Add a CHANGES marker 2022-09-08 14:00:21 +02:00
Michał Kępień c4dd168b38 Merge branch 'michal/prepare-documentation-for-bind-9.19.5' into 'security-main'
Prepare documentation for BIND 9.19.5

See merge request isc-private/bind9!458
2022-09-08 11:58:18 +00:00
Michał Kępień 41fdb42e9c Add release note for GL #3410 2022-09-08 12:45:56 +02:00
Michał Kępień ef5e0641c3 Tweak and reword release notes 2022-09-08 12:45:56 +02:00
Michał Kępień 849563797e Prepare release notes for BIND 9.19.5 2022-09-08 12:45:56 +02:00
Michał Kępień dd91276106 Merge branch '3487-eddsa-verify-leak' into 'security-main'
[CVE-2022-38178] eddsa verify leak

See merge request isc-private/bind9!422
2022-09-08 09:29:18 +00:00
Mark AndrewsandMichał Kępień e6cb1de20b Add release note for [GL #3487] 2022-09-08 11:27:31 +02:00
Mark AndrewsandMichał Kępień b3277f2e10 Add CHANGES note for [GL #3487] 2022-09-08 11:27:31 +02:00
Mark AndrewsandMichał Kępień 6ddb480a84 Free ctx on invalid siglen 2022-09-08 11:27:31 +02:00
Michał Kępień b101f27615 Merge branch '3517-serve-stale-client-timeout-0-cname-crash' into 'security-main'
[CVE-2022-3080] Fix serve-stale-client-timeout 0 CNAME crash

See merge request isc-private/bind9!443
2022-09-08 09:25:51 +00:00
Matthijs MekkingandMichał Kępień 97c6c3712e Add release notes for #3517 2022-09-08 11:24:37 +02:00
Matthijs MekkingandMichał Kępień e394902965 Add CHANGES entry for 3517 2022-09-08 11:24:37 +02:00
Matthijs MekkingandMichał Kępień d939d2ecde Only refresh RRset once
Don't attempt to resolve DNS responses for intermediate results. This
may create multiple refreshes and can cause a crash.

One scenario is where for the query there is a CNAME and canonical
answer in cache that are both stale. This will trigger a refresh of
the RRsets because we encountered stale data and we prioritized it over
the lookup. It will trigger a refresh of both RRsets. When we start
recursing, it will detect a recursion loop because the recursion
parameters will eventually be the same. In 'dns_resolver_destroyfetch'
the sanity check fails, one of the callers did not get its event back
before trying to destroy the fetch.

Move the call to 'query_refresh_rrset' to 'ns_query_done', so that it
is only called once per client request.

Another scenario is where for the query there is a stale CNAME in the
cache that points to a record that is also in cache but not stale. This
will trigger a refresh of the RRset (because we encountered stale data
and we prioritized it over the lookup).

We mark RRsets that we add to the message with
DNS_RDATASETATTR_STALE_ADDED to prevent adding a duplicate RRset when
a stale lookup and a normal lookup conflict with each other. However,
the other non-stale RRset when following a CNAME chain will be added to
the message without setting that attribute, because it is not stale.

This is a variant of the bug in #2594. The fix covered the same crash
but for stale-answer-client-timeout > 0.

Fix this by clearing all RRsets from the message before refreshing.
This requires the refresh to happen after the query is send back to
the client.
2022-09-08 11:24:37 +02:00
Michał Kępień d6faec60b1 Merge branch '3491-security-fix-openssl-dh-memory-leaks' into 'security-main'
[CVE-2022-2906] Fix memory leaks in DH code

See merge request isc-private/bind9!426
2022-09-08 09:22:32 +00:00
Aram SargsyanandMichał Kępień 113e949b34 Add release note for [GL #3491] 2022-09-08 11:20:34 +02:00
Aram SargsyanandMichał Kępień 5b5f2353d4 Add CHANGES note for [GL #3491] 2022-09-08 11:20:34 +02:00
Aram SargsyanandMichał Kępień 73d6bbff4e Fix memory leaks in DH code
When used with OpenSSL v3.0.0+, the `openssldh_compare()`,
`openssldh_paramcompare()`, and `openssldh_todns()` functions
fail to cleanup the used memory on some error paths.

Use `DST_RET` instead of `return`, when there is memory to be
released before returning from the functions.
2022-09-08 11:20:34 +02:00
Michał Kępień 3d2cf90390 Merge branch '3493-confidential-compression-buffer-reuse' into 'security-main'
[CVE-2022-2881] compression buffer was not reused correctly

See merge request isc-private/bind9!425
2022-09-08 09:18:27 +00:00
Evan HuntandMichał Kępień 430ee6c427 CHANGES and release notes for CVE-2022-2881 [GL #3493] 2022-09-08 11:15:52 +02:00
Evan HuntandMichał Kępień 47e9fa981e compression buffer was not reused correctly
when the compression buffer was reused for multiple statistics
requests, responses could grow beyond the correct size. this was
because the buffer was not cleared before reuse; compressed data
was still written to the beginning of the buffer, but then the size
of used region was increased by the amount written, rather than set
to the amount written. this caused responses to grow larger and
larger, potentially reading past the end of the allocated buffer.
2022-09-08 11:15:52 +02:00
Michał Kępień 2cffc5b849 Merge branch '3394-security-cve-2022-2795-mitigation' into 'security-main'
[CVE-2022-2795] Bound the amount of work performed for delegations

See merge request isc-private/bind9!431
2022-09-08 09:13:53 +00:00
Michał Kępień 672072812c Add release note for GL #3394 2022-09-08 11:11:30 +02:00
Michał Kępień e802beedfc Add CHANGES entry for GL #3394 2022-09-08 11:11:30 +02:00
Michał Kępień 3a44097fd6 Bound the amount of work performed for delegations
Limit the amount of database lookups that can be triggered in
fctx_getaddresses() (i.e. when determining the name server addresses to
query next) by setting a hard limit on the number of NS RRs processed
for any delegation encountered.  Without any limit in place, named can
be forced to perform large amounts of database lookups per each query
received, which severely impacts resolver performance.

The limit used (20) is an arbitrary value that is considered to be big
enough for any sane DNS delegation.
2022-09-08 11:11:30 +02:00
1235 changed files with 54477 additions and 51313 deletions
File diff suppressed because it is too large Load Diff
+55
View File
@@ -0,0 +1,55 @@
name: "CodeQL"
on:
push:
branches: [ "v9_16", "v9_18", "main" ]
schedule:
- cron: '39 8 * * 3'
jobs:
analyze:
name: Analyze
runs-on: ubuntu-latest
permissions:
actions: read
contents: read
security-events: write
strategy:
fail-fast: false
matrix:
language: [ 'cpp' ]
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Install build dependencies
uses: awalsh128/cache-apt-pkgs-action@latest
with:
packages: libuv1-dev libssl-dev libnghttp2-dev libxml2-dev liblmdb-dev libjson-c-dev pkg-config autoconf automake autotools-dev libtool-bin libjemalloc-dev libedit-dev libcap-dev libidn2-dev libkrb5-dev libmaxminddb-dev zlib1g-dev python3-ply
version: 1.0
# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
with:
languages: ${{ matrix.language }}
- name: Autobuild
uses: github/codeql-action/autobuild@v2
# ️ Command-line programs to run using the OS shell.
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun
# If the Autobuild fails above, remove it and uncomment the following three lines.
# modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance.
# - run: |
# echo "Run, Build Application using script"
# ./location_of_script_within_repo/buildscript.sh
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
with:
category: "/language:${{matrix.language}}"
+50
View File
@@ -0,0 +1,50 @@
name: SonarCloud
on:
push:
branches: [ "v9_16", "v9_18", "main" ]
schedule:
- cron: '39 8 * * 3'
jobs:
build:
name: Build and analyze
runs-on: ubuntu-latest
permissions:
actions: read
contents: read
security-events: write
strategy:
fail-fast: false
matrix:
language: [ 'cpp' ]
env:
BUILD_WRAPPER_OUT_DIR: build_wrapper_output_directory
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Install build dependencies
uses: awalsh128/cache-apt-pkgs-action@latest
with:
packages: libuv1-dev libssl-dev libnghttp2-dev libxml2-dev liblmdb-dev libjson-c-dev pkg-config autoconf automake autotools-dev libtool-bin libjemalloc-dev libedit-dev libcap-dev libidn2-dev libkrb5-dev libmaxminddb-dev zlib1g-dev python3-ply
version: 1.0
- name: Install sonar-scanner and build-wrapper
uses: SonarSource/sonarcloud-github-c-cpp@v1
- name: Run build-wrapper
run: |
autoreconf -fi
./configure
build-wrapper-linux-x86-64 --out-dir ${{ env.BUILD_WRAPPER_OUT_DIR }} make clean all
- name: Run sonar-scanner
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
run: |
sonar-scanner --define sonar.cfamily.build-wrapper-output="${{ env.BUILD_WRAPPER_OUT_DIR }}"
+235 -158
View File
@@ -8,11 +8,13 @@ variables:
CCACHE_DIR: "/ccache"
GIT_DEPTH: 1
# The following values may be overwritten in GitLab's CI/CD Variables Settings.
BUILD_PARALLEL_JOBS: 6
TEST_PARALLEL_JOBS: 6
TEST_PARALLEL_JOBS: 4
CONFIGURE: ./configure
CLANG_VERSION: 14
CLANG_VERSION: 15
CLANG: "clang-${CLANG_VERSION}"
SCAN_BUILD: "scan-build-${CLANG_VERSION}"
ASAN_SYMBOLIZER_PATH: "/usr/lib/llvm-${CLANG_VERSION}/bin/llvm-symbolizer"
@@ -23,6 +25,7 @@ variables:
# Pass run-time flags to AddressSanitizer to get core dumps on error.
ASAN_OPTIONS: abort_on_error=1:disable_coredump=0:unmap_shadow_on_exit=1
TSAN_OPTIONS_COMMON: "disable_coredump=0 second_deadlock_stack=1 history_size=7 log_exe_name=true log_path=tsan"
UBSAN_OPTIONS: "halt_on_error=1:abort_on_error=1:disable_coredump=0"
TARBALL_EXTENSION: xz
@@ -102,16 +105,12 @@ stages:
# Alpine Linux
.alpine-3.16-amd64: &alpine_3_16_amd64_image
image: "$CI_REGISTRY_IMAGE:alpine-3.16-amd64"
.alpine-3.17-amd64: &alpine_3_17_amd64_image
image: "$CI_REGISTRY_IMAGE:alpine-3.17-amd64"
<<: *linux_amd64
# Oracle Linux
.oraclelinux-7-amd64: &oraclelinux_7_amd64_image
image: "$CI_REGISTRY_IMAGE:oraclelinux-7-amd64"
<<: *linux_amd64
.oraclelinux-8-amd64: &oraclelinux_8_amd64_image
image: "$CI_REGISTRY_IMAGE:oraclelinux-8-amd64"
<<: *linux_amd64
@@ -122,10 +121,6 @@ stages:
# Debian
.debian-buster-amd64: &debian_buster_amd64_image
image: "$CI_REGISTRY_IMAGE:debian-buster-amd64"
<<: *linux_amd64
.debian-bullseye-amd64: &debian_bullseye_amd64_image
image: "$CI_REGISTRY_IMAGE:debian-bullseye-amd64"
<<: *linux_amd64
@@ -146,20 +141,16 @@ stages:
# Fedora
.fedora-35-amd64: &fedora_35_amd64_image
image: "$CI_REGISTRY_IMAGE:fedora-35-amd64"
.fedora-37-amd64: &fedora_37_amd64_image
image: "$CI_REGISTRY_IMAGE:fedora-37-amd64"
<<: *linux_amd64
.fedora-35-arm64: &fedora_35_arm64_image
image: "$CI_REGISTRY_IMAGE:fedora-35-arm64"
.fedora-37-arm64: &fedora_37_arm64_image
image: "$CI_REGISTRY_IMAGE:fedora-37-arm64"
<<: *linux_stress_arm64
# Ubuntu
.ubuntu-bionic-amd64: &ubuntu_bionic_amd64_image
image: "$CI_REGISTRY_IMAGE:ubuntu-bionic-amd64"
<<: *linux_amd64
.ubuntu-focal-amd64: &ubuntu_focal_amd64_image
image: "$CI_REGISTRY_IMAGE:ubuntu-focal-amd64"
<<: *linux_amd64
@@ -177,7 +168,7 @@ stages:
### QCOW2 Image Templates
.freebsd-12-amd64: &freebsd_12_amd64_image
image: "freebsd-12.3-x86_64"
image: "freebsd-12.4-x86_64"
<<: *libvirt_amd64
.freebsd-13-amd64: &freebsd_13_amd64_image
@@ -185,7 +176,7 @@ stages:
<<: *libvirt_amd64
.openbsd-amd64: &openbsd_amd64_image
image: "openbsd-7.1-x86_64"
image: "openbsd-7.2-x86_64"
<<: *libvirt_amd64
### Job Templates
@@ -238,9 +229,18 @@ stages:
--with-cmocka
--with-libxml2
--with-json-c
--enable-leak-detection
$EXTRA_CONFIGURE
|| (test -s config.log && cat config.log; exit 1)
# change directory to the workspace before including this
.find_python: &find_python
- PYTHON="$(source bin/tests/system/conf.sh; echo $PYTHON)"
- test -x "$PYTHON"
.parse_tsan: &parse_tsan
- find -name 'tsan.*' -exec "$PYTHON" util/parse_tsan.py {} \;
.check_readline_setup: &check_readline_setup
- if [[ -n "${WITHOUT_READLINE}" ]]; then
! grep "^#define HAVE_READLINE" config.h;
@@ -272,13 +272,16 @@ stages:
- *configure
- *check_readline_setup
- make -j${BUILD_PARALLEL_JOBS:-1} -k all V=1
- test -z "${BUILD_CONTRIB}" || for DIR in contrib/dlz/modules/*; do test -f "${DIR}/Makefile" && CFLAGS="${CFLAGS} -Werror" make -C "${DIR}"; done
- test -z "${RUN_MAKE_INSTALL}" || make DESTDIR="${INSTALL_PATH}" install
- test -z "${RUN_MAKE_INSTALL}" -o -z "${BUILD_CONTRIB}" || for DIR in contrib/dlz/modules/*; do test -f "${DIR}/Makefile" && make -C "${DIR}" DESTDIR="${INSTALL_PATH}" install; done
- test -z "${RUN_MAKE_INSTALL}" || DESTDIR="${INSTALL_PATH}" sh util/check-make-install
- if [[ "${CFLAGS}" == *"-fsanitize=address"* ]]; then ( ! grep -F AddressSanitizer config.log ); fi
- test -z "${CROSS_COMPILATION}" || grep -F -A 1 "checking whether we are cross compiling" config.log | grep -q "result.*yes"
- test -z "${CROSS_COMPILATION}" || file lib/dns/gen | grep -F -q "ELF 64-bit LSB"
- test -z "${CROSS_COMPILATION}" || ( ! git ls-files -z --others --exclude lib/dns/gen | xargs -0 file | grep "ELF 64-bit LSB" )
- if test -z "${OUT_OF_TREE_WORKSPACE}" && test "$(git status --porcelain | grep -Ev '\?\?' | wc -l)" -gt "0"; then git status --short; exit 1; fi
- bin/named/named -V
needs:
- job: autoreconf
artifacts: true
@@ -304,11 +307,15 @@ stages:
- cd bin/tests/system
- make -j${TEST_PARALLEL_JOBS:-1} -k check V=1
- if git rev-parse > /dev/null 2>&1; then ( ! grep "^I:.*:file.*not removed$" *.log ); fi
- '( ! grep -F "grep: warning:" *.log )'
after_script:
- test -n "${OUT_OF_TREE_WORKSPACE}" && cd "${OUT_OF_TREE_WORKSPACE}"
- test -d bind-* && cd bind-*
- REALSOURCEDIR="$PWD"
- test -n "${OUT_OF_TREE_WORKSPACE}" && cd "${OUT_OF_TREE_WORKSPACE}"
- cat bin/tests/system/test-suite.log
- (source bin/tests/system/conf.sh && "${PYTHON}" "${CI_PROJECT_DIR}/bin/tests/convert-trs-to-junit.py" . > "${CI_PROJECT_DIR}/junit.xml")
- *find_python
- >
"$PYTHON" "$REALSOURCEDIR"/bin/tests/convert-trs-to-junit.py . > "$CI_PROJECT_DIR"/junit.xml
.system_test: &system_test_job
<<: *system_test_common
@@ -330,11 +337,13 @@ stages:
<<: *system_test_common
after_script:
- cat bin/tests/system/test-suite.log
- find bin -name 'tsan.*' -exec python3 util/parse_tsan.py {} \;
- (source bin/tests/system/conf.sh && "${PYTHON}" "${CI_PROJECT_DIR}/bin/tests/convert-trs-to-junit.py" . > "${CI_PROJECT_DIR}/junit.xml")
- *find_python
- *parse_tsan
- >
"$PYTHON" bin/tests/convert-trs-to-junit.py . > "$CI_PROJECT_DIR"/junit.xml
artifacts:
expire_in: "1 day"
untracked: true
expire_in: "1 day"
when: always
reports:
junit: junit.xml
@@ -347,9 +356,12 @@ stages:
script:
- make -j${TEST_PARALLEL_JOBS:-1} -k unit V=1
after_script:
- test -n "${OUT_OF_TREE_WORKSPACE}" && cd "${OUT_OF_TREE_WORKSPACE}"
- test -d bind-* && cd bind-*
- (source bin/tests/system/conf.sh && "${PYTHON}" "${CI_PROJECT_DIR}/bin/tests/convert-trs-to-junit.py" . > "${CI_PROJECT_DIR}/junit.xml")
- REALSOURCEDIR="$PWD"
- test -n "${OUT_OF_TREE_WORKSPACE}" && cd "${OUT_OF_TREE_WORKSPACE}"
- *find_python
- >
"$PYTHON" "$REALSOURCEDIR"/bin/tests/convert-trs-to-junit.py . > "$CI_PROJECT_DIR"/junit.xml
.unit_test: &unit_test_job
<<: *unit_test_common
@@ -370,14 +382,13 @@ stages:
.unit_test_tsan: &unit_test_tsan_job
<<: *unit_test_common
after_script:
- find lib -name 'tsan.*' -exec python3 util/parse_tsan.py {} \;
- (source bin/tests/system/conf.sh && "${PYTHON}" "${CI_PROJECT_DIR}/bin/tests/convert-trs-to-junit.py" . > "${CI_PROJECT_DIR}/junit.xml")
- *find_python
- *parse_tsan
- >
"$PYTHON" bin/tests/convert-trs-to-junit.py . > "$CI_PROJECT_DIR"/junit.xml
artifacts:
untracked: true
expire_in: "1 day"
paths:
- tests/*/tsan.*
- tsan/
- junit.xml
when: always
reports:
junit: junit.xml
@@ -431,6 +442,7 @@ misc:
- test ! -f CHANGES.SE || sh util/check-line-length.sh CHANGES.SE
- rm CHANGES.tmp
- sh util/check-categories.sh
- sh util/check-gitignore.sh
- if git grep SYSTEMTESTTOP -- ':!.gitlab-ci.yml'; then echo 'Please use relative paths instead of $SYSTEMTESTTOP.'; exit 1; fi
- bash util/unused-headers.sh
- bash util/xmllint-html.sh
@@ -502,6 +514,12 @@ danger:
variables:
- $DANGER_GITLAB_API_TOKEN
checkbashisms:
<<: *precheck_job
needs: []
script:
- checkbashisms $(find . -path './.git' -prune -o -type f -exec sh -c 'head -n 1 "{}" | grep -qsF "#!/bin/sh"' \; -print)
tarball-create:
stage: precheck
<<: *base_image
@@ -545,52 +563,28 @@ docs:tarball:
- job: tarball-create
artifacts: true
# Jobs for regular GCC builds on Alpine Linux 3.16 (amd64)
# Jobs for regular GCC builds on Alpine Linux 3.17 (amd64)
gcc:alpine3.16:amd64:
gcc:alpine3.17:amd64:
variables:
CC: gcc
CFLAGS: "${CFLAGS_COMMON}"
EXTRA_CONFIGURE: "${WITHOUT_READLINE}"
<<: *alpine_3_16_amd64_image
<<: *alpine_3_17_amd64_image
<<: *build_job
system:gcc:alpine3.16:amd64:
<<: *alpine_3_16_amd64_image
system:gcc:alpine3.17:amd64:
<<: *alpine_3_17_amd64_image
<<: *system_test_job
needs:
- job: gcc:alpine3.16:amd64
- job: gcc:alpine3.17:amd64
artifacts: true
unit:gcc:alpine3.16:amd64:
<<: *alpine_3_16_amd64_image
unit:gcc:alpine3.17:amd64:
<<: *alpine_3_17_amd64_image
<<: *unit_test_job
needs:
- job: gcc:alpine3.16:amd64
artifacts: true
# Jobs for regular GCC builds on Oracle Linux 7 (amd64)
gcc:oraclelinux7:amd64:
variables:
CC: gcc
CFLAGS: "${CFLAGS_COMMON}"
EXTRA_CONFIGURE: "--with-libidn2"
<<: *oraclelinux_7_amd64_image
<<: *build_job
system:gcc:oraclelinux7:amd64:
<<: *oraclelinux_7_amd64_image
<<: *system_test_job
needs:
- job: gcc:oraclelinux7:amd64
artifacts: true
unit:gcc:oraclelinux7:amd64:
<<: *oraclelinux_7_amd64_image
<<: *unit_test_job
needs:
- job: gcc:oraclelinux7:amd64
- job: gcc:alpine3.17:amd64
artifacts: true
# Jobs for regular GCC builds on Oracle Linux 8 (amd64)
@@ -599,7 +593,7 @@ gcc:oraclelinux8:amd64:
variables:
CC: gcc
CFLAGS: "${CFLAGS_COMMON}"
EXTRA_CONFIGURE: "--enable-buffer-useinline --with-libidn2"
EXTRA_CONFIGURE: "--with-libidn2"
<<: *oraclelinux_8_amd64_image
<<: *build_job
@@ -623,7 +617,7 @@ gcc:oraclelinux9:amd64:
variables:
CC: gcc
CFLAGS: "${CFLAGS_COMMON}"
EXTRA_CONFIGURE: "--with-libidn2"
EXTRA_CONFIGURE: "--with-libidn2 --disable-developer"
<<: *oraclelinux_9_amd64_image
<<: *build_job
@@ -641,31 +635,19 @@ unit:gcc:oraclelinux9:amd64:
- job: gcc:oraclelinux9:amd64
artifacts: true
# Jobs for regular GCC builds on Debian 10 "buster" (amd64)
gcc:buster:amd64:
gcc:tarball:nosphinx:
variables:
CC: gcc
CFLAGS: "${CFLAGS_COMMON}"
EXTRA_CONFIGURE: "--with-libidn2"
<<: *debian_buster_amd64_image
EXTRA_CONFIGURE: "--with-libidn2 --disable-developer"
RUN_MAKE_INSTALL: 1
<<: *oraclelinux_9_amd64_image
<<: *build_job
<<: *api_schedules_tags_triggers_web_triggering_rules
system:gcc:buster:amd64:
<<: *debian_buster_amd64_image
<<: *system_test_job
<<: *api_schedules_tags_triggers_web_triggering_rules
before_script:
- (! command -v sphinx-build >/dev/null)
- *unpack_release_tarball
needs:
- job: gcc:buster:amd64
artifacts: true
unit:gcc:buster:amd64:
<<: *debian_buster_amd64_image
<<: *unit_test_job
<<: *api_schedules_tags_triggers_web_triggering_rules
needs:
- job: gcc:buster:amd64
- job: tarball-create
artifacts: true
# Jobs for regular GCC builds on Debian 11 "bullseye" (amd64)
@@ -673,9 +655,11 @@ unit:gcc:buster:amd64:
gcc:bullseye:amd64:
variables:
BUILD_CONTRIB: 1
CC: gcc
CFLAGS: "${CFLAGS_COMMON} --coverage -O0"
EXTRA_CONFIGURE: "--with-libidn2 ${WITH_READLINE_LIBEDIT}"
RUN_MAKE_INSTALL: 1
<<: *debian_bullseye_amd64_image
<<: *build_job
@@ -768,19 +752,50 @@ scan-build:
expire_in: "1 day"
when: on_failure
# Jobs for strict OpenSSL 3.x (no deprecated) GCC builds on Debian "sid" (amd64)
gcc:ossl3:sid:amd64:
variables:
CC: gcc
CFLAGS: "${CFLAGS_COMMON} -O3 -DOPENSSL_NO_DEPRECATED=1 -DOPENSSL_API_COMPAT=30000"
RUN_MAKE_INSTALL: 1
<<: *debian_sid_amd64_image
<<: *build_job
system:gcc:ossl3:sid:amd64:
<<: *debian_sid_amd64_image
<<: *system_test_job
needs:
- job: gcc:ossl3:sid:amd64
artifacts: true
unit:gcc:ossl3:amd64:
<<: *debian_sid_amd64_image
<<: *unit_test_job
needs:
- job: gcc:ossl3:sid:amd64
artifacts: true
# Jobs for regular GCC builds on Debian "sid" (amd64)
# Also tests configration option: --without-lmdb.
gcc:sid:amd64:
variables:
CC: gcc
CFLAGS: "${CFLAGS_COMMON} -O3"
EXTRA_CONFIGURE: "--with-libidn2 --without-lmdb ${WITH_READLINE}"
CFLAGS: "${CFLAGS_COMMON} -O3 -DOPENSSL_API_COMPAT=10100"
# For the jemalloc ./configure option, see https://gitlab.isc.org/isc-projects/bind9/-/issues/3444
EXTRA_CONFIGURE: "--with-libidn2 --without-lmdb --without-jemalloc --disable-leak-detection ${WITH_READLINE}"
RUN_MAKE_INSTALL: 1
<<: *debian_sid_amd64_image
<<: *build_job
system:gcc:sid:amd64:
# Set up environment variables that allow the "keyfromlabel" system test to be run
variables:
DEFAULT_OPENSSL_CONF: "/etc/ssl/openssl.cnf"
OPENSSL_CONF: "/var/tmp/etc/openssl.cnf"
SOFTHSM2_CONF: "/var/tmp/softhsm2/softhsm2.conf"
SOFTHSM2_MODULE: "/usr/lib/softhsm/libsofthsm2.so"
<<: *debian_sid_amd64_image
<<: *system_test_job
needs:
@@ -870,7 +885,15 @@ gcc:tumbleweed:amd64:
variables:
CC: gcc
CFLAGS: "${CFLAGS_COMMON} -DDEBUG"
EXTRA_CONFIGURE: "--with-libidn2 ${WITH_READLINE_READLINE}"
# NOTE: Testing DNSRPS-enabled builds currently requires an
# operating system with glibc 2.34+. This requirement will go away
# once the DNSRPS dynamic loading code gets reworked to use libuv's
# dlopen() API.
#
# NOTE: This does *not* enable testing of the DNSRPS feature itself.
# Doing that requires a DNSRPS provider library to be present on the
# test host.
EXTRA_CONFIGURE: "--enable-dnsrps --enable-dnsrps-dl --with-libidn2 ${WITH_READLINE_READLINE}"
<<: *tumbleweed_latest_amd64_image
<<: *build_job
@@ -888,40 +911,13 @@ unit:gcc:tumbleweed:amd64:
- job: gcc:tumbleweed:amd64
artifacts: true
# Jobs for regular GCC builds on Ubuntu 18.04 Bionic Beaver (amd64)
gcc:bionic:amd64:
variables:
CC: gcc
CFLAGS: "${CFLAGS_COMMON} -O2"
EXTRA_CONFIGURE: "--disable-dnstap --without-cmocka --without-gssapi"
<<: *ubuntu_bionic_amd64_image
<<: *build_job
<<: *api_schedules_tags_triggers_web_triggering_rules
system:gcc:bionic:amd64:
<<: *ubuntu_bionic_amd64_image
<<: *system_test_job
<<: *api_schedules_tags_triggers_web_triggering_rules
needs:
- job: gcc:bionic:amd64
artifacts: true
unit:gcc:bionic:amd64:
<<: *ubuntu_bionic_amd64_image
<<: *unit_test_job
<<: *api_schedules_tags_triggers_web_triggering_rules
needs:
- job: gcc:bionic:amd64
artifacts: true
# Jobs for regular GCC builds on Ubuntu 20.04 Focal Fossa (amd64)
gcc:focal:amd64:
variables:
CC: gcc
CFLAGS: "${CFLAGS_COMMON} -Og"
EXTRA_CONFIGURE: "--disable-geoip --with-libidn2"
EXTRA_CONFIGURE: "--disable-dnstap --without-cmocka --without-gssapi --with-libidn2"
<<: *ubuntu_focal_amd64_image
<<: *build_job
@@ -945,7 +941,7 @@ gcc:jammy:amd64:
variables:
CC: gcc
CFLAGS: "${CFLAGS_COMMON}"
EXTRA_CONFIGURE: "--with-libidn2 --disable-doh"
EXTRA_CONFIGURE: "--disable-geoip --with-libidn2 --disable-doh"
<<: *ubuntu_jammy_amd64_image
<<: *build_job
@@ -963,28 +959,28 @@ unit:gcc:jammy:amd64:
- job: gcc:jammy:amd64
artifacts: true
# Jobs for ASAN builds on Fedora 35 (amd64)
# Jobs for ASAN builds on Fedora 37 (amd64)
gcc:asan:
variables:
CC: gcc
CFLAGS: "${CFLAGS_COMMON} -fsanitize=address,undefined -Wno-error=stringop-overread"
CFLAGS: "${CFLAGS_COMMON} -fsanitize=address,undefined"
LDFLAGS: "-fsanitize=address,undefined"
EXTRA_CONFIGURE: "--with-libidn2 --without-jemalloc"
<<: *fedora_35_amd64_image
<<: *fedora_37_amd64_image
<<: *build_job
system:gcc:asan:
variables:
LSAN_OPTIONS: "suppressions=$CI_PROJECT_DIR/suppr-lsan.txt"
<<: *fedora_35_amd64_image
<<: *fedora_37_amd64_image
<<: *system_test_job
needs:
- job: gcc:asan
artifacts: true
unit:gcc:asan:
<<: *fedora_35_amd64_image
<<: *fedora_37_amd64_image
<<: *unit_test_job
needs:
- job: gcc:asan
@@ -1013,7 +1009,7 @@ unit:clang:asan:
- job: clang:asan
artifacts: true
# Jobs for TSAN builds on Fedora 35 (amd64)
# Jobs for TSAN builds on Fedora 37 (amd64)
gcc:tsan:
variables:
@@ -1021,13 +1017,13 @@ gcc:tsan:
CFLAGS: "${CFLAGS_COMMON} -fsanitize=thread"
LDFLAGS: "-fsanitize=thread"
EXTRA_CONFIGURE: "--with-libidn2 --enable-pthread-rwlock --without-jemalloc"
<<: *fedora_35_amd64_image
<<: *fedora_37_amd64_image
<<: *build_job
system:gcc:tsan:
variables:
TSAN_OPTIONS: "${TSAN_OPTIONS_COMMON} external_symbolizer_path=/usr/bin/llvm-symbolizer"
<<: *fedora_35_amd64_image
<<: *fedora_37_amd64_image
<<: *system_test_tsan_job
needs:
- job: gcc:tsan
@@ -1036,7 +1032,7 @@ system:gcc:tsan:
unit:gcc:tsan:
variables:
TSAN_OPTIONS: "${TSAN_OPTIONS_COMMON} external_symbolizer_path=/usr/bin/llvm-symbolizer"
<<: *fedora_35_amd64_image
<<: *fedora_37_amd64_image
<<: *unit_test_tsan_job
needs:
- job: gcc:tsan
@@ -1070,13 +1066,17 @@ unit:clang:tsan:
artifacts: true
# Jobs for Clang builds on Debian 11 "bullseye" (amd64)
# The -Wno-compound-token-split-by-macro option prevents warning when compiling
# Perl DLZ module with Clang against Perl older than version 5.35.2.
clang:bullseye:amd64:
variables:
BUILD_CONTRIB: 1
CC: ${CLANG}
CFLAGS: "${CFLAGS_COMMON} -Wenum-conversion"
CFLAGS: "${CFLAGS_COMMON} -Wenum-conversion -Wno-compound-token-split-by-macro"
# See https://gitlab.isc.org/isc-projects/bind9/-/issues/3444
EXTRA_CONFIGURE: "--without-jemalloc"
EXTRA_CONFIGURE: "--without-jemalloc --disable-leak-detection"
RUN_MAKE_INSTALL: 1
<<: *debian_bullseye_amd64_image
<<: *build_job
@@ -1115,7 +1115,6 @@ system:clang:freebsd12:amd64:
<<: *system_test_job
variables:
USER: gitlab-runner
TEST_PARALLEL_JOBS: 4
needs:
- job: clang:freebsd12:amd64
artifacts: true
@@ -1142,7 +1141,6 @@ system:clang:freebsd13:amd64:
<<: *system_test_job
variables:
USER: gitlab-runner
TEST_PARALLEL_JOBS: 4
needs:
- job: clang:freebsd13:amd64
artifacts: true
@@ -1173,6 +1171,7 @@ system:clang:openbsd:amd64:
needs:
- job: clang:openbsd:amd64
artifacts: true
allow_failure: true
unit:clang:openbsd:amd64:
<<: *openbsd_amd64_image
@@ -1214,7 +1213,7 @@ release:
artifacts:
paths:
- "*.tar.gz"
expire_in: "1 day"
expire_in: never
# Coverity Scan analysis upload
@@ -1281,6 +1280,36 @@ respdiff-short:
script:
- bash respdiff.sh -m /usr/lib/x86_64-linux-gnu/libjemalloc.so.2 -s named -q "${PWD}/10k_a.txt" -c 3 -w "${PWD}/rspworkdir" "${CI_PROJECT_DIR}" "/usr/local/respdiff-reference-bind/sbin/named"
respdiff-short:asan:
<<: *respdiff_job
<<: *default_triggering_rules
variables:
CC: gcc
CFLAGS: "${CFLAGS_COMMON} -Og -fsanitize=address,undefined"
LDFLAGS: "-fsanitize=address,undefined"
EXTRA_CONFIGURE: "--without-jemalloc"
MAX_DISAGREEMENTS_PERCENTAGE: "0.5"
script:
- bash respdiff.sh -s named -q "${PWD}/10k_a.txt" -c 3 -w "${PWD}/rspworkdir" "${CI_PROJECT_DIR}" "/usr/local/respdiff-reference-bind/sbin/named"
allow_failure: true
respdiff-short:tsan:
<<: *respdiff_job
<<: *default_triggering_rules
variables:
CC: gcc
CFLAGS: "${CFLAGS_COMMON} -Og -fsanitize=thread"
LDFLAGS: "-fsanitize=thread"
EXTRA_CONFIGURE: "--enable-pthread-rwlock --without-jemalloc"
MAX_DISAGREEMENTS_PERCENTAGE: "0.5"
TSAN_OPTIONS: "${TSAN_OPTIONS_COMMON} external_symbolizer_path=/usr/bin/llvm-symbolizer"
script:
- bash respdiff.sh -s named -q "${PWD}/10k_a.txt" -c 3 -w "${PWD}/rspworkdir" "${CI_PROJECT_DIR}" "/usr/local/respdiff-reference-bind/sbin/named"
after_script:
- *find_python
- *parse_tsan
allow_failure: true
respdiff-long:
<<: *respdiff_job
<<: *api_schedules_tags_triggers_web_triggering_rules
@@ -1291,6 +1320,36 @@ respdiff-long:
script:
- bash respdiff.sh -m /usr/lib/x86_64-linux-gnu/libjemalloc.so.2 -s named -q "${PWD}/100k_mixed.txt" -c 3 -w "${PWD}/rspworkdir" "${CI_PROJECT_DIR}" "/usr/local/respdiff-reference-bind/sbin/named"
respdiff-long:asan:
<<: *respdiff_job
<<: *api_schedules_tags_triggers_web_triggering_rules
variables:
CC: gcc
CFLAGS: "${CFLAGS_COMMON} -Og -fsanitize=address,undefined"
LDFLAGS: "-fsanitize=address,undefined"
EXTRA_CONFIGURE: "--without-jemalloc"
MAX_DISAGREEMENTS_PERCENTAGE: "0.5"
script:
- bash respdiff.sh -s named -q "${PWD}/100k_mixed.txt" -c 3 -w "${PWD}/rspworkdir" "${CI_PROJECT_DIR}" "/usr/local/respdiff-reference-bind/sbin/named"
allow_failure: true
respdiff-long:tsan:
<<: *respdiff_job
<<: *api_schedules_tags_triggers_web_triggering_rules
variables:
CC: gcc
CFLAGS: "${CFLAGS_COMMON} -Og -fsanitize=thread"
LDFLAGS: "-fsanitize=thread"
EXTRA_CONFIGURE: "--enable-pthread-rwlock --without-jemalloc"
MAX_DISAGREEMENTS_PERCENTAGE: "0.5"
TSAN_OPTIONS: "${TSAN_OPTIONS_COMMON} external_symbolizer_path=/usr/bin/llvm-symbolizer"
script:
- bash respdiff.sh -s named -q "${PWD}/100k_mixed.txt" -c 3 -w "${PWD}/rspworkdir" "${CI_PROJECT_DIR}" "/usr/local/respdiff-reference-bind/sbin/named"
after_script:
- *find_python
- *parse_tsan
allow_failure: true
respdiff-long-third-party:
<<: *respdiff_job
<<: *api_schedules_tags_triggers_web_triggering_rules
@@ -1318,12 +1377,12 @@ respdiff-long-third-party:
artifacts: true
artifacts:
untracked: true
expire_in: "1 day"
expire_in: "1 week"
when: always
timeout: 2h
stress:authoritative:fedora:35:amd64:
<<: *fedora_35_amd64_image
stress:authoritative:fedora:37:amd64:
<<: *fedora_37_amd64_image
<<: *linux_stress_amd64
<<: *stress_job
variables:
@@ -1336,8 +1395,8 @@ stress:authoritative:fedora:35:amd64:
variables:
- $CI_COMMIT_TAG || ($BIND_STRESS_TEST_OS =~ /linux/i && $BIND_STRESS_TEST_MODE =~ /authoritative/i && $BIND_STRESS_TEST_ARCH =~ /amd64/i)
stress:recursive:fedora:35:amd64:
<<: *fedora_35_amd64_image
stress:recursive:fedora:37:amd64:
<<: *fedora_37_amd64_image
<<: *linux_stress_amd64
<<: *stress_job
variables:
@@ -1350,8 +1409,8 @@ stress:recursive:fedora:35:amd64:
variables:
- $CI_COMMIT_TAG || ($BIND_STRESS_TEST_OS =~ /linux/i && $BIND_STRESS_TEST_MODE =~ /recursive/i && $BIND_STRESS_TEST_ARCH =~ /amd64/i)
stress:rpz:fedora:35:amd64:
<<: *fedora_35_amd64_image
stress:rpz:fedora:37:amd64:
<<: *fedora_37_amd64_image
<<: *linux_stress_amd64
<<: *stress_job
variables:
@@ -1364,8 +1423,8 @@ stress:rpz:fedora:35:amd64:
variables:
- $CI_COMMIT_TAG || ($BIND_STRESS_TEST_OS =~ /linux/i && $BIND_STRESS_TEST_MODE =~ /rpz/i && $BIND_STRESS_TEST_ARCH =~ /amd64/i)
stress:authoritative:fedora:35:arm64:
<<: *fedora_35_arm64_image
stress:authoritative:fedora:37:arm64:
<<: *fedora_37_arm64_image
<<: *linux_stress_arm64
<<: *stress_job
variables:
@@ -1378,8 +1437,8 @@ stress:authoritative:fedora:35:arm64:
variables:
- $CI_COMMIT_TAG || ($BIND_STRESS_TEST_OS =~ /linux/i && $BIND_STRESS_TEST_MODE =~ /authoritative/i && $BIND_STRESS_TEST_ARCH =~ /arm64/i)
stress:recursive:fedora:35:arm64:
<<: *fedora_35_arm64_image
stress:recursive:fedora:37:arm64:
<<: *fedora_37_arm64_image
<<: *linux_stress_arm64
<<: *stress_job
variables:
@@ -1392,8 +1451,8 @@ stress:recursive:fedora:35:arm64:
variables:
- $CI_COMMIT_TAG || ($BIND_STRESS_TEST_OS =~ /linux/i && $BIND_STRESS_TEST_MODE =~ /recursive/i && $BIND_STRESS_TEST_ARCH =~ /arm64/i)
stress:rpz:fedora:35:arm64:
<<: *fedora_35_arm64_image
stress:rpz:fedora:37:arm64:
<<: *fedora_37_arm64_image
<<: *linux_stress_arm64
<<: *stress_job
variables:
@@ -1448,6 +1507,22 @@ stress:rpz:freebsd12:amd64:
variables:
- $CI_COMMIT_TAG || ($BIND_STRESS_TEST_OS =~ /freebsd/i && $BIND_STRESS_TEST_MODE =~ /rpz/i && $BIND_STRESS_TEST_ARCH =~ /amd64/i)
# git fsck operates over the whole repository and is sufficient to schedule it
# only in one branch, preferably "main". GitLab's clone strategy prevents us
# from using the "bind9" repo clone; we need to clone it ourselves.
fsck:
<<: *base_image
stage: postcheck
variables:
GIT_STRATEGY: none
script:
- git clone https://gitlab.isc.org/isc-projects/bind9.git bind9-full-clone
- cd bind9-full-clone/
- git fsck
only:
- schedules
needs: []
gcov:
<<: *base_image
<<: *default_triggering_rules
@@ -1463,18 +1538,20 @@ gcov:
# Help gcovr process the nasty tricks in lib/dns/code.h, where we include C
# source files from lib/dns/rdata/*/, using an even nastier trick.
- find lib/dns/rdata/* -name "*.c" -execdir cp -f "{}" ../../ \;
# Help gcovr process inline functions in headers
- cp -f lib/dns/include/dns/*.h lib/dns/
- cp -f lib/dns/include/dns/*.h lib/ns/
- cp -f lib/isc/include/isc/*.h lib/isc/
- cp -f lib/isc/include/isc/*.h lib/dns/
- cp -f lib/isc/include/isc/*.h lib/ns/
# Help gcovr process inline functions in headers by copying all libdns and
# libisc headers to lib/{dns,isc,ns}/.
- for SRC in dns isc; do for DST in dns isc ns; do cp -f "lib/${SRC}/include/${SRC}"/*.h "lib/${DST}/"; done; done
- find bin lib -maxdepth 1 -mindepth 1 -type d -exec cp -f lib/isc/include/isc/buffer.h "{}" \;
- cp -f lib/isc/include/isc/buffer.h lib/isc/netmgr/buffer.h
- cp -f lib/isc/include/isc/dnsstream.h lib/isc/netmgr/dnsstream.h
# Help gcovr find dlz_dbi.c file
- for DST in ldap mysql mysqldyn sqlite3 wildcard; do cp contrib/dlz/modules/common/dlz_dbi.c "contrib/dlz/modules/${DST}"; done
# Generate XML file in the Cobertura XML format suitable for use by GitLab
# for the purpose of displaying code coverage information in the diff view
# of a given merge request.
- gcovr --root . --exclude-directories bin/tests --exclude-directories doc --exclude-directories lib/samples --exclude tests --xml -o coverage.xml
- gcovr --root . --exclude-directories bin/tests --exclude-directories doc --exclude-directories lib/samples --exclude tests --html-details -o coverage.html
- gcovr --root . --exclude-directories bin/tests --exclude-directories doc --exclude-directories lib/samples --exclude tests -o coverage.txt
- gcovr --root . --exclude-directories bin/tests --exclude-directories doc --exclude-directories fuzz --exclude-directories lib/samples --exclude tests --xml -o coverage.xml
- gcovr --root . --exclude-directories bin/tests --exclude-directories doc --exclude-directories fuzz --exclude-directories lib/samples --exclude tests --html-details -o coverage.html
- gcovr --root . --exclude-directories bin/tests --exclude-directories doc --exclude-directories fuzz --exclude-directories lib/samples --exclude tests -o coverage.txt
- tail -n 3 coverage.txt
artifacts:
paths:
+2 -2
View File
@@ -1,8 +1,8 @@
<!--
If the bug you are reporting is potentially security-related - for example,
if it involves an assertion failure or other crash in `named` that can be
triggered repeatedly - then please do *NOT* report it here, but send an
email to [security-officer@isc.org](security-officer@isc.org).
triggered repeatedly - then please make sure that you make the new issue
confidential!
-->
### Summary
+116 -25
View File
@@ -3,35 +3,126 @@ THIS ISSUE TEMPLATE IS INTENDED ONLY FOR INTERNAL USE.
If the bug you are reporting is potentially security-related - for example,
if it involves an assertion failure or other crash in `named` that can be
triggered repeatedly - then please do *NOT* report it here, but send an
email to [security-officer@isc.org](security-officer@isc.org).
triggered repeatedly - then please make sure that you make the new issue
confidential!
-->
| Quick Links | :link: |
| ------------------------ | ------------------------------------ |
| Incident Manager: | @user |
| Deputy Incident Manager: | @user |
| Public Disclosure Date: | YYYY-MM-DD |
| CVSS Score: | [0.0][cvss_score] |
| Security Advisory: | isc-private/printing-press!NNN |
| Mattermost Channel: | [CVE-YYYY-NNNN][mattermost_url] |
| Support Ticket: | [URL] |
| Release Checklist: | #NNNN |
| Post-mortem Etherpad: | [postmortem-YYYY-MM][postmortem_url] |
### CVE-specific actions
[cvss_score]: https://nvd.nist.gov/vuln-metrics/cvss/v3-calculator?vector=AV:X/AC:X/PR:X/UI:X/S:X/C:X/I:X/A:X&version=3.1
[mattermost_url]:
[postmortem_url]:
- [ ] Assign a CVE identifier
- [ ] Determine CVSS score
- [ ] Determine the range of BIND versions affected (including the Subscription Edition)
- [ ] Determine whether workarounds for the problem exists
- [ ] Create a draft of the security advisory and put the information above in there
- [ ] Prepare a detailed description of the problem which should include the following by default:
- instructions for reproducing the problem (a system test is good enough)
- explanation of code flow which triggers the problem (a system test is *not* good enough)
- [ ] Prepare a private merge request containing the following items in separate commits:
- a test for the issue (may be moved to a separate merge request for deferred merging)
- a fix for the issue
- documentation updates (`CHANGES`, release notes, anything else applicable)
- [ ] Ensure the merge request from the previous step is reviewed by SWENG staff and has no outstanding discussions
- [ ] Ensure the documentation changes introduced by the merge request addressing the problem are reviewed by Support and Marketing staff
- [ ] Prepare backports of the merge request addressing the problem for all affected (and still maintained) BIND branches (backporting might affect the issue's scope and/or description)
- [ ] Prepare a standalone patch for the last stable release of each affected (and still maintained) BIND branch
:bulb: **Click [here][checklist_explanations] (internal resource) for general information about the security incident handling process.**
### Release-specific actions
[checklist_explanations]: https://gitlab.isc.org/isc-private/isc-wiki/-/wikis/Security-Incident-Handling-Checklist-Explanations
- [ ] Create/update the private issue containing links to fixes & reproducers for all CVEs fixed in a given release cycle
- [ ] Reserve a block of `CHANGES` placeholders once the complete set of vulnerabilities fixed in a given release cycle is determined
- [ ] Ensure the merge requests containing CVE fixes are merged into `security-*` branches in CVE identifier order
### Earlier Than T-5
### Post-disclosure actions
- [ ] [:link:][step_deputy] **(IM)** Pick a Deputy Incident Manager
- [ ] [:link:][step_respond] **(IM)** Respond to the bug reporter
- [ ] [:link:][step_etherpad] **(IM)** Create an Etherpad for post-mortem
- [ ] [:link:][step_public_mrs] **(SwEng)** Ensure there are no public merge requests which inadvertently disclose the issue
- [ ] [:link:][step_assign_cve_id] **(IM)** Assign a CVE identifier
- [ ] [:link:][step_note_cve_info] **(SwEng)** Update this issue with the assigned CVE identifier and the CVSS score
- [ ] [:link:][step_versions_affected] **(SwEng)** Determine the range of product versions affected (including the Subscription Edition)
- [ ] [:link:][step_workarounds] **(SwEng)** Determine whether workarounds for the problem exist
- [ ] [:link:][step_coordinate] **(SwEng)** If necessary, coordinate with other parties
- [ ] [:link:][step_earliest] **(Support)** Prepare and send out "earliest" notifications
- [ ] [:link:][step_advisory_mr] **(Support)** Create a merge request for the Security Advisory and include all readily available information in it
- [ ] [:link:][step_reproducer_mr] **(SwEng)** Prepare a private merge request containing a system test reproducing the problem
- [ ] [:link:][step_notify_support] **(SwEng)** Notify Support when a reproducer is ready
- [ ] [:link:][step_code_analysis] **(SwEng)** Prepare a detailed explanation of the code flow triggering the problem
- [ ] [:link:][step_fix_mr] **(SwEng)** Prepare a private merge request with the fix
- [ ] [:link:][step_review_fix] **(SwEng)** Ensure the merge request with the fix is reviewed and has no outstanding discussions
- [ ] [:link:][step_review_docs] **(Support)** Review the documentation changes introduced by the merge request with the fix
- [ ] [:link:][step_backports] **(SwEng)** Prepare backports of the merge request addressing the problem for all affected (and still maintained) branches of a given product
- [ ] [:link:][step_finish_advisory] **(Support)** Finish preparing the Security Advisory
- [ ] [:link:][step_meta_issue] **(QA)** Create (or update) the private issue containing links to fixes & reproducers for all CVEs fixed in a given release cycle
- [ ] [:link:][step_changes] **(QA)** (BIND 9 only) Reserve a block of `CHANGES` placeholders once the complete set of vulnerabilities fixed in a given release cycle is determined
- [ ] [:link:][step_merge_fixes] **(QA)** Merge the CVE fixes in CVE identifier order
- [ ] [:link:][step_patches] **(QA)** Prepare a standalone patch for the last stable release of each affected (and still maintained) product branch
- [ ] [:link:][step_asn_releases] **(QA)** Prepare ASN releases (as outlined in the Release Checklist)
- [ ] Merge a regression test reproducing the bug into all affected (and still maintained) BIND branches
### At T-5
- [ ] [:link:][step_send_asn] **(Support)** Send ASN to eligible customers
- [ ] [:link:][step_preannouncement] **(Support)** (BIND 9 only) Send a pre-announcement email to the *bind-announce* mailing list to alert users that the upcoming release will include security fixes
### At T-4
- [ ] [:link:][step_verify_asn] **(Support)** Verify that all ASN-eligible customers have received the notification email
### At T-1
- [ ] [:link:][step_check_customers] **(Support)** Verify that any new or reinstated customers have received the notification email
- [ ] [:link:][step_packager_emails] **(First IM)** Send notifications to OS packagers
### On the Day of Public Disclosure
- [ ] [:link:][step_clearance] **(IM)** Grant Support clearance to proceed with public release
- [ ] [:link:][step_publish] **(Support)** Publish the releases (as outlined in the release checklist)
- [ ] [:link:][step_matrix] **(Support)** (BIND 9 only) Update vulnerability matrix in the Knowledge Base
- [ ] [:link:][step_publish_advisory] **(Support)** Bump Document Version for the Security Advisory and publish it in the Knowledge Base
- [ ] [:link:][step_notifications] **(First IM)** Send notification emails to third parties
- [ ] [:link:][step_mitre] **(First IM)** Advise MITRE about the disclosed CVEs
- [ ] [:link:][step_merge_advisory] **(First IM)** Merge the Security Advisory merge request
- [ ] [:link:][step_embargo_end] **(IM)** Inform original reporter (if external) that the security disclosure process is complete
- [ ] [:link:][step_customers] **(Support)** Inform customers a fix has been released
### After Public Disclosure
- [ ] [:link:][step_postmortem] **(First IM)** Organize post-mortem meeting and make sure it happens
- [ ] [:link:][step_tickets] **(Support)** Close support tickets
- [ ] [:link:][step_regression] **(QA)** Merge a regression test reproducing the bug into all affected (and still maintained) branches
[step_deputy]: https://gitlab.isc.org/isc-private/isc-wiki/-/wikis/Security-Incident-Handling-Checklist-Explanations#pick-a-deputy-incident-manager
[step_respond]: https://gitlab.isc.org/isc-private/isc-wiki/-/wikis/Security-Incident-Handling-Checklist-Explanations#respond-to-the-bug-reporter
[step_etherpad]: https://gitlab.isc.org/isc-private/isc-wiki/-/wikis/Security-Incident-Handling-Checklist-Explanations#create-an-etherpad-for-post-mortem
[step_public_mrs]: https://gitlab.isc.org/isc-private/isc-wiki/-/wikis/Security-Incident-Handling-Checklist-Explanations#ensure-there-are-no-public-merge-requests-which-inadvertently-disclose-the-issue
[step_assign_cve_id]: https://gitlab.isc.org/isc-private/isc-wiki/-/wikis/Security-Incident-Handling-Checklist-Explanations#assign-a-cve-identifier
[step_note_cve_info]: https://gitlab.isc.org/isc-private/isc-wiki/-/wikis/Security-Incident-Handling-Checklist-Explanations#update-this-issue-with-the-assigned-cve-identifier-and-the-cvss-score
[step_versions_affected]: https://gitlab.isc.org/isc-private/isc-wiki/-/wikis/Security-Incident-Handling-Checklist-Explanations#determine-the-range-of-product-versions-affected-including-the-subscription-edition
[step_workarounds]: https://gitlab.isc.org/isc-private/isc-wiki/-/wikis/Security-Incident-Handling-Checklist-Explanations#determine-whether-workarounds-for-the-problem-exist
[step_coordinate]: https://gitlab.isc.org/isc-private/isc-wiki/-/wikis/Security-Incident-Handling-Checklist-Explanations#if-necessary-coordinate-with-other-parties
[step_earliest]: https://gitlab.isc.org/isc-private/isc-wiki/-/wikis/Security-Incident-Handling-Checklist-Explanations#prepare-and-send-out-earliest-notifications
[step_advisory_mr]: https://gitlab.isc.org/isc-private/isc-wiki/-/wikis/Security-Incident-Handling-Checklist-Explanations#create-a-merge-request-for-the-security-advisory-and-include-all-readily-available-information-in-it
[step_reproducer_mr]: https://gitlab.isc.org/isc-private/isc-wiki/-/wikis/Security-Incident-Handling-Checklist-Explanations#prepare-a-private-merge-request-containing-a-system-test-reproducing-the-problem
[step_notify_support]: https://gitlab.isc.org/isc-private/isc-wiki/-/wikis/Security-Incident-Handling-Checklist-Explanations#notify-support-when-a-reproducer-is-ready
[step_code_analysis]: https://gitlab.isc.org/isc-private/isc-wiki/-/wikis/Security-Incident-Handling-Checklist-Explanations#prepare-a-detailed-explanation-of-the-code-flow-triggering-the-problem
[step_fix_mr]: https://gitlab.isc.org/isc-private/isc-wiki/-/wikis/Security-Incident-Handling-Checklist-Explanations#prepare-a-private-merge-request-with-the-fix
[step_review_fix]: https://gitlab.isc.org/isc-private/isc-wiki/-/wikis/Security-Incident-Handling-Checklist-Explanations#ensure-the-merge-request-with-the-fix-is-reviewed-and-has-no-outstanding-discussions
[step_review_docs]: https://gitlab.isc.org/isc-private/isc-wiki/-/wikis/Security-Incident-Handling-Checklist-Explanations#review-the-documentation-changes-introduced-by-the-merge-request-with-the-fix
[step_backports]: https://gitlab.isc.org/isc-private/isc-wiki/-/wikis/Security-Incident-Handling-Checklist-Explanations#prepare-backports-of-the-merge-request-addressing-the-problem-for-all-affected-and-still-maintained-branches-of-a-given-product
[step_finish_advisory]: https://gitlab.isc.org/isc-private/isc-wiki/-/wikis/Security-Incident-Handling-Checklist-Explanations#finish-preparing-the-security-advisory
[step_meta_issue]: https://gitlab.isc.org/isc-private/isc-wiki/-/wikis/Security-Incident-Handling-Checklist-Explanations#create-or-update-the-private-issue-containing-links-to-fixes-reproducers-for-all-cves-fixed-in-a-given-release-cycle
[step_changes]: https://gitlab.isc.org/isc-private/isc-wiki/-/wikis/Security-Incident-Handling-Checklist-Explanations#bind-9-only-reserve-a-block-of-changes-placeholders-once-the-complete-set-of-vulnerabilities-fixed-in-a-given-release-cycle-is-determined
[step_merge_fixes]: https://gitlab.isc.org/isc-private/isc-wiki/-/wikis/Security-Incident-Handling-Checklist-Explanations#merge-the-cve-fixes-in-cve-identifier-order
[step_patches]: https://gitlab.isc.org/isc-private/isc-wiki/-/wikis/Security-Incident-Handling-Checklist-Explanations#prepare-a-standalone-patch-for-the-last-stable-release-of-each-affected-and-still-maintained-product-branch
[step_asn_releases]: https://gitlab.isc.org/isc-private/isc-wiki/-/wikis/Security-Incident-Handling-Checklist-Explanations#prepare-asn-releases-as-outlined-in-the-release-checklist
[step_send_asn]: https://gitlab.isc.org/isc-private/isc-wiki/-/wikis/Security-Incident-Handling-Checklist-Explanations#send-asn-to-eligible-customers
[step_preannouncement]: https://gitlab.isc.org/isc-private/isc-wiki/-/wikis/Security-Incident-Handling-Checklist-Explanations#bind-9-only-send-a-pre-announcement-email-to-the-bind-announce-mailing-list-to-alert-users-that-the-upcoming-release-will-include-security-fixes
[step_verify_asn]: https://gitlab.isc.org/isc-private/isc-wiki/-/wikis/Security-Incident-Handling-Checklist-Explanations#verify-that-all-asn-eligible-customers-have-received-the-notification-email
[step_check_customers]: https://gitlab.isc.org/isc-private/isc-wiki/-/wikis/Security-Incident-Handling-Checklist-Explanations#verify-that-any-new-or-reinstated-customers-have-received-the-notification-email
[step_packager_emails]: https://gitlab.isc.org/isc-private/isc-wiki/-/wikis/Security-Incident-Handling-Checklist-Explanations#send-notifications-to-os-packagers
[step_clearance]: https://gitlab.isc.org/isc-private/isc-wiki/-/wikis/Security-Incident-Handling-Checklist-Explanations#grant-support-clearance-to-proceed-with-public-release
[step_publish]: https://gitlab.isc.org/isc-private/isc-wiki/-/wikis/Security-Incident-Handling-Checklist-Explanations#publish-the-releases-as-outlined-in-the-release-checklist
[step_matrix]: https://gitlab.isc.org/isc-private/isc-wiki/-/wikis/Security-Incident-Handling-Checklist-Explanations#bind-9-only-update-vulnerability-matrix-in-the-knowledge-base
[step_publish_advisory]: https://gitlab.isc.org/isc-private/isc-wiki/-/wikis/Security-Incident-Handling-Checklist-Explanations#bump-document-version-for-the-security-advisory-and-publish-it-in-the-knowledge-base
[step_notifications]: https://gitlab.isc.org/isc-private/isc-wiki/-/wikis/Security-Incident-Handling-Checklist-Explanations#send-notification-emails-to-third-parties
[step_mitre]: https://gitlab.isc.org/isc-private/isc-wiki/-/wikis/Security-Incident-Handling-Checklist-Explanations#advise-mitre-about-the-disclosed-cves
[step_merge_advisory]: https://gitlab.isc.org/isc-private/isc-wiki/-/wikis/Security-Incident-Handling-Checklist-Explanations#merge-the-security-advisory-merge-request
[step_embargo_end]: https://gitlab.isc.org/isc-private/isc-wiki/-/wikis/Security-Incident-Handling-Checklist-Explanations#inform-original-reporter-if-external-that-the-security-disclosure-process-is-complete
[step_customers]: https://gitlab.isc.org/isc-private/isc-wiki/-/wikis/Security-Incident-Handling-Checklist-Explanations#inform-customers-a-fix-has-been-released
[step_postmortem]: https://gitlab.isc.org/isc-private/isc-wiki/-/wikis/Security-Incident-Handling-Checklist-Explanations#organize-post-mortem-meeting-and-make-sure-it-happens
[step_tickets]: https://gitlab.isc.org/isc-private/isc-wiki/-/wikis/Security-Incident-Handling-Checklist-Explanations#close-support-tickets
[step_regression]: https://gitlab.isc.org/isc-private/isc-wiki/-/wikis/Security-Incident-Handling-Checklist-Explanations#merge-a-regression-test-reproducing-the-bug-into-all-affected-and-still-maintained-branches
+5 -2
View File
@@ -52,15 +52,17 @@
- [ ] ***(QA)*** Check that the formatting is correct for HTML and PDF versions of release notes.
- [ ] ***(QA)*** Check that the formatting of the generated man pages is correct.
- [ ] ***(QA)*** Verify GitLab CI results for the tags created and prepare a QA report for the releases to be published.
- [ ] ***(QA)*** Verify GitLab CI results for the tags created and sign off on the releases to be published.
- [ ] ***(QA)*** Update GitLab settings for all maintained branches to allow merging to them again.
- [ ] ***(QA)*** Prepare and merge MRs resetting the release notes and updating the version string for each maintained branch.
- [ ] ***(QA)*** Announce (on Mattermost) that the code freeze is over.
- [ ] ***(QA)*** Request signatures for the tarballs, providing their location and checksums.
- [ ] ***(Signers)*** Ensure that the contents of tarballs and tags are identical.
- [ ] ***(Signers)*** Validate tarball checksums, sign tarballs, and upload signatures.
- [ ] ***(QA)*** Verify tarball signatures and check tarball checksums again.
- [ ] ***(Support)*** Pre-publish ASN and/or Subscription Edition tarballs so that packages can be built.
- [ ] ***(QA)*** Build and test ASN and/or Subscription Edition packages.
- [ ] ***(QA)*** Prepare the `patches/` subdirectory for each security release (if applicable).
- [ ] ***(QA)*** Notify Support that the releases have been prepared.
- [ ] ***(Support)*** Send out ASNs (if applicable).
@@ -86,7 +88,8 @@
- [ ] ***(QA)*** Merge published release tags (non-linearly) back into the their relevant development/maintenance branches.
- [ ] ***(QA)*** Sanitize confidential issues which are assigned to the current release milestone and do not describe a security vulnerability, then make them public.
- [ ] ***(QA)*** Sanitize confidential issues which are assigned to older release milestones and describe security vulnerabilities, then make them public if appropriate[^2].
- [ ] ***(QA)*** Update QA tools used in GitLab CI (e.g. Flake8, PyLint) by modifying the relevant `Dockerfile`.
- [ ] ***(QA)*** Update QA tools used in GitLab CI (e.g. Black, PyLint, Sphinx) by modifying the relevant `Dockerfile`.
- [ ] ***(QA)*** Run a pipeline to rebuild all [images](https://gitlab.isc.org/isc-projects/images) used in GitLab CI.
[^1]: If not, use the time remaining until the tagging deadline to ensure all outstanding issues are either resolved or moved to a different milestone.
[^2]: As a rule of thumb, security vulnerabilities which have reproducers merged to the public repository are considered okay for full disclosure.
-35
View File
@@ -1,35 +0,0 @@
extraction:
cpp:
prepare:
packages:
- "libxml2-dev"
- "libjson-c-dev"
- "libssl-dev"
- "zlib1g-dev"
- "libcmocka-dev"
- "pkg-config"
- "libcap2-dev"
- "libedit-dev"
- "libidn2-dev"
- "libmaxminddb-dev"
- "libuv1-dev"
- "libnghttp2-dev"
configure:
command:
- "autoreconf -fi"
- "CFLAGS=\"-Og -g\" ./configure --enable-developer"
path_classifiers:
test:
- "lib/*/tests/"
- "bin/tests/"
docs:
- "**/*.xml"
- "**/*.docbook"
- "**/*.html"
- "**/*.1"
- "**/*.5"
- "**/*.8"
queries:
- exclude: fuzz/
- exclude: "bin/tests/system/*/ans*/*.py"
- exclude: cpp/use-of-goto
+12
View File
@@ -42,6 +42,11 @@ Files: **/*.after*
bin/tests/system/formerr/nametoolong
bin/tests/system/formerr/noquestions
bin/tests/system/formerr/twoquestions
bin/tests/system/forward/CA/CA.cfg
bin/tests/system/forward/CA/README
bin/tests/system/forward/CA/index.txt
bin/tests/system/forward/CA/index.txt.attr
bin/tests/system/forward/CA/serial
bin/tests/system/journal/ns1/managed-keys.bind.in
bin/tests/system/journal/ns1/managed-keys.bind.jnl.in
bin/tests/system/journal/ns2/managed-keys.bind.in
@@ -49,6 +54,11 @@ Files: **/*.after*
bin/tests/system/keepalive/expected
bin/tests/system/legacy/ns6/edns512.db.signed
bin/tests/system/legacy/ns7/edns512-notcp.db.signed
bin/tests/system/nsupdate/CA/CA.cfg
bin/tests/system/nsupdate/CA/README
bin/tests/system/nsupdate/CA/index.txt
bin/tests/system/nsupdate/CA/index.txt.attr
bin/tests/system/nsupdate/CA/serial
bin/tests/system/nsupdate/commandlist
bin/tests/system/nsupdate/verylarge.in
bin/tests/system/org.isc.bind.system.plist
@@ -147,6 +157,7 @@ Files: **/.clang-format
.clang-format
.clang-format.headers
.dir-locals.el
.git-blame-ignore-revs
.gitattributes
.gitignore
.gitlab-ci.yml
@@ -157,6 +168,7 @@ Files: **/.clang-format
doc/misc/options
doc/misc/rndc.grammar
tsan-suppressions.txt
sonar-project.properties
Copyright: Internet Systems Consortium, Inc. ("ISC")
License: CC0-1.0
+1
View File
@@ -51,3 +51,4 @@ Anay Panvalkar
colleen
Robert Edmonds
João Damas
Artem Boldariev (Артем Болдарєв)
+607 -6
View File
@@ -1,3 +1,587 @@
6118. [func] Add 'cds-digest-types' configuration option. Also allow
dnssec-signzone to create multple CDS records.
[GL #3837]
6117. [func] Add a qp-trie data structure. This is a foundation for
our plan to replace, in stages, BIND's red-black tree.
The qp-trie has lock-free multithreaded reads, using
QSBR for safe memory reclamation. [GL !7130]
6116. [placeholder]
6115. [bug] Unregister db update notify callback before detaching
from the previous db inside the catz update notify
callback. Also, call the db notify callbacks only after
zone_postload() returns successfully. [GL #3777]
6114. [func] Run the catalog zone update process on the offload
threads. [GL #3881]
6113. [func] Add shutdown signaling for catalog zones. [GL !7571]
6112. [func] Add reference count tracing for dns_catz_zone_t and
dns_catz_zones_t. [GL !7570]
6111. [cleanup] Move irs_resconf into libdns, and remove the
now empty libirs. [GL !7463]
6110. [cleanup] Refactor the dns_xfrin module to use dns_dispatch
to set up TCP connections and send and receive
messages. [GL #3886]
6109. [func] Infrastructure for QSBR, asynchronous safe memory
reclamation for lock-free data structures. [GL !7471]
6108. [func] Support for simple lock-free singly-linked stacks.
[GL !7470]
6107. [cleanup] Remove the dns_sdb API and rewrite the named
builtin databases to implement dns_db directly.
[GL #3882]
6106. [cleanup] Move bind9_getaddresses() to isc_getaddresses()
and remove the now empty libbind9. [GL !7462]
6105. [bug] Detach 'rpzs' and 'catzs' from the previous view in
configure_rpz() and configure_catz(), respectively,
just after attaching it to the new view. [GL #3880]
6104. [cleanup] Move libbind9's configuration checking code into
libisccfg alongside the other configuration code.
[GL !7461]
6103. [func] All uses of the isc_task and isc_event APIs have
been refactored to use isc_loop instead, and the
original APIs have been removed. [GL #3797]
6102. [cleanup] Several nugatory headers have been removed from libisc.
[GL !7464]
6101. [port] Clarify the portability dodge needed for `strerror_r()`
[GL !7465]
6100. [cleanup] Deprecate <isc/deprecated.h>, because obsolete
functions are now deleted instead of marked with
an attribute. [GL !7466]
6099. [performance] Change the internal read-write lock to modified C-RW-WP
algorithm that is more reader-writer fair and has better
performance for our workloads. [GL #1609]
6098. [test] Don't test HMAC-MD5 when not supported by libcrypto.
[GL #3871]
6097. [port] Improve support for yield / pause instructions in spin
loops on AArch64 platforms. [GL !7469]
6096. [bug] Fix RPZ reference counting error on shutdown in
dns__rpz_timer_cb(). [GL #3866]
6095. [test] Test various 'islands of trust' configurations when
using managed keys. [GL #3662]
6094. [bug] Building against (or running with) libuv versions
1.35.0 and 1.36.0 is now a fatal error. The rules for
mixing and matching compile-time and run-time libuv
versions have been tightened for libuv versions between
1.35.0 and 1.40.0. [GL #3840]
6093. [performance] Reduce the size of each rdataset header object
by 16 bytes. [GL !7505]
6092. [bug] dnssec-cds failed to cleanup properly. [GL #3831]
6091. [cleanup] Drop RHEL 7 and clones support. [GL #3729]
6090. [bug] Fix a bug in resolver's resume_dslookup() function by
making sure that dns_resolver_createfetch() is called
with valid parameters, as required by the function.
[GL #3839]
6089. [bug] Source ports configured for query-source,
transfer-source, etc, were being ignored. (This
feature is deprecated, but it is not yet removed,
so the bug still needed fixing.) [GL #3790]
6088. [cleanup] /etc/bind.keys is no longer needed and has been
removed from the distribution. named and delv can
still load keys from a file for testing purposes,
but they no longer do so by default. [GL #3850]
6087. [cleanup] Remove support for the `DNS_NAME_DOWNCASE` option to
the various dns_*_fromwire() functions. It has long
been unused and is unsupported since change 6022.
[GL !7467]
6086. [cleanup] Remove some remnants of bitstring labels. [GL !7196]
6085. [func] Add isc_time_monotonic() to simplify time measurements.
[GL !7468]
6084. [bug] When BIND was built without jemalloc, the allocator flag
ISC_MEM_ZERO could return non-zero memory. [GL #3845]
--- 9.19.10 released ---
6083. [bug] Fix DNSRPS-enabled builds as they were inadvertently
broken by changes 5949 and 6042. [GL #3827]
6082. [test] fuzz/dns_message_checksig leaked memory when shutting
down. [GL #3828]
6081. [bug] Handle primary server address lookup failures in
nsupdate more gracefully. [GL #3830]
6080. [bug] 'named -V' leaked memory. [GL #3829]
6079. [bug] Force set the DS state after a 'rdnc dnssec -checkds'
command. [GL #3822]
6078. [func] Cleanup the memory statistic counters to a bare
minumum - InUse with Malloced as alias. [GL #3718]
6077. [func] Implement query forwarding to DoT-enabled upstream
servers. [GL #3726]
6076. [bug] Handle OS errors when creating UDP and TCP sockets
more gracefully. [GL #3800]
6075. [bug] Add missing node lock when setting node->wild in
add_wildcard_magic. [GL #3799]
6074. [func] Refactor the isc_nm_xfr_allowed() function to return
isc_result_t instead of boolean. [GL #3808]
6073. [bug] Set RD=1 on DS requests to parental-agents. [GL #3783]
6072. [bug] Avoid the OpenSSL lock contention when initializing
Message Digest Contexts by using explicit algorithm
fetching, initializing static contexts for every
supported algorithms, and initializing the new context
by copying the static copy. [GL #3795]
6071. [func] The use of "port" when configuring query-source,
transfer-source, notify-source and parental-source
addresses has been deprecated, along with the
use-v[46]-udp-ports and avoid-v[46]-udp-ports
options. A warning will be logged when these
options are used. In a future release, they
will be removed. [GL #3781]
6070. [func] DSCP parsing has now been fully removed, and
configuration of DSCP values in named.conf is a
configuration error. [GL #3789]
6069. [bug] Detach from the view in zone_shutdown() to
release the memory held by the dead view
early. [GL #3801]
6068. [bug] Downloading a zone via TLS from a server which does
not negotiate "dot" ALPN token could crash BIND
on shutdown. That has been fixed. [GL #3767]
--- 9.19.9 released ---
6067. [security] Fix serve-stale crash when recursive clients soft quota
is reached. (CVE-2022-3924) [GL #3619]
6066. [security] Handle RRSIG lookups when serve-stale is active.
(CVE-2022-3736) [GL #3622]
6065. [placeholder]
6064. [security] An UPDATE message flood could cause named to exhaust all
available memory. This flaw was addressed by adding a
new "update-quota" statement that controls the number of
simultaneous UPDATE messages that can be processed or
forwarded. The default is 100. A stats counter has been
added to record events when the update quota is
exceeded, and the XML and JSON statistics version
numbers have been updated. (CVE-2022-3094) [GL #3523]
6063. [cleanup] The RSA and ECDSA parts of the DNSSEC has been
refactored for a better OpenSSL 3.x integration and
preliminary PKCS#11 support via for OpenSSL Providers
has been added. [GL #3785]
6062. [func] The DSCP implementation, which has been
nonfunctional for some time, is now marked as
obsolete and the implementation has been removed.
Configuring DSCP values in named.conf has no
effect, and a warning will be logged that
the feature should no longer be used. [GL #3773]
6061. [bug] Fix unexpected "Prohibited" extended DNS error
on allow-recursion. [GL #3743]
6060. [bug] Fix a use-after-free bug in dns_zonemgr_releasezone()
by detaching from the zone manager outside of the write
lock. [GL #3768]
6059. [bug] In some serve stale scenarios, like when following an
expired CNAME record, named could return SERVFAIL if the
previous request wasn't successful. Consider non-stale
data when in serve-stale mode. [GL #3678]
6058. [bug] Prevent named from crashing when "rndc delzone"
attempts to delete a zone added by a catalog zone.
[GL #3745]
6057. [bug] Fix shutdown and error path bugs in the rpz unit.
[GL #3735]
6056. [bug] Fix a race in adb.c:clean_namehooks(), so that an ADB
entry does not expire without holding the entries lock.
[GL #3754]
6055. [cleanup] Remove setting alternate transfer sources, make options
alt-transfer-source, alt-transfer-transfer-source-v6,
and use-alt-transfer-source ancient. [GL #3714]
6054. [func] Refactor remote servers (primaries, parental-agents)
in zone.c. Store common code in new source files
remote.c and remote.h. Introduce a new way to set the
source address and port. [GL !7110]
6053. [bug] Fix an ADB quota management bug in resolver. [GL #3752]
6052. [func] Replace DNS over TCP and DNS over TLS transports
code with a new, unified transport implementation.
[GL #3374]
6051. [bug] Improve thread safety in the dns_dispatch unit.
[GL #3178] [GL #3636]
6050. [bug] Changes to the RPZ response-policy min-update-interval
and add-soa options now take effect as expected when
named is reconfigured. [GL #3740]
6049. [bug] Exclude ABD hashtables from the ADB memory
overmem checks and don't clean ADB names
and ADB entries used in the last 10 seconds
(ADB_CACHE_MINIMUM). [GL #3739]
6048. [bug] Fix a log message error in dns_catz_update_from_db(),
where serials with values of 2^31 or larger were logged
incorrectly as negative numbers. [GL #3742]
6047. [bug] Try the next server instead of trying the same
server again on an outgoing query timeout.
[GL #3637]
6046. [bug] TLS session resumption might lead to handshake
failures when client certificates are used for
authentication (Mutual TLS). This has been fixed.
[GL #3725]
6045. [cleanup] The list of supported DNSSEC algorithms changed log
level from "warning" to "notice" to match named's other
startup messages. [GL !7217]
6044. [bug] There was an "RSASHA236" typo in a log message.
[GL !7206]
--- 9.19.8 released ---
6043. [bug] The key file IO locks objects would never get
deleted from the hashtable due to off-by-one error.
[GL #3727]
6042. [bug] ANY responses could sometimes have the wrong TTL.
[GL #3613]
6041. [func] Set the RLIMIT_NOFILE to rlim_max returned from
getrlimit() instead of trying to guess the maximum
allowed value. [GL #3676]
6040. [bug] Speed up the named shutdown time by explicitly
canceling all recursing ns_client objects for
each ns_clientmgr. [GL #3183]
6039. [bug] Removing a catalog zone from catalog-zones without
also removing the referenced zone could leave a
dangling pointer. [GL #3683]
6038. [placeholder]
6037. [func] Reject zones which have DS records not at delegation
points. [GL #3697]
6036. [bug] nslookup and host were not honoring the selected port
in TCP mode. [GL #3721]
6035. [bug] Refactor the dns_resolver unit to store the fetch
contexts and zone counter directly in the hash
tables without buckets and implement effective
cleaning of both objects. [GL #3709]
6034. [func] Deprecate alt-transfer-source, alt-transfer-source-v6
and use-alt-transfer-source. [GL #3694]
6033. [func] Log messages related to serve-stale now include the RR
type involved. [GL !7145]
6032. [bug] After change 5995, zone transfers were using a small
compression context that only had space for the first
few dozen names in each message. They now use a large
compression context with enough space for every name.
[GL #3706]
6031. [bug] Move the "final reference detached" log message
from dns_zone unit to the DEBUG(1) log level.
[GL #3707]
6030. [bug] Refactor the ADB to use a global LRU queue, store
the ADB names and ADB entries directly in the hash
tables instead of buckets, and properly clean the
ADB names and entries when not in use. [GL #3239]
[GL #3238] [GL #2615] [GL #2078] [GL #2437]
[GL #3312] [GL #2441]
6029. [cleanup] Remove the unused external cache cleaning mechanism
as RBTDB has its own internal cache cleaning
mechanism and we don't support any other database
implementations. [GL #3639]
6028. [performance] Build-time code generation of DNS RRtype switches
is now much faster. [GL !7121]
6027. [bug] Fix assertion failure in isc_http API used by
statschannel if the read callback would be called
on HTTP request that has been already closed.
[GL #3693]
6026. [cleanup] Deduplicate time unit conversion factors.
[GL !7033]
6025. [bug] Copy TLS identifier when setting up primaries for
catalog member zones. [GL #3638]
6024. [func] Deprecate 'auto-dnssec'. [GL #3667]
6023. [func] Remove dynamic update DNSSEC management feature.
[GL #3686]
6022. [performance] The decompression implementation in dns_name_fromwire()
is now smaller and faster. [GL #3655]
6021. [bug] Use the current domain name when checking answers from
a dual-stack-server. [GL #3607]
6020. [bug] Ensure 'named-checkconf -z' respects the check-wildcard
option when loading a zone. [GL #1905]
6019. [func] Deprecate `coresize`, `datasize`, `files`, and
`stacksize` named.conf options. [GL #3676]
6018. [cleanup] Remove the --with-tuning configure option.
[GL #3664]
6017. [bug] The view's zone table was not locked when it should
have been leading to race conditions when external
extensions that manipulate the zone table where in
use. [GL #3468]
6016. [func] Change NSEC3PARAM TTL to match the SOA MINIMUM.
[GL #3570]
6015. [bug] Some browsers (Firefox) send more than 10 HTTP
headers. Bump the number of allowed HTTP headers
to 100. [GL #3670]
6014. [func] Add isc_hashmap API implementation that implements
Robin Hood hashing. The API requires the keys to
be stored with the stored value. [GL !6790]
--- 9.19.7 released ---
6013. [bug] Fix a crash that could happen when you change
a dnssec-policy zone with NSEC3 to start using
inline-signing. [GL #3591]
6012. [placeholder]
6011. [func] Refactor the privilege setting part of named_os unit
to make libcap on Linux mandatory and use setreuid
and setregid if available. [GL #3583]
6010. [func] Make the initial interface scan happen before
dropping the privileges. This requires exiting
exclusive mode before scanning the interfaces
and re-entering it again when we are done. This
is because starting the listening on interfaces
requires the loopmgr to be running and not paused.
[GL #3583]
6009. [bug] Don't trust a placeholder KEYDATA from the managed-keys
zone by adding it into secroots. [GL #2895]
6008. [bug] Fixed a race condition that could cause a crash
in dns_zone_synckeyzone(). [GL #3617]
6007. [cleanup] Don't enforce the jemalloc use on NetBSD. [GL #3634]
6006. [cleanup] The zone dumping was using isc_task API to launch
the zonedump on the offloaded threadpool. Remove
the task and launch the offloaded work directly.
[GL #3628]
6005. [func] The zone loading has been moved to the offload
threadpool instead of doing incremental repeated
tasks, so zone loading scheduling is now driven
by the operating system scheduler rather than fixed
(100) quantum. [GL #3625]
6004. [func] Add check-svcb to control the checking of additional
constraints on SVBC records. This change impacts on
named, named-checkconf, named-checkzone,
named-compilezone and nsupdate. [GL #3576]
6003. [bug] Fix an inheritance bug when setting the port on
remote servers in configuration. [GL #3627]
6002. [bug] Fix a resolver prefetch bug when the record's TTL value
is equal to the configured prefetch eligibility value,
but the record was erroneously not treated as eligible
for prefetching. [GL #3603]
6001. [bug] Always call dns_adb_endudpfetch() after calling
dns_adb_beginudpfetch() for UDP queries in resolver.c,
in order to adjust back the quota. [GL #3598]
6000. [bug] Fix a startup issue on Solaris systems with many
(reportedly > 510) CPUs. Thanks to Stacey Marshall from
Oracle for deep investigation of the problem. [GL #3563]
5999. [bug] rpz-ip rules could be ineffective in some scenarios
with CD=1 queries. [GL #3247]
5998. [placeholder]
5997. [cleanup] Less ceremonial UNEXPECTED_ERROR() and FATAL_ERROR()
reporting macros. [GL !6914]
5996. [bug] Fix a couple of bugs in cfg_print_duration(), which
could result in generating incomplete duration values
when printing the configuration using named-checkconf.
[GL !6880]
5995. [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. [GL !6517]
5994. [func] Refactor the isc_httpd implementation used in the
statistics channel. [GL !6879]
5993. [cleanup] Store dns_name_t attributes as boolean members of
the structure. Remove DNS_NAMEATTR_* macros.
Fix latent attribute handling bug in RBT. [GL !6902]
--- 9.19.6 released ---
5992. [func] Introduce the new isc_mem_*x() APIs that takes extra
flags as the last argument. Currently ISC_MEM_ZERO
and ISC_MEM_ALIGN(n) flags have been implemented that
clears the memory to avoid the isc_mem_get()/memset()
pattern and make aligned allocation which replaces the
previous isc_mem_*_aligned() calls. [GL !6398]
5991. [protocol] Add support for parsing and validating "dohpath" to
SVCB. [GL #3544]
5990. [test] fuzz/dns_message_checksig now creates the key directory
it uses when testing in /tmp at run time. [GL #3569]
5989. [func] Implement support for DDNS update forwarding using DoT
to TLS-enabled primary servers. [GL #3512]
5988. [bug] Some out of memory conditions in opensslrsa_link.c
could lead to memory leaks. [GL #3551]
5987. [func] Provide custom isc_mem based allocators for libuv,
OpenSSL and libxml2 libraries that support replacing
the internal allocators. [GL #3559]
5986. [func] Make the memory context debugging options local to
the memory context and make it immutable for the memory
context lifetime. [GL #3559]
5985. [func] Bump the minimal libuv version to 1.34.0. [GL #3567]
5984. [func] 'named -V' now reports the list of supported
DNSSEC/DS/HMAC algorithms and the supported TKEY modes.
[GL #3541]
5983. [bug] Changing just the TSIG key names for primaries in
catalog zones' member zones was not effective.
[GL #3557]
5982. [func] Extend dig to allow requests to be signed using SIG(0)
as well as providing a mechanism to specify the signing
time. [GL !5923]
5981. [test] Add dns_message_checksig fuzzer to check messages
signed using TSIG or SIG(0). [GL !5923]
5980. [func] The internal isc_entropy API provider has been
changed from OpenSSL RAND_bytes() to uv_random()
to use system provided entropy. [GL !6803]
5979. [func] Implement DoT support for nsupdate. [GL #1781]
5978. [port] The ability to use pkcs11 via engine_pkcs11 has been
restored, by only using deprecated APIs in
OpenSSL 3.0.0. BIND needs to be compiled with
'-DOPENSSL_API_COMPAT=10100' specified in the CFLAGS
at compile time. [GL !6711]
5977. [bug] named could incorrectly return non-truncated, glueless
referrals for responses whose size was close to the UDP
packet size limit. [GL #1967]
5976. [cleanup] isc_timer_t objects are now created, started and
destroyed in a particular loop, and timer callbacks
run in that loop. isc_timer_stop() can still be called
from any loop; when run from a different loop than
the one associated with the timer, the request will
be recorded in atomic variable and the timer will
be stopped on the next callback call. [GL #3202]
5975. [func] Implement TLS transport support for dns_request and
dns_dispatch. [GL #3529]
5974. [bug] Fix an assertion failure in dispatch caused by
extra read callback call. [GL #3545]
5973. [bug] Fixed a possible invalid detach in UPDATE
processing. [GL #3522]
5972. [bug] Gracefully handle when the statschannel HTTP connection
gets cancelled during sending data back to the client.
[GL #3542]
5971. [func] Add libsystemd sd_notify() support. [GL #1176]
5970. [func] Log the reason why a query was refused. [GL !6669]
5969. [bug] DNSSEC signing statistics failed to identify the
algorithm involved. The key names have been changed
to be the algorithm number followed by "+" followed
by the key id (e.g. "8+54274"). [GL #3525]
5968. [cleanup] Remove 'resolve' binary from tests. [GL !6733]
5967. [cleanup] Flagged the obsolete "random-device" option as
ancient; it is now an error to configure it. [GL #3399]
5966. [func] You can now specify if a server must return a DNS
COOKIE before accepting the response over UDP.
[GL #2295]
server <prefix> { require-cookie <yes_or_no>; };
5965. [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
@@ -10,17 +594,32 @@
5963. [bug] Ensure struct named_server is properly initialized.
[GL #6531]
5962. [placeholder]
--- 9.19.5 released ---
5962. [security] Fix memory leak in EdDSA verify processing.
(CVE-2022-38178) [GL #3487]
5961. [placeholder]
5960. [placeholder]
5960. [security] Fix serve-stale crash that could happen when
stale-answer-client-timeout was set to 0 and there was
a stale CNAME in the cache for an incoming query.
(CVE-2022-3080) [GL #3517]
5959. [placeholder]
5959. [security] Fix memory leaks in the DH code when using OpenSSL 3.0.0
and later versions. The openssldh_compare(),
openssldh_paramcompare(), and openssldh_todns()
functions were affected. (CVE-2022-2906) [GL #3491]
5958. [placeholder]
5958. [security] When an HTTP connection was reused to get
statistics from the stats channel, and zlib
compression was in use, each successive
response sent larger and larger blocks of memory,
potentially reading past the end of the allocated
buffer. (CVE-2022-2881) [GL #3493]
5957. [placeholder]
5957. [security] Prevent excessive resource use while processing large
delegations. (CVE-2022-2795) [GL #3394]
5956. [func] Make RRL code treat all QNAMEs that are subject to
wildcard processing within a given zone as the same
@@ -537,7 +1136,9 @@
when the resent query's result was SERVFAIL. [GL #3020]
5830. [func] Implement incremental resizing of isc_ht hash tables to
perform the rehashing gradually. [GL #3212]
perform the rehashing gradually. The catalog zone
implementation has been optimized to work with hundreds
of thousands of member zones. [GL #3212] [GL #3744]
5829. [func] Refactor and simplify isc_timer API in preparation
for further refactoring on top of network manager
+1 -1
View File
@@ -1,4 +1,4 @@
Copyright (C) 1996-2022 Internet Systems Consortium, Inc. ("ISC")
Copyright (C) 1996-2023 Internet Systems Consortium, Inc. ("ISC")
This Source Code Form is subject to the terms of the Mozilla Public
License, v. 2.0. If a copy of the MPL was not distributed with this
+6 -3
View File
@@ -1,22 +1,25 @@
include $(top_srcdir)/Makefile.top
SUBDIRS = . lib doc bin fuzz
SUBDIRS = . lib doc
# build libtest before fuzz/* and bin/tests
if HAVE_CMOCKA
SUBDIRS += tests
endif HAVE_CMOCKA
# run fuzz tests before system tests
SUBDIRS += fuzz bin
BUILT_SOURCES = bind.keys.h
CLEANFILES = bind.keys.h
bind.keys.h: bind.keys Makefile
${PERL} ${top_srcdir}/util/bindkeys.pl ${top_srcdir}/bind.keys > $@
dist_sysconf_DATA = bind.keys
.PHONY: doc
EXTRA_DIST = \
bind.keys \
util/bindkeys.pl \
contrib \
CHANGES \
+2 -2
View File
@@ -2,6 +2,7 @@ SPHINX_V = $(SPHINX_V_@AM_V@)
SPHINX_V_ = $(SPHINX_V_@AM_DEFAULT_V@)
SPHINX_V_0 = -q
SPHINX_V_1 = -n
SPHINX_W = -W
AM_V_SPHINX = $(AM_V_SPHINX_@AM_V@)
AM_V_SPHINX_ = $(AM_V_SPHINX_@AM_DEFAULT_V@)
@@ -13,14 +14,13 @@ LF = \n
RNDC_CONF = .. |rndc_conf| replace:: ``$(sysconfdir)/rndc.conf``
RNDC_KEY = .. |rndc_key| replace:: ``$(sysconfdir)/rndc.key``
NAMED_CONF = .. |named_conf| replace:: ``$(sysconfdir)/named.conf``
BIND_KEYS = .. |bind_keys| replace:: ``$(sysconfdir)/bind.keys``
NAMED_PID = .. |named_pid| replace:: ``$(runstatedir)/named.pid``
SESSION_KEY = .. |session_key| replace:: ``$(runstatedir)/session.key``
export RST_EPILOG = $(RNDC_CONF)$(LF)$(RNDC_KEY)$(LF)$(NAMED_CONF)$(LF)$(BIND_KEYS)$(LF)$(NAMED_PID)$(LF)$(SESSION_KEY)
common_SPHINXOPTS = \
-W \
$(SPHINX_W) \
-c $(srcdir) \
-a \
$(SPHINX_V)
-12
View File
@@ -40,12 +40,6 @@ LIBNS_CFLAGS = \
LIBNS_LIBS = \
$(top_builddir)/lib/ns/libns.la
LIBIRS_CFLAGS = \
-I$(top_srcdir)/lib/irs/include
LIBIRS_LIBS = \
$(top_builddir)/lib/irs/libirs.la
LIBISCCFG_CFLAGS = \
-I$(top_srcdir)/lib/isccfg/include
@@ -57,9 +51,3 @@ LIBISCCC_CFLAGS = \
LIBISCCC_LIBS = \
$(top_builddir)/lib/isccc/libisccc.la
LIBBIND9_CFLAGS = \
-I$(top_srcdir)/lib/bind9/include
LIBBIND9_LIBS = \
$(top_builddir)/lib/bind9/libbind9.la
+1
View File
@@ -26,3 +26,4 @@ Some of these settings are:
| `-DISC_MEM_TRACKLINES=0` | Don't track memory allocations by file and line number; this improves performance but makes debugging more difficult |
| `-DNAMED_RUN_PID_DIR=0` | Create default PID files in `${localstatedir}/run` rather than `${localstatedir}/run/named/` |
| `-DNS_CLIENT_DROPPORT=0` | Disable dropping queries from particular well-known ports |
| `-DOPENSSL_API_COMPAT=10100` | Build using the deprecated OpenSSL APIs so that the `engine` API is available when building with OpenSSL 3.0.0 for PKCS#11 support |
+1 -1
View File
@@ -125,7 +125,7 @@ including your patch as an attachment, preferably generated by
### <a name="build"/> Building BIND 9
For information about building BIND 9, see the
["Building BIND 9"](doc/arm/build.rst) section in the BIND 9
["Building BIND 9"](doc/arm/build.inc.rst) section in the BIND 9
Administrator Reference Manual.
### <a name="testing"/> Automated testing
+2 -4
View File
@@ -4,8 +4,7 @@ AM_CPPFLAGS += \
$(LIBISC_CFLAGS) \
$(LIBDNS_CFLAGS) \
$(LIBNS_CFLAGS) \
$(LIBISCCFG_CFLAGS) \
$(LIBBIND9_CFLAGS)
$(LIBISCCFG_CFLAGS)
AM_CPPFLAGS += \
-DNAMED_CONFFILE=\"${sysconfdir}/named.conf\"
@@ -21,8 +20,7 @@ LDADD += \
$(LIBISC_LIBS) \
$(LIBDNS_LIBS) \
$(LIBNS_LIBS) \
$(LIBISCCFG_LIBS) \
$(LIBBIND9_LIBS)
$(LIBISCCFG_LIBS)
bin_PROGRAMS = named-checkconf named-checkzone
+8 -6
View File
@@ -14,6 +14,7 @@
/*! \file */
#include <inttypes.h>
#include <netdb.h>
#include <stdbool.h>
#include <stdio.h>
@@ -21,8 +22,6 @@
#include <isc/log.h>
#include <isc/mem.h>
#include <isc/net.h>
#include <isc/netdb.h>
#include <isc/print.h>
#include <isc/region.h>
#include <isc/result.h>
#include <isc/stdio.h>
@@ -94,7 +93,7 @@ dns_zoneopt_t zone_options = DNS_ZONEOPT_CHECKNS | DNS_ZONEOPT_CHECKMX |
#if CHECK_SIBLING
DNS_ZONEOPT_CHECKSIBLING |
#endif /* if CHECK_SIBLING */
DNS_ZONEOPT_CHECKWILDCARD |
DNS_ZONEOPT_CHECKSVCB | DNS_ZONEOPT_CHECKWILDCARD |
DNS_ZONEOPT_WARNMXCNAME | DNS_ZONEOPT_WARNSRVCNAME;
/*
@@ -205,7 +204,8 @@ checkns(dns_zone_t *zone, const dns_name_t *name, const dns_name_t *owner,
*/
cur = ai;
while (cur != NULL && cur->ai_canonname == NULL &&
cur->ai_next != NULL) {
cur->ai_next != NULL)
{
cur = cur->ai_next;
}
if (cur != NULL && cur->ai_canonname != NULL &&
@@ -407,7 +407,8 @@ checkmx(dns_zone_t *zone, const dns_name_t *name, const dns_name_t *owner) {
*/
cur = ai;
while (cur != NULL && cur->ai_canonname == NULL &&
cur->ai_next != NULL) {
cur->ai_next != NULL)
{
cur = cur->ai_next;
}
if (cur != NULL && cur->ai_canonname != NULL &&
@@ -493,7 +494,8 @@ checksrv(dns_zone_t *zone, const dns_name_t *name, const dns_name_t *owner) {
*/
cur = ai;
while (cur != NULL && cur->ai_canonname == NULL &&
cur->ai_next != NULL) {
cur->ai_next != NULL)
{
cur = cur->ai_next;
}
if (cur != NULL && cur->ai_canonname != NULL &&
+24 -4
View File
@@ -24,7 +24,6 @@
#include <isc/hash.h>
#include <isc/log.h>
#include <isc/mem.h>
#include <isc/print.h>
#include <isc/result.h>
#include <isc/string.h>
#include <isc/util.h>
@@ -37,11 +36,10 @@
#include <dns/rootns.h>
#include <dns/zone.h>
#include <isccfg/check.h>
#include <isccfg/grammar.h>
#include <isccfg/namedconf.h>
#include <bind9/check.h>
#include "check-tool.h"
static const char *program = "named-checkconf";
@@ -401,6 +399,28 @@ configure_zone(const char *vclass, const char *view, const cfg_obj_t *zconfig,
zone_options |= DNS_ZONEOPT_CHECKSPF;
}
obj = NULL;
if (get_maps(maps, "check-svcb", &obj)) {
if (cfg_obj_asboolean(obj)) {
zone_options |= DNS_ZONEOPT_CHECKSVCB;
} else {
zone_options &= ~DNS_ZONEOPT_CHECKSVCB;
}
} else {
zone_options |= DNS_ZONEOPT_CHECKSVCB;
}
obj = NULL;
if (get_maps(maps, "check-wildcard", &obj)) {
if (cfg_obj_asboolean(obj)) {
zone_options |= DNS_ZONEOPT_CHECKWILDCARD;
} else {
zone_options &= ~DNS_ZONEOPT_CHECKWILDCARD;
}
} else {
zone_options |= DNS_ZONEOPT_CHECKWILDCARD;
}
obj = NULL;
if (get_checknames(maps, &obj)) {
if (strcasecmp(cfg_obj_asstring(obj), "warn") == 0) {
@@ -713,7 +733,7 @@ main(int argc, char **argv) {
exit(1);
}
result = bind9_check_namedconf(config, loadplugins, logc, mctx);
result = isccfg_check_namedconf(config, loadplugins, logc, mctx);
if (result != ISC_R_SUCCESS) {
exit_status = 1;
}
+5 -4
View File
@@ -32,10 +32,11 @@ errors. If no file is specified,
|named_conf| is read by default.
Note: files that :iscman:`named` reads in separate parser contexts, such as
``rndc.key`` and ``bind.keys``, are not automatically read by
:program:`named-checkconf`. Configuration errors in these files may cause
:iscman:`named` to fail to run, even if :program:`named-checkconf` was successful.
However, :program:`named-checkconf` can be run on these files explicitly.
``rndc.conf`` or ``rndc.key``, are not automatically read by
:program:`named-checkconf`. Configuration errors in these files may cause
:iscman:`named` to fail to run, even if :program:`named-checkconf` was
successful. However, :program:`named-checkconf` can be run on these files
explicitly.
Options
~~~~~~~
+18 -6
View File
@@ -24,10 +24,8 @@
#include <isc/hash.h>
#include <isc/log.h>
#include <isc/mem.h>
#include <isc/print.h>
#include <isc/result.h>
#include <isc/string.h>
#include <isc/task.h>
#include <isc/timer.h>
#include <isc/util.h>
@@ -165,8 +163,8 @@ main(int argc, char **argv) {
isc_commandline_errprint = false;
while ((c = isc_commandline_parse(argc, argv,
"c:df:hi:jJ:k:L:l:m:n:qr:s:t:o:vw:DF:"
"M:S:T:W:")) != EOF)
"c:df:hi:jJ:k:L:l:m:n:qr:s:t:o:vw:C:"
"DF:M:S:T:W:")) != EOF)
{
switch (c) {
case 'c':
@@ -361,6 +359,18 @@ main(int argc, char **argv) {
workdir = isc_commandline_argument;
break;
case 'C':
if (ARGCMP("check-svcb:fail")) {
zone_options |= DNS_ZONEOPT_CHECKSVCB;
} else if (ARGCMP("check-svcb:ignore")) {
zone_options &= ~DNS_ZONEOPT_CHECKSVCB;
} else {
fprintf(stderr, "invalid argument to -C: %s\n",
isc_commandline_argument);
exit(1);
}
break;
case 'D':
dumpzone++;
break;
@@ -471,7 +481,8 @@ main(int argc, char **argv) {
outputformat = dns_masterformat_raw;
rawversion = strtol(outputformatstr + 4, &end, 10);
if (end == outputformatstr + 4 || *end != '\0' ||
rawversion > 1U) {
rawversion > 1U)
{
fprintf(stderr, "unknown raw format version\n");
exit(1);
}
@@ -510,7 +521,8 @@ main(int argc, char **argv) {
}
if (argc - isc_commandline_index < 1 ||
argc - isc_commandline_index > 2) {
argc - isc_commandline_index > 2)
{
usage();
}
+10 -1
View File
@@ -23,7 +23,7 @@ named-checkzone - zone file validation tool
Synopsis
~~~~~~~~
:program:`named-checkzone` [**-d**] [**-h**] [**-j**] [**-q**] [**-v**] [**-c** class] [**-f** format] [**-F** format] [**-J** filename] [**-i** mode] [**-k** mode] [**-m** mode] [**-M** mode] [**-n** mode] [**-l** ttl] [**-L** serial] [**-o** filename] [**-r** mode] [**-s** style] [**-S** mode] [**-t** directory] [**-T** mode] [**-w** directory] [**-D**] [**-W** mode] {zonename} {filename}
:program:`named-checkzone` [**-d**] [**-h**] [**-j**] [**-q**] [**-v**] [**-c** class] [**-C** mode] [**-f** format] [**-F** format] [**-J** filename] [**-i** mode] [**-k** mode] [**-m** mode] [**-M** mode] [**-n** mode] [**-l** ttl] [**-L** serial] [**-o** filename] [**-r** mode] [**-s** style] [**-S** mode] [**-t** directory] [**-T** mode] [**-w** directory] [**-D**] [**-W** mode] {zonename} {filename}
Description
~~~~~~~~~~~
@@ -68,6 +68,15 @@ Options
This option specifies the class of the zone. If not specified, ``IN`` is assumed.
.. option:: -C mode
This option controls check mode on zone files when loading.
Possible modes are ``check-svcb:fail`` and ``check-svcb:ignore``.
``check-svcb:fail`` turns on additional checks on ``_dns`` SVCB
records and ``check-svcb:ignore`` disables these checks. The
default is ``check-svcb:fail``.
.. option:: -i mode
This option performs post-load zone integrity checks. Possible modes are
+11 -2
View File
@@ -23,7 +23,7 @@ named-compilezone - zone file converting tool
Synopsis
~~~~~~~~
:program:`named-compilezone` [**-d**] [**-h**] [**-j**] [**-q**] [**-v**] [**-c** class] [**-f** format] [**-F** format] [**-J** filename] [**-i** mode] [**-k** mode] [**-m** mode] [**-M** mode] [**-n** mode] [**-l** ttl] [**-L** serial] [**-r** mode] [**-s** style] [**-S** mode] [**-t** directory] [**-T** mode] [**-w** directory] [**-D**] [**-W** mode] {**-o** filename} {zonename} {filename}
:program:`named-compilezone` [**-d**] [**-h**] [**-j**] [**-q**] [**-v**] [**-c** class] [**-C** mode] [**-f** format] [**-F** format] [**-J** filename] [**-i** mode] [**-k** mode] [**-m** mode] [**-M** mode] [**-n** mode] [**-l** ttl] [**-L** serial] [**-r** mode] [**-s** style] [**-S** mode] [**-t** directory] [**-T** mode] [**-w** directory] [**-D**] [**-W** mode] {**-o** filename} {zonename} {filename}
Description
~~~~~~~~~~~
@@ -70,6 +70,15 @@ Options
This option specifies the class of the zone. If not specified, ``IN`` is assumed.
.. option:: -C mode
This option controls check mode on zone files when loading.
Possible modes are ``check-svcb:fail`` and ``check-svcb:ignore``.
``check-svcb:fail`` turns on additional checks on ``_dns`` SVCB
records and ``check-svcb:ignore`` disables these checks. The
default is ``check-svcb:fail``.
.. option:: -i mode
This option performs post-load zone integrity checks. Possible modes are
@@ -220,5 +229,5 @@ and 0 otherwise.
See Also
~~~~~~~~
:iscman:`named(8) <named>`, :iscman:`named-checkconf(8) <named-checkconf>`, :iscman:`named-checkzone(8) <named-checkzone>`, `:rfc:`1035`,
:iscman:`named(8) <named>`, :iscman:`named-checkconf(8) <named-checkconf>`, :iscman:`named-checkzone(8) <named-checkzone>`, :rfc:`1035`,
BIND 9 Administrator Reference Manual.
+1 -25
View File
@@ -21,7 +21,6 @@
#include <isc/buffer.h>
#include <isc/file.h>
#include <isc/mem.h>
#include <isc/print.h>
#include <isc/result.h>
#include <isc/string.h>
@@ -34,29 +33,6 @@
#include "util.h"
/*%
* Convert algorithm type to string.
*/
const char *
alg_totext(dns_secalg_t alg) {
switch (alg) {
case DST_ALG_HMACMD5:
return ("hmac-md5");
case DST_ALG_HMACSHA1:
return ("hmac-sha1");
case DST_ALG_HMACSHA224:
return ("hmac-sha224");
case DST_ALG_HMACSHA256:
return ("hmac-sha256");
case DST_ALG_HMACSHA384:
return ("hmac-sha384");
case DST_ALG_HMACSHA512:
return ("hmac-sha512");
default:
return ("(unknown)");
}
}
/*%
* Convert string to algorithm type.
*/
@@ -175,7 +151,7 @@ void
write_key_file(const char *keyfile, const char *user, const char *keyname,
isc_buffer_t *secret, dns_secalg_t alg) {
isc_result_t result;
const char *algname = alg_totext(alg);
const char *algname = dst_hmac_algorithm_totext(alg);
FILE *fd = NULL;
DO("create keyfile", isc_file_safecreate(keyfile, &fd));
+1 -2
View File
@@ -34,7 +34,6 @@
#include <isc/file.h>
#include <isc/mem.h>
#include <isc/net.h>
#include <isc/print.h>
#include <isc/result.h>
#include <isc/string.h>
#include <isc/time.h>
@@ -222,7 +221,7 @@ main(int argc, char **argv) {
if (keysize < 0) {
keysize = alg_bits(alg);
}
algname = alg_totext(alg);
algname = dst_hmac_algorithm_totext(alg);
isc_mem_create(&mctx);
isc_buffer_init(&key_txtbuffer, &key_txtsecret, sizeof(key_txtsecret));
+3 -3
View File
@@ -30,7 +30,6 @@
#include <isc/file.h>
#include <isc/mem.h>
#include <isc/net.h>
#include <isc/print.h>
#include <isc/result.h>
#include <isc/string.h>
#include <isc/time.h>
@@ -127,7 +126,8 @@ main(int argc, char **argv) {
isc_commandline_errprint = false;
while ((ch = isc_commandline_parse(argc, argv, "a:hk:Mmr:qs:y:z:")) !=
-1) {
-1)
{
switch (ch) {
case 'a':
algname = isc_commandline_argument;
@@ -208,7 +208,7 @@ main(int argc, char **argv) {
}
/* Use canonical algorithm name */
algname = alg_totext(alg);
algname = dst_hmac_algorithm_totext(alg);
isc_mem_create(&mctx);
-2
View File
@@ -19,8 +19,6 @@
#include <stdio.h>
#include <stdlib.h>
#include <isc/print.h>
extern bool verbose;
extern const char *progname;
+3 -4
View File
@@ -4,8 +4,7 @@ AM_CPPFLAGS += \
-I$(top_builddir)/include \
$(LIBISC_CFLAGS) \
$(LIBDNS_CFLAGS) \
$(LIBISCCFG_CFLAGS) \
$(LIBIRS_CFLAGS)
$(LIBISCCFG_CFLAGS)
AM_CPPFLAGS += \
-DSYSCONFDIR=\"${sysconfdir}\"
@@ -14,8 +13,8 @@ bin_PROGRAMS = delv
delv_SOURCES = \
delv.c
delv_LDADD = \
$(LIBISC_LIBS) \
$(LIBDNS_LIBS) \
$(LIBISCCFG_LIBS) \
$(LIBIRS_LIBS)
$(LIBISCCFG_LIBS)
+42 -37
View File
@@ -35,12 +35,11 @@
#include <isc/mem.h>
#include <isc/netmgr.h>
#include <isc/parseint.h>
#include <isc/print.h>
#include <isc/result.h>
#include <isc/sockaddr.h>
#include <isc/string.h>
#include <isc/task.h>
#include <isc/timer.h>
#include <isc/tls.h>
#include <isc/util.h>
#include <dns/byaddr.h>
@@ -83,7 +82,9 @@ static isc_log_t *lctx = NULL;
/* Managers */
static isc_nm_t *netmgr = NULL;
static isc_loopmgr_t *loopmgr = NULL;
static isc_taskmgr_t *taskmgr = NULL;
/* TLS */
static isc_tlsctx_cache_t *tlsctx_client_cache = NULL;
/* Configurables */
static char *server = NULL;
@@ -121,7 +122,7 @@ static dns_name_t *anchor_name = NULL;
static dns_master_style_t *style = NULL;
static dns_fixedname_t qfn;
/* Default bind.keys contents */
/* Default trust anchors */
static char anchortext[] = TRUST_ANCHORS;
/*
@@ -464,7 +465,8 @@ printdata(dns_rdataset_t *rdataset, dns_name_t *owner) {
result = dns_rdataset_next(rdataset))
{
if ((rdataset->attributes &
DNS_RDATASETATTR_NEGATIVE) != 0) {
DNS_RDATASETATTR_NEGATIVE) != 0)
{
continue;
}
@@ -488,7 +490,8 @@ printdata(dns_rdataset_t *rdataset, dns_name_t *owner) {
} else {
dns_indent_t indent = { " ", 2 };
if (!yaml && (rdataset->attributes &
DNS_RDATASETATTR_NEGATIVE) != 0) {
DNS_RDATASETATTR_NEGATIVE) != 0)
{
isc_buffer_putstr(&target, "; ");
}
result = dns_master_rdatasettotext(
@@ -784,7 +787,8 @@ load_keys(const cfg_obj_t *keys, dns_client_t *client) {
keylist = cfg_listelt_value(elt);
for (elt2 = cfg_list_first(keylist); elt2 != NULL;
elt2 = cfg_list_next(elt2)) {
elt2 = cfg_list_next(elt2))
{
key = cfg_listelt_value(elt2);
CHECK(key_fromconfig(key, client));
}
@@ -805,16 +809,11 @@ setup_dnsseckeys(dns_client_t *client) {
const cfg_obj_t *managed_keys = NULL;
const cfg_obj_t *trust_anchors = NULL;
cfg_obj_t *bindkeys = NULL;
const char *filename = anchorfile;
if (!root_validation) {
return (ISC_R_SUCCESS);
}
if (filename == NULL) {
filename = SYSCONFDIR "/bind.keys";
}
if (trust_anchor == NULL) {
trust_anchor = isc_mem_strdup(mctx, ".");
}
@@ -825,22 +824,17 @@ setup_dnsseckeys(dns_client_t *client) {
CHECK(cfg_parser_create(mctx, dns_lctx, &parser));
if (access(filename, R_OK) != 0) {
if (anchorfile != NULL) {
if (anchorfile != NULL) {
if (access(anchorfile, R_OK) != 0) {
fatal("Unable to read key file '%s'", anchorfile);
}
} else {
result = cfg_parse_file(parser, filename, &cfg_type_bindkeys,
result = cfg_parse_file(parser, anchorfile, &cfg_type_bindkeys,
&bindkeys);
if (result != ISC_R_SUCCESS) {
if (anchorfile != NULL) {
fatal("Unable to load keys from '%s'",
anchorfile);
}
fatal("Unable to load keys from '%s'", anchorfile);
}
}
if (bindkeys == NULL) {
} else {
isc_buffer_t b;
isc_buffer_init(&b, anchortext, sizeof(anchortext) - 1);
@@ -943,14 +937,16 @@ addserver(dns_client_t *client) {
result = ISC_R_SUCCESS;
for (cur = res; cur != NULL; cur = cur->ai_next) {
if (cur->ai_family != AF_INET &&
cur->ai_family != AF_INET6) {
cur->ai_family != AF_INET6)
{
continue;
}
sa = isc_mem_get(mctx, sizeof(*sa));
memset(sa, 0, sizeof(*sa));
*sa = (isc_sockaddr_t){
.length = (unsigned int)cur->ai_addrlen,
};
ISC_LINK_INIT(sa, link);
memmove(&sa->type, cur->ai_addr, cur->ai_addrlen);
sa->length = (unsigned int)cur->ai_addrlen;
ISC_LIST_APPEND(servers, sa, link);
}
freeaddrinfo(res);
@@ -1443,7 +1439,8 @@ dash_option(char *option, char *next, bool *open_type_class) {
warn("extra query type");
}
if (rdtype == dns_rdatatype_ixfr ||
rdtype == dns_rdatatype_axfr) {
rdtype == dns_rdatatype_axfr)
{
fatal("Transfer not supported");
}
qtype = rdtype;
@@ -1522,7 +1519,8 @@ preparse_args(int argc, char **argv) {
/* Look for dash value option. */
if (strpbrk(option, dash_opts) != &option[0] ||
strlen(option) > 1U) {
strlen(option) > 1U)
{
/* Error or value in option. */
continue;
}
@@ -1560,13 +1558,15 @@ parse_args(int argc, char **argv) {
} else if (argv[0][0] == '-') {
if (argc <= 1) {
if (dash_option(&argv[0][1], NULL,
&open_type_class)) {
&open_type_class))
{
argc--;
argv++;
}
} else {
if (dash_option(&argv[0][1], argv[1],
&open_type_class)) {
&open_type_class))
{
argc--;
argv++;
}
@@ -1585,7 +1585,8 @@ parse_args(int argc, char **argv) {
warn("extra query type");
}
if (rdtype == dns_rdatatype_ixfr ||
rdtype == dns_rdatatype_axfr) {
rdtype == dns_rdatatype_axfr)
{
fatal("Transfer not supported");
}
qtype = rdtype;
@@ -1674,10 +1675,9 @@ get_reverse(char *reverse, size_t len, char *value, bool strict) {
/* This is a valid IPv6 address. */
dns_fixedname_t fname;
dns_name_t *name;
unsigned int options = 0;
name = dns_fixedname_initname(&fname);
result = dns_byaddr_createptrname(&addr, options, name);
result = dns_byaddr_createptrname(&addr, name);
if (result != ISC_R_SUCCESS) {
return (result);
}
@@ -1811,7 +1811,7 @@ main(int argc, char *argv[]) {
argc--;
argv++;
isc_managers_create(&mctx, 1, &loopmgr, &netmgr, &taskmgr);
isc_managers_create(&mctx, 1, &loopmgr, &netmgr);
result = dst_lib_init(mctx, NULL);
if (result != ISC_R_SUCCESS) {
@@ -1825,8 +1825,10 @@ main(int argc, char *argv[]) {
setup_logging(stderr);
/* Create client */
result = dns_client_create(mctx, loopmgr, taskmgr, netmgr, 0, &client,
srcaddr4, srcaddr6);
isc_tlsctx_cache_create(mctx, &tlsctx_client_cache);
result = dns_client_create(mctx, loopmgr, netmgr, 0,
tlsctx_client_cache, &client, srcaddr4,
srcaddr6);
if (result != ISC_R_SUCCESS) {
delv_log(ISC_LOG_ERROR, "dns_client_create: %s",
isc_result_totext(result));
@@ -1859,12 +1861,15 @@ cleanup:
if (style != NULL) {
dns_master_styledestroy(&style, mctx);
}
if (tlsctx_client_cache != NULL) {
isc_tlsctx_cache_detach(&tlsctx_client_cache);
}
isc_log_destroy(&lctx);
dst_lib_destroy();
isc_managers_destroy(&mctx, &loopmgr, &netmgr, &taskmgr);
isc_managers_destroy(&mctx, &loopmgr, &netmgr);
return (0);
}
+13 -14
View File
@@ -102,20 +102,21 @@ Options
.. option:: -a anchor-file
This option specifies a file from which to read DNSSEC trust anchors. The default
is |bind_keys|, which is included with BIND 9 and contains one
or more trust anchors for the root zone (".").
This option specifies a file from which to read an alternate
DNSSEC root zone trust anchor.
Keys that do not match the root zone name are ignored. An alternate
key name can be specified using the :option:`+root` option.
By default, keys that do not match the root zone name (`.`) are
ignored. If an alternate key name is desired, it can be
specified using the :option:`+root` option.
Note: When reading the trust anchor file, :program:`delv` treats ``trust-anchors``,
``initial-key``, and ``static-key`` identically. That is, for a managed key,
it is the *initial* key that is trusted; :rfc:`5011` key management is not
supported. :program:`delv` does not consult the managed-keys database maintained by
:iscman:`named`, which means that if either of the keys in |bind_keys| is
revoked and rolled over, |bind_keys| must be updated to
use DNSSEC validation in :program:`delv`.
Note: When reading trust anchors, :program:`delv` treats
``trust-anchors``, ``initial-key``, and ``static-key`` identically. That
is, for a managed key, it is the *initial* key that is trusted;
:rfc:`5011` key management is not supported. :program:`delv` does not
consult the managed-keys database maintained by :iscman:`named`. This
means that if the default key built in to :program:`delv` is revoked,
:program:`delv` must be updated to a newer version in order to continue
validating.
.. option:: -b address
@@ -354,8 +355,6 @@ assign values to options like the timeout interval. They have the form
Files
~~~~~
|bind_keys|
``/etc/resolv.conf``
See Also
+2 -5
View File
@@ -4,17 +4,14 @@ AM_CPPFLAGS += \
$(LIBISC_CFLAGS) \
$(LIBDNS_CFLAGS) \
$(LIBISCCFG_CFLAGS) \
$(LIBIRS_CFLAGS) \
$(LIBBIND9_CFLAGS) \
$(LIBIDN2_CFLAGS)
$(LIBIDN2_CFLAGS) \
$(LIBUV_CFLAGS)
LDADD += \
libdighost.la \
$(LIBISC_LIBS) \
$(LIBDNS_LIBS) \
$(LIBISCCFG_LIBS) \
$(LIBIRS_LIBS) \
$(LIBBIND9_LIBS) \
$(LIBIDN2_LIBS)
noinst_LTLIBRARIES = libdighost.la
+49 -40
View File
@@ -24,10 +24,8 @@
#include <isc/loop.h>
#include <isc/netaddr.h>
#include <isc/parseint.h>
#include <isc/print.h>
#include <isc/result.h>
#include <isc/string.h>
#include <isc/task.h>
#include <isc/time.h>
#include <isc/util.h>
@@ -206,9 +204,6 @@ help(void) {
"from ipv4only.arpa)\n"
" +[no]dnssec (Request DNSSEC records)\n"
" +domain=### (Set default domainname)\n"
" +[no]dscp[=###] (Set the DSCP value to "
"### "
"[0..63])\n"
" +[no]edns[=###] (Set EDNS version) [0]\n"
" +ednsflags=### (Set EDNS flag bits)\n"
" +[no]ednsnegotiation (Set EDNS version "
@@ -580,7 +575,7 @@ short_answer(dns_message_t *msg, dns_messagetextflag_t flags, isc_buffer_t *buf,
static bool
isdotlocal(dns_message_t *msg) {
isc_result_t result;
static unsigned char local_ndata[] = { "\005local\0" };
static unsigned char local_ndata[] = { "\005local" };
static unsigned char local_offsets[] = { 0, 6 };
static dns_name_t local = DNS_NAME_INITABSOLUTE(local_ndata,
local_offsets);
@@ -693,7 +688,8 @@ printmessage(dig_query_t *query, const isc_buffer_t *msgbuf, dns_message_t *msg,
flags |= DNS_MESSAGETEXTFLAG_NOCOMMENTS;
}
if (query->lookup->onesoa &&
query->lookup->rdtype == dns_rdatatype_axfr) {
query->lookup->rdtype == dns_rdatatype_axfr)
{
flags |= (query->msg_count == 0) ? DNS_MESSAGETEXTFLAG_ONESOA
: DNS_MESSAGETEXTFLAG_OMITSOA;
}
@@ -1390,22 +1386,6 @@ plus_option(char *option, bool is_batchfile, bool *need_clone,
}
strlcpy(domainopt, value, sizeof(domainopt));
break;
case 's': /* dscp */
FULLCHECK("dscp");
if (!state) {
lookup->dscp = -1;
break;
}
if (value == NULL) {
goto need_value;
}
result = parse_uint(&num, value, 0x3f, "DSCP");
if (result != ISC_R_SUCCESS) {
warn("Couldn't parse DSCP value");
goto exit_or_usage;
}
lookup->dscp = num;
break;
default:
goto invalid_option;
}
@@ -1522,8 +1502,31 @@ plus_option(char *option, bool is_batchfile, bool *need_clone,
}
break;
case 'f': /* fail */
FULLCHECK("fail");
lookup->servfail_stops = state;
switch (cmd[1]) {
case 'a':
FULLCHECK("fail");
lookup->servfail_stops = state;
break;
case 'u':
FULLCHECK("fuzztime");
lookup->fuzzing = state;
if (lookup->fuzzing) {
if (value == NULL) {
lookup->fuzztime = 0x622acce1;
break;
}
result = parse_uint(&num, value, 0xffffffff,
"fuzztime");
if (result != ISC_R_SUCCESS) {
warn("Couldn't parse fuzztime");
goto exit_or_usage;
}
lookup->fuzztime = num;
}
break;
default:
goto invalid_option;
}
break;
case 'h':
switch (cmd[1]) {
@@ -1771,7 +1774,8 @@ plus_option(char *option, bool is_batchfile, bool *need_clone,
}
for (num = 0;
num < sizeof(opcodetext) / sizeof(opcodetext[0]);
num++) {
num++)
{
if (strcasecmp(opcodetext[num], value) == 0) {
break;
}
@@ -1984,7 +1988,8 @@ plus_option(char *option, bool is_batchfile, bool *need_clone,
}
if (!state) {
if (lookup->ecs_addr != NULL) {
isc_mem_free(mctx, lookup->ecs_addr);
isc_mem_put(mctx, lookup->ecs_addr,
sizeof(*lookup->ecs_addr));
lookup->ecs_addr = NULL;
}
break;
@@ -1993,7 +1998,8 @@ plus_option(char *option, bool is_batchfile, bool *need_clone,
lookup->edns = DEFAULT_EDNS_VERSION;
}
if (lookup->ecs_addr != NULL) {
isc_mem_free(mctx, lookup->ecs_addr);
isc_mem_put(mctx, lookup->ecs_addr,
sizeof(*lookup->ecs_addr));
lookup->ecs_addr = NULL;
}
result = parse_netprefix(&lookup->ecs_addr, value);
@@ -2047,7 +2053,8 @@ plus_option(char *option, bool is_batchfile, bool *need_clone,
switch (cmd[2]) {
case 's':
if (!plus_tls_options(cmd, value, state,
lookup)) {
lookup))
{
goto invalid_option;
}
break;
@@ -2187,6 +2194,7 @@ plus_option(char *option, bool is_batchfile, bool *need_clone,
#if !TARGET_OS_IPHONE
exit_or_usage:
cleanup_openssl_refs();
digexit();
#endif /* if !TARGET_OS_IPHONE */
}
@@ -2388,7 +2396,8 @@ dash_option(char *option, char *next, dig_lookup_t **lookup,
result = dns_rdatatype_fromtext(
&rdtype, (isc_textregion_t *)&tr);
if (result == ISC_R_SUCCESS &&
rdtype == dns_rdatatype_ixfr) {
rdtype == dns_rdatatype_ixfr)
{
result = DNS_R_UNKNOWN;
}
}
@@ -2461,7 +2470,8 @@ dash_option(char *option, char *next, dig_lookup_t **lookup,
}
*need_clone = true;
if (get_reverse(textname, sizeof(textname), value, false) ==
ISC_R_SUCCESS) {
ISC_R_SUCCESS)
{
strlcpy((*lookup)->textname, textname,
sizeof((*lookup)->textname));
debug("looking up %s", (*lookup)->textname);
@@ -2643,7 +2653,8 @@ parse_args(bool is_batchfile, bool config_only, int argc, char **argv) {
}
if (batchfp != NULL) {
while (fgets(batchline, sizeof(batchline), batchfp) !=
0) {
0)
{
debug("config line %s", batchline);
bargc = split_batchline(batchline, bargv, 62,
".digrc argv");
@@ -2735,7 +2746,8 @@ parse_args(bool is_batchfile, bool config_only, int argc, char **argv) {
&rdtype,
(isc_textregion_t *)&tr);
if (result == ISC_R_SUCCESS &&
rdtype == dns_rdatatype_ixfr) {
rdtype == dns_rdatatype_ixfr)
{
fprintf(stderr, ";; Warning, "
"ixfr requires "
"a "
@@ -2775,7 +2787,8 @@ parse_args(bool is_batchfile, bool config_only, int argc, char **argv) {
lookup->rdtype = rdtype;
lookup->rdtypeset = true;
if (rdtype ==
dns_rdatatype_axfr) {
dns_rdatatype_axfr)
{
lookup->section_question =
plusquest;
lookup->comments =
@@ -2783,7 +2796,8 @@ parse_args(bool is_batchfile, bool config_only, int argc, char **argv) {
}
if (rdtype ==
dns_rdatatype_any &&
!lookup->tcp_mode_set) {
!lookup->tcp_mode_set)
{
lookup->tcp_mode = true;
}
lookup->ixfr_serial = false;
@@ -3030,11 +3044,6 @@ dig_startup(void) {
isc_loopmgr_run(loopmgr);
}
void
dig_query_start(void) {
start_lookup();
}
void
dig_shutdown(void) {
destroy_lookup(default_lookup);
+22 -17
View File
@@ -132,12 +132,14 @@ Options
.. option:: -k keyfile
This option tells :iscman:`named` to sign queries using TSIG using a key read from the given file. Key
files can be generated using :iscman:`tsig-keygen`. When using TSIG
authentication with :program:`dig`, the name server that is queried needs to
know the key and algorithm that is being used. In BIND, this is done
by providing appropriate ``key`` and ``server`` statements in
:iscman:`named.conf`.
This option tells :program:`dig` to sign queries using TSIG or
SIG(0) using a key read from the given file. Key files can be
generated using :iscman:`tsig-keygen`. When using TSIG authentication
with :program:`dig`, the name server that is queried needs to
know the key and algorithm that is being used. In BIND, this is
done by providing appropriate ``key`` and ``server`` statements
in :iscman:`named.conf` for TSIG and by looking up the KEY record
in zone data for SIG(0).
.. option:: -m
@@ -345,12 +347,6 @@ abbreviation is unambiguous; for example, :option:`+cd` is equivalent to
enables search list processing as if the :option:`+search` option were
given.
.. option:: +dscp=value
This option sets the DSCP code point to be used when sending the query. Valid DSCP
code points are in the range [0...63]. By default no code point is
explicitly set.
.. option:: +edns[=#], +noedns
This option specifies the EDNS version to query with. Valid values are 0 to 255.
@@ -386,6 +382,14 @@ abbreviation is unambiguous; for example, :option:`+cd` is equivalent to
to not try the next server, which is the reverse of normal stub
resolver behavior.
.. option:: +fuzztime[=value], +nofuzztime
This option allows the signing time to be specified when generating
signed messages. If a value is specified it is the seconds since
00:00:00 January 1, 1970 UTC ignoring leap seconds. If no value
is specified 1646972129 (Fri 11 Mar 2022 04:15:29 UTC) is used.
The default is ``+nofuzztime`` and the current time is used.
.. option:: +header-only, +noheader-only
This option sends a query with a DNS header without a question section. The
@@ -608,10 +612,11 @@ abbreviation is unambiguous; for example, :option:`+cd` is equivalent to
.. option:: +tcp, +notcp
This option indicates whether to use TCP when querying name servers.
The default behavior is to use UDP unless a type ``any`` or ``ixfr=N``
query is requested, in which case the default is TCP. AXFR queries
always use TCP.
This option indicates whether to use TCP when querying name
servers. The default behavior is to use UDP unless a type ``any``
or ``ixfr=N`` query is requested, in which case the default is
TCP. AXFR queries always use TCP. To prevent retry over TCP when
TC=1 is returned from a UDP query, use ``+ignore``.
.. option:: +timeout=T
@@ -737,7 +742,7 @@ shows how :program:`dig` can be used from the command line to make three
lookups: an ANY query for ``www.isc.org``, a reverse lookup of 127.0.0.1,
and a query for the NS records of ``isc.org``. A global query option of
:option:`+qr` is applied, so that :program:`dig` shows the initial query it made for
each lookup. The final query has a local query option of :option:`+qr` which
each lookup. The final query has a local query option of :option:`+noqr` which
means that :program:`dig` does not print the initial query when it looks up the
NS records for ``isc.org``.
+131 -85
View File
@@ -25,6 +25,7 @@
#include <inttypes.h>
#include <limits.h>
#include <locale.h>
#include <netdb.h>
#include <stdbool.h>
#include <stdlib.h>
#include <string.h>
@@ -36,26 +37,27 @@
#include <isc/base64.h>
#include <isc/file.h>
#include <isc/getaddresses.h>
#include <isc/hex.h>
#include <isc/lang.h>
#include <isc/log.h>
#include <isc/loop.h>
#include <isc/managers.h>
#include <isc/netaddr.h>
#include <isc/netdb.h>
#include <isc/nonce.h>
#include <isc/parseint.h>
#include <isc/print.h>
#include <isc/random.h>
#include <isc/result.h>
#include <isc/safe.h>
#include <isc/serial.h>
#include <isc/sockaddr.h>
#include <isc/string.h>
#include <isc/task.h>
#include <isc/timer.h>
#include <isc/tls.h>
#include <isc/types.h>
#include <isc/util.h>
#include <isc/uv.h>
#include <isc/xml.h>
#include <dns/byaddr.h>
#include <dns/fixedname.h>
@@ -78,8 +80,6 @@
#include <irs/resconf.h>
#include <bind9/getaddresses.h>
#include "dighost.h"
#define systemlocale(l) (void)setlocale(l, "")
@@ -102,7 +102,6 @@ unsigned int extrabytes;
isc_mem_t *mctx = NULL;
isc_log_t *lctx = NULL;
isc_nm_t *netmgr = NULL;
isc_taskmgr_t *taskmgr = NULL;
isc_loopmgr_t *loopmgr = NULL;
isc_loop_t *mainloop = NULL;
isc_sockaddr_t localaddr;
@@ -143,6 +142,7 @@ const dns_name_t *hmacname = NULL;
unsigned int digestbits = 0;
isc_buffer_t *namebuf = NULL;
dns_tsigkey_t *tsigkey = NULL;
dst_key_t *sig0key = NULL;
bool validated = true;
bool debugging = false;
bool debugtiming = false;
@@ -324,10 +324,9 @@ get_reverse(char *reverse, size_t len, char *value, bool strict) {
/* This is a valid IPv6 address. */
dns_fixedname_t fname;
dns_name_t *name;
unsigned int options = 0;
name = dns_fixedname_initname(&fname);
result = dns_byaddr_createptrname(&addr, options, name);
result = dns_byaddr_createptrname(&addr, name);
if (result != ISC_R_SUCCESS) {
return (result);
}
@@ -474,7 +473,8 @@ get_server_list(irs_resconf_t *resconf) {
debug("get_server_list()");
servers = irs_resconf_getnameservers(resconf);
for (sa = ISC_LIST_HEAD(*servers); sa != NULL;
sa = ISC_LIST_NEXT(sa, link)) {
sa = ISC_LIST_NEXT(sa, link))
{
int pf = isc_sockaddr_pf(sa);
isc_netaddr_t na;
isc_result_t result;
@@ -533,8 +533,7 @@ set_nameserver(char *opt) {
}
isc_loopmgr_blocking(loopmgr);
result = bind9_getaddresses(opt, 0, sockaddrs, DIG_MAX_ADDRESSES,
&count);
result = isc_getaddresses(opt, 0, sockaddrs, DIG_MAX_ADDRESSES, &count);
isc_loopmgr_nonblocking(loopmgr);
if (result != ISC_R_SUCCESS) {
fatal("couldn't get address for '%s': %s", opt,
@@ -617,7 +616,6 @@ make_empty_lookup(void) {
.section_authority = true,
.section_additional = true,
.ednsneg = true,
.dscp = -1,
};
dns_fixedname_init(&looknew->fdomain);
@@ -625,7 +623,7 @@ make_empty_lookup(void) {
ISC_LIST_INIT(looknew->q);
ISC_LIST_INIT(looknew->my_server_list);
looknew->tls_ctx_cache = isc_tlsctx_cache_new(mctx);
isc_tlsctx_cache_create(mctx, &looknew->tls_ctx_cache);
isc_refcount_init(&looknew->references, 1);
@@ -792,13 +790,15 @@ clone_lookup(dig_lookup_t *lookold, bool servers) {
looknew->tsigctx = NULL;
looknew->need_search = lookold->need_search;
looknew->done_as_is = lookold->done_as_is;
looknew->dscp = lookold->dscp;
looknew->rrcomments = lookold->rrcomments;
looknew->fuzzing = lookold->fuzzing;
looknew->fuzztime = lookold->fuzztime;
if (lookold->ecs_addr != NULL) {
size_t len = sizeof(isc_sockaddr_t);
looknew->ecs_addr = isc_mem_allocate(mctx, len);
memmove(looknew->ecs_addr, lookold->ecs_addr, len);
looknew->ecs_addr = isc_mem_get(mctx,
sizeof(*looknew->ecs_addr));
memmove(looknew->ecs_addr, lookold->ecs_addr,
sizeof(*looknew->ecs_addr));
}
dns_name_copy(dns_fixedname_name(&lookold->fdomain),
@@ -957,8 +957,8 @@ parse_netprefix(isc_sockaddr_t **sap, const char *value) {
fatal("invalid prefix '%s'\n", value);
}
sa = isc_mem_allocate(mctx, sizeof(*sa));
memset(sa, 0, sizeof(*sa));
sa = isc_mem_get(mctx, sizeof(*sa));
*sa = (isc_sockaddr_t){ .length = 0 };
if (strcmp(buf, "0") == 0) {
sa->type.sa.sa_family = AF_UNSPEC;
@@ -1141,6 +1141,10 @@ setup_file_key(void) {
debug("setup_file_key()");
if (sig0key != NULL) {
dst_key_free(&sig0key);
}
/* Try reading the key from a K* pair */
result = dst_key_fromnamedfile(
keyfile, NULL, DST_TYPE_PRIVATE | DST_TYPE_KEY, mctx, &dstkey);
@@ -1178,18 +1182,20 @@ setup_file_key(void) {
case DST_ALG_HMACSHA512:
hmacname = DNS_TSIG_HMACSHA512_NAME;
break;
default:
printf(";; Couldn't create key %s: bad algorithm\n",
keynametext);
goto failure;
}
result = dns_tsigkey_createfromkey(dst_key_name(dstkey), hmacname,
dstkey, false, NULL, 0, 0, mctx,
NULL, &tsigkey);
if (result != ISC_R_SUCCESS) {
printf(";; Couldn't create key %s: %s\n", keynametext,
isc_result_totext(result));
goto failure;
if (hmacname != NULL) {
result = dns_tsigkey_createfromkey(
dst_key_name(dstkey), hmacname, dstkey, false, NULL, 0,
0, mctx, NULL, &tsigkey);
if (result != ISC_R_SUCCESS) {
printf(";; Couldn't create key %s: %s\n", keynametext,
isc_result_totext(result));
goto failure;
}
} else {
dst_key_attach(dstkey, &sig0key);
dst_key_free(&dstkey);
}
failure:
if (dstkey != NULL) {
@@ -1359,7 +1365,7 @@ setup_libs(void) {
fatal("can't find either v4 or v6 networking");
}
isc_managers_create(&mctx, 1, &loopmgr, &netmgr, &taskmgr);
isc_managers_create(&mctx, 1, &loopmgr, &netmgr);
isc_log_create(mctx, &lctx, &logconfig);
isc_log_setcontext(lctx);
@@ -1593,7 +1599,7 @@ _destroy_lookup(dig_lookup_t *lookup) {
}
if (lookup->ecs_addr != NULL) {
isc_mem_free(mctx, lookup->ecs_addr);
isc_mem_put(mctx, lookup->ecs_addr, sizeof(*lookup->ecs_addr));
}
if (lookup->ednsopts != NULL) {
@@ -1906,7 +1912,8 @@ followup_lookup(dns_message_t *msg, dig_query_t *query, dns_section_t section) {
dns_rdata_ns_t ns;
if (query->lookup->trace_root &&
query->lookup->nsfound >= MXSERV) {
query->lookup->nsfound >= MXSERV)
{
break;
}
@@ -1927,7 +1934,8 @@ followup_lookup(dns_message_t *msg, dig_query_t *query, dns_section_t section) {
cancel_lookup(query->lookup);
lookup->doing_xfr = false;
if (!lookup->trace_root &&
section == DNS_SECTION_ANSWER) {
section == DNS_SECTION_ANSWER)
{
lookup->trace = false;
} else {
lookup->trace = query->lookup->trace;
@@ -2322,6 +2330,7 @@ setup_lookup(dig_lookup_t *lookup) {
clear_current_lookup();
return (false);
#else /* if TARGET_OS_IPHONE */
cleanup_openssl_refs();
digexit();
#endif /* if TARGET_OS_IPHONE */
}
@@ -2425,12 +2434,20 @@ setup_lookup(dig_lookup_t *lookup) {
debug("initializing keys");
result = dns_message_settsigkey(lookup->sendmsg, tsigkey);
check_result(result, "dns_message_settsigkey");
} else if (sig0key != NULL) {
debug("initializing keys");
result = dns_message_setsig0key(lookup->sendmsg, sig0key);
check_result(result, "dns_message_setsig0key");
}
if (lookup->fuzzing) {
lookup->sendmsg->fuzzing = true;
lookup->sendmsg->fuzztime = lookup->fuzztime;
}
lookup->sendspace = isc_mem_get(mctx, COMMSIZE);
result = dns_compress_init(&cctx, mctx);
check_result(result, "dns_compress_init");
dns_compress_init(&cctx, mctx, 0);
debug("starting to render the message");
isc_buffer_init(&lookup->renderbuf, lookup->sendspace, COMMSIZE);
@@ -2542,7 +2559,8 @@ setup_lookup(dig_lookup_t *lookup) {
addr[addrl - 1] &= ~0U
<< (8 - (plen % 8));
}
isc_buffer_putmem(&b, addr, (unsigned)addrl);
isc_buffer_putmem(&b, addr,
(unsigned int)addrl);
}
opts[i].value = (uint8_t *)ecsbuf;
@@ -2758,7 +2776,8 @@ _cancel_lookup(dig_lookup_t *lookup, const char *file, unsigned int line) {
query->lookup);
query->canceled = true;
if (query->readhandle != NULL &&
!isc_nm_is_http_handle(query->readhandle)) {
!isc_nm_is_http_handle(query->readhandle))
{
isc_nm_cancelread(query->readhandle);
}
query_detach(&query);
@@ -2834,7 +2853,8 @@ get_create_tls_context(dig_query_t *query, const bool is_https,
}
if (query->lookup->tls_key_file_set &&
query->lookup->tls_cert_file_set) {
query->lookup->tls_cert_file_set)
{
result = isc_tlsctx_load_certificate(
ctx, query->lookup->tls_key_file,
query->lookup->tls_cert_file);
@@ -2853,9 +2873,9 @@ get_create_tls_context(dig_query_t *query, const bool is_https,
}
#endif /* HAVE_LIBNGHTTP2 */
sess_cache = isc_tlsctx_client_session_cache_new(
mctx, ctx,
ISC_TLSCTX_CLIENT_SESSION_CACHE_DEFAULT_SIZE);
isc_tlsctx_client_session_cache_create(
mctx, ctx, ISC_TLSCTX_CLIENT_SESSION_CACHE_DEFAULT_SIZE,
&sess_cache);
result = isc_tlsctx_cache_add(
query->lookup->tls_ctx_cache, tlsctxname, transport,
@@ -2926,7 +2946,8 @@ start_tcp(dig_query_t *query) {
if (tls_mode) {
port = 853;
} else if (query->lookup->https_mode &&
!query->lookup->http_plain) {
!query->lookup->http_plain)
{
port = 443;
} else if (query->lookup->https_mode) {
port = 80;
@@ -3009,9 +3030,9 @@ start_tcp(dig_query_t *query) {
if (tlsctx == NULL) {
goto failure_tls;
}
isc_nm_tlsdnsconnect(netmgr, &localaddr, &query->sockaddr,
tcp_connected, connectquery, local_timeout,
tlsctx, sess_cache);
isc_nm_streamdnsconnect(netmgr, &localaddr, &query->sockaddr,
tcp_connected, connectquery,
local_timeout, tlsctx, sess_cache);
#if HAVE_LIBNGHTTP2
} else if (query->lookup->https_mode) {
char uri[4096] = { 0 };
@@ -3034,13 +3055,11 @@ start_tcp(dig_query_t *query) {
local_timeout);
#endif
} else {
isc_nm_tcpdnsconnect(netmgr, &localaddr, &query->sockaddr,
tcp_connected, connectquery,
local_timeout);
isc_nm_streamdnsconnect(netmgr, &localaddr, &query->sockaddr,
tcp_connected, connectquery,
local_timeout, NULL, NULL);
}
/* XXX: set DSCP */
return;
failure_tls:
@@ -3426,20 +3445,22 @@ launch_next_query(dig_query_t *query) {
xfr = query->lookup->rdtype == dns_rdatatype_ixfr ||
query->lookup->rdtype == dns_rdatatype_axfr;
if (xfr && isc_nm_socket_type(query->handle) == isc_nm_tlsdnssocket &&
!isc_nm_xfr_allowed(query->handle))
if (xfr &&
isc_nm_socket_type(query->handle) == isc_nm_streamdnssocket &&
query->lookup->tls_mode)
{
dighost_error("zone transfers over the "
"established TLS connection are not allowed");
dighost_error("as the "
"connection does not meet the requirements "
"enforced by the RFC 9103");
isc_refcount_decrement0(&recvcount);
isc_nmhandle_detach(&query->readhandle);
cancel_lookup(l);
lookup_detach(&l);
clear_current_lookup();
return;
isc_result_t result = isc_nm_xfr_checkperm(query->handle);
if (result != ISC_R_SUCCESS) {
dighost_error("zone transfers over the established TLS "
"connection are not allowed: %s",
isc_result_totext(result));
isc_refcount_decrement0(&recvcount);
isc_nmhandle_detach(&query->readhandle);
cancel_lookup(l);
lookup_detach(&l);
clear_current_lookup();
return;
}
}
query_attach(query, &readquery);
@@ -3671,13 +3692,15 @@ check_for_more_data(dig_lookup_t *lookup, dig_query_t *query,
* it's an SOA
*/
if ((!query->first_soa_rcvd) &&
(rdata.type != dns_rdatatype_soa)) {
(rdata.type != dns_rdatatype_soa))
{
puts("; Transfer failed. "
"Didn't start with SOA answer.");
return (true);
}
if ((!query->second_rr_rcvd) &&
(rdata.type != dns_rdatatype_soa)) {
(rdata.type != dns_rdatatype_soa))
{
query->second_rr_rcvd = true;
query->second_rr_serial = 0;
debug("got the second rr as nonsoa");
@@ -4243,7 +4266,8 @@ recv_done(isc_nmhandle_t *handle, isc_result_t eresult, isc_region_t *region,
}
if ((msg->flags & DNS_MESSAGEFLAG_TC) != 0 && !l->ignore &&
!l->tcp_mode) {
!l->tcp_mode)
{
if (l->cookie == NULL && l->sendcookie && msg->opt != NULL) {
process_opt(l, msg);
}
@@ -4375,7 +4399,8 @@ recv_done(isc_nmhandle_t *handle, isc_result_t eresult, isc_region_t *region,
if (!l->doing_xfr || l->xfr_q == query) {
if (msg->rcode == dns_rcode_nxdomain &&
(l->origin != NULL || l->need_search)) {
(l->origin != NULL || l->need_search))
{
if (!next_origin(l) || showsearch) {
dighost_printmessage(query, &b, msg, true);
dighost_received(isc_buffer_usedlength(&b),
@@ -4501,7 +4526,7 @@ get_address(char *host, in_port_t myport, isc_sockaddr_t *sockaddr) {
isc_result_t result;
isc_loopmgr_blocking(loopmgr);
result = bind9_getaddresses(host, myport, sockaddr, 1, &count);
result = isc_getaddresses(host, myport, sockaddr, 1, &count);
isc_loopmgr_nonblocking(loopmgr);
if (result != ISC_R_SUCCESS) {
return (result);
@@ -4522,8 +4547,8 @@ getaddresses(dig_lookup_t *lookup, const char *host, isc_result_t *resultp) {
char tmp[ISC_NETADDR_FORMATSIZE];
isc_loopmgr_blocking(loopmgr);
result = bind9_getaddresses(host, 0, sockaddrs, DIG_MAX_ADDRESSES,
&count);
result = isc_getaddresses(host, 0, sockaddrs, DIG_MAX_ADDRESSES,
&count);
isc_loopmgr_nonblocking(loopmgr);
if (resultp != NULL) {
*resultp = result;
@@ -4609,7 +4634,8 @@ cancel_all(void) {
current_lookup);
q->canceled = true;
if (q->readhandle != NULL &&
!isc_nm_is_http_handle(q->readhandle)) {
!isc_nm_is_http_handle(q->readhandle))
{
isc_nm_cancelread(q->readhandle);
}
query_detach(&q);
@@ -4631,6 +4657,25 @@ cancel_all(void) {
}
}
void
cleanup_openssl_refs(void) {
if (tsigkey != NULL) {
debug("freeing TSIG key %p", tsigkey);
dns_tsigkey_detach(&tsigkey);
}
if (sig0key != NULL) {
debug("freeing SIG(0) key %p", sig0key);
dst_key_free(&sig0key);
}
if (is_dst_up) {
debug("destroy DST lib");
dst_lib_destroy();
is_dst_up = false;
}
}
/*%
* Destroy all of the libs we are using, and get everything ready for a
* clean shutdown.
@@ -4652,18 +4697,11 @@ destroy_libs(void) {
clear_searchlist();
if (tsigkey != NULL) {
debug("freeing key %p", tsigkey);
dns_tsigkey_detach(&tsigkey);
}
if (namebuf != NULL) {
isc_buffer_free(&namebuf);
}
cleanup_openssl_refs();
if (is_dst_up) {
debug("destroy DST lib");
dst_lib_destroy();
is_dst_up = false;
if (namebuf != NULL) {
debug("freeing key %p", tsigkey);
isc_buffer_free(&namebuf);
}
debug("Removing log context");
@@ -4674,13 +4712,21 @@ destroy_libs(void) {
isc_mem_stats(mctx, stderr);
}
isc_managers_destroy(&mctx, &loopmgr, &netmgr, &taskmgr);
isc_managers_destroy(&mctx, &loopmgr, &netmgr);
#if ENABLE_LEAK_DETECTION
isc__tls_setdestroycheck(true);
isc__uv_setdestroycheck(true);
isc__xml_setdestroycheck(true);
#endif
isc_mem_checkdestroyed(stderr);
}
#ifdef HAVE_LIBIDN2
static isc_result_t
idn_filter(isc_buffer_t *buffer, unsigned start) {
idn_filter(isc_buffer_t *buffer, unsigned int start) {
char src[MXNAME];
char *dst = NULL;
size_t srclen, dstlen;
+9 -13
View File
@@ -27,7 +27,6 @@
#include <isc/magic.h>
#include <isc/mem.h>
#include <isc/netmgr.h>
#include <isc/print.h>
#include <isc/refcount.h>
#include <isc/sockaddr.h>
#include <isc/time.h>
@@ -108,10 +107,11 @@ struct dig_lookup {
isc_refcount_t references;
bool aaonly, adflag, badcookie, besteffort, cdflag, cleared, comments,
dns64prefix, dnssec, doing_xfr, done_as_is, ednsneg, expandaaaa,
expire, header_only, identify, /*%< Append an "on server <foo>"
message */
identify_previous_line, /*% Prepend a "Nameserver <foo>:"
message, with newline and tab */
expire, fuzzing, header_only, identify, /*%< Append an "on
server <foo>" message
*/
identify_previous_line, /*% Prepend a "Nameserver <foo>:"
message, with newline and tab */
idnin, idnout, ignore, multiline, need_search, new_search,
noclass, nocrypto, nottl, ns_search_only, /*%< dig +nssearch,
host -C */
@@ -166,7 +166,6 @@ struct dig_lookup {
char *cookie;
dns_ednsopt_t *ednsopts;
unsigned int ednsoptscnt;
isc_dscp_t dscp;
unsigned int ednsflags;
dns_opcode_t opcode;
int rrcomments;
@@ -188,6 +187,7 @@ struct dig_lookup {
char *tls_key_file;
isc_tlsctx_cache_t *tls_ctx_cache;
};
isc_stdtime_t fuzztime;
};
/*% The dig_query structure */
@@ -263,7 +263,6 @@ extern const dns_name_t *hmacname;
extern unsigned int digestbits;
extern dns_tsigkey_t *tsigkey;
extern bool validated;
extern isc_taskmgr_t *taskmgr;
extern isc_loopmgr_t *loopmgr;
extern isc_loop_t *mainloop;
extern bool free_now;
@@ -296,6 +295,9 @@ warn(const char *format, ...) ISC_FORMAT_PRINTF(1, 2);
noreturn void
digexit(void);
void
cleanup_openssl_refs(void);
void
debug(const char *format, ...) ISC_FORMAT_PRINTF(1, 2);
@@ -443,12 +445,6 @@ dig_query_setup(bool, bool, int argc, char **argv);
void
dig_startup(void);
/*%
* Initiates the next lookup cycle
*/
void
dig_query_start(void);
/*%
* Activate/deactivate IDN filtering of output.
*/
+15 -9
View File
@@ -23,9 +23,7 @@
#include <isc/commandline.h>
#include <isc/loop.h>
#include <isc/netaddr.h>
#include <isc/print.h>
#include <isc/string.h>
#include <isc/task.h>
#include <isc/util.h>
#include <dns/byaddr.h>
@@ -533,7 +531,8 @@ printmessage(dig_query_t *query, const isc_buffer_t *msgbuf, dns_message_t *msg,
}
if (!ISC_LIST_EMPTY(msg->sections[DNS_SECTION_AUTHORITY]) &&
!short_form) {
!short_form)
{
printf("\n");
result = printsection(msg, DNS_SECTION_AUTHORITY, "AUTHORITY",
true, query);
@@ -542,7 +541,8 @@ printmessage(dig_query_t *query, const isc_buffer_t *msgbuf, dns_message_t *msg,
}
}
if (!ISC_LIST_EMPTY(msg->sections[DNS_SECTION_ADDITIONAL]) &&
!short_form) {
!short_form)
{
printf("\n");
result = printsection(msg, DNS_SECTION_ADDITIONAL, "ADDITIONAL",
true, query);
@@ -590,10 +590,12 @@ pre_parse_args(int argc, char **argv) {
{
isc_mem_debugging |= ISC_MEM_DEBUGTRACE;
} else if (strcasecmp("record",
isc_commandline_argument) == 0) {
isc_commandline_argument) == 0)
{
isc_mem_debugging |= ISC_MEM_DEBUGRECORD;
} else if (strcasecmp("usage",
isc_commandline_argument) == 0) {
isc_commandline_argument) == 0)
{
isc_mem_debugging |= ISC_MEM_DEBUGUSAGE;
}
break;
@@ -704,7 +706,8 @@ parse_args(bool is_batchfile, int argc, char **argv) {
break;
case 't':
if (strncasecmp(isc_commandline_argument, "ixfr=", 5) ==
0) {
0)
{
rdtype = dns_rdatatype_ixfr;
/* XXXMPA add error checking */
serial = strtoul(isc_commandline_argument + 5,
@@ -723,7 +726,8 @@ parse_args(bool is_batchfile, int argc, char **argv) {
isc_commandline_argument);
}
if (!lookup->rdtypeset ||
lookup->rdtype != dns_rdatatype_axfr) {
lookup->rdtype != dns_rdatatype_axfr)
{
lookup->rdtype = rdtype;
}
lookup->rdtypeset = true;
@@ -767,7 +771,8 @@ parse_args(bool is_batchfile, int argc, char **argv) {
FALLTHROUGH;
case 'a':
if (!lookup->rdtypeset ||
lookup->rdtype != dns_rdatatype_axfr) {
lookup->rdtype != dns_rdatatype_axfr)
{
lookup->rdtype = dns_rdatatype_any;
}
list_type = dns_rdatatype_any;
@@ -841,6 +846,7 @@ parse_args(bool is_batchfile, int argc, char **argv) {
break;
case 'p':
port = atoi(isc_commandline_argument);
port_set = true;
break;
}
}
+1 -3
View File
@@ -20,14 +20,11 @@
#include <isc/buffer.h>
#include <isc/commandline.h>
#include <isc/condition.h>
#include <isc/event.h>
#include <isc/job.h>
#include <isc/loop.h>
#include <isc/netaddr.h>
#include <isc/parseint.h>
#include <isc/print.h>
#include <isc/string.h>
#include <isc/task.h>
#include <isc/util.h>
#include <isc/work.h>
@@ -569,6 +566,7 @@ set_port(const char *value) {
isc_result_t result = parse_uint(&n, value, 65535, "port");
if (result == ISC_R_SUCCESS) {
port = (uint16_t)n;
port_set = true;
}
}
+110 -67
View File
@@ -30,7 +30,6 @@
#include <isc/file.h>
#include <isc/hash.h>
#include <isc/mem.h>
#include <isc/print.h>
#include <isc/result.h>
#include <isc/serial.h>
#include <isc/string.h>
@@ -125,15 +124,29 @@ typedef isc_result_t
ds_maker_func_t(isc_buffer_t *buf, dns_rdata_t *ds, dns_dsdigest_t dt,
dns_rdata_t *crdata);
static dns_rdataset_t cdnskey_set, cdnskey_sig;
static dns_rdataset_t cds_set, cds_sig;
static dns_rdataset_t dnskey_set, dnskey_sig;
static dns_rdataset_t old_ds_set, new_ds_set;
static dns_rdataset_t cdnskey_set = DNS_RDATASET_INIT;
static dns_rdataset_t cdnskey_sig = DNS_RDATASET_INIT;
static dns_rdataset_t cds_set = DNS_RDATASET_INIT;
static dns_rdataset_t cds_sig = DNS_RDATASET_INIT;
static dns_rdataset_t dnskey_set = DNS_RDATASET_INIT;
static dns_rdataset_t dnskey_sig = DNS_RDATASET_INIT;
static dns_rdataset_t old_ds_set = DNS_RDATASET_INIT;
static dns_rdataset_t new_ds_set = DNS_RDATASET_INIT;
static keyinfo_t *old_key_tbl, *new_key_tbl;
static keyinfo_t *old_key_tbl = NULL, *new_key_tbl = NULL;
isc_buffer_t *new_ds_buf = NULL; /* backing store for new_ds_set */
static dns_db_t *child_db = NULL;
static dns_dbnode_t *child_node = NULL;
static dns_db_t *parent_db = NULL;
static dns_dbnode_t *parent_node = NULL;
static dns_db_t *update_db = NULL;
static dns_dbnode_t *update_node = NULL;
static dns_dbversion_t *update_version = NULL;
static bool cleanup_dst = false;
static bool print_mem_stats = false;
static void
verbose_time(int level, const char *msg, isc_stdtime_t time) {
isc_result_t result;
@@ -251,21 +264,27 @@ load_db(const char *filename, dns_db_t **dbp, dns_dbnode_t **nodep) {
}
static void
free_db(dns_db_t **dbp, dns_dbnode_t **nodep) {
dns_db_detachnode(*dbp, nodep);
dns_db_detach(dbp);
free_db(dns_db_t **dbp, dns_dbnode_t **nodep, dns_dbversion_t **versionp) {
if (*dbp != NULL) {
if (*nodep != NULL) {
dns_db_detachnode(*dbp, nodep);
}
if (versionp != NULL && *versionp != NULL) {
dns_db_closeversion(*dbp, versionp, false);
}
dns_db_detach(dbp);
}
}
static void
load_child_sets(const char *file) {
dns_db_t *db = NULL;
dns_dbnode_t *node = NULL;
load_db(file, &db, &node);
findset(db, node, dns_rdatatype_dnskey, &dnskey_set, &dnskey_sig);
findset(db, node, dns_rdatatype_cdnskey, &cdnskey_set, &cdnskey_sig);
findset(db, node, dns_rdatatype_cds, &cds_set, &cds_sig);
free_db(&db, &node);
load_db(file, &child_db, &child_node);
findset(child_db, child_node, dns_rdatatype_dnskey, &dnskey_set,
&dnskey_sig);
findset(child_db, child_node, dns_rdatatype_cdnskey, &cdnskey_set,
&cdnskey_sig);
findset(child_db, child_node, dns_rdatatype_cds, &cds_set, &cds_sig);
free_db(&child_db, &child_node, NULL);
}
static void
@@ -314,8 +333,6 @@ get_dsset_name(char *filename, size_t size, const char *path,
static void
load_parent_set(const char *path) {
isc_result_t result;
dns_db_t *db = NULL;
dns_dbnode_t *node = NULL;
isc_time_t modtime;
char filename[PATH_MAX + 1];
@@ -334,15 +351,15 @@ load_parent_set(const char *path) {
}
verbose_time(1, "child records must not be signed before", notbefore);
load_db(filename, &db, &node);
findset(db, node, dns_rdatatype_ds, &old_ds_set, NULL);
load_db(filename, &parent_db, &parent_node);
findset(parent_db, parent_node, dns_rdatatype_ds, &old_ds_set, NULL);
if (!dns_rdataset_isassociated(&old_ds_set)) {
fatal("could not find DS records for %s in %s", namestr,
filename);
}
free_db(&db, &node);
free_db(&parent_db, &parent_node, NULL);
}
#define MAX_CDS_RDATA_TEXT_SIZE DNS_RDATA_MAXLENGTH * 2
@@ -367,17 +384,18 @@ formatset(dns_rdataset_t *rdataset) {
isc_buffer_allocate(mctx, &buf, MAX_CDS_RDATA_TEXT_SIZE);
result = dns_master_rdatasettotext(name, rdataset, style, NULL, buf);
dns_master_styledestroy(&style, mctx);
if ((result == ISC_R_SUCCESS) && isc_buffer_availablelength(buf) < 1) {
result = ISC_R_NOSPACE;
}
check_result(result, "dns_rdataset_totext()");
if (result != ISC_R_SUCCESS) {
isc_buffer_free(&buf);
check_result(result, "dns_rdataset_totext()");
}
isc_buffer_putuint8(buf, 0);
dns_master_styledestroy(&style, mctx);
return (buf);
}
@@ -420,6 +438,7 @@ write_parent_set(const char *path, const char *inplace, bool nsupdate,
result = isc_file_openunique(tmpname, &fp);
if (result != ISC_R_SUCCESS) {
isc_buffer_free(&buf);
fatal("open %s: %s", tmpname, isc_result_totext(result));
}
fprintf(fp, "%s", (char *)r.base);
@@ -514,23 +533,22 @@ static keyinfo_t *
match_keyset_dsset(dns_rdataset_t *keyset, dns_rdataset_t *dsset,
strictness_t strictness) {
isc_result_t result;
keyinfo_t *keytable;
keyinfo_t *keytable, *ki;
int i;
nkey = dns_rdataset_count(keyset);
keytable = isc_mem_get(mctx, sizeof(keyinfo_t) * nkey);
keytable = isc_mem_getx(mctx, sizeof(keytable[0]) * nkey, ISC_MEM_ZERO);
for (result = dns_rdataset_first(keyset), i = 0;
result == ISC_R_SUCCESS; result = dns_rdataset_next(keyset), i++)
for (result = dns_rdataset_first(keyset), i = 0, ki = keytable;
result == ISC_R_SUCCESS;
result = dns_rdataset_next(keyset), i++, ki++)
{
keyinfo_t *ki;
dns_rdata_dnskey_t dnskey;
dns_rdata_t *keyrdata;
isc_region_t r;
INSIST(i < nkey);
ki = &keytable[i];
keyrdata = &ki->rdata;
dns_rdata_init(keyrdata);
@@ -568,14 +586,15 @@ free_keytable(keyinfo_t **keytable_p) {
keyinfo_t *ki;
int i;
for (i = 0; i < nkey; i++) {
ki = &keytable[i];
REQUIRE(keytable != NULL);
for (i = 0, ki = keytable; i < nkey; i++, ki++) {
if (ki->dst != NULL) {
dst_key_free(&ki->dst);
}
}
isc_mem_put(mctx, keytable, sizeof(keyinfo_t) * nkey);
isc_mem_put(mctx, keytable, sizeof(keytable[0]) * nkey);
}
/*
@@ -594,8 +613,9 @@ matching_sigs(keyinfo_t *keytbl, dns_rdataset_t *rdataset,
dns_secalg_t *algo;
int i;
algo = isc_mem_get(mctx, nkey);
memset(algo, 0, nkey);
REQUIRE(keytbl != NULL);
algo = isc_mem_getx(mctx, nkey * sizeof(algo[0]), ISC_MEM_ZERO);
for (result = dns_rdataset_first(sigset); result == ISC_R_SUCCESS;
result = dns_rdataset_next(sigset))
@@ -636,7 +656,8 @@ matching_sigs(keyinfo_t *keytbl, dns_rdataset_t *rdataset,
NULL);
if (result != ISC_R_SUCCESS &&
result != DNS_R_FROMWILDCARD) {
result != DNS_R_FROMWILDCARD)
{
vbprintf(1,
"skip RRSIG by key %d:"
" verification failed: %s\n",
@@ -677,7 +698,7 @@ signed_loose(dns_secalg_t *algo) {
ok = true;
}
}
isc_mem_put(mctx, algo, nkey);
isc_mem_put(mctx, algo, nkey * sizeof(algo[0]));
return (ok);
}
@@ -798,6 +819,7 @@ append_new_ds_set(ds_maker_func_t *ds_from_rdata, isc_buffer_t *buf,
isc_mem_put(mctx, ds, sizeof(*ds));
return (result);
default:
isc_mem_put(mctx, ds, sizeof(*ds));
check_result(result, "ds_from_rdata()");
}
}
@@ -955,32 +977,27 @@ static void
update_diff(const char *cmd, uint32_t ttl, dns_rdataset_t *addset,
dns_rdataset_t *delset) {
isc_result_t result;
dns_db_t *db;
dns_dbnode_t *node;
dns_dbversion_t *ver;
dns_rdataset_t diffset;
uint32_t save;
db = NULL;
result = dns_db_create(mctx, "rbt", name, dns_dbtype_zone, rdclass, 0,
NULL, &db);
NULL, &update_db);
check_result(result, "dns_db_create()");
ver = NULL;
result = dns_db_newversion(db, &ver);
result = dns_db_newversion(update_db, &update_version);
check_result(result, "dns_db_newversion()");
node = NULL;
result = dns_db_findnode(db, name, true, &node);
result = dns_db_findnode(update_db, name, true, &update_node);
check_result(result, "dns_db_findnode()");
dns_rdataset_init(&diffset);
result = dns_db_addrdataset(db, node, ver, 0, addset, DNS_DBADD_MERGE,
NULL);
result = dns_db_addrdataset(update_db, update_node, update_version, 0,
addset, DNS_DBADD_MERGE, NULL);
check_result(result, "dns_db_addrdataset()");
result = dns_db_subtractrdataset(db, node, ver, delset, 0, &diffset);
result = dns_db_subtractrdataset(update_db, update_node, update_version,
delset, 0, &diffset);
if (result == DNS_R_UNCHANGED) {
save = addset->ttl;
addset->ttl = ttl;
@@ -993,9 +1010,7 @@ update_diff(const char *cmd, uint32_t ttl, dns_rdataset_t *addset,
dns_rdataset_disassociate(&diffset);
}
dns_db_detachnode(db, &node);
dns_db_closeversion(db, &ver, false);
dns_db_detach(&db);
free_db(&update_db, &update_node, &update_version);
}
static void
@@ -1045,6 +1060,32 @@ usage(void) {
exit(1);
}
static void
cleanup(void) {
free_db(&child_db, &child_node, NULL);
free_db(&parent_db, &parent_node, NULL);
free_db(&update_db, &update_node, &update_version);
if (old_key_tbl != NULL) {
free_keytable(&old_key_tbl);
}
if (new_key_tbl != NULL) {
free_keytable(&new_key_tbl);
}
free_all_sets();
if (lctx != NULL) {
cleanup_logging(&lctx);
}
if (cleanup_dst) {
dst_lib_destroy();
}
if (mctx != NULL) {
if (print_mem_stats && verbose > 10) {
isc_mem_stats(mctx, stdout);
}
isc_mem_destroy(&mctx);
}
}
int
main(int argc, char *argv[]) {
const char *child_path = NULL;
@@ -1057,6 +1098,8 @@ main(int argc, char *argv[]) {
int ch;
char *endp;
setfatalcallback(cleanup);
isc_mem_create(&mctx);
isc_commandline_errprint = false;
@@ -1085,7 +1128,8 @@ main(int argc, char *argv[]) {
* optional, so that it works just like sed(1).
*/
if (isc_commandline_argument ==
argv[isc_commandline_index - 1]) {
argv[isc_commandline_index - 1])
{
isc_commandline_index--;
inplace = "";
} else {
@@ -1142,6 +1186,7 @@ main(int argc, char *argv[]) {
fatal("could not initialize dst: %s",
isc_result_totext(result));
}
cleanup_dst = true;
if (ds_path == NULL) {
fatal("missing -d DS pathname");
@@ -1177,7 +1222,8 @@ main(int argc, char *argv[]) {
fatal("missing RRSIG CDNSKEY records for %s", namestr);
}
if (dns_rdataset_isassociated(&cds_set) &&
!dns_rdataset_isassociated(&cds_sig)) {
!dns_rdataset_isassociated(&cds_sig))
{
fatal("missing RRSIG CDS records for %s", namestr);
}
@@ -1200,7 +1246,8 @@ main(int argc, char *argv[]) {
if (dns_rdataset_isassociated(&cdnskey_set)) {
vbprintf(1, "verify CDNSKEY signature(s)\n");
if (!signed_loose(matching_sigs(old_key_tbl, &cdnskey_set,
&cdnskey_sig))) {
&cdnskey_sig)))
{
fatal("could not validate child CDNSKEY RRset for %s",
namestr);
}
@@ -1208,7 +1255,8 @@ main(int argc, char *argv[]) {
if (dns_rdataset_isassociated(&cds_set)) {
vbprintf(1, "verify CDS signature(s)\n");
if (!signed_loose(
matching_sigs(old_key_tbl, &cds_set, &cds_sig))) {
matching_sigs(old_key_tbl, &cds_set, &cds_sig)))
{
fatal("could not validate child CDS RRset for %s",
namestr);
}
@@ -1238,7 +1286,7 @@ main(int argc, char *argv[]) {
vbprintf(1, "%s has neither CDS nor CDNSKEY records\n",
namestr);
write_parent_set(ds_path, inplace, nsupdate, &old_ds_set);
exit(0);
goto cleanup;
}
/*
@@ -1304,13 +1352,8 @@ main(int argc, char *argv[]) {
write_parent_set(ds_path, inplace, nsupdate, &new_ds_set);
free_all_sets();
cleanup_logging(&lctx);
dst_lib_destroy();
if (verbose > 10) {
isc_mem_stats(mctx, stdout);
}
isc_mem_destroy(&mctx);
cleanup:
print_mem_stats = true;
cleanup();
exit(0);
}
+1 -2
View File
@@ -23,7 +23,6 @@
#include <isc/dir.h>
#include <isc/hash.h>
#include <isc/mem.h>
#include <isc/print.h>
#include <isc/result.h>
#include <isc/string.h>
#include <isc/util.h>
@@ -314,7 +313,7 @@ emit(dns_dsdigest_t dt, bool showall, bool cds, dns_rdata_t *rdata) {
static void
emits(bool showall, bool cds, dns_rdata_t *rdata) {
unsigned i, n;
unsigned int i, n;
n = sizeof(dtype) / sizeof(dtype[0]);
for (i = 0; i < n; i++) {
-1
View File
@@ -21,7 +21,6 @@
#include <isc/commandline.h>
#include <isc/hash.h>
#include <isc/mem.h>
#include <isc/print.h>
#include <isc/result.h>
#include <isc/string.h>
#include <isc/util.h>
+4 -3
View File
@@ -22,7 +22,6 @@
#include <isc/buffer.h>
#include <isc/commandline.h>
#include <isc/mem.h>
#include <isc/print.h>
#include <isc/region.h>
#include <isc/result.h>
#include <isc/string.h>
@@ -559,7 +558,8 @@ main(int argc, char **argv) {
flags |= DNS_KEYOWNER_ZONE;
} else if ((options & DST_TYPE_KEY) != 0) { /* KEY */
if (strcasecmp(nametype, "host") == 0 ||
strcasecmp(nametype, "entity") == 0) {
strcasecmp(nametype, "entity") == 0)
{
flags |= DNS_KEYOWNER_ENTITY;
} else if (strcasecmp(nametype, "user") == 0) {
flags |= DNS_KEYOWNER_USER;
@@ -586,7 +586,8 @@ main(int argc, char **argv) {
if (protocol == -1) {
protocol = DNS_KEYPROTO_DNSSEC;
} else if ((options & DST_TYPE_KEY) == 0 &&
protocol != DNS_KEYPROTO_DNSSEC) {
protocol != DNS_KEYPROTO_DNSSEC)
{
fatal("invalid DNSKEY protocol: %d", protocol);
}
+10 -6
View File
@@ -37,7 +37,6 @@
#include <isc/buffer.h>
#include <isc/commandline.h>
#include <isc/mem.h>
#include <isc/print.h>
#include <isc/region.h>
#include <isc/result.h>
#include <isc/string.h>
@@ -254,7 +253,8 @@ kasp_from_conf(cfg_obj_t *config, isc_mem_t *mctx, const char *name,
cfg_obj_t *kconfig = cfg_listelt_value(element);
kasp = NULL;
if (strcmp(cfg_obj_asstring(cfg_tuple_get(kconfig, "name")),
name) != 0) {
name) != 0)
{
continue;
}
@@ -391,7 +391,8 @@ keygen(keygen_ctx_t *ctx, isc_mem_t *mctx, int argc, char **argv) {
if (!ctx->oldstyle && ctx->prepub > 0) {
if (ctx->setpub && ctx->setact &&
(ctx->activate - ctx->prepub) < ctx->publish) {
(ctx->activate - ctx->prepub) < ctx->publish)
{
fatal("Activation and publication dates "
"are closer together than the\n\t"
"prepublication interval.");
@@ -727,7 +728,8 @@ keygen(keygen_ctx_t *ctx, isc_mem_t *mctx, int argc, char **argv) {
if (ctx->setdel) {
if (ctx->setinact &&
ctx->deltime < ctx->inactive) {
ctx->deltime < ctx->inactive)
{
fprintf(stderr,
"%s: warning: Key is "
"scheduled to be deleted "
@@ -981,7 +983,8 @@ main(int argc, char **argv) {
ctx.protocol = strtol(isc_commandline_argument, &endp,
10);
if (*endp != '\0' || ctx.protocol < 0 ||
ctx.protocol > 255) {
ctx.protocol > 255)
{
fatal("-p must be followed by a number "
"[0..255]");
}
@@ -997,7 +1000,8 @@ main(int argc, char **argv) {
ctx.signatory = strtol(isc_commandline_argument, &endp,
10);
if (*endp != '\0' || ctx.signatory < 0 ||
ctx.signatory > 15) {
ctx.signatory > 15)
{
fatal("-s must be followed by a number "
"[0..15]");
}
+2 -2
View File
@@ -24,7 +24,6 @@
#include <isc/file.h>
#include <isc/hash.h>
#include <isc/mem.h>
#include <isc/print.h>
#include <isc/result.h>
#include <isc/string.h>
#include <isc/util.h>
@@ -136,7 +135,8 @@ main(int argc, char **argv) {
}
if (argc < isc_commandline_index + 1 ||
argv[isc_commandline_index] == NULL) {
argv[isc_commandline_index] == NULL)
{
fatal("The key file name was not specified");
}
if (argc > isc_commandline_index + 1) {
+4 -3
View File
@@ -26,7 +26,6 @@
#include <isc/file.h>
#include <isc/hash.h>
#include <isc/mem.h>
#include <isc/print.h>
#include <isc/result.h>
#include <isc/string.h>
#include <isc/time.h>
@@ -544,7 +543,8 @@ main(int argc, char **argv) {
}
if (argc < isc_commandline_index + 1 ||
argv[isc_commandline_index] == NULL) {
argv[isc_commandline_index] == NULL)
{
fatal("The key file name was not specified");
}
if (argc > isc_commandline_index + 1) {
@@ -552,7 +552,8 @@ main(int argc, char **argv) {
}
if ((setgoal || setds || setdnskey || setkrrsig || setzrrsig) &&
!write_state) {
!write_state)
{
fatal("Options -g, -d, -k, -r and -z require -s to be set");
}
+197 -216
View File
@@ -38,7 +38,6 @@
#include <isc/base32.h>
#include <isc/commandline.h>
#include <isc/dir.h>
#include <isc/event.h>
#include <isc/file.h>
#include <isc/hash.h>
#include <isc/hex.h>
@@ -49,7 +48,6 @@
#include <isc/mem.h>
#include <isc/mutex.h>
#include <isc/os.h>
#include <isc/print.h>
#include <isc/random.h>
#include <isc/result.h>
#include <isc/rwlock.h>
@@ -57,7 +55,6 @@
#include <isc/serial.h>
#include <isc/stdio.h>
#include <isc/string.h>
#include <isc/task.h>
#include <isc/tid.h>
#include <isc/time.h>
#include <isc/util.h>
@@ -68,6 +65,7 @@
#include <dns/dnssec.h>
#include <dns/ds.h>
#include <dns/fixedname.h>
#include <dns/kasp.h>
#include <dns/keyvalues.h>
#include <dns/log.h>
#include <dns/master.h>
@@ -117,13 +115,6 @@ static int nsec_datatype = dns_rdatatype_nsec;
#define SOA_SERIAL_UNIXTIME 2
#define SOA_SERIAL_DATE 3
typedef struct signer_event sevent_t;
struct signer_event {
ISC_EVENT_COMMON(sevent_t);
dns_fixedname_t *fname;
dns_dbnode_t *node;
};
static dns_dnsseckeylist_t keylist;
static unsigned int keycount = 0;
static isc_rwlock_t keylist_lock;
@@ -148,7 +139,6 @@ static const char *directory = NULL, *dsdir = NULL;
static isc_mutex_t namelock, statslock;
static isc_nm_t *netmgr = NULL;
static isc_loopmgr_t *loopmgr = NULL;
static isc_taskmgr_t *taskmgr = NULL;
static dns_db_t *gdb; /* The database */
static dns_dbversion_t *gversion; /* The database version */
static dns_dbiterator_t *gdbiter; /* The database iterator */
@@ -159,8 +149,7 @@ static dns_iterations_t nsec3iter = 0U;
static unsigned char saltbuf[255];
static unsigned char *gsalt = saltbuf;
static size_t salt_length = 0;
static isc_task_t *write_task = NULL;
static unsigned int ntasks = 0;
static unsigned int nloops = 0;
static atomic_bool shuttingdown;
static atomic_bool finished;
static bool nokeys = false;
@@ -184,6 +173,7 @@ static bool output_stdout = false;
static bool set_maxttl = false;
static dns_ttl_t maxttl = 0;
static bool no_max_check = false;
static const char *sync_records = "cdnskey,cds:sha-256";
#define INCSTAT(counter) \
if (printstats) { \
@@ -192,9 +182,6 @@ static bool no_max_check = false;
UNLOCK(&statslock); \
}
static void
sign(isc_task_t *task, isc_event_t *event);
/*%
* Store a copy of 'name' in 'fzonecut' and return a pointer to that copy.
*/
@@ -215,20 +202,13 @@ dumpnode(dns_name_t *name, dns_dbnode_t *node) {
isc_buffer_t *buffer = NULL;
isc_region_t r;
isc_result_t result;
unsigned bufsize = 4096;
if (outputformat != dns_masterformat_text) {
return;
}
unsigned int bufsize = 4096;
if (!output_dnssec_only) {
result = dns_master_dumpnodetostream(mctx, gdb, gversion, node,
name, masterstyle, outfp);
check_result(result, "dns_master_dumpnodetostream");
return;
}
result = dns_db_allrdatasets(gdb, node, gversion, 0, &iter);
result = dns_db_allrdatasets(gdb, node, gversion, 0, 0, &iter);
check_result(result, "dns_db_allrdatasets");
dns_rdataset_init(&rds);
@@ -275,6 +255,17 @@ dumpnode(dns_name_t *name, dns_dbnode_t *node) {
dns_rdatasetiter_destroy(&iter);
}
static void
lock_and_dumpnode(dns_name_t *name, dns_dbnode_t *node) {
if (!output_dnssec_only) {
return;
}
LOCK(&namelock);
dumpnode(name, node);
UNLOCK(&namelock);
}
/*%
* Sign the given RRset with given key, and add the signature record to the
* given tuple.
@@ -365,7 +356,8 @@ keythatsigned_unlocked(dns_rdata_rrsig_t *rrsig) {
dns_dnsseckey_t *key;
for (key = ISC_LIST_HEAD(keylist); key != NULL;
key = ISC_LIST_NEXT(key, link)) {
key = ISC_LIST_NEXT(key, link))
{
if (rrsig->keyid == dst_key_id(key->key) &&
rrsig->algorithm == dst_key_alg(key->key) &&
dns_name_equal(&rrsig->signer, dst_key_name(key->key)))
@@ -565,7 +557,8 @@ signset(dns_diff_t *del, dns_diff_t *add, dns_dbnode_t *node, dns_name_t *name,
"invalid validity period\n",
sigstr);
} else if (key == NULL && !future &&
expecttofindkey(&rrsig.signer)) {
expecttofindkey(&rrsig.signer))
{
/* rrsig is dropped and not replaced */
vbprintf(2,
"\trrsig by %s dropped - "
@@ -576,7 +569,8 @@ signset(dns_diff_t *del, dns_diff_t *add, dns_dbnode_t *node, dns_name_t *name,
vbprintf(2, "\trrsig by %s %s - dnskey not found\n",
keep ? "retained" : "dropped", sigstr);
} else if (!dns_dnssec_keyactive(key->key, now) &&
remove_inactkeysigs) {
remove_inactkeysigs)
{
keep = false;
vbprintf(2, "\trrsig by %s dropped - key inactive\n",
sigstr);
@@ -677,7 +671,8 @@ signset(dns_diff_t *del, dns_diff_t *add, dns_dbnode_t *node, dns_name_t *name,
}
for (key = ISC_LIST_HEAD(keylist); key != NULL;
key = ISC_LIST_NEXT(key, link)) {
key = ISC_LIST_NEXT(key, link))
{
if (nowsignedby[key->index]) {
continue;
}
@@ -699,7 +694,8 @@ signset(dns_diff_t *del, dns_diff_t *add, dns_dbnode_t *node, dns_name_t *name,
curr = ISC_LIST_NEXT(curr, link))
{
if (dst_key_alg(key->key) !=
dst_key_alg(curr->key)) {
dst_key_alg(curr->key))
{
continue;
}
if (REVOKE(curr->key)) {
@@ -710,7 +706,8 @@ signset(dns_diff_t *del, dns_diff_t *add, dns_dbnode_t *node, dns_name_t *name,
}
}
if (isksk(key) || !have_ksk ||
(iszsk(key) && !keyset_kskonly)) {
(iszsk(key) && !keyset_kskonly))
{
signwithkey(name, set, key->key, ttl, add,
"signing with dnskey");
}
@@ -751,7 +748,8 @@ signset(dns_diff_t *del, dns_diff_t *add, dns_dbnode_t *node, dns_name_t *name,
DST_NUM_SUCCESSOR,
&suc);
if (ret != ISC_R_SUCCESS ||
dst_key_id(key->key) != suc) {
dst_key_id(key->key) != suc)
{
continue;
}
@@ -1186,7 +1184,7 @@ signname(dns_dbnode_t *node, dns_name_t *name) {
dns_diff_init(mctx, &del);
dns_diff_init(mctx, &add);
rdsiter = NULL;
result = dns_db_allrdatasets(gdb, node, gversion, 0, &rdsiter);
result = dns_db_allrdatasets(gdb, node, gversion, 0, 0, &rdsiter);
check_result(result, "dns_db_allrdatasets()");
result = dns_rdatasetiter_first(rdsiter);
while (result == ISC_R_SUCCESS) {
@@ -1204,7 +1202,8 @@ signname(dns_dbnode_t *node, dns_name_t *name) {
*/
if (isdelegation) {
if (rdataset.type != nsec_datatype &&
rdataset.type != dns_rdatatype_ds) {
rdataset.type != dns_rdatatype_ds)
{
goto skip;
}
} else if (rdataset.type == dns_rdatatype_ds) {
@@ -1259,7 +1258,7 @@ active_node(dns_dbnode_t *node) {
bool found;
dns_rdataset_init(&rdataset);
result = dns_db_allrdatasets(gdb, node, gversion, 0, &rdsiter);
result = dns_db_allrdatasets(gdb, node, gversion, 0, 0, &rdsiter);
check_result(result, "dns_db_allrdatasets()");
result = dns_rdatasetiter_first(rdsiter);
while (result == ISC_R_SUCCESS) {
@@ -1305,7 +1304,8 @@ active_node(dns_dbnode_t *node) {
/*
* Delete RRSIGs for types that no longer exist.
*/
result = dns_db_allrdatasets(gdb, node, gversion, 0, &rdsiter2);
result = dns_db_allrdatasets(gdb, node, gversion, 0, 0,
&rdsiter2);
check_result(result, "dns_db_allrdatasets()");
for (result = dns_rdatasetiter_first(rdsiter);
result == ISC_R_SUCCESS;
@@ -1353,7 +1353,8 @@ active_node(dns_dbnode_t *node) {
check_result(result, "dns_db_deleterdataset("
"rrsig)");
} else if (result != ISC_R_NOMORE &&
result != ISC_R_SUCCESS) {
result != ISC_R_SUCCESS)
{
fatal("rdataset iteration failed: %s",
isc_result_totext(result));
}
@@ -1434,7 +1435,8 @@ setsoaserial(uint32_t serial, dns_updatemethod_t method) {
old_serial = dns_soa_getserial(&rdata);
if (method == dns_updatemethod_date ||
method == dns_updatemethod_unixtime) {
method == dns_updatemethod_unixtime)
{
new_serial = dns_update_soaserial(old_serial, method, &used);
} else if (serial != 0 || method == dns_updatemethod_none) {
/* Set SOA serial to the value provided. */
@@ -1491,47 +1493,6 @@ cleanup:
return (result);
}
/*%
* Delete any RRSIG records at a node.
*/
static void
cleannode(dns_db_t *db, dns_dbversion_t *dbversion, dns_dbnode_t *node) {
dns_rdatasetiter_t *rdsiter = NULL;
dns_rdataset_t set;
isc_result_t result, dresult;
if (outputformat != dns_masterformat_text || !disable_zone_check) {
return;
}
dns_rdataset_init(&set);
result = dns_db_allrdatasets(db, node, dbversion, 0, &rdsiter);
check_result(result, "dns_db_allrdatasets");
result = dns_rdatasetiter_first(rdsiter);
while (result == ISC_R_SUCCESS) {
bool destroy = false;
dns_rdatatype_t covers = 0;
dns_rdatasetiter_current(rdsiter, &set);
if (set.type == dns_rdatatype_rrsig) {
covers = set.covers;
destroy = true;
}
dns_rdataset_disassociate(&set);
result = dns_rdatasetiter_next(rdsiter);
if (destroy) {
dresult = dns_db_deleterdataset(db, node, dbversion,
dns_rdatatype_rrsig,
covers);
check_result(dresult, "dns_db_deleterdataset");
}
}
if (result != ISC_R_NOMORE) {
fatal("rdataset iteration failed: %s",
isc_result_totext(result));
}
dns_rdatasetiter_destroy(&rdsiter);
}
/*%
* Set up the iterator and global state before starting the tasks.
*/
@@ -1570,10 +1531,7 @@ signapex(void) {
result = dns_dbiterator_current(gdbiter, &node, name);
check_dns_dbiterator_current(result);
signname(node, name);
LOCK(&namelock);
dumpnode(name, node);
UNLOCK(&namelock);
cleannode(gdb, gversion, node);
dns_db_detachnode(gdb, &node);
result = dns_dbiterator_first(gdbiter);
if (result == ISC_R_NOMORE) {
@@ -1584,16 +1542,22 @@ signapex(void) {
}
}
static void
abortwork(void *arg) {
UNUSED(arg);
atomic_store(&shuttingdown, true);
}
/*%
* Assigns a node to a worker thread. This is protected by the main task's
* lock.
*/
static void
assignwork(isc_task_t *task) {
dns_fixedname_t *fname = NULL;
assignwork(void *arg) {
dns_fixedname_t fname;
dns_name_t *name = NULL;
dns_dbnode_t *node = NULL;
sevent_t *sevent = NULL;
dns_rdataset_t nsec;
bool found;
isc_result_t result;
@@ -1601,6 +1565,8 @@ assignwork(isc_task_t *task) {
static dns_fixedname_t fzonecut; /* Protected by namelock. */
static unsigned int ended = 0; /* Protected by namelock. */
UNUSED(arg);
if (atomic_load(&shuttingdown)) {
return;
}
@@ -1608,15 +1574,14 @@ assignwork(isc_task_t *task) {
LOCK(&namelock);
if (atomic_load(&finished)) {
ended++;
if (ended == ntasks) {
isc_task_detach(&write_task);
if (ended == nloops) {
isc_loopmgr_shutdown(loopmgr);
}
goto unlock;
UNLOCK(&namelock);
return;
}
fname = isc_mem_get(mctx, sizeof(dns_fixedname_t));
name = dns_fixedname_initname(fname);
name = dns_fixedname_initname(&fname);
node = NULL;
found = false;
while (!found) {
@@ -1651,10 +1616,12 @@ assignwork(isc_task_t *task) {
!dns_name_issubdomain(name, zonecut)))
{
if (is_delegation(gdb, gversion, gorigin, name,
node, NULL)) {
node, NULL))
{
zonecut = savezonecut(&fzonecut, name);
if (!OPTOUT(nsec3flags) ||
secure(name, node)) {
secure(name, node))
{
found = true;
}
} else if (has_dname(gdb, gversion, node)) {
@@ -1683,93 +1650,24 @@ assignwork(isc_task_t *task) {
}
if (!found) {
ended++;
if (ended == ntasks) {
isc_task_detach(&write_task);
if (ended == nloops) {
isc_loopmgr_shutdown(loopmgr);
}
isc_mem_put(mctx, fname, sizeof(dns_fixedname_t));
goto unlock;
}
sevent = (sevent_t *)isc_event_allocate(mctx, task, SIGNER_EVENT_WORK,
sign, NULL, sizeof(sevent_t));
sevent->node = node;
sevent->fname = fname;
isc_task_send(task, ISC_EVENT_PTR(&sevent));
unlock:
UNLOCK(&namelock);
}
/*%
* Start a worker task
*/
static void
startworker(void *arg) {
isc_task_t **tasks = (isc_task_t **)arg;
isc_result_t result;
int tid;
REQUIRE(tasks != NULL);
tid = isc_tid();
result = isc_task_create(taskmgr, &tasks[tid], tid);
if (result != ISC_R_SUCCESS) {
fatal("failed to create task: %s", isc_result_totext(result));
UNLOCK(&namelock);
return;
}
assignwork(tasks[tid]);
}
/*%
* Finish a worker task
*/
static void
workerdone(void *arg) {
isc_task_t **tasks = (isc_task_t **)arg;
isc_task_detach(&tasks[isc_tid()]);
}
/*%
* Write a node to the output file, and restart the worker task.
*/
static void
writenode(isc_task_t *task, isc_event_t *event) {
sevent_t *sevent = (sevent_t *)event;
LOCK(&namelock);
dumpnode(dns_fixedname_name(sevent->fname), sevent->node);
UNLOCK(&namelock);
cleannode(gdb, gversion, sevent->node);
dns_db_detachnode(gdb, &sevent->node);
isc_mem_put(mctx, sevent->fname, sizeof(dns_fixedname_t));
assignwork(task);
isc_event_free(&event);
}
/*%
* Sign a database node.
*/
static void
sign(isc_task_t *task, isc_event_t *event) {
dns_fixedname_t *fname;
dns_dbnode_t *node;
sevent_t *sevent, *wevent;
signname(node, dns_fixedname_name(&fname));
UNUSED(task);
/*%
* Write a node to the output file, and restart the worker task.
*/
lock_and_dumpnode(dns_fixedname_name(&fname), node);
dns_db_detachnode(gdb, &node);
sevent = (sevent_t *)event;
node = sevent->node;
fname = sevent->fname;
isc_event_free(&event);
signname(node, dns_fixedname_name(fname));
wevent = (sevent_t *)isc_event_allocate(mctx, write_task,
SIGNER_EVENT_WRITE, writenode,
NULL, sizeof(sevent_t));
wevent->node = node;
wevent->fname = fname;
isc_task_send(write_task, ISC_EVENT_PTR(&wevent));
isc_job_run(loopmgr, assignwork, NULL);
}
/*%
@@ -1825,7 +1723,7 @@ remove_records(dns_dbnode_t *node, dns_rdatatype_t which, bool checknsec) {
/*
* Delete any records of the given type at the apex.
*/
result = dns_db_allrdatasets(gdb, node, gversion, 0, &rdsiter);
result = dns_db_allrdatasets(gdb, node, gversion, 0, 0, &rdsiter);
check_result(result, "dns_db_allrdatasets()");
for (result = dns_rdatasetiter_first(rdsiter); result == ISC_R_SUCCESS;
result = dns_rdatasetiter_next(rdsiter))
@@ -1836,12 +1734,14 @@ remove_records(dns_dbnode_t *node, dns_rdatatype_t which, bool checknsec) {
dns_rdataset_disassociate(&rdataset);
if (type == which || covers == which) {
if (which == dns_rdatatype_nsec && checknsec &&
!update_chain) {
!update_chain)
{
fatal("Zone contains NSEC records. Use -u "
"to update to NSEC3.");
}
if (which == dns_rdatatype_nsec3param && checknsec &&
!update_chain) {
!update_chain)
{
fatal("Zone contains NSEC3 chains. Use -u "
"to update to NSEC.");
}
@@ -1866,7 +1766,7 @@ remove_sigs(dns_dbnode_t *node, bool delegation, dns_rdatatype_t which) {
dns_rdataset_t rdataset;
dns_rdataset_init(&rdataset);
result = dns_db_allrdatasets(gdb, node, gversion, 0, &rdsiter);
result = dns_db_allrdatasets(gdb, node, gversion, 0, 0, &rdsiter);
check_result(result, "dns_db_allrdatasets()");
for (result = dns_rdatasetiter_first(rdsiter); result == ISC_R_SUCCESS;
result = dns_rdatasetiter_next(rdsiter))
@@ -1930,7 +1830,8 @@ nsecify(void) {
{
result = dns_dbiterator_current(dbiter, &node, name);
check_dns_dbiterator_current(result);
result = dns_db_allrdatasets(gdb, node, gversion, 0, &rdsiter);
result = dns_db_allrdatasets(gdb, node, gversion, 0, 0,
&rdsiter);
check_result(result, "dns_db_allrdatasets()");
for (result = dns_rdatasetiter_first(rdsiter);
result == ISC_R_SUCCESS;
@@ -2285,7 +2186,8 @@ rrset_cleanup(dns_name_t *name, dns_rdataset_t *rdataset, dns_diff_t *add,
count2++;
dns_rdataset_current(&tmprdataset, &rdata2);
if (count1 < count2 &&
dns_rdata_casecompare(&rdata1, &rdata2) == 0) {
dns_rdata_casecompare(&rdata1, &rdata2) == 0)
{
vbprintf(2, "removing duplicate at %s/%s\n",
namestr, typestr);
result = dns_difftuple_create(
@@ -2340,7 +2242,8 @@ cleanup_zone(void) {
{
result = dns_dbiterator_current(dbiter, &node, name);
check_dns_dbiterator_current(result);
result = dns_db_allrdatasets(gdb, node, gversion, 0, &rdsiter);
result = dns_db_allrdatasets(gdb, node, gversion, 0, 0,
&rdsiter);
check_result(result, "dns_db_allrdatasets()");
for (result = dns_rdatasetiter_first(rdsiter);
result == ISC_R_SUCCESS;
@@ -2452,14 +2355,16 @@ nsec3ify(unsigned int hashalg, dns_iterations_t iterations,
continue;
}
if (is_delegation(gdb, gversion, gorigin, nextname,
nextnode, &nsttl)) {
nextnode, &nsttl))
{
zonecut = savezonecut(&fzonecut, nextname);
remove_sigs(nextnode, true, 0);
if (generateds) {
add_ds(nextname, nextnode, nsttl);
}
if (OPTOUT(nsec3flags) &&
!secure(nextname, nextnode)) {
!secure(nextname, nextnode))
{
dns_db_detachnode(gdb, &nextnode);
result = dns_dbiterator_next(dbiter);
continue;
@@ -2593,10 +2498,12 @@ nsec3ify(unsigned int hashalg, dns_iterations_t iterations,
continue;
}
if (is_delegation(gdb, gversion, gorigin, nextname,
nextnode, NULL)) {
nextnode, NULL))
{
zonecut = savezonecut(&fzonecut, nextname);
if (OPTOUT(nsec3flags) &&
!secure(nextname, nextnode)) {
!secure(nextname, nextnode))
{
dns_db_detachnode(gdb, &nextnode);
result = dns_dbiterator_next(dbiter);
continue;
@@ -2774,7 +2681,8 @@ loadexplicitkeys(char *keyfiles[], int n, bool setksk) {
/* Skip any duplicates */
for (key = ISC_LIST_HEAD(keylist); key != NULL;
key = ISC_LIST_NEXT(key, link)) {
key = ISC_LIST_NEXT(key, link))
{
if (dst_key_id(key->key) == dst_key_id(newkey) &&
dst_key_alg(key->key) == dst_key_alg(newkey))
{
@@ -2825,6 +2733,51 @@ clear_keylist(dns_dnsseckeylist_t *list) {
}
}
static void
add_digest(char *str, size_t dlen, dns_kasp_digestlist_t *digests,
bool *cdnskey) {
isc_result_t result;
isc_textregion_t r;
dns_dsdigest_t alg;
dns_kasp_digest_t *digest;
if (dlen == 7 && strncmp(str, "cdnskey", dlen) == 0) {
*cdnskey = true;
return;
}
if (dlen < 5 || strncmp(str, "cds:", 4) != 0) {
fatal("digest must specify cds:algorithm ('%.*s')", (int)dlen,
str);
}
r.base = str + 4;
r.length = dlen - 4;
result = dns_dsdigest_fromtext(&alg, &r);
if (result == DNS_R_UNKNOWN) {
fatal("bad digest '%.*s'", (int)dlen, str);
} else if (result != ISC_R_SUCCESS) {
fatal("bad digest '%.*s': %s", (int)dlen, str,
isc_result_totext(result));
} else if (!dst_ds_digest_supported(alg)) {
fatal("unsupported digest '%.*s'", (int)dlen, str);
}
/* Suppress duplicates */
for (dns_kasp_digest_t *d = ISC_LIST_HEAD(*digests); d != NULL;
d = ISC_LIST_NEXT(d, link))
{
if (d->digest == alg) {
return;
}
}
digest = isc_mem_get(mctx, sizeof(*digest));
digest->digest = alg;
ISC_LINK_INIT(digest, link);
ISC_LIST_APPEND(*digests, digest, link);
}
static void
build_final_keylist(void) {
isc_result_t result;
@@ -2834,14 +2787,39 @@ build_final_keylist(void) {
dns_dnsseckeylist_t rmkeys, matchkeys;
char name[DNS_NAME_FORMATSIZE];
dns_rdataset_t cdsset, cdnskeyset, soaset;
dns_kasp_digestlist_t digests;
dns_kasp_digest_t *d, *d_next;
bool cdnskey = false;
ISC_LIST_INIT(rmkeys);
ISC_LIST_INIT(matchkeys);
ISC_LIST_INIT(digests);
dns_rdataset_init(&soaset);
dns_rdataset_init(&cdsset);
dns_rdataset_init(&cdnskeyset);
if (strlen(sync_records) > 0) {
const char delim = ',';
char *digest;
char *s;
size_t dlen;
DE_CONST(sync_records, digest);
next_digest:
s = strchr(digest, delim);
if (s == NULL) {
dlen = strlen(digest);
add_digest(digest, dlen, &digests, &cdnskey);
goto findkeys;
}
dlen = s - digest;
add_digest(digest, dlen, &digests, &cdnskey);
digest = s + 1;
goto next_digest;
}
findkeys:
/*
* Find keys that match this zone in the key repository.
*/
@@ -2883,8 +2861,9 @@ build_final_keylist(void) {
/*
* Update keylist with sync records.
*/
dns_dnssec_syncupdate(&keylist, &rmkeys, &cdsset, &cdnskeyset, now,
keyttl, &diff, mctx);
&digests, cdnskey, keyttl, &diff, mctx);
dns_name_format(gorigin, name, sizeof(name));
@@ -2908,6 +2887,13 @@ build_final_keylist(void) {
clear_keylist(&rmkeys);
clear_keylist(&matchkeys);
for (d = ISC_LIST_HEAD(digests); d != NULL; d = d_next) {
d_next = ISC_LIST_NEXT(d, link);
ISC_LIST_UNLINK(digests, d, link);
isc_mem_put(mctx, d, sizeof(*d));
}
INSIST(ISC_LIST_EMPTY(digests));
}
static void
@@ -3115,7 +3101,8 @@ writeset(const char *prefix, dns_rdatatype_t type) {
name = gorigin;
for (key = ISC_LIST_HEAD(keylist); key != NULL;
key = ISC_LIST_NEXT(key, link)) {
key = ISC_LIST_NEXT(key, link))
{
if (REVOKE(key->key)) {
continue;
}
@@ -3237,6 +3224,8 @@ usage(void) {
fprintf(stderr, "\t-g:\t");
fprintf(stderr, "update DS records based on child zones' "
"dsset-* files\n");
fprintf(stderr, "\t-G sync-records:\t");
fprintf(stderr, "what CDNSKEY and CDS to publish\n");
fprintf(stderr, "\t-s [YYYYMMDDHHMMSS|+offset]:\n");
fprintf(stderr, "\t\tRRSIG start time "
"- absolute|offset (now - 1 hour)\n");
@@ -3367,7 +3356,6 @@ main(int argc, char *argv[]) {
bool free_output = false;
int tempfilelen = 0;
dns_rdataclass_t rdclass;
isc_task_t **tasks = NULL;
hashlist_t hashlist;
bool make_keyset = false;
bool set_salt = false;
@@ -3379,8 +3367,8 @@ main(int argc, char *argv[]) {
atomic_init(&finished, false);
/* Unused letters: Bb G J q Yy (and F is reserved). */
#define CMDLINE_FLAGS \
"3:AaCc:Dd:E:e:f:FghH:i:I:j:J:K:k:L:l:m:M:n:N:o:O:PpQqRr:s:ST:tuUv:" \
#define CMDLINE_FLAGS \
"3:AaCc:Dd:E:e:f:FgG:hH:i:I:j:J:K:k:L:l:m:M:n:N:o:O:PpQqRr:s:ST:tuUv:" \
"VX:xzZ:"
/*
@@ -3486,6 +3474,10 @@ main(int argc, char *argv[]) {
generateds = true;
break;
case 'G':
sync_records = isc_commandline_argument;
break;
case 'H':
set_iter = true;
/* too-many is NOT DOCUMENTED */
@@ -3574,8 +3566,8 @@ main(int argc, char *argv[]) {
case 'n':
endp = NULL;
ntasks = strtol(isc_commandline_argument, &endp, 0);
if (*endp != '\0' || ntasks > INT32_MAX) {
nloops = strtol(isc_commandline_argument, &endp, 0);
if (*endp != '\0' || nloops > INT32_MAX) {
fatal("number of cpus must be numeric");
}
break;
@@ -3716,10 +3708,10 @@ main(int argc, char *argv[]) {
cycle = (endtime - starttime) / 4;
}
if (ntasks == 0) {
ntasks = isc_os_ncpus();
if (nloops == 0) {
nloops = isc_os_ncpus();
}
vbprintf(4, "using %d cpus\n", ntasks);
vbprintf(4, "using %d cpus\n", nloops);
rdclass = strtoclass(classname);
@@ -3727,9 +3719,7 @@ main(int argc, char *argv[]) {
directory = ".";
}
isc_managers_create(&mctx, ntasks, &loopmgr, &netmgr, &taskmgr);
isc_task_create(taskmgr, &write_task, 0);
isc_managers_create(&mctx, nloops, &loopmgr, &netmgr);
result = dst_lib_init(mctx, engine);
if (result != ISC_R_SUCCESS) {
@@ -3791,7 +3781,8 @@ main(int argc, char *argv[]) {
outputformat = dns_masterformat_raw;
rawversion = strtol(outputformatstr + 4, &end, 10);
if (end == outputformatstr + 4 || *end != '\0' ||
rawversion > 1U) {
rawversion > 1U)
{
fprintf(stderr, "unknown raw format version\n");
exit(1);
}
@@ -3869,7 +3860,7 @@ main(int argc, char *argv[]) {
* of keys rather early.
*/
ISC_LIST_INIT(keylist);
isc_rwlock_init(&keylist_lock, 0, 0);
isc_rwlock_init(&keylist_lock);
/*
* Fill keylist with:
@@ -3900,7 +3891,8 @@ main(int argc, char *argv[]) {
/* Now enumerate the key list */
for (key = ISC_LIST_HEAD(keylist); key != NULL;
key = ISC_LIST_NEXT(key, link)) {
key = ISC_LIST_NEXT(key, link))
{
key->index = keycount++;
}
@@ -4003,11 +3995,7 @@ main(int argc, char *argv[]) {
result = isc_file_mktemplate(output, tempfile, tempfilelen);
check_result(result, "isc_file_mktemplate");
if (outputformat == dns_masterformat_text) {
result = isc_file_openunique(tempfile, &outfp);
} else {
result = isc_file_bopenunique(tempfile, &outfp);
}
result = isc_file_openunique(tempfile, &outfp);
if (result != ISC_R_SUCCESS) {
fatal("failed to open temporary output file: %s",
isc_result_totext(result));
@@ -4033,21 +4021,14 @@ main(int argc, char *argv[]) {
* There is more work to do. Spread it out over multiple
* processors if possible.
*/
tasks = isc_mem_get(mctx, ntasks * sizeof(isc_task_t *));
memset(tasks, 0, ntasks * sizeof(isc_task_t *));
isc_loopmgr_setup(loopmgr, startworker, tasks);
isc_loopmgr_teardown(loopmgr, workerdone, tasks);
isc_loopmgr_setup(loopmgr, assignwork, NULL);
isc_loopmgr_teardown(loopmgr, abortwork, NULL);
isc_loopmgr_run(loopmgr);
if (!atomic_load(&finished)) {
fatal("process aborted by user");
}
isc_mem_put(mctx, tasks, ntasks * sizeof(isc_task_t *));
}
atomic_store(&shuttingdown, true);
postsign();
TIME_NOW(&sign_finish);
@@ -4064,7 +4045,7 @@ main(int argc, char *argv[]) {
}
}
if (outputformat != dns_masterformat_text) {
if (!output_dnssec_only) {
dns_masterrawheader_t header;
dns_master_initrawheader(&header);
if (rawversion == 0U) {
@@ -4076,7 +4057,7 @@ main(int argc, char *argv[]) {
result = dns_master_dumptostream(mctx, gdb, gversion,
masterstyle, outputformat,
&header, outfp);
check_result(result, "dns_master_dumptostream3");
check_result(result, "dns_master_dumptostream");
}
if (!output_stdout) {
@@ -4123,7 +4104,7 @@ main(int argc, char *argv[]) {
isc_mem_stats(mctx, stdout);
}
isc_managers_destroy(&mctx, &loopmgr, &netmgr, &taskmgr);
isc_managers_destroy(&mctx, &loopmgr, &netmgr);
if (printstats) {
TIME_NOW(&timer_finish);
+8 -1
View File
@@ -21,7 +21,7 @@ dnssec-signzone - DNSSEC zone signing tool
Synopsis
~~~~~~~~
:program:`dnssec-signzone` [**-a**] [**-c** class] [**-d** directory] [**-D**] [**-E** engine] [**-e** end-time] [**-f** output-file] [**-g**] [**-h**] [**-i** interval] [**-I** input-format] [**-j** jitter] [**-K** directory] [**-k** key] [**-L** serial] [**-M** maxttl] [**-N** soa-serial-format] [**-o** origin] [**-O** output-format] [**-P**] [**-Q**] [**-q**] [**-R**] [**-S**] [**-s** start-time] [**-T** ttl] [**-t**] [**-u**] [**-v** level] [**-V**] [**-X** extended end-time] [**-x**] [**-z**] [**-3** salt] [**-H** iterations] [**-A**] {zonefile} [key...]
:program:`dnssec-signzone` [**-a**] [**-c** class] [**-d** directory] [**-D**] [**-E** engine] [**-e** end-time] [**-f** output-file] [**-g**] [**-G sync-records**] [**-h**] [**-i** interval] [**-I** input-format] [**-j** jitter] [**-K** directory] [**-k** key] [**-L** serial] [**-M** maxttl] [**-N** soa-serial-format] [**-o** origin] [**-O** output-format] [**-P**] [**-Q**] [**-q**] [**-R**] [**-S**] [**-s** start-time] [**-T** ttl] [**-t**] [**-u**] [**-v** level] [**-V**] [**-X** extended end-time] [**-x**] [**-z**] [**-3** salt] [**-H** iterations] [**-A**] {zonefile} [key...]
Description
~~~~~~~~~~~
@@ -76,6 +76,13 @@ Options
This option indicates that DS records for child zones should be generated from a ``dsset-`` or ``keyset-``
file. Existing DS records are removed.
.. option:: -G sync-records
This option indicates which CDS and CDNSKEY records should be generated. ``sync-records`` is a
comma-separated string with the following allowed items: ``cdnskey``, and ``cds:<digest-type>``,
where ``digest-type`` is an allowed algorithm such as SHA-256 (2), or SHA-384 (4).
Only works in combination with smart signing (``-S``).
.. option:: -K directory
This option specifies the directory to search for DNSSEC keys. If not
-2
View File
@@ -20,14 +20,12 @@
#include <isc/attributes.h>
#include <isc/base32.h>
#include <isc/commandline.h>
#include <isc/event.h>
#include <isc/file.h>
#include <isc/hash.h>
#include <isc/hex.h>
#include <isc/mem.h>
#include <isc/mutex.h>
#include <isc/os.h>
#include <isc/print.h>
#include <isc/random.h>
#include <isc/result.h>
#include <isc/rwlock.h>
+5 -4
View File
@@ -29,7 +29,6 @@
#include <isc/heap.h>
#include <isc/list.h>
#include <isc/mem.h>
#include <isc/print.h>
#include <isc/result.h>
#include <isc/string.h>
#include <isc/time.h>
@@ -315,7 +314,8 @@ strtotime(const char *str, int64_t now, int64_t base, bool *setp) {
*/
n = strspn(str, "0123456789");
if ((n == 8u || n == 14u) &&
(str[n] == '\0' || str[n] == '-' || str[n] == '+')) {
(str[n] == '\0' || str[n] == '-' || str[n] == '+'))
{
char timestr[15];
strlcpy(timestr, str, sizeof(timestr));
@@ -331,7 +331,8 @@ strtotime(const char *str, int64_t now, int64_t base, bool *setp) {
base = val;
str += n;
} else if (n == 10u &&
(str[n] == '\0' || str[n] == '-' || str[n] == '+')) {
(str[n] == '\0' || str[n] == '-' || str[n] == '+'))
{
base = strtoll(str, &endp, 0);
str += 10;
} else if (strncmp(str, "now", 3) == 0) {
@@ -406,7 +407,7 @@ cmp_dtype(const void *ap, const void *bp) {
void
add_dtype(unsigned int dt) {
unsigned i, n;
unsigned int i, n;
/* ensure there is space for a zero terminator */
n = sizeof(dtype) / sizeof(dtype[0]) - 1;
+7 -3
View File
@@ -7,13 +7,13 @@ AM_CPPFLAGS += \
$(LIBNS_CFLAGS) \
$(LIBISCCC_CFLAGS) \
$(LIBISCCFG_CFLAGS) \
$(LIBBIND9_CFLAGS) \
$(OPENSSL_CFLAGS) \
$(LIBCAP_CFLAGS) \
$(LMDB_CFLAGS) \
$(MAXMINDDB_CFLAGS) \
$(DNSTAP_CFLAGS) \
$(LIBUV_CFLAGS) \
$(LIBSYSTEMD_CFLAGS) \
$(ZLIB_CFLAGS)
if HAVE_JSON_C
@@ -102,14 +102,13 @@ named_LDADD = \
$(LIBNS_LIBS) \
$(LIBISCCC_LIBS) \
$(LIBISCCFG_LIBS) \
$(LIBBIND9_LIBS) \
$(OPENSSL_LIBS) \
$(LIBCAP_LIBS) \
$(LMDB_LIBS) \
$(MAXMINDDB_LIBS) \
$(DNSTAP_LIBS) \
$(LIBUV_LIBS) \
$(LIBXML2_LIBS) \
$(LIBSYSTEMD_LIBS) \
$(ZLIB_LIBS)
if HAVE_JSON_C
@@ -121,3 +120,8 @@ if HAVE_LIBNGHTTP2
named_LDADD += \
$(LIBNGHTTP2_LIBS)
endif HAVE_LIBNGHTTP2
if HAVE_LIBXML2
named_LDADD += \
$(LIBXML2_LIBS)
endif HAVE_LIBXML2
+1 -124
View File
@@ -15,7 +15,7 @@
<xsl:output method="html" indent="yes" version="4.0"/>
<!-- the version number **below** must match version in bin/named/statschannel.c -->
<!-- don't forget to update "/xml/v<STATS_XML_VERSION_MAJOR>" in the HTTP endpoints listed below -->
<xsl:template match="statistics[@version=&quot;3.12&quot;]">
<xsl:template match="statistics[@version=&quot;3.14&quot;]">
<html>
<head>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
@@ -156,29 +156,6 @@
background-color: #99ddff;
}
table.tasks {
border: 1px solid grey;
width: 500px;
}
table.tasks th {
text-align: center;
border: 1px solid grey;
width: 150px;
}
table.tasks td {
text-align: right;
font-family: monospace;
}
table.tasks td:nth-child(2) {
text-align: center;
}
table.tasks td:nth-child(4) {
text-align: center;
}
table.tasks tr:hover{
background-color: #99ddff;
}
table.netstat {
border: 1px solid grey;
width: 500px;
@@ -327,7 +304,6 @@
<a href="/xml/v3/server">Server</a>,
<a href="/xml/v3/zones">Zones</a>,
<a href="/xml/v3/net">Network</a>,
<a href="/xml/v3/tasks">Tasks</a>,
<a href="/xml/v3/mem">Memory</a> and
<a href="/xml/v3/traffic">Traffic Size</a></p>
<hr/>
@@ -931,85 +907,6 @@
</xsl:for-each>
</xsl:for-each>
</xsl:if>
<xsl:if test="taskmgr/thread-model/type">
<h2>Task Manager Configuration</h2>
<table class="counters">
<tr>
<th class="even">Thread-Model</th>
<td>
<xsl:value-of select="taskmgr/thread-model/type"/>
</td>
</tr>
<tr class="odd">
<th>Worker Threads</th>
<td>
<xsl:value-of select="taskmgr/thread-model/worker-threads"/>
</td>
</tr>
<tr class="even">
<th>Default Quantum</th>
<td>
<xsl:value-of select="taskmgr/thread-model/default-quantum"/>
</td>
</tr>
<tr class="odd">
<th>Tasks Running</th>
<td>
<xsl:value-of select="taskmgr/thread-model/tasks-running"/>
</td>
</tr>
<tr class="even">
<th>Tasks Ready</th>
<td>
<xsl:value-of select="taskmgr/thread-model/tasks-ready"/>
</td>
</tr>
</table>
<br/>
</xsl:if>
<xsl:if test="taskmgr/tasks/task">
<h2>Tasks</h2>
<table class="tasks">
<tr>
<th>ID</th>
<th>Name</th>
<th>References</th>
<th>State</th>
<th>Quantum</th>
<th>Events</th>
</tr>
<xsl:for-each select="taskmgr/tasks/task">
<xsl:sort select="name"/>
<xsl:variable name="css-class14">
<xsl:choose>
<xsl:when test="position() mod 2 = 0">even</xsl:when>
<xsl:otherwise>odd</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<tr class="{$css-class14}">
<td>
<xsl:value-of select="id"/>
</td>
<td>
<xsl:value-of select="name"/>
</td>
<td>
<xsl:value-of select="references"/>
</td>
<td>
<xsl:value-of select="state"/>
</td>
<td>
<xsl:value-of select="quantum"/>
</td>
<td>
<xsl:value-of select="events"/>
</td>
</tr>
</xsl:for-each>
</table>
<br/>
</xsl:if>
<xsl:if test="memory/summary">
<h2>Memory Usage Summary</h2>
<table class="counters">
@@ -1039,12 +936,7 @@
<th>ID</th>
<th>Name</th>
<th>References</th>
<th>TotalUse</th>
<th>InUse</th>
<th>MaxUse</th>
<th>Malloced</th>
<th>MaxMalloced</th>
<th>BlockSize</th>
<th>Pools</th>
<th>HiWater</th>
<th>LoWater</th>
@@ -1067,24 +959,9 @@
<td>
<xsl:value-of select="references"/>
</td>
<td>
<xsl:value-of select="total"/>
</td>
<td>
<xsl:value-of select="inuse"/>
</td>
<td>
<xsl:value-of select="maxinuse"/>
</td>
<td>
<xsl:value-of select="malloced"/>
</td>
<td>
<xsl:value-of select="maxmalloced"/>
</td>
<td>
<xsl:value-of select="blocksize"/>
</td>
<td>
<xsl:value-of select="pools"/>
</td>
+906 -269
View File
File diff suppressed because it is too large Load Diff
+93 -220
View File
@@ -49,17 +49,12 @@ static char defaultconf[] = "\
options {\n\
answer-cookie true;\n\
automatic-interface-scan yes;\n\
bindkeys-file \"" NAMED_SYSCONFDIR "/bind.keys\";\n\
# blackhole {none;};\n"
" cookie-algorithm siphash24;\n"
" coresize default;\n\
datasize default;\n"
"\
# blackhole {none;};\n\
cookie-algorithm siphash24;\n\
# directory <none>\n\
dnssec-policy \"none\";\n\
dump-file \"named_dump.db\";\n\
edns-udp-size 1232;\n\
files unlimited;\n"
edns-udp-size 1232;\n"
#if defined(HAVE_GEOIP2)
"\
geoip-directory \"" MAXMINDDB_PREFIX "/share/GeoIP\";\n"
@@ -105,7 +100,6 @@ options {\n\
recursing-file \"named.recursing\";\n\
recursive-clients 1000;\n\
request-nsid false;\n\
reserved-sockets 512;\n\
resolver-query-timeout 10;\n\
rrset-order { order random; };\n\
secroots-file \"named.secroots\";\n\
@@ -115,7 +109,6 @@ options {\n\
session-keyalg hmac-sha256;\n\
# session-keyfile \"" NAMED_LOCALSTATEDIR "/run/named/session.key\";\n\
session-keyname local-ddns;\n\
stacksize default;\n\
startup-notify-rate 20;\n\
statistics-file \"named.stats\";\n\
tcp-advertised-timeout 300;\n\
@@ -136,6 +129,7 @@ options {\n\
trust-anchor-telemetry yes;\n\
udp-receive-buffer 0;\n\
udp-send-buffer 0;\n\
update-quota 100;\n\
\n\
/* view */\n\
allow-new-zones no;\n\
@@ -152,6 +146,7 @@ options {\n\
check-names response ignore;\n\
check-names secondary warn;\n\
check-spf warn;\n\
check-svcb yes;\n\
clients-per-query 10;\n\
dnssec-accept-expired no;\n\
dnssec-validation " VALIDATION_DEFAULT "; \n"
@@ -212,8 +207,6 @@ options {\n\
allow-query-on {any;};\n\
allow-transfer {any;};\n\
# also-notify <none>\n\
alt-transfer-source *;\n\
alt-transfer-source-v6 *;\n\
check-integrity yes;\n\
check-mx-cname warn;\n\
check-sibling yes;\n\
@@ -222,7 +215,6 @@ options {\n\
dialup no;\n\
dnssec-dnskey-kskonly yes;\n\
dnssec-loadkeys-interval 60;\n\
dnssec-secure-to-insecure no;\n\
dnssec-update-mode maintain;\n\
# forward <none>\n\
# forwarders <none>\n\
@@ -302,6 +294,7 @@ dnssec-policy \"default\" {\n\
csk key-directory lifetime unlimited algorithm 13;\n\
};\n\
\n\
cds-digest-types { 2; };\n\
dnskey-ttl " DNS_KASP_KEY_TTL ";\n\
publish-safety " DNS_KASP_PUBLISH_SAFETY "; \n\
retire-safety " DNS_KASP_RETIRE_SAFETY "; \n\
@@ -394,7 +387,8 @@ named_checknames_get(const cfg_obj_t **maps, const char *const names[],
for (i = 0; maps[i] != NULL; i++) {
checknames = NULL;
if (cfg_map_get(maps[i], "check-names", &checknames) ==
ISC_R_SUCCESS) {
ISC_R_SUCCESS)
{
/*
* Zone map entry is not a list.
*/
@@ -410,7 +404,8 @@ named_checknames_get(const cfg_obj_t **maps, const char *const names[],
for (size_t j = 0; names[j] != NULL; j++) {
if (strcasecmp(cfg_obj_asstring(type),
names[j]) == 0) {
names[j]) == 0)
{
*obj = cfg_tuple_get(value,
"mode");
return (ISC_R_SUCCESS);
@@ -483,7 +478,8 @@ named_config_getzonetype(const cfg_obj_t *zonetypeobj) {
if (strcasecmp(str, "primary") == 0 || strcasecmp(str, "master") == 0) {
ztype = dns_zone_primary;
} else if (strcasecmp(str, "secondary") == 0 ||
strcasecmp(str, "slave") == 0) {
strcasecmp(str, "slave") == 0)
{
ztype = dns_zone_secondary;
} else if (strcasecmp(str, "mirror") == 0) {
ztype = dns_zone_mirror;
@@ -499,109 +495,6 @@ named_config_getzonetype(const cfg_obj_t *zonetypeobj) {
return (ztype);
}
isc_result_t
named_config_getiplist(const cfg_obj_t *config, const cfg_obj_t *list,
in_port_t defport, isc_mem_t *mctx,
isc_sockaddr_t **addrsp, isc_dscp_t **dscpsp,
uint32_t *countp) {
int count, i = 0;
const cfg_obj_t *addrlist;
const cfg_obj_t *portobj, *dscpobj;
const cfg_listelt_t *element;
isc_sockaddr_t *addrs;
in_port_t port;
isc_dscp_t dscp = -1, *dscps = NULL;
isc_result_t result;
INSIST(addrsp != NULL && *addrsp == NULL);
INSIST(dscpsp == NULL || *dscpsp == NULL);
INSIST(countp != NULL);
addrlist = cfg_tuple_get(list, "addresses");
count = named_config_listcount(addrlist);
portobj = cfg_tuple_get(list, "port");
if (cfg_obj_isuint32(portobj)) {
uint32_t val = cfg_obj_asuint32(portobj);
if (val > UINT16_MAX) {
cfg_obj_log(portobj, named_g_lctx, ISC_LOG_ERROR,
"port '%u' out of range", val);
return (ISC_R_RANGE);
}
port = (in_port_t)val;
} else if (defport != 0) {
port = defport;
} else {
result = named_config_getport(config, "port", &port);
if (result != ISC_R_SUCCESS) {
return (result);
}
}
if (dscpsp != NULL) {
dscpobj = cfg_tuple_get(list, "dscp");
if (dscpobj != NULL && cfg_obj_isuint32(dscpobj)) {
if (cfg_obj_asuint32(dscpobj) > 63) {
cfg_obj_log(dscpobj, named_g_lctx,
ISC_LOG_ERROR,
"dscp value '%u' is out of range",
cfg_obj_asuint32(dscpobj));
return (ISC_R_RANGE);
}
dscp = (isc_dscp_t)cfg_obj_asuint32(dscpobj);
}
dscps = isc_mem_get(mctx, count * sizeof(isc_dscp_t));
}
addrs = isc_mem_get(mctx, count * sizeof(isc_sockaddr_t));
for (element = cfg_list_first(addrlist); element != NULL;
element = cfg_list_next(element), i++)
{
const cfg_obj_t *addr;
INSIST(i < count);
addr = cfg_listelt_value(element);
addrs[i] = *cfg_obj_assockaddr(addr);
if (dscpsp != NULL) {
isc_dscp_t innerdscp;
innerdscp = cfg_obj_getdscp(addr);
if (innerdscp == -1) {
innerdscp = dscp;
}
dscps[i] = innerdscp;
}
if (isc_sockaddr_getport(&addrs[i]) == 0) {
isc_sockaddr_setport(&addrs[i], port);
}
}
INSIST(i == count);
*addrsp = addrs;
*countp = count;
if (dscpsp != NULL) {
*dscpsp = dscps;
}
return (ISC_R_SUCCESS);
}
void
named_config_putiplist(isc_mem_t *mctx, isc_sockaddr_t **addrsp,
isc_dscp_t **dscpsp, uint32_t count) {
INSIST(addrsp != NULL && *addrsp != NULL);
INSIST(dscpsp == NULL || *dscpsp != NULL);
isc_mem_put(mctx, *addrsp, count * sizeof(isc_sockaddr_t));
*addrsp = NULL;
if (dscpsp != NULL) {
isc_mem_put(mctx, *dscpsp, count * sizeof(isc_dscp_t));
*dscpsp = NULL;
}
}
static isc_result_t
getremotesdef(const cfg_obj_t *cctx, const char *list, const char *name,
const cfg_obj_t **ret) {
@@ -621,7 +514,8 @@ getremotesdef(const cfg_obj_t *cctx, const char *list, const char *name,
while (elt != NULL) {
obj = cfg_listelt_value(elt);
if (strcasecmp(cfg_obj_asstring(cfg_tuple_get(obj, "name")),
name) == 0) {
name) == 0)
{
*ret = obj;
return (ISC_R_SUCCESS);
}
@@ -681,65 +575,58 @@ named_config_getname(isc_mem_t *mctx, const cfg_obj_t *obj,
return (ISC_R_SUCCESS);
}
#define grow_array(mctx, array, newlen, oldlen) \
if (newlen >= oldlen) { \
size_t newsize = (newlen + 16) * sizeof(array[0]); \
size_t oldsize = oldlen * sizeof(array[0]); \
void *tmp = isc_mem_get(mctx, newsize); \
memset(tmp, 0, newsize); \
if (oldlen != 0) { \
memmove(tmp, array, oldsize); \
isc_mem_put(mctx, array, oldsize); \
} \
array = tmp; \
oldlen = newlen + 16; \
#define grow_array(mctx, array, newlen, oldlen) \
if (newlen >= oldlen) { \
size_t newsize = (newlen + 16) * sizeof(array[0]); \
size_t oldsize = oldlen * sizeof(array[0]); \
array = isc_mem_regetx(mctx, array, oldsize, newsize, \
ISC_MEM_ZERO); \
oldlen = newlen + 16; \
}
#define shrink_array(mctx, array, newlen, oldlen) \
if (newlen < oldlen) { \
void *tmp = NULL; \
size_t newsize = newlen * sizeof(array[0]); \
size_t oldsize = oldlen * sizeof(array[0]); \
if (newlen != 0) { \
tmp = isc_mem_get(mctx, newsize); \
memset(tmp, 0, newsize); \
memmove(tmp, array, newsize); \
} else { \
tmp = NULL; \
} \
isc_mem_put(mctx, array, oldsize); \
array = tmp; \
oldlen = newlen; \
#define shrink_array(mctx, array, newlen, oldlen) \
if (newlen < oldlen) { \
size_t newsize = newlen * sizeof(array[0]); \
size_t oldsize = oldlen * sizeof(array[0]); \
array = isc_mem_regetx(mctx, array, oldsize, newsize, \
ISC_MEM_ZERO); \
oldlen = newlen; \
}
isc_result_t
named_config_getipandkeylist(const cfg_obj_t *config, const char *listtype,
const cfg_obj_t *list, isc_mem_t *mctx,
dns_ipkeylist_t *ipkl) {
uint32_t addrcount = 0, dscpcount = 0, keycount = 0, tlscount = 0,
i = 0;
uint32_t listcount = 0, l = 0, j;
uint32_t addrcount = 0, srccount = 0;
uint32_t keycount = 0, tlscount = 0;
uint32_t listcount = 0, l = 0, i = 0;
uint32_t stackcount = 0, pushed = 0;
isc_result_t result;
const cfg_listelt_t *element;
const cfg_obj_t *addrlist;
const cfg_obj_t *portobj;
const cfg_obj_t *dscpobj;
const cfg_obj_t *src4obj;
const cfg_obj_t *src6obj;
in_port_t port = (in_port_t)0;
in_port_t def_port;
in_port_t def_tlsport;
isc_dscp_t dscp = -1;
isc_sockaddr_t src4;
isc_sockaddr_t src6;
isc_sockaddr_t *addrs = NULL;
isc_dscp_t *dscps = NULL;
isc_sockaddr_t *sources = NULL;
dns_name_t **keys = NULL;
dns_name_t **tlss = NULL;
struct {
const char *name;
in_port_t port;
isc_sockaddr_t *src4s;
isc_sockaddr_t *src6s;
} *lists = NULL;
struct {
const cfg_listelt_t *element;
in_port_t port;
isc_dscp_t dscp;
isc_sockaddr_t src4;
isc_sockaddr_t src6;
} *stack = NULL;
REQUIRE(ipkl != NULL);
@@ -747,7 +634,6 @@ named_config_getipandkeylist(const cfg_obj_t *config, const char *listtype,
REQUIRE(ipkl->addrs == NULL);
REQUIRE(ipkl->keys == NULL);
REQUIRE(ipkl->tlss == NULL);
REQUIRE(ipkl->dscps == NULL);
REQUIRE(ipkl->labels == NULL);
REQUIRE(ipkl->allocated == 0);
@@ -764,15 +650,11 @@ named_config_getipandkeylist(const cfg_obj_t *config, const char *listtype,
goto cleanup;
}
result = named_config_getdscp(config, &dscp);
if (result != ISC_R_SUCCESS) {
goto cleanup;
}
newlist:
addrlist = cfg_tuple_get(list, "addresses");
portobj = cfg_tuple_get(list, "port");
dscpobj = cfg_tuple_get(list, "dscp");
src4obj = cfg_tuple_get(list, "source");
src6obj = cfg_tuple_get(list, "source-v6");
if (cfg_obj_isuint32(portobj)) {
uint32_t val = cfg_obj_asuint32(portobj);
@@ -785,15 +667,16 @@ newlist:
port = (in_port_t)val;
}
if (dscpobj != NULL && cfg_obj_isuint32(dscpobj)) {
if (cfg_obj_asuint32(dscpobj) > 63) {
cfg_obj_log(dscpobj, named_g_lctx, ISC_LOG_ERROR,
"dscp value '%u' is out of range",
cfg_obj_asuint32(dscpobj));
result = ISC_R_RANGE;
goto cleanup;
}
dscp = (isc_dscp_t)cfg_obj_asuint32(dscpobj);
if (src4obj != NULL && cfg_obj_issockaddr(src4obj)) {
src4 = *cfg_obj_assockaddr(src4obj);
} else {
isc_sockaddr_any(&src4);
}
if (src6obj != NULL && cfg_obj_issockaddr(src6obj)) {
src6 = *cfg_obj_assockaddr(src6obj);
} else {
isc_sockaddr_any6(&src6);
}
result = ISC_R_NOMEMORY;
@@ -813,6 +696,7 @@ resume:
if (!cfg_obj_issockaddr(addr)) {
const char *listname = cfg_obj_asstring(addr);
isc_result_t tresult;
uint32_t j;
/* Grow lists? */
grow_array(mctx, lists, l, listcount);
@@ -849,21 +733,18 @@ resume:
*/
stack[pushed].element = cfg_list_next(element);
stack[pushed].port = port;
stack[pushed].dscp = dscp;
stack[pushed].src4 = src4;
stack[pushed].src6 = src6;
pushed++;
goto newlist;
}
grow_array(mctx, addrs, i, addrcount);
grow_array(mctx, dscps, i, dscpcount);
grow_array(mctx, keys, i, keycount);
grow_array(mctx, tlss, i, tlscount);
grow_array(mctx, sources, i, srccount);
addrs[i] = *cfg_obj_assockaddr(addr);
dscps[i] = cfg_obj_getdscp(addr);
if (dscps[i] == -1) {
dscps[i] = dscp;
}
result = named_config_getname(mctx, key, &keys[i]);
if (result != ISC_R_SUCCESS) {
@@ -879,32 +760,51 @@ resume:
goto cleanup;
}
/* Set the default port or tls-port */
if (port == 0) {
if (tlss[i] != NULL) {
port = def_tlsport;
} else {
port = def_port;
/* If the port is unset, take it from one of the upper levels */
if (isc_sockaddr_getport(&addrs[i]) == 0) {
in_port_t addr_port = port;
/* If unset, use the default port or tls-port */
if (addr_port == 0) {
if (tlss[i] != NULL) {
addr_port = def_tlsport;
} else {
addr_port = def_port;
}
}
isc_sockaddr_setport(&addrs[i], addr_port);
}
if (isc_sockaddr_getport(&addrs[i]) == 0) {
isc_sockaddr_setport(&addrs[i], port);
switch (isc_sockaddr_pf(&addrs[i])) {
case PF_INET:
sources[i] = src4;
break;
case PF_INET6:
sources[i] = src6;
break;
default:
i++; /* Increment here so that cleanup on error works.
*/
result = ISC_R_NOTIMPLEMENTED;
goto cleanup;
}
i++;
}
if (pushed != 0) {
pushed--;
element = stack[pushed].element;
port = stack[pushed].port;
dscp = stack[pushed].dscp;
src4 = stack[pushed].src4;
src6 = stack[pushed].src6;
goto resume;
}
shrink_array(mctx, addrs, i, addrcount);
shrink_array(mctx, dscps, i, dscpcount);
shrink_array(mctx, keys, i, keycount);
shrink_array(mctx, tlss, i, tlscount);
shrink_array(mctx, sources, i, srccount);
if (lists != NULL) {
isc_mem_put(mctx, lists, listcount * sizeof(lists[0]));
@@ -913,15 +813,14 @@ resume:
isc_mem_put(mctx, stack, stackcount * sizeof(stack[0]));
}
INSIST(dscpcount == addrcount);
INSIST(keycount == addrcount);
INSIST(tlscount == addrcount);
INSIST(keycount == dscpcount);
INSIST(srccount == addrcount);
ipkl->addrs = addrs;
ipkl->dscps = dscps;
ipkl->keys = keys;
ipkl->tlss = tlss;
ipkl->sources = sources;
ipkl->count = addrcount;
ipkl->allocated = addrcount;
@@ -931,11 +830,8 @@ cleanup:
if (addrs != NULL) {
isc_mem_put(mctx, addrs, addrcount * sizeof(addrs[0]));
}
if (dscps != NULL) {
isc_mem_put(mctx, dscps, dscpcount * sizeof(dscps[0]));
}
if (keys != NULL) {
for (j = 0; j < i; j++) {
for (size_t j = 0; j < i; j++) {
if (keys[j] == NULL) {
continue;
}
@@ -947,7 +843,7 @@ cleanup:
isc_mem_put(mctx, keys, keycount * sizeof(keys[0]));
}
if (tlss != NULL) {
for (j = 0; j < i; j++) {
for (size_t j = 0; j < i; j++) {
if (tlss[j] == NULL) {
continue;
}
@@ -958,6 +854,9 @@ cleanup:
}
isc_mem_put(mctx, tlss, tlscount * sizeof(tlss[0]));
}
if (sources != NULL) {
isc_mem_put(mctx, sources, srccount * sizeof(sources[0]));
}
if (lists != NULL) {
isc_mem_put(mctx, lists, listcount * sizeof(lists[0]));
}
@@ -996,32 +895,6 @@ named_config_getport(const cfg_obj_t *config, const char *type,
return (ISC_R_SUCCESS);
}
isc_result_t
named_config_getdscp(const cfg_obj_t *config, isc_dscp_t *dscpp) {
const cfg_obj_t *options = NULL;
const cfg_obj_t *dscpobj = NULL;
isc_result_t result;
(void)cfg_map_get(config, "options", &options);
if (options == NULL) {
return (ISC_R_SUCCESS);
}
result = cfg_map_get(options, "dscp", &dscpobj);
if (result != ISC_R_SUCCESS || dscpobj == NULL) {
*dscpp = -1;
return (ISC_R_SUCCESS);
}
if (cfg_obj_asuint32(dscpobj) >= 64) {
cfg_obj_log(dscpobj, named_g_lctx, ISC_LOG_ERROR,
"dscp '%u' out of range",
cfg_obj_asuint32(dscpobj));
return (ISC_R_RANGE);
}
*dscpp = (isc_dscp_t)cfg_obj_asuint32(dscpobj);
return (ISC_R_SUCCESS);
}
struct keyalgorithms {
const char *str;
enum {
+1 -5
View File
@@ -15,7 +15,6 @@
#include <stdbool.h>
#include <isc/event.h>
#include <isc/lex.h>
#include <isc/mem.h>
#include <isc/result.h>
@@ -97,10 +96,7 @@ named_control_docommand(isccc_sexpr_t *message, bool readonly,
return (result);
}
result = isc_lex_create(named_g_mctx, strlen(cmdline), &lex);
if (result != ISC_R_SUCCESS) {
return (result);
}
isc_lex_create(named_g_mctx, strlen(cmdline), &lex);
isc_buffer_init(&src, cmdline, strlen(cmdline));
isc_buffer_add(&src, strlen(cmdline));
+11 -20
View File
@@ -16,9 +16,9 @@
#include <inttypes.h>
#include <stdbool.h>
#include <isc/async.h>
#include <isc/base64.h>
#include <isc/buffer.h>
#include <isc/event.h>
#include <isc/file.h>
#include <isc/mem.h>
#include <isc/mutex.h>
@@ -30,21 +30,18 @@
#include <isc/result.h>
#include <isc/stdtime.h>
#include <isc/string.h>
#include <isc/task.h>
#include <isc/util.h>
#include <isccc/alist.h>
#include <isccc/cc.h>
#include <isccc/ccmsg.h>
#include <isccc/events.h>
#include <isccc/sexpr.h>
#include <isccc/symtab.h>
#include <isccc/util.h>
#include <isccfg/check.h>
#include <isccfg/namedconf.h>
#include <bind9/check.h>
#include <named/config.h>
#include <named/control.h>
#include <named/log.h>
@@ -375,24 +372,19 @@ cleanup:
}
static void
control_command(isc_task_t *task, isc_event_t *event) {
controlconnection_t *conn = event->ev_arg;
control_command(void *arg) {
controlconnection_t *conn = (controlconnection_t *)arg;
controllistener_t *listener = conn->listener;
UNUSED(task);
if (atomic_load_acquire(&listener->controls->shuttingdown)) {
conn_cleanup(conn);
isc_nmhandle_detach(&conn->cmdhandle);
goto done;
return;
}
conn->result = named_control_docommand(conn->request,
listener->readonly, &conn->text);
control_respond(conn->cmdhandle, conn);
done:
isc_event_free(&event);
}
static void
@@ -400,7 +392,6 @@ control_recvmessage(isc_nmhandle_t *handle, isc_result_t result, void *arg) {
controlconnection_t *conn = (controlconnection_t *)arg;
controllistener_t *listener = conn->listener;
controlkey_t *key = NULL;
isc_event_t *event = NULL;
isccc_time_t sent;
isccc_time_t exp;
uint32_t nonce;
@@ -469,7 +460,8 @@ control_recvmessage(isc_nmhandle_t *handle, isc_result_t result, void *arg) {
if (isccc_cc_lookupuint32(conn->ctrl, "_tim", &sent) == ISC_R_SUCCESS) {
if ((sent + CLOCKSKEW) < conn->now ||
(sent - CLOCKSKEW) > conn->now) {
(sent - CLOCKSKEW) > conn->now)
{
log_invalid(&conn->ccmsg, ISCCC_R_CLOCKSKEW);
goto cleanup;
}
@@ -534,9 +526,7 @@ control_recvmessage(isc_nmhandle_t *handle, isc_result_t result, void *arg) {
* Trigger the command.
*/
event = isc_event_allocate(listener->mctx, conn, NAMED_EVENT_COMMAND,
control_command, conn, sizeof(isc_event_t));
isc_task_send(named_g_server->task, &event);
isc_async_run(named_g_mainloop, control_command, conn);
return;
@@ -848,7 +838,7 @@ get_rndckey(isc_mem_t *mctx, controlkeylist_t *keyids) {
CHECK(ISC_R_NOMEMORY);
}
CHECK(bind9_check_key(key, named_g_lctx));
CHECK(isccfg_check_key(key, named_g_lctx));
(void)cfg_map_get(key, "algorithm", &algobj);
(void)cfg_map_get(key, "secret", &secretobj);
@@ -916,7 +906,8 @@ get_key_info(const cfg_obj_t *config, const cfg_obj_t *control,
control_keylist = cfg_tuple_get(control, "keys");
if (!cfg_obj_isvoid(control_keylist) &&
cfg_list_first(control_keylist) != NULL) {
cfg_list_first(control_keylist) != NULL)
{
result = cfg_map_get(config, "key", &global_keylist);
if (result == ISC_R_SUCCESS) {
+6 -9
View File
@@ -18,7 +18,6 @@
#include <string.h>
#include <isc/mem.h>
#include <isc/print.h>
#include <isc/result.h>
#include <isc/util.h>
#include <isc/uv.h>
@@ -225,12 +224,11 @@ dlopen_dlz_create(const char *dlzname, unsigned int argc, char *argv[],
isc_mem_create(&mctx);
cd = isc_mem_get(mctx, sizeof(*cd));
memset(cd, 0, sizeof(*cd));
cd->mctx = mctx;
cd->dl_path = isc_mem_strdup(cd->mctx, argv[1]);
cd->dlzname = isc_mem_strdup(cd->mctx, dlzname);
*cd = (dlopen_data_t){
.mctx = mctx,
.dl_path = isc_mem_strdup(mctx, argv[1]),
.dlzname = isc_mem_strdup(mctx, dlzname),
};
/* Initialize the lock */
isc_mutex_init(&cd->lock);
@@ -532,8 +530,7 @@ dlz_dlopen_init(isc_mem_t *mctx) {
mctx, &dlz_dlopen);
if (result != ISC_R_SUCCESS) {
UNEXPECTED_ERROR(__FILE__, __LINE__,
"dns_sdlzregister() failed: %s",
UNEXPECTED_ERROR("dns_sdlzregister() failed: %s",
isc_result_totext(result));
result = ISC_R_UNEXPECTED;
}
-1
View File
@@ -18,7 +18,6 @@
#endif /* if defined(HAVE_GEOIP2) */
#include <isc/dir.h>
#include <isc/print.h>
#include <isc/string.h>
#include <isc/util.h>
+11
View File
@@ -15,8 +15,19 @@
/*! \file */
#include <inttypes.h>
#include <isc/lang.h>
#include <isc/types.h>
#include <dns/clientinfo.h>
#include <dns/types.h>
/***
*** Functions
***/
/* Initialization functions for builtin zone databases */
isc_result_t
named_builtin_init(void);
-13
View File
@@ -52,16 +52,6 @@ named_config_gettype(const cfg_obj_t *typeobj, dns_rdatatype_t deftype,
dns_zonetype_t
named_config_getzonetype(const cfg_obj_t *zonetypeobj);
isc_result_t
named_config_getiplist(const cfg_obj_t *config, const cfg_obj_t *list,
in_port_t defport, isc_mem_t *mctx,
isc_sockaddr_t **addrsp, isc_dscp_t **dscpsp,
uint32_t *countp);
void
named_config_putiplist(isc_mem_t *mctx, isc_sockaddr_t **addrsp,
isc_dscp_t **dscpsp, uint32_t count);
isc_result_t
named_config_getremotesdef(const cfg_obj_t *cctx, const char *list,
const char *name, const cfg_obj_t **ret);
@@ -81,6 +71,3 @@ named_config_getkeyalgorithm(const char *str, const dns_name_t **name,
isc_result_t
named_config_getkeyalgorithm2(const char *str, const dns_name_t **name,
unsigned int *typep, uint16_t *digestbits);
isc_result_t
named_config_getdscp(const cfg_obj_t *config, isc_dscp_t *dscpp);
+1 -11
View File
@@ -50,7 +50,6 @@
EXTERN isc_mem_t *named_g_mctx INIT(NULL);
EXTERN unsigned int named_g_cpus INIT(0);
EXTERN unsigned int named_g_udpdisp INIT(0);
EXTERN isc_taskmgr_t *named_g_taskmgr INIT(NULL);
EXTERN isc_loop_t *named_g_mainloop INIT(NULL);
EXTERN isc_loopmgr_t *named_g_loopmgr INIT(NULL);
EXTERN dns_dispatchmgr_t *named_g_dispatchmgr INIT(NULL);
@@ -77,7 +76,6 @@ EXTERN in_port_t named_g_port INIT(0);
EXTERN in_port_t named_g_tlsport INIT(0);
EXTERN in_port_t named_g_httpsport INIT(0);
EXTERN in_port_t named_g_httpport INIT(0);
EXTERN isc_dscp_t named_g_dscp INIT(-1);
EXTERN in_port_t named_g_http_listener_clients INIT(0);
EXTERN in_port_t named_g_http_streams_per_conn INIT(0);
@@ -98,7 +96,7 @@ EXTERN unsigned int named_g_debuglevel INIT(0);
EXTERN cfg_obj_t *named_g_config INIT(NULL);
EXTERN const cfg_obj_t *named_g_defaults INIT(NULL);
EXTERN const char *named_g_conffile INIT(NAMED_SYSCONFDIR "/named.conf");
EXTERN const char *named_g_defaultbindkeys INIT(NAMED_SYSCONFDIR "/bind.keys");
EXTERN const char *named_g_defaultbindkeys INIT(NULL);
EXTERN const char *named_g_keyfile INIT(NAMED_SYSCONFDIR "/rndc.key");
EXTERN dns_tsigkey_t *named_g_sessionkey INIT(NULL);
@@ -106,14 +104,6 @@ EXTERN dns_name_t named_g_sessionkeyname;
EXTERN bool named_g_conffileset INIT(false);
EXTERN cfg_aclconfctx_t *named_g_aclconfctx INIT(NULL);
/*
* Initial resource limits.
*/
EXTERN isc_resourcevalue_t named_g_initstacksize INIT(0);
EXTERN isc_resourcevalue_t named_g_initdatasize INIT(0);
EXTERN isc_resourcevalue_t named_g_initcoresize INIT(0);
EXTERN isc_resourcevalue_t named_g_initopenfiles INIT(0);
/*
* Misc.
*/
-3
View File
@@ -62,9 +62,6 @@ named_os_issingleton(const char *filename);
void
named_os_shutdown(void);
isc_result_t
named_os_gethostname(char *buf, size_t len);
void
named_os_shutdownmsg(char *command, isc_buffer_t *text);
-22
View File
@@ -38,14 +38,6 @@
#include <named/types.h>
#define NAMED_EVENTCLASS ISC_EVENTCLASS(0x4E43)
#define NAMED_EVENT_RELOAD (NAMED_EVENTCLASS + 0)
#define NAMED_EVENT_DELZONE (NAMED_EVENTCLASS + 1)
#define NAMED_EVENT_COMMAND (NAMED_EVENTCLASS + 2)
#define NAMED_EVENT_TATSEND (NAMED_EVENTCLASS + 3)
#define NAMED_EVENT_RUN (NAMED_EVENTCLASS + 4)
#define NAMED_EVENT_SHUTDOWN (NAMED_EVENTCLASS + 5)
/*%
* Name server state. Better here than in lots of separate global variables.
*/
@@ -55,8 +47,6 @@ struct named_server {
ns_server_t *sctx;
isc_task_t *task;
char *statsfile; /*%< Statistics file name */
char *dumpfile; /*%< Dump file name */
char *secrootsfile; /*%< Secroots file name */
@@ -139,12 +129,6 @@ named_server_destroy(named_server_t **serverp);
* Destroy a server object, freeing its memory.
*/
void
named_server_shutdown(named_server_t *server);
/*%<
* Initiate the server shutdown.
*/
void
named_server_reloadwanted(void *arg, int signum);
/*%<
@@ -308,12 +292,6 @@ named_server_rekey(named_server_t *server, isc_lex_t *lex, isc_buffer_t **text);
isc_result_t
named_server_dumprecursing(named_server_t *server);
/*%
* Maintain a list of dispatches that require reserved ports.
*/
void
named_add_reserved_dispatch(named_server_t *server, const isc_sockaddr_t *addr);
/*%
* Enable or disable dnssec validation.
*/
+3 -1
View File
@@ -60,6 +60,7 @@ named_log_init(bool safe) {
* Setup a logging context.
*/
isc_mem_create(&log_mctx);
isc_mem_setname(log_mctx, "named_log");
isc_log_create(log_mctx, &named_g_lctx, &lcfg);
isc_mem_detach(&log_mctx);
@@ -201,7 +202,8 @@ named_log_setdefaultsslkeylogfile(isc_logconfig_t *lcfg) {
isc_result_t result;
if (sslkeylogfile_path == NULL ||
strcmp(sslkeylogfile_path, "config") == 0) {
strcmp(sslkeylogfile_path, "config") == 0)
{
return;
}
+4 -6
View File
@@ -17,8 +17,6 @@
#include <stdbool.h>
#include <isc/file.h>
#include <isc/offset.h>
#include <isc/print.h>
#include <isc/result.h>
#include <isc/stdio.h>
#include <isc/string.h>
@@ -146,14 +144,14 @@ channel_fromconf(const cfg_obj_t *channel, isc_logconfig_t *logconfig) {
const cfg_obj_t *suffixobj = cfg_tuple_get(fileobj, "suffix");
int32_t versions = ISC_LOG_ROLLNEVER;
isc_log_rollsuffix_t suffix = isc_log_rollsuffix_increment;
isc_offset_t size = 0;
off_t size = 0;
uint64_t maxoffset;
/*
* isc_offset_t is a signed integer type, so the maximum
* off_t is a signed integer type, so the maximum
* value is all 1s except for the MSB.
*/
switch (sizeof(isc_offset_t)) {
switch (sizeof(off_t)) {
case 4:
maxoffset = 0x7fffffffULL;
break;
@@ -178,7 +176,7 @@ channel_fromconf(const cfg_obj_t *channel, isc_logconfig_t *logconfig) {
if (sizeobj != NULL && cfg_obj_isuint64(sizeobj) &&
cfg_obj_asuint64(sizeobj) < maxoffset)
{
size = (isc_offset_t)cfg_obj_asuint64(sizeobj);
size = (off_t)cfg_obj_asuint64(sizeobj);
}
if (suffixobj != NULL && cfg_obj_isstring(suffixobj) &&
strcasecmp(cfg_obj_asstring(suffixobj), "timestamp") == 0)
+148 -77
View File
@@ -34,16 +34,14 @@
#include <isc/managers.h>
#include <isc/netmgr.h>
#include <isc/os.h>
#include <isc/print.h>
#include <isc/resource.h>
#include <isc/result.h>
#include <isc/signal.h>
#include <isc/stdio.h>
#include <isc/string.h>
#include <isc/task.h>
#include <isc/timer.h>
#include <isc/util.h>
#include <isc/uv.h>
#include <isc/xml.h>
#include <dns/dispatch.h>
#include <dns/dyndb.h>
@@ -110,7 +108,6 @@
#define BACKTRACE_MAXFRAME 128
#endif /* ifndef BACKTRACE_MAXFRAME */
extern int isc_dscp_check_value;
extern unsigned int dns_zone_mkey_hour;
extern unsigned int dns_zone_mkey_day;
extern unsigned int dns_zone_mkey_month;
@@ -240,12 +237,12 @@ assertion_failed(const char *file, int line, isc_assertiontype_t type,
}
noreturn static void
library_fatal_error(const char *file, int line, const char *format,
va_list args) ISC_FORMAT_PRINTF(3, 0);
library_fatal_error(const char *file, int line, const char *func,
const char *format, va_list args) ISC_FORMAT_PRINTF(3, 0);
static void
library_fatal_error(const char *file, int line, const char *format,
va_list args) {
library_fatal_error(const char *file, int line, const char *func,
const char *format, va_list args) {
/*
* Handle isc_error_fatal() calls from our libraries.
*/
@@ -259,7 +256,7 @@ library_fatal_error(const char *file, int line, const char *format,
isc_log_write(named_g_lctx, NAMED_LOGCATEGORY_GENERAL,
NAMED_LOGMODULE_MAIN, ISC_LOG_CRITICAL,
"%s:%d: fatal error:", file, line);
"%s:%d:%s(): fatal error: ", file, line, func);
isc_log_vwrite(named_g_lctx, NAMED_LOGCATEGORY_GENERAL,
NAMED_LOGMODULE_MAIN, ISC_LOG_CRITICAL, format,
args);
@@ -267,7 +264,7 @@ library_fatal_error(const char *file, int line, const char *format,
NAMED_LOGMODULE_MAIN, ISC_LOG_CRITICAL,
"exiting (due to fatal error in library)");
} else {
fprintf(stderr, "%s:%d: fatal error: ", file, line);
fprintf(stderr, "%s:%d:%s(): fatal error: ", file, line, func);
vfprintf(stderr, format, args);
fprintf(stderr, "\n");
fflush(stderr);
@@ -280,12 +277,13 @@ library_fatal_error(const char *file, int line, const char *format,
}
static void
library_unexpected_error(const char *file, int line, const char *format,
va_list args) ISC_FORMAT_PRINTF(3, 0);
library_unexpected_error(const char *file, int line, const char *func,
const char *format, va_list args)
ISC_FORMAT_PRINTF(3, 0);
static void
library_unexpected_error(const char *file, int line, const char *format,
va_list args) {
library_unexpected_error(const char *file, int line, const char *func,
const char *format, va_list args) {
/*
* Handle isc_error_unexpected() calls from our libraries.
*/
@@ -293,12 +291,13 @@ library_unexpected_error(const char *file, int line, const char *format,
if (named_g_lctx != NULL) {
isc_log_write(named_g_lctx, NAMED_LOGCATEGORY_GENERAL,
NAMED_LOGMODULE_MAIN, ISC_LOG_ERROR,
"%s:%d: unexpected error:", file, line);
"%s:%d:%s(): unexpected error: ", file, line,
func);
isc_log_vwrite(named_g_lctx, NAMED_LOGCATEGORY_GENERAL,
NAMED_LOGMODULE_MAIN, ISC_LOG_ERROR, format,
args);
} else {
fprintf(stderr, "%s:%d: fatal error: ", file, line);
fprintf(stderr, "%s:%d:%s(): fatal error: ", file, line, func);
vfprintf(stderr, format, args);
fprintf(stderr, "\n");
fflush(stderr);
@@ -437,7 +436,8 @@ set_flags(const char *arg, struct flag_def *defs, unsigned int *ret) {
arglen = (int)(end - arg);
for (def = defs; def->name != NULL; def++) {
if (arglen == (int)strlen(def->name) &&
memcmp(arg, def->name, arglen) == 0) {
memcmp(arg, def->name, arglen) == 0)
{
if (def->value == 0) {
clear = true;
}
@@ -462,11 +462,106 @@ set_flags(const char *arg, struct flag_def *defs, unsigned int *ret) {
}
}
static void
list_dnssec_algorithms(isc_buffer_t *b) {
for (dst_algorithm_t i = DST_ALG_UNKNOWN; i < DST_MAX_ALGS; i++) {
if (i == DST_ALG_DH || i == DST_ALG_GSSAPI ||
(i >= DST_ALG_HMAC_FIRST && i <= DST_ALG_HMAC_LAST))
{
continue;
}
if (dst_algorithm_supported(i)) {
isc_buffer_putstr(b, " ");
(void)dns_secalg_totext(i, b);
}
}
}
static void
list_ds_algorithms(isc_buffer_t *b) {
for (size_t i = 0; i < 256; i++) {
if (dst_ds_digest_supported(i)) {
isc_buffer_putstr(b, " ");
(void)dns_dsdigest_totext(i, b);
}
}
}
static void
list_hmac_algorithms(isc_buffer_t *b) {
isc_buffer_t sb = *b;
for (dst_algorithm_t i = DST_ALG_HMAC_FIRST; i <= DST_ALG_HMAC_LAST;
i++)
{
if (dst_algorithm_supported(i)) {
isc_buffer_putstr(b, " ");
isc_buffer_putstr(b, dst_hmac_algorithm_totext(i));
}
}
for (unsigned char *s = isc_buffer_used(&sb); s != isc_buffer_used(b);
s++)
{
*s = toupper(*s);
}
}
static void
logit(isc_buffer_t *b) {
isc_log_write(named_g_lctx, NAMED_LOGCATEGORY_GENERAL,
NAMED_LOGMODULE_MAIN, ISC_LOG_NOTICE, "%.*s",
(int)isc_buffer_usedlength(b),
(char *)isc_buffer_base(b));
}
static void
printit(isc_buffer_t *b) {
printf("%.*s\n", (int)isc_buffer_usedlength(b),
(char *)isc_buffer_base(b));
}
static void
format_supported_algorithms(void (*emit)(isc_buffer_t *b)) {
isc_buffer_t b;
char buf[512];
isc_buffer_init(&b, buf, sizeof(buf));
isc_buffer_putstr(&b, "DNSSEC algorithms:");
list_dnssec_algorithms(&b);
(*emit)(&b);
isc_buffer_init(&b, buf, sizeof(buf));
isc_buffer_putstr(&b, "DS algorithms:");
list_ds_algorithms(&b);
(*emit)(&b);
isc_buffer_init(&b, buf, sizeof(buf));
isc_buffer_putstr(&b, "HMAC algorithms:");
list_hmac_algorithms(&b);
(*emit)(&b);
isc_buffer_init(&b, buf, sizeof(buf));
isc_buffer_printf(&b, "TKEY mode 2 support (Diffie-Hellman): %s",
(dst_algorithm_supported(DST_ALG_DH) &&
dst_algorithm_supported(DST_ALG_HMACMD5))
? "yes"
: "non");
(*emit)(&b);
isc_buffer_init(&b, buf, sizeof(buf));
isc_buffer_printf(&b, "TKEY mode 3 support (GSS-API): %s",
dst_algorithm_supported(DST_ALG_GSSAPI) ? "yes"
: "no");
(*emit)(&b);
}
static void
printversion(bool verbose) {
char rndcconf[PATH_MAX], *dot = NULL;
#if defined(HAVE_GEOIP2)
isc_mem_t *mctx = NULL;
isc_result_t result;
isc_buffer_t b;
char buf[512];
#if defined(HAVE_GEOIP2)
cfg_parser_t *parser = NULL;
cfg_obj_t *config = NULL;
const cfg_obj_t *defaults = NULL, *obj = NULL;
@@ -538,7 +633,19 @@ printversion(bool verbose) {
printf("compiled with protobuf-c version: %s\n", PROTOBUF_C_VERSION);
printf("linked to protobuf-c version: %s\n", protobuf_c_version());
#endif /* if defined(HAVE_DNSTAP) */
printf("threads support is enabled\n\n");
printf("threads support is enabled\n");
isc_mem_create(&mctx);
result = dst_lib_init(mctx, named_g_engine);
if (result == ISC_R_SUCCESS) {
isc_buffer_init(&b, buf, sizeof(buf));
format_supported_algorithms(printit);
printf("\n");
dst_lib_destroy();
} else {
printf("DST initialization failure: %s\n",
isc_result_totext(result));
}
/*
* The default rndc.conf and rndc.key paths are in the same
@@ -558,13 +665,11 @@ printversion(bool verbose) {
printf("default paths:\n");
printf(" named configuration: %s\n", named_g_conffile);
printf(" rndc configuration: %s\n", rndcconf);
printf(" DNSSEC root key: %s\n", named_g_defaultbindkeys);
printf(" nsupdate session key: %s\n", named_g_defaultsessionkeyfile);
printf(" named PID file: %s\n", named_g_defaultpidfile);
printf(" named lock file: %s\n", named_g_defaultlockfile);
#if defined(HAVE_GEOIP2)
#define RTC(x) RUNTIME_CHECK((x) == ISC_R_SUCCESS)
isc_mem_create(&mctx);
RTC(cfg_parser_create(mctx, named_g_lctx, &parser));
RTC(named_config_parsedefaults(parser, &config));
RTC(cfg_map_get(config, "options", &defaults));
@@ -608,13 +713,9 @@ parse_T_opt(char *option) {
/*
* force the server to behave (or misbehave) in
* specified ways for testing purposes.
* dscp=x: check that dscp values are as
* expected and assert otherwise.
*/
if (!strcmp(option, "dropedns")) {
dropedns = true;
} else if (!strncmp(option, "dscp=", 5)) {
isc_dscp_check_value = atoi(option + 5);
} else if (!strcmp(option, "ednsformerr")) {
ednsformerr = true;
} else if (!strcmp(option, "ednsnotimp")) {
@@ -924,7 +1025,7 @@ create_managers(void) {
named_g_udpdisp == 1 ? "" : "s");
isc_managers_create(&named_g_mctx, named_g_cpus, &named_g_loopmgr,
&named_g_netmgr, &named_g_taskmgr);
&named_g_netmgr);
isc_nm_maxudp(named_g_netmgr, maxudp);
@@ -934,7 +1035,6 @@ create_managers(void) {
static void
setup(void) {
isc_result_t result;
isc_resourcevalue_t old_openfiles;
ns_server_t *sctx;
#ifdef HAVE_LIBSCF
char *instance = NULL;
@@ -1107,39 +1207,11 @@ setup(void) {
NAMED_LOGMODULE_MAIN, ISC_LOG_NOTICE,
"----------------------------------------------------");
/*
* Get the initial resource limits.
*/
RUNTIME_CHECK(isc_resource_getlimit(isc_resource_stacksize,
&named_g_initstacksize) ==
ISC_R_SUCCESS);
RUNTIME_CHECK(isc_resource_getlimit(isc_resource_datasize,
&named_g_initdatasize) ==
ISC_R_SUCCESS);
RUNTIME_CHECK(isc_resource_getlimit(isc_resource_coresize,
&named_g_initcoresize) ==
ISC_R_SUCCESS);
RUNTIME_CHECK(isc_resource_getlimit(isc_resource_openfiles,
&named_g_initopenfiles) ==
ISC_R_SUCCESS);
/*
* System resources cannot effectively be tuned on some systems.
* Raise the limit in such cases for safety.
*/
old_openfiles = named_g_initopenfiles;
named_os_adjustnofile();
RUNTIME_CHECK(isc_resource_getlimit(isc_resource_openfiles,
&named_g_initopenfiles) ==
ISC_R_SUCCESS);
if (old_openfiles != named_g_initopenfiles) {
isc_log_write(named_g_lctx, NAMED_LOGCATEGORY_GENERAL,
NAMED_LOGMODULE_MAIN, ISC_LOG_NOTICE,
"adjusted limit on open files from "
"%" PRIu64 " to "
"%" PRIu64,
old_openfiles, named_g_initopenfiles);
}
/*
* If the named configuration filename is relative, prepend the current
@@ -1193,6 +1265,12 @@ setup(void) {
ENSURE(named_g_server != NULL);
sctx = named_g_server->sctx;
/*
* Report supported algorithms now that dst_lib_init() has
* been called via named_server_create().
*/
format_supported_algorithms(logit);
/*
* Modify server context according to command line options
*/
@@ -1296,8 +1374,7 @@ named_smf_get_instance(char **ins_name, int debug, isc_mem_t *mctx) {
if ((h = scf_handle_create(SCF_VERSION)) == NULL) {
if (debug) {
UNEXPECTED_ERROR(__FILE__, __LINE__,
"scf_handle_create() failed: %s",
UNEXPECTED_ERROR("scf_handle_create() failed: %s",
scf_strerror(scf_error()));
}
return (ISC_R_FAILURE);
@@ -1305,8 +1382,7 @@ named_smf_get_instance(char **ins_name, int debug, isc_mem_t *mctx) {
if (scf_handle_bind(h) == -1) {
if (debug) {
UNEXPECTED_ERROR(__FILE__, __LINE__,
"scf_handle_bind() failed: %s",
UNEXPECTED_ERROR("scf_handle_bind() failed: %s",
scf_strerror(scf_error()));
}
scf_handle_destroy(h);
@@ -1315,8 +1391,7 @@ named_smf_get_instance(char **ins_name, int debug, isc_mem_t *mctx) {
if ((namelen = scf_myname(h, NULL, 0)) == -1) {
if (debug) {
UNEXPECTED_ERROR(__FILE__, __LINE__,
"scf_myname() failed: %s",
UNEXPECTED_ERROR("scf_myname() failed: %s",
scf_strerror(scf_error()));
}
scf_handle_destroy(h);
@@ -1324,8 +1399,7 @@ named_smf_get_instance(char **ins_name, int debug, isc_mem_t *mctx) {
}
if ((instance = isc_mem_allocate(mctx, namelen + 1)) == NULL) {
UNEXPECTED_ERROR(__FILE__, __LINE__,
"named_smf_get_instance memory "
UNEXPECTED_ERROR("named_smf_get_instance memory "
"allocation failed: %s",
isc_result_totext(ISC_R_NOMEMORY));
scf_handle_destroy(h);
@@ -1334,8 +1408,7 @@ named_smf_get_instance(char **ins_name, int debug, isc_mem_t *mctx) {
if (scf_myname(h, instance, namelen + 1) == -1) {
if (debug) {
UNEXPECTED_ERROR(__FILE__, __LINE__,
"scf_myname() failed: %s",
UNEXPECTED_ERROR("scf_myname() failed: %s",
scf_strerror(scf_error()));
}
scf_handle_destroy(h);
@@ -1362,10 +1435,6 @@ main(int argc, char *argv[]) {
(void)ProfilerStart(NULL);
#endif /* ifdef HAVE_GPERFTOOLS_PROFILER */
#ifdef HAVE_LIBXML2
xmlInitParser();
#endif /* HAVE_LIBXML2 */
/*
* Technically, this call is superfluous because on startup of the main
* program, the portable "C" locale is selected by default. This
@@ -1432,6 +1501,7 @@ main(int argc, char *argv[]) {
setup();
isc_mem_setname(named_g_mctx, "main");
INSIST(named_g_server != NULL);
/*
* Start things running
@@ -1445,8 +1515,7 @@ main(int argc, char *argv[]) {
result = named_smf_get_instance(&instance, 1, named_g_mctx);
if (result == ISC_R_SUCCESS && instance != NULL) {
if (smf_disable_instance(instance, 0) != 0) {
UNEXPECTED_ERROR(__FILE__, __LINE__,
"smf_disable_instance() "
UNEXPECTED_ERROR("smf_disable_instance() "
"failed for %s : %s",
instance,
scf_strerror(scf_error()));
@@ -1473,8 +1542,14 @@ main(int argc, char *argv[]) {
}
}
isc_managers_destroy(&named_g_mctx, &named_g_loopmgr, &named_g_netmgr,
&named_g_taskmgr);
isc_managers_destroy(&named_g_mctx, &named_g_loopmgr, &named_g_netmgr);
#if ENABLE_LEAK_DETECTION
isc__tls_setdestroycheck(true);
isc__uv_setdestroycheck(true);
isc__xml_setdestroycheck(true);
#endif
isc_mem_checkdestroyed(stderr);
named_main_setmemstats(NULL);
@@ -1483,10 +1558,6 @@ main(int argc, char *argv[]) {
named_os_shutdown();
#ifdef HAVE_LIBXML2
xmlCleanupParser();
#endif /* HAVE_LIBXML2 */
#ifdef HAVE_GPERFTOOLS_PROFILER
ProfilerStop();
#endif /* ifdef HAVE_GPERFTOOLS_PROFILER */
+2 -17
View File
@@ -143,22 +143,6 @@ Options
This option is mainly of interest to BIND 9 developers and may be
removed or changed in a future release.
.. option:: -S #max-socks
This option is deprecated and no longer has any function.
.. warning::
This option should be unnecessary for the vast majority of users.
The use of this option could even be harmful, because the specified
value may exceed the limitation of the underlying system API. It
is therefore set only when the default configuration causes
exhaustion of file descriptors and the operational environment is
known to support the specified number of sockets. Note also that
the actual maximum number is normally slightly fewer than the
specified value, because :program:`named` reserves some file descriptors
for its internal use.
.. option:: -t directory
This option tells :program:`named` to chroot to ``directory`` after processing the command-line arguments, but
@@ -203,7 +187,8 @@ Options
.. option:: -V
This option reports the version number and build options, and exits.
This option reports the version number, build options, supported
cryptographics algorithms, and exits.
.. option:: -X lock-file
+185 -89
View File
@@ -14,6 +14,7 @@
/*! \file */
#include <stdarg.h>
#include <stdbool.h>
#include <sys/resource.h>
#include <sys/stat.h>
#include <sys/types.h> /* dev_t FreeBSD 2.1 */
#ifdef HAVE_UNAME
@@ -36,14 +37,13 @@
#include <isc/buffer.h>
#include <isc/file.h>
#include <isc/print.h>
#include <isc/resource.h>
#include <isc/result.h>
#include <isc/strerr.h>
#include <isc/string.h>
#include <isc/util.h>
#include <named/globals.h>
#include <named/log.h>
#include <named/main.h>
#include <named/os.h>
#ifdef HAVE_LIBSCF
@@ -63,7 +63,7 @@ static struct passwd *runas_pw = NULL;
static bool done_setuid = false;
static int dfd[2] = { -1, -1 };
#ifdef HAVE_SYS_CAPABILITY_H
#if HAVE_LIBCAP
static bool non_root = false;
static bool non_root_caps = false;
@@ -249,7 +249,137 @@ linux_keepcaps(void) {
}
}
#endif /* HAVE_SYS_CAPABILITY_H */
#endif /* HAVE_LIBCAP */
/*
* First define compatibility shims if {set,get}res{uid,gid} are not available
*/
#if !HAVE_GETRESGID
static int
getresgid(gid_t *rgid, gid_t *egid, gid_t *sgid) {
*rgid = -1;
*egid = getegid();
*sgid = -1;
return (0);
}
#endif /* !HAVE_GETRESGID */
#if !HAVE_SETRESGID
static int
setresgid(gid_t rgid, gid_t egid, gid_t sgid) {
REQUIRE(rgid == (gid_t)-1);
REQUIRE(sgid == (gid_t)-1);
#if HAVE_SETREGID
return (setregid(rgid, egid));
#else /* HAVE_SETREGID */
return (setegid(egid));
#endif /* HAVE_SETREGID */
}
#endif /* !HAVE_SETRESGID */
#if !HAVE_GETRESUID
static int
getresuid(uid_t *ruid, uid_t *euid, uid_t *suid) {
*ruid = -1;
*euid = geteuid();
*suid = -1;
return (0);
}
#endif /* !HAVE_GETRESUID */
#if !HAVE_SETRESUID
static int
setresuid(uid_t ruid, uid_t euid, uid_t suid) {
REQUIRE(ruid == (uid_t)-1);
REQUIRE(suid == (uid_t)-1);
#if HAVE_SETREGID
return (setregid(ruid, euid));
#else /* HAVE_SETREGID */
return (setegid(euid));
#endif /* HAVE_SETREGID */
}
#endif /* !HAVE_SETRESUID */
static int
set_effective_gid(gid_t gid) {
gid_t oldgid;
if (getresgid(&(gid_t){ 0 }, &oldgid, &(gid_t){ 0 }) == -1) {
return (-1);
}
if (oldgid == gid) {
return (0);
}
if (setresgid(-1, gid, -1) == -1) {
return (-1);
}
if (getresgid(&(gid_t){ 0 }, &oldgid, &(gid_t){ 0 }) == -1) {
return (-1);
}
if (oldgid != gid) {
return (-1);
}
return (0);
}
static int
set_effective_uid(uid_t uid) {
uid_t olduid;
if (getresuid(&(uid_t){ 0 }, &olduid, &(uid_t){ 0 }) == -1) {
return (-1);
}
if (olduid == uid) {
return (0);
}
if (setresuid(-1, uid, -1) == -1) {
return (-1);
}
if (getresuid(&(uid_t){ 0 }, &olduid, &(uid_t){ 0 }) == -1) {
return (-1);
}
if (olduid != uid) {
return (-1);
}
/* Success */
return (0);
}
static void
setperms(uid_t uid, gid_t gid) {
char strbuf[ISC_STRERRORSIZE];
/*
* Drop the gid privilege first, because in some cases the gid privilege
* cannot be dropped after the uid privilege has been dropped.
*/
if (set_effective_gid(gid) == -1) {
strerror_r(errno, strbuf, sizeof(strbuf));
named_main_earlywarning("unable to set effective gid to %d: %s",
gid, strbuf);
}
if (set_effective_uid(uid) == -1) {
strerror_r(errno, strbuf, sizeof(strbuf));
named_main_earlywarning("unable to set effective uid to %d: %s",
uid, strbuf);
}
}
static void
setup_syslog(const char *progname) {
@@ -265,9 +395,9 @@ setup_syslog(const char *progname) {
void
named_os_init(const char *progname) {
setup_syslog(progname);
#ifdef HAVE_SYS_CAPABILITY_H
#if HAVE_LIBCAP
linux_initialprivs();
#endif /* ifdef HAVE_SYS_CAPABILITY_H */
#endif /* HAVE_LIBCAP */
#ifdef SIGXFSZ
signal(SIGXFSZ, SIG_IGN);
#endif /* ifdef SIGXFSZ */
@@ -460,7 +590,7 @@ named_os_changeuser(void) {
named_main_earlyfatal("setuid(): %s", strbuf);
}
#if defined(HAVE_SYS_CAPABILITY_H)
#if HAVE_LIBCAP
/*
* Restore the ability of named to drop core after the setuid()
* call has disabled it.
@@ -472,7 +602,7 @@ named_os_changeuser(void) {
}
linux_minprivs();
#endif /* if defined(HAVE_SYS_CAPABILITY_H) */
#endif /* HAVE_LIBCAP */
}
uid_t
@@ -485,30 +615,56 @@ ns_os_uid(void) {
void
named_os_adjustnofile(void) {
#if defined(__linux__)
isc_result_t result;
isc_resourcevalue_t newvalue;
int r;
struct rlimit rl;
rlim_t rlim_old;
char strbuf[ISC_STRERRORSIZE];
/*
* Linux: max number of open files specified by one thread doesn't seem
* to apply to other threads on Linux.
*/
newvalue = ISC_RESOURCE_UNLIMITED;
result = isc_resource_setlimit(isc_resource_openfiles, newvalue);
if (result != ISC_R_SUCCESS) {
named_main_earlywarning("couldn't adjust limit on open files");
r = getrlimit(RLIMIT_NOFILE, &rl);
if (r != 0) {
goto fail;
}
#endif /* if defined(__linux__) */
rlim_old = rl.rlim_cur;
if (rl.rlim_cur == rl.rlim_max) {
isc_log_write(named_g_lctx, NAMED_LOGCATEGORY_GENERAL,
NAMED_LOGMODULE_MAIN, ISC_LOG_NOTICE,
"the limit on open files is already at the "
"maximum allowed value: "
"%" PRIu64,
(uint64_t)rl.rlim_max);
return;
}
rl.rlim_cur = rl.rlim_max;
r = setrlimit(RLIMIT_NOFILE, &rl);
if (r != 0) {
goto fail;
}
isc_log_write(named_g_lctx, NAMED_LOGCATEGORY_GENERAL,
NAMED_LOGMODULE_MAIN, ISC_LOG_NOTICE,
"adjusted limit on open files from "
"%" PRIu64 " to "
"%" PRIu64,
(uint64_t)rlim_old, (uint64_t)rl.rlim_cur);
return;
fail:
strerror_r(errno, strbuf, sizeof(strbuf));
named_main_earlywarning("adjusting limit on open files failed: %s",
strbuf);
return;
}
void
named_os_minprivs(void) {
#if defined(HAVE_SYS_CAPABILITY_H)
#if HAVE_LIBCAP
linux_keepcaps();
named_os_changeuser();
linux_minprivs();
#endif /* if defined(HAVE_SYS_CAPABILITY_H) */
#endif /* HAVE_LIBCAP */
}
static int
@@ -628,56 +784,6 @@ error:
return (-1);
}
#if !HAVE_SYS_CAPABILITY_H
static void
setperms(uid_t uid, gid_t gid) {
#if defined(HAVE_SETEGID) || defined(HAVE_SETRESGID)
char strbuf[ISC_STRERRORSIZE];
#endif /* if defined(HAVE_SETEGID) || defined(HAVE_SETRESGID) */
#if !defined(HAVE_SETEGID) && defined(HAVE_SETRESGID)
gid_t oldgid, tmpg;
#endif /* if !defined(HAVE_SETEGID) && defined(HAVE_SETRESGID) */
#if !defined(HAVE_SETEUID) && defined(HAVE_SETRESUID)
uid_t olduid, tmpu;
#endif /* if !defined(HAVE_SETEUID) && defined(HAVE_SETRESUID) */
#if defined(HAVE_SETEGID)
if (getegid() != gid && setegid(gid) == -1) {
strerror_r(errno, strbuf, sizeof(strbuf));
named_main_earlywarning("unable to set effective "
"gid to %ld: %s",
(long)gid, strbuf);
}
#elif defined(HAVE_SETRESGID)
if (getresgid(&tmpg, &oldgid, &tmpg) == -1 || oldgid != gid) {
if (setresgid(-1, gid, -1) == -1) {
strerror_r(errno, strbuf, sizeof(strbuf));
named_main_earlywarning("unable to set effective "
"gid to %d: %s",
gid, strbuf);
}
}
#endif /* if defined(HAVE_SETEGID) */
#if defined(HAVE_SETEUID)
if (geteuid() != uid && seteuid(uid) == -1) {
strerror_r(errno, strbuf, sizeof(strbuf));
named_main_earlywarning("unable to set effective "
"uid to %ld: %s",
(long)uid, strbuf);
}
#elif defined(HAVE_SETRESUID)
if (getresuid(&tmpu, &olduid, &tmpu) == -1 || olduid != uid) {
if (setresuid(-1, uid, -1) == -1) {
strerror_r(errno, strbuf, sizeof(strbuf));
named_main_earlywarning("unable to set effective "
"uid to %d: %s",
uid, strbuf);
}
}
#endif /* if defined(HAVE_SETEUID) */
}
#endif /* !HAVE_SYS_CAPABILITY_H */
FILE *
named_os_openfile(const char *filename, mode_t mode, bool switch_user) {
char strbuf[ISC_STRERRORSIZE], *f;
@@ -703,19 +809,17 @@ named_os_openfile(const char *filename, mode_t mode, bool switch_user) {
if (switch_user && runas_pw != NULL) {
uid_t olduid = getuid();
gid_t oldgid = getgid();
#if HAVE_SYS_CAPABILITY_H
REQUIRE(olduid == runas_pw->pw_uid);
REQUIRE(oldgid == runas_pw->pw_gid);
#else /* HAVE_SYS_CAPABILITY_H */
/* Set UID/GID to the one we'll be running with eventually */
/*
* Set UID/GID to the one we'll be running with
* eventually.
*/
setperms(runas_pw->pw_uid, runas_pw->pw_gid);
#endif
fd = safe_open(filename, mode, false);
#if !HAVE_SYS_CAPABILITY_H
/* Restore UID/GID to previous uid/gid */
setperms(olduid, oldgid);
#endif
if (fd == -1) {
fd = safe_open(filename, mode, false);
@@ -867,14 +971,6 @@ named_os_shutdown(void) {
cleanup_lockfile();
}
isc_result_t
named_os_gethostname(char *buf, size_t len) {
int n;
n = gethostname(buf, len);
return ((n == 0) ? ISC_R_SUCCESS : ISC_R_FAILURE);
}
void
named_os_shutdownmsg(char *command, isc_buffer_t *text) {
char *last, *ptr;
+621 -785
View File
File diff suppressed because it is too large Load Diff
+146 -217
View File
@@ -20,7 +20,6 @@
#include <isc/httpd.h>
#include <isc/mem.h>
#include <isc/once.h>
#include <isc/print.h>
#include <isc/stats.h>
#include <isc/string.h>
#include <isc/util.h>
@@ -56,11 +55,11 @@
#include "xsl_p.h"
#define STATS_XML_VERSION_MAJOR "3"
#define STATS_XML_VERSION_MINOR "12"
#define STATS_XML_VERSION_MINOR "14"
#define STATS_XML_VERSION STATS_XML_VERSION_MAJOR "." STATS_XML_VERSION_MINOR
#define STATS_JSON_VERSION_MAJOR "1"
#define STATS_JSON_VERSION_MINOR "6"
#define STATS_JSON_VERSION_MINOR "8"
#define STATS_JSON_VERSION STATS_JSON_VERSION_MAJOR "." STATS_JSON_VERSION_MINOR
#define CHECK(m) \
@@ -78,13 +77,12 @@ struct named_statschannel {
isc_mem_t *mctx;
/*
* Locked by channel lock: can be referenced and modified by both
* the server task and the channel task.
* Locked by channel lock
*/
isc_mutex_t lock;
dns_acl_t *acl;
/* Locked by server task */
/* Locked by main loop. */
ISC_LINK(struct named_statschannel) link;
};
@@ -352,6 +350,7 @@ init_desc(void) {
SET_NSSTATDESC(reclimitdropped,
"queries dropped due to recursive client limit",
"RecLimitDropped");
SET_NSSTATDESC(updatequota, "Update quota exceeded", "UpdateQuota");
INSIST(i == ns_statscounter_max);
@@ -1464,7 +1463,8 @@ rdtypestat_dump(dns_rdatastatstype_t type, uint64_t val, void *arg) {
#endif /* ifdef HAVE_JSON_C */
if ((DNS_RDATASTATSTYPE_ATTR(type) &
DNS_RDATASTATSTYPE_ATTR_OTHERTYPE) == 0) {
DNS_RDATASTATSTYPE_ATTR_OTHERTYPE) == 0)
{
dns_rdatatype_format(DNS_RDATASTATSTYPE_BASE(type), typebuf,
sizeof(typebuf));
typestr = typebuf;
@@ -1536,7 +1536,8 @@ rdatasetstats_dump(dns_rdatastatstype_t type, uint64_t val, void *arg) {
#endif /* ifdef HAVE_JSON_C */
if ((DNS_RDATASTATSTYPE_ATTR(type) &
DNS_RDATASTATSTYPE_ATTR_NXDOMAIN) != 0) {
DNS_RDATASTATSTYPE_ATTR_NXDOMAIN) != 0)
{
typestr = "NXDOMAIN";
} else if ((DNS_RDATASTATSTYPE_ATTR(type) &
DNS_RDATASTATSTYPE_ATTR_OTHERTYPE) != 0)
@@ -1713,7 +1714,7 @@ cleanup:
#if defined(EXTENDED_STATS)
static void
dnssecsignstat_dump(dns_keytag_t tag, uint64_t val, void *arg) {
dnssecsignstat_dump(uint32_t kval, uint64_t val, void *arg) {
FILE *fp;
char tagbuf[64];
stats_dumparg_t *dumparg = arg;
@@ -1725,7 +1726,11 @@ dnssecsignstat_dump(dns_keytag_t tag, uint64_t val, void *arg) {
json_object *zoneobj, *obj;
#endif /* ifdef HAVE_JSON_C */
snprintf(tagbuf, sizeof(tagbuf), "%u", tag);
/*
* kval is '(algorithm << 16) | keyid'.
*/
snprintf(tagbuf, sizeof(tagbuf), "%u+%u", (kval >> 16) & 0xff,
kval & 0xffff);
switch (dumparg->type) {
case isc_statsformat_file:
@@ -1772,7 +1777,6 @@ cleanup:
#define STATS_XML_STATUS 0x00 /* display only common statistics */
#define STATS_XML_SERVER 0x01
#define STATS_XML_ZONES 0x02
#define STATS_XML_TASKS 0x04
#define STATS_XML_NET 0x08
#define STATS_XML_MEM 0x10
#define STATS_XML_TRAFFIC 0x20
@@ -2239,7 +2243,8 @@ generatexml(named_server_t *server, uint32_t flags, int *buflen,
view = ISC_LIST_HEAD(server->viewlist);
TRY0(xmlTextWriterStartElement(writer, ISC_XMLCHAR "views"));
while (view != NULL &&
((flags & (STATS_XML_SERVER | STATS_XML_ZONES)) != 0)) {
((flags & (STATS_XML_SERVER | STATS_XML_ZONES)) != 0))
{
isc_stats_t *istats = NULL;
dns_stats_t *dstats = NULL;
@@ -2250,8 +2255,8 @@ generatexml(named_server_t *server, uint32_t flags, int *buflen,
if ((flags & STATS_XML_ZONES) != 0) {
TRY0(xmlTextWriterStartElement(writer,
ISC_XMLCHAR "zones"));
CHECK(dns_zt_apply(view->zonetable, true, NULL,
zone_xmlrender, writer));
CHECK(dns_zt_apply(view->zonetable, isc_rwlocktype_read,
true, NULL, zone_xmlrender, writer));
TRY0(xmlTextWriterEndElement(writer)); /* /zones */
}
@@ -2327,12 +2332,6 @@ generatexml(named_server_t *server, uint32_t flags, int *buflen,
}
TRY0(xmlTextWriterEndElement(writer)); /* /views */
if ((flags & STATS_XML_TASKS) != 0) {
TRY0(xmlTextWriterStartElement(writer, ISC_XMLCHAR "taskmgr"));
TRY0(isc_taskmgr_renderxml(named_g_taskmgr, writer));
TRY0(xmlTextWriterEndElement(writer)); /* /taskmgr */
}
if ((flags & STATS_XML_MEM) != 0) {
TRY0(xmlTextWriterStartElement(writer, ISC_XMLCHAR "memory"));
TRY0(isc_mem_renderxml(writer));
@@ -2372,20 +2371,14 @@ wrap_xmlfree(isc_buffer_t *buffer, void *arg) {
}
static isc_result_t
render_xml(uint32_t flags, const char *url, isc_httpdurl_t *urlinfo,
const char *querystring, const char *headers, void *arg,
unsigned int *retcode, const char **retmsg, const char **mimetype,
isc_buffer_t *b, isc_httpdfree_t **freecb, void **freecb_args) {
render_xml(uint32_t flags, void *arg, unsigned int *retcode,
const char **retmsg, const char **mimetype, isc_buffer_t *b,
isc_httpdfree_t **freecb, void **freecb_args) {
unsigned char *msg = NULL;
int msglen;
named_server_t *server = arg;
isc_result_t result;
UNUSED(url);
UNUSED(urlinfo);
UNUSED(headers);
UNUSED(querystring);
result = generatexml(server, flags, &msglen, &msg);
if (result == ISC_R_SUCCESS) {
@@ -2406,91 +2399,80 @@ render_xml(uint32_t flags, const char *url, isc_httpdurl_t *urlinfo,
}
static isc_result_t
render_xml_all(const char *url, isc_httpdurl_t *urlinfo,
const char *querystring, const char *headers, void *arg,
unsigned int *retcode, const char **retmsg,
render_xml_all(const isc_httpd_t *httpd, const isc_httpdurl_t *urlinfo,
void *arg, unsigned int *retcode, const char **retmsg,
const char **mimetype, isc_buffer_t *b, isc_httpdfree_t **freecb,
void **freecb_args) {
return (render_xml(STATS_XML_ALL, url, urlinfo, querystring, headers,
arg, retcode, retmsg, mimetype, b, freecb,
freecb_args));
UNUSED(httpd);
UNUSED(urlinfo);
return (render_xml(STATS_XML_ALL, arg, retcode, retmsg, mimetype, b,
freecb, freecb_args));
}
static isc_result_t
render_xml_status(const char *url, isc_httpdurl_t *urlinfo,
const char *querystring, const char *headers, void *arg,
unsigned int *retcode, const char **retmsg,
render_xml_status(const isc_httpd_t *httpd, const isc_httpdurl_t *urlinfo,
void *arg, unsigned int *retcode, const char **retmsg,
const char **mimetype, isc_buffer_t *b,
isc_httpdfree_t **freecb, void **freecb_args) {
return (render_xml(STATS_XML_STATUS, url, urlinfo, querystring, headers,
arg, retcode, retmsg, mimetype, b, freecb,
freecb_args));
UNUSED(httpd);
UNUSED(urlinfo);
return (render_xml(STATS_XML_STATUS, arg, retcode, retmsg, mimetype, b,
freecb, freecb_args));
}
static isc_result_t
render_xml_server(const char *url, isc_httpdurl_t *urlinfo,
const char *querystring, const char *headers, void *arg,
unsigned int *retcode, const char **retmsg,
render_xml_server(const isc_httpd_t *httpd, const isc_httpdurl_t *urlinfo,
void *arg, unsigned int *retcode, const char **retmsg,
const char **mimetype, isc_buffer_t *b,
isc_httpdfree_t **freecb, void **freecb_args) {
return (render_xml(STATS_XML_SERVER, url, urlinfo, querystring, headers,
arg, retcode, retmsg, mimetype, b, freecb,
freecb_args));
UNUSED(httpd);
UNUSED(urlinfo);
return (render_xml(STATS_XML_SERVER, arg, retcode, retmsg, mimetype, b,
freecb, freecb_args));
}
static isc_result_t
render_xml_zones(const char *url, isc_httpdurl_t *urlinfo,
const char *querystring, const char *headers, void *arg,
unsigned int *retcode, const char **retmsg,
render_xml_zones(const isc_httpd_t *httpd, const isc_httpdurl_t *urlinfo,
void *arg, unsigned int *retcode, const char **retmsg,
const char **mimetype, isc_buffer_t *b,
isc_httpdfree_t **freecb, void **freecb_args) {
return (render_xml(STATS_XML_ZONES, url, urlinfo, querystring, headers,
arg, retcode, retmsg, mimetype, b, freecb,
freecb_args));
UNUSED(httpd);
UNUSED(urlinfo);
return (render_xml(STATS_XML_ZONES, arg, retcode, retmsg, mimetype, b,
freecb, freecb_args));
}
static isc_result_t
render_xml_net(const char *url, isc_httpdurl_t *urlinfo,
const char *querystring, const char *headers, void *arg,
unsigned int *retcode, const char **retmsg,
render_xml_net(const isc_httpd_t *httpd, const isc_httpdurl_t *urlinfo,
void *arg, unsigned int *retcode, const char **retmsg,
const char **mimetype, isc_buffer_t *b, isc_httpdfree_t **freecb,
void **freecb_args) {
return (render_xml(STATS_XML_NET, url, urlinfo, querystring, headers,
arg, retcode, retmsg, mimetype, b, freecb,
freecb_args));
UNUSED(httpd);
UNUSED(urlinfo);
return (render_xml(STATS_XML_NET, arg, retcode, retmsg, mimetype, b,
freecb, freecb_args));
}
static isc_result_t
render_xml_tasks(const char *url, isc_httpdurl_t *urlinfo,
const char *querystring, const char *headers, void *arg,
unsigned int *retcode, const char **retmsg,
const char **mimetype, isc_buffer_t *b,
isc_httpdfree_t **freecb, void **freecb_args) {
return (render_xml(STATS_XML_TASKS, url, urlinfo, querystring, headers,
arg, retcode, retmsg, mimetype, b, freecb,
freecb_args));
}
static isc_result_t
render_xml_mem(const char *url, isc_httpdurl_t *urlinfo,
const char *querystring, const char *headers, void *arg,
unsigned int *retcode, const char **retmsg,
render_xml_mem(const isc_httpd_t *httpd, const isc_httpdurl_t *urlinfo,
void *arg, unsigned int *retcode, const char **retmsg,
const char **mimetype, isc_buffer_t *b, isc_httpdfree_t **freecb,
void **freecb_args) {
return (render_xml(STATS_XML_MEM, url, urlinfo, querystring, headers,
arg, retcode, retmsg, mimetype, b, freecb,
freecb_args));
UNUSED(httpd);
UNUSED(urlinfo);
return (render_xml(STATS_XML_MEM, arg, retcode, retmsg, mimetype, b,
freecb, freecb_args));
}
static isc_result_t
render_xml_traffic(const char *url, isc_httpdurl_t *urlinfo,
const char *querystring, const char *headers, void *arg,
unsigned int *retcode, const char **retmsg,
render_xml_traffic(const isc_httpd_t *httpd, const isc_httpdurl_t *urlinfo,
void *arg, unsigned int *retcode, const char **retmsg,
const char **mimetype, isc_buffer_t *b,
isc_httpdfree_t **freecb, void **freecb_args) {
return (render_xml(STATS_XML_TRAFFIC, url, urlinfo, querystring,
headers, arg, retcode, retmsg, mimetype, b, freecb,
freecb_args));
UNUSED(httpd);
UNUSED(urlinfo);
return (render_xml(STATS_XML_TRAFFIC, arg, retcode, retmsg, mimetype, b,
freecb, freecb_args));
}
#endif /* HAVE_LIBXML2 */
@@ -2502,7 +2484,6 @@ render_xml_traffic(const char *url, isc_httpdurl_t *urlinfo,
#define STATS_JSON_STATUS 0x00 /* display only common statistics */
#define STATS_JSON_SERVER 0x01
#define STATS_JSON_ZONES 0x02
#define STATS_JSON_TASKS 0x04
#define STATS_JSON_NET 0x08
#define STATS_JSON_MEM 0x10
#define STATS_JSON_TRAFFIC 0x20
@@ -2731,7 +2712,8 @@ zone_jsonrender(dns_zone_t *zone, void *arg) {
}
if (json_object_get_object(refresh_counters)->count !=
0) {
0)
{
json_object_object_add(zoneobj,
"dnssec-refresh",
refresh_counters);
@@ -2987,8 +2969,9 @@ generatejson(named_server_t *server, size_t *msglen, const char **msg,
CHECKMEM(za);
if ((flags & STATS_JSON_ZONES) != 0) {
CHECK(dns_zt_apply(view->zonetable, true, NULL,
zone_jsonrender, za));
CHECK(dns_zt_apply(view->zonetable,
isc_rwlocktype_read, true,
NULL, zone_jsonrender, za));
}
if (json_object_array_length(za) != 0) {
@@ -3135,19 +3118,6 @@ generatejson(named_server_t *server, size_t *msglen, const char **msg,
}
}
if ((flags & STATS_JSON_TASKS) != 0) {
json_object *tasks = json_object_new_object();
CHECKMEM(tasks);
result = isc_taskmgr_renderjson(named_g_taskmgr, tasks);
if (result != ISC_R_SUCCESS) {
json_object_put(tasks);
goto cleanup;
}
json_object_object_add(bindstats, "taskmgr", tasks);
}
if ((flags & STATS_JSON_MEM) != 0) {
json_object *memory = json_object_new_object();
CHECKMEM(memory);
@@ -3316,10 +3286,9 @@ cleanup:
}
static isc_result_t
render_json(uint32_t flags, const char *url, isc_httpdurl_t *urlinfo,
const char *querystring, const char *headers, void *arg,
unsigned int *retcode, const char **retmsg, const char **mimetype,
isc_buffer_t *b, isc_httpdfree_t **freecb, void **freecb_args) {
render_json(uint32_t flags, void *arg, unsigned int *retcode,
const char **retmsg, const char **mimetype, isc_buffer_t *b,
isc_httpdfree_t **freecb, void **freecb_args) {
isc_result_t result;
json_object *bindstats = NULL;
named_server_t *server = arg;
@@ -3327,11 +3296,6 @@ render_json(uint32_t flags, const char *url, isc_httpdurl_t *urlinfo,
size_t msglen = 0;
char *p;
UNUSED(url);
UNUSED(urlinfo);
UNUSED(headers);
UNUSED(querystring);
result = generatejson(server, &msglen, &msg, &bindstats, flags);
if (result == ISC_R_SUCCESS) {
*retcode = 200;
@@ -3352,156 +3316,128 @@ render_json(uint32_t flags, const char *url, isc_httpdurl_t *urlinfo,
}
static isc_result_t
render_json_all(const char *url, isc_httpdurl_t *urlinfo,
const char *querystring, const char *headers, void *arg,
unsigned int *retcode, const char **retmsg,
render_json_all(const isc_httpd_t *httpd, const isc_httpdurl_t *urlinfo,
void *arg, unsigned int *retcode, const char **retmsg,
const char **mimetype, isc_buffer_t *b,
isc_httpdfree_t **freecb, void **freecb_args) {
return (render_json(STATS_JSON_ALL, url, urlinfo, querystring, headers,
arg, retcode, retmsg, mimetype, b, freecb,
freecb_args));
UNUSED(httpd);
UNUSED(urlinfo);
return (render_json(STATS_JSON_ALL, arg, retcode, retmsg, mimetype, b,
freecb, freecb_args));
}
static isc_result_t
render_json_status(const char *url, isc_httpdurl_t *urlinfo,
const char *querystring, const char *headers, void *arg,
unsigned int *retcode, const char **retmsg,
render_json_status(const isc_httpd_t *httpd, const isc_httpdurl_t *urlinfo,
void *arg, unsigned int *retcode, const char **retmsg,
const char **mimetype, isc_buffer_t *b,
isc_httpdfree_t **freecb, void **freecb_args) {
return (render_json(STATS_JSON_STATUS, url, urlinfo, querystring,
headers, arg, retcode, retmsg, mimetype, b, freecb,
freecb_args));
UNUSED(httpd);
UNUSED(urlinfo);
return (render_json(STATS_JSON_STATUS, arg, retcode, retmsg, mimetype,
b, freecb, freecb_args));
}
static isc_result_t
render_json_server(const char *url, isc_httpdurl_t *urlinfo,
const char *querystring, const char *headers, void *arg,
unsigned int *retcode, const char **retmsg,
render_json_server(const isc_httpd_t *httpd, const isc_httpdurl_t *urlinfo,
void *arg, unsigned int *retcode, const char **retmsg,
const char **mimetype, isc_buffer_t *b,
isc_httpdfree_t **freecb, void **freecb_args) {
return (render_json(STATS_JSON_SERVER, url, urlinfo, querystring,
headers, arg, retcode, retmsg, mimetype, b, freecb,
freecb_args));
UNUSED(httpd);
UNUSED(urlinfo);
return (render_json(STATS_JSON_SERVER, arg, retcode, retmsg, mimetype,
b, freecb, freecb_args));
}
static isc_result_t
render_json_zones(const char *url, isc_httpdurl_t *urlinfo,
const char *querystring, const char *headers, void *arg,
unsigned int *retcode, const char **retmsg,
render_json_zones(const isc_httpd_t *httpd, const isc_httpdurl_t *urlinfo,
void *arg, unsigned int *retcode, const char **retmsg,
const char **mimetype, isc_buffer_t *b,
isc_httpdfree_t **freecb, void **freecb_args) {
return (render_json(STATS_JSON_ZONES, url, urlinfo, querystring,
headers, arg, retcode, retmsg, mimetype, b, freecb,
freecb_args));
UNUSED(httpd);
UNUSED(urlinfo);
return (render_json(STATS_JSON_ZONES, arg, retcode, retmsg, mimetype, b,
freecb, freecb_args));
}
static isc_result_t
render_json_mem(const char *url, isc_httpdurl_t *urlinfo,
const char *querystring, const char *headers, void *arg,
unsigned int *retcode, const char **retmsg,
render_json_mem(const isc_httpd_t *httpd, const isc_httpdurl_t *urlinfo,
void *arg, unsigned int *retcode, const char **retmsg,
const char **mimetype, isc_buffer_t *b,
isc_httpdfree_t **freecb, void **freecb_args) {
return (render_json(STATS_JSON_MEM, url, urlinfo, querystring, headers,
arg, retcode, retmsg, mimetype, b, freecb,
freecb_args));
UNUSED(httpd);
UNUSED(urlinfo);
return (render_json(STATS_JSON_MEM, arg, retcode, retmsg, mimetype, b,
freecb, freecb_args));
}
static isc_result_t
render_json_tasks(const char *url, isc_httpdurl_t *urlinfo,
const char *querystring, const char *headers, void *arg,
unsigned int *retcode, const char **retmsg,
const char **mimetype, isc_buffer_t *b,
isc_httpdfree_t **freecb, void **freecb_args) {
return (render_json(STATS_JSON_TASKS, url, urlinfo, querystring,
headers, arg, retcode, retmsg, mimetype, b, freecb,
freecb_args));
}
static isc_result_t
render_json_net(const char *url, isc_httpdurl_t *urlinfo,
const char *querystring, const char *headers, void *arg,
unsigned int *retcode, const char **retmsg,
render_json_net(const isc_httpd_t *httpd, const isc_httpdurl_t *urlinfo,
void *arg, unsigned int *retcode, const char **retmsg,
const char **mimetype, isc_buffer_t *b,
isc_httpdfree_t **freecb, void **freecb_args) {
return (render_json(STATS_JSON_NET, url, urlinfo, querystring, headers,
arg, retcode, retmsg, mimetype, b, freecb,
freecb_args));
UNUSED(httpd);
UNUSED(urlinfo);
return (render_json(STATS_JSON_NET, arg, retcode, retmsg, mimetype, b,
freecb, freecb_args));
}
static isc_result_t
render_json_traffic(const char *url, isc_httpdurl_t *urlinfo,
const char *querystring, const char *headers, void *arg,
unsigned int *retcode, const char **retmsg,
render_json_traffic(const isc_httpd_t *httpd, const isc_httpdurl_t *urlinfo,
void *arg, unsigned int *retcode, const char **retmsg,
const char **mimetype, isc_buffer_t *b,
isc_httpdfree_t **freecb, void **freecb_args) {
return (render_json(STATS_JSON_TRAFFIC, url, urlinfo, querystring,
headers, arg, retcode, retmsg, mimetype, b, freecb,
freecb_args));
UNUSED(httpd);
UNUSED(urlinfo);
return (render_json(STATS_JSON_TRAFFIC, arg, retcode, retmsg, mimetype,
b, freecb, freecb_args));
}
#endif /* HAVE_JSON_C */
static isc_result_t
render_xsl(const char *url, isc_httpdurl_t *urlinfo, const char *querystring,
const char *headers, void *args, unsigned int *retcode,
const char **retmsg, const char **mimetype, isc_buffer_t *b,
isc_httpdfree_t **freecb, void **freecb_args) {
render_xsl(const isc_httpd_t *httpd, const isc_httpdurl_t *urlinfo, void *args,
unsigned int *retcode, const char **retmsg, const char **mimetype,
isc_buffer_t *b, isc_httpdfree_t **freecb, void **freecb_args) {
isc_result_t result;
char *_headers = NULL;
char *p;
char *p = NULL;
UNUSED(url);
UNUSED(querystring);
UNUSED(httpd);
UNUSED(args);
*freecb = NULL;
*freecb_args = NULL;
*mimetype = "text/xslt+xml";
if (urlinfo->isstatic) {
isc_time_t when;
char *line, *saveptr;
const char *if_modified_since = "If-Modified-Since: ";
_headers = strdup(headers);
if (isc_httpdurl_isstatic(urlinfo)) {
time_t t1, t2;
const isc_time_t *when;
const isc_time_t *loadtime;
if (_headers == NULL) {
when = isc_httpd_if_modified_since(httpd);
if (isc_time_isepoch(when)) {
goto send;
}
saveptr = NULL;
for (line = strtok_r(_headers, "\n", &saveptr); line;
line = strtok_r(NULL, "\n", &saveptr))
{
if (strncasecmp(line, if_modified_since,
strlen(if_modified_since)) == 0) {
time_t t1, t2;
line += strlen(if_modified_since);
result = isc_time_parsehttptimestamp(line,
&when);
if (result != ISC_R_SUCCESS) {
goto send;
}
result = isc_time_secondsastimet(&when, &t1);
if (result != ISC_R_SUCCESS) {
goto send;
}
result = isc_time_secondsastimet(
&urlinfo->loadtime, &t2);
if (result != ISC_R_SUCCESS) {
goto send;
}
if (t1 < t2) {
goto send;
}
*retcode = 304;
*retmsg = "Not modified";
goto end;
}
result = isc_time_secondsastimet(when, &t1);
if (result != ISC_R_SUCCESS) {
goto send;
}
loadtime = isc_httpdurl_loadtime(urlinfo);
result = isc_time_secondsastimet(loadtime, &t2);
if (result != ISC_R_SUCCESS) {
goto send;
}
if (t1 < t2) {
goto send;
}
*retcode = 304;
*retmsg = "Not modified";
goto end;
}
send:
@@ -3511,7 +3447,6 @@ send:
isc_buffer_reinit(b, p, strlen(xslmsg));
isc_buffer_add(b, strlen(xslmsg));
end:
free(_headers);
return (ISC_R_SUCCESS);
}
@@ -3632,9 +3567,6 @@ add_listener(named_server_t *server, named_statschannel_t **listenerp,
isc_httpdmgr_addurl(listener->httpdmgr,
"/xml/v" STATS_XML_VERSION_MAJOR "/net", false,
render_xml_net, server);
isc_httpdmgr_addurl(listener->httpdmgr,
"/xml/v" STATS_XML_VERSION_MAJOR "/tasks", false,
render_xml_tasks, server);
isc_httpdmgr_addurl(listener->httpdmgr,
"/xml/v" STATS_XML_VERSION_MAJOR "/mem", false,
render_xml_mem, server);
@@ -3657,9 +3589,6 @@ add_listener(named_server_t *server, named_statschannel_t **listenerp,
isc_httpdmgr_addurl(listener->httpdmgr,
"/json/v" STATS_JSON_VERSION_MAJOR "/zones", false,
render_json_zones, server);
isc_httpdmgr_addurl(listener->httpdmgr,
"/json/v" STATS_JSON_VERSION_MAJOR "/tasks", false,
render_json_tasks, server);
isc_httpdmgr_addurl(listener->httpdmgr,
"/json/v" STATS_JSON_VERSION_MAJOR "/net", false,
render_json_net, server);
@@ -3752,7 +3681,7 @@ named_statschannels_configure(named_server_t *server, const cfg_obj_t *config,
const cfg_listelt_t *element, *element2;
char socktext[ISC_SOCKADDR_FORMATSIZE];
RUNTIME_CHECK(isc_once_do(&once, init_desc) == ISC_R_SUCCESS);
isc_once_do(&once, init_desc);
ISC_LIST_INIT(new_listeners);
@@ -3909,7 +3838,7 @@ named_stats_dump(named_server_t *server, FILE *fp) {
uint64_t sockstat_values[isc_sockstatscounter_max];
uint64_t gluecachestats_values[dns_gluecachestatscounter_max];
RUNTIME_CHECK(isc_once_do(&once, init_desc) == ISC_R_SUCCESS);
isc_once_do(&once, init_desc);
/* Set common fields */
dumparg.type = isc_statsformat_file;
+2 -1
View File
@@ -59,7 +59,8 @@
const cfg_listelt_t *proto = NULL; \
INSIST(obj != NULL); \
for (proto = cfg_list_first(obj); proto != 0; \
proto = cfg_list_next(proto)) { \
proto = cfg_list_next(proto)) \
{ \
const cfg_obj_t *tls_proto_obj = \
cfg_listelt_value(proto); \
const char *tls_sver = \
+2 -1
View File
@@ -84,7 +84,8 @@ add_initial_keys(const cfg_obj_t *list, dns_tsig_keyring_t *ring,
*/
algstr = cfg_obj_asstring(algobj);
if (named_config_getkeyalgorithm(algstr, &alg, &bits) !=
ISC_R_SUCCESS) {
ISC_R_SUCCESS)
{
cfg_obj_log(algobj, named_g_lctx, ISC_LOG_ERROR,
"key '%s': has a "
"unsupported algorithm '%s'",
+97 -171
View File
@@ -17,7 +17,6 @@
#include <isc/buffer.h>
#include <isc/file.h>
#include <isc/mem.h>
#include <isc/print.h>
#include <isc/result.h>
#include <isc/stats.h>
#include <isc/string.h>
@@ -251,7 +250,8 @@ configure_zone_ssutable(const cfg_obj_t *zconfig, dns_zone_t *zone,
str = cfg_obj_asstring(matchtype);
CHECK(dns_ssu_mtypefromstring(str, &mtype));
if (mtype == dns_ssumatchtype_subdomain &&
strcasecmp(str, "zonesub") == 0) {
strcasecmp(str, "zonesub") == 0)
{
usezone = true;
}
@@ -313,7 +313,8 @@ configure_zone_ssutable(const cfg_obj_t *zconfig, dns_zone_t *zone,
r.length = bracket - str;
max = strtoul(bracket + 1, &end, 10);
if (max > 0xffff || end[0] != /*(*/ ')' ||
end[1] != 0) {
end[1] != 0)
{
cfg_obj_log(identity, named_g_lctx,
ISC_LOG_ERROR,
"'%s' is not a valid count",
@@ -454,7 +455,8 @@ configure_staticstub_serveraddrs(const cfg_obj_t *zconfig, dns_zone_t *zone,
* there's nothing to do anymore.
*/
if (ISC_LIST_EMPTY(rdatalist_a->rdata) &&
ISC_LIST_EMPTY(rdatalist_aaaa->rdata)) {
ISC_LIST_EMPTY(rdatalist_aaaa->rdata))
{
return (ISC_R_SUCCESS);
}
@@ -888,8 +890,6 @@ named_zone_configure(const cfg_obj_t *config, const cfg_obj_t *vconfig,
int i;
int32_t journal_size;
bool multi;
bool alt;
dns_view_t *view = NULL;
dns_kasp_t *kasp = NULL;
bool check = false, fail = false;
bool warn = false, ignore = false;
@@ -904,7 +904,6 @@ named_zone_configure(const cfg_obj_t *config, const cfg_obj_t *vconfig,
int seconds;
dns_ttl_t maxttl = 0; /* unlimited */
dns_zone_t *mayberaw = (raw != NULL) ? raw : zone;
isc_dscp_t dscp;
i = 0;
if (zconfig != NULL) {
@@ -928,8 +927,8 @@ named_zone_configure(const cfg_obj_t *config, const cfg_obj_t *vconfig,
maps[i] = NULL;
if (vconfig != NULL) {
RETERR(named_config_getclass(cfg_tuple_get(vconfig, "class"),
dns_rdataclass_in, &vclass));
CHECK(named_config_getclass(cfg_tuple_get(vconfig, "class"),
dns_rdataclass_in, &vclass));
} else {
vclass = dns_rdataclass_in;
}
@@ -940,8 +939,8 @@ named_zone_configure(const cfg_obj_t *config, const cfg_obj_t *vconfig,
zname = cfg_obj_asstring(cfg_tuple_get(zconfig, "name"));
RETERR(named_config_getclass(cfg_tuple_get(zconfig, "class"), vclass,
&zclass));
CHECK(named_config_getclass(cfg_tuple_get(zconfig, "class"), vclass,
&zclass));
dns_zone_setclass(zone, zclass);
if (raw != NULL) {
dns_zone_setclass(raw, zclass);
@@ -961,7 +960,7 @@ named_zone_configure(const cfg_obj_t *config, const cfg_obj_t *vconfig,
cpval = isc_mem_strdup(mctx, cfg_obj_asstring(obj));
}
if (cpval == NULL) {
return (ISC_R_NOMEMORY);
CHECK(ISC_R_NOMEMORY);
}
obj = NULL;
@@ -976,7 +975,7 @@ named_zone_configure(const cfg_obj_t *config, const cfg_obj_t *vconfig,
"zone '%s': both 'database' and 'dlz' "
"specified",
zname);
return (ISC_R_FAILURE);
CHECK(ISC_R_FAILURE);
}
len = strlen(dlzname) + 5;
@@ -987,7 +986,7 @@ named_zone_configure(const cfg_obj_t *config, const cfg_obj_t *vconfig,
result = strtoargv(mctx, cpval, &dbargc, &dbargv);
if (result != ISC_R_SUCCESS && cpval != default_dbtype) {
isc_mem_free(mctx, cpval);
return (result);
CHECK(result);
}
/*
@@ -1012,11 +1011,12 @@ named_zone_configure(const cfg_obj_t *config, const cfg_obj_t *vconfig,
* will be needing a master file.
*/
if (ztype == dns_zone_primary && cpval == default_dbtype &&
filename == NULL) {
filename == NULL)
{
isc_log_write(named_g_lctx, NAMED_LOGCATEGORY_GENERAL,
NAMED_LOGMODULE_SERVER, ISC_LOG_ERROR,
"zone '%s': 'file' not specified", zname);
return (ISC_R_FAILURE);
CHECK(ISC_R_FAILURE);
}
if (ztype == dns_zone_secondary || ztype == dns_zone_mirror) {
@@ -1049,7 +1049,7 @@ named_zone_configure(const cfg_obj_t *config, const cfg_obj_t *vconfig,
"can only be used with "
"'masterfile-format text'",
zname);
return (ISC_R_FAILURE);
CHECK(ISC_R_FAILURE);
}
if (strcasecmp(masterstylestr, "full") == 0) {
@@ -1074,47 +1074,45 @@ named_zone_configure(const cfg_obj_t *config, const cfg_obj_t *vconfig,
size_t signedlen = strlen(filename) + sizeof(SIGNED);
char *signedname;
RETERR(dns_zone_setfile(raw, filename, masterformat,
masterstyle));
CHECK(dns_zone_setfile(raw, filename, masterformat,
masterstyle));
signedname = isc_mem_get(mctx, signedlen);
(void)snprintf(signedname, signedlen, "%s" SIGNED, filename);
result = dns_zone_setfile(zone, signedname,
dns_masterformat_raw, NULL);
isc_mem_put(mctx, signedname, signedlen);
if (result != ISC_R_SUCCESS) {
return (result);
}
CHECK(result);
} else {
RETERR(dns_zone_setfile(zone, filename, masterformat,
masterstyle));
CHECK(dns_zone_setfile(zone, filename, masterformat,
masterstyle));
}
obj = NULL;
result = cfg_map_get(zoptions, "journal", &obj);
if (result == ISC_R_SUCCESS) {
RETERR(dns_zone_setjournal(mayberaw, cfg_obj_asstring(obj)));
CHECK(dns_zone_setjournal(mayberaw, cfg_obj_asstring(obj)));
}
/*
* Notify messages are processed by the raw zone if it exists.
*/
if (ztype == dns_zone_secondary || ztype == dns_zone_mirror) {
RETERR(configure_zone_acl(
zconfig, vconfig, config, allow_notify, ac, mayberaw,
dns_zone_setnotifyacl, dns_zone_clearnotifyacl));
CHECK(configure_zone_acl(zconfig, vconfig, config, allow_notify,
ac, mayberaw, dns_zone_setnotifyacl,
dns_zone_clearnotifyacl));
}
/*
* XXXAG This probably does not make sense for stubs.
*/
RETERR(configure_zone_acl(zconfig, vconfig, config, allow_query, ac,
zone, dns_zone_setqueryacl,
dns_zone_clearqueryacl));
CHECK(configure_zone_acl(zconfig, vconfig, config, allow_query, ac,
zone, dns_zone_setqueryacl,
dns_zone_clearqueryacl));
RETERR(configure_zone_acl(zconfig, vconfig, config, allow_query_on, ac,
zone, dns_zone_setqueryonacl,
dns_zone_clearqueryonacl));
CHECK(configure_zone_acl(zconfig, vconfig, config, allow_query_on, ac,
zone, dns_zone_setqueryonacl,
dns_zone_clearqueryonacl));
obj = NULL;
result = named_config_get(maps, "dialup", &obj);
@@ -1171,10 +1169,10 @@ named_zone_configure(const cfg_obj_t *config, const cfg_obj_t *vconfig,
rcvquerystats = NULL;
dnssecsignstats = NULL;
if (statlevel == dns_zonestat_full) {
RETERR(isc_stats_create(mctx, &zoneqrystats,
ns_statscounter_max));
RETERR(dns_rdatatypestats_create(mctx, &rcvquerystats));
RETERR(dns_dnssecsignstats_create(mctx, &dnssecsignstats));
CHECK(isc_stats_create(mctx, &zoneqrystats,
ns_statscounter_max));
CHECK(dns_rdatatypestats_create(mctx, &rcvquerystats));
CHECK(dns_dnssecsignstats_create(mctx, &dnssecsignstats));
}
dns_zone_setrequeststats(zone, zoneqrystats);
dns_zone_setrcvquerystats(zone, rcvquerystats);
@@ -1200,6 +1198,12 @@ named_zone_configure(const cfg_obj_t *config, const cfg_obj_t *vconfig,
if (ztype != dns_zone_stub && ztype != dns_zone_staticstub &&
ztype != dns_zone_redirect)
{
/* Make a reference to the default policy. */
result = dns_kasplist_find(kasplist, "default", &kasp);
INSIST(result == ISC_R_SUCCESS && kasp != NULL);
dns_zone_setdefaultkasp(zone, kasp);
dns_kasp_detach(&kasp);
obj = NULL;
result = named_config_get(maps, "dnssec-policy", &obj);
if (result == ISC_R_SUCCESS) {
@@ -1213,7 +1217,7 @@ named_zone_configure(const cfg_obj_t *config, const cfg_obj_t *vconfig,
ISC_LOG_ERROR,
"dnssec-policy '%s' not found ",
kaspname);
RETERR(result);
CHECK(result);
}
dns_zone_setkasp(zone, kasp);
use_kasp = true;
@@ -1262,9 +1266,9 @@ named_zone_configure(const cfg_obj_t *config, const cfg_obj_t *vconfig,
dns_ipkeylist_t ipkl;
dns_ipkeylist_init(&ipkl);
RETERR(named_config_getipandkeylist(config, "primaries",
obj, mctx, &ipkl));
dns_zone_setalsonotify(zone, ipkl.addrs, ipkl.dscps,
CHECK(named_config_getipandkeylist(config, "primaries",
obj, mctx, &ipkl));
dns_zone_setalsonotify(zone, ipkl.addrs, ipkl.sources,
ipkl.keys, ipkl.tlss,
ipkl.count);
dns_ipkeylist_clear(mctx, &ipkl);
@@ -1275,50 +1279,22 @@ named_zone_configure(const cfg_obj_t *config, const cfg_obj_t *vconfig,
obj = NULL;
result = named_config_get(maps, "parental-source", &obj);
INSIST(result == ISC_R_SUCCESS && obj != NULL);
RETERR(dns_zone_setparentalsrc4(zone, cfg_obj_assockaddr(obj)));
dscp = cfg_obj_getdscp(obj);
if (dscp == -1) {
dscp = named_g_dscp;
}
RETERR(dns_zone_setparentalsrc4dscp(zone, dscp));
named_add_reserved_dispatch(named_g_server,
cfg_obj_assockaddr(obj));
CHECK(dns_zone_setparentalsrc4(zone, cfg_obj_assockaddr(obj)));
obj = NULL;
result = named_config_get(maps, "parental-source-v6", &obj);
INSIST(result == ISC_R_SUCCESS && obj != NULL);
RETERR(dns_zone_setparentalsrc6(zone, cfg_obj_assockaddr(obj)));
dscp = cfg_obj_getdscp(obj);
if (dscp == -1) {
dscp = named_g_dscp;
}
RETERR(dns_zone_setparentalsrc6dscp(zone, dscp));
named_add_reserved_dispatch(named_g_server,
cfg_obj_assockaddr(obj));
CHECK(dns_zone_setparentalsrc6(zone, cfg_obj_assockaddr(obj)));
obj = NULL;
result = named_config_get(maps, "notify-source", &obj);
INSIST(result == ISC_R_SUCCESS && obj != NULL);
RETERR(dns_zone_setnotifysrc4(zone, cfg_obj_assockaddr(obj)));
dscp = cfg_obj_getdscp(obj);
if (dscp == -1) {
dscp = named_g_dscp;
}
RETERR(dns_zone_setnotifysrc4dscp(zone, dscp));
named_add_reserved_dispatch(named_g_server,
cfg_obj_assockaddr(obj));
CHECK(dns_zone_setnotifysrc4(zone, cfg_obj_assockaddr(obj)));
obj = NULL;
result = named_config_get(maps, "notify-source-v6", &obj);
INSIST(result == ISC_R_SUCCESS && obj != NULL);
RETERR(dns_zone_setnotifysrc6(zone, cfg_obj_assockaddr(obj)));
dscp = cfg_obj_getdscp(obj);
if (dscp == -1) {
dscp = named_g_dscp;
}
RETERR(dns_zone_setnotifysrc6dscp(zone, dscp));
named_add_reserved_dispatch(named_g_server,
cfg_obj_assockaddr(obj));
CHECK(dns_zone_setnotifysrc6(zone, cfg_obj_assockaddr(obj)));
obj = NULL;
result = named_config_get(maps, "notify-to-soa", &obj);
@@ -1328,7 +1304,7 @@ named_zone_configure(const cfg_obj_t *config, const cfg_obj_t *vconfig,
dns_zone_setisself(zone, isself, named_g_server->interfacemgr);
RETERR(configure_zone_acl(
CHECK(configure_zone_acl(
zconfig, vconfig, config, allow_transfer, ac, zone,
dns_zone_setxfracl, dns_zone_clearxfracl));
@@ -1358,15 +1334,14 @@ named_zone_configure(const cfg_obj_t *config, const cfg_obj_t *vconfig,
journal_size = -1;
}
} else {
isc_resourcevalue_t value;
value = cfg_obj_asuint64(obj);
uint64_t value = cfg_obj_asuint64(obj);
if (value > DNS_JOURNAL_SIZE_MAX) {
cfg_obj_log(obj, named_g_lctx, ISC_LOG_ERROR,
"'max-journal-size "
"%" PRId64 "' "
"is too large",
value);
RETERR(ISC_R_RANGE);
CHECK(ISC_R_RANGE);
}
journal_size = (uint32_t)value;
}
@@ -1472,6 +1447,12 @@ named_zone_configure(const cfg_obj_t *config, const cfg_obj_t *vconfig,
}
dns_zone_setoption(zone, DNS_ZONEOPT_CHECKSPF, check);
obj = NULL;
result = named_config_get(maps, "check-svcb", &obj);
INSIST(result == ISC_R_SUCCESS && obj != NULL);
dns_zone_setoption(zone, DNS_ZONEOPT_CHECKSVCB,
cfg_obj_asboolean(obj));
obj = NULL;
result = named_config_get(maps, "zero-no-soa-ttl", &obj);
INSIST(result == ISC_R_SUCCESS && obj != NULL);
@@ -1498,15 +1479,14 @@ named_zone_configure(const cfg_obj_t *config, const cfg_obj_t *vconfig,
journal_size = -1;
}
} else {
isc_resourcevalue_t value;
value = cfg_obj_asuint64(obj);
uint64_t value = cfg_obj_asuint64(obj);
if (value > DNS_JOURNAL_SIZE_MAX) {
cfg_obj_log(obj, named_g_lctx, ISC_LOG_ERROR,
"'max-journal-size "
"%" PRId64 "' "
"is too large",
value);
RETERR(ISC_R_RANGE);
CHECK(ISC_R_RANGE);
}
journal_size = (uint32_t)value;
}
@@ -1536,9 +1516,9 @@ named_zone_configure(const cfg_obj_t *config, const cfg_obj_t *vconfig,
if (ztype == dns_zone_primary) {
dns_acl_t *updateacl;
RETERR(configure_zone_acl(
zconfig, vconfig, config, allow_update, ac, mayberaw,
dns_zone_setupdateacl, dns_zone_clearupdateacl));
CHECK(configure_zone_acl(zconfig, vconfig, config, allow_update,
ac, mayberaw, dns_zone_setupdateacl,
dns_zone_clearupdateacl));
updateacl = dns_zone_getupdateacl(mayberaw);
if (updateacl != NULL && dns_acl_isinsecure(updateacl)) {
@@ -1549,7 +1529,7 @@ named_zone_configure(const cfg_obj_t *config, const cfg_obj_t *vconfig,
zname);
}
RETERR(configure_zone_ssutable(zoptions, mayberaw, zname));
CHECK(configure_zone_ssutable(zoptions, mayberaw, zname));
}
/*
@@ -1626,7 +1606,7 @@ named_zone_configure(const cfg_obj_t *config, const cfg_obj_t *vconfig,
result = named_config_get(maps, "key-directory", &obj);
if (result == ISC_R_SUCCESS) {
filename = cfg_obj_asstring(obj);
RETERR(dns_zone_setkeydirectory(zone, filename));
CHECK(dns_zone_setkeydirectory(zone, filename));
}
obj = NULL;
@@ -1668,8 +1648,8 @@ named_zone_configure(const cfg_obj_t *config, const cfg_obj_t *vconfig,
result = named_config_get(maps, "dnssec-loadkeys-interval",
&obj);
INSIST(result == ISC_R_SUCCESS && obj != NULL);
RETERR(dns_zone_setrefreshkeyinterval(zone,
cfg_obj_asuint32(obj)));
CHECK(dns_zone_setrefreshkeyinterval(zone,
cfg_obj_asuint32(obj)));
obj = NULL;
result = cfg_map_get(zoptions, "auto-dnssec", &obj);
@@ -1697,10 +1677,10 @@ named_zone_configure(const cfg_obj_t *config, const cfg_obj_t *vconfig,
}
if (ztype == dns_zone_secondary || ztype == dns_zone_mirror) {
RETERR(configure_zone_acl(zconfig, vconfig, config,
allow_update_forwarding, ac, mayberaw,
dns_zone_setforwardacl,
dns_zone_clearforwardacl));
CHECK(configure_zone_acl(zconfig, vconfig, config,
allow_update_forwarding, ac, mayberaw,
dns_zone_setforwardacl,
dns_zone_clearforwardacl));
}
/*%
@@ -1712,13 +1692,13 @@ named_zone_configure(const cfg_obj_t *config, const cfg_obj_t *vconfig,
if (obj != NULL) {
dns_ipkeylist_t ipkl;
dns_ipkeylist_init(&ipkl);
RETERR(named_config_getipandkeylist(
CHECK(named_config_getipandkeylist(
config, "parental-agents", obj, mctx, &ipkl));
dns_zone_setparentals(zone, ipkl.addrs, ipkl.keys,
ipkl.tlss, ipkl.count);
dns_zone_setparentals(zone, ipkl.addrs, ipkl.sources,
ipkl.keys, ipkl.tlss, ipkl.count);
dns_ipkeylist_clear(mctx, &ipkl);
} else {
dns_zone_setparentals(zone, NULL, NULL, NULL, 0);
dns_zone_setparentals(zone, NULL, NULL, NULL, NULL, 0);
}
}
@@ -1807,13 +1787,6 @@ named_zone_configure(const cfg_obj_t *config, const cfg_obj_t *vconfig,
dns_zone_setoption(mayberaw, DNS_ZONEOPT_IGNORESRVCNAME,
ignore);
obj = NULL;
result = named_config_get(maps, "dnssec-secure-to-insecure",
&obj);
INSIST(result == ISC_R_SUCCESS && obj != NULL);
dns_zone_setoption(mayberaw, DNS_ZONEOPT_SECURETOINSECURE,
cfg_obj_asboolean(obj));
obj = NULL;
result = cfg_map_get(zoptions, "dnssec-update-mode", &obj);
if (result == ISC_R_SUCCESS) {
@@ -1856,7 +1829,7 @@ named_zone_configure(const cfg_obj_t *config, const cfg_obj_t *vconfig,
(void)cfg_map_get(zoptions, "allow-transfer", &obj);
if (obj == NULL) {
dns_acl_t *none;
RETERR(dns_acl_none(mctx, &none));
CHECK(dns_acl_none(mctx, &none));
dns_zone_setxfracl(zone, none);
dns_acl_detach(&none);
}
@@ -1881,20 +1854,22 @@ named_zone_configure(const cfg_obj_t *config, const cfg_obj_t *vconfig,
result = named_config_getremotesdef(
named_g_config, "primaries",
DEFAULT_IANA_ROOT_ZONE_PRIMARIES, &obj);
RETERR(result);
CHECK(result);
}
if (obj != NULL) {
dns_ipkeylist_t ipkl;
dns_ipkeylist_init(&ipkl);
RETERR(named_config_getipandkeylist(config, "primaries",
obj, mctx, &ipkl));
dns_zone_setprimaries(mayberaw, ipkl.addrs, ipkl.keys,
CHECK(named_config_getipandkeylist(config, "primaries",
obj, mctx, &ipkl));
dns_zone_setprimaries(mayberaw, ipkl.addrs,
ipkl.sources, ipkl.keys,
ipkl.tlss, ipkl.count);
count = ipkl.count;
dns_ipkeylist_clear(mctx, &ipkl);
} else {
dns_zone_setprimaries(mayberaw, NULL, NULL, NULL, 0);
dns_zone_setprimaries(mayberaw, NULL, NULL, NULL, NULL,
0);
}
multi = false;
@@ -1939,69 +1914,14 @@ named_zone_configure(const cfg_obj_t *config, const cfg_obj_t *vconfig,
obj = NULL;
result = named_config_get(maps, "transfer-source", &obj);
INSIST(result == ISC_R_SUCCESS && obj != NULL);
RETERR(dns_zone_setxfrsource4(mayberaw,
cfg_obj_assockaddr(obj)));
dscp = cfg_obj_getdscp(obj);
if (dscp == -1) {
dscp = named_g_dscp;
}
RETERR(dns_zone_setxfrsource4dscp(mayberaw, dscp));
named_add_reserved_dispatch(named_g_server,
cfg_obj_assockaddr(obj));
CHECK(dns_zone_setxfrsource4(mayberaw,
cfg_obj_assockaddr(obj)));
obj = NULL;
result = named_config_get(maps, "transfer-source-v6", &obj);
INSIST(result == ISC_R_SUCCESS && obj != NULL);
RETERR(dns_zone_setxfrsource6(mayberaw,
cfg_obj_assockaddr(obj)));
dscp = cfg_obj_getdscp(obj);
if (dscp == -1) {
dscp = named_g_dscp;
}
RETERR(dns_zone_setxfrsource6dscp(mayberaw, dscp));
named_add_reserved_dispatch(named_g_server,
cfg_obj_assockaddr(obj));
obj = NULL;
result = named_config_get(maps, "alt-transfer-source", &obj);
INSIST(result == ISC_R_SUCCESS && obj != NULL);
RETERR(dns_zone_setaltxfrsource4(mayberaw,
cfg_obj_assockaddr(obj)));
dscp = cfg_obj_getdscp(obj);
if (dscp == -1) {
dscp = named_g_dscp;
}
RETERR(dns_zone_setaltxfrsource4dscp(mayberaw, dscp));
obj = NULL;
result = named_config_get(maps, "alt-transfer-source-v6", &obj);
INSIST(result == ISC_R_SUCCESS && obj != NULL);
RETERR(dns_zone_setaltxfrsource6(mayberaw,
cfg_obj_assockaddr(obj)));
dscp = cfg_obj_getdscp(obj);
if (dscp == -1) {
dscp = named_g_dscp;
}
RETERR(dns_zone_setaltxfrsource6dscp(mayberaw, dscp));
obj = NULL;
(void)named_config_get(maps, "use-alt-transfer-source", &obj);
if (obj == NULL) {
/*
* Default off when views are in use otherwise
* on for BIND 8 compatibility.
*/
view = dns_zone_getview(zone);
if (view != NULL && strcmp(view->name, "_default") == 0)
{
alt = true;
} else {
alt = false;
}
} else {
alt = cfg_obj_asboolean(obj);
}
dns_zone_setoption(mayberaw, DNS_ZONEOPT_USEALTXFRSRC, alt);
CHECK(dns_zone_setxfrsource6(mayberaw,
cfg_obj_assockaddr(obj)));
obj = NULL;
(void)named_config_get(maps, "try-tcp-refresh", &obj);
@@ -2010,15 +1930,21 @@ named_zone_configure(const cfg_obj_t *config, const cfg_obj_t *vconfig,
break;
case dns_zone_staticstub:
RETERR(configure_staticstub(zoptions, zone, zname,
default_dbtype));
CHECK(configure_staticstub(zoptions, zone, zname,
default_dbtype));
break;
default:
break;
}
return (ISC_R_SUCCESS);
result = ISC_R_SUCCESS;
cleanup:
if (kasp != NULL) {
dns_kasp_detach(&kasp);
}
return (result);
}
/*
-4
View File
@@ -4,8 +4,6 @@ AM_CPPFLAGS += \
$(LIBISC_CFLAGS) \
$(LIBDNS_CFLAGS) \
$(LIBISCCFG_CFLAGS) \
$(LIBIRS_CFLAGS) \
$(LIBBIND9_CFLAGS) \
$(GSSAPI_CFLAGS) \
$(KRB5_CFLAGS) \
$(READLINE_CFLAGS)
@@ -17,8 +15,6 @@ LDADD += \
$(LIBISC_LIBS) \
$(LIBDNS_LIBS) \
$(LIBISCCFG_LIBS) \
$(LIBIRS_LIBS) \
$(LIBBIND9_LIBS) \
$(GSSAPI_LIBS) \
$(KRB5_LIBS)
+276 -132
View File
@@ -25,8 +25,8 @@
#include <isc/base64.h>
#include <isc/buffer.h>
#include <isc/commandline.h>
#include <isc/event.h>
#include <isc/file.h>
#include <isc/getaddresses.h>
#include <isc/hash.h>
#include <isc/job.h>
#include <isc/lex.h>
@@ -38,21 +38,19 @@
#include <isc/nonce.h>
#include <isc/parseint.h>
#include <isc/portset.h>
#include <isc/print.h>
#include <isc/random.h>
#include <isc/region.h>
#include <isc/result.h>
#include <isc/sockaddr.h>
#include <isc/stdio.h>
#include <isc/string.h>
#include <isc/task.h>
#include <isc/tls.h>
#include <isc/types.h>
#include <isc/util.h>
#include <dns/callbacks.h>
#include <dns/dispatch.h>
#include <dns/dnssec.h>
#include <dns/events.h>
#include <dns/fixedname.h>
#include <dns/log.h>
#include <dns/masterdump.h>
@@ -68,6 +66,7 @@
#include <dns/rdatatype.h>
#include <dns/request.h>
#include <dns/tkey.h>
#include <dns/transport.h>
#include <dns/tsig.h>
#include <dst/dst.h>
@@ -93,8 +92,6 @@
#endif /* HAVE_GSSAPI */
#include <bind9/getaddresses.h>
#include "../dig/readline.h"
#define MAXCMD (128 * 1024)
@@ -106,7 +103,7 @@
#define DNSDEFAULTPORT 53
/* Number of addresses to request from bind9_getaddresses() */
/* Number of addresses to request from isc_getaddresses() */
#define MAX_SERVERADDRS 4
static uint16_t dnsport = DNSDEFAULTPORT;
@@ -120,15 +117,14 @@ static bool memdebugging = false;
static bool have_ipv4 = false;
static bool have_ipv6 = false;
static bool is_dst_up = false;
static bool use_tls = false;
static bool usevc = false;
static bool usegsstsig = false;
static bool use_win2k_gsstsig = false;
static bool tried_other_gsstsig = false;
static bool local_only = false;
static isc_nm_t *netmgr = NULL;
static isc_taskmgr_t *taskmgr = NULL;
static isc_loopmgr_t *loopmgr = NULL;
static isc_task_t *global_task = NULL;
static isc_log_t *glctx = NULL;
static isc_mem_t *gmctx = NULL;
static dns_dispatchmgr_t *dispatchmgr = NULL;
@@ -147,6 +143,14 @@ static dns_tsigkey_t *tsigkey = NULL;
static dst_key_t *sig0key = NULL;
static isc_sockaddr_t *servers = NULL;
static isc_sockaddr_t *primary_servers = NULL;
static dns_transport_list_t *transport_list = NULL;
static dns_transport_t *transport = NULL;
static isc_tlsctx_cache_t *tls_ctx_cache = NULL;
static char *tls_hostname = NULL;
static char *tls_client_key_file = NULL;
static char *tls_client_cert_file = NULL;
static char *tls_ca_file = NULL;
static bool tls_always_verify_remote = true;
static bool default_servers = true;
static int ns_inuse = 0;
static int primary_inuse = 0;
@@ -175,6 +179,7 @@ static dns_message_t *answer = NULL;
static uint32_t default_ttl = 0;
static bool default_ttl_set = false;
static bool checknames = true;
static bool checksvcb = true;
static const char *resolvconf = RESOLV_CONF;
bool done = false;
@@ -222,7 +227,7 @@ static void
send_gssrequest(isc_sockaddr_t *destaddr, dns_message_t *msg,
dns_request_t **request, gss_ctx_id_t context);
static void
recvgss(isc_task_t *task, isc_event_t *event);
recvgss(void *arg);
#endif /* HAVE_GSSAPI */
static void
@@ -793,6 +798,19 @@ set_source_ports(dns_dispatchmgr_t *manager) {
isc_portset_destroy(gmctx, &v6portset);
}
static isc_result_t
create_name(const char *str, char *namedata, size_t len, dns_name_t *name) {
isc_buffer_t namesrc, namebuf;
dns_name_init(name, NULL);
isc_buffer_constinit(&namesrc, str, strlen(str));
isc_buffer_add(&namesrc, strlen(str));
isc_buffer_init(&namebuf, namedata, len);
return (dns_name_fromtext(name, &namesrc, dns_rootname,
DNS_NAME_DOWNCASE, &namebuf));
}
static void
setup_system(void) {
isc_result_t result;
@@ -800,6 +818,8 @@ setup_system(void) {
isc_sockaddrlist_t *nslist;
isc_logconfig_t *logconfig = NULL;
irs_resconf_t *resconf = NULL;
dns_name_t tlsname;
char namedata[DNS_NAME_FORMATSIZE + 1];
ddebug("setup_system()");
@@ -862,7 +882,8 @@ setup_system(void) {
*/
ns_total = 0;
for (sa = ISC_LIST_HEAD(*nslist); sa != NULL;
sa = ISC_LIST_NEXT(sa, link)) {
sa = ISC_LIST_NEXT(sa, link))
{
switch (sa->type.sa.sa_family) {
case AF_INET:
if (have_ipv4) {
@@ -884,7 +905,8 @@ setup_system(void) {
i = 0;
for (sa = ISC_LIST_HEAD(*nslist); sa != NULL;
sa = ISC_LIST_NEXT(sa, link)) {
sa = ISC_LIST_NEXT(sa, link))
{
switch (sa->type.sa.sa_family) {
case AF_INET:
if (have_ipv4) {
@@ -914,9 +936,6 @@ setup_system(void) {
result = dns_dispatchmgr_create(gmctx, netmgr, &dispatchmgr);
check_result(result, "dns_dispatchmgr_create");
result = isc_task_create(taskmgr, &global_task, 0);
check_result(result, "isc_task_create");
result = dst_lib_init(gmctx, NULL);
check_result(result, "dst_lib_init");
is_dst_up = true;
@@ -936,8 +955,33 @@ setup_system(void) {
&dispatchv4);
check_result(result, "dns_dispatch_createudp (v4)");
}
transport_list = dns_transport_list_new(gmctx);
result = dns_requestmgr_create(gmctx, taskmgr, dispatchmgr, dispatchv4,
isc_tlsctx_cache_create(gmctx, &tls_ctx_cache);
if (tls_client_key_file == NULL) {
result = create_name("tls-non-auth-client", namedata,
sizeof(namedata), &tlsname);
check_result(result, "create_name (tls-non-auth-client)");
transport = dns_transport_new(&tlsname, DNS_TRANSPORT_TLS,
transport_list);
dns_transport_set_tlsname(transport, "tls-non-auth-client");
} else {
result = create_name("tls-auth-client", namedata,
sizeof(namedata), &tlsname);
check_result(result, "create_name (tls-auth-client)");
transport = dns_transport_new(&tlsname, DNS_TRANSPORT_TLS,
transport_list);
dns_transport_set_tlsname(transport, "tls-auth-client");
dns_transport_set_keyfile(transport, tls_client_key_file);
dns_transport_set_certfile(transport, tls_client_cert_file);
}
dns_transport_set_cafile(transport, tls_ca_file);
dns_transport_set_remote_hostname(transport, tls_hostname);
dns_transport_set_always_verify_remote(transport,
tls_always_verify_remote);
result = dns_requestmgr_create(gmctx, dispatchmgr, dispatchv4,
dispatchv6, &requestmgr);
check_result(result, "dns_requestmgr_create");
@@ -963,7 +1007,7 @@ get_addresses(char *host, in_port_t port, isc_sockaddr_t *sockaddr,
isc_result_t result;
isc_loopmgr_blocking(loopmgr);
result = bind9_getaddresses(host, port, sockaddr, naddrs, &count);
result = isc_getaddresses(host, port, sockaddr, naddrs, &count);
isc_loopmgr_nonblocking(loopmgr);
if (result != ISC_R_SUCCESS) {
error("couldn't get address for '%s': %s", host,
@@ -972,7 +1016,7 @@ get_addresses(char *host, in_port_t port, isc_sockaddr_t *sockaddr,
return (count);
}
#define PARSE_ARGS_FMT "46C:dDghilL:Mok:p:Pr:R:t:Tu:vVy:"
#define PARSE_ARGS_FMT "46A:C:dDE:ghH:iK:lL:MoOk:p:Pr:R:St:Tu:vVy:"
static void
pre_parse_args(int argc, char **argv) {
@@ -1015,7 +1059,9 @@ pre_parse_args(int argc, char **argv) {
fprintf(stderr, "usage: nsupdate [-CdDi] [-L level] "
"[-l] [-g | -o | -y keyname:secret "
"| -k keyfile] [-p port] "
"[-v] [-V] [-P] [-T] [-4 | -6] "
"[ -S [-K tlskeyfile] [-E tlscertfile] "
"[-A tlscafile] [-H tlshostname] "
"[-O] ] [-v] [-V] [-P] [-T] [-4 | -6] "
"[filename]\n");
exit(1);
@@ -1087,6 +1133,11 @@ parse_args(int argc, char **argv) {
fatal("can't find IPv6 networking");
}
break;
case 'A':
use_tls = true;
usevc = true;
tls_ca_file = isc_commandline_argument;
break;
case 'C':
resolvconf = isc_commandline_argument;
break;
@@ -1097,12 +1148,27 @@ parse_args(int argc, char **argv) {
debugging = true;
ddebugging = true;
break;
case 'E':
use_tls = true;
usevc = true;
tls_client_cert_file = isc_commandline_argument;
break;
case 'H':
use_tls = true;
usevc = true;
tls_hostname = isc_commandline_argument;
break;
case 'M':
break;
case 'i':
force_interactive = true;
interactive = true;
break;
case 'K':
use_tls = true;
usevc = true;
tls_client_key_file = isc_commandline_argument;
break;
case 'l':
local_only = true;
break;
@@ -1135,6 +1201,11 @@ parse_args(int argc, char **argv) {
usegsstsig = true;
use_win2k_gsstsig = true;
break;
case 'O':
use_tls = true;
usevc = true;
tls_always_verify_remote = false;
break;
case 'p':
result = isc_parse_uint16(&dnsport,
isc_commandline_argument, 10);
@@ -1146,6 +1217,10 @@ parse_args(int argc, char **argv) {
exit(1);
}
break;
case 'S':
use_tls = true;
usevc = true;
break;
case 't':
result = isc_parse_uint32(&timeout,
isc_commandline_argument, 10);
@@ -1211,6 +1286,25 @@ parse_args(int argc, char **argv) {
}
#endif /* HAVE_GSSAPI */
if (use_tls) {
if ((tls_client_key_file == NULL) !=
(tls_client_cert_file == NULL))
{
fprintf(stderr,
"%s: cannot specify the -K option without"
"the -E option, and vice versa.\n",
argv[0]);
exit(1);
}
if (tls_ca_file != NULL && tls_always_verify_remote == false) {
fprintf(stderr,
"%s: cannot specify the -A option in "
"conjuction with the -O option.\n",
argv[0]);
exit(1);
}
}
if (argv[isc_commandline_index] != NULL) {
if (strcmp(argv[isc_commandline_index], "-") == 0) {
input = stdin;
@@ -1277,8 +1371,7 @@ parse_rdata(char **cmdlinep, dns_rdataclass_t rdataclass,
if (*cmdline != 0) {
dns_rdatacallbacks_init(&callbacks);
result = isc_lex_create(gmctx, strlen(cmdline), &lex);
check_result(result, "isc_lex_create");
isc_lex_create(gmctx, strlen(cmdline), &lex);
isc_buffer_init(&source, cmdline, strlen(cmdline));
isc_buffer_add(&source, strlen(cmdline));
result = isc_lex_openbuffer(lex, &source);
@@ -1494,9 +1587,8 @@ evaluate_server(char *cmdline) {
ns_alloc = MAX_SERVERADDRS;
ns_inuse = 0;
servers = isc_mem_get(gmctx, ns_alloc * sizeof(isc_sockaddr_t));
memset(servers, 0, ns_alloc * sizeof(isc_sockaddr_t));
servers = isc_mem_getx(gmctx, ns_alloc * sizeof(isc_sockaddr_t),
ISC_MEM_ZERO);
ns_total = get_addresses(server, (in_port_t)port, servers, ns_alloc);
if (ns_total == 0) {
return (STATUS_SYNTAX);
@@ -1902,7 +1994,8 @@ parseclass:
dns_name_t *bad;
if (!dns_rdata_checkowner(name, rdata->rdclass, rdata->type,
true)) {
true))
{
char namebuf[DNS_NAME_FORMATSIZE];
dns_name_format(name, namebuf, sizeof(namebuf));
@@ -1922,6 +2015,15 @@ parseclass:
}
}
if (!isdelete && checksvcb && rdata->type == dns_rdatatype_svcb) {
result = dns_rdata_checksvcb(name, rdata);
if (result != ISC_R_SUCCESS) {
fprintf(stderr, "check-svcb failed: %s\n",
isc_result_totext(result));
goto failure;
}
}
if (!isdelete && rdata->type == dns_rdatatype_nsec3param) {
dns_rdata_nsec3param_t nsec3param;
@@ -2008,6 +2110,32 @@ evaluate_checknames(char *cmdline) {
return (STATUS_MORE);
}
static uint16_t
evaluate_checksvcb(char *cmdline) {
char *word;
ddebug("evaluate_checksvcb()");
word = nsu_strsep(&cmdline, " \t\r\n");
if (word == NULL || *word == 0) {
fprintf(stderr, "could not read check-svcb directive\n");
return (STATUS_SYNTAX);
}
if (strcasecmp(word, "yes") == 0 || strcasecmp(word, "true") == 0 ||
strcasecmp(word, "on") == 0)
{
checksvcb = true;
} else if (strcasecmp(word, "no") == 0 ||
strcasecmp(word, "false") == 0 ||
strcasecmp(word, "off") == 0)
{
checksvcb = false;
} else {
fprintf(stderr, "incorrect check-svcb directive: %s\n", word);
return (STATUS_SYNTAX);
}
return (STATUS_MORE);
}
static void
setzone(dns_name_t *zonename) {
isc_result_t result;
@@ -2164,9 +2292,15 @@ do_next_command(char *cmdline) {
return (evaluate_realm(cmdline));
}
if (strcasecmp(word, "check-names") == 0 ||
strcasecmp(word, "checknames") == 0) {
strcasecmp(word, "checknames") == 0)
{
return (evaluate_checknames(cmdline));
}
if (strcasecmp(word, "check-svcb") == 0 ||
strcasecmp(word, "checksvcb") == 0)
{
return (evaluate_checksvcb(cmdline));
}
if (strcasecmp(word, "gsstsig") == 0) {
#if HAVE_GSSAPI
usegsstsig = true;
@@ -2333,32 +2467,24 @@ next_primary(const char *caller, isc_sockaddr_t *addr, isc_result_t eresult) {
}
static void
update_completed(isc_task_t *task, isc_event_t *event) {
dns_requestevent_t *reqev = NULL;
update_completed(void *arg) {
dns_request_t *request = (dns_request_t *)arg;
isc_result_t result;
dns_request_t *request;
UNUSED(task);
ddebug("update_completed()");
requests--;
REQUIRE(event->ev_type == DNS_EVENT_REQUESTDONE);
reqev = (dns_requestevent_t *)event;
request = reqev->request;
if (shuttingdown) {
dns_request_destroy(&request);
isc_event_free(&event);
maybeshutdown();
return;
}
if (reqev->result != ISC_R_SUCCESS) {
result = dns_request_getresult(request);
if (result != ISC_R_SUCCESS) {
if (!next_primary("update_completed",
&primary_servers[primary_inuse],
reqev->result))
&primary_servers[primary_inuse], result))
{
seenerror = true;
goto done;
@@ -2369,7 +2495,6 @@ update_completed(isc_task_t *task, isc_event_t *event) {
dns_message_renderreset(updatemsg);
dns_message_settsigkey(updatemsg, NULL);
send_update(zname, &primary_servers[primary_inuse]);
isc_event_free(&event);
return;
}
@@ -2440,7 +2565,6 @@ done:
dns_name_init(&tmpzonename, 0);
dns_name_init(&restart_primary, 0);
}
isc_event_free(&event);
done_update();
}
@@ -2448,8 +2572,10 @@ static void
send_update(dns_name_t *zone, isc_sockaddr_t *primary) {
isc_result_t result;
dns_request_t *request = NULL;
unsigned int options = DNS_REQUESTOPT_CASE;
isc_sockaddr_t *srcaddr;
unsigned int options = DNS_REQUESTOPT_CASE | DNS_REQUESTOPT_LARGE;
dns_transport_t *req_transport = NULL;
isc_tlsctx_cache_t *req_tls_ctx_cache = NULL;
ddebug("send_update()");
@@ -2457,7 +2583,12 @@ send_update(dns_name_t *zone, isc_sockaddr_t *primary) {
if (usevc) {
options |= DNS_REQUESTOPT_TCP;
if (use_tls) {
req_transport = transport;
req_tls_ctx_cache = tls_ctx_cache;
}
}
if (tsigkey == NULL && sig0key != NULL) {
result = dns_message_setsig0key(updatemsg, sig0key);
check_result(result, "dns_message_setsig0key");
@@ -2477,14 +2608,15 @@ send_update(dns_name_t *zone, isc_sockaddr_t *primary) {
/* Windows doesn't like the tsig name to be compressed. */
if (updatemsg->tsigname) {
updatemsg->tsigname->attributes |= DNS_NAMEATTR_NOCOMPRESS;
updatemsg->tsigname->attributes.nocompress = true;
}
result = dns_request_createvia(requestmgr, updatemsg, srcaddr, primary,
-1, options, tsigkey, timeout,
udp_timeout, udp_retries, global_task,
update_completed, NULL, &request);
check_result(result, "dns_request_createvia");
result = dns_request_create(requestmgr, updatemsg, srcaddr, primary,
req_transport, req_tls_ctx_cache, options,
tsigkey, timeout, udp_timeout, udp_retries,
isc_loop_main(loopmgr), update_completed,
NULL, &request);
check_result(result, "dns_request_create");
if (debugging) {
show_message(stdout, updatemsg, "Outgoing update query:");
@@ -2508,10 +2640,11 @@ next_server(const char *caller, isc_sockaddr_t *addr, isc_result_t eresult) {
}
static void
recvsoa(isc_task_t *task, isc_event_t *event) {
dns_requestevent_t *reqev = NULL;
dns_request_t *request = NULL;
isc_result_t result, eresult;
recvsoa(void *arg) {
dns_request_t *request = (dns_request_t *)arg;
isc_result_t result, eresult = dns_request_getresult(request);
nsu_requestinfo_t *reqinfo = dns_request_getarg(request);
dns_message_t *soaquery = reqinfo->msg;
dns_message_t *rcvmsg = NULL;
dns_section_t section;
dns_name_t *name = NULL;
@@ -2520,33 +2653,20 @@ recvsoa(isc_task_t *task, isc_event_t *event) {
dns_rdata_t soarr = DNS_RDATA_INIT;
int pass = 0;
dns_name_t primary;
nsu_requestinfo_t *reqinfo;
dns_message_t *soaquery = NULL;
isc_sockaddr_t *addr;
isc_sockaddr_t *srcaddr;
isc_sockaddr_t *addr = reqinfo->addr;
isc_sockaddr_t *srcaddr = NULL;
bool seencname = false;
dns_name_t tname;
unsigned int nlabels;
UNUSED(task);
ddebug("recvsoa()");
requests--;
REQUIRE(event->ev_type == DNS_EVENT_REQUESTDONE);
reqev = (dns_requestevent_t *)event;
request = reqev->request;
eresult = reqev->result;
reqinfo = reqev->ev_arg;
soaquery = reqinfo->msg;
addr = reqinfo->addr;
if (shuttingdown) {
dns_request_destroy(&request);
dns_message_detach(&soaquery);
isc_mem_put(gmctx, reqinfo, sizeof(nsu_requestinfo_t));
isc_event_free(&event);
maybeshutdown();
return;
}
@@ -2559,21 +2679,22 @@ recvsoa(isc_task_t *task, isc_event_t *event) {
dns_message_settsigkey(soaquery, NULL);
sendrequest(&servers[ns_inuse], soaquery, &request);
isc_mem_put(gmctx, reqinfo, sizeof(nsu_requestinfo_t));
isc_event_free(&event);
setzoneclass(dns_rdataclass_none);
return;
}
isc_mem_put(gmctx, reqinfo, sizeof(nsu_requestinfo_t));
reqinfo = NULL;
isc_event_free(&event);
reqev = NULL;
ddebug("About to create rcvmsg");
dns_message_create(gmctx, DNS_MESSAGE_INTENTPARSE, &rcvmsg);
result = dns_request_getresponse(request, rcvmsg,
DNS_MESSAGEPARSE_PRESERVEORDER);
if (result == DNS_R_TSIGERRORSET && servers != NULL) {
unsigned int options = DNS_REQUESTOPT_CASE;
dns_transport_t *req_transport = NULL;
isc_tlsctx_cache_t *req_tls_ctx_cache = NULL;
dns_message_detach(&rcvmsg);
ddebug("Destroying request [%p]", request);
dns_request_destroy(&request);
@@ -2583,17 +2704,26 @@ recvsoa(isc_task_t *task, isc_event_t *event) {
dns_message_renderreset(soaquery);
ddebug("retrying soa request without TSIG");
if (usevc) {
options |= DNS_REQUESTOPT_TCP;
if (!default_servers && use_tls) {
req_transport = transport;
req_tls_ctx_cache = tls_ctx_cache;
}
}
if (isc_sockaddr_pf(addr) == AF_INET6) {
srcaddr = localaddr6;
} else {
srcaddr = localaddr4;
}
result = dns_request_createvia(
requestmgr, soaquery, srcaddr, addr, -1, 0, NULL,
FIND_TIMEOUT * 20, FIND_TIMEOUT, 3, global_task,
recvsoa, reqinfo, &request);
check_result(result, "dns_request_createvia");
result = dns_request_create(
requestmgr, soaquery, srcaddr, addr, req_transport,
req_tls_ctx_cache, options, NULL, FIND_TIMEOUT * 20,
FIND_TIMEOUT, 3, isc_loop_main(loopmgr), recvsoa,
reqinfo, &request);
check_result(result, "dns_request_create");
requests++;
return;
}
@@ -2620,7 +2750,8 @@ recvsoa(isc_task_t *task, isc_event_t *event) {
}
if (rcvmsg->rcode != dns_rcode_noerror &&
rcvmsg->rcode != dns_rcode_nxdomain) {
rcvmsg->rcode != dns_rcode_nxdomain)
{
fatal("response to SOA query was unsuccessful");
}
@@ -2632,8 +2763,8 @@ recvsoa(isc_task_t *task, isc_event_t *event) {
dns_request_destroy(&request);
dns_message_detach(&soaquery);
ddebug("Out of recvsoa");
done_update();
seenerror = true;
done_update();
return;
}
@@ -2734,13 +2865,18 @@ lookforsoa:
}
primary_alloc = MAX_SERVERADDRS;
size = primary_alloc * sizeof(isc_sockaddr_t);
primary_servers = isc_mem_get(gmctx, size);
memset(primary_servers, 0, size);
primary_servers = isc_mem_getx(gmctx, size, ISC_MEM_ZERO);
primary_total = get_addresses(serverstr, dnsport,
primary_servers, primary_alloc);
if (primary_total == 0) {
exit(1);
seenerror = true;
dns_rdata_freestruct(&soa);
dns_message_detach(&soaquery);
dns_request_destroy(&request);
dns_message_detach(&rcvmsg);
ddebug("Out of recvsoa");
done_update();
return;
}
primary_inuse = 0;
} else {
@@ -2797,6 +2933,17 @@ sendrequest(isc_sockaddr_t *destaddr, dns_message_t *msg,
isc_result_t result;
nsu_requestinfo_t *reqinfo;
isc_sockaddr_t *srcaddr;
unsigned int options = DNS_REQUESTOPT_CASE;
dns_transport_t *req_transport = NULL;
isc_tlsctx_cache_t *req_tls_ctx_cache = NULL;
if (usevc) {
options |= DNS_REQUESTOPT_TCP;
if (!default_servers && use_tls) {
req_transport = transport;
req_tls_ctx_cache = tls_ctx_cache;
}
}
reqinfo = isc_mem_get(gmctx, sizeof(nsu_requestinfo_t));
reqinfo->msg = msg;
@@ -2808,11 +2955,12 @@ sendrequest(isc_sockaddr_t *destaddr, dns_message_t *msg,
srcaddr = localaddr4;
}
result = dns_request_createvia(requestmgr, msg, srcaddr, destaddr, -1,
0, default_servers ? NULL : tsigkey,
FIND_TIMEOUT * 20, FIND_TIMEOUT, 3,
global_task, recvsoa, reqinfo, request);
check_result(result, "dns_request_createvia");
result = dns_request_create(
requestmgr, msg, srcaddr, destaddr, req_transport,
req_tls_ctx_cache, options, default_servers ? NULL : tsigkey,
FIND_TIMEOUT * 20, FIND_TIMEOUT, 3, isc_loop_main(loopmgr),
recvsoa, reqinfo, request);
check_result(result, "dns_request_create");
requests++;
}
@@ -2953,7 +3101,7 @@ start_gssrequest(dns_name_t *primary) {
}
/* Windows doesn't recognize name compression in the key name. */
keyname->attributes |= DNS_NAMEATTR_NOCOMPRESS;
keyname->attributes.nocompress = true;
rmsg = NULL;
dns_message_create(gmctx, DNS_MESSAGE_INTENTRENDER, &rmsg);
@@ -2990,19 +3138,26 @@ static void
send_gssrequest(isc_sockaddr_t *destaddr, dns_message_t *msg,
dns_request_t **request, gss_ctx_id_t context) {
isc_result_t result;
nsu_gssinfo_t *reqinfo;
unsigned int options = 0;
isc_sockaddr_t *srcaddr;
nsu_gssinfo_t *reqinfo = NULL;
isc_sockaddr_t *srcaddr = NULL;
unsigned int options = DNS_REQUESTOPT_CASE | DNS_REQUESTOPT_TCP;
dns_transport_t *req_transport = NULL;
isc_tlsctx_cache_t *req_tls_ctx_cache = NULL;
if (!default_servers && use_tls) {
req_transport = transport;
req_tls_ctx_cache = tls_ctx_cache;
}
debug("send_gssrequest");
REQUIRE(destaddr != NULL);
reqinfo = isc_mem_get(gmctx, sizeof(nsu_gssinfo_t));
reqinfo->msg = msg;
reqinfo->addr = destaddr;
reqinfo->context = context;
options |= DNS_REQUESTOPT_TCP;
*reqinfo = (nsu_gssinfo_t){
.msg = msg,
.addr = destaddr,
.context = context,
};
if (isc_sockaddr_pf(destaddr) == AF_INET6) {
srcaddr = localaddr6;
@@ -3010,11 +3165,12 @@ send_gssrequest(isc_sockaddr_t *destaddr, dns_message_t *msg,
srcaddr = localaddr4;
}
result = dns_request_createvia(requestmgr, msg, srcaddr, destaddr, -1,
options, tsigkey, FIND_TIMEOUT * 20,
FIND_TIMEOUT, 3, global_task, recvgss,
reqinfo, request);
check_result(result, "dns_request_createvia");
result = dns_request_create(requestmgr, msg, srcaddr, destaddr,
req_transport, req_tls_ctx_cache, options,
tsigkey, FIND_TIMEOUT * 20, FIND_TIMEOUT, 3,
isc_loop_main(loopmgr), recvgss, reqinfo,
request);
check_result(result, "dns_request_create");
if (debugging) {
show_message(stdout, msg, "Outgoing update query:");
}
@@ -3022,40 +3178,27 @@ send_gssrequest(isc_sockaddr_t *destaddr, dns_message_t *msg,
}
static void
recvgss(isc_task_t *task, isc_event_t *event) {
dns_requestevent_t *reqev = NULL;
dns_request_t *request = NULL;
isc_result_t result, eresult;
recvgss(void *arg) {
dns_request_t *request = (dns_request_t *)arg;
nsu_gssinfo_t *reqinfo = dns_request_getarg(request);
isc_result_t result, eresult = dns_request_getresult(request);
dns_message_t *rcvmsg = NULL;
nsu_gssinfo_t *reqinfo;
dns_message_t *tsigquery = NULL;
isc_sockaddr_t *addr;
dns_gss_ctx_id_t context;
dns_message_t *tsigquery = reqinfo->msg;
dns_gss_ctx_id_t context = reqinfo->context;
isc_sockaddr_t *addr = reqinfo->addr;
isc_buffer_t buf;
dns_name_t *servname;
dns_name_t *servname = NULL;
dns_fixedname_t fname;
char *err_message = NULL;
UNUSED(task);
ddebug("recvgss()");
requests--;
REQUIRE(event->ev_type == DNS_EVENT_REQUESTDONE);
reqev = (dns_requestevent_t *)event;
request = reqev->request;
eresult = reqev->result;
reqinfo = reqev->ev_arg;
tsigquery = reqinfo->msg;
context = reqinfo->context;
addr = reqinfo->addr;
if (shuttingdown) {
dns_request_destroy(&request);
dns_message_detach(&tsigquery);
isc_mem_put(gmctx, reqinfo, sizeof(nsu_gssinfo_t));
isc_event_free(&event);
maybeshutdown();
return;
}
@@ -3073,14 +3216,10 @@ recvgss(isc_task_t *task, isc_event_t *event) {
send_gssrequest(kserver, tsigquery, &request, context);
}
isc_mem_put(gmctx, reqinfo, sizeof(nsu_gssinfo_t));
isc_event_free(&event);
return;
}
isc_mem_put(gmctx, reqinfo, sizeof(nsu_gssinfo_t));
isc_event_free(&event);
reqev = NULL;
ddebug("recvgss creating rcvmsg");
dns_message_create(gmctx, DNS_MESSAGE_INTENTPARSE, &rcvmsg);
@@ -3111,7 +3250,8 @@ recvgss(isc_task_t *task, isc_event_t *event) {
}
if (rcvmsg->rcode != dns_rcode_noerror &&
rcvmsg->rcode != dns_rcode_nxdomain) {
rcvmsg->rcode != dns_rcode_nxdomain)
{
fatal("response to GSS-TSIG query was unsuccessful");
}
@@ -3271,6 +3411,14 @@ static void
cleanup(void) {
ddebug("cleanup()");
if (tls_ctx_cache != NULL) {
isc_tlsctx_cache_detach(&tls_ctx_cache);
}
if (transport_list != NULL) {
dns_transport_list_detach(&transport_list);
}
LOCK(&answer_lock);
if (answer != NULL) {
dns_message_detach(&answer);
@@ -3293,9 +3441,6 @@ cleanup(void) {
}
#ifdef HAVE_GSSAPI
/*
* Cleanup GSSAPI resources after taskmgr has been destroyed.
*/
if (kserver != NULL) {
isc_mem_put(gmctx, kserver, sizeof(isc_sockaddr_t));
kserver = NULL;
@@ -3329,7 +3474,7 @@ cleanup(void) {
}
ddebug("Shutting down managers");
isc_managers_destroy(&gmctx, &loopmgr, &netmgr, &taskmgr);
isc_managers_destroy(&gmctx, &loopmgr, &netmgr);
}
static void
@@ -3348,7 +3493,6 @@ getinput(void *arg) {
more = user_interaction();
isc_loopmgr_nonblocking(loopmgr);
if (!more) {
isc_task_detach(&global_task);
isc_loopmgr_shutdown(loopmgr);
return;
}
@@ -3377,7 +3521,7 @@ main(int argc, char **argv) {
pre_parse_args(argc, argv);
isc_managers_create(&gmctx, 1, &loopmgr, &netmgr, &taskmgr);
isc_managers_create(&gmctx, 1, &loopmgr, &netmgr);
parse_args(argc, argv);
+55 -1
View File
@@ -19,7 +19,7 @@ nsupdate - dynamic DNS update utility
Synopsis
~~~~~~~~
:program:`nsupdate` [**-d**] [**-D**] [**-i**] [**-L** level] [ [**-g**] | [**-o**] | [**-l**] | [**-y** [hmac:]keyname:secret] | [**-k** keyfile] ] [**-t** timeout] [**-u** udptimeout] [**-r** udpretries] [**-v**] [**-T**] [**-P**] [**-V**] [ [**-4**] | [**-6**] ] [filename]
:program:`nsupdate` [**-d**] [**-D**] [**-i**] [**-L** level] [ [**-g**] | [**-o**] | [**-l**] | [**-y** [hmac:]keyname:secret] | [**-k** keyfile] ] [ [**-S**] [**-K** tlskeyfile] [**-E** tlscertfile] [**-A** tlscafile] [**-H** tlshostname] [-O] ] [**-t** timeout] [**-u** udptimeout] [**-r** udpretries] [**-v**] [**-T**] [**-P**] [**-V**] [ [**-4**] | [**-6**] ] [filename]
Description
~~~~~~~~~~~
@@ -71,6 +71,15 @@ Options
This option sets use of IPv6 only.
.. option:: -A tlscafile
This option specifies the file of the certificate authorities (CA) certificates
(in PEM format) in order to verify the remote server TLS certificate when
using DNS-over-TLS (DoT), to achieve Strict or Mutual TLS. When used, it will
override the certificates from the global certificates store, which are
otherwise used by default when :option:`-S` is enabled. This option can not
be used in conjuction with :option:`-O`, and it implies :option:`-S`.
.. option:: -C
Overrides the default `resolv.conf` file. This is only intended for testing.
@@ -84,10 +93,23 @@ Options
This option sets extra debug mode.
.. option:: -E tlscertfile
This option sets the certificate(s) file for authentication for the
DNS-over-TLS (DoT) transport to the remote server. The certificate
chain file is expected to be in PEM format. This option implies :option:`-S`,
and can only be used with :option:`-K`.
.. option:: -g
This option enables standard GSS-TSIG mode.
.. option:: -H tlshostname
This option makes :program:`nsupdate` use the provided hostname during remote
server TLS certificate verification. Otherwise, the DNS server name
is used. This option implies :option:`-S`.
.. option:: -i
This option forces interactive mode, even when standard input is not a terminal.
@@ -104,6 +126,13 @@ Options
key used to authenticate Dynamic DNS update requests. In this case,
the key specified is not an HMAC-MD5 key.
.. option:: -K tlskeyfile
This option sets the key file for authenticated encryption for the
DNS-over-TLS (DoT) transport with the remote server. The private key file is
expected to be in PEM format. This option implies :option:`-S`, and can only
be used with :option:`-E`.
.. option:: -l
This option sets local-host only mode, which sets the server address to localhost
@@ -123,6 +152,14 @@ Options
This option enables a non-standards-compliant variant of GSS-TSIG
used by Windows 2000.
.. option:: -O
This option enables Opportunistic TLS. When used, the remote peer's TLS
certificate will not be verified. This option should be used for debugging
purposes only, and it is not recommended to use it in production. This
option can not be used in conjuction with :option:`-A`, and it implies
:option:`-S`.
.. option:: -p port
This option sets the port to use for connections to a name server. The default is
@@ -138,6 +175,15 @@ Options
This option sets the number of UDP retries. The default is 3. If zero, only one update
request is made.
.. option:: -S
This option indicates whether to use DNS-over-TLS (DoT) when querying
name servers specified by ``server servername port`` syntax in the input
file, and the primary server discovered through a SOA request. When the
:option:`-K` and :option:`-E` options are used, then the specified TLS
client certificate and private key pair are used for authentication
(Mutual TLS). This option implies :option:`-v`.
.. option:: -t timeout
This option sets the maximum time an update request can take before it is aborted. The
@@ -216,6 +262,8 @@ The command formats and their meanings are as follows:
update requests are sent. If no port number is specified, the default
DNS port number of 53 is used.
.. note:: This command has no effect when GSS-TSIG is in use.
``local address port``
This command sends all dynamic update requests using the local ``address``. When
no local statement is provided, :program:`nsupdate` sends updates using
@@ -262,6 +310,12 @@ The command formats and their meanings are as follows:
By default check-names processing is on. If check-names processing
fails, the record is not added to the UPDATE message.
``check-svbc [boolean]``
This command turns on or off check-svcb processing on records to be added.
Check-svcb has no effect on prerequisites or records to be deleted.
By default check-svcb processing is on. If check-svcb processing
fails, the record is not added to the UPDATE message.
``prereq nxdomain domain-name``
This command requires that no resource record of any type exist with the name
``domain-name``.
+5 -3
View File
@@ -339,7 +339,7 @@ plugin_register(const char *parameters, const void *cfg, const char *cfg_file,
cfg_file, cfg_line, parameters != NULL ? "with" : "no");
inst = isc_mem_get(mctx, sizeof(*inst));
memset(inst, 0, sizeof(*inst));
*inst = (filter_instance_t){ 0 };
isc_mem_attach(mctx, &inst->mctx);
if (parameters != NULL) {
@@ -619,7 +619,8 @@ process_section(const section_filter_t *filter) {
}
if (section == DNS_SECTION_ANSWER ||
section == DNS_SECTION_AUTHORITY) {
section == DNS_SECTION_AUTHORITY)
{
message->flags &= ~DNS_MESSAGEFLAG_AD;
}
}
@@ -669,7 +670,8 @@ filter_prep_response_begin(void *arg, void *cbdata, isc_result_t *resp) {
result = ns_client_checkaclsilent(qctx->client, NULL,
inst->a_acl, true);
if (result == ISC_R_SUCCESS && inst->v4_a != NONE &&
is_v4_client(qctx->client)) {
is_v4_client(qctx->client))
{
client_state->mode = inst->v4_a;
} else if (result == ISC_R_SUCCESS && inst->v6_a != NONE &&
is_v6_client(qctx->client))
+4 -2
View File
@@ -342,7 +342,8 @@ plugin_register(const char *parameters, const void *cfg, const char *cfg_file,
cfg_file, cfg_line, parameters != NULL ? "with" : "no");
inst = isc_mem_get(mctx, sizeof(*inst));
memset(inst, 0, sizeof(*inst));
*inst = (filter_instance_t){ 0 };
isc_mem_attach(mctx, &inst->mctx);
if (parameters != NULL) {
@@ -622,7 +623,8 @@ process_section(const section_filter_t *filter) {
}
if (section == DNS_SECTION_ANSWER ||
section == DNS_SECTION_AUTHORITY) {
section == DNS_SECTION_AUTHORITY)
{
message->flags &= ~DNS_MESSAGEFLAG_AD;
}
}
+1 -1
View File
@@ -30,7 +30,7 @@ Description
Until BIND 9.12, this feature was implemented natively in :iscman:`named` and
enabled with the ``filter-aaaa`` ACL and the ``filter-aaaa-on-v4`` and
``filter-aaaa-on-v6`` options. These options are now deprecated in
``filter-aaaa-on-v6`` options. These options are no longer available in
:iscman:`named.conf` but can be passed as parameters to the
``filter-aaaa.so`` plugin, for example:
+2 -4
View File
@@ -4,8 +4,7 @@ AM_CPPFLAGS += \
$(LIBISC_CFLAGS) \
$(LIBDNS_CFLAGS) \
$(LIBISCCFG_CFLAGS) \
$(LIBISCCC_CFLAGS) \
$(LIBBIND9_CFLAGS)
$(LIBISCCC_CFLAGS)
AM_CPPFLAGS += \
-DRNDC_CONFFILE=\"${sysconfdir}/rndc.conf\" \
@@ -22,5 +21,4 @@ rndc_LDADD = \
$(LIBISC_LIBS) \
$(LIBDNS_LIBS) \
$(LIBISCCC_LIBS) \
$(LIBISCCFG_LIBS) \
$(LIBBIND9_LIBS)
$(LIBISCCFG_LIBS)
+13 -17
View File
@@ -22,19 +22,18 @@
#include <isc/buffer.h>
#include <isc/commandline.h>
#include <isc/file.h>
#include <isc/getaddresses.h>
#include <isc/log.h>
#include <isc/loop.h>
#include <isc/managers.h>
#include <isc/mem.h>
#include <isc/net.h>
#include <isc/netmgr.h>
#include <isc/print.h>
#include <isc/random.h>
#include <isc/refcount.h>
#include <isc/result.h>
#include <isc/stdtime.h>
#include <isc/string.h>
#include <isc/task.h>
#include <isc/thread.h>
#include <isc/util.h>
@@ -50,8 +49,6 @@
#include <isccfg/namedconf.h>
#include <bind9/getaddresses.h>
#include "util.h"
#define SERVERADDRS 10
@@ -60,9 +57,7 @@ const char *progname = NULL;
bool verbose;
static isc_nm_t *netmgr = NULL;
static isc_taskmgr_t *taskmgr = NULL;
static isc_loopmgr_t *loopmgr = NULL;
static isc_task_t *rndc_task = NULL;
static const char *admin_conffile = NULL;
static const char *admin_keyfile = NULL;
@@ -282,7 +277,7 @@ get_addresses(const char *host, in_port_t port) {
}
} else {
count = SERVERADDRS - nserveraddrs;
result = bind9_getaddresses(
result = isc_getaddresses(
host, port, &serveraddrs[nserveraddrs], count, &found);
nserveraddrs += found;
}
@@ -308,7 +303,6 @@ rndc_senddone(isc_nmhandle_t *handle, isc_result_t result, void *arg) {
atomic_load_acquire(&recvs) == 0)
{
shuttingdown = true;
isc_task_detach(&rndc_task);
isc_loopmgr_shutdown(loopmgr);
}
}
@@ -394,7 +388,6 @@ rndc_recvdone(isc_nmhandle_t *handle, isc_result_t result, void *arg) {
atomic_load_acquire(&sends) == 0)
{
shuttingdown = true;
isc_task_detach(&rndc_task);
isc_loopmgr_shutdown(loopmgr);
}
}
@@ -688,7 +681,8 @@ parse_config(isc_mem_t *mctx, isc_log_t *log, const char *keyname,
(void)cfg_map_get(config, "server", &servers);
if (servers != NULL) {
for (elt = cfg_list_first(servers); elt != NULL;
elt = cfg_list_next(elt)) {
elt = cfg_list_next(elt))
{
const char *name = NULL;
server = cfg_listelt_value(elt);
name = cfg_obj_asstring(
@@ -725,7 +719,8 @@ parse_config(isc_mem_t *mctx, isc_log_t *log, const char *keyname,
} else {
DO("get config key list", cfg_map_get(config, "key", &keys));
for (elt = cfg_list_first(keys); elt != NULL;
elt = cfg_list_next(elt)) {
elt = cfg_list_next(elt))
{
const char *name = NULL;
key = cfg_listelt_value(elt);
@@ -935,11 +930,13 @@ main(int argc, char **argv) {
break;
case 'b':
if (inet_pton(AF_INET, isc_commandline_argument, &in) ==
1) {
1)
{
isc_sockaddr_fromin(&local4, &in, 0);
local4set = true;
} else if (inet_pton(AF_INET6, isc_commandline_argument,
&in6) == 1) {
&in6) == 1)
{
isc_sockaddr_fromin6(&local6, &in6, 0);
local6set = true;
}
@@ -1022,10 +1019,9 @@ main(int argc, char **argv) {
serial = isc_random32();
isc_managers_create(&rndc_mctx, 1, &loopmgr, &netmgr, &taskmgr);
isc_loopmgr_setup(loopmgr, rndc_start, rndc_task);
isc_managers_create(&rndc_mctx, 1, &loopmgr, &netmgr);
isc_loopmgr_setup(loopmgr, rndc_start, NULL);
DO("create task", isc_task_create(taskmgr, &rndc_task, 0));
isc_log_create(rndc_mctx, &log, &logconfig);
isc_log_setcontext(log);
isc_log_settag(logconfig, progname);
@@ -1095,7 +1091,7 @@ main(int argc, char **argv) {
isc_mem_stats(rndc_mctx, stderr);
}
isc_managers_destroy(&rndc_mctx, &loopmgr, &netmgr, &taskmgr);
isc_managers_destroy(&rndc_mctx, &loopmgr, &netmgr);
if (failed) {
return (1);
-2
View File
@@ -19,8 +19,6 @@
#include <stdio.h>
#include <stdlib.h>
#include <isc/print.h>
extern bool verbose;
extern const char *progname;
+2
View File
@@ -1,5 +1,7 @@
include $(top_srcdir)/Makefile.top
EXTRA_DIST = convert-trs-to-junit.py
SUBDIRS = system
noinst_PROGRAMS = \
+1
View File
@@ -1,5 +1,6 @@
.cache
.hypothesis
.mypy_cache
__pycache__
dig.out*
rndc.out*
+10 -14
View File
@@ -23,7 +23,6 @@ check_PROGRAMS = \
feature-test \
makejournal \
pipelined/pipequeries \
resolve \
rndc/gencheck \
rpz/dnsrps \
tkey/keycreate \
@@ -49,13 +48,13 @@ pipelined_pipequeries_LDADD = \
$(LDADD) \
$(LIBDNS_LIBS)
resolve_CPPFLAGS = \
rpz_dnsrps_CPPFLAGS = \
$(AM_CPPFLAGS) \
$(LIBISC_CFLAGS) \
$(LIBDNS_CFLAGS) \
$(LIBIRS_CFLAGS)
$(LIBDNS_CFLAGS)
resolve_LDADD = $(LIBISC_LIBS) $(LIBIRS_LIBS) $(LIBDNS_LIBS)
rpz_dnsrps_LDADD = \
$(LDADD) \
$(LIBDNS_LIBS)
tkey_keycreate_CPPFLAGS = \
$(AM_CPPFLAGS) \
@@ -105,16 +104,17 @@ TESTS += \
checknames \
checkzone \
database \
dialup \
dlzexternal \
dns64 \
dscp \
dsdigest \
dupsigs \
dyndb \
ecdsa \
eddsa \
ednscompliance \
emptyzones \
engine_pkcs11 \
enginepkcs11 \
filter-aaaa \
formerr \
geoip2 \
@@ -124,6 +124,7 @@ TESTS += \
inline \
integrity \
hooks \
host \
journal \
keepalive \
keyfromlabel \
@@ -170,12 +171,6 @@ TESTS += \
xferquota \
zonechecks
# The "stress" test is not run by default since it creates enough
# load on the machine to make it unusable to other users.
# The "dialup", "delzone", and "dupsigs" tests are also not run by
# default because they take a very long time to complete.
# TESTS += delzone dialup dupsigs stress
if HAVE_LMDB
TESTS += nzd2nzf
endif # HAVE_LMDB
@@ -188,6 +183,7 @@ TESTS += \
nsupdate \
resolver \
statistics \
stress \
upforwd \
zero
+1 -1
View File
@@ -98,7 +98,7 @@ grep "^;" dig.out.${t} > /dev/null 2>&1 || { echo_i "test $tt failed" ; status=1
# and other values? right out
t=`expr $t + 1`
$DIG $DIGOPTS tsigzone. \
@10.53.0.2 -b 127.0.0.1 axfr -y three:1234abcd8765 > dig.out.${t}
@10.53.0.2 -b 127.0.0.1 axfr -y "${DEFAULT_HMAC}:three:1234abcd8765" > dig.out.${t}
grep "^;" dig.out.${t} > /dev/null 2>&1 || { echo_i "test $t failed" ; status=1; }
# now we only allow 10.53.0.1 *and* key one, or 10.53.0.2 *and* key two
+11 -11
View File
@@ -45,7 +45,7 @@ n=`expr $n + 1`
if [ $ret != 0 ]; then echo_i "failed"; fi
status=`expr $status + $ret`
if [ -n "$NZD" ]; then
if $FEATURETEST --with-lmdb; then
echo_i "checking that existing NZF file was renamed after migration ($n)"
[ -e ns2/3bf305731dd26307.nzf~ ] || ret=1
n=`expr $n + 1`
@@ -124,7 +124,7 @@ n=`expr $n + 1`
if [ $ret != 0 ]; then echo_i "failed"; fi
status=`expr $status + $ret`
if [ -z "$NZD" ]; then
if ! $FEATURETEST --with-lmdb; then
echo_i "verifying no comments in NZF file ($n)"
ret=0
hcount=`grep "^# New zone file for view: _default" ns2/3bf305731dd26307.nzf | wc -l`
@@ -143,7 +143,7 @@ n=`expr $n + 1`
if [ $ret != 0 ]; then echo_i "failed"; fi
status=`expr $status + $ret`
if [ -n "$NZD" ]; then
if $FEATURETEST --with-lmdb; then
echo_i "checking zone is present in NZD ($n)"
ret=0
$NZD2NZF ns2/_default.nzd | grep previous.example > /dev/null || ret=1
@@ -169,14 +169,14 @@ check_nzd2nzf() (
! grep previous.example nzd2nzf.out.$n > /dev/null
)
if [ -n "$NZD" ]; then
if $FEATURETEST --with-lmdb; then
echo_i "checking zone was deleted from NZD ($n)"
retry_quiet 10 check_nzd2nzf || ret=1
if [ $ret != 0 ]; then echo_i "failed"; fi
status=`expr $status + $ret`
fi
if [ -z "$NZD" ]; then
if ! $FEATURETEST --with-lmdb; then
echo_i "checking NZF file now has comment ($n)"
ret=0
hcount=`grep "^# New zone file for view: _default" ns2/3bf305731dd26307.nzf | wc -l`
@@ -512,7 +512,7 @@ n=`expr $n + 1`
if [ $ret != 0 ]; then echo_i "failed"; fi
status=`expr $status + $ret`
if [ -z "$NZD" ]; then
if ! $FEATURETEST --with-lmdb; then
echo_i "checking new NZF file has comment ($n)"
ret=0
hcount=`grep "^# New zone file for view: external" ns2/external.nzf | wc -l`
@@ -522,7 +522,7 @@ if [ -z "$NZD" ]; then
status=`expr $status + $ret`
fi
if [ -n "$NZD" ]; then
if $FEATURETEST --with-lmdb; then
echo_i "verifying added.example in external view created an external.nzd DB ($n)"
ret=0
[ -e ns2/external.nzd ] || ret=1
@@ -548,7 +548,7 @@ status=`expr $status + $ret`
echo_i "checking rndc showzone with newly added zone ($n)"
_check_rndc_showzone_newly_added() (
if [ -z "$NZD" ]; then
if ! $FEATURETEST --with-lmdb; then
expected='zone "added.example" in external { type primary; file "added.db"; };'
else
expected='zone "added.example" { type primary; file "added.db"; };'
@@ -655,7 +655,7 @@ n=`expr $n + 1`
if [ $ret != 0 ]; then echo_i "failed"; fi
status=`expr $status + $ret`
if [ -n "$NZD" ]; then
if $FEATURETEST --with-lmdb; then
echo_i "checking NZD file was created in new-zones-directory ($n)"
expect=ns2/new-zones/directory.nzd
else
@@ -725,8 +725,8 @@ $RNDCCMD 10.53.0.3 addzone '"test\".baz"' '{ type primary; check-names ignore; f
$RNDCCMD 10.53.0.3 addzone '"test\\.baz"' '{ type primary; check-names ignore; file "e.db"; };' > /dev/null 2>&1 || ret=1
$RNDCCMD 10.53.0.3 addzone '"test\032.baz"' '{ type primary; check-names ignore; file "e.db"; };' > /dev/null 2>&1 || ret=1
$RNDCCMD 10.53.0.3 addzone '"test\010.baz"' '{ type primary; check-names ignore; file "e.db"; };' > /dev/null 2>&1 || ret=1
stop_server addzone ns3
start_server --noclean --restart --port ${PORT} addzone ns3 || ret=1
stop_server ns3
start_server --noclean --restart --port ${PORT} ns3 || ret=1
retry_quiet 10 _check_version_bind || ret=1
$DIG $DIGOPTS @10.53.0.3 SOA "test4.baz" > dig.out.1.test$n || ret=1
grep "status: NOERROR" dig.out.1.test$n > /dev/null || ret=1
+7
View File
@@ -95,6 +95,7 @@ $DIG $DIGOPTS @10.53.0.2 -b 10.53.0.2 a.normal.example a > dig.out.ns2.$n || ret
grep 'status: REFUSED' dig.out.ns2.$n > /dev/null || ret=1
grep 'EDE: 18 (Prohibited)' dig.out.ns2.$n > /dev/null || ret=1
grep '^a.normal.example' dig.out.ns2.$n > /dev/null && ret=1
nextpart ns2/named.run | grep 'recursion not enabled for view' > /dev/null || ret=1
if [ $ret != 0 ]; then echo_i "failed"; fi
status=`expr $status + $ret`
@@ -636,11 +637,13 @@ status=`expr $status + $ret`
n=`expr $n + 1`
echo_i "test $n: default allow-recursion configuration"
ret=0
nextpart ns3/named.run > /dev/null
$DIG -p ${PORT} @10.53.0.3 -b 127.0.0.1 a.normal.example a > dig.out.ns3.1.$n
grep 'status: NOERROR' dig.out.ns3.1.$n > /dev/null || ret=1
$DIG -p ${PORT} @10.53.0.3 -b 10.53.0.1 a.normal.example a > dig.out.ns3.2.$n
grep 'status: REFUSED' dig.out.ns3.2.$n > /dev/null || ret=1
grep 'EDE: 18 (Prohibited)' dig.out.ns3.2.$n > /dev/null || ret=1
nextpart ns3/named.run | grep 'allow-recursion did not match' > /dev/null || ret=1
if [ $ret != 0 ]; then echo_i "failed"; fi
status=`expr $status + $ret`
@@ -653,6 +656,7 @@ grep 'status: NOERROR' dig.out.ns3.1.$n > /dev/null || ret=1
$DIG -p ${PORT} @10.53.0.3 -b 10.53.0.1 ns . > dig.out.ns3.2.$n
grep 'status: REFUSED' dig.out.ns3.2.$n > /dev/null || ret=1
grep 'EDE: 18 (Prohibited)' dig.out.ns3.2.$n > /dev/null || ret=1
nextpart ns3/named.run | grep 'allow-recursion did not match' > /dev/null || ret=1
if [ $ret != 0 ]; then echo_i "failed"; fi
status=`expr $status + $ret`
@@ -671,6 +675,7 @@ grep 'ANSWER: 1' dig.out.ns3.1.$n > /dev/null || ret=1
$DIG -p ${PORT} @10.53.0.3 b.normal.example a > dig.out.ns3.2.$n
grep 'recursion requested but not available' dig.out.ns3.2.$n > /dev/null || ret=1
grep 'ANSWER: 0' dig.out.ns3.2.$n > /dev/null || ret=1
nextpart ns3/named.run | grep 'allow-recursion-on did not match' > /dev/null || ret=1
if [ $ret != 0 ]; then echo_i "failed"; fi
status=`expr $status + $ret`
@@ -697,6 +702,7 @@ $DIG -p ${PORT} @10.53.1.2 d.normal.example a > dig.out.ns3.4.$n
grep 'recursion requested but not available' dig.out.ns3.4.$n > /dev/null || ret=1
grep 'status: REFUSED' dig.out.ns3.4.$n > /dev/null || ret=1
grep 'EDE: 18 (Prohibited)' dig.out.ns3.4.$n > /dev/null || ret=1
nextpart ns3/named.run | grep 'allow-recursion-on did not match' > /dev/null || ret=1
if [ $ret != 0 ]; then echo_i "failed"; fi
status=`expr $status + $ret`
@@ -723,6 +729,7 @@ $DIG -p ${PORT} @10.53.1.2 f.normal.example a > dig.out.ns3.4.$n
grep 'recursion requested but not available' dig.out.ns3.4.$n > /dev/null || ret=1
grep 'status: REFUSED' dig.out.ns3.4.$n > /dev/null || ret=1
grep 'EDE: 18 (Prohibited)' dig.out.ns3.4.$n > /dev/null || ret=1
nextpart ns3/named.run | grep 'allow-recursion-on did not match' > /dev/null || ret=1
if [ $ret != 0 ]; then echo_i "failed"; fi
status=`expr $status + $ret`
+2
View File
@@ -1,3 +1,5 @@
#!/bin/sh
# Copyright (C) Internet Systems Consortium, Inc. ("ISC")
#
# SPDX-License-Identifier: MPL-2.0
-3
View File
@@ -59,11 +59,8 @@ rm -f ns3/optout.example.db
rm -f ns3/optout.nsec3.example.db
rm -f ns3/optout.optout.example.db
rm -f ns3/prepub.example.db
rm -f ns3/prepub.example.db.in
rm -f ns3/reconf.example.db
rm -f ns3/rsasha256.example.db ns3/rsasha512.example.db
rm -f ns3/secure-to-insecure.example.db
rm -f ns3/secure-to-insecure2.example.db
rm -f ns3/secure.example.db
rm -f ns3/secure.nsec3.example.db
rm -f ns3/secure.optout.example.db
+2 -3
View File
@@ -16,9 +16,8 @@
# Have the child generate subdomain keys and pass DS sets to us.
( cd ../ns3 && $SHELL keygen.sh )
for subdomain in secure nsec3 autonsec3 optout rsasha256 rsasha512 \
nsec3-to-nsec oldsigs sync dname-at-apex-nsec3 cds-delete \
cdnskey-delete
for subdomain in secure nsec3 optout rsasha256 rsasha512 \
nsec3-to-nsec oldsigs dname-at-apex-nsec3
do
cp ../ns3/dsset-$subdomain.example. .
done
+1 -21
View File
@@ -192,31 +192,11 @@ $KEYGEN -q -a $DEFAULT_ALGORITHM -fk $zone > kg.out 2>&1 || dumpit kg.out
$KEYGEN -q -a $DEFAULT_ALGORITHM $zone > kg.out 2>&1 || dumpit kg.out
$SIGNER -S -3 beef -A -o $zone -f $zonefile $infile > s.out || dumpit s.out
#
# secure-to-insecure transition test zone; used to test removal of
# keys via nsupdate
#
setup secure-to-insecure.example
$KEYGEN -a $DEFAULT_ALGORITHM -q -fk $zone > kg.out 2>&1 || dumpit kg.out
$KEYGEN -a $DEFAULT_ALGORITHM -q $zone > kg.out 2>&1 || dumpit kg.out
$SIGNER -S -o $zone -f $zonefile $infile > s.out || dumpit s.out
#
# another secure-to-insecure transition test zone; used to test
# removal of keys on schedule.
#
setup secure-to-insecure2.example
ksk=$($KEYGEN -q -a $DEFAULT_ALGORITHM -3 -fk $zone 2> kg.out) || dumpit kg.out
echo $ksk > ../del1.key
zsk=$($KEYGEN -q -a $DEFAULT_ALGORITHM -3 $zone 2> kg.out) || dumpit kg.out
echo $zsk > ../del2.key
$SIGNER -S -3 beef -o $zone -f $zonefile $infile > s.out || dumpit s.out
#
# Introducing a pre-published key test.
#
setup prepub.example
infile="secure-to-insecure2.example.db.in"
infile="prepub.example.db.in"
$KEYGEN -a $DEFAULT_ALGORITHM -3 -q -fk $zone > kg.out 2>&1 || dumpit kg.out
$KEYGEN -a $DEFAULT_ALGORITHM -3 -q $zone > kg.out 2>&1 || dumpit kg.out
$SIGNER -S -3 beef -o $zone -f $zonefile $infile > s.out || dumpit s.out
@@ -170,21 +170,6 @@ zone "nsec3-to-nsec.example" {
auto-dnssec maintain;
};
zone "secure-to-insecure.example" {
type primary;
file "secure-to-insecure.example.db";
allow-update { any; };
dnssec-secure-to-insecure yes;
};
zone "secure-to-insecure2.example" {
type primary;
file "secure-to-insecure2.example.db";
allow-update { any; };
auto-dnssec maintain;
dnssec-secure-to-insecure yes;
};
zone "oldsigs.example" {
type primary;
file "oldsigs.example.db";
+26 -208
View File
@@ -267,80 +267,6 @@ n=$((n + 1))
if [ $ret != 0 ]; then echo_i "failed"; fi
status=$((status + ret))
echo_i "checking NSEC->NSEC3 conversion prerequisites ($n)"
ret=0
# these commands should result in an empty file:
$DIG $DIGOPTS +noall +answer nsec3.example. nsec3param @10.53.0.3 > dig.out.ns3.1.test$n || ret=1
grep "NSEC3PARAM" dig.out.ns3.1.test$n > /dev/null && ret=1
$DIG $DIGOPTS +noall +answer autonsec3.example. nsec3param @10.53.0.3 > dig.out.ns3.2.test$n || ret=1
grep "NSEC3PARAM" dig.out.ns3.2.test$n > /dev/null && ret=1
n=$((n + 1))
if [ $ret != 0 ]; then echo_i "failed"; fi
status=$((status + ret))
echo_i "checking NSEC3->NSEC conversion prerequisites ($n)"
ret=0
$DIG $DIGOPTS +noall +answer nsec3-to-nsec.example. nsec3param @10.53.0.3 > dig.out.ns3.test$n || ret=1
grep "NSEC3PARAM" dig.out.ns3.test$n > /dev/null || ret=1
n=$((n + 1))
if [ $ret != 0 ]; then echo_i "failed"; fi
status=$((status + ret))
echo_i "converting zones from nsec to nsec3"
$NSUPDATE > /dev/null 2>&1 <<END || status=1
server 10.53.0.3 ${PORT}
zone nsec3.nsec3.example.
update add nsec3.nsec3.example. 3600 NSEC3PARAM 1 0 10 BEEF
send
zone optout.nsec3.example.
update add optout.nsec3.example. 3600 NSEC3PARAM 1 1 10 BEEF
send
zone nsec3.example.
update add nsec3.example. 3600 NSEC3PARAM 1 0 10 BEEF
send
zone autonsec3.example.
update add autonsec3.example. 3600 NSEC3PARAM 1 0 20 DEAF
send
zone nsec3.optout.example.
update add nsec3.optout.example. 3600 NSEC3PARAM 1 0 10 BEEF
send
zone optout.optout.example.
update add optout.optout.example. 3600 NSEC3PARAM 1 1 10 BEEF
send
zone optout.example.
update add optout.example. 3600 NSEC3PARAM 1 1 10 BEEF
send
END
if $SHELL ../testcrypto.sh -q RSASHA1
then
# try to convert nsec-only.example; this should fail due to
# non-NSEC3 compatible keys
echo_i "preset nsec3param in unsigned zone via nsupdate ($n)"
$NSUPDATE > nsupdate.out 2>&1 <<END
server 10.53.0.3 ${PORT}
zone nsec-only.example.
update add nsec-only.example. 3600 NSEC3PARAM 1 0 10 BEEF
send
END
fi
echo_i "checking for nsec3param in unsigned zone ($n)"
ret=0
$DIG $DIGOPTS +noall +answer autonsec3.example. nsec3param @10.53.0.3 > dig.out.ns3.test$n || ret=1
grep "NSEC3PARAM" dig.out.ns3.test$n > /dev/null && ret=1
n=$((n + 1))
if [ $ret != 0 ]; then echo_i "failed"; fi
status=$((status + ret))
echo_i "checking for nsec3param signing record ($n)"
ret=0
$RNDCCMD 10.53.0.3 signing -list autonsec3.example. > signing.out.test$n 2>&1
grep "Pending NSEC3 chain 1 0 20 DEAF" signing.out.test$n > /dev/null || ret=1
n=$((n + 1))
if [ $ret != 0 ]; then echo_i "failed"; fi
status=$((status + ret))
echo_i "resetting nsec3param via rndc signing ($n)"
ret=0
$RNDCCMD 10.53.0.3 signing -clear all autonsec3.example. > /dev/null 2>&1
@@ -359,6 +285,22 @@ n=$((n + 1))
if [ $ret != 0 ]; then echo_i "failed"; fi
status=$((status + ret))
echo_i "setting nsec3param via rndc signing ($n)"
ret=0
$RNDCCMD 10.53.0.3 signing -nsec3param 1 1 10 beef optout.example. 2>&1
for i in 0 1 2 3 4 5 6 7 8 9; do
ret=0
$DIG $DIGOPTS @10.53.0.3 nsec3param optout.example > dig.out.ns3.test$n
# Note that the Opt-Out flag is not used in NSEC3PARAM and is set to zero.
grep "NSEC3PARAM.*1.*0.*10.*BEEF" dig.out.ns3.test$n > /dev/null || ret=1
[ $ret -eq 0 ] && break
echo_i "waiting ... ($i)"
sleep 2
done
n=$((n + 1))
if [ $ret != 0 ]; then echo_i "failed"; fi
status=$((status + ret))
echo_i "signing preset nsec3 zone"
zsk=$(cat autozsk.key)
ksk=$(cat autoksk.key)
@@ -369,17 +311,6 @@ $SETTIME -K ns3 -P now -A now $ksk > settime.out.test$n.ksk || ret=1
echo_i "waiting for changes to take effect"
sleep 3
echo_i "converting zone from nsec3 to nsec"
$NSUPDATE > /dev/null 2>&1 << END || status=1
server 10.53.0.3 ${PORT}
zone nsec3-to-nsec.example.
update delete nsec3-to-nsec.example. NSEC3PARAM
send
END
echo_i "waiting for change to take effect"
sleep 3
missing=$(keyfile_to_key_id "$(cat noksk-ksk.key)")
echo_i "checking that expired RRSIGs from missing KSK $missing are not deleted ($n)"
ret=0
@@ -492,51 +423,6 @@ n=$((n + 1))
if [ $ret != 0 ]; then echo_i "failed"; fi
status=$((status + ret))
echo_i "checking NSEC->NSEC3 conversion failed with NSEC-only key ($n)"
ret=0
if $SHELL ../testcrypto.sh -q RSASHA1
then
grep "failed: REFUSED" nsupdate.out > /dev/null || ret=1
else
echo_i "skip: RSASHA1 not supported"
fi
n=$((n + 1))
if [ $ret != 0 ]; then echo_i "failed"; fi
status=$((status + ret))
echo_i "checking NSEC3->NSEC conversion succeeded ($n)"
ret=0
# this command should result in an empty file:
$DIG $DIGOPTS +noall +answer nsec3-to-nsec.example. nsec3param @10.53.0.3 > dig.out.ns3.nx.test$n || ret=1
grep "NSEC3PARAM" dig.out.ns3.nx.test$n > /dev/null && ret=1
$DIG $DIGOPTS +noauth q.nsec3-to-nsec.example. @10.53.0.3 a > dig.out.ns3.test$n || ret=1
$DIG $DIGOPTS +noauth q.nsec3-to-nsec.example. @10.53.0.4 a > dig.out.ns4.test$n || ret=1
digcomp dig.out.ns3.test$n dig.out.ns4.test$n || ret=1
grep "flags:.*ad.*QUERY" dig.out.ns4.test$n > /dev/null || ret=1
grep "status: NXDOMAIN" dig.out.ns4.test$n > /dev/null || ret=1
n=$((n + 1))
if [ $ret != 0 ]; then echo_i "failed"; fi
status=$((status + ret))
echo_i "checking NSEC3->NSEC conversion with 'rndc signing -nsec3param none' ($n)"
ret=0
$RNDCCMD 10.53.0.3 signing -nsec3param none autonsec3.example. > /dev/null 2>&1
# this command should result in an empty file:
no_nsec3param() (
$DIG $DIGOPTS +noall +answer autonsec3.example. nsec3param @10.53.0.3 > dig.out.ns3.nx.test$n || return 1
grep "NSEC3PARAM" dig.out.ns3.nx.test$n > /dev/null && return 1
return 0
)
retry_quiet 10 no_nsec3param || ret=1
$DIG $DIGOPTS +noauth q.autonsec3.example. @10.53.0.3 a > dig.out.ns3.test$n || ret=1
$DIG $DIGOPTS +noauth q.autonsec3.example. @10.53.0.4 a > dig.out.ns4.test$n || ret=1
digcomp dig.out.ns3.test$n dig.out.ns4.test$n || ret=1
grep "flags:.*ad.*QUERY" dig.out.ns4.test$n > /dev/null || ret=1
grep "status: NXDOMAIN" dig.out.ns4.test$n > /dev/null || ret=1
n=$((n + 1))
if [ $ret != 0 ]; then echo_i "failed"; fi
status=$((status + ret))
echo_i "checking TTLs of imported DNSKEYs (no default) ($n)"
ret=0
$DIG $DIGOPTS +tcp +noall +answer dnskey ttl1.example. @10.53.0.3 > dig.out.ns3.test$n || ret=1
@@ -1036,79 +922,11 @@ n=$((n + 1))
if [ $ret != 0 ]; then echo_i "failed"; fi
status=$((status + ret))
echo_i "checking secure-to-insecure transition, nsupdate ($n)"
ret=0
$NSUPDATE > /dev/null 2>&1 <<END || status=1
server 10.53.0.3 ${PORT}
zone secure-to-insecure.example
update delete secure-to-insecure.example dnskey
send
END
for i in 0 1 2 3 4 5 6 7 8 9; do
ret=0
$DIG $DIGOPTS axfr secure-to-insecure.example @10.53.0.3 > dig.out.ns3.test$n || ret=1
egrep '(RRSIG|DNSKEY|NSEC)' dig.out.ns3.test$n > /dev/null && ret=1
[ $ret -eq 0 ] && break
echo_i "waiting ... ($i)"
sleep 2
done
n=$((n + 1))
if [ $ret != 0 ]; then echo_i "failed"; fi
status=$((status + ret))
echo_i "checking secure-to-insecure transition, scheduled ($n)"
ret=0
file="ns3/$(cat del1.key).key"
$SETTIME -I now -D now $file > settime.out.test$n.1 || ret=1
file="ns3/$(cat del2.key).key"
$SETTIME -I now -D now $file > settime.out.test$n.2 || ret=1
($RNDCCMD 10.53.0.3 sign secure-to-insecure2.example. 2>&1 | sed 's/^/ns3 /' | cat_i) || ret=1
for i in 0 1 2 3 4 5 6 7 8 9; do
ret=0
$DIG $DIGOPTS axfr secure-to-insecure2.example @10.53.0.3 > dig.out.ns3.test$n || ret=1
egrep '(RRSIG|DNSKEY|NSEC3)' dig.out.ns3.test$n > /dev/null && ret=1
[ $ret -eq 0 ] && break
echo_i "waiting ... ($i)"
sleep 2
done
n=$((n + 1))
if [ $ret != 0 ]; then echo_i "failed"; fi
status=$((status + ret))
echo_i "checking jitter in a newly signed NSEC3 zone ($n)"
ret=0
# Use DNS UPDATE to add an NSEC3PARAM record into the zone.
$NSUPDATE > nsupdate.out.test$n 2>&1 <<END || ret=1
server 10.53.0.3 ${PORT}
zone jitter.nsec3.example.
update add jitter.nsec3.example. 3600 NSEC3PARAM 1 0 10 BEEF
send
END
[ $ret != 0 ] && echo_i "error: dynamic update add NSEC3PARAM failed"
# Create DNSSEC keys in the zone directory.
$KEYGEN -a $DEFAULT_ALGORITHM -3 -q -K ns3 jitter.nsec3.example > /dev/null
# Trigger zone signing.
($RNDCCMD 10.53.0.3 sign jitter.nsec3.example. 2>&1 | sed 's/^/ns3 /' | cat_i) || ret=1
# Wait until zone has been signed.
check_if_nsec3param_exists() {
$DIG $DIGOPTS NSEC3PARAM jitter.nsec3.example @10.53.0.3 > dig.out.ns3.1.test$n || return 1
grep -q "^jitter\.nsec3\.example\..*NSEC3PARAM" dig.out.ns3.1.test$n || return 1
}
retry_quiet 40 check_if_nsec3param_exists || {
echo_i "error: NSEC3PARAM not present yet"
ret=1
}
$DIG $DIGOPTS AXFR jitter.nsec3.example @10.53.0.3 > dig.out.ns3.2.test$n || ret=1
# Check jitter distribution.
checkjitter dig.out.ns3.2.test$n || ret=1
n=$((n + 1))
if [ $ret != 0 ]; then echo_i "failed"; fi
status=$((status + ret))
echo_i "checking that serial number and RRSIGs are both updated (rt21045) ($n)"
ret=0
oldserial=$($DIG $DIGOPTS +short soa prepub.example @10.53.0.3 | awk '$0 !~ /SOA/ {print $3}')
oldinception=$($DIG $DIGOPTS +short soa prepub.example @10.53.0.3 | awk '/SOA/ {print $6}' | sort -u)
$DIG $DIGOPTS +short soa prepub.example @10.53.0.3 > dig.out.ns3.test$n || ret=1
oldserial=$(cat dig.out.ns3.test$n | awk '$0 !~ /SOA/ {print $3}')
oldinception=$(cat dig.out.ns3.test$n | awk '/SOA/ {print $6}' | sort -u)
$KEYGEN -a $DEFAULT_ALGORITHM -3 -q -K ns3 -P 0 -A +6d -I +38d -D +45d prepub.example > /dev/null
@@ -1117,12 +935,12 @@ newserial=$oldserial
try=0
while [ $oldserial -eq $newserial -a $try -lt 42 ]
do
newserial=$($DIG $DIGOPTS +short soa prepub.example @10.53.0.3 |
awk '$0 !~ /SOA/ {print $3}')
$DIG $DIGOPTS +short soa prepub.example @10.53.0.3 > dig.out.ns3.test$n.2
newserial=$(cat dig.out.ns3.test$n.2 | awk '$0 !~ /SOA/ {print $3}')
sleep 1
try=$((try + 1))
done
newinception=$($DIG $DIGOPTS +short soa prepub.example @10.53.0.3 | awk '/SOA/ {print $6}' | sort -u)
newinception=$(cat dig.out.ns3.test$n.2 | awk '/SOA/ {print $6}' | sort -u)
#echo "$oldserial : $newserial"
#echo "$oldinception : $newinception"
@@ -1179,7 +997,6 @@ status=$((status + ret))
echo_i "checking that signing records have been marked as complete ($n)"
ret=0
checkprivate . 10.53.0.1 || ret=1
checkprivate bar 10.53.0.2 || ret=1
checkprivate example 10.53.0.2 0 type65280 || ret=1 # sig-signing-type 65280
checkprivate private.secure.example 10.53.0.3 2 || ret=1 # pre-signed
@@ -1201,8 +1018,6 @@ checkprivate rsasha512.example 10.53.0.3 || ret=1
checkprivate secure.example 10.53.0.3 || ret=1
checkprivate secure.nsec3.example 10.53.0.3 || ret=1
checkprivate secure.optout.example 10.53.0.3 || ret=1
checkprivate secure-to-insecure2.example 10.53.0.3 2|| ret=1 # automatically removed
checkprivate secure-to-insecure.example 10.53.0.3 2 || ret=1 # automatically removed
checkprivate ttl1.example 10.53.0.3 || ret=1
checkprivate ttl2.example 10.53.0.3 || ret=1
checkprivate ttl3.example 10.53.0.3 || ret=1
@@ -1210,8 +1025,11 @@ checkprivate ttl4.example 10.53.0.3 || ret=1
n=$((n + 1))
status=$((status + ret))
echo_i "forcing full sign"
echo_i "forcing full sign ($n)"
ret=0
($RNDCCMD 10.53.0.1 sign . 2>&1 | sed 's/^/ns1 /' | cat_i) || ret=1
n=$((n + 1))
if [ $ret != 0 ]; then echo_i "failed"; fi
echo_i "waiting for change to take effect"
sleep 5
+8 -6
View File
@@ -1,3 +1,5 @@
#!/bin/sh
# Copyright (C) Internet Systems Consortium, Inc. ("ISC")
#
# SPDX-License-Identifier: MPL-2.0
@@ -158,7 +160,7 @@ sleep 1
grep "zone serial (0) unchanged." ns1/named.run > /dev/null && ret=1
if [ $ret != 0 ] ; then echo_i "failed"; status=`expr $status + $ret`; fi
HOSTNAME=`$FEATURETEST --gethostname`
HOST_NAME=`$FEATURETEST --gethostname`
BIND_VERSION_STRING=$($NAMED -V | head -1)
BIND_VERSION=$($NAMED -V | sed -ne 's/^BIND \([^ ]*\).*/\1/p')
@@ -166,14 +168,14 @@ n=`expr $n + 1`
ret=0
echo_i "Checking that default version works for rndc ($n)"
$RNDCCMD 10.53.0.1 status > rndc.status.ns1.$n 2>&1
fgrep "version: $BIND_VERSION_STRING" rndc.status.ns1.$n > /dev/null || ret=1
grep -F "version: $BIND_VERSION_STRING" rndc.status.ns1.$n > /dev/null || ret=1
if [ $ret != 0 ] ; then echo_i "failed"; status=`expr $status + $ret`; fi
n=`expr $n + 1`
ret=0
echo_i "Checking that custom version works for rndc ($n)"
$RNDCCMD 10.53.0.3 status > rndc.status.ns3.$n 2>&1
fgrep "version: $BIND_VERSION_STRING (this is a test of version)" rndc.status.ns3.$n > /dev/null || ret=1
grep -F "version: $BIND_VERSION_STRING (this is a test of version)" rndc.status.ns3.$n > /dev/null || ret=1
if [ $ret != 0 ] ; then echo_i "failed"; status=`expr $status + $ret`; fi
n=`expr $n + 1`
@@ -194,7 +196,7 @@ n=`expr $n + 1`
ret=0
echo_i "Checking that default hostname works for query ($n)"
$DIG $DIGOPTS +short hostname.bind txt ch @10.53.0.1 > dig.out.ns1.$n
grep "^\"$HOSTNAME\"$" dig.out.ns1.$n > /dev/null || ret=1
grep "^\"$HOST_NAME\"$" dig.out.ns1.$n > /dev/null || ret=1
if [ $ret != 0 ] ; then echo_i "failed"; status=`expr $status + $ret`; fi
n=`expr $n + 1`
@@ -216,14 +218,14 @@ n=`expr $n + 1`
ret=0
echo_i "Checking that server-id hostname works for query ($n)"
$DIG $DIGOPTS +short id.server txt ch @10.53.0.2 > dig.out.ns2.$n
grep "^\"$HOSTNAME\"$" dig.out.ns2.$n > /dev/null || ret=1
grep "^\"$HOST_NAME\"$" dig.out.ns2.$n > /dev/null || ret=1
if [ $ret != 0 ] ; then echo_i "failed"; status=`expr $status + $ret`; fi
n=`expr $n + 1`
ret=0
echo_i "Checking that server-id hostname works for EDNS name server ID request ($n)"
$DIG $DIGOPTS +norec +nsid foo @10.53.0.2 > dig.out.ns2.$n
grep "^; NSID: .* (\"$HOSTNAME\")$" dig.out.ns2.$n > /dev/null || ret=1
grep "^; NSID: .* (\"$HOST_NAME\")$" dig.out.ns2.$n > /dev/null || ret=1
if [ $ret != 0 ] ; then echo_i "failed"; status=`expr $status + $ret`; fi
n=`expr $n + 1`
+3 -5
View File
@@ -108,7 +108,7 @@ echo_i "reset and check that records are correctly cached initially ($n)"
ret=0
load_cache
dump_cache
nrecords=`filter_tree flushtest.example ns2/named_dump.db.test$n | egrep '(TXT|ANY)' | wc -l`
nrecords=`filter_tree flushtest.example ns2/named_dump.db.test$n | grep -E '(TXT|ANY)' | wc -l`
[ $nrecords -eq 18 ] || { ret=1; echo_i "found $nrecords records expected 18"; }
if [ $ret != 0 ]; then echo_i "failed"; fi
status=`expr $status + $ret`
@@ -202,7 +202,7 @@ n=`expr $n + 1`
echo_i "check the number of cached records remaining ($n)"
ret=0
dump_cache
nrecords=`filter_tree flushtest.example ns2/named_dump.db.test$n | grep -v '^;' | egrep '(TXT|ANY)' | wc -l`
nrecords=`filter_tree flushtest.example ns2/named_dump.db.test$n | grep -v '^;' | grep -E '(TXT|ANY)' | wc -l`
[ $nrecords -eq 17 ] || { ret=1; echo_i "found $nrecords records expected 17"; }
if [ $ret != 0 ]; then echo_i "failed"; fi
status=`expr $status + $ret`
@@ -220,7 +220,7 @@ n=`expr $n + 1`
echo_i "check the number of cached records remaining ($n)"
ret=0
dump_cache
nrecords=`filter_tree flushtest.example ns2/named_dump.db.test$n | egrep '(TXT|ANY)' | wc -l`
nrecords=`filter_tree flushtest.example ns2/named_dump.db.test$n | grep -E '(TXT|ANY)' | wc -l`
[ $nrecords -eq 1 ] || { ret=1; echo_i "found $nrecords records expected 1"; }
if [ $ret != 0 ]; then echo_i "failed"; fi
status=`expr $status + $ret`
@@ -234,7 +234,6 @@ mv ns2/named_dump.db.test$n ns2/named_dump.db.test$n.a
sed -n '/plain success\/timeout/,/Unassociated entries/p' \
ns2/named_dump.db.test$n.a > sed.out.$n.a
grep 'plain success/timeout' sed.out.$n.a > /dev/null 2>&1 || ret=1
grep 'Unassociated entries' sed.out.$n.a > /dev/null 2>&1 || ret=1
grep 'ns.flushtest.example' sed.out.$n.a > /dev/null 2>&1 || ret=1
$RNDC $RNDCOPTS flushtree flushtest.example || ret=1
dump_cache
@@ -242,7 +241,6 @@ mv ns2/named_dump.db.test$n ns2/named_dump.db.test$n.b
sed -n '/plain success\/timeout/,/Unassociated entries/p' \
ns2/named_dump.db.test$n.b > sed.out.$n.b
grep 'plain success/timeout' sed.out.$n.b > /dev/null 2>&1 || ret=1
grep 'Unassociated entries' sed.out.$n.b > /dev/null 2>&1 || ret=1
grep 'ns.flushtest.example' sed.out.$n.b > /dev/null 2>&1 && ret=1
if [ $ret != 0 ]; then echo_i "failed"; fi
status=`expr $status + $ret`
+2
View File
@@ -1,3 +1,5 @@
#!/bin/sh
# Copyright (C) Internet Systems Consortium, Inc. ("ISC")
#
# SPDX-License-Identifier: MPL-2.0
+12 -6
View File
@@ -1,3 +1,5 @@
#!/bin/sh
# Copyright (C) Internet Systems Consortium, Inc. ("ISC")
#
# SPDX-License-Identifier: MPL-2.0
@@ -11,21 +13,25 @@
rm -f dig.out.*
rm -f ns*/*.jnl
rm -f ns*/*.nzf
rm -f ns*/*.mkeys
rm -f ns*/*.nzd ns*/*.nzd-lock
rm -f ns*/*.nzf
rm -f ns*/managed-keys.bind*
rm -f ns*/named.conf
rm -f ns*/named.lock
rm -f ns*/named.memstats
rm -f ns*/named.conf
rm -f ns*/named.run
rm -f ns*/named.run.prev
rm -f ns1/*dom*example.db
rm -f ns1/tls1.example.db
rm -f ns2/__catz__*db
rm -f ns2/catalog-bad*.db
rm -f ns2/named.conf.tmp
rm -f ns3/dom2.example.db ns3/dom13.example.db ns3/dom14.example.db ns3/dom17.example.db ns3/dom18.example.db
rm -f nsupdate.out.*
rm -f ns4/__catz__*db
rm -f ns4/catalog-self.example.db
rm -f ns[123]/catalog[1234].example.db
rm -rf ns2/zonedir
rm -f ns*/*.nzd ns*/*.nzd-lock
rm -f ns*/managed-keys.bind*
rm -f ns[14]/catalog-tls.example.db
rm -f nsupdate.out.*
rm -f wait_for_message.*
rm -rf ns2/zonedir
+17
View File
@@ -22,10 +22,12 @@ options {
notify-source 10.53.0.1;
transfer-source 10.53.0.1;
port @PORT@;
tls-port @TLSPORT@;
allow-new-zones yes;
pid-file "named.pid";
listen-on { 10.53.0.1; };
listen-on port @EXTRAPORT1@ { 10.53.0.1; };
listen-on tls ephemeral { 10.53.0.1; };
listen-on-v6 { none; };
notify no;
notify-delay 0;
@@ -105,6 +107,16 @@ view "default" {
also-notify { 10.53.0.2; };
notify explicit;
};
# A catalog zone that requires TLS to be used
zone "catalog-tls.example" {
type primary;
file "catalog-tls.example.db";
allow-transfer transport tls { key tsig_key; };
allow-update { any; };
also-notify { 10.53.0.4; };
notify explicit;
};
};
view "ch" ch {
@@ -125,3 +137,8 @@ key tsig_key. {
secret "LSAnCU+Z";
algorithm @DEFAULT_HMAC@;
};
key next_key. {
secret "LaAnCU+Z";
algorithm @DEFAULT_HMAC@;
};
+5
View File
@@ -177,3 +177,8 @@ key tsig_key. {
secret "LSAnCU+Z";
algorithm @DEFAULT_HMAC@;
};
key next_key. {
secret "LaAnCU+Z";
algorithm @DEFAULT_HMAC@;
};

Some files were not shown because too many files have changed in this diff Show More