Commit Graph

36417 Commits

Author SHA1 Message Date
Ondřej Surý
d242ced18f Cleanup the STATID_CONNECT and STATID_CONNECTFAIL stat counters
The STATID_CONNECT and STATID_CONNECTFAIL statistics were used
incorrectly. The STATID_CONNECT was incremented twice (once in
the *_connect_direct() and once in the callback) and STATID_CONNECTFAIL
would not be incremented at all if the failure happened in the callback.

Closes: #3452
(cherry picked from commit 59e1703b50)
2022-07-14 21:48:44 +02:00
Ondřej Surý
259f4481bd Handle the transient TCP connect() failures on FreeBSD
On FreeBSD (and perhaps other *BSD) systems, the TCP connect() call (via
uv_tcp_connect()) can fail with transient UV_EADDRINUSE error.  The UDP
code already handles this by trying three times (is a charm) before
giving up.  Add a code for the TCP, TCPDNS and TLSDNS layers to also try
three times before giving up by calling uv_tcp_connect() from the
callback two more time on UV_EADDRINUSE error.

Additionally, stop the timer only if we succeed or on hard error via
isc__nm_failed_connect_cb().

(cherry picked from commit b21f507c0a)
2022-07-14 21:47:47 +02:00
Mark Andrews
5ba1038a1b Merge branch '3447-lib-dns-tkey-c-free_namelist-should-be-disassociating-associated-rdatatsets-v9_18' into 'v9_18'
disassociate rdatasets when cleaning up [v9_18]

See merge request isc-projects/bind9!6577
2022-07-14 00:58:59 +00:00
Mark Andrews
937794c2da disassociate rdatasets when cleaning up
free_namelist could be passed names with associated rdatasets
when handling errors.  These need to be disassociated before
calling dns_message_puttemprdataset.

(cherry picked from commit 745d5edc3a)
2022-07-14 10:21:38 +10:00
Mark Andrews
4ae0a18a51 Merge branch '3449-kasp-system-test-failed-to-log-some-zones-during-setup-v9_18' into 'v9_18'
kasp: add missing logging during setup [v9_18]

See merge request isc-projects/bind9!6575
2022-07-14 00:13:30 +00:00
Mark Andrews
190784a779 kasp: add missing logging during setup
Some zones where not being logged when just DNSSEC keys where being
generated in system test setup phase.  Add logging for these zones.

(cherry picked from commit 04627997eb)
2022-07-14 09:46:06 +10:00
Ondřej Surý
7af589693f Merge branch 'ondrej-update-dir-locals-for-libtest-v9_18' into 'v9_18'
Update the .dir-locals.el for libtest [v9.18]

See merge request isc-projects/bind9!6566
2022-07-13 10:22:55 +00:00
Ondřej Surý
d2bdb6fe3d Update the .dir-locals.el for libtest
The tests/libtest directory is missing from the .dir-locals.el, so the
emacs flycheck would not work for the unit tests.  Add it to the
configuration.

(cherry picked from commit 80fbd849d5)
2022-07-13 12:20:16 +02:00
Michał Kępień
788939a510 Merge branch '3439-stop-resolving-invalid-names-in-resume_dslookup-v9_18' into 'v9_18'
[v9_18] Stop resolving invalid names in resume_dslookup()

See merge request isc-projects/bind9!6564
2022-07-13 09:32:55 +00:00
Michał Kępień
410456d3d8 Add CHANGES entry and release note for GL #3439
(cherry picked from commit cfa398ad37)
2022-07-13 11:00:32 +02:00
Michał Kępień
b855c6b6c9 Stop resolving invalid names in resume_dslookup()
Commit 7b2ea97e46 introduced a logic bug
in resume_dslookup(): that function now only conditionally checks
whether DS chasing can still make progress.  Specifically, that check is
only performed when the previous resume_dslookup() call invokes
dns_resolver_createfetch() with the 'nameservers' argument set to
something else than NULL, which may not always be the case.  Failing to
perform that check may trigger assertion failures as a result of
dns_resolver_createfetch() attempting to resolve an invalid name.

