Commit Graph

36449 Commits

Author SHA1 Message Date
Aram Sargsyan
29057d9911 DiG: use the same retry and fail-over logic for different failure types
DiG implements different logic in the `recv_done()` callback function
when processing a failure:

1. For a timed-out query it applies the "retries" logic first, then,
   when it fails, fail-overs to the next server.

2. For an EOF (end-of-file, or unexpected disconnect) error it tries to
   make a single retry attempt (even if the user has requested more
   retries), then, when it fails, fail-overs to the next server.

3. For other types of failures, DiG does not apply the "retries" logic,
   and tries to fail-over to the next servers (again, even if the user
   has requested to make retries).

Simplify the logic and apply the same logic (1) of first retries, and
then fail-over, for different types of failures in `recv_done()`.

(cherry picked from commit abfd0d363f)
2022-07-22 09:00:21 +00:00
Aram Sargsyan
6efb73d4bb Fix DiG query retry and fail-over bug
When the `send_done()` callback function gets called with a failure
result code, DiG erroneously cancels the lookup.

Stop canceling the lookup and give DiG a chance to retry the failed
query, or fail-over to another server, using the logic implemented in
the `recv_done()` callback function.

(cherry picked from commit c2329dd110)
2022-07-22 09:00:15 +00:00
Aram Sargsyan
be8ec6ef18 Fix DiG UDP query retry and fail-over bug
When the `udp_ready()` callback function gets called with a failure
result code, DiG erroneously cancels the lookup.

Copy the logic behind `tcp_connected()` callback function into
`udp_ready()` so that DiG will now retry the failed query (if retries
are enabled) and then, if it fails again, it will fail-over to the next
server in the list, which synchronizes the behavior between TCP and UDP
modes.

Also, `udp_ready()` was calling `lookup_detach()` without calling
`lookup_attach()` first, but the issue was masked behind the fact
that `clear_current_lookup()` wasn't being called when needed, and
`lookup_detach()` was compensating for that. This also has been fixed.

(cherry picked from commit 3f31085525)
2022-07-22 09:00:08 +00:00
Petr Špaček
c003127717 Merge branch 'pspacek/arm-zombie-support-v9_18' into 'v9_18'
Support ancient build tools for the ARM [v9_18]

See merge request isc-projects/bind9!6605
2022-07-21 13:30:27 +00:00
Petr Špaček
c56bcbdb6a Support Sphinx 1.6.7
Luckily we don't rely on SphinxDirective functionality which does not
exist in 1.6.7. Replace it with docutils Directive.

transform_content() callback was added only in Sphinx 3.0.0.
Detect if it was not called and call it manually.
The transform_content() function requires access to inner "contentnode"
which is created inside run(). This workaround relies on the order of
node as it was in the pre-3.0.0 versions, but it should not matter as
new versions will not trigger the workaround.

(cherry picked from commit 8796ad7fe8)
2022-07-21 15:26:26 +02:00
Petr Špaček
5864cac5d4 Support docutils 0.14+dfsg-4
Ancient versions of docutils cannot cope with bare text inside a table
cell. Wrap text in a paragraph to work around that.

(cherry picked from commit af5bbb433a)
2022-07-21 15:26:22 +02:00
Petr Špaček
3818a87e95 Merge branch 'pspacek/minor-arm-tweaks-and-fixes-v9_18' into 'v9_18'
Fix dnssec-signzone examples in DNSSEC Guide [v9_18]

See merge request isc-projects/bind9!6603
2022-07-21 13:19:24 +00:00
Petr Špaček
d40615d881 Avoid opt-out flag in dnssec-signzone examples
Since !6413 we discourage opt-out, so we should not be advertising it in
the examples. Even worse, it was just thrown into the command line
without even mentioning its meaning in the surrounding text.

Related: !6413
(cherry picked from commit beae857288)
2022-07-21 15:18:55 +02:00
Petr Špaček
a927799e84 Remove errorneous shell output redirection from dnssec-signzone example
The > looked like shell output redirection. It was present since we
imported DNSSEC Guide into the ARM.

(cherry picked from commit 1ab564d605)
2022-07-21 15:18:50 +02:00
Michal Nowak
d4b00b1dc1 Merge tag 'v9_18_5' into v9_18
BIND 9.18.5
2022-07-21 12:31:03 +02:00
Michał Kępień
98258e21b5 Merge branch 'michal/run-a-short-respdiff-test-for-all-merge-requests-v9_18' into 'v9_18'
[v9_18] Run a short respdiff test for all merge requests

