Commit Graph

37924 Commits

Author SHA1 Message Date
Tony Finch
0e489b9ed4 Merge branch '3745-delzone-catz' into 'main'
Don't crash when rndc delzone encounters a catz member

Closes #3745

See merge request isc-projects/bind9!7232
2023-01-04 17:04:48 +00:00
Tony Finch
9fa20d6f6c Don't crash when rndc delzone encounters a catz member
This bug was masked in the tests because the `catz` test script did an
`rndc addzone` before an `rndc delzone`. The `addzone` autovivified
the NZF config, so `delzone` worked OK.

This commit swaps the order of two sections of the `catz` test script
so that it uses `delzone` before `addzone`, which provokes a crash
when `delzone` requires a non-NULL NZF config.

To fix the crash, we now try to remove the zone from the NZF config
only if it was dynamically added but not by a catalog zone.
2023-01-04 14:04:22 +00:00
Matthijs Mekking
a4063f7d20 Merge branch '3760-cid-432259-sizeof-not-portable-in-lib-dns-remote' into 'main'
Fix CID 432259: Sizeof not portable (remote.c)

Closes #3760

See merge request isc-projects/bind9!7288
2023-01-04 07:58:12 +00:00
Matthijs Mekking
abd8c1cad0 Fix CID 432259: Sizeof not portable (remote.c)
The following report suggests that the 'size' parameter in the two
calls to 'isc_mem_get()' should be set to the
'count * sizeof(*tlsnames)' and 'count * sizeof(*keynames)'
respectively.

