Compare commits

...
Author SHA1 Message Date
Ondřej Surý 547062e44b Remove even more contention between threads
Remove unneeded qp*_ref/unref and qpcache_ref/unref calls by skipping
the extra ref/unref on the database in qp*node_release().  This makes
the extra ref/unref in detachnode() unnecessary as the reference on the
database will always only go down when releasing the database nodes.
2025-02-18 12:09:27 +01: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
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
Mark Andrews cf90a2bb0e fix: nil: TLS notify checks fail on OL 8 FIPS
Add missing checks for `$FEATURETEST --have-fips-dh` in notify system test to match those in setup.sh.

Closes #5015

Merge branch '5015-tls-notify-checks-fail-on-ol-8-fips' into 'main'

See merge request isc-projects/bind9!9707
2024-11-02 05:59:09 +00:00
Mark Andrews 4f7e3e29a7 Add missing $FEATURETEST --have-fips-dh
Notify over TLS only works if FIPS DH is supported.  Skip the system
tests parts that depend on it.
2024-11-02 03:59:21 +00:00
Matthijs Mekking 675a7f0166 chg: usr: dnssec-ksr now supports KSK rollovers
The tool 'dnssec-ksr' now allows for KSK generation, as well as planned KSK rollovers. When signing a bundle from a Key Signing Request (KSR), only the key that is active in that time frame is being used for signing. Also, the CDS and CDNSKEY records are now added and removed at the correct time.

Closes #4697 

Closes #4705

Merge branch '4705-dnssec-ksr-only-sign-with-active-ksks' into 'main'

See merge request isc-projects/bind9!9452
2024-11-01 15:29:37 +00:00
Matthijs Mekking d7f2a2f437 Fix dnssec-ksr to support KSK rollovers
dnssec-ksr can now sign KSR files with multiple KSKs. A planned KSK
rollover is supported, meaning the KSR will first be signed with
one KSK and later with another. The timing metadata for CDS and
CDNSKEY records are also taken into account, so these records are
only published when the time is between "SyncPublish" and "SyncDelete".
2024-11-01 15:50:16 +01:00
Matthijs Mekking 8cf5f972f4 Add KSK roll test case
Add a test case for Offline KSK where during the lifespan of the Signed
Key Response a KSK rollover happens. Ensure that the correct DNSKEY,
CDNSKEY, and CDS records are published at the right times.
2024-11-01 15:50:16 +01:00
Matthijs Mekking 708927e03d Allow empty CDNSKEY/CDS RRset in ksr system test
When the zone is initially signed, the CDNSKEY/CDS RRset is not
immediately published. The DNSKEY and signatures must propagate first.
Adjust the test to allow for this case.
2024-11-01 15:50:16 +01:00
Matthijs Mekking 680aedb595 dnssec-ksr keygen -o to create KSKs
Add an option to dnssec-ksr keygen, -o, to create KSKs instead of ZSKs.
This way, we can create a set of KSKS for a given period too.

For KSKs we also need to set timing metadata, including "SyncPublish"
and "SyncDelete". This functionality already exists in keymgr.c so
let's make the function accessible.

Replace dnssec-keygen calls with dnssec-ksr keygen for KSK in the
ksr system test and check keys for created KSKs as well. This requires
a slight modification of the check_keys function to take into account
KSK timings and metadata.
2024-11-01 15:50:16 +01:00
Matthijs Mekking 01169b7ffc Add -f option to dnssec-ksr documentation
This was previously left out by error.
2024-11-01 15:50:16 +01:00
Matthijs Mekking a6349765fa chg: test: Match algorithms when checking signatures
In the ksr system test, the 'test_ksr_twotone' case may fail if there are two keys with the same keytag (but different algorithms), because one key is expected to be signing and the other is not.

Switch to regular expression matching and include the algorithm in the search string.

Closes #5017

Merge branch '5017-unexpected-match-ksr-twotone-again' into 'main'

See merge request isc-projects/bind9!9701
2024-11-01 14:15:49 +00:00
Matthijs Mekking 795fcc9f80 Match algorithms when checking signatures
In the ksr system test, the test_ksr_twotone case may fail if there
are two keys with the same keytag (but different algorithms), because
one key is expected to be signing and the other is not.

Switch to regular expression matching and include the algorithm in the
search string.
2024-11-01 14:14:07 +01:00
Michal Nowak 84d91b6b3a chg: test: Rewrite rsabigexponent system test to pytest
Merge branch 'mnowak/pytest_rewrite_rsabigexponent' into 'main'

See merge request isc-projects/bind9!9157
2024-10-31 18:12:21 +00:00
Michal Nowak cacff68e78 Rewrite rsabigexponent system test to pytest 2024-10-31 16:46:51 +00:00
Michal Nowak 5585bd0fde fix: doc: Remove the CHANGES file
With the introduction of the generated changelog, the CHANGES file
became a symlink to doc/arm/changelog.rst. After the changes made in
!9549, the changelog file transitioned from being a wholly generated
file to one that includes versioned changelog files, which are
themselves generated. However, while implementing !9549, we overlooked
that the CHANGES file is copied to a release directory on an FTP server
and contains just "include" directives, not the changelog itself.
Therefore, in the same fashion as the "RELEASE-NOTES*.html" file, create
a "CHANGELOG*.html" file that redirects to the Changelog appendix of the
ARM.

Closes #5000

Merge branch '5000-provide-correct-changelog-on-ftp' into 'main'

See merge request isc-projects/bind9!9690
2024-10-31 16:46:11 +00:00
Michal Nowak 9750f22e3a Fix changelog history header 2024-10-31 16:45:35 +00:00
Michal Nowak e40bd273e4 Remove the CHANGES file
With the introduction of the generated changelog, the CHANGES file
became a symlink to doc/arm/changelog.rst. After the changes made in
!9549, the changelog file transitioned from being a wholly generated
file to one that includes versioned changelog files, which are
themselves generated. However, while implementing !9549, we overlooked
that the CHANGES file is copied to a release directory on an FTP server
and contains just "include" directives, not the changelog itself.
Therefore, in the same fashion as the "RELEASE-NOTES*.html" file, create
a "CHANGELOG*.html" file that redirects to the Changelog appendix of the
ARM.
2024-10-31 16:45:35 +00:00
Nicki Křížek 04bdaf6efb new: dev: Support jinja2 templates in pytest runner
Configuration files in system tests which require some variables (e.g.
port numbers) filled in during test setup, can now use jinja2 templates
when `jinja2` python package is available.

Any `*.j2` file found within the system test directory will be
automatically rendered with the environment variables into a file
without the `.j2` extension by the pytest runner. E.g.
`ns1/named.conf.j2` will become `ns1/named.conf` during test setup. To
avoid automatic rendering, use `.j2.manual` extension and render the
files manually at test time.

New `templates` pytest fixture has been added. Its `render()` function
can be used to render a template with custom test variables. This can be
useful to fill in different config options during the test. With
advanced jinja2 template syntax, it can also be used to include/omit
entire sections of the config file rather than using `named1.conf.in`,
`named2.conf.in` etc.

Closes #4938

Merge branch '4938-use-jinja2-templates-in-system-tests' into 'main'

See merge request isc-projects/bind9!9587
2024-10-31 09:40:02 +00:00
Nicki Křížek 60e118c4fb Support jinja2 templates in pytest runner
Configuration files in system tests which require some variables (e.g.
port numbers) filled in during test setup, can now use jinja2 templates
when `jinja2` python package is available.

Any `*.j2` file found within the system test directory will be
automatically rendered with the environment variables into a file
without the `.j2` extension by the pytest runner. E.g.
`ns1/named.conf.j2` will become `ns1/named.conf` during test setup. To
avoid automatic rendering, use `.j2.manual` extension and render the
files manually at test time.

New `templates` pytest fixture has been added. Its `render()` function
can be used to render a template with custom test variables. This can be
useful to fill in different config options during the test. With
advanced jinja2 template syntax, it can also be used to include/omit
entire sections of the config file rather than using `named1.conf.in`,
`named2.conf.in` etc.
2024-10-30 18:00:20 +01:00
Evan Hunt 887b04571b chg: usr: Add missing EDNS option mnemonics
The `Report-Channel` and `ZONEVERSION` EDNS options can now be sent using `dig +ednsopt=report-channel` (or `dig +ednsopt=rc` for short), and `dig +ednsopt=zoneversion`.

Several other EDNS option names, including `DAU`, `DHU`, `N3U`, and `CHAIN`, are now displayed correctly in text and YAML formats. Also, an inconsistency has been corrected: the `TCP-KEEPALIVE` option is now spelled with a hyphen in both text and YAML formats; previously, text format used a space.

Merge branch 'each-add-missing-edns-opts' into 'main'

See merge request isc-projects/bind9!9691
2024-10-29 20:05:52 +00:00
Evan Hunt e2393ba27b refactor, add missing EDNS options, and fix option names
some EDNS option names, including DAU, DHU, N3U, and CHAIN,
were not printed in dns_message_pseudosectiontotext() or
_psuedosectiontoyaml(); they were displayed as unknown options.
this has been corrected.

that code was also refactored to use switch instead of if/else,
and to look up the option code names in a table to prevent
inconsistencies between the two formats. one such inconsistency
was corrected: the "TCP-KEEPALIVE" option is now always printed
with a hyphen, instead of being "TCP KEEPALIVE" when not using
YAML. the keepalive system test has been updated to expect this.

EDNS options that print DNS names (i.e., CHAIN and Report-Channel)
now enclose them in quotation marks to ensure YAML correctness.
the auth system test has been updated to expect this when grepping
for Report-Channel options.
2024-10-29 20:05:27 +00:00
Evan Hunt c30754f28b add missing EDNS option mnemonics to dig
Report-Channel and ZONEVERSION EDNS options can now be sent
using `dig +ednsopt=report-channel` (or `dig +ednsopt=rc` for
short), and `dig +ednsopt=zoneversion`.
2024-10-29 20:05:27 +00:00
Nicki Křížek c0e403dc72 chg: ci: Make changelog audience mandatory
Merge branch 'nicki/harazd-enforce-mr-title-audience' into 'main'

See merge request isc-projects/bind9!9628
2024-10-29 16:02:43 +00:00
Nicki Křížek cdb93bcbd4 Make changelog audience mandatory
Use a stricter hazard check which ensures the audience tag is present in
the MR title and is one of the known values. This prevents siuations
where incorrect audience is accidentally used, resulting in a missing
changelog entry or a release note.
2024-10-29 16:22:53 +01:00
Matthijs Mekking 9e46291211 fix: test: Fix CID 510858: Null ptr derefs in check_keys
Coverity Scan reported a new issue for the ksr system test. There is allegedly a null pointer dereference (FORWARD_NULL) in check_keys().

This popped up because previously we set 'retired' to 0 in case of unlimited lifetime, but we changed it to None.

It is actually a false positive, because if lifetime is unlimited there will be only one key in 'keys'.

However, the code would be better if we always initialized 'active' and if it is not the first key and retired is set, set the successor key's active time to the retire time of the predecessor key.

Closes #5004

Merge branch '5004-cid-510858-ksr-check-keys' into 'main'

See merge request isc-projects/bind9!9687
2024-10-25 11:20:03 +00:00
Matthijs Mekking e777efb576 Fix CID 510858: Null ptr derefs in check_keys
Coverity Scan reported a new issue for the ksr system test. There
is allegedly a null pointer dereference (FORWARD_NULL) in check_keys().

This popped up because previously we set 'retired' to 0 in case of
unlimited lifetime, but we changed it to None.

It is actually a false positive, because if lifetime is unlimited
there will be only one key in 'keys'.

However, the code would be better if we always initialized 'active'
and if it is not the first key and retired is set, set the successor
key's active time to the retire time of the predecessor key.
2024-10-25 11:19:50 +00:00
Matthijs Mekking 81667b13c7 fix: test: Fix intermittent ksr test failure
A test may fail if the key id is shorter than 5 digits. Add a leading space to the expected strings which start with the key tag to avoid the issue.

Closes #5002

Merge branch '5002-unexpected-match-ksr-twotwone' into 'main'

See merge request isc-projects/bind9!9688
2024-10-25 07:43:28 +00:00
Matthijs Mekking d5f32f6990 Fix intermittent ksr test failure
The test_ksr_twotwone may fail if the key id is shorter than 5 digits.
Add a leading space to the expected strings which start with the key
tag to avoid the issue.
2024-10-24 14:30:51 +02:00
Nicki Křížek ac8db8041b fix: test: Make system tests compatible with pytest 8.0.0+
Make system tests symlinks and logged test names consistent across pytest versions.

Merge branch 'nicki/pytest-v8-compat' into 'main'

See merge request isc-projects/bind9!9071
2024-10-24 11:53:54 +00:00
Nicki Křížek 6262d002bf Add legacy.run.sh to .gitignore
While this file is no longer created / used in the main branch, it may
linger around when switching from maintenance branches.
2024-10-24 13:13:13 +02:00
Nicki Křížek 7118cbed98 Make system tests compatible with pytest 8.0.0+
The pytest collection mechanism has been overhauled in pytest 8.0.0,
resulting in a different node tree when collecting the tests. Ensure the
paths / names we're using that are derived from the node tree are
consistent across different pytest versions.

Particularly, this has affected the convenience symlink name (which is
supposed to be in the form of e.g. dns64_sh_dns64 for the dns64 module
and tests_sh_dns64.py module) and the test name that's logged at the
start of the test, which is supposed to include the system test
directory relative to the root system test directory as well as the
module name (e.g. dns64/tests_sh_dns64.py).

Related https://github.com/pytest-dev/pytest/issues/7777
2024-10-24 13:13:13 +02:00
Mark Andrews 4c882e4c0b fix: usr: Use TLS for notifies if configured to do so
Notifies configured to use TLS will now be sent over TLS, instead of plaintext UDP or TCP.
Also, failing to load the TLS configuration for notify now also results in an error.

Closes #4821

Merge branch '4821-notify-over-tls' into 'main'

See merge request isc-projects/bind9!9407
2024-10-24 03:10:38 +00:00
Timo EisenmannandMark Andrews bbdc6b26aa Use correct certificates for TLS notify tests
Use tls-forward-secrecy instead of tls-expired for tls-x2 and regenerate
the expired certificate for tls-x6 to reflect the swap of ns2 and ns3.
2024-10-24 13:39:59 +11:00
Mark Andrews 87e287c984 swap ns2 and ns3 rolls in tls notify tests
Still need to regenerate the expired certificate as it has
the wrong IP address
2024-10-24 13:39:59 +11:00
Timo EisenmannandMark Andrews e00beca8c5 Add system tests for notify over TLS
We use ns2 as the primary, and ns3 as the secondary server.
2024-10-24 12:55:01 +11:00
Timo EisenmannandMark Andrews e9d54d798f Use TLS for notifies if configured to do so 2024-10-24 12:55:01 +11:00
Mark Andrews a7df51b706 fix: dev: Transport needs to be a selector when looking for an existing dispatch
This allows for dispatch to use existing TCP/HTTPS/TLS etc. streams without accidentally using an unexpected transport.

Closes #4989

Merge branch '4989-fix-transport-use-with-dispatch' into 'main'

See merge request isc-projects/bind9!9633
2024-10-24 01:20:51 +00:00
Mark Andrews baab8a5d75 Fix TCP dispatches and transport
Dispatch needs to know the transport that is being used over the
TCP connection to correctly allow for it to be reused.  Add a
transport parameter to dns_dispatch_createtcp and dns_dispatch_gettcp
and use it when selecting a TCP socket for reuse.
2024-10-24 11:41:18 +11:00
Evan Hunt e1588022c1 new: usr: Implement RFC 9567: EDNS Report-Channel option
Add new `send-report-channel` and `log-report-channel` options. `send-report-channel` specifies an agent domain, to which error reports can be sent by querying a specially constructed name within the agent domain. EDNS Report-Channel options will be added to outgoing authoritative responses, to inform clients where to send such queries in the event of a problem.

If a zone is configured which matches the agent domain and has `log-report-channel` set to `yes`, error-reporting queries will be logged at level `info` to the `dns-reporting-agent` logging channel.

Closes #3659

Merge branch '3659-implement-draft-ietf-dnsop-dns-error-reporting' into 'main'

See merge request isc-projects/bind9!7036
2024-10-23 21:29:55 +00:00
Evan Hunt c6698322c6 suppress report-channel for zones above the agent-domain
RFC 9567 section 8.1 specifies that the agent domain cannot
be a subdomain of the domain it is reporting on. therefore,
in addition to making it illegal to configure that at the
zone level, we also need to disable send-report-channel for
any zone for which the global send-report-channel value is
a subdomain.

we also now warn if send-report-channel is configured
globally to a zone that we host, but that zone doesn't
have log-report-channel set.
2024-10-23 21:29:32 +00:00
Evan Hunt 5bcccf4754 expand validity checks for send-report-channel
when configured at the zone level, send-report-channel cannot be
a subdomain of the zone name.
2024-10-23 21:29:32 +00:00
Evan Hunt 1cd0d291d3 enforce '*._er' requirement for error-reporting zones
if "log-report-channel" is set to "yes", then the zone must
contain a wildcard name matching '*._er' with a TXT record.
2024-10-23 21:29:32 +00:00
Evan Hunt d60324891c set up logging functionality using log-report-channel
the logging of error-report queries is no longer activated by
the view's "send-report-channel" option; that now only configures
the agent-domain value that is to be sent in authoritative
responses. the warning that was logged when "send-agent-domain"
was set to a value that is not a locally configured zone has
been removed.

error-report logging is now activated by the presence of an
authoritative zone with the "log-report-channel" option set to
"yes".  this is not permitted in the root zone.

NOTE: a zone with "log-report-channel yes;" should contain a
"*._er" wildcard, but that requirement is not yet enforced.
2024-10-23 21:29:32 +00:00
Evan Hunt 5519dd2669 add log-report-channel zone option
add a boolean "log-report-channel" option for primary and
secondary zones, which sets the DNS_ZONEOPT_LOGREPORTS zone
flag. this option is not yet functional.
2024-10-23 21:29:32 +00:00
Mark AndrewsandEvan Hunt c676fd2566 Allow send-report-channel to be set at the zone level
If send-report-channel is set at the zone level, it will
be stored in the zone object and used instead of the
view-level agent-domain when constructing the EDNS
Report-Channel option.
2024-10-23 21:29:32 +00:00
Mark AndrewsandEvan Hunt ac1c60d87e Add send-report-channel option
This commit adds support for the EDNS Report-Channel option,
which is returned in authoritative responses when EDNS is in use.

"send-report-channel" sets the Agent-Domain value that will be
included in EDNS Report-Channel options.  This is configurable at
the options/view level; the value is a DNS name. Setting the
Agent-Domain to the root zone (".") disables the option.

When this value has been set, incoming queries matchng the form
_er.<qtype>.<qname>.<extended-error-code>._er.<agent-domain>/TXT
will be logged to the dns-reporting-agent channel at INFO level.

(Note: error reporting queries will only be accepted if sent via
TCP or with a good server cookie.  If neither is present, named
returns BADCOOKIE to complete the DNS COOKIE handshake, or TC=1
to switch the client to TCP.)
2024-10-23 21:29:32 +00:00
Mark Andrews 80f611afe6 new: usr: Add detailed debugging of update-policy rule matching
This logs how named determines if an update request is granted or denied when using update-policy.

Closes #4751

Merge branch '4751-provide-debug-level-logging-of-update-policy' into 'main'

See merge request isc-projects/bind9!9074
2024-10-23 20:29:11 +00:00
Mark Andrews 0d65af8bf2 Check update-policy logs 2024-10-23 10:48:43 +11:00
Mark Andrews b7a13cf2c1 Add per rule logging of dns_ssutable_checkrules processing
These are logged to the update category at debug level 99 and
have the following form.

    update-policy: using: signer=ddns-key.example.nil, name=updated.example.nil, addr=10.53.0.1, tcp=0, type=A, target=
    update-policy: trying: grant zonesub-key.example.nil zonesub TXT
    update-policy: next rule: signer does not match identity
    update-policy: trying: grant ddns-key.example.nil zonesub ANY
    update-policy: matched: grant ddns-key.example.nil zonesub ANY

or

    update-policy: using: signer=restricted.example.nil, name=example.nil, addr=10.53.0.1, tcp=0, type=TXT, target=
    update-policy: trying: grant zonesub-key.example.nil zonesub TXT
    update-policy: next rule: signer does not match identity
    update-policy: trying: grant ddns-key.example.nil zonesub ANY
    update-policy: next rule: signer does not match identity
    update-policy: trying: grant restricted.example.nil zonesub ANY
    update-policy: next rule: name/subdomain mismatch
    update-policy: no match found

