Compare commits

...
Author SHA1 Message Date
Tony FinchandTony Finch 82a5d96407 Cache decompressed names 2022-12-09 21:35:34 +00:00
Tony FinchandTony Finch 180885fb46 Add a dns_name_append() function
This is maybe redundant wrt dns_name_concatenate() but neither the
documentation nor the code are straightforward enough for me to be
sure.
2022-12-09 21:35:34 +00:00
Tony FinchandTony Finch 8de253181e Avoid mystery numbers when manipulating labels in names
Use some more descriptive macros instead.
2022-12-09 21:35:15 +00:00
Tony FinchandTony Finch 0fc505df97 Embiggen decompression contexts
This partly reverts commit 1d807d84f1 "Shrink decompression contexts",
and while I am adjusting nearly all the calls to dns_name_fromwire()
it seems like a good time to remove all the unused `options`
arguments, to reduce the amount of cleanup churn.

I reworked the code that calls dns_decompress_setpermitted() at least
twice before I understood that it's a no-op. Good grief!

Before this year's changes, the decompression modes were ANY (which
became ALWAYS), NONE (became NEVER), and STRICT, which meant "strictly
follow RFC 3579" wrt whether or not a name is allowed to be compressed
in RDATA. (STRICT became DEFAULT, which in retrospect was a misnomer.)
STRICT was the only mode in which dns_decompress_setmethods() had any
effect, but decompression contexts were not initialized to STRICT and
later toggled (except in the tests), so all this machinery was not
actually used in production.

In practice, we either expect no names to be compressed, or permit any
name to be compressed. This is not entirely Postel's law: there were
compatibility issues around the time RFC 3579 was written, so RRtypes
allocated between RFC 1035 and RFC 3579 might legitimately have compressed
RDATA even though that is formally discouraged.

So after another round of refactoring, "ALWAYS" is now indicated by
the presence of a decompression context, and "NEVER" is indicated by a
NULL dctx pointer, and the mutable mode only remains in a vesigial
place-holder form.
2022-12-09 18:48:06 +00:00
Tony FinchandTony Finch da2abb8840 Parse large messages a little bit faster
dns_message_gettempname() allocates a dns_fixedname_t, which
includes a buffer and an offsets vector, so it is not necessary to
separately allocate a scratch buffer or a fresh offsets vector.

When parsing a message, owner names are deduplicated to collect
records into RRsets. This can require a lot of name comparisons.
Add a place to keep a hash value inside a dns_fixedname_t, and use
it to avoid comparisons.

