2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-08-30 14:07:59 +00:00
Commit Graph

35845 Commits

Author SHA1 Message Date
Petr Špaček
473d5a8d03 Remove nonexistent option -r from confgen man pages
Fixes omission in !269.

Fixes: #2826
2022-03-10 20:13:18 +01:00
Tony Finch
ca1da46ac1 Merge branch '3199-doc-dev' into 'main'
a few developer documentation nits

Closes #3199

See merge request isc-projects/bind9!5953
2022-03-10 14:08:38 +00:00
Tony Finch
e532d39146 Update the status of Python
There are no longer any Python utilities in BIND: like Perl it is now
used for test scripts and generating some documentation and source
files.
2022-03-09 18:01:28 +00:00
Tony Finch
037468f6a4 Drop references to Windows in doc/dev
Windows is not a supported platform any more.
2022-03-09 18:01:28 +00:00
Tony Finch
328d11297d Small developer documentation cleanups
GitLab replaced RT, we don't support 1990s operating systems, we
like wrapped paragraphs, and we don't need that extra comma.
2022-03-09 18:01:28 +00:00
Tony Finch
ec1e8e7001 Drop documents that have been folded into doc/dev/dev.md
There is no need to keep obsolete duplicate docs around.
2022-03-09 18:01:28 +00:00
Tony Finch
6be83f2eb7 Remove documentation for rndc keydone
This feature never made it through the 9.9 development cycle; it is
now covered by `rndc signing` which is adequately documented
elsewhere.
2022-03-09 18:01:28 +00:00
Tony Finch
1c77f55dc6 Merge branch '3189-version-stdout' into 'main'
Consistently print version numbers to stdout

Closes #3189

See merge request isc-projects/bind9!5940
2022-03-09 17:55:37 +00:00
Tony Finch
338df9e1ff Correct spelling of dnssec-signzone in output file
The version comment in the signed zone said "dnssec_signzone". To fix
it, use the same `program` variable as other warnings and messages.
2022-03-09 17:37:11 +00:00
Tony Finch
6bcfa0c4ec Consistently print version numbers to stdout
Since the user asked for the version number it is logical to make it a
non-error, i.e. print to stdout (not stderr) and exit(0).

Closes #3189
2022-03-09 17:37:07 +00:00
Tony Finch
bfaf88ce7d Merge branch '3188-dig-noidn' into 'main'
Stop dig complaining about +noidn when it can't IDN

Closes #3188

See merge request isc-projects/bind9!5927
2022-03-09 14:42:11 +00:00
Tony Finch
ae73a8d87a Stop dig complaining about +noidn when it can't IDN
When dig was built without IDN support, it reported an error if the
+noidnin and/or +noidnout options were used. This means the options
were not useful for a script that wants consistent lack of IDN
translation regardless of how BIND is built.

Make dig complain about lack of built-in IDN support only when the
user asks for IDN translation.

Closes #3188
2022-03-09 13:13:15 +00:00
Ondřej Surý
e369c90369 Merge branch 'ondrej/remove-ATOMIC_VAR_INIT' into 'main'
Remove usage of deprecated ATOMIC_VAR_INIT() macro

See merge request isc-projects/bind9!5949
2022-03-09 08:24:40 +00:00
Ondřej Surý
f251d69eba Remove usage of deprecated ATOMIC_VAR_INIT() macro
The C17 standard deprecated ATOMIC_VAR_INIT() macro (see [1]).  Follow
the suite and remove the ATOMIC_VAR_INIT() usage in favor of simple
assignment of the value as this is what all supported stdatomic.h
implementations do anyway:

  * MacOSX.plaform: #define ATOMIC_VAR_INIT(__v) {__v}
  * Gcc stdatomic.h: #define ATOMIC_VAR_INIT(VALUE)	(VALUE)

1. http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2018/p1138r0.pdf
2022-03-08 23:55:10 +01:00
Ondřej Surý
0b68596c45 Merge branch 'ondrej/lib/isc/ht.c-cleanup' into 'main'
Make isc_ht_init() and isc_ht_iter_create() return void

