]> git.ipfire.org Git - thirdparty/bind9.git/log
thirdparty/bind9.git
3 years agoMerge branch '3670-fix-http-headers-test' into 'main'
Ondřej Surý [Fri, 11 Nov 2022 09:23:43 +0000 (09:23 +0000)] 
Merge branch '3670-fix-http-headers-test' into 'main'

Update the HTTP headers test to check for 101 headers

Closes #3670

See merge request isc-projects/bind9!7070

3 years agoUpdate the HTTP headers test to check for 101 headers
Ondřej Surý [Fri, 11 Nov 2022 08:19:41 +0000 (09:19 +0100)] 
Update the HTTP headers test to check for 101 headers

When we bumped the number of allowed HTTP headers to 100, we forgot to
bump the number in the system test.  Bump the number in the system test
too.

3 years agoMerge branch '3670-bump-statschannel-headers' into 'main'
Ondřej Surý [Thu, 10 Nov 2022 18:27:44 +0000 (18:27 +0000)] 
Merge branch '3670-bump-statschannel-headers' into 'main'

Bump the allowed HTTP headers in statschannel to 100

Closes #3670

See merge request isc-projects/bind9!7068

3 years agoAdd CHANGES and release note for [GL #3670]
Ondřej Surý [Thu, 10 Nov 2022 15:41:25 +0000 (16:41 +0100)] 
Add CHANGES and release note for [GL #3670]

3 years agoBump the allowed HTTP headers in statschannel to 100
Ondřej Surý [Thu, 10 Nov 2022 15:34:26 +0000 (16:34 +0100)] 
Bump the allowed HTTP headers in statschannel to 100

Firefox 90+ apparently sends more than 10 headers, so we need to bump
the number to some higher number.  Bump it to 100 just to be on a save
side, this is for internal use only anyway.

3 years agoMerge branch 'ondrej-add-isc_hashmap' into 'main'
Ondřej Surý [Thu, 10 Nov 2022 14:08:30 +0000 (14:08 +0000)] 
Merge branch 'ondrej-add-isc_hashmap' into 'main'

Add isc_hashmap API that implements Robin Hood hashing

See merge request isc-projects/bind9!6790

3 years agoAdd CHANGES note for [GL !6790]
Ondřej Surý [Tue, 8 Nov 2022 08:53:23 +0000 (09:53 +0100)] 
Add CHANGES note for [GL !6790]

3 years agoUse isc_hashmap instead of isc_ht in the dns_resolver API
Ondřej Surý [Mon, 7 Nov 2022 14:37:30 +0000 (15:37 +0100)] 
Use isc_hashmap instead of isc_ht in the dns_resolver API

Replace the use of isc_ht API with isc_hashmap API in the dns_resolver
implementation.  This requires extending the fctxbucket_t structure to
include keysize and copy of the key because the isc_hashmap API needs
the raw key in case of resizing the hashmap table.

3 years agoUse isc_hashmap instead of isc_ht in the dns_adb API
Ondřej Surý [Mon, 27 Jun 2022 10:46:06 +0000 (12:46 +0200)] 
Use isc_hashmap instead of isc_ht in the dns_adb API

Replace the use of isc_ht API with isc_hashmap API in the dns_adb
database implementation.  This requires extending the
dns_adbnamebucket_t and dns_adbentrybucket_t structures to include
keysize and copy of the key because the isc_hashmap API needs the raw
key in case of resizing the hashmap table.

3 years agoAdd isc_hashmap API that implements Robin Hood hashing
Ondřej Surý [Fri, 24 Jun 2022 06:32:12 +0000 (08:32 +0200)] 
Add isc_hashmap API that implements Robin Hood hashing

Add new isc_hashmap API that differs from the current isc_ht API in
several aspects:

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

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

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

This makes the isc_hashmap_t a little less universal because of the key
storage requirements, but the inserts and deletes are faster because
they don't require memory allocation on isc_hashmap_add() and memory
deallocation on isc_hashmap_delete().

3 years agoMerge branch '3630-nextpart-is-not-compatible-with-set-x' into 'main'
Mark Andrews [Tue, 8 Nov 2022 16:42:13 +0000 (16:42 +0000)] 
Merge branch '3630-nextpart-is-not-compatible-with-set-x' into 'main'

Resolve "'nextpart' is not compatible with 'set -x'"

Closes #3630

See merge request isc-projects/bind9!6995

3 years agoUse file descriptor 3 to save file.prev
Mark Andrews [Wed, 5 Oct 2022 06:12:16 +0000 (17:12 +1100)] 
Use file descriptor 3 to save file.prev

If 'set -x' is in effect file.prev gets populated with debugging output.
To prevent this open descriptor 3 and redirect stderr from the awk
command to descriptor 3. Debugging output will stay directed to stderr.

3 years agoMerge branch 'tkrizek/danger-approve' into 'main'
Tom Krizek [Tue, 8 Nov 2022 13:37:33 +0000 (13:37 +0000)] 
Merge branch 'tkrizek/danger-approve' into 'main'

ci: add danger checks - approve workflow & wip commits

Closes #3651

See merge request isc-projects/bind9!7041

3 years agoCheck for cherry pick message in backport commits in danger CI
Tom Krizek [Tue, 8 Nov 2022 09:53:09 +0000 (10:53 +0100)] 
Check for cherry pick message in backport commits in danger CI

Using the -x option for cherry pick makes it easy to link commits across
branches and it is recommended to use for all backport commits (with
exceptions -- thus a warning level rather than failure).

3 years agoDetect work-in-progress commits in danger CI
Tom Krizek [Mon, 7 Nov 2022 13:18:55 +0000 (14:18 +0100)] 
Detect work-in-progress commits in danger CI

To avoid accidentally merging unfinished work, detect prohibited
keywords at the start of the subject line. If the first word is any of
the following, fail the check:
WIP, wip, DROP, drop, TODO, todo

The only slightly controversial is the lowercase "drop" which might have
a legitimate use - seems like four commits in the history used it as a
start of a sentence. However, since people commonly use "drop" to
indicate a commit should be dropped before merging, let's prohibit it as
well. In case of false-positive, "Drop" with a capitalized first letter
can always be used.

3 years agoUse approve button workflow in danger CI
Tom Krizek [Fri, 4 Nov 2022 12:05:29 +0000 (13:05 +0100)] 
Use approve button workflow in danger CI

Since the LGTM label was deprecated in favor of using the Approve button
in gitlab, adjust the detection in danger bot.

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

It still makes sense to utilize the danger-python, since it handles the
integration with gitlab which doesn't need to be reimplemented as long
as it works - same with the other checks.

3 years agoMerge branch 'ondrej-name-loop-memory-contexts' into 'main'
Ondřej Surý [Tue, 8 Nov 2022 12:33:17 +0000 (12:33 +0000)] 
Merge branch 'ondrej-name-loop-memory-contexts' into 'main'

Properly name the loop->mctx

See merge request isc-projects/bind9!7046

3 years agoProperly name the loop->mctx
Ondřej Surý [Fri, 4 Nov 2022 14:03:22 +0000 (15:03 +0100)] 
Properly name the loop->mctx

The per loop memory context were unnamed, properly name them as
'loop<tid>'.

3 years agoMerge branch 'michal/set-up-version-and-release-notes-for-bind-9.19.8' into 'main'
Michał Kępień [Tue, 8 Nov 2022 12:30:09 +0000 (12:30 +0000)] 
Merge branch 'michal/set-up-version-and-release-notes-for-bind-9.19.8' into 'main'

Set up version and release notes for BIND 9.19.8

See merge request isc-projects/bind9!7053

3 years agoSet up release notes for BIND 9.19.8
Michał Kępień [Tue, 8 Nov 2022 12:21:29 +0000 (13:21 +0100)] 
Set up release notes for BIND 9.19.8

3 years agoUpdate BIND version to 9.19.8-dev
Michał Kępień [Tue, 8 Nov 2022 12:21:29 +0000 (13:21 +0100)] 
Update BIND version to 9.19.8-dev

3 years agoUpdate BIND version for release v9.19.7
Michał Kępień [Mon, 7 Nov 2022 21:17:02 +0000 (22:17 +0100)] 
Update BIND version for release

3 years agoAdd a CHANGES marker
Michał Kępień [Mon, 7 Nov 2022 21:17:02 +0000 (22:17 +0100)] 
Add a CHANGES marker

3 years agoMerge branch 'michal/prepare-documentation-for-bind-9.19.7' into 'v9_19_7-release'
Michał Kępień [Mon, 7 Nov 2022 21:14:43 +0000 (21:14 +0000)] 
Merge branch 'michal/prepare-documentation-for-bind-9.19.7' into 'v9_19_7-release'

Prepare documentation for BIND 9.19.7

See merge request isc-private/bind9!471

3 years agoAdd release note for GL #3661
Michał Kępień [Mon, 7 Nov 2022 21:07:08 +0000 (22:07 +0100)] 
Add release note for GL #3661

3 years agoAdd release note for GL #3603
Michał Kępień [Mon, 7 Nov 2022 21:07:08 +0000 (22:07 +0100)] 
Add release note for GL #3603

3 years agoAdd release note for GL #3247
Michał Kępień [Mon, 7 Nov 2022 21:07:08 +0000 (22:07 +0100)] 
Add release note for GL #3247

3 years agoReorder release notes
Michał Kępień [Mon, 7 Nov 2022 21:07:08 +0000 (22:07 +0100)] 
Reorder release notes

3 years agoTweak and reword release notes
Michał Kępień [Mon, 7 Nov 2022 21:07:08 +0000 (22:07 +0100)] 
Tweak and reword release notes

3 years agoPrepare release notes for BIND 9.19.7
Michał Kępień [Mon, 7 Nov 2022 21:07:08 +0000 (22:07 +0100)] 
Prepare release notes for BIND 9.19.7

3 years agoRemove CHANGES entry 6012
Michał Kępień [Mon, 7 Nov 2022 21:07:08 +0000 (22:07 +0100)] 
Remove CHANGES entry 6012

The code change that entry 6012 describes (introduced in commit
be204bf4c7712d0f31aac0a7725e54e3a7786507) was reverted shortly after (in
commit c429b52533e4e454905fb1507ddee8f87472e152).  Remove that entry
from CHANGES as it is misleading.

3 years agoMerge branch 'pspacek/doc-known-issues-reshuffle' into 'main'
Michał Kępień [Mon, 7 Nov 2022 13:42:13 +0000 (13:42 +0000)] 
Merge branch 'pspacek/doc-known-issues-reshuffle' into 'main'

Repeat Known Issues at the top of Release Notes page

See merge request isc-projects/bind9!7040

3 years agoRepeat Known Issues at the top of Release Notes page
Petr Špaček [Mon, 7 Nov 2022 13:03:15 +0000 (14:03 +0100)] 
Repeat Known Issues at the top of Release Notes page

From now on all per-version notes link to the global list
of Known Issues. If there is a new note it should be listed twice:
In the per-version list, and in the global list.

3 years agoMerge branch '3652-reference-manual-update-policies-unmatched-parenthesis' into ...
Michał Kępień [Mon, 7 Nov 2022 12:48:41 +0000 (12:48 +0000)] 
Merge branch '3652-reference-manual-update-policies-unmatched-parenthesis' into 'main'

Resolve "reference manual update-policies unmatched parenthesis"

Closes #3652

See merge request isc-projects/bind9!7030

3 years agoAdd missing closing ')' to update-policy documentation
Mark Andrews [Fri, 4 Nov 2022 06:03:44 +0000 (06:03 +0000)] 
Add missing closing ')' to update-policy documentation

The opening '(' before local was not being matched by a closing
')' after the closing '};'.

3 years agoMerge branch '3654-main-doesn-t-compile-on-macos' into 'main'
Mark Andrews [Fri, 4 Nov 2022 10:36:40 +0000 (10:36 +0000)] 
Merge branch '3654-main-doesn-t-compile-on-macos' into 'main'

Resolve "Main doesn't compile on MacOS"

Closes #3654

See merge request isc-projects/bind9!7031

3 years agoFix local getresuid and getresuid implementations
Mark Andrews [Fri, 4 Nov 2022 06:21:31 +0000 (06:21 +0000)] 
Fix local getresuid and getresuid implementations

3 years agoMerge branch '3645-dont-release-the-read-lock-when-iterating' into 'main'
Ondřej Surý [Thu, 3 Nov 2022 14:30:49 +0000 (14:30 +0000)] 
Merge branch '3645-dont-release-the-read-lock-when-iterating' into 'main'

Don't release the tree read lock in dereference_iter_node()

Closes #3645

See merge request isc-projects/bind9!7023

3 years agoDon't release the tree read lock in dereference_iter_node()
Ondřej Surý [Thu, 3 Nov 2022 12:28:33 +0000 (13:28 +0100)] 
Don't release the tree read lock in dereference_iter_node()

Previously, the tree read lock could be upgraded to a write lock in
decrement_reference() and then downgraded back to read lock in
dereference_iter_node().  When the use of isc_rwlock_downgrade() was
removed, the downgrade was changed to a simple unlock+lock. This allows
some delete operations to sneak in and delete nodes that the iterator
expects to be in place.

Expand decrement_reference() so the caller can indicate whether the
tree read lock should be upgraded, and disallow the upgrade when
calling from dereference_iter_node(), so there will be no need to
release the lock afterward.

3 years agoMerge branch '3643-dont-use-dns_zone_attach-in-zone_refreshkeys' into 'main'
Ondřej Surý [Thu, 3 Nov 2022 13:53:07 +0000 (13:53 +0000)] 
Merge branch '3643-dont-use-dns_zone_attach-in-zone_refreshkeys' into 'main'

Don't use dns_zone_attach() in zone_refreshkeys()

Closes #3643

See merge request isc-projects/bind9!7022

3 years agoDon't use dns_zone_attach() in zone_refreshkeys()
Ondřej Surý [Thu, 3 Nov 2022 11:08:35 +0000 (12:08 +0100)] 
Don't use dns_zone_attach() in zone_refreshkeys()

The zone_refreshkeys() could run before the zone_shutdown(), but after
the last .erefs has been "detached" causing assertion failure when doing
dns_zone_attach().  Remove the use of .erefs (dns_zone_attach/detach)
and replace it with using the .irefs and additional checks whether the
zone is exiting in the callbacks.

3 years agoMerge branch '3591-nsec3-crash-dynamic-to-inline-signing' into 'main'
Matthijs Mekking [Thu, 3 Nov 2022 10:41:32 +0000 (10:41 +0000)] 
Merge branch '3591-nsec3-crash-dynamic-to-inline-signing' into 'main'

Fix crash where dnssec-policy zone with NSEC3 crashes when inline-signing is turned on

Closes #3591

See merge request isc-projects/bind9!6905

3 years agoAdd release note and change for GL #3591
Matthijs Mekking [Tue, 11 Oct 2022 10:13:19 +0000 (12:13 +0200)] 
Add release note and change for GL #3591

Breaking news.

3 years agoIf a zone is not reusable, trigger full sign
Matthijs Mekking [Tue, 11 Oct 2022 09:07:43 +0000 (11:07 +0200)] 
If a zone is not reusable, trigger full sign

If after a reconfig a zone is not reusable because inline-signing
was turned on/off, trigger a full resign. This is necessary because
otherwise the zone maintenance may decide to only apply the changes
in the journal, leaving the zone in an inconsistent DNSSEC state.

3 years agoDon't allow DNSSEC records in the raw zone
Matthijs Mekking [Mon, 10 Oct 2022 12:14:43 +0000 (14:14 +0200)] 
Don't allow DNSSEC records in the raw zone

There was an exception for dnssec-policy that allowed DNSSEC in the
unsigned version of the zone. This however causes a crash if the
zone switches from dynamic to inline-signing in the case of NSEC3,
because we are now trying to add an NSEC3 record to a non-NSEC3 node.
This is because BIND expects none of the records in the unsigned
version of the zone to be NSEC3.

Remove the exception for dnssec-policy when copying non DNSSEC
records, but do allow for DNSKEY as this may be a published DNSKEY
from a different provider.

3 years agoRemove checks when going to dnssec-policy none
Matthijs Mekking [Tue, 11 Oct 2022 09:21:35 +0000 (11:21 +0200)] 
Remove checks when going to dnssec-policy none

The changes in the code have the side effect that the CDNSKEY and CDS
records in the secure version of the zone are not reusable and thus
are thrashed from the zone. Remove the apex checks for this use case.
We only care about that the zone is not immediately goes bogus, but
a user really should use the built-in "insecure" policy when unsigning
a zone.

3 years agoAdd nsec3 system test that transfers in NSEC3
Matthijs Mekking [Tue, 11 Oct 2022 13:17:53 +0000 (15:17 +0200)] 
Add nsec3 system test that transfers in NSEC3

Similar to an attempt to add NSEC through dynamic update, add a test
case that tries to add NSEC3 through zone transfer.

3 years agoAdd two more nsec3 system tests
Matthijs Mekking [Tue, 11 Oct 2022 09:15:34 +0000 (11:15 +0200)] 
Add two more nsec3 system tests

Add one more case that tests reconfiguring a zone to turn off
inline-signing. It should still be a valid DNSSEC zone and the NSEC3
parameters should not change.

Add another test to ensure that you cannot update the zone with a
NSEC3 record.

3 years agoUpdate kasp system test to work with .signed files
Matthijs Mekking [Tue, 11 Oct 2022 09:11:13 +0000 (11:11 +0200)] 
Update kasp system test to work with .signed files

We no longer accept copying DNSSEC records from the raw zone to
the secure zone, so update the kasp system test that relies on this
accordingly.

Also add more debugging and store the dnssec-verify results in a file.

3 years agoTest changing from dynamic to inline-signing
Matthijs Mekking [Mon, 10 Oct 2022 11:26:47 +0000 (13:26 +0200)] 
Test changing from dynamic to inline-signing

Add a kasp system test that reconfigures a dnssec-policy zone from
maintaining DNSSEC records directly to the zone to using inline-signing.

Add a similar test case to the nsec3 system test, testing the same
thing but now with NSEC3 in use.

3 years agoMerge branch '3646-use-after-free-triggers-a-crash-in-reactivate_node' into 'main'
Ondřej Surý [Thu, 3 Nov 2022 08:09:28 +0000 (08:09 +0000)] 
Merge branch '3646-use-after-free-triggers-a-crash-in-reactivate_node' into 'main'

Don't cleanup the dead nodes when pruning the tree

Closes #3646

See merge request isc-projects/bind9!7018

3 years agoDon't cleanup the dead nodes when pruning the tree
Ondřej Surý [Thu, 3 Nov 2022 08:06:08 +0000 (09:06 +0100)] 
Don't cleanup the dead nodes when pruning the tree

The dead nodes might get reactivated during the db iterator walks the
version of the tree, so we can't cleanup the dead nodes while the db
version is open.  Restore the previous behaviour that cleaned up the
dead nodes when we are closing the version.

3 years agoMerge branch '3641-cleanup-dead_nodes-from-prune_tree' into 'main'
Ondřej Surý [Wed, 2 Nov 2022 18:08:42 +0000 (18:08 +0000)] 
Merge branch '3641-cleanup-dead_nodes-from-prune_tree' into 'main'

Cleanup the dead nodes when pruning the tree

Closes #3641

See merge request isc-projects/bind9!7012

3 years agoAdd CHANGES for [GL #3641]
Ondřej Surý [Wed, 2 Nov 2022 12:10:42 +0000 (13:10 +0100)] 
Add CHANGES for [GL #3641]

3 years agoCleanup the dead nodes when pruning the tree
Ondřej Surý [Wed, 2 Nov 2022 12:04:56 +0000 (13:04 +0100)] 
Cleanup the dead nodes when pruning the tree

While sending the node to prune_tree(), we can also cleanup dead nodes
because we already hold the tree and node bucket write locks.

3 years agoMerge branch 'ondrej-rework-pthread-rwlock-3' into 'main'
Ondřej Surý [Wed, 2 Nov 2022 09:56:33 +0000 (09:56 +0000)] 
Merge branch 'ondrej-rework-pthread-rwlock-3' into 'main'

Make the pthread_rwlock implementation header-only macros [3/3]

See merge request isc-projects/bind9!6909

3 years agoMake the pthread_rwlock implementation header-only macros [2/2]
Ondřej Surý [Fri, 14 Oct 2022 10:54:57 +0000 (12:54 +0200)] 
Make the pthread_rwlock implementation header-only macros [2/2]

While using mutrace, the phtread-rwlock based isc_rwlock implementation
would be all tracked in the rwlock.c unit losing all useful information
as all rwlocks would be traced in a single place.  Rewrite the
pthread_rwlock based implementation to be header-only macros, so we can
use mutrace to properly track the rwlock contention without heavily
patching mutrace to understand the libisc synchronization primitives.

3 years agoRemove one level of indirection from isc_rwlock [1/2]
Ondřej Surý [Fri, 14 Oct 2022 10:03:02 +0000 (12:03 +0200)] 
Remove one level of indirection from isc_rwlock [1/2]

Instead of checking the PTHREAD_RUNTIME_CHECK from the header, move it
to the pthread_rwlock implementation functions.  The internal isc_rwlock
actually cannot fail, so the checks in the header was useless anyway.

3 years agoMerge branch 'ondrej-rework-pthread-rwlock-2' into 'main'
Ondřej Surý [Wed, 2 Nov 2022 08:52:27 +0000 (08:52 +0000)] 
Merge branch 'ondrej-rework-pthread-rwlock-2' into 'main'

Remove isc_rwlock_downgrade() from isc_rwlock [2/3]

See merge request isc-projects/bind9!6908

3 years agoMerge branch 'ondrej-rework-pthread-rwlock-1' into 'main'
Ondřej Surý [Wed, 2 Nov 2022 08:05:38 +0000 (08:05 +0000)] 
Merge branch 'ondrej-rework-pthread-rwlock-1' into 'main'

Remove isc_rwlock_downgrade usage in rbtdb.c [1/3]

See merge request isc-projects/bind9!6907

3 years agoRemove isc_rwlock_downgrade() from isc_rwlock
Ondřej Surý [Fri, 14 Oct 2022 09:42:31 +0000 (11:42 +0200)] 
Remove isc_rwlock_downgrade() from isc_rwlock

The isc_rwlock_downgrade() is not used anywhere, so we can remove it and
make the pthread_rwlock implementation simpler.

3 years agoAdd strong rwlock consistency checks to dns_rbtdb
Ondřej Surý [Fri, 14 Oct 2022 12:35:44 +0000 (14:35 +0200)] 
Add strong rwlock consistency checks to dns_rbtdb

The dns_rbtdb unit already tracks the state of the node and tree rwlocks
during the top level function and passes the states of the locks to the
called functions.

Add the tree locking family of macros modeled after node locking macros,
and expand both to track the state of the lock in an external variable.
Additionally, in developer mode, add precondition to the macros, so the
lock is in required state - this should cause an assertion failure on
double locking instead of the thread getting stuck.

3 years agoRemove isc_rwlock_downgrade usage in rbtdb.c
Ondřej Surý [Thu, 13 Oct 2022 19:10:04 +0000 (21:10 +0200)] 
Remove isc_rwlock_downgrade usage in rbtdb.c

The only place where isc_rwlock_downgrade was being used was the
decrement_reference() where the code tries either relocks the node
rwlock to write and then tries to upgrade the tree lock.  When returning
from the function it tries to restore the locks into a previous state
which is nice, but kind of moot, because at every use of
decrement_reference() the node locks is immediately or almost
immeditately unlocked, and same holds for the tree lock.

Instead of trying to restore the node and tree lock into the initial
state, the decrement_reference now returns the state of the locks, so
the caller can then use the right unlock operation (read or write).
Only when the tree lock was originally unlocked, the decrement_reference
unlocks the tree lock before returning to the caller.

3 years agoMerge branch '3583-make-libcap-mandatory-on-linux' into 'main'
Ondřej Surý [Tue, 1 Nov 2022 14:32:34 +0000 (14:32 +0000)] 
Merge branch '3583-make-libcap-mandatory-on-linux' into 'main'

Refactor the privilege dropping

Closes #3583

See merge request isc-projects/bind9!6873

3 years agoAdd CHANGES and release note for [GL #3583]
Ondřej Surý [Thu, 6 Oct 2022 12:34:24 +0000 (14:34 +0200)] 
Add CHANGES and release note for [GL #3583]

3 years agoRefactor the privilege dropping
Ondřej Surý [Thu, 6 Oct 2022 12:22:20 +0000 (14:22 +0200)] 
Refactor the privilege dropping

On Linux, the libcap is now mandatory.  It makes things simpler for us.

System without {set,get}res{uid,gid} now have compatibility shim using
setreuid/setregid or seteuid/setegid to setup effective UID/GID, so the
same code can be called all the time (including on Linux).

3 years agoMerge branch 'artem-fix-tlsdns-tcpdns-unit-tests-connect-func-passing' into 'main'
Artem Boldariev [Tue, 1 Nov 2022 13:24:23 +0000 (13:24 +0000)] 
Merge branch 'artem-fix-tlsdns-tcpdns-unit-tests-connect-func-passing' into 'main'

Fix TCP and TLS DNS tests: properly pass connection callback

See merge request isc-projects/bind9!6986

3 years agoTLS DNS unit tests: do not share the port with TCP DNS tests
Artem Boldariev [Wed, 26 Oct 2022 12:41:30 +0000 (15:41 +0300)] 
TLS DNS unit tests: do not share the port with TCP DNS tests

TLS DNS unit tests were sharing the port with TCP DNS tests by
mistake. That could have caused conflicts between the two, when
running the unit tests in parallel. This commit fixes that.

3 years agoTCP and TLS DNS tests: properly pass connection callback
Artem Boldariev [Wed, 26 Oct 2022 12:17:54 +0000 (15:17 +0300)] 
TCP and TLS DNS tests: properly pass connection callback

After the loop manager refactoring TCP DNS and TLS DNS unit tests
ended up broken.

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

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

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

This commit fixes the problem by passing the tcpdns_connect() and
tlsdns_connect() function pointers to connect_connect_cb().

3 years agoMerge branch '3583-bind-to-interfaces-early' into 'main'
Ondřej Surý [Tue, 1 Nov 2022 10:50:33 +0000 (10:50 +0000)] 
Merge branch '3583-bind-to-interfaces-early' into 'main'

Rescan interfaces before dropping privileges

Closes #3583

See merge request isc-projects/bind9!6875

3 years agoAdd CHANGES note for [GL #3583]
Ondřej Surý [Thu, 6 Oct 2022 16:06:05 +0000 (18:06 +0200)] 
Add CHANGES note for [GL #3583]

3 years agoRescan interfaces before dropping privileges
Ondřej Surý [Thu, 6 Oct 2022 16:00:06 +0000 (18:00 +0200)] 
Rescan interfaces before dropping privileges

The ns_interfacemgr_scan() now requires the loopmgr to be running, so we
need to end exclusive mode for the rescan and then begin it again.

This is relatively safe operation (because the scan happens on the timer
anyway), but we need to ensure that we won't load the configuration from
different threads.  This is already the case because the initial load
happens on the main thread and the control channel also listens just on
the main loop.

3 years agoMerge branch '2895-named-can-create-unrecoverable-managed-keys' into 'main'
Arаm Sаrgsyаn [Tue, 1 Nov 2022 10:48:18 +0000 (10:48 +0000)] 
Merge branch '2895-named-can-create-unrecoverable-managed-keys' into 'main'

Don't trust a placeholder KEYDATA record

Closes #2895

See merge request isc-projects/bind9!7003

3 years agoAdd CHANGES and release notes for [GL #2895]
Aram Sargsyan [Mon, 31 Oct 2022 13:03:47 +0000 (13:03 +0000)] 
Add CHANGES and release notes for [GL #2895]

3 years agoDon't trust a placeholder KEYDATA record
Aram Sargsyan [Mon, 31 Oct 2022 12:49:05 +0000 (12:49 +0000)] 
Don't trust a placeholder KEYDATA record

When named starts it creates an empty KEYDATA record in the managed-keys
zone as a placeholder, then schedules a key refresh. If key refresh
fails for some reason (e.g. connectivity problems), named will load the
placeholder key into secroots as a trusted key during the next startup,
which will break the chain of trust, and named will never recover from
that state until managed-keys.bind and managed-keys.bind.jnl files are
manually deleted before (re)starting named again.

Before calling load_secroots(), check that we are not dealing with a
placeholder.

3 years agoTest managed-keys placeholder
Aram Sargsyan [Mon, 31 Oct 2022 12:48:57 +0000 (12:48 +0000)] 
Test managed-keys placeholder

Add a dnssec test to make sure that named can correctly process a
managed-keys zone with a placeholder KEYDATA record.

3 years agoMerge branch '3617-keyfetch-race' into 'main'
Evan Hunt [Tue, 1 Nov 2022 06:28:04 +0000 (06:28 +0000)] 
Merge branch '3617-keyfetch-race' into 'main'

call dns_resolver_createfetch() asynchronously in zone_refreshkeys()

Closes #3617

See merge request isc-projects/bind9!6971

3 years agoCHANGES for [GL #3617]
Evan Hunt [Mon, 31 Oct 2022 21:40:40 +0000 (14:40 -0700)] 
CHANGES for [GL #3617]

3 years agoCall dns_resolver_createfetch() asynchronously in zone_refreshkeys()
Evan Hunt [Sun, 23 Oct 2022 18:39:44 +0000 (11:39 -0700)] 
Call dns_resolver_createfetch() asynchronously in zone_refreshkeys()

Because dns_resolver_createfetch() locks the view, it was necessary
to unlock the zone in zone_refreshkeys() before calling it in order
to maintain the lock order, and relock afterward. this permitted a race
with dns_zone_synckeyzone().

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

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

This necessitated refactoring dns_zone_detach() so it always runs
unlocked. For managed zones it now schedules zone_shutdown() to
run asynchronously, and for unmanaged zones, it requires the last
dns_zone_detach() to be run without loopmgr running.

3 years agoMerge branch '3634-dont-enforce-jemalloc-on-NetBSD' into 'main'
Ondřej Surý [Mon, 31 Oct 2022 15:14:37 +0000 (15:14 +0000)] 
Merge branch '3634-dont-enforce-jemalloc-on-NetBSD' into 'main'

Don't enforce jemalloc on NetBSD

Closes #3634

See merge request isc-projects/bind9!7004

3 years agoAdd CHANGES note for [GL #3634]
Ondřej Surý [Mon, 31 Oct 2022 14:48:08 +0000 (14:48 +0000)] 
Add CHANGES note for [GL #3634]

3 years agoDon't enforce jemalloc on NetBSD
Ondřej Surý [Mon, 31 Oct 2022 14:46:30 +0000 (14:46 +0000)] 
Don't enforce jemalloc on NetBSD

The NetBSD system allocator is in fact based on the jemalloc, but it
doesn't export the extended interface, so we can't use that.  Remove
the jemalloc enforcement for the NetBSD.

3 years agoMerge branch '3632-async-backwards' into 'main'
Evan Hunt [Mon, 31 Oct 2022 13:24:38 +0000 (13:24 +0000)] 
Merge branch '3632-async-backwards' into 'main'

isc_async_run() runs events in reverse order

Closes #3632

See merge request isc-projects/bind9!7000

3 years agoisc_async_run() runs events in reverse order
Evan Hunt [Sun, 30 Oct 2022 01:05:39 +0000 (18:05 -0700)] 
isc_async_run() runs events in reverse order

when more than one event was scheduled in the isc_aysnc queue,
they were executed in reverse order. we need to pull events
off the back of queue instead the front, so that uv_loop will
run them in the right order.

note that isc_job_run() has the same behavior, because it calls
uv_idle_start() directly. in that case we just document it so
it'll be less surprising in the future.

3 years agoMerge branch 'each-fix-fuzz' into 'main'
Evan Hunt [Mon, 31 Oct 2022 11:28:38 +0000 (11:28 +0000)] 
Merge branch 'each-fix-fuzz' into 'main'

fix build error in fuzz tests

See merge request isc-projects/bind9!6997

3 years agofix build error in fuzz tests
Evan Hunt [Mon, 31 Oct 2022 05:40:44 +0000 (22:40 -0700)] 
fix build error in fuzz tests

a missing include file caused dns_message_checksig.c to fail
to build on some platforms. this has been fixed.

3 years agoMerge branch 'each-dupsigs-test' into 'main'
Evan Hunt [Mon, 31 Oct 2022 11:23:41 +0000 (11:23 +0000)] 
Merge branch 'each-dupsigs-test' into 'main'

make dupsigs test less timing-sensitive

See merge request isc-projects/bind9!6998

3 years agomake dupsigs test less timing-sensitive
Evan Hunt [Sun, 30 Oct 2022 08:19:35 +0000 (01:19 -0700)] 
make dupsigs test less timing-sensitive

the dupsigs test is prone to failing on slow CI machines
because the first test can occur before the zone is fully
signed.

instead of just waiting ten seconds arbitrarily, we now
check every second, and allow up to 30 seconds before giving
up.

3 years agoMerge branch '3628-cleanup-task-from-dns_masterdump' into 'main'
Ondřej Surý [Mon, 31 Oct 2022 10:30:49 +0000 (10:30 +0000)] 
Merge branch '3628-cleanup-task-from-dns_masterdump' into 'main'

Refactor zone loading and dumping to use offloaded work

Closes #3628

See merge request isc-projects/bind9!6990

3 years agoAdd CHANGES note for [GL #3628]
Ondřej Surý [Mon, 31 Oct 2022 10:19:36 +0000 (10:19 +0000)] 
Add CHANGES note for [GL #3628]

3 years agoRefactor dns_master_dump*async() to use offloaded work
Ondřej Surý [Wed, 26 Oct 2022 18:01:29 +0000 (20:01 +0200)] 
Refactor dns_master_dump*async() to use offloaded work

The dns_master_dump*async() functions were using isc_async_run() to
schedule work on the active loop; use isc_work_enqueue() instead.

3 years agorefactor dns_master_dump*async() to use loop callbacks
Evan Hunt [Wed, 26 Oct 2022 18:12:36 +0000 (11:12 -0700)] 
refactor dns_master_dump*async() to use loop callbacks

Asynchronous zone dumping now uses loop callbacks instead of
task events.

3 years agoMerge branch '3631-fix-zone-maintenance-race' into 'main'
Evan Hunt [Mon, 31 Oct 2022 10:24:24 +0000 (10:24 +0000)] 
Merge branch '3631-fix-zone-maintenance-race' into 'main'

fix a potential data race in zone_maintenance()

Closes #3631

See merge request isc-projects/bind9!6999

3 years agofix a potential data race in zone_maintenance()
Evan Hunt [Mon, 31 Oct 2022 06:48:14 +0000 (23:48 -0700)] 
fix a potential data race in zone_maintenance()

zone_maintenance() accessed zone timer information without locking.

3 years agoMerge branch '3625-run-zone-loading-as-offloaded-task' into 'main'
Ondřej Surý [Mon, 31 Oct 2022 06:24:23 +0000 (06:24 +0000)] 
Merge branch '3625-run-zone-loading-as-offloaded-task' into 'main'

Move the zone loading to the offloaded threads

Closes #3625

See merge request isc-projects/bind9!6985

3 years agoAdd CHANGES note for [GL #3625]
Ondřej Surý [Wed, 26 Oct 2022 11:26:23 +0000 (13:26 +0200)] 
Add CHANGES note for [GL #3625]

3 years agoMove the zone loading to the offloaded threads
Ondřej Surý [Wed, 26 Oct 2022 10:40:43 +0000 (12:40 +0200)] 
Move the zone loading to the offloaded threads

Instead of doing incremental zone loading with fixed quantum - 100
loaded lines per event, move the zone loading process to the offloaded
libuv threads using isc_work_enqueue() API.

This has the advantage that the thread scheduling is given back to the
operating system that understands blocking operations, and the zone
loading operation doesn't block the networking threads directly.

3 years agoRefactor dns_master_loadfileinc() to use loopmgr instead of tasks
Evan Hunt [Tue, 25 Oct 2022 21:38:53 +0000 (14:38 -0700)] 
Refactor dns_master_loadfileinc() to use loopmgr instead of tasks

Incremental file loads now use loopmgr events instead of task events.

The dns_master_loadstreaminc(), _loadbufferinc(), _loadlexer() and
_loadlexerinc() functions were not used in BIND, and have been removed.

3 years agoMerge branch '3576-check-_dns-svcb-records-additional-constraints' into 'main'
Mark Andrews [Fri, 28 Oct 2022 20:49:45 +0000 (20:49 +0000)] 
Merge branch '3576-check-_dns-svcb-records-additional-constraints' into 'main'

Resolve "Check _dns SVCB records additional constraints in primary zones."

Closes #3576

See merge request isc-projects/bind9!6856

3 years agoAdd release note for [GL #3576]
Mark Andrews [Thu, 6 Oct 2022 06:42:14 +0000 (17:42 +1100)] 
Add release note for [GL #3576]