Compare commits

..
588 Commits
Author SHA1 Message Date
Evan Hunt 3878c145c9 experiment 2025-02-26 16:01:01 -08:00
Evan Hunt 4acbfbc2d1 retry fix 2025-02-26 16:01:01 -08:00
Evan Hunt 1ef9a32de7 slight refactoring in validated()
fix some minor code redundancies.
2025-02-26 15:28:57 -08:00
Evan Hunt 6c738fe323 simplify dns_ncache_add()
there's no longer any reason to have both dns_ncache_add() and
dns_ncache_addoptout().
2025-02-26 15:28:57 -08:00
Evan Hunt 49ccbe857a fix: dev: Validating ADB fetches could cause a crash in import_rdataset()
Previously, in some cases, the resolver could return rdatasets of type CNAME or DNAME without the result code being set to `DNS_R_CNAME` or `DNS_R_DNAME`. This could trigger an assertion failure in the ADB. The resolver error has been fixed.

Closes #5201

Merge branch '5201-adb-cname-error' into 'main'

See merge request isc-projects/bind9!10172
2025-02-26 20:34:27 +00:00
Evan Hunt 1edbbc32b4 set eresult based on the type in ncache_adderesult()
when the caching of a negative record failed because of the
presence of a positive one, ncache_adderesult() could override
this to ISC_R_SUCCESS. this could cause CNAME and DNAME responses
to be handled incorrectly.  ncache_adderesult() now sets the result
code correctly in such cases.
2025-02-25 21:29:19 -08:00
Mark Andrews a102e504c3 fix: doc: Fix command to generate KSR in DNSSEC guide
Merge branch 'doc-fix-dnssec-ksr-request-command' into 'main'

See merge request isc-projects/bind9!10087
2025-02-26 01:51:33 +00:00
Doug FreedandMark Andrews 0dd046d007 Fix command to generate KSR in DNSSEC guide 2025-02-26 01:08:52 +00:00
Evan Hunt 764eb65cf6 fix: dev: Remove 'target' from dns_adb
When a server name turns out to be a CNAME or DNAME, the ADB does not use it, but the `dns_adbname` structure still stored a copy of the target name. This is unnecessary and the code has been removed.

Merge branch 'each-remove-adb-target' into 'main'

See merge request isc-projects/bind9!10149
2025-02-26 00:43:46 +00:00
Evan Hunt 6c2af2ae3b remove 'target' from dns_adb
the target name parameter to dns_adb_createfind() was always passed as
NULL, so we can safely remove it.

relatedly, the 'target' field in the dns_adbname structure was never
referenced after being set.  the 'expire_target' field was used, but
only as a way to check whether an ADB name represents a CNAME or DNAME,
and that information can be stored as a single flag.
2025-02-26 00:43:21 +00:00
Mark Andrews 6af708f3b0 fix: usr: Fix dual-stack-servers configuration option
The dual-stack-servers configuration option was not working as expected; the specified servers were not being used when they should have been, leading to resolution failures. This has been fixed.

Closes #5019

Merge branch '5019-dual-stack-servers-wasn-t-working-in-all-cases' into 'main'

See merge request isc-projects/bind9!9708
2025-02-26 00:22:30 +00:00
Mark Andrews 14ab1629b7 Removing now unneeded priming queries
Now that fctx_try is being called when adb returns DNS_ADB_NOMOREADDRESSES
we don't need these priming queries for the dual-stack-servers test
to succeed.
2025-02-25 23:47:46 +00:00
Mark Andrews f98a8331aa Fix dual-stack-servers
Named was stopping nameserver address resolution attempts too soon
when dual stack servers are configured.  Dual stack servers are
used when there are *not* addresses for the server in a particular
address family so find->status == DNS_ADB_NOMOREADDRESSES is not a
sufficient stopping condition when dual stack servers are available.
Call fctx_try to see if the alternate servers can be used.
2025-02-25 23:47:46 +00:00
Mark Andrews 1bc7016d7a fix: usr: Relax private DNSKEY and RRSIG constraints
DNSKEY, KEY, RRSIG and SIG constraints have been relaxed to allow empty key and signature material after the algorithm identifier for PRIVATEOID and PRIVATEDNS. It is arguable whether this falls within the expected use of these types as no key material is shared and the signatures are ineffective but these are private algorithms and they can be totally insecure.

Closes #5167

Merge branch '5167-relax-private-dnskey-constraints' into 'main'

See merge request isc-projects/bind9!10083
2025-02-25 23:39:40 +00:00
Mark Andrews b048190e23 Relax private DNSKEY and RRSIG constraints
DNSKEY, KEY, RRSIG and SIG constraints have been relaxed to allow
empty key and signature material after the algorithm identifier for
PRIVATEOID and PRIVATEDNS. It is arguable whether this falls within
the expected use of these types as no key material is shared and
the signatures are ineffective but these are private algorithms and
they can be totally insecure.
2025-02-25 22:59:46 +00:00
Evan Hunt 5604d3a44e fix: dev: Prevent a reference leak when using plugins
The `NS_QUERY_DONE_BEGIN` and `NS_QUERY_DONE_SEND` plugin hooks could cause a reference leak if they returned `NS_HOOK_RETURN` without cleaning up the query context properly.

Closes #2094

Merge branch '2094-plugin-reference-leak' into 'main'

See merge request isc-projects/bind9!9971
2025-02-25 22:40:55 +00:00
Evan Hunt ae37ef45ff wrap ns_client_error() for unit testing
When testing, the client object doesn't have a proper
netmgr handle, so ns_client_error() needs to be a no-op.
2025-02-25 22:40:48 +00:00
Evan Hunt c2e4358267 prevent a reference leak from the ns_query_done hooks
if the NS_QUERY_DONE_BEGIN or NS_QUERY_DONE_SEND hook is
used in a plugin and returns NS_HOOK_RETURN, some of the
cleanup in ns_query_done() can be skipped over, leading
to reference leaks that can cause named to hang on shut
down.

this has been addressed by adding more housekeeping
code after the cleanup: tag in ns_query_done().
2025-02-25 22:40:48 +00:00
Mark Andrews 26f8ee7229 fix: usr: dnssec-signzone needs to check for a NULL key when setting offline
dnssec-signzone could dereference a NULL key pointer when resigning a zone.  This has been fixed.

Closes #5192

Merge branch '5192-dnssec-signzone-needs-to-check-for-a-null-key-when-setting-offline' into 'main'

See merge request isc-projects/bind9!10161
2025-02-25 22:22:30 +00:00
Mark Andrews 1784e4a9ae Check if key is NULL before dereferencing it 2025-02-25 21:45:37 +00:00
Evan Hunt e16560a650 fix: dev: Simplify some dns_name API calls
Several functions in the `dns_name` module have had parameters removed, that were rarely or never used:
- `dns_name_fromtext()` and `dns_name_concatenate()` no longer take a target buffer.
- `dns_name_towire()` no longer takes a compression offset pointer; this is now part of the compression context.
- `dns_name_towire()` with a `NULL` compression context will copy name data directly into a buffer with no processing.

Merge branch 'each-simplify-names' into 'main'

See merge request isc-projects/bind9!10152
2025-02-25 21:34:31 +00:00
Evan Hunt 2f7e6eb019 allow NULL compression context in dns_name_towire()
passing NULL as the compression context to dns_name_towire()
copies the uncompressed name data directly into the target buffer.
2025-02-25 12:53:25 -08:00
Evan Hunt afb424c9b6 simplify dns_name_fromtext() interface
previously, dns_name_fromtext() took both a target name and an
optional target buffer parameter, which could override the name's
dedicated buffer. this interface is unnecessarily complex.

we now have two functions, dns_name_fromtext() to convert text
into a dns_name that has a dedicated buffer, and dns_name_wirefromtext()
to convert text into uncompressed DNS wire format and append it to a
target buffer.

in cases where it really is necessary to have both, we can use
dns_name_fromtext() to load the dns_name, then dns_name_towire()
to append the wire format to the target buffer.
2025-02-25 12:53:25 -08:00
Evan Hunt cf098cf10d avoid the 'target' buffer in dns_name_fromtext()
dns_name_fromtext() stores the converted name in the 'name'
passed to it, and optionally also copies it in wire format to
a buffer 'target'. this makes the interface unnecessarily
complex, and could be simplified by having a different function
for each purpose. as a first step, remove uses of the target
buffer in calls to dns_name_fromtext() where it wasn't actually
needed.
2025-02-25 12:53:25 -08:00
Evan Hunt a6986f6837 remove 'target' parameter from dns_name_concatenate()
the target buffer passed to dns_name_concatenate() was never
used (except for one place in dig, where it wasn't actually
needed, and has already been removed in a prior commit).
we can safely remove the parameter.
2025-02-25 12:53:25 -08:00
Evan Hunt 2edefbad4a remove the 'name_coff' parameter in dns_name_towire()
this parameter was added as a (minor) optimization for
cases where dns_name_towire() is run repeatedly with the
same compression context, as when rendering all of the rdatas
in an rdataset. it is currently only used in one place.

we now simplify the interface by removing the extra parameter.
the compression offset value is now part of the compression
context, and can be activated when needed by calling
dns_compress_setmultiuse(). multiuse mode is automatically
deactivated by any subsequent call to dns_compress_permitted().
2025-02-25 12:53:25 -08:00
Evan Hunt 1d7a9ebeda remove the namebuf and onamebuf buffers in dig
lookup->namebuf and lookup->onamebuf were not necessary and
have been removed.
2025-02-25 12:53:25 -08:00
Evan Hunt cf981ab13b fix: dev: Save time when creating a slab from another slab
The `dns_rdataslab_fromrdataset()` function creates a slab from an rdataset. If the source rdataset already uses a slab, then no processing is necessary; we can just copy the existing slab to a new location.

Closes #5188

Merge branch '5188-optimize-makeslab' into 'main'

See merge request isc-projects/bind9!10162
2025-02-25 18:37:49 +00:00
Evan Hunt 94a96a7a0e save time when creating a slab from another slab
the dns_rdataslab_fromrdataset() function creates a slab
from an rdataset. if the source rdataset already uses a slab,
then no processing is necessary; we can just copy the existing
slab to a new location.
2025-02-25 18:37:35 +00:00
Ondřej Surý 796b662b92 fix: usr: Fix assertion failure when dumping recursing clients
Previously, if a new counter was added to the hashtable
while dumping recursing clients via the `rndc recursing`
command, and `fetches-per-zone` was enabled, an assertion
failure could occur. This has been fixed.

Closes #5200

Merge branch '5200-destroy-iterator-inside-the-rwlock' into 'main'

See merge request isc-projects/bind9!10164
2025-02-25 15:38:08 +00:00
Ondřej Surý 1e4fb53c61 Destroy the hashmap iterator inside the rwlock
Previously, the hashmap iterator for fetches-per-zone was destroy
outside the rwlock.  This could lead to an assertion failure due to a
timing race with the internal rehashing of the hashmap table as the
rehashing process requires no iterators to be running when rehashing the
hashmap table.  This has been fixed by moving the destruction of the
iterator inside the read locked section.
2025-02-25 13:36:37 +01:00
Ondřej Surý 24db1b1a8a chg:usr: Reduce memory used to store DNS names
The memory used to internally store the DNS names has been reduced.

Merge branch 'ondrej/experiment-no-offsets-in-dns_name' into 'main'

See merge request isc-projects/bind9!10140
2025-02-25 11:17:55 +00:00
Ondřej Surý 67e1df1a07 Squash set_offsets() and dns_name_offsets() into single function
The third argument to set_offsets() was only used in
dns_name_fromregion() and not really needed.  We can remove the third
argument and then manually check whether the last label is root label.
2025-02-25 12:17:34 +01:00
Ondřej Surý 79c3871a7b Remove target buffer from dns_name_downcase()
There was just a single use of passing an extra buffer to
dns_name_downcase() which have been replaced by simple call to
isc_ascii_lowercase() and the 'target' argument from dns_name_downcase()
function has been removed.
2025-02-25 12:17:34 +01:00
Ondřej Surý 3bb47bc6cd Remove MAKE_EMPTY() macro from dns_name unit
The MAKE_EMPTY() macro was clearing up the output variable in case of
the failure.  However, this was breaking the usual design pattern that
the output variables are left in indeterminate state or we don't touch
them at all when a failure occurs.  Remove the macro and change the
dns_name_downcase() to not touch the name contents until success.
2025-02-25 12:17:34 +01:00
Ondřej Surý 259600c837 Cleanup the usage of dns_offsets_t vs unsigned char * pointers
There was a back-and-forth between static arrays and the pointers to the
offsets.  Since we are now only using the static arrays, we can cleanup
the usage of the pointers that would previously point either to the
static array or name->offsets if available.
2025-02-25 12:17:34 +01:00
Ondřej Surý 1c22ab2ef7 Simplify name initializers
We no longer need to pass labels to DNS_NAME_INITABSOLUTE
and DNS_NAME_INITNONABSOLUTE.
2025-02-25 12:17:34 +01:00
Ondřej Surý 04c2c2cbc8 Simplify dns_name_init()
Remove the now-unused offsets parameter from dns_name_init().
2025-02-25 12:17:34 +01:00
Ondřej Surý 08e966df82 Remove offsets from the dns_name and dns_fixedname structures
The offsets were meant to speed-up the repeated dns_name operations, but
it was experimentally proven that there's actually no real-world
benefit.  Remove the offsets and labels fields from the dns_name and the
static offsets fields to save 128 bytes from the fixedname in favor of
calculating labels and offsets only when needed.
2025-02-25 12:17:34 +01:00
Alessio Podda 869168545a chg: nil: Remove unused symtab implementation
The old symtab implementation should have been removed in !9921, but it wasn't. This MR addresses that.

Merge branch 'alessio/cleanup-symtab-orphan-files' into 'main'

See merge request isc-projects/bind9!10122
2025-02-25 11:13:22 +00:00
alessio 45132df850 Remove unused symtab implementation
The old symtab implementation should have been removed in !9921 , but
it wasn't. This commit addresses that.
2025-02-25 11:29:58 +01:00
Alessio Podda 7fce7707db chg: usr: Drop malformed notify messages early instead of decompressing them
The DNS header shows if a message has multiple questions or invalid
NOTIFY sections. We can drop these messages early, right after parsing
the question. This matches RFC 9619 for multi-question messages and
Unbound's handling of NOTIFY. We still parse the question to include it in
our FORMERR response.

Add drop_msg_early() function to check for these conditions:
- Messages with more than one question, as required by RFC 9619
- NOTIFY query messages containing answer sections (like Unbound)
- NOTIFY messages containing authority sections (like Unbound)

Closes #5158, #3656

Merge branch '5158-early-formerr-on-bad-notify-or-bad-qdcount' into 'main'

See merge request isc-projects/bind9!10056
2025-02-25 10:29:00 +00:00
alessio 887502e37d Drop malformed notify messages early instead of decompressing them
The DNS header shows if a message has multiple questions or invalid
NOTIFY sections. We can drop these messages early, right after parsing
the question. This matches RFC 9619 for multi-question messages and
Unbound's handling of NOTIFY.
To further add further robustness, we include an additional check for
unknown opcodes, and also drop those messages early.

Add early_sanity_check() function to check for these conditions:
- Messages with more than one question, as required by RFC 9619
- NOTIFY query messages containing answer sections (like Unbound)
- NOTIFY messages containing authority sections (like Unbound)
- Unknown opcodes.
2025-02-25 10:40:38 +01:00
Mark Andrews 4e0b62bf10 fix: test: Handle example3.db being modified in upforwd system test
The zone file for example3 (ns1/example3.db) can be modified in the
upforwd test as example3 is updated as part of the test.  Whether
the zone is written out or not by the end of the test is timing
dependent.  Rename ns1/example3.db to ns1/example3.db.in and copy it to
ns1/example3.db in setup so we don't trigger post test changes checks.

Closes #5180

Merge branch '5180-create-example3-in-setup' into 'main'

See merge request isc-projects/bind9!10160
2025-02-25 06:16:45 +00:00
Mark Andrews afc4413862 Handle example3.db being modified in upforwd system test
The zone file for example3 (ns1/example3.db) can be modified in the
upforwd test as example3 is updated as part of the test.  Whether
the zone is written out or not by the end of the test is timing
dependent.  Rename ns1/example3.db to ns1/example3.db.in and copy
it to ns1/example3.db in setup so we don't trigger post test changes
checks.
2025-02-25 12:28:58 +11:00
Evan Hunt 02ef8ff01c fix: dev: Fix a logic error in cache_name()
A change in 6aba56ae8 (checking whether a rejected RRset was identical
to the data it would have replaced, so that we could still cache a
signature) inadvertently introduced cases where processing of a
response would continue when previously it would have been skipped.

Closes #5197

Merge branch '5197-cache_name-logic-error' into 'main'

See merge request isc-projects/bind9!10157
2025-02-24 23:39:23 +00:00
Evan Hunt d0fd9cbe3b Fix a logic error in cache_name()
A change in 6aba56ae8 (checking whether a rejected RRset was identical
to the data it would have replaced, so that we could still cache a
signature) inadvertently introduced cases where processing of a
response would continue when previously it would have been skipped.
2025-02-24 15:04:14 -08:00
Ondřej Surý c4868b5bd9 fix: dev: Acquire the database reference before possibly last node release
Acquire the database reference in the detachnode() to prevent the last
reference to be release while the NODE_LOCK being locked.  The NODE_LOCK
is locked/unlocked inside the RCU critical section, thus it is most
probably this should not pose a problem as the database uses call_rcu
memory reclamation, but this it is still safer to acquire the reference
before releasing the node.

Closes #5194

Merge branch '5194-fix-assertion-failure-while-reference-counting-qpdb' into 'main'

See merge request isc-projects/bind9!10155
2025-02-24 22:24:51 +00:00
Ondřej Surý d1ef6a93c1 Acquire the database reference before possibly last node release
Acquire the database refernce in the detachnode() to prevent the last
reference to be release while the NODE_LOCK being locked.  The NODE_LOCK
is locked/unlocked inside the RCU critical section, thus it is most
probably this should not pose a problem as the database uses call_rcu
memory reclamation, but this it is still safer to acquire the reference
before releasing the node.
2025-02-24 20:05:56 +01:00
Ondřej Surý 6e0c1f151c chg: dev: Move the library initialization and shutdown to executables
Instead of relying on unreliable order of execution of the library
constructors and destructors, move them to individual binaries.  The
advantage is that the execution time and order will remain constant and
will not depend on the dynamic load dependency solver.

Merge branch 'ondrej/move-the-constructors-destructors-to-binaries' into 'main'

See merge request isc-projects/bind9!10069
2025-02-22 18:06:21 +00:00
Ondřej Surý e99627a006 Suppressing memory leaks produced by clang LeakSanitizer
Previously, we were suppressing only the memory leaks in the GCC
LeakSanitizer job, but those suppression are also needed by the Clang.
2025-02-22 18:17:18 +01:00
Ondřej Surý 4917ffa61b Explicitly create and shutdown the call_rcu_thread
As the default_call_rcu_thread can't be forced to flush all the work
during the executable shutdown, create one call_rcu_thread explicitly
and assign it to the all created threads.

This allows this explicit call_rcu_thread to be unassociated from the
main thread and freed before the executable destructor exits.
2025-02-22 16:19:01 +01:00
Ondřej Surý f5c204ac3e Move the library init and shutdown to executables
Instead of relying on unreliable order of execution of the library
constructors and destructors, move them to individual binaries.  The
advantage is that the execution time and order will remain constant and
will not depend on the dynamic load dependency solver.

This requires more work, but that was mitigated by a simple requirement,
any executable using libisc and libdns, must include <isc/lib.h> and
<dns/lib.h> respectively (in this particular order).  In turn, these two
headers must not be included from within any library as they contain
inlined functions marked with constructor/destructor attributes.
2025-02-22 16:19:00 +01:00
Ondřej Surý 5d0c347e75 fix:usr: Dump the active resolver fetches from dns_resolver_dumpfetches()
Previously, active resolver fetches were only dumped when the `fetches-per-zone` configuration option was enabled. Now, active resolver fetches are dumped along with the number of `clients-per-server` counters per resolver fetch.

Merge branch 'ondrej/make-dns_resolver_dumpfetches-dump-fetches' into 'main'

See merge request isc-projects/bind9!10107
2025-02-21 21:26:18 +00:00
Ondřej Surý c6b0368b21 Dump the fetches from dns_resolver_dumpfetches()
Previously, the dns_resolver_dumpfetches() would go over the fetch
counters.  Alas, because of the earlier optimization, the fetch counters
would be increased only when fetches-per-zone was not 0, otherwise the
whole counting was skipped for performance reasons.

Instead of using the auxiliary fetch counters hash table, use the real
hash table that stores the fetch contexts to dump the ongoing fetches to
the recursing file.

Additionally print more information about the fetch context like start
and expiry times, number of fetch responses, number of queries and count
of allowed and dropped fetches.
2025-02-21 22:25:43 +01:00
Ondřej Surý 479c366c2b fix:usr: Fix the data race causing a permanent active client increase
Previously, a data race could cause a newly created fetch context for a new client to be used
before it had been fully initialized, which would cause the query to become stuck; queries for the same
data would be either paused indefinitely or dropped because of
the `clients-per-query` limit. This has been fixed.

Closes #5053

Merge branch '5053-fetch-context-create-data-race' into 'main'

See merge request isc-projects/bind9!10146
2025-02-21 21:24:56 +00:00
Ondřej Surý cf078fadeb Fix the fetch context hash table lock ordering
The order of the fetch context hash table rwlock and the individual
fetch context was reversed when calling the release_fctx() function.
This was causing a problem when iterating the hash table, and thus the
ordering has been corrected in a way that the hash table rwlock is now
always locked on the outside and the fctx lock is the interior lock.
2025-02-21 22:05:43 +01:00
Ondřej Surý b9e3cd5d2a Add isc_timer_running() function to check status of timer
In the next commit, we need to know whether the timer has been started
or stopped.  Add isc_timer_running() function that returns true if the
timer has been started.
2025-02-21 22:05:43 +01:00
Michał Kępień e127ba0041 chg: doc: Update Sphinx and sphinx_rtd_theme
Update Sphinx-related Python packages to their current versions pulled
in by "pip install sphinx-rtd-theme" run in a fresh virtual environment.

Merge branch 'michal/update-sphinx-and-sphinx_rtd_theme' into 'main'

See merge request isc-projects/bind9!10138
2025-02-21 13:47:08 +00:00
Michał Kępień eae270cc32 Update Sphinx and sphinx_rtd_theme
Update Sphinx-related Python packages to their current versions pulled
in by "pip install sphinx-rtd-theme" run in a fresh virtual environment.
2025-02-21 14:41:25 +01:00
Arаm Sаrgsyаn 5ba811bea2 fix: usr: Fix RPZ race condition during a reconfiguration
With RPZ in use, `named` could terminate unexpectedly because of a race condition when a reconfiguration command was received using `rndc`. This has been fixed.

Closes #5146

Merge branch '5146-rpz-reconfig-bug-fix' into 'main'

See merge request isc-projects/bind9!10079
2025-02-21 11:45:00 +00:00
Aram Sargsyan 3ea2fbc238 Fix RPZ bug when resuming a query during a reconfiguration
After a reconfiguration the old view can be left without a valid
'rpzs' member, because when the RPZ is not changed during the named
reconfiguration 'rpzs' "migrate" from the old view into the new
view, so when a query resumes it can find that 'qctx->view->rpzs'
is NULL which query_resume() currently doesn't expect to happen if
it's recursing and 'qctx->rpz_st' is not NULL.

Fix the issue by adding a NULL-check. In order to not split the log
message to two different log messages depending on whether
'qctx->view->rpzs' is NULL or not, change the message to not log
the RPZ policy's "version" which is just a runtime counter and is
most likely not very useful for the users.
2025-02-21 11:10:15 +00:00
Ondřej Surý 7471ef5e1a chg:nil: Cleanup the isc_counter unit
The isc_counter_create() doesn't need the return value (it was always
ISC_R_SUCCESS), use the macros to implement the reference counting,
little style cleanup, and expand the unit test.

Merge branch 'ondrej/cleanup-isc_counter-unit' into 'main'

See merge request isc-projects/bind9!10126
2025-02-21 09:51:49 +00:00
Ondřej Surý 77ec2a6c22 Cleanup the isc_counter unit
The isc_counter_create() doesn't need the return value (it was always
ISC_R_SUCCESS), use the macros to implement the reference counting,
little style cleanup, and expand the unit test.
2025-02-21 09:51:42 +00:00
Mark Andrews f0785fedf1 fix: usr: Remove NSEC/DS/NSEC3 RRSIG check from dns_message_parse
Previously, when parsing responses, named incorrectly rejected responses without matching RRSIG records for NSEC/DS/NSEC3 records in the authority section. This rejection, if appropriate, should have been left for the validator to determine and has been fixed.

Closes #5185

Merge branch '5185-remove-rrsig-check-from-dns_message_parse' into 'main'

See merge request isc-projects/bind9!10125
2025-02-21 02:57:46 +00:00
Mark Andrews 4271d93f00 Check insecure response with missing RRSIG in authority
This scenario should succeed but wasn't due rejection of the
message at the message parsing stage.
2025-02-20 20:31:07 +00:00
Mark Andrews 83159d0a54 Remove check for missing RRSIG records from getsection
Checking whether the authority section is properly signed should
be left to the validator.  Checking in getsection (dns_message_parse)
was way too early and resulted in resolution failures of lookups
that should have otherwise succeeded.
2025-02-20 20:31:07 +00:00
Arаm Sаrgsyаn d78ebff861 fix: usr: Implement sig0key-checks-limit and sig0message-checks-limit
Previously a hard-coded limitation of maximum two key or message
verification checks were introduced when checking the message's
SIG(0) signature. It was done in order to protect against possible
DoS attacks. The logic behind choosing the number 2 was that more
than a single key should only be required during key rotations, and
in that case two keys are enough. But later it became apparent that
there are other use cases too where even more keys are required, see
issue number #5050 in GitLab.

This change introduces two new configuration options for the views,
`sig0key-checks-limit` and `sig0message-checks-limit`, which define how
many keys are allowed to be checked to find a matching key, and how
many message verifications are allowed to take place once a matching
key has been found. The latter protects against expensive cryptographic
operations when there are keys with colliding tags and algorithm
numbers, with default being 2, and the former protects against a bit
less expensive key parsing operations and defaults to 16.

Closes #5050

Merge branch '5050-sig0-let-considering-more-than-two-keys' into 'main'

See merge request isc-projects/bind9!9967
2025-02-20 14:24:17 +00:00
Aram Sargsyan 5861c10dfb Document sig0key-checks-limit and sig0message-checks-limit 2025-02-20 13:35:14 +00:00
Aram Sargsyan 716b936045 Implement sig0key-checks-limit and sig0message-checks-limit
Previously a hard-coded limitation of maximum two key or message
verification checks were introduced when checking the message's
SIG(0) signature. It was done in order to protect against possible
DoS attacks. The logic behind choosing the number two was that more
than one key should only be required only during key rotations, and
in that case two keys are enough. But later it became apparent that
there are other use cases too where even more keys are required, see
issue number #5050 in GitLab.

This change introduces two new configuration options for the views,
sig0key-checks-limit and sig0message-checks-limit, which define how
many keys are allowed to be checked to find a matching key, and how
many message verifications are allowed to take place once a matching
key has been found. The latter protects against expensive cryptographic
operations when there are keys with colliding tags and algorithm
numbers, with default being 2, and the former protects against a bit
less expensive key parsing operations and defaults to 16.
2025-02-20 13:35:14 +00:00
Arаm Sаrgsyаn 742d379d88 fix: dev: Fix isc_quota bug
Running jobs which were entered into the isc_quota queue is the
responsibility of the isc_quota_release() function, which, when
releasing a previously acquired quota, checks whether the queue
is empty, and if it's not, it runs a job from the queue without touching
the 'quota->used' counter. This mechanism is susceptible to a possible
hangup of a newly queued job in case when between the time a decision
has been made to queue it (because used >= max) and the time it was
actually queued, the last quota was released. Since there is no more
quotas to be released (unless arriving in the future), the newly
entered job will be stuck in the queue.

Fix the issue by adding checks in both isc_quota_release() and
isc_quota_acquire_cb() to make sure that the described hangup does
not happen. Also see code comments.

Closes #4965

Merge branch '4965-isc_quota-bug-fix' into 'main'

See merge request isc-projects/bind9!10082
2025-02-20 12:19:46 +00:00
Aram Sargsyan c6529891bb Fix isc_quota bug
Running jobs which were entered into the isc_quota queue is the
responsibility of the isc_quota_release() function, which, when
releasing a previously acquired quota, checks whether the queue
is empty, and if it's not, it runs a job from the queue without touching
the 'quota->used' counter. This mechanism is susceptible to a possible
hangup of a newly queued job in case when between the time a decision
has been made to queue it (because used >= max) and the time it was
actually queued, the last quota was released. Since there is no more
quotas to be released (unless arriving in the future), the newly
entered job will be stuck in the queue.

Fix the wrong memory ordering for 'quota->used', as the relaxed
ordering doesn't ensure that data modifications made by one thread
are visible in other threads.

Add checks in both isc_quota_release() and isc_quota_acquire_cb()
to make sure that the described hangup does not happen. Also see
code comments.
2025-02-20 10:56:00 +00:00
Arаm Sаrgsyаn a282f1ba3f new: usr: Implement the min-transfer-rate-in configuration option
A new option 'min-transfer-rate-in <bytes> <minutes>' has been added
to the view and zone configurations. It can abort incoming zone
transfers which run very slowly due to network related issues, for
example. The default value is set to 10240 bytes in 5 minutes.

Closes #3914

Merge branch '3914-detect-and-restart-stalled-zone-transfers' into 'main'

See merge request isc-projects/bind9!9098
2025-02-20 10:31:47 +00:00
Aram Sargsyan c701b590e4 Expose the incoming transfers' rates in the statistics channel
Expose the average transfer rate (in bytes-per-second) during the
last full 'min-transfer-rate-in <bytes> <minutes>' minutes interval.
If no such interval has passed yet, then the overall average rate is
reported instead.
2025-02-20 09:32:55 +00:00
Aram Sargsyan b9c6aa24f8 Test the new min-transfer-rate-in configuration option
Add a new big zone, run a zone transfer in slow mode, and check
whether the zone transfer gets canceled because 100000 bytes are
not transferred in 5 seconds (as it's running in slow mode).
2025-02-20 09:32:55 +00:00
Aram Sargsyan f6dfff01ab Document the min-transfer-rate-in configuration option
Add a new section in ARM describing min-transfer-rate-in.
2025-02-20 09:32:55 +00:00
Aram Sargsyan 91ea156203 Implement the min-transfer-rate-in configuration option
This new option sets a minimum amount of transfer rate for
an incoming zone transfer that will abort a transfer, which
for some network related reasons run very slowly.
2025-02-20 09:32:55 +00:00
Evan Hunt fc3a4d6f89 fix: dev: Do not cache signatures for rejected data
The cache has been updated so that if new data is rejected - for example, because there was already existing data at a higher trust level - then its covering RRSIG will also be rejected.

Closes #5132

Merge branch '5132-improve-cd-behavior' into 'main'

See merge request isc-projects/bind9!9999
2025-02-20 02:12:12 +00:00
Evan Hunt e4652a0444 add a test with an inconsistent NS RRset
add a zone with different NS RRsets in the parent and child,
and test resolver and forwarder behavior with and without +CD.
2025-02-19 17:25:20 -08:00
Evan Hunt 6aba56ae89 Check whether a rejected rrset is different
Add a new dns_rdataset_equals() function to check whether two
rdatasets are equal in DNSSEC terms.

When an rdataset being cached is rejected because its trust
level is lower than the existing rdataset, we now check to see
whether the rejected data was identical to the existing data.
This allows us to cache a potentially useful RRSIG when handling
CD=1 queries, while still rejecting RRSIGs that would definitely
have resulted in a validation failure.
2025-02-19 17:25:20 -08:00
Evan Hunt 948f8d7a98 fix: dev: Clean up dns_rdataslab module
Rdata slabs used in the QP databases are usually prepended with a slab header, but are sometimes "raw", containing only the rdata and no header. Previously, to allow for them to be used both ways, functions that operated on them took a `reservelen` argument, which would be set to either the header length or to zero, and skipped over that many bytes at the beginning of the buffer. Most such functions were never used on the raw form. To make the code clearer, each of these functions now operates on full slabs with headers, and an alternate "raw" version of the function has been added in cases where that was needed.

In addition, the `dns_rdataslab_merge()` and `_subtract()` functions have been rewritten for clarity and efficiency, and a minor bug has been fixed in `dns_rdataslab_equal()` and `_equalx()`, which could cause an incorrect result if both slabs being compared had zero length.

Merge branch 'each-refactor-rdataslab' into 'main'

See merge request isc-projects/bind9!10084
2025-02-19 23:43:41 +00:00
Ondřej SurýandEvan Hunt 2fc32c105d Remove the "raw" version of the dns_slabheader API
The "raw" version of the header was used for the noqname and the closest
proofs to save around 152 bytes of the dns_slabheader_t while bringing
an additional complexity.  Remove the raw version of the dns_slabheader
API at the slight expense of having unused dns_slabheader_t data sitting
in front of the proofs.
2025-02-19 15:00:15 -08:00
Evan Hunt c2e19771ac refactor dns_rdataslab_subtract() for efficiency
reduce the number of rdata comparisons needed by walking
through the original slab once to determine whether the rdata
in it is duplicated in the slab to be subtracted, and then
write out the rdatas that aren't. previously, this was
done twice: once when determining the size of the target buffer
and then again when copying data into it.
2025-02-19 15:00:15 -08:00
Evan Hunt 1d5fe36136 refactor dns_rdataslab_merge() for efficiency
when merging two rdata slabs, we now check once to see
whether an item in the new slab has a duplicate in the
old. previously this was done twice; once to determine the
size of the target buffer required, and then again when
copying the data into it.

we also minimize the number of rdata comparisons necessary,
by remembering which items in the old slab have already been
found to be duplicates.
2025-02-19 15:00:15 -08:00
Evan Hunt ed83455c81 dns_slabheader_fromrdataset() -> dns_rdataset_getheader()
The function name dns_slabheader_fromrdataset() was too similar
to dns_rdataslab_fromrdataset(). Instead, we now have an rdataset
method 'getheader' which is implemented for slab-type rdatasets.

A new NOHEADER rdataset attribute is set for rdatasets using
raw slabs (i.e., noqname and closest encloser proofs); when
called on rdatasets with that flag set, dns_rdataset_getheader()
returns NULL.
2025-02-19 14:58:32 -08:00
Evan Hunt 82edec67a5 initialize header in dns_rdataslab_fromrdataset()
when dns_rdataslab_fromrdataset() is run, in addition to
allocating space for a slab header, it also partially
initializes it, setting the type match rdataset->type and
rdataset->covers, the trust to rdataset->trust, and the TTL to
rdataset->ttl.
2025-02-19 14:58:32 -08:00
Evan Hunt b4bde9bef4 clarify dns_rdataslab_fromrdataset()
there are now two functions for creating an rdataslab from an
rdataset: dns_rdataslab_fromrdataset() creates a full slab (including
space for a slab header), and dns_rdataslab_raw_fromrdataset() creates
a raw slab.
2025-02-19 14:58:32 -08:00
Evan Hunt f1ab7f199b refactor dns_rdataslab_merge() and _subtract()
these two functions have been refactored for clarity
and readability, with a more logical flow, added comments,
and less code duplication.
2025-02-19 14:58:32 -08:00
Evan Hunt 6908d1f9be more rdataslab refactoring
- there are now two functions for getting rdataslab size:
  dns_rdataslab_size() is for full slabs and dns_rdataslab_sizeraw()
  for raw slabs. there is no longer a need for a reservelen parameter.
- dns_rdataslab_count() also no longer takes a reservelen parameter.
  (currently it's never used for raw slabs, so there is no _countraw()
  function.)
- dns_rdataslab_rdatasize() has been removed, because
  dns_rdataslab_sizeraw() can do the same thing.
- dns_rdataslab_merge() and dns_rdataslab_subtract() both take
  slabheader parameters instead of character buffers, and the
  reservelen parameter has been removed.
2025-02-19 14:58:32 -08:00
Evan Hunt 4601d4299a fix and simplify dns_rdataset_equal() and _equalx()
if both rdataslabs being compared have zero length, return true.

also, since these functions are only ever called on slabheaders
with sizeof(dns_slabheader_t) as the reserve length, we can
simplify the API: remove the reservelen argument, and pass the
slabs as type dns_slabheader_t * instead of unsigned char *.
2025-02-19 14:58:32 -08:00
Ondřej SurýandEvan Hunt 15fe68e50d Add .up pointer to slabheader
The dns_slabheader object uses the 'next' pointer for two purposes.
In the first header for any given type, 'next' points to the first
header for the next type. But 'down' points to the next header of
the same type, and in that record, 'next' points back up.

This design made the code confusing to read.  We now use a union
so that the 'next' pointer can also be called 'up'.
2025-02-19 14:58:32 -08:00
Andoni Duarte Pintado 44026fc4ad Merge tag 'v9.21.5' 2025-02-19 17:46:17 +01:00
Artem Boldariev 3033d127d2 fix: dev: Post [CVE-2024-12705] Performance Drop Fixes
This merge request fixes a [performance drop](https://gitlab.isc.org/isc-projects/bind9/-/pipelines/216728) after merging the fixes for #4795, in particular in 9.18.

The MR [fixes the problem](https://gitlab.isc.org/isc-projects/bind9/-/pipelines/219825) without affecting performance for the newer versions, in particular for [the development version](https://gitlab.isc.org/isc-projects/bind9/-/pipelines/220619).

Merge branch 'artem-doh-performance-drop' into 'main'

See merge request isc-projects/bind9!10109
2025-02-19 16:39:36 +00:00
Artem Boldariev 2adabe835a DoH: http_send_outgoing() return value is not used
The value returned by http_send_outgoing() is not used anywhere, so we
make it not return anything (void). Probably it is an omission from
older times.
2025-02-19 17:52:36 +02:00
Artem Boldariev 8b8f4d500d DoH: Fix missing send callback calls
When handling outgoing data, there were a couple of rarely executed
code paths that would not take into account that the callback MUST be
called.

It could lead to potential memory leaks and consequent shutdown hangs.
2025-02-19 17:52:36 +02:00
Artem Boldariev a22bc2d7d4 DoH: change how the active streams number is calculated
This commit changes the way how the number of active HTTP streams is
calculated and allows it to scale with the values of the maximum
amount of streams per connection, instead of effectively capping at
STREAM_CLIENTS_PER_CONN.

The original limit, which is intended to define the pipelining limit
for TCP/DoT. However, it appeared to be too restrictive for DoH, as it
works quite differently and implements pipelining at protocol level by
the means of multiplexing multiple streams. That renders each stream
to be effectively a separate connection from the point of view of the
rest of the codebase.
2025-02-19 17:52:36 +02:00
Artem Boldariev 05e8a50818 DoH: Track the amount of in flight outgoing data
Previously we would limit the amount of incoming data to process based
solely on the presence of not completed send requests. That worked,
however, it was found to severely degrade performance in certain
cases, as was revealed during extended testing.

Now we switch to keeping track of how much data is in flight (or ready
to be in flight) and limit the amount of processed incoming data when
the amount of in flight data surpasses the given threshold, similarly
to like we do in other transports.
2025-02-19 17:52:36 +02:00
Evan Hunt 67255da4b3 fix: dev: Delete dead nodes when committing a new version
In the qpzone implementation of `dns_db_closeversion()`, if there are changed nodes that have no remaining data, delete them.

Closes #5169

Merge branch '5169-qpzone-delete-dead-nodes' into 'main'

See merge request isc-projects/bind9!10089
2025-02-18 22:54:42 +00:00
Evan Hunt e58ce19cf2 when committing a new qpzone version, delete dead nodes
if all data has been deleted from a node in the qpzone
database, delete the node too.
2025-02-18 14:22:38 -08:00
Evan Hunt 74c9ff384e rem: dev: Clean up unnecessary code in qpcache
Removed some code from the cache database implementation that was left over from before it and the zone database implementation were separated.

Merge branch 'each-qpcache-refactor' into 'main'

See merge request isc-projects/bind9!9991
2025-02-18 20:15:14 +00:00
Ondřej SurýandEvan Hunt ce9f6e68c3 Unify how we handle database version in the cache
Database versions are not used in cache databases. Some places in
qpcache.c required the version argument to be NULL; others marked it
as UNUSED. Unify all cases to require version to be NULL.
2025-02-18 20:15:00 +00:00
Ondřej SurýandEvan Hunt 2d53796e28 Clean up 'now' usage in the cache
Unify the way we handle the 'now' argument in the cache: when it's
set to zero by the caller, it is replaced with isc_stdtime_now().
2025-02-18 20:15:00 +00:00
Ondřej SurýandEvan Hunt 3b2fe808c4 Clean up the search part in qpcache_find()
Slightly refactor the header search in qpcache_find(), so the scope
level is reduced and the cname parts are logically grouped together.
2025-02-18 20:15:00 +00:00
Ondřej SurýandEvan Hunt bfb219ac2d Refactor the search in qpcache_findrdataset()
Add new related_headers() function that simplifies the code
flow in qpcache_findrdataset().  Also use check_stale_header() function
to remove code duplication.
2025-02-18 20:15:00 +00:00
Ondřej SurýandEvan Hunt cf66ba02a4 Refactor simple slabheader matching
Add a helper function both_headers() that unifies the slabheader
matching for simple type: it returns true when both the type and
the matching RRSIG have been found.
2025-02-18 20:15:00 +00:00
Ondřej SurýandEvan Hunt 4cd1dd8dd7 Add new helper maybe_update_headers() function
The new maybe_update_headers() function unifies the LRU updates to the
slabheaders that was scattered all over the place.  More calls to update
headers after bindrdatasets() were also added for completeness.
2025-02-18 20:15:00 +00:00
Ondřej SurýandEvan Hunt 4448f1adb2 Add bindrdatasets() function that binds both rdatasets
This removes code duplication between the dual bindrdataset() calls.  It
also unifies the handling as there were small differences between the
calls: one variant was checking for !NEGATIVE(found) condition and one
wasn't, and it is technically ok to do the check for all variants.
2025-02-18 20:15:00 +00:00
Ondřej SurýandEvan Hunt 53d9ef5bd0 Refactor check_stale_header() function
The check_stale_header() function now updates header_prev directly
so it doesn't have to be handled in the outer loop; it's always
set to the correct value of the previous header in the chain.
2025-02-18 20:15:00 +00:00
Evan Hunt b24981ea02 add missing "failed" message in digdelv test
there was a test case that could fail (and did) without logging
the fact.
2025-02-18 20:15:00 +00:00
Evan Hunt 5281c708d3 clean up unnecessary code in qpcache
some code was left in the cache database implementation after
it was separated from the zone database, and can be cleaned up
and refactored now:

- the DNS_SLABHEADERATTR_IGNORE flag is never set in the cache
- support for loading the cache from was removed, but the add()
  function still had a 'loading' flag that's always false
- two different macros were used for checking the
  DNS_SLABHEADERATTR_NONEXISTENT flag - EXISTS() and NONEXISTENT().
  it's clearer to just use EXISTS().
- the cache doesn't support versions, so it isn't necessary to
  walk down the 'down' pointer chain when iterating through the
  cache or looking for a header to update.  'down' now only points
  to records that are deleted from the cache but have not yet been
  purged from memory. this allows us to simplify both the iterator
  and the add() function.
2025-02-18 20:15:00 +00:00
Petr Špaček d34414c47b new: usr: Add HTTPS record query to host command line tool
The host command was extended to also query for the HTTPS RR type by default.

Merge branch 'feature/main/host-rr-https' into 'main'

See merge request isc-projects/bind9!8642
2025-02-18 14:56:39 +00:00
Petr MenšíkandPetr Špaček 82069a5700 Do HTTPS record query from host in addition
Unless explicitly specified type from host command, do fourth query for
type HTTPS RR. It is expected it will become more common and some
systems already query that record for every name.
2025-02-18 14:56:08 +00:00
Artem Boldariev 1f6a16e6d0 fix: dev: Fix wrong logging severity in do_nsfetch()
ISC_LOG_WARNING was used while ISC_LOG_DEBUG(3) was implied.

Closes #5145

Merge branch '5145-artem-fix-wrong-logging-severity-in-do_nsfetch' into 'main'

See merge request isc-projects/bind9!10017
2025-02-18 09:01:39 +00:00
Artem Boldariev fd3beaba2e Fix wrong logging severity in do_nsfetch()
ISC_LOG_WARNING was used while ISC_LOG_DEBUG(3) was implied.
2025-02-18 10:28:23 +02:00
Matthijs Mekking bf7efe03b0 fix: doc: Fix typo in ARM related to max-stale-ttl
The text that stale-cache-enable is set to no has no effect on
max-cache-ttl, but on max-stale-ttl.

Closes #5181

Merge branch '5181-max-stale-ttl-typo-arm' into 'main'

See merge request isc-projects/bind9!10108
2025-02-18 07:33:55 +00:00
Matthijs Mekking b017d9fe67 Fix typo in ARM related to max-stale-ttl
The text that stale-cache-enable is set to no has no effect on
max-cache-ttl, but on max-stale-ttl.
2025-02-18 07:33:43 +00:00
Evan Hunt d6b63210a8 fix: dev: Fix dns_qp_insert() checks in qpzone
Remove code in the QP zone database to handle failures of `dns_qp_insert()` which can't actually happen.

Closes #5171

Merge branch '5171-qpzone-insert-checks' into 'main'

See merge request isc-projects/bind9!10088
2025-02-18 05:54:33 +00:00
Evan Hunt fffa150df3 fix dns_qp_insert() checks in qpzone
in some places there were checks for failures of dns_qp_insert()
after dns_qp_getname(). such failures could only happen if another
thread inserted a node between the two calls, and that can't happen
because the calls are serialized with dns_qpmulti_write(). we can
simplify the code and just add an INSIST.
2025-02-17 12:21:50 -08:00
Michal Nowak 766805a374 chg: test: Rewrite keyfromlabel system test to pytest
Merge branch 'mnowak/pytest_rewrite_keyfromlabel' into 'main'

See merge request isc-projects/bind9!9188
2025-02-17 19:19:32 +00:00
Michal Nowak 409f394d6e Rewrite keyfromlabel system test to pytest 2025-02-17 19:18:04 +00:00
Michal Nowak 0921e91a4b chg: test: Rewrite keepalive system test to pytest
Merge branch 'mnowak/pytest_rewrite_keepalive' into 'main'

See merge request isc-projects/bind9!9202
2025-02-17 19:16:18 +00:00
Michal Nowak b804a70fac Rewrite keepalive system test to pytest 2025-02-17 19:16:03 +00:00
Michal Nowak 7347abd01f Add Dig interface 2025-02-17 19:16:03 +00:00
Arаm Sаrgsyаn 3f61a87be3 fix: usr: Use named Service Parameter Keys (SvcParamKeys) by default
When converting SVCB records to text representation `named` now uses named
`SvcParamKeys` values unless backward-compatible mode is activated,
in which case the values which were not defined initially in
RFC9460 and were added later (see [1]) are converted to opaque
"keyNNNN" syntax, like, for example, "key7" instead of "dohpath".

Also a new `+[no]svcparamkeycompat` option is implemented for `dig`,
which enables the backward-compatible mode and uses the opaque
syntax, if required for interoperability with other software or
scripts. By default, the compatibility mode is disabled.

[1] https://www.iana.org/assignments/dns-svcb/dns-svcb.xhtml

Closes #5156

Merge branch '5156-svcparamkey-use-named-keys-by-default' into 'main'

See merge request isc-projects/bind9!10085
2025-02-17 18:24:02 +00:00
Aram Sargsyan 9d441c93d0 Update the rdata unit test
Update the rdata unit test to accommodate the change in the default
represenation of the Service Parameter Keys (SvcParamKeys) for the
SVCB records.
2025-02-17 17:33:43 +00:00
Aram Sargsyan 3482d7e694 Test dig +svcparamkeycompat
This check in the nsupdate system test expects the opaque
representation of the "dohpath" Service Parameter Key. Use
the +svcparamkeycompat dig option to enable it.
2025-02-17 17:33:43 +00:00
Aram Sargsyan 583a838c25 Implement dig +[no]svcparamkeycompat
The new +[no]svcparamkeycompat option for dig enables the
backward-compatible mode for the Service Parameter Keys'
(SvcParamKeys) representation format. See the previous commit
for more information.
2025-02-17 17:33:43 +00:00
Aram Sargsyan d5d63d6253 Fix a bug in generic_totext_in_svcb()
The 'sbpr_dohpath' case was missing from the switch-case. Add the
'sbpr_dohpath' case, which should work similarly as the 'sbpr_text'
case.
2025-02-17 17:33:43 +00:00
Aram Sargsyanandsdomi c6e3695478 Use named Service Parameter Keys (SvcParamKeys) by default
When converting SVCB records to text representation use named
SvcParamKeys values unless backward-compatible mode is activated,
in which case the values which were not defined initially in
RFC9460 and were added later (see [1]) are converted to opaque
"keyN" syntax, like, for example, "key7" instead of "dohpath".

[1] https://www.iana.org/assignments/dns-svcb/dns-svcb.xhtml

Co-authored-by: sdomi <ja@sdomi.pl>
2025-02-17 17:33:43 +00:00
Alessio Podda 5559539eb0 chg: dev: Refactor and simplify isc_symtab
This commit does several changes to isc_symtab:

1. Rewrite the isc_symtab to internally use isc_hashmap instead of
   hand-stiched hashtable.

2. Create a new isc_symtab_define_and_return() api, which returns
   the already defined symvalue on ISC_R_EXISTS; this allows users
   of the API to skip the isc_symtab_lookup()+isc_symtab_define()
   calls and directly call isc_symtab_define_and_return().

3. Merge isccc_symtab into isc_symtab - the only missing function
   was isccc_symtab_foreach() that was merged into isc_symtab API.

4. Add full set of unit tests for the isc_symtab API.

Closes #5103

Merge branch '5103-use-isc_hashmap-for-isc_symtab' into 'main'

See merge request isc-projects/bind9!9921
2025-02-17 12:30:24 +00:00
alessio 53991ecc14 Refactor and simplify isc_symtab
This commit does several changes to isc_symtab:

1. Rewrite the isc_symtab to internally use isc_hashmap instead of
   hand-stiched hashtable.

2. Create a new isc_symtab_define_and_return() api, which returns
   the already defined symvalue on ISC_R_EXISTS; this allows users
   of the API to skip the isc_symtab_lookup()+isc_symtab_define()
   calls and directly call isc_symtab_define_and_return().

3. Merge isccc_symtab into isc_symtab - the only missing function
   was isccc_symtab_foreach() that was merged into isc_symtab API.

4. Add full set of unit tests for the isc_symtab API.
2025-02-17 11:43:19 +01:00
Mark Andrews ebf1606f38 fix: usr: Fix deferred validation of unsigned DS and DNSKEY records
When processing a query with the "checking disabled" bit set (CD=1), `named` stores the unvalidated result in the cache, marked "pending". When the same query is sent with CD=0, the cached data is validated, and either accepted as an answer, or ejected from the cache as invalid. This deferred validation was not attempted for DS and DNSKEY records if they had no cached signatures, causing spurious validation failures. We now complete the deferred validation in this scenario.

Also, if deferred validation fails, we now re-query the data to find out whether the zone has been corrected since the invalid data was cached.

Closes #5066

Merge branch '5066-fix-strip-dnssec-rrsigs' into 'main'

See merge request isc-projects/bind9!10104
2025-02-16 23:36:25 +00:00
Mark Andrews 04b1484ed8 Re-fetch pending records that failed validation
If a deferred validation on data that was originally queried with
CD=1 fails, we now repeat the query, since the zone data may have
changed in the meantime.
2025-02-17 08:57:58 +11:00
Mark Andrews 8b900d1808 Complete the deferred validation if there are no RRSIGs
When a query is made with CD=1, we store the result in the
cache marked pending so that it can be validated later, at
which time it will either be accepted as an answer or removed
from the cache as invalid.  Deferred validation was not
attempted when there were no cached RRSIGs for DNSKEY and
DS.  We now complete the deferred validation in this scenario.
2025-02-17 08:57:58 +11:00
Mark Andrews 66f293a952 Add stripped DS RRSIG senario 2025-02-17 08:57:58 +11:00
Mark Andrews a71b617566 Add stripped DNSKEY RRSIG senario 2025-02-17 08:57:58 +11:00
Mark Andrews b694acbe45 fix: usr: "CNAME and other data check" not applied to all types
An incorrect optimization caused "CNAME and other data" errors not to be detected if certain types were at the same node as a CNAME.  This has been fixed.

Closes #5150

Merge branch '5150-cname-and-other-data-check-not-applied-to-all-types' into 'main'

See merge request isc-projects/bind9!10033
2025-02-14 02:23:52 +00:00
Mark Andrews 559fac329a Move SVCB and HTTPS to be in type code order 2025-02-14 01:51:38 +00:00
Mark Andrews dfc367f52c Test cname-and-other-data against various types 2025-02-14 01:51:38 +00:00
Mark Andrews 5e49a9e4ae Fix "CNAME and other data" detection
prio_type was being used in the wrong place to optimize cname_and_other.
We have to first exclude and accepted types and we also have to
determine that the record exists before we can check if we are at
a point where a later CNAME cannot appear.
2025-02-14 01:51:38 +00:00
Michal Nowak bd4729e13b chg: test: Rewrite nzd2nzf system test to pytest
Merge branch 'mnowak/pytest_rewrite_nzd2nzf' into 'main'

See merge request isc-projects/bind9!9160
2025-02-13 18:29:07 +00:00
Michal Nowak 38e751d9ac Rename assert_custom_named_is_alive to named_alive 2025-02-13 18:43:47 +01:00
Michal Nowak 7c499d1689 Rewrite nzd2nzf system test to pytest 2025-02-13 18:43:47 +01:00
Michal Nowak 42a7b6aedf chg: test: Rewrite names system test to pytest
Merge branch 'mnowak/pytest_rewrite_names' into 'main'

See merge request isc-projects/bind9!8759
2025-02-13 16:56:31 +00:00
Michal Nowak 5250ad8720 Rewrite names system test to pytest
dnspython 2.7.0 or newer is needed because of wire().
2025-02-13 16:55:38 +00:00
Michal Nowak 7b3dc7ab32 chg: test: Generate TSAN unit stress tests
This is a complement to the already present system test "stress" test.

Merge branch 'mnowak/generate-tsan-unit-stress-tests' into 'main'

See merge request isc-projects/bind9!9474
2025-02-13 16:40:25 +00:00
Michal Nowak a03c4b4cf9 Generate TSAN unit stress tests 2025-02-13 16:39:27 +00:00
Andoni Duarte 3d3247109c chg: doc: Set up version for BIND 9.21.6
Merge branch 'andoni/set-up-version-for-bind-9.21.6' into 'main'

See merge request isc-projects/bind9!10093
2025-02-13 16:10:39 +00:00
Andoni Duarte Pintado 259678df11 Update BIND version to 9.21.6-dev 2025-02-13 15:55:46 +01:00
Andoni Duarte Pintado ee913c1370 Update BIND version for release 2025-02-11 18:10:51 +01:00
Andoni Duarte e5f02d3a25 new: doc: Prepare documentation for BIND 9.21.5
Merge branch 'andoni/prepare-documentation-for-bind-9.21.5' into 'v9.21.5-release'

See merge request isc-private/bind9!778
2025-02-11 17:04:45 +00:00
Michał KępieńandAndoni Duarte Pintado da23a0c4e1 Update CVE checklist 2025-02-11 17:34:52 +01:00
Andoni Duarte Pintado 8a742d084f Tweak and reword release notes 2025-02-11 17:34:52 +01:00
Andoni Duarte Pintado b23b0d991a Prepare release notes for BIND 9.21.5 2025-02-11 17:34:52 +01:00
Andoni Duarte Pintado af174fe816 Generate changelog for BIND 9.21.5 2025-02-11 17:34:52 +01:00
Michal Nowak 9b15715558 fix: ci: Do not evaluate $CI_PROJECT_DIR in generate-stress-test-configs.py
GitLab CI Runner's $builds_dir variable is set to "/builds" by default.
For technical reasons, the FreeBSD Runners, using the "instance"
executor, sets the path differently.

The value of $CI_PROJECT_DIR is based on $builds_dir, so if the
generate-stress-test-configs.py script generates jobs with
$CI_PROJECT_DIR (or variables like $INSTALL_PATH that are based on it)
evaluated, it is calcified to whatever was the value in the particular
environment, disregarding the FreeBSD "instance" executor specifics in
the child pipeline.

Instead of evaluating $CI_PROJECT_DIR in the script, evaluate it in the
runtime environment.

Merge branch 'mnowak/fix-CI_PROJECT_DIR-variable-evaluation' into 'main'

See merge request isc-projects/bind9!10075
2025-02-05 15:01:03 +00:00
Michal Nowak dab7d28b09 Do not evaluate $CI_PROJECT_DIR in generate-stress-test-configs.py
GitLab CI Runner's $builds_dir variable is set to "/builds" by default.
For technical reasons, the FreeBSD Runners, using the "instance"
executor, sets the path differently.

The value of $CI_PROJECT_DIR is based on $builds_dir, so if the
generate-stress-test-configs.py script generates jobs with
$CI_PROJECT_DIR (or variables like $INSTALL_PATH that are based on it)
evaluated, it is calcified to whatever was the value in the particular
environment, disregarding the FreeBSD "instance" executor specifics in
the child pipeline.

Instead of evaluating $CI_PROJECT_DIR in the script, evaluate it in the
runtime environment.
2025-02-05 15:46:14 +01:00
Ondřej Surý d4a7bff0b6 fix: dev: Reduce the false sharing the dns_qpcache and dns_qpzone
Instead of having many node_lock_count * sizeof(<member>) arrays, pack all
the members into a qpcache_bucket_t that is cacheline aligned to prevent
false sharing between RWLocks.

Merge branch 'ondrej/prevent-nodelock-false-sharing' into 'main'

See merge request isc-projects/bind9!10072
2025-02-04 22:24:20 +00:00
Ondřej Surý 732fc338a9 Switch the locknum generation for qpznode to random
Instead of using on hash of the name modulo number of the buckets,
assign the locknum randomly with isc_random_uniform().  This makes
the locknum assignment aligned with qpcache and allows the bucket
number to be non-prime in the future.
2025-02-04 22:50:49 +01:00
Ondřej Surý 1fa5219fdf Rely on call_rcu() to destroy the qpzone outside of locks
Reduce the number of qpzone_ref() and qpzone_unref() calls in
qpzone_detachnode() by relying on the call_rcu to delay
the destruction of the lock buckets.
2025-02-04 21:37:46 +01:00
Ondřej Surý 6dcc398726 Reduce false sharing in dns_qpzone
Instead of having many node_lock_count * sizeof(<member>) arrays, pack
all the members into a qpzone_bucket_t that is cacheline aligned and have
a single array of those.
2025-02-04 21:37:46 +01:00
Ondřej Surý c602d76c1f Reduce false sharing in dns_qpcache
Instead of having many node_lock_count * sizeof(<member>) arrays, pack
all the members into a qpcache_bucket_t struct that is cacheline aligned
and have a single array of those.

Additionaly, make both the head and the tail of isc_queue_t padded, not
just the head, to prevent false sharing of the lock-free structure with
the lock that follows it.
2025-02-04 21:37:46 +01:00
Michal Nowak a1ca49683a chg: test: Rewrite stub system test to pytest
Merge branch 'mnowak/pytest_rewrite_stub' into 'main'

See merge request isc-projects/bind9!9190
2025-02-04 12:38:25 +00:00
Michal Nowak 1069eb1969 Rewrite stub system test to pytest 2025-02-04 12:35:38 +00:00
Michal Nowak b19fb37080 Add isctest.check.notauth() 2025-02-04 12:35:38 +00:00
Nicki KřížekandMichal Nowak a24f71bae4 Allow to use an arbitrary numeric identifier for NamedInstance
In some cases, the numeric identifier doesn't correspond to the
directory name (i.e. `resolver` server in `shutdown` test, which is
supposed to be 10.53.0.3). These are typically servers that shouldn't be
auto-started by the runner, thus avoiding the typical `*ns<X>` name.

Support these server by allowing a fallback initialization with custom
numeric identifier in case it can't be parsed from the directory name.
2025-02-04 12:35:38 +00:00
Nicki KřížekandMichal Nowak 37699ad84b Add start/stop wrappers to control NamedInstance
The start()/stop() functions can be used in the pytests in the same way
as start_server and stop_server functions were used in shell tests. Note
that the servers obtained through the servers fixture are still started
and stopped by the test runner at the start and end of the test. This
makes these functions mostly useful for restarting the server(s)
mid-test.
2025-02-04 12:35:38 +00:00
Nicki KřížekandMichal Nowak b6d645410c Move shell and perl util functions to isctest.run
Previously, these functions have been provided as fixtures. This was
limiting re-use, because it wasn't possible to call these outside of
tests / other fixtures without passing these utility functions around.
Move them into isctest.run package instead.
2025-02-04 12:35:38 +00:00
Michal Nowak d2f6e236a2 fix: ci: Supress the leak detection in __xmlDefaultBufferSize
Closes #5157

Merge branch '5157-suppress-lsan-libxml2-leak' into 'main'

See merge request isc-projects/bind9!10067
2025-02-04 12:34:41 +00:00
Michal Nowak ca859563aa Supress the leak detection in __xmlDefaultBufferSize 2025-02-04 12:34:02 +00:00
Arаm Sаrgsyаn 166c324142 chg: usr: Include destination address port number in query logging
When query logging is enabled, named will now include the destination
address port in the logged message.

Closes #5060

Merge branch '5060-log-query-incoming-port' into 'main'

See merge request isc-projects/bind9!9972
2025-02-04 11:48:52 +00:00
Aram Sargsyan 19843f6c9d Include destination address port number in query logging
When query logging is enabled, named will now include the destination
address port in the logged message.

Example messages for before and after this change:

    before: client @0x7608b2026000 10.53.0.1#52136 (example.test): query: example.test IN A +E(0)K (10.53.0.1)
    after:  client @0x729bf5c26000 10.53.0.1#35976 (example.test): query: example.test IN A +E(0)K (10.53.0.1#53)
2025-02-04 10:49:26 +00:00
Mark Andrews f8802cbfa0 fix: test: Fix 'ans' servers so they respond with consistent answers to NS queries at QNAME.
The ANS servers were not to written to handle NS queries at the QNAME, resulting in gratuitous protocol errors that will break tests when NS requests are made for the QNAME: i.e., NXDOMAIN for NS vs data for expected type,  CNAME not being returned for all query types.

Prerequisite for !9155 

Closes #5062

Merge branch '5062-fix-ans-servers-ns-at-qname' into 'main'

See merge request isc-projects/bind9!9786
2025-02-04 02:35:33 +00:00
Mark Andrews 0680eb6f64 Fix gratuitious DNS protocol errors in the ANS servers
The ANS servers were not to written to handle NS queries at the
QNAME resulting in gratuitious protocol errors that will break tests
when NS requests are made for the QNAME.
2025-02-04 12:49:50 +11:00
Ondřej Surý ae73ac81a3 new: usr: Print the expiration time of the stale records
Print the expiration time of the stale RRsets in the cache dump.

Merge branch 'ondrej/print-expiration-time-of-stale-records' into 'main'

See merge request isc-projects/bind9!10057
2025-02-03 15:18:31 +00:00
Ondřej Surý 355fc48472 Print the expiration time of the stale records (not ancient)
In #1870, the expiration time of ANCIENT records were printed, but
actually the ancient records are very short lived, and the information
carries a little value.

Instead of printing the expiration of ANCIENT records, print the
expiration time of STALE records.
2025-02-03 15:47:06 +01:00
Ondřej Surý 517c5b6b28 fix: usr: Recently expired records could be returned with timestamp in future
Under rare circumstances, the RRSet that expired at the time of
the query could be returned with TTL far in the future.  This
has been fixed.

As a side-effect, the expiration time of expired RRSets are no
longer printed out in the cache dump.

Closes #5094

Merge branch '5094-fix-timestamp-in-ttl' into 'main'

See merge request isc-projects/bind9!10048
2025-02-03 13:39:39 +00:00
Ondřej Surý 36a3ceb19f Restore the .ttl field for slabheader in dns_qpzone
The original .ttl field was actually used as TTL in the dns_qpzone unit.
Restore the field by adding it to union with the .expire struct member
and cleanup all the code that added or subtracted 'now' from the ttl
field as that was misleading as 'now' would be always 0 for qpzone
database.
2025-02-03 14:39:06 +01:00
Ondřej Surý 60f6b88c63 Remove duplicate 'now' argument from find_coveringnsec()
The find_coveringnsec() was getting the 'now' from two sources -
search->now and separate now argument.  Things like this are ticking
bombs, remove the extra 'now' argument and use single source of 'now'.
2025-02-03 14:39:06 +01:00
Ondřej Surý 58179e6a19 Expand the usage of mark_ancient() helper functions
When the mark_ancient() helper function was introduced, couple of places
with duplicate (or almost duplicate) code was missed.  Move the
mark_ancient() function closer to the top of the file, and correctly use
it in places that mark the header as ANCIENT.
2025-02-03 14:39:06 +01:00
Ondřej Surý cfee6aa565 Add better ZEROTTL handling in bindrdataset()
If we know that the header has ZEROTTL set, the server should never send
stale records for it and the TTL should never be anything else than 0.
The comment was already there, but the code was not matching the
comment.
2025-02-03 14:39:06 +01:00
Ondřej Surý e07f5a4a5b In dns_slabheader_t structure, change .ttl to .expire
The old name was misleading as it never meant time-to-live, e.g. number
of seconds from now when the header should expire.  The true meaning was
an expiration time e.g. now + ttl.  This was the original design bug
that caused the slip when we assigned header->ttl to rdataset->ttl.
Because the name was matching, nobody has questioned the correctness of
the code both during the MR review and during the numerous re-reviews
when we were searching for the cause of the 54 year TTL.
2025-02-03 14:39:06 +01:00
Ondřej Surý 1bbb57f81b In cache, set rdataset TTL to 0 when the header is not active
When the header has been marked as ANCIENT, but the ttl hasn't been
reset (this happens in couple of places), the rdataset TTL would be
set to the header timestamp instead to a reasonable TTL value.

Since this header has been already expired (ANCIENT is set), set the
rdataset TTL to 0 and don't reuse this field to print the expiration
time when dumping the cache.  Instead of printing the time, we now
just print 'expired (awaiting cleanup'.
2025-02-03 14:39:06 +01:00
Mark Andrews d9eb272b69 fix: usr: validate adb fetches
ADB responses were not being validated, allowing spoofed responses to be accepted and used for further lookups. This should not be possible when the servers for the zone are in a signed zone, except with CD=1 requests or when glue is needed. This has been fixed.

Closes #5066

Merge branch '5066-validate-adb-fetches' into 'main'

See merge request isc-projects/bind9!10052
2025-02-03 02:18:09 +00:00
Mark Andrews 88c31fdd52 Check recovery from spoofed server addresses
Named was failing to recover when spoofed nameserver address from
a signed zone for a peer zone were returned to a previous CD=1
query. Validate non-glue interior server addresses before using them.
2025-02-03 00:24:34 +00:00
Mark Andrews 6469ebd08e Set PENDINGOK if STARTATZONE is set
When there are parent and child zones on the same server, the DNSKEY
lookup was failing as the pending record we are validating is needed
to fetch the DNSKEY records.  This change allows that to happen.
The caller is already setting STARTATZONE when the name being looked
up is a subdomain of the current domain.
2025-02-03 00:24:34 +00:00
Mark Andrews ea9d7080cd Validate address lookups from ADB
The address lookups from ADB were not being validated, allowing
spoofed responses to be accepted and used for other lookups.

Validate the answers except when CD=1 is set in the triggering
request.  Separate ADB names looked up with CD=1 from those without
CD=1, to prevent the use of unvalidated answers in the normal lookup
case (CD=0).  Set the TTL on unvalidated (pending) responses to
ADB_CACHE_MINIMUM when adding them to the ADB.
2025-02-03 00:24:34 +00:00
Ondřej Surý 282b0ed514 fix: dev: Fix the cache findzonecut() implementation
The search for the deepest known zone cut in the cache could improperly reject a node if it contained any stale data, regardless of whether it was the NS RRset that was stale.

Closes #5155

Merge branch '5155-fix-findzonecut' into 'main'

See merge request isc-projects/bind9!10047
2025-02-02 18:54:24 +00:00
Evan HuntandOndřej Surý 1f095b902c fix the cache findzonecut implementation
the search for the deepest known zone cut in the cache could
improperly reject a node containing stale data, even if the
NS rdataset wasn't the data that was stale.

this change also improves the efficiency of the search by
stopping it when both NS and RRSIG(NS) have been found.
2025-02-02 18:43:50 +01:00
Petr Špaček 32518f7de3 fix: ci: Fix shell escaping in post-merge before_script
Merge branch 'pspacek/no-cross-project-after-merge-jobs-fix' into 'main'

See merge request isc-projects/bind9!10042
2025-01-31 13:34:59 +00:00
Petr Špaček 6276e0b23b Fix shell escaping in post-merge before_script
Fixup for commit 6014060774
"Do not trigger post-merge jobs for cross-project pushes".

Related: isc-projects/bind9!10029
2025-01-31 14:20:09 +01:00
Petr Špaček 98325fabeb fix: ci: Do not trigger post-merge jobs for cross-project pushes
Merge branch 'pspacek/no-cross-project-after-merge-jobs' into 'main'

See merge request isc-projects/bind9!10029
2025-01-31 12:10:41 +00:00
Petr Špaček 6014060774 Do not trigger post-merge jobs for cross-project pushes
We need to avoid double-triggering of post-merge jobs in the following
scenario:

 1. A private MR gets merged into the private BIND 9 repository.

 2. This merge operation triggers a "push" pipeline in the private
    repository, which correctly runs post-merge jobs, e.g. to set MR
    metadata in the private project.

 3. When a release is published, a script is run to change the
    automatically assigned milestone value ("Not released yet") to
    something else.

 4. Shortly afterwards, the result of the merge from step 1 is merged
    back into a maintenance branch in the public repository.

 5. The push operation triggers another "push" pipeline, this time in
    the public project.

At this point there are two problems:

  - If the script is dumb (like it currently is), it will extract the
    merge request ID from the merge commit description and change the
    milestone for a merge request in the wrong project namespace.

  - Even if the script was fixed to extract and use the correct GitLab
    project reference, it would reset the milestone for the merge
    request in the private repository back to "Not released yet" - while
    the milestone set in step 3 should be retained.

An alternative would be to change the order of operations so that
post-release milestoning happens at a later stage, while also fixing the
script to correctly follow cross-project references, but that approach
seems more fragile than simply failing on all cross-project pushes.  The
rule to enforce is: each project should only take care of its own
post-merge tasks.
2025-01-31 13:07:57 +01:00
Michał Kępień 5a688130e5 chg: nil: Update CVE checklist
This MR adds an extra CVE checklist step suggested by @pspacek after
CVE-2024-0760.  See [Mattermost][1] for context.

It also syncs checklist steps with their corresponding links to the
explanations wiki page as these have been out-of-sync since !9307.

[1]: https://mattermost.isc.org/isc/pl/156npi4bwtr6pechbj6sfs6jjo

Merge branch 'michal/update-cve-checklist' into 'main'

See merge request isc-projects/bind9!9949
2025-01-31 11:27:51 +00:00
Michał Kępień 35604a2cad Sync checklist steps with links to explanations 2025-01-31 12:26:10 +01:00
Michał Kępień ebeafd93ad Update CVE checklist 2025-01-31 12:26:10 +01:00
Michał Kępień 0ba2b5585d chg: ci: Use default cloning depth for the Danger CI job
With shallow fetching working reliably in pygit2 1.17.0+, there is no
longer any need for GitLab CI runners to clone the BIND 9 repository
with a fixed depth of 1000 during every "danger" CI job as Hazard is now
able to fetch remote refs with an arbitrary depth, controlled by the
HAZARD_FETCH_DEPTH environment variable.  The latter can be defined via
GitLab project's CI settings and adjusted as needed over time, without
the need to update .gitlab-ci.yml every time its value needs to be
changed.

Merge branch 'michal/use-default-cloning-depth-for-the-danger-ci-job' into 'main'

See merge request isc-projects/bind9!9946
2025-01-31 09:26:25 +00:00
Michał Kępień e39e7afc16 Use default cloning depth for the Danger CI job
With shallow fetching working reliably in pygit2 1.17.0+, there is no
longer any need for GitLab CI runners to clone the BIND 9 repository
with a fixed depth of 1000 during every "danger" CI job as Hazard is now
able to fetch remote refs with an arbitrary depth, controlled by the
HAZARD_FETCH_DEPTH environment variable.  The latter can be defined via
GitLab project's CI settings and adjusted as needed over time, without
the need to update .gitlab-ci.yml every time its value needs to be
changed.
2025-01-31 10:25:56 +01:00
Evan Hunt f43bf94ece chg: dev: Refactor decref() in both QPDB
Clean up the pattern in the newref() and decref() functions in QP databases.  Replace the `db_nodelock_t` structure with plain reference counting for every active database node in QPDB.

Related to #5134

Merge branch '5134-refactor-decref-functions-in-qpdb' into 'main'

See merge request isc-projects/bind9!10006
2025-01-31 04:45:07 +00:00
Evan Hunt d4f791793e Clarify reference counting in QP databases
Change the names of the node reference counting functions
and add comments to make the mechanism easier to understand:

- newref() and decref() are now called qpcnode_acquire()/
  qpznode_acquire() and qpcnode_release()/qpznode_release()
  respectively; this reflects the fact that they modify both
  the internal and external reference counters for a node.

- qpcnode_newref() and qpznode_newref() are now called
  qpcnode_erefs_increment() and qpznode_erefs_increment(), and
  qpcnode_decref() and qpznode_decref() are now called
  qpcnode_erefs_decrement() and qpznode_erefs_decrement(),
  to reflect that they only increase and decrease the node's
  external reference counters, not internal.
2025-01-30 20:08:46 -08:00
Ondřej Surý 431513d8b3 Remove db_nodelock_t in favor of reference counted qpdb
This removes the db_nodelock_t structure and changes the node_locks
array to be composed only of isc_rwlock_t pointers.  The .reference
member has been moved to qpdb->references in addition to
common.references that's external to dns_db API users.  The .exiting
members has been completely removed as it has no use when the reference
counting is used correctly.
2025-01-30 16:43:02 +01:00
Ondřej Surý 36a26bfa1a Remove origin_node from qpcache
The origin_node in qpcache was always NULL, so we can remove the
getoriginode() function and origin_node pointer as the
dns_db_getoriginnode() correctly returns ISC_R_NOTFOUND when the
function is not implemented.
2025-01-30 16:43:02 +01:00
Ondřej Surý 814b87da64 Refactor decref() in both qpcache.c and qpzone.c
Cleanup the pattern in the decref() functions in both qpcache.c and
qpzone.c, so it follows the similar patter as we already have in
newref() function.
2025-01-30 16:43:02 +01:00
Colin Vidal fd51d80297 fix: dev: DNSSEC EDE system tests on FIPS platform
Changes introducing the support of extended DNS error code 1 and 2 uses
SHA-1 digest for some tests which break FIPS platform. The digest itself
was irrelevant, another digest is used.

Merge branch 'colin/fix-fips-9807' into 'main'

See merge request isc-projects/bind9!10002
2025-01-30 13:07:18 +00:00
Colin Vidal d82262d293 fix DNSSEC EDE system tests on FIPS platform
Changes !9948 introducing the support of extended DNS error code 1 and 2
uses SHA-1 digest for some tests which break FIPS platform. The digest
itself was irrelevant, another digest is used.
2025-01-30 11:41:30 +00:00
Ondřej Surý a8e0a695c4 fix: dev: Split and simplify the use of EDE list implementation
Instead of mixing the dns_resolver and dns_validator units directly with
the EDE code, split-out the dns_ede functionality into own separate
compilation unit and hide the implementation details behind abstraction.

Additionally, the new dns_edelist_t doesn't have to be copied into all
responses as those are attached to the fetch context, but it could be
only passed by reference.

This makes the dns_ede implementation simpler to use, although sligtly
more complicated on the inside.

Closes #5141

Merge branch '5141-ede-mem-fix-v2' into 'main'

See merge request isc-projects/bind9!10016
2025-01-30 11:29:53 +00:00
Colin Vidal 7c5678bb03 Use DNS_EDE_OTHER instead of its literal value 2025-01-30 11:54:36 +01:00
Colin Vidal c7b0fe5bec update EDE copy and add dup tests
Update EDE tests to exercise the bitmap and next ede index logic
2025-01-30 11:52:53 +01:00
Colin Vidal 9021f9d802 detect dup EDE with bitmap and store next pos
In order to avoid to loop to find the next position to store an EDE in
a dns_edectx_t, add a "nextede" state which holds the next available
position.

Also, in order ot avoid to loop to find if an EDE is already existing in
a dns_edectx_t, and avoid a duplicate, use a bitmap to immediately know
if the EDE is there or not.

Those both changes applies for adding or copying EDE.

Also make the direction of dns_ede_copy more explicit/avoid errors by
making "edectx_from" a const pointer.
2025-01-30 11:52:53 +01:00
Colin Vidal 7b01cbfb04 add lib/dns/ede.c documentation
Add documentation usage of EDE compilation unit as well as centralize
all EDE-related macros in the same lib/dns/include/dns/ede.h header.
2025-01-30 11:52:53 +01:00
Colin Vidal f9f41190b3 Refactor test covering dns_ede API
Migrate tests cases in client_test code which were exclusively testing
code which is now all wrapped inside ede compilation unit. Those are
testing maximum number of EDE, duplicate EDE as well as truncation of
text of an EDE.

Also add coverage for the copy of EDE from an edectx to another one, as
well as checking the assertion of the maximum EDE info code which can be
used.
2025-01-30 11:52:53 +01:00
Ondřej SurýandColin Vidal 2f8e0edf3b Split and simplify the use of EDE list implementation
Instead of mixing the dns_resolver and dns_validator units directly with
the EDE code, split-out the dns_ede functionality into own separate
compilation unit and hide the implementation details behind abstraction.

Additionally, the EDE codes are directly copied into the ns_client
buffers by passing the EDE context to dns_resolver_createfetch().

This makes the dns_ede implementation simpler to use, although sligtly
more complicated on the inside.

Co-authored-by: Colin Vidal <colin@isc.org>
Co-authored-by: Ondřej Surý <ondrej@isc.org>
2025-01-30 11:52:53 +01:00
Andoni Duarte 53734b6845 fix: ci: remove allow failure in cross version config tests
From https://gitlab.isc.org/isc-projects/bind9/-/issues/5087, the relevant MRs have been merged in the January 2025 release. Hence this MR removes `allow_failure: true` in CI.

Merge branch 'andoni/remove-allow-failure-in-cross-version-config-tests' into 'main'

See merge request isc-projects/bind9!10026
2025-01-30 10:02:18 +00:00
Andoni Duarte Pintado 5d07df807a Update cross-version-config-tests CI
Remove `allow_failure: true` from .gitlab-ci.yaml, as the relevant
MRs have been merged in the January 2025 release.
2025-01-30 10:24:48 +01:00
Andoni Duarte Pintado 3a64b288c1 Merge tag 'v9.21.4' 2025-01-29 17:17:18 +01:00
Nicki Křížek c5669a274d chg: ci: Use make clean to reduce artifacts in successful jobs
Reduce the amount of artifacts stored by running make clean at the end
of unit and system test run. If any of the previous commands fail, the
runner will stop executing the commands in `script` immediately, so the
cleanup only happens if none of the previous commands failed.

The build artifacts from unit and system tests are re-used anywhere and
should be safe to throw away immediately.

Merge branch 'nicki/reduce-ci-artifacts' into 'main'

See merge request isc-projects/bind9!10015
2025-01-29 14:11:13 +00:00
Nicki Křížek e5636598a5 Enable unit test artifacts for gcov jobs
Without using the build artifacts from the unit test jobs in the
bookworm tests, the gcov would be incomplete.
2025-01-29 13:33:14 +01:00
Nicki Křížek e59bc5b366 Use make clean to reduce artifacts in successful jobs
Reduce the amount of artifacts stored by running make clean at the end
of unit and system test run. If any of the previous commands fail, the
runner will stop executing the commands in `script` immediately, so the
cleanup only happens if none of the previous commands failed.

The build artifacts from unit and system tests are re-used anywhere and
should be safe to throw away immediately. Same for respdiff.
2025-01-28 16:15:36 +01:00
Nicki Křížek e3dd7e3d96 fix: ci: Run merged-metadata job for release branches in private repo
The prior regex didn't match the actual names we use for release
branches in the private repo. This caused the merged-metadata job to not
be created upon merging to a release branch, resulting in the private MR
not being properly milestoned.

Use the correct regex along with protecting the v9.*-release branches in
the gitlab UI so that they have access to the token used to perform the
required API operations.

Merge branch 'nicki/ci-fix-post-merge-in-private-repo' into 'main'

See merge request isc-projects/bind9!10003
2025-01-28 13:35:07 +00:00
Nicki Křížek 2e5a3bde7e Run merged-metadata job for release branches in private repo
The prior regex didn't match the actual names we use for release
branches in the private repo. This caused the merged-metadata job to not
be created upon merging to a release branch, resulting in the private MR
not being properly milestoned.

Use the correct regex along with protecting the v9.*-release branches in
the gitlab UI so that they have access to the token used to perform the
required API operations.
2025-01-28 14:34:18 +01:00
Michal Nowak 94c72e7943 fix: doc: Use archived version of draft-icann-dnssec-keymgmt-01.txt
The iana.org link is gone.

Merge branch 'mnowak/linkcheck-fix-draft-icann-dnssec-keymgmt-01.txt-link' into 'main'

See merge request isc-projects/bind9!10010
2025-01-28 11:55:42 +00:00
Michal Nowak 5dbc87730e Use archived version of draft-icann-dnssec-keymgmt-01.txt
The iana.org link is gone.
2025-01-28 12:13:57 +01:00
Michal Nowak 92a3487106 chg: test: Add stress tests with DoH and DoT
Validation pipeline: https://gitlab.isc.org/isc-projects/bind9/-/pipelines/160984

Prerequisites:
- [x] isc-private/devops!11
- [x] https://gitlab.isc.org/isc-projects/bind9-qa/-/merge_requests/9

Things to consider:
- FreeBSD DoH jobs are not added because Flamethrower queries always timeout.
- This adds 15 more CI jobs:
  - Linux (AWS autoscaler): `(auth + recursive + RPZ) * (DoH + DoT) * (amd64 + arm64) = 12`
  - FreeBSD (one FreeBSD runner): `(auth + recursive + RPZ) * (DoT) * (amd64) = 3`
- Autoscaler is not yet present on FreeBSD. Adding 3 CI jobs (i.e., DoT) run serially adds 3 hours to the pipeline runtime. Should we add just one FreeBSD DoT job to limit the runtime?
- DoH/DoT performance is slightly lower than pure TCP, so the threshold for the test to pass must be lowered by 5-10% (see isc-private/bind-qa!40).

Merge branch 'mnowak/stress-test-with-doh-dot' into 'main'

See merge request isc-projects/bind9!5800
2025-01-27 20:09:49 +00:00
Michal Nowak 9756292a5f Add DoH and DoT stress tests, generate test configurations
Add DoH and DoT stress test jobs. The DoH scenario on FreeBSD is omitted
because all Flamethrower's DoH queries timeout on this platform.

Since the response rate of DoT queries is lower than that of DoH and
TCP, the expected TCP response rate is 80%.

Due to the large number of similar stress test configurations, the
"util/generate-stress-test-configs.py" script now generates them as part
of a downstream pipeline. The script is expected to be run exclusively
within the CI environment, which sources all environmental variables and
files.

This refactoring brought the following changes:

- To start a stress test immediately and not wait for artifacts of the
  autoreconf job, run the "autoreconf -fi" command as part of every job.

- Drop the BIND_STRESS_TEST_* variables as they were rarely used and
  conflicted with mode and platform selection in the configuration
  generator.

- Most pipelines now include a few short, randomly selected stress test
  jobs. To schedule all stress tests, set the ALL_BIND_STRESS_TESTS
  environmental variable, push a tag to CI, or run a scheduled pipeline.

- Set the BIND_STRESS_TESTS_RUN_TIME environmental variable to pick the
  stress test runtime of your choosing, set the BIND_STRESS_TESTS_RATE
  environmental variable to set different than the default query rate.

- Job timeout is set to 30 minutes plus stress test runtime in minutes.
2025-01-27 16:17:39 +01:00
Colin Vidal dc3c3efdbf fix: dev: fix EDE 22 time out detection
Extended DNS error 22 (No reachable authority) was previously detected when `fctx_expired` fired. It turns out this function is used as a "safety net" and the timeout detection should be caught earlier.

It was working though, because of another issue fixed by !9927. But then, the recursive request timed out detection occurs before `fctx_expired` making impossible to raise the EDE 22 error.

This fixes the problem by triggering the EDE 22 in the part of the code detecting the (TCP or UDP) time out and taking the decision to cancel the whole fetch (i.e. There is no other server to attempt to contact).

Note this is not targeting users (no release note) because there is no release versions of BIND between !9927 and this changes. Thus a release note would be confusing.

Closes #5137

Merge branch '5137-ede22' into 'main'

See merge request isc-projects/bind9!9985
2025-01-27 11:48:49 +00:00
Colin Vidal 39c2fc4670 fix byte order in EDE logging
When an EDE code is added to a message, the code is converted early in a
big-endian order so it can be memcpy-ed directly in the EDE buffer that
will go on the wire.

This previous change forget to update debug logs which still assume the
EDE code was in host byte order. Add a separate variable to
differentiate both and avoid ambiguities
2025-01-27 11:49:44 +01:00
Colin Vidal 27f3b8950a update serve-stale test to support EDE 22
When EDE 3 (stale answer) was added the serve-stale tests were checking
for those exclusively, i.e. grepping for no "EDE" in the dig output when
no stale answer was expected.

However, some stale tests disable stale answers and make the
authoritative server unresponsive, effectively triggering a timed out
request thus an EDE 22. Update those tests so they still tests the
absence of EDE 3 error, but also the presence of EDE 22.
2025-01-27 11:49:44 +01:00
Colin Vidal 7cb8a028fe add new EDE 22 system tests
This re-do a previously existing EDE 22 system test as well as add
another one making sure the timed out flow detection works also on UDP
when the resolver is contacting the authoritative server. (the existing
test was using TCP to contact the authoritative servers).
2025-01-27 11:49:44 +01:00
Colin Vidal 78274ec2b1 fix EDE 22 time out detection
Extended DNS error 22 (No reachable authority) was previously detected
when `fctx_expired` fired. It turns out this function is used as a
"safety net" and the timeout detection should be caught earlier.

It was working though, because of another issue fixed by !9927. Since
this change, the recursive request timed out detection occurs before
`fctx_expired` so EDE 22 is not added to the response message anymore.

The fix of the problem is to add the EDE 22 code in two situations:

- When the dispatch code timed out (rctx_timedout) the resolver code
  checks various properties to figure out if it needs to make another
  fetch attempt. One of the paramters if the fetch expiration time. If
  it expires, the whole recursion is canceled, so it now adds the EDE 22
  code.

- If the fetch expiration time doesn't expires in the case above (and
  other parameters allows it) a new fetch attempt is made (fctx_query).
  But before the new request is actually made, the fetch expiration time
  is re-checked. It might then has elapsed, and the whole recursion is
  canceled. So it now also adds the EDE 22 code here as well.
2025-01-27 11:49:44 +01:00
Aydın Mercan 2bee113a46 new: usr: add a rndc command to toggle jemalloc profiling
The new command is `rndc memprof`. The memory profiling status is also
reported inside `rndc status`. The status also shows whether named can
toggle memory profiling or not and if the server is built with jemalloc.

Closes #4759

Merge branch '4759-add-a-trigger-to-dump-jeprof-data-or-memory-statistics' into 'main'

See merge request isc-projects/bind9!9370
2025-01-25 12:53:38 +00:00
Aydın Mercan b495e9918e add a rndc command to toggle jemalloc profiling
The new command is `rndc memprof`. The memory profiling status is also
reported inside `rndc status`. The status also shows whether named can
toggle memory profiling or not and if the server is built with jemalloc.
2025-01-25 14:28:41 +03:00
Nicki Křížek b9db917752 chg: ci: Ensure changelog job builds docs with the new entry
The changelog job is supposed to test that the text from GitLab MR
title&description is valid rst syntax and can be built with sphinx. In
49128fc1, the way gitchangelog generates entries was changed - it no
longer writes to the changelog file, but generates output on stdout
instead. Ensure the generated notes is actually written to (some)
rendered file which is part of the docs so that the subsequent sphinx
build attempts to render the note.

Merge branch 'nicki/ci-fix-changelog-job' into 'main'

See merge request isc-projects/bind9!9804
2025-01-24 18:10:32 +00:00
Nicki Křížek 380a30ba8d Ensure changelog job builds docs with the new entry
The changelog job is supposed to test that the text from GitLab MR
title&description is valid rst syntax and can be built with sphinx. In
49128fc1, the way gitchangelog generates entries was changed - it no
longer writes to the changelog file, but generates output on stdout
instead. Ensure the generated notes is actually written to (some)
rendered file which is part of the docs so that the subsequent sphinx
build attempts to render the note.
2025-01-24 14:48:06 +01:00
Colin Vidal 5a8fce4851 new: usr: adds support for EDE code 1 and 2
Add support for EDE codes 1 & 2 which might occurs during DNSSEC validation in case of unsupported RRSIG algorithm or DNSKEY digest.

See #2715

Merge branch '2715-ede-unsupported-digest-alg' into 'main'

See merge request isc-projects/bind9!9948
2025-01-24 13:16:56 +00:00
Colin Vidal 244923b9dc add DNSSEC EDE test for unsupported digest and alg
A DNSSEC validation can fail in the case where multiple DNSKEY are
available for a zone and none of them are supported, but for different
reasons: one has a DS record in the parent zone using an unsupported
digest while the other one uses an unsupported encryption algorithm.

Add a specific test case covering this flow and making sure that two
extended DNS error are provided: code 1 and 2, each of them highlighting
unsupported algorithm and digest.
2025-01-24 12:26:30 +00:00
Colin Vidal 8b50d63fe1 tests for support for EDE 1 & 2 2025-01-24 12:26:30 +00:00
Colin Vidal 46a58acdf5 add support for EDE code 1 and 2
Add support for EDE codes 1 (Unsupported DNSKEY Algorithm) and 2
(Unsupported DS Digest Type) which might occurs during DNSSEC
validation in case of unsupported DNSKEY algorithm or DS digest type.

Because DNSSEC internally kicks off various fetches, we need to copy
all encountered extended errors from fetch responses to the fetch
context. Upon an event, the errors from the fetch context are copied
to the client response.
2025-01-24 12:26:30 +00:00
Michal Nowak 98522ab702 new: doc: Add linkcheck to CI
Merge branch 'mnowak/rtd-add-linkcheck' into 'main'

See merge request isc-projects/bind9!9680
2025-01-24 12:00:30 +00:00
Michal Nowak 48eab76427 Add linkcheck job 2025-01-24 12:18:37 +01:00
Michal Nowak 8302469507 Fix broken links in documentation
Some detected links are not to be verified (127.*, dnssec-or-not.com)
and some I can't fix (flaticon, godaddy, icann), but they are not
crucial.
2025-01-24 12:07:36 +01:00
Michal Nowak 4dfc12cb44 chg: test: Rewrite cipher-suites system test to pytest
The minimal dnspython version to run this test is 2.5.0.

Merge branch 'mnowak/pytest_rewrite_cipher-suites' into 'main'

See merge request isc-projects/bind9!8662
2025-01-24 08:53:25 +00:00
Michal Nowak df7e9f4ac3 Rename have_* marks to with_*
Marks starting with "with" or "without" make more sense linguistically
than those starting with "have" or "have_not".
2025-01-24 08:45:51 +00:00
Nicki KřížekandMichal Nowak 23fb615963 Test cipher-suites after zone transfers complete
Ensure the zone transfers have completed (successfully or not) before
running the test cases, because they assume zone transfers have been
done.
2025-01-24 08:45:51 +00:00
Nicki KřížekandMichal Nowak a72ff9fd57 Make servers fixture in pytest module-wide
The servers are setup and torn down once per each test module. All the
logs and server state persists between individual tests within the same
module. The servers fixture representing these servers should be
module-wide as well.
2025-01-24 08:45:51 +00:00
Michal Nowak 100b759863 Rewrite cipher-suites system test to pytest
The minimal required dnspython version is 2.5.0 because of the need for
the "verify" argument in dns.query.tls().
2025-01-24 08:45:51 +00:00
Michal Nowak b2964cc922 Use Debian "sid" for pylint and mypy jobs to get recent dnspython
The base image tends to have a rather old dnspython version and when
used with pylint and mypy it produces errors about newer dnspython
features the old version does not know about.

    $ mypy "bin/tests/system/isctest/"
    bin/tests/system/isctest/query.py:55: error: Unexpected keyword argument "verify" for "tls"  [call-arg]
    /usr/lib/python3/dist-packages/dns/query.py:958: note: "tls" defined here

    $ pylint --rcfile $CI_PROJECT_DIR/.pylintrc --disable=wrong-import-position $(git ls-files 'bin/tests/system/*.py' | grep -vE 'ans\.py')
    ************* Module isctest.query
    bin/tests/system/isctest/query.py:55:11: E1123: Unexpected keyword argument 'verify' in function call (unexpected-keyword-arg)
2025-01-24 08:45:51 +00:00
Michal Nowak df8c419058 Add isctest.query.tls() function
When explicitly set to True, the "verify" argument lets dnspython verify
certificates used for the connection. As most certificates in the system
test will inevitably be self-signed, the "verify" argument defaults to
False.

The "verify" argument is present in dnspython since the version 2.5.0.
2025-01-24 08:45:51 +00:00
Michal Nowak feecbd8e77 Add "without_fips" mark
The "without_fips" mark disables test function when BIND 9 was built
with the FIPS mode enabled as not everything works in FIPS-enabled
builds.
2025-01-24 08:45:51 +00:00
Evan Hunt d3455be08c rem: dev: Clean up unused result codes
A number of result codes are obsolete and can be removed. Others, including `ISC_R_NOMEMORY`, are still checked in various places even though they can't occur any longer. These have been cleaned up.

Merge branch 'each-cleanup-results' into 'main'

See merge request isc-projects/bind9!9942
2025-01-24 00:58:06 +00:00
Evan Hunt 314741fcd0 deduplicate result codes
ISCCC_R_SYNTAX, ISCCC_R_EXPIRED, and ISCCC_R_CLOCKSKEW have the
same usage and text formats as DNS_R_SYNTAX, DNS_R_EXPIRED and
DNS_R_CLOCKSCREW respectively. this was originally done because
result codes were defined in separate libraries, and some tool
might be linked with libisccc but not libdns. as the result codes
are now defined in only one place, there's no need to retain the
duplicates.
2025-01-23 15:54:57 -08:00
Evan Hunt a19f6c6654 clean up result codes that are never used
the following result codes are obsolete and have been removed
from result.h and result.c:

        - ISC_R_NOTHREADS
        - ISC_R_BOUND
        - ISC_R_NOTBOUND
        - ISC_R_NOTDIRECTORY
        - ISC_R_EMPTY
        - ISC_R_NOTBLOCKING
        - ISC_R_INPROGRESS
        - ISC_R_WOULDBLOCK

        - DNS_R_TOOMANYHOPS
        - DNS_R_NOREDATA
        - DNS_R_BADCKSUM
        - DNS_R_MOREDATA
        - DNS_R_NOVALIDDS
        - DNS_R_UNKNOWNOPT
        - DNS_R_NOVALIDKEY
        - DNS_R_NTACOVERED

        - DST_R_COMPUTESECRETFAILURE
        - DST_R_NORANDOMNESS
        - DST_R_NOCRYPTO
2025-01-23 15:54:57 -08:00
Evan Hunt 70e3d91396 clean up uses of DST_R_NOCRYPTO
building BIND without crypto support is no longer possible.
consequently this result code is never sent, and therefore we
don't need code in calling functions to handle it.
2025-01-23 15:54:57 -08:00
Evan Hunt 10accd6260 clean up uses of ISC_R_NOMEMORY
the isc_mem allocation functions can no longer fail; as a result,
ISC_R_NOMEMORY is now rarely used: only when an external library
such as libjson-c or libfstrm could return NULL. (even in
these cases, arguably we should assert rather than returning
ISC_R_NOMEMORY.)

code and comments that mentioned ISC_R_NOMEMORY have been
cleaned up, and the following functions have been changed to
type void, since (in most cases) the only value they could
return was ISC_R_SUCCESS:

- dns_dns64_create()
- dns_dyndb_create()
- dns_ipkeylist_resize()
- dns_kasp_create()
- dns_kasp_key_create()
- dns_keystore_create()
- dns_order_create()
- dns_order_add()
- dns_peerlist_new()
- dns_tkeyctx_create()
- dns_view_create()
- dns_zone_setorigin()
- dns_zone_setfile()
- dns_zone_setstream()
- dns_zone_getdbtype()
- dns_zone_setjournal()
- dns_zone_setkeydirectory()
- isc_lex_openstream()
- isc_portset_create()
- isc_symtab_create()

(the exception is dns_view_create(), which could have returned
other error codes in the event of a crypto library failure when
calling isc_file_sanitize(), but that should be a RUNTIME_CHECK
anyway.)
2025-01-23 15:54:57 -08:00
Nicki Křížek af0a5dfeeb chg: ci: Set stricter limits for respdiff testing
Adjust the limit of maximum disagreements in respdiff results based on
recent pipeline results.

The respdiff and respdiff:asan seem to have almost identical results,
typically around 0.07 % of differences with ocassional spikes up to
around 0.11 %. Similar results are for respdiff:tsan, perhaps with more
common spikes with values up to around 0.12 %. Set the limit to 0.15 %
to allow for some tolerance due to network conditions, time of day etc.

The respdiff:third-party has a slightly higher disagreements average,
with typical values being around 0.12 %. Set the limit to 0.2 %.

Exceeding either of those values should be quite clear indication that
some resolution behaviour has changed, since the values appear to be
very stable within the newly configured limits.

Merge branch 'nicki/ci-respdiff-limits' into 'main'

See merge request isc-projects/bind9!9950
2025-01-23 17:26:40 +00:00
Nicki Křížek 0584d3f65f Set stricter limits for respdiff testing
Adjust the limit of maximum disagreements in respdiff results based on
recent pipeline results.

The respdiff and respdiff:asan seem to have almost identical results,
typically around 0.07 % of differences with ocassional spikes up to
around 0.11 %. Similar results are for respdiff:tsan, perhaps with more
common spikes with values up to around 0.12 %. Set the limit to 0.15 %
to allow for some tolerance due to network conditions, time of day etc.

The respdiff:third-party has a slightly higher disagreements average,
with typical values being around 0.12 %. Set the limit to 0.2 %.

Exceeding either of those values should be quite clear indication that
some resolution behaviour has changed, since the values appear to be
very stable within the newly configured limits.
2025-01-23 18:19:35 +01:00
Matthijs Mekking da207678f3 chg: doc: Document how secondaries refresh a zone in the ARM
Closes #5123

Merge branch '5123-document-refreshing-a-secondary' into 'main'

See merge request isc-projects/bind9!9966
2025-01-23 15:52:54 +00:00
Matthijs Mekking 8daf3782d1 Document how secondaries refresh a zone in the ARM
We have a KB article that describes this, put a condensed version into
the ARM.
2025-01-23 15:52:31 +00:00
Matthijs Mekking 417a0e331f fix: doc: Clarify dnssec-signzone interval option
There was confusion about whether the interval was calculated from
the validity period provided on the command line (with -s and -e),
or from the signature being replaced.

Add text to clarify that the interval is calculated from the new
validity period.

Closes #5128

Merge branch '5128-clarify-dnssec-signzone-interval' into 'main'

See merge request isc-projects/bind9!9955
2025-01-23 11:12:33 +00:00
Matthijs Mekking ae42fa69fa Clarify dnssec-signzone interval option
There was confusion about whether the interval was calculated from
the validity period provided on the command line (with -s and -e),
or from the signature being replaced.

Add text to clarify that the interval is calculated from the new
validity period.
2025-01-23 11:12:25 +00:00
Matthijs Mekking 8efb4e2f26 fix: usr: Fix a bug in dnssec-signzone related to keys being offline
In the case when `dnssec-signzone` is called on an already signed zone, and the private key file is unavailable, a signature that needs to be refreshed may be dropped without being able to generate a replacement. This has been fixed.

Closes #5126

Merge branch '5126-dnssec-signzone-retain-rrsig-if-key-is-offline' into 'main'

See merge request isc-projects/bind9!9951
2025-01-23 10:36:15 +00:00
Matthijs Mekking 5e3aef364f dnssec-signzone retain signature if key is offline
Track inside the dns_dnsseckey structure whether we have seen the
private key, or if this key only has a public key file.

If the key only has a public key file, or a DNSKEY reference in the
zone, mark the key 'pubkey'. In dnssec-signzone, if the key only
has a public key available, consider the key to be offline. Any
signatures that should be refreshed for which the key is not available,
retain the signature.

So in the code, 'expired' becomes 'refresh', and the new 'expired'
is only used to determine whether we need to keep the signature if
the corresponding key is not available (retaining the signature if
it is not expired).

In the 'keysthatsigned' function, we can remove:
  -	key->force_publish = false;
  -	key->force_sign = false;

because they are redundant ('dns_dnsseckey_create' already sets these
values to false).
2025-01-23 09:43:07 +00:00
Matthijs Mekking 0a91321d78 Test dnssec-signzone with private key file missing
Add a test case for the scenario below.

There is a case when signing a zone with dnssec-signzone where the
private key file is moved outside the key directory (for offline
ksk purposes), and then the zone is resigned. The signature of the
DNSKEY needs refreshing, but is not expired.

Rather than removing the signature without having a valid replacement,
leave the signature in the zone (despite it needs to be refreshed).
2025-01-23 09:43:07 +00:00
Matthijs Mekking eec0aaa391 fix: dev: Fix possible truncation in dns_keymgr_status()
If the generated status output exceeds 4096 it was silently truncated, now we output that the status was truncated.

Closes #4180

Merge branch '4180-possible-truncation-in-dns_keymgr_status' into 'main'

See merge request isc-projects/bind9!9905
2025-01-23 09:40:05 +00:00
Matthijs Mekking 7ae7851173 Fix possible truncation in dns_keymgr_status()
If the generated status output exceeds 4096 it was silently truncated,
now we output that the status was truncated.
2025-01-23 09:31:00 +01:00
Mark Andrews e57ebb8f1b fix: usr: Yaml string not terminated in negative response in delv
Closes #5098

Merge branch '5098-missing-yaml-string-termination-delv' into 'main'

See merge request isc-projects/bind9!9922
2025-01-22 23:55:50 +00:00
Mark Andrews 9c04640def Check delv +yaml negative response output 2025-01-22 21:33:08 +00:00
Mark Andrews 89afc11389 Terminate yaml string after negative comment 2025-01-22 21:33:08 +00:00
Colin Vidal 076e47b427 new: usr: Add support for multiple extended DNS errors
Extended DNS error mechanism (EDE) may have several errors raised during a DNS resolution. `named` is now able to add up to three EDE codes in a DNS response. In the case of duplicate error codes, only the first one will be part of the DNS response.

Closes #5085

Merge branch '5085-multiple-ede' into 'main'

See merge request isc-projects/bind9!9952
2025-01-22 21:32:28 +00:00
Colin Vidal 950a0cffb3 add unit tests covering multiple EDE support 2025-01-22 21:07:44 +01:00
Colin Vidal 4096f27130 add support for multiple EDE
Extended DNS error mechanism (EDE) enables to have several EDE raised
during a DNS resolution (typically, a DNSSEC query will do multiple
fetches which each of them can have an error). Add support to up to 3
EDE errors in an DNS response. If duplicates occur (two EDEs with the
same code, the extra text is not compared), only the first one will be
part of the DNS answer.

Because the maximum number of EDE is statically fixed, `ns_client_t`
object own a static vector of `DNS_DE_MAX_ERRORS` (instead of a linked
list, for instance). The array can be fully filled (all slots point to
an allocated `dns_ednsopt_t` object) or partially filled (or
empty). In such case, the first NULL slot means there is no more EDE
objects.
2025-01-22 21:07:44 +01:00
Arаm Sаrgsyаn 66d4f9184a chg: dev: Use a suitable response in tcp_connected() when initiating a read
When 'ISC_R_TIMEDOUT' is received in 'tcp_recv()', it times out the
oldest response in the active responses queue, and only after that it
checks whether other active responses have also timed out. So when
setting a timeout value for a read operation after a successful
connection, it makes sense to take the timeout value from the oldest
response in the active queue too, because, theoretically, the responses
can have different timeout values, e.g. when the TCP dispatch is shared.
Currently 'resp' is always NULL. Previously when connect and read timeouts
were not separated in dispatch this affected only logging, but now since
we are setting a new timeout after a successful connection, we need to
choose a suitable response from the active queue.

Merge branch 'aram/dispatch-tcp_connected-fix' into 'main'

See merge request isc-projects/bind9!9927
2025-01-22 13:41:25 +00:00
Aram Sargsyan a6d6c3cb45 Clean up fctx->next_timeout
Since the support for non-zero values of stale-answer-client-timeout
was removed in bd7463914f, 'next_timeout'
is unused. Clean it up.
2025-01-22 13:40:45 +00:00
Aram Sargsyan 5367ccb561 Adjust the resolver-query-timeout test
Since the read timeout now works, the resolver time outs from the
dispatch level instead of from the "hung fetch" timer, and so the
EDE value in 'fctx_expired()' is not being set. Remove the expected
EDE value from the test.
2025-01-22 13:40:45 +00:00
Aram Sargsyan 87c453850c Fix rtt calculation bug for TCP in the resolver
When TCP is used, 'fctx_query()' adds one second to the rtt
(round-trip time) value, but there's a bug when the decision
about using TCP is made already after the calculation. Move the
block of the code which looks up the peers list to decide
whether to use TCP into a place that's before the rtt calculation
is performed. This commit doesn't add or remove any code, it just
moves the code and adds a comment block.
2025-01-22 13:40:45 +00:00
Aram Sargsyan e61ba5865f Use a suitable response in tcp_connected() when initiating a read
When 'ISC_R_TIMEDOUT' is received in 'tcp_recv()', it times out the
oldest response in the active responses queue, and only after that it
checks whether other active responses have also timed out. So when
setting a timeout value for a read operation after a successful
connection, it makes sense to take the timeout value from the oldest
response in the active queue too, because, theoretically, the responses
can have different timeout values, e.g. when the TCP dispatch is shared.
Currently 'resp' is always NULL. Previously when connect and read
timeouts were not separated in dispatch this affected only logging, but
now since we are setting a new timeout after a successful connection,
we need to choose a suitable response from the active queue.
2025-01-22 13:40:45 +00:00
Ondřej Surý 48471fd50c fix: usr: Avoid unnecessary locking in the zone/cache database
Prevent lock contention among many worker threads referring to the same database node at the same time.  This would improve zone and cache database performance for the heavily contended database nodes.

Closes #5130

Merge branch '5130-reduce-lock-contention-in-decrement-reference' into 'main'

See merge request isc-projects/bind9!9963
2025-01-22 13:27:40 +00:00
JINMEI TatuyaandOndřej Surý 7f4471594d Optimize database decref by avoiding locking with refs > 1
Previously, this function always acquires a node write lock if it
might need node cleanup in case the reference decrements to 0.  In
fact, the lock is unnecessary if the reference is larger than 1 and it
can be optimized as an "easy" case. This optimization could even be
"necessary". In some extreme cases, many worker threads could repeat
acquring and releasing the reference on the same node, resulting in
severe lock contention for nothing (as the ref wouldn't decrement to 0
in most cases). This change would prevent noticeable performance
drop like query timeout for such cases.

Co-authored-by: JINMEI Tatuya <jtatuya@infoblox.com>
Co-authored-by: Ondřej Surý <ondrej@isc.org>
2025-01-22 14:27:13 +01:00
Ondřej Surý 3fe440f0cf chg: dev: Shutdown the fetch context after canceling the last fetch
Shutdown the fetch context immediately after the last fetch has been canceled from
that particular fetch context.

Merge branch 'ondrej/shutdown-the-fetch-context-early' into 'main'

See merge request isc-projects/bind9!9958
2025-01-22 13:21:23 +00:00
Ondřej Surý 9f945c8b67 Shutdown the fetch context after canceling the last fetch
Currently, the fetch context will continue running even when the last
fetch (response) has been removed from the context, so named can process
and cache the answer.  This can lead to a situation where the number of
outgoing recursing clients exceeds the the configured number for
recursive-clients.

Be more stringent about the recursive-clients limit and shutdown the
fetch context immediately after the last fetch has been canceled from
that particular fetch context.
2025-01-22 14:19:20 +01:00
Ondřej Surý 0673568c17 fix: usr: Apply the memory limit only to ADB database items
Resolver under heavy-load could exhaust the memory available for storing
the information in the Address Database (ADB) effectively evicting already
stored information in the ADB.  The memory used to retrieve and provide
information from the ADB is now not a subject of the same memory limits
that are applied for storing the information in the Address Database.

Closes #5127

Merge branch '5127-change-ADB-memory-split' into 'main'

See merge request isc-projects/bind9!9954
2025-01-22 13:14:40 +00:00
Ondřej Surý 05faff6d53 Remove memory limit on ADB finds and fetches
Address Database (ADB) shares the memory for the short lived ADB
objects (finds, fetches, addrinfo) and the long lived ADB
objects (names, entries, namehooks).  This could lead to a situation
where the resolver-heavy load would force evict ADB objects from the
database to point where ADB is completely empty, leading to even more
resolver-heavy load.

Make the short lived ADB objects use the other memory context that we
already created for the hashmaps.  This makes the ADB overmem condition
to not be triggered by the ongoing resolver fetches.
2025-01-22 14:13:35 +01:00
Arаm Sаrgsyаn 3f490fe3fb chg: dev: Separate the connect and the read TCP timeouts in dispatch
The network manager layer has two different timers with their
own timeout values for TCP connections: connect timeout and read
timeout. Separate the connect and the read TCP timeouts in the
dispatch module too.

Closes #5009

Merge branch '5009-dispatch-separate-connect-and-read-timeouts' into 'main'

See merge request isc-projects/bind9!9698
2025-01-22 12:58:29 +00:00
Aram Sargsyan 612d76b83d Remove dispatch timeout INT16_MAX limitation
In some places there was a limitation of the maximum timeout
value of INT16_MAX, which is only about 32 seconds. Refactor
the code to remove the limitation.
2025-01-22 11:57:53 +00:00
Aram Sargsyan 64ffbe82c0 Separate the connect and the read timeouts in dispatch
The network manager layer has two different timers with their
own timeout values for TCP connections: connect timeout and read
timeout. Separate the connect and the read TCP timeouts in the
dispatch module too.
2025-01-22 11:57:52 +00:00
Aram Sargsyan 114555ea65 dispatch_test: make client timeouts shorter
Use shorter timeouts for the client to ensure that the clients
time out before the server.
2025-01-22 11:52:24 +00:00
Aram Sargsyan 9ccd1be482 Update the dns_dispatch_add() function's documentation
The 'timedout' callback no longer exists. Remove the mentioning of
the 'timedout' callback.
2025-01-22 11:52:24 +00:00
Colin Vidal 65c557c536 new: nil: ignore TAGS files
Merge branch 'colin/ignoreTAGS' into 'main'

See merge request isc-projects/bind9!9956
2025-01-22 11:22:41 +00:00
Colin Vidal 2164ea8abd ignore TAGS files
TAGS file are generated from `make tags` using etags. Other index tags
are already ignored (GTAGS, GPATH, etc.). Also ignoring `TAGS`.
2025-01-22 10:42:35 +00:00
Colin Vidal 1732346fcc rem: dev: remove fields from struct fetchctx
struct fetchctx does have several fields which are now unused or confusing, removing those.

Merge branch 'colin/remove-fctx-validator' into 'main'

See merge request isc-projects/bind9!9945
2025-01-22 10:31:22 +00:00
Colin Vidal c9529c0acb remove ISC_LINK(link) property from fetchctx
Likely because of historical reasons, struct fetchctx does have a list
link property but is never used as a list. Remove this link property.
2025-01-22 09:56:09 +00:00
Colin Vidal 93e6e72eb6 remove validator link form fetchctx
struct fetchctx does have a list of pending validators as well as a
pointer to the HEAD validator. Remove the validator pointer to avoid
confusion, as there is no perticular reasons to have it directly
accessible outside of the list.
2025-01-22 09:56:09 +00:00
Andoni Duarte 87b0c1c1a0 chg: doc: Set up version for BIND 9.21.5
Merge branch 'andoni/set-up-version-for-bind-9.21.5' into 'main'

See merge request isc-projects/bind9!9968
2025-01-22 08:33:12 +00:00
Andoni Duarte Pintado bdef1e2176 Update BIND version to 9.21.5-dev 2025-01-21 15:58:51 +01:00
Nicki Křížek 0f626b8cc3 Update BIND version for release 2025-01-20 13:54:00 +01:00
Nicki Křížek 4a0a598cc2 new: doc: Prepare documentation for BIND 9.21.4
Merge branch 'andoni/prepare-documentation-for-bind-9.21.4' into 'v9.21.4-release'

See merge request isc-private/bind9!772
2025-01-20 12:52:22 +00:00
Michał Kępień 70187b67ae Reorder release notes 2025-01-17 22:53:57 +01:00
Michał Kępień e9003901a7 Add release note for GL #5099 2025-01-17 22:53:57 +01:00
Andoni Duarte PintadoandMichał Kępień fa4c45d9e8 Tweak and reword release notes 2025-01-17 22:53:57 +01:00
Andoni Duarte PintadoandMichał Kępień 84f36eaa83 Fix broken option reference in the ARM 2025-01-17 22:53:57 +01:00
Andoni Duarte Pintado 0937207606 Prepare release notes for BIND 9.21.4 2025-01-16 10:39:11 +01:00
Andoni Duarte Pintado b6ccbcbcf1 Generate changelog for BIND 9.21.4 2025-01-16 10:20:01 +01:00
Andoni Duarte bddaff3210 [CVE-2024-12705] sec: usr: DNS-over-HTTP(s) flooding fixes
Fix DNS-over-HTTP(S) implementation issues that arise under heavy
query load. Optimize resource usage for :iscman:`named` instances
that accept queries over DNS-over-HTTP(S).

Previously, :iscman:`named` would process all incoming HTTP/2 data
at once, which could overwhelm the server, especially when dealing
with clients that send requests but don't wait for responses. That
has been fixed. Now, :iscman:`named` handles HTTP/2 data in smaller
chunks and throttles reading until the remote side reads the
response data. It also throttles clients that send too many requests
at once.

Additionally, :iscman:`named` now carefully processes data sent by
some clients, which can be considered "flooding." It logs these
clients and drops connections from them.
:gl:`#4795`

In some cases, :iscman:`named` could leave DNS-over-HTTP(S)
connections in the `CLOSE_WAIT` state indefinitely. That also has
been fixed. ISC would like to thank JF Billaud for thoroughly
investigating the issue and verifying the fix.
:gl:`#5083`

See https://gitlab.isc.org/isc-projects/bind9/-/issues/4795

Closes https://gitlab.isc.org/isc-projects/bind9/-/issues/5083

Merge branch 'artem-improve-doh-resource-usage' into 'v9.21.4-release'

See merge request isc-private/bind9!732
2025-01-15 14:42:44 +00:00
Artem BoldarievandAndoni Duarte 937b5f8349 DoH: reduce excessive bad request logging
We started using isc_nm_bad_request() more actively throughout
codebase. In the case of HTTP/2 it can lead to a large count of
useless "Bad Request" messages in the BIND log, as often we attempt to
send such request over effectively finished HTTP/2 sessions.

This commit fixes that.
2025-01-15 14:09:17 +00:00
Artem BoldarievandAndoni Duarte 4ae4e255cf Do not stop timer in isc_nm_read_stop() in manual timer mode
A call to isc_nm_read_stop() would always stop reading timer even in
manual timer control mode which was added with StreamDNS in mind. That
looks like an omission that happened due to how timers are controlled
in StreamDNS where we always stop the timer before pausing reading
anyway (see streamdns_on_complete_dnsmessage()). That would not work
well for HTTP, though, where we might want pause reading without
stopping the timer in the case we want to split incoming data into
multiple chunks to be processed independently.

I suppose that it happened due to NM refactoring in the middle of
StreamDNS development (at the time isc_nm_cancelread() and
isc_nm_pauseread() were removed), as the StreamDNS code seems to be
written as if timers are not stoping during a call to
isc_nm_read_stop().
2025-01-15 14:09:17 +00:00
Artem BoldarievandAndoni Duarte 609a41517b DoH: introduce manual read timer control
This commit introduces manual read timer control as used by StreamDNS
and its underlying transports. Before that, DoH code would rely on the
timer control provided by TCP, which would reset the timer any time
some data arrived. Now, the timer is restarted only when a full DNS
message is processed in line with other DNS transports.

That change is required because we should not stop the timer when
reading from the network is paused due to throttling. We need a way to
drop timed-out clients, particularly those who refuse to read the data
we send.
2025-01-15 14:09:17 +00:00
Artem BoldarievandAndoni Duarte 3425e4b1d0 DoH: floodding clients detection
This commit adds logic to make code better protected against clients
that send valid HTTP/2 data that is useless from a DNS server
perspective.

Firstly, it adds logic that protects against clients who send too
little useful (=DNS) data. We achieve that by adding a check that
eventually detects such clients with a nonfavorable useful to
processed data ratio after the initial grace period. The grace period
is limited to processing 128 KiB of data, which should be enough for
sending the largest possible DNS message in a GET request and then
some. This is the main safety belt that would detect even flooding
clients that initially behave well in order to fool the checks server.

Secondly, in addition to the above, we introduce additional checks to
detect outright misbehaving clients earlier:

The code will treat clients that open too many streams (50) without
sending any data for processing as flooding ones; The clients that
managed to send 1.5 KiB of data without opening a single stream or
submitting at least some DNS data will be treated as flooding ones.
Of course, the behaviour described above is nothing else but
heuristical checks, so they can never be perfect. At the same time,
they should be reasonable enough not to drop any valid clients,
realatively easy to implement, and have negligible computational
overhead.
2025-01-15 14:09:17 +00:00
Artem BoldarievandAndoni Duarte 9846f395ad DoH: process data chunk by chunk instead of all at once
Initially, our DNS-over-HTTP(S) implementation would try to process as
much incoming data from the network as possible. However, that might
be undesirable as we might create too many streams (each effectively
backed by a ns_client_t object). That is too forgiving as it might
overwhelm the server and trash its memory allocator, causing high CPU
and memory usage.

Instead of doing that, we resort to processing incoming data using a
chunk-by-chunk processing strategy. That is, we split data into small
chunks (currently 256 bytes) and process each of them
asynchronously. However, we can process more than one chunk at
once (up to 4 currently), given that the number of HTTP/2 streams has
not increased while processing a chunk.

That alone is not enough, though. In addition to the above, we should
limit the number of active streams: these streams for which we have
received a request and started processing it (the ones for which a
read callback was called), as it is perfectly fine to have more opened
streams than active ones. In the case we have reached or surpassed the
limit of active streams, we stop reading AND processing the data from
the remote peer. The number of active streams is effectively decreased
only when responses associated with the active streams are sent to the
remote peer.

Overall, this strategy is very similar to the one used for other
stream-based DNS transports like TCP and TLS.
2025-01-15 14:09:17 +00:00
Andoni Duarte 4d054cca7a [CVE-2024-11187] sec: usr: Limit the additional processing for large RDATA sets
When answering queries, don't add data to the additional section if the answer has more than 13 names in the RDATA. This limits the number of lookups into the database(s) during a single client query, reducing query processing load.

See isc-projects/bind9#5034

Merge branch '5034-security-limit-additional' into 'v9.21.4-release'

See merge request isc-private/bind9!750
2025-01-15 11:56:06 +00:00
Ondřej SurýandAndoni Duarte a1982cf1bb Limit the additional processing for large RDATA sets
Limit the number of records appended to ADDITIONAL section to the names
that have less than 14 records in the RDATA.  This limits the number
of the lookups into the database(s) during single client query.

Also don't append any additional data to ANY queries.  The answer to ANY
is already big enough.
2025-01-14 09:57:54 +00:00
Ondřej SurýandAndoni Duarte e51d4d3b88 Isolate using the -T noaa flag only for part of the resolver test
Instead of running the whole resolver/ns4 server with -T noaa flag,
use it only for the part where it is actually needed.  The -T noaa
could interfere with other parts of the test because the answers don't
have the authoritative-answer bit set, and we could have false
positives (or false negatives) in the test because the authoritative
server doesn't follow the DNS protocol for all the tests in the resolver
system test.
2025-01-14 09:57:54 +00:00
Ondřej SurýandAndoni Duarte 8356179953 Rename the qpzone and qpcache methods that implement DB api
All the database implementations share the same names for the methods
implementing the database.  That has some advantages like knowing what
to expect, but it turns out that any time such method shows up in any
kind of tracing - be it perf record, backtrace or anything else that
uses symbol names, it is very hard to distinguish whether the find()
belongs to qpcache, qpzone, builtin or sdlz implementation.

Make at least the names for qpzone and qpcache unique.
2025-01-14 09:57:54 +00:00
Nicki Křížek 3a94afa03a fix: usr: querying an NSEC3-signed zone for an empty record could trigger an assertion
A bug in the qpzone database could trigger a crash when querying for a deleted name, or a newly-added empty non-terminal name, in an NSEC3-signed zone. This has been fixed.

Closes #5108

Merge branch '5108-nsec3-empty-node' into 'main'

See merge request isc-projects/bind9!9928
2025-01-14 08:34:16 +00:00
Evan Hunt 232dac8cd5 detect when closest-encloser name is too long
there was a database bug in which dns_db_find() could get a partial
match for the query name, but still set foundname to match the full
query name.  this triggered an assertion when query_addwildcardproof()
assumed that foundname would be shorter.

the database bug has been fixed, but in case it happens again, we
can just copy the name instead of splitting it. we will also log a
warning that the closest-encloser name was invalid.
2025-01-09 17:04:08 -08:00
Evan Hunt 71e1c91695 dns_nsec3_addnsec3() can fail when iterating back
when adding a new NSEC3 record, dns_nsec3_addnsec3() uses a
dbiterator to seek to the newly created node and then find its
predecessor.  dbiterators in the qpzone use snapshots, so changes
to the database are not reflected in an already-existing iterator.
consequently, when we add a new node, we have to create a new iterator
before we can seek to it.
2025-01-09 17:04:08 -08:00
Evan Hunt 3e367a23f9 add a regression test for a new ENT node
this test adds a record with empty non-terminal nodes above it. this
has also been observed to trigger the crash in NSEC3 zones.

NOTE: the test currently fails, because while there is no crash, the
query results are not as expected.  when we add a node below an ENT,
receive_secure_serial() gets DNS_R_PARTIALMATCH, and the signed
zone is never updated. this is not a regression from fixing the
crash bug; it's a separate inline-signing bug.
2025-01-09 17:03:51 -08:00
Evan Hunt 7b94c34965 add a regression test for record deletion
test that there's no crash when querying for a newly-deleted node.

(incidentally also renamed ns3/named.conf.in to ns3/named1.conf.in,
because named2.conf.in does exist, and they should match.)
2025-01-09 17:03:51 -08:00
Evan Hunt ad4bab306c qpzone find() function could set foundname incorrectly
when a requested name is found in the QP trie during a lookup, but its
records have been marked as nonexistent by a previous deletion, then
it's treated as a partial match, but the foundname could be left
pointing to the original qname rather than the parent. this could
lead to an assertion failure in query_findclosestnsec3().
2025-01-09 17:03:51 -08:00
Michał Kępień 9636dc1a1e fix: nil: Fix default IANA root zone mirror configuration
Closes #5115

Merge branch '5115-fix-default-iana-root-zone-mirror-configuration' into 'main'

See merge request isc-projects/bind9!9934
2025-01-09 11:22:07 +00:00
Michał Kępień 010d2eb436 Fix default IANA root zone mirror configuration
Commit b121f02eac renamed the top-level
"primaries" block in bin/named/config.c to "remote-servers".  This
configuration block lists the primary servers used for an IANA root zone
mirror when no primary servers are explicitly specified for it in the
configuration.  However, the relevant part of the named_zone_configure()
function only looks for a top-level "primaries" block and not for any of
its synonyms.  As a result, configuring an IANA root zone mirror with
just:

    zone "." {
        type mirror;
    };

now results in a cryptic fatal error on startup:

    loading configuration: not found
    exiting (due to fatal error)

Fix by using the correct top-level block name in named_zone_configure().
2025-01-09 12:16:48 +01:00
Arаm Sаrgsyаn 19a2aab136 fix: usr: Fix response policy zones and catalog zones with an $INCLUDE statement defined
Response policy zones (RPZ) and catalog zones were not working correctly if they had an $INCLUDE statement defined. This has been fixed.

Closes #5111

Merge branch '5111-includes-disable-rpz-and-catz-fix' into 'main'

See merge request isc-projects/bind9!9930
2025-01-08 14:01:36 +00:00
Aram Sargsyan d75bdabe51 Fix a typo in dns/master.h
The ISC_R_SEENINCLUDE definition does not exist, the correct one
is DNS_R_SEENINCLUDE.
2025-01-08 14:00:55 +00:00
Aram Sargsyan 3d7a9fba3b Don't disable RPZ and CATZ for zones with an $INCLUDE statement
The code in zone_startload() disables RPZ and CATZ for a zone if
dns_master_loadfile() returns anything other than ISC_R_SUCCESS,
which makes sense, but it's an error because zone_startload() can
also return DNS_R_SEENINCLUDE upon success when the zone had an
$INCLUDE statement.
2025-01-08 14:00:55 +00:00
Nicki Křížek e71549eaba new: ci: Add shotgun perf test of DoH GET to CI
Add performance tests of DoH using the GET protocol to nightly pipelines.

Merge branch 'nicki/ci-shotgun-doh-get' into 'main'

See merge request isc-projects/bind9!9926
2025-01-08 13:43:40 +00:00
Nicki Křížek 32c5f24713 Add shotgun perf test of DoH GET to CI 2025-01-08 12:45:48 +00:00
Michal Nowak b1b004ed01 fix: test: Fix "checking startup notify rate limit" fails on OL 8 FIPS
Adjust number of zones down to 23 to match those present when testing in FIPS mode.

Closes #5097

Merge branch '5097-checking-startup-notify-rate-limit-fails-on-ol-8-fips' into 'main'

See merge request isc-projects/bind9!9919
2025-01-02 15:32:55 +00:00
Mark AndrewsandMichal Nowak 17804f5154 Adjust number of zones to those in FIPS mode 2025-01-02 14:38:24 +00:00
Michał Kępień 6230bc883a new: dev: Log both "from" and "to" socket in debug messages
Debug messages logging network traffic now include information about both sides of each communication channel rather than just one of them.

Closes #4345

Merge branch '4345-log-both-from-and-to-socket-in-debug-messages' into 'main'

See merge request isc-projects/bind9!8349
2024-12-31 04:42:41 +00:00
Michał Kępień dd2c509521 Account for revised log messages in test code
Adjust test code so that it expects the extended output that the
dns_message_logpacketfromto() function now emits.
2024-12-31 05:40:48 +01:00
Michał Kępień 7bdf5152d6 Adjust dns_message_logpacketfrom() log prefixes
Ensure the log prefixes passed to the dns_message_logpacketfrom()
function by its callers do not include the word "from" as the latter is
now emitted by the logfmtpacket() helper function.
2024-12-31 05:40:48 +01:00
Michał Kępień 58d38352ee Adjust dns_message_logpacketfromto() log prefixes
Ensure the log prefixes passed to the dns_message_logpacketfromto()
function by its callers do not include the words "from" or "to" as those
are now emitted by the logfmtpacket() helper function.
2024-12-31 05:40:48 +01:00
Michał Kępień c5555a5ca2 Log both "from" and "to" socket in debug messages
Move dns_dispentry_getlocaladdress() calls around so that they are not
only invoked when dnstap support is compiled in.  This function calls
isc_nmhandle_localaddr(), which may issue a system call, but only if the
ISC_SOCKET_DETAILS preprocessor macro is set at compile time.

Pass the value extracted by dns_dispentry_getlocaladdress() to
dns_message_logpacketfromto() so that it gets logged, adding useful
information to the relevant debug messages.
2024-12-31 05:40:48 +01:00
Michał Kępień 4ab35f6839 Rename dns_message_logpacket()
Since dns_message_logpacket() only takes a single socket address as a
parameter (and it is always the sending socket's address), rename it to
dns_message_logpacketfrom() so that its name better conveys its purpose
and so that the difference in purpose between this function and
dns_message_logpacketfromto() becomes more apparent.
2024-12-31 05:40:48 +01:00
Michał Kępień fa073a0a63 Rename dns_message_logfmtpacket()
Since dns_message_logfmtpacket() needs to be provided with both "from"
and "to" socket addresses, rename it to dns_message_logpacketfromto() so
that its name better conveys its purpose.  Clean up the code comments
for that function.
2024-12-31 05:40:48 +01:00
Michał Kępień bafa5d3c2e Enable logging both "from" and "to" socket
Change the function prototype for dns_message_logfmtpacket() so that it
takes two isc_sockaddr_t parameters: one for the sending side and
another one for the receiving side.  This enables debug messages to be
more precise.

Also adjust the function prototype for logfmtpacket() accordingly.
Unlike dns_message_logfmtpacket(), this function must not require both
'from' and 'to' parameters to be non-NULL as it is still going to be
used by dns_message_logpacket(), which only provides a single socket
address.  Adjust its log format to handle both of these cases properly.

Adjust both dns_message_logfmtpacket() call sites accordingly, without
actually providing the second socket address yet.  (This causes the
revised REQUIRE() assertion in dns_message_logfmtpacket() to fail; the
issue will be addressed in a separate commit.)
2024-12-31 05:40:48 +01:00
Michał Kępień 05d69bd7a4 dns_message_logfmtpacket(): drop 'style' parameter
Both existing callers of the dns_message_logfmtpacket() function set the
argument passed as 'style' to &dns_master_style_comment.  To simplify
these call sites, drop the 'style' parameter from the prototype for
dns_message_logfmtpacket() and use a fixed value of
&dns_master_style_comment in the function's body instead.
2024-12-31 05:40:48 +01:00
Michał Kępień 064b2c6889 logfmtpacket(): drop useless local variables
All callers of the logfmtpacket() helper function require the argument
passed as 'address' to be non-NULL.  Meanwhile, the 'newline' and
'space' local variables in logfmtpacket() are only set to values
different than their initial values if the 'address' parameter is NULL.
Replace the 'newline' and 'space' local variables in logfmtpacket() with
fixed strings to improve code readability.
2024-12-31 05:40:48 +01:00
Michał Kępień 44d5dbeab6 new: dev: Enable extraction of exact local socket addresses
Enable extracting the exact address/port that a local wildcard/TCP socket is bound to, improving the accuracy of dnstap logging and providing more information in debug logs produced by system tests.  Since this requires issuing an extra system call on some hot paths, this new feature is only enabled when the ``ISC_SOCKET_DETAILS`` preprocessor macro is set at compile time.

Closes #4344

Merge branch '4344-enable-extraction-of-exact-local-socket-addresses' into 'main'

See merge request isc-projects/bind9!8348
2024-12-31 04:40:12 +00:00
Michał Kępień d6f9785ac6 Enable extraction of exact local socket addresses
Extracting the exact address that each wildcard/TCP socket is bound to
locally requires issuing the getsockname() system call, which libuv
exposes via its uv_*_getsockname() functions.  This is only required for
detailed logging and comes at a noticeable performance cost, so it
should not happen by default.  However, it is useful for debugging
certain problems (e.g. cryptic system test failures), so a convenient
way of enabling that behavior should exist.

Update isc_nmhandle_localaddr() so that it calls uv_*_getsockname() when
the ISC_SOCKET_DETAILS preprocessor macro is set at compile time.
Ensure proper handling of sockets that wrap other sockets.

Set the new ISC_SOCKET_DETAILS macro by default when --enable-developer
is passed to ./configure.  This enables detailed logging in the system
tests run in GitLab CI without affecting performance in non-development
BIND 9 builds.

Note that setting the ISC_SOCKET_DETAILS preprocessor macro at compile
time enables all callers of isc_nmhandle_localaddr() to extract the
exact address of a given local socket, which results e.g. in dnstap
captures containing more accurate information.

Mention the new preprocessor macro in the section of the ARM that
discusses why exact socket addresses may not be logged by default.
2024-12-29 12:32:05 +01:00
Michał Kępień dc90e977fc chg: nil: Improve reuse of outgoing TCP connections
This MR is a prerequisite for !8348.

It intentionally does not have a changelog entry associated with it, to
prevent making a false impression of improving connection reuse **for
existing code**.  It will only make a difference once !8348 gets merged
(and even then, only if the new `ISC_SOCKET_DETAILS` macro will be set
during build).  That's because `isc_nmhandle_localaddr()` currently
simply returns `handle->local` and its return value will only be set to
the actual address the socket is bound to with !8348 in place.

Note that `dns_dispatch_gettcp()` is currently only used by the
`dns_request` API, so this MR's potential for introducing new breakage
is relatively low.

Closes #4693

Merge branch '4693-improve-reuse-of-outgoing-tcp-connections' into 'main'

See merge request isc-projects/bind9!8972
2024-12-29 11:31:29 +00:00
Michał Kępień 086c325ad3 Improve reuse of outgoing TCP connections
The dns_dispatch_gettcp() function is used for finding an existing TCP
connection that can be reused for sending a query from a specified local
address to a specified remote address.  The logic for matching the
provided <local address, remote address> tuple to one of the existing
TCP connections is implemented in the dispatch_match() function:

  - if the examined TCP connection already has a libuv handle assigned,
    it means the connection has already been established; therefore,
    compare the provided <local address, remote address> tuple against
    the corresponding address tuple for the libuv handle associated with
    the connection,

  - if the examined TCP connection does not yet have a libuv handle
    assigned, it means the connection has not yet been established;
    therefore, compare the provided <local address, remote address>
    tuple against the corresponding address tuple that the TCP
    connection was originally created for.

This logic limits TCP connection reuse potential as the libuv handle
assigned to an existing dispatch object may have a more specific local
<address, port> tuple associated with it than the local <address, port>
tuple that the dispatch object was originally created for.  That's
because the local address for outgoing connections can be set to a
wildcard <address, port> tuple (indicating that the caller does not care
what source <address, port> tuple will be used for establishing the
connection, thereby delegating the task of picking it to the operating
system) and then get "upgraded" to a specific <address, port> tuple when
the socket is bound (and a libuv handle gets associated with it).  When
another dns_dispatch_gettcp() caller then tries to look for an existing
TCP connection to the same peer and passes a wildcard address in the
local part of the tuple, the function will not match that request to a
previously-established TCP connection (unless isc_nmhandle_localaddr()
returns a wildcard address as well).

Simplify dispatch_match() so that the libuv handle associated with an
existing dispatch object is not examined for the purpose of matching it
to the provided <local address, remote address> tuple; instead, always
examine the <local address, remote address> tuple that the dispatch
object was originally created for.  This enables reuse of TCP
connections created without providing a specific local socket address
while still preventing other connections (created for a specific local
socket address) from being inadvertently shared.
2024-12-29 10:22:20 +01:00
Artem Boldariev 6eb77ed2b0 chg: dev: Add TLS SNI extension to all outgoing TLS connections
This change ensures that SNI extension is used in outgoing connections over TLS (e.g. for DoT and DoH) when applicable.

Closes #5099

Merge branch 'artem-outgoing-tls-sni-support' into 'main'

See merge request isc-projects/bind9!9923
2024-12-26 15:57:10 +00:00
Artem Boldariev 740292d3ec BIND - enable TLS SNI support for outgoing TLS connections
This commit ensures that BIND enables TLS SNI support for outgoing DoT
connections (when possible) in order to improve compatibility with
other DNS server software.
2024-12-26 17:23:25 +02:00
Artem Boldariev e04fb30ee6 Dig - enable TLS SNI support
This commit ensures that dig enables TLS SNI support for outgoing
connections in order to improve compatibility with other DNS server
software.
2024-12-26 17:23:19 +02:00
Artem Boldariev 6691a1530d TLS SNI - add low level support for SNI to the networking code
This commit adds support for setting SNI hostnames in outgoing
connections over TLS.

Most of the changes are related to either adapting the code to accept
and extra argument in *connect() functions and a couple of changes to
the TLS Stream to actually make use of the new SNI hostname
information.
2024-12-26 17:23:12 +02:00
Ondřej Surý 6ce55429f1 fix: dev: Use CMM_{STORE,LOAD}_SHARED to store/load glue in gluelist
ThreadSanitizer has trouble understanding that gluelist->glue is
constant after it is assigned to the slabheader with cmpxchg.  Help
ThreadSanitizer to understand the code by using CMM_STORE_SHARED and
CMM_LOAD_SHARED on gluelist->glue.

Merge branch 'ondrej/hint-tsan-in-addglue' into 'main'

See merge request isc-projects/bind9!9929
2024-12-25 15:06:09 +00:00
Ondřej Surý f7316b44b9 Use CMM_{STORE,LOAD}_SHARED to store/load glue in gluelist
ThreadSanitizer has trouble understanding that gluelist->glue is
constant after it is assigned to the slabheader with cmpxchg.  Help
ThreadSanitizer to understand the code by using CMM_STORE_SHARED and
CMM_LOAD_SHARED on gluelist->glue.

The ThreadSanitizer report:

    WARNING: ThreadSanitizer: data race
      Read of size 8 at 0x000000000001 by thread T0001:
	#0 addglue lib/dns/qpzone.c:5304 (BuildId: 62aa74b0423f77cc56d705f02c2412b4762577cb)
	#1 dns_db_addglue lib/dns/db.c:1119 (BuildId: 62aa74b0423f77cc56d705f02c2412b4762577cb)
	#2 query_additional lib/ns/query.c:2230 (BuildId: 9cc0711aeddfa6164f4f6fd94b0187f7bfa13ff2)
	#3 query_addrrset lib/ns/query.c:2324
	#4 query_prepare_delegation_response lib/ns/query.c:8595 (BuildId: 9cc0711aeddfa6164f4f6fd94b0187f7bfa13ff2)
	#5 query_delegation lib/ns/query.c:8780 (BuildId: 9cc0711aeddfa6164f4f6fd94b0187f7bfa13ff2)
	#6 query_notfound lib/ns/query.c:8552 (BuildId: 9cc0711aeddfa6164f4f6fd94b0187f7bfa13ff2)
	#7 query_gotanswer lib/ns/query.c:7553 (BuildId: 9cc0711aeddfa6164f4f6fd94b0187f7bfa13ff2)
	#8 query_lookup lib/ns/query.c:6020 (BuildId: 9cc0711aeddfa6164f4f6fd94b0187f7bfa13ff2)
	#9 ns__query_start lib/ns/query.c:5690 (BuildId: 9cc0711aeddfa6164f4f6fd94b0187f7bfa13ff2)
	#10 query_setup lib/ns/query.c:5239 (BuildId: 9cc0711aeddfa6164f4f6fd94b0187f7bfa13ff2)
	#11 ns_query_start lib/ns/query.c:11979 (BuildId: 9cc0711aeddfa6164f4f6fd94b0187f7bfa13ff2)
	#12 ns_client_request_continue lib/ns/client.c:2466 (BuildId: 9cc0711aeddfa6164f4f6fd94b0187f7bfa13ff2)
	#13 ns_client_request lib/ns/client.c:2142 (BuildId: 9cc0711aeddfa6164f4f6fd94b0187f7bfa13ff2)
	#14 isc___nm_readcb netmgr/netmgr.c:1859 (BuildId: de1ebc9b2642ead6bbd0f4553c7144c016b01ffc)
	#15 isc__nm_readcb netmgr/netmgr.c:1874
	#16 isc__nm_udp_read_cb netmgr/udp.c:589 (BuildId: de1ebc9b2642ead6bbd0f4553c7144c016b01ffc)
	#17 uv__udp_recvmmsg src/unix/udp.c:202 (BuildId: 355edf0d38120d6761c51ee8cab2c162dff57b0a)
	#18 uv__udp_recvmsg src/unix/udp.c:245 (BuildId: 355edf0d38120d6761c51ee8cab2c162dff57b0a)
	#19 uv__udp_io src/unix/udp.c:142
	#20 uv__io_poll src/unix/linux.c:1564 (BuildId: 355edf0d38120d6761c51ee8cab2c162dff57b0a)
	#21 uv_run src/unix/core.c:458 (BuildId: 355edf0d38120d6761c51ee8cab2c162dff57b0a)
	#22 loop_thread lib/isc/loop.c:328 (BuildId: de1ebc9b2642ead6bbd0f4553c7144c016b01ffc)
	#23 thread_body lib/isc/thread.c:85 (BuildId: de1ebc9b2642ead6bbd0f4553c7144c016b01ffc)
	#24 thread_run lib/isc/thread.c:100

      Previous write of size 8 at 0x000000000001 by thread T0002:
	#0 create_gluelist lib/dns/qpzone.c:5253 (BuildId: 62aa74b0423f77cc56d705f02c2412b4762577cb)
	#1 addglue lib/dns/qpzone.c:5281
	#2 dns_db_addglue lib/dns/db.c:1119 (BuildId: 62aa74b0423f77cc56d705f02c2412b4762577cb)
	#3 query_additional lib/ns/query.c:2230 (BuildId: 9cc0711aeddfa6164f4f6fd94b0187f7bfa13ff2)
	#4 query_addrrset lib/ns/query.c:2324
	#5 query_prepare_delegation_response lib/ns/query.c:8595 (BuildId: 9cc0711aeddfa6164f4f6fd94b0187f7bfa13ff2)
	#6 query_delegation lib/ns/query.c:8780 (BuildId: 9cc0711aeddfa6164f4f6fd94b0187f7bfa13ff2)
	#7 query_notfound lib/ns/query.c:8552 (BuildId: 9cc0711aeddfa6164f4f6fd94b0187f7bfa13ff2)
	#8 query_gotanswer lib/ns/query.c:7553 (BuildId: 9cc0711aeddfa6164f4f6fd94b0187f7bfa13ff2)
	#9 query_lookup lib/ns/query.c:6020 (BuildId: 9cc0711aeddfa6164f4f6fd94b0187f7bfa13ff2)
	#10 ns__query_start lib/ns/query.c:5690 (BuildId: 9cc0711aeddfa6164f4f6fd94b0187f7bfa13ff2)
	#11 query_setup lib/ns/query.c:5239 (BuildId: 9cc0711aeddfa6164f4f6fd94b0187f7bfa13ff2)
	#12 ns_query_start lib/ns/query.c:11979 (BuildId: 9cc0711aeddfa6164f4f6fd94b0187f7bfa13ff2)
	#13 ns_client_request_continue lib/ns/client.c:2466 (BuildId: 9cc0711aeddfa6164f4f6fd94b0187f7bfa13ff2)
	#14 ns_client_request lib/ns/client.c:2142 (BuildId: 9cc0711aeddfa6164f4f6fd94b0187f7bfa13ff2)
	#15 isc___nm_readcb netmgr/netmgr.c:1859 (BuildId: de1ebc9b2642ead6bbd0f4553c7144c016b01ffc)
	#16 isc__nm_readcb netmgr/netmgr.c:1874
	#17 isc__nm_udp_read_cb netmgr/udp.c:589 (BuildId: de1ebc9b2642ead6bbd0f4553c7144c016b01ffc)
	#18 uv__udp_recvmmsg src/unix/udp.c:202 (BuildId: 355edf0d38120d6761c51ee8cab2c162dff57b0a)
	#19 uv__udp_recvmsg src/unix/udp.c:245 (BuildId: 355edf0d38120d6761c51ee8cab2c162dff57b0a)
	#20 uv__udp_io src/unix/udp.c:142
	#21 uv__io_poll src/unix/linux.c:1564 (BuildId: 355edf0d38120d6761c51ee8cab2c162dff57b0a)
	#22 uv_run src/unix/core.c:458 (BuildId: 355edf0d38120d6761c51ee8cab2c162dff57b0a)
	#23 loop_thread lib/isc/loop.c:328 (BuildId: de1ebc9b2642ead6bbd0f4553c7144c016b01ffc)
	#24 thread_body lib/isc/thread.c:85 (BuildId: de1ebc9b2642ead6bbd0f4553c7144c016b01ffc)
	#25 thread_run lib/isc/thread.c:100

      Location is heap block of size 88 at 0x000000000024 allocated by thread T0002:
	#0 malloc <null> (BuildId: c08afb1c60772d9b4e4d4be38d0c0434c5b41990)
	#1 mallocx lib/isc/jemalloc_shim.h:41 (BuildId: de1ebc9b2642ead6bbd0f4553c7144c016b01ffc)
	#2 mem_get lib/isc/mem.c:303
	#3 isc__mem_get lib/isc/mem.c:654
	#4 new_gluelist lib/dns/qpzone.c:5012 (BuildId: 62aa74b0423f77cc56d705f02c2412b4762577cb)
	#5 create_gluelist lib/dns/qpzone.c:5241
	#6 addglue lib/dns/qpzone.c:5281
	#7 dns_db_addglue lib/dns/db.c:1119 (BuildId: 62aa74b0423f77cc56d705f02c2412b4762577cb)
	#8 query_additional lib/ns/query.c:2230 (BuildId: 9cc0711aeddfa6164f4f6fd94b0187f7bfa13ff2)
	#9 query_addrrset lib/ns/query.c:2324
	#10 query_prepare_delegation_response lib/ns/query.c:8595 (BuildId: 9cc0711aeddfa6164f4f6fd94b0187f7bfa13ff2)
	#11 query_delegation lib/ns/query.c:8780 (BuildId: 9cc0711aeddfa6164f4f6fd94b0187f7bfa13ff2)
	#12 query_notfound lib/ns/query.c:8552 (BuildId: 9cc0711aeddfa6164f4f6fd94b0187f7bfa13ff2)
	#13 query_gotanswer lib/ns/query.c:7553 (BuildId: 9cc0711aeddfa6164f4f6fd94b0187f7bfa13ff2)
	#14 query_lookup lib/ns/query.c:6020 (BuildId: 9cc0711aeddfa6164f4f6fd94b0187f7bfa13ff2)
	#15 ns__query_start lib/ns/query.c:5690 (BuildId: 9cc0711aeddfa6164f4f6fd94b0187f7bfa13ff2)
	#16 query_setup lib/ns/query.c:5239 (BuildId: 9cc0711aeddfa6164f4f6fd94b0187f7bfa13ff2)
	#17 ns_query_start lib/ns/query.c:11979 (BuildId: 9cc0711aeddfa6164f4f6fd94b0187f7bfa13ff2)
	#18 ns_client_request_continue lib/ns/client.c:2466 (BuildId: 9cc0711aeddfa6164f4f6fd94b0187f7bfa13ff2)
	#19 ns_client_request lib/ns/client.c:2142 (BuildId: 9cc0711aeddfa6164f4f6fd94b0187f7bfa13ff2)
	#20 isc___nm_readcb netmgr/netmgr.c:1859 (BuildId: de1ebc9b2642ead6bbd0f4553c7144c016b01ffc)
	#21 isc__nm_readcb netmgr/netmgr.c:1874
	#22 isc__nm_udp_read_cb netmgr/udp.c:589 (BuildId: de1ebc9b2642ead6bbd0f4553c7144c016b01ffc)
	#23 uv__udp_recvmmsg src/unix/udp.c:202 (BuildId: 355edf0d38120d6761c51ee8cab2c162dff57b0a)
	#24 uv__udp_recvmsg src/unix/udp.c:245 (BuildId: 355edf0d38120d6761c51ee8cab2c162dff57b0a)
	#25 uv__udp_io src/unix/udp.c:142
	#26 uv__io_poll src/unix/linux.c:1564 (BuildId: 355edf0d38120d6761c51ee8cab2c162dff57b0a)
	#27 uv_run src/unix/core.c:458 (BuildId: 355edf0d38120d6761c51ee8cab2c162dff57b0a)
	#28 loop_thread lib/isc/loop.c:328 (BuildId: de1ebc9b2642ead6bbd0f4553c7144c016b01ffc)
	#29 thread_body lib/isc/thread.c:85 (BuildId: de1ebc9b2642ead6bbd0f4553c7144c016b01ffc)
	#30 thread_run lib/isc/thread.c:100

      Thread T0001 'isc-loop-0002' (running) created by main thread at:
	#0 pthread_create <null> (BuildId: c08afb1c60772d9b4e4d4be38d0c0434c5b41990)
	#1 isc_thread_create lib/isc/thread.c:139 (BuildId: de1ebc9b2642ead6bbd0f4553c7144c016b01ffc)
	#2 isc_loopmgr_run lib/isc/loop.c:508 (BuildId: de1ebc9b2642ead6bbd0f4553c7144c016b01ffc)
	#3 main bin/named/main.c:1532 (BuildId: d03d7837520674921fd1fe7c353cb790cab69b3b)

      Thread T0002 'isc-loop-0003' (running) created by main thread at:
	#0 pthread_create <null> (BuildId: c08afb1c60772d9b4e4d4be38d0c0434c5b41990)
	#1 isc_thread_create lib/isc/thread.c:139 (BuildId: de1ebc9b2642ead6bbd0f4553c7144c016b01ffc)
	#2 isc_loopmgr_run lib/isc/loop.c:508 (BuildId: de1ebc9b2642ead6bbd0f4553c7144c016b01ffc)
	#3 main bin/named/main.c:1532 (BuildId: d03d7837520674921fd1fe7c353cb790cab69b3b)

    SUMMARY: ThreadSanitizer: data race lib/dns/qpzone.c:5304 in addglue
2024-12-25 15:06:01 +00:00
Ondřej Surý 1fea227ab8 chg: dev: Detect and possibly define constexpr using Autoconf
Previously, we had an ISC_CONSTEXPR macro that was expanded to either
`constexpr` or `static const`, depending on compiler support.  To make
the code cleaner, move `constexpr` support detection to Autoconf; if
`constexpr` support is missing from the compiler, define `constexpr` as
`static const` in config.h.

Merge branch 'ondrej/rename-ISC_CONSTEXPR-to-constexpr-shim' into 'main'

See merge request isc-projects/bind9!9924
2024-12-25 14:22:27 +00:00
Ondřej Surý 7b26becec0 Detect and possibly define constexpr using Autoconf
Previously, we had an ISC_CONSTEXPR macro that was expanded to either
`constexpr` or `static const`, depending on compiler support.  To make
the code cleaner, move `constexpr` support detection to Autoconf; if
`constexpr` support is missing from the compiler, define `constexpr` as
`static const` in config.h.
2024-12-25 15:21:26 +01:00
Ondřej Surý 8d9bc93e81 rem: dev: Remove C++ support from the public header
Since BIND 9 headers are not longer public, there's no reason to keep
the ISC_LANG_BEGINDECL and ISC_LANG_ENDDECL macros to support including
them from C++ projects.

Merge branch 'ondrej/remove-C++-header-support' into 'main'

See merge request isc-projects/bind9!9925
2024-12-18 16:34:37 +00:00
Ondřej Surý 06f9163d51 Remove C++ support from the public header
Since BIND 9 headers are not longer public, there's no reason to keep
the ISC_LANG_BEGINDECL and ISC_LANG_ENDDECL macros to support including
them from C++ projects.
2024-12-18 13:10:39 +01:00
Ondřej Surý e2c1941efd fix: usr: Resolve the spurious drops in performance due GLUE cache
For performance reasons, the returned GLUE records are cached on the first use.  The current implementation could randomly cause a performance drop and increased memory use.  This has been fixed.

Closes #5064

Merge branch '5064-rewrite-glue-cache-in-qpzone' into 'main'

See merge request isc-projects/bind9!9831
2024-12-13 23:11:04 +00:00
Ondřej Surý 29bde687b5 Rewrite the GLUE cache in QP zone database
This is a second attempt to rewrite the GLUE cache to not use per
database version hash table.  Instead of keeping a hash table indexed by
the node, use a directly linked list of GLUE records for each
slabheader.  This was attempted before, but there was a data race caused
by the fact that the thread cleaning the GLUE records could be slower
than accessing the slab headers again and reinitializing the wait-free
stack.

The improved design builds on the previous design, but adds a new
dns_gluelist structure that has a pointer to the database version.

If a dns_gluelist belonging to a different (old) version is detected, it
is just detached from the slabheader and left for the closeversion() to
clean it up later.
2024-12-13 21:48:11 +01:00
Ondřej Surý 759d59801b Revert "Fix the glue table in the QP and RBT zone databases"
This reverts commit 5beae5faf9.
2024-12-13 21:48:11 +01:00
Michal Nowak f379e1bef9 fix: test: Various coccinelle fixes
Merge branch 'mnowak/cocci-more-set-if-not-null-changes' into 'main'

See merge request isc-projects/bind9!9836
2024-12-13 13:48:20 +00:00
Michal Nowak cf76851c75 Drop superfluous isc_mem_get() NULL check
coccinelle v1.1 trips over a superfluous isc_mem_get() NULL check in
tests/libtest/ns.c and reports the following failure in CI:

    EXN: Failure("rule starting on line 26: already tagged token:\nC code context\nFile \"./tests/libtest/ns.c\", line 350, column 1, charpos = 7939\n  around = 'if',\n  whole content = \tif (qctx != NULL) {") in ./tests/libtest/ns.c
2024-12-13 13:52:52 +01:00
Michal Nowak 7f55041426 Move coccinelle job to "sid" image
The "sid" image has newer coccinelle 1.2 that identifies more issues.
2024-12-13 13:52:52 +01:00
Michal Nowak 7fb6be62e0 Disable unsigned-int spatch in models.c and sdlz.c
coccinelle v1.1 reports the following failure:

    EXN: Failure("./lib/dns/sdlz.c: 172: try to delete an expanded token: unsigned") in ./lib/dns/sdlz.c

coccinelle v1.2 reports the following failure:

    EXN: Failure("./util/models.c: 21: try to delete an expanded token: unsigned") in ./util/models.c
2024-12-13 13:52:52 +01:00
Michal Nowak 57b64dc397 Apply more SET_IF_NOT_NULL() changes
coccinelle v1.2 found more cases where the SET_IF_NOT_NULL macro
applies.
2024-12-13 13:52:52 +01:00
Matthijs Mekking f4377a3cd6 rem: dev: Remove DLV remnants
DLV is long gone, so we can remove design documentation around DLV, related command line options (that were already a hard failure), and some DLV related test remnants.

Merge branch 'matthijs-remove-dlv-remnants' into 'main'

See merge request isc-projects/bind9!9888
2024-12-13 11:00:54 +00:00
Matthijs Mekking 32f8f6237c Remove DLV remnants
DLV is long gone, so we can remove design documentation around DLV,
related command line options (that were already a hard failure),
and some DLV related test remnants.
2024-12-13 11:24:47 +01:00
Andoni Duarte Pintado 3fa50a98a2 Merge tag 'v9.21.3' 2024-12-13 10:53:33 +01:00
Matthijs Mekking 858ba71eaf chg: usr: The configuration clauses parental-agents and primaries are renamed to remote-servers
The top blocks 'primaries' and 'parental-agents' are no longer preferred and should be renamed to 'remote-servers'. The zone statements 'parental-agents' and 'primaries' are still used, and may refer to any 'remote-servers' top block.

Closes #4544

Merge branch '4544-primaries-block-documentation-issues' into 'main'

See merge request isc-projects/bind9!9822
2024-12-13 09:10:56 +00:00
Matthijs Mekking 726c9cd73b Rename remote-servers standard term to server-list
The 'remote-servers' named.conf reference conflicts with the standard
term from the glossary. Rename the standard term to server-list to
make the docs build.
2024-12-13 08:50:02 +01:00
Matthijs Mekking 1b2eadb197 Add primaries, parental-agents as synonyms
Add back the top blocks 'parental-agents', 'primaries', and 'masters'
to the configuration. Do not document them as so many names for the
same clause is confusing.

This has a slight negative side effect that a top block 'primaries'
can be referred to with a zone statement 'parental-agents' for example,
but that shouldn't be a big issue.
2024-12-13 08:50:02 +01:00
Matthijs Mekking b121f02eac Unify parental-agents, primaries to remote-servers
Having zone statements that are also top blocks is confusing, and if
we want to add more in the future (which I suspect will be for
generalized notifications, multi-signer), we need to duplicate a lot
of code.

Remove top blocks 'parental-agents' and 'primaries' and just have one
top block 'remote-servers' that you can refer to with zone statements.
2024-12-13 08:50:02 +01:00
Mark Andrews 0d5b8bfd40 fix: test: Fix "checking startup notify rate limit" failure
Fix the loop terminating condition to get consistent sample sizes and increase the minimum number of samples from 20 to 40.

Closes #5091

Merge branch '5091-investigate-checking-startup-notify-rate-limit-failure' into 'main'

See merge request isc-projects/bind9!9894
2024-12-13 00:07:23 +00:00
Mark Andrews 46388d07a2 Fix startup notify rate test
The terminating conditions for the startup notify test would
occasionally get ~20 records or get +10 seconds of records due to
a bad terminating condition.  Additionally 20 samples lead to test
failures.  Fix the terminating condition to use the correct conditional
(-eq -> -ge) and increase the minimum number of log entries to
average over to 40.
2024-12-12 23:35:30 +00:00
Mark Andrews b0eb3ca9d2 fix: test: tests/irs/resconf_test.c is missing check callbacks
Closes #5088

Merge branch '5088-tests-irs-resconf_test-c-is-missing-check-callbacks' into 'main'

See merge request isc-projects/bind9!9884
2024-12-12 22:49:50 +00:00
Mark Andrews b711b5b10d Move resconf_test.c to tests/dns and cleanup 2024-12-12 22:16:36 +00:00
Mark Andrews c38eb87158 Check that nameservers are parsed correctly
Add checks that the expected nameservers where actuall addes when
parsing resolv.conf.
2024-12-12 22:16:36 +00:00
Michal Nowak 1a670a4963 fix: ci: Disable tracing otherwise gcovr fails
Merge branch 'mnowak/gcovr-disable-tracing' into 'main'

See merge request isc-projects/bind9!9809
2024-12-12 14:51:52 +00:00
Michal Nowak 7048b3ab0d Disable tracing for gcovr-enabled builds
gcovr has issues with processing files produced as part of a BIND 9
build with tracing support enabled (--enable-tracing).  Depending on the
gcovr version used, these issues may result in either warnings or
failures being reported by that tool.  Disable tracing support for
gcovr-enabled builds to work around these issues.
2024-12-12 15:49:37 +01:00
Nicki Křížek 8240781cce chg: doc: Update CONTRIBUTING.md and developer docs
Include the recent changes such as:
- changes to running system tests
- gitlab development workflow
- changelog and release note process

Closes #5045

Merge branch '5045-update-contributing' into 'main'

See merge request isc-projects/bind9!9784
2024-12-12 12:45:40 +00:00
Nicki Křížek 39485c1f70 Update CONTRIBUTING.md and developer doc
Include the recent changes such as:
- changes to running system tests
- gitlab development workflow
- changelog and release note process
2024-12-12 12:45:31 +00:00
Michal Nowak d3765a5f35 fix: test: Wait for "all zones loaded" after rndc reload in "database" test
After the rndc reload command finished, we might have queried the
database zone sooner than it was reloaded because rndc reloads zones
asynchronously if no specific zone was provided. We should wait for "all
zones loaded" in the ns1 log to be sure.

Closes #5075

Merge branch '5075-database-rndc-reload-ensure-all-zones-loaded' into 'main'

See merge request isc-projects/bind9!9829
2024-12-12 12:08:13 +00:00
Michal Nowak 0bdd03db66 Wait for "all zones loaded" after rndc reload in "database" test
After the rndc reload command finished, we might have queried the
database zone sooner than it was reloaded because rndc reloads zones
asynchronously if no specific zone was provided. We should wait for "all
zones loaded" in the ns1 log to be sure.
2024-12-12 12:07:37 +00:00
Evan Hunt 2bce06e170 rem: usr: Remove 'sortlist' option
The `sortlist` option, which was deprecated in BIND 9.20, has now been removed.

Closes #4665

Merge branch '4665-remove-sortlist' into 'main'

See merge request isc-projects/bind9!9839
2024-12-12 02:35:18 +00:00
Evan Hunt 3394aa9c25 remove "sortlist"
this commit removes the deprecated "sortlist" option. the option
is now marked as ancient; it is a fatal error to use it in
named.conf.

the sortlist system test has been removed, and other tests that
referenced the option have been modified.

the enabling functions, dns_message_setsortorder() and
dns_rdataset_towiresorted(), have also been removed.
2024-12-11 15:09:24 -08:00
Mark Andrews ef6dc36e53 new: usr: Add "Zone has [AAAA/A] records but is not served by IPv[6/4]" warnings
Check that zones with AAAA records are served by IPv6 servers and that zones with A records are served by IPv4 servers.
Sometimes, IPv6 services are accidentally misconfigured and zones with IPv6 (AAAA) address records are not served by DNS servers with IPv6 addresses, which means they need to use translation devices to look up those IPv6 addresses. The reverse is also sometimes true: zones with A records are not resolvable over IPv4 when they should be.
To prevent this, BIND now looks for these misconfigured zones and issues a warning if they are found.

Closes #4370

Merge branch '4370-check-that-a-zone-is-served-by-ipv6-servers-if-it-has-aaaa-records' into 'main'

See merge request isc-projects/bind9!8393
2024-12-11 22:06:34 +00:00
Mark Andrews 673e966d37 Check "records but is not served by" warnings
This checks that "zone has A records but is not served by IPv4
servers" and "zone has AAAA records but is not served by IPv6
servers" are emitted when they should be and not when they shouldn't
be.
2024-12-11 21:32:21 +00:00
Mark Andrews 6d44e7320e Check that a zone that serves A/AAAA is served over IPv4/IPv6
named-checkzone will now, as part of the zone's integrity checks,
look to see if there are A or AAAA records being served and if so
check that the nameservers have A or AAAA records respectively.

These are a sometimes overlooked checks that, if not met, can mean
that a service that is supposed to reachable over IPv6 will not be
resolvable when the recursive resolver is IPv6 only.  Similarly for
IPv4 servers when there are IPv4 only resolvers.
2024-12-11 21:32:21 +00:00
Evan Hunt 3db39ec7ad fix: dev: clean up incorrect logging module names
Some files used logmodule names that had been copied in from elsewhere; these have now been given module names of their own. Also, the RBT and RBTDB logmodules have been removed, since they are now unused.

Merge branch 'each-cleanup-logmodules' into 'main'

See merge request isc-projects/bind9!9895
2024-12-11 17:12:18 +00:00
Evan Hunt 95a0b6f479 clean up log module names
- remove obsolete DNS_LOGMODULE_RBT and DNS_LOGMODULE_RBTDB
- correct the misuse of the wrong log modules in dns/rpz.c and
  dns/catz.c, and add DNS_LOGMODULE_RPZ and DNS_LOGMODULE_CATZ
  to support them.
2024-12-11 17:11:32 +00:00
Matthijs Mekking 9de6b228d4 rem: usr: Remove trusted-keys and managed-keys options
These options have been deprecated in 9.19 in favor of the 'trust-anchors' option and are now being removed.

Closes #5080

Merge branch '5080-remove-trusted-and-managed-keys' into 'main'

See merge request isc-projects/bind9!9855
2024-12-11 13:39:02 +00:00
Matthijs Mekking b6ca209292 Remove trusted-keys and managed-keys options
These options have been deprecated in 9.19 in favor of the trust-anchors
option. They are now removed to clean up the configuration and the code.
2024-12-11 14:04:37 +01:00
Evan Hunt 819a69219a fix: nil: update style guideline to reflect current practice
The style guide now mentions clang-format, doesn't parenthesize return values, and no longer calls for backward compatibility in public function names.

Merge branch 'each-style-update' into 'main'

See merge request isc-projects/bind9!9892
2024-12-11 03:39:21 +00:00
Evan Hunt 9f7314eaa4 update style guideline to reflect current practice
It now mentions clang-format, doesn't parenthesize return values,
and no longer calls for backward compatibility in public function names.
2024-12-10 19:26:56 -08:00
Ondřej Surý d71869d6a7 fix: dev: mark loop as shuttingdown earlier in shutdown_cb
Merge branch 'loop-shuttingdown' into 'main'

See merge request isc-projects/bind9!9827
2024-12-10 19:51:20 +00:00
Pavel BřezinaandOndřej Surý 67e21d94d4 mark loop as shuttingdown earlier in shutdown_cb
`shutdown_trigger_close_cb` is not called in the main loop since
queued events in the `loop->async_trigger`, including loop teardown
(shutdown_server) are processed first, before the `uv_close` callback
is executed..

In order to pass the information to the queued events, it is necessary
to set the flag earlier in the process and not wait for the `uv_close`
callback to trigger.
2024-12-10 19:18:49 +00:00
Michal Nowak a61910bdca fix: test: Add rr-related common test artifacts
Merge branch 'mnowak/add-rr-related-common-artifacts' into 'main'

See merge request isc-projects/bind9!9830
2024-12-10 17:40:35 +00:00
Michal Nowak c607237b77 Add rr-related common test artifacts 2024-12-10 17:31:35 +01:00
Michal Nowak 4fd57cb91e fix: ci: Set cross-version-config-tests to allow_failure in CI
Address failing cross-version-config-tests job.

Closes #5087

Merge branch 'mnowak/cross-version-config-tests-allow-fail' into 'main'

See merge request isc-projects/bind9!9833
2024-12-10 09:54:02 +00:00
Michal Nowak 97a9d7287c Set cross-version-config-tests to allow_failure in CI
The December releases suffer from the ns2/managed1.conf file not being
in the mkeys extra_artifacts. This manifests only when pytest is run
with the --setup-only option, which is the case in the
cross-version-config-tests CI job. The original issue is fixed in !9815,
but the fix will be effective only when subsequent releases are out.

The #4666 issue removed the "fixed" value for the "rrset-order" option
which is still present in the December release system test and which the
current named can't handle. This will be addressed when when the January
9.21 release is published.

The #4482 issue removed the "dnssec-must-be-secure" feature.
2024-12-10 10:36:06 +01:00
Matthijs Mekking f6ff4fff85 rem: dev: Drop single-use RETERR macro
If the RETERR define is only used once in a file, just drop the macro.

Merge branch 'matthijs-remove-single-use-define-reterr' into 'main'

See merge request isc-projects/bind9!9871
2024-12-10 08:46:29 +00:00
Matthijs Mekking b6d031462f Drop single-use RETERR macro
If the RETERR define is only used once in a file, just drop the macro.
2024-12-10 08:46:22 +00:00
Mark Andrews 8460716dfe chg: test: Use a different burst name to identify test queries
This allows easier identification of which burst is which in
named.run.

Merge branch 'marka-use-different-burst-name-for-forensics' into 'main'

See merge request isc-projects/bind9!9881
2024-12-10 05:52:45 +00:00
Mark Andrews e02d66b279 Use a different burst name to identify test queries
This allows easier identification of which burst is which in
named.run.
2024-12-10 14:30:18 +11:00
Mark Andrews 1ce80d633a fix: test: Fix static stub subtest description
This subtest exercises static stub behaviour when server-addresses has an address.  This was misidentified in the description.

Closes !9799

Merge branch 'marka-fix-stub-subtest-description' into 'main'

See merge request isc-projects/bind9!9799
2024-12-10 03:15:53 +00:00
Mark Andrews f173a01454 Fix static stub subtest description 2024-12-10 02:43:13 +00:00
Mark Andrews eda02dc342 fix: dev: Accept resolv.conf with more than 8 search domains
Closes #1259

Merge branch '1259-irs-search-unlimited' into 'main'

See merge request isc-projects/bind9!2446
2024-12-10 01:39:04 +00:00
Petr MenšíkandMark Andrews e7ddd3d7b4 Remove artificial search limit from libirs
Search directive from resolv.conf had a maximum of 8 domains. Any
more were ignored. Do not ignore them anymore; iterate over any
number of domains.

Test resolv.conf support by checking the first and last domain in
the search list. Ignore the domains between; just ensure that the
last domain in the configuration is the last domain parsed.
2024-12-10 00:51:56 +00:00
Mark Andrews 48901ef57e fix: usr: Unknown directive in resolv.conf not handled properly
The line after an unknown directive in resolv.conf could accidentally be skipped, potentially affecting dig, host, nslookup, nsupdate, or delv. This has been fixed.

Closes #5084

Merge branch '5084-plain-unknown-keyword-in-resolv-conf-not-handled-propely' into 'main'

See merge request isc-projects/bind9!9865
2024-12-10 00:45:44 +00:00
Mark AndrewsandEvan Hunt c44c4fcbfb Extend resconf_test
Update to the new unit test framework.

Add a test for an unknown directive without any arguments.

Add test for an unknown directive without arguments, followed
by a search directive.
2024-12-09 16:09:12 -08:00
Mark AndrewsandEvan Hunt eb78ad2080 Fix parsing of unknown directives in resolv.conf
Only call eatline() to skip to the next line if we're not
already at the end of a line when parsing an unknown directive.
We were accidentally skipping the next line when there was only
a single unknown directive on the current line.
2024-12-09 16:08:06 -08:00
Michal Nowak 713357456f new: test: Add Fedora 41
Prereq: isc-projects/images!345

Merge branch 'mnowak/fedora-41' into 'main'

See merge request isc-projects/bind9!9612
2024-12-09 17:19:26 +00:00
Michal Nowak 66fddf812f Add Fedora 41 2024-12-09 17:27:13 +01:00
Michal Nowak d22e7a8849 Add Alpine Linux 3.21
Prereq: isc-projects/images!359

Merge branch 'mnowak/alpine-3.21' into 'main'

See merge request isc-projects/bind9!9872
2024-12-09 16:25:12 +00:00
Michal Nowak 6340454ea7 Add Alpine Linux 3.21 2024-12-09 16:35:59 +01:00
Michal Nowak 107e869362 new: ci: Add FreeBSD 14.2
Merge branch 'mnowak/freebsd-14.2' into 'main'

See merge request isc-projects/bind9!9838
2024-12-09 13:35:30 +00:00
Michal Nowak a5628101ee Add FreeBSD 14.2 2024-12-09 14:34:43 +01:00
Ondřej Surý f5f792f1ed rem: usr: Remove dnssec-must-be-secure feature
Closes #4482

Merge branch '4482-remove-dnssec-must-be-secure-feature' into 'main'

See merge request isc-projects/bind9!9851
2024-12-09 12:10:48 +00:00
Ondřej Surý 2089996f96 Replace remaining usage of DNS_R_MUSTBESECURE with DNS_R_NOVALIDSIG
The DNS_R_MUSTBESECURE lost its meaning with removal of
dnssec-must-be-secure option, so replace the few remaining (and a bit
confusing) use of this result code with DNS_R_NOVALIDSIG.
2024-12-09 13:10:21 +01:00
Ondřej Surý dcd1f5b842 Remove dnssec-must-be-secure feature
The dnssec-must-be-secure feature was added in the early days of BIND 9
and DNSSEC and it makes sense only as a debugging feature.  There are no
reasons to keep this feature in the production code anymore.

Remove the feature to simplify the code.
2024-12-09 13:10:21 +01:00
Ondřej Surý 5bee088dd1 rem: usr: Remove fixed value for the rrset-order option
Remove the "fixed" value from the "rrset-order" option and from the
autoconf script.

Closes #4666

Merge branch '4666-remote-rrset-order-fixed' into 'main'

See merge request isc-projects/bind9!9852
2024-12-09 12:09:36 +00:00
Ondřej Surý 64b5c2a743 Remove fixed value for the rrset-order option
Remove the "fixed" value from the "rrset-order" option and from the
autoconf script.
2024-12-09 13:09:26 +01:00
Michal Nowak 707dded979 fix: usr: disable deterministic ecdsa for fips builds
FIPS 186-5 [1] allows the usage deterministic ECDSA (Section 6.3) which
is compabile with RFC 6979 [2] but OpenSSL seems to follow FIPS 186-4
(Section 6.3) [3] which only allows for random k values, failing
k value generation for OpenSSL >=3.2. [4]

Fix signing by not using deterministic ECDSA when FIPS mode is active.

[1]: https://nvlpubs.nist.gov/nistpubs/FIPS/NIST.FIPS.186-5.pdf
[2]: https://datatracker.ietf.org/doc/html/rfc6979
[3]: https://nvlpubs.nist.gov/nistpubs/FIPS/NIST.FIPS.186-4.pdf
[4]: https://github.com/openssl/openssl/blob/85f17585b0d8b55b335f561e2862db14a20b1e64/crypto/ec/ecdsa_ossl.c#L201-L207

Closes #5072

Merge branch '5072-the-ecdsa_determinism_test-check-fails-on-ol-9-5-fips' into 'main'

See merge request isc-projects/bind9!9808
2024-12-09 11:55:53 +00:00
Aydın MercanandMichal Nowak 8d093a6b66 disable deterministic ecdsa for fips builds
FIPS 186-5 [1] allows the usage deterministic ECDSA (Section 6.3) which
is compabile with RFC 6979 [2] but OpenSSL seems to follow FIPS 186-4
(Section 6.3) [3] which only allows for random k values, failing
k value generation for OpenSSL >=3.2. [4]

Fix signing by not using deterministic ECDSA when FIPS mode is active.

[1]: https://nvlpubs.nist.gov/nistpubs/FIPS/NIST.FIPS.186-5.pdf
[2]: https://datatracker.ietf.org/doc/html/rfc6979
[3]: https://nvlpubs.nist.gov/nistpubs/FIPS/NIST.FIPS.186-4.pdf
[4]: https://github.com/openssl/openssl/blob/85f17585b0d8b55b335f561e2862db14a20b1e64/crypto/ec/ecdsa_ossl.c#L201-L207
2024-12-09 10:33:01 +00:00
Matthijs Mekking 6306031409 chg: dev: Use query counters in validator code
Commit af7db89513 as part of #4141 was supposed to apply the 'max-recursion-queries' quota to validator queries, but the counter was never actually passed on to 'dns_resolver_createfetch()'. This has been fixed, and the global query counter ('max-query-count', per client request) is now also added.

Related to #4980

Merge branch '4980-pass-counters-in-validator-createfetch' into 'main'

See merge request isc-projects/bind9!9856
2024-12-09 10:31:24 +00:00
Matthijs Mekking 5b1ae4a948 Use query counters in validator code
Commit af7db89513 as part of #4141 was
supposed to apply the 'max-recursion-queries' quota to validator
queries, but the counter was never actually passed on to
dns_resolver_createfetch(). This has been fixed, and the global query
counter ('max-query-count', per client request) is now also added.
2024-12-09 10:55:32 +01:00
Ondřej Surý 9428077f48 chg: dev: Update picohttpparser.{c,h} with upstream repository
Closes #4485

Merge branch '4485-update-httppicoparser' into 'main'

See merge request isc-projects/bind9!9857
2024-12-08 12:28:23 +00:00
Ondřej Surý d14a76e115 Update picohttpparser.{c,h} with upstream repository
Upstream code doesn't do regular releases, so we need to regularly
sync the code from the upstream repository.  This is synchronization up
to the commit f8d0513 from Jan 29, 2024.
2024-12-08 11:14:37 +00:00
Evan Hunt 0b287f3aaf fix: usr: Preserve cache across reconfig when using attach-cache
When the `attach-cache` option is used in the `options` block with an arbitrary name, it causes all views to use the same cache. Previously, this configuration caused the cache to be deleted and a new cache created every time the server was reconfigured. This has been fixed.

Closes #5061

Merge branch '5061-attach-cache-fix' into 'main'

See merge request isc-projects/bind9!9787
2024-12-06 21:34:15 +00:00
Evan Hunt f3af8a7dc3 preserve cache across reload when using attach-cache
when the attach-cache option is used in the options block
with an arbitrary name, it causes all views to use the same
cache. however, previously, this could cause the cache to be
deleted and a new cache created every time the server was
reconfigured. this did *not* occur when attach-cache was
used at the view level to refer back to another view's cache.

in this commit we correct the problem by checking for
pre-existing caches during reconfiguration, and moving
them from the old server cache list to the new cache list
before cleaning up and freeing the old cache list.
2024-12-06 12:34:33 -08:00
Ondřej Surý de6f199f4d fix: dev: Revert "Lock and attach when returning zone stats"
Closes #5082

Merge branch '5082-lock-and-attach-when-return-zone-stats-revert' into 'main'

See merge request isc-projects/bind9!9859
2024-12-06 19:45:57 +00:00
Ondřej Surý 7a99d1baf8 Revert "Attach dnssecsignstats, rcvquerystats, and requeststats"
This reverts commit fb50a71159.
2024-12-06 19:46:39 +01:00
Matthijs Mekking 43622594f4 chg: dev: Remove unused maxquerycount
Related to #4980

Merge branch '4980-remove-unused-maxqueryqount' into 'main'

See merge request isc-projects/bind9!9850
2024-12-06 15:18:28 +00:00
Matthijs Mekking 397ca34e34 Remove unused maxquerycount
While implementing the global limit 'max-query-count', initially I
thought adding the variable to the resolver structure. But the limit
is per client request so it was moved to the view structure (and
counter in ns_query structure). However, I forgot to remove the
variable from the resolver structure again. This commit fixes that.
2024-12-06 11:19:18 +01:00
Michal Nowak a17a9cb84a new: test: Add OpenBSD 7.6
Merge branch 'mnowak/openbsd-7.6' into 'main'

See merge request isc-projects/bind9!9609
2024-12-06 10:16:29 +00:00
Michal Nowak 11670b581d Add OpenBSD 7.6 2024-12-06 10:16:10 +00:00
Michal Nowak 57f5dc5e2b chg: test: Add FreeBSD 13.4
Merge branch 'mnowak/freebsd-13.4' into 'main'

See merge request isc-projects/bind9!9640
2024-12-06 09:30:17 +00:00
Michal Nowak 88b4367daa Add FreeBSD 13.4 2024-12-06 07:37:40 +00:00
Mark Andrews 3c720c6425 fix: dev: Lock and attach when returning zone stats
When returning zone statistics counters, the statistics sets are now attached while the zone is locked.  This addresses Coverity warnings CID 468720, 468728 and 468729.

Closes #4934

Merge branch '4934-lock-and-attach-when-return-zone-stats' into 'main'

See merge request isc-projects/bind9!9488
2024-12-06 05:32:05 +00:00
Mark Andrews fb50a71159 Attach dnssecsignstats, rcvquerystats, and requeststats
In dns_zone_getdnssecsignstats, dns_zone_getrcvquerystats and
dns_zone_getrequeststats attach to the statistics structure.
2024-12-06 04:23:31 +00:00
Mark Andrews aa686512df INSIST that the zone in locked before unlocking
This is the counterpart to the INSIST(!zone->locked) when the zone
is locked.
2024-12-06 04:23:31 +00:00
Mark Andrews 667383587b fix: dev: Finalize removal of memory debug flags size and mctx
Commit 4b3d0c6600 has removed them, but
did not remove few traces in documentation and help. Remove them from
remaining places.

Merge branch 'main-memory-flags-size-mctx' into 'main'

See merge request isc-projects/bind9!9606
2024-12-06 03:12:29 +00:00
Petr MenšíkandMark Andrews 65b9eeb39a Finalize removal of memory debug flags size and mctx
Commit 4b3d0c6600 has removed them, but
did not remove few traces in documentation and help. Remove them from
remaining places.
2024-12-06 02:29:20 +00:00
Mark Andrews 1435770b1a fix: usr: Fix dnssec-signzone signing non-DNSKEY RRsets with revoked keys
`dnssec-signzone` was using revoked keys for signing RRsets other than DNSKEY.  This has been corrected.

Closes #5070

Merge branch '5070-dnssec-signzone-fix-revoke' into 'main'

See merge request isc-projects/bind9!9800
2024-12-06 00:59:26 +00:00
Mark Andrews 30ef6dde05 Check dnssec-signzone behaviour with revoked keys
Only DNSKEY records should be signed with a revoked key.
2024-12-06 11:25:09 +11:00
Mark Andrews 23775c6006 Do not sign non DNSKEY RRset with revoked keys
It does not make sense to sign RRsets other than DNSKEY with revoked
keys.
2024-12-06 11:25:09 +11:00
Michal Nowak bd0cf07e88 fix: test: ecdsa pytest rewrite fixes
Merge branch 'mnowak/ecdsa-pytest-rewrite-fixes' into 'main'

See merge request isc-projects/bind9!9823
2024-12-05 18:22:24 +00:00
Michal Nowak 1a5683b638 Use os.getenv() instead of os.environ
If ECDSAP256SHA256_SUPPORTED or ECDSAP384SHA384_SUPPORTED variables were
not present in the environment, os.environ would raise KeyError that is
not being handled in the decorator. Use os.getenv() instead.
2024-12-05 18:22:05 +00:00
Michal Nowak 2a7b8d9795 Fix skipif decorators' conditions
The ECDSA256 and ECDSA384 check conditions were switched.
2024-12-05 18:22:05 +00:00
Matthijs Mekking fa56e0d8b1 fix: usr: Fix nsupdate hang when processing a large update
To mitigate DNS flood attacks over a single TCP connection, we throttle the connection when the other side does not read the data. Throttling should only occur on server-side sockets, but erroneously also happened for nsupdate, which acts as a client. When nsupdate started throttling the connection, it never attempts to read again. This has been fixed.
 
Closes #4910

Merge branch '4910-nsupdate-hangs-when-processing-large-update' into 'main'

See merge request isc-projects/bind9!9709
2024-12-05 15:13:45 +00:00
Matthijs Mekking aa24b77d8b Fix nsupdate hang when processing a large update
The root cause is the fix for CVE-2024-0760 (part 3), which resets
the TCP connection on a failed send. Specifically commit
4b7c61381f stops reading on the socket
because the TCP connection is throttling.

When the tcpdns_send_cb callback thinks about restarting reading
on the socket, this fails because the socket is a client socket.
And nsupdate is a client and is using the same netmgr code.

This commit removes the requirement that the socket must be a server
socket, allowing reading on the socket again after being throttled.
2024-12-05 15:40:48 +01:00
Matthijs Mekking 3adabb4f89 Add test case for nsupdate hangs on large update
This test case hangs, despite the update being performed on the
name server.
2024-12-05 15:40:48 +01:00
Matthijs Mekking 80a5745a1f new: usr: Add a new option to configure the maximum number of outgoing queries per client request
The configuration option 'max-query-count' sets how many outgoing queries per client request is allowed. The existing 'max-recursion-queries' is the number of permissible queries for a single name and is reset on every CNAME redirection. This new option is a global limit on the client request. The default is 200.

This allows us to send a bit more queries while looking up a single name. The default for 'max-recursion-queries' is changed from 32 to 50.

Closes #4980 
Closes #4921

Merge branch '4980-global-limit-outgoing-queries' into 'main'

See merge request isc-projects/bind9!9737
2024-12-05 13:50:48 +00:00
Matthijs Mekking 84df920d9e Change default max-recursion-queries to 50
Changing the default for max-recursion-queries from 100 to 32 was too
strict in some cases, especially lookups in reverse IPv6 trees started
to fail more frequently. From issue #4921 it looks like 50 is a better
default.

Now that we have 'max-query-count' as a global limit of outgoing queries
per client request, we can increase the default for
'max-recursion-queries' again, as the number of recursive queries is
no longer bound by the multiple of 'max-recursion-queries' and
'max-query-restarts'.
2024-12-05 14:17:08 +01:00
Matthijs Mekking 73eafaba14 Add a CAMP test case
This adds a new test directory specifically for CAMP attacks. This first
test in this test directory follows multiple CNAME chains, restarting
the max-recursion-queries counter, but should bail when the global
maximum quota max-query-count is reached.
2024-12-05 14:17:08 +01:00
Matthijs Mekking 74f845d62f Add +maxtotalqueries option to delv
The max-query-count value can now be set on the command line in delv
with +maxtotalqueries.
2024-12-05 14:17:08 +01:00
Matthijs Mekking 16b3bd1cc7 Implement global limit for outgoing queries
This global limit is not reset on query restarts and is a hard limit
for any client request.
2024-12-05 14:17:07 +01:00
Matthijs Mekking ca7d487357 Implement getter function for counter limit 2024-12-05 14:17:07 +01:00
Matthijs Mekking bbc16cc8e6 Implement 'max-query-count'
Add another option to configure how many outgoing queries per
client request is allowed. The existing 'max-recursion-queries' is
per restart, this one is a global limit.
2024-12-05 14:01:57 +01:00
Ondřej Surý 522581469c chg: doc: only one loopmgr is expected
Resolves: https://gitlab.isc.org/isc-projects/bind9/-/issues/5057

Merge branch 'docs' into 'main'

See merge request isc-projects/bind9!9789
2024-12-05 10:32:25 +00:00
Pavel BřezinaandOndřej Surý 6f21cf201b update docs: only one loopmgr is expected
Resolves: https://gitlab.isc.org/isc-projects/bind9/-/issues/5057
2024-12-05 10:32:11 +00:00
Michal Nowak 480cc576b3 fix: ci: Add ns2/managed1.conf to mkeys extra_artifacts
The ns2/managed1.conf file is created by the setup.sh script. Then, in
the tests.sh script it is moved to ns2/managed.conf. The latter file
name is in mkeys extra_artifacts, but the former one is not. This is a
problem when pytest is started with the --setup-only option as it only
runs the setup.sh script (e.g., in the cross-version-config-tests CI
job) and thus failing the "Unexpected files found" assertion.

Merge branch 'mnowak/mkeys-add-ns2-managed1-conf-to-extra-artifacts' into 'main'

See merge request isc-projects/bind9!9815
2024-12-05 10:07:46 +00:00
Michal Nowak e7d973bd00 Add ns2/managed1.conf to mkeys extra_artifacts
The ns2/managed1.conf file is created by the setup.sh script. Then, in
the tests.sh script it is moved to ns2/managed.conf. The latter file
name is in mkeys extra_artifacts, but the former one is not. This is a
problem when pytest is started with the --setup-only option as it only
runs the setup.sh script (e.g., in the cross-version-config-tests CI
job) and thus failing the "Unexpected files found" assertion.
2024-12-05 10:07:33 +00:00
Mark Andrews be5266a7c6 fix: usr: Fix possible assertion failure when reloading server while processing updates
Closes #5006

Merge branch '5006-get-max-by-type-earlier' into 'main'

See merge request isc-projects/bind9!9745
2024-12-05 04:13:49 +00:00
Mark Andrews 44a54a29d8 Keep a local copy of the update rules to prevent UAF
Previously, the update policy rules check was moved earlier in the
sequence, and the keep rule match pointers were kept to maintain the
ability to verify maximum records by type.

However, these pointers can become invalid if server reloading
or reconfiguration occurs before update completion. To prevent
this issue, extract the maximum records by type value immediately
during processing and only keep the copy of the values instead of the
full ssurule.
2024-12-05 03:40:34 +00:00
Evan Hunt fb778a6500 fix: doc: document optional statements the same, enabled or not
The automatically-generated grammar for named.conf clauses that may or may not be enabled at compile time will now include the same comment, regardless of whether or not they are. Previously, the grammar didn't include a comment if an option was enabled, but said "not configured" if it was disabled. Now, in both cases, it will say "optional (only available if configured)".


Closes #4960

Merge branch '4960-optional-grammar' into 'main'

See merge request isc-projects/bind9!9579
2024-12-05 02:36:47 +00:00
Evan Hunt 202c68e6a8 document optional statements the same, enabled or not
the generated grammar for named.conf clauses that may or may not be
enabled at compile time will now print the same comment regardless of
whether or not they are.

previously, the grammar didn't print a comment if an option was enabled,
but printed "not configured" if it was disabled. now, in both cases,
it will say "optional (only available if configured)".

as an incidental fix, clarified the documentation for "named-checkconf -n".
2024-12-04 15:08:44 -08:00
Michal Nowak 6fd5e771eb chg: test: Rewrite ecdsa system test to pytest
Merge branch 'mnowak/pytest_rewrite_ecdsa' into 'main'

See merge request isc-projects/bind9!9159
2024-12-04 18:32:55 +00:00
Michal Nowak 292e919156 Rewrite ecdsa system test to pytest 2024-12-04 18:56:53 +01:00
Artem Boldariev 44f1b00118 fix: ci: tests: Use FIPS compatible DH-param files
When the tests were added, the files were generated without FIPS
compatibility in mind. That made the tests fail on recent OpenSSL
versions in FIPS mode.

So, the files were regenerated on a FIPS compliant system using the
following stanza:

```
$ openssl dhparam -out <file> 3072
```

Apparently, the old files are not valid for FIPS starting with OpneSSL
3.1.X release series as "FIPS 140-3 compliance changes" are mentioned
in the [changelog](https://openssl-library.org/news/openssl-3.1-notes/).

Closes #5074.

Merge branch '5074-fips-compatible-dhparams' into 'main'

See merge request isc-projects/bind9!9807
2024-12-04 16:50:36 +00:00
Artem Boldariev 384c92880e Use FIPS compatible DH-param files
When the tests were added, the files were generated without FIPS
compatibility in mind. That made the tests fail on recent OpenSSL
versions in FIPS mode.

So, the files were regenerated on a FIPS compliant system using the
following stanza:

$ openssl dhparam -out <file> 3072

Apparently, the old files are not valid for FIPS starting with OpneSSL
3.1.X release series as "FIPS 140-3 compliance changes" are mentioned
in the changelog:

https://openssl-library.org/news/openssl-3.1-notes/
2024-12-04 18:08:51 +02:00
Colin Vidal 3972eacdad new: usr: Add Extended DNS Error Code 22 - No Reachable Authority
When the resolver is trying to query an authority server and eventually timed out, a SERVFAIL answer is given to the client. Add the Extended DNS Error Code 22 - No Reachable Authority to the response.

Closes #2268

Merge branch '2268/ede-no-reachable-authority' into 'main'

See merge request isc-projects/bind9!9743
2024-12-04 15:52:16 +00:00
Colin Vidal d13e94b930 Add EDE 22 No reachable authority code
Add support for Extended DNS Errors (EDE) error 22: No reachable
authority. This occurs when after a timeout delay when the resolver is
trying to query an authority server.
2024-12-04 16:19:30 +01:00
Ondřej Surý 3779a81d50 rem: dev: Remove the log message about incomplete IPv6 API
The log message would not be ever reached, because the IPv6 API is
always considered to be complete.  Just remove the dead code.

Closes #5068

Merge branch '5068-remove-dead-code-from-ns_interface' into 'main'

See merge request isc-projects/bind9!9798
2024-12-04 15:19:21 +00:00
Ondřej Surý bfcde806c9 Remove the log message about incomplete IPv6 API
The log message would not be ever reached, because the IPv6 API is
always considered to be complete.  Just remove the dead code.
2024-12-04 15:19:12 +00:00
Petr Špaček 3e33674ded chg: doc: Set up version for BIND 9.21.4
Merge branch 'pspacek/set-up-version-for-bind-9.21.4' into 'main'

See merge request isc-projects/bind9!9810
2024-12-04 15:10:58 +00:00
Petr Špaček e0ccfb7beb Update BIND version to 9.21.4-dev 2024-12-04 15:52:49 +01:00
Petr Špaček 8306005ef1 Update BIND version for release 2024-12-03 10:43:11 +01:00
Petr Špaček 766c1a13c2 Add missing copyright header to Release Notes 2024-12-03 10:43:11 +01:00
Petr Špaček 10b662811e Add release note for GL #5022 2024-12-03 10:37:19 +01:00
Petr Špaček 3821a037bb Add release note for GL #4986 2024-12-03 10:37:19 +01:00
Petr Špaček 7a5dd9503b new: doc: Prepare documentation for BIND 9.21.3
Merge branch 'pspacek/prepare-documentation-for-bind-9.21.3' into 'v9.21.3-release'

See merge request isc-private/bind9!755
2024-12-02 16:55:38 +00:00
Petr Špaček 5ebcfca335 Tweak and reword release notes 2024-12-02 17:54:42 +01:00
Petr Špaček 50ae3a3d4c Automatically add hyperlinks to release notes for BIND 9.21.3 2024-12-02 15:34:07 +01:00
Petr Špaček 912cd22a8d Prepare release notes for BIND 9.21.3 2024-12-02 15:29:59 +01:00
Petr Špaček 2707c794c7 Fix Sphinx build failures on generated changelog for BIND 9.21.3 2024-12-02 15:15:53 +01:00
Petr Špaček 55734f9257 Generate changelog for BIND 9.21.3 2024-12-02 15:07:55 +01:00
Petr Špaček 8e1e24e127 chg: doc: gitchangelog: don't break lines on hyphens in relnotes
When release notes are generated, the text is wrapped and line breaks
are inserted into each paragraph (sourced from the commit message's
body). Prevent line breaks after hyphens, as these are often used for
option names. This makes it possible to easily find the options
afterwards.

Merge branch 'nicki/gitchangelog-dont-break-on-hyphens' into 'main'

See merge request isc-projects/bind9!9801
2024-12-02 13:53:38 +00:00
Nicki Křížek 9b0d0c0173 gitchangelog: don't break lines on hyphens in relnotes
When release notes are generated, the text is wrapped and line breaks
are inserted into each paragraph (sourced from the commit message's
body). Prevent line breaks after hyphens, as these are often used for
option names. This makes it possible to easily find the options
afterwards.
2024-12-02 11:10:01 +01:00
Artem Boldariev cd312298ea new: dev: Extended TCP accept() logging
Add extra log messages about TCP connection management.

Merge branch 'tcp-accept-extended-logging' into 'main'

See merge request isc-projects/bind9!9089
2024-11-27 19:48:58 +00:00
Artem Boldariev 300f05110d Extended TCP accept()/close() logging
This commit adds extra log messages issued when accepting or closing a
TCP connection (provided that debugging logging level >=99 is
enabled).
2024-11-27 21:14:08 +02:00
Ondřej Surý 5b96cbea01 fix: usr: Improve the memory cleaning in the SERVFAIL cache
The SERVFAIL cache doesn't have a memory bound and the
cleaning of the old SERVFAIL cache entries was implemented
only in opportunistic manner.  Improve the memory cleaning
of the SERVFAIL cache to be more aggressive, so it doesn't
consume a lot of memory in the case the server encounters
many SERVFAILs at once.

Closes #5025

Merge branch '5025-improve-badcache-cleaning' into 'main'

See merge request isc-projects/bind9!9760
2024-11-27 17:04:29 +00:00
Alessio Podda d94e88220c chg: dev: Optimize memory layout of core structs
Reduce memory footprint by:
- Reordering struct fields to minimize padding.
- Using exact-sized atomic types instead of `*_least`/`*_fast` variants
- Downsizing integer fields where possible

Affected structs:
- dns_name_t
- dns_slabheader_t 
- dns_rdata_t
- qpcnode_t
- qpznode_t

Closes #5022

Merge branch '5022-reduce-metadata-overhead-by-struct-packing' into 'main'

See merge request isc-projects/bind9!9721
2024-11-27 17:02:08 +00:00
Ondřej Surý b61739836d Remove dns_badcache usage in the resolver (lame-ttl)
The lame-ttl processing was overriden to be disabled in the config,
but the code related to the lame-ttl was still kept in the resolver
code.  More importantly, the DNS_RESOLVER_BADCACHETTL() macro would
cause the entries in the resolver badcache to be always cached for at
least 30 seconds even if the lame-ttl would be set to 0.

Remove the dns_badcache code from the dns_resolver unit, so we save some
processing time and memory in the resolver code.
2024-11-27 17:44:53 +01:00
Ondřej Surý 2cb5a6210f Improve the badcache cleaning by adding LRU and using RCU
Instead of cleaning the dns_badcache opportunistically, add per-loop
LRU, so each thread-loop can clean the expired entries.  This also
allows removal of the atomic operations as the badcache entries are now
immutable, instead of updating the badcache entry in place, the old
entry is now deleted from the hashtable and the LRU list, and the new
entry is inserted in the LRU.
2024-11-27 17:44:53 +01:00
alessio 32c7060bd2 Optimize memory layout of core structs
Reduce memory footprint by:

 - Reordering struct fields to minimize padding.
 - Using exact-sized atomic types instead of *_least/*_fast variants
 - Downsizing integer fields where possible

Affected structs:

 - dns_name_t
 - dns_slabheader_t
 - dns_rdata_t
 - qpcnode_t
 - qpznode_t
2024-11-27 16:04:25 +01:00
Ondřej Surý b72a2300b9 chg: dev: Assume IPv6 is universally available (on the kernel level)
Instead of various probing, just assume that IPv6 is universally available
and cleanup the various checks and defines that we have accumulated over
the years.

Merge branch 'ondrej/cleanup-IPv6-networking-support' into 'main'

See merge request isc-projects/bind9!9360
2024-11-27 14:23:11 +00:00
Ondřej Surý c18bb5f1f2 Remove unused definition of ISC_CMSG_IP_TOS
The #define was used before, but we forgot to clean it up when we
removed support for dscp.
2024-11-27 15:03:27 +01:00
Ondřej Surý 95a7419c2a Remove the incomplete code for IPv6 pktinfo
The code that listens on individual interfaces is now stable and doesn't
require any changes.  The code that would bind to IPv6 wildcard address
and then use IPv6 pktinfo structure to get the source address is not
going to be completed, so it's better to just remove the dead cruft.
2024-11-27 15:03:27 +01:00
Ondřej Surý 34a9a9a6be Assume universal availability of socklen_t
The SUSv2 defines accept(..., socklen_t), so we can safely require
socklen_t to be universally available.
2024-11-27 15:03:27 +01:00
Ondřej Surý e85399b1c0 Assume that IPv4 and IPv6 is always available
In 2024, it is reasonable to assume that IPv4 and IPv6 is always
available on a socket() level.  We still keep the option to enable or
disable each IP version individually, as the routing might be broken or
undesirable for one of the versions.
2024-11-27 15:03:27 +01:00
Ondřej Surý 5b273b5726 Assume IPV6_V6ONLY is universally available
In 2024, IPV6_V6ONLY socket option is either available or the operating
system is just not going to be supported.
2024-11-27 15:03:27 +01:00
Arаm Sаrgsyаn 0c645e3d45 fix: test: Fix the nslookup system test
The nslookup system test checks the count of resolved addresses in
the CNAME tests using a 'grep' match on the hostname, and ignoring
lines containing the 'canonical name' string. In order to protect
the check from intermittent failures like the 'address in use' warning
message, which then automatically resolves after a retry, edit the
'grep' matching string to also ignore the comments (as the mentioned
warning message is a comment which contains the hostname).

Closes #4948

Merge branch '4948-nslookup-test-fix' into 'main'

See merge request isc-projects/bind9!9523
2024-11-27 13:34:29 +00:00
Aram Sargsyan 345b0f9e5c Fix the nslookup system test
The nslookup system test checks the count of resolved addresses in
the CNAME tests using a 'grep' match on the hostname, and ignoring
lines containing the 'canonical name' string. In order to protect
the check from intermittent failures like the 'address in use' warning
message, which then automatically resolves after a retry, edit the
'grep' matching string to also ignore the comments (as the mentioned
warning message is a comment which contains the hostname).
2024-11-27 13:34:14 +00:00
Ondřej Surý 4c0e69ff01 fix: dev: Make dns_validator_cancel() respect the data ownership
There was a data race dns_validator_cancel() was called when the
offloaded operations were in progress.  Make dns_validator_cancel()
respect the data ownership and only set new .canceling variable when
the offloaded operations are in progress.  The cancel operation would
then finish when the offloaded work passes the ownership back to the
respective thread.

Closes #4926

Merge branch '4926-fix-data-race-in-dns_validator' into 'main'

See merge request isc-projects/bind9!9470
2024-11-27 13:00:33 +00:00
Ondřej Surý ee122ba025 Make dns_validator_cancel() respect the data ownership
There was a data race dns_validator_cancel() was called when the
offloaded operations were in progress.  Make dns_validator_cancel()
respect the data ownership and only set new .shuttingdown variable when
the offloaded operations are in progress.  The cancel operation would
then finish when the offloaded work passes the ownership back to the
respective thread.
2024-11-27 13:41:16 +01:00
Arаm Sаrgsyаn 025677943d fix: usr: Fix trying the next primary server when the preivous one was marked as unreachable
In some cases (there is evidence only when XoT was used) `named` failed
to try the next primary server in the list when the previous one was
marked as unreachable. This has been fixed.

Closes #5038

Merge branch '5038-xfr-primary-next-fix' into 'main'

See merge request isc-projects/bind9!9781
2024-11-27 11:46:09 +00:00
Aram Sargsyan 12225d125b Test trying of the next primary server
Add test cases which check that when a XoT primary server is
unreachable or is already marked as unreachble then the next
primary server in the list is used.
2024-11-27 10:37:13 +00:00
Aram Sargsyan 3262ebd0f3 xfrin: refactor and fix the ISC_R_CANCELED case handling
Previously a ISC_R_CANCELED result code switch-case has been added to
the zone.c:zone_xfrdone() function, which did two things:

1. Schedule a new zone transfer if there's a scheduled force reload of
   the zone.

2. Reset the primaries list.

This proved to be not a well-thought change and causes problems,
because the ISC_R_CANCELED code is used not only when the whole transfer
is canceled, but also when, for example, a particular primary server is
unreachable, and named still needs to continue the transfer process by
trying the next server, which it now no longer does in some cases. To
solve this issue, three changes are made:

1. Make sure dns_zone_refresh() runs on the zone's loop, so that the
   sequential calls of dns_zone_stopxfr() and dns_zone_forcexfr()
   functions (like done in 'rndc retransfer -force') run in intended
   order and don't race with each other.

2. Since starting the new transfer is now guaranteed to run after the
   previous transfer is shut down (see the previous change), remove the
   special handling of the ISC_R_CANCELED case, and let the default
   handler to handle it like before. This will bring back the ability to
   try the next primary if the current one was interrupted with a
   ISC_R_CANCELED result code.

3. Change the xfrin.c:xfrin_shutdown() function to pass the
   ISC_R_SHUTTINGDOWN result code instead of ISC_R_CANCELED, as it makes
   more sense.
2024-11-27 10:37:13 +00:00
Aram Sargsyan 1c4a34a3ab Clean up dns_zonemgr_unreachabledel()
The results of isc_sockaddr_format() calls are not used, remove them
and the local variables.
2024-11-27 10:37:13 +00:00
Evan Hunt f6148f66d4 chg: dev: Use default listening rules from config.c string
Remove special code which creates default listeners, and use the normal named.conf configuration parser instead. This removes unneeded code and makes the built-in configuration text provide a true primary source of defaults. This change should be transparent to end-users and should not cause any visible change.

Closes #1424

Merge branch '1424-listen-builtin-config' into 'main'

See merge request isc-projects/bind9!2663
2024-11-27 00:08:28 +00:00
Petr MenšíkandEvan Hunt c5ebe5eb0a Remove ns_listenlist_default()
It is not used anywhere in named and is no longer necessary
there.  It was called in some unit tests, but was not actually
needed by them.
2024-11-26 15:22:30 -08:00
Petr MenšíkandEvan Hunt 4fa81253ea Load default listen-on[-v6] values from config.c
Stop using ns_listenlist_default() to set the default listen-on
and listen-on-v6 configuration.  Instead, configure these options
using the default values in config.c.
2024-11-26 15:22:12 -08:00
Michal Nowak 84f36f4dce chg: test: Rewrite emptyzones system test to pytest
Merge branch 'mnowak/pytest_rewrite_emptyzones' into 'main'

See merge request isc-projects/bind9!9154
2024-11-26 15:15:51 +00:00
Michal Nowak 3ace62472c Rewrite emptyzones system test to pytest 2024-11-26 15:12:12 +00:00
Michal Nowak 7bedd1c296 Add isctest.check.refused() 2024-11-26 15:12:12 +00:00
Michal Nowak 4869ebb419 chg: test: Rewrite database system test to pytest
Merge branch 'mnowak/pytest_rewrite_database' into 'main'

See merge request isc-projects/bind9!9156
2024-11-26 12:11:30 +00:00
Michal Nowak 8005ad0dcd Rewrite database system test to pytest 2024-11-26 12:10:29 +00:00
Ondřej Surý 0fa2807d2b rem: usr: Move contributed DLZ modules into a separate repository
The DLZ modules are poorly maintained as we only ensure they can still
be compiled, the DLZ interface is blocking, so anything that blocks the
query to the database blocks the whole server and they should not be
used except in testing.  The DLZ interface itself is going to be scheduled
for removal.

The DLZ modules now live in https://gitlab.isc.org/isc-projects/dlz-modules
repository.

Closes #4865

Merge branch '4865-remove-contributed-DLZ-modules' into 'main'

See merge request isc-projects/bind9!9349
2024-11-26 11:30:12 +00:00
Ondřej SurýandOndřej Surý a6cce753e2 Move contributed DLZ modules into a separate repository
The DLZ modules are poorly maintained as we only ensure they can still
be compiled, the DLZ interface is blocking, so anything that blocks the
query to the database blocks the whole server and they should not be
used except in testing.  The DLZ interface itself should be scheduled
for removal.
2024-11-26 12:29:41 +01:00
Michal Nowak 08138d53e4 rem: test: Revert "xfail upforwd system test if DNSTAP is enabled"
This reverts commit 0579e0a429.

See isc-projects/bind9#4996

Merge branch 'mnowak/revert-xfail-upforwd-system-test' into 'main'

See merge request isc-projects/bind9!9681
2024-11-26 10:48:26 +00:00
Michal Nowak e7e73da39a Revert "xfail upforwd system test if DNSTAP is enabled"
This reverts commit 0579e0a429.
2024-11-26 10:48:00 +00:00
Ondřej Surý cf930c23d0 chg: usr: Add new logging module for logging crypto errors in libisc
Add a new 'crypto' log module that will be used for a low-level
cryptographic operations.  The DNS related cryptography logs
are still logged in the 'dns/crypto' module.

Merge branch 'ondrej/add-ISC_LOGMODULE_CRYPTO' into 'main'

See merge request isc-projects/bind9!9287
2024-11-26 10:23:11 +00:00
Ondřej SurýandOndřej Surý a0a1769509 Add new logging category for logging crypto errors in libisc
The libisc now includes sizeable chunks of cryptography, but the crypto
log module was missing.  Add the new ISC_LOGMODULE_CRYPTO to libisc and
use it in the isc_tls error logging.
2024-11-26 11:22:33 +01:00
Nicki Křížek 76c9522599 fix: test: Ignore test artifacts in .libs
Some tests may leave artifacts in the .libs directory. Ignore this
directory when detecting expected artifacts.

Closes #5055

Merge branch '5055-ignore-libs-artifacts' into 'main'

See merge request isc-projects/bind9!9766
2024-11-26 09:05:28 +00:00
Nicki Křížek cf606a9ead Ignore test artifacts in .libs
Some tests may leave artifacts in the .libs directory. Ignore this
directory when detecting expected artifacts.
2024-11-26 09:05:15 +00:00
Colin Vidal 001272127f chg: usr: Add none parameter to query-source and query-source-v6 to disable IPv4 or IPv6 upstream queries
Add a none parameter to named configuration option `query-source` (respectively `query-source-v6`) which forbid usage of IPv4 (respectively IPv6) addresses when named is doing an upstream query.

Closes #4981 Turning-off upstream IPv6 queries while still listening to downstream queries on IPv6.

Merge branch 'colin/querysource-none' into 'main'

See merge request isc-projects/bind9!9727
2024-11-26 08:46:58 +00:00
Colin VidalandColin Vidal bcf24ca07e Add a none parameter to query-source[-v6]
This change adds a "none" parameter to the query-source[-v6]
options in named.conf, which forbid the usage of IPv4 or IPv6
addresses when doing upstream queries.
2024-11-26 08:45:50 +01:00
Mark Andrews b2ffa5845b chg: usr: emit more helpful log for exceeding max-records-per-type
The new log message is emitted when adding or updating an RRset
fails due to exceeding the max-records-per-type limit. The log includes
the owner name and type, corresponding zone name, and the limit value.
It will be emitted on loading a zone file, inbound zone transfer
(both AXFR and IXFR), handling a DDNS update, or updating a cache DB.
It's especially helpful in the case of zone transfer, since the
secondary side doesn't have direct access to the offending zone data.

It could also be used for max-types-per-name, but this change
doesn't implement it yet as it's much less likely to happen
in practice.

Merge branch 'helpful-log-on-toomanyrecords' into 'main'

See merge request isc-projects/bind9!9509
2024-11-26 07:15:25 +00:00
JINMEI TatuyaandMark Andrews 000720fe14 update system tests to confirm new log messages 2024-11-26 16:39:48 +11:00
JINMEI TatuyaandMark Andrews b0309ee631 use more generic log module name for 'logtoomanyrecords'
DNS_LOGMODULE_RBTDB was simply inappropriate, and this
log message is actually dependent on db implementation
details, so DNS_LOGMODULE_DB would be the best choice.
2024-11-26 04:06:58 +00:00
JINMEI TatuyaandMark Andrews 4156995431 emit more helpful log for exceeding max-records-per-type
The new log message is emitted when adding or updating an RRset
fails due to exceeding the max-records-per-type limit. The log includes
the owner name and type, corresponding zone name, and the limit value.
It will be emitted on loading a zone file, inbound zone transfer
(both AXFR and IXFR), handling a DDNS update, or updating a cache DB.
It's especially helpful in the case of zone transfer, since the
secondary side doesn't have direct access to the offending zone data.

It could also be used for max-types-per-name, but this change
doesn't implement it yet as it's much less likely to happen
in practice.
2024-11-26 04:06:58 +00:00
Mark Andrews 8e0ec3fe0a fix: usr: '{&dns}' is as valid as '{?dns}' in a SVCB's dohpath
`dig` fails to parse a valid (as far as I can tell, and accepted by `kdig` and `Wireshark`) `SVCB` record with a `dohpath` URI template containing a `{&dns}`, like `dohpath=/some/path?key=value{&dns}"`. If the URI template contains a `{?dns}` instead `dig` is happy, but my understanding of rfc9461 and section 1.2. "Levels and Expression Types" of rfc6570 is that `{&dns}` is valid.
See for example section 1.2. "Levels and Expression Types" of rfc6570.

Note that Peter van Dijk suggested that `{dns}` and `{dns,someothervar}` might be valid forms as well, so my patch might be too restrictive, although it's anyone's guess how DoH clients would handle complex templates.

Closes https://gitlab.isc.org/isc-projects/bind9/-/issues/4922

Merge branch 'svcb-dohpath-uri-template' into 'main'

See merge request isc-projects/bind9!9455
2024-11-26 03:40:57 +00:00
Mark Andrews af54ef9f5d Parse the URI template and check for a dns variable
The 'dns' variable in dohpath can be in various forms ({?dns},
{dns}, {&dns} etc.).  To check for a valid dohpath it ends up
being simpler to just parse the URI template rather than looking
for all the various forms if substring.
2024-11-26 12:38:49 +11:00
Remi GacogneandMark Andrews e74052ea71 '{&dns}' is as valid as '{?dns}' in a SVCB's dohpath
See for example section 1.2. "Levels and Expression Types" of rfc6570.
2024-11-26 12:38:33 +11:00
Mark Andrews 54889fd2af fix: usr: Provide more visibility into configuration errors
by logging SSL_CTX_use_certificate_chain_file and SSL_CTX_use_PrivateKey_file errors individually.

Closes #5008

Merge branch '5008-provide-more-visibility-into-ssl-errors' into 'main'

See merge request isc-projects/bind9!9683
2024-11-26 00:02:50 +00:00
Mark Andrews 9006839ed7 Provide more visibility into configuration errors
by logging SSL_CTX_use_certificate_chain_file and
SSL_CTX_use_PrivateKey_file errors
2024-11-26 10:31:44 +11:00
Nicki Křížek 313aec5816 fix: test: Allow re-run of mkeys system test
On some slow systems, the test might intermittently fail due to inherent
timing issues. In our CI, this most often happens in the
system:gcc:8fips:amd64 jobs.

Closes #3098

Merge branch '3098-allow-re-run-of-mkeys-test' into 'main'

See merge request isc-projects/bind9!9732
2024-11-25 14:35:17 +00:00
Nicki Křížek a299650a6f Allow re-run of mkeys system test
On some slow systems, the test might intermittently fail due to inherent
timing issues. In our CI, this most often happens in the
system:gcc:8fips:amd64 jobs.
2024-11-25 14:56:17 +01:00
Michal Nowak b5c080c68b fix: ci: Fix paths to binaries in cross-version-config-tests job
The cross-version-config-tests job has never functioned in CI because
the testing framework changed after the testing was completed. To run
the new "named" binary using the old configurations, paths in the test
framework must be updated to point to the location of the new binaries.

Closes #4977

Merge branch '4977-fix-cross-version-config-tests' into 'main'

See merge request isc-projects/bind9!9702
2024-11-25 12:11:02 +00:00
Michal Nowak 09d7e2430a Fix paths to binaries in cross-version-config-tests job
The cross-version-config-tests job has never functioned in CI because
the testing framework changed after the testing was completed. To run
the new "named" binary using the old configurations, paths in the test
framework must be updated to point to the location of the new binaries.
2024-11-25 11:36:51 +01:00
Aydın Mercan 419aa3264e new: usr: add separate query counters for new protocols
Add query counters for DoT, DoH, unencrypted DoH and their proxied
counterparts. The new protocols do not update their respective TCP/UDP
transport counter and is now for TCP/UDP over plain 53 only.

Closes #598

Merge branch '598-wishlist-statistics-for-dns-over-tcp-and-tls' into 'main'

See merge request isc-projects/bind9!9585
2024-11-25 10:09:26 +00:00
Aydın Mercan ddede2b521 document protocol query counters in arm
ARM was missing the existing QryUDP and QryTCP documentation. Add them
alongside the new protocol counters.
2024-11-25 13:07:29 +03:00
Aydın Mercan d987e2d745 add separate query counters for new protocols
Add query counters for DoT, DoH, unencrypted DoH and their proxied
counterparts. The protocols don't increment TCP/UDP counters anymore
since they aren't the same as plain DNS-over-53.
2024-11-25 13:07:29 +03:00
Evan HuntandAydın Mercan 44de1d5bef wrap ns_nm_socket_type for testing
The testing ns_client doesn't have a proper nmhandle.
2024-11-25 13:07:24 +03:00
Colin Vidal 29f1d4bb6f rem: dev: Remove namedconf port/tls deprecated check on *-source[-v6] options
The usage of port and tls arguments in *-source and *-source-v6 named configuration options has been previously removed. Remove various configuration check deprecating usage of those arguments.

Merge branch 'colin/querysource-check-cleanup' into 'main'

See merge request isc-projects/bind9!9738
2024-11-22 18:34:51 +00:00
Colin Vidal 642776a976 Remove namedconf port/tls deprecated check on *-source[-v6] options
The usage of port and tls arguments in *-source and *-source-v6 named
configuration options has been previously removed. Remove
configuration check deprecating usage of those arguments.
2024-11-22 18:50:10 +01:00
Alessio Podda a3e03b52e2 chg: dev: Incrementally apply AXFR transfer
Reintroduce logic to apply diffs when the number of pending tuples is
above 128. The previous strategy of accumulating all the tuples and
pushing them at the end leads to excessive memory consumption during
transfer.

This effectively reverts half of e3892805d6

Closes #4986

Merge branch '4986-axfr-chunked-insert' into 'main'

See merge request isc-projects/bind9!9740
2024-11-22 17:35:48 +00:00
alessio 99b4f01b33 Incrementally apply AXFR transfer
Reintroduce logic to apply diffs when the number of pending tuples is
above 128. The previous strategy of accumulating all the tuples and
pushing them at the end leads to excessive memory consumption during
transfer.

This effectively reverts half of e3892805d6
2024-11-22 15:00:55 +01:00
Alessio Podda 9f628a34cd fix: nil: Fix alpine build by removing the need for LargestIntegralType in time_test
Fix alpine build by removing the need for `LargestIntegralType` use in `tests/isc/time_test.c`.

Merge branch 'alessio/fix-time-test' into 'main'

See merge request isc-projects/bind9!9758
2024-11-22 09:25:08 +00:00
alessio b4290a5e11 Fix alpine build by removing LargestIntegralType in time_test
Avoids using functions that require LargestIntegralType arguments in
time_test to resolve import issues on Alpine Linux. Using size_t instead
wasn't an option due to compatibility issues with 32-bit architectures.
2024-11-22 08:52:03 +01:00
Mark Andrews 2c1fb7e5eb new: usr: Enable runtime selection of FIPS mode in dig and delv
'dig -F' and 'delv -F' can now be used to select FIPS mode at runtime.

Closes #5046

Merge branch '5046-enable-runtime-selection-of-fips-mode-in-dig' into 'main'

See merge request isc-projects/bind9!9754
2024-11-22 00:12:02 +00:00
Mark Andrews d3d88638d8 Delv now supports selecting FIPS mode at runtime
To enable FIPS mode at runtime use 'delv -F'.  The operating system
must have FIPS support available for this to succeed.  This is on
by default when built with --enable-fips-mode.
2024-11-22 09:40:46 +11:00
Mark Andrews fe7ce99270 Dig now supports selecting FIPS mode at runtime
To enable FIPS mode at runtime use 'dig -F'.  The operating system
must have FIPS support available for this to succeed.  This is on
by default when built with --enable-fips-mode.
2024-11-22 09:40:46 +11:00
Evan Hunt 0989926745 fix: nil: Fix build of unit test on 32-bit architecture
Fix a unit test build failure on the i686 platform.

Merge branch 'bug/main/unittest-isc-time-32b' into 'main'

See merge request isc-projects/bind9!9753
2024-11-21 04:31:08 +00:00
Petr MenšíkandEvan Hunt 3a8741c8a9 Fix build of unit test on 32b architecture
Fixes unittest build failure on i686 platform.

In file included from tests/isc/time_test.c:24:
tests/isc/time_test.c: In function ‘run_test_isc_time_formatISO8601TZms_test’:
tests/isc/time_test.c:284:32: error: passing argument 2 of ‘_assert_in_set’ from incompatible pointer type [-Wincompatible-pointer-types]
  284 |         assert_in_set(buf[23], plus_minus, sizeof(plus_minus));
      |                                ^~~~~~~~~~
      |                                |
      |                                size_t * {aka unsigned int *}
/usr/include/cmocka.h:2369:64: note: expected ‘const long long unsigned int *’ but argument is of type ‘size_t *’ {aka ‘unsigned int *’}
 2369 |     const LargestIntegralType value, const LargestIntegralType values[],
2024-11-21 04:23:08 +00:00
Mark Andrews 6c46ccc577 chg: nil: Re-split format strings lib/ns/update.c
Re-split format strings that had been poorly split by multiple
clang-format runs using different versions of clang-format. 

Closes #5043

Merge branch '5043-re-split-format-strings-lib-ns-update-c' into 'main'

See merge request isc-projects/bind9!9752
2024-11-21 04:21:34 +00:00
Mark Andrews a24d6e1654 Re-split format strings
Re-split format strings that had been poorly split by multiple
clang-format runs using different versions of clang-format.
2024-11-20 13:06:43 +11:00
Ondřej Surý 94b65f5eb0 chg: dev: Add two new clang-format options that help with code formatting
* Add new clang-format option to remove redundant semicolons
* Add new clang-format option to remove redundant parentheses

Merge branch 'ondrej/code-style-2024' into 'main'

See merge request isc-projects/bind9!9749
2024-11-19 13:21:40 +00:00
Ondřej Surý 82f0c31c0d Ignore clang-format reformatting commit 2024-11-19 12:28:07 +01:00
Ondřej Surý 1a19ce39db Remove redundant semicolons after the closing braces of functions 2024-11-19 12:27:22 +01:00
Ondřej Surý c7420eccd9 Add new clang-format option to remove redundant semicolons
The new clang-format options (since clang-format 16) removes semicolons
after the closing braces of functions and constructors/destructors.
2024-11-19 12:27:22 +01:00
Ondřej Surý 0258850f20 Remove redundant parentheses from the return statement 2024-11-19 12:27:22 +01:00
Ondřej Surý 3873b0c279 Add new clang-format option to remove redundant parentheses
The new clang-format option (since 17) can remove redundant parentheses
in the return statement (with configuration value ReturnStatement).
2024-11-19 12:27:22 +01:00
Evan Hunt 63ee8979a7 new: usr: Update bind.keys with the new 2025 IANA root key
Add an 'initial-ds' entry to bind.keys for the new root key, ID
38696, which is scheduled for publication in January 2025.

Closes #4896

Merge branch '4896-update-bind-keys' into 'main'

See merge request isc-projects/bind9!9422
2024-11-15 22:28:38 +00:00
Evan Hunt 609bf35075 Add the DS for the new root key (38696)
Add an 'initial-ds' entry to bind.keys for the new root key, ID
38696, scheduled for publication in January 2025.
2024-11-15 13:14:30 -08:00
Petr Špaček be02e26f8b chg: doc: Move Known Issues to BIND9 wiki
Merge branch 'nicki/move-known-issues-to-wiki' into 'main'

See merge request isc-projects/bind9!9731
2024-11-15 13:56:23 +00:00
Nicki KřížekandPetr Špaček 891d7ac7fa Move Known Issues to BIND9 wiki
Keeping the Known Issues as part of the rendered docs has the issue that
the list can't be updated on the official docs website until the next
release. This is unpractical is a high-priority issue is discovered
shortly after a release. Keep the Known Issues in wiki and simply link
to the list from the rendered docs. The wiki article can be updated at
any time as needed.
2024-11-15 13:56:14 +00:00
Petr Špaček d83c649e87 fix: nil: Add REQUIREs to dns_xfrin_create()
Two `REQUIRE` assertions were accidentally deleted by the
dbf230650f commit earlier.
Bring them back.

Merge branch 'aram/dns_xfrin_create-bring-back-requires' into 'main'

See merge request isc-projects/bind9!9729
2024-11-15 13:21:47 +00:00
Aram SargsyanandPetr Špaček 53117b2ab3 Add REQUIREs to dns_xfrin_create()
Two REQUIRE assertions were accidentally deleted by the
dbf230650f commit earlier.
Bring them back.
2024-11-15 13:21:26 +00:00
Ondřej Surý 75f1587aed fix: usr: Fix race condition when canceling ADB find
When canceling the ADB find, the lock on the find gets released for
a brief period of time to be locked again inside adbname lock.  During
the brief period that the ADB find is unlocked, it can get canceled by
other means removing it from the adbname list which in turn causes
assertion failure due to a double removal from the adbname list.
This has been fixed.

Closes #5024

Merge branch '5024-fix-crash-in-dns_adb_cancelfind' into 'main'

See merge request isc-projects/bind9!9722
2024-11-13 07:49:05 +00:00
Ondřej Surý 128e50e1ff Revalidate the adbname when canceling the ADB find
When canceling the ADB find, the lock on the find gets released for
a brief period of time to be locked again inside adbname lock.  During
the brief period that the ADB find is unlocked, it can get canceled by
other means removing it from the adbname list which in turn causes
assertion failure due to a double removal from the adbname list.

Recheck if the find->adbname is still valid after acquiring the lock
again and if not just skip the double removal.  Additionally, attach to
the adbname as in the worst case, the adbname might also cease to exist
if the scheduler would block this particular thread for a longer period
of time invalidating the lock we are going to acquire and release.
2024-11-13 08:18:39 +01:00
Nicki Křížek 39d32e525f fix: test: minor fixes for extra_artifacts detection
Some omissions of !9426 discovered during the backports

Merge branch 'nicki/extra-artifacts-fixups' into 'main'

See merge request isc-projects/bind9!9739
2024-11-12 10:18:48 +00:00
Nicki Křížek 7dde34afac Fix clean.sh removal omissions
- Ensure keyfromlabel token is cleaned up
2024-11-12 10:20:41 +01:00
Nicki Křížek b66fb31dcb Ensure pytest runner get proper outcome from flaky reruns
When a test is re-run by the flaky plugin, the TestReport outcomes
collected in the pytest_runtest_makereport() hook should be overriden.
Each of the setup/call/teardown phases is reported again and since we
care about the overall outcome, their respective results should be
overriden so that only the outcome from the final test (re)run gets
reported.

Prior to this change, it lead to a situation where an extra_artifact
generated during the test might be ignored. This was caused because the
check was skipped, since the test was incorrectly considered as "failed"
in the case where the test would fail on the first run, but pass on a
subsequent flaky rerun.
2024-11-12 10:19:03 +01:00
Ondřej Surý a10d78db55 rem: usr: Remove RBTDB implementation
Remove the RBTDB database implementation, and only leave the QPDB
based implementations of zone and cache databases.  This means
it's no longer possible to choose the RBTDB to be default at the
compilation time and it's not possible to configure RBTDB as the
database backend in the configuration file.

Closes #5027

Merge branch '5027-remove-rbtdb-implementation' into 'main'

See merge request isc-projects/bind9!9733
2024-11-12 08:26:28 +00:00
Ondřej Surý 34b3e7cb40 Remove RBTDB implementation
QPDB is now a default implementation for both cache and zone.  Remove
the venerable RBTDB database implementation, so we can fast-track the
changes to the database without having to implement the design changes
to both QPDB and RBTDB and this allows us to be more aggressive when
refactoring the database design.
2024-11-12 09:07:19 +01:00
Nicki Křížek 32cc143da0 chg: dev: Use lists of expected artifacts in system tests
``clean.sh`` scripts have been replaced by lists of expected artifacts for each system test module. The list is defined using the custom ``pytest.mark.extra_artifacts`` mark, which can use both filenames and globs.

Closes #4261

Merge branch '4261-add-pytest-fixture-checking-test-artifacts' into 'main'

See merge request isc-projects/bind9!9426
2024-11-08 11:36:16 +00:00
Nicki Křížek f2cb2e5723 Remove invocations and mentions of clean.sh 2024-11-08 10:54:24 +01:00
Nicki Křížek 7c259fe254 Replace clean.sh files with extra_artifacts mark
The artifact lists in clean.sh and extra_artifacts might be slightly
different. The list was updated for each test to reflect the current
state.
2024-11-08 10:54:24 +01:00
Michał KępieńandNicki Křížek 3a9f4edddc Add pytest fixture for checking test artifacts
Prior to introducing the pytest runner, clean.sh files were used as a
list of files that the test is expected to leave around as artifacts and
check that no extra files were created.

With the pytest runner, those scripts are no longer used, but the
ability to detect extraneous files is still useful. Add a new
"extra_artifacts" mark which can be used for the same purpose.
2024-11-08 10:54:24 +01:00
Arаm Sаrgsyаn 60ec9ef507 fix: dev: Fix a data race between dns_zone_getxfr() and dns_xfrin_create()
There is a data race between the statistics channel, which uses
`dns_zone_getxfr()` to get a reference to `zone->xfr`, and the creation
of `zone->xfr`, because the latter happens outside of a zone lock.

Split the `dns_xfrin_create()` function into two parts to separate the
zone transfer starting part from the zone transfer object creation part.
This allows us to attach the new object to a local variable first, then
attach it to `zone->xfr` under a lock, and only then start the transfer.

Closes #5011

Merge branch '5011-dns_zone_getxfr-race-fix' into 'main'

See merge request isc-projects/bind9!9716
2024-11-07 09:58:47 +00:00
Aram Sargsyan dbf230650f Fix a data race between dns_zone_getxfr() and dns_xfrin_create()
There is a data race between the statistics channel, which uses
`dns_zone_getxfr()` to get a reference to `zone->xfr`, and the creation
of `zone->xfr`, because the latter happens outside of a zone lock.

Split the `dns_xfrin_create()` function into two parts to separate the
zone tranfer startring part from the zone transfer object creation part.
This allows us to attach the new object to a local variable first, then
attach it to `zone->xfr` under a lock, and only then start the transfer.
2024-11-07 08:47:52 +00:00
Ondřej Surý 4b47c96a89 chg: dev: Enforce type checking for dns_dbversion_t
Originally, the dns_dbversion_t was typedef'ed to void type.  This
allowed some flexibility, but using (void *) just removes any
type-checking that C might have.  Instead of using:

    typedef void dns_dbversion_t;

use a trick to define the type to non-existing structure:

    typedef struct dns_dbversion dns_dbversion_t;

This allows the C compilers to employ the type-checking while the
structure itself doesn't have to be ever defined because the actual
'storage' is never accessed using dns_dbversion_t type.

Merge branch 'ondrej/non-void-dns_dbversion_t' into 'main'

See merge request isc-projects/bind9!9724
2024-11-07 07:23:02 +00:00
Ondřej Surý 8a38c17cca Enforce type checking for dns_dbversiont_t
Originally, the dns_dbversion_t was typedef'ed to void type.  This
allowed some flexibility, but using (void *) just removes any
type-checking that C might have.  Instead of using:

    typedef void dns_dbversion_t;

use a trick to define the type to non-existing structure:

    typedef struct dns_dbversion dns_dbversion_t;

This allows the C compilers to employ the type-checking while the
structure itself doesn't have to be ever defined because the actual
'storage' is never accessed using dns_dbversion_t type.
2024-11-07 08:03:55 +01:00
Mark Andrews e8e1246dda rem: nil: Remove named_g_sessionkey and named_g_sessionkeyname
Remove named_g_sessionkey and named_g_sessionkeyname as they are declared and cleaned up but otherwise are unused.

Closes #5023

Merge branch '5023-remove-named_g_sessionkey-as-it-is-unused' into 'main'

See merge request isc-projects/bind9!9720
2024-11-07 02:17:17 +00:00
Mark Andrews f70ff727ec Remove named_g_sessionkey and named_g_sessionkeyname
They are only declared and cleaned up but otherwise unused.
2024-11-06 23:26:09 +00:00
Ondřej Surý 4b47c4f628 fix: dev: Enforce type checking for dns_dbnode_t
Originally, the dns_dbnode_t was typedef'ed to void type.  This allowed
some flexibility, but using (void *) just removes any type-checking that
C might have.  Instead of using:

    typedef void dns_dbnode_t;

use a trick to define the type to non-existing structure:

    typedef struct dns_dbnode dns_dbnode_t;

This allows the C compilers to employ the type-checking while the
structure itself doesn't have to be ever defined because the actual
'storage' is never accessed using dns_dbnode_t type.

Merge branch 'ondrej/non-void-dns_dbnode_t' into 'main'

See merge request isc-projects/bind9!9719
2024-11-06 17:05:03 +00:00
Ondřej Surý fbd5f614d7 Enforce type checking for dns_dbnode_t
Originally, the dns_dbnode_t was typedef'ed to void type.  This allowed
some flexibility, but using (void *) just removes any type-checking that
C might have.  Instead of using:

    typedef void dns_dbnode_t;

use a trick to define the type to non-existing structure:

    typedef struct dns_dbnode dns_dbnode_t;

This allows the C compilers to employ the type-checking while the
structure itself doesn't have to be ever defined because the actual
'storage' is never accessed using dns_dbnode_t type.
2024-11-06 17:08:04 +01:00
Alessio Podda ff94eb9e31 chg: dev: Unify parsing of query-source and other X-source options
The query-source option currently allows the address to be specified in two ways, either as every other X-source option, or as an
"address" key-value pair.
This merge request extends the `parse_sockaddrsub` config parsing function so that it can parse the query-source option. It also removes the separate config parsing function for `query-source`.

Closes #4961

Merge branch '4961-query-source-parsing-refactor' into 'main'

See merge request isc-projects/bind9!9551
2024-11-05 09:36:19 +00:00
Alessio Podda 7a57200f38 Merge parse_querysource and parse_sockaddrsub
The query-source option has the slight quirk of allowing the address to
be specified in two ways, either as every other source option, or as an
"address" key-value pair.
For this reason, it had a separate parsing function from other X-source
options, but it is possible to extend the parsing of other X-sources to
be generic and also handle query-source.
This commit just does that.
2024-11-05 09:37:08 +01:00
Ondřej Surý 14e6242ad4 fix: nil: Add OpenSSL includes as needed
The isc/crypto.h now directly includes the OpenSSL headers (evp.h) and
any application that includes that header also needs to have
OPENSSL_CFLAGS in the Makefile.am.  Adjust the required automake files
as needed.

Merge branch 'ondrej/add-missing-OPENSSL_CFLAGS' into 'main'

See merge request isc-projects/bind9!9713
2024-11-04 23:36:09 +00:00
Ondřej Surý 88103e72d5 Add OpenSSL includes as needed
The isc/crypto.h now directly includes the OpenSSL headers (evp.h) and
any application that includes that header also needs to have
OPENSSL_CFLAGS in the Makefile.am.  Adjust the required automake files
as needed.
2024-11-04 23:35:52 +00:00
Mark Andrews d0900b7edf chg: usr: Print expire option in transfer summary.
The zone transfer summary will now print the expire option value in the zone transfer summary.

Closes #5013

Merge branch '5013-print-expire-option-in-transfer-summary' into 'main'

See merge request isc-projects/bind9!9694
2024-11-04 18:26:49 +00:00
Mark Andrews 5253c75b7a Update zone transfer summary
Print the expire option in the zone transfer summary. This is
currently emitted in a DEBUG(1) message.
2024-11-04 17:53:16 +00:00
1390 changed files with 30704 additions and 57063 deletions
+2
View File
@@ -79,3 +79,5 @@ PenaltyExcessCharacter: 100
Standard: Cpp11
ContinuationIndentWidth: 8
ForEachMacros: [ 'cds_lfs_for_each', 'cds_lfs_for_each_safe', 'cds_list_for_each_entry_safe', 'ISC_LIST_FOREACH', 'ISC_LIST_FOREACH_SAFE', 'ISC_LIST_FOREACH_REV', 'ISC_LIST_FOREACH_REV_SAFE' ]
RemoveParentheses: ReturnStatement
RemoveSemicolon: true
+2
View File
@@ -78,3 +78,5 @@ PenaltyBreakString: 80
PenaltyExcessCharacter: 100
Standard: Cpp11
ContinuationIndentWidth: 8
RemoveParentheses: ReturnStatement
RemoveSemicolon: true
+4
View File
@@ -1544,3 +1544,7 @@ b7de2c7cb959fa35099d72c3f9b13938348c74e6
ff69d07fed2619a9bedf5ccc18cf106b7dd49bef
# Reformat sources with up-to-date clang-format-19
ebb5bd9c0f079de8970b538fe48e5f5c60ea7ee9
# Remove redundant semicolons after the closing braces of functions
1a19ce39db12ed4ecf59a3d0f5734656d24999a5
# Remove redundant parentheses from the return statement
0258850f202b7a46b52f3e3a4968c3fc68fe9a45
+1
View File
@@ -96,6 +96,7 @@ doc/man/pkcs11-tokens.8in
/GPATH
/GRTAGS
/GTAGS
TAGS
# Emacs specific files
\.dir-locals-2.el
/emacs.desktop
+119 -330
View File
@@ -51,12 +51,11 @@ variables:
# cross-testrun files as there is no need to use that feature in CI.
PYTEST_ADDOPTS: "-p no:cacheprovider"
# Default platforms to run "stress" tests on
BIND_STRESS_TEST_OS: linux
BIND_STRESS_TEST_ARCH: amd64
HYPOTHESIS_PROFILE: "ci"
# Some jobs may clean up the build artifacts unless this is set to 0.
CLEAN_BUILD_ARTIFACTS_ON_SUCCESS: 1
default:
# Allow all running CI jobs to be automatically canceled when a new
# version of a branch is pushed.
@@ -123,8 +122,8 @@ stages:
# Alpine Linux
.alpine-3.20-amd64: &alpine_3_20_amd64_image
image: "$CI_REGISTRY_IMAGE:alpine-3.20-amd64"
.alpine-3.21-amd64: &alpine_3_21_amd64_image
image: "$CI_REGISTRY_IMAGE:alpine-3.21-amd64"
<<: *linux_amd64
# Oracle Linux
@@ -171,16 +170,16 @@ stages:
# Fedora
.tsan-fedora-40-amd64: &tsan_fedora_40_amd64_image
image: "$CI_REGISTRY_IMAGE:tsan-fedora-40-amd64"
.tsan-fedora-41-amd64: &tsan_fedora_41_amd64_image
image: "$CI_REGISTRY_IMAGE:tsan-fedora-41-amd64"
<<: *linux_amd64
.fedora-40-amd64: &fedora_40_amd64_image
image: "$CI_REGISTRY_IMAGE:fedora-40-amd64"
.fedora-41-amd64: &fedora_41_amd64_image
image: "$CI_REGISTRY_IMAGE:fedora-41-amd64"
<<: *linux_amd64
.fedora-40-arm64: &fedora_40_arm64_image
image: "$CI_REGISTRY_IMAGE:fedora-40-arm64"
.fedora-41-arm64: &fedora_41_arm64_image
image: "$CI_REGISTRY_IMAGE:fedora-41-arm64"
<<: *linux_arm64
# Ubuntu
@@ -206,15 +205,15 @@ stages:
### QCOW2 Image Templates
.freebsd-13-amd64: &freebsd_13_amd64_image
image: "freebsd-13.3-x86_64"
image: "freebsd-13.4-x86_64"
<<: *libvirt_amd64
.freebsd-14-amd64: &freebsd_14_amd64_image
image: "freebsd-14.1-x86_64"
image: "freebsd-14.2-x86_64"
<<: *libvirt_amd64
.openbsd-amd64: &openbsd_amd64_image
image: "openbsd-7.5-x86_64"
image: "openbsd-7.6-x86_64"
<<: *libvirt_amd64
### Job Templates
@@ -316,9 +315,7 @@ 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"
@@ -379,6 +376,7 @@ stages:
- >
"$PYTEST" --junit-xml="$CI_PROJECT_DIR"/junit.xml -n "$TEST_PARALLEL_JOBS" | tee pytest.out.txt
- '( ! grep -F "grep: warning:" pytest.out.txt )'
- test "$CLEAN_BUILD_ARTIFACTS_ON_SUCCESS" -eq 0 || ( cd ../../.. && make clean >/dev/null 2>&1 )
after_script:
- test -n "${OUT_OF_TREE_WORKSPACE}" && cd "${OUT_OF_TREE_WORKSPACE}"
- *display_pytest_failures
@@ -433,6 +431,7 @@ stages:
- test -n "${OUT_OF_TREE_WORKSPACE}" && cd "${OUT_OF_TREE_WORKSPACE}"
script:
- make -j${TEST_PARALLEL_JOBS:-1} -k unit V=1
- test "$CLEAN_BUILD_ARTIFACTS_ON_SUCCESS" -eq 0 || make clean >/dev/null 2>&1
after_script:
- test -d bind-* && cd bind-*
- REALSOURCEDIR="$PWD"
@@ -469,10 +468,12 @@ stages:
junit: junit.xml
.docs: &docs_job
variables:
DOC_MAKE_TARGET: doc
stage: docs
script:
- *configure
- make -j${BUILD_PARALLEL_JOBS:-1} -k doc V=1
- make -j${BUILD_PARALLEL_JOBS:-1} -k ${DOC_MAKE_TARGET} V=1
- find doc/man/ -maxdepth 1 -name "*.[0-9]" -exec mandoc -T lint "{}" \; | ( ! grep -v -e "skipping paragraph macro. sp after" -e "unknown font, skipping request. ft C" -e "input text line longer than 80 bytes" )
.respdiff: &respdiff_job
@@ -566,21 +567,29 @@ clang-format:
when: on_failure
coccinelle:
<<: *precheck_job
######################################################################
# Revert to using the "precheck_job" anchor after the "base" image is
# upgraded to Debian trixie, which has Coccinelle 1.2.
<<: *default_triggering_rules
<<: *debian_sid_amd64_image
stage: precheck
######################################################################
needs: []
script:
- util/check-cocci
- if test "$(git status --porcelain | grep -Ev '\?\?' | wc -l)" -gt "0"; then git status --short; exit 1; fi
pylint:
<<: *precheck_job
<<: *default_triggering_rules
<<: *debian_sid_amd64_image
stage: precheck
needs: []
variables:
PYTHONPATH: "${CI_PROJECT_DIR}/bin/tests/system"
script:
- pylint --rcfile $CI_PROJECT_DIR/.pylintrc $(git ls-files '*.py' | grep -vE '(ans\.py|dangerfile\.py|^bin/tests/system/|^contrib/)')
# Ignore Pylint wrong-import-position error in system test to enable use of pytest.importorskip
- pylint --rcfile $CI_PROJECT_DIR/.pylintrc --disable=wrong-import-position $(git ls-files 'bin/tests/system/*.py' | grep -vE 'ans\.py')
- pylint --rcfile $CI_PROJECT_DIR/.pylintrc --disable=wrong-import-position $(git ls-files 'bin/tests/system/*.py' | grep -vE '(ans\.py|vulture_ignore_list\.py)')
reuse:
<<: *precheck_job
@@ -606,11 +615,6 @@ shfmt:
danger:
<<: *precheck_job
# Keep the GIT_DEPTH environment variable set to a "high number" before
# https://github.com/libgit2/libgit2/pull/6662 is addressed and integrated
# into pygit2.
variables:
GIT_DEPTH: 1000
needs: []
script:
- pip install git+https://gitlab.isc.org/isc-projects/hazard.git
@@ -626,7 +630,9 @@ checkbashisms:
- checkbashisms $(find . -path './.git' -prune -o -type f -exec sh -c 'head -n 1 "{}" | grep -qsF "#!/bin/sh"' \; -print)
mypy:
<<: *precheck_job
<<: *default_triggering_rules
<<: *debian_sid_amd64_image
stage: precheck
script:
- mypy "bin/tests/system/isctest/"
@@ -663,18 +669,33 @@ changelog:
GIT_AUTHOR_EMAIL: $GITLAB_USER_EMAIL
GIT_COMMITTER_NAME: $GITLAB_USER_NAME
GIT_COMMITTER_EMAIL: $GITLAB_USER_EMAIL
DOC_MAKE_TARGET: html
before_script:
- echo -e "$CI_MERGE_REQUEST_TITLE\n" > commitmsg
- sed -i 's/^Draft:\s*//' commitmsg
- echo -e "$CI_MERGE_REQUEST_DESCRIPTION" >> commitmsg
- git commit --allow-empty -F commitmsg
- ./contrib/gitchangelog/gitchangelog.py HEAD^..HEAD
- ./contrib/gitchangelog/gitchangelog.py HEAD^..HEAD >> $(ls doc/changelog/changelog-9.* | sort --version-sort | tail -n 1)
after_script:
- git diff
needs:
- job: autoreconf
artifacts: true
artifacts:
untracked: true
linkcheck:
<<: *base_image
stage: docs
script:
- pushd doc/arm/ > /dev/null && sphinx-build -b linkcheck . linkcheck_output/
artifacts:
paths:
- doc/arm/linkcheck_output/
rules:
- if: '$CI_PIPELINE_SOURCE == "schedule"'
needs: []
docs:
<<: *default_triggering_rules
<<: *base_image
@@ -722,11 +743,14 @@ cross-version-config-tests:
# also from the $BIND_BASELINE_VERSION.
- find bin/tests/system/ -mindepth 1 -maxdepth 1 -type d -exec sh -c 'test -e ../"$0" || rm -rfv -- "$0"' {} \;
- cd bin/tests/system
# System tests that employ binary drivers will fail on ABI change and
# should not be run.
- rm -r dlzexternal
- rm -r dyndb
# Run the setup phase of all system tests in the most recently tagged BIND 9
# release using the binaries built for the current BIND 9 version. This
# intends to detect obvious backward compatibility issues with the latter.
- >
echo "${CI_PROJECT_DIR}" > isctest/vars/.ac_vars/TOP_BUILDDIR
- sed -i "s|f\"{AC_VARS\['TOP_BUILDDIR'\]}|\"$CI_PROJECT_DIR|g" isctest/vars/basic.py
- >
"$PYTEST" --setup-only --junit-xml="$CI_PROJECT_DIR"/junit.xml -n "${TEST_PARALLEL_JOBS:-1}"
needs:
@@ -744,28 +768,28 @@ cross-version-config-tests:
expire_in: "1 day"
when: always
# Jobs for regular GCC builds on Alpine Linux 3.20 (amd64)
# Jobs for regular GCC builds on Alpine Linux 3.21 (amd64)
gcc:alpine3.20:amd64:
gcc:alpine3.21:amd64:
variables:
CC: gcc
CFLAGS: "${CFLAGS_COMMON}"
EXTRA_CONFIGURE: "${WITHOUT_READLINE}"
<<: *alpine_3_20_amd64_image
<<: *alpine_3_21_amd64_image
<<: *build_job
system:gcc:alpine3.20:amd64:
<<: *alpine_3_20_amd64_image
system:gcc:alpine3.21:amd64:
<<: *alpine_3_21_amd64_image
<<: *system_test_job
needs:
- job: gcc:alpine3.20:amd64
- job: gcc:alpine3.21:amd64
artifacts: true
unit:gcc:alpine3.20:amd64:
<<: *alpine_3_20_amd64_image
unit:gcc:alpine3.21:amd64:
<<: *alpine_3_21_amd64_image
<<: *unit_test_job
needs:
- job: gcc:alpine3.20:amd64
- job: gcc:alpine3.21:amd64
artifacts: true
# Jobs for regular GCC builds on Oracle Linux 8 (amd64)
@@ -887,10 +911,10 @@ gcc:tarball:nosphinx:
gcc:bookworm:amd64:
variables:
BUILD_CONTRIB: 1
CC: gcc
CFLAGS: "${CFLAGS_COMMON} --coverage -O0"
EXTRA_CONFIGURE: "--with-libidn2 ${WITH_READLINE_LIBEDIT}"
# Tracing needs to be disabled otherwise gcovr fails
EXTRA_CONFIGURE: "--with-libidn2 ${WITH_READLINE_LIBEDIT} --disable-tracing"
RUN_MAKE_INSTALL: 1
<<: *debian_bookworm_amd64_image
<<: *build_job
@@ -900,8 +924,9 @@ system:gcc:bookworm:amd64:
<<: *system_test_gcov_job
variables:
CI_ENABLE_ALL_TESTS: 1
CLEAN_BUILD_ARTIFACTS_ON_SUCCESS: 0
TZ: Australia/Sydney
needs:
needs: # using artifacts from unit test job is required for gcov
- job: unit:gcc:bookworm:amd64
artifacts: true
@@ -910,6 +935,7 @@ unit:gcc:bookworm:amd64:
<<: *unit_test_gcov_job
variables:
CI_ENABLE_ALL_TESTS: 1
CLEAN_BUILD_ARTIFACTS_ON_SUCCESS: 0
needs:
- job: gcc:bookworm:amd64
artifacts: true
@@ -920,7 +946,7 @@ gcc:bookworm:rbt:amd64:
variables:
CC: gcc
CFLAGS: "${CFLAGS_COMMON}"
EXTRA_CONFIGURE: "--with-libidn2 --with-zonedb=rbt --with-cachedb=rbt"
EXTRA_CONFIGURE: "--with-libidn2"
<<: *debian_bookworm_amd64_image
<<: *build_job
@@ -928,7 +954,7 @@ system:gcc:bookworm:rbt:amd64:
<<: *debian_bookworm_amd64_image
<<: *system_test_job
needs:
- job: unit:gcc:bookworm:rbt:amd64
- job: gcc:bookworm:rbt:amd64
artifacts: true
unit:gcc:bookworm:rbt:amd64:
@@ -1205,7 +1231,7 @@ unit:gcc:noble:amd64:
- job: gcc:noble:amd64
artifacts: true
# Jobs for ASAN builds on Fedora 40 (amd64)
# Jobs for ASAN builds on Fedora 41 (amd64)
gcc:asan:
variables:
@@ -1213,20 +1239,20 @@ gcc:asan:
CFLAGS: "${CFLAGS_COMMON} -fsanitize=address,undefined"
LDFLAGS: "-fsanitize=address,undefined"
EXTRA_CONFIGURE: "--with-libidn2 --without-jemalloc"
<<: *fedora_40_amd64_image
<<: *fedora_41_amd64_image
<<: *build_job
system:gcc:asan:
variables:
LSAN_OPTIONS: "suppressions=$CI_PROJECT_DIR/suppr-lsan.txt"
<<: *fedora_40_amd64_image
<<: *fedora_41_amd64_image
<<: *system_test_job
needs:
- job: gcc:asan
artifacts: true
unit:gcc:asan:
<<: *fedora_40_amd64_image
<<: *fedora_41_amd64_image
<<: *unit_test_job
needs:
- job: gcc:asan
@@ -1242,6 +1268,8 @@ clang:asan:
<<: *build_job
system:clang:asan:
variables:
LSAN_OPTIONS: "suppressions=$CI_PROJECT_DIR/suppr-lsan.txt"
<<: *base_image
<<: *system_test_job
needs:
@@ -1255,7 +1283,7 @@ unit:clang:asan:
- job: clang:asan
artifacts: true
# Jobs for TSAN builds on Fedora 40 (amd64)
# Jobs for TSAN builds on Fedora 41 (amd64)
gcc:tsan:
variables:
@@ -1263,13 +1291,13 @@ gcc:tsan:
CFLAGS: "${CFLAGS_COMMON} -Wno-stringop-overread -ggdb -O2 -fsanitize=thread"
LDFLAGS: "-fsanitize=thread"
EXTRA_CONFIGURE: "--with-libidn2 --enable-pthread-rwlock --without-jemalloc PKG_CONFIG_PATH=/opt/tsan/lib/pkgconfig"
<<: *tsan_fedora_40_amd64_image
<<: *tsan_fedora_41_amd64_image
<<: *build_job
system:gcc:tsan:
variables:
TSAN_OPTIONS: "${TSAN_OPTIONS_FEDORA}"
<<: *tsan_fedora_40_amd64_image
<<: *tsan_fedora_41_amd64_image
<<: *system_test_tsan_job
needs:
- job: gcc:tsan
@@ -1278,7 +1306,7 @@ system:gcc:tsan:
unit:gcc:tsan:
variables:
TSAN_OPTIONS: "${TSAN_OPTIONS_FEDORA}"
<<: *tsan_fedora_40_amd64_image
<<: *tsan_fedora_41_amd64_image
<<: *unit_test_tsan_job
needs:
- job: gcc:tsan
@@ -1344,7 +1372,6 @@ tsan:stress:
clang:bookworm:amd64:
variables:
BUILD_CONTRIB: 1
CC: ${CLANG}
CFLAGS: "${CFLAGS_COMMON} -Wenum-conversion -DOPENSSL_API_COMPAT=10100"
# See https://gitlab.isc.org/isc-projects/bind9/-/issues/3444
@@ -1578,9 +1605,10 @@ respdiff:
variables:
CC: gcc
CFLAGS: "${CFLAGS_COMMON} -Og -DISC_TRACK_PTHREADS_OBJECTS"
MAX_DISAGREEMENTS_PERCENTAGE: "0.5"
MAX_DISAGREEMENTS_PERCENTAGE: "0.15"
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"
- cd ../.. && make clean >/dev/null 2>&1
respdiff:asan:
<<: *respdiff_job
@@ -1591,9 +1619,10 @@ respdiff:asan:
CFLAGS: "${CFLAGS_COMMON} -Og -fsanitize=address,undefined"
LDFLAGS: "-fsanitize=address,undefined"
EXTRA_CONFIGURE: "--without-jemalloc"
MAX_DISAGREEMENTS_PERCENTAGE: "0.5"
MAX_DISAGREEMENTS_PERCENTAGE: "0.15"
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"
- cd ../.. && make clean >/dev/null 2>&1
respdiff:tsan:
<<: *respdiff_job
@@ -1604,10 +1633,11 @@ respdiff:tsan:
CFLAGS: "${CFLAGS_COMMON} -Og -fsanitize=thread"
LDFLAGS: "-fsanitize=thread"
EXTRA_CONFIGURE: "--enable-pthread-rwlock --without-jemalloc PKG_CONFIG_PATH=/opt/tsan/lib/pkgconfig"
MAX_DISAGREEMENTS_PERCENTAGE: "0.5"
MAX_DISAGREEMENTS_PERCENTAGE: "0.15"
TSAN_OPTIONS: "${TSAN_OPTIONS_DEBIAN}"
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"
- cd ../.. && make clean >/dev/null 2>&1
after_script:
- *find_python
- *parse_tsan
@@ -1619,9 +1649,10 @@ respdiff-third-party:
variables:
CC: gcc
CFLAGS: "${CFLAGS_COMMON} -Og"
MAX_DISAGREEMENTS_PERCENTAGE: "0.5"
MAX_DISAGREEMENTS_PERCENTAGE: "0.2"
script:
- bash respdiff.sh -s third_party -q "${PWD}/100k_mixed.txt" -c 1 -w "${PWD}/rspworkdir" "${CI_PROJECT_DIR}"
- cd ../.. && make clean >/dev/null 2>&1
# Performance tests
@@ -1650,281 +1681,39 @@ shotgun:dot:
when: delayed
start_in: 5 minutes
shotgun:doh-get:
<<: *shotgun_job
variables:
SHOTGUN_SCENARIO: doh-get
SHOTGUN_TRAFFIC_MULTIPLIER: 3
when: delayed
start_in: 5 minutes
.stress-test: &stress_test
stage: performance
generate-stress-test-configs:
<<: *base_image
<<: *default_triggering_rules
stage: precheck
script:
- *configure
- *setup_interfaces
- make -j${BUILD_PARALLEL_JOBS:-1} -k all V=1
- make DESTDIR="${INSTALL_PATH}" install
- git clone --depth 1 https://gitlab.isc.org/isc-projects/bind9-qa.git
- cd bind9-qa/stress
- LD_LIBRARY_PATH="${INSTALL_PATH}/usr/local/lib" BIND_INSTALL_PATH="${INSTALL_PATH}/usr/local" WORKSPACE="${CI_PROJECT_DIR}" bash stress.sh
- util/generate-stress-test-configs.py > stress-test-configs.yml
artifacts:
paths:
- stress-test-configs.yml
needs: []
stress-test-child-pipeline:
<<: *default_triggering_rules
stage: performance
trigger:
include:
- artifact: stress-test-configs.yml
job: generate-stress-test-configs
needs:
- job: autoreconf
- job: generate-stress-test-configs
artifacts: true
.stress-test-long: &stress_test_long_job
<<: *stress_test
artifacts:
untracked: true
exclude:
- "output/ns4/*.dtq*"
- "output/ns4/large-delta-rpz*.local"
- "output/rpz_*"
expire_in: "1 week"
when: always
timeout: 2h
.stress-test-short: &stress_test_short_job
<<: *stress_test
only:
- merge_requests
artifacts:
untracked: true
exclude:
- "output/ns4/*.dtq*"
- "output/ns4/large-delta-rpz*.local"
- "output/rpz_*"
when: always
stress:short:authoritative:fedora:40:amd64:
<<: *fedora_40_amd64_image
<<: *linux_amd64
<<: *stress_test_short_job
variables:
CC: gcc
CFLAGS: "${CFLAGS_COMMON} -Og"
FLAME: /usr/bin/flame
MODE: authoritative
RATE: 10000
RUN_TIME: 15
stress:short:recursive:fedora:40:amd64:
<<: *fedora_40_amd64_image
<<: *linux_amd64
<<: *stress_test_short_job
variables:
CC: gcc
CFLAGS: "${CFLAGS_COMMON} -Og"
FLAME: /usr/bin/flame
MODE: recursive
RATE: 10000
RUN_TIME: 15
stress:short:rpz:fedora:40:amd64:
<<: *fedora_40_amd64_image
<<: *linux_amd64
<<: *stress_test_short_job
variables:
CC: gcc
CFLAGS: "${CFLAGS_COMMON} -Og"
FLAME: /usr/bin/flame
MODE: rpz
RATE: 1500
RUN_TIME: 15
stress:short:authoritative:fedora:40:arm64:
<<: *fedora_40_arm64_image
<<: *linux_arm64
<<: *stress_test_short_job
variables:
CC: gcc
CFLAGS: "${CFLAGS_COMMON} -Og"
FLAME: /usr/bin/flame
MODE: authoritative
RATE: 10000
RUN_TIME: 15
stress:short:recursive:fedora:40:arm64:
<<: *fedora_40_arm64_image
<<: *linux_arm64
<<: *stress_test_short_job
variables:
CC: gcc
CFLAGS: "${CFLAGS_COMMON} -Og"
FLAME: /usr/bin/flame
MODE: recursive
RATE: 10000
RUN_TIME: 15
stress:short:rpz:fedora:40:arm64:
<<: *fedora_40_arm64_image
<<: *linux_arm64
<<: *stress_test_short_job
variables:
CC: gcc
CFLAGS: "${CFLAGS_COMMON} -Og"
FLAME: /usr/bin/flame
MODE: rpz
RATE: 1500
RUN_TIME: 15
stress:short:authoritative:freebsd13:amd64:
<<: *freebsd_stress_amd64
<<: *stress_test_short_job
variables:
CC: clang
CFLAGS: "${CFLAGS_COMMON} -Og"
FLAME: /usr/local/bin/flame
MODE: authoritative
RATE: 10000
RUN_TIME: 15
stress:short:recursive:freebsd13:amd64:
<<: *freebsd_stress_amd64
<<: *stress_test_short_job
variables:
CC: clang
CFLAGS: "${CFLAGS_COMMON} -Og"
FLAME: /usr/local/bin/flame
MODE: recursive
RATE: 10000
RUN_TIME: 15
stress:short:rpz:freebsd13:amd64:
<<: *freebsd_stress_amd64
<<: *stress_test_short_job
variables:
CC: clang
CFLAGS: "${CFLAGS_COMMON} -Og"
FLAME: /usr/local/bin/flame
MODE: rpz
RATE: 1500
RUN_TIME: 15
stress:authoritative:fedora:40:amd64:
<<: *fedora_40_amd64_image
<<: *linux_amd64
<<: *stress_test_long_job
variables:
CC: gcc
CFLAGS: "${CFLAGS_COMMON} -Og"
FLAME: /usr/bin/flame
MODE: authoritative
RATE: 10000
RUN_TIME: 60
only:
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:40:amd64:
<<: *fedora_40_amd64_image
<<: *linux_amd64
<<: *stress_test_long_job
variables:
CC: gcc
CFLAGS: "${CFLAGS_COMMON} -Og"
FLAME: /usr/bin/flame
MODE: recursive
RATE: 10000
RUN_TIME: 60
only:
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:40:amd64:
<<: *fedora_40_amd64_image
<<: *linux_amd64
<<: *stress_test_long_job
variables:
CC: gcc
CFLAGS: "${CFLAGS_COMMON} -Og"
FLAME: /usr/bin/flame
MODE: rpz
RATE: 1500
RUN_TIME: 60
only:
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:40:arm64:
<<: *fedora_40_arm64_image
<<: *linux_arm64
<<: *stress_test_long_job
variables:
CC: gcc
CFLAGS: "${CFLAGS_COMMON} -Og"
FLAME: /usr/bin/flame
MODE: authoritative
RATE: 10000
RUN_TIME: 60
only:
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:40:arm64:
<<: *fedora_40_arm64_image
<<: *linux_arm64
<<: *stress_test_long_job
variables:
CC: gcc
CFLAGS: "${CFLAGS_COMMON} -Og"
FLAME: /usr/bin/flame
MODE: recursive
RATE: 10000
RUN_TIME: 60
only:
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:40:arm64:
<<: *fedora_40_arm64_image
<<: *linux_arm64
<<: *stress_test_long_job
variables:
CC: gcc
CFLAGS: "${CFLAGS_COMMON} -Og"
FLAME: /usr/bin/flame
MODE: rpz
RATE: 1500
RUN_TIME: 60
only:
variables:
- $CI_COMMIT_TAG || ($BIND_STRESS_TEST_OS =~ /linux/i && $BIND_STRESS_TEST_MODE =~ /rpz/i && $BIND_STRESS_TEST_ARCH =~ /arm64/i)
stress:authoritative:freebsd13:amd64:
<<: *freebsd_stress_amd64
<<: *stress_test_long_job
variables:
CC: clang
CFLAGS: "${CFLAGS_COMMON} -Og"
FLAME: /usr/local/bin/flame
MODE: authoritative
RATE: 10000
RUN_TIME: 60
only:
variables:
- $CI_COMMIT_TAG || ($BIND_STRESS_TEST_OS =~ /freebsd/i && $BIND_STRESS_TEST_MODE =~ /authoritative/i && $BIND_STRESS_TEST_ARCH =~ /amd64/i)
stress:recursive:freebsd13:amd64:
<<: *freebsd_stress_amd64
<<: *stress_test_long_job
variables:
CC: clang
CFLAGS: "${CFLAGS_COMMON} -Og"
FLAME: /usr/local/bin/flame
MODE: recursive
RATE: 10000
RUN_TIME: 60
only:
variables:
- $CI_COMMIT_TAG || ($BIND_STRESS_TEST_OS =~ /freebsd/i && $BIND_STRESS_TEST_MODE =~ /recursive/i && $BIND_STRESS_TEST_ARCH =~ /amd64/i)
stress:rpz:freebsd13:amd64:
<<: *freebsd_stress_amd64
<<: *stress_test_long_job
variables:
CC: clang
CFLAGS: "${CFLAGS_COMMON} -Og"
FLAME: /usr/local/bin/flame
MODE: rpz
RATE: 1500
RUN_TIME: 60
only:
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.
@@ -2015,10 +1804,10 @@ pairwise:
- set +o pipefail; git log --format='%H' | grep --silent "$CI_COMMIT_BEFORE_SHA" && PREVIOUS_TIP_REACHABLE=1
- test "$PREVIOUS_TIP_REACHABLE" != "1" && echo "force-push detected, stop" && exit 1
# non-fast-forward merges are disabled so we have to have merge commit on top
- MERGE_REQUEST_ID="$(git log -1 --format='%b' | sed --silent -e 's/^See merge request [^!]\+!//p')"
- MERGE_REQUEST_ID="$(git log -1 --format='%b' | sed --silent -e "s|^See merge request ${CI_PROJECT_PATH}\!||p")"
- >
: stop if this is not a merge request
- test "$MERGE_REQUEST_ID" -ge 0
: stop if this is not a merge request in the current project\'s namespace
- test -n "$MERGE_REQUEST_ID"
- git clone --depth 1 https://gitlab.isc.org/isc-projects/bind9-qa.git
backports:
@@ -2034,6 +1823,6 @@ backports:
merged-metadata:
<<: *post_merge
rules:
- if: '$CI_PIPELINE_SOURCE == "push" && ($CI_COMMIT_REF_NAME =~ /^bind-9.[0-9]+(-sub)?$/ || $CI_COMMIT_REF_NAME =~ /^bind-9.[0-9]+.[0-9]+-release$/ || $CI_COMMIT_REF_NAME == $CI_DEFAULT_BRANCH)'
- if: '$CI_PIPELINE_SOURCE == "push" && ($CI_COMMIT_REF_NAME =~ /^bind-9.[0-9]+(-sub)?$/ || $CI_COMMIT_REF_NAME =~ /^v9.[0-9]+.[0-9]+-release$/ || $CI_COMMIT_REF_NAME == $CI_DEFAULT_BRANCH)'
script:
- bind9-qa/releng/after_merge.py "$CI_PROJECT_ID" "$MERGE_REQUEST_ID"
@@ -31,11 +31,11 @@ confidential!
- [ ] [:link:][step_deputy] **(IM)** Pick a Deputy Incident Manager
- [ ] [:link:][step_respond] **(IM)** Respond to the bug reporter
- [ ] [:link:][step_public_mrs] **(SwEng)** Ensure there are no public merge requests which inadvertently disclose the issue
- [ ] [:link:][step_coordinate_cve_id] **(SwEng)** Check if we need to coordinate with other vendors (an industry-wide CVE identifier might be necessary)
- [ ] [:link:][step_assign_cve_id] **(IM)** Assign a CVE identifier
- [ ] [:link:][step_note_cve_info] **(SwEng)** Update this issue with the assigned CVE identifier, the CVSS score, and CWE category
- [ ] [:link:][step_note_cve_info] **(SwEng)** Update this issue with the assigned CVE identifier, the CVSS score, and the CWE category
- [ ] [:link:][step_versions_affected] **(SwEng)** Determine the range of product versions affected (including the Subscription Edition)
- [ ] [:link:][step_workarounds] **(SwEng)** Determine whether workarounds for the problem exist
- [ ] [:link:][step_coordinate] **(SwEng)** If necessary, coordinate with other parties
- [ ] [:link:][step_earliest_prepare] **(Support)** Prepare "earliest" notification text
- [ ] [:link:][step_earliest_send] **(Support)** Update "earliest" notification ticket in support portal Earliest queue which will notify earliest customers
- [ ] [:link:][step_advisory_mr] **(Support)** Create a merge request for the Security Advisory and include all readily available information in it
@@ -48,6 +48,7 @@ confidential!
- [ ] [:link:][step_backports] **(SwEng)** Prepare backports of the merge request addressing the problem for all affected (and still maintained) branches of a given product
- [ ] [:link:][step_finish_advisory] **(Support)** Finish preparing the Security Advisory
- [ ] [:link:][step_meta_issue] **(QA)** Create (or update) the private issue containing links to fixes & reproducers for all CVEs fixed in a given release cycle
- [ ] [:link:][step_coordinate_check] **(SwEng)** Make sure other vendors are able to release on the date that was previously agreed upon
- [ ] [:link:][step_merge_fixes] **(QA)** Merge the CVE fixes in CVE identifier order
- [ ] [:link:][step_patches] **(QA)** Prepare a standalone patch for the last stable release of each affected (and still maintained) product branch
- [ ] [:link:][step_asn_releases] **(QA)** Prepare ASN releases (as outlined in the Release Checklist)
@@ -68,15 +69,16 @@ confidential!
### On the Day of Public Disclosure
- [ ] [:link:][step_clearance] **(IM)** Grant QA & Marketing clearance to proceed with public release
- [ ] [:link:][step_publish] **(QA/Marketing)** Publish the releases (as outlined in the release checklist)
- [ ] [:link:][step_matrix] **(Support)** (BIND 9 only) Add the new CVEs to the vulnerability matrix in the Knowledge Base
- [ ] [:link:][step_publish_advisory] **(Support)** Bump Document Version for the Security Advisory and publish it in the Knowledge Base
- [ ] [:link:][step_bump_advisory] **(Support)** Bump Document Version for the Security Advisory in Printing Press
- [ ] [:link:][step_publish_advisory] **(Support)** Publish the Security Advisory in the Knowledge Base
- [ ] [:link:][step_publish] **(QA/Marketing)** Publish the releases (as outlined in the release checklist)
- [ ] [:link:][step_notifications] **(First IM)** Send notification emails to third parties
- [ ] [:link:][step_mitre] **(First IM)** Advise MITRE about the disclosed CVEs
- [ ] [:link:][step_merge_advisory] **(First IM)** Merge the Security Advisory merge request
- [ ] [:link:][step_embargo_end] **(IM)** Inform original reporter (if external) that the security disclosure process is complete
- [ ] [:link:][step_asn_clear] **(Support)** Update the tickets in the ASN queues in RT that the embargo is lifted
- [ ] [:link:][step_customers] **(Marketing)** Open a ticket in the <software name> Announce queue that the release is published
- [ ] [:link:][step_customers] **(Marketing)** Open a ticket in the appropriate announce queue in RT that the release is published
### After Public Disclosure
@@ -85,13 +87,13 @@ confidential!
[step_deputy]: https://gitlab.isc.org/isc-private/isc-wiki/-/wikis/Security-Incident-Handling-Checklist-Explanations#pick-a-deputy-incident-manager
[step_respond]: https://gitlab.isc.org/isc-private/isc-wiki/-/wikis/Security-Incident-Handling-Checklist-Explanations#respond-to-the-bug-reporter
[step_public_mrs]: https://gitlab.isc.org/isc-private/isc-wiki/-/wikis/Security-Incident-Handling-Checklist-Explanations#ensure-there-are-no-public-merge-requests-which-inadvertently-disclose-the-issue
[step_coordinate_cve_id]: https://gitlab.isc.org/isc-private/isc-wiki/-/wikis/Security-Incident-Handling-Checklist-Explanations#check-if-we-need-to-coordinate-with-other-vendors-an-industry-wide-cve-identifier-might-be-necessary
[step_assign_cve_id]: https://gitlab.isc.org/isc-private/isc-wiki/-/wikis/Security-Incident-Handling-Checklist-Explanations#assign-a-cve-identifier
[step_note_cve_info]: https://gitlab.isc.org/isc-private/isc-wiki/-/wikis/Security-Incident-Handling-Checklist-Explanations#update-this-issue-with-the-assigned-cve-identifier-the-cvss-score-and-the-cwe-category
[step_versions_affected]: https://gitlab.isc.org/isc-private/isc-wiki/-/wikis/Security-Incident-Handling-Checklist-Explanations#determine-the-range-of-product-versions-affected-including-the-subscription-edition
[step_workarounds]: https://gitlab.isc.org/isc-private/isc-wiki/-/wikis/Security-Incident-Handling-Checklist-Explanations#determine-whether-workarounds-for-the-problem-exist
[step_coordinate]: https://gitlab.isc.org/isc-private/isc-wiki/-/wikis/Security-Incident-Handling-Checklist-Explanations#if-necessary-coordinate-with-other-parties
[step_earliest_prepare]: https://gitlab.isc.org/isc-private/isc-wiki/-/wikis/Security-Incident-Handling-Checklist-Explanations#prepare-earliest-notification-text-and-hand-it-off-to-marketing
[step_earliest_send]: https://gitlab.isc.org/isc-private/isc-wiki/-/wikis/Security-Incident-Handling-Checklist-Explanations#update-earliest-notification-document-in-sf-portal-and-send-bulk-email-to-earliest-customers
[step_earliest_prepare]: https://gitlab.isc.org/isc-private/isc-wiki/-/wikis/Security-Incident-Handling-Checklist-Explanations#prepare-earliest-notification-text
[step_earliest_send]: https://gitlab.isc.org/isc-private/isc-wiki/-/wikis/Security-Incident-Handling-Checklist-Explanations#update-earliest-notification-ticket-in-support-portal-earliest-queue-which-will-notify-earliest-customers
[step_advisory_mr]: https://gitlab.isc.org/isc-private/isc-wiki/-/wikis/Security-Incident-Handling-Checklist-Explanations#create-a-merge-request-for-the-security-advisory-and-include-all-readily-available-information-in-it
[step_reproducer_mr]: https://gitlab.isc.org/isc-private/isc-wiki/-/wikis/Security-Incident-Handling-Checklist-Explanations#prepare-a-private-merge-request-containing-a-system-test-reproducing-the-problem
[step_notify_support]: https://gitlab.isc.org/isc-private/isc-wiki/-/wikis/Security-Incident-Handling-Checklist-Explanations#notify-support-when-a-reproducer-is-ready
@@ -102,25 +104,26 @@ confidential!
[step_backports]: https://gitlab.isc.org/isc-private/isc-wiki/-/wikis/Security-Incident-Handling-Checklist-Explanations#prepare-backports-of-the-merge-request-addressing-the-problem-for-all-affected-and-still-maintained-branches-of-a-given-product
[step_finish_advisory]: https://gitlab.isc.org/isc-private/isc-wiki/-/wikis/Security-Incident-Handling-Checklist-Explanations#finish-preparing-the-security-advisory
[step_meta_issue]: https://gitlab.isc.org/isc-private/isc-wiki/-/wikis/Security-Incident-Handling-Checklist-Explanations#create-or-update-the-private-issue-containing-links-to-fixes-reproducers-for-all-cves-fixed-in-a-given-release-cycle
[step_changes]: https://gitlab.isc.org/isc-private/isc-wiki/-/wikis/Security-Incident-Handling-Checklist-Explanations#bind-9-only-reserve-a-block-of-changes-placeholders-once-the-complete-set-of-vulnerabilities-fixed-in-a-given-release-cycle-is-determined
[step_coordinate_check]: https://gitlab.isc.org/isc-private/isc-wiki/-/wikis/Security-Incident-Handling-Checklist-Explanations#make-sure-other-vendors-are-able-to-release-on-the-date-that-was-previously-agreed-upon
[step_merge_fixes]: https://gitlab.isc.org/isc-private/isc-wiki/-/wikis/Security-Incident-Handling-Checklist-Explanations#merge-the-cve-fixes-in-cve-identifier-order
[step_patches]: https://gitlab.isc.org/isc-private/isc-wiki/-/wikis/Security-Incident-Handling-Checklist-Explanations#prepare-a-standalone-patch-for-the-last-stable-release-of-each-affected-and-still-maintained-product-branch
[step_asn_releases]: https://gitlab.isc.org/isc-private/isc-wiki/-/wikis/Security-Incident-Handling-Checklist-Explanations#prepare-asn-releases-as-outlined-in-the-release-checklist
[step_asn_documents]: https://gitlab.isc.org/isc-private/isc-wiki/-/wikis/Security-Incident-Handling-Checklist-Explanations#update-the-text-on-the-t-5-from-the-printing-press-project-and-earliest-asn-documents-in-the-sf-portal
[step_asn_links]: https://gitlab.isc.org/isc-private/isc-wiki/-/wikis/Security-Incident-Handling-Checklist-Explanations#bind-9-only-update-the-bind-s-information-document-in-sf-with-download-links-to-the-new-versions
[step_asn_send]: https://gitlab.isc.org/isc-private/isc-wiki/-/wikis/Security-Incident-Handling-Checklist-Explanations#bulk-email-eligible-customers-to-check-the-sf-portal
[step_asn_links]: https://gitlab.isc.org/isc-private/isc-wiki/-/wikis/Security-Incident-Handling-Checklist-Explanations#bind-9-only-update-the-bind-s-information-document-in-the-support-portal-with-download-links-to-the-new-versions
[step_asn_send]: https://gitlab.isc.org/isc-private/isc-wiki/-/wikis/Security-Incident-Handling-Checklist-Explanations#notify-eligible-customers-by-adding-a-ticket-to-the-5-day-queue-in-rt-with-the-text-of-the-advisory-earliest-and-t-5
[step_preannouncement]: https://gitlab.isc.org/isc-private/isc-wiki/-/wikis/Security-Incident-Handling-Checklist-Explanations#bind-9-only-send-a-pre-announcement-email-to-the-bind-announce-mailing-list-to-alert-users-that-the-upcoming-release-will-include-security-fixes
[step_asn_send]: https://gitlab.isc.org/isc-private/isc-wiki/-/wikis/Security-Incident-Handling-Checklist-Explanations#notify-eligible-customers-by-adding-a-ticket-to-the-3-day-queue-in-rt-with-the-text-of-the-advisory-t-3
[step_packager_emails]: https://gitlab.isc.org/isc-private/isc-wiki/-/wikis/Security-Incident-Handling-Checklist-Explanations#send-notifications-to-os-packagers
[step_clearance]: https://gitlab.isc.org/isc-private/isc-wiki/-/wikis/Security-Incident-Handling-Checklist-Explanations#grant-qa-marketing-clearance-to-proceed-with-public-release
[step_publish]: https://gitlab.isc.org/isc-private/isc-wiki/-/wikis/Security-Incident-Handling-Checklist-Explanations#publish-the-releases-as-outlined-in-the-release-checklist
[step_matrix]: https://gitlab.isc.org/isc-private/isc-wiki/-/wikis/Security-Incident-Handling-Checklist-Explanations#bind-9-only-add-the-new-cves-to-the-vulnerability-matrix-in-the-knowledge-base
[step_publish_advisory]: https://gitlab.isc.org/isc-private/isc-wiki/-/wikis/Security-Incident-Handling-Checklist-Explanations#bump-document-version-for-the-security-advisory-and-publish-it-in-the-knowledge-base
[step_bump_advisory]: https://gitlab.isc.org/isc-private/isc-wiki/-/wikis/Security-Incident-Handling-Checklist-Explanations#bump-document-version-for-the-security-advisory-in-printing-press
[step_publish_advisory]: https://gitlab.isc.org/isc-private/isc-wiki/-/wikis/Security-Incident-Handling-Checklist-Explanations#publish-the-security-advisory-in-the-knowledge-base
[step_publish]: https://gitlab.isc.org/isc-private/isc-wiki/-/wikis/Security-Incident-Handling-Checklist-Explanations#publish-the-releases-as-outlined-in-the-release-checklist
[step_notifications]: https://gitlab.isc.org/isc-private/isc-wiki/-/wikis/Security-Incident-Handling-Checklist-Explanations#send-notification-emails-to-third-parties
[step_mitre]: https://gitlab.isc.org/isc-private/isc-wiki/-/wikis/Security-Incident-Handling-Checklist-Explanations#advise-mitre-about-the-disclosed-cves
[step_merge_advisory]: https://gitlab.isc.org/isc-private/isc-wiki/-/wikis/Security-Incident-Handling-Checklist-Explanations#merge-the-security-advisory-merge-request
[step_embargo_end]: https://gitlab.isc.org/isc-private/isc-wiki/-/wikis/Security-Incident-Handling-Checklist-Explanations#inform-original-reporter-if-external-that-the-security-disclosure-process-is-complete
[step_asn_clear]: https://gitlab.isc.org/isc-private/isc-wiki/-/wikis/Security-Incident-Handling-Checklist-Explanations#update-the-sf-portal-to-clear-the-asn
[step_customers]: https://gitlab.isc.org/isc-private/isc-wiki/-/wikis/Security-Incident-Handling-Checklist-Explanations#email-asn-recipients-that-the-embargo-is-lifted
[step_asn_clear]: https://gitlab.isc.org/isc-private/isc-wiki/-/wikis/Security-Incident-Handling-Checklist-Explanations#update-the-tickets-in-the-asn-queues-in-rt-that-the-embargo-is-lifted
[step_customers]: https://gitlab.isc.org/isc-private/isc-wiki/-/wikis/Security-Incident-Handling-Checklist-Explanations#open-a-ticket-in-the-appropriate-announce-queue-in-rt-that-the-release-is-published
[step_regression]: https://gitlab.isc.org/isc-private/isc-wiki/-/wikis/Security-Incident-Handling-Checklist-Explanations#merge-a-regression-test-reproducing-the-bug-into-all-affected-and-still-maintained-branches
/confidential
+12 -11
View File
@@ -11,7 +11,7 @@ See the COPYRIGHT file distributed with this work for additional
information regarding copyright ownership.
-->
## BIND 9 Source Access and Contributor Guidelines
*May 28, 2020*
*Nov 26, 2024*
### Contents
@@ -72,13 +72,13 @@ To clone the repository, use:
> $ git clone https://gitlab.isc.org/isc-projects/bind9.git
Release branch names are of the form `bind-9.X`, where X represents the second
number in the BIND 9 version number. So, to check out the BIND 9.18
number in the BIND 9 version number. So, to check out the BIND 9.20
branch, use:
> $ git checkout bind-9.18
> $ git checkout bind-9.20
Whenever a branch is ready for publication, a tag is placed of the
form `v9.X.Y`. The 9.18.0 release, for instance, is tagged as `v9.18.0`.
form `v9.X.Y`. The 9.20.0 release, for instance, is tagged as `v9.20.0`.
The branch in which the next major release is being developed is called
`main`.
@@ -121,8 +121,9 @@ patch will be applied.
#### <a name="bind"></a>BIND code
Patches for BIND may be submitted directly via merge requests in
[ISC's GitLab](https://gitlab.isc.org/isc-projects/bind9/) source
repository for BIND.
[ISC's GitLab](https://gitlab.isc.org/isc-projects/bind9/) source repository for
BIND. Please contact ISC and provide your GitLab username in order to be allowed
to fork the project and submit merge requests.
Patches can also be submitted as diffs against a specific version of
BIND -- preferably the current top of the `main` branch. Diffs may
@@ -144,8 +145,8 @@ we're busy with other work, it may take us a long time to get to it.
To ensure your patch is acted on as promptly as possible, please:
* Try to adhere to the [BIND 9 coding style](doc/dev/style.md).
* Run `make check` to ensure your change hasn't caused any
functional regressions.
* Run unit and system tests to ensure your change hasn't caused any
functional regressions (these can be checked in the CI pipeline).
* Document your work, both in the patch itself and in the
accompanying email.
* In patches that make non-trivial functional changes, include system
@@ -156,12 +157,12 @@ To ensure your patch is acted on as promptly as possible, please:
##### Changes to `configure`
If you need to make changes to `configure`, you should not edit it
directly; instead, edit `configure.in`, then run `autoconf`. Similarly,
instead of editing `config.h.in` directly, edit `configure.in` and run
directly; instead, edit `configure.ac`, then run `autoconf`. Similarly,
instead of editing `config.h.in` directly, edit `configure.ac` and run
`autoheader`.
When submitting a patch as a diff, it's fine to omit the `configure`
diffs to save space. Just send the `configure.in` diffs and we'll
diffs to save space. Just send the `configure.ac` diffs and we'll
generate the new `configure` during the review process.
##### Documentation
+147 -65
View File
@@ -112,11 +112,7 @@ add(char *key, int value) {
}
if (symtab == NULL) {
result = isc_symtab_create(sym_mctx, 100, freekey, sym_mctx,
false, &symtab);
if (result != ISC_R_SUCCESS) {
return;
}
isc_symtab_create(sym_mctx, freekey, sym_mctx, false, &symtab);
}
key = isc_mem_strdup(sym_mctx, key);
@@ -134,14 +130,92 @@ logged(char *key, int value) {
isc_result_t result;
if (symtab == NULL) {
return (false);
return false;
}
result = isc_symtab_lookup(symtab, key, value, NULL);
if (result == ISC_R_SUCCESS) {
return (true);
return true;
}
return false;
}
static bool
checkisservedby(dns_zone_t *zone, dns_rdatatype_t type,
const dns_name_t *name) {
char namebuf[DNS_NAME_FORMATSIZE + 1];
char ownerbuf[DNS_NAME_FORMATSIZE + 1];
/*
* Not all getaddrinfo implementations distinguish NODATA
* from NXDOMAIN with PF_INET6 so use PF_UNSPEC and look at
* the returned ai_family values.
*/
struct addrinfo hints = {
.ai_flags = AI_CANONNAME,
.ai_family = PF_UNSPEC,
.ai_socktype = SOCK_STREAM,
.ai_protocol = IPPROTO_TCP,
};
struct addrinfo *ai = NULL, *cur;
bool has_type = false;
int eai;
dns_name_format(name, namebuf, sizeof(namebuf) - 1);
/*
* Turn off search.
*/
if (dns_name_countlabels(name) > 1U) {
strlcat(namebuf, ".", sizeof(namebuf));
}
eai = getaddrinfo(namebuf, NULL, &hints, &ai);
switch (eai) {
case 0:
cur = ai;
while (cur != NULL) {
if (cur->ai_family == AF_INET &&
type == dns_rdatatype_a)
{
has_type = true;
break;
}
if (cur->ai_family == AF_INET6 &&
type == dns_rdatatype_aaaa)
{
has_type = true;
break;
}
cur = cur->ai_next;
}
freeaddrinfo(ai);
return has_type;
#if defined(EAI_NODATA) && (EAI_NODATA != EAI_NONAME)
case EAI_NODATA:
#endif /* if defined(EAI_NODATA) && (EAI_NODATA != EAI_NONAME) */
case EAI_NONAME:
if (!logged(namebuf, ERR_NO_ADDRESSES)) {
dns_name_format(dns_zone_getorigin(zone), ownerbuf,
sizeof(ownerbuf));
dns_name_format(name, namebuf, sizeof(namebuf) - 1);
dns_zone_log(zone, ISC_LOG_ERROR,
"%s/NS '%s' (out of zone) "
"has no addresses records (A or AAAA)",
ownerbuf, namebuf);
add(namebuf, ERR_NO_ADDRESSES);
}
return false;
default:
if (!logged(namebuf, ERR_LOOKUP_FAILURE)) {
dns_name_format(dns_zone_getorigin(zone), ownerbuf,
sizeof(ownerbuf));
dns_name_format(name, namebuf, sizeof(namebuf) - 1);
dns_zone_log(zone, ISC_LOG_WARNING,
"getaddrinfo(%s) failed: %s", namebuf,
gai_strerror(eai));
add(namebuf, ERR_LOOKUP_FAILURE);
}
return true;
}
return (false);
}
static bool
@@ -149,7 +223,14 @@ checkns(dns_zone_t *zone, const dns_name_t *name, const dns_name_t *owner,
dns_rdataset_t *a, dns_rdataset_t *aaaa) {
dns_rdataset_t *rdataset;
dns_rdata_t rdata = DNS_RDATA_INIT;
struct addrinfo hints, *ai, *cur;
isc_result_t result;
struct addrinfo hints = {
.ai_flags = AI_CANONNAME,
.ai_family = PF_UNSPEC,
.ai_socktype = SOCK_STREAM,
.ai_protocol = IPPROTO_TCP,
};
struct addrinfo *ai = NULL, *cur;
char namebuf[DNS_NAME_FORMATSIZE + 1];
char ownerbuf[DNS_NAME_FORMATSIZE];
char addrbuf[sizeof("xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:123.123.123.123")];
@@ -157,7 +238,7 @@ checkns(dns_zone_t *zone, const dns_name_t *name, const dns_name_t *owner,
bool match;
const char *type;
void *ptr = NULL;
int result;
int eai;
REQUIRE(a == NULL || !dns_rdataset_isassociated(a) ||
a->type == dns_rdatatype_a);
@@ -165,15 +246,9 @@ checkns(dns_zone_t *zone, const dns_name_t *name, const dns_name_t *owner,
aaaa->type == dns_rdatatype_aaaa);
if (a == NULL || aaaa == NULL) {
return (answer);
return answer;
}
memset(&hints, 0, sizeof(hints));
hints.ai_flags = AI_CANONNAME;
hints.ai_family = PF_UNSPEC;
hints.ai_socktype = SOCK_STREAM;
hints.ai_protocol = IPPROTO_TCP;
dns_name_format(name, namebuf, sizeof(namebuf) - 1);
/*
* Turn off search.
@@ -183,9 +258,9 @@ checkns(dns_zone_t *zone, const dns_name_t *name, const dns_name_t *owner,
}
dns_name_format(owner, ownerbuf, sizeof(ownerbuf));
result = getaddrinfo(namebuf, NULL, &hints, &ai);
eai = getaddrinfo(namebuf, NULL, &hints, &ai);
dns_name_format(name, namebuf, sizeof(namebuf) - 1);
switch (result) {
switch (eai) {
case 0:
/*
* Work around broken getaddrinfo() implementations that
@@ -222,16 +297,16 @@ checkns(dns_zone_t *zone, const dns_name_t *name, const dns_name_t *owner,
add(namebuf, ERR_NO_ADDRESSES);
}
/* XXX950 make fatal for 9.5.0 */
return (true);
return true;
default:
if (!logged(namebuf, ERR_LOOKUP_FAILURE)) {
dns_zone_log(zone, ISC_LOG_WARNING,
"getaddrinfo(%s) failed: %s", namebuf,
gai_strerror(result));
gai_strerror(eai));
add(namebuf, ERR_LOOKUP_FAILURE);
}
return (true);
return true;
}
/*
@@ -358,25 +433,27 @@ checkmissing:
add(namebuf, ERR_MISSING_GLUE);
}
}
freeaddrinfo(ai);
return (answer);
if (ai != NULL) {
freeaddrinfo(ai);
}
return answer;
}
static bool
checkmx(dns_zone_t *zone, const dns_name_t *name, const dns_name_t *owner) {
struct addrinfo hints, *ai, *cur;
struct addrinfo hints = {
.ai_flags = AI_CANONNAME,
.ai_family = PF_UNSPEC,
.ai_socktype = SOCK_STREAM,
.ai_protocol = IPPROTO_TCP,
};
struct addrinfo *ai = NULL, *cur;
char namebuf[DNS_NAME_FORMATSIZE + 1];
char ownerbuf[DNS_NAME_FORMATSIZE];
int result;
int eai;
int level = ISC_LOG_ERROR;
bool answer = true;
memset(&hints, 0, sizeof(hints));
hints.ai_flags = AI_CANONNAME;
hints.ai_family = PF_UNSPEC;
hints.ai_socktype = SOCK_STREAM;
hints.ai_protocol = IPPROTO_TCP;
dns_name_format(name, namebuf, sizeof(namebuf) - 1);
/*
* Turn off search.
@@ -386,9 +463,9 @@ checkmx(dns_zone_t *zone, const dns_name_t *name, const dns_name_t *owner) {
}
dns_name_format(owner, ownerbuf, sizeof(ownerbuf));
result = getaddrinfo(namebuf, NULL, &hints, &ai);
eai = getaddrinfo(namebuf, NULL, &hints, &ai);
dns_name_format(name, namebuf, sizeof(namebuf) - 1);
switch (result) {
switch (eai) {
case 0:
/*
* Work around broken getaddrinfo() implementations that
@@ -421,8 +498,10 @@ checkmx(dns_zone_t *zone, const dns_name_t *name, const dns_name_t *owner) {
}
}
}
freeaddrinfo(ai);
return (answer);
if (ai != NULL) {
freeaddrinfo(ai);
}
return answer;
case EAI_NONAME:
#if defined(EAI_NODATA) && (EAI_NODATA != EAI_NONAME)
@@ -436,34 +515,34 @@ checkmx(dns_zone_t *zone, const dns_name_t *name, const dns_name_t *owner) {
add(namebuf, ERR_NO_ADDRESSES);
}
/* XXX950 make fatal for 9.5.0. */
return (true);
return true;
default:
if (!logged(namebuf, ERR_LOOKUP_FAILURE)) {
dns_zone_log(zone, ISC_LOG_WARNING,
"getaddrinfo(%s) failed: %s", namebuf,
gai_strerror(result));
gai_strerror(eai));
add(namebuf, ERR_LOOKUP_FAILURE);
}
return (true);
return true;
}
}
static bool
checksrv(dns_zone_t *zone, const dns_name_t *name, const dns_name_t *owner) {
struct addrinfo hints, *ai, *cur;
struct addrinfo hints = {
.ai_flags = AI_CANONNAME,
.ai_family = PF_UNSPEC,
.ai_socktype = SOCK_STREAM,
.ai_protocol = IPPROTO_TCP,
};
struct addrinfo *ai = NULL, *cur;
char namebuf[DNS_NAME_FORMATSIZE + 1];
char ownerbuf[DNS_NAME_FORMATSIZE];
int result;
int eai;
int level = ISC_LOG_ERROR;
bool answer = true;
memset(&hints, 0, sizeof(hints));
hints.ai_flags = AI_CANONNAME;
hints.ai_family = PF_UNSPEC;
hints.ai_socktype = SOCK_STREAM;
hints.ai_protocol = IPPROTO_TCP;
dns_name_format(name, namebuf, sizeof(namebuf) - 1);
/*
* Turn off search.
@@ -473,9 +552,9 @@ checksrv(dns_zone_t *zone, const dns_name_t *name, const dns_name_t *owner) {
}
dns_name_format(owner, ownerbuf, sizeof(ownerbuf));
result = getaddrinfo(namebuf, NULL, &hints, &ai);
eai = getaddrinfo(namebuf, NULL, &hints, &ai);
dns_name_format(name, namebuf, sizeof(namebuf) - 1);
switch (result) {
switch (eai) {
case 0:
/*
* Work around broken getaddrinfo() implementations that
@@ -508,8 +587,10 @@ checksrv(dns_zone_t *zone, const dns_name_t *name, const dns_name_t *owner) {
}
}
}
freeaddrinfo(ai);
return (answer);
if (ai != NULL) {
freeaddrinfo(ai);
}
return answer;
case EAI_NONAME:
#if defined(EAI_NODATA) && (EAI_NODATA != EAI_NONAME)
@@ -523,16 +604,16 @@ checksrv(dns_zone_t *zone, const dns_name_t *name, const dns_name_t *owner) {
add(namebuf, ERR_NO_ADDRESSES);
}
/* XXX950 make fatal for 9.5.0. */
return (true);
return true;
default:
if (!logged(namebuf, ERR_LOOKUP_FAILURE)) {
dns_zone_log(zone, ISC_LOG_WARNING,
"getaddrinfo(%s) failed: %s", namebuf,
gai_strerror(result));
gai_strerror(eai));
add(namebuf, ERR_LOOKUP_FAILURE);
}
return (true);
return true;
}
}
@@ -544,7 +625,7 @@ setup_logging(FILE *errout) {
ISC_LOG_DYNAMIC, ISC_LOGDESTINATION_FILE(errout), 0,
ISC_LOGCATEGORY_DEFAULT, ISC_LOGMODULE_DEFAULT);
return (ISC_R_SUCCESS);
return ISC_R_SUCCESS;
}
/*% load the zone */
@@ -574,18 +655,18 @@ load_zone(isc_mem_t *mctx, const char *zonename, const char *filename,
isc_buffer_constinit(&buffer, zonename, strlen(zonename));
isc_buffer_add(&buffer, strlen(zonename));
origin = dns_fixedname_initname(&fixorigin);
CHECK(dns_name_fromtext(origin, &buffer, dns_rootname, 0, NULL));
CHECK(dns_zone_setorigin(zone, origin));
CHECK(dns_name_fromtext(origin, &buffer, dns_rootname, 0));
dns_zone_setorigin(zone, origin);
dns_zone_setdbtype(zone, 1, (const char *const *)dbtype);
if (strcmp(filename, "-") == 0) {
CHECK(dns_zone_setstream(zone, stdin, fileformat,
&dns_master_style_default));
dns_zone_setstream(zone, stdin, fileformat,
&dns_master_style_default);
} else {
CHECK(dns_zone_setfile(zone, filename, fileformat,
&dns_master_style_default));
dns_zone_setfile(zone, filename, fileformat,
&dns_master_style_default);
}
if (journal != NULL) {
CHECK(dns_zone_setjournal(zone, journal));
dns_zone_setjournal(zone, journal);
}
region.base = UNCONST(classname);
@@ -603,6 +684,7 @@ load_zone(isc_mem_t *mctx, const char *zonename, const char *filename,
}
if (docheckns) {
dns_zone_setcheckns(zone, checkns);
dns_zone_setcheckisservedby(zone, checkisservedby);
}
if (dochecksrv) {
dns_zone_setchecksrv(zone, checksrv);
@@ -619,7 +701,7 @@ cleanup:
if (zone != NULL) {
dns_zone_detach(&zone);
}
return (result);
return result;
}
/*% dump the zone */
@@ -650,7 +732,7 @@ dump_zone(const char *zonename, dns_zone_t *zone, const char *filename,
"could not open output "
"file \"%s\" for writing\n",
filename);
return (ISC_R_FAILURE);
return ISC_R_FAILURE;
}
}
@@ -660,5 +742,5 @@ dump_zone(const char *zonename, dns_zone_t *zone, const char *filename,
(void)isc_stdio_close(output);
}
return (result);
return result;
}
-5
View File
@@ -18,7 +18,6 @@
#include <inttypes.h>
#include <stdbool.h>
#include <isc/lang.h>
#include <isc/stdio.h>
#include <isc/types.h>
@@ -26,8 +25,6 @@
#include <dns/types.h>
#include <dns/zone.h>
ISC_LANG_BEGINDECLS
isc_result_t
setup_logging(FILE *errout);
@@ -48,5 +45,3 @@ extern bool docheckmx;
extern bool docheckns;
extern bool dochecksrv;
extern dns_zoneopt_t zone_options;
ISC_LANG_ENDDECLS
+28 -26
View File
@@ -22,6 +22,7 @@
#include <isc/commandline.h>
#include <isc/dir.h>
#include <isc/hash.h>
#include <isc/lib.h>
#include <isc/log.h>
#include <isc/mem.h>
#include <isc/result.h>
@@ -30,6 +31,7 @@
#include <dns/db.h>
#include <dns/fixedname.h>
#include <dns/lib.h>
#include <dns/name.h>
#include <dns/rdataclass.h>
#include <dns/rootns.h>
@@ -83,10 +85,10 @@ directory_callback(const char *clausename, const cfg_obj_t *obj, void *arg) {
cfg_obj_log(obj, ISC_LOG_ERROR,
"change directory to '%s' failed: %s\n", directory,
isc_result_totext(result));
return (result);
return result;
}
return (ISC_R_SUCCESS);
return ISC_R_SUCCESS;
}
static bool
@@ -94,10 +96,10 @@ get_maps(const cfg_obj_t **maps, const char *name, const cfg_obj_t **obj) {
int i;
for (i = 0;; i++) {
if (maps[i] == NULL) {
return (false);
return false;
}
if (cfg_map_get(maps[i], name, obj) == ISC_R_SUCCESS) {
return (true);
return true;
}
}
}
@@ -113,7 +115,7 @@ get_checknames(const cfg_obj_t **maps, const cfg_obj_t **obj) {
for (i = 0;; i++) {
if (maps[i] == NULL) {
return (false);
return false;
}
checknames = NULL;
result = cfg_map_get(maps[i], "check-names", &checknames);
@@ -122,7 +124,7 @@ get_checknames(const cfg_obj_t **maps, const cfg_obj_t **obj) {
}
if (checknames != NULL && !cfg_obj_islist(checknames)) {
*obj = checknames;
return (true);
return true;
}
for (element = cfg_list_first(checknames); element != NULL;
element = cfg_list_next(element))
@@ -136,7 +138,7 @@ get_checknames(const cfg_obj_t **maps, const cfg_obj_t **obj) {
continue;
}
*obj = cfg_tuple_get(value, "mode");
return (true);
return true;
}
}
}
@@ -149,23 +151,23 @@ configure_hint(const char *zfile, const char *zclass, isc_mem_t *mctx) {
isc_textregion_t r;
if (zfile == NULL) {
return (ISC_R_FAILURE);
return ISC_R_FAILURE;
}
r.base = UNCONST(zclass);
r.length = strlen(zclass);
result = dns_rdataclass_fromtext(&rdclass, &r);
if (result != ISC_R_SUCCESS) {
return (result);
return result;
}
result = dns_rootns_create(mctx, rdclass, zfile, &db);
if (result != ISC_R_SUCCESS) {
return (result);
return result;
}
dns_db_detach(&db);
return (ISC_R_SUCCESS);
return ISC_R_SUCCESS;
}
/*% configure the zone */
@@ -221,18 +223,18 @@ configure_zone(const char *vclass, const char *view, const cfg_obj_t *zconfig,
printf("%s %s %s in-view %s\n", zname, zclass, view, inview);
}
if (inviewobj != NULL) {
return (ISC_R_SUCCESS);
return ISC_R_SUCCESS;
}
cfg_map_get(zoptions, "type", &typeobj);
if (typeobj == NULL) {
return (ISC_R_FAILURE);
return ISC_R_FAILURE;
}
if (list) {
const char *ztype = cfg_obj_asstring(typeobj);
printf("%s %s %s %s\n", zname, zclass, view, ztype);
return (ISC_R_SUCCESS);
return ISC_R_SUCCESS;
}
/*
@@ -242,12 +244,12 @@ configure_zone(const char *vclass, const char *view, const cfg_obj_t *zconfig,
if (dbobj != NULL &&
strcmp(ZONEDB_DEFAULT, cfg_obj_asstring(dbobj)) != 0)
{
return (ISC_R_SUCCESS);
return ISC_R_SUCCESS;
}
cfg_map_get(zoptions, "dlz", &dlzobj);
if (dlzobj != NULL) {
return (ISC_R_SUCCESS);
return ISC_R_SUCCESS;
}
cfg_map_get(zoptions, "file", &fileobj);
@@ -261,12 +263,12 @@ configure_zone(const char *vclass, const char *view, const cfg_obj_t *zconfig,
* master and redirect
*/
if (strcasecmp(cfg_obj_asstring(typeobj), "hint") == 0) {
return (configure_hint(zfile, zclass, mctx));
return configure_hint(zfile, zclass, mctx);
} else if ((strcasecmp(cfg_obj_asstring(typeobj), "primary") != 0) &&
(strcasecmp(cfg_obj_asstring(typeobj), "master") != 0) &&
(strcasecmp(cfg_obj_asstring(typeobj), "redirect") != 0))
{
return (ISC_R_SUCCESS);
return ISC_R_SUCCESS;
}
/*
@@ -279,12 +281,12 @@ configure_zone(const char *vclass, const char *view, const cfg_obj_t *zconfig,
}
if (primariesobj != NULL) {
return (ISC_R_SUCCESS);
return ISC_R_SUCCESS;
}
}
if (zfile == NULL) {
return (ISC_R_FAILURE);
return ISC_R_FAILURE;
}
obj = NULL;
@@ -462,7 +464,7 @@ configure_zone(const char *vclass, const char *view, const cfg_obj_t *zconfig,
fprintf(stderr, "%s/%s/%s: %s\n", view, zname, zclass,
isc_result_totext(result));
}
return (result);
return result;
}
/*% configure a view */
@@ -497,7 +499,7 @@ configure_view(const char *vclass, const char *view, const cfg_obj_t *config,
result = tresult;
}
}
return (result);
return result;
}
static isc_result_t
@@ -507,11 +509,11 @@ config_getclass(const cfg_obj_t *classobj, dns_rdataclass_t defclass,
if (!cfg_obj_isstring(classobj)) {
*classp = defclass;
return (ISC_R_SUCCESS);
return ISC_R_SUCCESS;
}
r.base = UNCONST(cfg_obj_asstring(classobj));
r.length = strlen(r.base);
return (dns_rdataclass_fromtext(classp, &r));
return dns_rdataclass_fromtext(classp, &r);
}
/*% load zones from the configuration */
@@ -569,7 +571,7 @@ load_zones_fromconfig(const cfg_obj_t *config, isc_mem_t *mctx,
}
cleanup:
return (result);
return result;
}
static void
@@ -762,5 +764,5 @@ cleanup:
isc_mem_destroy(&mctx);
}
return (result == ISC_R_SUCCESS ? 0 : 1);
return result == ISC_R_SUCCESS ? 0 : 1;
}
+3 -1
View File
@@ -73,7 +73,9 @@ Options
.. option:: -n
Do not error on options that are disabled in this build.
Do not print errors when encountering options that are disabled in
this build. This allows checking of configuration files for other
builds, in which those options are enabled.
.. option:: -p
+3 -1
View File
@@ -22,6 +22,7 @@
#include <isc/dir.h>
#include <isc/file.h>
#include <isc/hash.h>
#include <isc/lib.h>
#include <isc/log.h>
#include <isc/mem.h>
#include <isc/result.h>
@@ -31,6 +32,7 @@
#include <dns/db.h>
#include <dns/fixedname.h>
#include <dns/lib.h>
#include <dns/master.h>
#include <dns/masterdump.h>
#include <dns/name.h>
@@ -577,5 +579,5 @@ main(int argc, char **argv) {
destroy();
isc_mem_destroy(&mctx);
return ((result == ISC_R_SUCCESS) ? 0 : 1);
return (result == ISC_R_SUCCESS) ? 0 : 1;
}
+4
View File
@@ -91,9 +91,13 @@ Options
(both in-zone and out-of-zone hostnames). Mode ``local`` only
checks SRV records which refer to in-zone hostnames.
Mode ``full`` checks that a zone that has A or AAAA records it is served
by a server with the same type of address records.
Mode ``full`` checks that delegation NS records refer to A or AAAA
records (both in-zone and out-of-zone hostnames). It also checks that
glue address records in the zone match those advertised by the child.
Mode ``local`` only checks NS records which refer to in-zone
hostnames or verifies that some required glue exists, i.e., when the
name server is in a child zone.
-6
View File
@@ -17,10 +17,6 @@
#include <stdio.h>
#include <isc/lang.h>
ISC_LANG_BEGINDECLS
int
set_user(FILE *fd, const char *user);
/*%<
@@ -29,5 +25,3 @@ set_user(FILE *fd, const char *user);
* 0 success
* -1 insufficient permissions, or 'user' does not exist.
*/
ISC_LANG_ENDDECLS
+14 -14
View File
@@ -44,24 +44,24 @@ alg_fromtext(const char *name) {
}
if (strcasecmp(p, "md5") == 0) {
return (DST_ALG_HMACMD5);
return DST_ALG_HMACMD5;
}
if (strcasecmp(p, "sha1") == 0) {
return (DST_ALG_HMACSHA1);
return DST_ALG_HMACSHA1;
}
if (strcasecmp(p, "sha224") == 0) {
return (DST_ALG_HMACSHA224);
return DST_ALG_HMACSHA224;
}
if (strcasecmp(p, "sha256") == 0) {
return (DST_ALG_HMACSHA256);
return DST_ALG_HMACSHA256;
}
if (strcasecmp(p, "sha384") == 0) {
return (DST_ALG_HMACSHA384);
return DST_ALG_HMACSHA384;
}
if (strcasecmp(p, "sha512") == 0) {
return (DST_ALG_HMACSHA512);
return DST_ALG_HMACSHA512;
}
return (DST_ALG_UNKNOWN);
return DST_ALG_UNKNOWN;
}
/*%
@@ -71,19 +71,19 @@ int
alg_bits(dns_secalg_t alg) {
switch (alg) {
case DST_ALG_HMACMD5:
return (128);
return 128;
case DST_ALG_HMACSHA1:
return (160);
return 160;
case DST_ALG_HMACSHA224:
return (224);
return 224;
case DST_ALG_HMACSHA256:
return (256);
return 256;
case DST_ALG_HMACSHA384:
return (384);
return 384;
case DST_ALG_HMACSHA512:
return (512);
return 512;
default:
return (0);
return 0;
}
}
-5
View File
@@ -16,13 +16,10 @@
/*! \file */
#include <isc/buffer.h>
#include <isc/lang.h>
#include <isc/mem.h>
#include <dns/secalg.h>
ISC_LANG_BEGINDECLS
void
generate_key(isc_mem_t *mctx, dns_secalg_t alg, int keysize,
isc_buffer_t *key_txtbuffer);
@@ -37,5 +34,3 @@ dns_secalg_t
alg_fromtext(const char *name);
int
alg_bits(dns_secalg_t alg);
ISC_LANG_ENDDECLS
+2 -2
View File
@@ -30,7 +30,7 @@ set_user(FILE *fd, const char *user) {
pw = getpwnam(user);
if (pw == NULL) {
errno = EINVAL;
return (-1);
return -1;
}
return (fchown(fileno(fd), pw->pw_uid, -1));
return fchown(fileno(fd), pw->pw_uid, -1);
}
+3 -1
View File
@@ -32,6 +32,7 @@
#include <isc/buffer.h>
#include <isc/commandline.h>
#include <isc/file.h>
#include <isc/lib.h>
#include <isc/mem.h>
#include <isc/net.h>
#include <isc/result.h>
@@ -40,6 +41,7 @@
#include <isc/util.h>
#include <dns/keyvalues.h>
#include <dns/lib.h>
#include <dns/name.h>
#include <dst/dst.h>
@@ -290,5 +292,5 @@ options {\n\
isc_mem_destroy(&mctx);
return (0);
return 0;
}
+3 -1
View File
@@ -28,6 +28,7 @@
#include <isc/buffer.h>
#include <isc/commandline.h>
#include <isc/file.h>
#include <isc/lib.h>
#include <isc/mem.h>
#include <isc/net.h>
#include <isc/result.h>
@@ -36,6 +37,7 @@
#include <isc/util.h>
#include <dns/keyvalues.h>
#include <dns/lib.h>
#include <dns/name.h>
#include <dst/dst.h>
@@ -296,5 +298,5 @@ nsupdate -k <keyfile>\n");
isc_mem_destroy(&mctx);
return (0);
return 0;
}
-5
View File
@@ -17,7 +17,6 @@
#include <isc/attributes.h>
#include <isc/formatcheck.h>
#include <isc/lang.h>
#define NS_CONTROL_PORT 953
@@ -31,12 +30,8 @@
notify("%s", name); \
} while (0)
ISC_LANG_BEGINDECLS
void
notify(const char *fmt, ...) ISC_FORMAT_PRINTF(1, 2);
ISC_NORETURN void
fatal(const char *format, ...) ISC_FORMAT_PRINTF(1, 2);
ISC_LANG_ENDDECLS
+4 -2
View File
@@ -5,7 +5,8 @@ AM_CPPFLAGS += \
$(LIBISC_CFLAGS) \
$(LIBDNS_CFLAGS) \
$(LIBNS_CFLAGS) \
$(LIBISCCFG_CFLAGS)
$(LIBISCCFG_CFLAGS) \
$(OPENSSL_CFLAGS)
AM_CPPFLAGS += \
-DSYSCONFDIR=\"${sysconfdir}\"
@@ -19,4 +20,5 @@ delv_LDADD = \
$(LIBISC_LIBS) \
$(LIBDNS_LIBS) \
$(LIBNS_LIBS) \
$(LIBISCCFG_LIBS)
$(LIBISCCFG_LIBS) \
$(OPENSSL_LIBS)
+144 -88
View File
@@ -25,11 +25,19 @@
#include <sys/types.h>
#include <unistd.h>
#include <openssl/opensslv.h>
#if OPENSSL_VERSION_NUMBER >= 0x30000000L
#include <openssl/err.h>
#include <openssl/provider.h>
#endif
#include <isc/async.h>
#include <isc/attributes.h>
#include <isc/base64.h>
#include <isc/buffer.h>
#include <isc/fips.h>
#include <isc/hex.h>
#include <isc/lib.h>
#include <isc/log.h>
#include <isc/managers.h>
#include <isc/md.h>
@@ -52,6 +60,7 @@
#include <dns/fixedname.h>
#include <dns/keytable.h>
#include <dns/keyvalues.h>
#include <dns/lib.h>
#include <dns/masterdump.h>
#include <dns/message.h>
#include <dns/name.h>
@@ -86,7 +95,8 @@
#define MAXNAME (DNS_NAME_MAXTEXT + 1)
#define MAX_QUERIES 32
#define MAX_QUERIES 50
#define MAX_TOTAL 200
#define MAX_RESTARTS 11
/* Variables used internally by delv. */
@@ -131,6 +141,7 @@ static bool showcomments = true, showdnssec = true, showtrust = true,
yaml = false, fulltrace = false;
static uint32_t maxqueries = MAX_QUERIES;
static uint32_t maxtotal = MAX_TOTAL;
static uint32_t restarts = MAX_RESTARTS;
static bool resolve_trace = false, validator_trace = false,
@@ -156,6 +167,10 @@ static dns_fixedname_t qfn;
/* Default trust anchors */
static char anchortext[] = TRUST_ANCHORS;
#if OPENSSL_VERSION_NUMBER >= 0x30000000L
static OSSL_PROVIDER *fips = NULL, *base = NULL;
#endif
/*
* Static function prototypes
*/
@@ -215,7 +230,6 @@ usage(void) {
" +[no]crypto (Control display of "
"cryptographic\n"
" fields in records)\n"
" +[no]dlv (Obsolete)\n"
" +[no]dnssec (Display DNSSEC "
"records)\n"
" +[no]mtrace (Trace messages "
@@ -566,7 +580,7 @@ setup_style(void) {
48, 80, 8, splitwidth, mctx);
}
return (result);
return result;
}
static isc_result_t
@@ -583,15 +597,15 @@ convert_name(dns_fixedname_t *fn, dns_name_t **name, const char *text) {
isc_buffer_add(&b, len);
n = dns_fixedname_initname(fn);
result = dns_name_fromtext(n, &b, dns_rootname, 0, NULL);
result = dns_name_fromtext(n, &b, dns_rootname, 0);
if (result != ISC_R_SUCCESS) {
delv_log(ISC_LOG_ERROR, "failed to convert name %s: %s", text,
isc_result_totext(result));
return (result);
return result;
}
*name = n;
return (ISC_R_SUCCESS);
return ISC_R_SUCCESS;
}
static isc_result_t
@@ -624,7 +638,7 @@ key_fromconfig(const cfg_obj_t *key, dns_client_t *client, dns_view_t *toview) {
CHECK(convert_name(&fkeyname, &keyname, keynamestr));
if (!root_validation) {
return (ISC_R_SUCCESS);
return ISC_R_SUCCESS;
}
if (anchor_name) {
@@ -632,11 +646,11 @@ key_fromconfig(const cfg_obj_t *key, dns_client_t *client, dns_view_t *toview) {
}
if (!match_root) {
return (ISC_R_SUCCESS);
return ISC_R_SUCCESS;
}
if (!root_validation) {
return (ISC_R_SUCCESS);
return ISC_R_SUCCESS;
}
delv_log(ISC_LOG_DEBUG(3), "adding trust anchor %s", trust_anchor);
@@ -655,7 +669,7 @@ key_fromconfig(const cfg_obj_t *key, dns_client_t *client, dns_view_t *toview) {
if (cfg_obj_isvoid(obj)) {
/*
* "anchortype" is not defined, this must be a static-key
* configured with trusted-keys.
* configured with trust-anchors.
*/
anchortype = STATIC_KEY;
} else {
@@ -775,9 +789,7 @@ key_fromconfig(const cfg_obj_t *key, dns_client_t *client, dns_view_t *toview) {
num_keys++;
cleanup:
if (result == DST_R_NOCRYPTO) {
cfg_obj_log(key, ISC_LOG_ERROR, "no crypto support");
} else if (result == DST_R_UNSUPPORTEDALG) {
if (result == DST_R_UNSUPPORTEDALG) {
cfg_obj_log(key, ISC_LOG_WARNING,
"skipping trusted key '%s': %s", keynamestr,
isc_result_totext(result));
@@ -789,7 +801,7 @@ cleanup:
result = ISC_R_FAILURE;
}
return (result);
return result;
}
static isc_result_t
@@ -811,23 +823,18 @@ load_keys(const cfg_obj_t *keys, dns_client_t *client, dns_view_t *toview) {
}
cleanup:
if (result == DST_R_NOCRYPTO) {
result = ISC_R_SUCCESS;
}
return (result);
return result;
}
static isc_result_t
setup_dnsseckeys(dns_client_t *client, dns_view_t *toview) {
isc_result_t result;
cfg_parser_t *parser = NULL;
const cfg_obj_t *trusted_keys = NULL;
const cfg_obj_t *managed_keys = NULL;
const cfg_obj_t *trust_anchors = NULL;
cfg_obj_t *bindkeys = NULL;
if (!root_validation) {
return (ISC_R_SUCCESS);
return ISC_R_SUCCESS;
}
if (trust_anchor == NULL) {
@@ -864,16 +871,7 @@ setup_dnsseckeys(dns_client_t *client, dns_view_t *toview) {
}
INSIST(bindkeys != NULL);
cfg_map_get(bindkeys, "trusted-keys", &trusted_keys);
cfg_map_get(bindkeys, "managed-keys", &managed_keys);
cfg_map_get(bindkeys, "trust-anchors", &trust_anchors);
if (trusted_keys != NULL) {
CHECK(load_keys(trusted_keys, client, toview));
}
if (managed_keys != NULL) {
CHECK(load_keys(managed_keys, client, toview));
}
if (trust_anchors != NULL) {
CHECK(load_keys(trust_anchors, client, toview));
}
@@ -894,7 +892,7 @@ cleanup:
delv_log(ISC_LOG_ERROR, "setup_dnsseckeys: %s",
isc_result_totext(result));
}
return (result);
return result;
}
static isc_result_t
@@ -941,7 +939,7 @@ addserver(dns_client_t *client) {
if (gaierror != 0) {
delv_log(ISC_LOG_ERROR, "getaddrinfo failed: %s",
gai_strerror(gaierror));
return (ISC_R_FAILURE);
return ISC_R_FAILURE;
}
result = ISC_R_SUCCESS;
@@ -977,7 +975,7 @@ cleanup:
isc_result_totext(result));
}
return (result);
return result;
}
static isc_result_t
@@ -1046,7 +1044,7 @@ cleanup:
if (resconf != NULL) {
irs_resconf_destroy(&resconf);
}
return (result);
return result;
}
static isc_result_t
@@ -1059,10 +1057,10 @@ parse_uint(uint32_t *uip, const char *value, uint32_t max, const char *desc) {
if (result != ISC_R_SUCCESS) {
printf("invalid %s '%s': %s\n", desc, value,
isc_result_totext(result));
return (result);
return result;
}
*uip = n;
return (ISC_R_SUCCESS);
return ISC_R_SUCCESS;
}
static void
@@ -1123,14 +1121,6 @@ plus_option(char *option) {
break;
case 'd':
switch (cmd[1]) {
case 'l': /* dlv */
FULLCHECK("dlv");
if (state) {
fprintf(stderr, "Invalid option: "
"+dlv is obsolete\n");
exit(EXIT_FAILURE);
}
break;
case 'n': /* dnssec */
FULLCHECK("dnssec");
showdnssec = state;
@@ -1157,22 +1147,46 @@ plus_option(char *option) {
break;
case 'm':
switch (cmd[1]) {
case 'a': /* maxqueries */
FULLCHECK("maxqueries");
if (value == NULL) {
goto need_value;
}
if (!state) {
case 'a':
switch (cmd[3]) {
case 'q': /* maxqueries */
FULLCHECK("maxqueries");
if (value == NULL) {
goto need_value;
}
if (!state) {
goto invalid_option;
}
result = parse_uint(&maxqueries, value,
UINT_MAX, "maxqueries");
if (result != ISC_R_SUCCESS) {
fatal("Couldn't parse maxqueries");
}
if (maxqueries == 0) {
fatal("maxqueries must be nonzero");
}
break;
case 't': /* maxtotalqueries */
FULLCHECK("maxtotalqueries");
if (value == NULL) {
goto need_value;
}
if (!state) {
goto invalid_option;
}
result = parse_uint(&maxtotal, value, UINT_MAX,
"maxtotalqueries");
if (result != ISC_R_SUCCESS) {
fatal("Couldn't parse maxtotalqueries");
}
if (maxtotal == 0) {
fatal("maxtotalqueries must be "
"nonzero");
}
break;
default:
goto invalid_option;
}
result = parse_uint(&maxqueries, value, UINT_MAX,
"maxqueries");
if (result != ISC_R_SUCCESS) {
fatal("Couldn't parse maxqueries");
}
if (maxqueries == 0) {
fatal("maxqueries must be nonzero");
}
break;
case 't': /* mtrace */
FULLCHECK("mtrace");
@@ -1379,8 +1393,8 @@ plus_option(char *option) {
/*
* options: "46a:b:c:d:himp:q:t:vx:";
*/
static const char *single_dash_opts = "46himv";
static const char *dash_opts = "46abcdhimpqtvx";
static const char *single_dash_opts = "46Fhimv";
static const char *dash_opts = "46abcdFhimpqtvx";
static bool
dash_option(char *option, char *next, bool *open_type_class) {
@@ -1423,6 +1437,9 @@ dash_option(char *option, char *next, bool *open_type_class) {
use_ipv4 = false;
}
break;
case 'F': /* FIPS */
/* handled in preparse_args() */
break;
case 'h':
usage();
exit(EXIT_SUCCESS);
@@ -1442,7 +1459,7 @@ dash_option(char *option, char *next, bool *open_type_class) {
if (strlen(option) > 1U) {
option = &option[1];
} else {
return (false);
return false;
}
}
opt = option[0];
@@ -1459,7 +1476,7 @@ dash_option(char *option, char *next, bool *open_type_class) {
switch (opt) {
case 'a':
anchorfile = isc_mem_strdup(mctx, value);
return (value_from_next);
return value_from_next;
case 'b':
hash = strchr(value, '#');
if (hash != NULL) {
@@ -1496,7 +1513,7 @@ dash_option(char *option, char *next, bool *open_type_class) {
if (hash != NULL) {
*hash = '#';
}
return (value_from_next);
return value_from_next;
case 'c':
if (classset) {
warn("extra query class");
@@ -1514,28 +1531,28 @@ dash_option(char *option, char *next, bool *open_type_class) {
} else {
warn("ignoring invalid class");
}
return (value_from_next);
return value_from_next;
case 'd':
result = parse_uint(&num, value, 99, "debug level");
if (result != ISC_R_SUCCESS) {
fatal("Couldn't parse debug level");
}
loglevel = num;
return (value_from_next);
return value_from_next;
case 'p':
port = value;
result = parse_uint(&destport, port, 0xffff, "port");
if (result != ISC_R_SUCCESS) {
fatal("Couldn't parse port number");
}
return (value_from_next);
return value_from_next;
case 'q':
if (curqname != NULL) {
warn("extra query name");
isc_mem_free(mctx, curqname);
}
curqname = isc_mem_strdup(mctx, value);
return (value_from_next);
return value_from_next;
case 't':
*open_type_class = false;
tr.base = value;
@@ -1556,7 +1573,7 @@ dash_option(char *option, char *next, bool *open_type_class) {
} else {
warn("ignoring invalid type");
}
return (value_from_next);
return value_from_next;
case 'x':
result = get_reverse(textname, sizeof(textname), value, false);
if (result == ISC_R_SUCCESS) {
@@ -1574,14 +1591,14 @@ dash_option(char *option, char *next, bool *open_type_class) {
fprintf(stderr, "Invalid IP address %s\n", value);
exit(EXIT_FAILURE);
}
return (value_from_next);
return value_from_next;
invalid_option:
default:
fprintf(stderr, "Invalid option: -%s\n", option);
usage();
}
UNREACHABLE();
return (false);
return false;
}
/*
@@ -1601,6 +1618,28 @@ preparse_args(int argc, char **argv) {
option = &argv[0][1];
while (strpbrk(option, single_dash_opts) == &option[0]) {
switch (option[0]) {
case 'F':
#if OPENSSL_VERSION_NUMBER >= 0x30000000L
fips = OSSL_PROVIDER_load(NULL, "fips");
if (fips == NULL) {
ERR_clear_error();
fatal("Failed to load FIPS provider");
}
base = OSSL_PROVIDER_load(NULL, "base");
if (base == NULL) {
OSSL_PROVIDER_unload(fips);
ERR_clear_error();
fatal("Failed to load base provider");
}
#endif
/* Already in FIPS mode? */
if (isc_fips_mode()) {
break;
}
if (isc_fips_set_mode(1) != ISC_R_SUCCESS) {
fatal("setting FIPS mode failed");
}
break;
case 'm':
isc_mem_debugging = ISC_MEM_DEBUGTRACE |
ISC_MEM_DEBUGRECORD;
@@ -1748,11 +1787,11 @@ parse_args(int argc, char **argv) {
static isc_result_t
append_str(const char *text, int len, char **p, char *end) {
if (len > end - *p) {
return (ISC_R_NOSPACE);
return ISC_R_NOSPACE;
}
memmove(*p, text, len);
*p += len;
return (ISC_R_SUCCESS);
return ISC_R_SUCCESS;
}
static isc_result_t
@@ -1763,17 +1802,17 @@ reverse_octets(const char *in, char **p, char *end) {
isc_result_t result;
result = reverse_octets(dot + 1, p, end);
if (result != ISC_R_SUCCESS) {
return (result);
return result;
}
result = append_str(".", 1, p, end);
if (result != ISC_R_SUCCESS) {
return (result);
return result;
}
len = (int)(dot - in);
} else {
len = strlen(in);
}
return (append_str(in, len, p, end));
return append_str(in, len, p, end);
}
static isc_result_t
@@ -1792,10 +1831,10 @@ get_reverse(char *reverse, size_t len, char *value, bool strict) {
name = dns_fixedname_initname(&fname);
result = dns_byaddr_createptrname(&addr, name);
if (result != ISC_R_SUCCESS) {
return (result);
return result;
}
dns_name_format(name, reverse, (unsigned int)len);
return (ISC_R_SUCCESS);
return ISC_R_SUCCESS;
} else {
/*
* Not a valid IPv6 address. Assume IPv4.
@@ -1808,17 +1847,17 @@ get_reverse(char *reverse, size_t len, char *value, bool strict) {
char *p = reverse;
char *end = reverse + len;
if (strict && inet_pton(AF_INET, value, &addr.type.in) != 1) {
return (DNS_R_BADDOTTEDQUAD);
return DNS_R_BADDOTTEDQUAD;
}
result = reverse_octets(value, &p, end);
if (result != ISC_R_SUCCESS) {
return (result);
return result;
}
result = append_str(".in-addr.arpa.", 15, &p, end);
if (result != ISC_R_SUCCESS) {
return (result);
return result;
}
return (ISC_R_SUCCESS);
return ISC_R_SUCCESS;
}
}
@@ -1895,6 +1934,7 @@ run_resolve(void *arg) {
CHECK(dns_client_create(mctx, loopmgr, netmgr, 0, tlsctx_client_cache,
&client, srcaddr4, srcaddr6));
dns_client_setmaxrestarts(client, restarts);
dns_client_setmaxqueries(client, maxtotal);
/* Set the nameserver */
if (server != NULL) {
@@ -2055,7 +2095,7 @@ accept_cb(isc_nmhandle_t *handle, isc_result_t result, void *arg) {
UNUSED(handle);
UNUSED(arg);
return (result);
return result;
}
static void
@@ -2099,9 +2139,15 @@ sendquery(void *arg) {
&requestmgr));
dns_view_attach(view, &(dns_view_t *){ NULL });
uint32_t initial;
isc_nm_gettimeouts(netmgr, &initial, NULL, NULL, NULL);
const unsigned int connect_timeout = initial, timeout = initial;
CHECK(dns_request_create(requestmgr, message, NULL, &peer, NULL, NULL,
DNS_REQUESTOPT_TCP, NULL, 1, 0, 0, isc_loop(),
recvresponse, message, &request));
DNS_REQUESTOPT_TCP, NULL, connect_timeout,
timeout, 0, 0, isc_loop(), recvresponse,
message, &request));
return;
cleanup:
@@ -2130,7 +2176,7 @@ matchview(isc_netaddr_t *srcaddr, isc_netaddr_t *destaddr,
*viewp = view;
*viewpatchresultp = ISC_R_SUCCESS;
return (ISC_R_SUCCESS);
return ISC_R_SUCCESS;
}
static void
@@ -2153,13 +2199,14 @@ run_server(void *arg) {
CHECK(ns_interfacemgr_create(mctx, sctx, loopmgr, netmgr, dispatchmgr,
NULL, &interfacemgr));
CHECK(dns_view_create(mctx, dispatchmgr, dns_rdataclass_in, "_default",
&view));
dns_view_create(mctx, loopmgr, dispatchmgr, dns_rdataclass_in,
"_default", &view);
CHECK(dns_cache_create(loopmgr, dns_rdataclass_in, "", mctx, &cache));
dns_view_setcache(view, cache, false);
dns_cache_detach(&cache);
dns_view_setdstport(view, destport);
dns_view_setmaxrestarts(view, restarts);
dns_view_setmaxqueries(view, maxtotal);
CHECK(dns_rootns_create(mctx, dns_rdataclass_in, hintfile, &roothints));
dns_view_sethints(view, roothints);
@@ -2262,5 +2309,14 @@ cleanup:
isc_managers_destroy(&mctx, &loopmgr, &netmgr);
return (0);
#if OPENSSL_VERSION_NUMBER >= 0x30000000L
if (base != NULL) {
OSSL_PROVIDER_unload(base);
}
if (fips != NULL) {
OSSL_PROVIDER_unload(fips);
}
#endif
return 0;
}
+11 -2
View File
@@ -21,7 +21,7 @@ delv - DNS lookup and validation utility
Synopsis
~~~~~~~~
:program:`delv` [@server] [ [**-4**] | [**-6**] ] [**-a** anchor-file] [**-b** address] [**-c** class] [**-d** level] [**-i**] [**-m**] [**-p** port#] [**-q** name] [**-t** type] [**-x** addr] [name] [type] [class] [queryopt...]
:program:`delv` [@server] [ [**-4**] | [**-6**] ] [**-a** anchor-file] [**-b** address] [**-c** class] [**-d** level] [**-F**] [**-i**] [**-m**] [**-p** port#] [**-q** name] [**-t** type] [**-x** addr] [name] [type] [class] [queryopt...]
:program:`delv` [**-h**]
@@ -138,6 +138,10 @@ Options
:option:`+mtrace`, :option:`+rtrace`, and :option:`+vtrace` options below for
additional debugging details.
.. option:: -F
This option enables FIPS mode if supported by the cryptographic library in use.
.. option:: -h
This option displays the :program:`delv` help usage output and exits.
@@ -347,7 +351,12 @@ assign values to options like the timeout interval. They have the form
.. option:: +maxqueries
This option specifies the maximum number of queries to send to resolve
a name before giving up. The default is 32.
a name before giving up. The default is 50.
.. option:: +maxtotalqueries
This option specifies the maximum number of queries to send to resolve
a client request before giving up. The default is 200.
.. option:: +trust, +notrust
+4 -1
View File
@@ -5,13 +5,16 @@ AM_CPPFLAGS += \
$(LIBDNS_CFLAGS) \
$(LIBISCCFG_CFLAGS) \
$(LIBIDN2_CFLAGS) \
$(LIBUV_CFLAGS)
$(OPENSSL_CFLAGS) \
$(LIBUV_CFLAGS) \
$(OPENSSL_CFLAGS)
LDADD += \
libdighost.la \
$(LIBISC_LIBS) \
$(LIBDNS_LIBS) \
$(LIBISCCFG_LIBS) \
$(OPENSSL_LIBS) \
$(LIBIDN2_LIBS)
noinst_LTLIBRARIES = libdighost.la
+126 -69
View File
@@ -21,6 +21,8 @@
#include <isc/attributes.h>
#include <isc/dir.h>
#include <isc/fips.h>
#include <isc/lib.h>
#include <isc/loop.h>
#include <isc/netaddr.h>
#include <isc/parseint.h>
@@ -32,6 +34,7 @@
#include <dns/byaddr.h>
#include <dns/dns64.h>
#include <dns/fixedname.h>
#include <dns/lib.h>
#include <dns/masterdump.h>
#include <dns/message.h>
#include <dns/name.h>
@@ -69,6 +72,16 @@ static bool short_form = false, printcmd = true, plusquest = false,
pluscomm = false, ipv4only = false, ipv6only = false, digrc = true;
static uint32_t splitwidth = 0xffffffff;
#include <openssl/opensslv.h>
#if OPENSSL_VERSION_NUMBER >= 0x30000000L
#include <openssl/err.h>
#include <openssl/provider.h>
#endif
#if OPENSSL_VERSION_NUMBER >= 0x30000000L
static OSSL_PROVIDER *fips = NULL, *base = NULL;
#endif
/*% opcode text */
static const char *const opcodetext[] = {
"QUERY", "IQUERY", "STATUS", "RESERVED3",
@@ -89,9 +102,9 @@ rcode_totext(dns_rcode_t rcode) {
RUNTIME_CHECK(result == ISC_R_SUCCESS);
if (strspn(buf + 1, "0123456789") == strlen(buf + 1)) {
buf[0] = '?';
return (buf);
return buf;
}
return (buf + 1);
return buf + 1;
}
/*% print usage */
@@ -292,6 +305,8 @@ help(void) {
"statistics)\n"
" +subnet=addr (Set edns-client-subnet "
"option)\n"
" +[no]svcparamkeycompat (Display backward-"
"compatible SvcParamKey names (keyN) for non-initial entries)\n"
" +[no]tcflag (Set TC flag in query "
"(+[no]tcflag))\n"
" +[no]tcp (TCP mode (+[no]vc))\n"
@@ -473,7 +488,7 @@ say_message(dns_rdata_t *rdata, dig_query_t *query, isc_buffer_t *buf) {
if (query->lookup->trace || query->lookup->ns_search_only) {
result = dns_rdatatype_totext(rdata->type, buf);
if (result != ISC_R_SUCCESS) {
return (result);
return result;
}
ADD_STRING(buf, " ");
}
@@ -491,10 +506,13 @@ say_message(dns_rdata_t *rdata, dig_query_t *query, isc_buffer_t *buf) {
if (query->lookup->expandaaaa) {
styleflags |= DNS_STYLEFLAG_EXPANDAAAA;
}
if (query->lookup->svcparamkeycompat) {
styleflags |= DNS_STYLEFLAG_SVCPARAMKEYCOMPAT;
}
result = dns_rdata_tofmttext(rdata, NULL, styleflags, 0, splitwidth,
" ", buf);
if (result == ISC_R_NOSPACE) {
return (result);
return result;
}
check_result(result, "dns_rdata_totext");
if (query->lookup->identify) {
@@ -511,7 +529,7 @@ say_message(dns_rdata_t *rdata, dig_query_t *query, isc_buffer_t *buf) {
ADD_STRING(buf, store);
}
ADD_STRING(buf, "\n");
return (ISC_R_SUCCESS);
return ISC_R_SUCCESS;
}
/*%
@@ -535,14 +553,14 @@ dns64prefix_answer(dns_message_t *msg, isc_buffer_t *buf) {
dns_rdatatype_aaaa, dns_rdatatype_none,
NULL, &rdataset);
if (result == DNS_R_NXDOMAIN || result == DNS_R_NXRRSET) {
return (ISC_R_SUCCESS);
return ISC_R_SUCCESS;
} else if (result != ISC_R_SUCCESS) {
return (result);
return result;
}
result = dns_dns64_findprefix(rdataset, prefix, &count);
if (result == ISC_R_NOTFOUND) {
return (ISC_R_SUCCESS);
return ISC_R_SUCCESS;
}
if (count > 10) {
count = 10;
@@ -550,15 +568,15 @@ dns64prefix_answer(dns_message_t *msg, isc_buffer_t *buf) {
for (i = 0; i < count; i++) {
result = isc_netaddr_totext(&prefix[i].addr, buf);
if (result != ISC_R_SUCCESS) {
return (result);
return result;
}
result = isc_buffer_printf(buf, "/%u\n", prefix[i].prefixlen);
if (result != ISC_R_SUCCESS) {
return (result);
return result;
}
}
return (ISC_R_SUCCESS);
return ISC_R_SUCCESS;
}
/*%
@@ -575,12 +593,12 @@ short_answer(dns_message_t *msg, dns_messagetextflag_t flags, isc_buffer_t *buf,
UNUSED(flags);
dns_name_init(&empty_name, NULL);
dns_name_init(&empty_name);
result = dns_message_firstname(msg, DNS_SECTION_ANSWER);
if (result == ISC_R_NOMORE) {
return (ISC_R_SUCCESS);
return ISC_R_SUCCESS;
} else if (result != ISC_R_SUCCESS) {
return (result);
return result;
}
for (;;) {
@@ -595,7 +613,7 @@ short_answer(dns_message_t *msg, dns_messagetextflag_t flags, isc_buffer_t *buf,
dns_rdataset_current(rdataset, &rdata);
result = say_message(&rdata, query, buf);
if (result == ISC_R_NOSPACE) {
return (result);
return result;
}
check_result(result, "say_message");
loopresult = dns_rdataset_next(rdataset);
@@ -606,20 +624,18 @@ short_answer(dns_message_t *msg, dns_messagetextflag_t flags, isc_buffer_t *buf,
if (result == ISC_R_NOMORE) {
break;
} else if (result != ISC_R_SUCCESS) {
return (result);
return result;
}
}
return (ISC_R_SUCCESS);
return ISC_R_SUCCESS;
}
static bool
isdotlocal(dns_message_t *msg) {
isc_result_t result;
static unsigned char local_ndata[] = { "\005local" };
static unsigned char local_offsets[] = { 0, 6 };
static dns_name_t local = DNS_NAME_INITABSOLUTE(local_ndata,
local_offsets);
static dns_name_t local = DNS_NAME_INITABSOLUTE(local_ndata);
for (result = dns_message_firstname(msg, DNS_SECTION_QUESTION);
result == ISC_R_SUCCESS;
@@ -628,10 +644,10 @@ isdotlocal(dns_message_t *msg) {
dns_name_t *name = NULL;
dns_message_currentname(msg, DNS_SECTION_QUESTION, &name);
if (dns_name_issubdomain(name, &local)) {
return (true);
return true;
}
}
return (false);
return false;
}
/*
@@ -684,6 +700,9 @@ printmessage(dig_query_t *query, const isc_buffer_t *msgbuf, dns_message_t *msg,
if (query->lookup->expandaaaa) {
styleflags |= DNS_STYLEFLAG_EXPANDAAAA;
}
if (query->lookup->svcparamkeycompat) {
styleflags |= DNS_STYLEFLAG_SVCPARAMKEYCOMPAT;
}
if (query->lookup->multiline) {
styleflags |= DNS_STYLEFLAG_OMIT_OWNER;
styleflags |= DNS_STYLEFLAG_OMIT_CLASS;
@@ -1024,7 +1043,7 @@ repopulate_buffer:
dig_idnsetup(query->lookup, false);
return (result);
return result;
}
/*%
@@ -1193,7 +1212,7 @@ proxy_handle_addr_string(const char *addr_start, const size_t addr_len,
}
}
return (result);
return result;
}
static bool
@@ -1213,7 +1232,7 @@ parse_proxy_addresses(const char *addrs, isc_sockaddr_t *psrc,
/* start syntax analysis and verification */
if (!rule_proxy_addrs(&st)) {
warn("PROXY source and destination addresses cannot be parsed");
return (false);
return false;
}
/* get port numeric values */
@@ -1240,7 +1259,7 @@ parse_proxy_addresses(const char *addrs, isc_sockaddr_t *psrc,
if (result != ISC_R_SUCCESS) {
warn("Cannot get PROXY source address: %s",
isc_result_totext(result));
return (false);
return false;
}
result = proxy_handle_addr_string(st.dst_addr_start, st.dst_addr_len,
@@ -1248,26 +1267,26 @@ parse_proxy_addresses(const char *addrs, isc_sockaddr_t *psrc,
if (result != ISC_R_SUCCESS) {
warn("Cannot get PROXY destination address: %s",
isc_result_totext(result));
return (false);
return false;
}
/* addresses should be of the same type */
if (isc_sockaddr_pf(&src) != isc_sockaddr_pf(&dst)) {
warn("PROXY source and destination addresses must be of the "
"same type");
return (false);
return false;
}
*psrc = src;
*pdst = dst;
return (true);
return true;
}
static bool
rule_proxy_addrs(isc_proxy_addrs_parser_state_t *st) {
if (!rule_addr(st)) {
return (false);
return false;
}
st->src_addr_start = st->last_addr_start;
@@ -1276,13 +1295,13 @@ rule_proxy_addrs(isc_proxy_addrs_parser_state_t *st) {
st->src_port_len = st->last_port_len;
if (!MATCH('-')) {
return (false);
return false;
}
ADVANCE();
if (!rule_addr(st)) {
return (false);
return false;
}
st->dst_addr_start = st->last_addr_start;
@@ -1291,17 +1310,17 @@ rule_proxy_addrs(isc_proxy_addrs_parser_state_t *st) {
st->dst_port_len = st->last_port_len;
if (!MATCH('\0')) {
return (false);
return false;
}
return (true);
return true;
}
static bool
rule_addr(isc_proxy_addrs_parser_state_t *st) {
const char *start = GETP();
if (!rule_addr_char(st)) {
return (false);
return false;
}
while (rule_addr_char(st)) {
@@ -1315,18 +1334,18 @@ rule_addr(isc_proxy_addrs_parser_state_t *st) {
ADVANCE();
if (!rule_port(st)) {
return (false);
return false;
}
}
return (true);
return true;
}
static bool
rule_port(isc_proxy_addrs_parser_state_t *st) {
const char *start = GETP();
if (!MATCH_DIGIT()) {
return (false);
return false;
}
ADVANCE();
@@ -1338,18 +1357,18 @@ rule_port(isc_proxy_addrs_parser_state_t *st) {
st->last_port_start = start;
st->last_port_len = GETP() - start;
return (true);
return true;
}
static bool
rule_addr_char(isc_proxy_addrs_parser_state_t *st) {
if (MATCH('#') || MATCH('-') || MATCH('\0')) {
return (false);
return false;
}
ADVANCE();
return (true);
return true;
}
#undef GETP
@@ -1366,20 +1385,20 @@ plus_proxy_handle_addresses(const char *value, const bool state,
* We are not interested in the option value in that
* case
*/
return (true);
return true;
}
if (value == NULL || *value == '\0') {
lookup->proxy_local = true;
return (true);
return true;
}
if (!parse_proxy_addresses(value, &lookup->proxy_src_addr,
&lookup->proxy_dst_addr))
{
return (false);
return false;
}
return (true);
return true;
}
static bool
@@ -1402,10 +1421,10 @@ plus_proxy_options(const char *cmd, const char *value, const bool state,
default:
goto invalid_option;
}
return (true);
return true;
invalid_option:
return (false);
return false;
}
static bool
@@ -1500,9 +1519,9 @@ plus_tls_options(const char *cmd, const char *value, const bool state,
goto invalid_option;
}
return (true);
return true;
invalid_option:
return (false);
return false;
}
/*%
@@ -1525,7 +1544,7 @@ plus_option(char *option, bool is_batchfile, bool *need_clone,
if ((cmd = strtok_r(option, "=", &last)) == NULL) {
printf(";; Invalid option %s\n", option);
return (lookup);
return lookup;
}
if (strncasecmp(cmd, "no", 2) == 0) {
cmd += 2;
@@ -2383,6 +2402,10 @@ plus_option(char *option, bool is_batchfile, bool *need_clone,
goto exit_or_usage;
}
break;
case 'v': /* svcparamkeycompat */
FULLCHECK("svcparamkeycompat");
lookup->svcparamkeycompat = state;
break;
default:
goto invalid_option;
}
@@ -2561,7 +2584,7 @@ plus_option(char *option, bool is_batchfile, bool *need_clone,
if (value != NULL) {
value[-1] = '=';
}
return (lookup);
return lookup;
#if !TARGET_OS_IPHONE
exit_or_usage:
@@ -2573,8 +2596,8 @@ exit_or_usage:
/*%
* #true returned if value was used
*/
static const char *single_dash_opts = "46dhimnruv";
static const char *dash_opts = "46bcdfhikmnpqrtvyx";
static const char *single_dash_opts = "46dFhimnruv";
static const char *dash_opts = "46bcdFfhikmnpqrtvyx";
static bool
dash_option(char *option, char *next, dig_lookup_t **lookup,
bool *open_type_class, bool *need_clone, bool config_only, int argc,
@@ -2607,7 +2630,7 @@ dash_option(char *option, char *next, dig_lookup_t **lookup,
} else {
fatal("can't find IPv4 networking");
UNREACHABLE();
return (false);
return false;
}
break;
case '6':
@@ -2617,7 +2640,7 @@ dash_option(char *option, char *next, dig_lookup_t **lookup,
} else {
fatal("can't find IPv6 networking");
UNREACHABLE();
return (false);
return false;
}
break;
case 'd':
@@ -2626,11 +2649,14 @@ dash_option(char *option, char *next, dig_lookup_t **lookup,
cmd = option;
FULLCHECK("debug");
debugging = true;
return (false);
return false;
} else {
debugging = true;
}
break;
case 'F': /* FIPS */
/* FIPS is handled in preparse_args() */
break;
case 'h':
help();
exit(EXIT_SUCCESS);
@@ -2657,7 +2683,7 @@ dash_option(char *option, char *next, dig_lookup_t **lookup,
if (strlen(option) > 1U) {
option = &option[1];
} else {
return (false);
return false;
}
}
opt = option[0];
@@ -2701,7 +2727,7 @@ dash_option(char *option, char *next, dig_lookup_t **lookup,
*hash = '#';
}
specified_source = true;
return (value_from_next);
return value_from_next;
case 'c':
if ((*lookup)->rdclassset) {
fprintf(stderr, ";; Warning, extra class option\n");
@@ -2720,13 +2746,13 @@ dash_option(char *option, char *next, dig_lookup_t **lookup,
"invalid class %s\n",
value);
}
return (value_from_next);
return value_from_next;
case 'f':
batchname = value;
return (value_from_next);
return value_from_next;
case 'k':
strlcpy(keyfile, value, sizeof(keyfile));
return (value_from_next);
return value_from_next;
case 'p':
result = parse_uint(&num, value, MAXPORT, "port number");
if (result != ISC_R_SUCCESS) {
@@ -2734,7 +2760,7 @@ dash_option(char *option, char *next, dig_lookup_t **lookup,
}
port = num;
port_set = true;
return (value_from_next);
return value_from_next;
case 'q':
if (!config_only) {
if (*need_clone) {
@@ -2753,7 +2779,7 @@ dash_option(char *option, char *next, dig_lookup_t **lookup,
ISC_LIST_APPEND(lookup_list, (*lookup), link);
debug("looking up %s", (*lookup)->textname);
}
return (value_from_next);
return value_from_next;
case 't':
*open_type_class = false;
if (strncasecmp(value, "ixfr=", 5) == 0) {
@@ -2811,7 +2837,7 @@ dash_option(char *option, char *next, dig_lookup_t **lookup,
"invalid type %s\n",
value);
}
return (value_from_next);
return value_from_next;
case 'y':
if ((ptr = strtok_r(value, ":", &last)) == NULL) {
usage();
@@ -2836,7 +2862,7 @@ dash_option(char *option, char *next, dig_lookup_t **lookup,
ptr[-1] = ':';
}
ptr2[-1] = ':';
return (value_from_next);
return value_from_next;
case 'x':
if (*need_clone) {
*lookup = clone_lookup(default_lookup, true);
@@ -2866,14 +2892,14 @@ dash_option(char *option, char *next, dig_lookup_t **lookup,
fprintf(stderr, "Invalid IP address %s\n", value);
exit(EXIT_FAILURE);
}
return (value_from_next);
return value_from_next;
invalid_option:
default:
fprintf(stderr, "Invalid option: -%s\n", option);
usage();
}
UNREACHABLE();
return (false);
return false;
}
/*%
@@ -2904,6 +2930,28 @@ preparse_args(int argc, char **argv) {
/* For debugging early startup */
debugging = true;
break;
case 'F':
#if OPENSSL_VERSION_NUMBER >= 0x30000000L
fips = OSSL_PROVIDER_load(NULL, "fips");
if (fips == NULL) {
ERR_clear_error();
fatal("Failed to load FIPS provider");
}
base = OSSL_PROVIDER_load(NULL, "base");
if (base == NULL) {
OSSL_PROVIDER_unload(fips);
ERR_clear_error();
fatal("Failed to load base provider");
}
#endif
/* Already in FIPS mode? */
if (isc_fips_mode()) {
break;
}
if (isc_fips_set_mode(1) != ISC_R_SUCCESS) {
fatal("setting FIPS mode failed");
}
break;
case 'm':
memdebugging = true;
isc_mem_debugging = ISC_MEM_DEBUGTRACE |
@@ -2967,7 +3015,7 @@ split_batchline(char *batchline, char **bargv, int len, const char *msg) {
{
debug("%s %d: %s", msg, bargc, bargv[bargc]);
}
return (bargc);
return bargc;
}
static void
@@ -3428,5 +3476,14 @@ main(int argc, char **argv) {
dig_startup();
dig_shutdown();
return (exitcode);
#if OPENSSL_VERSION_NUMBER >= 0x30000000L
if (base != NULL) {
OSSL_PROVIDER_unload(base);
}
if (fips != NULL) {
OSSL_PROVIDER_unload(fips);
}
#endif
return exitcode;
}
+13 -1
View File
@@ -20,7 +20,7 @@ dig - DNS lookup utility
Synopsis
~~~~~~~~
:program:`dig` [@server] [**-b** address] [**-c** class] [**-f** filename] [**-k** filename] [**-m**] [**-p** port#] [**-q** name] [**-t** type] [**-v**] [**-x** addr] [**-y** [hmac:]name:key] [ [**-4**] | [**-6**] ] [name] [type] [class] [queryopt...]
:program:`dig` [@server] [**-b** address] [**-c** class] [**-f** filename] [**-F**] [**-k** filename] [**-m**] [**-p** port#] [**-q** name] [**-t** type] [**-v**] [**-x** addr] [**-y** [hmac:]name:key] [ [**-4**] | [**-6**] ] [name] [type] [class] [queryopt...]
:program:`dig` [**-h**]
@@ -126,6 +126,10 @@ Options
same way it would be presented as a query to :program:`dig` using the
command-line interface.
.. option:: -F
This option enables FIPS mode if supported by the cryptographic library in use.
.. option:: -h
Print a usage summary.
@@ -638,6 +642,14 @@ abbreviation is unambiguous; for example, :option:`+cd` is equivalent to
prefix-length of zero, which signals a resolver that the client's
address information must *not* be used when resolving this query.
.. option:: +svcparamkeycompat, +nosvcparamkeycompat
This option sets [or does not set] the backward-compatible representation of
the Service Parameter Keys (SvcParamKeys) for SVCB records, in which case
the keys, which were not defined initially in :rfc:`9460` are represented
in their opaque "keyN"-like format, where "N" is their numerical value. The
default is ``+nosvcparamkeycompat``.
.. option:: +tcflag, +notcflag
This option sets [or does not set] the TC (TrunCation) bit in the query. The default is
+86 -89
View File
@@ -40,7 +40,6 @@
#include <isc/file.h>
#include <isc/getaddresses.h>
#include <isc/hex.h>
#include <isc/lang.h>
#include <isc/log.h>
#include <isc/loop.h>
#include <isc/managers.h>
@@ -61,6 +60,7 @@
#include <isc/xml.h>
#include <dns/byaddr.h>
#include <dns/ede.h>
#include <dns/fixedname.h>
#include <dns/message.h>
#include <dns/name.h>
@@ -234,7 +234,7 @@ count_dots(char *string) {
}
s++;
}
return (i);
return i;
}
static void
@@ -282,11 +282,11 @@ hex_dump(isc_buffer_t *b) {
static isc_result_t
append(const char *text, size_t len, char **p, char *end) {
if (*p + len > end) {
return (ISC_R_NOSPACE);
return ISC_R_NOSPACE;
}
memmove(*p, text, len);
*p += len;
return (ISC_R_SUCCESS);
return ISC_R_SUCCESS;
}
static isc_result_t
@@ -297,17 +297,17 @@ reverse_octets(const char *in, char **p, char *end) {
isc_result_t result;
result = reverse_octets(dot + 1, p, end);
if (result != ISC_R_SUCCESS) {
return (result);
return result;
}
result = append(".", 1, p, end);
if (result != ISC_R_SUCCESS) {
return (result);
return result;
}
len = (int)(dot - in);
} else {
len = (int)strlen(in);
}
return (append(in, len, p, end));
return append(in, len, p, end);
}
isc_result_t
@@ -326,10 +326,10 @@ get_reverse(char *reverse, size_t len, char *value, bool strict) {
name = dns_fixedname_initname(&fname);
result = dns_byaddr_createptrname(&addr, name);
if (result != ISC_R_SUCCESS) {
return (result);
return result;
}
dns_name_format(name, reverse, (unsigned int)len);
return (ISC_R_SUCCESS);
return ISC_R_SUCCESS;
} else {
/*
* Not a valid IPv6 address. Assume IPv4.
@@ -342,18 +342,18 @@ get_reverse(char *reverse, size_t len, char *value, bool strict) {
char *p = reverse;
char *end = reverse + len;
if (strict && inet_pton(AF_INET, value, &addr.type.in) != 1) {
return (DNS_R_BADDOTTEDQUAD);
return DNS_R_BADDOTTEDQUAD;
}
result = reverse_octets(value, &p, end);
if (result != ISC_R_SUCCESS) {
return (result);
return result;
}
/* Append .in-addr.arpa. and a terminating NUL. */
result = append(".in-addr.arpa.", 15, &p, end);
if (result != ISC_R_SUCCESS) {
return (result);
return result;
}
return (ISC_R_SUCCESS);
return ISC_R_SUCCESS;
}
}
@@ -454,7 +454,7 @@ make_server(const char *servname, const char *userarg) {
strlcpy(srv->servername, servname, MXNAME);
strlcpy(srv->userarg, userarg, MXNAME);
ISC_LINK_INIT(srv, link);
return (srv);
return srv;
}
/*%
@@ -630,7 +630,7 @@ make_empty_lookup(void) {
debug("make_empty_lookup() = %p->references = %" PRIuFAST32, looknew,
isc_refcount_current(&looknew->references));
return (looknew);
return looknew;
}
#define EDNSOPT_OPTIONS 100U
@@ -758,6 +758,7 @@ clone_lookup(dig_lookup_t *lookold, bool servers) {
looknew->nocrypto = lookold->nocrypto;
looknew->ttlunits = lookold->ttlunits;
looknew->expandaaaa = lookold->expandaaaa;
looknew->svcparamkeycompat = lookold->svcparamkeycompat;
looknew->qr = lookold->qr;
looknew->idnin = lookold->idnin;
looknew->idnout = lookold->idnout;
@@ -821,7 +822,7 @@ clone_lookup(dig_lookup_t *lookold, bool servers) {
looknew->magic = DIG_LOOKUP_MAGIC;
return (looknew);
return looknew;
}
/*%
@@ -851,20 +852,20 @@ requeue_lookup(dig_lookup_t *lookold, bool servers) {
ISC_LIST_PREPEND(lookup_list, looknew, link);
debug("after insertion, init -> %p, new = %p, new -> %p", lookold,
looknew, looknew->link.next);
return (looknew);
return looknew;
}
void
setup_text_key(void) {
isc_result_t result;
dns_name_t keyname;
dns_fixedname_t fkey;
dns_name_t *keyname = dns_fixedname_initname(&fkey);
isc_buffer_t secretbuf;
unsigned int secretsize;
unsigned char *secretstore;
debug("setup_text_key()");
isc_buffer_allocate(mctx, &namebuf, MXNAME);
dns_name_init(&keyname, NULL);
isc_buffer_putstr(namebuf, keynametext);
secretsize = (unsigned int)strlen(keysecret) * 3 / 4;
secretstore = isc_mem_allocate(mctx, secretsize);
@@ -881,12 +882,12 @@ setup_text_key(void) {
goto failure;
}
result = dns_name_fromtext(&keyname, namebuf, dns_rootname, 0, namebuf);
result = dns_name_fromtext(keyname, namebuf, dns_rootname, 0);
if (result != ISC_R_SUCCESS) {
goto failure;
}
result = dns_tsigkey_create(&keyname, hmac_alg, secretstore,
result = dns_tsigkey_create(keyname, hmac_alg, secretstore,
(int)secretsize, mctx, &tsigkey);
failure:
if (result != ISC_R_SUCCESS) {
@@ -897,7 +898,6 @@ failure:
}
isc_mem_free(mctx, secretstore);
dns_name_invalidate(&keyname);
isc_buffer_free(&namebuf);
}
@@ -912,20 +912,20 @@ parse_uint_helper(uint32_t *uip, const char *value, uint32_t max,
if (result != ISC_R_SUCCESS) {
printf("invalid %s '%s': %s\n", desc, value,
isc_result_totext(result));
return (result);
return result;
}
*uip = n;
return (ISC_R_SUCCESS);
return ISC_R_SUCCESS;
}
isc_result_t
parse_uint(uint32_t *uip, const char *value, uint32_t max, const char *desc) {
return (parse_uint_helper(uip, value, max, desc, 10));
return parse_uint_helper(uip, value, max, desc, 10);
}
isc_result_t
parse_xint(uint32_t *uip, const char *value, uint32_t max, const char *desc) {
return (parse_uint_helper(uip, value, max, desc, 0));
return parse_uint_helper(uip, value, max, desc, 0);
}
static uint32_t
@@ -938,7 +938,7 @@ parse_bits(char *arg, const char *desc, uint32_t max) {
fatal("couldn't parse digest bits");
}
tmp = (tmp + 7) & ~0x7U;
return (tmp);
return tmp;
}
isc_result_t
@@ -1016,7 +1016,7 @@ done:
sa->length = prefix_length;
*sap = sa;
return (ISC_R_SUCCESS);
return ISC_R_SUCCESS;
}
/*
@@ -1092,7 +1092,7 @@ read_confkey(void) {
isc_result_t result;
if (!isc_file_exists(keyfile)) {
return (ISC_R_FILENOTFOUND);
return ISC_R_FILENOTFOUND;
}
result = cfg_parser_create(mctx, &pctx);
@@ -1133,7 +1133,7 @@ cleanup:
cfg_parser_destroy(&pctx);
}
return (result);
return result;
}
void
@@ -1203,7 +1203,7 @@ make_searchlist_entry(char *domain) {
strlcpy(search->origin, domain, MXNAME);
search->origin[MXNAME - 1] = 0;
ISC_LINK_INIT(search, link);
return (search);
return search;
}
static void
@@ -1543,13 +1543,13 @@ check_if_queries_done(dig_lookup_t *l, dig_query_t *except_q) {
if (!q->started || isc_refcount_current(&q->references) > 1) {
if (!q->canceled && q != except_q) {
debug("there is a pending query %p", q);
return (false);
return false;
}
}
q = ISC_LIST_NEXT(q, link);
}
return (true);
return true;
}
static void
@@ -1859,7 +1859,7 @@ followup_lookup(dns_message_t *msg, dig_query_t *query, dns_section_t section) {
result = dns_message_findtype(name, dns_rdatatype_soa,
0, &rdataset);
if (result == ISC_R_SUCCESS) {
return (0);
return 0;
}
}
rdataset = NULL;
@@ -1962,7 +1962,7 @@ followup_lookup(dns_message_t *msg, dig_query_t *query, dns_section_t section) {
if (lookup == NULL && section == DNS_SECTION_ANSWER &&
(query->lookup->trace || query->lookup->ns_search_only))
{
return (followup_lookup(msg, query, DNS_SECTION_AUTHORITY));
return followup_lookup(msg, query, DNS_SECTION_AUTHORITY);
}
/*
@@ -1994,7 +1994,7 @@ followup_lookup(dns_message_t *msg, dig_query_t *query, dns_section_t section) {
link);
}
return (numLookups);
return numLookups;
}
/*%
@@ -2021,7 +2021,7 @@ next_origin(dig_lookup_t *oldlookup) {
* We're not using a search list, so don't even think
* about finding the next entry.
*/
return (false);
return false;
}
/*
@@ -2033,14 +2033,14 @@ next_origin(dig_lookup_t *oldlookup) {
(dns_name_isabsolute(name) ||
(int)dns_name_countlabels(name) > ndots))
{
return (false);
return false;
}
if (oldlookup->origin == NULL && !oldlookup->need_search) {
/*
* Then we just did rootorg; there's nothing left.
*/
return (false);
return false;
}
if (oldlookup->origin == NULL && oldlookup->need_search) {
newlookup = requeue_lookup(oldlookup, true);
@@ -2049,13 +2049,13 @@ next_origin(dig_lookup_t *oldlookup) {
} else {
search = ISC_LIST_NEXT(oldlookup->origin, link);
if (search == NULL && oldlookup->done_as_is) {
return (false);
return false;
}
newlookup = requeue_lookup(oldlookup, true);
newlookup->origin = search;
}
cancel_lookup(oldlookup);
return (true);
return true;
}
/*%
@@ -2081,8 +2081,8 @@ insert_soa(dig_lookup_t *lookup) {
soa.common.rdclass = lookup->rdclass;
soa.common.rdtype = dns_rdatatype_soa;
dns_name_init(&soa.origin, NULL);
dns_name_init(&soa.contact, NULL);
dns_name_init(&soa.origin);
dns_name_init(&soa.contact);
dns_name_clone(dns_rootname, &soa.origin);
dns_name_clone(dns_rootname, &soa.contact);
@@ -2158,7 +2158,7 @@ _new_query(dig_lookup_t *lookup, char *servname, char *userarg,
ISC_LINK_INIT(query, link);
query->magic = DIG_QUERY_MAGIC;
return (query);
return query;
}
/*%
@@ -2205,11 +2205,6 @@ setup_lookup(dig_lookup_t *lookup) {
}
dns_message_gettempname(lookup->sendmsg, &lookup->name);
isc_buffer_init(&lookup->namebuf, lookup->name_space,
sizeof(lookup->name_space));
isc_buffer_init(&lookup->onamebuf, lookup->oname_space,
sizeof(lookup->oname_space));
/*
* We cannot convert `textname' and `origin' separately.
* `textname' doesn't contain TLD, but local mapping needs
@@ -2257,8 +2252,7 @@ setup_lookup(dig_lookup_t *lookup) {
len = (unsigned int)strlen(origin);
isc_buffer_init(&b, origin, len);
isc_buffer_add(&b, len);
result = dns_name_fromtext(lookup->oname, &b, dns_rootname, 0,
&lookup->onamebuf);
result = dns_name_fromtext(lookup->oname, &b, dns_rootname, 0);
if (result != ISC_R_SUCCESS) {
dns_message_puttempname(lookup->sendmsg, &lookup->name);
dns_message_puttempname(lookup->sendmsg,
@@ -2276,12 +2270,12 @@ setup_lookup(dig_lookup_t *lookup) {
len = (unsigned int)strlen(textname);
isc_buffer_init(&b, textname, len);
isc_buffer_add(&b, len);
result = dns_name_fromtext(name, &b, NULL, 0, NULL);
result = dns_name_fromtext(name, &b, NULL, 0);
if (result == ISC_R_SUCCESS) {
if (!dns_name_isabsolute(name)) {
result = dns_name_concatenate(
name, lookup->oname,
lookup->name, &lookup->namebuf);
lookup->name);
} else {
dns_name_copy(name, lookup->name);
}
@@ -2292,7 +2286,7 @@ setup_lookup(dig_lookup_t *lookup) {
dns_message_puttempname(lookup->sendmsg,
&lookup->oname);
if (result == DNS_R_NAMETOOLONG) {
return (false);
return false;
}
fatal("'%s' is not in legal name syntax (%s)",
lookup->textname,
@@ -2309,8 +2303,7 @@ setup_lookup(dig_lookup_t *lookup) {
isc_buffer_init(&b, textname, len);
isc_buffer_add(&b, len);
result = dns_name_fromtext(lookup->name, &b,
dns_rootname, 0,
&lookup->namebuf);
dns_rootname, 0);
if (result != ISC_R_SUCCESS) {
dns_message_puttempname(lookup->sendmsg,
&lookup->name);
@@ -2319,7 +2312,7 @@ setup_lookup(dig_lookup_t *lookup) {
isc_result_totext(result));
#if TARGET_OS_IPHONE
clear_current_lookup();
return (false);
return false;
#else /* if TARGET_OS_IPHONE */
cleanup_openssl_refs();
digexit();
@@ -2652,7 +2645,7 @@ setup_lookup(dig_lookup_t *lookup) {
ISC_LIST_ENQUEUE(lookup->q, query, link);
}
return (true);
return true;
}
/*%
@@ -2779,6 +2772,12 @@ _cancel_lookup(dig_lookup_t *lookup, const char *file, unsigned int line) {
check_if_done();
}
static inline const char *
get_tls_sni_hostname(dig_query_t *query) {
return query->lookup->tls_hostname_set ? query->lookup->tls_hostname
: query->userarg;
}
static isc_tlsctx_t *
get_create_tls_context(dig_query_t *query, const bool is_https,
isc_tlsctx_client_session_cache_t **psess_cache) {
@@ -2797,7 +2796,7 @@ 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)
{
return (NULL);
return NULL;
}
isc_sockaddr_format(&query->sockaddr, tlsctxname, sizeof(tlsctxname));
@@ -2825,10 +2824,7 @@ get_create_tls_context(dig_query_t *query, const bool is_https,
}
if (store != NULL) {
const char *hostname =
query->lookup->tls_hostname_set
? query->lookup->tls_hostname
: query->userarg;
const char *hostname = get_tls_sni_hostname(query);
/*
* According to RFC 8310, Subject field MUST NOT be
* inspected when verifying hostname for DoT. Only
@@ -2876,7 +2872,7 @@ get_create_tls_context(dig_query_t *query, const bool is_https,
INSIST(*psess_cache == NULL);
*psess_cache = sess_cache;
}
return (ctx);
return ctx;
}
if (psess_cache != NULL) {
@@ -2885,7 +2881,7 @@ get_create_tls_context(dig_query_t *query, const bool is_https,
}
INSIST(!query->lookup->tls_ca_set || found_store != NULL);
return (found_ctx);
return found_ctx;
failure:
if (ctx != NULL) {
isc_tlsctx_free(&ctx);
@@ -2900,7 +2896,7 @@ failure:
if (store != NULL && store != found_store) {
isc_tls_cert_store_free(&store);
}
return (NULL);
return NULL;
}
static void
@@ -3042,7 +3038,8 @@ start_tcp(dig_query_t *query) {
}
isc_nm_streamdnsconnect(netmgr, &localaddr, &query->sockaddr,
tcp_connected, connectquery,
local_timeout, tlsctx, sess_cache,
local_timeout, tlsctx,
get_tls_sni_hostname(query), sess_cache,
proxy_type, ppi);
#if HAVE_LIBNGHTTP2
} else if (query->lookup->https_mode) {
@@ -3062,14 +3059,15 @@ start_tcp(dig_query_t *query) {
isc_nm_httpconnect(netmgr, &localaddr, &query->sockaddr, uri,
!query->lookup->https_get, tcp_connected,
connectquery, tlsctx, sess_cache,
connectquery, tlsctx,
get_tls_sni_hostname(query), sess_cache,
local_timeout, proxy_type, ppi);
#endif
} else {
isc_nm_streamdnsconnect(netmgr, &localaddr, &query->sockaddr,
tcp_connected, connectquery,
local_timeout, NULL, NULL, proxy_type,
ppi);
local_timeout, NULL, NULL, NULL,
proxy_type, ppi);
}
return;
@@ -3354,12 +3352,12 @@ try_next_server(dig_lookup_t *lookup) {
current_query = lookup->current_query;
if (current_query == NULL || !ISC_LINK_LINKED(current_query, link)) {
return (false);
return false;
}
next_query = ISC_LIST_NEXT(current_query, link);
if (next_query == NULL) {
return (false);
return false;
}
debug("trying next server...");
@@ -3370,7 +3368,7 @@ try_next_server(dig_lookup_t *lookup) {
start_udp(next_query);
}
return (true);
return true;
}
static void
@@ -3709,7 +3707,7 @@ check_for_more_data(dig_lookup_t *lookup, dig_query_t *query,
result = dns_message_firstname(msg, DNS_SECTION_ANSWER);
if (result != ISC_R_SUCCESS) {
puts("; Transfer failed.");
return (true);
return true;
}
do {
dns_name_t *name;
@@ -3735,7 +3733,7 @@ check_for_more_data(dig_lookup_t *lookup, dig_query_t *query,
{
puts("; Transfer failed. "
"Didn't start with SOA answer.");
return (true);
return true;
}
if ((!query->second_rr_rcvd) &&
(rdata.type != dns_rdatatype_soa))
@@ -3815,10 +3813,10 @@ check_for_more_data(dig_lookup_t *lookup, dig_query_t *query,
isc_nmhandle_detach(&query->readhandle);
launch_next_query(query);
query_detach(&query);
return (false);
return false;
doexit:
dighost_received(len, peer, query);
return (true);
return true;
}
static void
@@ -3912,7 +3910,7 @@ process_opt(dig_lookup_t *l, dns_message_t *msg) {
static int
ednsvers(dns_rdataset_t *opt) {
return ((opt->ttl >> 16) & 0xff);
return (opt->ttl >> 16) & 0xff;
}
/*%
@@ -4126,8 +4124,7 @@ recv_done(isc_nmhandle_t *handle, isc_result_t eresult, isc_region_t *region,
if (l->tcp_mode) {
bool fail = true;
if (result == ISC_R_SUCCESS) {
if ((!query->first_soa_rcvd || query->warn_id))
{
if (!query->first_soa_rcvd || query->warn_id) {
dighost_warning("%s: ID mismatch: "
"expected ID %u, got "
"%u",
@@ -4583,12 +4580,12 @@ get_address(char *host, in_port_t myport, isc_sockaddr_t *sockaddr) {
result = isc_getaddresses(host, myport, sockaddr, 1, &count);
isc_loopmgr_nonblocking(loopmgr);
if (result != ISC_R_SUCCESS) {
return (result);
return result;
}
INSIST(count == 1);
return (ISC_R_SUCCESS);
return ISC_R_SUCCESS;
}
int
@@ -4610,7 +4607,7 @@ getaddresses(dig_lookup_t *lookup, const char *host, isc_result_t *resultp) {
fatal("couldn't get address for '%s': %s", host,
isc_result_totext(result));
}
return (0);
return 0;
}
for (i = 0; i < count; i++) {
@@ -4620,7 +4617,7 @@ getaddresses(dig_lookup_t *lookup, const char *host, isc_result_t *resultp) {
ISC_LIST_APPEND(lookup->my_server_list, srv, link);
}
return (count);
return count;
}
/*%
@@ -4793,7 +4790,7 @@ idn_filter(isc_buffer_t *buffer, unsigned int start) {
}
resetlocale(LC_ALL);
if (res != IDN2_OK) {
return (ISC_R_SUCCESS);
return ISC_R_SUCCESS;
}
/*
@@ -4801,14 +4798,14 @@ idn_filter(isc_buffer_t *buffer, unsigned int start) {
*/
dstlen = strlen(dst);
if (isc_buffer_length(buffer) < start + dstlen) {
return (ISC_R_NOSPACE);
return ISC_R_NOSPACE;
}
isc_buffer_subtract(buffer, srclen);
memmove(isc_buffer_used(buffer), dst, dstlen);
isc_buffer_add(buffer, dstlen);
idn2_free(dst);
return (ISC_R_SUCCESS);
return ISC_R_SUCCESS;
}
/*%
@@ -4874,8 +4871,8 @@ dig_idnsetup(dig_lookup_t *lookup, bool active) {
bool
dig_lookup_is_tls(const dig_lookup_t *lookup) {
if (lookup->tls_mode || (lookup->tls_ca_set && !lookup->https_mode)) {
return (true);
return true;
}
return (false);
return false;
}
+2 -10
View File
@@ -21,7 +21,6 @@
#include <isc/attributes.h>
#include <isc/buffer.h>
#include <isc/formatcheck.h>
#include <isc/lang.h>
#include <isc/list.h>
#include <isc/loop.h>
#include <isc/magic.h>
@@ -85,8 +84,6 @@
* in a tight loop of constant lookups. It's value is arbitrary.
*/
ISC_LANG_BEGINDECLS
typedef struct dig_lookup dig_lookup_t;
typedef struct dig_query dig_query_t;
typedef struct dig_server dig_server_t;
@@ -107,9 +104,8 @@ 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, fuzzing, header_only, identify, /*%< Append an "on
server <foo>" message
*/
svcparamkeycompat, 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,
@@ -135,8 +131,6 @@ struct dig_lookup {
bool rdclassset;
char name_space[BUFSIZE];
char oname_space[BUFSIZE];
isc_buffer_t namebuf;
isc_buffer_t onamebuf;
isc_buffer_t renderbuf;
char *sendspace;
dns_name_t *name;
@@ -466,5 +460,3 @@ dig_shutdown(void);
bool
dig_lookup_is_tls(const dig_lookup_t *lookup);
ISC_LANG_ENDDECLS
+30 -17
View File
@@ -21,6 +21,7 @@
#include <isc/attributes.h>
#include <isc/commandline.h>
#include <isc/lib.h>
#include <isc/loop.h>
#include <isc/netaddr.h>
#include <isc/string.h>
@@ -28,6 +29,7 @@
#include <dns/byaddr.h>
#include <dns/fixedname.h>
#include <dns/lib.h>
#include <dns/message.h>
#include <dns/name.h>
#include <dns/rdata.h>
@@ -80,6 +82,7 @@ struct rtype rtypes[] = { { 1, "has address" },
{ 25, "has key" },
{ 28, "has IPv6 address" },
{ 29, "location" },
{ dns_rdatatype_https, "has HTTP service bindings" },
{ 0, NULL } };
static char *
@@ -96,7 +99,7 @@ rcode_totext(dns_rcode_t rcode) {
} else {
totext.consttext = rcodetext[rcode];
}
return (totext.deconsttext);
return totext.deconsttext;
}
ISC_NORETURN static void
@@ -218,13 +221,13 @@ printsection(dns_message_t *msg, dns_section_t sectionid,
printf(";; %s SECTION:\n", section_name);
}
dns_name_init(&empty_name, NULL);
dns_name_init(&empty_name);
result = dns_message_firstname(msg, sectionid);
if (result == ISC_R_NOMORE) {
return (ISC_R_SUCCESS);
return ISC_R_SUCCESS;
} else if (result != ISC_R_SUCCESS) {
return (result);
return result;
}
for (;;) {
@@ -262,7 +265,7 @@ printsection(dns_message_t *msg, dns_section_t sectionid,
print_name, false,
no_rdata, &target);
if (result != ISC_R_SUCCESS) {
return (result);
return result;
}
#ifdef USEINITALWS
if (first) {
@@ -317,11 +320,11 @@ printsection(dns_message_t *msg, dns_section_t sectionid,
if (result == ISC_R_NOMORE) {
break;
} else if (result != ISC_R_SUCCESS) {
return (result);
return result;
}
}
return (ISC_R_SUCCESS);
return ISC_R_SUCCESS;
}
static isc_result_t
@@ -341,12 +344,12 @@ printrdata(dns_message_t *msg, dns_rdataset_t *rdataset,
result = dns_rdataset_totext(rdataset, owner, false, false, &target);
if (result != ISC_R_SUCCESS) {
return (result);
return result;
}
isc_buffer_usedregion(&target, &r);
printf("%.*s", (int)r.length, (char *)r.base);
return (ISC_R_SUCCESS);
return ISC_R_SUCCESS;
}
static void
@@ -423,7 +426,7 @@ printmessage(dig_query_t *query, const isc_buffer_t *msgbuf, dns_message_t *msg,
: query->lookup->textname,
msg->rcode, rcode_totext(msg->rcode));
}
return (ISC_R_SUCCESS);
return ISC_R_SUCCESS;
}
if (default_lookups && query->lookup->rdtype == dns_rdatatype_a) {
@@ -457,6 +460,16 @@ printmessage(dig_query_t *query, const isc_buffer_t *msgbuf, dns_message_t *msg,
lookup->retries = tries;
ISC_LIST_APPEND(lookup_list, lookup, link);
}
lookup = clone_lookup(query->lookup, false);
if (lookup != NULL) {
strlcpy(lookup->textname, namestr,
sizeof(lookup->textname));
lookup->rdtype = dns_rdatatype_https;
lookup->rdtypeset = true;
lookup->origin = NULL;
lookup->retries = tries;
ISC_LIST_APPEND(lookup_list, lookup, link);
}
}
if (!short_form) {
@@ -517,7 +530,7 @@ printmessage(dig_query_t *query, const isc_buffer_t *msgbuf, dns_message_t *msg,
result = printsection(msg, DNS_SECTION_QUESTION, "QUESTION",
true, query);
if (result != ISC_R_SUCCESS) {
return (result);
return result;
}
}
if (!ISC_LIST_EMPTY(msg->sections[DNS_SECTION_ANSWER])) {
@@ -527,7 +540,7 @@ printmessage(dig_query_t *query, const isc_buffer_t *msgbuf, dns_message_t *msg,
result = printsection(msg, DNS_SECTION_ANSWER, "ANSWER",
!short_form, query);
if (result != ISC_R_SUCCESS) {
return (result);
return result;
}
}
@@ -538,7 +551,7 @@ printmessage(dig_query_t *query, const isc_buffer_t *msgbuf, dns_message_t *msg,
result = printsection(msg, DNS_SECTION_AUTHORITY, "AUTHORITY",
true, query);
if (result != ISC_R_SUCCESS) {
return (result);
return result;
}
}
if (!ISC_LIST_EMPTY(msg->sections[DNS_SECTION_ADDITIONAL]) &&
@@ -548,7 +561,7 @@ printmessage(dig_query_t *query, const isc_buffer_t *msgbuf, dns_message_t *msg,
result = printsection(msg, DNS_SECTION_ADDITIONAL, "ADDITIONAL",
true, query);
if (result != ISC_R_SUCCESS) {
return (result);
return result;
}
}
if ((tsig != NULL) && !short_form) {
@@ -556,7 +569,7 @@ printmessage(dig_query_t *query, const isc_buffer_t *msgbuf, dns_message_t *msg,
result = printrdata(msg, tsig, tsigname, "PSEUDOSECTION TSIG",
true);
if (result != ISC_R_SUCCESS) {
return (result);
return result;
}
}
if (!short_form) {
@@ -574,7 +587,7 @@ printmessage(dig_query_t *query, const isc_buffer_t *msgbuf, dns_message_t *msg,
printf("%s has no %s record\n", namestr, typestr);
}
seen_error = force_error;
return (result);
return result;
}
static const char *optstring = "46aAc:dilnm:p:rst:vVwCDN:R:TUW:";
@@ -917,5 +930,5 @@ main(int argc, char **argv) {
cancel_all();
destroy_libs();
return ((seen_error == 0) ? 0 : 1);
return (seen_error == 0) ? 0 : 1;
}
+1 -1
View File
@@ -122,7 +122,7 @@ Options
CNAME, NS, SOA, TXT, DNSKEY, AXFR, etc.
When no query type is specified, :program:`host` automatically selects an
appropriate query type. By default, it looks for A, AAAA, and MX
appropriate query type. By default, it looks for A, AAAA, MX, and HTTPS
records. If the :option:`-C` option is given, queries are made for SOA
records. If ``name`` is a dotted-decimal IPv4 address or
colon-delimited IPv6 address, :program:`host` queries for PTR records.
+18 -16
View File
@@ -21,6 +21,7 @@
#include <isc/buffer.h>
#include <isc/commandline.h>
#include <isc/condition.h>
#include <isc/lib.h>
#include <isc/loop.h>
#include <isc/netaddr.h>
#include <isc/parseint.h>
@@ -30,6 +31,7 @@
#include <dns/byaddr.h>
#include <dns/fixedname.h>
#include <dns/lib.h>
#include <dns/message.h>
#include <dns/name.h>
#include <dns/rdata.h>
@@ -128,7 +130,7 @@ rcode_totext(dns_rcode_t rcode) {
} else {
totext.consttext = rcodetext[rcode];
}
return (totext.deconsttext);
return totext.deconsttext;
}
static void
@@ -210,9 +212,9 @@ printsection(dig_query_t *query, dns_message_t *msg, bool headers,
result = dns_message_firstname(msg, section);
if (result == ISC_R_NOMORE) {
return (ISC_R_SUCCESS);
return ISC_R_SUCCESS;
} else if (result != ISC_R_SUCCESS) {
return (result);
return result;
}
for (;;) {
name = NULL;
@@ -256,10 +258,10 @@ printsection(dig_query_t *query, dns_message_t *msg, bool headers,
if (result == ISC_R_NOMORE) {
break;
} else if (result != ISC_R_SUCCESS) {
return (result);
return result;
}
}
return (ISC_R_SUCCESS);
return ISC_R_SUCCESS;
}
static isc_result_t
@@ -294,9 +296,9 @@ detailsection(dig_query_t *query, dns_message_t *msg, bool headers,
result = dns_message_firstname(msg, section);
if (result == ISC_R_NOMORE) {
return (ISC_R_SUCCESS);
return ISC_R_SUCCESS;
} else if (result != ISC_R_SUCCESS) {
return (result);
return result;
}
for (;;) {
name = NULL;
@@ -338,10 +340,10 @@ detailsection(dig_query_t *query, dns_message_t *msg, bool headers,
if (result == ISC_R_NOMORE) {
break;
} else if (result != ISC_R_SUCCESS) {
return (result);
return result;
}
}
return (ISC_R_SUCCESS);
return ISC_R_SUCCESS;
}
static void
@@ -424,7 +426,7 @@ printmessage(dig_query_t *query, const isc_buffer_t *msgbuf, dns_message_t *msg,
/* the lookup failed */
print_error |= 1;
return (ISC_R_SUCCESS);
return ISC_R_SUCCESS;
}
if (default_lookups && query->lookup->rdtype == dns_rdatatype_a) {
@@ -478,7 +480,7 @@ printmessage(dig_query_t *query, const isc_buffer_t *msgbuf, dns_message_t *msg,
printsection(query, msg, headers, DNS_SECTION_AUTHORITY);
printsection(query, msg, headers, DNS_SECTION_ADDITIONAL);
}
return (ISC_R_SUCCESS);
return ISC_R_SUCCESS;
}
static void
@@ -537,10 +539,10 @@ testtype(char *typetext) {
tr.length = strlen(typetext);
result = dns_rdatatype_fromtext(&rdtype, &tr);
if (result == ISC_R_SUCCESS) {
return (true);
return true;
} else {
printf("unknown query type: %s\n", typetext);
return (false);
return false;
}
}
@@ -554,10 +556,10 @@ testclass(char *typetext) {
tr.length = strlen(typetext);
result = dns_rdataclass_fromtext(&rdclass, &tr);
if (result == ISC_R_SUCCESS) {
return (true);
return true;
} else {
printf("unknown query class: %s\n", typetext);
return (false);
return false;
}
}
@@ -975,5 +977,5 @@ main(int argc, char **argv) {
cancel_all();
destroy_libs();
return (query_error | print_error);
return query_error | print_error;
}
+3 -3
View File
@@ -48,10 +48,10 @@ readline(const char *prompt) {
line = fgets(buf, RL_MAXCMD, stdin);
if (line == NULL) {
free(buf);
return (NULL);
return NULL;
}
return (buf);
};
return buf;
}
#define add_history(line)
+21 -19
View File
@@ -29,6 +29,7 @@
#include <isc/dir.h>
#include <isc/file.h>
#include <isc/hash.h>
#include <isc/lib.h>
#include <isc/log.h>
#include <isc/mem.h>
#include <isc/result.h>
@@ -44,6 +45,7 @@
#include <dns/ds.h>
#include <dns/fixedname.h>
#include <dns/keyvalues.h>
#include <dns/lib.h>
#include <dns/master.h>
#include <dns/name.h>
#include <dns/rdata.h>
@@ -176,7 +178,7 @@ initname(char *setname) {
isc_buffer_init(&buf, setname, strlen(setname));
isc_buffer_add(&buf, strlen(setname));
result = dns_name_fromtext(name, &buf, dns_rootname, 0, NULL);
result = dns_name_fromtext(name, &buf, dns_rootname, 0);
if (result != ISC_R_SUCCESS) {
fatal("could not initialize name %s", setname);
}
@@ -393,7 +395,7 @@ formatset(dns_rdataset_t *rdataset) {
}
isc_buffer_putuint8(buf, 0);
return (buf);
return buf;
}
static void
@@ -503,14 +505,14 @@ match_key_dsset(keyinfo_t *ki, dns_rdataset_t *dsset, strictness_t strictness) {
vbprintf(1, "found matching %s %d %d %d\n",
c ? "CDS" : "DS", ds.key_tag, ds.algorithm,
ds.digest_type);
return (true);
return true;
} else if (strictness == TIGHT) {
vbprintf(0,
"key does not match %s %d %d %d "
"when it looks like it should\n",
c ? "CDS" : "DS", ds.key_tag, ds.algorithm,
ds.digest_type);
return (false);
return false;
}
}
@@ -519,7 +521,7 @@ match_key_dsset(keyinfo_t *ki, dns_rdataset_t *dsset, strictness_t strictness) {
ki->rdata.type == dns_rdatatype_cdnskey ? "CDNSKEY" : "DNSKEY",
ki->tag, ki->algo);
return (false);
return false;
}
/*
@@ -573,7 +575,7 @@ match_keyset_dsset(dns_rdataset_t *keyset, dns_rdataset_t *dsset,
}
}
return (keytable);
return keytable;
}
static void
@@ -679,7 +681,7 @@ matching_sigs(keyinfo_t *keytbl, dns_rdataset_t *rdataset,
}
}
return (algo);
return algo;
}
/*
@@ -696,7 +698,7 @@ signed_loose(dns_secalg_t *algo) {
}
}
isc_mem_cput(mctx, algo, nkey, sizeof(algo[0]));
return (ok);
return ok;
}
/*
@@ -738,7 +740,7 @@ signed_strict(dns_rdataset_t *dsset, dns_secalg_t *algo) {
}
isc_mem_cput(mctx, algo, nkey, sizeof(algo[0]));
return (all_ok);
return all_ok;
}
/*
@@ -759,10 +761,10 @@ ds_from_cds(isc_buffer_t *buf, dns_rdata_t *rds, dns_dsdigest_t dt,
ds.common.rdtype = dns_rdatatype_ds;
if (ds.digest_type != dt) {
return (ISC_R_IGNORE);
return ISC_R_IGNORE;
}
return (dns_rdata_fromstruct(rds, rdclass, dns_rdatatype_ds, &ds, buf));
return dns_rdata_fromstruct(rds, rdclass, dns_rdatatype_ds, &ds, buf);
}
static isc_result_t
@@ -775,7 +777,7 @@ ds_from_cdnskey(isc_buffer_t *buf, dns_rdata_t *ds, dns_dsdigest_t dt,
isc_buffer_availableregion(buf, &r);
if (r.length < DNS_DS_BUFFERSIZE) {
return (ISC_R_NOSPACE);
return ISC_R_NOSPACE;
}
result = dns_ds_buildrdata(name, cdnskey, dt, r.base, ds);
@@ -783,7 +785,7 @@ ds_from_cdnskey(isc_buffer_t *buf, dns_rdata_t *ds, dns_dsdigest_t dt,
isc_buffer_add(buf, DNS_DS_BUFFERSIZE);
}
return (result);
return result;
}
static isc_result_t
@@ -814,14 +816,14 @@ append_new_ds_set(ds_maker_func_t *ds_from_rdata, isc_buffer_t *buf,
continue;
case ISC_R_NOSPACE:
isc_mem_put(mctx, ds, sizeof(*ds));
return (result);
return result;
default:
isc_mem_put(mctx, ds, sizeof(*ds));
check_result(result, "ds_from_rdata()");
}
}
return (ISC_R_SUCCESS);
return ISC_R_SUCCESS;
}
static void
@@ -866,8 +868,8 @@ make_new_ds_set(ds_maker_func_t *ds_from_rdata, uint32_t ttl,
static int
rdata_cmp(const void *rdata1, const void *rdata2) {
return (dns_rdata_compare((const dns_rdata_t *)rdata1,
(const dns_rdata_t *)rdata2));
return dns_rdata_compare((const dns_rdata_t *)rdata1,
(const dns_rdata_t *)rdata2);
}
/*
@@ -948,7 +950,7 @@ consistent_digests(dns_rdataset_t *dsset) {
isc_mem_cput(mctx, ds, n, sizeof(dns_rdata_ds_t));
isc_mem_cput(mctx, arrdata, n, sizeof(dns_rdata_t));
return (match);
return match;
}
static void
@@ -1339,5 +1341,5 @@ cleanup:
print_mem_stats = true;
cleanup();
return (0);
return 0;
}
+12 -13
View File
@@ -22,6 +22,7 @@
#include <isc/commandline.h>
#include <isc/dir.h>
#include <isc/hash.h>
#include <isc/lib.h>
#include <isc/log.h>
#include <isc/mem.h>
#include <isc/result.h>
@@ -34,6 +35,7 @@
#include <dns/ds.h>
#include <dns/fixedname.h>
#include <dns/keyvalues.h>
#include <dns/lib.h>
#include <dns/master.h>
#include <dns/name.h>
#include <dns/rdata.h>
@@ -65,8 +67,8 @@ initname(char *setname) {
isc_buffer_init(&buf, setname, strlen(setname));
isc_buffer_add(&buf, strlen(setname));
result = dns_name_fromtext(name, &buf, dns_rootname, 0, NULL);
return (result);
result = dns_name_fromtext(name, &buf, dns_rootname, 0);
return result;
}
static void
@@ -138,7 +140,7 @@ loadset(const char *filename, dns_rdataset_t *rdataset) {
if (db != NULL) {
dns_db_detach(&db);
}
return (result);
return result;
}
static isc_result_t
@@ -153,7 +155,7 @@ loadkeyset(char *dirname, dns_rdataset_t *rdataset) {
if (dirname != NULL) {
/* allow room for a trailing slash */
if (strlen(dirname) >= isc_buffer_availablelength(&buf)) {
return (ISC_R_NOSPACE);
return ISC_R_NOSPACE;
}
isc_buffer_putstr(&buf, dirname);
if (dirname[strlen(dirname) - 1] != '/') {
@@ -162,18 +164,18 @@ loadkeyset(char *dirname, dns_rdataset_t *rdataset) {
}
if (isc_buffer_availablelength(&buf) < 7) {
return (ISC_R_NOSPACE);
return ISC_R_NOSPACE;
}
isc_buffer_putstr(&buf, "keyset-");
result = dns_name_tofilenametext(name, false, &buf);
check_result(result, "dns_name_tofilenametext()");
if (isc_buffer_availablelength(&buf) == 0) {
return (ISC_R_NOSPACE);
return ISC_R_NOSPACE;
}
isc_buffer_putuint8(&buf, 0);
return (loadset(filename, rdataset));
return loadset(filename, rdataset);
}
static void
@@ -381,7 +383,7 @@ main(int argc, char **argv) {
isc_commandline_errprint = false;
#define OPTIONS "12Aa:Cc:d:Ff:K:l:sT:v:whV"
#define OPTIONS "12Aa:Cc:d:Ff:K:sT:v:whV"
while ((ch = isc_commandline_parse(argc, argv, OPTIONS)) != -1) {
switch (ch) {
case '1':
@@ -417,9 +419,6 @@ main(int argc, char **argv) {
case 'f':
filename = isc_commandline_argument;
break;
case 'l':
fatal("-l option (DLV lookaside) is obsolete");
break;
case 's':
usekeyset = true;
break;
@@ -549,8 +548,8 @@ main(int argc, char **argv) {
fflush(stdout);
if (ferror(stdout)) {
fprintf(stderr, "write error\n");
return (1);
return 1;
} else {
return (0);
return 0;
}
}
+7 -5
View File
@@ -20,6 +20,7 @@
#include <isc/buffer.h>
#include <isc/commandline.h>
#include <isc/hash.h>
#include <isc/lib.h>
#include <isc/log.h>
#include <isc/mem.h>
#include <isc/result.h>
@@ -32,6 +33,7 @@
#include <dns/ds.h>
#include <dns/fixedname.h>
#include <dns/keyvalues.h>
#include <dns/lib.h>
#include <dns/master.h>
#include <dns/name.h>
#include <dns/rdata.h>
@@ -67,8 +69,8 @@ initname(char *setname) {
isc_buffer_init(&buf, setname, strlen(setname));
isc_buffer_add(&buf, strlen(setname));
result = dns_name_fromtext(name, &buf, dns_rootname, 0, NULL);
return (result);
result = dns_name_fromtext(name, &buf, dns_rootname, 0);
return result;
}
static void
@@ -141,7 +143,7 @@ loadset(const char *filename, dns_rdataset_t *rdataset) {
if (db != NULL) {
dns_db_detach(&db);
}
return (result);
return result;
}
static void
@@ -459,8 +461,8 @@ main(int argc, char **argv) {
fflush(stdout);
if (ferror(stdout)) {
fprintf(stderr, "write error\n");
return (1);
return 1;
} else {
return (0);
return 0;
}
}
+4 -2
View File
@@ -21,6 +21,7 @@
#include <isc/attributes.h>
#include <isc/buffer.h>
#include <isc/commandline.h>
#include <isc/lib.h>
#include <isc/log.h>
#include <isc/mem.h>
#include <isc/region.h>
@@ -31,6 +32,7 @@
#include <dns/dnssec.h>
#include <dns/fixedname.h>
#include <dns/keyvalues.h>
#include <dns/lib.h>
#include <dns/name.h>
#include <dns/rdataclass.h>
#include <dns/secalg.h>
@@ -365,7 +367,7 @@ main(int argc, char **argv) {
isc_buffer_init(&buf, argv[isc_commandline_index],
strlen(argv[isc_commandline_index]));
isc_buffer_add(&buf, strlen(argv[isc_commandline_index]));
ret = dns_name_fromtext(name, &buf, dns_rootname, 0, NULL);
ret = dns_name_fromtext(name, &buf, dns_rootname, 0);
if (ret != ISC_R_SUCCESS) {
fatal("invalid key name %s: %s",
argv[isc_commandline_index],
@@ -750,5 +752,5 @@ main(int argc, char **argv) {
free(freeit);
}
return (0);
return 0;
}
+5 -3
View File
@@ -39,6 +39,7 @@
#include <isc/buffer.h>
#include <isc/commandline.h>
#include <isc/fips.h>
#include <isc/lib.h>
#include <isc/log.h>
#include <isc/mem.h>
#include <isc/region.h>
@@ -50,6 +51,7 @@
#include <dns/fixedname.h>
#include <dns/kasp.h>
#include <dns/keyvalues.h>
#include <dns/lib.h>
#include <dns/name.h>
#include <dns/rdataclass.h>
#include <dns/secalg.h>
@@ -190,7 +192,7 @@ usage(void) {
"(default: AUTHCONF)\n");
fprintf(stderr, " -h: print usage and exit\n");
fprintf(stderr, " -m <memory debugging mode>:\n");
fprintf(stderr, " usage | trace | record | size | mctx\n");
fprintf(stderr, " usage | trace | record\n");
fprintf(stderr, " -v <level>: set verbosity level (0 - 10)\n");
fprintf(stderr, " -V: print version information\n");
fprintf(stderr, "Timing options:\n");
@@ -275,7 +277,7 @@ keygen(keygen_ctx_t *ctx, isc_mem_t *mctx, int argc, char **argv) {
isc_buffer_init(&buf, argv[isc_commandline_index],
strlen(argv[isc_commandline_index]));
isc_buffer_add(&buf, strlen(argv[isc_commandline_index]));
ret = dns_name_fromtext(name, &buf, dns_rootname, 0, NULL);
ret = dns_name_fromtext(name, &buf, dns_rootname, 0);
if (ret != ISC_R_SUCCESS) {
fatal("invalid key name %s: %s",
argv[isc_commandline_index],
@@ -1320,5 +1322,5 @@ main(int argc, char **argv) {
free(freeit);
}
return (0);
return 0;
}
+17 -15
View File
@@ -20,6 +20,7 @@
#include <isc/commandline.h>
#include <isc/fips.h>
#include <isc/lex.h>
#include <isc/lib.h>
#include <isc/mem.h>
#include <dns/callbacks.h>
@@ -27,6 +28,7 @@
#include <dns/fixedname.h>
#include <dns/keymgr.h>
#include <dns/keyvalues.h>
#include <dns/lib.h>
#include <dns/rdataclass.h>
#include <dns/rdatalist.h>
#include <dns/rdataset.h>
@@ -149,7 +151,7 @@ between(isc_stdtime_t t, isc_stdtime_t start, isc_stdtime_t end) {
if (t > 0 && t > start && t < end) {
r = t;
}
return (r);
return r;
}
static void
@@ -199,15 +201,15 @@ keyalgtag_cmp(const void *k1, const void *k2) {
dns_dnsseckey_t **key1 = (dns_dnsseckey_t **)k1;
dns_dnsseckey_t **key2 = (dns_dnsseckey_t **)k2;
if (dst_key_alg((*key1)->key) < dst_key_alg((*key2)->key)) {
return (-1);
return -1;
} else if (dst_key_alg((*key1)->key) > dst_key_alg((*key2)->key)) {
return (1);
return 1;
} else if (dst_key_id((*key1)->key) < dst_key_id((*key2)->key)) {
return (-1);
return -1;
} else if (dst_key_id((*key1)->key) > dst_key_id((*key2)->key)) {
return (1);
return 1;
}
return (0);
return 0;
}
static void
@@ -641,7 +643,7 @@ fail:
namestr, algstr, timestr);
}
return (next_bundle);
return next_bundle;
}
static isc_stdtime_t
@@ -735,7 +737,7 @@ sign_rrset(ksr_ctx_t *ksr, isc_stdtime_t inception, isc_stdtime_t expiration,
print_rdata(&rrsigset);
freerrset(&rrsigset);
return (next_bundle);
return next_bundle;
}
/*
@@ -893,11 +895,11 @@ get_keymaterial(ksr_ctx_t *ksr, dns_kasp_t *kasp, isc_stdtime_t inception,
dns_rdatalist_tordataset(cdnskeylist, cdnskeyset);
dns_rdatalist_tordataset(cdslist, cdsset);
return (next_bundle);
return next_bundle;
fail:
fatal("failed to create KSK/CDS/CDNSKEY");
return (0);
return 0;
}
static void
@@ -1006,12 +1008,12 @@ parse_dnskey(isc_lex_t *lex, char *owner, isc_buffer_t *buf, dns_ttl_t *ttl) {
dname = dns_fixedname_initname(&dfname);
isc_buffer_init(&b, owner, strlen(owner));
isc_buffer_add(&b, strlen(owner));
ret = dns_name_fromtext(dname, &b, dns_rootname, 0, NULL);
ret = dns_name_fromtext(dname, &b, dns_rootname, 0);
if (ret != ISC_R_SUCCESS) {
return (ret);
return ret;
}
if (dns_name_compare(dname, name) != 0) {
return (DNS_R_BADOWNERNAME);
return DNS_R_BADOWNERNAME;
}
isc_buffer_clear(&b);
@@ -1049,7 +1051,7 @@ parse_dnskey(isc_lex_t *lex, char *owner, isc_buffer_t *buf, dns_ttl_t *ttl) {
cleanup:
isc_lex_setcomments(lex, 0);
return (ret);
return ret;
}
static void
@@ -1453,7 +1455,7 @@ main(int argc, char *argv[]) {
name = dns_fixedname_initname(&fname);
isc_buffer_init(&buf, argv[1], strlen(argv[1]));
isc_buffer_add(&buf, strlen(argv[1]));
ret = dns_name_fromtext(name, &buf, dns_rootname, 0, NULL);
ret = dns_name_fromtext(name, &buf, dns_rootname, 0);
if (ret != ISC_R_SUCCESS) {
fatal("invalid zone name %s: %s", argv[1],
isc_result_totext(ret));
+3 -1
View File
@@ -23,12 +23,14 @@
#include <isc/commandline.h>
#include <isc/file.h>
#include <isc/hash.h>
#include <isc/lib.h>
#include <isc/mem.h>
#include <isc/result.h>
#include <isc/string.h>
#include <isc/util.h>
#include <dns/keyvalues.h>
#include <dns/lib.h>
#include <dst/dst.h>
@@ -248,5 +250,5 @@ cleanup:
}
isc_mem_destroy(&mctx);
return (0);
return 0;
}
+3 -1
View File
@@ -25,6 +25,7 @@
#include <isc/commandline.h>
#include <isc/file.h>
#include <isc/hash.h>
#include <isc/lib.h>
#include <isc/log.h>
#include <isc/mem.h>
#include <isc/result.h>
@@ -33,6 +34,7 @@
#include <isc/util.h>
#include <dns/keyvalues.h>
#include <dns/lib.h>
#include <dst/dst.h>
@@ -949,5 +951,5 @@ main(int argc, char **argv) {
isc_mem_free(mctx, directory);
isc_mem_destroy(&mctx);
return (0);
return 0;
}
+79 -60
View File
@@ -45,6 +45,7 @@
#include <isc/fips.h>
#include <isc/hash.h>
#include <isc/hex.h>
#include <isc/lib.h>
#include <isc/log.h>
#include <isc/loop.h>
#include <isc/managers.h>
@@ -71,6 +72,7 @@
#include <dns/fixedname.h>
#include <dns/kasp.h>
#include <dns/keyvalues.h>
#include <dns/lib.h>
#include <dns/master.h>
#include <dns/masterdump.h>
#include <dns/nsec.h>
@@ -197,7 +199,7 @@ savezonecut(dns_fixedname_t *fzonecut, dns_name_t *name) {
result = dns_fixedname_initname(fzonecut);
dns_name_copy(name, result);
return (result);
return result;
}
static void
@@ -325,28 +327,28 @@ signwithkey(dns_name_t *name, dns_rdataset_t *rdataset, dst_key_t *key,
static bool
issigningkey(dns_dnsseckey_t *key) {
return (key->force_sign || key->hint_sign);
return key->force_sign || key->hint_sign;
}
static bool
ispublishedkey(dns_dnsseckey_t *key) {
return ((key->force_publish || key->hint_publish) && !key->hint_remove);
return (key->force_publish || key->hint_publish) && !key->hint_remove;
}
static bool
iszonekey(dns_dnsseckey_t *key) {
return (dns_name_equal(dst_key_name(key->key), gorigin) &&
dst_key_iszonekey(key->key));
return dns_name_equal(dst_key_name(key->key), gorigin) &&
dst_key_iszonekey(key->key);
}
static bool
isksk(dns_dnsseckey_t *key) {
return (key->ksk);
return key->ksk;
}
static bool
iszsk(dns_dnsseckey_t *key) {
return (ignore_kskflag || !key->ksk);
return ignore_kskflag || !key->ksk;
}
/*%
@@ -366,10 +368,10 @@ keythatsigned_unlocked(dns_rdata_rrsig_t *rrsig) {
rrsig->algorithm == dst_key_alg(key->key) &&
dns_name_equal(&rrsig->signer, dst_key_name(key->key)))
{
return (key);
return key;
}
}
return (NULL);
return NULL;
}
/*%
@@ -386,7 +388,7 @@ keythatsigned(dns_rdata_rrsig_t *rrsig) {
key = keythatsigned_unlocked(rrsig);
RWUNLOCK(&keylist_lock, isc_rwlocktype_read);
if (key != NULL) {
return (key);
return key;
}
/*
@@ -400,7 +402,7 @@ keythatsigned(dns_rdata_rrsig_t *rrsig) {
key = keythatsigned_unlocked(rrsig);
if (key != NULL) {
isc_rwlock_unlock(&keylist_lock, isc_rwlocktype_write);
return (key);
return key;
}
result = dst_key_fromfile(&rrsig->signer, rrsig->keyid,
@@ -408,7 +410,7 @@ keythatsigned(dns_rdata_rrsig_t *rrsig) {
mctx, &pubkey);
if (result != ISC_R_SUCCESS) {
isc_rwlock_unlock(&keylist_lock, isc_rwlocktype_write);
return (NULL);
return NULL;
}
result = dst_key_fromfile(
@@ -419,15 +421,14 @@ keythatsigned(dns_rdata_rrsig_t *rrsig) {
dns_dnsseckey_create(mctx, &privkey, &key);
} else {
dns_dnsseckey_create(mctx, &pubkey, &key);
key->pubkey = true;
}
key->force_publish = false;
key->force_sign = false;
key->index = keycount++;
ISC_LIST_APPEND(keylist, key, link);
isc_rwlock_unlock(&keylist_lock, isc_rwlocktype_write);
return (key);
return key;
}
/*%
@@ -449,11 +450,11 @@ expecttofindkey(dns_name_t *name) {
case ISC_R_SUCCESS:
case DNS_R_NXDOMAIN:
case DNS_R_NXRRSET:
return (true);
return true;
case DNS_R_DELEGATION:
case DNS_R_CNAME:
case DNS_R_DNAME:
return (false);
return false;
default:
break;
}
@@ -461,7 +462,7 @@ expecttofindkey(dns_name_t *name) {
fatal("failure looking for '%s DNSKEY' in database: %s", namestr,
isc_result_totext(result));
UNREACHABLE();
return (false); /* removes a warning */
return false; /* removes a warning */
}
static bool
@@ -471,10 +472,10 @@ setverifies(dns_name_t *name, dns_rdataset_t *set, dst_key_t *key,
result = dns_dnssec_verify(name, set, key, false, 0, mctx, rrsig, NULL);
if (result == ISC_R_SUCCESS || result == DNS_R_FROMWILDCARD) {
INCSTAT(nverified);
return (true);
return true;
} else {
INCSTAT(nverifyfailed);
return (false);
return false;
}
}
@@ -540,7 +541,7 @@ signset(dns_diff_t *del, dns_diff_t *add, dns_dbnode_t *node, dns_name_t *name,
}
while (result == ISC_R_SUCCESS) {
bool expired, future;
bool expired, refresh, future, offline;
bool keep = false, resign = false;
dns_rdataset_current(&sigset, &sigrdata);
@@ -551,8 +552,10 @@ signset(dns_diff_t *del, dns_diff_t *add, dns_dbnode_t *node, dns_name_t *name,
future = isc_serial_lt(now, rrsig.timesigned);
key = keythatsigned(&rrsig);
offline = (key != NULL) ? key->pubkey : false;
sig_format(&rrsig, sigstr, sizeof(sigstr));
expired = isc_serial_gt(now + cycle, rrsig.timeexpire);
expired = isc_serial_gt(now, rrsig.timeexpire);
refresh = isc_serial_gt(now + cycle, rrsig.timeexpire);
if (isc_serial_gt(rrsig.timesigned, rrsig.timeexpire)) {
/* rrsig is dropped and not replaced */
@@ -581,15 +584,21 @@ signset(dns_diff_t *del, dns_diff_t *add, dns_dbnode_t *node, dns_name_t *name,
} else if (issigningkey(key)) {
wassignedby[key->index] = true;
if (!expired && rrsig.originalttl == set->ttl &&
if (!refresh && rrsig.originalttl == set->ttl &&
setverifies(name, set, key->key, &sigrdata))
{
vbprintf(2, "\trrsig by %s retained\n", sigstr);
keep = true;
} else if (offline) {
vbprintf(2,
"\trrsig by %s retained - private key "
"missing\n",
sigstr);
keep = true;
} else {
vbprintf(2, "\trrsig by %s dropped - %s\n",
sigstr,
expired ? "expired"
refresh ? "refresh"
: rrsig.originalttl != set->ttl
? "ttl change"
: "failed to "
@@ -602,25 +611,32 @@ signset(dns_diff_t *del, dns_diff_t *add, dns_dbnode_t *node, dns_name_t *name,
} else if (iszonekey(key)) {
wassignedby[key->index] = true;
if (!expired && rrsig.originalttl == set->ttl &&
if (!refresh && rrsig.originalttl == set->ttl &&
setverifies(name, set, key->key, &sigrdata))
{
vbprintf(2, "\trrsig by %s retained\n", sigstr);
keep = true;
} else if (offline) {
vbprintf(2,
"\trrsig by %s retained - private key "
"missing\n",
sigstr);
keep = true;
} else {
vbprintf(2, "\trrsig by %s dropped - %s\n",
sigstr,
expired ? "expired"
refresh ? "refresh"
: rrsig.originalttl != set->ttl
? "ttl change"
: "failed to "
"verify");
}
} else if (!expired) {
} else if (!refresh) {
vbprintf(2, "\trrsig by %s retained\n", sigstr);
keep = true;
} else {
vbprintf(2, "\trrsig by %s expired\n", sigstr);
vbprintf(2, "\trrsig by %s %s\n", sigstr,
expired ? "expired" : "needs refresh");
}
if (keep) {
@@ -673,6 +689,10 @@ 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))
{
if (REVOKE(key->key) && set->type != dns_rdatatype_dnskey) {
continue;
}
if (nowsignedby[key->index]) {
continue;
}
@@ -855,7 +875,7 @@ hashlist_add_dns_name(hashlist_t *l,
static int
hashlist_comp(const void *a, const void *b) {
return (memcmp(a, b, hash_length + 1));
return memcmp(a, b, hash_length + 1);
}
static void
@@ -887,11 +907,11 @@ hashlist_hasdup(hashlist_t *l) {
continue;
}
if (isc_safe_memequal(current, next, l->length - 1)) {
return (true);
return true;
}
current = next;
}
return (false);
return false;
}
static const unsigned char *
@@ -913,16 +933,16 @@ hashlist_findnext(const hashlist_t *l,
}
} while (entries-- > 1U);
INSIST(entries != 0U);
return (next);
return next;
}
static bool
hashlist_exists(const hashlist_t *l,
const unsigned char hash[NSEC3_MAX_HASH_LENGTH]) {
if (bsearch(hash, l->hashbuf, l->entries, l->length, hashlist_comp)) {
return (true);
return true;
} else {
return (false);
return false;
}
}
@@ -939,7 +959,7 @@ addnowildcardhash(hashlist_t *l,
wild = dns_fixedname_initname(&fixed);
result = dns_name_concatenate(dns_wildcardname, name, wild, NULL);
result = dns_name_concatenate(dns_wildcardname, name, wild);
if (result == ISC_R_NOSPACE) {
return;
}
@@ -1031,7 +1051,7 @@ loadds(dns_name_t *name, uint32_t ttl, dns_rdataset_t *dsset) {
vbprintf(2, "found DS records\n");
dsset->ttl = ttl;
dns_db_detach(&db);
return (result);
return result;
}
}
dns_db_detach(&db);
@@ -1040,13 +1060,13 @@ loadds(dns_name_t *name, uint32_t ttl, dns_rdataset_t *dsset) {
/* No DS records found; try again, looking for DNSKEY records */
opendb("keyset-", name, gclass, &db);
if (db == NULL) {
return (ISC_R_NOTFOUND);
return ISC_R_NOTFOUND;
}
result = dns_db_findnode(db, name, false, &node);
if (result != ISC_R_SUCCESS) {
dns_db_detach(&db);
return (result);
return result;
}
dns_rdataset_init(&keyset);
@@ -1055,7 +1075,7 @@ loadds(dns_name_t *name, uint32_t ttl, dns_rdataset_t *dsset) {
if (result != ISC_R_SUCCESS) {
dns_db_detachnode(db, &node);
dns_db_detach(&db);
return (result);
return result;
}
vbprintf(2, "found DNSKEY records\n");
@@ -1091,7 +1111,7 @@ loadds(dns_name_t *name, uint32_t ttl, dns_rdataset_t *dsset) {
dns_rdataset_disassociate(&keyset);
dns_db_detachnode(db, &node);
dns_db_detach(&db);
return (result);
return result;
}
static bool
@@ -1100,7 +1120,7 @@ secure(dns_name_t *name, dns_dbnode_t *node) {
isc_result_t result;
if (dns_name_equal(name, gorigin)) {
return (false);
return false;
}
dns_rdataset_init(&dsset);
@@ -1110,7 +1130,7 @@ secure(dns_name_t *name, dns_dbnode_t *node) {
dns_rdataset_disassociate(&dsset);
}
return (result == ISC_R_SUCCESS);
return result == ISC_R_SUCCESS;
}
static bool
@@ -1120,7 +1140,7 @@ is_delegation(dns_db_t *db, dns_dbversion_t *ver, dns_name_t *origin,
isc_result_t result;
if (dns_name_equal(name, origin)) {
return (false);
return false;
}
dns_rdataset_init(&nsset);
@@ -1133,7 +1153,7 @@ is_delegation(dns_db_t *db, dns_dbversion_t *ver, dns_name_t *origin,
dns_rdataset_disassociate(&nsset);
}
return ((result == ISC_R_SUCCESS));
return result == ISC_R_SUCCESS;
}
/*%
@@ -1152,7 +1172,7 @@ has_dname(dns_db_t *db, dns_dbversion_t *ver, dns_dbnode_t *node) {
dns_rdataset_disassociate(&dnameset);
}
return ((result == ISC_R_SUCCESS));
return result == ISC_R_SUCCESS;
}
/*%
@@ -1370,7 +1390,7 @@ active_node(dns_dbnode_t *node) {
}
dns_rdatasetiter_destroy(&rdsiter);
return (active);
return active;
}
/*%
@@ -1419,7 +1439,7 @@ setsoaserial(uint32_t serial, dns_updatemethod_t method) {
result = dns_db_getoriginnode(gdb, &node);
if (result != ISC_R_SUCCESS) {
return (result);
return result;
}
dns_rdataset_init(&rdataset);
@@ -1493,7 +1513,7 @@ cleanup:
}
dns_rdata_reset(&rdata);
return (result);
return result;
}
/*%
@@ -2014,7 +2034,7 @@ addnsec3(dns_name_t *name, dns_dbnode_t *node, const unsigned char *salt,
dns_fixedname_init(&hashname);
dns_rdataset_init(&rdataset);
dns_name_downcase(name, name, NULL);
dns_name_downcase(name, name);
result = dns_nsec3_hashname(&hashname, hash, &hash_len, name, gorigin,
dns_hash_sha1, iterations, salt, salt_len);
check_result(result, "addnsec3: dns_nsec3_hashname()");
@@ -2382,7 +2402,7 @@ nsec3ify(unsigned int hashalg, dns_iterations_t iterations,
fatal("iterating through the database failed: %s",
isc_result_totext(result));
}
dns_name_downcase(name, name, NULL);
dns_name_downcase(name, name);
hashlist_add_dns_name(hashlist, name, hashalg, iterations, salt,
salt_len, false);
dns_db_detachnode(gdb, &node);
@@ -2392,7 +2412,7 @@ nsec3ify(unsigned int hashalg, dns_iterations_t iterations,
* node for another <name,nextname> span so we don't add
* it here. Empty labels on nextname are within the span.
*/
dns_name_downcase(nextname, nextname, NULL);
dns_name_downcase(nextname, nextname);
dns_name_fullcompare(name, nextname, &order, &nlabels);
addnowildcardhash(hashlist, name, hashalg, iterations, salt,
salt_len);
@@ -2559,7 +2579,7 @@ loadzone(char *file, char *origin, dns_rdataclass_t rdclass, dns_db_t **db) {
isc_buffer_add(&b, len);
name = dns_fixedname_initname(&fname);
result = dns_name_fromtext(name, &b, dns_rootname, 0, NULL);
result = dns_name_fromtext(name, &b, dns_rootname, 0);
if (result != ISC_R_SUCCESS) {
fatal("failed converting name '%s' to dns format: %s", origin,
isc_result_totext(result));
@@ -3368,9 +3388,12 @@ main(int argc, char *argv[]) {
atomic_init(&shuttingdown, false);
atomic_init(&finished, false);
/* Unused letters: Bb G J q Yy (and F is reserved). */
#define CMDLINE_FLAGS \
"3:AaCc:Dd:E:e:f:FgG:hH:i:I:j:J:K:k:L:l:m:M:n:N:o:O:PpQqRr:s:ST:tuUv:" \
/*
* Unused letters: Bb G J l q Yy (and F is reserved).
* l was previously used for DLV lookaside.
*/
#define CMDLINE_FLAGS \
"3:AaCc:Dd:E:e:f:FgG:hH:i:I:j:J:K:k:L:m:M:n:N:o:O:PpQqRr:s:ST:tuUv:" \
"VX:xzZ:"
/*
@@ -3544,10 +3567,6 @@ main(int argc, char *argv[]) {
}
break;
case 'l':
fatal("-l option (DLV lookaside) is obsolete");
break;
case 'M':
endp = NULL;
set_maxttl = true;
@@ -4134,5 +4153,5 @@ main(int argc, char *argv[]) {
}
isc_mutex_destroy(&namelock);
return (vresult == ISC_R_SUCCESS ? 0 : 1);
return vresult == ISC_R_SUCCESS ? 0 : 1;
}
+7 -2
View File
@@ -174,6 +174,11 @@ Options
days. Therefore, if any existing RRSIG records are due to expire in
less than 7.5 days, they are replaced.
Note that the calculation of cycle interval is based upon the validity
period of the replacement signatures that would be generated by
``dnssec-signzone``, not on the valid lifetimes of the input RRSIGs being
considered for pre-expiry replacement.
.. option:: -I input-format
This option sets the format of the input zone file. Possible formats are
@@ -269,7 +274,7 @@ Options
with cached copies of the old DNSKEY RRset. The :option:`-Q` option forces
:program:`dnssec-signzone` to remove signatures from keys that are no longer
active. This enables ZSK rollover using the procedure described in
:rfc:`6781#4.1.1.1` ("Pre-Publish Key Rollover").
:rfc:`6781#section-4.1.1.1` ("Pre-Publish Zone Signing Key Rollover").
.. option:: -q
@@ -286,7 +291,7 @@ Options
This option is similar to :option:`-Q`, except it forces
:program:`dnssec-signzone` to remove signatures from keys that are no longer
published. This enables ZSK rollover using the procedure described in
:rfc:`6781#4.1.1.2` ("Double Signature Zone Signing Key
:rfc:`6781#section-4.1.1.2` ("Double Signature Zone Signing Key
Rollover").
.. option:: -S
+4 -2
View File
@@ -23,6 +23,7 @@
#include <isc/file.h>
#include <isc/hash.h>
#include <isc/hex.h>
#include <isc/lib.h>
#include <isc/log.h>
#include <isc/mem.h>
#include <isc/mutex.h>
@@ -43,6 +44,7 @@
#include <dns/ds.h>
#include <dns/fixedname.h>
#include <dns/keyvalues.h>
#include <dns/lib.h>
#include <dns/master.h>
#include <dns/masterdump.h>
#include <dns/nsec.h>
@@ -103,7 +105,7 @@ loadzone(char *file, char *origin, dns_rdataclass_t rdclass, dns_db_t **db) {
isc_buffer_add(&b, len);
name = dns_fixedname_initname(&fname);
result = dns_name_fromtext(name, &b, dns_rootname, 0, NULL);
result = dns_name_fromtext(name, &b, dns_rootname, 0);
if (result != ISC_R_SUCCESS) {
fatal("failed converting name '%s' to dns format: %s", origin,
isc_result_totext(result));
@@ -330,5 +332,5 @@ main(int argc, char *argv[]) {
}
isc_mem_destroy(&mctx);
return (result == ISC_R_SUCCESS ? 0 : 1);
return result == ISC_R_SUCCESS ? 0 : 1;
}
+31 -33
View File
@@ -173,16 +173,16 @@ time_units(isc_stdtime_t offset, char *suffix, const char *str) {
switch (suffix[0]) {
case 'Y':
case 'y':
return (offset * (365 * 24 * 3600));
return offset * (365 * 24 * 3600);
case 'M':
case 'm':
switch (suffix[1]) {
case 'O':
case 'o':
return (offset * (30 * 24 * 3600));
return offset * (30 * 24 * 3600);
case 'I':
case 'i':
return (offset * 60);
return offset * 60;
case '\0':
fatal("'%s' ambiguous: use 'mi' for minutes "
"or 'mo' for months",
@@ -194,29 +194,29 @@ time_units(isc_stdtime_t offset, char *suffix, const char *str) {
break;
case 'W':
case 'w':
return (offset * (7 * 24 * 3600));
return offset * (7 * 24 * 3600);
case 'D':
case 'd':
return (offset * (24 * 3600));
return offset * (24 * 3600);
case 'H':
case 'h':
return (offset * 3600);
return offset * 3600;
case 'S':
case 's':
case '\0':
return (offset);
return offset;
default:
fatal("time value %s is invalid", str);
}
UNREACHABLE();
return (0); /* silence compiler warning */
return 0; /* silence compiler warning */
}
static bool
isnone(const char *str) {
return ((strcasecmp(str, "none") == 0) ||
(strcasecmp(str, "never") == 0) ||
(strcasecmp(str, "unset") == 0));
return (strcasecmp(str, "none") == 0) ||
(strcasecmp(str, "never") == 0) ||
(strcasecmp(str, "unset") == 0);
}
dns_ttl_t
@@ -226,7 +226,7 @@ strtottl(const char *str) {
char *endp;
if (isnone(str)) {
return ((dns_ttl_t)0);
return (dns_ttl_t)0;
}
ttl = strtol(str, &endp, 0);
@@ -234,19 +234,19 @@ strtottl(const char *str) {
fatal("TTL must be numeric");
}
ttl = time_units(ttl, endp, orig);
return (ttl);
return ttl;
}
dst_key_state_t
strtokeystate(const char *str) {
if (isnone(str)) {
return (DST_KEY_STATE_NA);
return DST_KEY_STATE_NA;
}
for (int i = 0; i < KEYSTATES_NVALUES; i++) {
if (keystates[i] != NULL && strcasecmp(str, keystates[i]) == 0)
{
return ((dst_key_state_t)i);
return (dst_key_state_t)i;
}
}
fatal("unknown key state %s", str);
@@ -263,13 +263,13 @@ strtotime(const char *str, int64_t now, int64_t base, bool *setp) {
if (isnone(str)) {
SET_IF_NOT_NULL(setp, false);
return ((isc_stdtime_t)0);
return (isc_stdtime_t)0;
}
SET_IF_NOT_NULL(setp, true);
if ((str[0] == '0' || str[0] == '-') && str[1] == '\0') {
return ((isc_stdtime_t)0);
return (isc_stdtime_t)0;
}
/*
@@ -318,7 +318,7 @@ strtotime(const char *str, int64_t now, int64_t base, bool *setp) {
}
if (str[0] == '\0') {
return ((isc_stdtime_t)base);
return (isc_stdtime_t)base;
} else if (str[0] == '+') {
offset = strtol(str + 1, &endp, 0);
offset = time_units((isc_stdtime_t)offset, endp, orig);
@@ -331,7 +331,7 @@ strtotime(const char *str, int64_t now, int64_t base, bool *setp) {
fatal("time value %s is invalid", orig);
}
return ((isc_stdtime_t)val);
return (isc_stdtime_t)val;
}
dns_rdataclass_t
@@ -341,7 +341,7 @@ strtoclass(const char *str) {
isc_result_t result;
if (str == NULL) {
return (dns_rdataclass_in);
return dns_rdataclass_in;
}
r.base = UNCONST(str);
r.length = strlen(str);
@@ -349,7 +349,7 @@ strtoclass(const char *str) {
if (result != ISC_R_SUCCESS) {
fatal("unknown class %s", str);
}
return (rdclass);
return rdclass;
}
unsigned int
@@ -364,14 +364,14 @@ strtodsdigest(const char *str) {
if (result != ISC_R_SUCCESS) {
fatal("unknown DS algorithm %s", str);
}
return (alg);
return alg;
}
static int
cmp_dtype(const void *ap, const void *bp) {
int a = *(const uint8_t *)ap;
int b = *(const uint8_t *)bp;
return (a - b);
return a - b;
}
void
@@ -403,7 +403,7 @@ try_dir(const char *dirname) {
if (result == ISC_R_SUCCESS) {
isc_dir_close(&d);
}
return (result);
return result;
}
/*
@@ -460,9 +460,7 @@ key_collision(dst_key_t *dstkey, dns_name_t *name, const char *dir,
dns_secalg_t alg;
isc_stdtime_t now = isc_stdtime_now();
if (exact != NULL) {
*exact = false;
}
SET_IF_NOT_NULL(exact, false);
id = dst_key_id(dstkey);
rid = dst_key_rid(dstkey);
@@ -472,14 +470,14 @@ key_collision(dst_key_t *dstkey, dns_name_t *name, const char *dir,
if (id < min || id > max) {
fprintf(stderr, "Key ID %d outside of [%u..%u]\n", id,
min, max);
return (true);
return true;
}
if (rid < min || rid > max) {
fprintf(stderr,
"Revoked Key ID %d (for tag %d) outside of "
"[%u..%u]\n",
rid, id, min, max);
return (true);
return true;
}
}
@@ -487,7 +485,7 @@ key_collision(dst_key_t *dstkey, dns_name_t *name, const char *dir,
result = dns_dnssec_findmatchingkeys(name, NULL, dir, NULL, now, mctx,
&matchkeys);
if (result == ISC_R_NOTFOUND) {
return (false);
return false;
}
while (!ISC_LIST_EMPTY(matchkeys) && !conflict) {
@@ -531,7 +529,7 @@ key_collision(dst_key_t *dstkey, dns_name_t *name, const char *dir,
dns_dnsseckey_destroy(mctx, &key);
}
return (conflict);
return conflict;
}
bool
@@ -546,9 +544,9 @@ isoptarg(const char *arg, char **argv, void (*usage)(void)) {
isc_commandline_argument = argv[isc_commandline_index];
/* skip to next argument */
isc_commandline_index++;
return (true);
return true;
}
return (false);
return false;
}
void
+2
View File
@@ -931,6 +931,7 @@
<th>Messages Received</th>
<th>Records Received</th>
<th>Bytes Received</th>
<th>Transfer Rate (B/s)</th>
</tr>
</thead>
<tbody>
@@ -959,6 +960,7 @@
<td><xsl:value-of select="nmsg"/></td>
<td><xsl:value-of select="nrecs"/></td>
<td><xsl:value-of select="nbytes"/></td>
<td><xsl:value-of select="rate"/></td>
</tr>
</xsl:for-each>
</tbody>
+89 -89
View File
@@ -120,7 +120,7 @@ putrdata(bdbnode_t *node, dns_rdatatype_t typeval, dns_ttl_t ttl,
rdatalist->ttl = ttl;
ISC_LIST_APPEND(node->lists, rdatalist, link);
} else if (rdatalist->ttl != ttl) {
return (DNS_R_BADTTL);
return DNS_R_BADTTL;
}
rdata = isc_mem_get(mctx, sizeof(dns_rdata_t));
@@ -136,7 +136,7 @@ putrdata(bdbnode_t *node, dns_rdatatype_t typeval, dns_ttl_t ttl,
ISC_LIST_APPEND(rdatalist->rdata, rdata, link);
ISC_LIST_APPEND(node->buffers, rdatabuf, link);
return (ISC_R_SUCCESS);
return ISC_R_SUCCESS;
}
static isc_result_t
@@ -159,7 +159,7 @@ putrr(bdbnode_t *node, const char *type, dns_ttl_t ttl, const char *data) {
isc_constregion_t r = { .base = type, .length = strlen(type) };
result = dns_rdatatype_fromtext(&typeval, (isc_textregion_t *)&r);
if (result != ISC_R_SUCCESS) {
return (result);
return result;
}
isc_lex_create(mctx, 64, &lex);
@@ -170,7 +170,7 @@ putrr(bdbnode_t *node, const char *type, dns_ttl_t ttl, const char *data) {
result = isc_lex_openbuffer(lex, &b);
if (result != ISC_R_SUCCESS) {
return (result);
return result;
}
isc_buffer_allocate(mctx, &rb, DNS_RDATA_MAXLENGTH);
@@ -185,7 +185,7 @@ putrr(bdbnode_t *node, const char *type, dns_ttl_t ttl, const char *data) {
isc_buffer_free(&rb);
return (result);
return result;
}
/* Reasonable default SOA values */
@@ -207,9 +207,9 @@ putsoa(bdbnode_t *node, const char *mname, const char *rname, uint32_t serial) {
serial, DEFAULT_REFRESH, DEFAULT_RETRY, DEFAULT_EXPIRE,
DEFAULT_MINIMUM);
if (n >= (int)sizeof(str) || n < 0) {
return (ISC_R_NOSPACE);
return ISC_R_NOSPACE;
}
return (putrr(node, "SOA", DEFAULT_TTL, str));
return putrr(node, "SOA", DEFAULT_TTL, str);
}
static isc_result_t
@@ -222,7 +222,7 @@ puttxt(bdbnode_t *node, const char *text) {
}
buf[0] = len;
memmove(&buf[1], text, len);
return (putrdata(node, dns_rdatatype_txt, 0, buf, len + 1));
return putrdata(node, dns_rdatatype_txt, 0, buf, len + 1);
}
/*
@@ -279,7 +279,7 @@ dns64_rdata(unsigned char *v, size_t start, unsigned char *rdata) {
}
}
memmove(&rdata[j], "\07in-addr\04arpa", 14);
return (j + 14);
return j + 14;
}
static isc_result_t
@@ -301,7 +301,7 @@ dns64_cname(const dns_name_t *zone, const dns_name_t *name, bdbnode_t *node) {
zlen = zone->length;
nlen = name->length;
if ((zlen + nlen) > 74U || zlen < 10U || (nlen % 2) != 0U) {
return (ISC_R_NOTFOUND);
return ISC_R_NOTFOUND;
}
/*
@@ -320,11 +320,11 @@ dns64_cname(const dns_name_t *zone, const dns_name_t *name, bdbnode_t *node) {
while (j != 0U) {
INSIST((i / 2) < sizeof(v));
if (ndata[0] != 1) {
return (ISC_R_NOTFOUND);
return ISC_R_NOTFOUND;
}
n = hex16[ndata[1] & 0xff];
if (n == 1) {
return (ISC_R_NOTFOUND);
return ISC_R_NOTFOUND;
}
v[i / 2] = n | (v[i / 2] >> 4);
j -= 2;
@@ -346,14 +346,14 @@ dns64_cname(const dns_name_t *zone, const dns_name_t *name, bdbnode_t *node) {
* to exist in the zone.
*/
if (nlen > 16U && v[(nlen - 1) / 4 - 4] != 0) {
return (ISC_R_NOTFOUND);
return ISC_R_NOTFOUND;
}
/*
* If the total length is not 74 then this is a empty node
* so return success.
*/
if (nlen + zlen != 74U) {
return (ISC_R_SUCCESS);
return ISC_R_SUCCESS;
}
len = dns64_rdata(v, 8, rdata);
break;
@@ -363,14 +363,14 @@ dns64_cname(const dns_name_t *zone, const dns_name_t *name, bdbnode_t *node) {
* to exist in the zone.
*/
if (nlen > 12U && v[(nlen - 1) / 4 - 3] != 0) {
return (ISC_R_NOTFOUND);
return ISC_R_NOTFOUND;
}
/*
* If the total length is not 74 then this is a empty node
* so return success.
*/
if (nlen + zlen != 74U) {
return (ISC_R_SUCCESS);
return ISC_R_SUCCESS;
}
len = dns64_rdata(v, 6, rdata);
break;
@@ -380,14 +380,14 @@ dns64_cname(const dns_name_t *zone, const dns_name_t *name, bdbnode_t *node) {
* to exist in the zone.
*/
if (nlen > 8U && v[(nlen - 1) / 4 - 2] != 0) {
return (ISC_R_NOTFOUND);
return ISC_R_NOTFOUND;
}
/*
* If the total length is not 74 then this is a empty node
* so return success.
*/
if (nlen + zlen != 74U) {
return (ISC_R_SUCCESS);
return ISC_R_SUCCESS;
}
len = dns64_rdata(v, 5, rdata);
break;
@@ -397,14 +397,14 @@ dns64_cname(const dns_name_t *zone, const dns_name_t *name, bdbnode_t *node) {
* to exist in the zone.
*/
if (nlen > 4U && v[(nlen - 1) / 4 - 1] != 0) {
return (ISC_R_NOTFOUND);
return ISC_R_NOTFOUND;
}
/*
* If the total length is not 74 then this is a empty node
* so return success.
*/
if (nlen + zlen != 74U) {
return (ISC_R_SUCCESS);
return ISC_R_SUCCESS;
}
len = dns64_rdata(v, 4, rdata);
break;
@@ -414,14 +414,14 @@ dns64_cname(const dns_name_t *zone, const dns_name_t *name, bdbnode_t *node) {
* to exist in the zone.
*/
if (v[(nlen - 1) / 4] != 0) {
return (ISC_R_NOTFOUND);
return ISC_R_NOTFOUND;
}
/*
* If the total length is not 74 then this is a empty node
* so return success.
*/
if (nlen + zlen != 74U) {
return (ISC_R_SUCCESS);
return ISC_R_SUCCESS;
}
len = dns64_rdata(v, 3, rdata);
break;
@@ -431,7 +431,7 @@ dns64_cname(const dns_name_t *zone, const dns_name_t *name, bdbnode_t *node) {
* so return success.
*/
if (nlen + zlen != 74U) {
return (ISC_R_SUCCESS);
return ISC_R_SUCCESS;
}
len = dns64_rdata(v, 0, rdata);
break;
@@ -440,7 +440,7 @@ dns64_cname(const dns_name_t *zone, const dns_name_t *name, bdbnode_t *node) {
* This should never be reached unless someone adds a
* zone declaration with this internal type to named.conf.
*/
return (ISC_R_NOTFOUND);
return ISC_R_NOTFOUND;
}
/*
@@ -449,22 +449,22 @@ dns64_cname(const dns_name_t *zone, const dns_name_t *name, bdbnode_t *node) {
if ((v[0] == 170 || v[0] == 171) && v[1] == 0 && v[2] == 0 &&
v[3] == 192)
{
return (putrdata(node, dns_rdatatype_ptr, 3600, ipv4only,
sizeof(ipv4only)));
return putrdata(node, dns_rdatatype_ptr, 3600, ipv4only,
sizeof(ipv4only));
}
return (putrdata(node, dns_rdatatype_cname, 600, rdata,
(unsigned int)len));
return putrdata(node, dns_rdatatype_cname, 600, rdata,
(unsigned int)len);
}
static isc_result_t
builtin_lookup(bdb_t *bdb, const dns_name_t *name, bdbnode_t *node) {
if (name->labels == 0 && name->length == 0) {
return (bdb->lookup(node));
if (name->length == 0) {
return bdb->lookup(node);
} else if ((node->bdb->implementation->flags & BDB_DNS64) != 0) {
return (dns64_cname(&bdb->common.origin, name, node));
return dns64_cname(&bdb->common.origin, name, node);
} else {
return (ISC_R_NOTFOUND);
return ISC_R_NOTFOUND;
}
}
@@ -483,27 +483,27 @@ builtin_authority(bdb_t *bdb, bdbnode_t *node) {
result = putsoa(node, server, contact, 0);
if (result != ISC_R_SUCCESS) {
return (ISC_R_FAILURE);
return ISC_R_FAILURE;
}
result = putrr(node, "NS", 0, server);
if (result != ISC_R_SUCCESS) {
return (ISC_R_FAILURE);
return ISC_R_FAILURE;
}
return (ISC_R_SUCCESS);
return ISC_R_SUCCESS;
}
static isc_result_t
version_lookup(bdbnode_t *node) {
if (named_g_server->version_set) {
if (named_g_server->version == NULL) {
return (ISC_R_SUCCESS);
return ISC_R_SUCCESS;
} else {
return (puttxt(node, named_g_server->version));
return puttxt(node, named_g_server->version);
}
} else {
return (puttxt(node, PACKAGE_VERSION));
return puttxt(node, PACKAGE_VERSION);
}
}
@@ -511,16 +511,16 @@ static isc_result_t
hostname_lookup(bdbnode_t *node) {
if (named_g_server->hostname_set) {
if (named_g_server->hostname == NULL) {
return (ISC_R_SUCCESS);
return ISC_R_SUCCESS;
} else {
return (puttxt(node, named_g_server->hostname));
return puttxt(node, named_g_server->hostname);
}
} else {
char buf[256];
if (gethostname(buf, sizeof(buf)) != 0) {
return (ISC_R_FAILURE);
return ISC_R_FAILURE;
}
return (puttxt(node, buf));
return puttxt(node, buf);
}
}
@@ -546,16 +546,16 @@ authors_lookup(bdbnode_t *node) {
* If a version string is specified, disable the authors.bind zone.
*/
if (named_g_server->version_set) {
return (ISC_R_SUCCESS);
return ISC_R_SUCCESS;
}
for (p = authors; *p != NULL; p++) {
result = puttxt(node, *p);
if (result != ISC_R_SUCCESS) {
return (result);
return result;
}
}
return (ISC_R_SUCCESS);
return ISC_R_SUCCESS;
}
static isc_result_t
@@ -563,13 +563,13 @@ id_lookup(bdbnode_t *node) {
if (named_g_server->sctx->usehostname) {
char buf[256];
if (gethostname(buf, sizeof(buf)) != 0) {
return (ISC_R_FAILURE);
return ISC_R_FAILURE;
}
return (puttxt(node, buf));
return puttxt(node, buf);
} else if (named_g_server->sctx->server_id != NULL) {
return (puttxt(node, named_g_server->sctx->server_id));
return puttxt(node, named_g_server->sctx->server_id);
} else {
return (ISC_R_SUCCESS);
return ISC_R_SUCCESS;
}
}
@@ -577,7 +577,7 @@ static isc_result_t
empty_lookup(bdbnode_t *node) {
UNUSED(node);
return (ISC_R_SUCCESS);
return ISC_R_SUCCESS;
}
static isc_result_t
@@ -588,10 +588,10 @@ ipv4only_lookup(bdbnode_t *node) {
for (int i = 0; i < 2; i++) {
result = putrdata(node, dns_rdatatype_a, 3600, data[i], 4);
if (result != ISC_R_SUCCESS) {
return (result);
return result;
}
}
return (ISC_R_SUCCESS);
return ISC_R_SUCCESS;
}
static isc_result_t
@@ -600,7 +600,7 @@ ipv4reverse_lookup(bdbnode_t *node) {
result = putrdata(node, dns_rdatatype_ptr, 3600, ipv4only,
sizeof(ipv4only));
return (result);
return result;
}
/*
@@ -670,10 +670,10 @@ rdatasetiter_first(dns_rdatasetiter_t *iterator DNS__DB_FLARG) {
bdbnode_t *bdbnode = (bdbnode_t *)iterator->node;
if (ISC_LIST_EMPTY(bdbnode->lists)) {
return (ISC_R_NOMORE);
return ISC_R_NOMORE;
}
bdbiterator->current = ISC_LIST_HEAD(bdbnode->lists);
return (ISC_R_SUCCESS);
return ISC_R_SUCCESS;
}
static isc_result_t
@@ -682,9 +682,9 @@ rdatasetiter_next(dns_rdatasetiter_t *iterator DNS__DB_FLARG) {
bdbiterator->current = ISC_LIST_NEXT(bdbiterator->current, link);
if (bdbiterator->current == NULL) {
return (ISC_R_NOMORE);
return ISC_R_NOMORE;
} else {
return (ISC_R_SUCCESS);
return ISC_R_SUCCESS;
}
}
@@ -787,7 +787,7 @@ createnode(bdb_t *bdb, bdbnode_t **nodep) {
node->magic = BDBNODE_MAGIC;
*nodep = node;
return (ISC_R_SUCCESS);
return ISC_R_SUCCESS;
}
static void
@@ -839,28 +839,28 @@ getoriginnode(dns_db_t *db, dns_dbnode_t **nodep DNS__DB_FLARG) {
REQUIRE(VALID_BDB(bdb));
REQUIRE(nodep != NULL && *nodep == NULL);
dns_name_init(&relname, NULL);
dns_name_init(&relname);
name = &relname;
result = createnode(bdb, &node);
if (result != ISC_R_SUCCESS) {
return (result);
return result;
}
result = builtin_lookup(bdb, name, node);
if (result != ISC_R_SUCCESS && result != ISC_R_NOTFOUND) {
destroynode(node);
return (result);
return result;
}
result = builtin_authority(bdb, node);
if (result != ISC_R_SUCCESS) {
destroynode(node);
return (result);
return result;
}
*nodep = node;
return (ISC_R_SUCCESS);
*nodep = (dns_dbnode_t *)node;
return ISC_R_SUCCESS;
}
static isc_result_t
@@ -881,32 +881,32 @@ findnode(dns_db_t *db, const dns_name_t *name, bool create,
isorigin = dns_name_equal(name, &bdb->common.origin);
labels = dns_name_countlabels(name) - dns_name_countlabels(&db->origin);
dns_name_init(&relname, NULL);
dns_name_init(&relname);
dns_name_getlabelsequence(name, 0, labels, &relname);
name = &relname;
result = createnode(bdb, &node);
if (result != ISC_R_SUCCESS) {
return (result);
return result;
}
result = builtin_lookup(bdb, name, node);
if (result != ISC_R_SUCCESS && (!isorigin || result != ISC_R_NOTFOUND))
{
destroynode(node);
return (result);
return result;
}
if (isorigin) {
result = builtin_authority(bdb, node);
if (result != ISC_R_SUCCESS) {
destroynode(node);
return (result);
return result;
}
}
*nodep = node;
return (ISC_R_SUCCESS);
*nodep = (dns_dbnode_t *)node;
return ISC_R_SUCCESS;
}
static isc_result_t
@@ -925,10 +925,10 @@ find(dns_db_t *db, const dns_name_t *name, dns_dbversion_t *version,
REQUIRE(VALID_BDB(bdb));
REQUIRE(nodep == NULL || *nodep == NULL);
REQUIRE(version == NULL || version == (void *)&dummy);
REQUIRE(version == NULL || version == (dns_dbversion_t *)&dummy);
if (!dns_name_issubdomain(name, &db->origin)) {
return (DNS_R_NXDOMAIN);
return DNS_R_NXDOMAIN;
}
olabels = dns_name_countlabels(&db->origin);
@@ -954,13 +954,13 @@ find(dns_db_t *db, const dns_name_t *name, dns_dbversion_t *version,
* No data at zone apex?
*/
if (i == olabels) {
return (DNS_R_BADDB);
return DNS_R_BADDB;
}
result = DNS_R_NXDOMAIN;
continue;
}
if (result != ISC_R_SUCCESS) {
return (result);
return result;
}
/*
@@ -1015,7 +1015,7 @@ find(dns_db_t *db, const dns_name_t *name, dns_dbversion_t *version,
* and try again.
*/
if (i < nlabels) {
destroynode(node);
destroynode((bdbnode_t *)node);
node = NULL;
continue;
}
@@ -1069,7 +1069,7 @@ find(dns_db_t *db, const dns_name_t *name, dns_dbversion_t *version,
detachnode(db, &node DNS__DB_FLARG_PASS);
}
return (result);
return result;
}
static void
@@ -1117,7 +1117,7 @@ findrdataset(dns_db_t *db, dns_dbnode_t *node, dns_dbversion_t *version,
UNUSED(sigrdataset);
if (type == dns_rdatatype_rrsig) {
return (ISC_R_NOTIMPLEMENTED);
return ISC_R_NOTIMPLEMENTED;
}
list = ISC_LIST_HEAD(bdbnode->lists);
@@ -1128,12 +1128,12 @@ findrdataset(dns_db_t *db, dns_dbnode_t *node, dns_dbversion_t *version,
list = ISC_LIST_NEXT(list, link);
}
if (list == NULL) {
return (ISC_R_NOTFOUND);
return ISC_R_NOTFOUND;
}
new_rdataset(list, db, node, rdataset);
return (ISC_R_SUCCESS);
return ISC_R_SUCCESS;
}
static isc_result_t
@@ -1142,7 +1142,7 @@ allrdatasets(dns_db_t *db, dns_dbnode_t *node, dns_dbversion_t *version,
dns_rdatasetiter_t **iteratorp DNS__DB_FLARG) {
bdb_rdatasetiter_t *iterator = NULL;
REQUIRE(version == NULL || version == &dummy);
REQUIRE(version == NULL || version == (dns_dbversion_t *)&dummy);
iterator = isc_mem_get(db->mctx, sizeof(bdb_rdatasetiter_t));
*iterator = (bdb_rdatasetiter_t){
@@ -1158,7 +1158,7 @@ allrdatasets(dns_db_t *db, dns_dbnode_t *node, dns_dbversion_t *version,
*iteratorp = (dns_rdatasetiter_t *)iterator;
return (ISC_R_SUCCESS);
return ISC_R_SUCCESS;
}
static dns_dbmethods_t bdb_methods = {
@@ -1186,7 +1186,7 @@ create(isc_mem_t *mctx, const dns_name_t *origin, dns_dbtype_t type,
REQUIRE(implementation != NULL);
if (type != dns_dbtype_zone) {
return (ISC_R_NOTIMPLEMENTED);
return ISC_R_NOTIMPLEMENTED;
}
bdb = isc_mem_get(mctx, sizeof(*bdb));
@@ -1197,8 +1197,8 @@ create(isc_mem_t *mctx, const dns_name_t *origin, dns_dbtype_t type,
isc_refcount_init(&bdb->common.references, 1);
isc_mem_attach(mctx, &bdb->common.mctx);
dns_name_init(&bdb->common.origin, NULL);
dns_name_dupwithoffsets(origin, mctx, &bdb->common.origin);
dns_name_init(&bdb->common.origin);
dns_name_dup(origin, mctx, &bdb->common.origin);
INSIST(argc >= 1);
if (strcmp(argv[0], "authors") == 0) {
@@ -1241,7 +1241,7 @@ create(isc_mem_t *mctx, const dns_name_t *origin, dns_dbtype_t type,
*dbp = (dns_db_t *)bdb;
return (ISC_R_SUCCESS);
return ISC_R_SUCCESS;
cleanup:
dns_name_free(&bdb->common.origin, mctx);
@@ -1253,7 +1253,7 @@ cleanup:
}
isc_mem_putanddetach(&bdb->common.mctx, bdb, sizeof(bdb_t));
return (result);
return result;
}
/*
@@ -1269,17 +1269,17 @@ named_builtin_init(void) {
result = dns_db_register("_builtin", create, &builtin, named_g_mctx,
&builtin.dbimp);
if (result != ISC_R_SUCCESS) {
return (result);
return result;
}
result = dns_db_register("_dns64", create, &dns64, named_g_mctx,
&dns64.dbimp);
if (result != ISC_R_SUCCESS) {
dns_db_unregister(&builtin.dbimp);
return (result);
return result;
}
return (ISC_R_SUCCESS);
return ISC_R_SUCCESS;
}
void
+57 -66
View File
@@ -111,6 +111,8 @@ options {\n\
session-keyname local-ddns;\n\
startup-notify-rate 20;\n\
sig0checks-quota 1;\n\
sig0key-checks-limit 16;\n\
sig0message-checks-limit 2;\n\
statistics-file \"named.stats\";\n\
tcp-advertised-timeout 300;\n\
tcp-clients 150;\n\
@@ -168,7 +170,8 @@ options {\n\
max-clients-per-query 100;\n\
max-ncache-ttl 10800; /* 3 hours */\n\
max-recursion-depth 7;\n\
max-recursion-queries 32;\n\
max-recursion-queries 50;\n\
max-query-count 200;\n\
max-query-restarts 11;\n\
max-stale-ttl 86400; /* 1 day */\n\
message-compression yes;\n\
@@ -192,7 +195,6 @@ options {\n\
require-server-cookie no;\n\
root-key-sentinel yes;\n\
servfail-ttl 1;\n\
# sortlist <none>\n\
stale-answer-client-timeout off;\n\
stale-answer-enable false;\n\
stale-answer-ttl 30; /* 30 seconds */\n\
@@ -232,6 +234,7 @@ options {\n\
max-transfer-time-out 120;\n\
min-refresh-time 300;\n\
min-retry-time 500;\n\
min-transfer-rate-in 10240 5;\n\
multi-master no;\n\
notify yes;\n\
notify-delay 5;\n\
@@ -331,7 +334,7 @@ dnssec-policy \"insecure\" {\n\
"# END TRUST ANCHORS\n\
\n\
primaries " DEFAULT_IANA_ROOT_ZONE_PRIMARIES " {\n\
remote-servers " DEFAULT_IANA_ROOT_ZONE_PRIMARIES " {\n\
2801:1b8:10::b; # b.root-servers.net\n\
2001:500:2::c; # c.root-servers.net\n\
2001:500:2f::f; # f.root-servers.net\n\
@@ -355,15 +358,15 @@ named_config_parsedefaults(cfg_parser_t *parser, cfg_obj_t **conf) {
isc_buffer_init(&b, defaultconf, sizeof(defaultconf) - 1);
isc_buffer_add(&b, sizeof(defaultconf) - 1);
return (cfg_parse_buffer(parser, &b, __FILE__, 0, &cfg_type_namedconf,
CFG_PCTX_NODEPRECATED | CFG_PCTX_NOOBSOLETE |
CFG_PCTX_NOEXPERIMENTAL,
conf));
return cfg_parse_buffer(parser, &b, __FILE__, 0, &cfg_type_namedconf,
CFG_PCTX_NODEPRECATED | CFG_PCTX_NOOBSOLETE |
CFG_PCTX_NOEXPERIMENTAL,
conf);
}
const char *
named_config_getdefault(void) {
return (defaultconf);
return defaultconf;
}
isc_result_t
@@ -373,10 +376,10 @@ named_config_get(cfg_obj_t const *const *maps, const char *name,
for (i = 0; maps[i] != NULL; i++) {
if (cfg_map_get(maps[i], name, obj) == ISC_R_SUCCESS) {
return (ISC_R_SUCCESS);
return ISC_R_SUCCESS;
}
}
return (ISC_R_NOTFOUND);
return ISC_R_NOTFOUND;
}
isc_result_t
@@ -402,7 +405,7 @@ named_checknames_get(const cfg_obj_t **maps, const char *const names[],
*/
if (checknames != NULL && !cfg_obj_islist(checknames)) {
*obj = checknames;
return (ISC_R_SUCCESS);
return ISC_R_SUCCESS;
}
for (element = cfg_list_first(checknames);
element != NULL; element = cfg_list_next(element))
@@ -416,13 +419,13 @@ named_checknames_get(const cfg_obj_t **maps, const char *const names[],
{
*obj = cfg_tuple_get(value,
"mode");
return (ISC_R_SUCCESS);
return ISC_R_SUCCESS;
}
}
}
}
}
return (ISC_R_NOTFOUND);
return ISC_R_NOTFOUND;
}
int
@@ -434,7 +437,7 @@ named_config_listcount(const cfg_obj_t *list) {
i++;
}
return (i);
return i;
}
isc_result_t
@@ -445,7 +448,7 @@ named_config_getclass(const cfg_obj_t *classobj, dns_rdataclass_t defclass,
if (!cfg_obj_isstring(classobj)) {
*classp = defclass;
return (ISC_R_SUCCESS);
return ISC_R_SUCCESS;
}
r.base = UNCONST(cfg_obj_asstring(classobj));
r.length = strlen(r.base);
@@ -454,7 +457,7 @@ named_config_getclass(const cfg_obj_t *classobj, dns_rdataclass_t defclass,
cfg_obj_log(classobj, ISC_LOG_ERROR, "unknown class '%s'",
r.base);
}
return (result);
return result;
}
isc_result_t
@@ -465,7 +468,7 @@ named_config_gettype(const cfg_obj_t *typeobj, dns_rdatatype_t deftype,
if (!cfg_obj_isstring(typeobj)) {
*typep = deftype;
return (ISC_R_SUCCESS);
return ISC_R_SUCCESS;
}
r.base = UNCONST(cfg_obj_asstring(typeobj));
r.length = strlen(r.base);
@@ -474,7 +477,7 @@ named_config_gettype(const cfg_obj_t *typeobj, dns_rdatatype_t deftype,
cfg_obj_log(typeobj, ISC_LOG_ERROR, "unknown type '%s'",
r.base);
}
return (result);
return result;
}
dns_zonetype_t
@@ -500,12 +503,12 @@ named_config_getzonetype(const cfg_obj_t *zonetypeobj) {
} else {
UNREACHABLE();
}
return (ztype);
return ztype;
}
static isc_result_t
getremotesdef(const cfg_obj_t *cctx, const char *list, const char *name,
const cfg_obj_t **ret) {
isc_result_t
named_config_getremotesdef(const cfg_obj_t *cctx, const char *list,
const char *name, const cfg_obj_t **ret) {
isc_result_t result;
const cfg_obj_t *obj = NULL;
const cfg_listelt_t *elt;
@@ -516,7 +519,7 @@ getremotesdef(const cfg_obj_t *cctx, const char *list, const char *name,
result = cfg_map_get(cctx, list, &obj);
if (result != ISC_R_SUCCESS) {
return (result);
return result;
}
elt = cfg_list_first(obj);
while (elt != NULL) {
@@ -525,28 +528,11 @@ getremotesdef(const cfg_obj_t *cctx, const char *list, const char *name,
name) == 0)
{
*ret = obj;
return (ISC_R_SUCCESS);
return ISC_R_SUCCESS;
}
elt = cfg_list_next(elt);
}
return (ISC_R_NOTFOUND);
}
isc_result_t
named_config_getremotesdef(const cfg_obj_t *cctx, const char *list,
const char *name, const cfg_obj_t **ret) {
isc_result_t result;
if (strcmp(list, "parental-agents") == 0) {
return (getremotesdef(cctx, list, name, ret));
} else if (strcmp(list, "primaries") == 0) {
result = getremotesdef(cctx, list, name, ret);
if (result != ISC_R_SUCCESS) {
result = getremotesdef(cctx, "masters", name, ret);
}
return (result);
}
return (ISC_R_NOTFOUND);
return ISC_R_NOTFOUND;
}
static isc_result_t
@@ -561,26 +547,26 @@ named_config_getname(isc_mem_t *mctx, const cfg_obj_t *obj,
if (!cfg_obj_isstring(obj)) {
*namep = NULL;
return (ISC_R_SUCCESS);
return ISC_R_SUCCESS;
}
*namep = isc_mem_get(mctx, sizeof(**namep));
dns_name_init(*namep, NULL);
dns_name_init(*namep);
objstr = cfg_obj_asstring(obj);
isc_buffer_constinit(&b, objstr, strlen(objstr));
isc_buffer_add(&b, strlen(objstr));
dns_fixedname_init(&fname);
result = dns_name_fromtext(dns_fixedname_name(&fname), &b, dns_rootname,
0, NULL);
0);
if (result != ISC_R_SUCCESS) {
isc_mem_put(mctx, *namep, sizeof(**namep));
*namep = NULL;
return (result);
return result;
}
dns_name_dup(dns_fixedname_name(&fname), mctx, *namep);
return (ISC_R_SUCCESS);
return ISC_R_SUCCESS;
}
#define grow_array(mctx, array, newlen, oldlen) \
@@ -597,10 +583,12 @@ named_config_getname(isc_mem_t *mctx, const cfg_obj_t *obj,
oldlen = newlen; \
}
static const char *remotesnames[4] = { "remote-servers", "parental-agents",
"primaries", "masters" };
isc_result_t
named_config_getipandkeylist(const cfg_obj_t *config, const char *listtype,
const cfg_obj_t *list, isc_mem_t *mctx,
dns_ipkeylist_t *ipkl) {
named_config_getipandkeylist(const cfg_obj_t *config, const cfg_obj_t *list,
isc_mem_t *mctx, dns_ipkeylist_t *ipkl) {
uint32_t addrcount = 0, srccount = 0;
uint32_t keycount = 0, tlscount = 0;
uint32_t listcount = 0, l = 0, i = 0;
@@ -683,8 +671,6 @@ newlist:
isc_sockaddr_any6(&src6);
}
result = ISC_R_NOMEMORY;
element = cfg_list_first(addrlist);
resume:
for (; element != NULL; element = cfg_list_next(element)) {
@@ -715,17 +701,22 @@ resume:
continue;
}
list = NULL;
tresult = named_config_getremotesdef(config, listtype,
listname, &list);
tresult = ISC_R_NOTFOUND;
for (size_t n = 0; n < ARRAY_SIZE(remotesnames); n++) {
tresult = named_config_getremotesdef(
config, remotesnames[n], listname,
&list);
if (tresult == ISC_R_SUCCESS) {
break;
}
}
if (tresult == ISC_R_NOTFOUND) {
cfg_obj_log(addr, ISC_LOG_ERROR,
"%s \"%s\" not found", listtype,
"remote-servers \"%s\" not found",
listname);
result = tresult;
goto cleanup;
}
if (tresult != ISC_R_SUCCESS) {
result = tresult;
goto cleanup;
}
lists[l++].name = listname;
@@ -828,7 +819,7 @@ resume:
ipkl->count = addrcount;
ipkl->allocated = addrcount;
return (ISC_R_SUCCESS);
return ISC_R_SUCCESS;
cleanup:
if (addrs != NULL) {
@@ -867,7 +858,7 @@ cleanup:
if (stack != NULL) {
isc_mem_cput(mctx, stack, stackcount, sizeof(stack[0]));
}
return (result);
return result;
}
isc_result_t
@@ -892,10 +883,10 @@ named_config_getport(const cfg_obj_t *config, const char *type,
if (cfg_obj_asuint32(portobj) >= UINT16_MAX) {
cfg_obj_log(portobj, ISC_LOG_ERROR, "port '%u' out of range",
cfg_obj_asuint32(portobj));
return (ISC_R_RANGE);
return ISC_R_RANGE;
}
*portp = (in_port_t)cfg_obj_asuint32(portobj);
return (ISC_R_SUCCESS);
return ISC_R_SUCCESS;
}
struct keyalgorithms {
@@ -939,15 +930,15 @@ named_config_getkeyalgorithm(const char *str, unsigned int *typep,
}
}
if (algorithms[i].str == NULL) {
return (ISC_R_NOTFOUND);
return ISC_R_NOTFOUND;
}
if (str[len] == '-') {
result = isc_parse_uint16(&bits, str + len + 1, 10);
if (result != ISC_R_SUCCESS) {
return (result);
return result;
}
if (bits > algorithms[i].size) {
return (ISC_R_RANGE);
return ISC_R_RANGE;
}
} else if (algorithms[i].size == 0) {
bits = 128;
@@ -956,5 +947,5 @@ named_config_getkeyalgorithm(const char *str, unsigned int *typep,
}
SET_IF_NOT_NULL(typep, algorithms[i].type);
SET_IF_NOT_NULL(digestbits, bits);
return (ISC_R_SUCCESS);
return ISC_R_SUCCESS;
}
+9 -7
View File
@@ -44,23 +44,23 @@ getcommand(isc_lex_t *lex, char **cmdp) {
result = isc_lex_gettoken(lex, ISC_LEXOPT_EOF, &token);
if (result != ISC_R_SUCCESS) {
return (result);
return result;
}
isc_lex_ungettoken(lex, &token);
if (token.type != isc_tokentype_string) {
return (ISC_R_FAILURE);
return ISC_R_FAILURE;
}
*cmdp = token.value.as_textregion.base;
return (ISC_R_SUCCESS);
return ISC_R_SUCCESS;
}
static bool
command_compare(const char *str, const char *command) {
return (strcasecmp(str, command) == 0);
return strcasecmp(str, command) == 0;
}
/*%
@@ -86,7 +86,7 @@ named_control_docommand(isccc_sexpr_t *message, bool readonly,
/*
* No data section.
*/
return (ISC_R_FAILURE);
return ISC_R_FAILURE;
}
result = isccc_cc_lookupstring(data, "type", &cmdline);
@@ -94,7 +94,7 @@ named_control_docommand(isccc_sexpr_t *message, bool readonly,
/*
* We have no idea what this is.
*/
return (result);
return result;
}
isc_lex_create(named_g_mctx, strlen(cmdline), &lex);
@@ -233,6 +233,8 @@ named_control_docommand(isccc_sexpr_t *message, bool readonly,
command_compare(command, NAMED_COMMAND_SIGN))
{
result = named_server_rekey(named_g_server, lex, text);
} else if (command_compare(command, NAMED_COMMAND_MEMPROF)) {
result = named_server_togglememprof(lex);
} else if (command_compare(command, NAMED_COMMAND_MKEYS)) {
result = named_server_mkeys(named_g_server, lex, text);
} else if (command_compare(command, NAMED_COMMAND_NOTIFY)) {
@@ -305,5 +307,5 @@ cleanup:
isc_lex_destroy(&lex);
}
return (result);
return result;
}
+21 -30
View File
@@ -31,13 +31,13 @@
#include <isc/result.h>
#include <isc/stdtime.h>
#include <isc/string.h>
#include <isc/symtab.h>
#include <isc/util.h>
#include <isccc/alist.h>
#include <isccc/cc.h>
#include <isccc/ccmsg.h>
#include <isccc/sexpr.h>
#include <isccc/symtab.h>
#include <isccc/util.h>
#include <isccfg/check.h>
@@ -108,7 +108,7 @@ struct named_controls {
controllistenerlist_t listeners;
bool shuttingdown;
isc_mutex_t symtab_lock;
isccc_symtab_t *symtab;
isc_symtab_t *symtab;
};
static isc_result_t
@@ -246,7 +246,7 @@ address_ok(isc_sockaddr_t *sockaddr, controllistener_t *listener) {
result = dns_acl_match(&netaddr, NULL, listener->acl, env, &match,
NULL);
return (result == ISC_R_SUCCESS && match > 0);
return result == ISC_R_SUCCESS && match > 0;
}
static void
@@ -489,7 +489,7 @@ control_recvmessage(isc_nmhandle_t *handle ISC_ATTR_UNUSED, isc_result_t result,
if ((sent + CLOCKSKEW) < conn->now ||
(sent - CLOCKSKEW) > conn->now)
{
result = ISCCC_R_CLOCKSKEW;
result = DNS_R_CLOCKSKEW;
goto cleanup;
}
} else {
@@ -503,7 +503,7 @@ control_recvmessage(isc_nmhandle_t *handle ISC_ATTR_UNUSED, isc_result_t result,
if (isccc_cc_lookupuint32(conn->ctrl, "_exp", &exp) == ISC_R_SUCCESS &&
conn->now > exp)
{
result = ISCCC_R_EXPIRED;
result = DNS_R_EXPIRED;
goto cleanup;
}
@@ -638,7 +638,7 @@ control_newconn(isc_nmhandle_t *handle, isc_result_t result, void *arg) {
if (result == ISC_R_SHUTTINGDOWN) {
shutdown_listener(listener);
}
return (result);
return result;
}
peeraddr = isc_nmhandle_peeraddr(handle);
@@ -649,11 +649,11 @@ control_newconn(isc_nmhandle_t *handle, isc_result_t result, void *arg) {
NAMED_LOGMODULE_CONTROL, ISC_LOG_WARNING,
"rejected command channel message from %s",
socktext);
return (ISC_R_FAILURE);
return ISC_R_FAILURE;
}
newconnection(listener, handle);
return (ISC_R_SUCCESS);
return ISC_R_SUCCESS;
}
static void
@@ -707,11 +707,11 @@ cfgkeylist_find(const cfg_obj_t *keylist, const char *keyname,
}
}
if (element == NULL) {
return (ISC_R_NOTFOUND);
return ISC_R_NOTFOUND;
}
obj = cfg_listelt_value(element);
*objp = obj;
return (ISC_R_SUCCESS);
return ISC_R_SUCCESS;
}
static void
@@ -833,7 +833,7 @@ get_rndckey(isc_mem_t *mctx, controlkeylist_t *keyids) {
ISC_LOG_INFO, "configuring command channel from '%s'",
named_g_keyfile);
if (!isc_file_exists(named_g_keyfile)) {
return (ISC_R_FILENOTFOUND);
return ISC_R_FILENOTFOUND;
}
CHECK(cfg_parser_create(mctx, &pctx));
@@ -842,15 +842,12 @@ get_rndckey(isc_mem_t *mctx, controlkeylist_t *keyids) {
CHECK(cfg_map_get(config, "key", &key));
keyid = isc_mem_get(mctx, sizeof(*keyid));
*keyid = (controlkey_t){
.algorithm = DST_ALG_UNKNOWN,
.link = ISC_LINK_INITIALIZER,
};
keyid->keyname = isc_mem_strdup(mctx,
cfg_obj_asstring(cfg_map_getname(key)));
keyid->secret.base = NULL;
keyid->secret.length = 0;
keyid->algorithm = DST_ALG_UNKNOWN;
ISC_LINK_INIT(keyid, link);
if (keyid->keyname == NULL) {
CHECK(ISC_R_NOMEMORY);
}
CHECK(isccfg_check_key(key));
@@ -899,7 +896,7 @@ cleanup:
if (pctx != NULL) {
cfg_parser_destroy(&pctx);
}
return (result);
return result;
}
/*
@@ -1205,7 +1202,7 @@ named_controls_configure(named_controls_t *cp, const cfg_obj_t *config,
cfg_obj_log(controls, ISC_LOG_ERROR,
"UNIX domain sockets are not "
"supported");
return (ISC_R_FAILURE);
return ISC_R_FAILURE;
}
(void)cfg_map_get(controls, "inet", &inetcontrols);
@@ -1333,13 +1330,12 @@ named_controls_configure(named_controls_t *cp, const cfg_obj_t *config,
* down will be taken care of by listen_done().
*/
ISC_LIST_APPENDLIST(cp->listeners, new_listeners, link);
return (ISC_R_SUCCESS);
return ISC_R_SUCCESS;
}
isc_result_t
named_controls_create(named_server_t *server, named_controls_t **ctrlsp) {
isc_mem_t *mctx = server->mctx;
isc_result_t result;
named_controls_t *controls = isc_mem_get(mctx, sizeof(*controls));
*controls = (named_controls_t){
@@ -1350,16 +1346,11 @@ named_controls_create(named_server_t *server, named_controls_t **ctrlsp) {
isc_mutex_init(&controls->symtab_lock);
LOCK(&controls->symtab_lock);
result = isccc_cc_createsymtab(&controls->symtab);
isccc_cc_createsymtab(mctx, &controls->symtab);
UNLOCK(&controls->symtab_lock);
if (result != ISC_R_SUCCESS) {
isc_mutex_destroy(&controls->symtab_lock);
isc_mem_put(server->mctx, controls, sizeof(*controls));
return (result);
}
*ctrlsp = controls;
return (ISC_R_SUCCESS);
return ISC_R_SUCCESS;
}
void
@@ -1371,7 +1362,7 @@ named_controls_destroy(named_controls_t **ctrlsp) {
REQUIRE(ISC_LIST_EMPTY(controls->listeners));
LOCK(&controls->symtab_lock);
isccc_symtab_destroy(&controls->symtab);
isc_symtab_destroy(&controls->symtab);
UNLOCK(&controls->symtab_lock);
isc_mutex_destroy(&controls->symtab_lock);
isc_mem_put(controls->server->mctx, controls, sizeof(*controls));
+25 -25
View File
@@ -98,13 +98,13 @@ dlopen_dlz_allnodes(const char *zone, void *driverarg, void *dbdata,
UNUSED(driverarg);
if (cd->dlz_allnodes == NULL) {
return (ISC_R_NOPERM);
return ISC_R_NOPERM;
}
MAYBE_LOCK(cd);
result = cd->dlz_allnodes(zone, cd->dbdata, allnodes);
MAYBE_UNLOCK(cd);
return (result);
return result;
}
static isc_result_t
@@ -116,13 +116,13 @@ dlopen_dlz_allowzonexfr(void *driverarg, void *dbdata, const char *name,
UNUSED(driverarg);
if (cd->dlz_allowzonexfr == NULL) {
return (ISC_R_NOPERM);
return ISC_R_NOPERM;
}
MAYBE_LOCK(cd);
result = cd->dlz_allowzonexfr(cd->dbdata, name, client);
MAYBE_UNLOCK(cd);
return (result);
return result;
}
static isc_result_t
@@ -134,13 +134,13 @@ dlopen_dlz_authority(const char *zone, void *driverarg, void *dbdata,
UNUSED(driverarg);
if (cd->dlz_authority == NULL) {
return (ISC_R_NOTIMPLEMENTED);
return ISC_R_NOTIMPLEMENTED;
}
MAYBE_LOCK(cd);
result = cd->dlz_authority(zone, cd->dbdata, lookup);
MAYBE_UNLOCK(cd);
return (result);
return result;
}
static isc_result_t
@@ -155,7 +155,7 @@ dlopen_dlz_findzonedb(void *driverarg, void *dbdata, const char *name,
MAYBE_LOCK(cd);
result = cd->dlz_findzonedb(cd->dbdata, name, methods, clientinfo);
MAYBE_UNLOCK(cd);
return (result);
return result;
}
static isc_result_t
@@ -172,7 +172,7 @@ dlopen_dlz_lookup(const char *zone, const char *name, void *driverarg,
result = cd->dlz_lookup(zone, name, cd->dbdata, lookup, methods,
clientinfo);
MAYBE_UNLOCK(cd);
return (result);
return result;
}
/*
@@ -195,7 +195,7 @@ dl_load_symbol(dlopen_data_t *cd, const char *symbol, bool mandatory) {
}
}
return (ptr);
return ptr;
}
static void
@@ -219,7 +219,7 @@ dlopen_dlz_create(const char *dlzname, unsigned int argc, char *argv[],
"dlz_dlopen driver for '%s' needs a path to "
"the shared library",
dlzname);
return (ISC_R_FAILURE);
return ISC_R_FAILURE;
}
isc_mem_create(&mctx);
@@ -319,14 +319,14 @@ dlopen_dlz_create(const char *dlzname, unsigned int argc, char *argv[],
*dbdata = cd;
return (ISC_R_SUCCESS);
return ISC_R_SUCCESS;
failed:
dlopen_log(ISC_LOG_ERROR, "dlz_dlopen of '%s' failed", dlzname);
dlopen_dlz_destroy(NULL, cd);
return (result);
return result;
}
/*
@@ -363,13 +363,13 @@ dlopen_dlz_newversion(const char *zone, void *driverarg, void *dbdata,
UNUSED(driverarg);
if (cd->dlz_newversion == NULL) {
return (ISC_R_NOTIMPLEMENTED);
return ISC_R_NOTIMPLEMENTED;
}
MAYBE_LOCK(cd);
result = cd->dlz_newversion(zone, cd->dbdata, versionp);
MAYBE_UNLOCK(cd);
return (result);
return result;
}
/*
@@ -404,7 +404,7 @@ dlopen_dlz_configure(dns_view_t *view, dns_dlzdb_t *dlzdb, void *driverarg,
UNUSED(driverarg);
if (cd->dlz_configure == NULL) {
return (ISC_R_SUCCESS);
return ISC_R_SUCCESS;
}
MAYBE_LOCK(cd);
@@ -413,7 +413,7 @@ dlopen_dlz_configure(dns_view_t *view, dns_dlzdb_t *dlzdb, void *driverarg,
cd->in_configure = false;
MAYBE_UNLOCK(cd);
return (result);
return result;
}
/*
@@ -429,7 +429,7 @@ dlopen_dlz_ssumatch(const char *signer, const char *name, const char *tcpaddr,
UNUSED(driverarg);
if (cd->dlz_ssumatch == NULL) {
return (false);
return false;
}
MAYBE_LOCK(cd);
@@ -437,7 +437,7 @@ dlopen_dlz_ssumatch(const char *signer, const char *name, const char *tcpaddr,
keydata, cd->dbdata);
MAYBE_UNLOCK(cd);
return (ret);
return ret;
}
/*
@@ -452,14 +452,14 @@ dlopen_dlz_addrdataset(const char *name, const char *rdatastr, void *driverarg,
UNUSED(driverarg);
if (cd->dlz_addrdataset == NULL) {
return (ISC_R_NOTIMPLEMENTED);
return ISC_R_NOTIMPLEMENTED;
}
MAYBE_LOCK(cd);
result = cd->dlz_addrdataset(name, rdatastr, cd->dbdata, version);
MAYBE_UNLOCK(cd);
return (result);
return result;
}
/*
@@ -474,14 +474,14 @@ dlopen_dlz_subrdataset(const char *name, const char *rdatastr, void *driverarg,
UNUSED(driverarg);
if (cd->dlz_subrdataset == NULL) {
return (ISC_R_NOTIMPLEMENTED);
return ISC_R_NOTIMPLEMENTED;
}
MAYBE_LOCK(cd);
result = cd->dlz_subrdataset(name, rdatastr, cd->dbdata, version);
MAYBE_UNLOCK(cd);
return (result);
return result;
}
/*
@@ -496,14 +496,14 @@ dlopen_dlz_delrdataset(const char *name, const char *type, void *driverarg,
UNUSED(driverarg);
if (cd->dlz_delrdataset == NULL) {
return (ISC_R_NOTIMPLEMENTED);
return ISC_R_NOTIMPLEMENTED;
}
MAYBE_LOCK(cd);
result = cd->dlz_delrdataset(name, type, cd->dbdata, version);
MAYBE_UNLOCK(cd);
return (result);
return result;
}
static dns_sdlzmethods_t dlz_dlopen_methods = {
@@ -535,7 +535,7 @@ dlz_dlopen_init(isc_mem_t *mctx) {
result = ISC_R_UNEXPECTED;
}
return (result);
return result;
}
/*
+5 -5
View File
@@ -126,7 +126,7 @@ fuzz_thread_client(void *arg) {
named_server_flushonshutdown(named_g_server,
false);
isc_loopmgr_shutdown(named_g_loopmgr);
return (NULL);
return NULL;
}
raise(SIGSTOP);
goto next;
@@ -160,7 +160,7 @@ fuzz_thread_client(void *arg) {
named_server_flushonshutdown(named_g_server, false);
isc_loopmgr_shutdown(named_g_loopmgr);
return (NULL);
return NULL;
}
/*
@@ -374,7 +374,7 @@ fuzz_thread_resolver(void *arg) {
named_server_flushonshutdown(named_g_server,
false);
isc_loopmgr_shutdown(named_g_loopmgr);
return (NULL);
return NULL;
}
raise(SIGSTOP);
continue;
@@ -586,7 +586,7 @@ fuzz_thread_resolver(void *arg) {
__AFL_LOOP(0);
#endif /* ifdef __AFL_LOOP */
return (NULL);
return NULL;
}
/*
@@ -717,7 +717,7 @@ fuzz_thread_tcp(void *arg) {
named_server_flushonshutdown(named_g_server, false);
isc_loopmgr_shutdown(named_g_loopmgr);
return (NULL);
return NULL;
}
#endif /* ENABLE_AFL */
+3 -3
View File
@@ -43,7 +43,7 @@ open_geoip2(const char *dir, const char *dbfile, MMDB_s *mmdb) {
ISC_LOG_ERROR,
"GeoIP2 database '%s/%s': path too long", dir,
dbfile);
return (NULL);
return NULL;
}
ret = MMDB_open(pathbuf, MMDB_MODE_MMAP, mmdb);
@@ -51,7 +51,7 @@ open_geoip2(const char *dir, const char *dbfile, MMDB_s *mmdb) {
isc_log_write(NAMED_LOGCATEGORY_GENERAL, NAMED_LOGMODULE_SERVER,
ISC_LOG_INFO, "opened GeoIP2 database '%s'",
pathbuf);
return (mmdb);
return mmdb;
}
isc_log_write(NAMED_LOGCATEGORY_GENERAL, NAMED_LOGMODULE_SERVER,
@@ -59,7 +59,7 @@ open_geoip2(const char *dir, const char *dbfile, MMDB_s *mmdb) {
"unable to open GeoIP2 database '%s' (status %d)",
pathbuf, ret);
return (NULL);
return NULL;
}
#endif /* HAVE_GEOIP2 */
-1
View File
@@ -17,7 +17,6 @@
#include <inttypes.h>
#include <isc/lang.h>
#include <isc/types.h>
#include <dns/clientinfo.h>
+2 -3
View File
@@ -57,9 +57,8 @@ named_config_getremotesdef(const cfg_obj_t *cctx, const char *list,
const char *name, const cfg_obj_t **ret);
isc_result_t
named_config_getipandkeylist(const cfg_obj_t *config, const char *listtype,
const cfg_obj_t *list, isc_mem_t *mctx,
dns_ipkeylist_t *ipkl);
named_config_getipandkeylist(const cfg_obj_t *config, const cfg_obj_t *list,
isc_mem_t *mctx, dns_ipkeylist_t *ipkl);
isc_result_t
named_config_getport(const cfg_obj_t *config, const char *type,
+1
View File
@@ -43,6 +43,7 @@
#define NAMED_COMMAND_FREEZE "freeze"
#define NAMED_COMMAND_HALT "halt"
#define NAMED_COMMAND_LOADKEYS "loadkeys"
#define NAMED_COMMAND_MEMPROF "memprof"
#define NAMED_COMMAND_MKEYS "managed-keys"
#define NAMED_COMMAND_MODZONE "modzone"
#define NAMED_COMMAND_NOTIFY "notify"
-2
View File
@@ -98,8 +98,6 @@ EXTERN const char *named_g_conffile INIT(NAMED_SYSCONFDIR "/named.conf");
EXTERN const char *named_g_defaultbindkeys INIT(NULL);
EXTERN const char *named_g_keyfile INIT(NAMED_SYSCONFDIR "/rndc.key");
EXTERN dns_tsigkey_t *named_g_sessionkey INIT(NULL);
EXTERN dns_name_t named_g_sessionkeyname;
EXTERN bool named_g_conffileset INIT(false);
EXTERN cfg_aclconfctx_t *named_g_aclconfctx INIT(NULL);
+12
View File
@@ -388,3 +388,15 @@ named_server_fetchlimit(named_server_t *server, isc_lex_t *lex,
*/
isc_result_t
named_server_skr(named_server_t *server, isc_lex_t *lex, isc_buffer_t **text);
/*%
* Toggle memory profiling if supported.
*/
isc_result_t
named_server_togglememprof(isc_lex_t *lex);
/*%
* Get status of memory profiling.
*/
const char *
named_server_getmemprof(void);
+1 -6
View File
@@ -15,13 +15,10 @@
/*! \file */
#include <isc/lang.h>
#include <isc/types.h>
#include <isccfg/cfg.h>
ISC_LANG_BEGINDECLS
isc_result_t
named_tkeyctx_fromconfig(const cfg_obj_t *options, isc_mem_t *mctx,
dns_tkeyctx_t **tctxp);
@@ -37,7 +34,5 @@ named_tkeyctx_fromconfig(const cfg_obj_t *options, isc_mem_t *mctx,
*
* Returns:
*\li ISC_R_SUCCESS
*\li ISC_R_NOMEMORY
*\li return codes from dns_name_fromtext()
*/
ISC_LANG_ENDDECLS
-5
View File
@@ -15,15 +15,12 @@
/*! \file */
#include <isc/lang.h>
#include <isc/types.h>
#include <dns/transport.h>
#include <isccfg/cfg.h>
ISC_LANG_BEGINDECLS
isc_result_t
named_transports_fromconfig(const cfg_obj_t *config, const cfg_obj_t *vconfig,
isc_mem_t *mctx, dns_transport_list_t **listp);
@@ -39,5 +36,3 @@ named_transports_fromconfig(const cfg_obj_t *config, const cfg_obj_t *vconfig,
* \li 'listp' is not NULL, and '*listp' is NULL
*
*/
ISC_LANG_ENDDECLS
+2 -6
View File
@@ -15,11 +15,8 @@
/*! \file */
#include <isc/lang.h>
#include <isc/types.h>
ISC_LANG_BEGINDECLS
isc_result_t
named_tsigkeyring_fromconfig(const cfg_obj_t *config, const cfg_obj_t *vconfig,
isc_mem_t *mctx, dns_tsigkeyring_t **ringp);
@@ -35,7 +32,6 @@ named_tsigkeyring_fromconfig(const cfg_obj_t *config, const cfg_obj_t *vconfig,
*
* Returns:
* \li ISC_R_SUCCESS
* \li ISC_R_NOMEMORY
* \li DNS_R_BADALG
* \li return codes from dns_name_fromtext()
*/
ISC_LANG_ENDDECLS
-5
View File
@@ -17,14 +17,11 @@
#include <stdbool.h>
#include <isc/lang.h>
#include <isc/types.h>
#include <isccfg/aclconf.h>
#include <isccfg/cfg.h>
ISC_LANG_BEGINDECLS
isc_result_t
named_zone_configure(const cfg_obj_t *config, const cfg_obj_t *vconfig,
const cfg_obj_t *zconfig, cfg_aclconfctx_t *ac,
@@ -76,5 +73,3 @@ named_zone_configure_writeable_dlz(dns_dlzdb_t *dlzdatabase, dns_zone_t *zone,
* \li 'rdclass' to be a valid rdataclass
* \li 'name' to be a valid zone origin name
*/
ISC_LANG_ENDDECLS
+4 -4
View File
@@ -54,12 +54,12 @@ named_log_init(bool safe) {
named_g_logging = true;
return (ISC_R_SUCCESS);
return ISC_R_SUCCESS;
cleanup:
rcu_read_unlock();
return (result);
return result;
}
void
@@ -219,7 +219,7 @@ named_log_setdefaultcategory(isc_logconfig_t *lcfg) {
}
cleanup:
return (result);
return result;
}
isc_result_t
@@ -228,5 +228,5 @@ named_log_setunmatchedcategory(isc_logconfig_t *lcfg) {
result = isc_log_usechannel(lcfg, "null", NAMED_LOGCATEGORY_UNMATCHED,
ISC_LOGMODULE_DEFAULT);
return (result);
return result;
}
+8 -8
View File
@@ -55,11 +55,11 @@ category_fromconf(const cfg_obj_t *ccat, isc_logconfig_t *logconfig) {
/*
* Allow further processing by returning success.
*/
return (ISC_R_SUCCESS);
return ISC_R_SUCCESS;
}
if (logconfig == NULL) {
return (ISC_R_SUCCESS);
return ISC_R_SUCCESS;
}
destinations = cfg_tuple_get(ccat, "destinations");
@@ -76,10 +76,10 @@ category_fromconf(const cfg_obj_t *ccat, isc_logconfig_t *logconfig) {
NAMED_LOGMODULE_SERVER, ISC_LOG_ERROR,
"logging channel '%s': %s", channelname,
isc_result_totext(result));
return (result);
return result;
}
}
return (ISC_R_SUCCESS);
return ISC_R_SUCCESS;
}
/*%
@@ -127,7 +127,7 @@ channel_fromconf(const cfg_obj_t *channel, isc_logconfig_t *logconfig) {
"channel '%s': exactly one of file, syslog, "
"null, and stderr must be present",
channelname);
return (ISC_R_FAILURE);
return ISC_R_FAILURE;
}
type = ISC_LOG_TONULL;
@@ -308,7 +308,7 @@ channel_fromconf(const cfg_obj_t *channel, isc_logconfig_t *logconfig) {
}
done:
return (result);
return result;
}
isc_result_t
@@ -363,8 +363,8 @@ named_logconfig(isc_logconfig_t *logconfig, const cfg_obj_t *logstmt) {
CHECK(named_log_setunmatchedcategory(logconfig));
}
return (ISC_R_SUCCESS);
return ISC_R_SUCCESS;
cleanup:
return (result);
return result;
}
+12 -17
View File
@@ -33,6 +33,7 @@
#include <isc/fips.h>
#include <isc/hash.h>
#include <isc/httpd.h>
#include <isc/lib.h>
#include <isc/managers.h>
#include <isc/netmgr.h>
#include <isc/os.h>
@@ -47,6 +48,7 @@
#include <dns/dispatch.h>
#include <dns/dyndb.h>
#include <dns/lib.h>
#include <dns/name.h>
#include <dns/resolver.h>
#include <dns/view.h>
@@ -309,7 +311,7 @@ usage(void) {
" [-S sockets] [-t chrootdir] [-u "
"username] [-U listeners]\n"
" [-m "
"{usage|trace|record|size|mctx}]\n"
"{usage|trace|record}]\n"
" [-M fill|nofill]\n"
"usage: named [-v|-V|-C]\n");
}
@@ -402,7 +404,7 @@ parse_int(char *arg, const char *desc) {
if (tmp < 0 || tmp != ltmp) {
named_main_earlyfatal("%s '%s' out of range", desc, arg);
}
return (tmp);
return tmp;
}
static struct flag_def {
@@ -1025,7 +1027,7 @@ create_managers(void) {
isc_nm_maxudp(named_g_netmgr, maxudp);
return (ISC_R_SUCCESS);
return ISC_R_SUCCESS;
}
static void
@@ -1393,7 +1395,7 @@ named_smf_get_instance(char **ins_name, int debug, isc_mem_t *mctx) {
UNEXPECTED_ERROR("scf_handle_create() failed: %s",
scf_strerror(scf_error()));
}
return (ISC_R_FAILURE);
return ISC_R_FAILURE;
}
if (scf_handle_bind(h) == -1) {
@@ -1402,7 +1404,7 @@ named_smf_get_instance(char **ins_name, int debug, isc_mem_t *mctx) {
scf_strerror(scf_error()));
}
scf_handle_destroy(h);
return (ISC_R_FAILURE);
return ISC_R_FAILURE;
}
if ((namelen = scf_myname(h, NULL, 0)) == -1) {
@@ -1411,17 +1413,10 @@ named_smf_get_instance(char **ins_name, int debug, isc_mem_t *mctx) {
scf_strerror(scf_error()));
}
scf_handle_destroy(h);
return (ISC_R_FAILURE);
}
if ((instance = isc_mem_allocate(mctx, namelen + 1)) == NULL) {
UNEXPECTED_ERROR("named_smf_get_instance memory "
"allocation failed: %s",
isc_result_totext(ISC_R_NOMEMORY));
scf_handle_destroy(h);
return (ISC_R_FAILURE);
return ISC_R_FAILURE;
}
instance = isc_mem_allocate(mctx, namelen + 1);
if (scf_myname(h, instance, namelen + 1) == -1) {
if (debug) {
UNEXPECTED_ERROR("scf_myname() failed: %s",
@@ -1429,12 +1424,12 @@ named_smf_get_instance(char **ins_name, int debug, isc_mem_t *mctx) {
}
scf_handle_destroy(h);
isc_mem_free(mctx, instance);
return (ISC_R_FAILURE);
return ISC_R_FAILURE;
}
scf_handle_destroy(h);
*ins_name = instance;
return (ISC_R_SUCCESS);
return ISC_R_SUCCESS;
}
#endif /* HAVE_LIBSCF */
@@ -1592,5 +1587,5 @@ main(int argc, char *argv[]) {
ProfilerStop();
#endif /* ifdef HAVE_GPERFTOOLS_PROFILER */
return (0);
return 0;
}
+1 -1
View File
@@ -108,7 +108,7 @@ Options
.. option:: -m flag
This option turns on memory usage debugging flags. Possible flags are ``usage``,
``trace``, ``record``, ``size``, and ``mctx``. These correspond to the
``trace`` and ``record``. These correspond to the
``ISC_MEM_DEBUGXXXX`` flags described in ``<isc/mem.h>``.
.. option:: -n #cpus
+17 -17
View File
@@ -400,15 +400,15 @@ named_os_closedevnull(void) {
static bool
all_digits(const char *s) {
if (*s == '\0') {
return (false);
return false;
}
while (*s != '\0') {
if (!isdigit((unsigned char)(*s))) {
return (false);
return false;
}
s++;
}
return (true);
return true;
}
void
@@ -521,9 +521,9 @@ named_os_changeuser(bool permanent) {
uid_t
named_os_uid(void) {
if (runas_pw == NULL) {
return (0);
return 0;
}
return (runas_pw->pw_uid);
return runas_pw->pw_uid;
}
void
@@ -587,22 +587,22 @@ safe_open(const char *filename, mode_t mode, bool append) {
if (stat(filename, &sb) == -1) {
if (errno != ENOENT) {
return (-1);
return -1;
}
} else if ((sb.st_mode & S_IFREG) == 0) {
errno = EOPNOTSUPP;
return (-1);
return -1;
}
if (append) {
fd = open(filename, O_WRONLY | O_CREAT | O_APPEND, mode);
} else {
if (unlink(filename) < 0 && errno != ENOENT) {
return (-1);
return -1;
}
fd = open(filename, O_WRONLY | O_CREAT | O_EXCL, mode);
}
return (fd);
return fd;
}
static void
@@ -650,7 +650,7 @@ mkdirpath(char *filename, void (*report)(const char *, ...)) {
!strcmp(slash + 1, ".."))
{
*slash = '/';
return (0);
return 0;
}
mode = S_IRUSR | S_IWUSR | S_IXUSR; /* u=rwx */
mode |= S_IRGRP | S_IXGRP; /* g=rx */
@@ -672,11 +672,11 @@ mkdirpath(char *filename, void (*report)(const char *, ...)) {
}
*slash = '/';
}
return (0);
return 0;
error:
*slash = '/';
return (-1);
return -1;
}
FILE *
@@ -693,11 +693,11 @@ named_os_openfile(const char *filename, mode_t mode, bool switch_user) {
strerror_r(errno, strbuf, sizeof(strbuf));
named_main_earlywarning("couldn't strdup() '%s': %s", filename,
strbuf);
return (NULL);
return NULL;
}
if (mkdirpath(f, named_main_earlywarning) == -1) {
free(f);
return (NULL);
return NULL;
}
free(f);
@@ -737,7 +737,7 @@ named_os_openfile(const char *filename, mode_t mode, bool switch_user) {
strerror_r(errno, strbuf, sizeof(strbuf));
named_main_earlywarning("could not open file '%s': %s",
filename, strbuf);
return (NULL);
return NULL;
}
fp = fdopen(fd, "w");
@@ -747,7 +747,7 @@ named_os_openfile(const char *filename, mode_t mode, bool switch_user) {
filename, strbuf);
}
return (fp);
return fp;
}
void
@@ -863,5 +863,5 @@ named_os_uname(void) {
if (unamep == NULL) {
getuname();
}
return (unamep);
return unamep;
}
+732 -714
View File
File diff suppressed because it is too large Load Diff
+102 -78
View File
@@ -97,7 +97,7 @@ typedef struct stats_dumparg {
isc_result_t result;
} stats_dumparg_t;
static isc_once_t once = ISC_ONCE_INIT;
static isc_once_t once = ISC_ONCE_INITIALIZER;
#if defined(HAVE_LIBXML2) || defined(HAVE_JSON_C)
#define EXTENDED_STATS
@@ -126,19 +126,19 @@ user_zonetype(dns_zone_t *zone) {
const struct zt *tp;
if ((dns_zone_getoptions(zone) & DNS_ZONEOPT_AUTOEMPTY) != 0) {
return ("builtin");
return "builtin";
}
view = dns_zone_getview(zone);
if (view != NULL && strcmp(view->name, "_bind") == 0) {
return ("builtin");
return "builtin";
}
ztype = dns_zone_gettype(zone);
for (tp = typemap; tp->string != NULL && tp->type != ztype; tp++) {
/* empty */
}
return (tp->string);
return tp->string;
}
#endif /* ifdef EXTENDED_STATS */
@@ -251,7 +251,7 @@ get_histo_desc(const char *prefix, int i, int inf, bool ext) {
}
INSIST(0 < len && (size_t)len < space);
used += len + 1;
return (desc);
return desc;
}
static void
@@ -339,6 +339,21 @@ init_desc(void) {
"RPZRewrites");
SET_NSSTATDESC(udp, "UDP queries received", "QryUDP");
SET_NSSTATDESC(tcp, "TCP queries received", "QryTCP");
SET_NSSTATDESC(dot, "DoT queries received", "QryDoT");
SET_NSSTATDESC(doh, "DoH queries received", "QryDoH");
SET_NSSTATDESC(dohplain, "DoH-Plain queries received", "QryDoHPlain");
SET_NSSTATDESC(proxyudp, "PROXYv2 UDP queries received", "QryProxyUDP");
SET_NSSTATDESC(proxytcp, "PROXYv2 TCP queries received", "QryProxyTCP");
SET_NSSTATDESC(proxydot, "PROXYv2 DoT queries received", "QryProxyDoT");
SET_NSSTATDESC(proxydoh, "PROXYv2 DoH queries received", "QryProxyDoH");
SET_NSSTATDESC(proxydohplain, "PROXYv2/DoH-Plain queries received",
"QryProxyDoHPlain");
SET_NSSTATDESC(encryptedproxydot,
"Encrypted PROXYv2 DoT queries received",
"QryEncryptedProxyDoT");
SET_NSSTATDESC(encryptedproxydoh,
"Encrypted PROXYv2 DoH queries received",
"QryEncryptedProxyDoH");
SET_NSSTATDESC(nsidopt, "NSID option received", "NSIDOpt");
SET_NSSTATDESC(expireopt, "Expire option received", "ExpireOpt");
SET_NSSTATDESC(keepaliveopt, "EDNS TCP keepalive option received",
@@ -816,8 +831,8 @@ dump_stats(isc_stats_t *stats, isc_statsformat_t type, void *arg,
memset(values, 0, sizeof(values[0]) * ncounters);
isc_stats_dump(stats, generalstat_dump, &dumparg, options);
return (dump_counters(type, arg, category, desc, ncounters, indices,
values, options));
return dump_counters(type, arg, category, desc, ncounters, indices,
values, options);
}
#if defined(EXTENDED_STATS)
@@ -833,8 +848,8 @@ dump_histo(isc_histomulti_t *hm, isc_statsformat_t type, void *arg,
}
isc_histo_destroy(&hg);
return (dump_counters(type, arg, category, desc, ncounters, indices,
values, options));
return dump_counters(type, arg, category, desc, ncounters, indices,
values, options);
}
#endif /* defined(EXTENDED_STATS) */
@@ -863,7 +878,7 @@ dump_counters(isc_statsformat_t type, void *arg, const char *category,
if (category != NULL) {
cat = json_object_new_object();
if (cat == NULL) {
return (ISC_R_NOMEMORY);
return ISC_R_NOMEMORY;
}
json_object_object_add(job, category, cat);
}
@@ -928,19 +943,19 @@ dump_counters(isc_statsformat_t type, void *arg, const char *category,
#ifdef HAVE_JSON_C
counter = json_object_new_int64(value);
if (counter == NULL) {
return (ISC_R_NOMEMORY);
return ISC_R_NOMEMORY;
}
json_object_object_add(cat, desc[idx], counter);
#endif /* ifdef HAVE_JSON_C */
break;
}
}
return (ISC_R_SUCCESS);
return ISC_R_SUCCESS;
#ifdef HAVE_LIBXML2
cleanup:
isc_log_write(NAMED_LOGCATEGORY_GENERAL, NAMED_LOGMODULE_SERVER,
ISC_LOG_ERROR, "failed at dump_counters()");
return (ISC_R_FAILURE);
return ISC_R_FAILURE;
#endif /* ifdef HAVE_LIBXML2 */
}
@@ -1009,7 +1024,7 @@ cleanup:
static bool
rdatastatstype_attr(dns_rdatastatstype_t type, unsigned int attr) {
return ((DNS_RDATASTATSTYPE_ATTR(type) & attr) != 0);
return (DNS_RDATASTATSTYPE_ATTR(type) & attr) != 0;
}
static void
@@ -1289,7 +1304,7 @@ zone_xmlrender(dns_zone_t *zone, void *arg) {
statlevel = dns_zone_getstatlevel(zone);
if (statlevel == dns_zonestat_none) {
return (ISC_R_SUCCESS);
return ISC_R_SUCCESS;
}
dumparg.type = isc_statsformat_xml;
@@ -1446,11 +1461,11 @@ zone_xmlrender(dns_zone_t *zone, void *arg) {
TRY0(xmlTextWriterEndElement(writer)); /* zone */
return (ISC_R_SUCCESS);
return ISC_R_SUCCESS;
cleanup:
isc_log_write(NAMED_LOGCATEGORY_GENERAL, NAMED_LOGMODULE_SERVER,
ISC_LOG_ERROR, "Failed at zone_xmlrender()");
return (ISC_R_FAILURE);
return ISC_R_FAILURE;
}
static isc_result_t
@@ -1473,10 +1488,11 @@ xfrin_xmlrender(dns_zone_t *zone, void *arg) {
unsigned int nmsg = 0;
unsigned int nrecs = 0;
uint64_t nbytes = 0;
uint64_t rate = 0;
statlevel = dns_zone_getstatlevel(zone);
if (statlevel == dns_zonestat_none) {
return (ISC_R_SUCCESS);
return ISC_R_SUCCESS;
}
if (dns_zone_getxfr(zone, &xfr, &is_firstrefresh, &is_running,
@@ -1488,7 +1504,7 @@ xfrin_xmlrender(dns_zone_t *zone, void *arg) {
* (if any), but we still want to continue generating the
* remaining parts of the output.
*/
return (ISC_R_SUCCESS);
return ISC_R_SUCCESS;
}
if (!is_running && !is_deferred && !is_presoa && !is_pending &&
@@ -1498,12 +1514,12 @@ xfrin_xmlrender(dns_zone_t *zone, void *arg) {
dns_xfrin_detach(&xfr);
}
/* No ongoing/queued transfer. */
return (ISC_R_SUCCESS);
return ISC_R_SUCCESS;
}
if (is_running && xfr == NULL) {
/* The transfer is finished, and it's shutting down. */
return (ISC_R_SUCCESS);
return ISC_R_SUCCESS;
}
TRY0(xmlTextWriterStartElement(writer, ISC_XMLCHAR "xfrin"));
@@ -1686,7 +1702,7 @@ xfrin_xmlrender(dns_zone_t *zone, void *arg) {
TRY0(xmlTextWriterEndElement(writer));
if (is_running) {
dns_xfrin_getstats(xfr, &nmsg, &nrecs, &nbytes);
dns_xfrin_getstats(xfr, &nmsg, &nrecs, &nbytes, &rate);
}
TRY0(xmlTextWriterStartElement(writer, ISC_XMLCHAR "nmsg"));
TRY0(xmlTextWriterWriteFormatString(writer, "%u", nmsg));
@@ -1697,6 +1713,9 @@ xfrin_xmlrender(dns_zone_t *zone, void *arg) {
TRY0(xmlTextWriterStartElement(writer, ISC_XMLCHAR "nbytes"));
TRY0(xmlTextWriterWriteFormatString(writer, "%" PRIu64, nbytes));
TRY0(xmlTextWriterEndElement(writer));
TRY0(xmlTextWriterStartElement(writer, ISC_XMLCHAR "rate"));
TRY0(xmlTextWriterWriteFormatString(writer, "%" PRIu64, rate));
TRY0(xmlTextWriterEndElement(writer));
TRY0(xmlTextWriterStartElement(writer, ISC_XMLCHAR "ixfr"));
if (is_running && is_first_data_received) {
@@ -1713,7 +1732,7 @@ xfrin_xmlrender(dns_zone_t *zone, void *arg) {
dns_xfrin_detach(&xfr);
}
return (ISC_R_SUCCESS);
return ISC_R_SUCCESS;
cleanup:
if (xfr != NULL) {
@@ -1723,7 +1742,7 @@ cleanup:
isc_log_write(NAMED_LOGCATEGORY_GENERAL, NAMED_LOGMODULE_SERVER,
ISC_LOG_ERROR, "Failed at xfrin_xmlrender()");
return (ISC_R_FAILURE);
return ISC_R_FAILURE;
}
static isc_result_t
@@ -2125,7 +2144,7 @@ generatexml(named_server_t *server, uint32_t flags, int *buflen,
xmlFreeTextWriter(writer);
xmlFreeDoc(doc);
return (ISC_R_SUCCESS);
return ISC_R_SUCCESS;
cleanup:
isc_log_write(NAMED_LOGCATEGORY_GENERAL, NAMED_LOGMODULE_SERVER,
@@ -2136,7 +2155,7 @@ cleanup:
if (doc != NULL) {
xmlFreeDoc(doc);
}
return (ISC_R_FAILURE);
return ISC_R_FAILURE;
}
static void
@@ -2170,7 +2189,7 @@ render_xml(uint32_t flags, void *arg, unsigned int *retcode,
ISC_LOG_ERROR, "failed at rendering XML()");
}
return (result);
return result;
}
static isc_result_t
@@ -2180,8 +2199,8 @@ render_xml_all(const isc_httpd_t *httpd, const isc_httpdurl_t *urlinfo,
void **freecb_args) {
UNUSED(httpd);
UNUSED(urlinfo);
return (render_xml(STATS_XML_ALL, arg, retcode, retmsg, mimetype, b,
freecb, freecb_args));
return render_xml(STATS_XML_ALL, arg, retcode, retmsg, mimetype, b,
freecb, freecb_args);
}
static isc_result_t
@@ -2191,8 +2210,8 @@ render_xml_status(const isc_httpd_t *httpd, const isc_httpdurl_t *urlinfo,
isc_httpdfree_t **freecb, void **freecb_args) {
UNUSED(httpd);
UNUSED(urlinfo);
return (render_xml(STATS_XML_STATUS, arg, retcode, retmsg, mimetype, b,
freecb, freecb_args));
return render_xml(STATS_XML_STATUS, arg, retcode, retmsg, mimetype, b,
freecb, freecb_args);
}
static isc_result_t
@@ -2202,8 +2221,8 @@ render_xml_server(const isc_httpd_t *httpd, const isc_httpdurl_t *urlinfo,
isc_httpdfree_t **freecb, void **freecb_args) {
UNUSED(httpd);
UNUSED(urlinfo);
return (render_xml(STATS_XML_SERVER, arg, retcode, retmsg, mimetype, b,
freecb, freecb_args));
return render_xml(STATS_XML_SERVER, arg, retcode, retmsg, mimetype, b,
freecb, freecb_args);
}
static isc_result_t
@@ -2213,8 +2232,8 @@ render_xml_zones(const isc_httpd_t *httpd, const isc_httpdurl_t *urlinfo,
isc_httpdfree_t **freecb, void **freecb_args) {
UNUSED(httpd);
UNUSED(urlinfo);
return (render_xml(STATS_XML_ZONES, arg, retcode, retmsg, mimetype, b,
freecb, freecb_args));
return render_xml(STATS_XML_ZONES, arg, retcode, retmsg, mimetype, b,
freecb, freecb_args);
}
static isc_result_t
@@ -2224,8 +2243,8 @@ render_xml_xfrins(const isc_httpd_t *httpd, const isc_httpdurl_t *urlinfo,
isc_httpdfree_t **freecb, void **freecb_args) {
UNUSED(httpd);
UNUSED(urlinfo);
return (render_xml(STATS_XML_XFRINS, arg, retcode, retmsg, mimetype, b,
freecb, freecb_args));
return render_xml(STATS_XML_XFRINS, arg, retcode, retmsg, mimetype, b,
freecb, freecb_args);
}
static isc_result_t
@@ -2235,8 +2254,8 @@ render_xml_net(const isc_httpd_t *httpd, const isc_httpdurl_t *urlinfo,
void **freecb_args) {
UNUSED(httpd);
UNUSED(urlinfo);
return (render_xml(STATS_XML_NET, arg, retcode, retmsg, mimetype, b,
freecb, freecb_args));
return render_xml(STATS_XML_NET, arg, retcode, retmsg, mimetype, b,
freecb, freecb_args);
}
static isc_result_t
@@ -2246,8 +2265,8 @@ render_xml_mem(const isc_httpd_t *httpd, const isc_httpdurl_t *urlinfo,
void **freecb_args) {
UNUSED(httpd);
UNUSED(urlinfo);
return (render_xml(STATS_XML_MEM, arg, retcode, retmsg, mimetype, b,
freecb, freecb_args));
return render_xml(STATS_XML_MEM, arg, retcode, retmsg, mimetype, b,
freecb, freecb_args);
}
static isc_result_t
@@ -2257,8 +2276,8 @@ render_xml_traffic(const isc_httpd_t *httpd, const isc_httpdurl_t *urlinfo,
isc_httpdfree_t **freecb, void **freecb_args) {
UNUSED(httpd);
UNUSED(urlinfo);
return (render_xml(STATS_XML_TRAFFIC, arg, retcode, retmsg, mimetype, b,
freecb, freecb_args));
return render_xml(STATS_XML_TRAFFIC, arg, retcode, retmsg, mimetype, b,
freecb, freecb_args);
}
#endif /* HAVE_LIBXML2 */
@@ -2298,7 +2317,7 @@ addzone(char *name, char *classname, const char *ztype, uint32_t serial,
json_object *node = json_object_new_object();
if (node == NULL) {
return (NULL);
return NULL;
}
json_object_object_add(node, "name", json_object_new_string(name));
@@ -2312,7 +2331,7 @@ addzone(char *name, char *classname, const char *ztype, uint32_t serial,
json_object_object_add(node, "type",
json_object_new_string(ztype));
}
return (node);
return node;
}
static isc_result_t
@@ -2331,7 +2350,7 @@ zone_jsonrender(dns_zone_t *zone, void *arg) {
statlevel = dns_zone_getstatlevel(zone);
if (statlevel == dns_zonestat_none) {
return (ISC_R_SUCCESS);
return ISC_R_SUCCESS;
}
dns_zone_nameonly(zone, buf, sizeof(buf));
@@ -2350,7 +2369,7 @@ zone_jsonrender(dns_zone_t *zone, void *arg) {
}
if (zoneobj == NULL) {
return (ISC_R_NOMEMORY);
return ISC_R_NOMEMORY;
}
/*
@@ -2518,7 +2537,7 @@ cleanup:
if (zoneobj != NULL) {
json_object_put(zoneobj);
}
return (result);
return result;
}
static isc_result_t
@@ -2544,10 +2563,11 @@ xfrin_jsonrender(dns_zone_t *zone, void *arg) {
unsigned int nmsg = 0;
unsigned int nrecs = 0;
uint64_t nbytes = 0;
uint64_t rate = 0;
statlevel = dns_zone_getstatlevel(zone);
if (statlevel == dns_zonestat_none) {
return (ISC_R_SUCCESS);
return ISC_R_SUCCESS;
}
dns_zone_nameonly(zone, buf, sizeof(buf));
@@ -2741,7 +2761,7 @@ xfrin_jsonrender(dns_zone_t *zone, void *arg) {
}
if (is_running) {
dns_xfrin_getstats(xfr, &nmsg, &nrecs, &nbytes);
dns_xfrin_getstats(xfr, &nmsg, &nrecs, &nbytes, &rate);
}
json_object_object_add(xfrinobj, "nmsg",
json_object_new_int64((int64_t)nmsg));
@@ -2751,6 +2771,10 @@ xfrin_jsonrender(dns_zone_t *zone, void *arg) {
xfrinobj, "nbytes",
json_object_new_int64(nbytes > INT64_MAX ? INT64_MAX
: (int64_t)nbytes));
json_object_object_add(xfrinobj, "rate",
json_object_new_int64(rate > INT64_MAX
? INT64_MAX
: (int64_t)rate));
if (is_running && is_first_data_received) {
json_object_object_add(
@@ -2772,7 +2796,7 @@ cleanup:
if (xfrinobj != NULL) {
json_object_put(xfrinobj);
}
return (result);
return result;
}
static isc_result_t
@@ -2810,7 +2834,7 @@ generatejson(named_server_t *server, size_t *msglen, const char **msg,
bindstats = json_object_new_object();
if (bindstats == NULL) {
return (ISC_R_NOMEMORY);
return ISC_R_NOMEMORY;
}
/*
@@ -3343,7 +3367,7 @@ cleanup:
json_object_put(bindstats);
}
return (result);
return result;
}
static isc_result_t
@@ -3372,7 +3396,7 @@ render_json(uint32_t flags, void *arg, unsigned int *retcode,
ISC_LOG_ERROR, "failed at rendering JSON()");
}
return (result);
return result;
}
static isc_result_t
@@ -3382,8 +3406,8 @@ render_json_all(const isc_httpd_t *httpd, const isc_httpdurl_t *urlinfo,
isc_httpdfree_t **freecb, void **freecb_args) {
UNUSED(httpd);
UNUSED(urlinfo);
return (render_json(STATS_JSON_ALL, arg, retcode, retmsg, mimetype, b,
freecb, freecb_args));
return render_json(STATS_JSON_ALL, arg, retcode, retmsg, mimetype, b,
freecb, freecb_args);
}
static isc_result_t
@@ -3393,8 +3417,8 @@ render_json_status(const isc_httpd_t *httpd, const isc_httpdurl_t *urlinfo,
isc_httpdfree_t **freecb, void **freecb_args) {
UNUSED(httpd);
UNUSED(urlinfo);
return (render_json(STATS_JSON_STATUS, arg, retcode, retmsg, mimetype,
b, freecb, freecb_args));
return render_json(STATS_JSON_STATUS, arg, retcode, retmsg, mimetype, b,
freecb, freecb_args);
}
static isc_result_t
@@ -3404,8 +3428,8 @@ render_json_server(const isc_httpd_t *httpd, const isc_httpdurl_t *urlinfo,
isc_httpdfree_t **freecb, void **freecb_args) {
UNUSED(httpd);
UNUSED(urlinfo);
return (render_json(STATS_JSON_SERVER, arg, retcode, retmsg, mimetype,
b, freecb, freecb_args));
return render_json(STATS_JSON_SERVER, arg, retcode, retmsg, mimetype, b,
freecb, freecb_args);
}
static isc_result_t
@@ -3415,8 +3439,8 @@ render_json_zones(const isc_httpd_t *httpd, const isc_httpdurl_t *urlinfo,
isc_httpdfree_t **freecb, void **freecb_args) {
UNUSED(httpd);
UNUSED(urlinfo);
return (render_json(STATS_JSON_ZONES, arg, retcode, retmsg, mimetype, b,
freecb, freecb_args));
return render_json(STATS_JSON_ZONES, arg, retcode, retmsg, mimetype, b,
freecb, freecb_args);
}
static isc_result_t
@@ -3426,8 +3450,8 @@ render_json_xfrins(const isc_httpd_t *httpd, const isc_httpdurl_t *urlinfo,
isc_httpdfree_t **freecb, void **freecb_args) {
UNUSED(httpd);
UNUSED(urlinfo);
return (render_json(STATS_JSON_XFRINS, arg, retcode, retmsg, mimetype,
b, freecb, freecb_args));
return render_json(STATS_JSON_XFRINS, arg, retcode, retmsg, mimetype, b,
freecb, freecb_args);
}
static isc_result_t
@@ -3437,8 +3461,8 @@ render_json_mem(const isc_httpd_t *httpd, const isc_httpdurl_t *urlinfo,
isc_httpdfree_t **freecb, void **freecb_args) {
UNUSED(httpd);
UNUSED(urlinfo);
return (render_json(STATS_JSON_MEM, arg, retcode, retmsg, mimetype, b,
freecb, freecb_args));
return render_json(STATS_JSON_MEM, arg, retcode, retmsg, mimetype, b,
freecb, freecb_args);
}
static isc_result_t
@@ -3448,8 +3472,8 @@ render_json_net(const isc_httpd_t *httpd, const isc_httpdurl_t *urlinfo,
isc_httpdfree_t **freecb, void **freecb_args) {
UNUSED(httpd);
UNUSED(urlinfo);
return (render_json(STATS_JSON_NET, arg, retcode, retmsg, mimetype, b,
freecb, freecb_args));
return render_json(STATS_JSON_NET, arg, retcode, retmsg, mimetype, b,
freecb, freecb_args);
}
static isc_result_t
@@ -3459,8 +3483,8 @@ render_json_traffic(const isc_httpd_t *httpd, const isc_httpdurl_t *urlinfo,
isc_httpdfree_t **freecb, void **freecb_args) {
UNUSED(httpd);
UNUSED(urlinfo);
return (render_json(STATS_JSON_TRAFFIC, arg, retcode, retmsg, mimetype,
b, freecb, freecb_args));
return render_json(STATS_JSON_TRAFFIC, arg, retcode, retmsg, mimetype,
b, freecb, freecb_args);
}
#endif /* HAVE_JSON_C */
@@ -3523,7 +3547,7 @@ send:
isc_buffer_reinit(b, p, strlen(xslmsg));
isc_buffer_add(b, strlen(xslmsg));
end:
return (ISC_R_SUCCESS);
return ISC_R_SUCCESS;
}
#endif
@@ -3558,7 +3582,7 @@ client_ok(const isc_sockaddr_t *fromaddr, void *arg) {
match > 0)
{
UNLOCK(&listener->lock);
return (true);
return true;
}
UNLOCK(&listener->lock);
@@ -3567,7 +3591,7 @@ client_ok(const isc_sockaddr_t *fromaddr, void *arg) {
ISC_LOG_WARNING, "rejected statistics connection from %s",
socktext);
return (false);
return false;
}
#endif
@@ -3601,7 +3625,7 @@ add_listener(named_server_t *server, named_statschannel_t **listenerp,
UNUSED(aclconfctx);
UNUSED(socktext);
return (ISC_R_NOTIMPLEMENTED);
return ISC_R_NOTIMPLEMENTED;
#else
isc_result_t result;
named_statschannel_t *listener = NULL;
@@ -3704,7 +3728,7 @@ add_listener(named_server_t *server, named_statschannel_t **listenerp,
ISC_LOG_NOTICE, "statistics channel listening on %s",
socktext);
return (ISC_R_SUCCESS);
return ISC_R_SUCCESS;
cleanup:
if (listener->acl != NULL) {
@@ -3713,7 +3737,7 @@ cleanup:
isc_mutex_destroy(&listener->lock);
isc_mem_putanddetach(&listener->mctx, listener, sizeof(*listener));
return (result);
return result;
#endif
}
@@ -3906,7 +3930,7 @@ named_statschannels_configure(named_server_t *server, const cfg_obj_t *config,
}
ISC_LIST_APPENDLIST(server->statschannels, new_listeners, link);
return (ISC_R_SUCCESS);
return ISC_R_SUCCESS;
}
void
@@ -4144,5 +4168,5 @@ named_stats_dump(named_server_t *server, FILE *fp) {
fprintf(fp, "--- Statistics Dump --- (%lu)\n", (unsigned long)now);
return (ISC_R_SUCCESS); /* this function currently always succeeds */
return ISC_R_SUCCESS; /* this function currently always succeeds */
}
+6 -9
View File
@@ -53,10 +53,7 @@ named_tkeyctx_fromconfig(const cfg_obj_t *options, isc_mem_t *mctx,
isc_buffer_t b;
const cfg_obj_t *obj;
result = dns_tkeyctx_create(mctx, &tctx);
if (result != ISC_R_SUCCESS) {
return (result);
}
dns_tkeyctx_create(mctx, &tctx);
obj = NULL;
result = cfg_map_get(options, "tkey-domain", &obj);
@@ -65,9 +62,9 @@ named_tkeyctx_fromconfig(const cfg_obj_t *options, isc_mem_t *mctx,
isc_buffer_constinit(&b, s, strlen(s));
isc_buffer_add(&b, strlen(s));
name = dns_fixedname_initname(&fname);
RETERR(dns_name_fromtext(name, &b, dns_rootname, 0, NULL));
RETERR(dns_name_fromtext(name, &b, dns_rootname, 0));
tctx->domain = isc_mem_get(mctx, sizeof(dns_name_t));
dns_name_init(tctx->domain, NULL);
dns_name_init(tctx->domain);
dns_name_dup(name, mctx, tctx->domain);
}
@@ -79,7 +76,7 @@ named_tkeyctx_fromconfig(const cfg_obj_t *options, isc_mem_t *mctx,
isc_buffer_constinit(&b, s, strlen(s));
isc_buffer_add(&b, strlen(s));
name = dns_fixedname_initname(&fname);
RETERR(dns_name_fromtext(name, &b, dns_rootname, 0, NULL));
RETERR(dns_name_fromtext(name, &b, dns_rootname, 0));
RETERR(dst_gssapi_acquirecred(name, false, &tctx->gsscred));
}
@@ -91,9 +88,9 @@ named_tkeyctx_fromconfig(const cfg_obj_t *options, isc_mem_t *mctx,
}
*tctxp = tctx;
return (ISC_R_SUCCESS);
return ISC_R_SUCCESS;
failure:
dns_tkeyctx_destroy(&tctx);
return (result);
return result;
}
+28 -30
View File
@@ -27,17 +27,16 @@
#include <named/log.h>
#include <named/transportconf.h>
#define create_name(id, name) \
isc_buffer_t namesrc, namebuf; \
char namedata[DNS_NAME_FORMATSIZE + 1]; \
dns_name_init(name, NULL); \
isc_buffer_constinit(&namesrc, id, strlen(id)); \
isc_buffer_add(&namesrc, strlen(id)); \
isc_buffer_init(&namebuf, namedata, sizeof(namedata)); \
result = (dns_name_fromtext(name, &namesrc, dns_rootname, \
DNS_NAME_DOWNCASE, &namebuf)); \
if (result != ISC_R_SUCCESS) { \
goto failure; \
#define create_name(id, name) \
isc_buffer_t namesrc; \
dns_fixedname_t _fn; \
name = dns_fixedname_initname(&_fn); \
isc_buffer_constinit(&namesrc, id, strlen(id)); \
isc_buffer_add(&namesrc, strlen(id)); \
result = (dns_name_fromtext(name, &namesrc, dns_rootname, \
DNS_NAME_DOWNCASE)); \
if (result != ISC_R_SUCCESS) { \
goto failure; \
}
#define parse_transport_option(map, transport, name, setter) \
@@ -100,15 +99,15 @@ add_doh_transports(const cfg_obj_t *transportlist, dns_transport_list_t *list) {
for (const cfg_listelt_t *element = cfg_list_first(transportlist);
element != NULL; element = cfg_list_next(element))
{
dns_name_t dohname;
dns_transport_t *transport;
dns_name_t *dohname = NULL;
dns_transport_t *transport = NULL;
doh = cfg_listelt_value(element);
dohid = cfg_obj_asstring(cfg_map_getname(doh));
create_name(dohid, &dohname);
create_name(dohid, dohname);
transport = dns_transport_new(&dohname, DNS_TRANSPORT_HTTP,
transport = dns_transport_new(dohname, DNS_TRANSPORT_HTTP,
list);
dns_transport_set_tlsname(transport, dohid);
@@ -131,12 +130,12 @@ add_doh_transports(const cfg_obj_t *transportlist, dns_transport_list_t *list) {
dns_transport_set_remote_hostname);
}
return (ISC_R_SUCCESS);
return ISC_R_SUCCESS;
failure:
cfg_obj_log(doh, ISC_LOG_ERROR, "configuring DoH '%s': %s", dohid,
isc_result_totext(result));
return (result);
return result;
}
static isc_result_t
@@ -148,8 +147,8 @@ add_tls_transports(const cfg_obj_t *transportlist, dns_transport_list_t *list) {
for (const cfg_listelt_t *element = cfg_list_first(transportlist);
element != NULL; element = cfg_list_next(element))
{
dns_name_t tlsname;
dns_transport_t *transport;
dns_name_t *tlsname = NULL;
dns_transport_t *transport = NULL;
tls = cfg_listelt_value(element);
tlsid = cfg_obj_asstring(cfg_map_getname(tls));
@@ -159,10 +158,9 @@ add_tls_transports(const cfg_obj_t *transportlist, dns_transport_list_t *list) {
goto failure;
}
create_name(tlsid, &tlsname);
create_name(tlsid, tlsname);
transport = dns_transport_new(&tlsname, DNS_TRANSPORT_TLS,
list);
transport = dns_transport_new(tlsname, DNS_TRANSPORT_TLS, list);
dns_transport_set_tlsname(transport, tlsid);
parse_transport_option(tls, transport, "key-file",
@@ -184,12 +182,12 @@ add_tls_transports(const cfg_obj_t *transportlist, dns_transport_list_t *list) {
dns_transport_set_remote_hostname);
}
return (ISC_R_SUCCESS);
return ISC_R_SUCCESS;
failure:
cfg_obj_log(tls, ISC_LOG_ERROR, "configuring tls '%s': %s", tlsid,
isc_result_totext(result));
return (result);
return result;
}
#define CHECK(f) \
@@ -216,18 +214,18 @@ transport_list_fromconfig(const cfg_obj_t *config, dns_transport_list_t *list) {
obj = NULL;
}
return (result);
return result;
}
static void
transport_list_add_ephemeral(dns_transport_list_t *list) {
isc_result_t result;
dns_name_t tlsname;
dns_name_t *tlsname = NULL;
dns_transport_t *transport;
create_name("ephemeral", &tlsname);
create_name("ephemeral", tlsname);
transport = dns_transport_new(&tlsname, DNS_TRANSPORT_TLS, list);
transport = dns_transport_new(tlsname, DNS_TRANSPORT_TLS, list);
dns_transport_set_tlsname(transport, "ephemeral");
return;
@@ -258,8 +256,8 @@ named_transports_fromconfig(const cfg_obj_t *config, const cfg_obj_t *vconfig,
}
*listp = list;
return (ISC_R_SUCCESS);
return ISC_R_SUCCESS;
failure:
dns_transport_list_detach(&list);
return (result);
return result;
}
+10 -12
View File
@@ -46,11 +46,11 @@ add_initial_keys(const cfg_obj_t *list, dns_tsigkeyring_t *ring,
{
const cfg_obj_t *algobj = NULL;
const cfg_obj_t *secretobj = NULL;
dns_name_t keyname;
dns_fixedname_t fkey;
dns_name_t *keyname = dns_fixedname_initname(&fkey);
dst_algorithm_t alg = DST_ALG_UNKNOWN;
const char *algstr = NULL;
char keynamedata[1024];
isc_buffer_t keynamesrc, keynamebuf;
isc_buffer_t keynamesrc;
const char *secretstr = NULL;
isc_buffer_t secretbuf;
int secretlen = 0;
@@ -68,12 +68,10 @@ add_initial_keys(const cfg_obj_t *list, dns_tsigkeyring_t *ring,
/*
* Create the key name.
*/
dns_name_init(&keyname, NULL);
isc_buffer_constinit(&keynamesrc, keyid, strlen(keyid));
isc_buffer_add(&keynamesrc, strlen(keyid));
isc_buffer_init(&keynamebuf, keynamedata, sizeof(keynamedata));
ret = dns_name_fromtext(&keyname, &keynamesrc, dns_rootname,
DNS_NAME_DOWNCASE, &keynamebuf);
ret = dns_name_fromtext(keyname, &keynamesrc, dns_rootname,
DNS_NAME_DOWNCASE);
if (ret != ISC_R_SUCCESS) {
goto failure;
}
@@ -103,7 +101,7 @@ add_initial_keys(const cfg_obj_t *list, dns_tsigkeyring_t *ring,
}
secretlen = isc_buffer_usedlength(&secretbuf);
ret = dns_tsigkey_create(&keyname, alg, secret, secretlen, mctx,
ret = dns_tsigkey_create(keyname, alg, secret, secretlen, mctx,
&tsigkey);
isc_mem_put(mctx, secret, secretalloc);
secret = NULL;
@@ -123,7 +121,7 @@ add_initial_keys(const cfg_obj_t *list, dns_tsigkeyring_t *ring,
dns_tsigkey_detach(&tsigkey);
}
return (ISC_R_SUCCESS);
return ISC_R_SUCCESS;
failure:
if (secret != NULL) {
@@ -131,7 +129,7 @@ failure:
}
cfg_obj_log(key, ISC_LOG_ERROR, "configuring key '%s': %s", keyid,
isc_result_totext(ret));
return (ret);
return ret;
}
isc_result_t
@@ -172,9 +170,9 @@ named_tsigkeyring_fromconfig(const cfg_obj_t *config, const cfg_obj_t *vconfig,
}
*ringp = ring;
return (ISC_R_SUCCESS);
return ISC_R_SUCCESS;
failure:
dns_tsigkeyring_detach(&ring);
return (result);
return result;
}
+85 -70
View File
@@ -61,13 +61,6 @@ typedef enum {
allow_update_forwarding
} acl_type_t;
#define RETERR(x) \
do { \
isc_result_t _r = (x); \
if (_r != ISC_R_SUCCESS) \
return ((_r)); \
} while (0)
#define CHECK(x) \
do { \
result = (x); \
@@ -148,7 +141,7 @@ configure_zone_acl(const cfg_obj_t *zconfig, const cfg_obj_t *vconfig,
/* Failing that, see if there's a default ACL already in the view */
if (aclp != NULL && *aclp != NULL) {
(*setzacl)(zone, *aclp);
return (ISC_R_SUCCESS);
return ISC_R_SUCCESS;
}
/* Check for default ACLs that haven't been parsed yet */
@@ -171,14 +164,14 @@ configure_zone_acl(const cfg_obj_t *zconfig, const cfg_obj_t *vconfig,
(void)named_config_get(maps, aclname, &aclobj);
if (aclobj == NULL) {
(*clearzacl)(zone);
return (ISC_R_SUCCESS);
return ISC_R_SUCCESS;
}
parse_acl:
result = cfg_acl_fromconfig(aclobj, config, actx, named_g_mctx, 0,
&acl);
if (result != ISC_R_SUCCESS) {
return (result);
return result;
}
(*setzacl)(zone, acl);
@@ -188,7 +181,7 @@ parse_acl:
}
dns_acl_detach(&acl);
return (ISC_R_SUCCESS);
return ISC_R_SUCCESS;
}
/*%
@@ -213,7 +206,7 @@ configure_zone_ssutable(const cfg_obj_t *zconfig, dns_zone_t *zone,
if (updatepolicy == NULL) {
dns_zone_setssutable(zone, NULL);
return (ISC_R_SUCCESS);
return ISC_R_SUCCESS;
}
if (cfg_obj_isstring(updatepolicy) &&
@@ -260,7 +253,7 @@ configure_zone_ssutable(const cfg_obj_t *zconfig, dns_zone_t *zone,
isc_buffer_constinit(&b, str, strlen(str));
isc_buffer_add(&b, strlen(str));
result = dns_name_fromtext(dns_fixedname_name(&fident), &b,
dns_rootname, 0, NULL);
dns_rootname, 0);
if (result != ISC_R_SUCCESS) {
cfg_obj_log(identity, ISC_LOG_ERROR,
"'%s' is not a valid name", str);
@@ -290,7 +283,7 @@ configure_zone_ssutable(const cfg_obj_t *zconfig, dns_zone_t *zone,
isc_buffer_constinit(&b, str, strlen(str));
isc_buffer_add(&b, strlen(str));
result = dns_name_fromtext(dns_fixedname_name(&fname),
&b, dns_rootname, 0, NULL);
&b, dns_rootname, 0);
if (result != ISC_R_SUCCESS) {
cfg_obj_log(identity, ISC_LOG_ERROR,
"'%s' is not a valid name", str);
@@ -395,7 +388,7 @@ configure_zone_ssutable(const cfg_obj_t *zconfig, dns_zone_t *zone,
cleanup:
isc_buffer_clearmctx(&dbuf);
dns_ssutable_detach(&table);
return (result);
return result;
}
/*
@@ -437,7 +430,7 @@ configure_staticstub_serveraddrs(const cfg_obj_t *zconfig, dns_zone_t *zone,
cfg_obj_log(zconfig, ISC_LOG_ERROR,
"port is not configurable for "
"static stub server-addresses");
return (ISC_R_FAILURE);
return ISC_R_FAILURE;
}
isc_netaddr_fromsockaddr(&na, sa);
if (isc_netaddr_getzone(&na) != 0) {
@@ -445,7 +438,7 @@ configure_staticstub_serveraddrs(const cfg_obj_t *zconfig, dns_zone_t *zone,
"scoped address is not allowed "
"for static stub "
"server-addresses");
return (ISC_R_FAILURE);
return ISC_R_FAILURE;
}
switch (na.family) {
@@ -476,7 +469,7 @@ configure_staticstub_serveraddrs(const cfg_obj_t *zconfig, dns_zone_t *zone,
if (ISC_LIST_EMPTY(rdatalist_a->rdata) &&
ISC_LIST_EMPTY(rdatalist_aaaa->rdata))
{
return (ISC_R_SUCCESS);
return ISC_R_SUCCESS;
}
/* Add to the list an apex NS with the ns name being the origin name */
@@ -490,7 +483,7 @@ configure_staticstub_serveraddrs(const cfg_obj_t *zconfig, dns_zone_t *zone,
&region);
ISC_LIST_APPEND(rdatalist_ns->rdata, rdata, link);
return (result);
return result;
}
/*%
@@ -525,20 +518,20 @@ configure_staticstub_servernames(const cfg_obj_t *zconfig, dns_zone_t *zone,
isc_buffer_constinit(&b, str, strlen(str));
isc_buffer_add(&b, strlen(str));
result = dns_name_fromtext(nsname, &b, dns_rootname, 0, NULL);
result = dns_name_fromtext(nsname, &b, dns_rootname, 0);
if (result != ISC_R_SUCCESS) {
cfg_obj_log(zconfig, ISC_LOG_ERROR,
"server-name '%s' is not a valid "
"name",
str);
return (result);
return result;
}
if (dns_name_issubdomain(nsname, dns_zone_getorigin(zone))) {
cfg_obj_log(zconfig, ISC_LOG_ERROR,
"server-name '%s' must not be a "
"subdomain of zone name '%s'",
str, zname);
return (ISC_R_FAILURE);
return ISC_R_FAILURE;
}
dns_name_toregion(nsname, &sregion);
@@ -552,7 +545,7 @@ configure_staticstub_servernames(const cfg_obj_t *zconfig, dns_zone_t *zone,
ISC_LIST_APPEND(rdatalist->rdata, rdata, link);
}
return (result);
return result;
}
/*%
@@ -577,9 +570,12 @@ configure_staticstub(const cfg_obj_t *zconfig, dns_zone_t *zone,
isc_region_t region;
/* Create the DB beforehand */
RETERR(dns_db_create(mctx, dbtype, dns_zone_getorigin(zone),
dns_dbtype_stub, dns_zone_getclass(zone), 0, NULL,
&db));
result = dns_db_create(mctx, dbtype, dns_zone_getorigin(zone),
dns_dbtype_stub, dns_zone_getclass(zone), 0,
NULL, &db);
if (result != ISC_R_SUCCESS) {
return result;
}
dns_rdataset_init(&rdataset);
@@ -637,7 +633,7 @@ configure_staticstub(const cfg_obj_t *zconfig, dns_zone_t *zone,
*/
CHECK(dns_db_newversion(db, &dbversion));
dns_name_init(&apexname, NULL);
dns_name_init(&apexname);
dns_name_clone(dns_zone_getorigin(zone), &apexname);
CHECK(dns_db_findnode(db, &apexname, false, &apexnode));
@@ -692,7 +688,7 @@ cleanup:
INSIST(dbversion == NULL);
return (result);
return result;
}
/*%
@@ -705,7 +701,7 @@ zonetype_fromconfig(const cfg_obj_t *map) {
result = cfg_map_get(map, "type", &obj);
INSIST(result == ISC_R_SUCCESS && obj != NULL);
return (named_config_getzonetype(obj));
return named_config_getzonetype(obj);
}
/*%
@@ -736,11 +732,11 @@ strtoargvsub(isc_mem_t *mctx, char *s, unsigned int *argcp, char ***argvp,
result = strtoargvsub(mctx, p, argcp, argvp, n + 1);
if (result != ISC_R_SUCCESS) {
return (result);
return result;
}
(*argvp)[n] = s;
}
return (ISC_R_SUCCESS);
return ISC_R_SUCCESS;
}
/*%
@@ -752,7 +748,7 @@ strtoargvsub(isc_mem_t *mctx, char *s, unsigned int *argcp, char ***argvp,
*/
static isc_result_t
strtoargv(isc_mem_t *mctx, char *s, unsigned int *argcp, char ***argvp) {
return (strtoargvsub(mctx, s, argcp, argvp, 0));
return strtoargvsub(mctx, s, argcp, argvp, 0);
}
static const char *const primary_synonyms[] = { "primary", "master", NULL };
@@ -799,12 +795,12 @@ isself(dns_view_t *myview, dns_tsigkey_t *mykey, const isc_sockaddr_t *srcaddr,
/* interfacemgr can be destroyed only in exclusive mode. */
if (named_g_server->interfacemgr == NULL) {
return (true);
return true;
}
if (!ns_interfacemgr_listeningon(named_g_server->interfacemgr, dstaddr))
{
return (false);
return false;
}
isc_netaddr_fromsockaddr(&netsrc, srcaddr);
@@ -847,7 +843,7 @@ isself(dns_view_t *myview, dns_tsigkey_t *mykey, const isc_sockaddr_t *srcaddr,
break;
}
}
return (view == myview);
return view == myview;
}
/*%
@@ -865,7 +861,7 @@ process_notifytype(dns_notifytype_t ntype, dns_zonetype_t ztype,
* zone is configured with something else than "notify yes;".
*/
if (ztype != dns_zone_mirror || ntype != dns_notifytype_yes) {
return (ntype);
return ntype;
}
/*
@@ -879,7 +875,7 @@ process_notifytype(dns_notifytype_t ntype, dns_zonetype_t ztype,
zname);
}
return (dns_notifytype_explicit);
return dns_notifytype_explicit;
}
isc_result_t
@@ -982,9 +978,6 @@ named_zone_configure(const cfg_obj_t *config, const cfg_obj_t *vconfig,
if (result == ISC_R_SUCCESS) {
cpval = isc_mem_strdup(mctx, cfg_obj_asstring(obj));
}
if (cpval == NULL) {
CHECK(ISC_R_NOMEMORY);
}
obj = NULL;
result = cfg_map_get(zoptions, "dlz", &obj);
@@ -1113,24 +1106,20 @@ named_zone_configure(const cfg_obj_t *config, const cfg_obj_t *vconfig,
size_t signedlen = strlen(filename) + sizeof(SIGNED);
char *signedname;
CHECK(dns_zone_setfile(raw, filename, masterformat,
masterstyle));
dns_zone_setfile(raw, filename, masterformat, masterstyle);
signedname = isc_mem_get(mctx, signedlen);
(void)snprintf(signedname, signedlen, "%s" SIGNED, filename);
result = dns_zone_setfile(zone, signedname,
dns_masterformat_raw, NULL);
dns_zone_setfile(zone, signedname, dns_masterformat_raw, NULL);
isc_mem_put(mctx, signedname, signedlen);
CHECK(result);
} else {
CHECK(dns_zone_setfile(zone, filename, masterformat,
masterstyle));
dns_zone_setfile(zone, filename, masterformat, masterstyle);
}
obj = NULL;
result = cfg_map_get(zoptions, "journal", &obj);
if (result == ISC_R_SUCCESS) {
CHECK(dns_zone_setjournal(mayberaw, cfg_obj_asstring(obj)));
dns_zone_setjournal(mayberaw, cfg_obj_asstring(obj));
}
/*
@@ -1277,8 +1266,8 @@ named_zone_configure(const cfg_obj_t *config, const cfg_obj_t *vconfig,
dns_ipkeylist_t ipkl;
dns_ipkeylist_init(&ipkl);
CHECK(named_config_getipandkeylist(config, "primaries",
obj, mctx, &ipkl));
CHECK(named_config_getipandkeylist(config, obj, mctx,
&ipkl));
dns_zone_setalsonotify(zone, ipkl.addrs, ipkl.sources,
ipkl.keys, ipkl.tlss,
ipkl.count);
@@ -1631,7 +1620,7 @@ named_zone_configure(const cfg_obj_t *config, const cfg_obj_t *vconfig,
result = named_config_get(maps, "key-directory", &obj);
if (result == ISC_R_SUCCESS) {
filename = cfg_obj_asstring(obj);
CHECK(dns_zone_setkeydirectory(zone, filename));
dns_zone_setkeydirectory(zone, filename);
}
/* Also save a reference to the keystore list. */
dns_zone_setkeystores(zone, keystorelist);
@@ -1683,9 +1672,8 @@ named_zone_configure(const cfg_obj_t *config, const cfg_obj_t *vconfig,
if (parentals != NULL) {
dns_ipkeylist_t ipkl;
dns_ipkeylist_init(&ipkl);
CHECK(named_config_getipandkeylist(
config, "parental-agents", parentals, mctx,
&ipkl));
CHECK(named_config_getipandkeylist(config, parentals,
mctx, &ipkl));
dns_zone_setparentals(zone, ipkl.addrs, ipkl.sources,
ipkl.keys, ipkl.tlss, ipkl.count);
dns_ipkeylist_clear(mctx, &ipkl);
@@ -1857,7 +1845,7 @@ named_zone_configure(const cfg_obj_t *config, const cfg_obj_t *vconfig,
dns_name_equal(dns_zone_getorigin(zone), dns_rootname))
{
result = named_config_getremotesdef(
named_g_config, "primaries",
named_g_config, "remote-servers",
DEFAULT_IANA_ROOT_ZONE_PRIMARIES, &obj);
CHECK(result);
}
@@ -1865,8 +1853,8 @@ named_zone_configure(const cfg_obj_t *config, const cfg_obj_t *vconfig,
dns_ipkeylist_t ipkl;
dns_ipkeylist_init(&ipkl);
CHECK(named_config_getipandkeylist(config, "primaries",
obj, mctx, &ipkl));
CHECK(named_config_getipandkeylist(config, obj, mctx,
&ipkl));
dns_zone_setprimaries(mayberaw, ipkl.addrs,
ipkl.sources, ipkl.keys,
ipkl.tlss, ipkl.count);
@@ -1886,6 +1874,33 @@ named_zone_configure(const cfg_obj_t *config, const cfg_obj_t *vconfig,
}
dns_zone_setoption(mayberaw, DNS_ZONEOPT_MULTIMASTER, multi);
obj = NULL;
result = named_config_get(maps, "min-transfer-rate-in", &obj);
INSIST(result == ISC_R_SUCCESS && obj != NULL);
uint32_t traffic_bytes =
cfg_obj_asuint32(cfg_tuple_get(obj, "traffic_bytes"));
uint32_t time_minutes =
cfg_obj_asuint32(cfg_tuple_get(obj, "time_minutes"));
if (traffic_bytes == 0) {
cfg_obj_log(obj, ISC_LOG_ERROR,
"zone '%s': 'min-transfer-rate-in' bytes"
"value can not be '0'",
zname);
CHECK(ISC_R_FAILURE);
}
/* Max. 28 days (in minutes). */
const unsigned int time_minutes_max = 28 * 24 * 60;
if (time_minutes < 1 || time_minutes > time_minutes_max) {
cfg_obj_log(obj, ISC_LOG_ERROR,
"zone '%s': 'min-transfer-rate-in' minutes"
"value is out of range (1..%u)",
zname, time_minutes_max);
CHECK(ISC_R_FAILURE);
}
dns_zone_setminxfrratein(mayberaw, traffic_bytes,
transferinsecs ? time_minutes
: time_minutes * 60);
obj = NULL;
result = named_config_get(maps, "max-transfer-time-in", &obj);
INSIST(result == ISC_R_SUCCESS && obj != NULL);
@@ -1953,7 +1968,7 @@ cleanup:
if (kasp != NULL) {
dns_kasp_detach(&kasp);
}
return (result);
return result;
}
/*
@@ -1968,11 +1983,11 @@ named_zone_configure_writeable_dlz(dns_dlzdb_t *dlzdatabase, dns_zone_t *zone,
dns_zone_settype(zone, dns_zone_dlz);
result = dns_sdlz_setdb(dlzdatabase, rdclass, name, &db);
if (result != ISC_R_SUCCESS) {
return (result);
return result;
}
result = dns_zone_dlzpostload(zone, db);
dns_db_detach(&db);
return (result);
return result;
}
bool
@@ -1996,7 +2011,7 @@ named_zone_reusable(dns_zone_t *zone, const cfg_obj_t *zconfig,
if (zonetype_fromconfig(zoptions) == dns_zone_staticstub) {
dns_zone_log(zone, ISC_LOG_DEBUG(1),
"not reusable: staticstub");
return (false);
return false;
}
/* If there's a raw zone, use that for filename and type comparison */
@@ -2017,17 +2032,17 @@ named_zone_reusable(dns_zone_t *zone, const cfg_obj_t *zconfig,
if (!inline_signing && has_raw) {
dns_zone_log(zone, ISC_LOG_DEBUG(1),
"not reusable: old zone was inline-signing");
return (false);
return false;
} else if (inline_signing && !has_raw) {
dns_zone_log(zone, ISC_LOG_DEBUG(1),
"not reusable: old zone was not inline-signing");
return (false);
return false;
}
if (zonetype_fromconfig(zoptions) != ztype) {
dns_zone_log(zone, ISC_LOG_DEBUG(1),
"not reusable: type mismatch");
return (false);
return false;
}
obj = NULL;
@@ -2043,10 +2058,10 @@ named_zone_reusable(dns_zone_t *zone, const cfg_obj_t *zconfig,
{
dns_zone_log(zone, ISC_LOG_DEBUG(1),
"not reusable: filename mismatch");
return (false);
return false;
}
return (true);
return true;
}
bool
@@ -2080,13 +2095,13 @@ named_zone_inlinesigning(const cfg_obj_t *zconfig, const cfg_obj_t *vconfig,
if (res != ISC_R_SUCCESS ||
strcmp(cfg_obj_asstring(policy), "none") == 0)
{
return (false);
return false;
}
/* Lookup the policy. */
res = dns_kasplist_find(kasplist, cfg_obj_asstring(policy), &kasp);
if (res != ISC_R_SUCCESS) {
return (false);
return false;
}
inline_signing = dns_kasp_inlinesigning(kasp);
@@ -2099,8 +2114,8 @@ named_zone_inlinesigning(const cfg_obj_t *zconfig, const cfg_obj_t *vconfig,
*/
res = cfg_map_get(maps[0], "inline-signing", &signing);
if (res == ISC_R_SUCCESS && cfg_obj_isboolean(signing)) {
return (cfg_obj_asboolean(signing));
return cfg_obj_asboolean(signing);
}
return (inline_signing);
return inline_signing;
}
+165 -169
View File
File diff suppressed because it is too large Load Diff
+27 -27
View File
@@ -177,7 +177,7 @@ static const char *filter_a_enums[] = { "break-dnssec", NULL };
static isc_result_t
parse_filter_a(cfg_parser_t *pctx, const cfg_type_t *type, cfg_obj_t **ret) {
return (cfg_parse_enum_or_other(pctx, type, &cfg_type_boolean, ret));
return cfg_parse_enum_or_other(pctx, type, &cfg_type_boolean, ret);
}
static void
@@ -210,7 +210,7 @@ parse_filter_a_on(const cfg_obj_t *param_obj, const char *param_name,
result = cfg_map_get(param_obj, param_name, &obj);
if (result != ISC_R_SUCCESS) {
return (ISC_R_SUCCESS);
return ISC_R_SUCCESS;
}
if (cfg_obj_isboolean(obj)) {
@@ -225,7 +225,7 @@ parse_filter_a_on(const cfg_obj_t *param_obj, const char *param_name,
result = ISC_R_UNEXPECTED;
}
return (result);
return result;
}
static isc_result_t
@@ -237,7 +237,7 @@ check_syntax(cfg_obj_t *fmap, const void *cfg, isc_mem_t *mctx, void *actx) {
cfg_map_get(fmap, "filter-a", &aclobj);
if (aclobj == NULL) {
return (result);
return result;
}
CHECK(cfg_acl_fromconfig(aclobj, (const cfg_obj_t *)cfg,
@@ -265,7 +265,7 @@ cleanup:
dns_acl_detach(&acl);
}
return (result);
return result;
}
static isc_result_t
@@ -306,7 +306,7 @@ cleanup:
if (parser != NULL) {
cfg_parser_destroy(&parser);
}
return (result);
return result;
}
/**
@@ -358,7 +358,7 @@ cleanup:
plugin_destroy((void **)&inst);
}
return (result);
return result;
}
isc_result_t
@@ -385,7 +385,7 @@ cleanup:
if (parser != NULL) {
cfg_parser_destroy(&parser);
}
return (result);
return result;
}
/*
@@ -415,7 +415,7 @@ plugin_destroy(void **instp) {
*/
int
plugin_version(void) {
return (NS_PLUGIN_VERSION);
return NS_PLUGIN_VERSION;
}
/**
@@ -440,14 +440,14 @@ typedef struct section_filter {
static bool
is_v4_client(ns_client_t *client) {
if (isc_sockaddr_pf(&client->peeraddr) == AF_INET) {
return (true);
return true;
}
if (isc_sockaddr_pf(&client->peeraddr) == AF_INET6 &&
IN6_IS_ADDR_V4MAPPED(&client->peeraddr.type.sin6.sin6_addr))
{
return (true);
return true;
}
return (false);
return false;
}
/*
@@ -458,9 +458,9 @@ is_v6_client(ns_client_t *client) {
if (isc_sockaddr_pf(&client->peeraddr) == AF_INET6 &&
!IN6_IS_ADDR_V4MAPPED(&client->peeraddr.type.sin6.sin6_addr))
{
return (true);
return true;
}
return (false);
return false;
}
static filter_data_t *
@@ -473,7 +473,7 @@ client_state_get(const query_ctx_t *qctx, filter_instance_t *inst) {
sizeof(qctx->client), (void **)&client_state);
UNLOCK(&inst->hlock);
return (result == ISC_R_SUCCESS ? client_state : NULL);
return result == ISC_R_SUCCESS ? client_state : NULL;
}
static void
@@ -569,7 +569,7 @@ process_name(query_ctx_t *qctx, filter_a_t mode, const dns_name_t *name,
}
cleanup:
return (modified);
return modified;
}
/*%
@@ -640,7 +640,7 @@ filter_qctx_initialize(void *arg, void *cbdata, isc_result_t *resp) {
client_state_create(qctx, inst);
}
return (NS_HOOK_CONTINUE);
return NS_HOOK_CONTINUE;
}
/*
@@ -658,7 +658,7 @@ filter_prep_response_begin(void *arg, void *cbdata, isc_result_t *resp) {
*resp = ISC_R_UNSET;
if (client_state == NULL) {
return (NS_HOOK_CONTINUE);
return NS_HOOK_CONTINUE;
}
if (inst->v4_a != NONE || inst->v6_a != NONE) {
@@ -675,7 +675,7 @@ filter_prep_response_begin(void *arg, void *cbdata, isc_result_t *resp) {
}
}
return (NS_HOOK_CONTINUE);
return NS_HOOK_CONTINUE;
}
/*
@@ -695,7 +695,7 @@ filter_respond_begin(void *arg, void *cbdata, isc_result_t *resp) {
*resp = ISC_R_UNSET;
if (client_state == NULL) {
return (NS_HOOK_CONTINUE);
return NS_HOOK_CONTINUE;
}
if (client_state->mode != BREAK_DNSSEC &&
@@ -703,7 +703,7 @@ filter_respond_begin(void *arg, void *cbdata, isc_result_t *resp) {
(WANTDNSSEC(qctx->client) && qctx->sigrdataset != NULL &&
dns_rdataset_isassociated(qctx->sigrdataset))))
{
return (NS_HOOK_CONTINUE);
return NS_HOOK_CONTINUE;
}
if (qctx->qtype == dns_rdatatype_a) {
@@ -776,11 +776,11 @@ filter_respond_begin(void *arg, void *cbdata, isc_result_t *resp) {
*resp = result;
return (NS_HOOK_RETURN);
return NS_HOOK_RETURN;
}
*resp = result;
return (NS_HOOK_CONTINUE);
return NS_HOOK_CONTINUE;
}
/*
@@ -813,7 +813,7 @@ filter_respond_any_found(void *arg, void *cbdata, isc_result_t *resp) {
process_section(&filter_answer);
}
return (NS_HOOK_CONTINUE);
return NS_HOOK_CONTINUE;
}
/*
@@ -850,7 +850,7 @@ filter_query_done_send(void *arg, void *cbdata, isc_result_t *resp) {
}
}
return (NS_HOOK_CONTINUE);
return NS_HOOK_CONTINUE;
}
/*
@@ -865,10 +865,10 @@ filter_qctx_destroy(void *arg, void *cbdata, isc_result_t *resp) {
*resp = ISC_R_UNSET;
if (!qctx->detach_client) {
return (NS_HOOK_CONTINUE);
return NS_HOOK_CONTINUE;
}
client_state_destroy(qctx, inst);
return (NS_HOOK_CONTINUE);
return NS_HOOK_CONTINUE;
}
+27 -27
View File
@@ -177,7 +177,7 @@ static const char *filter_aaaa_enums[] = { "break-dnssec", NULL };
static isc_result_t
parse_filter_aaaa(cfg_parser_t *pctx, const cfg_type_t *type, cfg_obj_t **ret) {
return (cfg_parse_enum_or_other(pctx, type, &cfg_type_boolean, ret));
return cfg_parse_enum_or_other(pctx, type, &cfg_type_boolean, ret);
}
static void
@@ -211,7 +211,7 @@ parse_filter_aaaa_on(const cfg_obj_t *param_obj, const char *param_name,
result = cfg_map_get(param_obj, param_name, &obj);
if (result != ISC_R_SUCCESS) {
return (ISC_R_SUCCESS);
return ISC_R_SUCCESS;
}
if (cfg_obj_isboolean(obj)) {
@@ -226,7 +226,7 @@ parse_filter_aaaa_on(const cfg_obj_t *param_obj, const char *param_name,
result = ISC_R_UNEXPECTED;
}
return (result);
return result;
}
static isc_result_t
@@ -238,7 +238,7 @@ check_syntax(cfg_obj_t *fmap, const void *cfg, isc_mem_t *mctx, void *actx) {
cfg_map_get(fmap, "filter-aaaa", &aclobj);
if (aclobj == NULL) {
return (result);
return result;
}
CHECK(cfg_acl_fromconfig(aclobj, (const cfg_obj_t *)cfg,
@@ -266,7 +266,7 @@ cleanup:
dns_acl_detach(&acl);
}
return (result);
return result;
}
static isc_result_t
@@ -309,7 +309,7 @@ cleanup:
if (parser != NULL) {
cfg_parser_destroy(&parser);
}
return (result);
return result;
}
/**
@@ -362,7 +362,7 @@ cleanup:
plugin_destroy((void **)&inst);
}
return (result);
return result;
}
isc_result_t
@@ -389,7 +389,7 @@ cleanup:
if (parser != NULL) {
cfg_parser_destroy(&parser);
}
return (result);
return result;
}
/*
@@ -419,7 +419,7 @@ plugin_destroy(void **instp) {
*/
int
plugin_version(void) {
return (NS_PLUGIN_VERSION);
return NS_PLUGIN_VERSION;
}
/**
@@ -444,14 +444,14 @@ typedef struct section_filter {
static bool
is_v4_client(ns_client_t *client) {
if (isc_sockaddr_pf(&client->peeraddr) == AF_INET) {
return (true);
return true;
}
if (isc_sockaddr_pf(&client->peeraddr) == AF_INET6 &&
IN6_IS_ADDR_V4MAPPED(&client->peeraddr.type.sin6.sin6_addr))
{
return (true);
return true;
}
return (false);
return false;
}
/*
@@ -462,9 +462,9 @@ is_v6_client(ns_client_t *client) {
if (isc_sockaddr_pf(&client->peeraddr) == AF_INET6 &&
!IN6_IS_ADDR_V4MAPPED(&client->peeraddr.type.sin6.sin6_addr))
{
return (true);
return true;
}
return (false);
return false;
}
static filter_data_t *
@@ -477,7 +477,7 @@ client_state_get(const query_ctx_t *qctx, filter_instance_t *inst) {
sizeof(qctx->client), (void **)&client_state);
UNLOCK(&inst->hlock);
return (result == ISC_R_SUCCESS ? client_state : NULL);
return result == ISC_R_SUCCESS ? client_state : NULL;
}
static void
@@ -573,7 +573,7 @@ process_name(query_ctx_t *qctx, filter_aaaa_t mode, const dns_name_t *name,
}
cleanup:
return (modified);
return modified;
}
/*%
@@ -644,7 +644,7 @@ filter_qctx_initialize(void *arg, void *cbdata, isc_result_t *resp) {
client_state_create(qctx, inst);
}
return (NS_HOOK_CONTINUE);
return NS_HOOK_CONTINUE;
}
/*
@@ -662,7 +662,7 @@ filter_prep_response_begin(void *arg, void *cbdata, isc_result_t *resp) {
*resp = ISC_R_UNSET;
if (client_state == NULL) {
return (NS_HOOK_CONTINUE);
return NS_HOOK_CONTINUE;
}
if (inst->v4_aaaa != NONE || inst->v6_aaaa != NONE) {
@@ -679,7 +679,7 @@ filter_prep_response_begin(void *arg, void *cbdata, isc_result_t *resp) {
}
}
return (NS_HOOK_CONTINUE);
return NS_HOOK_CONTINUE;
}
/*
@@ -699,7 +699,7 @@ filter_respond_begin(void *arg, void *cbdata, isc_result_t *resp) {
*resp = ISC_R_UNSET;
if (client_state == NULL) {
return (NS_HOOK_CONTINUE);
return NS_HOOK_CONTINUE;
}
if (client_state->mode != BREAK_DNSSEC &&
@@ -707,7 +707,7 @@ filter_respond_begin(void *arg, void *cbdata, isc_result_t *resp) {
(WANTDNSSEC(qctx->client) && qctx->sigrdataset != NULL &&
dns_rdataset_isassociated(qctx->sigrdataset))))
{
return (NS_HOOK_CONTINUE);
return NS_HOOK_CONTINUE;
}
if (qctx->qtype == dns_rdatatype_aaaa) {
@@ -779,11 +779,11 @@ filter_respond_begin(void *arg, void *cbdata, isc_result_t *resp) {
*resp = result;
return (NS_HOOK_RETURN);
return NS_HOOK_RETURN;
}
*resp = result;
return (NS_HOOK_CONTINUE);
return NS_HOOK_CONTINUE;
}
/*
@@ -816,7 +816,7 @@ filter_respond_any_found(void *arg, void *cbdata, isc_result_t *resp) {
process_section(&filter_answer);
}
return (NS_HOOK_CONTINUE);
return NS_HOOK_CONTINUE;
}
/*
@@ -853,7 +853,7 @@ filter_query_done_send(void *arg, void *cbdata, isc_result_t *resp) {
}
}
return (NS_HOOK_CONTINUE);
return NS_HOOK_CONTINUE;
}
/*
@@ -868,10 +868,10 @@ filter_qctx_destroy(void *arg, void *cbdata, isc_result_t *resp) {
*resp = ISC_R_UNSET;
if (!qctx->detach_client) {
return (NS_HOOK_CONTINUE);
return NS_HOOK_CONTINUE;
}
client_state_destroy(qctx, inst);
return (NS_HOOK_CONTINUE);
return NS_HOOK_CONTINUE;
}
+8 -2
View File
@@ -22,6 +22,7 @@
#include <isc/commandline.h>
#include <isc/file.h>
#include <isc/getaddresses.h>
#include <isc/lib.h>
#include <isc/log.h>
#include <isc/loop.h>
#include <isc/managers.h>
@@ -36,6 +37,7 @@
#include <isc/thread.h>
#include <isc/util.h>
#include <dns/lib.h>
#include <dns/name.h>
#include <isccc/alist.h>
@@ -143,6 +145,10 @@ command is one of the following:\n\
Display RFC 5011 managed keys information\n\
managed-keys sync [class [view]]\n\
Write RFC 5011 managed keys to disk\n\
memprof [ on | off | dump ]\n\
Enable / disable memory profiling or dump the profile.\n\
Requires named to built with jemalloc and run with the relevant\n\
MALLOC_CONF environment variables.\n\
modzone zone [class [view]] { zone-options }\n\
Modify a zone's configuration.\n\
Requires allow-new-zones option.\n\
@@ -1013,8 +1019,8 @@ main(int argc, char **argv) {
isc_managers_destroy(&rndc_mctx, &loopmgr, &netmgr);
if (failed) {
return (1);
return 1;
}
return (0);
return 0;
}
+15 -3
View File
@@ -322,6 +322,19 @@ Currently supported commands are:
keys in the event of a trust anchor rollover, or as a brute-force
repair for key maintenance problems.
.. option:: memprof [(on | off | dump)]
This command controls memory profiling. To have any effect, :iscman:`named` must be
built with jemalloc, the library have profiling support enabled and run with the
``prof:true`` allocator configuration. (either via ``MALLOC_CONF`` or ``/etc/malloc.conf``)
The ``prof_active:false`` option is recommended to ensure the profiling overhead does
not affect :iscman:`named` when not needed.
The ``on`` and ``off`` options will start and stop the jemalloc memory profiling respectively.
When run with the `dump` option, :iscman:`named` will dump the profile to the working
directory. The name will be chosen automatically by jemalloc.
.. option:: modzone zone [class [view]] configuration
This command modifies the configuration of a zone while the server is running. This
@@ -491,9 +504,8 @@ Currently supported commands are:
.. option:: secroots [-] [view ...]
This command dumps the security roots (i.e., trust anchors configured via
``trust-anchors``, or the ``managed-keys`` or ``trusted-keys`` statements
[both deprecated], or ``dnssec-validation auto``) and negative trust anchors
for the specified views. If no view is specified, all views are
``trust-anchors`` statement, or ``dnssec-validation auto``) and negative
trust anchors for the specified views. If no view is specified, all views are
dumped. Security roots indicate whether they are configured as trusted
keys, managed keys, or initializing managed keys (managed keys that have not
yet been updated by a successful key refresh query).
-5
View File
@@ -17,7 +17,6 @@
#include <isc/attributes.h>
#include <isc/formatcheck.h>
#include <isc/lang.h>
#define NS_CONTROL_PORT 953
@@ -31,12 +30,8 @@
notify("%s", name); \
} while (0)
ISC_LANG_BEGINDECLS
void
notify(const char *fmt, ...) ISC_FORMAT_PRINTF(1, 2);
ISC_NORETURN void
fatal(const char *format, ...) ISC_FORMAT_PRINTF(1, 2);
ISC_LANG_ENDDECLS
+2 -1
View File
@@ -71,6 +71,7 @@ TESTS = \
autosign \
builtin \
cacheclean \
camp \
case \
catz \
cds \
@@ -134,6 +135,7 @@ TESTS = \
proxy \
pipelined \
qmin \
query-source \
reclimit \
redirect \
resolver \
@@ -148,7 +150,6 @@ TESTS = \
sfcache \
shutdown \
smartsign \
sortlist \
spf \
staticstub \
statistics \
-25
View File
@@ -1,25 +0,0 @@
#!/bin/sh
# 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.
#
# Clean up after zone transfer tests.
#
rm -f dig.out.*
rm -f ns2/example.db ns2/tsigzone.db ns2/example.db.jnl
rm -f */named.conf
rm -f */named.memstats
rm -f */named.run
rm -f ns*/_default.nzf
rm -f ns*/_default.nzd*
rm -f ns*/managed-keys.bind* ns*/*.mkeys*
-1
View File
@@ -13,7 +13,6 @@
. ../conf.sh
$SHELL clean.sh
$SHELL ${TOP_SRCDIR}/bin/tests/system/genzone.sh 2 3 >ns2/example.db
$SHELL ${TOP_SRCDIR}/bin/tests/system/genzone.sh 2 3 >ns2/tsigzone.db
copy_setports ns2/named1.conf.in ns2/named.conf
+12
View File
@@ -9,6 +9,18 @@
# See the COPYRIGHT file distributed with this work for additional
# information regarding copyright ownership.
import pytest
pytestmark = pytest.mark.extra_artifacts(
[
"dig.out*",
"ns*/_default.nzd*",
"ns*/_default.nzf*",
"ns2/example.db",
"ns2/tsigzone.db",
]
)
def test_acl(run_tests_sh):
run_tests_sh()
-1
View File
@@ -13,7 +13,6 @@
. ../conf.sh
$SHELL clean.sh
copy_setports ns1/named1.conf.in ns1/named.conf
copy_setports ns2/named.conf.in ns2/named.conf
copy_setports ns3/named.conf.in ns3/named.conf
@@ -9,6 +9,14 @@
# See the COPYRIGHT file distributed with this work for additional
# information regarding copyright ownership.
import pytest
pytestmark = pytest.mark.extra_artifacts(
[
"dig.out.*",
]
)
def test_additional(run_tests_sh):
run_tests_sh()
-43
View File
@@ -1,43 +0,0 @@
#!/bin/sh
# 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.
rm -f ./dig.out.*
rm -f ./rndc.out*
rm -f ./showzone.out*
rm -f ./zonestatus.out*
rm -f ./*/named.conf
rm -f ./*/named.memstats
rm -f ./ns1/*.nzf ./ns1/*.nzf~
rm -f ./ns1/*.nzd ./ns1/*.nzd-lock
rm -f ./ns2/*.nzf ./ns2/*.nzf~
rm -f ./ns2/*.nzd ./ns2/*.nzd-lock
rm -f ./ns3/*.nzf ./ns3/*.nzf~
rm -f ./ns3/*.nzd ./ns3/*.nzd-lock
rm -f ./ns2/core*
rm -f ./ns2/inline.db.jbk
rm -f ./ns2/inline.db.signed
rm -f ./ns2/inlinesec.bk*
rm -rf ./ns2/new-zones
rm -f ./ns*/named.run ./ns*/named.run.prev
rm -f ./ns2/nzf-*
rm -f ./ns3/named.conf
rm -f ./ns3/*.nzf ./ns3/*.nzf~
rm -f ./ns3/*.nzd ns3/*.nzd-lock
rm -f ./ns3/inlinesec.db
rm -f ./ns1/redirect.db
rm -f ./ns2/redirect.db
rm -f ./ns2/redirect.bk
rm -f ./ns3/redirect.db
rm -f ./ns*/managed-keys.bind* ns*/*.mkeys*
rm -f ./nzd2nzf.out.*
rm -f ./wait_for_message.*
+1 -1
View File
@@ -34,6 +34,6 @@ zone "." {
file "redirect.db";
};
primaries "test" {
remote-servers "test" {
10.53.0.99;
};
@@ -12,8 +12,21 @@
import concurrent.futures
import time
import pytest
import isctest
pytestmark = pytest.mark.extra_artifacts(
[
"ns*/*.nzf*",
"ns*/*.nzd*",
"ns1/redirect.db",
"ns2/new-zones",
"ns2/redirect.db",
"ns3/redirect.db",
]
)
def rndc_loop(test_state, domain, ns3):
"""
@@ -9,6 +9,35 @@
# See the COPYRIGHT file distributed with this work for additional
# information regarding copyright ownership.
import pytest
pytestmark = pytest.mark.extra_artifacts(
[
"dig.out.*",
"rndc.out*",
"showzone.out.*",
"zonestatus.out.*",
"ns*/*.nzd*",
"ns*/*.nzf*",
"ns1/redirect.db",
"nzd2nzf.out.*",
"ns2/*.nzf~",
"ns2/K*.key",
"ns2/K*.private",
"ns2/K*.state",
"ns2/external.nzd",
"ns2/extra.nzd",
"ns2/inline.db.jbk",
"ns2/inline.db.signed",
"ns2/inline.db.signed.jnl",
"ns2/inlinesec.bk.jbk",
"ns2/new-zones",
"ns2/redirect.bk",
"ns2/redirect.db",
"ns3/redirect.db",
]
)
def test_addzone(run_tests_sh):
run_tests_sh()
-23
View File
@@ -1,23 +0,0 @@
#!/bin/sh
# 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.
#
# Clean up after allow query tests.
#
rm -f dig.out.*
rm -f ns*/named.conf
rm -f ns2/controls.conf
rm -f */named.memstats
rm -f ns*/named.run ns*/named.run.prev
rm -f ns*/managed-keys.bind* ns*/*.mkeys*
@@ -9,6 +9,15 @@
# See the COPYRIGHT file distributed with this work for additional
# information regarding copyright ownership.
import pytest
pytestmark = pytest.mark.extra_artifacts(
[
"dig.out.*",
"ns2/controls.conf",
]
)
def test_allow_query(run_tests_sh):
run_tests_sh()
-21
View File
@@ -1,21 +0,0 @@
#!/bin/sh
# 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.
rm -f */named.conf
rm -f */named.memstats
rm -f */named.run
rm -f */named.run.prev
rm -f dig.out.test*
rm -f ns*/managed-keys.bind* ns*/*mkeys*
rm -f ns2/example.com.bk
rm -f ns2/example.net.bk
+9
View File
@@ -9,6 +9,15 @@
# See the COPYRIGHT file distributed with this work for additional
# information regarding copyright ownership.
import pytest
pytestmark = pytest.mark.extra_artifacts(
[
"dig.out.test*",
"ns*/example.*.bk",
]
)
def test_auth(run_tests_sh):
run_tests_sh()
-76
View File
@@ -1,76 +0,0 @@
#!/bin/sh
# 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.
rm -f ./dsset-*
rm -f */K* */dsset-* */*.signed */tmp* */*.jnl */*.bk
rm -f */core
rm -f */example.bk
rm -f */named.conf
rm -f */named.memstats
rm -f */named.run*
rm -f */trusted.conf */private.conf
rm -f dig.out.*
rm -f digcomp.out.test*
rm -f activate-now-publish-1day.key prepub.key
rm -f active.key inact.key del.key delzsk.key unpub.key standby.key rev.key
rm -f delayksk.key delayzsk.key autoksk.key autozsk.key
rm -f noksk-ksk.key nozsk-ksk.key nozsk-zsk.key inaczsk-zsk.key inaczsk-ksk.key
rm -f nopriv.key vanishing.key del1.key del2.key
rm -rf ns*/inactive
rm -f ns*/managed-keys.bind*
rm -f ns1/root.db ns1/root.db.1 ns1/root.db.2 ns1/root.db.3
rm -f ns1/signing.out
rm -f ns2/bar.db
rm -f ns2/child.nsec3.example.db
rm -f ns2/child.optout.example.db
rm -f ns2/example.db
rm -f ns2/insecure.secure.example.db
rm -f ns2/nsec3-with-ent.db
rm -f ns2/private.secure.example.db
rm -f ns2/signing.*
rm -f ns3/*.nzd ns3/*.nzd-lock ns3/*.nzf
rm -f ns3/*.nzf
rm -f ns3/*.jbk
rm -f ns3/autonsec3.example.db
rm -f ns3/delay.example.db ns3/delay.example.1 ns3/delay.example.2
rm -f ns3/delzsk.example.db
rm -f ns3/dname-at-apex-nsec3.example.db
rm -f ns3/inaczsk2.example.db
rm -f ns3/jitter.nsec3.example.db
rm -f ns3/kg.out ns3/s.out ns3/st.out
rm -f ns3/kskonly.example.db
rm -f ns3/named.ns3.prev
rm -f ns3/noksk.example.db
rm -f ns3/nozsk.example.db ns3/inaczsk.example.db
rm -f ns3/nsec-only.example.db
rm -f ns3/nsec3-to-nsec.example.db
rm -f ns3/nsec3.example.db
rm -f ns3/nsec3.nsec3.example.db
rm -f ns3/nsec3.optout.example.db
rm -f ns3/oldsigs.example.db ns3/oldsigs.example.db.bak
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/reconf.example.db
rm -f ns3/rsasha256.example.db ns3/rsasha512.example.db
rm -f ns3/secure.example.db
rm -f ns3/secure.nsec3.example.db
rm -f ns3/secure.optout.example.db
rm -f ns3/settime.out.*
rm -f ns3/sync.example.db
rm -f ns3/ttl*.db
rm -f nsupdate.out.test*
rm -f settime.out.*
rm -f signing.*
rm -f sync.key
-4
View File
@@ -52,10 +52,6 @@ ns.secure A 10.53.0.3
insecure NS ns.insecure
ns.insecure A 10.53.0.3
; A insecure subdomain
mustbesecure NS ns.mustbesecure
ns.mustbesecure A 10.53.0.3
z A 10.0.0.26
nsec3 NS ns.nsec3
@@ -52,10 +52,6 @@ ns.secure A 10.53.0.3
insecure NS ns.insecure
ns.insecure A 10.53.0.3
; A insecure subdomain
mustbesecure NS ns.mustbesecure
ns.mustbesecure A 10.53.0.3
z A 10.0.0.26
nsec3 NS ns.nsec3
@@ -23,7 +23,6 @@ options {
listen-on-v6 { none; };
recursion yes;
dnssec-validation yes;
dnssec-must-be-secure mustbesecure.example yes;
};
zone "." {
@@ -9,9 +9,147 @@
# See the COPYRIGHT file distributed with this work for additional
# information regarding copyright ownership.
import pytest
import isctest.mark
pytestmark = pytest.mark.extra_artifacts(
[
"active.key",
"activate-now-publish-1day.key",
"autoksk.key",
"autozsk.key",
"del.key",
"delayksk.key",
"delayzsk.key",
"delzsk.key",
"dig.out.*",
"dsset-.",
"dsset-bar.",
"dsset-delay.example.",
"inact.key",
"inaczsk-ksk.key",
"inaczsk-zsk.key",
"noksk-ksk.key",
"nopriv.key",
"nozsk-ksk.key",
"nozsk-zsk.key",
"nsupdate.out.*",
"prepub.key",
"rev.key",
"settime.out.*",
"signing.*out*",
"standby.key",
"sync.key",
"unpub.key",
"vanishing.key",
"*/K*",
"*/dsset-*",
"*/*.signed",
"*/*.jnl",
"*/*.bk",
"ns*/_default.nzf*",
"ns*/_default.nzd*",
"ns1/root.db",
"ns1/root.db.1",
"ns1/root.db.2",
"ns1/root.db.3",
"ns1/signing.out",
"ns1/trusted.conf",
"ns2/bar.db",
"ns2/child.nsec3.example.db",
"ns2/child.optout.example.db",
"ns2/dsset-dname-at-apex-nsec3.example.",
"ns2/dsset-example.",
"ns2/dsset-nsec3-to-nsec.example.",
"ns2/dsset-nsec3.example.",
"ns2/dsset-oldsigs.example.",
"ns2/dsset-optout.example.",
"ns2/dsset-private.secure.example.",
"ns2/dsset-rsasha256.example.",
"ns2/dsset-rsasha512.example.",
"ns2/dsset-secure.example.",
"ns2/example.db",
"ns2/insecure.secure.example.db",
"ns2/nsec3-with-ent.db",
"ns2/private.conf",
"ns2/private.secure.example.db",
"ns2/signing.bar.out",
"ns2/signing.privsec.out",
"ns2/trusted.conf",
"ns3/autonsec3.example.db",
"ns3/delay.example.1",
"ns3/delay.example.2",
"ns3/delay.example.db",
"ns3/delzsk.example.db",
"ns3/dname-at-apex-nsec3.example.db",
"ns3/dsset-autonsec3.example.",
"ns3/dsset-dname-at-apex-nsec3.example.",
"ns3/dsset-inaczsk.example.",
"ns3/dsset-inaczsk2.example.",
"ns3/dsset-kskonly.example.",
"ns3/dsset-noksk.example.",
"ns3/dsset-nozsk.example.",
"ns3/dsset-nsec-only.example.",
"ns3/dsset-nsec3-to-nsec.example.",
"ns3/dsset-nsec3-to-nsec3.example.",
"ns3/dsset-nsec3.example.",
"ns3/dsset-nsec3.nsec3.example.",
"ns3/dsset-nsec3.optout.example.",
"ns3/dsset-oldsigs.example.",
"ns3/dsset-optout.example.",
"ns3/dsset-optout.nsec3.example.",
"ns3/dsset-optout.optout.example.",
"ns3/dsset-prepub.example.",
"ns3/dsset-rsasha256.example.",
"ns3/dsset-rsasha512.example.",
"ns3/dsset-secure.example.",
"ns3/dsset-secure.nsec3.example.",
"ns3/dsset-secure.optout.example.",
"ns3/dsset-sync.example.",
"ns3/inactive",
"ns3/inaczsk.example.db",
"ns3/inaczsk2.example.db",
"ns3/jitter.nsec3.example.db",
"ns3/kg.out",
"ns3/kskonly.example.db",
"ns3/kskonly.example.db.jbk",
"ns3/noksk.example.db",
"ns3/nozsk.example.db",
"ns3/nsec-only.example.db",
"ns3/nsec3-to-nsec.example.db",
"ns3/nsec3-to-nsec3.example.db",
"ns3/nsec3.example.db",
"ns3/nsec3.nsec3.example.db",
"ns3/nsec3.optout.example.db",
"ns3/oldsigs.example.db",
"ns3/oldsigs.example.db.bak",
"ns3/optout.example.db",
"ns3/optout.example.db.jbk",
"ns3/optout.nsec3.example.db",
"ns3/optout.optout.example.db",
"ns3/prepub.example.db",
"ns3/reconf.example.db",
"ns3/reconf.example.db.jbk",
"ns3/rsasha256.example.db",
"ns3/rsasha512.example.db",
"ns3/s.out",
"ns3/secure.example.db",
"ns3/secure.nsec3.example.db",
"ns3/secure.optout.example.db",
"ns3/st.out",
"ns3/sync.example.db",
"ns3/trusted.conf",
"ns3/ttl1.example.db",
"ns3/ttl2.example.db",
"ns3/ttl3.example.db",
"ns3/ttl4.example.db",
"ns4/private.conf",
"ns4/trusted.conf",
"ns5/trusted.conf",
]
)
@isctest.mark.flaky(max_runs=2)
def test_autosign(run_tests_sh):
@@ -9,6 +9,15 @@
# See the COPYRIGHT file distributed with this work for additional
# information regarding copyright ownership.
import pytest
pytestmark = pytest.mark.extra_artifacts(
[
"dig.out.*",
"rndc.status.ns*",
]
)
def test_builtin(run_tests_sh):
run_tests_sh()
-26
View File
@@ -1,26 +0,0 @@
#!/bin/sh
# 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.
#
# Clean up after cache cleaner tests.
#
rm -f dig.out.ns2
rm -f dig.out.expire
rm -f rndc.out.*
rm -f sed.out.*
rm -f */named.memstats
rm -f */named.run
rm -f */named.conf
rm -f ns2/named_dump.db.*
rm -f ns*/managed-keys.bind*
@@ -9,6 +9,17 @@
# See the COPYRIGHT file distributed with this work for additional
# information regarding copyright ownership.
import pytest
pytestmark = pytest.mark.extra_artifacts(
[
"dig.out.*",
"rndc.out.*",
"sed.out.*",
"ns2/named_dump.db.*",
]
)
def test_cacheclean(run_tests_sh):
run_tests_sh()

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