See merge request isc-projects/bind9!5943
2022-03-08 18:20:49 +00:00
Ondřej Surý
d128656d2e Make dns_catz_get_iterator() return void
Previously, the function(s) in the commit subject could fail for various
reasons - mostly allocation failures, or other functions returning
different return code than ISC_R_SUCCESS.  Now, the aforementioned
function(s) cannot ever fail and they would always return ISC_R_SUCCESS.

Change the function(s) to return void and remove the extra checks in
the code that uses them.
2022-03-08 14:51:55 +01:00
Ondřej Surý
8fa27365ec Make isc_ht_init() and isc_ht_iter_create() return void
Previously, the function(s) in the commit subject could fail for various
reasons - mostly allocation failures, or other functions returning
different return code than ISC_R_SUCCESS.  Now, the aforementioned
function(s) cannot ever fail and they would always return ISC_R_SUCCESS.

Change the function(s) to return void and remove the extra checks in
the code that uses them.
2022-03-08 14:51:55 +01:00
Ondřej Surý
3db335bca0 Merge branch 'ondrej/lib/isc/heap.c-cleanup' into 'main'
Make isc_heap_create() and isc_heap_insert() return void

See merge request isc-projects/bind9!5756
2022-03-08 10:50:35 +00:00
Ondřej Surý
bbb4cdb92d Make isc_heap_create() and isc_heap_insert() return void
Previously, the function(s) in the commit subject could fail for various
reasons - mostly allocation failures, or other functions returning
different return code than ISC_R_SUCCESS.  Now, the aforementioned
function(s) cannot ever fail and they would always return ISC_R_SUCCESS.

Change the function(s) to return void and remove the extra checks in
the code that uses them.
2022-03-08 11:19:34 +01:00
Ondřej Surý
acf5986a7c Merge branch '2201-reimplement-set_tcp_maxseg-for-netmgr' into 'main'
Set TCP maximum segment size to minimum

Closes #2201

