Commit Graph
40118 Commits
Author SHA1 Message Date
Ondřej Surý d3f2766a79 Mark the lock-file configuration option as deprecated
This is first step in removing the lock-file configuration option, it
marks both the `lock-file` configuration directive and -X option to
named as deprecated.
2023-10-26 22:41:45 +02:00
Michal Nowak 40c4540cf9 Merge branch 'mnowak/openbsd-7.4' into 'main'
Add OpenBSD 7.4

See merge request isc-projects/bind9!8395
2023-10-26 14:31:13 +00:00
Michal Nowak f8733fc051 Add OpenBSD 7.4 2023-10-26 16:27:56 +02:00
Arаm Sаrgsyаn c70e9f0fef Merge branch 'aram/fix-lock-file-option-and--X-argument-issues' into 'main'
Fix assertion failure when using -X none and lock-file in configuration

See merge request isc-projects/bind9!8432
2023-10-26 13:11:30 +00:00
Aram Sargsyan 41945b32d7 Do not warn about lock-file option change when -X is used
When -X is used the 'lock-file' option change detection condition
is invalid, because it compares the 'lock-file' option's value to
the '-X' argument's value instead of the older 'lock-file' option
value (which was ignored because of '-X').

Don't warn about changing 'lock-file' option if '-X' is used.
2023-10-26 12:34:15 +00:00
Aram Sargsyan bc891e749f Fix an invalid condition check when detecting a lock-file change
It is obvious that the '!cfg_obj_asstring(obj)' check should be
'cfg_obj_asstring(obj)' instead, because it is an AND logic chain
which further uses 'obj' as a string.

Fix the error.
2023-10-26 12:34:07 +00:00
Aram Sargsyan fc2dd09390 Fix assertion failure when using -X none and lock-file in configuration
When 'lock-file <lockfile>' is used in configuration at the same time
as using '-X none' in 'named' invocation, there is an invalid
logic that would lead to a isc_mem_strdup() call on a NULL value.

Also, contradicting to ARM, 'lock-file none' is overriding the '-X'
argument.

Fix the overall logic, and make sure that the '-X' takes precedence to
'lock-file'.
2023-10-26 12:21:57 +00:00
Ondřej Surý c6edfa398c Merge branch '4386-fix-assertion-failure-when-using--X-named-option' into 'main'
Fix assertion failure when using -X and lock-file in configuration

Closes #4386