/lib/dns/remote.c: 117 in dns_remote_init()
111		}
112	} else {
113		remote->keynames = NULL;
114	}
115
116	if (tlsnames != NULL) {

>>>     CID 432259:    (SIZEOF_MISMATCH)
>>>     Passing argument "count * 8UL /* sizeof (tlsnames) */" to
>>>	function "isc__mem_get" and then casting the return value to
>>>	"dns_name_t **" is suspicious.  In this particular case
>>>	"sizeof (dns_name_t **)" happens to be equal to
>>>	"sizeof (dns_name_t *)", but this is not a portable assumption.

117	remote->tlsnames = isc_mem_get(mctx, count * sizeof(tlsnames));
118		for (i = 0; i < count; i++) {
119			remote->tlsnames[i] = NULL;
120		}
121		for (i = 0; i < count; i++) {
122			if (tlsnames[i] != NULL) {

/lib/dns/remote.c: 99 in dns_remote_init()
93		memmove(remote->dscps, dscp, count * sizeof(isc_dscp_t));
94	} else {
95		remote->dscps = NULL;
96	}
97
98	if (keynames != NULL) {

>>>     CID 432259:    (SIZEOF_MISMATCH)
>>>     Passing argument "count * 8UL /* sizeof (keynames) */" to
>>>	function "isc__mem_get" and then casting the return value to
>>>	"dns_name_t **" is suspicious.  In this particular case
>>>	"sizeof (dns_name_t **)" happens to be equal to "sizeof
>>>	(dns_name_t *)", but this is not a portable assumption.

99	 remote->keynames = isc_mem_get(mctx, count * sizeof(keynames));
100	 for (i = 0; i < count; i++) {
101		remote->keynames[i] = NULL;
102	 }
103	 for (i = 0; i < count; i++) {
104		if (keynames[i] != NULL) {
2023-01-03 16:47:57 +01:00
Arаm Sаrgsyаn
0667cd6cc4 Merge branch '3735-fix-rpz-shutdown-bugs' into 'main'
Fix shutdown and error path bugs in the rpz unit

Closes #3735

See merge request isc-projects/bind9!7289
2023-01-03 15:11:08 +00:00
Aram Sargsyan
2824422e78 Add a CHANGES note for [GL #3735] 2023-01-03 14:21:17 +00:00
Aram Sargsyan
ef4f15d2d1 Fix an error path bug in rpz.c:update_nodes()
When dns_db_createiterator() fails, 'updbit' should not be destroyed
for obvious reasons, i.e. it is NULL.
2023-01-03 14:21:17 +00:00
Aram Sargsyan
d36728e42f Fix a shutdown and error path bugs in rpz.c:update_nodes()
When shutting down, or when dns_dbiterator_current() fails, 'node'
shouldn't be detached, because it is NULL at that point.
2023-01-03 14:21:17 +00:00
Aram Sargsyan
975d16230b Fix a shutdown bug in update_rpz_cb()
When shutting down, the cleanup path should not try to destroy
'newnodes', because it is NULL at that point.

Introduce another label for the "shuttingdown" scenario.
2023-01-03 13:27:43 +00:00
Arаm Sаrgsyаn
ca2d2568b1 Merge branch '3754-adb-maybe_expire_entry-called-unlocked-bug' into 'main'
Don't expire an ADB entry without holding the entries lock

Closes #3754

See merge request isc-projects/bind9!7275
2023-01-03 09:01:18 +00:00
Aram Sargsyan
268154f899 Add a CHANGES note for [GL #3754] 2023-01-03 08:23:23 +00:00
Aram Sargsyan
da7c448988 Don't expire an ADB entry without holding the entries lock
The clean_namehooks() function does't hold the 'adb->entries_lock'
lock, so calling maybe_expire_entry() is not thread-safe.

Instead of adding a lock/unlock, leave the expiration to later,
e.g. by the get_attached_and_locked_entry() function.

Also fix a couple of comment typos.
2023-01-03 08:21:52 +00:00
Mark Andrews
2e1e398e7d Merge branch '3761-ubsan-error-in-isc_buffer_reserve' into 'main'
Resolve "UBSAN error in isc_buffer_reserve"

Closes #3761

See merge request isc-projects/bind9!7285
2023-01-03 07:30:21 +00:00
Mark Andrews
096b280b1c Do not pass NULL pointer to memmove - undefined behaviour
Check if 'old_base' is NULL and if so skip calling memmove.
2023-01-03 14:40:30 +11:00
Michał Kępień
b2d08c514d Merge branch 'michal/update-copyright-year-to-2023' into 'main'
Update copyright year to 2023

See merge request isc-projects/bind9!7282
2023-01-02 13:06:36 +00:00
Michał Kępień
1a5d707f52 Update copyright year to 2023 2023-01-02 13:58:00 +01:00
Artem Boldariev
b78829a3f8 Merge branch 'artem-tls-use-isc-buffer' into 'main'
TLS: use isc_buffer_t for send requests, reuse isc_buffer_t during send requests

See merge request isc-projects/bind9!7281
2022-12-30 18:35:53 +00:00
Artem Boldariev
fbf1546fb8 TLS: use isc_buffer_t for send requests
This commit replaces ad-hoc code for send requests buffer management
within TLS with the one based on isc_buffer_t.

Previous version of the code was trying to use pre-allocated small
buffers to avoid extra allocations. The code would allocate a larger
dynamic buffer when needed. There is no need to have ad-hoc code for
this, as isc_buffer_t now provides this functionality internally.

Additionally to the above, the old version of the code lacked any
logic to reuse the dynamically allocated buffers. Now, as we do not
manage memory buffers, but isc_buffer_t objects, we can implement this
strategy. It can be in particular helpful for longer lasting
connections, as in this case the buffer will adjust itself to the size
of the messages being transferred. That is, it is in particular useful
for XoT, as Stream DNS happen to order send requests in such a way
that the send request will get reused.
2022-12-30 19:56:25 +02:00
Arаm Sаrgsyаn
0c252fdfc5 Merge branch 'aram/dns_dispatch_createtcp-bugfix' into 'main'
Don't pass a NULL pointer to isc_sockaddr_format()

See merge request isc-projects/bind9!7277
2022-12-28 14:18:52 +00:00
Aram Sargsyan
41ca9d419e Don't pass a NULL pointer to isc_sockaddr_format()
The 'localaddr' pointer can be NULL, which causes an assertion failure.

Use '&disp->local' instead when printing a debug log message.
2022-12-28 12:10:09 +00:00
Matthijs Mekking
eb7275e933 Merge branch '3714-remove-alt-transfer-source' into 'main'
Remove setting alternate transfer source

Closes #3714

See merge request isc-projects/bind9!7163
2022-12-23 15:11:25 +00:00
Matthijs Mekking
e277f1f757 Add CHANGES and release notes for #3714
Update release notes, remove the deprecation entry and add a new
removed feature entry.
2022-12-23 15:32:12 +01:00
Matthijs Mekking
d8e98d4bba Remove unused dns_remote_t functions
Now that setting alternate transfer sources is removed, the functions
to check whether all addresses are considered good have become obsolete.
2022-12-23 15:17:54 +01:00
Matthijs Mekking
8640e70616 Remove setting alternate transfer source from doc
Remove any reference to 'alt-transfer-source', 'alt-transfer-source-v6',
and 'use-alt-transfer-source' from the documentation and manual pages.
2022-12-23 14:44:48 +01:00
Matthijs Mekking
5954ae6458 Remove setting alternate transfer source
Remove parsing the configuration options 'alt-transfer-source',
'alt-transfer-source-v6', and 'use-alt-transfer-source', and remove
the corresponding code that implements the feature.
2022-12-23 14:39:59 +01:00
Matthijs Mekking
2638a2a29c Merge branch 'matthijs-remote-server-refactor' into 'main'
Refactor remote servers (primaries, parental agents) in zone.c

See merge request isc-projects/bind9!7110
2022-12-23 13:37:14 +00:00
Matthijs Mekking
80178c2134 Add release notes
The refactor introduces a new way to configure source addresses for
primaries and parental-agents, a new thingy that we should make people
aware of.
2022-12-23 13:36:50 +00:00
Matthijs Mekking
34636576d0 Add CHANGES
Mention the refactor of zone.c
2022-12-23 13:36:50 +00:00
Matthijs Mekking
c4bffb3e64 Use 'source[-v6]' for transfer, notify, checkds
Use the configured 'source' and 'source-v6' when initiating a zone
transfer, sending a notify, or when checking for the DS. Remove the
special code for using alternate transfer sources.

Update some system tests to use the new configuration and make sure
the tests still work.
2022-12-23 13:36:50 +00:00
Matthijs Mekking
a92b9e40ce Small comment change in remote.h header file
The documentation for 'dns_remote_addr()' was incorrect (copy paste
error).
2022-12-23 13:36:50 +00:00
Matthijs Mekking
17e16c7a34 Parse and store new 'source[-v6]' option
Parse the new 'source' and 'source-v6' options and store them with
the corresponding remote servers (parental-agents, primaries, ...).
2022-12-23 13:36:50 +00:00
Matthijs Mekking
ad248f2261 Add new 'source[-v6]' option for remote servers
Add a new way to configure the preferred source address when talking to
remote servers such as primaries and parental-agents. This will
eventually deprecate options such as 'parental-source',
'parental-source-v6', 'transfer-source', etc.

Example of the new configuration:

    parental-agents "parents" port 5353 \
        source 10.10.10.10 port 5354 dscp 54 \
        source-v6 2001:db8::10 port 5355 dscp 55 {
	10.10.10.11;
	2001:db8::11;
    };
2022-12-23 13:36:50 +00:00
Matthijs Mekking
c444c6d806 Remove functions named_config_[get|put]iplist
They are unused.
2022-12-23 13:36:50 +00:00
Matthijs Mekking
bf1dd57242 Refactor zone.c, use dns_remote_t structure
Use the new dns_remote_t structure for remote server communication to
primaries, parental agents, etc.
2022-12-23 13:36:50 +00:00
Matthijs Mekking
0300295944 Add new files for remote server communication
The dns_remote_t structure is intended to replace the variables in
the structure that deals with remote server communication to primaries,
parental agents, forwarders, etc.
2022-12-23 13:36:50 +00:00
Tom Krizek
8c35815513 Merge branch 'tkrizek/gitignore-fixes' into 'main'
Don't track gitignored files in the repo

See merge request isc-projects/bind9!7264
2022-12-23 13:29:12 +00:00
Michał Kępień
5b28da7ea0 Detect "ignored yet tracked" files in GitLab CI
Ensure that no .gitignore file in the tree contains patterns matching
files tracked by Git by adding a simple script that detects such
situations and running that script as part of the "misc" job in the
"precheck" stage of every GitLab CI pipeline.
2022-12-23 13:44:18 +01:00
Tom Krizek
a02da6cf21 Remove obsolete gitignore file in mysqldyn
The Makefile used to be autogenerated prior to
67f76b1269 which is the reason why the
.gitignore existed in the first place. Since then, a static Makefile is
used and is supposed to be tracked in the git repo.
2022-12-23 13:44:18 +01:00
Tom Krizek
e03daf22ec Make gitignore matching in rpzrecurse more precise
The pre-defined test cases use named.$TESTCASE.conf naming convention,
where TESTCASE is a human readable name contaning actual word(s). The
autogenerated test cases' names always start with a number from 1 to 6.
2022-12-23 13:44:18 +01:00
Tom Krizek
b8616e457f Remove ans.pl system test files from gitignore
The ans*.pl scripts are part of system tests and should be part of the
repository. The gitignore entires for these files have been removed.
2022-12-23 13:44:18 +01:00
Tom Krizek
c5708044e7 Rename dig reference files in the rrsetorder test
bin/tests/system/rrsetorder/dig.out* files match a gitignore expression
present in bin/tests/system/.gitignore.  Since these are meant to be
reference files that are compared to the files generated when the
"rrsetorder" system test is run, rename them to avoid listing tracked
files in .gitignore files.
2022-12-23 13:44:18 +01:00
Arаm Sаrgsyаn
14957c95b0 Merge branch '3752-resolver-adb-quota-bug' into 'main'
Fix an ADB quota management bug in the resolver

Closes #3752

See merge request isc-projects/bind9!7266
2022-12-23 10:23:29 +00:00
Aram Sargsyan
a4def095f3 Add CHANGES and release notes for [GL #3752] 2022-12-23 09:45:20 +00:00
Aram Sargsyan
53afe1f978 Fix an ADB quota management error in the resolver
Normally, when a 'resquery_t' object is created in fctx_query(),
we call dns_adb_beginudpfetch() (which increases the ADB quota)
only if it's a UDP query. Then, in fctx_cancelquery(), we call
dns_adb_endudpfetch() to decreases back the ADB quota, again only
if it's a UDP query.

The problem is that a UDP query can become a TCP query, preventing
the quota from adjusting back in fctx_cancelquery() later.

Call dns_adb_beginudpfetch() also when switching the query type
from UDP to TCP.
2022-12-23 09:45:20 +00:00
Aram Sargsyan
c7ba26c3d6 INSIST that active quota is 0 in destroy_adbentry()
This should catch ADB quota management errors in the resolver.
2022-12-23 09:45:20 +00:00
Artem Boldariev
c4097ec5d5 Merge branch '3748-rename-tls-caches-creation-functions' into 'main'
Rename isc_tlsctx_cache_new() to isc_tlsctx_cache_create(), tlsctx_client_session_cache_new() to tlsctx_client_session_create()

Closes #3748

See merge request isc-projects/bind9!7269
2022-12-23 09:13:56 +00:00
Artem Boldariev
7962e7f575 tlsctx_client_session_cache_new() -> tlsctx_client_session_create()
Additionally to renaming, it changes the function definition so that
it accepts a pointer to pointer instead of returning a pointer to the
new object.

It is mostly done to make it in line with other functions in the
module.
2022-12-23 11:10:11 +02:00
Artem Boldariev
f102df96b8 Rename isc_tlsctx_cache_new() -> isc_tlsctx_cache_create()
Additionally to renaming, it changes the function definition so that
it accepts a pointer to pointer instead of returning a pointer to the
new object.

It is mostly done to make it in line with other functions in the
module.
2022-12-23 11:10:11 +02:00
Tom Krizek
6dede665c7 Merge branch 'tkrizek/dangerfile-backport-tweaks' into 'main'
danger CI: tweak backport check and add Affects label check

See merge request isc-projects/bind9!7253
2022-12-23 08:50:10 +00:00
Tom Krizek
64d71a1f5f danger: check the Affects labels are set
Unless the MR is a backport, the Affects labels should be used to
indicate which versions are affected by the issue that prompted the MR.
2022-12-23 09:44:56 +01:00