Together these speed up a large zone transfer by about 2.5%
2022-12-09 12:50:57 +00: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
812 changed files with 27083 additions and 17871 deletions
File diff suppressed because it is too large Load Diff
+173 -119
View File
@@ -12,7 +12,7 @@ variables:
TEST_PARALLEL_JOBS: 6
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"
@@ -122,10 +122,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 +142,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
@@ -185,7 +177,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 +230,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 +273,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 +308,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 +338,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 +357,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 +383,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
@@ -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
@@ -599,7 +617,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 +641,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,41 +659,16 @@ unit:gcc:oraclelinux9:amd64:
- job: gcc:oraclelinux9:amd64
artifacts: true
# Jobs for regular GCC builds on Debian 10 "buster" (amd64)
gcc:buster:amd64:
variables:
CC: gcc
CFLAGS: "${CFLAGS_COMMON}"
EXTRA_CONFIGURE: "--with-libidn2"
<<: *debian_buster_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
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
artifacts: true
# Jobs for regular GCC builds on Debian 11 "bullseye" (amd64)
# (The second unit test job also executes unstable unit tests.)
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
@@ -774,13 +767,20 @@ scan-build:
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:
@@ -888,40 +888,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 +918,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 +936,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 +986,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 +994,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 +1009,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 +1043,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
@@ -1281,6 +1258,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 +1298,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
@@ -1322,8 +1359,8 @@ respdiff-long-third-party:
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 +1373,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 +1387,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 +1401,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 +1415,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 +1429,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 +1485,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 +1516,19 @@ 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
# 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:
+1 -1
View File
@@ -86,7 +86,7 @@
- [ ] ***(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) by modifying the relevant `Dockerfile`.
[^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.
+6
View File
@@ -49,6 +49,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 +152,7 @@ Files: **/.clang-format
.clang-format
.clang-format.headers
.dir-locals.el
.git-blame-ignore-revs
.gitattributes
.gitignore
.gitlab-ci.yml
+323 -5
View File
@@ -1,3 +1,306 @@
6044. [performance] Speed up message parsing by avoiding unnecessary
allocations, and by hashing names to reduce the need
to compare them in full. [GL !7197]
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 +313,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
+2 -1
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@)
@@ -20,7 +21,7 @@ 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)
+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
+7 -4
View File
@@ -94,7 +94,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 +205,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 +408,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 +495,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 &&
+22
View File
@@ -401,6 +401,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) {
+18 -4
View File
@@ -165,8 +165,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 +361,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 +483,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 +523,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
+10 -1
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
+1 -24
View File
@@ -34,29 +34,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 +152,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 -1
View File
@@ -222,7 +222,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 -2
View File
@@ -127,7 +127,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 +209,7 @@ main(int argc, char **argv) {
}
/* Use canonical algorithm name */
algname = alg_totext(alg);
algname = dst_hmac_algorithm_totext(alg);
isc_mem_create(&mctx);
+21 -11
View File
@@ -464,7 +464,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 +489,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 +786,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));
}
@@ -943,14 +946,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 +1448,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 +1528,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 +1567,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 +1594,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;
+2 -1
View File
@@ -6,7 +6,8 @@ AM_CPPFLAGS += \
$(LIBISCCFG_CFLAGS) \
$(LIBIRS_CFLAGS) \
$(LIBBIND9_CFLAGS) \
$(LIBIDN2_CFLAGS)
$(LIBIDN2_CFLAGS) \
$(LIBUV_CFLAGS)
LDADD += \
libdighost.la \
+47 -13
View File
@@ -693,7 +693,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;
}
@@ -1522,8 +1523,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 +1795,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 +2009,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 +2019,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 +2074,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;
@@ -2388,7 +2416,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 +2490,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 +2673,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 +2766,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 +2807,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 +2816,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;
+22 -11
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
@@ -386,6 +388,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 +618,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 +748,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``.
+81 -33
View File
@@ -54,8 +54,11 @@
#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>
@@ -143,6 +146,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;
@@ -474,7 +478,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;
@@ -794,11 +799,14 @@ clone_lookup(dig_lookup_t *lookold, bool servers) {
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 +965,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 +1149,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 +1190,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) {
@@ -1593,7 +1607,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 +1920,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 +1942,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;
@@ -2425,12 +2441,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 +2566,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 +2783,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 +2860,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);
@@ -2926,7 +2953,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;
@@ -3671,13 +3699,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 +4273,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 +4406,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),
@@ -4609,7 +4641,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);
@@ -4653,10 +4686,17 @@ destroy_libs(void) {
clear_searchlist();
if (tsigkey != NULL) {
debug("freeing key %p", tsigkey);
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 (namebuf != NULL) {
debug("freeing key %p", tsigkey);
isc_buffer_free(&namebuf);
}
@@ -4675,12 +4715,20 @@ destroy_libs(void) {
}
isc_managers_destroy(&mctx, &loopmgr, &netmgr, &taskmgr);
#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;
+6 -4
View File
@@ -108,10 +108,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 */
@@ -188,6 +189,7 @@ struct dig_lookup {
char *tls_key_file;
isc_tlsctx_cache_t *tls_ctx_cache;
};
isc_stdtime_t fuzztime;
};
/*% The dig_query structure */
+15 -7
View File
@@ -533,7 +533,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 +543,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 +592,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 +708,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 +728,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 +773,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 +848,7 @@ parse_args(bool is_batchfile, int argc, char **argv) {
break;
case 'p':
port = atoi(isc_commandline_argument);
port_set = true;
break;
}
}
+1
View File
@@ -569,6 +569,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;
}
}
+14 -10
View File
@@ -519,7 +519,7 @@ match_keyset_dsset(dns_rdataset_t *keyset, dns_rdataset_t *dsset,
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++)
@@ -575,7 +575,7 @@ free_keytable(keyinfo_t **keytable_p) {
}
}
isc_mem_put(mctx, keytable, sizeof(keyinfo_t) * nkey);
isc_mem_put(mctx, keytable, sizeof(keytable[0]) * nkey);
}
/*
@@ -594,8 +594,7 @@ 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);
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 +635,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 +677,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);
}
@@ -1085,7 +1085,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 {
@@ -1177,7 +1178,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 +1202,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 +1211,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);
}
+1 -1
View File
@@ -314,7 +314,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++) {
+4 -2
View File
@@ -559,7 +559,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 +587,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 -5
View File
@@ -254,7 +254,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 +392,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 +729,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 +984,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 +1001,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 -1
View File
@@ -136,7 +136,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 -2
View File
@@ -544,7 +544,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 +553,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");
}
+65 -36
View File
@@ -215,7 +215,7 @@ 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;
unsigned int bufsize = 4096;
if (outputformat != dns_masterformat_text) {
return;
@@ -228,7 +228,7 @@ dumpnode(dns_name_t *name, dns_dbnode_t *node) {
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);
@@ -365,7 +365,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 +566,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 +578,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 +680,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 +703,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 +715,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 +757,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 +1193,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 +1211,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 +1267,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 +1313,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 +1362,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 +1444,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. */
@@ -1505,7 +1516,7 @@ cleannode(dns_db_t *db, dns_dbversion_t *dbversion, dns_dbnode_t *node) {
}
dns_rdataset_init(&set);
result = dns_db_allrdatasets(db, node, dbversion, 0, &rdsiter);
result = dns_db_allrdatasets(db, node, dbversion, 0, 0, &rdsiter);
check_result(result, "dns_db_allrdatasets");
result = dns_rdatasetiter_first(rdsiter);
while (result == ISC_R_SUCCESS) {
@@ -1651,10 +1662,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)) {
@@ -1825,7 +1838,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 +1849,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 +1881,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 +1945,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 +2301,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 +2357,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 +2470,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 +2613,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 +2796,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))
{
@@ -3115,7 +3138,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;
}
@@ -3729,7 +3753,10 @@ main(int argc, char *argv[]) {
isc_managers_create(&mctx, ntasks, &loopmgr, &netmgr, &taskmgr);
isc_task_create(taskmgr, &write_task, 0);
result = isc_task_create(taskmgr, &write_task, 0);
if (result != ISC_R_SUCCESS) {
fatal("failed to create task: %s", isc_result_totext(result));
}
result = dst_lib_init(mctx, engine);
if (result != ISC_R_SUCCESS) {
@@ -3791,7 +3818,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);
}
@@ -3900,7 +3928,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++;
}
@@ -4033,8 +4062,8 @@ 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 *));
tasks = isc_mem_getx(mctx, ntasks * sizeof(isc_task_t *),
ISC_MEM_ZERO);
isc_loopmgr_setup(loopmgr, startworker, tasks);
isc_loopmgr_teardown(loopmgr, workerdone, tasks);
+5 -3
View File
@@ -315,7 +315,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 +332,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 +408,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 -1
View File
@@ -14,6 +14,7 @@ AM_CPPFLAGS += \
$(MAXMINDDB_CFLAGS) \
$(DNSTAP_CFLAGS) \
$(LIBUV_CFLAGS) \
$(LIBSYSTEMD_CFLAGS) \
$(ZLIB_CFLAGS)
if HAVE_JSON_C
@@ -109,7 +110,7 @@ named_LDADD = \
$(MAXMINDDB_LIBS) \
$(DNSTAP_LIBS) \
$(LIBUV_LIBS) \
$(LIBXML2_LIBS) \
$(LIBSYSTEMD_LIBS) \
$(ZLIB_LIBS)
if HAVE_JSON_C
@@ -121,3 +122,8 @@ if HAVE_LIBNGHTTP2
named_LDADD += \
$(LIBNGHTTP2_LIBS)
endif HAVE_LIBNGHTTP2
if HAVE_LIBXML2
named_LDADD += \
$(LIBXML2_LIBS)
endif HAVE_LIBXML2
+2 -1
View File
@@ -302,7 +302,8 @@ dns64_cname(const dns_name_t *zone, const dns_name_t *name,
* Reverse of 192.0.0.170 or 192.0.0.171 maps to ipv4only.arpa.
*/
if ((v[0] == 170 || v[0] == 171) && v[1] == 0 && v[2] == 0 &&
v[3] == 192) {
v[3] == 192)
{
return (dns_sdb_putrdata(lookup, dns_rdatatype_ptr, 3600,
ipv4only, sizeof(ipv4only)));
}
+39 -49
View File
@@ -50,16 +50,12 @@ 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"
@@ -115,7 +111,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\
@@ -152,6 +147,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"
@@ -222,7 +218,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\
@@ -394,7 +389,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 +406,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 +480,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;
@@ -621,7 +619,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,35 +680,22 @@ 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
@@ -879,18 +865,22 @@ 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);
}
i++;
}
if (pushed != 0) {
+1 -4
View File
@@ -97,10 +97,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));
+4 -2
View File
@@ -469,7 +469,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;
}
@@ -916,7 +917,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 -8
View File
@@ -225,12 +225,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 +531,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;
}
-8
View File
@@ -106,14 +106,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.
*/
+2 -1
View File
@@ -201,7 +201,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;
}
+145 -66
View File
@@ -35,7 +35,6 @@
#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>
@@ -44,6 +43,7 @@
#include <isc/timer.h>
#include <isc/util.h>
#include <isc/uv.h>
#include <isc/xml.h>
#include <dns/dispatch.h>
#include <dns/dyndb.h>
@@ -240,12 +240,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 +259,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 +267,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 +280,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 +294,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 +439,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 +465,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_WARNING, "%.*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 +636,18 @@ 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");
} else {
printf("DST initialization failure: %s\n",
isc_result_totext(result));
}
/*
* The default rndc.conf and rndc.key paths are in the same
@@ -564,7 +673,6 @@ printversion(bool verbose) {
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));
@@ -934,7 +1042,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 +1214,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 +1272,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 +1381,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 +1389,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 +1398,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 +1406,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 +1415,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 +1442,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 +1508,7 @@ main(int argc, char *argv[]) {
setup();
isc_mem_setname(named_g_mctx, "main");
INSIST(named_g_server != NULL);
/*
* Start things running
@@ -1445,8 +1522,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()));
@@ -1475,6 +1551,13 @@ main(int argc, char *argv[]) {
isc_managers_destroy(&named_g_mctx, &named_g_loopmgr, &named_g_netmgr,
&named_g_taskmgr);
#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 +1566,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 -1
View File
@@ -203,7 +203,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 -80
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
@@ -37,13 +38,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 +64,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 +250,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 +396,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 +591,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 +603,7 @@ named_os_changeuser(void) {
}
linux_minprivs();
#endif /* if defined(HAVE_SYS_CAPABILITY_H) */
#endif /* HAVE_LIBCAP */
}
uid_t
@@ -485,30 +616,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 +785,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 +810,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);
+238 -222
View File
@@ -28,6 +28,10 @@
#include <fstrm.h>
#endif
#ifdef HAVE_LIBSYSTEMD
#include <systemd/sd-daemon.h>
#endif
#include <isc/aes.h>
#include <isc/attributes.h>
#include <isc/base64.h>
@@ -48,7 +52,6 @@
#include <isc/portset.h>
#include <isc/print.h>
#include <isc/refcount.h>
#include <isc/resource.h>
#include <isc/result.h>
#include <isc/signal.h>
#include <isc/siphash.h>
@@ -215,11 +218,12 @@
} while (0)
#define CHECKFATAL(op, msg) \
do { \
{ \
result = (op); \
if (result != ISC_R_SUCCESS) \
if (result != ISC_R_SUCCESS) { \
fatal(server, msg, result); \
} while (0)
} \
}
/*%
* Maximum ADB size for views that share a cache. Use this limit to suppress
@@ -260,7 +264,7 @@ struct dumpcontext {
dns_dumpctx_t *mdctx;
dns_db_t *db;
dns_db_t *cache;
isc_task_t *task;
isc_loop_t *loop;
dns_dbversion_t *version;
};
@@ -960,7 +964,8 @@ process_key(const cfg_obj_t *key, dns_keytable_t *secroots,
* warning, but do not prevent further keys from being processed.
*/
if (!dns_resolver_algorithm_supported(view->resolver, keyname,
ds.algorithm)) {
ds.algorithm))
{
cfg_obj_log(key, named_g_lctx, ISC_LOG_WARNING,
"ignoring %s for '%s': algorithm is disabled",
initializing ? "initial-key" : "static-key",
@@ -1002,7 +1007,8 @@ load_view_keys(const cfg_obj_t *keys, dns_view_t *view, bool managed,
keylist = cfg_listelt_value(elt);
for (elt2 = cfg_list_first(keylist); elt2 != NULL;
elt2 = cfg_list_next(elt2)) {
elt2 = cfg_list_next(elt2))
{
CHECK(process_key(cfg_listelt_value(elt2), secroots,
keyname, view, managed));
}
@@ -1070,7 +1076,8 @@ configure_view_dnsseckeys(dns_view_t *view, const cfg_obj_t *vconfig,
/* We don't need trust anchors for the _bind view */
if (strcmp(view->name, "_bind") == 0 &&
view->rdclass == dns_rdataclass_chaos) {
view->rdclass == dns_rdataclass_chaos)
{
return (ISC_R_SUCCESS);
}
@@ -1470,6 +1477,12 @@ configure_peer(const cfg_obj_t *cpeer, isc_mem_t *mctx, dns_peer_t **peerp) {
CHECK(dns_peer_setsendcookie(peer, cfg_obj_asboolean(obj)));
}
obj = NULL;
(void)cfg_map_get(cpeer, "require-cookie", &obj);
if (obj != NULL) {
CHECK(dns_peer_setrequirecookie(peer, cfg_obj_asboolean(obj)));
}
obj = NULL;
(void)cfg_map_get(cpeer, "edns", &obj);
if (obj != NULL) {
@@ -2051,7 +2064,8 @@ conf_dnsrps_get(const cfg_obj_t **sub_obj, const cfg_obj_t **maps,
if (cfg_obj_isvoid(*sub_obj)) {
*sub_obj = NULL;
if (maps != NULL &&
ISC_R_SUCCESS != named_config_get(maps, name, sub_obj)) {
ISC_R_SUCCESS != named_config_get(maps, name, sub_obj))
{
*sub_obj = NULL;
}
}
@@ -2197,7 +2211,8 @@ conf_dnsrps(dns_view_t *view, const cfg_obj_t **maps, bool nsip_enabled,
* statement in the view and the general options.
*/
if (conf_dnsrps_get(&obj, maps, rpz_obj, "dnsrps-options", &ctx) &&
obj != NULL) {
obj != NULL)
{
conf_dnsrps_sadd(&ctx, " %s\n", cfg_obj_asstring(obj));
}
@@ -2274,7 +2289,8 @@ configure_rpz_zone(dns_view_t *view, const cfg_listelt_t *element,
obj = cfg_tuple_get(rpz_obj, "recursive-only");
if (cfg_obj_isvoid(obj) ? recursive_only_default
: cfg_obj_asboolean(obj)) {
: cfg_obj_asboolean(obj))
{
view->rpzs->p.no_rd_ok &= ~DNS_RPZ_ZBIT(zone->num);
} else {
view->rpzs->p.no_rd_ok |= DNS_RPZ_ZBIT(zone->num);
@@ -2317,9 +2333,11 @@ configure_rpz_zone(dns_view_t *view, const cfg_listelt_t *element,
}
if (!view->rpzs->p.dnsrps_enabled) {
for (rpz_num = 0; rpz_num < view->rpzs->p.num_zones - 1;
++rpz_num) {
++rpz_num)
{
if (dns_name_equal(&view->rpzs->zones[rpz_num]->origin,
&zone->origin)) {
&zone->origin))
{
cfg_obj_log(rpz_obj, named_g_lctx,
DNS_RPZ_ERROR_LEVEL,
"duplicate '%s'", str);
@@ -2504,9 +2522,8 @@ configure_rpz(dns_view_t *view, dns_view_t *pview, const cfg_obj_t **maps,
}
#endif /* ifndef USE_DNSRPS */
result = dns_rpz_new_zones(&view->rpzs, rps_cstr, rps_cstr_size,
view->mctx, named_g_loopmgr,
named_g_taskmgr);
result = dns_rpz_new_zones(view->mctx, named_g_loopmgr, rps_cstr,
rps_cstr_size, &view->rpzs);
if (result != ISC_R_SUCCESS) {
return (result);
}
@@ -2627,10 +2644,12 @@ configure_rpz(dns_view_t *view, dns_view_t *pview, const cfg_obj_t **maps,
*/
if (*old_rpz_okp) {
if (old != NULL &&
memcmp(&old->p, &zones->p, sizeof(zones->p)) != 0) {
memcmp(&old->p, &zones->p, sizeof(zones->p)) != 0)
{
*old_rpz_okp = false;
} else if ((old == NULL || old->rps_cstr == NULL) !=
(zones->rps_cstr == NULL)) {
(zones->rps_cstr == NULL))
{
*old_rpz_okp = false;
} else if (old != NULL && zones->rps_cstr != NULL &&
strcmp(old->rps_cstr, zones->rps_cstr) != 0)
@@ -2640,6 +2659,7 @@ configure_rpz(dns_view_t *view, dns_view_t *pview, const cfg_obj_t **maps,
}
if (*old_rpz_okp) {
dns_rpz_shutdown_rpzs(view->rpzs);
dns_rpz_detach_rpzs(&view->rpzs);
dns_rpz_attach_rpzs(pview->rpzs, &view->rpzs);
} else if (old != NULL && pview != NULL) {
@@ -2690,7 +2710,8 @@ catz_addmodzone_taskaction(isc_task_t *task, isc_event_t *event0) {
result = dns_fwdtable_find(ev->view->fwdtable, name, NULL,
&dnsforwarders);
if (result == ISC_R_SUCCESS &&
dnsforwarders->fwdpolicy == dns_fwdpolicy_only) {
dnsforwarders->fwdpolicy == dns_fwdpolicy_only)
{
isc_log_write(named_g_lctx, NAMED_LOGCATEGORY_GENERAL,
NAMED_LOGMODULE_SERVER, ISC_LOG_WARNING,
"catz: catz_addmodzone_taskaction: "
@@ -2773,7 +2794,8 @@ catz_addmodzone_taskaction(isc_task_t *task, isc_event_t *event0) {
}
goto cleanup;
} else if (result != ISC_R_NOTFOUND &&
result != DNS_R_PARTIALMATCH) {
result != DNS_R_PARTIALMATCH)
{
isc_log_write(named_g_lctx, NAMED_LOGCATEGORY_GENERAL,
NAMED_LOGMODULE_SERVER, ISC_LOG_WARNING,
"catz: error \"%s\" while trying to "
@@ -3491,7 +3513,8 @@ create_empty_zone(dns_zone_t *pzone, dns_name_t *name, dns_view_t *view,
obj = NULL;
(void)cfg_map_get(zoptions, "type", &obj);
if (obj != NULL &&
strcasecmp(cfg_obj_asstring(obj), "forward") == 0) {
strcasecmp(cfg_obj_asstring(obj), "forward") == 0)
{
obj = NULL;
(void)cfg_map_get(zoptions, "forward", &obj);
if (obj == NULL) {
@@ -3541,7 +3564,8 @@ create_empty_zone(dns_zone_t *pzone, dns_name_t *name, dns_view_t *view,
}
if (pzone != NULL &&
dns_zone_gettype(pzone) != dns_zone_primary) {
dns_zone_gettype(pzone) != dns_zone_primary)
{
pzone = NULL;
}
if (pzone != NULL && dns_zone_getfile(pzone) != NULL) {
@@ -4060,6 +4084,8 @@ configure_view(dns_view_t *view, dns_viewlist_t *viewlist, cfg_obj_t *config,
const cfg_obj_t *zonelist;
const cfg_obj_t *dlzlist;
const cfg_obj_t *dlz;
const cfg_obj_t *prefetch_trigger;
const cfg_obj_t *prefetch_eligible;
unsigned int dlzargc;
char **dlzargv;
const cfg_obj_t *dyndb_list, *plugin_list;
@@ -4078,7 +4104,6 @@ configure_view(dns_view_t *view, dns_viewlist_t *viewlist, cfg_obj_t *config,
dns_tsig_keyring_t *ring = NULL;
dns_transport_list_t *transports = NULL;
dns_view_t *pview = NULL; /* Production view */
isc_mem_t *cmctx = NULL, *hmctx = NULL;
dns_dispatch_t *dispatch4 = NULL;
dns_dispatch_t *dispatch6 = NULL;
bool rpz_configured = false;
@@ -4329,8 +4354,7 @@ configure_view(dns_view_t *view, dns_viewlist_t *viewlist, cfg_obj_t *config,
max_cache_size = SIZE_AS_PERCENT;
max_cache_size_percent = cfg_obj_aspercentage(obj);
} else {
isc_resourcevalue_t value;
value = cfg_obj_asuint64(obj);
uint64_t value = cfg_obj_asuint64(obj);
if (value > SIZE_MAX) {
cfg_obj_log(obj, named_g_lctx, ISC_LOG_WARNING,
"'max-cache-size "
@@ -4672,7 +4696,8 @@ configure_view(dns_view_t *view, dns_viewlist_t *viewlist, cfg_obj_t *config,
}
if (pview != NULL) {
if (!cache_reusable(pview, view,
zero_no_soattl)) {
zero_no_soattl))
{
isc_log_write(named_g_lctx,
NAMED_LOGCATEGORY_GENERAL,
NAMED_LOGMODULE_SERVER,
@@ -4706,20 +4731,9 @@ configure_view(dns_view_t *view, dns_viewlist_t *viewlist, cfg_obj_t *config,
* view but is not yet configured. If it is not the
* view name but not a forward reference either, then it
* is simply a named cache that is not shared.
*
* We use two separate memory contexts for the
* cache, for the main cache memory and the heap
* memory.
*/
isc_mem_create(&cmctx);
isc_mem_setname(cmctx, "cache");
isc_mem_create(&hmctx);
isc_mem_setname(hmctx, "cache_heap");
CHECK(dns_cache_create(cmctx, hmctx, named_g_taskmgr,
view->rdclass, cachename, "rbt",
0, NULL, &cache));
isc_mem_detach(&cmctx);
isc_mem_detach(&hmctx);
CHECK(dns_cache_create(named_g_loopmgr, view->rdclass,
cachename, &cache));
}
nsc = isc_mem_get(mctx, sizeof(*nsc));
nsc->cache = NULL;
@@ -4754,8 +4768,7 @@ configure_view(dns_view_t *view, dns_viewlist_t *viewlist, cfg_obj_t *config,
maps, AF_INET6, &dispatch6, &dscp6,
(ISC_LIST_PREV(view, link) == NULL)));
if (dispatch4 == NULL && dispatch6 == NULL) {
UNEXPECTED_ERROR(__FILE__, __LINE__,
"unable to obtain either an IPv4 or"
UNEXPECTED_ERROR("unable to obtain either an IPv4 or"
" an IPv6 dispatch");
result = ISC_R_UNEXPECTED;
goto cleanup;
@@ -4800,7 +4813,8 @@ configure_view(dns_view_t *view, dns_viewlist_t *viewlist, cfg_obj_t *config,
max_adb_size = 1; /* Force minimum. */
}
if (view != nsc->primaryview &&
max_adb_size > MAX_ADB_SIZE_FOR_CACHESHARE) {
max_adb_size > MAX_ADB_SIZE_FOR_CACHESHARE)
{
max_adb_size = MAX_ADB_SIZE_FOR_CACHESHARE;
if (!nsc->adbsizeadjusted) {
dns_adb_setadbsize(nsc->primaryview->adb,
@@ -4920,7 +4934,7 @@ configure_view(dns_view_t *view, dns_viewlist_t *viewlist, cfg_obj_t *config,
if (udpsize > 4096) {
udpsize = 4096;
}
dns_resolver_setudpsize(view->resolver, (uint16_t)udpsize);
dns_view_setudpsize(view, (uint16_t)udpsize);
/*
* Set the maximum UDP response size.
@@ -5277,7 +5291,8 @@ configure_view(dns_view_t *view, dns_viewlist_t *viewlist, cfg_obj_t *config,
NULL, actx, named_g_mctx, &view->cacheonacl));
if (strcmp(view->name, "_bind") != 0 &&
view->rdclass != dns_rdataclass_chaos) {
view->rdclass != dns_rdataclass_chaos)
{
/* named.conf only */
CHECK(configure_view_acl(vconfig, config, NULL,
"allow-recursion", NULL, actx,
@@ -5560,33 +5575,29 @@ configure_view(dns_view_t *view, dns_viewlist_t *viewlist, cfg_obj_t *config,
obj = NULL;
result = named_config_get(maps, "prefetch", &obj);
if (result == ISC_R_SUCCESS) {
const cfg_obj_t *trigger, *eligible;
trigger = cfg_tuple_get(obj, "trigger");
view->prefetch_trigger = cfg_obj_asuint32(trigger);
if (view->prefetch_trigger > 10) {
view->prefetch_trigger = 10;
}
eligible = cfg_tuple_get(obj, "eligible");
if (cfg_obj_isvoid(eligible)) {
int m;
for (m = 1; maps[m] != NULL; m++) {
obj = NULL;
result = named_config_get(&maps[m], "prefetch",
&obj);
INSIST(result == ISC_R_SUCCESS);
eligible = cfg_tuple_get(obj, "eligible");
if (cfg_obj_isuint32(eligible)) {
break;
}
INSIST(result == ISC_R_SUCCESS);
prefetch_trigger = cfg_tuple_get(obj, "trigger");
view->prefetch_trigger = cfg_obj_asuint32(prefetch_trigger);
if (view->prefetch_trigger > 10) {
view->prefetch_trigger = 10;
}
prefetch_eligible = cfg_tuple_get(obj, "eligible");
if (cfg_obj_isvoid(prefetch_eligible)) {
int m;
for (m = 1; maps[m] != NULL; m++) {
obj = NULL;
result = named_config_get(&maps[m], "prefetch", &obj);
INSIST(result == ISC_R_SUCCESS);
prefetch_eligible = cfg_tuple_get(obj, "eligible");
if (cfg_obj_isuint32(prefetch_eligible)) {
break;
}
INSIST(cfg_obj_isuint32(eligible));
}
view->prefetch_eligible = cfg_obj_asuint32(eligible);
if (view->prefetch_eligible < view->prefetch_trigger + 6) {
view->prefetch_eligible = view->prefetch_trigger + 6;
}
INSIST(cfg_obj_isuint32(prefetch_eligible));
}
view->prefetch_eligible = cfg_obj_asuint32(prefetch_eligible);
if (view->prefetch_eligible < view->prefetch_trigger + 6) {
view->prefetch_eligible = view->prefetch_trigger + 6;
}
/*
@@ -5707,7 +5718,8 @@ configure_view(dns_view_t *view, dns_viewlist_t *viewlist, cfg_obj_t *config,
(void)named_config_get(maps, "empty-zones-enable", &obj);
(void)named_config_get(maps, "disable-empty-zone", &disablelist);
if (obj == NULL && disablelist == NULL &&
view->rdclass == dns_rdataclass_in) {
view->rdclass == dns_rdataclass_in)
{
empty_zones_enable = view->recursion;
} else if (view->rdclass == dns_rdataclass_in) {
if (obj != NULL) {
@@ -5792,7 +5804,8 @@ configure_view(dns_view_t *view, dns_viewlist_t *viewlist, cfg_obj_t *config,
*/
CHECK(dns_name_fromstring(name, empty, 0, NULL));
if (disablelist != NULL &&
on_disable_list(disablelist, name)) {
on_disable_list(disablelist, name))
{
continue;
}
@@ -5882,7 +5895,8 @@ configure_view(dns_view_t *view, dns_viewlist_t *viewlist, cfg_obj_t *config,
name = dns_fixedname_initname(&fixed);
for (ipv4only_zone = 0; ipv4only_zone < ARRAY_SIZE(zones);
ipv4only_zone++) {
ipv4only_zone++)
{
dns_forwarders_t *dnsforwarders = NULL;
CHECK(dns_name_fromstring(
@@ -6119,12 +6133,6 @@ cleanup:
if (order != NULL) {
dns_order_detach(&order);
}
if (cmctx != NULL) {
isc_mem_detach(&cmctx);
}
if (hmctx != NULL) {
isc_mem_detach(&hmctx);
}
if (cache != NULL) {
dns_cache_detach(&cache);
}
@@ -6493,6 +6501,7 @@ configure_zone(const cfg_obj_t *config, const cfg_obj_t *zconfig,
bool zone_is_catz = false;
bool zone_maybe_inline = false;
bool inline_signing = false;
bool fullsign = false;
options = NULL;
(void)cfg_map_get(config, "options", &options);
@@ -6731,7 +6740,8 @@ configure_zone(const cfg_obj_t *config, const cfg_obj_t *zconfig,
}
if (view->catzs != NULL &&
dns_catz_get_zone(view->catzs, origin) != NULL) {
dns_catz_get_zone(view->catzs, origin) != NULL)
{
zone_is_catz = true;
}
@@ -6761,6 +6771,7 @@ configure_zone(const cfg_obj_t *config, const cfg_obj_t *zconfig,
if (zone != NULL && !named_zone_reusable(zone, zconfig)) {
dns_zone_detach(&zone);
fullsign = true;
}
if (zone != NULL && (rpz_num != dns_zone_get_rpz_num(zone) ||
@@ -6895,7 +6906,7 @@ configure_zone(const cfg_obj_t *config, const cfg_obj_t *zconfig,
* Ensure that zone keys are reloaded on reconfig
*/
if ((dns_zone_getkeyopts(zone) & DNS_ZONEKEY_MAINTAIN) != 0) {
dns_zone_rekey(zone, false);
dns_zone_rekey(zone, fullsign);
}
cleanup:
@@ -7063,7 +7074,7 @@ static void
interface_timer_tick(void *arg) {
named_server_t *server = (named_server_t *)arg;
ns_interfacemgr_scan(server->interfacemgr, false, false);
(void)ns_interfacemgr_scan(server->interfacemgr, false, false);
}
static void
@@ -7198,13 +7209,13 @@ get_tat_qname(dns_name_t *target, dns_name_t *keyname, dns_keynode_t *keynode) {
r.base = label;
r.length = sizeof(label);
m = snprintf(r.base, r.length, "_ta");
if (m < 0 || (unsigned)m > r.length) {
if (m < 0 || (unsigned int)m > r.length) {
return (ISC_R_FAILURE);
}
isc_textregion_consume(&r, m);
for (i = 0; i < n; i++) {
m = snprintf(r.base, r.length, "-%04x", ids[i]);
if (m < 0 || (unsigned)m > r.length) {
if (m < 0 || (unsigned int)m > r.length) {
return (ISC_R_FAILURE);
}
isc_textregion_consume(&r, m);
@@ -7425,51 +7436,6 @@ setoptstring(named_server_t *server, char **field, const cfg_obj_t *obj) {
}
}
static void
set_limit(const cfg_obj_t **maps, const char *configname,
const char *description, isc_resource_t resourceid,
isc_resourcevalue_t defaultvalue) {
const cfg_obj_t *obj = NULL;
const char *resource;
isc_resourcevalue_t value;
isc_result_t result;
if (named_config_get(maps, configname, &obj) != ISC_R_SUCCESS) {
return;
}
if (cfg_obj_isstring(obj)) {
resource = cfg_obj_asstring(obj);
if (strcasecmp(resource, "unlimited") == 0) {
value = ISC_RESOURCE_UNLIMITED;
} else {
INSIST(strcasecmp(resource, "default") == 0);
value = defaultvalue;
}
} else {
value = cfg_obj_asuint64(obj);
}
result = isc_resource_setlimit(resourceid, value);
isc_log_write(
named_g_lctx, NAMED_LOGCATEGORY_GENERAL, NAMED_LOGMODULE_SERVER,
result == ISC_R_SUCCESS ? ISC_LOG_DEBUG(3) : ISC_LOG_WARNING,
"set maximum %s to %" PRIu64 ": %s", description, value,
isc_result_totext(result));
}
#define SETLIMIT(cfgvar, resource, description) \
set_limit(maps, cfgvar, description, isc_resource_##resource, \
named_g_init##resource)
static void
set_limits(const cfg_obj_t **maps) {
SETLIMIT("stacksize", stacksize, "stack size");
SETLIMIT("datasize", datasize, "data size");
SETLIMIT("coresize", coresize, "core size");
SETLIMIT("files", openfiles, "open files");
}
static void
portset_fromconf(isc_portset_t *portset, const cfg_obj_t *ports,
bool positive) {
@@ -8395,6 +8361,11 @@ load_configuration(const char *filename, named_server_t *server,
dns_aclenv_t *env =
ns_interfacemgr_getaclenv(named_g_server->interfacemgr);
/*
* Require the reconfiguration to happen always on the main loop
*/
REQUIRE(isc_loop_current(named_g_loopmgr) == named_g_mainloop);
ISC_LIST_INIT(kasplist);
ISC_LIST_INIT(viewlist);
ISC_LIST_INIT(builtin_viewlist);
@@ -8557,11 +8528,6 @@ load_configuration(const char *filename, named_server_t *server,
server->bindkeysfile);
}
/*
* Set process limits, which (usually) needs to be done as root.
*/
set_limits(maps);
/*
* Check the process lockfile.
*/
@@ -8604,7 +8570,7 @@ load_configuration(const char *filename, named_server_t *server,
max = isc_quota_getmax(&server->sctx->recursionquota);
if (max > 1000) {
unsigned margin = ISC_MAX(100, named_g_cpus + 1);
unsigned int margin = ISC_MAX(100, named_g_cpus + 1);
if (margin + 100 > max) {
isc_log_write(named_g_lctx, NAMED_LOGCATEGORY_GENERAL,
NAMED_LOGMODULE_SERVER, ISC_LOG_ERROR,
@@ -8947,7 +8913,8 @@ load_configuration(const char *filename, named_server_t *server,
isc_nm_setloadbalancesockets(named_g_netmgr,
cfg_obj_asboolean(obj));
} else if (loadbalancesockets !=
isc_nm_getloadbalancesockets(named_g_netmgr)) {
isc_nm_getloadbalancesockets(named_g_netmgr))
{
cfg_obj_log(obj, named_g_lctx, ISC_LOG_WARNING,
"changing reuseport value requires server restart");
}
@@ -9030,6 +8997,32 @@ load_configuration(const char *filename, named_server_t *server,
}
}
if (first_time) {
isc_task_endexclusive(server->task);
/*
* Rescan the interface list to pick up changes in the
* listen-on option.
*/
result = ns_interfacemgr_scan(server->interfacemgr, true, true);
isc_task_beginexclusive(server->task);
/*
* Check that named is able to TCP listen on at least one
* interface. Otherwise, another named process could be running
* and we should fail.
*/
if (result == ISC_R_ADDRINUSE) {
isc_log_write(named_g_lctx, NAMED_LOGCATEGORY_GENERAL,
NAMED_LOGMODULE_SERVER, ISC_LOG_ERROR,
"unable to listen on any configured "
"interfaces");
result = ISC_R_FAILURE;
goto cleanup_v6portset;
}
}
/*
* Arrange for further interface scanning to occur periodically
* as specified by the "interface-interval" option.
@@ -9638,7 +9631,8 @@ load_configuration(const char *filename, named_server_t *server,
sizeof(server->sctx->secret));
result = isc_hex_decodestring(str, &b);
if (result != ISC_R_SUCCESS &&
result != ISC_R_NOSPACE) {
result != ISC_R_NOSPACE)
{
goto cleanup_altsecrets;
}
first = false;
@@ -9649,7 +9643,8 @@ load_configuration(const char *filename, named_server_t *server,
sizeof(altsecret->secret));
result = isc_hex_decodestring(str, &b);
if (result != ISC_R_SUCCESS &&
result != ISC_R_NOSPACE) {
result != ISC_R_NOSPACE)
{
isc_mem_put(server->sctx->mctx,
altsecret,
sizeof(*altsecret));
@@ -9759,26 +9754,7 @@ load_configuration(const char *filename, named_server_t *server,
goto cleanup_altsecrets;
}
/*
* Rescan the interface list to pick up changes in the
* listen-on option. It's important that we do this before we try
* to configure the query source, since the dispatcher we use might
* be shared with an interface.
*/
result = ns_interfacemgr_scan(server->interfacemgr, true, true);
/*
* Check that named is able to TCP listen on at least one
* interface. Otherwise, another named process could be running
* and we should fail.
*/
if (first_time && (result == ISC_R_ADDRINUSE)) {
isc_log_write(named_g_lctx, NAMED_LOGCATEGORY_GENERAL,
NAMED_LOGMODULE_SERVER, ISC_LOG_ERROR,
"unable to listen on any configured interfaces");
result = ISC_R_FAILURE;
goto cleanup_altsecrets;
}
(void)ns_interfacemgr_scan(server->interfacemgr, true, true);
/*
* These cleans up either the old production view list
@@ -9807,14 +9783,15 @@ cleanup_cachelist:
cleanup_viewlist:
for (dns_view_t *view = ISC_LIST_HEAD(viewlist); view != NULL;
view = view_next) {
view = view_next)
{
view_next = ISC_LIST_NEXT(view, link);
ISC_LIST_UNLINK(viewlist, view, link);
if (result == ISC_R_SUCCESS && strcmp(view->name, "_bind") != 0)
{
dns_view_setviewrevert(view);
(void)dns_zt_apply(view->zonetable, false, NULL,
removed, view);
(void)dns_zt_apply(view->zonetable, isc_rwlocktype_read,
false, NULL, removed, view);
}
dns_view_detach(&view);
}
@@ -9906,6 +9883,15 @@ view_loaded(void *arg) {
"FIPS mode is %s",
FIPS_mode() ? "enabled" : "disabled");
#endif /* ifdef HAVE_FIPS_MODE */
#if HAVE_LIBSYSTEMD
sd_notifyf(0,
"READY=1\n"
"STATUS=running\n"
"MAINPID=%" PRId64 "\n",
(int64_t)getpid());
#endif /* HAVE_LIBSYSTEMD */
atomic_store(&server->reload_status, NAMED_RELOAD_DONE);
isc_log_write(named_g_lctx, NAMED_LOGCATEGORY_GENERAL,
@@ -9984,12 +9970,15 @@ run_server(isc_task_t *task, isc_event_t *event) {
named_server_t *server = (named_server_t *)event->ev_arg;
dns_geoip_databases_t *geoip = NULL;
fprintf(stderr, "%s\n", __func__);
INSIST(task == server->task);
isc_event_free(&event);
CHECKFATAL(dns_zonemgr_create(named_g_mctx, named_g_loopmgr,
named_g_taskmgr, named_g_netmgr,
&server->zonemgr),
"dns_zonemgr_create");
CHECKFATAL(dns_dispatchmgr_create(named_g_mctx, named_g_netmgr,
&named_g_dispatchmgr),
"creating dispatch manager");
@@ -10079,6 +10068,10 @@ shutdown_server(isc_task_t *task, isc_event_t *event) {
isc_event_free(&event);
#if HAVE_LIBSYSTEMD
sd_notify(0, "STOPPING=1\n");
#endif /* HAVE_LIBSYSTEMD */
/*
* We need to shutdown the interface before going
* exclusive (which would pause the netmgr).
@@ -10109,14 +10102,16 @@ shutdown_server(isc_task_t *task, isc_event_t *event) {
(void)named_server_saventa(server);
for (kasp = ISC_LIST_HEAD(server->kasplist); kasp != NULL;
kasp = kasp_next) {
kasp = kasp_next)
{
kasp_next = ISC_LIST_NEXT(kasp, link);
ISC_LIST_UNLINK(server->kasplist, kasp, link);
dns_kasp_detach(&kasp);
}
for (view = ISC_LIST_HEAD(server->viewlist); view != NULL;
view = view_next) {
view = view_next)
{
view_next = ISC_LIST_NEXT(view, link);
ISC_LIST_UNLINK(server->viewlist, view, link);
dns_view_flushonshutdown(view, flush);
@@ -10204,7 +10199,8 @@ get_matching_view(isc_netaddr_t *srcaddr, isc_netaddr_t *destaddr,
view = ISC_LIST_NEXT(view, link))
{
if (message->rdclass == view->rdclass ||
message->rdclass == dns_rdataclass_any) {
message->rdclass == dns_rdataclass_any)
{
const dns_name_t *tsig = NULL;
*sigresult = dns_message_rechecksig(message, view);
@@ -10300,11 +10296,6 @@ named_server_create(isc_mem_t *mctx, named_server_t **serverp) {
server->sighup = isc_signal_new(
named_g_loopmgr, named_server_reloadwanted, server, SIGHUP);
CHECKFATAL(dns_zonemgr_create(named_g_mctx, named_g_loopmgr,
named_g_taskmgr, named_g_netmgr,
&server->zonemgr),
"dns_zonemgr_create");
CHECKFATAL(isc_stats_create(server->mctx, &server->sockstats,
isc_sockstatscounter_max),
"isc_stats_create");
@@ -10520,6 +10511,10 @@ reload(named_server_t *server) {
isc_result_t result;
atomic_store(&server->reload_status, NAMED_RELOAD_IN_PROGRESS);
#if HAVE_LIBSYSTEMD
sd_notify(0, "RELOADING=1\n"
"STATUS=reload command received\n");
#endif /* HAVE_LIBSYSTEMD */
CHECK(loadconfig(server));
@@ -10536,6 +10531,12 @@ reload(named_server_t *server) {
atomic_store(&server->reload_status, NAMED_RELOAD_FAILED);
}
cleanup:
#if HAVE_LIBSYSTEMD
sd_notifyf(0,
"READY=1\n"
"STATUS=reload command finished: %s\n",
isc_result_totext(result));
#endif /* HAVE_LIBSYSTEMD */
return (result);
}
@@ -10619,7 +10620,8 @@ next_token(isc_lex_t *lex, isc_buffer_t **text) {
}
if (token.type == isc_tokentype_string ||
token.type == isc_tokentype_qstring) {
token.type == isc_tokentype_qstring)
{
return (token.value.as_textregion.base);
}
@@ -10897,6 +10899,10 @@ isc_result_t
named_server_reconfigcommand(named_server_t *server) {
isc_result_t result;
atomic_store(&server->reload_status, NAMED_RELOAD_IN_PROGRESS);
#if HAVE_LIBSYSTEMD
sd_notify(0, "RELOADING=1\n"
"STATUS=reconfig command received\n");
#endif /* HAVE_LIBSYSTEMD */
CHECK(loadconfig(server));
@@ -10913,6 +10919,12 @@ named_server_reconfigcommand(named_server_t *server) {
atomic_store(&server->reload_status, NAMED_RELOAD_FAILED);
}
cleanup:
#if HAVE_LIBSYSTEMD
sd_notifyf(0,
"READY=1\n"
"STATUS=reconfig command finished: %s\n",
isc_result_totext(result));
#endif /* HAVE_LIBSYSTEMD */
return (result);
}
@@ -11081,10 +11093,12 @@ find_maplist(const cfg_obj_t *config, const char *listname, const char *name) {
}
for (elt = cfg_list_first(maplist); elt != NULL;
elt = cfg_list_next(elt)) {
elt = cfg_list_next(elt))
{
const cfg_obj_t *map = cfg_listelt_value(elt);
if (strcasecmp(cfg_obj_asstring(cfg_map_getname(map)), name) ==
0) {
0)
{
return (map);
}
}
@@ -11158,12 +11172,14 @@ listenelt_fromconfig(const cfg_obj_t *listener, const cfg_obj_t *config,
cert = cfg_obj_asstring(certobj);
if (cfg_map_get(tlsmap, "ca-file", &ca_obj) ==
ISC_R_SUCCESS) {
ISC_R_SUCCESS)
{
ca_file = cfg_obj_asstring(ca_obj);
}
if (cfg_map_get(tlsmap, "protocols", &tls_proto_list) ==
ISC_R_SUCCESS) {
ISC_R_SUCCESS)
{
const cfg_listelt_t *proto = NULL;
INSIST(tls_proto_list != NULL);
for (proto = cfg_list_first(tls_proto_list);
@@ -11185,12 +11201,14 @@ listenelt_fromconfig(const cfg_obj_t *listener, const cfg_obj_t *config,
}
if (cfg_map_get(tlsmap, "dhparam-file", &dhparam_obj) ==
ISC_R_SUCCESS) {
ISC_R_SUCCESS)
{
dhparam_file = cfg_obj_asstring(dhparam_obj);
}
if (cfg_map_get(tlsmap, "ciphers", &ciphers_obj) ==
ISC_R_SUCCESS) {
ISC_R_SUCCESS)
{
ciphers = cfg_obj_asstring(ciphers_obj);
}
@@ -11373,7 +11391,8 @@ listenelt_http(const cfg_obj_t *http, const uint16_t family, bool tls,
}
if (cfg_map_get(http, "listener-clients", &cfg_max_clients) ==
ISC_R_SUCCESS) {
ISC_R_SUCCESS)
{
INSIST(cfg_max_clients != NULL);
max_clients = cfg_obj_asuint32(cfg_max_clients);
}
@@ -11390,7 +11409,8 @@ listenelt_http(const cfg_obj_t *http, const uint16_t family, bool tls,
if (http != NULL && eplist != NULL) {
for (elt = cfg_list_first(eplist); elt != NULL;
elt = cfg_list_next(elt)) {
elt = cfg_list_next(elt))
{
const cfg_obj_t *ep = cfg_listelt_value(elt);
const char *path = cfg_obj_asstring(ep);
endpoints[i++] = isc_mem_strdup(mctx, path);
@@ -11482,8 +11502,8 @@ add_view_tolist(struct dumpcontext *dctx, dns_view_t *view) {
ISC_LIST_INIT(vle->zonelist);
ISC_LIST_APPEND(dctx->viewlist, vle, link);
if (dctx->dumpzones) {
result = dns_zt_apply(view->zonetable, true, NULL,
add_zone_tolist, dctx);
result = dns_zt_apply(view->zonetable, isc_rwlocktype_read,
true, NULL, add_zone_tolist, dctx);
}
return (result);
}
@@ -11516,9 +11536,6 @@ dumpcontext_destroy(struct dumpcontext *dctx) {
if (dctx->cache != NULL) {
dns_db_detach(&dctx->cache);
}
if (dctx->task != NULL) {
isc_task_detach(&dctx->task);
}
if (dctx->fp != NULL) {
(void)isc_stdio_close(dctx->fp);
}
@@ -11574,8 +11591,8 @@ resume:
dns_cache_getname(dctx->view->view->cache));
result = dns_master_dumptostreamasync(
dctx->mctx, dctx->cache, NULL, style, dctx->fp,
dctx->task, dumpdone, dctx, &dctx->mdctx);
if (result == DNS_R_CONTINUE) {
named_g_mainloop, dumpdone, dctx, &dctx->mdctx);
if (result == ISC_R_SUCCESS) {
return;
}
if (result == ISC_R_NOTIMPLEMENTED) {
@@ -11634,9 +11651,9 @@ resume:
dns_db_currentversion(dctx->db, &dctx->version);
result = dns_master_dumptostreamasync(
dctx->mctx, dctx->db, dctx->version, style,
dctx->fp, dctx->task, dumpdone, dctx,
&dctx->mdctx);
if (result == DNS_R_CONTINUE) {
dctx->fp, dns_zone_getloop(dctx->zone->zone),
dumpdone, dctx, &dctx->mdctx);
if (result == ISC_R_SUCCESS) {
return;
}
if (result == ISC_R_NOTIMPLEMENTED) {
@@ -11693,25 +11710,14 @@ named_server_dumpdb(named_server_t *server, isc_lex_t *lex,
}
dctx = isc_mem_get(server->mctx, sizeof(*dctx));
dctx->mctx = server->mctx;
dctx->dumpcache = true;
dctx->dumpadb = true;
dctx->dumpbad = true;
dctx->dumpexpired = false;
dctx->dumpfail = true;
dctx->dumpzones = false;
dctx->fp = NULL;
ISC_LIST_INIT(dctx->viewlist);
dctx->view = NULL;
dctx->zone = NULL;
dctx->cache = NULL;
dctx->mdctx = NULL;
dctx->db = NULL;
dctx->cache = NULL;
dctx->task = NULL;
dctx->version = NULL;
isc_task_attach(server->task, &dctx->task);
*dctx = (struct dumpcontext){
.mctx = server->mctx,
.dumpcache = true,
.dumpadb = true,
.dumpbad = true,
.dumpfail = true,
.viewlist = ISC_LIST_INITIALIZER,
};
CHECKMF(isc_stdio_open(server->dumpfile, "w", &dctx->fp),
"could not open dump file", server->dumpfile);
@@ -12417,8 +12423,8 @@ named_server_status(named_server_t *server, isc_buffer_t **text) {
CHECK(putstr(text, line));
snprintf(line, sizeof(line), "TCP high-water: %u\n",
(unsigned)ns_stats_get_counter(server->sctx->nsstats,
ns_statscounter_tcphighwater));
(unsigned int)ns_stats_get_counter(
server->sctx->nsstats, ns_statscounter_tcphighwater));
CHECK(putstr(text, line));
reload_status = atomic_load(&server->reload_status);
@@ -12805,7 +12811,8 @@ named_server_sync(named_server_t *server, isc_lex_t *lex, isc_buffer_t **text) {
arg = next_token(lex, text);
if (arg != NULL &&
(strcmp(arg, "-clean") == 0 || strcmp(arg, "-clear") == 0)) {
(strcmp(arg, "-clean") == 0 || strcmp(arg, "-clear") == 0))
{
cleanup = true;
arg = next_token(lex, text);
}
@@ -12823,7 +12830,8 @@ named_server_sync(named_server_t *server, isc_lex_t *lex, isc_buffer_t **text) {
for (view = ISC_LIST_HEAD(server->viewlist); view != NULL;
view = ISC_LIST_NEXT(view, link))
{
result = dns_zt_apply(view->zonetable, false, NULL,
result = dns_zt_apply(view->zonetable,
isc_rwlocktype_none, false, NULL,
synczone, &cleanup);
if (result != ISC_R_SUCCESS && tresult == ISC_R_SUCCESS)
{
@@ -12845,7 +12853,8 @@ named_server_sync(named_server_t *server, isc_lex_t *lex, isc_buffer_t **text) {
view = dns_zone_getview(zone);
if (strcmp(view->name, "_default") == 0 ||
strcmp(view->name, "_bind") == 0) {
strcmp(view->name, "_bind") == 0)
{
vname = "";
sep = "";
} else {
@@ -12971,7 +12980,8 @@ named_server_freeze(named_server_t *server, bool freeze, isc_lex_t *lex,
view = dns_zone_getview(mayberaw);
if (strcmp(view->name, "_default") == 0 ||
strcmp(view->name, "_bind") == 0) {
strcmp(view->name, "_bind") == 0)
{
vname = "";
sep = "";
} else {
@@ -13109,7 +13119,8 @@ nzf_writeconf(const cfg_obj_t *config, dns_view_t *view) {
CHECK(add_comment(fp, view->name)); /* force a comment */
for (elt = ISC_LIST_HEAD(*list); elt != NULL;
elt = ISC_LIST_NEXT(elt, link)) {
elt = ISC_LIST_NEXT(elt, link))
{
const cfg_obj_t *zconfig = cfg_listelt_value(elt);
CHECK(isc_stdio_write("zone ", 5, 1, fp, NULL));
@@ -13797,7 +13808,8 @@ delete_zoneconf(dns_view_t *view, cfg_parser_t *pctx, const cfg_obj_t *config,
myname = dns_fixedname_initname(&myfixed);
for (elt = ISC_LIST_HEAD(*list); elt != NULL;
elt = ISC_LIST_NEXT(elt, link)) {
elt = ISC_LIST_NEXT(elt, link))
{
const cfg_obj_t *zconf = cfg_listelt_value(elt);
const char *zn;
cfg_listelt_t *e;
@@ -14683,7 +14695,8 @@ find_name_in_list_from_map(const cfg_obj_t *config,
if (name1 != NULL) {
result = dns_name_fromstring(name2, vname, 0, NULL);
if (result == ISC_R_SUCCESS &&
dns_name_equal(name1, name2)) {
dns_name_equal(name1, name2))
{
const cfg_obj_t *zoptions;
const cfg_obj_t *typeobj = NULL;
zoptions = cfg_tuple_get(obj, "options");
@@ -14897,7 +14910,8 @@ named_server_signing(named_server_t *server, isc_lex_t *lex,
if (strcasecmp(ptr, "-list") == 0) {
list = true;
} else if ((strcasecmp(ptr, "-clear") == 0) ||
(strcasecmp(ptr, "-clean") == 0)) {
(strcasecmp(ptr, "-clean") == 0))
{
clear = true;
ptr = next_token(lex, text);
if (ptr == NULL) {
@@ -14941,7 +14955,8 @@ named_server_signing(named_server_t *server, isc_lex_t *lex,
}
if (hash > 0xffU || flags > 0xffU ||
iter > dns_nsec3_maxiterations()) {
iter > dns_nsec3_maxiterations())
{
return (ISC_R_RANGE);
}
@@ -15532,7 +15547,8 @@ named_server_zonestatus(named_server_t *server, isc_lex_t *lex,
/* Key refresh time */
if (zonetype == dns_zone_primary ||
(zonetype == dns_zone_secondary && hasraw)) {
(zonetype == dns_zone_secondary && hasraw))
{
dns_zone_getrefreshkeytime(zone, &refreshkeytime);
isc_time_formathttptimestamp(&refreshkeytime, kbuf,
sizeof(kbuf));
@@ -16749,7 +16765,7 @@ named_server_fetchlimit(named_server_t *server, isc_lex_t *lex,
dns_adb_getquota(view->adb, &val, NULL, NULL, NULL, NULL);
s = snprintf(tbuf, sizeof(tbuf),
" (fetches-per-server %u):", val);
if (s < 0 || (unsigned)s > sizeof(tbuf)) {
if (s < 0 || (unsigned int)s > sizeof(tbuf)) {
return (ISC_R_NOSPACE);
}
first = false;
@@ -16765,7 +16781,7 @@ named_server_fetchlimit(named_server_t *server, isc_lex_t *lex,
val = dns_resolver_getfetchesperzone(view->resolver);
s = snprintf(tbuf, sizeof(tbuf),
" (fetches-per-zone %u):", val);
if (s < 0 || (unsigned)s > sizeof(tbuf)) {
if (s < 0 || (unsigned int)s > sizeof(tbuf)) {
return (ISC_R_NOSPACE);
}
CHECK(putstr(text, tbuf));
+153 -174
View File
@@ -1464,7 +1464,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 +1537,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 +1715,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 +1727,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:
@@ -2239,7 +2245,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 +2257,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 */
}
@@ -2372,20 +2379,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 +2407,91 @@ 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,
render_xml_tasks(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_TASKS, url, urlinfo, querystring, headers,
arg, retcode, retmsg, mimetype, b, freecb,
freecb_args));
UNUSED(httpd);
UNUSED(urlinfo);
return (render_xml(STATS_XML_TASKS, 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 */
@@ -2731,7 +2732,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 +2989,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) {
@@ -3316,10 +3319,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 +3329,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 +3349,139 @@ 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,
render_json_tasks(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_TASKS, url, urlinfo, querystring,
headers, arg, retcode, retmsg, mimetype, b, freecb,
freecb_args));
UNUSED(httpd);
UNUSED(urlinfo);
return (render_json(STATS_JSON_TASKS, 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 +3491,6 @@ send:
isc_buffer_reinit(b, p, strlen(xslmsg));
isc_buffer_add(b, strlen(xslmsg));
end:
free(_headers);
return (ISC_R_SUCCESS);
}
@@ -3752,7 +3731,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 +3888,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'",
+16 -15
View File
@@ -251,7 +251,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 +314,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 +456,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);
}
@@ -1012,7 +1015,8 @@ 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);
@@ -1358,8 +1362,7 @@ 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 "
@@ -1472,6 +1475,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,8 +1507,7 @@ 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 "
@@ -1807,13 +1815,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) {
+231 -42
View File
@@ -46,6 +46,7 @@
#include <isc/stdio.h>
#include <isc/string.h>
#include <isc/task.h>
#include <isc/tls.h>
#include <isc/types.h>
#include <isc/util.h>
@@ -68,6 +69,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>
@@ -120,6 +122,7 @@ 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;
@@ -147,6 +150,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 +186,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;
@@ -793,6 +805,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 +825,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 +889,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 +912,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) {
@@ -936,6 +965,31 @@ setup_system(void) {
&dispatchv4);
check_result(result, "dns_dispatch_createudp (v4)");
}
transport_list = dns_transport_list_new(gmctx);
tls_ctx_cache = isc_tlsctx_cache_new(gmctx);
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, taskmgr, dispatchmgr, dispatchv4,
dispatchv6, &requestmgr);
@@ -972,7 +1026,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 +1069,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 +1143,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 +1158,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 +1211,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 +1227,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 +1296,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 +1381,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 +1597,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 +2004,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 +2025,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 +2120,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 +2302,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;
@@ -2448,8 +2592,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 +2603,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 +2628,14 @@ 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, -1, options, tsigkey, timeout, udp_timeout,
udp_retries, global_task, update_completed, NULL, &request);
check_result(result, "dns_request_create");
if (debugging) {
show_message(stdout, updatemsg, "Outgoing update query:");
@@ -2574,6 +2725,10 @@ recvsoa(isc_task_t *task, isc_event_t *event) {
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 +2738,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, -1, options, NULL, FIND_TIMEOUT * 20,
FIND_TIMEOUT, 3, global_task, recvsoa, reqinfo,
&request);
check_result(result, "dns_request_create");
requests++;
return;
}
@@ -2620,7 +2784,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");
}
@@ -2734,9 +2899,7 @@ 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) {
@@ -2797,6 +2960,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 +2982,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, -1,
options, default_servers ? NULL : tsigkey,
FIND_TIMEOUT * 20, FIND_TIMEOUT, 3,
global_task, recvsoa, reqinfo, request);
check_result(result, "dns_request_create");
requests++;
}
@@ -2953,7 +3128,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);
@@ -2991,8 +3166,15 @@ 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;
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);
@@ -3002,19 +3184,17 @@ send_gssrequest(isc_sockaddr_t *destaddr, dns_message_t *msg,
reqinfo->addr = destaddr;
reqinfo->context = context;
options |= DNS_REQUESTOPT_TCP;
if (isc_sockaddr_pf(destaddr) == AF_INET6) {
srcaddr = localaddr6;
} else {
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, -1, options, tsigkey, FIND_TIMEOUT * 20,
FIND_TIMEOUT, 3, global_task, recvgss, reqinfo, request);
check_result(result, "dns_request_create");
if (debugging) {
show_message(stdout, msg, "Outgoing update query:");
}
@@ -3111,7 +3291,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 +3452,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);
+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;
}
}
+8 -4
View File
@@ -688,7 +688,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 +726,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 +937,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;
}
+2
View File
@@ -1,5 +1,7 @@
include $(top_srcdir)/Makefile.top
EXTRA_DIST = convert-trs-to-junit.py
SUBDIRS = system
noinst_PROGRAMS = \
+4 -15
View File
@@ -23,7 +23,6 @@ check_PROGRAMS = \
feature-test \
makejournal \
pipelined/pipequeries \
resolve \
rndc/gencheck \
rpz/dnsrps \
tkey/keycreate \
@@ -49,14 +48,6 @@ pipelined_pipequeries_LDADD = \
$(LDADD) \
$(LIBDNS_LIBS)
resolve_CPPFLAGS = \
$(AM_CPPFLAGS) \
$(LIBISC_CFLAGS) \
$(LIBDNS_CFLAGS) \
$(LIBIRS_CFLAGS)
resolve_LDADD = $(LIBISC_LIBS) $(LIBIRS_LIBS) $(LIBDNS_LIBS)
tkey_keycreate_CPPFLAGS = \
$(AM_CPPFLAGS) \
$(LIBDNS_CFLAGS)
@@ -105,10 +96,12 @@ TESTS += \
checknames \
checkzone \
database \
dialup \
dlzexternal \
dns64 \
dscp \
dsdigest \
dupsigs \
dyndb \
ecdsa \
eddsa \
@@ -124,6 +117,7 @@ TESTS += \
inline \
integrity \
hooks \
host \
journal \
keepalive \
keyfromlabel \
@@ -170,12 +164,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 +176,7 @@ TESTS += \
nsupdate \
resolver \
statistics \
stress \
upforwd \
zero
+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
+11 -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,24 @@
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 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@;
};
+55
View File
@@ -0,0 +1,55 @@
/*
* Copyright (C) Internet Systems Consortium, Inc. ("ISC")
*
* SPDX-License-Identifier: MPL-2.0
*
* 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
* file, you can obtain one at https://mozilla.org/MPL/2.0/.
*
* See the COPYRIGHT file distributed with this work for additional
* information regarding copyright ownership.
*/
include "../../common/rndc.key";
controls {
inet 10.53.0.4 port @CONTROLPORT@ allow { any; } keys { rndc_key; };
};
options {
query-source address 10.53.0.4;
notify-source 10.53.0.4;
transfer-source 10.53.0.4;
port @PORT@;
tls-port @TLSPORT@;
pid-file "named.pid";
listen-on { 10.53.0.4; };
listen-on-v6 { fd92:7065:b8e:ffff::4; };
notify no;
notify-delay 0;
recursion no;
serial-query-rate 100;
catalog-zones {
zone "catalog-tls.example"
min-update-interval 1s
default-primaries { 10.53.0.1 key tsig_key tls ephemeral; };
};
};
zone "catalog-tls.example" {
type secondary;
file "catalog-tls.example.db";
primaries { 10.53.0.1 key tsig_key tls ephemeral; };
};
key tsig_key. {
secret "LSAnCU+Z";
algorithm @DEFAULT_HMAC@;
};
key next_key. {
secret "LaAnCU+Z";
algorithm @DEFAULT_HMAC@;
};
+2
View File
@@ -18,10 +18,12 @@ $SHELL clean.sh
copy_setports ns1/named.conf.in ns1/named.conf
copy_setports ns2/named1.conf.in ns2/named.conf
copy_setports ns3/named.conf.in ns3/named.conf
copy_setports ns4/named.conf.in ns4/named.conf
cp -f ns1/catalog.example.db.in ns1/catalog1.example.db
cp -f ns3/catalog.example.db.in ns3/catalog2.example.db
cp -f ns1/catalog.example.db.in ns1/catalog3.example.db
cp -f ns1/catalog.example.db.in ns1/catalog4.example.db
cp -f ns1/catalog.example.db.in ns1/catalog-tls.example.db
mkdir -p ns2/zonedir
+140 -1
View File
@@ -1229,6 +1229,56 @@ wait_for_soa @10.53.0.2 dom9.example. dig.out.test$n || ret=1
if [ $ret -ne 0 ]; then echo_i "failed"; fi
status=$((status+ret))
n=$((n+1))
echo_i "change TSIG key name on primary ($n)"
ret=0
rndccmd 10.53.0.1 modzone dom9.example. in default '{type primary; notify yes; file "dom9.example.db"; allow-transfer { key next_key; }; };' || ret=1
if [ $ret -ne 0 ]; then echo_i "failed"; fi
status=$((status+ret))
n=$((n+1))
echo_i "update TSIG key name in catalog zone ($n)"
ret=0
$NSUPDATE -d <<END >> nsupdate.out.test$n 2>&1 || ret=1
server 10.53.0.1 ${PORT}
update del label1.primaries.ext.f0f989bc71c5c8ca3a1eb9c9ab5246521907e3af.zones.catalog1.example. 3600 IN TXT "tsig_key"
update add label1.primaries.ext.f0f989bc71c5c8ca3a1eb9c9ab5246521907e3af.zones.catalog1.example. 3600 IN TXT "next_key"
send
END
if [ $ret -ne 0 ]; then echo_i "failed"; fi
status=$((status+ret))
n=$((n+1))
echo_i "waiting for secondary to sync up ($n)"
ret=0
wait_for_message ns2/named.run "catz: modifying zone 'dom9.example' from catalog 'catalog1.example'" || ret=1
if [ $ret -ne 0 ]; then echo_i "failed"; fi
status=$((status+ret))
n=$((n+1))
echo_i "update zone contents and reload ($n)"
ret=0
echo "@ 3600 IN SOA . . 2 3600 3600 3600 3600" > ns1/dom9.example.db
echo "@ IN NS ns2" >> ns1/dom9.example.db
echo "ns2 IN A 10.53.0.2" >> ns1/dom9.example.db
rndccmd 10.53.0.1 reload dom9.example. || ret=1
if [ $ret -ne 0 ]; then echo_i "failed"; fi
status=$((status+ret))
n=$((n+1))
echo_i "wait for primary to update zone ($n)"
ret=0
wait_for_a @10.53.0.1 ns2.dom9.example. dig.out.test$n || ret=1
if [ $ret -ne 0 ]; then echo_i "failed"; fi
status=$((status+ret))
n=$((n+1))
echo_i "wait for secondary to update zone ($n)"
ret=0
wait_for_a @10.53.0.2 ns2.dom9.example. dig.out.test$n || ret=1
if [ $ret -ne 0 ]; then echo_i "failed"; fi
status=$((status+ret))
n=$((n+1))
echo_i "deleting domain dom9.example. from catalog1 zone ($n)"
ret=0
@@ -1236,7 +1286,7 @@ $NSUPDATE -d <<END >> nsupdate.out.test$n 2>&1 || ret=1
server 10.53.0.1 ${PORT}
update delete f0f989bc71c5c8ca3a1eb9c9ab5246521907e3af.zones.catalog1.example. 3600 IN PTR dom9.example.
update delete label1.primaries.ext.f0f989bc71c5c8ca3a1eb9c9ab5246521907e3af.zones.catalog1.example. 3600 IN A 10.53.0.1
update delete label1.primaries.ext.f0f989bc71c5c8ca3a1eb9c9ab5246521907e3af.zones.catalog1.example. 3600 IN TXT "tsig_key"
update delete label1.primaries.ext.f0f989bc71c5c8ca3a1eb9c9ab5246521907e3af.zones.catalog1.example. 3600 IN TXT "next_key"
send
END
if [ $ret -ne 0 ]; then echo_i "failed"; fi
@@ -2465,5 +2515,94 @@ rndccmd 10.53.0.2 reconfig || ret=1
if [ $ret -ne 0 ]; then echo_i "failed"; fi
status=$((status+ret))
#########################################################################
nextpart ns2/named.run >/dev/null
n=$((n+1))
echo_i "Adding a dom19.example. to primary via RNDC ($n)"
ret=0
# enough initial content for IXFR response when TXT record is added below
echo "@ 3600 IN SOA . . 1 3600 3600 3600 3600" > ns1/dom19.example.db
echo "@ 3600 IN NS invalid." >> ns1/dom19.example.db
echo "foo 3600 IN TXT some content here" >> ns1/dom19.example.db
echo "bar 3600 IN TXT some content here" >> ns1/dom19.example.db
echo "xxx 3600 IN TXT some content here" >> ns1/dom19.example.db
echo "yyy 3600 IN TXT some content here" >> ns1/dom19.example.db
rndccmd 10.53.0.1 addzone dom19.example. in default '{ type primary; file "dom19.example.db"; allow-transfer { key tsig_key; }; allow-update { any; }; notify explicit; also-notify { 10.53.0.2; }; };' || ret=1
if [ $ret -ne 0 ]; then echo_i "failed"; fi
status=$((status+ret))
n=$((n+1))
echo_i "add an entry to the restored catalog zone ($n)"
ret=0
$NSUPDATE -d <<END >> nsupdate.out.test$n 2>&1 || ret=1
server 10.53.0.1 ${PORT}
update add 09da0a318e5333a9a7f6c14c385d69f6933e8b72.zones.catalog1.example. 3600 IN PTR dom19.example.
update add label1.primaries.ext.09da0a318e5333a9a7f6c14c385d69f6933e8b72.zones.catalog1.example. 3600 IN A 10.53.0.1
update add label1.primaries.ext.09da0a318e5333a9a7f6c14c385d69f6933e8b72.zones.catalog1.example. 3600 IN TXT "tsig_key"
send
END
if [ $ret -ne 0 ]; then echo_i "failed"; fi
status=$((status+ret))
n=$((n+1))
echo_i "waiting for secondary to sync up ($n)"
ret=0
wait_for_message ns2/named.run "catz: adding zone 'dom19.example' from catalog 'catalog1.example'" &&
wait_for_message ns2/named.run "transfer of 'dom19.example/IN/default' from 10.53.0.1#${PORT}: Transfer status: success" || ret=1
if [ $ret -ne 0 ]; then echo_i "failed"; fi
status=$((status+ret))
##########################################################################
n=$((n+1))
echo_i "Adding a domain tls1.example. to primary via RNDC ($n)"
ret=0
# enough initial content for IXFR response when TXT record is added below
echo "@ 3600 IN SOA . . 1 3600 3600 3600 3600" > ns1/tls1.example.db
echo "@ 3600 IN NS invalid." >> ns1/tls1.example.db
echo "foo 3600 IN TXT some content here" >> ns1/tls1.example.db
echo "bar 3600 IN TXT some content here" >> ns1/tls1.example.db
echo "xxx 3600 IN TXT some content here" >> ns1/tls1.example.db
echo "yyy 3600 IN TXT some content here" >> ns1/tls1.example.db
rndccmd 10.53.0.1 addzone tls1.example. in default '{ type primary; file "tls1.example.db"; allow-transfer transport tls { key tsig_key; }; allow-update { any; }; notify explicit; also-notify { 10.53.0.4; }; };' || ret=1
if [ $ret -ne 0 ]; then echo_i "failed"; fi
status=$((status+ret))
n=$((n+1))
echo_i "checking that tls1.example. is now served by primary ($n)"
ret=0
wait_for_soa @10.53.0.1 tls1.example. dig.out.test$n || ret=1
if [ $ret -ne 0 ]; then echo_i "failed"; fi
status=$((status+ret))
nextpart ns4/named.run >/dev/null
n=$((n+1))
echo_i "Adding domain tls1.example. to catalog-tls zone ($n)"
ret=0
$NSUPDATE -d <<END >> nsupdate.out.test$n 2>&1 || ret=1
server 10.53.0.1 ${PORT}
update add 1ba056ba375209a66a2c9a0617b1df714b998112.zones.catalog-tls.example. 3600 IN PTR tls1.example.
send
END
if [ $ret -ne 0 ]; then echo_i "failed"; fi
status=$((status+ret))
n=$((n+1))
echo_i "waiting for secondary to sync up ($n)"
ret=0
wait_for_message ns4/named.run "catz: adding zone 'tls1.example' from catalog 'catalog-tls.example'" &&
wait_for_message ns4/named.run "transfer of 'tls1.example/IN' from 10.53.0.1#${TLSPORT}: Transfer status: success" || ret=1
if [ $ret -ne 0 ]; then echo_i "failed"; fi
status=$((status+ret))
n=$((n+1))
echo_i "checking that tls1.example. is served by secondary ($n)"
ret=0
wait_for_soa @10.53.0.4 tls1.example. dig.out.test$n || ret=1
if [ $ret -ne 0 ]; then echo_i "failed"; fi
status=$((status+ret))
echo_i "exit status: $status"
[ $status -eq 0 ] || exit 1
+1 -1
View File
@@ -37,7 +37,7 @@ id2=$id2
EOF
tac() {
$PERL -e 'print reverse <>' "$@"
$PERL -e 'print reverse <>'
}
convert() {
+1 -1
View File
@@ -42,7 +42,7 @@ testcase() {
check_stderr() {
if [ -n "${err:=}" ]; then
egrep "$err" err.$n >/dev/null && return 0
grep -E "$err" err.$n >/dev/null && return 0
echo_d "stderr did not match '$err'"
else
[ -s err.$n ] || return 0
+2
View File
@@ -1,3 +1,5 @@
#!/bin/sh
# Copyright (C) Internet Systems Consortium, Inc. ("ISC")
#
# SPDX-License-Identifier: MPL-2.0
@@ -11,12 +11,6 @@
* information regarding copyright ownership.
*/
key rndc_key {
secret "1234abcd8765";
algorithm hmac-sha256;
options {
random-device "/dev/urandom";
};
controls {
inet 10.53.0.2 port 9953 allow { any; } keys { rndc_key; };
};
@@ -0,0 +1,18 @@
/*
* Copyright (C) Internet Systems Consortium, Inc. ("ISC")
*
* SPDX-License-Identifier: MPL-2.0
*
* 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
* file, you can obtain one at https://mozilla.org/MPL/2.0/.
*
* See the COPYRIGHT file distributed with this work for additional
* information regarding copyright ownership.
*/
zone "check-wildcard" {
type primary;
file "check-wildcard.db";
check-wildcard no;
};
@@ -0,0 +1,18 @@
/*
* Copyright (C) Internet Systems Consortium, Inc. ("ISC")
*
* SPDX-License-Identifier: MPL-2.0
*
* 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
* file, you can obtain one at https://mozilla.org/MPL/2.0/.
*
* See the COPYRIGHT file distributed with this work for additional
* information regarding copyright ownership.
*/
zone "check-wildcard" {
type primary;
file "check-wildcard.db";
check-wildcard yes;
};
@@ -9,9 +9,8 @@
; See the COPYRIGHT file distributed with this work for additional
; information regarding copyright ownership.
;$ORIGIN added.example.
$TTL 300 ; 5 minutes
@ IN SOA mname1. . (
$TTL 600 ; 10 minutes
@ IN SOA mname1. . (
1 ; serial
20 ; refresh (20 seconds)
20 ; retry (20 seconds)
@@ -20,7 +19,5 @@ $TTL 300 ; 5 minutes
)
NS ns2
ns2 A 10.53.0.2
MX 10 mail
a A 10.0.0.1
mail A 10.0.0.2
; an interior wildcard name
foo.* TXT The owner name contains an interior wildcard
@@ -1,6 +1,6 @@
/*
* Copyright (C) Internet Systems Consortium, Inc. ("ISC")
*
*
* SPDX-License-Identifier: MPL-2.0
*
* This Source Code Form is subject to the terms of the Mozilla Public
@@ -11,10 +11,8 @@
* information regarding copyright ownership.
*/
#pragma once
void
isc__tls_initialize(void);
void
isc__tls_shutdown(void);
zone "test" {
type primary;
file "test.db";
auto-dnssec maintain;
};
@@ -30,6 +30,7 @@ server 0.0.0.0 {
request-expire no;
request-ixfr no;
request-nsid no;
require-cookie no;
send-cookie no;
tcp-keepalive no;
tcp-only no;
@@ -52,6 +53,7 @@ server :: {
request-expire no;
request-ixfr no;
request-nsid no;
require-cookie no;
send-cookie no;
tcp-keepalive no;
tcp-only no;
-3
View File
@@ -45,12 +45,9 @@ options {
blackhole {
10.0.0.0/8;
};
coresize 1073741824;
datasize 104857600;
directory ".";
dscp 41;
dump-file "named_dumpdb";
files 1000;
heartbeat-interval 30;
hostname none;
interface-interval 30;
@@ -20,7 +20,6 @@ zone "nsec3.net" {
auto-dnssec maintain;
dnskey-sig-validity 3600;
dnssec-dnskey-kskonly yes;
dnssec-secure-to-insecure yes;
dnssec-update-mode maintain;
inline-signing no;
sig-validity-interval 3600;
+91 -69
View File
@@ -1,3 +1,5 @@
#!/bin/sh
# Copyright (C) Internet Systems Consortium, Inc. ("ISC")
#
# SPDX-License-Identifier: MPL-2.0
@@ -20,7 +22,7 @@ n=`expr $n + 1`
echo_i "checking that named-checkconf handles a known good config ($n)"
ret=0
$CHECKCONF good.conf > checkconf.out$n 2>&1 || ret=1
if [ $ret != 0 ]; then echo_i "failed"; fi
if [ $ret -ne 0 ]; then echo_i "failed"; fi
status=`expr $status + $ret`
n=`expr $n + 1`
@@ -31,7 +33,7 @@ awk 'BEGIN { ok = 0; } /cut here/ { ok = 1; getline } ok == 1 { print }' good.co
$CHECKCONF -p good.conf.raw > checkconf.out$n || ret=1
grep -v '^good.conf.raw:' < checkconf.out$n > good.conf.out 2>&1 || ret=1
cmp good.conf.raw good.conf.out || ret=1
if [ $ret != 0 ]; then echo_i "failed"; fi
if [ $ret -ne 0 ]; then echo_i "failed"; fi
status=`expr $status + $ret`
n=`expr $n + 1`
@@ -43,7 +45,7 @@ grep 'secret "????????????????"' good.conf.raw > /dev/null 2>&1 && ret=1
$CHECKCONF -p -x good.conf.raw > checkconf.out$n || ret=1
grep -v '^good.conf.raw:' < checkconf.out$n > good.conf.out 2>&1 || ret=1
grep 'secret "????????????????"' good.conf.out > /dev/null 2>&1 || ret=1
if [ $ret != 0 ]; then echo_i "failed"; fi
if [ $ret -ne 0 ]; then echo_i "failed"; fi
status=`expr $status + $ret`
for bad in bad-*.conf
@@ -52,7 +54,7 @@ do
echo_i "checking that named-checkconf detects error in $bad ($n)"
ret=0
$CHECKCONF $bad > checkconf.out$n 2>&1
if [ $? != 1 ]; then ret=1; fi
if [ $? -ne 1 ]; then ret=1; fi
grep "^$bad:[0-9]*: " < checkconf.out$n > /dev/null || ret=1
case $bad in
bad-update-policy[123].conf)
@@ -68,7 +70,7 @@ do
grep "$pat" < checkconf.out$n > /dev/null || ret=1
;;
esac
if [ $ret != 0 ]; then echo_i "failed"; fi
if [ $ret -ne 0 ]; then echo_i "failed"; fi
status=`expr $status + $ret`
done
@@ -85,7 +87,7 @@ do
esac
fi
$CHECKCONF $good > checkconf.out$n 2>&1
if [ $? != 0 ]; then echo_i "failed"; ret=1; fi
if [ $? -ne 0 ]; then echo_i "failed"; ret=1; fi
status=`expr $status + $ret`
done
@@ -98,11 +100,11 @@ do
if [ $? -eq 0 ]; then
echo_i "checking that named-checkconf detects no error in $lmdb ($n)"
$CHECKCONF $lmdb > checkconf.out$n 2>&1
if [ $? != 0 ]; then echo_i "failed"; ret=1; fi
if [ $? -ne 0 ]; then echo_i "failed"; ret=1; fi
else
echo_i "checking that named-checkconf detects error in $lmdb ($n)"
$CHECKCONF $lmdb > checkconf.out$n 2>&1
if [ $? == 0 ]; then echo_i "failed"; ret=1; fi
if [ $? -eq 0 ]; then echo_i "failed"; ret=1; fi
fi
status=`expr $status + $ret`
done
@@ -112,7 +114,7 @@ echo_i "checking that ancient options report a fatal error ($n)"
ret=0
$CHECKCONF ancient.conf > ancient.out 2>&1 && ret=1
grep "no longer exists" ancient.out > /dev/null || ret=1
if [ $ret != 0 ]; then echo_i "failed"; fi
if [ $ret -ne 0 ]; then echo_i "failed"; fi
status=`expr $status + $ret`
n=`expr $n + 1`
@@ -120,14 +122,14 @@ echo_i "checking that named-checkconf -z catches missing hint file ($n)"
ret=0
$CHECKCONF -z hint-nofile.conf > hint-nofile.out 2>&1 && ret=1
grep "could not configure root hints from 'nonexistent.db': file not found" hint-nofile.out > /dev/null || ret=1
if [ $ret != 0 ]; then echo_i "failed"; fi
if [ $ret -ne 0 ]; then echo_i "failed"; fi
status=`expr $status + $ret`
n=`expr $n + 1`
echo_i "checking that named-checkconf catches range errors ($n)"
ret=0
$CHECKCONF range.conf > checkconf.out$n 2>&1 && ret=1
if [ $ret != 0 ]; then echo_i "failed"; fi
if [ $ret -ne 0 ]; then echo_i "failed"; fi
status=`expr $status + $ret`
n=`expr $n + 1`
@@ -136,18 +138,23 @@ ret=0
$CHECKCONF notify.conf > checkconf.out$n 2>&1
warnings=`grep "'notify' is disabled" < checkconf.out$n | wc -l`
[ $warnings -eq 3 ] || ret=1
if [ $ret != 0 ]; then echo_i "failed"; fi
if [ $ret -ne 0 ]; then echo_i "failed"; fi
status=`expr $status + $ret`
n=`expr $n + 1`
echo_i "checking named-checkconf dnssec warnings ($n)"
ret=0
# dnssec.1: auto-dnssec warning
$CHECKCONF dnssec.1 > checkconf.out$n.2 2>&1
grep 'auto-dnssec may only be ' < checkconf.out$n.2 > /dev/null || ret=1
# dnssec.2: should have no warnings
$CHECKCONF dnssec.2 > checkconf.out$n.3 2>&1
grep '.*' < checkconf.out$n.3 > /dev/null && ret=1
$CHECKCONF dnssec.1 > checkconf.out$n.1 2>&1
grep 'auto-dnssec may only be ' < checkconf.out$n.1 > /dev/null || ret=1
# dnssec.2: should have no warnings (other than deprecation warning)
$CHECKCONF dnssec.2 > checkconf.out$n.2 2>&1
grep "option 'auto-dnssec' is deprecated" < checkconf.out$n.2 > /dev/null || ret=1
lines=$(wc -l < "checkconf.out$n.2")
if [ $lines != 1 ]; then ret=1; fi
# dnssec.3: should have specific deprecation warning
$CHECKCONF dnssec.3 > checkconf.out$n.3 2>&1
grep "'auto-dnssec' option is deprecated and will be removed in BIND 9\.19" < checkconf.out$n.3 > /dev/null || ret=1
if [ $ret != 0 ]; then echo_i "failed"; fi
status=`expr $status + $ret`
@@ -158,12 +165,12 @@ $CHECKCONF deprecated.conf > checkconf.out$n.1 2>&1
grep "option 'managed-keys' is deprecated" < checkconf.out$n.1 > /dev/null || ret=1
grep "option 'trusted-keys' is deprecated" < checkconf.out$n.1 > /dev/null || ret=1
grep "option 'max-zone-ttl' is deprecated" < checkconf.out$n.1 > /dev/null || ret=1
if [ $ret != 0 ]; then echo_i "failed"; fi
if [ $ret -ne 0 ]; then echo_i "failed"; fi
status=`expr $status + $ret`
# set -i to ignore deprecate warnings
$CHECKCONF -i deprecated.conf > checkconf.out$n.2 2>&1
grep '.*' < checkconf.out$n.2 > /dev/null && ret=1
if [ $ret != 0 ]; then echo_i "failed"; fi
if [ $ret -ne 0 ]; then echo_i "failed"; fi
status=`expr $status + $ret`
n=`expr $n + 1`
@@ -171,12 +178,12 @@ echo_i "checking named-checkconf servestale warnings ($n)"
ret=0
$CHECKCONF servestale.stale-refresh-time.0.conf > checkconf.out$n.1 2>&1
grep "'stale-refresh-time' should either be 0 or otherwise 30 seconds or higher" < checkconf.out$n.1 > /dev/null && ret=1
if [ $ret != 0 ]; then echo_i "failed"; fi
if [ $ret -ne 0 ]; then echo_i "failed"; fi
status=`expr $status + $ret`
ret=0
$CHECKCONF servestale.stale-refresh-time.29.conf > checkconf.out$n.1 2>&1
grep "'stale-refresh-time' should either be 0 or otherwise 30 seconds or higher" < checkconf.out$n.1 > /dev/null || ret=1
if [ $ret != 0 ]; then echo_i "failed"; fi
if [ $ret -ne 0 ]; then echo_i "failed"; fi
status=`expr $status + $ret`
n=`expr $n + 1`
@@ -216,7 +223,7 @@ EOF
$CHECKCONF badzero.conf > checkconf.out$n.4 2>&1
[ $? -eq 1 ] || { echo_i "zone $field failed" ; ret=1; }
done
if [ $ret != 0 ]; then echo_i "failed"; fi
if [ $ret -ne 0 ]; then echo_i "failed"; fi
status=`expr $status + $ret`
n=`expr $n + 1`
@@ -231,7 +238,7 @@ l=`grep "dnssec-loadkeys-interval.*requires inline" < checkconf.out$n.2 | wc -l`
$CHECKCONF bad-dnssec.conf > checkconf.out$n.3 2>&1
l=`grep "update-check-ksk.*requires inline" < checkconf.out$n.3 | wc -l`
[ $l -eq 1 ] || ret=1
if [ $ret != 0 ]; then echo_i "failed"; fi
if [ $ret -ne 0 ]; then echo_i "failed"; fi
status=`expr $status + $ret`
n=`expr $n + 1`
@@ -245,7 +252,7 @@ l=`grep "missing 'file' entry" < checkconf.out$n.2 | wc -l`
$CHECKCONF inline-bad.conf > checkconf.out$n.3 2>&1
l=`grep "missing 'file' entry" < checkconf.out$n.3 | wc -l`
[ $l -eq 1 ] || ret=1
if [ $ret != 0 ]; then echo_i "failed"; fi
if [ $ret -ne 0 ]; then echo_i "failed"; fi
status=`expr $status + $ret`
n=`expr $n + 1`
@@ -253,7 +260,7 @@ echo_i "checking named-checkconf DLZ warnings ($n)"
ret=0
$CHECKCONF dlz-bad.conf > checkconf.out$n 2>&1
grep "'dlz' and 'database'" < checkconf.out$n > /dev/null || ret=1
if [ $ret != 0 ]; then echo_i "failed"; fi
if [ $ret -ne 0 ]; then echo_i "failed"; fi
status=`expr $status + $ret`
n=`expr $n + 1`
@@ -273,7 +280,7 @@ $CHECKCONF warn-keydir.conf > checkconf.out$n.3 2>&1
l=`grep "key-directory" < checkconf.out$n.3 | wc -l`
[ $l -eq 0 ] || ret=1
rm -rf test.keydir
if [ $ret != 0 ]; then echo_i "failed"; fi
if [ $ret -ne 0 ]; then echo_i "failed"; fi
n=`expr $n + 1`
echo_i "checking that named-checkconf -z catches conflicting ttl with max-ttl ($n)"
@@ -282,56 +289,56 @@ $CHECKCONF -z max-ttl.conf > check.out 2>&1
grep 'TTL 900 exceeds configured max-zone-ttl 600' check.out > /dev/null 2>&1 || ret=1
grep 'TTL 900 exceeds configured max-zone-ttl 600' check.out > /dev/null 2>&1 || ret=1
grep 'TTL 900 exceeds configured max-zone-ttl 600' check.out > /dev/null 2>&1 || ret=1
if [ $ret != 0 ]; then echo_i "failed"; ret=1; fi
if [ $ret -ne 0 ]; then echo_i "failed"; ret=1; fi
status=`expr $status + $ret`
n=`expr $n + 1`
echo_i "checking that named-checkconf -z catches invalid max-ttl ($n)"
ret=0
$CHECKCONF -z max-ttl-bad.conf > checkconf.out$n 2>&1 && ret=1
if [ $ret != 0 ]; then echo_i "failed"; ret=1; fi
if [ $ret -ne 0 ]; then echo_i "failed"; ret=1; fi
status=`expr $status + $ret`
n=`expr $n + 1`
echo_i "checking that named-checkconf -z skips zone check with alternate databases ($n)"
ret=0
$CHECKCONF -z altdb.conf > checkconf.out$n 2>&1 || ret=1
if [ $ret != 0 ]; then echo_i "failed"; ret=1; fi
if [ $ret -ne 0 ]; then echo_i "failed"; ret=1; fi
status=`expr $status + $ret`
n=`expr $n + 1`
echo_i "checking that named-checkconf -z skips zone check with DLZ ($n)"
ret=0
$CHECKCONF -z altdlz.conf > checkconf.out$n 2>&1 || ret=1
if [ $ret != 0 ]; then echo_i "failed"; ret=1; fi
if [ $ret -ne 0 ]; then echo_i "failed"; ret=1; fi
status=`expr $status + $ret`
n=`expr $n + 1`
echo_i "checking that named-checkconf -z fails on view with ANY class ($n)"
ret=0
$CHECKCONF -z view-class-any1.conf > checkconf.out$n 2>&1 && ret=1
if [ $ret != 0 ]; then echo_i "failed"; ret=1; fi
if [ $ret -ne 0 ]; then echo_i "failed"; ret=1; fi
status=`expr $status + $ret`
n=`expr $n + 1`
echo_i "checking that named-checkconf -z fails on view with CLASS255 class ($n)"
ret=0
$CHECKCONF -z view-class-any2.conf > checkconf.out$n 2>&1 && ret=1
if [ $ret != 0 ]; then echo_i "failed"; ret=1; fi
if [ $ret -ne 0 ]; then echo_i "failed"; ret=1; fi
status=`expr $status + $ret`
n=`expr $n + 1`
echo_i "checking that named-checkconf -z passes on view with IN class ($n)"
ret=0
$CHECKCONF -z view-class-in1.conf > checkconf.out$n 2>&1 || ret=1
if [ $ret != 0 ]; then echo_i "failed"; ret=1; fi
if [ $ret -ne 0 ]; then echo_i "failed"; ret=1; fi
status=`expr $status + $ret`
n=`expr $n + 1`
echo_i "checking that named-checkconf -z passes on view with CLASS1 class ($n)"
ret=0
$CHECKCONF -z view-class-in2.conf > checkconf.out$n 2>&1 || ret=1
if [ $ret != 0 ]; then echo_i "failed"; ret=1; fi
if [ $ret -ne 0 ]; then echo_i "failed"; ret=1; fi
status=`expr $status + $ret`
n=`expr $n + 1`
@@ -340,7 +347,7 @@ ret=0
$CHECKCONF -z check-names-fail.conf > checkconf.out$n 2>&1 && ret=1
grep "near '_underscore': bad name (check-names)" < checkconf.out$n > /dev/null || ret=1
grep "zone check-names/IN: loaded serial" < checkconf.out$n > /dev/null && ret=1
if [ $ret != 0 ]; then echo_i "failed"; ret=1; fi
if [ $ret -ne 0 ]; then echo_i "failed"; ret=1; fi
status=`expr $status + $ret`
n=`expr $n + 1`
@@ -349,7 +356,7 @@ ret=0
$CHECKCONF -z check-mx-fail.conf > checkconf.out$n 2>&1 && ret=1
grep "near '10.0.0.1': MX is an address" < checkconf.out$n > /dev/null || ret=1
grep "zone check-mx/IN: loaded serial" < checkconf.out$n > /dev/null && ret=1
if [ $ret != 0 ]; then echo_i "failed"; ret=1; fi
if [ $ret -ne 0 ]; then echo_i "failed"; ret=1; fi
status=`expr $status + $ret`
n=`expr $n + 1`
@@ -358,7 +365,7 @@ ret=0
$CHECKCONF -z check-dup-records-fail.conf > checkconf.out$n 2>&1 && ret=1
grep "has semantically identical records" < checkconf.out$n > /dev/null || ret=1
grep "zone check-dup-records/IN: loaded serial" < checkconf.out$n > /dev/null && ret=1
if [ $ret != 0 ]; then echo_i "failed"; ret=1; fi
if [ $ret -ne 0 ]; then echo_i "failed"; ret=1; fi
status=`expr $status + $ret`
n=`expr $n + 1`
@@ -367,7 +374,7 @@ ret=0
$CHECKCONF -z check-mx-fail.conf > checkconf.out$n 2>&1 && ret=1
grep "failed: MX is an address" < checkconf.out$n > /dev/null || ret=1
grep "zone check-mx/IN: loaded serial" < checkconf.out$n > /dev/null && ret=1
if [ $ret != 0 ]; then echo_i "failed"; ret=1; fi
if [ $ret -ne 0 ]; then echo_i "failed"; ret=1; fi
status=`expr $status + $ret`
n=`expr $n + 1`
@@ -376,7 +383,7 @@ ret=0
$CHECKCONF -z check-mx-cname-fail.conf > checkconf.out$n 2>&1 && ret=1
grep "MX.* is a CNAME (illegal)" < checkconf.out$n > /dev/null || ret=1
grep "zone check-mx-cname/IN: loaded serial" < checkconf.out$n > /dev/null && ret=1
if [ $ret != 0 ]; then echo_i "failed"; ret=1; fi
if [ $ret -ne 0 ]; then echo_i "failed"; ret=1; fi
status=`expr $status + $ret`
n=`expr $n + 1`
@@ -385,7 +392,7 @@ ret=0
$CHECKCONF -z check-srv-cname-fail.conf > checkconf.out$n 2>&1 && ret=1
grep "SRV.* is a CNAME (illegal)" < checkconf.out$n > /dev/null || ret=1
grep "zone check-mx-cname/IN: loaded serial" < checkconf.out$n > /dev/null && ret=1
if [ $ret != 0 ]; then echo_i "failed"; ret=1; fi
if [ $ret -ne 0 ]; then echo_i "failed"; ret=1; fi
status=`expr $status + $ret`
n=`expr $n + 1`
@@ -393,7 +400,7 @@ echo_i "check that named-checkconf -p properly print a port range ($n)"
ret=0
$CHECKCONF -p portrange-good.conf > checkconf.out$n 2>&1 || ret=1
grep "range 8610 8614;" < checkconf.out$n > /dev/null || ret=1
if [ $ret != 0 ]; then echo_i "failed"; ret=1; fi
if [ $ret -ne 0 ]; then echo_i "failed"; ret=1; fi
status=`expr $status + $ret`
n=`expr $n + 1`
@@ -401,14 +408,14 @@ echo_i "check that named-checkconf -z handles in-view ($n)"
ret=0
$CHECKCONF -z in-view-good.conf > checkconf.out$n 2>&1 || ret=1
grep "zone shared.example/IN: loaded serial" < checkconf.out$n > /dev/null || ret=1
if [ $ret != 0 ]; then echo_i "failed"; ret=1; fi
if [ $ret -ne 0 ]; then echo_i "failed"; ret=1; fi
status=`expr $status + $ret`
n=`expr $n + 1`
echo_i "check that named-checkconf -z returns error when a later view is okay ($n)"
ret=0
$CHECKCONF -z check-missing-zone.conf > checkconf.out$n 2>&1 && ret=1
if [ $ret != 0 ]; then echo_i "failed"; ret=1; fi
if [ $ret -ne 0 ]; then echo_i "failed"; ret=1; fi
status=`expr $status + $ret`
n=`expr $n + 1`
@@ -416,7 +423,7 @@ echo_i "check that named-checkconf prints max-cache-size <percentage> correctly
ret=0
$CHECKCONF -p max-cache-size-good.conf > checkconf.out$n 2>&1 || ret=1
grep "max-cache-size 60%;" < checkconf.out$n > /dev/null || ret=1
if [ $ret != 0 ]; then echo_i "failed"; ret=1; fi
if [ $ret -ne 0 ]; then echo_i "failed"; ret=1; fi
status=`expr $status + $ret`
n=`expr $n + 1`
@@ -428,7 +435,7 @@ grep -v "is not recommended" |
grep -v "no longer exists" |
grep -v "is obsolete" > checkconf.out$n || ret=1
diff good.zonelist checkconf.out$n > diff.out$n || ret=1
if [ $ret != 0 ]; then echo_i "failed"; ret=1; fi
if [ $ret -ne 0 ]; then echo_i "failed"; ret=1; fi
status=`expr $status + $ret`
n=`expr $n + 1`
@@ -437,7 +444,7 @@ ret=0
$CHECKCONF check-root-ksk-2010.conf > checkconf.out$n 2>/dev/null || ret=1
[ -s checkconf.out$n ] || ret=1
grep "key without the updated" < checkconf.out$n > /dev/null || ret=1
if [ $ret != 0 ]; then echo_i "failed"; ret=1; fi
if [ $ret -ne 0 ]; then echo_i "failed"; ret=1; fi
status=`expr $status + $ret`
n=`expr $n + 1`
@@ -445,7 +452,7 @@ echo_i "check that the 2010 ICANN ROOT KSK with the 2017 ICANN ROOT KSK does not
ret=0
$CHECKCONF check-root-ksk-both.conf > checkconf.out$n 2>/dev/null || ret=1
[ -s checkconf.out$n ] && ret=1
if [ $ret != 0 ]; then echo_i "failed"; ret=1; fi
if [ $ret -ne 0 ]; then echo_i "failed"; ret=1; fi
status=`expr $status + $ret`
n=`expr $n + 1`
@@ -453,7 +460,7 @@ echo_i "check that the 2017 ICANN ROOT KSK alone does not generate a warning ($n
ret=0
$CHECKCONF check-root-ksk-2017.conf > checkconf.out$n 2>/dev/null || ret=1
[ -s checkconf.out$n ] && ret=1
if [ $ret != 0 ]; then echo_i "failed"; ret=1; fi
if [ $ret -ne 0 ]; then echo_i "failed"; ret=1; fi
status=`expr $status + $ret`
n=`expr $n + 1`
@@ -461,7 +468,7 @@ echo_i "check that a static root key generates a warning ($n)"
ret=0
$CHECKCONF check-root-static-key.conf > checkconf.out$n 2>/dev/null || ret=1
grep "static entry for the root zone WILL FAIL" checkconf.out$n > /dev/null || ret=1
if [ $ret != 0 ]; then echo_i "failed"; ret=1; fi
if [ $ret -ne 0 ]; then echo_i "failed"; ret=1; fi
status=`expr $status + $ret`
n=`expr $n + 1`
@@ -469,7 +476,7 @@ echo_i "check that a static root DS trust anchor generates a warning ($n)"
ret=0
$CHECKCONF check-root-static-ds.conf > checkconf.out$n 2>/dev/null || ret=1
grep "static entry for the root zone WILL FAIL" checkconf.out$n > /dev/null || ret=1
if [ $ret != 0 ]; then echo_i "failed"; ret=1; fi
if [ $ret -ne 0 ]; then echo_i "failed"; ret=1; fi
status=`expr $status + $ret`
n=`expr $n + 1`
@@ -477,7 +484,7 @@ echo_i "check that a trusted-keys entry for root generates a warning ($n)"
ret=0
$CHECKCONF check-root-trusted-key.conf > checkconf.out$n 2>/dev/null || ret=1
grep "trusted-keys entry for the root zone WILL FAIL" checkconf.out$n > /dev/null || ret=1
if [ $ret != 0 ]; then echo_i "failed"; ret=1; fi
if [ $ret -ne 0 ]; then echo_i "failed"; ret=1; fi
status=`expr $status + $ret`
n=`expr $n + 1`
@@ -485,22 +492,21 @@ echo_i "check that using trust-anchors and managed-keys generates an error ($n)"
ret=0
$CHECKCONF check-mixed-keys.conf > checkconf.out$n 2>/dev/null && ret=1
grep "use of managed-keys is not allowed" checkconf.out$n > /dev/null || ret=1
if [ $ret != 0 ]; then echo_i "failed"; ret=1; fi
if [ $ret -ne 0 ]; then echo_i "failed"; ret=1; fi
status=`expr $status + $ret`
n=`expr $n + 1`
echo_i "checking named-checkconf kasp errors ($n)"
ret=0
$CHECKCONF kasp-and-other-dnssec-options.conf > checkconf.out$n 2>&1 && ret=1
grep "'dnssec-policy;' requires dynamic DNS or inline-signing to be configured for the zone" < checkconf.out$n > /dev/null || ret=1
grep "'inline-signing yes;' must also be configured explicitly for zones using dnssec-policy without a configured 'allow-update' or 'update-policy'" < checkconf.out$n > /dev/null || ret=1
grep "'auto-dnssec maintain;' cannot be configured if dnssec-policy is also set" < checkconf.out$n > /dev/null || ret=1
grep "dnskey-sig-validity: cannot be configured if dnssec-policy is also set" < checkconf.out$n > /dev/null || ret=1
grep "dnssec-dnskey-kskonly: cannot be configured if dnssec-policy is also set" < checkconf.out$n > /dev/null || ret=1
grep "dnssec-secure-to-insecure: cannot be configured if dnssec-policy is also set" < checkconf.out$n > /dev/null || ret=1
grep "dnssec-update-mode: cannot be configured if dnssec-policy is also set" < checkconf.out$n > /dev/null || ret=1
grep "sig-validity-interval: cannot be configured if dnssec-policy is also set" < checkconf.out$n > /dev/null || ret=1
grep "update-check-ksk: cannot be configured if dnssec-policy is also set" < checkconf.out$n > /dev/null || ret=1
if [ $ret != 0 ]; then echo_i "failed"; fi
if [ $ret -ne 0 ]; then echo_i "failed"; fi
status=`expr $status + $ret`
n=`expr $n + 1`
@@ -509,8 +515,8 @@ ret=0
$CHECKCONF kasp-bad-nsec3-iter.conf > checkconf.out$n 2>&1 && ret=1
grep "dnssec-policy: nsec3 iterations value 151 out of range" < checkconf.out$n > /dev/null || ret=1
lines=$(wc -l < "checkconf.out$n")
if [ $lines != 3 ]; then ret=1; fi
if [ $ret != 0 ]; then echo_i "failed"; fi
if [ $lines -ne 3 ]; then ret=1; fi
if [ $ret -ne 0 ]; then echo_i "failed"; fi
status=`expr $status + $ret`
n=`expr $n + 1`
@@ -518,7 +524,7 @@ echo_i "checking named-checkconf kasp nsec3 algorithm errors ($n)"
ret=0
$CHECKCONF kasp-bad-nsec3-alg.conf > checkconf.out$n 2>&1 && ret=1
grep "dnssec-policy: cannot use nsec3 with algorithm 'RSASHA1'" < checkconf.out$n > /dev/null || ret=1
if [ $ret != 0 ]; then echo_i "failed"; fi
if [ $ret -ne 0 ]; then echo_i "failed"; fi
status=`expr $status + $ret`
n=`expr $n + 1`
@@ -526,7 +532,7 @@ echo_i "checking named-checkconf kasp key errors ($n)"
ret=0
$CHECKCONF kasp-bad-keylen.conf > checkconf.out$n 2>&1 && ret=1
grep "dnssec-policy: key with algorithm rsasha1 has invalid key length 511" < checkconf.out$n > /dev/null || ret=1
if [ $ret != 0 ]; then echo_i "failed"; fi
if [ $ret -ne 0 ]; then echo_i "failed"; fi
status=`expr $status + $ret`
n=`expr $n + 1`
@@ -536,8 +542,8 @@ $CHECKCONF kasp-bad-signatures-refresh.conf > checkconf.out$n 2>&1 && ret=1
grep "dnssec-policy: policy 'bad-sigrefresh' signatures-refresh must be at most 90% of the signatures-validity" < checkconf.out$n > /dev/null || ret=1
grep "dnssec-policy: policy 'bad-sigrefresh-dnskey' signatures-refresh must be at most 90% of the signatures-validity-dnskey" < checkconf.out$n > /dev/null || ret=1
lines=$(wc -l < "checkconf.out$n")
if [ $lines != 2 ]; then ret=1; fi
if [ $ret != 0 ]; then echo_i "failed"; fi
if [ $lines -ne 2 ]; then ret=1; fi
if [ $ret -ne 0 ]; then echo_i "failed"; fi
status=`expr $status + $ret`
n=`expr $n + 1`
@@ -545,8 +551,8 @@ echo_i "checking named-checkconf kasp key lifetime errors ($n)"
ret=0
$CHECKCONF kasp-bad-lifetime.conf > checkconf.out$n 2>&1 && ret=1
lines=$(grep "dnssec-policy: key lifetime is shorter than the time it takes to do a rollover" < checkconf.out$n | wc -l) || ret=1
if [ $lines != 3 ]; then ret=1; fi
if [ $ret != 0 ]; then echo_i "failed"; fi
if [ $lines -ne 3 ]; then ret=1; fi
if [ $ret -ne 0 ]; then echo_i "failed"; fi
status=`expr $status + $ret`
n=`expr $n + 1`
@@ -554,7 +560,7 @@ echo_i "checking named-checkconf kasp predefined key length ($n)"
ret=0
$CHECKCONF kasp-ignore-keylen.conf > checkconf.out$n 2>&1 || ret=1
grep "dnssec-policy: key algorithm ecdsa256 has predefined length; ignoring length value 2048" < checkconf.out$n > /dev/null || ret=1
if [ $ret != 0 ]; then echo_i "failed"; fi
if [ $ret -ne 0 ]; then echo_i "failed"; fi
status=`expr $status + $ret`
n=`expr $n + 1`
@@ -567,15 +573,15 @@ grep "dnssec-policy: algorithm 13 has multiple keys with KSK role" < checkconf.o
grep "dnssec-policy: algorithm 13 has multiple keys with ZSK role" < checkconf.out$n > /dev/null || ret=1
grep "dnssec-policy: key lifetime is shorter than 30 days" < checkconf.out$n > /dev/null || ret=1
lines=$(wc -l < "checkconf.out$n")
if [ $lines != 5 ]; then ret=1; fi
if [ $ret != 0 ]; then echo_i "failed"; fi
if [ $lines -ne 5 ]; then ret=1; fi
if [ $ret -ne 0 ]; then echo_i "failed"; fi
status=`expr $status + $ret`
n=`expr $n + 1`
echo_i "check that a good 'kasp' configuration is accepted ($n)"
ret=0
$CHECKCONF good-kasp.conf > checkconf.out$n 2>/dev/null || ret=1
if [ $ret != 0 ]; then echo_i "failed"; fi
if [ $ret -ne 0 ]; then echo_i "failed"; fi
status=`expr $status + $ret`
n=`expr $n + 1`
@@ -585,7 +591,7 @@ awk 'BEGIN { ok = 0; } /cut here/ { ok = 1; getline } ok == 1 { print }' good-ka
[ -s good-kasp.conf.in ] || ret=1
$CHECKCONF -p good-kasp.conf.in | grep -v '^good-kasp.conf.in:' > good-kasp.conf.out 2>&1 || ret=1
cmp good-kasp.conf.in good-kasp.conf.out || ret=1
if [ $ret != 0 ]; then echo_i "failed"; fi
if [ $ret -ne 0 ]; then echo_i "failed"; fi
status=`expr $status + $ret`
n=`expr $n + 1`
@@ -593,7 +599,7 @@ echo_i "check that max-ixfr-ratio 100% generates a warning ($n)"
ret=0
$CHECKCONF warn-maxratio1.conf > checkconf.out$n 2>/dev/null || ret=1
grep "exceeds 100%" < checkconf.out$n > /dev/null || ret=1
if [ $ret != 0 ]; then echo_i "failed"; ret=1; fi
if [ $ret -ne 0 ]; then echo_i "failed"; ret=1; fi
status=`expr $status + $ret`
n=`expr $n + 1`
@@ -605,6 +611,22 @@ $CHECKCONF warn-notify-source.conf > checkconf.out$n 2>/dev/null || ret=1
grep "not recommended" < checkconf.out$n > /dev/null || ret=1
$CHECKCONF warn-parental-source.conf > checkconf.out$n 2>/dev/null || ret=1
grep "not recommended" < checkconf.out$n > /dev/null || ret=1
if [ $ret -ne 0 ]; then echo_i "failed"; ret=1; fi
status=`expr $status + $ret`
n=`expr $n + 1`
echo_i "check that 'check-wildcard no;' succeeds as configured ($n)"
ret=0
$CHECKCONF -z check-wildcard-no.conf > checkconf.out$n 2>&1 || ret=1
grep -F "warning: ownername 'foo.*.check-wildcard' contains an non-terminal wildcard" checkconf.out$n > /dev/null && ret=1
if [ $ret != 0 ]; then echo_i "failed"; ret=1; fi
status=`expr $status + $ret`
n=`expr $n + 1`
echo_i "check that 'check-wildcard yes;' warns as configured ($n)"
ret=0
$CHECKCONF -z check-wildcard.conf > checkconf.out$n 2>&1 || ret=1
grep -F "warning: ownername 'foo.*.check-wildcard' contains an non-terminal wildcard" checkconf.out$n > /dev/null || ret=1
if [ $ret != 0 ]; then echo_i "failed"; ret=1; fi
status=`expr $status + $ret`
+4 -2
View File
@@ -43,7 +43,8 @@ do
$SETTIME -s -g $O -k $O $T -r $O $T -z $O $T -d $R $T "$CSK" > settime.out.$zone 2>&1
cat template.db.in "${CSK}.key" > "$infile"
private_type_record $zone $DEFAULT_ALGORITHM_NUMBER "$CSK" >> "$infile"
$SIGNER -S -z -x -s now-1h -e now+30d -o $zone -O full -f $zonefile $infile > signer.out.$zone.1 2>&1
cp $infile $zonefile
$SIGNER -S -z -x -s now-1h -e now+30d -o $zone -O raw -f "${zonefile}.signed" $infile > signer.out.$zone.1 2>&1
done
# DS Withdrawal.
@@ -57,5 +58,6 @@ do
$SETTIME -s -g $H -k $O $T -r $O $T -z $O $T -d $U $T "$CSK" > settime.out.$zone 2>&1
cat template.db.in "${CSK}.key" > "$infile"
private_type_record $zone $DEFAULT_ALGORITHM_NUMBER "$CSK" >> "$infile"
$SIGNER -S -z -x -s now-1h -e now+30d -o $zone -O full -f $zonefile $infile > signer.out.$zone.1 2>&1
cp $infile $zonefile
$SIGNER -S -z -x -s now-1h -e now+30d -o $zone -O raw -f "${zonefile}.signed" $infile > signer.out.$zone.1 2>&1
done
@@ -328,6 +328,7 @@ def test_checkds_dspublished(named_port):
keystate_check(parent, "incomplete-dspublished.checkds.", "!DSPublish")
# One of the parents is badly configured.
zone_check(server, "bad2-dswithdrawn.checkds.")
wait_for_log(
"ns9/named.run",
"zone bad2-dspublished.checkds/IN (signed): checkds: "
@@ -425,6 +426,7 @@ def test_checkds_dswithdrawn(named_port):
keystate_check(parent, "incomplete-dswithdrawn.checkds.", "!DSRemoved")
# One of the parents is badly configured.
zone_check(server, "bad2-dswithdrawn.checkds.")
wait_for_log(
"ns9/named.run",
"zone bad2-dswithdrawn.checkds/IN (signed): checkds: "
+2
View File
@@ -1,3 +1,5 @@
#!/bin/sh
# Copyright (C) Internet Systems Consortium, Inc. ("ISC")
#
# SPDX-License-Identifier: MPL-2.0
+2
View File
@@ -1,3 +1,5 @@
#!/bin/sh
# Copyright (C) Internet Systems Consortium, Inc. ("ISC")
#
# SPDX-License-Identifier: MPL-2.0
+2
View File
@@ -1,3 +1,5 @@
#!/bin/sh
# Copyright (C) Internet Systems Consortium, Inc. ("ISC")
#
# SPDX-License-Identifier: MPL-2.0
+2
View File
@@ -1,3 +1,5 @@
#!/bin/sh
# Copyright (C) Internet Systems Consortium, Inc. ("ISC")
#
# SPDX-License-Identifier: MPL-2.0
@@ -0,0 +1,18 @@
; Copyright (C) Internet Systems Consortium, Inc. ("ISC")
;
; SPDX-License-Identifier: MPL-2.0
;
; 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
; file, you can obtain one at https://mozilla.org/MPL/2.0/.
;
; See the COPYRIGHT file distributed with this work for additional
; information regarding copyright ownership.
$TTL 600
@ SOA ns hostmaster 2011012708 3600 1200 604800 1200
NS ns
ns A 192.0.2.1
; no alpn specified
_dns SVCB 1 ns dohpath=/{?dns}
@@ -0,0 +1,18 @@
; Copyright (C) Internet Systems Consortium, Inc. ("ISC")
;
; SPDX-License-Identifier: MPL-2.0
;
; 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
; file, you can obtain one at https://mozilla.org/MPL/2.0/.
;
; See the COPYRIGHT file distributed with this work for additional
; information regarding copyright ownership.
$TTL 600
@ SOA ns hostmaster 2011012708 3600 1200 604800 1200
NS ns
ns A 192.0.2.1
; no dohpath
_dns SVCB 1 ns alpn=http/1.1
@@ -0,0 +1,18 @@
; Copyright (C) Internet Systems Consortium, Inc. ("ISC")
;
; SPDX-License-Identifier: MPL-2.0
;
; 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
; file, you can obtain one at https://mozilla.org/MPL/2.0/.
;
; See the COPYRIGHT file distributed with this work for additional
; information regarding copyright ownership.
$TTL 600
@ SOA ns hostmaster 2011012708 3600 1200 604800 1200
NS ns
ns A 192.0.2.1
; no dohpath
_dns SVCB 1 ns alpn=h2
@@ -0,0 +1,18 @@
; Copyright (C) Internet Systems Consortium, Inc. ("ISC")
;
; SPDX-License-Identifier: MPL-2.0
;
; 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
; file, you can obtain one at https://mozilla.org/MPL/2.0/.
;
; See the COPYRIGHT file distributed with this work for additional
; information regarding copyright ownership.
$TTL 600
@ SOA ns hostmaster 2011012708 3600 1200 604800 1200
NS ns
ns A 192.0.2.1
; no dohpath
_dns SVCB 1 ns alpn=h3
@@ -0,0 +1,18 @@
; Copyright (C) Internet Systems Consortium, Inc. ("ISC")
;
; SPDX-License-Identifier: MPL-2.0
;
; 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
; file, you can obtain one at https://mozilla.org/MPL/2.0/.
;
; See the COPYRIGHT file distributed with this work for additional
; information regarding copyright ownership.
$TTL 600
@ SOA ns hostmaster 2011012708 3600 1200 604800 1200
NS ns
ns A 192.0.2.1
; no dohpath
_443._dns SVCB 1 ns alpn=h1\\,h2
@@ -0,0 +1,18 @@
; Copyright (C) Internet Systems Consortium, Inc. ("ISC")
;
; SPDX-License-Identifier: MPL-2.0
;
; 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
; file, you can obtain one at https://mozilla.org/MPL/2.0/.
;
; See the COPYRIGHT file distributed with this work for additional
; information regarding copyright ownership.
$TTL 600
@ SOA ns hostmaster 2011012708 3600 1200 604800 1200
NS ns
ns A 192.0.2.1
; no dohpath
_443._dns SVCB 1 ns alpn=x1\\,h2
@@ -0,0 +1,15 @@
; Copyright (C) Internet Systems Consortium, Inc. ("ISC")
;
; SPDX-License-Identifier: MPL-2.0
;
; 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
; file, you can obtain one at https://mozilla.org/MPL/2.0/.
;
; See the COPYRIGHT file distributed with this work for additional
; information regarding copyright ownership.
example. 0 SOA . . 0 0 0 0 0
example. 0 NS .
example. 0 DNSKEY 257 3 10 AwEAAbqjg7xdvnU2Q/gtLw5LOfr5cDeTRjYuEbkzGrUiVSOSoxcTxuao WS/AFPQHuD8OSLiE/CeZ087JowREXl058rRfae8KMrveY17V0wmKs9N1 F1wf/hRDpXiThlRHWlskp8eSEEIqYrrHgWTesy/xDGIEOFM1gwRo0w8j KdRRJeL2hseTMa+m3rTzrYudUsI0BHLW8PiDUCbG5xgdee8/5YR4847i AAqHIiPJ1Z/IT53OIjMmtv5BUykZ8RYjlJxxX+C+dpRKiK73SQaR3hCB XAYOL9WsDp2/fpmEZpewavkMkdC+j2CX+z27MCS3ASO0AeKK0lcNXwND kgreE+Kr7gc=
foo.example. 0 DS 14364 10 2 FD03B2312C8F0FE72C1751EFA1007D743C94EC91594FF0047C23C37CE119BA0C
@@ -24,3 +24,4 @@ svcb6 SVCB 6 . mandatory=port,alpn port=60 alpn=h3
svcb7 SVCB 7 . mandatory=port,alpn port=60 alpn=h1,h3
svcb8 SVCB 8 . mandatory=port,alpn port=60 alpn="h1\\,h2,h3"
svcb9 SVCB 0 44._svbc.example.net.
svcb10 SVCB 7 . alpn="h2,h3" dohpath=/{?dns}
+1 -1
View File
@@ -1,4 +1,4 @@
#! /bin/sh
#!/bin/sh
# Copyright (C) Internet Systems Consortium, Inc. ("ISC")
#

Some files were not shown because too many files have changed in this diff Show More