See merge request isc-projects/bind9!6590
2022-07-18 13:33:49 +00:00
Michał Kępień
f3e647a4c1 Run a short respdiff test for all merge requests
Running a respdiff test for every merge request would be useful for
catching protocol-breaking changes before they are applied to the source
code.  However, the existing respdiff-based tests take a while to
complete (about half an hour with our current CI infrastructure), which
does not make them a good fit for this purpose.  Add a new GitLab CI
job, "respdiff-short", which uses a smaller query set that gets
processed within a couple of minutes on our current CI infrastructure.
Rename the existing respdiff-based jobs to make distinguishing them
easier.

(cherry picked from commit 31ee43a314)
2022-07-18 15:25:17 +02:00
Michał Kępień
82b6a388fc Extract respdiff job definition to a YAML anchor
Ensure the common parts of all jobs using respdiff are available in the
form of a reusable YAML anchor, to reduce code duplication and to
simplify adding more respdiff-based jobs to GitLab CI.

(cherry picked from commit ca20a189f7)
2022-07-18 15:25:17 +02:00
Michał Kępień
7d02e1088c Use a pre-built executable as the reference named
The "respdiff" GitLab CI job compares DNS responses produced by the
current version of named with those produced by a reference version.
The latter is built from source in each "respdiff" job, despite the fact
that the reference version changes very rarely.  Use a pre-built named
executable as the reference version instead, assuming it is available in
the OS image used for "respdiff" tests.

(cherry picked from commit ab90a4705a)
2022-07-18 15:25:17 +02:00
Ondřej Surý
116b825b8d Merge branch '3453-cope-with-too-small-BUFSIZ-v9_18' into 'v9_18'
Increase the BUFSIZ-long buffers [v9.18]

See merge request isc-projects/bind9!6586
2022-07-15 20:40:03 +00:00
Ondřej Surý
3c1d6e164e Increase the BUFSIZ-long buffers
The BUFSIZ value varies between platforms, it could be 8K on Linux and
512 bytes on mingw.  Make sure the buffers are always big enough for the
output data to prevent truncation of the output by appropriately
enlarging or sizing the buffers.

(cherry picked from commit b19d932262)
2022-07-15 21:16:51 +02:00
Michał Kępień
c447008196 Merge branch '3443-memory-related-cleanups-v9_18' into 'v9_18'
[v9_18] Memory-related cleanups

See merge request isc-projects/bind9!6568
2022-07-15 08:36:18 +00:00
Michał Kępień
93ded5cca2 Update documentation for named's -M option
Remove "external" from the list of legal values for the -M command-line
option as it has not been allowed since the internal memory allocator
was removed by commit 55ace5d3aa.

Make the style of the relevant paragraph more in line with the next one
and split its contents up into an unordered list of options for improved
readability.

(cherry picked from commit f0c31ceb3b)
2022-07-15 10:31:53 +02:00
Evan Hunt
ba16ff2da5 Merge branch '3456-dispatch-connect-race-v9_18' into 'v9_18'
remove unnecessary assertion in dns_dispatch_connect()

See merge request isc-projects/bind9!6584
2022-07-15 04:18:05 +00:00
Evan Hunt
7903bffbc4 remove unnecessary assertion in dns_dispatch_connect()
When a thread calls dns_dispatch_connect() on an unconnected TCP socket
it sets `tcpstate` from `DNS_DISPATCHSTATE_NONE` to `_CONNECTING`.
Previously, it then INSISTed that there were no pending connections
before calling isc_nm_tcpdnsconnect().

If a second thread called dns_dispatch_connect() during that window
of time, it could add a pending connection to the list, and trigger
an assertion failure.

This commit removes the INSIST since the condition is actually
harmless.

(cherry picked from commit 25ddec8a0a)
2022-07-14 19:27:24 -07:00
Ondřej Surý
93757acfe5 Merge branch 'ondrej-fix-timing-error-in-statistics-system-test-v9_18' into 'v9_18'
Wait for TCP connection refused in the statistics system test [v9.18]

See merge request isc-projects/bind9!6583
2022-07-14 20:53:10 +00:00
Ondřej Surý
c6b4d82557 Wait for TCP connection refused in the statistics system test
The statistics system test makes a query to foo.info to check for the
pending connections because the ans4 doesn't respond to the query.

This might or might not (depending on exact timing) increment the failed
TCP connection counter when the query is retried over TCP because ans4
doesn't listen on the TCP.

Wait for the 'connection refused' in the ns3 log file to be able to
count the exactly 1 failed TCP connection.

(cherry picked from commit 0227d82dc8)
2022-07-14 22:34:08 +02:00
Ondřej Surý
54ec179723 Merge branch '3451-handle-transient-TCP-connect-EADDRINUSE-on-BSDs-v9_18' into 'v9_18'
Handle the transient TCP connect() failures on FreeBSD [v9.18]

See merge request isc-projects/bind9!6582
2022-07-14 20:13:12 +00:00
Ondřej Surý
c79ee8daa1 Add CHANGES note for [GL #3451]
(cherry picked from commit a9c54ecdc6)
2022-07-14 21:48:48 +02:00
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