where 'using:' is the calling parameters of dns_ssutable_checkrules,
'trying:' in the rule bing evaluated, "next rule:" is the reason
the rule does not match, "matched:" repeats the matched rule, and
no match found is reported when te set of rules is exhausted.
2024-10-23 08:35:08 +11:00
Mark Andrews d282e5a66e Add log category update-policy 2024-10-23 08:30:59 +11:00
Nicki Křížek de8d94f938 fix: test: Use UTC timezone when handling keys in kasp test library
When working with key timestamps, ensure we correctly set the UTC
timezone in order for the tests to work consistently regardless of the
local time setting.

Closes #4999

Merge branch '4999-pytest-kasp-use-utc-timezone' into 'main'

See merge request isc-projects/bind9!9673
2024-10-22 08:20:25 +00:00
Nicki Křížek 46810be809 Set TZ to Australia/Sydney for bookworm CI job
Use a different timezone via the TZ variable in at least one of the
system test jobs in order to detect possible issues with timezone
handling in python.
2024-10-22 09:17:19 +02:00
Nicki Křížek f840deba33 Use UTC timezone when handling keys in kasp test library
When working with key timestamps, ensure we correctly set the UTC
timezone in order for the tests to work consistently regardless of the
local time setting.
2024-10-22 09:17:19 +02:00
Mark Andrews 6ea2ac5f94 fix: usr: Parsing of hostnames in rndc.conf was broken
When DSCP support was removed, parsing of hostnames in rndc.conf was accidentally broken, resulting in an assertion failure.  This has been fixed.

Closes #4991

Merge branch '4991-rndc-fix-parsing-hostnames' into 'main'