Example scenario that leads to such outcome:

 1. A validating resolver is configured to forward all queries to
    another resolver.  The latter returns broken DS responses that
    trigger DS chasing.

 2. rctx_chaseds() calls dns_resolver_createfetch() with the
    'nameservers' argument set to NULL.

 3. The fetch fails, so resume_dslookup() is called.  Due to
    fevent->result being set to e.g. DNS_R_SERVFAIL, the default branch
    is taken in the switch statement.

 4. Since 'nameservers' was set to NULL for the fetch which caused the
    resume_dslookup() callback to be invoked
    (fctx->nsfetch->private->nameservers), resume_dslookup() chops off
    one label off fctx->nsname and calls dns_resolver_createfetch()
    again, for a name containing one label less than before.

 5. Steps 3-4 are repeated (i.e. all attempts to find the name servers
    authoritative for the DS RRset being chased fail) until fctx->nsname
    becomes stripped down the the root name.

 6. Since resume_dslookup() does not check whether DS chasing can still
    make progress, it strips off a label off the root name and continues
    its attempts at finding the name servers authoritative for the DS
    RRset being chased, passing an invalid name to
    dns_resolver_createfetch().

Fix by ensuring resume_dslookup() always checks whether DS chasing can
still make progress when a name server fetch fails.  Update code
comments to ensure the purpose of the relevant dns_name_equal() check is
clear.

(cherry picked from commit 1a79aeab44)
2022-07-13 11:00:32 +02:00
Evan Hunt
2d5ad9cd49 Merge branch '2962-invalid-fctx-v9_18' into 'v9_18'
clear fctx->magic and fetch->magic when destroying

See merge request isc-projects/bind9!6554
2022-07-13 05:43:04 +00:00
Evan Hunt
b66cd7b2fc clear fctx->magic and fetch->magic when destroying
fctx_destroy() and dns_resolver_destroyfetch() did not clear the
'magic' field during destruction.

(cherry picked from commit 5ec077e6aa)
2022-07-13 02:12:35 +00:00
Mark Andrews
b8d5763494 Merge branch '3446-autosign-s-checking-revoked-key-with-duplicate-key-id-test-was-incomplete-v9_18' into 'v9_18'
Make "checking revoked key with duplicate key ID" work [v9_18]

See merge request isc-projects/bind9!6559
2022-07-13 01:54:03 +00:00
Mark Andrews
484c74f5f4 Make "checking revoked key with duplicate key ID" work
There should be 2 keys with the same key id after the numerically
lower one is revoked (serial space arithmetic).  The DS points
at the non-revoked key so validation should still succeed.

(cherry picked from commit 513cb24b55)
2022-07-13 11:22:52 +10:00
Mark Andrews
f62e6d870d Merge branch '3445-update-libdns_la_libadd-instead-of-libdns_la_ldflags-v9_18' into 'v9_18'
Update libdns_la_LIBADD rather than libdns_la_LDFLAGS [v9_18]

See merge request isc-projects/bind9!6557
2022-07-13 01:02:14 +00:00
Mark Andrews
7f101aeb53 Update libdns_la_LIBADD rather than libdns_la_LDFLAGS
the wrong macro was being update with MAXMINDDB_LIBS making
it difficult to adjust link order.

(cherry picked from commit 5b51610174)
2022-07-13 10:46:37 +10:00
Evan Hunt
7994f1368c Merge branch '2683-ixfr-logging-v9_18' into 'v9_18'
log the reason for falling back to AXFR from IXFR at level info

See merge request isc-projects/bind9!6551
2022-07-12 23:52:38 +00:00
Evan Hunt
cc3070a0b3 log the reason for falling back to AXFR from IXFR at level info
messages indicating the reason for a fallback to AXFR (i.e, because
the requested serial number is not present in the journal, or because
the size of the IXFR response would exceeed "max-ixfr-ratio") are now
logged at level info instead of debug(4).

(cherry picked from commit df1d81cf96)
2022-07-12 16:26:13 -07:00
Matthijs Mekking
06c6c3d2f3 Merge branch '3438-dnssec-policy-does-not-set-inline-signing-v9_18' into 'v9_18'
[v9_18] Fix inheritance for dnssec-policy when checking for inline-signing

See merge request isc-projects/bind9!6546
2022-07-12 15:23:09 +00:00
Matthijs Mekking
383fe2f4ba Add release note and change entry for #3438
Bug worth mentioning.

(cherry picked from commit 689215a675)
2022-07-12 17:22:39 +02:00
Matthijs Mekking
235b89dbcd Inherit dnssec-policy in check for inline-signing
When dnssec-policy is used, and the zone is not dynamic, BIND will
assume that the zone is inline-signed. But the function responsible
for this did not inherit the dnssec-policy option from the view or
options level, and thus never enabled inline-signing, while the zone
should have been.

This is fixed by this commit.

