Commit Graph

40098 Commits

Author SHA1 Message Date
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 Hunt
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
Mark Andrews
c7a06b1fa1 Add release note for [GL #4101] 2023-10-20 14:06:25 +11:00
Mark Andrews
b9bba29c5e Add CHANGES note for [GL #4101] 2023-10-20 14:06:24 +11:00
Mark Andrews
b69100b747 Suppress reporting upcoming changes in root hints
To reduce the amount of log spam when root servers change their
addresses keep a table of upcoming changes by expected date and time
and suppress reporting differences for them until then.

Add initial entry for B.ROOT-SERVERS.NET, Nov 27, 2023.
2023-10-20 14:05:56 +11:00
Mark Andrews
2ca2f7e985 Update b.root-servers.net IP addresses
This covers both root hints and the default primaries for the root
zone mirror.  The official change date is Nov 27, 2023.
2023-10-20 14:05:56 +11:00
Ondřej Surý
2728b8100c Merge branch '4367-offload-ixfr-processing' into 'main'
Offload AXFR and IXFR processing

Closes #4367

See merge request isc-projects/bind9!8399
2023-10-19 13:40:09 +00:00
Ondřej Surý
ec41e8c763 Add CHANGES and release note for [GL #4367] 2023-10-19 14:57:25 +02:00
Ondřej Surý
3737ea592b Offload AXFR and IXFR processing
Instead of processing received data synchronously, store the incoming
differences in the list and process them asynchronously when we need to
commit the data into the database and/or journal.
2023-10-19 14:57:25 +02:00
Ondřej Surý
e5c79261c0 Remove all locking from XFR
Instead of locking the struct dns_xfrin members that get accessed from
the statistics, convert those into atomic types and use atomic accesses
to prevent ThreadSanitizer from blowing up.

In fact, even the atomic operations are not really needed here, because
all writes are done from a single thread and we don't really require
consistency from the statistics.  It's easier to use atomics here, but
it is slightly confusing as it suggests there might be multithreaded
accesses to those variables while in fact, the only off-thread access
happens when collecting the statistics.
2023-10-19 14:57:25 +02:00
Ondřej Surý
109dc883e7 Cleanup wrong whitespace in dns/diff.h 2023-10-19 14:57:25 +02:00
Ondřej Surý
e3892805d6 Remove the logic that applies differences when over limit
The ixfr_putdata() and axfr_putdata() had a logic to apply dns_diff when
the number of pending tuples went over 100.  Since we are going to
offload the XFR data processing, we don't need to do that anymore.
2023-10-19 14:57:25 +02:00
Ondřej Surý
8a590d1605 Cleanup the FAIL() macro in the dns_xfrin
The FAIL() macro was just setting the result and jumping to failure,
unobfuscate the code by removing the macro.
2023-10-19 14:57:25 +02:00
Ondřej Surý
d233fc1730 Merge branch 'ondrej/disable-memory-context-for-OpenSSL-1.x' into 'main'
Disable OpenSSL memory contexts for OpenSSL < 3.0.0

See merge request isc-projects/bind9!8402
2023-10-19 12:56:39 +00:00
Ondřej Surý
74f9f5f821 Disable OpenSSL memory contexts for OpenSSL < 3.0.0
OpenSSL 1.1 has already reached end-of-life and since we are
experiencing a weird memory leak in the mirror system test on just
Ubuntu 20.04 (Focal) with OpenSSL 1.1, we disable the legacy code for
enabling memory contexts for OpenSSL < 3.0.0 in this commit.
2023-10-19 12:54:40 +02:00
Arаm Sаrgsyаn
d0a03db850 Merge branch '4375-qp_test-fix' into 'main'
Fix an error in the qp_test.c unit test

Closes #4375

See merge request isc-projects/bind9!8401
2023-10-19 09:30:59 +00:00
Aram Sargsyan
b535843bb7 Fix an error in the qp_test.c unit test
In order to check whether there are enough inserted values the
code uses the 'tests' variable (loop counter), which is unreliable,
because the loop sometimes removes an item instead of inserting
one (when the randomly generated item already exists).

Instead of the loop counter, use the existing variable 'inserted',
which should indicate the correct number of the inserted items.
2023-10-19 08:46:58 +00:00
Mark Andrews
671e524aef Merge branch '4260-adjust-udp-refresh-timeouts' into 'main'
Adjust UDP zone maintenance timeouts

Closes #4260

See merge request isc-projects/bind9!8205
2023-10-18 06:07:32 +00:00
Mark Andrews
1a9791b4d8 add CHANGES for [GL #4260] 2023-10-18 13:07:24 +11:00
Mark Andrews
29f399797d Adjust UDP timeouts used in zone maintenance
Drop timeout before resending a UDP request from 15 seconds to 5
seconds and add 1 second to the total time to allow for the reply
to the third request to arrive.  This will speed up the time it
takes for named to recover from a lost packet when refreshing a
zone and for it to determine that a primary is down.
2023-10-18 13:06:28 +11:00
Michal Nowak
85ee12f60e Merge branch 'mnowak/llvm-17' into 'main'
Update clang to version 17

See merge request isc-projects/bind9!8366
2023-10-17 15:55:09 +00:00
Michal Nowak
dd234c60fe Update the source code formatting using clang-format-17 2023-10-17 17:47:46 +02:00