2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-08-31 22:45:39 +00:00
Commit Graph

38481 Commits

Author SHA1 Message Date
Tony Finch
5f2f43e684 Merge branch 'fanf-dns-name-maxlabels' into 'main'
Define DNS_NAME_MAXLABELS and DNS_NAME_LABELLEN

See merge request isc-projects/bind9!7598
2023-02-27 12:08:52 +00:00
Tony Finch
c6bf51492d Define DNS_NAME_MAXLABELS and DNS_NAME_LABELLEN
Some qp-trie operations will need to know the maximum number of labels
in a name, so I wanted a standard macro definition with the right
value.

Replace DNS_MAX_LABELS from <dns/resolver.h with DNS_NAME_MAXLABELS in
<dns/name.h>, and add its counterpart DNS_NAME_LABELLEN.

Use these macros in `name.c` and `resolver.c`.

Fix an off-by-one error in an assertion in `dns_name_countlabels()`.
2023-02-27 11:27:12 +00:00
Arаm Sаrgsyаn
c3ae4e125c Merge branch '3777-fix-crash-after-failed-ixfr-from-differences' into 'main'
Resolve "crash after failed ixfr-from-differences on a catalog zone"

Closes #3777

See merge request isc-projects/bind9!7431
2023-02-27 11:25:00 +00:00
Aram Sargsyan
46b1c558ce Add a CHANGES note for [GL #3777] 2023-02-27 10:06:32 +00:00
Aram Sargsyan
cf79692a66 catz: unregister the db update-notify callback before detaching from db
When detaching from the previous version of the database, make sure
that the update-notify callback is unregistered, otherwise there is
an INSIST check which can generate an assertion failure in free_rbtdb(),
which checks that there are no outstanding update listeners in the list.

There is a similar code already in place for RPZ.
2023-02-27 10:06:32 +00:00
Aram Sargsyan
0ef0c86632 Searching catzs->zones requires a read lock
Lock the catzs->lock mutex before searching in the catzs->zones
hash table.
2023-02-27 10:06:32 +00:00
Aram Sargsyan
ed268b46f1 Process db callbacks in zone_loaddone() after zone_postload()
The zone_postload() function can fail and unregister the callbacks.

Call dns_db_endload() only after calling zone_postload() to make
sure that the registered update-notify callbacks are not called
when the zone loading has failed during zone_postload().

Also, don't ignore the return value of zone_postload().
2023-02-27 10:06:32 +00:00
Aram Sargsyan
a73b67456e Add a system test for [GL #3777]
Add the 'ixfr-from-differences yes;' option to trigger a failed
zone postload operation when a zone is updated but the serial
number is not updated, then issue two successive 'rndc reload'
commands to trigger the bug, which causes an assertion failure.
2023-02-27 10:06:32 +00:00
Mark Andrews
01cd25efd8 Merge branch '3895-memory-leak-in-isc_hmac_init' into 'main'
Resolve "memory leak in isc_hmac_init"

Closes #3895

See merge request isc-projects/bind9!7588
2023-02-26 23:17:35 +00:00
Mark Andrews
cf5f133679 Fix memory leak in isc_hmac_init
If EVP_DigestSignInit failed 'pkey' was not freed.
2023-02-26 22:56:07 +00:00
Arаm Sаrgsyаn
664bfb1cb6 Merge branch 'aram/catz-do-not-destroy-catzs-before-catz' into 'main'
Make sure catz->catzs isn't destroyed before catz

See merge request isc-projects/bind9!7603
2023-02-24 20:31:08 +00:00
Aram Sargsyan
030ffbf475 Make sure catz->catzs isn't destroyed before catz
Call dns_catz_unref_catzs() only after detaching 'catz'.
2023-02-24 19:40:34 +00:00
Ondřej Surý
56c543a3bc Merge branch '3881-catz-offload' into 'main'
Resolve "Run the catalog zone update as an offloaded work"

Closes #3881

See merge request isc-projects/bind9!7560
2023-02-24 16:11:58 +00:00
Aram Sargsyan
cb1cd67bea Add CHANGES and release notes for [GL #3881] 2023-02-24 17:06:18 +01:00
Ondřej Surý
4e7187601f Pause the catz dbiterator while processing the zone
The dbiterator read-locks the whole zone and it stayed locked during
whole processing time when catz is being read.  Pause the iterator, so
the updates to catz zone are not being blocked while processing the catz
update.
2023-02-24 17:06:18 +01:00
Ondřej Surý
b1cd4a066a Unlock catzs during dns__catz_update_cb()
Instead of holding the catzs->lock the whole time we process the catz
update, only hold it for hash table lookup and then release it.  This
should unblock any other threads that might be processing updates to
catzs triggered by extra incoming transfer.
2023-02-24 17:04:33 +01:00
Aram Sargsyan
0b96c9234f Offload catalog zone updates
Offload catalog zone processing so that the network manager threads
are not interrupted by a large catalog zone update.

Introduce a new 'updaterunning' state alongside with 'updatepending',
like it is done in the RPZ module.

Note that the dns__catz_update_cb() function currently holds the
catzs->lock during the whole process, which is far from being optimal,
but the issue is going to be addressed separately.
2023-02-24 15:18:02 +01:00
Ondřej Surý
afdb16dc01 Merge branch 'aram/catz-add-shutdown-signaling' into 'main'
Add shutdown signaling for catalog zones

See merge request isc-projects/bind9!7602
2023-02-24 14:08:20 +00:00
Aram Sargsyan
c76cc58803 Add a CHANGES note for [GL !7571] 2023-02-24 15:07:14 +01:00
Aram Sargsyan
246b7084d6 Add shutdown signaling for catalog zones
This change should make sure that catalog zone update processing
doesn't happen when the catalog zone is being shut down. This
should help avoid races when offloading the catalog zone updates
in the follow-up commit.
2023-02-24 15:06:54 +01:00
Ondřej Surý
94ee6f6672 Merge branch 'aram/catz-light-refactoring-and-reference-count-tracing' into 'main'
Implement reference count tracing for dns_catz_zone_t and dns_catz_zones_t

See merge request isc-projects/bind9!7570
2023-02-24 14:06:06 +00:00
Aram Sargsyan
c29299aa15 Add a CHANGES note for [GL !7570] 2023-02-24 15:00:44 +01:00
Aram Sargsyan
2a52d30660 Call dns_catz_new_zones() only when it is needed
The configure_catz() function creates the catalog zones structure
for the view even when it is not needed, in which case it then
discards it (by detaching) later.

Instead, call dns_catz_new_zones() only when it is needed, i.e. when
there is no existing "previous" view with an existing 'catzs', that
is going to be reused.
2023-02-24 15:00:26 +01:00
Aram Sargsyan
53f0c5a9ac Add reference count tracing for dns_catz_zone_t and dns_catz_zones_t
Tracing can be activated by defining DNS_RPZ_TRACE in catz.h.
2023-02-24 15:00:26 +01:00
Aram Sargsyan
8cb79fec9d Light refactoring of catz.c
* Change 'dns_catz_new_zones()' function's prototype (the order of the
  arguments) to synchronize it with the similar function in rpz.c.
* Rename 'refs' to 'references' in preparation of ISC_REFCOUNT_*
  macros usage for reference tracking.
* Unify dns_catz_zone_t naming to catz, and dns_catz_zones_t naming to
  catzs, following the logic of similar changes in rpz.c.
* Use C compound literals for structure initialization.
* Synchronize the "new zone version came too soon" log message with the
  one in rpz.c.
* Use more of 'sizeof(*ptr)' style instead of the 'sizeof(type_t)' style
  expressions when allocating or freeing memory for 'ptr'.
2023-02-24 15:00:26 +01:00
Michal Nowak
52c9a5b2f5 Merge branch 'mnowak/freebsd-12.4' into 'main'
Add FreeBSD 12.4

See merge request isc-projects/bind9!7169
2023-02-24 12:58:38 +00:00
Michal Nowak
2307661b1a Add FreeBSD 12.4 2023-02-24 13:40:30 +01:00
Michal Nowak
5f805417cf Merge branch 'mnowak/alpine-3.17' into 'main'
Add Alpine Linux 3.17

See merge request isc-projects/bind9!7586
2023-02-24 11:46:50 +00:00
Michal Nowak
5783280b10 Drop date from "Regularly Tested Platforms" section
Changing the date is easy to forget and may be outdated.
2023-02-24 11:50:57 +01:00
Michal Nowak
345089ad23 Add Alpine Linux 3.17 2023-02-24 11:50:57 +01:00
Tony Finch
d2a450d308 Merge branch 'fanf-prune-libirs' into 'main'
Move irs_resconf into libdns and remove libirs

See merge request isc-projects/bind9!7463
2023-02-24 10:01:05 +00:00
Tony Finch
330ff06d4a Move irs_resconf into libdns and remove libirs
`libirs` used to be a reference implementation of `getaddrinfo` and
related modern resolver APIs. It was stripped down in BIND 9.18
leaving only the `irs_resconf` module, which parses
`/etc/resolv.conf`. I have kept its include path and namespace prefix,
so it remains a little fragment of libirs now embedded in libdns.
2023-02-24 09:38:59 +00:00
Ondřej Surý
5ad1fe3570 Merge branch 'ondrej-restore-sonarcloud-analysis' into 'main'
Add SonarCloud GitHub Action

See merge request isc-projects/bind9!7589
2023-02-24 08:53:45 +00:00
Ondřej Surý
4bfbb4ddf7 Add SonarCloud GitHub Action
Add new SonarCloud GitHub Action and configuration; something (maybe
the way the builds were submitted) has apparently changed and the
project got deleted and the analysis wasn't working.
2023-02-24 08:53:41 +00:00
Evan Hunt
14bba4688c Merge branch '3886-xfrin-dispatch' into 'main'
refactor dns_xfrin to use dns_dispatch

Closes #3886

See merge request isc-projects/bind9!7573
2023-02-24 08:30:48 +00:00
Evan Hunt
55f00de18e CHANGES for [GL #3886] 2023-02-24 08:30:33 +00:00
Evan Hunt
4e93d44c74 fix a bug in dns_dispatch_getnext()
when a message arrives over a TCP connection matching an expected
QID, the dispatch is updated so it no longer expects that QID,
but continues reading. subsequent messages with the same QID are
ignored, unless the dispatch entry has called dns_dispatch_getnext()
or dns_dispatch_resume().

however, a coding error caused those functions to have no effect
when the dispatch was reading, so streams of messages with the same
QID could not be received over a single TCP connection, breaking *XFR.

this has been corrected by changing the order of operations in
tcp_dispatch_getnext() so that disp->reading isn't checked until
after the dispatch entry has been reactivated.
2023-02-24 08:30:33 +00:00
Evan Hunt
f0c766abec refactor dns_xfrin to use dns_dispatch
the dns_xfrin module was still using the network manager directly to
manage TCP connections and send and receive messages.  this commit
changes it to use the dispatch manager instead.
2023-02-24 08:30:33 +00:00
Evan Hunt
a4c8decc6a implement refcount tracing in xfrin.c
use ISC_REFCOUNT_IMPL for dns_xfrin_ctx_t (which has been renamed
to dns_xfrin_t to keep the function names dns_xfrin_attach() and
dns_xfrin_detach() unchanged).
2023-02-24 08:30:33 +00:00
Evan Hunt
d72419d1f5 minor cleanups in dispatch.c
- simplified tcp_startrecv()
- removed a short function that was only called once
- removed an unnecessary if statement
2023-02-24 08:30:33 +00:00
Evan Hunt
1dd42a80d6 log the xfrin pointer address in xfrin_log()
to make it easier to trace xfrin events in the log, include
the address of the dns_xfrin_t object in all xfrin log messages.
2023-02-24 08:30:33 +00:00
Evan Hunt
9d37621012 remove dead code in dns_request
the 'connected' variable in 'dns_request_create()` was always false.
2023-02-24 08:30:33 +00:00
Evan Hunt
ae5ba54fbe move dispatchmgr from resolver to view
the 'dispatchmgr' member of the resolver object is used by both
the dns_resolver and dns_request modules, and may in the future
be used by others such as dns_xfrin. it doesn't make sense for it
to live in the resolver object; this commit moves it into dns_view.
2023-02-24 08:30:33 +00:00
Michal Nowak
ec33efe351 Merge branch 'mnowak/update_TEST_PARALLEL_JOBS_for_BSD' into 'main'
Disable OpenBSD system test parallelism in CI

See merge request isc-projects/bind9!7585
2023-02-24 08:16:14 +00:00
Michal Nowak
d73eba57bd Disable OpenBSD system test parallelism in CI
Make OpenBSD system tests more stable by disabling parallelism in CI.

Accordingly, they will run 3-4 times longer.
2023-02-24 08:59:18 +01:00
Michal Nowak
cf46addf51 Do not set TEST_PARALLEL_JOBS in FreeBSD system test
Setting TEST_PARALLEL_JOBS to 4 in FreeBSD system test jobs is a no-op
because it's already set to 4, one level above, on the global level.
2023-02-24 08:59:18 +01:00
Tony Finch
dfed03f094 Merge branch 'fanf-qsbr' into 'main'
QSBR: safe memory reclamation for lock-free data structures

See merge request isc-projects/bind9!7290
2023-02-23 16:43:56 +00:00
Tony Finch
9b7aa536ba QSBR: safe memory reclamation for lock-free data structures
This "quiescent state based reclamation" module provides support for
the qp-trie module in dns/qp. It is a replacement for liburcu, written
without reference to the urcu source code, and in fact it works in a
significantly different way.

A few specifics of BIND make this variant of QSBR somewhat simpler:

  * We can require that wait-free access to a qp-trie only happens in
    an isc_loop callback. The loop provides a natural quiescent state,
    after the callbacks are done, when no qp-trie access occurs.

  * We can dispense with any API like rcu_synchronize(). In practice,
    it takes far too long to wait for a grace period to elapse for each
    write to a data structure.

  * We use the idea of "phases" (aka epochs or eras) from EBR to
    reduce the amount of bookkeeping needed to track memory that is no
    longer needed, knowing that the qp-trie does most of that work
    already.

I considered hazard pointers for safe memory reclamation. They have
more read-side overhead (updating the hazard pointers) and it wasn't
clear to me how to nicely schedule the cleanup work. Another
alternative, epoch-based reclamation, is designed for fine-grained
lock-free updates, so it needs some rethinking to work well with the
heavily read-biased design of the qp-trie. QSBR has the fastest read
side of the basic SMR algorithms (with no barriers), and fits well
into a libuv loop. More recent hybrid SMR algorithms do not appear to
have enough benefits to justify the extra complexity.
2023-02-23 15:57:53 +00:00
Tony Finch
5e8aa4982b Merge branch 'fanf-refcount-trace-tid' into 'main'
Include thread ID in refcount trace output

See merge request isc-projects/bind9!7584
2023-02-23 14:28:34 +00:00
Tony Finch
63cd73d43e Include thread ID in refcount trace output 2023-02-23 14:28:27 +00:00