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

35420 Commits

Author SHA1 Message Date
Artem Boldariev
923a9a33fe Modify CHANGES [GL #3055]
Mention that we try to avoid spurious interface re-scans on Linux.
2021-12-15 09:46:06 -08:00
Evan Hunt
df2ddc9e7e remove ns_interface reference counting
reference counting of ns_interface objects has not been used
since the clientmgr cleanup in #2433, and it no longer really
makes sense now - when we want to destroy an interface on a
rescan, we want it to be destroyed, not kept active by some
other caller. so ns_interface_attach() has been removed,
ns_interface_detach() has been replaced with a static
interface_destroy(), and do_scan() has been simplified
accordingly.
2021-12-15 09:46:06 -08:00
Evan Hunt
6df5cf1ee6 keep track of non-listening interfaces
previously, if "listen-on-v6" was set to "none", then every
time a scan saw an IPv6 address it would appear to be a new
one.  this commit retains all known interfaces in a list
and sets a flag in the ones that are listening, so that
configured interfaces that have been seen before will be
recognized as such.

as an incidental fix, the ns__interfacemgr_getif() and _nextif()
functions have been removed since they were never used.
2021-12-15 09:46:06 -08:00
Artem Boldariev
fb4e1ed5b2 Examine RTM_NEWADDR, RTM_DELADDR messages contents
This commit modifies the NetLink handling code in such a way
that the contents of the messages we are interested in is checked
for the local addresses changes only. This helps to avoid spurious
interface re-scans.

The 'route_recv' log messages are also reduced from DEBUG(3) to
DEBUG(9).
2021-12-15 09:46:06 -08:00
Ondřej Surý
4861f7d76e Merge branch 'ondrej/fix-isc_mem_setname-usage' into 'main'
Set the clientmgr isc_mem_t context name

See merge request isc-projects/bind9!5639
2021-12-14 19:46:00 +00:00
Ondřej Surý
ce75d4a96b Set the clientmgr isc_mem_t context name
The memory context created in the clientmgr context was missing a name,
so it was nameless in the memory context statistics.

Set the clientmgr memory context name to "clientmgr".
2021-12-14 19:15:58 +00:00
Michal Nowak
11ab4ffb42 Merge branch '2886-drop-cppcheck' into 'main'
Drop cppcheck

Closes #2886 and #2698

See merge request isc-projects/bind9!5574
2021-12-14 14:07:57 +00:00
Michal Nowak
7c88292e45 Add CHANGES note for [GL #2886] 2021-12-14 15:03:56 +01:00
Michal Nowak
9c013f37d0 Drop cppcheck workarounds
As cppcheck was removed from the CI, associated workarounds and
suppressions are not required anymore.
2021-12-14 15:03:56 +01:00
Michal Nowak
654cc61bb9 Drop cppcheck CI job
Every cppcheck update brings the cost of addressing new false positives
in the BIND 9 source code while not reaping any benefits in case of
identified issues with the code.
2021-12-14 15:03:55 +01:00
Arаm Sаrgsyаn
ec3f58eee0 Merge branch '3056-interface-scan-tls-https-recreate-only-when-reconfiguring' into 'main'
Recreate HTTPS and TLS interfaces only during reconfiguration

Closes #3056

See merge request isc-projects/bind9!5636
2021-12-14 13:28:54 +00:00
Aram Sargsyan
f595a75cd6 Recreate HTTPS and TLS interfaces only during reconfiguration
The 850e9e59bf commit intended to recreate
the HTTPS and TLS interfaces during reconfiguration, but they are being
recreated also during regular interface re-scans.

Make sure the HTTPS and TLS interfaces are being recreated only during
reconfiguration.
2021-12-14 09:28:01 +00:00
Arаm Sаrgsyаn
f999d8f3f5 Merge branch '3053-tls-listeners-recreate-on-reconfiguration' into 'main'
Recreate TLS interfaces during reconfiguration

Closes #3053

See merge request isc-projects/bind9!5634
2021-12-13 11:06:09 +00:00
Aram Sargsyan
1bc60caaa0 Add system test for checking TLS interfaces after a reconfiguration 2021-12-13 10:19:57 +00:00
Aram Sargsyan
e2460a1b58 Add CHANGES for [GL #3053] 2021-12-13 10:19:57 +00:00
Aram Sargsyan
850e9e59bf Recreate TLS interfaces during reconfiguration
For DoH and DoT listeners, a reconfiguration event triggers a creation
of a new 'SSL_CTX' TLS context, and a destruction of the old one.

The network manager, though, keeps using the old context which causes
errors.

During interface scanning, when a matching existing interface is found,
reuse it only when it doesn't have a TLS context, otherwise shut it down
and recreate with a new TLS context.
2021-12-13 10:19:57 +00:00
Matthijs Mekking
e256a17070 Merge branch 'matthijs/pemensik-bug-main-isdir-error-rhbz490837' into 'main'
Improve error message when directory name is given

See merge request isc-projects/bind9!5633
2021-12-10 10:24:54 +00:00
Petr Menšík
929bbe192d Improve error message when directory name is given
Surprising error IO error is returned when directory name
is given instead of named.conf file. It can be passed to named-checkconf
or include statement. Make a simple change to return Invalid file
instead. Still not precise, but much better error message is returned.

Fix of rhbz#490837.
2021-12-10 10:50:21 +01:00
Michał Kępień
a181b556f0 Merge branch 'michal/remove-mutex-profiling-code' into 'main'
Remove mutex profiling code

See merge request isc-projects/bind9!5629
2021-12-09 13:47:44 +00:00
Michał Kępień
eb4713c8e5 Remove mutex debugging code
Mutex debugging code (used when the ISC_MUTEX_DEBUG preprocessor macro
is set to 1 and PTHREAD_MUTEX_ERRORCHECK is defined) has been broken for
the past 3 years (since commit 2f3eee5a4f)
and nobody complained, which is a strong indication that this code is
not being used these days any more.  External tools for detecting
locking issues are already wired into various GitLab CI checks.  Drop
all code depending on the ISC_MUTEX_DEBUG preprocessor macro being set.
2021-12-09 14:02:36 +01:00
Michał Kępień
0964a94ad5 Remove mutex profiling code
Mutex profiling code (used when the ISC_MUTEX_PROFILE preprocessor macro
is set to 1) has been broken for the past 3 years (since commit
0bed9bfc28) and nobody complained, which
is a strong indication that this code is not being used these days any
more.  External tools for both measuring performance and detecting
locking issues are already wired into various GitLab CI checks.  Drop
all code depending on the ISC_MUTEX_PROFILE preprocessor macro being
set.
2021-12-09 12:25:21 +01:00
Evan Hunt
ea0b5dbd5d Merge branch '3042-tcp-hang' into 'main'
prevent a shutdown hang on non-matching TCP responses

Closes #3042

See merge request isc-projects/bind9!5616
2021-12-08 18:48:34 +00:00
Evan Hunt
2dd97e2c6a CHANGES for [GL #3042] 2021-12-08 10:22:25 -08:00
Evan Hunt
2f3ded7652 add system test for a no-questions reply over TCP 2021-12-08 10:22:03 -08:00
Evan Hunt
157d7bd0e9 incidental cleanups
the 'dipsatchmgr->state' was never set, so the MGR_IS_SHUTTINGDOWN
macro was always false. both of these have been removed.

renamed the 'dispatch->state' field to 'tcpstate' to make its purpose
less ambiguous.

changed an FCTXTRACE log message from "response did not match question"
to the more correctly descriptive "invalid question section".
2021-12-08 10:22:03 -08:00
Evan Hunt
5f82fc11a9 prevent a shutdown hang on non-matching TCP responses
When a non-matching DNS response is received by the resolver,
it calls dns_dispatch_getnext() to resume reading. This is necessary
for UDP but not for TCP, because TCP connections automatically
resume reading after any valid DNS response.

This commit adds a 'tcpreading' flag to TCP dispatches, so that
`dispatch_getnext()` can be called multiple times without subsequent
calls having any effect.
2021-12-08 10:22:03 -08:00
Ondřej Surý
0059433106 Merge branch '3051-missing-destroy-for-pthread-primitives' into 'main'
Stop leaking mutex in nmworker and cond in nm socket

Closes #3051

See merge request isc-projects/bind9!5622
2021-12-08 17:17:17 +00:00
Ondřej Surý
dff5888d9b Add CHANGES and release not for [GL #3051] 2021-12-08 17:58:53 +01:00
Ondřej Surý
57d0fabadd Stop leaking mutex in nmworker and cond in nm socket
On FreeBSD, the pthread primitives are not solely allocated on stack,
but part of the object lives on the heap.  Missing pthread_*_destroy
causes the heap memory to grow and in case of fast lived object it's
possible to run out-of-memory.

Properly destroy the leaking mutex (worker->lock) and
the leaking condition (sock->cond).
2021-12-08 17:58:53 +01:00
Ondřej Surý
9321481106 Merge branch '3048-fix-isc_hp-initialization' into 'main'
Fix the isc_hp initialization and memory usage

Closes #3048

See merge request isc-projects/bind9!5620
2021-12-08 16:33:40 +00:00
Ondřej Surý
c6f3e12fe7 Reduce the number of hazard pointers
Previously, we set the number of the hazard pointers to be 4 times the
number of workers because the dispatch ran on the old socket code.
Since the old socket code was removed there's a smaller number of
threads, namely:

 - 1 main thread
 - 1 timer thread
 - <n> netmgr threads
 - <n> threadpool threads

Set the number of hazard pointers to 2 + 2 * workers.
2021-12-07 21:12:53 +01:00
Ondřej Surý
15ce1737fa Fix the isc_hp initialization and memory usage
Previously, the isc_hp_init() could not lower the value of
isc__hp_max_threads, but because of a mistake the isc__hp_max_threads
would be set to HP_MAX_THREADS (e.g. 128 threads) thus it would be
always set to 128.  This would result in increased memory usage even
when small number of workers were in use.

Change the default value of isc__hp_max_threads to be 1.

Additionally, enforce the max_hps value in isc_hp_new() to be smaller or
equal to HP_MAX_HPS.  The only user is isc_queue which uses just 1
hazard pointer, so it's only theoretical issue.
2021-12-07 20:41:46 +01:00
Petr Špaček
5e69cd6329 Merge branch '1265-deprecate-broken-nsec' into 'main'
Mark broken-nsec option as deprecated

See merge request isc-projects/bind9!5618
2021-12-06 16:06:25 +00:00
Petr Špaček
74d83910d5 Mark broken-nsec option as deprecated
It's unclear if we are going to keep it or not, so let's mark it as
deprecated for a good measure. It's easier to un-deprecate it than the
other way around.
2021-12-06 16:55:55 +01:00
Michał Kępień
236a19ce40 Merge branch '3040-restore-the-fetch-context-expiry-timer' into 'main'
Restore the fetch context expiry timer

Closes #3040

See merge request isc-projects/bind9!5612
2021-12-03 09:07:27 +00:00
Evan Hunt
3a52250286 CHANGES for [GL #3040] 2021-12-03 09:51:06 +01:00
Evan Hunt
4d4cea243a restore the fetch lifetime timer
the lifetime expiry timer for the fetch context was removed
when we switched to using in-band netmgr timeouts. however,
it turns out some dependency loops can occur between a fetch
and the ADB the validator; these deadlocks were formerly broken
when the timer fired, and now there's no timer. we can fix these
errors individually, but in the meantime we don't want the server
to get hung at shutdown because of dangling fetches.

this commit puts back a single timer, which fires two seconds
after the fetch should have completed, and shuts it down. it also
logs a message at level INFO so we know about the problems when
they occur.
2021-12-03 09:49:24 +01:00
Petr Špaček
9f790f75b4 Merge branch '1265-bind-9-14-option-synth-from-dnssec-causing-high-cpu-consumption-and-degraded-client-experience' into 'main'
Rework rbtdb.c:find_coveringnsec to use shadow NSEC tree

Closes #1265

See merge request isc-projects/bind9!5446
2021-12-02 13:52:40 +00:00
Petr Špaček
d24dab6430 Clarify that NSEC3 is not supported by synth-from-dnssec yet 2021-12-02 14:27:18 +01:00
Mark Andrews
41d14210de Check reject-000-label 2021-12-02 14:27:18 +01:00
Mark Andrews
0aaaa8768f Reject NSEC records with next field with \000 label
A number of DNS implementation produce NSEC records with bad type
maps that don't contain types that exist at the name leading to
NODATA responses being synthesize instead of the records in the
zone.  NSEC records with these bad type maps often have the NSEC
NSEC field set to '\000.QNAME'.  We look for the first label of
this pattern.

e.g.
	example.com NSEC \000.example.com SOA NS NSEC RRSIG
	example.com RRRSIG NSEC ...
	example.com SOA ...
	example.com RRRSIG SOA ...
	example.com NS ...
	example.com RRRSIG NS ...
	example.com A ...
	example.com RRRSIG A ...

	A is missing from the type map.

This introduces a temporary option 'reject-000-label' to control
this behaviour.
2021-12-02 14:27:18 +01:00
Mark Andrews
8878adcd61 Check SOA without DNSKEY behaviour 2021-12-02 14:27:18 +01:00
Mark Andrews
dfe31e61d2 Check 'server { broken-nsec yes; };' 2021-12-02 14:27:18 +01:00
Mark Andrews
3faccb16cc Add server christmas tree test
This sets as many server options as possible at once to detect
cut-and-paste bugs when implementing new server options in peer.c.
Most of the accessor functions are similar and it is easy to miss
updating a macro name or structure element name when adding new
accessor functions.

checkconf/setup.sh is there to minimise the difference to branches
with optional server options where the list is updated at runtime.
2021-12-02 14:27:18 +01:00
Mark Andrews
733f58a7a5 Allow servers that emit broken NSEC records to be identified
'server <prefix> { broken-nsec yes; };' can now be used to stop
NSEC records from negative responses from servers in the given
prefix being cached and hence available to synth-from-dnssec.
2021-12-02 14:27:14 +01:00
Mark Andrews
454c29046f Check that SOA and DNSKEY are consistent in NSEC typemaps
If there is a SOA record present then there should also be a
DNSKEY record present as the DNSKEY is supposed to live at the
zone apex like the SOA.
2021-12-02 14:24:37 +01:00
Mark Andrews
d733eeba75 Add data lookups into nodata tests 2021-12-02 14:24:37 +01:00
Mark Andrews
b25ff302ac Check synthesis of wildcard NODATA with 2 NSEC 2021-12-02 14:24:37 +01:00
Mark Andrews
5252985a21 Look for covering NSEC under two more conditions
1) when after processing a node there where no headers that
   contained active records.

   When

       if (check_stale_header(node, header, &locktype, lock, &search,
			      &header_prev);

   succeeds or

       if (EXISTS(header) && !ANCIENT(header))

   fails for all entries in the list leading to 'empty_node' remaining
   true.

   If there is are no active records we know nothing about the
   current state of the name so we treat is as ISC_R_NOTFOUND.

2) when there was a covering NOQNAME proof found or all the
   active headers where negative.

   When

	if (header->noqname != NULL &&
	    header->trust == dns_trust_secure)

   succeeds or

	if (!NEGATIVE(header))

   never succeeds.  Under these conditions there could (should be for
   found_noqname) be a covering NSEC earlier in the tree.
2021-12-02 14:24:37 +01:00
Mark Andrews
94935e7e34 Check synthesis of wildcard NODATA with 1 NSEC 2021-12-02 14:24:37 +01:00