(cherry picked from commit 576b21b168)
2022-07-12 17:22:39 +02:00
Matthijs Mekking
718d7bdeb9 Test setting of inline-signing with dnssec-policy
When dnssec-policy is used, and the zone is not dynamic, BIND will
assume that the zone is inline-signed. Add test cases to verify this.

(cherry picked from commit efa8a4e88d)
2022-07-12 17:22:39 +02:00
Matthijs Mekking
3f54a0f051 Fix kasp system test bugs
Fix a comment, ensuring the right parameters are used (zone is
parameter $3, not $2) and add view and policy parameters to the comment.

Fix the view tests and test the correct view (example3 instead of
example2).

Fix placement of "n=$((n+1)" for two test cases.

(cherry picked from commit ff65f07779)
2022-07-12 17:22:39 +02:00
Artem Boldariev
3d98312a7b Merge branch 'artem-backport-tls-related-fixes-from-loopmgr-branch-v9-18' into 'v9_18'
[Backport to 9.18] Backport TLS-related fixes from the loopmgr-branch

See merge request isc-projects/bind9!6550
2022-07-12 13:13:39 +00:00
Artem Boldariev
814baa3e6b TLS: do not ignore accept callback result
Before this change the TLS code would ignore the accept callback result,
and would not try to gracefully close the connection. This had not been
noticed, as it is not really required for DoH. Now the code tries to
shut down the TLS connection gracefully when accepting it is not
successful.

(cherry picked from commit ffcb54211e)
2022-07-12 15:32:45 +03:00
Artem Boldariev
d6041e5d45 *_noresponse, tlsdns_listen_noalpn: csends == 1 is not guaranteed
This commit removes an assertion from the unit test which cannot be
guaranteed.

According to the test, exactly one client send must succeed. However,
it cannot really be guaranteed, as do not start to read data in the
accept callback on the server nor attach to the accepted handle. Thus,
we can expect the connection to be closed soon after we have returned
from the callback.

Interestingly enough, the test would pass just fine on TCP because:

a) there are fewer layers involved and thus there is less processing;

b) it is possible for the data to be sent and end up in an internal OS
socket buffer without being touched by an application's code on the
server. In such a case the client's write callback still would be
called successfully;

There is a chance for the test to succeed over TLS as well (as it
happily did before), but as the code has been changed to close unused
connections as soon as possible, the chance is far slimmer now.

What can be guaranteed is:

* cconnects == 1 (number client connections equals 1);
* saccepts == 1 (number of accepted connections equals 1).

(cherry picked from commit 0f9b6a7bc1)
2022-07-12 15:31:20 +03:00
Artem Boldariev
c85949fbe1 TLSDNS: try pass incoming data to OpenSSL if there are any
Otherwise the code path will lead to a call to SSL_get_error()
returning SSL_ERROR_SSL, which in turn might lead to closing
connection to early in an unexpected way, as it is clearly not what is
intended.

The issue was found when working on loppmgr branch and appears to
be timing related as well. Might be responsible for some unexpected
transmission failures e.g. on zone transfers.

(cherry picked from commit 8585b92f98)
2022-07-12 15:29:36 +03:00
Artem Boldariev
ba7fabde01 TLS: bail out earlier when NM is stopping
In some operations - most prominently when establishing connection -
it might be beneficial to bail out earlier when the network manager
is stopping.

The issue is backported from loopmgr branch, where such a change is
not only beneficial, but required.

(cherry picked from commit fc74b15e67)
2022-07-12 15:28:15 +03:00
Artem Boldariev
0754def85d TLS: sometimes TCP conn. handle might be NULL on when connecting
In some cases - in particular, in case of errors, NULL might be passed
to a connection callback instead of a handle that could have led to
an abort. This commit ensures that such a situation will not occur.

The issue was found when working on the loopmgr branch.

(cherry picked from commit ac4fb34f18)
2022-07-12 15:26:50 +03:00
Artem Boldariev
c44633feb2 TLS: try to close sockets whenever there are no pending operations
This commit ensures that the underlying TCP socket of a TLS connection
gets closed earlier whenever there are no pending operations on it.

In the loop-manager branch, in some circumstances the connection
could have remained opened for far too long for no reason. This
commit ensures that will not happen.

(cherry picked from commit 88524e26ec)
2022-07-12 15:25:30 +03:00
Artem Boldariev
3e69cc35b8 TLS: Implement isc_nmhandle_setwritetimeout()
This commit adds a proper implementation of
isc_nmhandle_setwritetimeout() for TLS connections. Now it passes the
value to the underlying TCP handle.