See merge request isc-projects/bind9!5468
2022-03-08 10:11:45 +00:00
Ondřej Surý
67dbe0ae4d Add CHANGES note for [GL #2201] 2022-03-08 10:27:22 +01:00
Ondřej Surý
8098a58581 Set TCP maximum segment size to minimum size of 1220
Previously the socket code would set the TCPv6 maximum segment size to
minimum value to prevent IP fragmentation for TCP.  This was not yet
implemented for the network manager.

Implement network manager functions to set and use minimum MTU socket
option and set the TCP_MAXSEG socket option for both IPv4 and IPv6 and
use those to clamp the TCP maximum segment size for TCP, TCPDNS and
TLSDNS layers in the network manager to 1220 bytes, that is 1280 (IPv6
minimum link MTU) minus 40 (IPv6 fixed header) minus 20 (TCP fixed
header)

We already rely on a similar value for UDP to prevent IP fragmentation
and it make sense to use the same value for IPv4 and IPv6 because the
modern networks are required to support IPv6 packet sizes.  If there's
need for small TCP segment values, the MTU on the interfaces needs to be
properly configured.
2022-03-08 10:27:05 +01:00
Ondřej Surý
5d34a14f22 Set minimum MTU (1280) on IPv6 sockets
The IPV6_USE_MIN_MTU socket option directs the IP layer to limit the
IPv6 packet size to the minimum required supported MTU from the base
IPv6 specification, i.e. 1280 bytes.  Many implementations of TCP
running over IPv6 neglect to check the IPV6_USE_MIN_MTU value when
performing MSS negotiation and when constructing a TCP segment despite
MSS being defined to be the MTU less the IP and TCP header sizes (60
bytes for IPv6).  This leads to oversized IPv6 packets being sent
resulting in unintended Path Maximum Transport Unit Discovery (PMTUD)
being performed and to fragmented IPv6 packets being sent.

Add and use a function to set socket option to limit the MTU on IPv6
sockets to the minimum MTU (1280) both for UDP and TCP.
2022-03-08 10:27:05 +01:00
Mark Andrews
b40d1e8467 Merge branch '3142-add-checkconf-check-for-dnssec-policy-keys-algorithm' into 'main'
Resolve "Add checkconf check for dnssec-policy keys algorithm"

Closes #3142

See merge request isc-projects/bind9!5836
2022-03-08 03:25:22 +00:00
Mark Andrews
e48af36981 Add release note for [GL #3142] 2022-03-08 13:24:49 +11:00
Mark Andrews
d4c2395fff Add CHANGES entry for [GL #3142] 2022-03-08 13:24:09 +11:00
Mark Andrews
9bcf45f4ce Check dnssec-policy key roles for validity
For each algorithm there must be a key performing the KSK and
ZSK rolls.  After reading the keys from named.conf check that
each algorithm present has both rolls.  CSK implicitly has both
rolls.
2022-03-08 13:23:14 +11:00
Mark Andrews
f23e86b96b Add test configurations with invalid dnssec-policy clauses
bad-ksk-without-zsk.conf only has a ksk defined without a
matching zsk for the same algorithm.

bad-zsk-without-ksk.conf only has a zsk defined without a
matching ksk for the same algorithm.

bad-unpaired-keys.conf has two keys of different algorithms
one ksk only and the other zsk only
2022-03-08 13:23:14 +11:00
Arаm Sаrgsyаn
18efcdc65f Merge branch 'aram-fix-dns_request_createraw-cleanup-bug' into 'main'
Fix a function cleanup bug in dns_request_createraw()

Closes #3195

See merge request isc-projects/bind9!5937
2022-03-07 12:42:25 +00:00
Aram Sargsyan
963f6a2203 Fix a function cleanup bug in dns_request_createraw
When get_dispatch() returns an error code, the dns_request_createraw()
function jumps to the `cleanup` label, which will leave a previous
attachment to the `request` pointer unattached.

Fix the issue by jumping to the `detach` label instead.
2022-03-07 11:24:09 +00:00
Ondřej Surý
e229d46a87 Merge branch '3193-null-pointer-dereferences-in-udp_ready' into 'main'
Fix null pointer dereferences in udp_ready()

Closes #3193

See merge request isc-projects/bind9!5935
2022-03-06 12:05:18 +00:00
Ondřej Surý
9d8e8a4fcc Fix null pointer dereferences in udp_ready()
The query pointer was detached too early leading to null pointer
reference.  Move the query_detach() after the query->canceled check.
2022-03-06 10:18:20 +01:00
Ondřej Surý
51147fa567 Merge branch 'ondrej/refactor-tooling-around-lib/gen/dns.c' into 'main'
Merge lib/dns/gen.h contents to lib/dns/gen.c

See merge request isc-projects/bind9!5755
2022-03-04 13:33:08 +00:00
Ondřej Surý
b5a5eed7a0 Replace AX_CC_FOR_BUILD with AX_PROG_CC_FOR_BUILD
The AX_PROG_CC_FOR_BUILD implementation to find a native CC compiler is
slightly better because it uses AC_PROG_CC and AC_PROG_CPP to find the
native compiler instead of just defaulting to `gcc` as AX_CC_FOR_BUILD
does.

AX_PROG_CC_FOR_BUILD also sets BUILD_EXEEXT that we already use in the
Makefile.am for `lib/dns/gen` while AX_CC_FOR_BUILD uses
EXEEXT_FOR_BUILD.
2022-03-04 14:13:58 +01:00
Ondřej Surý
f24b26188d Merge lib/dns/gen.h contents to lib/dns/gen.c
Formerly, the gen.h header contained a compatibility layer between Win32
and POSIX platforms.  Since we have already dropped the Win32 build, we
can merged gen.h into gen.c as the header file is not used elsewhere.
2022-03-04 14:13:58 +01:00
Ondřej Surý
d811cca3c6 Merge branch 'ondrej-use-locked-queue' into 'main'
Replace netievent lock-free queue with simple locked queue

Closes #3180

See merge request isc-projects/bind9!5914
2022-03-04 13:12:53 +00:00
Ondřej Surý
d75b953489 Add CHANGES note for [GL #3180] 2022-03-04 13:49:51 +01:00
Ondřej Surý
6bd025942c Replace netievent lock-free queue with simple locked queue
The current implementation of isc_queue uses Michael-Scott lock-free
queue that in turn uses hazard pointers.  It was discovered that the way
we use the isc_queue, such complicated mechanism isn't really needed,
because most of the time, we either execute the work directly when on
nmthread (in case of UDP) or schedule the work from the matching
nmthreads.

Replace the current implementation of the isc_queue with a simple locked
ISC_LIST.  There's a slight improvement - since copying the whole list
is very lightweight - we move the queue into a new list before we start
the processing and locking just for moving the queue and not for every
single item on the list.

NOTE: There's a room for future improvements - since we don't guarantee
the order in which the netievents are processed, we could have two lists
- one unlocked that would be used when scheduling the work from the
matching thread and one locked that would be used from non-matching
thread.
2022-03-04 13:49:51 +01:00
Ondřej Surý
1bb56bb0fc Merge branch '3105-assertion-failure-on-shutdown-in-req_senddone' into 'main'
Add attach/detach for the dns_dispatch_send()

Closes #3105

See merge request isc-projects/bind9!5926
2022-03-04 12:48:37 +00:00
Ondřej Surý
a53ed01d03 Add CHANGES file for [GL #3105] 2022-03-04 13:47:59 +01:00
Ondřej Surý
be34b1c535 Reorder the nsupdate shutdown code to shutdown managers early
If the dns_request send callback is delayed, the dst API would get
deinitialized and then the detach from the tsig key would cause an
assertion failure.

Shutdown the isc_managers early, and only then dereference the dst
objects when cleaning up the resources used by nsupdate.
2022-03-04 13:47:59 +01:00
Ondřej Surý
f3ca90a804 Add attach/detach for the dns_dispatch_send()
The order in which the netievents are processed on the network manager
loop is not guaranteed.  Therefore the recv/read callback can come
earlier than the send/write callback.

The dns_request API wasn't ready for this reordering and it was
destroying the dns_request_t object before the send callback has been
called.

Add additional attach/detach in the req_send()/req_senddone() functions
to make sure we don't destroy the dns_request_t while it's still being
references by asynchronous call.
2022-03-04 13:47:59 +01:00
Ondřej Surý
488b1a776c Merge branch '3184-query-context-management-issues-in-dighost-c' into 'main'
Fix query context management issues in dighost.c

Closes #3184

See merge request isc-projects/bind9!5921
2022-03-04 12:45:58 +00:00
Ondřej Surý
f3228df622 Add CHANGES note for [GL #3184] 2022-03-03 11:11:11 -08:00
Aram Sargsyan
4043fe9090 Fix query context management issues in dighost.c
For the reference, the _cancel_lookup() function iterates through
the lookup's queries list and detaches them. In the ideal scenario,
that should be the last reference and the query will be destroyed
after that, but it is also possible that we are still expecting a
callback, which also holds a reference (for example, _cancel_lookup()
could have been called from recv_done(), when send_done() was still
not executed).

The start_udp() and start_tcp() functions are currently designed in
slightly different ways: start_udp() creates a new query attachment
`connectquery`, to be called in the callback function, while
start_tcp() does not, which is a bug, but is hidden by the fact
that when the query is being erroneously destroyed prematurely (before
_cancel_lookup() is called) in the result of that, it also gets
de-listed from the lookup's queries' list, so _cancel_lookup() doesn't
even try to detach it.

For better understanding, here's an illustration of the query's
references count changes, and from where it was changed:

UDP
---
 1. _new_query()        -> refcount = 1 (initial)
 2. start_udp()         -> refcount = 2 (lookup->current_query)
 3. start_udp()         -> refcount = 3 (connectquery)
 4. udp_ready()         -> refcount = 4 (readquery)
 5. udp_ready()         -> refcount = 5 (sendquery)
 6. udp_ready()         -> refcount = 4 (lookup->current_query)
 7. udp_ready()         -> refcount = 3 (connectquery)
 8. send_done()         -> refcount = 2 (sendquery)
 9. recv_done()         -> refcount = 1 (readquery)
10. _cancel_lookup()    -> refcount = 0 (initial)
11. the query gets destroyed and removed from `lookup->q`

TCP, fortunate scenario
-----------------------

 1. _new_query()        -> refcount = 1 (initial)
 2. start_tcp()         -> refcount = 2 (lookup->current_query)
 3. launch_next_query() -> refcount = 3 (readquery)
 4. launch_next_query() -> refcount = 4 (sendquery)
 5. tcp_connected()     -> refcount = 3 (lookup->current_query)
 6. tcp_connected()     -> refcount = 2 (bug, there was no connectquery)
 7. send_done()         -> refcount = 1 (sendquery)
 8. recv_done()         -> refcount = 0 (readquery)
 9. the query gets prematurely destroyed and removed from `lookup->q`
10. _cancel_lookup()    -> the query is not in `lookup->q`

TCP, unfortunate scenario, revealing the bug
--------------------------------------------

 1. _new_query()        -> refcount = 1 (initial)
 2. start_tcp()         -> refcount = 2 (lookup->current_query)
 3. launch_next_query() -> refcount = 3 (readquery)
 4. launch_next_query() -> refcount = 4 (sendquery)
 5. tcp_connected()     -> refcount = 3 (lookup->current_query)
 6. tcp_connected()     -> refcount = 2 (bug, there was no connectquery)
 7. recv_done()         -> refcount = 1 (readquery)
 8. _cancel_lookup()    -> refcount = 0 (the query was in `lookup->q`)
 9. we hit an assertion here when trying to destroy the query, because
    sendhandle is not detached (which is done by send_done()).
10. send_done()         -> this never happens

This commit does the following:

1. Add a `connectquery` attachment in start_tcp(), like done in
   start_udp().
2. Add missing _cancel_lookup() calls for error scenarios, which
   were possibly missing because before fixing the bug, calling
   _cancel_lookup() and then calling query_detach() would cause
   an assertion.
3. Log a debug message and call isc_nm_cancelread(query->readhandle)
   for every query in the lookup from inside the _cancel_lookup()
   function, like it is done in _cancel_all().
4. Add a `canceled` property for the query which becomes `true` when
   the lookup (and subsequently, its queries) are canceled.
5. Use the `canceled` property in the network manager callbacks to
   know that the query was canceled, and act like `eresult` was equal
   to `ISC_R_CANCELED`.
2022-03-03 11:10:52 -08:00
Aram Sargsyan
98820aef7e Add a missing UNLOCK_LOOKUP
There was a missing UNLOCK_LOOKUP in the recv_done() callback when
the operation had been canceled. That omission could result in a
deadlock situation.
2022-03-03 11:10:52 -08:00
Michał Kępień
284b2ce106 Merge branch 'michal/add-placeholder-entries-to-CHANGES' into 'main'
Add placeholder entries to CHANGES

See merge request isc-projects/bind9!5925
2022-03-03 12:35:08 +00:00
Michał Kępień
6b52160a5b Add placeholder entries to CHANGES
Add placeholders for the following issues:

  - [GL #2950]
  - [GL #3112]
  - [GL #3129]
  - [GL #3158]
2022-03-03 12:18:55 +01:00
Arаm Sаrgsyаn
60f5f78b8d Merge branch '3172-libressl-3.5.0-compat' into 'main'
Resolve "BIND is not compatible with LibreSSL 3.5.0"

Closes #3172

See merge request isc-projects/bind9!5906
2022-03-02 11:07:53 +00:00
Aram Sargsyan
347ce4f590 Add CHANGES entry for [GL #3172] 2022-03-02 10:48:46 +00:00