See merge request isc-projects/bind9!8427
2023-10-26 11:43:13 +00:00
Ondřej Surý 8294a43acf Add CHANGES and release note for [GL #4386] 2023-10-26 12:56:40 +02:00
Ondřej Surý 4f68def5e9 Fix assertion failure when using -X and lock-file in configuration
When 'lock-file <lockfile1>' was used in configuration at the same time
as using `-X <lockfile2>` in `named` invocation, there was an invalid
logic that would lead to a double isc_mem_strdup() call on the
<lockfile2> value.

Skip the second allocation if `lock-file` is being used in
configuration, so the <lockfile2> is used only single time.
2023-10-26 11:01:17 +02:00
Tom Krizek f2225ca9af Merge branch 'tkrizek/shfmt' into 'main'
Enforce shell script codestyle with shfmt

See merge request isc-projects/bind9!8419
2023-10-26 09:01:06 +00:00
Tom Krizek c8fb0b48e0 Ignore shell script formatting in git blame 2023-10-26 10:25:11 +02:00
Tom Krizek bebdfa13be Add editorconfig file for shell style 2023-10-26 10:23:52 +02:00
Tom Krizek b6505ff573 Run shfmt in CI
Ensure our shell script format stays consistent in the future.
2023-10-26 10:23:52 +02:00
Tom Krizek 4cb8b13987 Reformat shell scripts with shfmt
All changes in this commit were automated using the command:

  shfmt -w -i 2 -ci -bn . $(find . -name "*.sh.in")

By default, only *.sh and files without extension are checked, so
*.sh.in files have to be added additionally. (See mvdan/sh#944)
2023-10-26 10:23:50 +02:00
Ondřej Surý dea544d651 Merge branch '4390-allow-changing-liburcu-mode-only-in-developer-mode' into 'main'
Allowing changing Userspace-RCU variant only in developer mode

Closes #4390

See merge request isc-projects/bind9!8425
2023-10-26 08:21:49 +00:00
Ondřej Surý 17f1d0e862 Remove Userspace-RCU signal variant
The signal variant of Userspace-RCU has been deprecated upstream.
Remove the support for compiling with it from configure.ac.
2023-10-26 10:20:29 +02:00
Ondřej Surý 42d43aa075 Allowing changing Userspace-RCU variant only in developer mode
The Userspace-RCU variants other than membarrier is untested and at
least in QSBR case it's broken.  Allow changing the Userspace-RCU
variant only in the developer's mode.
2023-10-26 10:20:29 +02:00
Evan Hunt 59e4c45fa5 Merge branch '4385-qp-lookup-race' into 'main'
prevent a possible race in dns_qpmulti_query()

Closes #4385

See merge request isc-projects/bind9!8421
2023-10-26 07:34:57 +00:00
Evan Hunt 03183baa6d Prevent a possible race in dns_qpmulti_query() and _snapshot()
The `.reader` member of dns_qpmulti_t was accessed without RCU
protection; reader_open() calls rcu_dereference() on it, and this
call needs to be inside an RCU critical section.

A similar problem was identified in the dns_qpmulti_snapshot() - the
RCU critical section was completely missing.

These are relicts of the isc_qsbr - in the QSBR mode the rcu_read_lock()
and rcu_read_unlock() are no-ops and whole event loop is a critical section.
2023-10-26 00:32:22 -07:00
Mark Andrews 17b0eff0cc Merge branch '4387-lock-file-is-deleted-on-exit-even-if-lock-acquisition-failed' into 'main'
Resolve "lock file is deleted on exit even if lock acquisition failed"

Closes #4387

See merge request isc-projects/bind9!8422
2023-10-26 07:02:01 +00:00
Mark Andrews c1b8279ebb Add release note for [GL #4387] 2023-10-26 16:14:02 +11:00
Mark Andrews a8613372c9 Add CHANGES note for [GL #4387] 2023-10-26 15:41:46 +11:00
Mark Andrews 811c9ee7d1 Check that the lock file was not removed too early
When named fails to starts due to not being able to obtain
a lock on the lock file that lock file should remain.  Check
that the lock file exists before and after the attempt to
start a second instance of named.
2023-10-26 15:41:46 +11:00
Mark Andrews b9c789b8b3 Only remove the lock file if we managed to lock it
The lock file was being removed when we hadn't successfully locked
it which defeated the purpose of the lockfile.  Adjust cleanup_lockfile
such that it only unlinks the lockfile if we have successfully locked
the lockfile and it is still active (lockfile != NULL).
2023-10-26 14:55:31 +11:00
Ondřej Surý 8983bf8ed2 Merge branch 'ondrej/dns_message-refactoring' into 'main'
Refactor and cleanup the dns_message unit

See merge request isc-projects/bind9!8400
2023-10-25 10:37:16 +00:00
Ondřej Surý 6bb42939cf Refactor dns_message using ISC_LIST_FOREACH macros
Do a light refactoring and cleanups that replaces common list walking
patterns with ISC_LIST_FOREACH macros and split some nested loops into
separate static functions to reduce the nesting depth.
2023-10-25 12:36:37 +02:00
Ondřej Surý d2e84a4b97 Add ISC_LIST_FOREACH_REV(_SAFE) macros
Add complementary macros to ISC_LIST_FOREACH(_SAFE) that walk the lists
in reverse.

  * ISC_LIST_FOREACH_REV(list, elt, link) - walk the static list from
    tail to head
  * ISC_LIST_FOREACH_REV_SAFE(list, elt, link, next) - walk the list
    from tail to head in a manner that's safe against list member
    deletions
2023-10-25 12:36:13 +02:00
Ondřej Surý fd732a7fb5 Add dns__message_putassociatedrdataset() to deduplicate code
There was a lot of internal code looking like this:

    INSIST(dns_rdataset_isassociated(rdataset));
    dns_rdataset_disassociated(rdataset)
    isc_mempool_put(msg->rdspool, rdataset);

Deduplicate the code into local dns__message_puttemprdataset() routine,
and drop the INSIST() which is checked in dns_rdataset_disassociate().
2023-10-25 12:36:08 +02:00
Ondřej Surý 5fca0fb519 Remove unused dns_message_movename() method
Since dns_message_movename() was unused, it could be removed from the
code based to declutter the API.
2023-10-25 11:43:10 +02:00
Ondřej Surý 1b387c204c Merge branch '4379-dont-reuse-TCP-dispatches-in-dns_xfrin' into 'main'
Add option to mark TCP dispatch as unshared

Closes #4379

See merge request isc-projects/bind9!8408
2023-10-24 12:19:23 +00:00
Ondřej Surý 5a1e0dbfd1 Add CHANGES note for [GL #4379] 2023-10-24 13:07:31 +02:00
Ondřej Surý d246aa02a6 Add dispatch_getcp and dispatch_newtcp tests
Refactor the dispatch unit test to use more local variables (previously
dispatchmgr, dispatch and dispentry were all global), and add two new
tests:

* dispatch_getcp - test whether the TCP connection will get reused
* dispatch_newtcp - test that the TCP connection will not get reused
                    when DNS_DISPATCHOPT_UNSHARED is in effect
2023-10-24 13:07:03 +02:00
Ondřej Surý f213f644ed Add option to mark TCP dispatch as unshared
The current dispatch code could reuse the TCP connection when
dns_dispatch_gettcp() would be used first.  This is problematic as the
dns_resolver doesn't use TCP connection sharing, but dns_request could
get the TCP stream that was created outside of the dns_request.

Add new DNS_DISPATCHOPT_UNSHARED option to dns_dispatch_createtcp() that
would prevent the TCP stream to be reused.  Use that option in the
dns_resolver call to dns_dispatch_createtcp() to prevent dns_request
from reusing the TCP connections created by dns_resolver.

Additionally, the dns_xfrin unit added TCP connection sharing for
incoming transfers.  While interleaving *xfr streams on a TCP connection
should work this should be a deliberate change and be property of the
server that can be controlled.  Additionally some level of parallel TCP
streams is desirable.  Revert to the old behaviour by removing the
dns_dispatch_gettcp() calls from dns_xfrin and use the new option to
prevent from sharing the transfer streams with dns_request.
2023-10-24 13:07:03 +02:00
Ondřej Surý efbdee5b3a Merge branch '4380-keep-the-offloaded-work-result-local' into 'main'
Don't set the offloaded work result from main thread

Closes #4380

See merge request isc-projects/bind9!8407
2023-10-24 10:49:42 +00:00
Ondřej Surý e0e089f106 Don't set the offloaded work result from main thread
The xfrin_recv_done() was accessing xfr->result where we stored the
result of the offloaded work from a thread that could receive data while
processing the transfer on the offloaded thread.

Completely remove the offloaded result from the dns_xfrin_t structure
and keep it local for *xfr_apply() and *xfr_apply_done() as the failure
is already recorded in .shutdown_result and we now that the processing
has failed because .shuttingdown has been already set.
2023-10-24 11:14:54 +02:00
Arаm Sаrgsyаn 04304272a9 Merge branch '4377-sd_notify-RELOADING-add-MONOTONIC_USEC-field' into 'main'
Resolve "named support of a systemd unit with 'notify-reload' service type is incomplete"

Closes #4377

See merge request isc-projects/bind9!8403
2023-10-23 14:49:14 +00:00
Aram Sargsyan da97f714a2 Add a CHANGES note for [GL #4377] 2023-10-23 13:43:39 +00:00
Aram Sargsyan 71b2f40963 sd_notify(3): set the MONOTONIC_USEC field with RELOADING=1
When using sd_notify(3) to send a message to the service manager
about named being reloaded, systemd also requires the MONOTONIC_USEC
field to be set to the current monotonic time in microseconds,
otherwise the 'systemctl reload' command fails.

Add the MONOTONIC_USEC field to the message.

See 'man 5 systemd.service' for more information.
2023-10-23 13:27:59 +00:00
Arаm Sаrgsyаn 60856e65cb Merge branch '4381-assert-in-dns__catz_update_cb-on-shutdown' into 'main'
Resolve "Assertion failure in dns__catz_update_cb() on shutdown"

Closes #4381

See merge request isc-projects/bind9!8409
2023-10-23 09:39:14 +00:00
Aram Sargsyan 598107f1c2 Add a CHANGES note for [GL #4381] 2023-10-23 08:21:39 +00:00
Aram Sargsyan 4eb4fa288c Fix shutdown races in catzs
The dns__catz_update_cb() does not expect that 'catzs->zones'
can become NULL during shutdown.

Add similar checks in the dns__catz_update_cb() and dns_catz_zone_get()
functions to protect from such a case. Also add an INSIST in the
dns_catz_zone_add() function to explicitly state that such a case
is not expected there, because that function is called only during a
reconfiguration.
2023-10-23 08:21:39 +00:00
Michal Nowak cddd9dcb53 Merge branch '4152-reproducer-stack-exhaustion' into 'main'
Add test for CVE-2023-3341

See merge request isc-projects/bind9!8410
2023-10-20 14:23:20 +00:00
Michal Nowak 7d1834b250 Add test for CVE-2023-3341 2023-10-20 15:42:10 +02:00
Mark Andrews 45f088fea7 Merge branch '4372-assertion-failure-in-dispatch-c' into 'main'
Resolve "Assertion failure in dispatch.c"

Closes #4372

See merge request isc-projects/bind9!8397
2023-10-20 09:26:07 +00:00
Mark Andrews c00c1e9a72 Add CHANGES note for [GL #4372] 2023-10-20 18:16:51 +11:00
Mark Andrews 84fd3e3808 Test xfrin's handing of EDNS failure scenarios
We test EDNS requests returning FORMERR where named is expected
to retry without EDNS.

We test EDNS requests returning NOTIMP where named is expected
to fail the transfer as the remote end is not protocol compliant.
2023-10-20 18:16:25 +11:00
Evan HuntandMark Andrews aacea440c3 handle pre-existing disp/dispentry when retrying
when xfrin_start() is called to retry a transfer, close the existing
dispatch entry and reuse the existing dispatch.
2023-10-20 18:16:25 +11:00
Mark Andrews a99adb9efa Test NOTIMP being returned to an IXFR request in xfrin
The server is expected to retry the transfer using SOA and if
the returned serial is greater than the current serial AXFR.

Check the log that IXFR is request.
2023-10-20 18:16:25 +11:00
Mark Andrews 30e182ea56 Merge branch '4101-update-b-root-server-net-addresses' into 'main'
Resolve "Update b.root-server.net addresses"

Closes #4101

See merge request isc-projects/bind9!8371
2023-10-20 03:44:36 +00:00