(cherry picked from commit 237ce05b89)
2022-07-12 15:22:57 +03:00
Michal Nowak
4884ac3355 Merge branch 'mnowak/alpine-3.16-v9_18' into 'v9_18'
[v9_18] Add Alpine Linux 3.16

See merge request isc-projects/bind9!6548
2022-07-12 11:33:24 +00:00
Michal Nowak
1e386c5489 Add Alpine Linux 3.16
(cherry picked from commit 0d0ab3db10)
2022-07-12 13:11:48 +02:00
Mark Andrews
bcc5fc4a10 Merge branch '3389-unexpected-badkey-in-upforwd-system-test-v9_18' into 'v9_18'
Clone the message buffer before forwarding UPDATE messages [v9_18]

See merge request isc-projects/bind9!6544
2022-07-12 10:05:54 +00:00
Mark Andrews
4be9aba39e Add CHANGES note for [GL #3389]
(cherry picked from commit 09d8ed3970)
2022-07-12 19:01:18 +10:00
Mark Andrews
44bfc8a9b2 Clone the message buffer before forwarding UPDATE messages
this prevents named forwarding a buffer that may have been over
written.

(cherry picked from commit 7a42417d61)
2022-07-12 19:00:38 +10:00
Michał Kępień
068741dbe6 Merge branch 'michal/set-up-version-and-release-notes-for-bind-9.18.6' into 'v9_18'
Set up version and release notes for BIND 9.18.6

See merge request isc-projects/bind9!6539
2022-07-11 07:05:55 +00:00
Michał Kępień
c7f1ee665b Set up release notes for BIND 9.18.6 2022-07-11 08:51:32 +02:00
Michał Kępień
be9c6f44f3 Update BIND version to 9.18.6-dev 2022-07-11 08:51:32 +02:00
Mark Andrews
a93f5ed51d Merge branch '3433-support-default-hmac-v9_18' into 'v9_18'
Support DEFAULT_HMAC [v9_18]

See merge request isc-projects/bind9!6533
2022-07-07 05:06:48 +00:00
Mark Andrews
ba45075acb Add DEFAULT_HMAC to conf.sh.common
(cherry picked from commit 972d7fd682)
2022-07-07 13:26:16 +10:00
Mark Andrews
d4297eed9c Merge branch '3061-ifconfig-sh-down-messes-up-loopback-interfaces-v9_18' into 'v9_18'
update ifconfig.sh [v9_18]

See merge request isc-projects/bind9!6530
2022-07-07 00:52:51 +00:00
Mark Andrews
6311d9d2f6 Add CHANGES note for [GL #3061]
(cherry picked from commit e0708c8950)
2022-07-07 10:13:00 +10:00
Mark Andrews
5a58e8af8d update ifconfig.sh
* make it harder to get the interface numbers wrong by using 'max'
to specify the upper bound of the sequence of interfaces and use 'max'
when calculating the interface number
* extract the platform specific instruction into 'up' and 'down'
and call them from the inner loop so that the interface number is
calculated in one place.
* calculate the A and AAAA address in a single place rather than
in each command
* use /sbin/ipadm on Solaris 2.11 and greater

(cherry picked from commit abfb5b1173)
2022-07-07 10:13:00 +10:00
Evan Hunt
382cac0f4f Merge branch '3152-retry-on-formerr-v9_18' into 'v9_18'
try other servers when receiving FORMERR

See merge request isc-projects/bind9!6529
2022-07-06 22:39:36 +00:00
Evan Hunt
19be66772c CHANGES for [GL #3152]
(cherry picked from commit 43e38a21ef)
2022-07-06 22:19:20 +00:00
Evan Hunt
30534b125e try other servers when receiving FORMERR
previously, when an iterative query returned FORMERR, resolution
would be stopped under the assumption that other servers for
the same domain would likely have the same capabilities. this
assumption is not correct; some domains have been reported for
which some but not all servers will return FORMERR to a given
query; retrying allows recursion to succeed.

(cherry picked from commit f6abb80746)
2022-07-06 22:19:20 +00:00
Mark Andrews
12224771d0 Merge branch '3402-create-synth-from-dnssec-namespaces-v9_18' into 'v9_18'
Add a mechanism to record namespaces for synth-from-dnssec [v9_18]

See merge request isc-projects/bind9!6528
2022-07-06 22:18:23 +00:00
Mark Andrews
1872105f09 Add release note for [GL #3402]
(cherry picked from commit 07d5c23cac)
2022-07-07 07:47:45 +10:00