See merge request isc-projects/bind9!9669
2024-10-22 00:11:39 +00:00
Mark Andrews 5a78f6b21b Add regression test for [GL #4991] 2024-10-22 10:34:12 +11:00
Mark Andrews 6c095f89f5 Fix parsing of hostnames in rndc.conf
When DSCP was removed the parsing of hostnames was accidentally
broken resulting in an assertion failure.  Call cfg_parse_tuple
rather than using custom code in parse_sockaddrnameport.
2024-10-22 10:30:07 +11:00
Michal Nowak 7c2aafe03f chg: test: Rewrite verify system test to pytest
Merge branch 'mnowak/pytest_rewrite_verify' into 'main'

See merge request isc-projects/bind9!9249
2024-10-21 11:59:00 +00:00
Michal Nowak 091968f5fa Rewrite verify system test to pytest 2024-10-21 11:58:35 +00:00
Nicki Křížek b8aa6e7c54 chg: doc: Review BIND ARM (9.20 updates)
Forward-port of !9508

Closes #4945

Merge branch '4945-bind-arm-review-9.20-updates' into 'main'

See merge request isc-projects/bind9!9668
2024-10-21 11:50:39 +00:00
Suzanne GoldlustandNicki Křížek d645014232 Review and update ARM documentation
Minor edits and fixes for the documentation added from 9.18.28 through
9.20.0.

(cherry picked from commit 998c61c1cf)
2024-10-21 12:55:14 +02:00
Michal Nowak e122d9428c chg: test: xfail upforwd system test if DNSTAP is enabled
See isc-projects/bind9#4996

Merge branch 'mnowak/mark-upforwd-xfail' into 'main'

See merge request isc-projects/bind9!9662
2024-10-21 10:52:26 +00:00
Michal Nowak 0579e0a429 xfail upforwd system test if DNSTAP is enabled 2024-10-21 12:04:56 +02:00
Michal Nowak a8b70abca1 Add with_dnstap mark 2024-10-21 12:04:56 +02:00
Michal Nowak 64fafba6b9 fix: doc: All footnotes need to have unique name and be referenced
With Sphinx 8.1.0, footnotes can't stand on their own and have to be
referenced from somewhere, otherwise build fails, e.g.:

    doc/dnssec-guide/signing.rst:1470: WARNING: Footnote [#] is not referenced. [ref.footnote]

Merge branch 'mnowak/fix-dnssec-guide-footnote' into 'main'

See merge request isc-projects/bind9!9663
2024-10-21 07:23:10 +00:00
Michal Nowak bdf8859e2d All footnotes need to have unique name and be referenced
With Sphinx 8.1.0, footnotes can't stand on their own and have to be
referenced from somewhere, otherwise build fails, e.g.:

    doc/dnssec-guide/signing.rst:1470: WARNING: Footnote [#] is not referenced. [ref.footnote]
2024-10-21 07:22:36 +00:00
Evan Hunt 923b915797 fix: nil: corrected code style errors
- add missing brackets around one-line statements
- add paretheses around return values

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

See merge request isc-projects/bind9!9664
2024-10-18 19:31:40 +00:00
Evan Hunt 5ea1f6390d corrected code style errors
- add missing brackets around one-line statements
- add paretheses around return values
2024-10-18 19:31:27 +00:00
Mark Andrews 8467449407 fix: usr: Restore values when dig prints command line
Options of the form `[+-]option=<value>` failed to display the value on the printed command line. This has been fixed.

Closes #4993

Merge branch '4993-dig-restore-command-line-values' into 'main'

See merge request isc-projects/bind9!9653
2024-10-18 02:09:38 +00:00
Mark Andrews df5b4ba894 Correctly get final token 2024-10-18 01:24:32 +00:00
Mark Andrews 609d96aa12 Restore seperator values
strtok_r is destructive.  Restore the seperators so that the command
line can be properly displayed.
2024-10-18 01:24:32 +00:00
Aydın Mercan 54c5a8e962 fix: import missing definitions for fips builds
FIPS build of libisc failed from some missing definitions.

Closes #4994

Merge branch '4994-crypto-c-174-7-error-implicit-declaration-of-function-isc_fips_mode' into 'main'

See merge request isc-projects/bind9!9655
2024-10-17 14:54:52 +00:00
Aydın Mercan 0b0f05215c include missing definitions for fips builds 2024-10-17 15:28:31 +03:00
Michal Nowak 84316dcf47 chg: doc: Read the Docs should always source requirements.txt from "main"
HTTP URI of doc/arm/requirements.txt on the "main" branch is the source
of PyPI packages in CI base image. To make it consistent in all
maintained CI branches on RTD, use the HTTP URI as well.

This change is non-material on the "main" branch, but ensures the right
packages on stable branches where for RTD we currently leverage outdated
packages because we failed to update doc/arm/requirements.txt there.

Merge branch 'mnowak/rtd-always-resource-requirements-txt-from-main' into 'main'

See merge request isc-projects/bind9!9630
2024-10-17 10:47:11 +00:00
Michal Nowak 8fb6115492 Read the Docs should always source requirements.txt from "main"
HTTP URI of doc/arm/requirements.txt on the "main" branch is the source
of PyPI packages in CI base image. To make it consistent in all
maintained CI branches on RTD, use the HTTP URI as well.

This change is non-material on the "main" branch, but ensures the right
packages on stable branches where for RTD we currently leverage outdated
packages because we failed to update doc/arm/requirements.txt there.
2024-10-17 12:11:08 +02:00
Michal Nowak fc324043c6 chg: doc: Update Sphinx, docutils, and sphinx_rtd_theme packages
Merge branch 'mnowak/doc-tools-october-2024-updates' into 'main'

See merge request isc-projects/bind9!9652
2024-10-17 10:08:55 +00:00
Michal Nowak 54410e034f Add RFCs referenced by footnotes
With Sphinx 8.1.0, footnotes can't stand on their own and have
referenced from somewhere:

    /builds/isc-projects/bind9/doc/arm/general.rst:439: WARNING: Footnote [#] is not referenced. [ref.footnote]
    /builds/isc-projects/bind9/doc/arm/general.rst:441: WARNING: Footnote [#] is not referenced. [ref.footnote]
    /builds/isc-projects/bind9/doc/arm/general.rst:445: WARNING: Footnote [#] is not referenced. [ref.footnote]
    /builds/isc-projects/bind9/doc/arm/general.rst:457: WARNING: Footnote [#] is not referenced. [ref.footnote]
2024-10-17 12:07:55 +02:00
Michal Nowak 755dd44ec5 Update Sphinx, docutils, and sphinx_rtd_theme packages 2024-10-17 11:43:56 +02:00
Nicki Křížek 2e277cc70e chg: test: Disable too-many/too-few pylint checks
Merge branch 'nicki/pylint-disable-too-few-too-many-checks' into 'main'

See merge request isc-projects/bind9!9626
2024-10-17 09:11:26 +00:00
Nicki Křížek 7639c58c48 Disable too-many/too-few pylint checks
Enforcing pylint standards and default for our test code seems
counter-productive. Since most of the newly added code are tests or is
test-related, encountering these checks rarely make us refactor the code
in other ways and we just disable these checks individually. Code that
is too complex or convoluted will be pointed out in reviews anyways.
2024-10-17 11:01:44 +02:00
Mark Andrews d7fab54393 fix: usr: 'Recursive-clients 0;' triggers an assertion
BIND 9.20.0 broke `recursive-clients 0;`.  This has now been fixed.

Closes #4987

Merge branch '4987-fix-recursive-clients-0' into 'main'

See merge request isc-projects/bind9!9621
2024-10-17 06:43:25 +00:00
Mark Andrews 677abded6b Add regression test for [GL #4987] 2024-10-17 11:04:32 +11:00
Mark Andrews 840eaa628d Fix recursive-clients 0
Setting recursive-clients 0 triggered an assertion in isc_quota_soft.
This has now been fixed.
2024-10-17 11:04:26 +11:00
Michal Nowak b98f82b94f Merge tag 'v9.21.2' 2024-10-16 17:49:36 +02:00
Matthijs Mekking 6dca5a0ced chg: test: Rewrite ksr system test to pytest
Merge branch 'matthijs-pytest-rewrite-ksr' into 'main'

See merge request isc-projects/bind9!9445
2024-10-16 15:45:18 +00:00
Matthijs Mekking b8b3df0676 Retry dnssec-verify in kasp test code
It is possible that the zone is not yet fully signed because it is
signed in batches. Retry the AXFR and verify command a couple of times.
2024-10-16 17:16:02 +02:00
Nicki KřížekandMatthijs Mekking 3c6124a093 Address pylint issues 2024-10-16 17:16:02 +02:00
Nicki KřížekandMatthijs Mekking b7207fa3e7 Use difflib rather than diff cmd 2024-10-16 17:16:02 +02:00
Nicki KřížekandMatthijs Mekking c9ecd2a618 Move algorithm defaults to check_keys() 2024-10-16 17:16:02 +02:00
Nicki KřížekandMatthijs Mekking 55ec9f94bc Use f-strings 2024-10-16 17:16:02 +02:00
Nicki KřížekandMatthijs Mekking 732a959d9a Simplify command invocation 2024-10-16 17:16:02 +02:00
Nicki KřížekandMatthijs Mekking b5633462bf Remove unused isctest/kasp code 2024-10-16 17:16:02 +02:00
Nicki KřížekandMatthijs Mekking 67957d1f54 Rename kasp function to check_*
If a function is expected to assert / raise on failure (rather than
return boolean), its name should start with "check_".
2024-10-16 17:16:02 +02:00
Nicki KřížekandMatthijs Mekking 2b0a8fcfb5 Use convenience wrappers for kasp key operations 2024-10-16 17:16:02 +02:00
Matthijs Mekking a15bf6704b Convert ksr system test to pytest
Move all test cases from tests.sh to tests_ksr.py. The only test that
is not moved is the check that key id's match expected keys. The
shell-based system test checks two earlier set environment variables
against each other that has become redundant in the pytest variant,
because we now check the signed key response against a list of keys
and for each key we take into account the timing metadata. So we
already ensure that each published key is in the correct key bundle.
2024-10-16 17:16:02 +02:00
Matthijs Mekking a3829990fd Introduce pytest kasp library
Write initial pytest kasp library. This contains everything that is
required for testing Offline KSK functionality with pytest.

This includes:
- addtime: adding a value to a timing metadata
- get_timing_metdata: retrieve timing metadata from keyfile
- get_metadata/get_keystate: retrieve metadata from statefile
- get_keytag: retrieve keytag from base keyfile string
- get_keyrole: get key role from statefile
- dnskey_equals: compare DNSKEY record from file against a string
- cds_equals: compare CDS derived from file against a string
- zone_is_signed: wait until a zone is completely signed
- dnssec_verify: verify a DNSSEC signed zone with dnssec-verify
- check_dnssecstatus: check rndc dnssec -status output
- check_signatures: check that signatures for a given RRset are correct
- check_dnskeys: check that the published DNSKEY RRset is correct
- check_cds: check that the published CDS RRset is correct
- check_apex: check SOA, DNSKEY, CDNSKEY, and CDS RRset
- check_subdomain: check an RRset below the apex
2024-10-16 17:16:02 +02:00
Matthijs Mekking ea1fc5c47b Change dnssec-ksr key sorting
Sort keys on algorithm, then keytag. This is more convenient for
testing.
2024-10-16 17:16:02 +02:00
Aydın Mercan 94e5061151 chg: dev: unify explicit fetching and libcrypto handling
Unify libcrypto initialization and explicit digest fetching in a single place.

It will remove the remaining implicit fetching and deduplicate explicit
fetching inside the codebase. Initialization has been moved in to ensure
OpenSSL cleanup is done only after fetched contextes are destroyed.

Merge branch 'aydin/libdns-explicit-fetch' into 'main'

See merge request isc-projects/bind9!9288
2024-10-16 12:53:31 +00:00
Aydın Mercan 05798b31ff unify libcrypto and evp_md handling
Unify libcrypto initialization and explicit digest fetching in a single
place and move relevant code to the isc__crypto namespace instead of
isc__tls.

It will remove the remaining implicit fetching and deduplicate explicit
fetching inside the codebase.
2024-10-16 14:03:14 +03:00
Mark Andrews a1fed2d8e7 rem: dev: Remove unused <openssl/hmac.h> headers from OpenSSL shims
The <openssl/hmac.h> header was unused and including the
header might cause build failure when OpenSSL doesn't have
Engines support enabled.

See https://fedoraproject.org/wiki/Changes/OpensslDeprecateEngine

Removes unused hmac includes after Remove OpenSSL Engine support
(commit ef7aba70) removed engine support.

Merge branch 'main-openssl-engine' into 'main'

See merge request isc-projects/bind9!9228
2024-10-16 04:54:09 +00:00
Petr MenšíkandMark Andrews 9e55ffaf89 Remove unused <openssl/hmac.h> headers from OpenSSL shims
The <openssl/hmac.h> header was unused and including the
header might cause build failure when OpenSSL doesn't have
Engines support enabled.

See https://fedoraproject.org/wiki/Changes/OpensslDeprecateEngine

Removes unused hmac includes after Remove OpenSSL Engine support
(commit ef7aba7072) removed engine
support.
2024-10-16 04:19:16 +00:00
Michal Nowak 81bcc19265 chg: test: Remove unused sbytes, stime, n, response, and rtime variables
Merge branch 'mnowak/drop-unused-variables' into 'main'

See merge request isc-projects/bind9!9617
2024-10-15 17:53:46 +00:00
Michal Nowak c0246ecef6 Add vulture 2024-10-15 17:38:03 +00:00
Michal Nowak 4857da271d Remove unused sbytes, stime, n, response, and rtime variables 2024-10-15 17:38:03 +00:00
Michal Nowak a8383e5785 chg: test: Rewrite tools system test to pytest
Merge branch 'mnowak/pytest_rewrite_tools' into 'main'

See merge request isc-projects/bind9!9208
2024-10-15 17:19:09 +00:00
Michal Nowak 3f8e59330d Rewrite tools system test to pytest 2024-10-15 18:35:47 +02:00
Nicki Křížek 33380d7a50 chg: ci: Allow re-try of unit tests on FreeBSD 14
The unit test doh_test tends do fail quite often due to exceeding run
time limit in the unit:clang:freebsd14:amd64 job. Use a retry on gitlab
level to alleviate the issue until a better fix is available.

Related #4924

Merge branch '4924-retry-doh_test-freebsd14' into 'main'

See merge request isc-projects/bind9!9578
2024-10-15 11:14:02 +00:00
Nicki Křížek 1636864ddb Allow re-try of unit tests on FreeBSD 14
The unit test doh_test tends do fail quite often due to exceeding run
time limit in the unit:clang:freebsd14:amd64 job. Use a retry on gitlab
level to alleviate the issue until a better fix is available.
2024-10-15 12:39:18 +02:00
Nicki Křížek 66c52a92c5 chg: test: Support dnspython 2.7.0
Closes #4988

Merge branch '4988-dnspython-2.7.0-support' into 'main'

See merge request isc-projects/bind9!9634
2024-10-15 10:27:08 +00:00
Nicki Křížek 0d90b13646 Support dnspython 2.7.0
CookieOption with new .server/.client attributes (rather than .data) was
added to dnspython. Adjust the code to use the new attributes if
available and fall back to the old code for dnspython<2.7.0
compatibility.
2024-10-15 10:03:25 +02:00
Mark Andrews a33528fe99 fix: usr: Fix NSEC3 closest encloser lookup for names with empty non-terminals
The performance improvement for finding the NSEC3 closest encloser when generating authoritative responses could cause servers to return incorrect NSEC3 records in some cases. This has been fixed.

Closes #4950

Merge branch '4950-bind-logs-expected-covering-nsec3-got-an-exact-match' into 'main'

See merge request isc-projects/bind9!9610
2024-10-14 23:54:27 +00:00
Mark Andrews b457f64d4a Test that the correct NSEC3 closest encloser is returned 2024-10-14 23:19:34 +00:00
Mark Andrews 67f31c5046 Use a binary search to find the NSEC3 closest encloser
maxlabels is the suffix length that corresponds to the latest
NXDOMAIN response.  minlabels is the suffix length that corresponds
to longest found existing name.
2024-10-14 23:19:34 +00:00
Evan Hunt 87ec2ce498 fix: usr: Report client transport in 'rndc recursing'
When `rndc recursing` is used to dump the list of recursing clients, it now indicates whether a query was sent via UDP, TCP, TLS, or HTTP.

Closes #4971

Merge branch '4971-recursing-show-client-transport' into 'main'

See merge request isc-projects/bind9!9590
2024-10-14 21:16:27 +00:00
Evan Hunt 3ad82a4721 add a unit test for dns_transport_totext()
confirm that the text returned by the dns_transport_totext()
function matches the transport type when it was created.
2024-10-14 12:59:52 -07:00
Evan Hunt 74f53a0032 check 'rndc recursing'
there was no system test that exercised 'rndc recursing'; a
simple one has now been added; it confirms that the number of
recursing clients reported by 'rndc stats' is in agreement with
the list returned by 'rndc recursing'.
2024-10-14 12:59:52 -07:00
Evan Hunt 8104ffda0e report client transport in 'rndc recursing'
when dumping the list of recursing clients, indicate whether
a given query was sent over UDP, TCP, TLS, or HTTP.
2024-10-14 12:59:52 -07:00
Michal Nowak 26ed03c247 fix: test: Always use requirements.txt from main
Merge branch 'mnowak/update-util-release-tarball-comparison-sh' into 'main'

See merge request isc-projects/bind9!9603
2024-10-14 18:07:32 +00:00
Michal Nowak 0dd154648e Add libjson-c-dev before #4960 is addressed
Otherwise the "statistics-channels" option in doc/misc/options and
doc/man/named.conf.5in is marked as "not configured" (contrary to what
we have in release tarballs as they were build on a different image that
has libjson-c and libxml2 in it).

Caused by #4895 that made the option dependant on libjson-c or libxml2
presence in the build image.
2024-10-14 18:52:45 +02:00
Michal Nowak b926488de8 Always use requirements.txt from main
Instances of the requirements.txt file may be outdated in other
branches.
2024-10-14 18:52:45 +02:00
Michal Nowak 83357e4d3c Drop BIND 9.16 support 2024-10-14 18:52:45 +02:00
Nicki Křížek 0129ce1477 chg: ci: Increase shotgun pipeline timeout
When running shotgun tests on tagged releases, the increased number of
jobs may cause the shotgun pipeline to take longer than 50 minutes to
finish.

Merge branch 'nicki/increase-shotgun-pipeline-timeout' into 'main'

See merge request isc-projects/bind9!9599
2024-10-14 11:02:06 +00:00
Nicki Křížek 3b227e1161 Increase shotgun pipeline timeout
When running shotgun tests on tagged releases, the increased number of
jobs may cause the shotgun pipeline to take longer than 50 minutes to
finish.
2024-10-14 10:41:39 +02:00
Matthijs Mekking 7a416693bb chg: usr: Harden key management when key files have become unavailabe
Prior to doing key management, BIND 9 will check if the key files on disk match the expected keys. If key files for previously observed keys have become unavailable, this will prevent the internal key manager from running.

Merge branch '4763-do-not-roll-if-key-files-are-missing' into 'main'

See merge request isc-projects/bind9!9337
2024-10-14 07:15:41 +00:00
Matthijs Mekking 351c066d91 Add new behavior to the ARM
Add text to the ARM that describes what we do in case key files have
become unavailable.
2024-10-11 17:42:01 +02:00
Matthijs Mekking 5f552293d7 Test removing DNSKEYs from other providers
In a multi-signer setup, removing DNSKEY records from the zone should
not be treated as a key that previously exists in the keyring, thus
blocking the keymgr. Add a test case to make sure.
2024-10-11 17:42:01 +02:00
Matthijs Mekking af54e3dadc Small keymgr improvement
When a key is to be purged, don't run the key state machinery for it.
2024-10-11 17:42:01 +02:00
Matthijs Mekking a2317425bc Add additional test case with purged key
Test that if a key to be purged is in the keyring, it does not
prevent the keymgr from running. Normally a key that is in the keyring
should be available again on the next run, but that is not true for
a key that can be purged.

In addition, fix some wait_for_log calls, by adding the missing
'|| ret=1' parts.
2024-10-11 17:42:01 +02:00
Matthijs Mekking d1e263ef13 Fix some system test cases
Some test cases were working but for the wrong reasons. These started
to fail when I implemented the first approach for #4763, where the
existence of a DNSKEY together with an empty keyring is suspicious and
would prevent the keymgr from running.

These are:

1. kasp: The multisigner-model2.kasp zone has ZSKs from other providers
   in the zone, but not yet its own keys. Pregenerate signing keys and
   add them to the unsigned zone as well.

2. kasp: The dynamic-signed-inline-signing.kasp zone has a key generated
   and added in the raw version of the zone. But the key file is stored
   outside the key-directory for the given zone. Add '-K keys' to the
   dnssec-keygen command.
2024-10-11 17:42:01 +02:00
Matthijs Mekking 5fdad05a8a Verify new key files before running keymgr
Prior to running the keymgr, first make sure that existing keys
are present in the new keylist. If not, treat this as an operational
error where the keys are made offline (temporarily), possibly unwanted.
2024-10-11 17:42:00 +02:00
Matthijs Mekking a3afbd9d6f Add test for missing key files, don't roll
In this specific case the key files are temporary unavailable, for
example because of an operator error, or a mount failure). In such
cases, BIND should not try to roll over these keys.
2024-10-11 16:27:50 +02:00
Artem Boldariev 0699cb9726 fix: dig - always set the default port when doing a UDP query
This commit ensures that the port is set before attempting a UDP
query. Before that a situation could appear when previous query have
completed over a different transport (that uses a dedicated port) and
then a UDP query will be attempted over the port of the previous
transport.

Closes: #4984.

Merge branch 'artem-debian-bug-1059582' into 'main'

See merge request isc-projects/bind9!9618
2024-10-10 19:05:54 +00:00
Artem Boldariev e390ed4421 dig: always set the default port when doing a UDP query
This commit ensures that the port is set before attempting a UDP
query. Before that a situation could appear when previous query have
completed over a different transport (that uses a dedicated port) and
then a UDP query will be attempted over the port of the previous
transport.
2024-10-10 21:19:50 +03:00
Matthijs Mekking 3bdd704d6f chg: doc: Add release note for #4460
This release note was missing due to a malformed Merge Request title.

The text is not copied verbatim, but changed to something more release
note-like.

Merge branch '4460-add-missing-release-note' into 'main'

See merge request isc-projects/bind9!9598
2024-10-10 10:22:57 +00:00
Matthijs Mekking 5860bafc60 Add release note for #4460
This release note was missing due to a malformed Merge Request title.

The text is not copied verbatim, but changed to something more release
note-like.
2024-10-10 10:22:48 +00:00
Matthijs Mekking 3a321ec661 fix: dev: Revert "Improve performance when looking for the closest encloser"
Revert "fix: chg: Improve performance when looking for the closest encloser when returning NSEC3 proofs"

This reverts merge request !9436

Closes #4950

Merge branch 'revert-78d48f7a' into 'main'

See merge request isc-projects/bind9!9611
2024-10-10 09:27:29 +00:00
Matthijs Mekking 0396bf98ee Revert "fix: chg: Improve performance when looking for the closest encloser when returning NSEC3 proofs"
This reverts merge request !9436
2024-10-10 06:59:28 +00:00
Arаm Sаrgsyаn 508f7007e8 fix: dev: Fix error path bugs in the manager's "recursing-clients" list management
In two places, after linking the client to the manager's
"recursing-clients" list using the check_recursionquota()
function, the query.c module fails to unlink it on error
paths. Fix the bugs by unlinking the client from the list.

Merge branch 'aram/unlink-recursing-clients-on-error-paths' into 'main'

See merge request isc-projects/bind9!9586
2024-10-09 11:38:35 +00:00
Aram Sargsyan 7bd44a4182 Refactor the way check_recursionquota() is used
Rename check_recursionquota() to acquire_recursionquota(), and
implement a new function called release_recursionquota() to
reverse the action. It helps with decreasing code duplication.
2024-10-09 10:31:33 +00:00
Aram Sargsyan 36c4808903 Fix error path bugs in the "recursing-clients" list management
In two places, after linking the client to the manager's
"recursing-clients" list using the check_recursionquota()
function, the query.c module fails to unlink it on error
paths. Fix the bugs by unlinking the client from the list.

Also make sure that unlinking happens before detaching the
client's handle, as it is the logically correct order, e.g.
in case if it's the last handle and ns__client_reset_cb()
can be called because of the detachment.
2024-10-09 10:31:33 +00:00
Arаm Sаrgsyаn 84eac93bfd fix: dev: Fix a data race in dns_zone_getxfrintime()
The dns_zone_getxfrintime() function fails to lock the zone before
accessing its 'xfrintime' structure member, which can cause a data
race between soa_query() and the statistics channel. Add the missing
locking/unlocking pair, like it's done in numerous other similar
functions.

Closes #4976

Merge branch '4976-zone-xfrintime-data-race-fix' into 'main'

See merge request isc-projects/bind9!9591
2024-10-09 10:31:09 +00:00
Aram Sargsyan ab07803465 Fix a data race in dns_zone_getxfrintime()
The dns_zone_getxfrintime() function fails to lock the zone before
accessing its 'xfrintime' structure member, which can cause a data
race between soa_query() and the statistics channel. Add the missing
locking/unlocking pair, like it's done in numerous other similar
functions.
2024-10-09 09:13:04 +00:00
Arаm Sаrgsyаn 617381f115 fix: dev: Clean up 'nodetach' in ns_client
The 'nodetach' member is a leftover from the times when non-zero
'stale-answer-client-timeout' values were supported, and currently
is always 'false'. Clean up the member and its usage.

Merge branch 'aram/cleanup-ns-client-nodetach' into 'main'

See merge request isc-projects/bind9!9592
2024-10-09 09:12:45 +00:00
Aram Sargsyan b8c068835e Clean up 'nodetach' in ns_client
The 'nodetach' member is a leftover from the times when non-zero
'stale-answer-client-timeout' values were supported, and currently
is always 'false'. Clean up the member and its usage.
2024-10-09 08:03:13 +00:00
Michal Nowak 40dc5ae27f chg: doc: Set up version for BIND 9.21.3
Merge branch 'mnowak/set-up-version-for-bind-9.21.3' into 'main'

See merge request isc-projects/bind9!9595
2024-10-08 08:40:41 +00:00
Michal Nowak 63775b2288 Update BIND version to 9.21.3-dev 2024-10-08 10:30:48 +02:00
Michal Nowak 05d1ca8a3b Update BIND version for release 2024-10-07 16:07:08 +02:00
Michal Nowak 4090adbeb7 new: doc: Prepare documentation for BIND 9.21.2
Merge branch 'mnowak/prepare-documentation-for-bind-9.21.2' into 'v9.21.2-release'

See merge request isc-private/bind9!743
2024-10-07 14:05:36 +00:00
Michal Nowak f27abe5d80 Tweak and reword release notes 2024-10-07 14:32:19 +02:00
Michal Nowak 441b5d6a66 Prepare release notes for BIND 9.21.2 2024-10-03 14:16:36 +02:00
Michal Nowak fe241d594a Generate release notes 2024-10-03 14:15:34 +02:00
Michal Nowak 0ff215b64a Generate changelog 2024-10-03 14:15:06 +02:00
Ondřej Surý 27c4d7ef6d fix: dev: Don't enable REUSEADDR on outgoing UDP sockets
The outgoing UDP sockets enabled `SO_REUSEADDR` that allows sharing of the UDP sockets, but with one big caveat - the socket that was opened the last would get all traffic.  The dispatch code would ignore the invalid responses in the dns_dispatch, but this could lead to unexpected results.

Merge branch 'ondrej/fix-outgoing-UDP-port-selection' into 'main'

See merge request isc-projects/bind9!9569
2024-10-02 12:16:03 +00:00
Ondřej Surý eec30c33c2 Don't enable SO_REUSEADDR on outgoing UDP sockets
Currently, the outgoing UDP sockets have enabled
SO_REUSEADDR (SO_REUSEPORT on BSDs) which allows multiple UDP sockets to
bind to the same address+port.  There's one caveat though - only a
single (the last one) socket is going to receive all the incoming
traffic.  This in turn could lead to incoming DNS message matching to
invalid dns_dispatch and getting dropped.

Disable setting the SO_REUSEADDR on the outgoing UDP sockets.  This
needs to be done explicitly because `uv_udp_open()` silently enables the
option on the socket.
2024-10-02 12:15:53 +00:00
Ondřej Surý fe305f96c9 fix: usr: Fix assertion failure when receiving DNS responses over TCP
When matching the received Query ID in the TCP connection,
an invalid received Query ID can very rarely cause assertion
failure.

Closes #4952

Merge branch '4952-check-whether-QID-is-not-deleted' into 'main'

See merge request isc-projects/bind9!9580
2024-10-02 10:41:26 +00:00
Ondřej Surý 4ef316e21e Skip TCP dispatch responses that are not ours
When matching the TCP dispatch responses, we should skip the responses
that do not belong to our TCP connection.  This can happen with faulty
upstream server that sends invalid QID back to us.
2024-10-02 10:41:04 +00:00
Arаm Sаrgsyаn 41f4c620c2 fix: dev: Don't ignore the local port number in dns_dispatch_add() for TCP
The dns_dispatch_add() function registers the 'resp' entry in
'disp->mgr->qids' hash table with 'resp->port' being 0, but in
tcp_recv_success(), when looking up an entry in the hash table
after a successfully received data the port is used, so if the
local port was set (i.e. it was not 0) it fails to find the
entry and results in an unexpected error.

Set the 'resp->port' to the given local port value extracted from
'disp->local'.

Closes #4969

Merge branch '4969-dispatch-tcp-source-port-bug-fix' into 'main'

See merge request isc-projects/bind9!9576
2024-10-02 09:51:40 +00:00
Aram Sargsyan d49a8f518a Don't ignore the local port number in dns_dispatch_add() for TCP
The dns_dispatch_add() function registers the 'resp' entry in
'disp->mgr->qids' hash table with 'resp->port' being 0, but in
tcp_recv_success(), when looking up an entry in the hash table
after a successfully received data the port is used, so if the
local port was set (i.e. it was not 0) it fails to find the
entry and results in an unexpected error.

Set the 'resp->port' to the given local port value extracted from
'disp->local'.
2024-10-02 08:53:44 +00:00
Alessio Podda e618cdddf8 new: usr: Support ISO timestamps with timezone information
The configuration option `print-time` can now be set to `iso8601-tzinfo` in order to use the ISO 8601 timestamp with timezone information when logging. This is used as a default for `named -g`.

Closes #4963

Merge branch '4963-provide-timezone-information-in-log-timestamps' into 'main'

See merge request isc-projects/bind9!9563
2024-10-02 08:16:17 +00:00
Alessio Podda cc167266aa Support ISO timestamps with timezone information
This commit adds support for timestamps in iso8601 format with timezone
when logging. This is exposed through the iso8601-tzinfo printtime
suboption.
It also makes the new logging format the default for -g output,
hopefully removing the need for custom timestamp parsing in scripts.
2024-10-01 15:09:43 +00:00
Michal Nowak 1db4ebd983 chg: test: Replace dns.query module with isctest.query
The `dns.query.udp` and `dns.query.tcp` methods are [prone to timeouts](https://gitlab.isc.org/isc-projects/bind9/-/jobs/4785053); their `isctest.query` equivalents should be used in system tests instead.

Merge branch 'mnowak/convert-dns-query-udp-and-tcp-to-isctest-query' into 'main'

See merge request isc-projects/bind9!9560
2024-10-01 12:05:39 +00:00
Michal Nowak dfec69b4a2 Replace dns.query module with isctest.query 2024-10-01 13:25:56 +02:00
Michal Nowak a2d2d9c0d3 Add isctest.check.notimp() 2024-10-01 13:25:56 +02:00
Michal Nowak 4cb52f072e Report expected and last returned rcode on query timeout
Sometimes it's useful to see what was the server returning that did not
match the expected rcode.
2024-10-01 13:25:56 +02:00
Alessio Podda 474398a5a9 fix: dev: Null clausedefs for ancient options
This commit nulls all type fields for the clausedef lists that are
declared ancient, and removes the corresponding cfg_type_t and parsing
functions when they are found to be unused after the change.

Among others, it removes some leftovers from #1913.

Closes #4962

Merge branch '4962-null-clausedef-types-for-ancient-options' into 'main'

See merge request isc-projects/bind9!9552
2024-10-01 10:33:56 +00:00
alessio bc63758d70 Null clausedefs for ancient options
This commit nulls all type fields for the clausedef lists that are
declared ancient, and removes the corresponding cfg_type_t and parsing
functions when they are found to be unused after the change.
2024-10-01 10:17:04 +02:00
Matthijs Mekking 516b098220 fix: doc: Restore text about sig validity and SOA expire
When `sig-validity-interval` was obsoleted, the text that the signature validity interval should be multiples of the SOA expire interval was removed. Restore this text to the description of the `signatures-validity` option.

Closes #4951

Merge branch '4951-document-signatures-validity-soa-expire' into 'main'

See merge request isc-projects/bind9!9566
2024-10-01 06:32:48 +00:00
Matthijs Mekking 8aa94931c3 Update example.com zone SOA expire value
The example.com zone file given in the "Configurations and Zone Files"
chapter has an SOA expire of 3 weeks, which is not a multiple of
the default signatures-validity value. Adjust the SOA expire so that
it is much lower than the signatures-validity default.
2024-10-01 06:32:28 +00:00
Matthijs Mekking b09230004b Restore text about sig validity and SOA expire
When `sig-validity-interval` was obsoleted, the text that the signature
validity interval should be multiples of the SOA expire interval was
removed. Restore this text to the description of the
`signatures-validity` option.
2024-10-01 06:32:28 +00:00
Mark Andrews 3304e1dc76 fix: usr: Fix a bug in the static-stub implementation
Static-stub addresses and addresses from other sources were being
mixed together, resulting in static-stub queries going to addresses
not specified in the configuration, or alternatively, static-stub
addresses being used instead of the correct server addresses.

Closes #4850

Merge branch '4850-add-an-additional-class-of-names-to-adb' into 'main'

See merge request isc-projects/bind9!9314
2024-10-01 01:26:56 +00:00
Mark Andrews b3a2c790f3 Store static-stub addresses seperately in the adb
Static-stub address and addresses from other sources where being
mixed together resulting in static-stub queries going to addresses
not specified in the configuration or alternatively static-stub
addresses being used instead of the real addresses.
2024-10-01 00:19:13 +00:00
Petr Špaček 4d759a251b rem: dev: Remove unused function dns_zonemgr_resumexfrs()
Merge branch 'pspacek/zone-xfr-cleanup' into 'main'

See merge request isc-projects/bind9!9565
2024-09-30 12:42:22 +00:00
Petr Špaček a0f3b0c5de Remove unused function dns_zonemgr_resumexfrs() 2024-09-30 12:42:08 +00:00
Ondřej Surý b1be0145a5 chg: dev: Use release memory ordering when incrementing reference counter
As the relaxed memory ordering doesn't ensure any memory
synchronization, it is possible that the increment will succeed even
in the case when it should not - there is a race between
atomic_fetch_sub(..., acq_rel) and atomic_fetch_add(..., relaxed).
Only the result is consistent, but the previous value for both calls
could be same when both calls are executed at the same time.

Merge branch 'ondrej/use-release-memory-ordering-for-reference-counting' into 'main'

See merge request isc-projects/bind9!9460
2024-09-30 12:22:05 +00:00
Ondřej Surý 88227ea665 Use release memory ordering when incrementing reference counter
As the relaxed memory ordering doesn't ensure any memory
synchronization, it is possible that the increment will succeed even
in the case when it should not - there is a race between
atomic_fetch_sub(..., acq_rel) and atomic_fetch_add(..., relaxed).
Only the result is consistent, but the previous value for both calls
could be same when both calls are executed at the same time.
2024-09-30 11:03:01 +02:00
1426 changed files with 33570 additions and 55686 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
+128 -331
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"
@@ -363,6 +360,7 @@ stages:
needs:
- job: ci-variables
artifacts: true
timeout: 2h
.system_test_common: &system_test_common
<<: *default_triggering_rules
@@ -378,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
@@ -432,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"
@@ -468,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
@@ -528,6 +530,12 @@ black:
expire_in: "1 week"
when: on_failure
vulture:
<<: *precheck_job
needs: []
script:
- vulture --exclude "*/ans*/ans.py,conftest.py,isctest" --ignore-names "pytestmark" bin/tests/system/
ci-variables:
stage: precheck
<<: *precheck_job
@@ -559,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
@@ -599,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
@@ -619,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/"
@@ -656,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
@@ -715,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:
@@ -737,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)
@@ -880,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
@@ -893,7 +924,9 @@ system:gcc:bookworm:amd64:
<<: *system_test_gcov_job
variables:
CI_ENABLE_ALL_TESTS: 1
needs:
CLEAN_BUILD_ARTIFACTS_ON_SUCCESS: 0
TZ: Australia/Sydney
needs: # using artifacts from unit test job is required for gcov
- job: unit:gcc:bookworm:amd64
artifacts: true
@@ -902,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
@@ -912,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
@@ -920,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:
@@ -1197,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:
@@ -1205,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
@@ -1247,7 +1281,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:
@@ -1255,13 +1289,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
@@ -1270,7 +1304,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
@@ -1336,7 +1370,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
@@ -1414,6 +1447,7 @@ unit:clang:freebsd14:amd64:
needs:
- job: clang:freebsd14:amd64
artifacts: true
retry: 1 # GL #4924
# Jobs for Clang builds on OpenBSD (amd64)
@@ -1446,11 +1480,12 @@ release:
- pushd "${BIND_DIRECTORY}-release"
- mv "../${BIND_DIRECTORY}.tar.xz" .
- tar --extract --file="${BIND_DIRECTORY}.tar.xz"
- mv "${BIND_DIRECTORY}"/{CHANGES*,COPYRIGHT,LICENSE,README.md,srcid} .
- mv "${BIND_DIRECTORY}"/{COPYRIGHT,LICENSE,README.md,srcid} .
- rm -rf "${BIND_DIRECTORY}"
- mv "../doc/arm/_build/html" doc/arm/
- mv "../doc/arm/_build/epub/Bv9ARM.epub" doc/arm/
- echo '<!DOCTYPE HTML><html lang="en"><meta http-equiv="refresh" content="0; url=doc/arm/html/notes.html"><title>Redirect</title></html>' > "RELEASE-NOTES-${BIND_DIRECTORY}.html"
- echo '<!DOCTYPE HTML><html lang="en"><meta http-equiv="refresh" content="0; url=doc/arm/html/changelog.html"><title>Redirect</title></html>' > "CHANGELOG-${BIND_DIRECTORY}.html"
- popd
needs:
- job: tarball-create
@@ -1568,9 +1603,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
@@ -1581,9 +1617,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
@@ -1594,10 +1631,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
@@ -1609,9 +1647,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
@@ -1640,281 +1679,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.
@@ -2005,10 +1802,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:
@@ -2024,6 +1821,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,15 @@ 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_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 +86,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 +103,25 @@ 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_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
+11
View File
@@ -12,6 +12,17 @@ disable=
C0116, # missing-function-docstring
C0209, # consider-using-f-string
C0301, # line-too-long, handled better by black
C0302, # too-many-lines
C0415, # import-outside-toplevel
R0801, # duplicate-code
R0901, # too-many-ancestors
R0902, # too-many-instance-attributes
R0903, # too-few-public-methods
R0904, # too-many-public-methods
R0911, # too-many-return-statements
R0912, # too-many-branches
R0913, # too-many-arguments
R0914, # too-many-locals
R0915, # too-many-statements
R0916, # too-many-boolean-expressions
R0917, # too-many-positional-arguments
+3 -5
View File
@@ -6,6 +6,9 @@ build:
os: ubuntu-22.04
tools:
python: "3.11"
jobs:
pre_build:
- python -m pip install -r https://gitlab.isc.org/isc-projects/bind9/-/raw/main/doc/arm/requirements.txt
# Build documentation in doc/arm/ with Sphinx
sphinx:
@@ -13,8 +16,3 @@ sphinx:
# Build all formats
formats: all
# Explicitly set the version of Python and its requirements
python:
install:
- requirements: doc/arm/requirements.txt
+5 -1
View File
@@ -26,7 +26,6 @@ Files: **/*.after*
.gitlab/*
.mailmap
AUTHORS
CHANGES
COPYRIGHT
Makefile
Makefile.*
@@ -74,6 +73,11 @@ Files: **/*.after*
bin/tests/system/masterfile/knowngood.include
bin/tests/system/masterfile/knowngood.ttl1
bin/tests/system/masterfile/knowngood.ttl2
bin/tests/system/notify/CA/CA.cfg
bin/tests/system/notify/CA/README
bin/tests/system/notify/CA/index.txt
bin/tests/system/notify/CA/index.txt.attr
bin/tests/system/notify/CA/serial
bin/tests/system/notify/ns4/named.port.in
bin/tests/system/nsupdate/CA/CA.cfg
bin/tests/system/nsupdate/CA/README
-1
View File
@@ -1 +0,0 @@
doc/arm/changelog.rst
+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
-1
View File
@@ -21,7 +21,6 @@ EXTRA_DIST = \
util/bindkeys.pl \
util/dtrace.sh \
contrib \
CHANGES \
COPYRIGHT \
LICENSE \
*.md
+1 -1
View File
@@ -163,7 +163,7 @@ Additional information on various subjects can be found in other
#### Bug report identifiers
Most notes in the CHANGES file include a reference to a bug report or
Most notes in the ARM Changelog appendix include a reference to a bug report or
issue number. Prior to 2018, these were usually of the form `[RT #NNN]`
and referred to entries in the "bind9-bugs" RT database, which was not open
to the public. More recent entries use the form `[GL #NNN]` or, less often,
+146 -64
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 */
@@ -575,17 +656,17 @@ load_zone(isc_mem_t *mctx, const char *zonename, const char *filename,
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));
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
+26 -26
View File
@@ -83,10 +83,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 +94,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 +113,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 +122,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 +136,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 +149,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 +221,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 +242,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 +261,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 +279,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 +462,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 +497,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 +507,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 +569,7 @@ load_zones_fromconfig(const cfg_obj_t *config, isc_mem_t *mctx,
}
cleanup:
return (result);
return result;
}
static void
@@ -762,5 +762,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
+14 -2
View File
@@ -159,7 +159,7 @@ main(int argc, char **argv) {
while ((c = isc_commandline_parse(argc, argv,
"c:df:hi:jJ:k:L:l:m:n:qr:s:t:o:vw:C:"
"DF:M:S:T:W:")) != EOF)
"DF:M:R:S:T:W:")) != EOF)
{
switch (c) {
case 'c':
@@ -323,6 +323,18 @@ main(int argc, char **argv) {
}
break;
case 'R':
if (ARGCMP("fail")) {
zone_options |= DNS_ZONEOPT_LOGREPORTS;
} else if (ARGCMP("ignore")) {
zone_options &= ~DNS_ZONEOPT_LOGREPORTS;
} else {
fprintf(stderr, "invalid argument to -R: %s\n",
isc_commandline_argument);
exit(EXIT_FAILURE);
}
break;
case 's':
if (ARGCMP("full")) {
outputstyle = &dns_master_style_full;
@@ -565,5 +577,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;
}
+11 -1
View File
@@ -23,7 +23,7 @@ named-checkzone - zone file validation tool
Synopsis
~~~~~~~~
:program:`named-checkzone` [**-d**] [**-h**] [**-j**] [**-q**] [**-v**] [**-c** class] [**-C** mode] [**-f** format] [**-F** format] [**-J** filename] [**-i** mode] [**-k** mode] [**-m** mode] [**-M** mode] [**-n** mode] [**-l** ttl] [**-L** serial] [**-o** filename] [**-r** mode] [**-s** style] [**-S** mode] [**-t** directory] [**-T** mode] [**-w** directory] [**-D**] [**-W** mode] {zonename} {filename}
:program:`named-checkzone` [**-d**] [**-h**] [**-j**] [**-q**] [**-v**] [**-c** class] [**-C** mode] [**-f** format] [**-F** format] [**-J** filename] [**-i** mode] [**-k** mode] [**-m** mode] [**-M** mode] [**-n** mode] [**-l** ttl] [**-L** serial] [**-o** filename] [**-r** mode] [**-R** mode] [**-s** style] [**-S** mode] [**-t** directory] [**-T** mode] [**-w** directory] [**-D**] [**-W** mode] {zonename} {filename}
Description
~~~~~~~~~~~
@@ -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.
@@ -166,6 +170,12 @@ Options
semantically equal in plain DNS. Possible modes are ``fail``,
``warn`` (the default), and ``ignore``.
.. option:: -R mode
This option checks whether a TXT wildcard record exists that
matches the name format for RFC 9567 error-reporting queries: ``*._er``.
Possible modes are ``fail`` and ``ignore`` (the default).
.. option:: -s style
This option specifies the style of the dumped zone file. Possible styles are
+7 -1
View File
@@ -23,7 +23,7 @@ named-compilezone - zone file converting tool
Synopsis
~~~~~~~~
:program:`named-compilezone` [**-d**] [**-h**] [**-j**] [**-q**] [**-v**] [**-c** class] [**-C** mode] [**-f** format] [**-F** format] [**-J** filename] [**-i** mode] [**-k** mode] [**-m** mode] [**-M** mode] [**-n** mode] [**-l** ttl] [**-L** serial] [**-r** mode] [**-s** style] [**-S** mode] [**-t** directory] [**-T** mode] [**-w** directory] [**-D**] [**-W** mode] {**-o** filename} {zonename} {filename}
:program:`named-compilezone` [**-d**] [**-h**] [**-j**] [**-q**] [**-v**] [**-c** class] [**-C** mode] [**-f** format] [**-F** format] [**-J** filename] [**-i** mode] [**-k** mode] [**-m** mode] [**-M** mode] [**-n** mode] [**-l** ttl] [**-L** serial] [**-r** mode] [**-R** mode] [**-s** style] [**-S** mode] [**-t** directory] [**-T** mode] [**-w** directory] [**-D**] [**-W** mode] {**-o** filename} {zonename} {filename}
Description
~~~~~~~~~~~
@@ -175,6 +175,12 @@ Options
semantically equal in plain DNS. Possible modes are ``fail``,
``warn``, and ``ignore`` (the default).
.. option:: -R mode
This option checks whether a TXT wildcard record exists that
matches the name format for RFC 9567 error-reporting queries: ``*._er``.
Possible modes are ``fail`` and ``ignore`` (the default).
.. option:: -s style
This option specifies the style of the dumped zone file. Possible styles are
-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);
}
+1 -1
View File
@@ -290,5 +290,5 @@ options {\n\
isc_mem_destroy(&mctx);
return (0);
return 0;
}
+1 -1
View File
@@ -296,5 +296,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)
+141 -87
View File
@@ -25,10 +25,17 @@
#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/log.h>
#include <isc/managers.h>
@@ -86,7 +93,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 +139,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 +165,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 +228,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 +578,7 @@ setup_style(void) {
48, 80, 8, splitwidth, mctx);
}
return (result);
return result;
}
static isc_result_t
@@ -587,11 +599,11 @@ convert_name(dns_fixedname_t *fn, dns_name_t **name, const char *text) {
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 +636,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 +644,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 +667,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 +787,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 +799,7 @@ cleanup:
result = ISC_R_FAILURE;
}
return (result);
return result;
}
static isc_result_t
@@ -811,23 +821,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 +869,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 +890,7 @@ cleanup:
delv_log(ISC_LOG_ERROR, "setup_dnsseckeys: %s",
isc_result_totext(result));
}
return (result);
return result;
}
static isc_result_t
@@ -941,7 +937,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 +973,7 @@ cleanup:
isc_result_totext(result));
}
return (result);
return result;
}
static isc_result_t
@@ -1046,7 +1042,7 @@ cleanup:
if (resconf != NULL) {
irs_resconf_destroy(&resconf);
}
return (result);
return result;
}
static isc_result_t
@@ -1059,10 +1055,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 +1119,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 +1145,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 +1391,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 +1435,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 +1457,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 +1474,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 +1511,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 +1529,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 +1571,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 +1589,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 +1616,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 +1785,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 +1800,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 +1829,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 +1845,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 +1932,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 +2093,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 +2137,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 +2174,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 +2197,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 +2307,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
+133 -66
View File
@@ -21,6 +21,7 @@
#include <isc/attributes.h>
#include <isc/dir.h>
#include <isc/fips.h>
#include <isc/loop.h>
#include <isc/netaddr.h>
#include <isc/parseint.h>
@@ -69,6 +70,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 +100,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 +303,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 +486,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 +504,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 +527,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 +551,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 +566,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;
}
/*%
@@ -578,9 +594,9 @@ short_answer(dns_message_t *msg, dns_messagetextflag_t flags, isc_buffer_t *buf,
dns_name_init(&empty_name, NULL);
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 +611,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,11 +622,11 @@ 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
@@ -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
@@ -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;
@@ -1824,9 +1843,12 @@ plus_option(char *option, bool is_batchfile, bool *need_clone,
"specified");
goto exit_or_usage;
}
extra = strtok_r(NULL, "\0",
extra = strtok_r(NULL, "",
&last);
save_opt(lookup, code, extra);
if (extra != NULL) {
extra[-1] = ':';
}
break;
default:
goto invalid_option;
@@ -2380,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;
}
@@ -2555,7 +2581,10 @@ plus_option(char *option, bool is_batchfile, bool *need_clone,
fprintf(stderr, "Invalid option: +%s\n", option);
usage();
}
return (lookup);
if (value != NULL) {
value[-1] = '=';
}
return lookup;
#if !TARGET_OS_IPHONE
exit_or_usage:
@@ -2567,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,
@@ -2601,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':
@@ -2611,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':
@@ -2620,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);
@@ -2651,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];
@@ -2695,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");
@@ -2714,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) {
@@ -2728,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) {
@@ -2747,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) {
@@ -2805,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();
@@ -2814,8 +2846,8 @@ dash_option(char *option, char *next, dig_lookup_t **lookup,
* secret */
usage();
}
if ((ptr3 = strtok_r(NULL, ":", &last)) != NULL) { /* secret or
* NULL */
if ((ptr3 = strtok_r(NULL, "", &last)) != NULL) { /* secret or
* NULL */
parse_hmac(ptr);
ptr = ptr2;
ptr2 = ptr3;
@@ -2826,7 +2858,11 @@ dash_option(char *option, char *next, dig_lookup_t **lookup,
/* XXXONDREJ: FIXME */
strlcpy(keynametext, ptr, sizeof(keynametext));
strlcpy(keysecret, ptr2, sizeof(keysecret));
return (value_from_next);
if (ptr3 != NULL) {
ptr[-1] = ':';
}
ptr2[-1] = ':';
return value_from_next;
case 'x':
if (*need_clone) {
*lookup = clone_lookup(default_lookup, true);
@@ -2856,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;
}
/*%
@@ -2894,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 |
@@ -2957,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
@@ -3418,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
+103 -90
View File
@@ -36,10 +36,10 @@
#endif /* HAVE_LIBIDN2 */
#include <isc/base64.h>
#include <isc/crypto.h>
#include <isc/file.h>
#include <isc/getaddresses.h>
#include <isc/hex.h>
#include <isc/lang.h>
#include <isc/log.h>
#include <isc/loop.h>
#include <isc/managers.h>
@@ -60,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>
@@ -233,7 +234,7 @@ count_dots(char *string) {
}
s++;
}
return (i);
return i;
}
static void
@@ -281,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
@@ -296,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
@@ -325,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.
@@ -341,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;
}
}
@@ -453,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;
}
/*%
@@ -629,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
@@ -757,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;
@@ -820,7 +822,7 @@ clone_lookup(dig_lookup_t *lookold, bool servers) {
looknew->magic = DIG_LOOKUP_MAGIC;
return (looknew);
return looknew;
}
/*%
@@ -850,7 +852,7 @@ 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
@@ -911,20 +913,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
@@ -937,7 +939,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
@@ -1015,7 +1017,7 @@ done:
sa->length = prefix_length;
*sap = sa;
return (ISC_R_SUCCESS);
return ISC_R_SUCCESS;
}
/*
@@ -1091,7 +1093,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);
@@ -1132,7 +1134,7 @@ cleanup:
cfg_parser_destroy(&pctx);
}
return (result);
return result;
}
void
@@ -1202,7 +1204,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
@@ -1376,24 +1378,27 @@ typedef struct dig_ednsoptname {
} dig_ednsoptname_t;
dig_ednsoptname_t optnames[] = {
{ 1, "LLQ" }, /* draft-sekar-dns-llq */
{ 2, "UL" }, /* draft-ietf-dnssd-update-lease */
{ 3, "NSID" }, /* RFC 5001 */
{ 5, "DAU" }, /* RFC 6975 */
{ 6, "DHU" }, /* RFC 6975 */
{ 7, "N3U" }, /* RFC 6975 */
{ 8, "ECS" }, /* RFC 7871 */
{ 9, "EXPIRE" }, /* RFC 7314 */
{ 10, "COOKIE" }, /* RFC 7873 */
{ 11, "KEEPALIVE" }, /* RFC 7828 */
{ 12, "PADDING" }, /* RFC 7830 */
{ 12, "PAD" }, /* shorthand */
{ 13, "CHAIN" }, /* RFC 7901 */
{ 14, "KEY-TAG" }, /* RFC 8145 */
{ 15, "EDE" }, /* ietf-dnsop-extended-error-16 */
{ 16, "CLIENT-TAG" }, /* draft-bellis-dnsop-edns-tags */
{ 17, "SERVER-TAG" }, /* draft-bellis-dnsop-edns-tags */
{ 26946, "DEVICEID" }, /* Brian Hartvigsen */
{ 1, "LLQ" }, /* draft-sekar-dns-llq */
{ 2, "UL" }, /* draft-ietf-dnssd-update-lease */
{ 3, "NSID" }, /* RFC 5001 */
{ 5, "DAU" }, /* RFC 6975 */
{ 6, "DHU" }, /* RFC 6975 */
{ 7, "N3U" }, /* RFC 6975 */
{ 8, "ECS" }, /* RFC 7871 */
{ 9, "EXPIRE" }, /* RFC 7314 */
{ 10, "COOKIE" }, /* RFC 7873 */
{ 11, "KEEPALIVE" }, /* RFC 7828 */
{ 12, "PADDING" }, /* RFC 7830 */
{ 12, "PAD" }, /* shorthand */
{ 13, "CHAIN" }, /* RFC 7901 */
{ 14, "KEY-TAG" }, /* RFC 8145 */
{ 15, "EDE" }, /* ietf-dnsop-extended-error-16 */
{ 16, "CLIENT-TAG" }, /* draft-bellis-dnsop-edns-tags */
{ 17, "SERVER-TAG" }, /* draft-bellis-dnsop-edns-tags */
{ 18, "REPORT-CHANNEL" }, /* RFC 9567 */
{ 18, "RC" }, /* shorthand */
{ 19, "ZONEVERSION" }, /* RFC 9660 */
{ 26946, "DEVICEID" }, /* Brian Hartvigsen */
};
#define N_EDNS_OPTNAMES (sizeof(optnames) / sizeof(optnames[0]))
@@ -1539,13 +1544,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
@@ -1855,7 +1860,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;
@@ -1958,7 +1963,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);
}
/*
@@ -1990,7 +1995,7 @@ followup_lookup(dns_message_t *msg, dig_query_t *query, dns_section_t section) {
link);
}
return (numLookups);
return numLookups;
}
/*%
@@ -2017,7 +2022,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;
}
/*
@@ -2029,14 +2034,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);
@@ -2045,13 +2050,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;
}
/*%
@@ -2154,7 +2159,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;
}
/*%
@@ -2288,7 +2293,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,
@@ -2315,7 +2320,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();
@@ -2648,7 +2653,7 @@ setup_lookup(dig_lookup_t *lookup) {
ISC_LIST_ENQUEUE(lookup->q, query, link);
}
return (true);
return true;
}
/*%
@@ -2775,6 +2780,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) {
@@ -2793,7 +2804,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));
@@ -2821,10 +2832,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
@@ -2872,7 +2880,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) {
@@ -2881,7 +2889,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);
@@ -2896,7 +2904,7 @@ failure:
if (store != NULL && store != found_store) {
isc_tls_cert_store_free(&store);
}
return (NULL);
return NULL;
}
static void
@@ -3038,7 +3046,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) {
@@ -3058,14 +3067,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;
@@ -3278,6 +3288,10 @@ start_udp(dig_query_t *query) {
return;
}
if (!port_set) {
port = 53;
}
result = get_address(query->servname, port, &query->sockaddr);
if (result != ISC_R_SUCCESS) {
/* This servname doesn't have an address. */
@@ -3346,12 +3360,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...");
@@ -3362,7 +3376,7 @@ try_next_server(dig_lookup_t *lookup) {
start_udp(next_query);
}
return (true);
return true;
}
static void
@@ -3701,7 +3715,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;
@@ -3727,7 +3741,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))
@@ -3807,10 +3821,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
@@ -3904,7 +3918,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;
}
/*%
@@ -4118,8 +4132,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",
@@ -4575,12 +4588,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
@@ -4602,7 +4615,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++) {
@@ -4612,7 +4625,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;
}
/*%
@@ -4750,7 +4763,7 @@ destroy_libs(void) {
isc_managers_destroy(&mctx, &loopmgr, &netmgr);
#if ENABLE_LEAK_DETECTION
isc__tls_setdestroycheck(true);
isc__crypto_setdestroycheck(true);
isc__uv_setdestroycheck(true);
isc__xml_setdestroycheck(true);
#endif
@@ -4785,7 +4798,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;
}
/*
@@ -4793,14 +4806,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;
}
/*%
@@ -4866,8 +4879,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 -8
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,
@@ -466,5 +462,3 @@ dig_shutdown(void);
bool
dig_lookup_is_tls(const dig_lookup_t *lookup);
ISC_LANG_ENDDECLS
+16 -16
View File
@@ -96,7 +96,7 @@ rcode_totext(dns_rcode_t rcode) {
} else {
totext.consttext = rcodetext[rcode];
}
return (totext.deconsttext);
return totext.deconsttext;
}
ISC_NORETURN static void
@@ -222,9 +222,9 @@ printsection(dns_message_t *msg, dns_section_t sectionid,
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 +262,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 +317,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 +341,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 +423,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) {
@@ -517,7 +517,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 +527,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 +538,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 +548,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 +556,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 +574,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 +917,5 @@ main(int argc, char **argv) {
cancel_all();
destroy_libs();
return ((seen_error == 0) ? 0 : 1);
return (seen_error == 0) ? 0 : 1;
}
+16 -16
View File
@@ -128,7 +128,7 @@ rcode_totext(dns_rcode_t rcode) {
} else {
totext.consttext = rcodetext[rcode];
}
return (totext.deconsttext);
return totext.deconsttext;
}
static void
@@ -210,9 +210,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 +256,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 +294,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 +338,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 +424,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 +478,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 +537,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 +554,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 +975,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)
+18 -18
View File
@@ -393,7 +393,7 @@ formatset(dns_rdataset_t *rdataset) {
}
isc_buffer_putuint8(buf, 0);
return (buf);
return buf;
}
static void
@@ -503,14 +503,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 +519,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 +573,7 @@ match_keyset_dsset(dns_rdataset_t *keyset, dns_rdataset_t *dsset,
}
}
return (keytable);
return keytable;
}
static void
@@ -679,7 +679,7 @@ matching_sigs(keyinfo_t *keytbl, dns_rdataset_t *rdataset,
}
}
return (algo);
return algo;
}
/*
@@ -696,7 +696,7 @@ signed_loose(dns_secalg_t *algo) {
}
}
isc_mem_cput(mctx, algo, nkey, sizeof(algo[0]));
return (ok);
return ok;
}
/*
@@ -738,7 +738,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 +759,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 +775,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 +783,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 +814,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 +866,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 +948,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 +1339,5 @@ cleanup:
print_mem_stats = true;
cleanup();
return (0);
return 0;
}
+9 -12
View File
@@ -66,7 +66,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);
return (result);
return result;
}
static void
@@ -138,7 +138,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 +153,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 +162,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 +381,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 +417,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 +546,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 -4
View File
@@ -68,7 +68,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);
return (result);
return result;
}
static void
@@ -141,7 +141,7 @@ loadset(const char *filename, dns_rdataset_t *rdataset) {
if (db != NULL) {
dns_db_detach(&db);
}
return (result);
return result;
}
static void
@@ -459,8 +459,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;
}
}
+1 -1
View File
@@ -750,5 +750,5 @@ main(int argc, char **argv) {
free(freeit);
}
return (0);
return 0;
}
+2 -2
View File
@@ -190,7 +190,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");
@@ -1320,5 +1320,5 @@ main(int argc, char **argv) {
free(freeit);
}
return (0);
return 0;
}
+242 -89
View File
@@ -25,6 +25,7 @@
#include <dns/callbacks.h>
#include <dns/dnssec.h>
#include <dns/fixedname.h>
#include <dns/keymgr.h>
#include <dns/keyvalues.h>
#include <dns/rdataclass.h>
#include <dns/rdatalist.h>
@@ -61,16 +62,19 @@ struct ksr_ctx {
bool setstart;
bool setend;
/* keygen */
bool ksk;
dns_ttl_t ttl;
dns_secalg_t alg;
int size;
time_t lifetime;
time_t parentpropagation;
time_t propagation;
time_t publishsafety;
time_t retiresafety;
time_t sigrefresh;
time_t sigvalidity;
time_t signdelay;
time_t ttlds;
time_t ttlsig;
};
typedef struct ksr_ctx ksr_ctx_t;
@@ -139,6 +143,15 @@ usage(int ret) {
exit(ret);
}
static isc_stdtime_t
between(isc_stdtime_t t, isc_stdtime_t start, isc_stdtime_t end) {
isc_stdtime_t r = end;
if (t > 0 && t > start && t < end) {
r = t;
}
return r;
}
static void
checkparams(ksr_ctx_t *ksr, const char *command) {
if (ksr->configfile == NULL) {
@@ -182,15 +195,19 @@ getkasp(ksr_ctx_t *ksr, dns_kasp_t **kasp) {
}
static int
keytag_cmp(const void *k1, const void *k2) {
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_id((*key1)->key) < dst_key_id((*key2)->key)) {
return (-1);
if (dst_key_alg((*key1)->key) < dst_key_alg((*key2)->key)) {
return -1;
} else if (dst_key_alg((*key1)->key) > dst_key_alg((*key2)->key)) {
return 1;
} else if (dst_key_id((*key1)->key) < dst_key_id((*key2)->key)) {
return -1;
} else if (dst_key_id((*key1)->key) > dst_key_id((*key2)->key)) {
return (1);
return 1;
}
return (0);
return 0;
}
static void
@@ -220,7 +237,7 @@ get_dnskeys(ksr_ctx_t *ksr, dns_dnsseckeylist_t *keys) {
{
keys_sorted[i] = dk;
}
qsort(keys_sorted, n, sizeof(dns_dnsseckey_t *), keytag_cmp);
qsort(keys_sorted, n, sizeof(dns_dnsseckey_t *), keyalgtag_cmp);
while (!ISC_LIST_EMPTY(keys_read)) {
dns_dnsseckey_t *key = ISC_LIST_HEAD(keys_read);
ISC_LIST_UNLINK(keys_read, key, link);
@@ -235,6 +252,7 @@ get_dnskeys(ksr_ctx_t *ksr, dns_dnsseckeylist_t *keys) {
static void
setcontext(ksr_ctx_t *ksr, dns_kasp_t *kasp) {
ksr->parentpropagation = dns_kasp_parentpropagationdelay(kasp);
ksr->propagation = dns_kasp_zonepropagationdelay(kasp);
ksr->publishsafety = dns_kasp_publishsafety(kasp);
ksr->retiresafety = dns_kasp_retiresafety(kasp);
@@ -242,6 +260,7 @@ setcontext(ksr_ctx_t *ksr, dns_kasp_t *kasp) {
ksr->sigrefresh = dns_kasp_sigrefresh(kasp);
ksr->signdelay = dns_kasp_signdelay(kasp);
ksr->ttl = dns_kasp_dnskeyttl(kasp);
ksr->ttlds = dns_kasp_dsttl(kasp);
ksr->ttlsig = dns_kasp_zonemaxttl(kasp, true);
}
@@ -309,9 +328,9 @@ freerrset(dns_rdataset_t *rdataset) {
}
static void
create_zsk(ksr_ctx_t *ksr, dns_kasp_key_t *kaspkey, dns_dnsseckeylist_t *keys,
isc_stdtime_t inception, isc_stdtime_t active,
isc_stdtime_t *expiration) {
create_key(ksr_ctx_t *ksr, dns_kasp_t *kasp, dns_kasp_key_t *kaspkey,
dns_dnsseckeylist_t *keys, isc_stdtime_t inception,
isc_stdtime_t active, isc_stdtime_t *expiration) {
bool conflict = false;
bool freekey = false;
bool show_progress = true;
@@ -323,9 +342,15 @@ create_zsk(ksr_ctx_t *ksr, dns_kasp_key_t *kaspkey, dns_dnsseckeylist_t *keys,
isc_buffer_t buf;
isc_result_t ret;
isc_stdtime_t prepub;
uint16_t flags = DNS_KEYOWNER_ZONE;
isc_stdtime_tostring(inception, timestr, sizeof(timestr));
/* ZSK or KSK? */
if (ksr->ksk) {
flags |= DNS_KEYFLAG_KSK;
}
/* Check algorithm and size. */
dns_secalg_format(ksr->alg, algstr, sizeof(algstr));
if (!dst_algorithm_supported(ksr->alg)) {
@@ -416,18 +441,18 @@ create_zsk(ksr_ctx_t *ksr, dns_kasp_key_t *kaspkey, dns_dnsseckeylist_t *keys,
ret = dns_keystore_keygen(
ksr->keystore, name, ksr->policy,
dns_rdataclass_in, mctx, ksr->alg, ksr->size,
DNS_KEYOWNER_ZONE, &key);
flags, &key);
} else if (show_progress) {
ret = dst_key_generate(
name, ksr->alg, ksr->size, 0, DNS_KEYOWNER_ZONE,
DNS_KEYPROTO_DNSSEC, dns_rdataclass_in, NULL,
mctx, &key, &progress);
ret = dst_key_generate(name, ksr->alg, ksr->size, 0,
flags, DNS_KEYPROTO_DNSSEC,
dns_rdataclass_in, NULL, mctx,
&key, &progress);
fflush(stderr);
} else {
ret = dst_key_generate(
name, ksr->alg, ksr->size, 0, DNS_KEYOWNER_ZONE,
DNS_KEYPROTO_DNSSEC, dns_rdataclass_in, NULL,
mctx, &key, NULL);
ret = dst_key_generate(name, ksr->alg, ksr->size, 0,
flags, DNS_KEYPROTO_DNSSEC,
dns_rdataclass_in, NULL, mctx,
&key, NULL);
}
if (ret != ISC_R_SUCCESS) {
@@ -464,15 +489,28 @@ create_zsk(ksr_ctx_t *ksr, dns_kasp_key_t *kaspkey, dns_dnsseckeylist_t *keys,
prepub = ksr->ttl + ksr->publishsafety + ksr->propagation;
dst_key_setttl(key, ksr->ttl);
dst_key_setnum(key, DST_NUM_LIFETIME, ksr->lifetime);
dst_key_setbool(key, DST_BOOL_KSK, false);
dst_key_setbool(key, DST_BOOL_ZSK, true);
dst_key_setbool(key, DST_BOOL_KSK, ksr->ksk);
dst_key_setbool(key, DST_BOOL_ZSK, !ksr->ksk);
dst_key_settime(key, DST_TIME_CREATED, ksr->now);
dst_key_settime(key, DST_TIME_PUBLISH, (active - prepub));
dst_key_settime(key, DST_TIME_ACTIVATE, active);
if (ksr->ksk) {
dns_keymgr_settime_syncpublish(key, kasp,
(inception == ksr->start));
}
if (ksr->lifetime > 0) {
isc_stdtime_t inactive = (active + ksr->lifetime);
isc_stdtime_t remove = ksr->ttlsig + ksr->propagation +
ksr->retiresafety + ksr->signdelay;
isc_stdtime_t remove;
if (ksr->ksk) {
remove = ksr->ttlds + ksr->parentpropagation +
ksr->retiresafety;
dst_key_settime(key, DST_TIME_SYNCDELETE, inactive);
} else {
remove = ksr->ttlsig + ksr->propagation +
ksr->retiresafety + ksr->signdelay;
}
dst_key_settime(key, DST_TIME_INACTIVE, inactive);
dst_key_settime(key, DST_TIME_DELETE, (inactive + remove));
*expiration = inactive;
@@ -603,15 +641,16 @@ fail:
namestr, algstr, timestr);
}
return (next_bundle);
return next_bundle;
}
static void
static isc_stdtime_t
sign_rrset(ksr_ctx_t *ksr, isc_stdtime_t inception, isc_stdtime_t expiration,
dns_rdataset_t *rrset, dns_dnsseckeylist_t *keys) {
dns_rdatalist_t *rrsiglist = NULL;
dns_rdataset_t rrsigset = DNS_RDATASET_INIT;
isc_result_t ret;
isc_stdtime_t next_bundle = expiration;
UNUSED(ksr);
@@ -655,6 +694,25 @@ sign_rrset(ksr_ctx_t *ksr, isc_stdtime_t inception, isc_stdtime_t expiration,
unsigned char rdatabuf[SIG_FORMATSIZE];
isc_stdtime_t clockskew = inception - 3600;
isc_stdtime_t pub = 0, act = 0, inact = 0, del = 0;
/* Determine next bundle. */
(void)dst_key_gettime(dk->key, DST_TIME_PUBLISH, &pub);
(void)dst_key_gettime(dk->key, DST_TIME_ACTIVATE, &act);
(void)dst_key_gettime(dk->key, DST_TIME_INACTIVE, &inact);
(void)dst_key_gettime(dk->key, DST_TIME_DELETE, &del);
next_bundle = between(pub, inception, next_bundle);
next_bundle = between(act, inception, next_bundle);
next_bundle = between(inact, inception, next_bundle);
next_bundle = between(del, inception, next_bundle);
if (act > inception) {
continue;
}
if (inact != 0 && inception >= inact) {
continue;
}
rrsig = isc_mem_get(mctx, sizeof(*rrsig));
dns_rdata_init(rrsig);
isc_buffer_init(&buf, rdatabuf, sizeof(rdatabuf));
@@ -676,21 +734,25 @@ sign_rrset(ksr_ctx_t *ksr, isc_stdtime_t inception, isc_stdtime_t expiration,
dns_rdatalist_tordataset(rrsiglist, &rrsigset);
print_rdata(&rrsigset);
freerrset(&rrsigset);
return next_bundle;
}
/*
* Create the DNSKEY, CDS, and CDNSKEY records beloing to the KSKs
* listed in 'keys'.
*/
static void
create_ksk(ksr_ctx_t *ksr, dns_kasp_t *kasp, dns_dnsseckeylist_t *keys,
dns_rdataset_t *dnskeyset, dns_rdataset_t *cdnskeyset,
dns_rdataset_t *cdsset) {
static isc_stdtime_t
get_keymaterial(ksr_ctx_t *ksr, dns_kasp_t *kasp, isc_stdtime_t inception,
isc_stdtime_t next_inception, dns_dnsseckeylist_t *keys,
dns_rdataset_t *dnskeyset, dns_rdataset_t *cdnskeyset,
dns_rdataset_t *cdsset) {
dns_kasp_digestlist_t digests = dns_kasp_digests(kasp);
dns_rdatalist_t *dnskeylist = isc_mem_get(mctx, sizeof(*dnskeylist));
dns_rdatalist_t *cdnskeylist = isc_mem_get(mctx, sizeof(*cdnskeylist));
dns_rdatalist_t *cdslist = isc_mem_get(mctx, sizeof(*cdslist));
isc_result_t ret = ISC_R_SUCCESS;
dns_kasp_digestlist_t digests = dns_kasp_digests(kasp);
isc_stdtime_t next_bundle = next_inception;
dns_rdatalist_init(dnskeylist);
dnskeylist->rdclass = dns_rdataclass_in;
@@ -710,31 +772,73 @@ create_ksk(ksr_ctx_t *ksr, dns_kasp_t *kasp, dns_dnsseckeylist_t *keys,
for (dns_dnsseckey_t *dk = ISC_LIST_HEAD(*keys); dk != NULL;
dk = ISC_LIST_NEXT(dk, link))
{
bool published = true;
isc_buffer_t buf;
isc_buffer_t *newbuf;
dns_rdata_t *rdata;
isc_region_t r;
isc_region_t rcds;
isc_stdtime_t pub = 0, del = 0;
unsigned char kskbuf[DST_KEY_MAXSIZE];
unsigned char cdnskeybuf[DST_KEY_MAXSIZE];
unsigned char cdsbuf[DNS_DS_BUFFERSIZE];
/* KSK */
newbuf = NULL;
rdata = isc_mem_get(mctx, sizeof(*rdata));
dns_rdata_init(rdata);
(void)dst_key_gettime(dk->key, DST_TIME_PUBLISH, &pub);
(void)dst_key_gettime(dk->key, DST_TIME_DELETE, &del);
next_bundle = between(pub, inception, next_bundle);
next_bundle = between(del, inception, next_bundle);
isc_buffer_init(&buf, kskbuf, sizeof(kskbuf));
CHECK(dst_key_todns(dk->key, &buf));
isc_buffer_usedregion(&buf, &r);
isc_buffer_allocate(mctx, &newbuf, r.length);
isc_buffer_putmem(newbuf, r.base, r.length);
isc_buffer_usedregion(newbuf, &r);
dns_rdata_fromregion(rdata, dns_rdataclass_in,
dns_rdatatype_dnskey, &r);
ISC_LIST_APPEND(dnskeylist->rdata, rdata, link);
ISC_LIST_APPEND(cleanup_list, newbuf, link);
isc_buffer_clear(newbuf);
if (pub > inception) {
published = false;
}
if (del != 0 && inception >= del) {
published = false;
}
if (published) {
newbuf = NULL;
rdata = isc_mem_get(mctx, sizeof(*rdata));
dns_rdata_init(rdata);
isc_buffer_init(&buf, kskbuf, sizeof(kskbuf));
CHECK(dst_key_todns(dk->key, &buf));
isc_buffer_usedregion(&buf, &r);
isc_buffer_allocate(mctx, &newbuf, r.length);
isc_buffer_putmem(newbuf, r.base, r.length);
isc_buffer_usedregion(newbuf, &r);
dns_rdata_fromregion(rdata, dns_rdataclass_in,
dns_rdatatype_dnskey, &r);
ISC_LIST_APPEND(dnskeylist->rdata, rdata, link);
ISC_LIST_APPEND(cleanup_list, newbuf, link);
isc_buffer_clear(newbuf);
}
published = true;
if (dns_kasp_cdnskey(kasp) || !ISC_LIST_EMPTY(digests)) {
pub = 0;
del = 0;
(void)dst_key_gettime(dk->key, DST_TIME_SYNCPUBLISH,
&pub);
(void)dst_key_gettime(dk->key, DST_TIME_SYNCDELETE,
&del);
next_bundle = between(pub, inception, next_bundle);
next_bundle = between(del, inception, next_bundle);
if (pub != 0 && pub > inception) {
published = false;
}
if (del != 0 && inception >= del) {
published = false;
}
} else {
published = false;
}
if (!published) {
continue;
}
/* CDNSKEY */
newbuf = NULL;
@@ -788,35 +892,98 @@ create_ksk(ksr_ctx_t *ksr, dns_kasp_t *kasp, dns_dnsseckeylist_t *keys,
dns_rdatalist_tordataset(dnskeylist, dnskeyset);
dns_rdatalist_tordataset(cdnskeylist, cdnskeyset);
dns_rdatalist_tordataset(cdslist, cdsset);
return;
return next_bundle;
fail:
fatal("failed to create KSK/CDS/CDNSKEY");
return 0;
}
static void
sign_bundle(ksr_ctx_t *ksr, isc_stdtime_t inception,
isc_stdtime_t next_inception, dns_rdatalist_t *rdatalist,
dns_rdataset_t *cds, dns_rdataset_t *cdnskey,
sign_bundle(ksr_ctx_t *ksr, dns_kasp_t *kasp, isc_stdtime_t inception,
isc_stdtime_t next_inception, dns_rdatalist_t *zsklist,
dns_dnsseckeylist_t *keys) {
dns_rdataset_t rrset = DNS_RDATASET_INIT;
isc_stdtime_t expiration;
isc_stdtime_t expiration = inception + ksr->sigvalidity;
isc_stdtime_t next_bundle = next_inception;
dns_rdataset_t zsk;
dns_rdataset_init(&zsk);
dns_rdatalist_tordataset(zsklist, &zsk);
dns_rdataset_init(&rrset);
dns_rdatalist_tordataset(rdatalist, &rrset);
expiration = inception + ksr->sigvalidity;
while (inception <= next_inception) {
sign_rrset(ksr, inception, expiration, &rrset, keys);
if (dns_rdataset_count(cdnskey) > 0) {
sign_rrset(ksr, inception, expiration, cdnskey, keys);
isc_stdtime_t next_time = next_bundle;
/* DNSKEY RRset */
dns_rdatalist_t *dnskeylist;
dnskeylist = isc_mem_get(mctx, sizeof(*dnskeylist));
dns_rdatalist_init(dnskeylist);
dnskeylist->rdclass = dns_rdataclass_in;
dnskeylist->type = dns_rdatatype_dnskey;
dnskeylist->ttl = ksr->ttl;
dns_rdataset_t ksk, cdnskey, cds, rrset;
dns_rdataset_init(&ksk);
dns_rdataset_init(&cdnskey);
dns_rdataset_init(&cds);
dns_rdataset_init(&rrset);
next_time = get_keymaterial(ksr, kasp, inception, next_time,
keys, &ksk, &cdnskey, &cds);
if (next_bundle > next_time) {
next_bundle = next_time;
}
if (dns_rdataset_count(cds) > 0) {
sign_rrset(ksr, inception, expiration, cds, keys);
for (isc_result_t r = dns_rdatalist_first(&ksk);
r == ISC_R_SUCCESS; r = dns_rdatalist_next(&ksk))
{
dns_rdata_t *clone = isc_mem_get(mctx, sizeof(*clone));
dns_rdata_init(clone);
dns_rdatalist_current(&ksk, clone);
ISC_LIST_APPEND(dnskeylist->rdata, clone, link);
}
for (isc_result_t r = dns_rdatalist_first(&zsk);
r == ISC_R_SUCCESS; r = dns_rdatalist_next(&zsk))
{
dns_rdata_t *clone = isc_mem_get(mctx, sizeof(*clone));
dns_rdata_init(clone);
dns_rdatalist_current(&zsk, clone);
ISC_LIST_APPEND(dnskeylist->rdata, clone, link);
}
dns_rdatalist_tordataset(dnskeylist, &rrset);
next_time = sign_rrset(ksr, inception, expiration, &rrset,
keys);
if (next_bundle > next_time) {
next_bundle = next_time;
}
freerrset(&ksk);
freerrset(&rrset);
/* CDNSKEY */
if (dns_rdataset_count(&cdnskey) > 0) {
(void)sign_rrset(ksr, inception, expiration, &cdnskey,
keys);
}
freerrset(&cdnskey);
/* CDS */
if (dns_rdataset_count(&cds) > 0) {
(void)sign_rrset(ksr, inception, expiration, &cds,
keys);
}
freerrset(&cds);
/* Next response bundle. */
inception = expiration - ksr->sigrefresh;
if (inception > next_bundle) {
inception = next_bundle;
}
expiration = inception + ksr->sigvalidity;
next_bundle = expiration;
}
freerrset(&rrset);
freerrset(&zsk);
}
static isc_result_t
@@ -841,10 +1008,10 @@ parse_dnskey(isc_lex_t *lex, char *owner, isc_buffer_t *buf, dns_ttl_t *ttl) {
isc_buffer_add(&b, strlen(owner));
ret = dns_name_fromtext(dname, &b, dns_rootname, 0, NULL);
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);
@@ -882,7 +1049,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
@@ -903,9 +1070,12 @@ keygen(ksr_ctx_t *ksr) {
for (dns_kasp_key_t *kk = ISC_LIST_HEAD(dns_kasp_keys(kasp));
kk != NULL; kk = ISC_LIST_NEXT(kk, link))
{
if (dns_kasp_key_ksk(kk)) {
if (dns_kasp_key_ksk(kk) && !ksr->ksk) {
/* only ZSKs allowed */
continue;
} else if (dns_kasp_key_zsk(kk) && ksr->ksk) {
/* only KSKs allowed */
continue;
}
ksr->alg = dns_kasp_key_algorithm(kk);
ksr->lifetime = dns_kasp_key_lifetime(kk);
@@ -916,7 +1086,7 @@ keygen(ksr_ctx_t *ksr) {
for (isc_stdtime_t inception = ksr->start, act = ksr->start;
inception < ksr->end; inception += ksr->lifetime)
{
create_zsk(ksr, kk, &keys, inception, act, &act);
create_key(ksr, kasp, kk, &keys, inception, act, &act);
if (ksr->lifetime == 0) {
/* unlimited lifetime, but not infinite loop */
break;
@@ -924,7 +1094,7 @@ keygen(ksr_ctx_t *ksr) {
}
}
if (noop) {
fatal("policy '%s' has no zsks", ksr->policy);
fatal("no keys created for policy '%s'", ksr->policy);
}
/* Cleanup */
cleanup(&keys, kasp);
@@ -1003,9 +1173,6 @@ sign(ksr_ctx_t *ksr) {
dns_dnsseckeylist_t keys;
dns_kasp_t *kasp = NULL;
dns_rdatalist_t *rdatalist = NULL;
dns_rdataset_t ksk = DNS_RDATASET_INIT;
dns_rdataset_t cdnskey = DNS_RDATASET_INIT;
dns_rdataset_t cds = DNS_RDATASET_INIT;
isc_result_t ret;
isc_stdtime_t inception;
isc_lex_t *lex = NULL;
@@ -1038,9 +1205,6 @@ sign(ksr_ctx_t *ksr) {
isc_result_totext(ret));
}
/* KSK, CDS and CDNSKEY */
create_ksk(ksr, kasp, &keys, &ksk, &cdnskey, &cds);
for (ret = isc_lex_gettoken(lex, opt, &token); ret == ISC_R_SUCCESS;
ret = isc_lex_gettoken(lex, opt, &token))
{
@@ -1090,8 +1254,8 @@ sign(ksr_ctx_t *ksr) {
if (have_bundle) {
/* Sign previous bundle */
sign_bundle(ksr, inception, next_inception,
rdatalist, &cds, &cdnskey, &keys);
sign_bundle(ksr, kasp, inception,
next_inception, rdatalist, &keys);
fprintf(stdout, "\n");
}
@@ -1101,15 +1265,7 @@ sign(ksr_ctx_t *ksr) {
rdatalist->rdclass = dns_rdataclass_in;
rdatalist->type = dns_rdatatype_dnskey;
rdatalist->ttl = ksr->ttl;
for (isc_result_t r = dns_rdatalist_first(&ksk);
r == ISC_R_SUCCESS; r = dns_rdatalist_next(&ksk))
{
dns_rdata_t *clone =
isc_mem_get(mctx, sizeof(*clone));
dns_rdata_init(clone);
dns_rdatalist_current(&ksk, clone);
ISC_LIST_APPEND(rdatalist->rdata, clone, link);
}
inception = next_inception;
have_bundle = true;
@@ -1168,8 +1324,7 @@ sign(ksr_ctx_t *ksr) {
/* Final bundle */
if (have_bundle && rdatalist != NULL) {
sign_bundle(ksr, inception, ksr->end, rdatalist, &cds, &cdnskey,
&keys);
sign_bundle(ksr, kasp, inception, ksr->end, rdatalist, &keys);
} else {
fatal("bad KSR file %s(%lu): no bundles", ksr->file,
isc_lex_getsourceline(lex));
@@ -1181,11 +1336,6 @@ sign(ksr_ctx_t *ksr) {
timestr, PACKAGE_VERSION);
fail:
/* Clean up */
freerrset(&ksk);
freerrset(&cdnskey);
freerrset(&cds);
isc_lex_destroy(&lex);
cleanup(&keys, kasp);
}
@@ -1208,7 +1358,7 @@ main(int argc, char *argv[]) {
isc_commandline_errprint = false;
#define OPTIONS "E:e:Ff:hi:K:k:l:v:V"
#define OPTIONS "E:e:Ff:hi:K:k:l:ov:V"
while ((ch = isc_commandline_parse(argc, argv, OPTIONS)) != -1) {
switch (ch) {
case 'E':
@@ -1245,6 +1395,9 @@ main(int argc, char *argv[]) {
case 'l':
ksr.configfile = isc_commandline_argument;
break;
case 'o':
ksr.ksk = true;
break;
case 'V':
version(program);
break;
+17 -7
View File
@@ -21,7 +21,7 @@ dnssec-ksr - Create signed key response (SKR) files for offline KSK setups
Synopsis
~~~~~~~~
:program:`dnssec-ksr` [**-e** date/offset] [**-F**] [**-h**] [**-i** date/offset] [**-K** directory] [**-k** policy] [**-l** file] [**-V**] [**-v** level] {command} {zone}
:program:`dnssec-ksr` [**-e** date/offset] [**-F**] [**-f** file] [**-h**] [**-i** date/offset] [**-K** directory] [**-k** policy] [**-l** file] [**-o**] [**-V**] [**-v** level] {command} {zone}
Description
~~~~~~~~~~~
@@ -51,6 +51,10 @@ Options
mode if the underlying crytographic library supports running in FIPS
mode.
.. option:: -f
This option sets the SKR file to be signed when issuing a ``sign`` command.
.. option:: -h
This option prints a short summary of the options and arguments to
@@ -76,6 +80,11 @@ Options
This option provides a configuration file that contains a ``dnssec-policy``
statement (matching the policy set with :option:`-k`).
.. option:: -o
Normally when pregenerating keys, ZSKs are created. When this option is
set, create KSKs instead.
.. option:: -V
This option prints version information.
@@ -98,9 +107,8 @@ Commands
.. option:: keygen
Pregenerate a number of zone signing keys (ZSKs), given a DNSSEC policy and
an interval. The number of generated keys depends on the interval and the
ZSK lifetime.
Pregenerate a number of keys, given a DNSSEC policy and an interval. The
number of generated keys depends on the interval and the key lifetime.
.. option:: request
@@ -123,7 +131,7 @@ occurred.
Examples
~~~~~~~~
When you need to generate keys for the zone "example.com" for the next year,
When you need to generate ZSKs for the zone "example.com" for the next year,
given a ``dnssec-policy`` named "mypolicy":
::
@@ -136,7 +144,8 @@ Creating a KSR for the same zone and period can be done with:
dnssec-ksr -i now -e +1y -k mypolicy -l named.conf request example.com > ksr.txt
Typically you would now transfer the KSR to the system that has access to the KSK.
Typically you would now transfer the KSR to the system that has access to
the KSK.
Signing the KSR created above can be done with:
@@ -144,7 +153,8 @@ Signing the KSR created above can be done with:
dnssec-ksr -i now -e +1y -k kskpolicy -l named.conf -f ksr.txt sign example.com
Make sure that the DNSSEC parameters in ``kskpolicy`` match those in ``mypolicy``.
Make sure that the DNSSEC parameters in ``kskpolicy`` match those
in ``mypolicy``.
See Also
~~~~~~~~
+1 -1
View File
@@ -248,5 +248,5 @@ cleanup:
}
isc_mem_destroy(&mctx);
return (0);
return 0;
}
+1 -1
View File
@@ -949,5 +949,5 @@ main(int argc, char **argv) {
isc_mem_free(mctx, directory);
isc_mem_destroy(&mctx);
return (0);
return 0;
}
+72 -55
View File
@@ -197,7 +197,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 +325,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 +366,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 +386,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 +400,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 +408,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 +419,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 +448,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 +460,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 +470,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 +539,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 +550,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->pubkey;
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 +582,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 +609,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 +687,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 +873,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 +905,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 +931,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;
}
}
@@ -1031,7 +1049,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 +1058,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 +1073,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 +1109,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 +1118,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 +1128,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 +1138,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 +1151,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 +1170,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 +1388,7 @@ active_node(dns_dbnode_t *node) {
}
dns_rdatasetiter_destroy(&rdsiter);
return (active);
return active;
}
/*%
@@ -1419,7 +1437,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 +1511,7 @@ cleanup:
}
dns_rdata_reset(&rdata);
return (result);
return result;
}
/*%
@@ -3368,9 +3386,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 +3565,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 +4151,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
+1 -1
View File
@@ -330,5 +330,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
+84 -84
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));
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
@@ -844,23 +844,23 @@ getoriginnode(dns_db_t *db, dns_dbnode_t **nodep DNS__DB_FLARG) {
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
@@ -887,26 +887,26 @@ findnode(dns_db_t *db, const dns_name_t *name, bool create,
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));
@@ -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
+53 -64
View File
@@ -168,7 +168,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 +193,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\
@@ -236,6 +236,7 @@ options {\n\
notify yes;\n\
notify-delay 5;\n\
notify-to-soa no;\n\
send-report-channel .;\n\
serial-update-method increment;\n\
sig-signing-nodes 100;\n\
sig-signing-signatures 10;\n\
@@ -330,7 +331,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\
@@ -354,15 +355,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
@@ -372,10 +373,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
@@ -401,7 +402,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))
@@ -415,13 +416,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
@@ -433,7 +434,7 @@ named_config_listcount(const cfg_obj_t *list) {
i++;
}
return (i);
return i;
}
isc_result_t
@@ -444,7 +445,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);
@@ -453,7 +454,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
@@ -464,7 +465,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);
@@ -473,7 +474,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
@@ -499,12 +500,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;
@@ -515,7 +516,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) {
@@ -524,28 +525,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
@@ -560,7 +544,7 @@ 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));
@@ -575,11 +559,11 @@ named_config_getname(isc_mem_t *mctx, const cfg_obj_t *obj,
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) \
@@ -596,10 +580,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;
@@ -682,8 +668,6 @@ newlist:
isc_sockaddr_any6(&src6);
}
result = ISC_R_NOMEMORY;
element = cfg_list_first(addrlist);
resume:
for (; element != NULL; element = cfg_list_next(element)) {
@@ -714,17 +698,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;
@@ -827,7 +816,7 @@ resume:
ipkl->count = addrcount;
ipkl->allocated = addrcount;
return (ISC_R_SUCCESS);
return ISC_R_SUCCESS;
cleanup:
if (addrs != NULL) {
@@ -866,7 +855,7 @@ cleanup:
if (stack != NULL) {
isc_mem_cput(mctx, stack, stackcount, sizeof(stack[0]));
}
return (result);
return result;
}
isc_result_t
@@ -891,10 +880,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 {
@@ -938,15 +927,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;
@@ -955,5 +944,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"
+1 -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);
@@ -111,6 +109,7 @@ EXTERN const char *named_g_chrootdir INIT(NULL);
EXTERN bool named_g_foreground INIT(false);
EXTERN bool named_g_logstderr INIT(false);
EXTERN bool named_g_nosyslog INIT(false);
EXTERN unsigned int named_g_logflags INIT(0);
EXTERN const char *named_g_logfile INIT(NULL);
EXTERN const char *named_g_defaultsessionkeyfile INIT(NAMED_LOCALSTATEDIR
+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
+24 -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
@@ -79,6 +79,16 @@ named_log_setdefaultchannels(isc_logconfig_t *lcfg) {
isc_log_createchannel(lcfg, "default_debug", ISC_LOG_TOFILE,
ISC_LOG_DYNAMIC, &destination,
ISC_LOG_PRINTTIME | ISC_LOG_DEBUGONLY);
} else if (named_g_logstderr && (named_g_logflags != 0)) {
/*
* If the option -g is given, but we also requested iso
* timestamps, we'll still need to override the "default_debug"
* logger with a new one.
*/
isc_log_createchannel(lcfg, "default_debug", ISC_LOG_TOFILEDESC,
ISC_LOG_DYNAMIC,
ISC_LOGDESTINATION_STDERR,
ISC_LOG_PRINTTIME | named_g_logflags);
}
if (named_g_logfile != NULL) {
@@ -118,6 +128,16 @@ named_log_setsafechannels(isc_logconfig_t *lcfg) {
* discarded a bit faster.
*/
isc_log_setdebuglevel(0);
} else if (named_g_logstderr && (named_g_logflags != 0)) {
/*
* If the option -g is given, but we also requested iso
* timestamps, we'll still need to override the "default_debug"
* logger with a new one.
*/
isc_log_createchannel(lcfg, "default_debug", ISC_LOG_TOFILEDESC,
ISC_LOG_DYNAMIC,
ISC_LOGDESTINATION_STDERR,
ISC_LOG_PRINTTIME | named_g_logflags);
} else {
isc_log_setdebuglevel(named_g_debuglevel);
}
@@ -199,7 +219,7 @@ named_log_setdefaultcategory(isc_logconfig_t *lcfg) {
}
cleanup:
return (result);
return result;
}
isc_result_t
@@ -208,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;
}
+10 -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;
@@ -239,6 +239,8 @@ channel_fromconf(const cfg_obj_t *channel, isc_logconfig_t *logconfig) {
flags |= ISC_LOG_ISO8601;
} else if (strcasecmp(s, "iso8601-utc") == 0) {
flags |= ISC_LOG_ISO8601 | ISC_LOG_UTC;
} else if (strcasecmp(s, "iso8601-tzinfo") == 0) {
flags |= ISC_LOG_ISO8601 | ISC_LOG_TZINFO;
}
}
}
@@ -306,7 +308,7 @@ channel_fromconf(const cfg_obj_t *channel, isc_logconfig_t *logconfig) {
}
done:
return (result);
return result;
}
isc_result_t
@@ -361,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;
}
+14 -18
View File
@@ -27,6 +27,7 @@
#include <isc/attributes.h>
#include <isc/backtrace.h>
#include <isc/commandline.h>
#include <isc/crypto.h>
#include <isc/dir.h>
#include <isc/file.h>
#include <isc/fips.h>
@@ -308,7 +309,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");
}
@@ -401,7 +402,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 {
@@ -889,6 +890,8 @@ parse_command_line(int argc, char *argv[]) {
case 'g':
named_g_foreground = true;
named_g_logstderr = true;
named_g_logflags = ISC_LOG_PRINTTIME | ISC_LOG_ISO8601 |
ISC_LOG_TZINFO;
break;
case 'L':
named_g_logfile = isc_commandline_argument;
@@ -1022,7 +1025,7 @@ create_managers(void) {
isc_nm_maxudp(named_g_netmgr, maxudp);
return (ISC_R_SUCCESS);
return ISC_R_SUCCESS;
}
static void
@@ -1390,7 +1393,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) {
@@ -1399,7 +1402,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) {
@@ -1408,17 +1411,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",
@@ -1426,12 +1422,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 */
@@ -1563,7 +1559,7 @@ main(int argc, char *argv[]) {
isc_managers_destroy(&named_g_mctx, &named_g_loopmgr, &named_g_netmgr);
#if ENABLE_LEAK_DETECTION
isc__tls_setdestroycheck(true);
isc__crypto_setdestroycheck(true);
isc__uv_setdestroycheck(true);
isc__xml_setdestroycheck(true);
#endif
@@ -1589,5 +1585,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;
}
+695 -689
View File
File diff suppressed because it is too large Load Diff
+90 -75
View File
@@ -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
@@ -1476,7 +1491,7 @@ xfrin_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;
}
if (dns_zone_getxfr(zone, &xfr, &is_firstrefresh, &is_running,
@@ -1488,7 +1503,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 +1513,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"));
@@ -1713,7 +1728,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 +1738,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 +2140,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 +2151,7 @@ cleanup:
if (doc != NULL) {
xmlFreeDoc(doc);
}
return (ISC_R_FAILURE);
return ISC_R_FAILURE;
}
static void
@@ -2170,7 +2185,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 +2195,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 +2206,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 +2217,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 +2228,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 +2239,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 +2250,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 +2261,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 +2272,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 +2313,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 +2327,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 +2346,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 +2365,7 @@ zone_jsonrender(dns_zone_t *zone, void *arg) {
}
if (zoneobj == NULL) {
return (ISC_R_NOMEMORY);
return ISC_R_NOMEMORY;
}
/*
@@ -2518,7 +2533,7 @@ cleanup:
if (zoneobj != NULL) {
json_object_put(zoneobj);
}
return (result);
return result;
}
static isc_result_t
@@ -2547,7 +2562,7 @@ xfrin_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));
@@ -2772,7 +2787,7 @@ cleanup:
if (xfrinobj != NULL) {
json_object_put(xfrinobj);
}
return (result);
return result;
}
static isc_result_t
@@ -2810,7 +2825,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 +3358,7 @@ cleanup:
json_object_put(bindstats);
}
return (result);
return result;
}
static isc_result_t
@@ -3372,7 +3387,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 +3397,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 +3408,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 +3419,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 +3430,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 +3441,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 +3452,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 +3463,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 +3474,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 +3538,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 +3573,7 @@ client_ok(const isc_sockaddr_t *fromaddr, void *arg) {
match > 0)
{
UNLOCK(&listener->lock);
return (true);
return true;
}
UNLOCK(&listener->lock);
@@ -3567,7 +3582,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 +3616,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 +3719,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 +3728,7 @@ cleanup:
isc_mutex_destroy(&listener->lock);
isc_mem_putanddetach(&listener->mctx, listener, sizeof(*listener));
return (result);
return result;
#endif
}
@@ -3906,7 +3921,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 +4159,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 */
}
+3 -6
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);
@@ -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;
}
+7 -7
View File
@@ -131,12 +131,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
@@ -184,12 +184,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,7 +216,7 @@ transport_list_fromconfig(const cfg_obj_t *config, dns_transport_list_t *list) {
obj = NULL;
}
return (result);
return result;
}
static void
@@ -258,8 +258,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;
}
+4 -4
View File
@@ -123,7 +123,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 +131,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 +172,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;
}
+136 -79
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;
}
/*%
@@ -203,12 +196,17 @@ configure_zone_ssutable(const cfg_obj_t *zconfig, dns_zone_t *zone,
isc_mem_t *mctx = dns_zone_getmctx(zone);
bool autoddns = false;
isc_result_t result = ISC_R_SUCCESS;
char debug[1024];
isc_buffer_t dbuf;
isc_buffer_init(&dbuf, debug, sizeof(debug));
isc_buffer_setmctx(&dbuf, mctx);
(void)cfg_map_get(zconfig, "update-policy", &updatepolicy);
if (updatepolicy == NULL) {
dns_zone_setssutable(zone, NULL);
return (ISC_R_SUCCESS);
return ISC_R_SUCCESS;
}
if (cfg_obj_isstring(updatepolicy) &&
@@ -237,7 +235,9 @@ configure_zone_ssutable(const cfg_obj_t *zconfig, dns_zone_t *zone,
isc_buffer_t b;
dns_ssuruletype_t *types;
unsigned int i, n;
char namebuf[DNS_NAME_FORMATSIZE];
isc_buffer_clear(&dbuf);
str = cfg_obj_asstring(mode);
if (strcasecmp(str, "grant") == 0) {
grant = true;
@@ -246,14 +246,7 @@ configure_zone_ssutable(const cfg_obj_t *zconfig, dns_zone_t *zone,
} else {
UNREACHABLE();
}
str = cfg_obj_asstring(matchtype);
CHECK(dns_ssu_mtypefromstring(str, &mtype));
if (mtype == dns_ssumatchtype_subdomain &&
strcasecmp(str, "zonesub") == 0)
{
usezone = true;
}
isc_buffer_putstr(&dbuf, str);
dns_fixedname_init(&fident);
str = cfg_obj_asstring(identity);
@@ -266,6 +259,20 @@ configure_zone_ssutable(const cfg_obj_t *zconfig, dns_zone_t *zone,
"'%s' is not a valid name", str);
goto cleanup;
}
dns_name_format(dns_fixedname_name(&fident), namebuf,
sizeof(namebuf));
isc_buffer_putstr(&dbuf, " ");
isc_buffer_putstr(&dbuf, namebuf);
str = cfg_obj_asstring(matchtype);
CHECK(dns_ssu_mtypefromstring(str, &mtype));
if (mtype == dns_ssumatchtype_subdomain &&
strcasecmp(str, "zonesub") == 0)
{
usezone = true;
}
isc_buffer_putstr(&dbuf, " ");
isc_buffer_putstr(&dbuf, str);
dns_fixedname_init(&fname);
if (usezone) {
@@ -282,6 +289,10 @@ configure_zone_ssutable(const cfg_obj_t *zconfig, dns_zone_t *zone,
"'%s' is not a valid name", str);
goto cleanup;
}
dns_name_format(dns_fixedname_name(&fname), namebuf,
sizeof(namebuf));
isc_buffer_putstr(&dbuf, " ");
isc_buffer_putstr(&dbuf, namebuf);
}
n = named_config_listcount(typelist);
@@ -305,6 +316,8 @@ configure_zone_ssutable(const cfg_obj_t *zconfig, dns_zone_t *zone,
typeobj = cfg_listelt_value(element2);
str = cfg_obj_asstring(typeobj);
r.base = UNCONST(str);
isc_buffer_putstr(&dbuf, " ");
isc_buffer_putstr(&dbuf, str);
bracket = strchr(str, '(' /*)*/);
if (bracket != NULL) {
@@ -337,9 +350,10 @@ configure_zone_ssutable(const cfg_obj_t *zconfig, dns_zone_t *zone,
}
INSIST(i == n);
isc_buffer_putuint8(&dbuf, '\0');
dns_ssutable_addrule(table, grant, dns_fixedname_name(&fident),
mtype, dns_fixedname_name(&fname), n,
types);
types, isc_buffer_base(&dbuf));
if (types != NULL) {
isc_mem_cput(mctx, types, n, sizeof(*types));
}
@@ -363,17 +377,18 @@ configure_zone_ssutable(const cfg_obj_t *zconfig, dns_zone_t *zone,
goto cleanup;
}
dns_ssutable_addrule(table, true,
named_g_server->session_keyname,
dns_ssumatchtype_local,
dns_zone_getorigin(zone), 1, &any);
dns_ssutable_addrule(
table, true, named_g_server->session_keyname,
dns_ssumatchtype_local, dns_zone_getorigin(zone), 1,
&any, "local");
}
dns_zone_setssutable(zone, table);
cleanup:
isc_buffer_clearmctx(&dbuf);
dns_ssutable_detach(&table);
return (result);
return result;
}
/*
@@ -415,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) {
@@ -423,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) {
@@ -454,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 */
@@ -468,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;
}
/*%
@@ -509,14 +524,14 @@ configure_staticstub_servernames(const cfg_obj_t *zconfig, dns_zone_t *zone,
"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);
@@ -530,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;
}
/*%
@@ -555,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);
@@ -670,7 +688,7 @@ cleanup:
INSIST(dbversion == NULL);
return (result);
return result;
}
/*%
@@ -683,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);
}
/*%
@@ -714,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;
}
/*%
@@ -730,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 };
@@ -777,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);
@@ -825,7 +843,7 @@ isself(dns_view_t *myview, dns_tsigkey_t *mykey, const isc_sockaddr_t *srcaddr,
break;
}
}
return (view == myview);
return view == myview;
}
/*%
@@ -843,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;
}
/*
@@ -857,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
@@ -960,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);
@@ -1091,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));
}
/*
@@ -1186,6 +1197,8 @@ named_zone_configure(const cfg_obj_t *config, const cfg_obj_t *vconfig,
if (ztype != dns_zone_stub && ztype != dns_zone_staticstub &&
ztype != dns_zone_redirect)
{
bool logreports = false;
/* Make a reference to the default policy. */
result = dns_kasplist_find(kasplist, "default", &kasp);
INSIST(result == ISC_R_SUCCESS && kasp != NULL);
@@ -1253,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);
@@ -1459,6 +1472,51 @@ named_zone_configure(const cfg_obj_t *config, const cfg_obj_t *vconfig,
INSIST(result == ISC_R_SUCCESS && obj != NULL);
dns_zone_setoption(zone, DNS_ZONEOPT_NSEC3TESTZONE,
cfg_obj_asboolean(obj));
obj = NULL;
result = cfg_map_get(zoptions, "log-report-channel", &obj);
if (result == ISC_R_SUCCESS) {
logreports = cfg_obj_asboolean(obj);
dns_zone_setoption(zone, DNS_ZONEOPT_LOGREPORTS,
logreports);
}
obj = NULL;
result = named_config_get(maps, "send-report-channel", &obj);
if (result == ISC_R_SUCCESS && obj != NULL) {
dns_fixedname_t fixed;
dns_name_t *rad = dns_fixedname_initname(&fixed);
const char *adstr = cfg_obj_asstring(obj);
dns_name_t *zn = dns_zone_getorigin(zone);
CHECK(dns_name_fromstring(rad, adstr, dns_rootname, 0,
mctx));
if (logreports || dns_name_equal(rad, dns_rootname)) {
/* Disable RC for error-logging zones or root */
dns_zone_setrad(zone, NULL);
} else if (dns_name_equal(rad, zn)) {
/*
* It's illegal to set a matching agent
* domain at the zone level, but it could
* be set in options/view. If so, and the
* matching zone doesn't log reports, warn.
*/
cfg_obj_log(obj, ISC_LOG_WARNING,
"send-report-channel is set to "
"'%s' but that zone does not have "
"log-report-channel set",
zname);
dns_zone_setrad(zone, NULL);
} else if (dns_name_issubdomain(rad, zn)) {
cfg_obj_log(obj, ISC_LOG_WARNING,
"send-report-channel '%s' ignored "
"for zone '%s' because it is a "
"subdomain of the zone",
adstr, zname);
dns_zone_setrad(zone, NULL);
} else {
dns_zone_setrad(zone, rad);
}
}
} else if (ztype == dns_zone_redirect) {
dns_zone_setnotifytype(zone, dns_notifytype_no);
@@ -1562,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);
@@ -1614,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);
@@ -1788,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);
}
@@ -1796,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);
@@ -1884,7 +1941,7 @@ cleanup:
if (kasp != NULL) {
dns_kasp_detach(&kasp);
}
return (result);
return result;
}
/*
@@ -1899,11 +1956,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
@@ -1927,7 +1984,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 */
@@ -1948,17 +2005,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;
@@ -1974,10 +2031,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
@@ -2011,13 +2068,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);
@@ -2030,8 +2087,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;
}
+140 -141
View File
@@ -253,7 +253,7 @@ getzoneclass(void) {
if (zoneclass == dns_rdataclass_none) {
zoneclass = defaultclass;
}
return (zoneclass);
return zoneclass;
}
static bool
@@ -263,9 +263,9 @@ setzoneclass(dns_rdataclass_t rdclass) {
zoneclass = rdclass;
}
if (zoneclass != rdclass) {
return (false);
return false;
}
return (true);
return true;
}
static void
@@ -329,7 +329,7 @@ nsu_strsep(char **stringp, const char *delim) {
char sc, dc;
if (string == NULL) {
return (NULL);
return NULL;
}
for (; *string != '\0'; string++) {
@@ -350,11 +350,11 @@ nsu_strsep(char **stringp, const char *delim) {
if (sc == dc) {
*s++ = '\0';
*stringp = s;
return (string);
return string;
}
}
}
return (string);
return string;
}
static void
@@ -390,7 +390,7 @@ parse_hmac(const char *hmacstr, size_t len, dst_algorithm_t *hmac_alg,
if (len >= sizeof(buf)) {
error("unknown key type '%.*s'", (int)(len), hmacstr);
return (false);
return false;
}
/* Copy len bytes and NUL terminate. */
@@ -403,7 +403,7 @@ parse_hmac(const char *hmacstr, size_t len, dst_algorithm_t *hmac_alg,
result = isc_parse_uint16(&digestbits, &buf[9], 10);
if (result != ISC_R_SUCCESS || digestbits > 128) {
error("digest-bits out of range [0..128]");
return (false);
return false;
}
*digestbitsp = (digestbits + 7) & ~0x7U;
} else if (strcasecmp(buf, "hmac-sha1") == 0) {
@@ -413,7 +413,7 @@ parse_hmac(const char *hmacstr, size_t len, dst_algorithm_t *hmac_alg,
result = isc_parse_uint16(&digestbits, &buf[10], 10);
if (result != ISC_R_SUCCESS || digestbits > 160) {
error("digest-bits out of range [0..160]");
return (false);
return false;
}
*digestbitsp = (digestbits + 7) & ~0x7U;
} else if (strcasecmp(buf, "hmac-sha224") == 0) {
@@ -423,7 +423,7 @@ parse_hmac(const char *hmacstr, size_t len, dst_algorithm_t *hmac_alg,
result = isc_parse_uint16(&digestbits, &buf[12], 10);
if (result != ISC_R_SUCCESS || digestbits > 224) {
error("digest-bits out of range [0..224]");
return (false);
return false;
}
*digestbitsp = (digestbits + 7) & ~0x7U;
} else if (strcasecmp(buf, "hmac-sha256") == 0) {
@@ -433,7 +433,7 @@ parse_hmac(const char *hmacstr, size_t len, dst_algorithm_t *hmac_alg,
result = isc_parse_uint16(&digestbits, &buf[12], 10);
if (result != ISC_R_SUCCESS || digestbits > 256) {
error("digest-bits out of range [0..256]");
return (false);
return false;
}
*digestbitsp = (digestbits + 7) & ~0x7U;
} else if (strcasecmp(buf, "hmac-sha384") == 0) {
@@ -443,7 +443,7 @@ parse_hmac(const char *hmacstr, size_t len, dst_algorithm_t *hmac_alg,
result = isc_parse_uint16(&digestbits, &buf[12], 10);
if (result != ISC_R_SUCCESS || digestbits > 384) {
error("digest-bits out of range [0..384]");
return (false);
return false;
}
*digestbitsp = (digestbits + 7) & ~0x7U;
} else if (strcasecmp(buf, "hmac-sha512") == 0) {
@@ -453,14 +453,14 @@ parse_hmac(const char *hmacstr, size_t len, dst_algorithm_t *hmac_alg,
result = isc_parse_uint16(&digestbits, &buf[12], 10);
if (result != ISC_R_SUCCESS || digestbits > 512) {
error("digest-bits out of range [0..512]");
return (false);
return false;
}
*digestbitsp = (digestbits + 7) & ~0x7U;
} else {
error("unknown key type '%s'", buf);
return (false);
return false;
}
return (true);
return true;
}
static int
@@ -474,7 +474,7 @@ basenamelen(const char *file) {
} else if (len > 4 && strcmp(file + len - 4, ".key") == 0) {
len -= 4;
}
return (len);
return len;
}
static void
@@ -570,7 +570,7 @@ read_sessionkey(isc_mem_t *mctx) {
int len;
if (!isc_file_exists(keyfile)) {
return (ISC_R_FILENOTFOUND);
return ISC_R_FILENOTFOUND;
}
result = cfg_parser_create(mctx, &pctx);
@@ -616,7 +616,7 @@ cleanup:
isc_mem_free(mctx, keystr);
}
return (result);
return result;
}
static void
@@ -766,14 +766,12 @@ set_source_ports(dns_dispatchmgr_t *manager) {
in_port_t udpport_low, udpport_high;
isc_result_t result;
result = isc_portset_create(gmctx, &v4portset);
check_result(result, "isc_portset_create (v4)");
isc_portset_create(gmctx, &v4portset);
result = isc_net_getudpportrange(AF_INET, &udpport_low, &udpport_high);
check_result(result, "isc_net_getudpportrange (v4)");
isc_portset_addrange(v4portset, udpport_low, udpport_high);
result = isc_portset_create(gmctx, &v6portset);
check_result(result, "isc_portset_create (v6)");
isc_portset_create(gmctx, &v6portset);
result = isc_net_getudpportrange(AF_INET6, &udpport_low, &udpport_high);
check_result(result, "isc_net_getudpportrange (v6)");
isc_portset_addrange(v6portset, udpport_low, udpport_high);
@@ -794,8 +792,8 @@ create_name(const char *str, char *namedata, size_t len, dns_name_t *name) {
isc_buffer_add(&namesrc, strlen(str));
isc_buffer_init(&namebuf, namedata, len);
return (dns_name_fromtext(name, &namesrc, dns_rootname,
DNS_NAME_DOWNCASE, &namebuf));
return dns_name_fromtext(name, &namesrc, dns_rootname,
DNS_NAME_DOWNCASE, &namebuf);
}
static void
@@ -993,7 +991,7 @@ get_addresses(char *host, in_port_t port, isc_sockaddr_t *sockaddr,
error("couldn't get address for '%s': %s", host,
isc_result_totext(result));
}
return (count);
return count;
}
#define PARSE_ARGS_FMT "46A:C:dDE:ghH:iK:lL:MoOk:p:Pr:R:St:Tu:vVy:"
@@ -1303,7 +1301,7 @@ parse_name(char **cmdlinep, dns_message_t *msg, dns_name_t **namep) {
word = nsu_strsep(cmdlinep, " \t\r\n");
if (word == NULL || *word == 0) {
fprintf(stderr, "could not read owner name\n");
return (STATUS_SYNTAX);
return STATUS_SYNTAX;
}
dns_message_gettempname(msg, namep);
@@ -1314,10 +1312,10 @@ parse_name(char **cmdlinep, dns_message_t *msg, dns_name_t **namep) {
error("invalid owner name: %s", isc_result_totext(result));
isc_buffer_invalidate(&source);
dns_message_puttempname(msg, namep);
return (STATUS_SYNTAX);
return STATUS_SYNTAX;
}
isc_buffer_invalidate(&source);
return (STATUS_MORE);
return STATUS_MORE;
}
static uint16_t
@@ -1332,7 +1330,7 @@ parse_rdata(char **cmdlinep, dns_rdataclass_t rdataclass,
if (cmdline == NULL) {
rdata->flags = DNS_RDATA_UPDATE;
return (STATUS_MORE);
return STATUS_MORE;
}
while (*cmdline != 0 && isspace((unsigned char)*cmdline)) {
@@ -1363,13 +1361,13 @@ parse_rdata(char **cmdlinep, dns_rdataclass_t rdataclass,
fprintf(stderr, "invalid rdata format: %s\n",
isc_result_totext(result));
isc_buffer_free(&buf);
return (STATUS_SYNTAX);
return STATUS_SYNTAX;
}
} else {
rdata->flags = DNS_RDATA_UPDATE;
}
*cmdlinep = cmdline;
return (STATUS_MORE);
return STATUS_MORE;
}
static uint16_t
@@ -1392,7 +1390,7 @@ make_prereq(char *cmdline, bool ispositive, bool isrrset) {
*/
retval = parse_name(&cmdline, updatemsg, &name);
if (retval != STATUS_MORE) {
return (retval);
return retval;
}
/*
@@ -1472,13 +1470,13 @@ make_prereq(char *cmdline, bool ispositive, bool isrrset) {
ISC_LIST_INIT(name->list);
ISC_LIST_APPEND(name->list, rdataset, link);
dns_message_addname(updatemsg, name, DNS_SECTION_PREREQUISITE);
return (STATUS_MORE);
return STATUS_MORE;
failure:
if (name != NULL) {
dns_message_puttempname(updatemsg, &name);
}
return (STATUS_SYNTAX);
return STATUS_SYNTAX;
}
static uint16_t
@@ -1490,7 +1488,7 @@ evaluate_prereq(char *cmdline) {
word = nsu_strsep(&cmdline, " \t\r\n");
if (word == NULL || *word == 0) {
fprintf(stderr, "could not read operation code\n");
return (STATUS_SYNTAX);
return STATUS_SYNTAX;
}
if (strcasecmp(word, "nxdomain") == 0) {
ispositive = false;
@@ -1506,9 +1504,9 @@ evaluate_prereq(char *cmdline) {
isrrset = true;
} else {
fprintf(stderr, "incorrect operation code: %s\n", word);
return (STATUS_SYNTAX);
return STATUS_SYNTAX;
}
return (make_prereq(cmdline, ispositive, isrrset));
return make_prereq(cmdline, ispositive, isrrset);
}
static void
@@ -1554,7 +1552,7 @@ evaluate_lease(char *cmdline) {
word = nsu_strsep(&cmdline, " \t\r\n");
if (word == NULL || *word == 0) {
fprintf(stderr, "could not read ttl\n");
return (STATUS_SYNTAX);
return STATUS_SYNTAX;
}
if (!strcasecmp(word, "none")) {
@@ -1563,12 +1561,12 @@ evaluate_lease(char *cmdline) {
keylease = 0;
keylease_set = false;
updateopt();
return (STATUS_MORE);
return STATUS_MORE;
}
result = isc_parse_uint32(&value1, word, 10);
if (result != ISC_R_SUCCESS) {
return (STATUS_SYNTAX);
return STATUS_SYNTAX;
}
word = nsu_strsep(&cmdline, " \t\r\n");
@@ -1578,12 +1576,12 @@ evaluate_lease(char *cmdline) {
keylease = 0;
keylease_set = false;
updateopt();
return (STATUS_MORE);
return STATUS_MORE;
}
result = isc_parse_uint32(&value2, word, 10);
if (result != ISC_R_SUCCESS) {
return (STATUS_SYNTAX);
return STATUS_SYNTAX;
}
lease = value1;
@@ -1592,7 +1590,7 @@ evaluate_lease(char *cmdline) {
keylease_set = true;
updateopt();
return (STATUS_MORE);
return STATUS_MORE;
}
static uint16_t
@@ -1602,13 +1600,13 @@ evaluate_server(char *cmdline) {
if (local_only) {
fprintf(stderr, "cannot reset server in localhost-only mode\n");
return (STATUS_SYNTAX);
return STATUS_SYNTAX;
}
word = nsu_strsep(&cmdline, " \t\r\n");
if (word == NULL || *word == 0) {
fprintf(stderr, "could not read server name\n");
return (STATUS_SYNTAX);
return STATUS_SYNTAX;
}
server = word;
@@ -1620,13 +1618,13 @@ evaluate_server(char *cmdline) {
port = strtol(word, &endp, 10);
if (*endp != 0) {
fprintf(stderr, "port '%s' is not numeric\n", word);
return (STATUS_SYNTAX);
return STATUS_SYNTAX;
} else if (port < 1 || port > 65535) {
fprintf(stderr,
"port '%s' is out of range "
"(1 to 65535)\n",
word);
return (STATUS_SYNTAX);
return STATUS_SYNTAX;
}
}
@@ -1644,10 +1642,10 @@ evaluate_server(char *cmdline) {
servers = isc_mem_cget(gmctx, ns_alloc, sizeof(isc_sockaddr_t));
ns_total = get_addresses(server, (in_port_t)port, servers, ns_alloc);
if (ns_total == 0) {
return (STATUS_SYNTAX);
return STATUS_SYNTAX;
}
return (STATUS_MORE);
return STATUS_MORE;
}
static uint16_t
@@ -1660,7 +1658,7 @@ evaluate_local(char *cmdline) {
word = nsu_strsep(&cmdline, " \t\r\n");
if (word == NULL || *word == 0) {
fprintf(stderr, "could not read server name\n");
return (STATUS_SYNTAX);
return STATUS_SYNTAX;
}
local = word;
@@ -1672,13 +1670,13 @@ evaluate_local(char *cmdline) {
port = strtol(word, &endp, 10);
if (*endp != 0) {
fprintf(stderr, "port '%s' is not numeric\n", word);
return (STATUS_SYNTAX);
return STATUS_SYNTAX;
} else if (port < 1 || port > 65535) {
fprintf(stderr,
"port '%s' is out of range "
"(1 to 65535)\n",
word);
return (STATUS_SYNTAX);
return STATUS_SYNTAX;
}
}
@@ -1694,10 +1692,10 @@ evaluate_local(char *cmdline) {
isc_sockaddr_fromin(localaddr4, &in4, (in_port_t)port);
} else {
fprintf(stderr, "invalid address %s", local);
return (STATUS_SYNTAX);
return STATUS_SYNTAX;
}
return (STATUS_MORE);
return STATUS_MORE;
}
static uint16_t
@@ -1718,7 +1716,7 @@ evaluate_key(char *cmdline) {
namestr = nsu_strsep(&cmdline, " \t\r\n");
if (namestr == NULL || *namestr == 0) {
fprintf(stderr, "could not read key name\n");
return (STATUS_SYNTAX);
return STATUS_SYNTAX;
}
mykeyname = dns_fixedname_initname(&fkeyname);
@@ -1726,7 +1724,7 @@ evaluate_key(char *cmdline) {
n = strchr(namestr, ':');
if (n != NULL) {
if (!parse_hmac(namestr, n - namestr, &hmac_alg, &digestbits)) {
return (STATUS_SYNTAX);
return STATUS_SYNTAX;
}
namestr = n + 1;
} else {
@@ -1738,13 +1736,13 @@ evaluate_key(char *cmdline) {
result = dns_name_fromtext(mykeyname, &b, dns_rootname, 0, NULL);
if (result != ISC_R_SUCCESS) {
fprintf(stderr, "could not parse key name\n");
return (STATUS_SYNTAX);
return STATUS_SYNTAX;
}
secretstr = nsu_strsep(&cmdline, "\r\n");
if (secretstr == NULL || *secretstr == 0) {
fprintf(stderr, "could not read key secret\n");
return (STATUS_SYNTAX);
return STATUS_SYNTAX;
}
secretlen = strlen(secretstr) * 3 / 4;
secret = isc_mem_allocate(gmctx, secretlen);
@@ -1755,7 +1753,7 @@ evaluate_key(char *cmdline) {
fprintf(stderr, "could not create key from %s: %s\n", secretstr,
isc_result_totext(result));
isc_mem_free(gmctx, secret);
return (STATUS_SYNTAX);
return STATUS_SYNTAX;
}
secretlen = isc_buffer_usedlength(&secretbuf);
@@ -1768,10 +1766,10 @@ evaluate_key(char *cmdline) {
if (result != ISC_R_SUCCESS) {
fprintf(stderr, "could not create key from %s %s: %s\n",
namestr, secretstr, isc_result_totext(result));
return (STATUS_SYNTAX);
return STATUS_SYNTAX;
}
dst_key_setbits(tsigkey->key, digestbits);
return (STATUS_MORE);
return STATUS_MORE;
}
static uint16_t
@@ -1783,7 +1781,7 @@ evaluate_zone(char *cmdline) {
word = nsu_strsep(&cmdline, " \t\r\n");
if (word == NULL || *word == 0) {
fprintf(stderr, "could not read zone name\n");
return (STATUS_SYNTAX);
return STATUS_SYNTAX;
}
userzone = dns_fixedname_initname(&fuserzone);
@@ -1793,10 +1791,10 @@ evaluate_zone(char *cmdline) {
if (result != ISC_R_SUCCESS) {
userzone = NULL; /* Lest it point to an invalid name */
fprintf(stderr, "could not parse zone name\n");
return (STATUS_SYNTAX);
return STATUS_SYNTAX;
}
return (STATUS_MORE);
return STATUS_MORE;
}
static uint16_t
@@ -1813,19 +1811,19 @@ evaluate_realm(char *cmdline) {
word = nsu_strsep(&cmdline, " \t\r\n");
if (word == NULL || *word == 0) {
return (STATUS_MORE);
return STATUS_MORE;
}
n = snprintf(buf, sizeof(buf), "@%s", word);
if (n < 0 || (size_t)n >= sizeof(buf)) {
error("realm is too long");
return (STATUS_SYNTAX);
return STATUS_SYNTAX;
}
realm = isc_mem_strdup(gmctx, buf);
return (STATUS_MORE);
return STATUS_MORE;
#else /* HAVE_GSSAPI */
UNUSED(cmdline);
return (STATUS_SYNTAX);
return STATUS_SYNTAX;
#endif /* HAVE_GSSAPI */
}
@@ -1838,29 +1836,29 @@ evaluate_ttl(char *cmdline) {
word = nsu_strsep(&cmdline, " \t\r\n");
if (word == NULL || *word == 0) {
fprintf(stderr, "could not read ttl\n");
return (STATUS_SYNTAX);
return STATUS_SYNTAX;
}
if (!strcasecmp(word, "none")) {
default_ttl = 0;
default_ttl_set = false;
return (STATUS_MORE);
return STATUS_MORE;
}
result = isc_parse_uint32(&ttl, word, 10);
if (result != ISC_R_SUCCESS) {
return (STATUS_SYNTAX);
return STATUS_SYNTAX;
}
if (ttl > TTL_MAX) {
fprintf(stderr, "ttl '%s' is out of range (0 to %u)\n", word,
TTL_MAX);
return (STATUS_SYNTAX);
return STATUS_SYNTAX;
}
default_ttl = ttl;
default_ttl_set = true;
return (STATUS_MORE);
return STATUS_MORE;
}
static uint16_t
@@ -1873,7 +1871,7 @@ evaluate_class(char *cmdline) {
word = nsu_strsep(&cmdline, " \t\r\n");
if (word == NULL || *word == 0) {
fprintf(stderr, "could not read class name\n");
return (STATUS_SYNTAX);
return STATUS_SYNTAX;
}
r.base = word;
@@ -1881,19 +1879,19 @@ evaluate_class(char *cmdline) {
result = dns_rdataclass_fromtext(&rdclass, &r);
if (result != ISC_R_SUCCESS) {
fprintf(stderr, "could not parse class name: %s\n", word);
return (STATUS_SYNTAX);
return STATUS_SYNTAX;
}
switch (rdclass) {
case dns_rdataclass_none:
case dns_rdataclass_any:
case dns_rdataclass_reserved0:
fprintf(stderr, "bad default class: %s\n", word);
return (STATUS_SYNTAX);
return STATUS_SYNTAX;
default:
defaultclass = rdclass;
}
return (STATUS_MORE);
return STATUS_MORE;
}
static uint16_t
@@ -1917,7 +1915,7 @@ update_addordelete(char *cmdline, bool isdelete) {
*/
retval = parse_name(&cmdline, updatemsg, &name);
if (retval != STATUS_MORE) {
return (retval);
return retval;
}
dns_message_gettemprdata(updatemsg, &rdata);
@@ -2103,14 +2101,14 @@ doneparsing:
ISC_LIST_INIT(name->list);
ISC_LIST_APPEND(name->list, rdataset, link);
dns_message_addname(updatemsg, name, DNS_SECTION_UPDATE);
return (STATUS_MORE);
return STATUS_MORE;
failure:
if (name != NULL) {
dns_message_puttempname(updatemsg, &name);
}
dns_message_puttemprdata(updatemsg, &rdata);
return (STATUS_SYNTAX);
return STATUS_SYNTAX;
}
static uint16_t
@@ -2122,7 +2120,7 @@ evaluate_update(char *cmdline) {
word = nsu_strsep(&cmdline, " \t\r\n");
if (word == NULL || *word == 0) {
fprintf(stderr, "could not read operation code\n");
return (STATUS_SYNTAX);
return STATUS_SYNTAX;
}
if (strcasecmp(word, "delete") == 0) {
isdelete = true;
@@ -2132,9 +2130,9 @@ evaluate_update(char *cmdline) {
isdelete = false;
} else {
fprintf(stderr, "incorrect operation code: %s\n", word);
return (STATUS_SYNTAX);
return STATUS_SYNTAX;
}
return (update_addordelete(cmdline, isdelete));
return update_addordelete(cmdline, isdelete);
}
static uint16_t
@@ -2145,7 +2143,7 @@ evaluate_checknames(char *cmdline) {
word = nsu_strsep(&cmdline, " \t\r\n");
if (word == NULL || *word == 0) {
fprintf(stderr, "could not read check-names directive\n");
return (STATUS_SYNTAX);
return STATUS_SYNTAX;
}
if (strcasecmp(word, "yes") == 0 || strcasecmp(word, "true") == 0 ||
strcasecmp(word, "on") == 0)
@@ -2158,9 +2156,9 @@ evaluate_checknames(char *cmdline) {
checknames = false;
} else {
fprintf(stderr, "incorrect check-names directive: %s\n", word);
return (STATUS_SYNTAX);
return STATUS_SYNTAX;
}
return (STATUS_MORE);
return STATUS_MORE;
}
static uint16_t
@@ -2171,7 +2169,7 @@ evaluate_checksvcb(char *cmdline) {
word = nsu_strsep(&cmdline, " \t\r\n");
if (word == NULL || *word == 0) {
fprintf(stderr, "could not read check-svcb directive\n");
return (STATUS_SYNTAX);
return STATUS_SYNTAX;
}
if (strcasecmp(word, "yes") == 0 || strcasecmp(word, "true") == 0 ||
strcasecmp(word, "on") == 0)
@@ -2184,9 +2182,9 @@ evaluate_checksvcb(char *cmdline) {
checksvcb = false;
} else {
fprintf(stderr, "incorrect check-svcb directive: %s\n", word);
return (STATUS_SYNTAX);
return STATUS_SYNTAX;
}
return (STATUS_MORE);
return STATUS_MORE;
}
static void
@@ -2264,58 +2262,58 @@ do_next_command(char *cmdline) {
word = nsu_strsep(&cmdline, " \t\r\n");
if (word == NULL || *word == 0) {
return (STATUS_SEND);
return STATUS_SEND;
}
if (word[0] == ';') {
return (STATUS_MORE);
return STATUS_MORE;
}
if (strcasecmp(word, "quit") == 0) {
return (STATUS_QUIT);
return STATUS_QUIT;
}
if (strcasecmp(word, "prereq") == 0) {
return (evaluate_prereq(cmdline));
return evaluate_prereq(cmdline);
}
if (strcasecmp(word, "nxdomain") == 0) {
return (make_prereq(cmdline, false, false));
return make_prereq(cmdline, false, false);
}
if (strcasecmp(word, "yxdomain") == 0) {
return (make_prereq(cmdline, true, false));
return make_prereq(cmdline, true, false);
}
if (strcasecmp(word, "nxrrset") == 0) {
return (make_prereq(cmdline, false, true));
return make_prereq(cmdline, false, true);
}
if (strcasecmp(word, "yxrrset") == 0) {
return (make_prereq(cmdline, true, true));
return make_prereq(cmdline, true, true);
}
if (strcasecmp(word, "update") == 0) {
return (evaluate_update(cmdline));
return evaluate_update(cmdline);
}
if (strcasecmp(word, "delete") == 0) {
return (update_addordelete(cmdline, true));
return update_addordelete(cmdline, true);
}
if (strcasecmp(word, "del") == 0) {
return (update_addordelete(cmdline, true));
return update_addordelete(cmdline, true);
}
if (strcasecmp(word, "add") == 0) {
return (update_addordelete(cmdline, false));
return update_addordelete(cmdline, false);
}
if (strcasecmp(word, "lease") == 0) {
return (evaluate_lease(cmdline));
return evaluate_lease(cmdline);
}
if (strcasecmp(word, "server") == 0) {
return (evaluate_server(cmdline));
return evaluate_server(cmdline);
}
if (strcasecmp(word, "local") == 0) {
return (evaluate_local(cmdline));
return evaluate_local(cmdline);
}
if (strcasecmp(word, "zone") == 0) {
return (evaluate_zone(cmdline));
return evaluate_zone(cmdline);
}
if (strcasecmp(word, "class") == 0) {
return (evaluate_class(cmdline));
return evaluate_class(cmdline);
}
if (strcasecmp(word, "send") == 0) {
return (STATUS_SEND);
return STATUS_SEND;
}
if (strcasecmp(word, "debug") == 0) {
if (debugging) {
@@ -2323,14 +2321,14 @@ do_next_command(char *cmdline) {
} else {
debugging = true;
}
return (STATUS_MORE);
return STATUS_MORE;
}
if (strcasecmp(word, "ttl") == 0) {
return (evaluate_ttl(cmdline));
return evaluate_ttl(cmdline);
}
if (strcasecmp(word, "show") == 0) {
show_message(stdout, updatemsg, "Outgoing update query:");
return (STATUS_MORE);
return STATUS_MORE;
}
if (strcasecmp(word, "answer") == 0) {
LOCK(&answer_lock);
@@ -2338,24 +2336,24 @@ do_next_command(char *cmdline) {
show_message(stdout, answer, "Answer:");
}
UNLOCK(&answer_lock);
return (STATUS_MORE);
return STATUS_MORE;
}
if (strcasecmp(word, "key") == 0) {
usegsstsig = false;
return (evaluate_key(cmdline));
return evaluate_key(cmdline);
}
if (strcasecmp(word, "realm") == 0) {
return (evaluate_realm(cmdline));
return evaluate_realm(cmdline);
}
if (strcasecmp(word, "check-names") == 0 ||
strcasecmp(word, "checknames") == 0)
{
return (evaluate_checknames(cmdline));
return evaluate_checknames(cmdline);
}
if (strcasecmp(word, "check-svcb") == 0 ||
strcasecmp(word, "checksvcb") == 0)
{
return (evaluate_checksvcb(cmdline));
return evaluate_checksvcb(cmdline);
}
if (strcasecmp(word, "gsstsig") == 0) {
#if HAVE_GSSAPI
@@ -2363,7 +2361,7 @@ do_next_command(char *cmdline) {
#else /* HAVE_GSSAPI */
fprintf(stderr, "gsstsig not supported\n");
#endif /* HAVE_GSSAPI */
return (STATUS_MORE);
return STATUS_MORE;
}
if (strcasecmp(word, "oldgsstsig") == 0) {
#if HAVE_GSSAPI
@@ -2371,7 +2369,7 @@ do_next_command(char *cmdline) {
#else /* HAVE_GSSAPI */
fprintf(stderr, "gsstsig not supported\n");
#endif /* HAVE_GSSAPI */
return (STATUS_MORE);
return STATUS_MORE;
}
if (strcasecmp(word, "help") == 0) {
fprintf(stdout, "nsupdate " PACKAGE_VERSION ":\n"
@@ -2411,14 +2409,14 @@ do_next_command(char *cmdline) {
"record to the zone)\n"
"[update] del[ete] .... (remove the given "
"record(s) from the zone)\n");
return (STATUS_MORE);
return STATUS_MORE;
}
if (strcasecmp(word, "version") == 0) {
fprintf(stdout, "nsupdate " PACKAGE_VERSION "\n");
return (STATUS_MORE);
return STATUS_MORE;
}
fprintf(stderr, "incorrect section name: %s\n", word);
return (STATUS_SYNTAX);
return STATUS_SYNTAX;
}
static uint16_t
@@ -2450,7 +2448,7 @@ get_next_command(void) {
free(ptr);
}
return (result);
return result;
}
static bool
@@ -2465,9 +2463,9 @@ user_interaction(void) {
}
}
if (result == STATUS_SEND) {
return (true);
return true;
}
return (false);
return false;
}
static void
@@ -2512,10 +2510,10 @@ next_primary(const char *caller, isc_sockaddr_t *addr, isc_result_t eresult) {
fprintf(stderr, "; Communication with %s failed: %s\n", addrbuf,
isc_result_totext(eresult));
if (++primary_inuse >= primary_total) {
return (false);
return false;
}
ddebug("%s: trying next server", caller);
return (true);
return true;
}
static void
@@ -2665,9 +2663,9 @@ send_update(dns_name_t *zone, isc_sockaddr_t *primary) {
result = dns_request_create(requestmgr, updatemsg, srcaddr, primary,
req_transport, req_tls_ctx_cache, options,
tsigkey, timeout, udp_timeout, udp_retries,
isc_loop_main(loopmgr), update_completed,
NULL, &request);
tsigkey, timeout, timeout, udp_timeout,
udp_retries, isc_loop_main(loopmgr),
update_completed, NULL, &request);
check_result(result, "dns_request_create");
if (debugging) {
@@ -2770,11 +2768,11 @@ recvsoa(void *arg) {
srcaddr = localaddr4;
}
result = dns_request_create(requestmgr, soaquery, srcaddr, addr,
req_transport, req_tls_ctx_cache,
options, NULL, timeout, udp_timeout,
udp_retries, isc_loop_main(loopmgr),
recvsoa, reqinfo, &request);
result = dns_request_create(
requestmgr, soaquery, srcaddr, addr, req_transport,
req_tls_ctx_cache, options, NULL, timeout, timeout,
udp_timeout, udp_retries, isc_loop_main(loopmgr),
recvsoa, reqinfo, &request);
check_result(result, "dns_request_create");
requests++;
return;
@@ -3009,8 +3007,8 @@ sendrequest(isc_sockaddr_t *destaddr, dns_message_t *msg,
result = dns_request_create(
requestmgr, msg, srcaddr, destaddr, req_transport,
req_tls_ctx_cache, options, default_servers ? NULL : tsigkey,
timeout, udp_timeout, udp_retries, isc_loop_main(loopmgr),
recvsoa, reqinfo, request);
timeout, timeout, udp_timeout, udp_retries,
isc_loop_main(loopmgr), recvsoa, reqinfo, request);
check_result(result, "dns_request_create");
requests++;
}
@@ -3210,10 +3208,11 @@ send_gssrequest(isc_sockaddr_t *destaddr, dns_message_t *msg,
srcaddr = localaddr4;
}
result = dns_request_create(
requestmgr, msg, srcaddr, destaddr, req_transport,
req_tls_ctx_cache, options, tsigkey, timeout, udp_timeout,
udp_retries, isc_loop_main(loopmgr), recvgss, reqinfo, request);
result = dns_request_create(requestmgr, msg, srcaddr, destaddr,
req_transport, req_tls_ctx_cache, options,
tsigkey, timeout, timeout, udp_timeout,
udp_retries, isc_loop_main(loopmgr),
recvgss, reqinfo, request);
check_result(result, "dns_request_create");
if (debugging) {
show_message(stdout, msg, "Outgoing update query:");
@@ -3556,8 +3555,8 @@ main(int argc, char **argv) {
cleanup();
if (seenerror) {
return (2);
return 2;
}
return (0);
return 0;
}
+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;
}
+6 -2
View File
@@ -143,6 +143,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 +1017,8 @@ main(int argc, char **argv) {
isc_managers_destroy(&rndc_mctx, &loopmgr, &netmgr);
if (failed) {
return (1);
return 1;
}
return (0);
return 0;
}
+19 -5
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
@@ -429,8 +442,10 @@ Currently supported commands are:
The first list includes all unique clients that are waiting for
recursion to complete, including the query that is awaiting a
response and the timestamp (seconds since the Unix epoch) of
when named started processing this client query.
response, the timestamp (seconds since the Unix epoch) of
when named started processing this client query, the client's
address, and the transport over which the the query was received
(UDP, TCP, TLS, or HTTP).
The second list comprises of domains for which there are active
(or recently active) fetches in progress. It reports the number
@@ -489,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
+1
View File
@@ -16,6 +16,7 @@ named.run
/*.trs
/*.xml
/resolve
/legacy.run.sh
/run.log
/start.sh
/stop.sh
+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 \
+12 -3
View File
@@ -51,6 +51,7 @@ To run system tests, make sure you have the following dependencies installed:
- perl
- dnspython
- pytest-xdist (for parallel execution)
- python-jinja2 (for tests which use jinja templates)
Individual system tests might also require additional dependencies. If those
are missing, the affected tests will be skipped and should produce a message
@@ -154,9 +155,17 @@ system test directories may contain the following standard files:
- `tests_*.py`: These python files are picked up by pytest as modules. If they
contain any test functions, they're added to the test suite.
- `setup.sh`: This sets up the preconditions for the tests. Although optional,
virtually all tests will require such a file to set up the ports they should
use for the test.
- `*.j2`: These jinja2 templates can be used for configuration files or any
other files which require certain variables filled in, e.g. ports from the
environment variables. During test setup, the pytest runner will automatically
fill those in and strip the filename extension .j2, e.g. `ns1/named.conf.j2`
becomes `ns1/named.conf`. When using advanced templating to conditionally
include/omit entire sections or when filling in custom variables used for the
test, ensure the templates always include the defaults. If you don't need the
file to be auto-templated during test setup, use `.j2.manual` instead and then
no defaults are needed.
- `setup.sh`: This sets up the preconditions for the tests.
- `tests.sh`: Any shell-based tests are located within this file. Runs the
actual tests.
+6
View File
@@ -19,3 +19,9 @@ key rndc_key {
algorithm hmac-sha256;
secret "1234abcd8765";
};
/* Regresssion test for [GL #4991] */
server example.com {
key rndc-key;
addresses { localhost; 127.0.0.1; ::1; };
};
-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()
-22
View File
@@ -1,22 +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 tests.
#
rm -f dig.out.*
rm -f */named.memstats
rm -f */named.conf
rm -f */named.run
rm -f ns*/managed-keys.bind*
-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()
@@ -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()
-20
View File
@@ -1,20 +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.memstats
rm -f */named.run
rm -f */named.conf
rm -f dig.out.test*
rm -f ns2/example.com.bk
rm -f ns2/example.net.bk
rm -f ns*/managed-keys.bind* ns*/*mkeys*

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