Compare commits

...
Author SHA1 Message Date
Matthijs Mekking 9f6c62be50 Revert "[9.18] fix: usr: Fix NSEC3 closest encloser lookup for names with empty non-terminals"
This reverts merge request !9632
2024-10-22 13:39:20 +00:00
Michal Nowak fa16eb402e [9.18] chg: test: Rewrite verify system test to pytest
Backport of MR !9249

Merge branch 'backport-mnowak/pytest_rewrite_verify-9.18' into 'bind-9.18'

See merge request isc-projects/bind9!9675
2024-10-21 13:07:12 +00:00
Michal Nowak 82712ad7fc Rewrite verify system test to pytest
(cherry picked from commit 091968f5fa)
2024-10-21 14:11:46 +02:00
Michal Nowak 59e20811fc [9.18] fix: doc: All footnotes need to have unique name and be referenced
With Sphinx 8.1.0, footnotes can't stand on their own and have to be
referenced from somewhere, otherwise build fails, e.g.:

    doc/dnssec-guide/signing.rst:1470: WARNING: Footnote [#] is not referenced. [ref.footnote]

Backport of MR !9663

Merge branch 'backport-mnowak/fix-dnssec-guide-footnote-9.18' into 'bind-9.18'

See merge request isc-projects/bind9!9671
2024-10-21 09:15:55 +00:00
Michal Nowak eb9061e7f1 All footnotes need to have unique name and be referenced
With Sphinx 8.1.0, footnotes can't stand on their own and have to be
referenced from somewhere, otherwise build fails, e.g.:

    doc/dnssec-guide/signing.rst:1470: WARNING: Footnote [#] is not referenced. [ref.footnote]

(cherry picked from commit bdf8859e2d)
2024-10-21 11:02:27 +02:00
Mark Andrews 002141af2e [9.18] fix: usr: Restore values when dig prints command line
Options of the form `[+-]option=<value>` failed to display the value on the printed command line. This has been fixed.

Closes #4993

Backport of MR !9653

Merge branch 'backport-4993-dig-restore-command-line-values-9.18' into 'bind-9.18'

See merge request isc-projects/bind9!9667
2024-10-18 02:59:14 +00:00
Mark Andrews a05508b0c4 Correctly get final token
(cherry picked from commit df5b4ba894)
2024-10-18 02:10:39 +00:00
Mark Andrews b22134fd74 Restore seperator values
strtok_r is destructive.  Restore the seperators so that the command
line can be properly displayed.

(cherry picked from commit 609d96aa12)
2024-10-18 02:10:38 +00:00
Mark Andrews 7bb817d1b6 [9.18] fix: dev: Remove unused <openssl/{hmac,engine}.h> headers from OpenSSL shims
The <openssl/{hmac,engine}.h> headers were unused and including the
<openssl/engine.h> header might cause build failure when OpenSSL
doesn't have Engines support enabled.

See https://fedoraproject.org/wiki/Changes/OpensslDeprecateEngine

Backport of MR !9593

Merge branch 'backport-bind-9.20-openssl-engine-9.18' into 'bind-9.18'

See merge request isc-projects/bind9!9645
2024-10-18 01:36:41 +00:00
Petr MenšíkandMark Andrews e5ffa52c6d Remove unused <openssl/{hmac,engine}.h> headers from OpenSSL shims
The <openssl/{hmac,engine}.h> headers were unused and including the
<openssl/engine.h> header might cause build failure when OpenSSL
doesn't have Engines support enabled.

See https://fedoraproject.org/wiki/Changes/OpensslDeprecateEngine

(cherry picked from commit 75a50925f7)
2024-10-18 01:29:27 +00:00
Nicki Křížek c5b6eb3619 [9.18] chg: test: Disable too-many/too-few pylint checks
Backport of MR !9626

Merge branch 'backport-nicki/pylint-disable-too-few-too-many-checks-9.18' into 'bind-9.18'

See merge request isc-projects/bind9!9657
2024-10-17 11:56:13 +00:00
Nicki Křížek 9ca6fcc4d5 Disable too-many/too-few pylint checks
Enforcing pylint standards and default for our test code seems
counter-productive. Since most of the newly added code are tests or is
test-related, encountering these checks rarely make us refactor the code
in other ways and we just disable these checks individually. Code that
is too complex or convoluted will be pointed out in reviews anyways.

(cherry picked from commit 7639c58c48)
2024-10-17 13:42:08 +02:00
Michal Nowak 68ac0194ee [9.18] chg: doc: Read the Docs should always source requirements.txt from "main"
HTTP URI of doc/arm/requirements.txt on the "main" branch is the source
of PyPI packages in CI base image. To make it consistent in all
maintained CI branches on RTD, use the HTTP URI as well.

This change is non-material on the "main" branch, but ensures the right
packages on stable branches where for RTD we currently leverage outdated
packages because we failed to update doc/arm/requirements.txt there.

Backport of MR !9630

Merge branch 'backport-mnowak/rtd-always-resource-requirements-txt-from-main-9.18' into 'bind-9.18'

See merge request isc-projects/bind9!9661
2024-10-17 11:23:12 +00:00
Michal Nowak d189b8a432 Drop doc/arm/requirements.txt
doc/arm/requirements.txt is maintained only on the "main" branch.
2024-10-17 12:59:31 +02:00
Michal Nowak 03d068d168 Read the Docs should always source requirements.txt from "main"
HTTP URI of doc/arm/requirements.txt on the "main" branch is the source
of PyPI packages in CI base image. To make it consistent in all
maintained CI branches on RTD, use the HTTP URI as well.

This change is non-material on the "main" branch, but ensures the right
packages on stable branches where for RTD we currently leverage outdated
packages because we failed to update doc/arm/requirements.txt there.

(cherry picked from commit 8fb6115492)
2024-10-17 10:50:25 +00:00
Michal Nowak 9ddfe87a76 [9.18] chg: doc: Update Sphinx, docutils, and sphinx_rtd_theme packages
Backport of MR !9652

Merge branch 'backport-mnowak/doc-tools-october-2024-updates-9.18' into 'bind-9.18'

See merge request isc-projects/bind9!9659
2024-10-17 10:28:04 +00:00
Michal Nowak 2405885b05 Add RFCs referenced by footnotes
With Sphinx 8.1.0, footnotes can't stand on their own and have
referenced from somewhere:

    /builds/isc-projects/bind9/doc/arm/general.rst:439: WARNING: Footnote [#] is not referenced. [ref.footnote]
    /builds/isc-projects/bind9/doc/arm/general.rst:441: WARNING: Footnote [#] is not referenced. [ref.footnote]
    /builds/isc-projects/bind9/doc/arm/general.rst:445: WARNING: Footnote [#] is not referenced. [ref.footnote]
    /builds/isc-projects/bind9/doc/arm/general.rst:457: WARNING: Footnote [#] is not referenced. [ref.footnote]

(cherry picked from commit 54410e034f)
2024-10-17 10:11:19 +00:00
Michal Nowak 992dd6f2e3 Update Sphinx, docutils, and sphinx_rtd_theme packages
(cherry picked from commit 755dd44ec5)
2024-10-17 10:11:19 +00:00
Michal Nowak 55c09a4d95 Merge tag 'v9.18.31' into bind-9.18 2024-10-16 17:54:38 +02:00
Michal Nowak 8ce45e2a72 [9.18] chg: test: Remove unused sbytes, stime, n, response, and rtime variables
Backport of MR !9617

Merge branch 'backport-mnowak/drop-unused-variables-9.18' into 'bind-9.18'

See merge request isc-projects/bind9!9644
2024-10-15 18:57:23 +00:00
Michal Nowak 5d7a32f5c4 Add vulture
(cherry picked from commit c0246ecef6)
2024-10-15 18:50:06 +00:00
Michal Nowak 03cf294d06 Remove unused sbytes, stime, n, response, and rtime variables
(cherry picked from commit 4857da271d)
2024-10-15 18:50:06 +00:00
Michal Nowak e0ad4d5eb6 [9.18] chg: test: Rewrite tools system test to pytest
Backport of MR !9208

Merge branch 'backport-mnowak/pytest_rewrite_tools-9.18' into 'bind-9.18'

See merge request isc-projects/bind9!9642
2024-10-15 18:15:06 +00:00
Michal Nowak eb8a56c90c Rewrite tools system test to pytest
(cherry picked from commit 3f8e59330d)
2024-10-15 17:28:42 +00:00
Michal Nowak 4bbb46ea84 [9.18] chg: doc: Update sphinx to 7.4.7
Backport of MR !9529.

Merge branch 'backport-mnowak/update-sphinx-9.18' into 'bind-9.18'

See merge request isc-projects/bind9!9639
2024-10-15 12:54:24 +00:00
Nicki KřížekandMichal Nowak 4f1e800f28 Update sphinx to 7.4.7
(cherry picked from commit 3d65fa2740)
2024-10-15 14:39:31 +02:00
Nicki Křížek 6cb3cc642b [9.18] chg: test: Support dnspython 2.7.0
Closes #4988

Backport of MR !9634

Merge branch 'backport-4988-dnspython-2.7.0-support-9.18' into 'bind-9.18'

See merge request isc-projects/bind9!9636
2024-10-15 11:09:16 +00:00
Nicki Křížek ef508f5052 Support dnspython 2.7.0
CookieOption with new .server/.client attributes (rather than .data) was
added to dnspython. Adjust the code to use the new attributes if
available and fall back to the old code for dnspython<2.7.0
compatibility.

(cherry picked from commit 0d90b13646)
2024-10-15 10:30:02 +00:00
Mark Andrews 9d59c72798 [9.18] fix: usr: Fix NSEC3 closest encloser lookup for names with empty non-terminals
The performance improvement for finding the NSEC3 closest encloser when generating authoritative responses could cause servers to return incorrect NSEC3 records in some cases. This has been fixed.

Closes #4950

Backport of MR !9610

Merge branch 'backport-4950-bind-logs-expected-covering-nsec3-got-an-exact-match-9.18' into 'bind-9.18'

See merge request isc-projects/bind9!9632
2024-10-15 02:37:02 +00:00
Mark Andrews 74b6aa8dd2 Test that the correct NSEC3 closest encloser is returned
(cherry picked from commit b457f64d4a)
2024-10-15 11:00:03 +11:00
Mark Andrews 94f6655915 Use a binary search to find the NSEC3 closest encloser
maxlabels is the suffix length that corresponds to the latest
NXDOMAIN response.  minlabels is the suffix length that corresponds
to longest found existing name.

(cherry picked from commit 67f31c5046)
2024-10-14 23:55:13 +00:00
Matthijs Mekking f60f153b8a [9.18] chg: usr: Harden key management when key files have become unavailabe
Prior to doing key management, BIND 9 will check if the key files on disk match the expected keys. If key files for previously observed keys have become unavailable, this will prevent the internal key manager from running.

Backport of MR !9337

Merge branch 'backport-4763-do-not-roll-if-key-files-are-missing-9.18' into 'bind-9.18'

See merge request isc-projects/bind9!9623
2024-10-14 14:29:05 +00:00
Matthijs Mekking 16fed98e20 Add new behavior to the ARM
Add text to the ARM that describes what we do in case key files have
become unavailable.

(cherry picked from commit 351c066d91)
2024-10-14 13:54:09 +00:00
Matthijs Mekking 39e4576341 Test removing DNSKEYs from other providers
In a multi-signer setup, removing DNSKEY records from the zone should
not be treated as a key that previously exists in the keyring, thus
blocking the keymgr. Add a test case to make sure.

(cherry picked from commit 5f552293d7)
2024-10-14 13:54:09 +00:00
Matthijs Mekking fdeb456341 Small keymgr improvement
When a key is to be purged, don't run the key state machinery for it.

(cherry picked from commit af54e3dadc)
2024-10-14 13:54:09 +00:00
Matthijs Mekking 5be6acb63d Add additional test case with purged key
Test that if a key to be purged is in the keyring, it does not
prevent the keymgr from running. Normally a key that is in the keyring
should be available again on the next run, but that is not true for
a key that can be purged.

In addition, fix some wait_for_log calls, by adding the missing
'|| ret=1' parts.

(cherry picked from commit a2317425bc)
2024-10-14 13:54:09 +00:00
Matthijs Mekking 65cd5d5c32 Fix some system test cases
Some test cases were working but for the wrong reasons. These started
to fail when I implemented the first approach for #4763, where the
existence of a DNSKEY together with an empty keyring is suspicious and
would prevent the keymgr from running.

These are:

1. kasp: The multisigner-model2.kasp zone has ZSKs from other providers
   in the zone, but not yet its own keys. Pregenerate signing keys and
   add them to the unsigned zone as well.

2. kasp: The dynamic-signed-inline-signing.kasp zone has a key generated
   and added in the raw version of the zone. But the key file is stored
   outside the key-directory for the given zone. Add '-K keys' to the
   dnssec-keygen command.

(cherry picked from commit d1e263ef13)
2024-10-14 13:54:09 +00:00
Matthijs Mekking 4091177181 Verify new key files before running keymgr
Prior to running the keymgr, first make sure that existing keys
are present in the new keylist. If not, treat this as an operational
error where the keys are made offline (temporarily), possibly unwanted.

(cherry picked from commit 5fdad05a8a)
2024-10-14 13:54:09 +00:00
Matthijs Mekking 29be6a82f3 Add test for missing key files, don't roll
In this specific case the key files are temporary unavailable, for
example because of an operator error, or a mount failure). In such
cases, BIND should not try to roll over these keys.

(cherry picked from commit a3afbd9d6f)
2024-10-14 13:54:09 +00:00
Nicki Křížek c0923c5a81 [9.18] chg: ci: Increase shotgun pipeline timeout
When running shotgun tests on tagged releases, the increased number of
jobs may cause the shotgun pipeline to take longer than 50 minutes to
finish.

Backport of MR !9599

Merge branch 'backport-nicki/increase-shotgun-pipeline-timeout-9.18' into 'bind-9.18'

See merge request isc-projects/bind9!9625
2024-10-14 11:33:00 +00:00
Nicki Křížek cc76c1ee97 Increase shotgun pipeline timeout
When running shotgun tests on tagged releases, the increased number of
jobs may cause the shotgun pipeline to take longer than 50 minutes to
finish.

(cherry picked from commit 3b227e1161)
2024-10-14 11:06:08 +00:00
Artem Boldariev 7039949d49 [9.18] fix: dig - always set the default port when doing a UDP query
This change ensures that the port is set before attempting a UDP query. Before that a situation could appear when previous query have completed over a different transport (that uses a dedicated port) and then a UDP query will be attempted over the port of the previous transport.

Backport of !9618.

Merge branch 'artem-debian-bug-1059582-9.18' into 'bind-9.18'

See merge request isc-projects/bind9!9620
2024-10-10 20:08:04 +00:00
Artem Boldariev cecd3a75ec dig: always set the default port when doing a UDP query
This commit ensures that the port is set before attempting a UDP
query. Before that a situation could appear when previous query have
completed over a different transport (that uses a dedicated port) and
then a UDP query will be attempted over the port of the previous
transport.

(cherry picked from commit e390ed4421)
2024-10-10 22:31:52 +03:00
Matthijs Mekking 03b5bde1d4 [9.18] chg: doc: Add release note for #4460
This release note was missing due to a malformed Merge Request title.

The text is not copied verbatim, but changed to something more release
note-like.

Backport of MR !9598

Merge branch 'backport-4460-add-missing-release-note-9.18' into 'bind-9.18'

See merge request isc-projects/bind9!9616
2024-10-10 14:12:34 +00:00
Matthijs Mekking 96e6d91887 Add release note for #4460
This release note was missing due to a malformed Merge Request title.

The text is not copied verbatim, but changed to something more release
note-like.

(manually picked from commit 5860bafc60)
2024-10-10 13:41:38 +00:00
Matthijs Mekking 257fd7eca0 [9.18] fix: dev: Revert "Improve performance when looking for the closest encloser"
Revert "fix: chg: Improve performance when looking for the closest encloser when returning NSEC3 proofs"

This reverts merge request !9436

Closes #4950

Backport of MR !9611

Merge branch 'backport-revert-78d48f7a-9.18' into 'bind-9.18'

See merge request isc-projects/bind9!9614
2024-10-10 12:26:51 +00:00
Matthijs Mekking 60bd3bc051 Revert "fix: chg: Improve performance when looking for the closest encloser"
The 9.18 code does not have the rbtdb refactoring. Rather than
backporting from MR !9611, this reverts directly from commit
5d81a258e3.
2024-10-10 14:26:13 +02:00
Michal Nowak a3b61ad9ec chg: doc: Set up version for BIND 9.18.32
Merge branch 'mnowak/set-up-version-for-bind-9.18.32' into 'bind-9.18'

See merge request isc-projects/bind9!9597
2024-10-08 08:43:23 +00:00
Michal Nowak 2943e17363 Update BIND version to 9.18.32-dev 2024-10-08 10:37:40 +02:00
Michal Nowak 6298f90b85 Update BIND version for release 2024-10-07 16:51:56 +02:00
Michal Nowak 97193d1b5d new: doc: Prepare documentation for BIND 9.18.31
Merge branch 'mnowak/prepare-documentation-for-bind-9.18.31' into 'v9.18.31-release'

See merge request isc-private/bind9!745
2024-10-07 14:49:49 +00:00
Michal Nowak eb14a3b976 Tweak and reword release notes 2024-10-07 11:20:52 +02:00
Michal Nowak f0590dbff7 Prepare release notes for BIND 9.18.31 2024-10-07 11:18:15 +02:00
Michal Nowak 7dc63c6be4 Generate release notes 2024-10-07 11:16:36 +02:00
Michal Nowak bd3bf7e1c7 Generate changelog 2024-10-07 11:16:07 +02:00
Ondřej Surý b902a4e214 [9.18] fix: dev: Don't enable REUSEADDR on outgoing UDP sockets
The outgoing UDP sockets enabled `SO_REUSEADDR` that allows sharing of the UDP sockets, but with one big caveat - the socket that was opened the last would get all traffic.  The dispatch code would ignore the invalid responses in the dns_dispatch, but this could lead to unexpected results.

Backport of MR !9569

Merge branch 'backport-ondrej/fix-outgoing-UDP-port-selection-9.18' into 'bind-9.18'

See merge request isc-projects/bind9!9584
2024-10-02 14:24:06 +00:00
Ondřej Surý 7ad2d6e986 Don't enable SO_REUSEADDR on outgoing UDP sockets
Currently, the outgoing UDP sockets have enabled
SO_REUSEADDR (SO_REUSEPORT on BSDs) which allows multiple UDP sockets to
bind to the same address+port.  There's one caveat though - only a
single (the last one) socket is going to receive all the incoming
traffic.  This in turn could lead to incoming DNS message matching to
invalid dns_dispatch and getting dropped.

Disable setting the SO_REUSEADDR on the outgoing UDP sockets.  This
needs to be done explicitly because `uv_udp_open()` silently enables the
option on the socket.

(cherry picked from commit eec30c33c2)
2024-10-02 15:20:28 +02:00
Ondřej Surý b2bbceecfe [9.18] chg: dev: Use release memory ordering when incrementing reference counter
As the relaxed memory ordering doesn't ensure any memory
synchronization, it is possible that the increment will succeed even
in the case when it should not - there is a race between
atomic_fetch_sub(..., acq_rel) and atomic_fetch_add(..., relaxed).
Only the result is consistent, but the previous value for both calls
could be same when both calls are executed at the same time.

Backport of MR !9460

Merge branch 'backport-ondrej/use-release-memory-ordering-for-reference-counting-9.18' into 'bind-9.18'

See merge request isc-projects/bind9!9568
2024-10-02 07:09:23 +00:00
Ondřej Surý 5bac885ace Use release memory ordering when incrementing reference counter
As the relaxed memory ordering doesn't ensure any memory
synchronization, it is possible that the increment will succeed even
in the case when it should not - there is a race between
atomic_fetch_sub(..., acq_rel) and atomic_fetch_add(..., relaxed).
Only the result is consistent, but the previous value for both calls
could be same when both calls are executed at the same time.

(cherry picked from commit 88227ea665)
2024-10-02 09:09:03 +02:00
Michal Nowak a435e9a5fd [9.18] chg: test: Replace dns.query module with isctest.query
The `dns.query.udp` and `dns.query.tcp` methods are [prone to timeouts](https://gitlab.isc.org/isc-projects/bind9/-/jobs/4785053); their `isctest.query` equivalents should be used in system tests instead.

Backport of MR !9560

Merge branch 'backport-mnowak/convert-dns-query-udp-and-tcp-to-isctest-query-9.18' into 'bind-9.18'

See merge request isc-projects/bind9!9575
2024-10-02 05:26:17 +00:00
Michal Nowak aa7087ca9b Replace dns.query module with isctest.query
(cherry picked from commit dfec69b4a2)
2024-10-01 16:33:42 +02:00
Michal Nowak a5cc3bfbe3 Add isctest.check.notimp()
(cherry picked from commit a2d2d9c0d3)
2024-10-01 12:06:47 +00:00
Michal Nowak 077b2b56d9 Report expected and last returned rcode on query timeout
Sometimes it's useful to see what was the server returning that did not
match the expected rcode.

(cherry picked from commit 4cb52f072e)
2024-10-01 12:06:47 +00:00
Evan Hunt 1e5bc23921 [9.18] fix: usr: Fix a bug in the static-stub implementation
Static-stub addresses and addresses from other sources were being
mixed together, resulting in static-stub queries going to addresses
not specified in the configuration, or alternatively, static-stub
addresses being used instead of the correct server addresses.

Closes #4850

Backport of MR !9314

Merge branch 'backport-4850-add-an-additional-class-of-names-to-adb-9.18' into 'bind-9.18'

See merge request isc-projects/bind9!9572
2024-10-01 07:37:21 +00:00
Mark Andrews b1cf7997a7 Store static-stub addresses seperately in the adb
Static-stub address and addresses from other sources where being
mixed together resulting in static-stub queries going to addresses
not specified in the configuration or alternatively static-stub
addresses being used instead of the real addresses.

(cherry picked from commit b3a2c790f3)
2024-10-01 15:30:17 +10:00
Ondřej Surý 436e6955ca [9.18] dev: Add full Alessio's name to .mailmap to fix some of the older commits
Backport of MR !9557

Merge branch 'backport-ondrej/add-alessio-to-.mailmap-9.18' into 'bind-9.18'

See merge request isc-projects/bind9!9559
2024-09-26 11:55:11 +00:00
Ondřej Surý 23f4b87536 Add full Alessio's name to .mailmap to fix some of the older commits
(cherry picked from commit 1bc9eb0fc8)
2024-09-26 11:51:12 +00:00
Mark Andrews 65d9f28b32 [9.18] new: usr: Added WALLET type
Add the new record type WALLET (262).  This provides a mapping from a domain name to a cryptographic currency wallet.  Multiple mappings can exist if multiple records exist.

Closes #4947

Backport of MR !9521

Merge branch 'backport-4947-add-wallet-type-to-named-9.18' into 'bind-9.18'

See merge request isc-projects/bind9!9555
2024-09-25 12:45:06 +00:00
Mark Andrews 1a68cc6cfa Add examples of WALLET records
(cherry picked from commit 9b358e6e8b)
2024-09-25 12:07:57 +00:00
Mark Andrews 314ff56081 Add the new record type WALLET (262)
This provides a mapping from a domain name to a cryptographic
currency wallet and is a clone of TXT.

(cherry picked from commit b919b9b4f3)
2024-09-25 12:07:57 +00:00
Mark Andrews 4d573a2111 [9.18] fix: test: Check read value in upforwd/ans4
The ans4 server wasn't shutting down cleanly sometimes.  Check that read returns the
expected value for the message length or exit read loop.

Closes #4301

Backport of MR !9537

Merge branch 'backport-4301-check-read-value-in-ans4-9.18' into 'bind-9.18'

See merge request isc-projects/bind9!9546
2024-09-24 09:53:15 +00:00
Mark Andrews a0522653ca Check read value in upforwd/ans4
The ans4 server wasn't shutting down cleanly sometimes.  Check that
read returns the expected value for the message length or exit read
loop.

(cherry picked from commit 21baad0a8f)
2024-09-24 09:22:22 +00:00
Nicki Křížek 5afcb291a3 [9.18] chg: doc: Track changes in separate files
Keeping a single changelog file creates annoying conflicts when rebasing
the -S version. To eliminate these, keep the changelog for each version
in a separate file and also create files for the -S versions to include
them in the docs. In the open source version, these files will remain
empty and thus won't affect the documentation, while in the -S edition
they'll be filled in and included without introducing any conflicts.

---

Closes #4946

Merge branch 'nicki/reorganize-changelog-docfiles' into 'bind-9.18'

See merge request isc-projects/bind9!9528
2024-09-24 08:17:20 +00:00
Nicki Křížek bf5c21f3f6 Fix changelog formatting for #4579 2024-09-24 10:15:48 +02:00
Nicki Křížek 9bd8d34ffe Generate changelog to stdout
Since the changes aren't tracked in the single changelog.rst file,
generate the changelog to stdout instead, so it can be easily redirected
to the proper file.
2024-09-24 10:15:48 +02:00
Nicki Křížek f80d4d8367 Track changes in separate files
Keeping a single changelog file creates annoying conflicts when rebasing
the -S version. To eliminate these, keep the changelog for each version
in a separate file and also create files for the -S versions to include
them in the docs. In the open source version, these files will remain
empty and thus won't affect the documentation, while in the -S edition
they'll be filled in and included without introducing any conflicts.
2024-09-24 10:15:48 +02:00
Michal Nowak cecadee2e9 [9.18] chg: test: Downgrade "timeout" and "attempts" arguments in shutdown
The shutdown system test sends queries when named is shutting down, not
in an attempt to get answers but to destabilize the server into a crash.
With isctest.query.udp() defaulting to try up to ten times with a
ten-second timeout to get a response we don't care about from a likely
terminated server, we make the test run much longer than needed because
of retries and long timeouts.

Also, see isc-projects/bind9#4943.

Backport of MR !9507

Merge branch 'backport-mnowak/shutdown-downgrade-timeout-and-attempts-arguments-9.18' into 'bind-9.18'

See merge request isc-projects/bind9!9542
2024-09-23 16:31:50 +00:00
Michal Nowak 20cab85f41 Print correct udp/tcp function name in generic_query()
(cherry picked from commit 1c637e96d1)
2024-09-23 15:40:44 +00:00
Michal Nowak 86c7bb4a0c Downgrade "timeout" and "attempts" arguments in shutdown
The shutdown system test sends queries when named is shutting down, not
in an attempt to get answers but to destabilize the server into a crash.
With isctest.query.udp() defaulting to try up to ten times with a
ten-second timeout to get a response we don't care about from a likely
terminated server, we make the test run much longer than needed because
of retries and long timeouts.

(cherry picked from commit 463ab2f3f5)
2024-09-23 15:40:44 +00:00
Michal Nowak a1fae6152d [9.18] chg: ci: Exclude some RPZ files from long stress test artifacts
This fixes 6f86885304, that excluded files
only from short stress tests.

Validation jobs:
- [x] short - [#4756989](https://gitlab.isc.org/isc-projects/bind9/-/jobs/4756989/artifacts/browse/output/ns4/) - 
- [x] long - [#4757196](https://gitlab.isc.org/isc-projects/bind9/-/jobs/4757196/artifacts/browse/output/ns4/)

Backport of MR !9522

Merge branch 'backport-mnowak/exclude-some-rpz-files-from-long-stress-tests-artifacts-9.18' into 'bind-9.18'

See merge request isc-projects/bind9!9539
2024-09-23 12:25:23 +00:00
Michal Nowak f4122dfcd0 Exclude some RPZ files from long stress test artifacts
This fixes 6f86885304, that excluded files
only from short stress tests.

(cherry picked from commit 871eeed519)
2024-09-23 11:20:54 +00:00
Ondřej Surý 5744c009eb [9.18] chg: ci: Update code formatting
Backport of MR !9533

Merge branch 'backport-nicki/update-code-format-9.18' into 'bind-9.18'

See merge request isc-projects/bind9!9535
2024-09-21 11:20:47 +00:00
Nicki KřížekandOndřej Surý c8438e80f1 Ignore clang-format reformatting commit
(cherry picked from commit 28d4e866c7)
2024-09-21 12:47:04 +02:00
Nicki KřížekandOndřej Surý 15b61602c6 Fix arguments-renamed pylint issue in iscconf.py
The argument name was different in the base class.

(cherry picked from commit 833ea7926c)
2024-09-21 07:20:11 +00:00
Nicki KřížekandOndřej Surý 50221d6ff1 Update code formatting
clang 19 was updated in the base image.

(cherry picked from commit ebb5bd9c0f)
2024-09-21 07:20:11 +00:00
Alessio Podda 694cb11a17 [9.18] fix: usr: Do not set SO_INCOMING_CPU
We currently set SO_INCOMING_CPU incorrectly, and testing by Ondrej
shows that fixing the issue by setting affinities is worse than letting
the kernel schedule threads without constraints. So we should not set
SO_INCOMING_CPU anymore.

Closes #4936

Backport of MR !9497

Merge branch 'backport-4936-remove-so-incoming-cpu-9.18' into 'bind-9.18'

See merge request isc-projects/bind9!9505
2024-09-20 06:58:40 +00:00
alessio 01e3567243 Do not set SO_INCOMING_CPU
We currently set SO_INCOMING_CPU incorrectly, and testing by Ondrej
shows that fixing the issue and setting affinities is worse than letting
the kernel schedule threads without constraints. So we should not set
SO_INCOMING_CPU anymore.

(cherry picked from commit 8b8149cdd2)
2024-09-19 16:40:59 +02:00
Nicki Křížek 0b386fc34c Merge tag 'v9.18.30' into bind-9.18 2024-09-18 18:08:01 +02:00
Arаm Sаrgsyаn 5a6c5218ad [9.18] fix: usr: Fix a statistics channel counter bug when 'forward only' zones are used
When resolving a zone with a 'forward only' policy, and
finding out that all the forwarders are marked as "bad",
the 'ServerQuota' counter of the statistics channel was
incorrectly increased. This has been fixed.

Closes #1793

Backport of MR !9493

Merge branch 'backport-1793-serverquota-counter-bug-with-forward-only-9.18' into 'bind-9.18'

See merge request isc-projects/bind9!9503
2024-09-18 08:59:28 +00:00
Aram SargsyanandMark Andrews 904940167c Update the resolver system test
The 'bin/tests/system/resolver.c' tool used in the resolver system
test uses the 'dns_client_setservers()' function, which sets up a
resolution in 'forward only' mode. Since a bug was just fixed in
'fctx_getaddresses()', two expected failures in the resolver system
test now fail with a different failure message, because
'fctx_getaddresses()' returns 'ISC_R_FAILURE' instead of
'res->quotaresp[dns_quotatype_server]', which is 'DNS_R_SERVFAIL'
by default. Change the expected failure message.
2024-09-18 01:25:01 +00:00
Aram SargsyanandMark Andrews 8f617d7971 Add a statistics channel check in the forward system test
Check that the fix in the previous commit works and that the
'ServerQuota' counter in the statistics channel is still unset
after a SERVFAIL result in a 'forward only' zone.

(cherry picked from commit 81b3c5d908)
2024-09-18 01:25:01 +00:00
Aram SargsyanandMark Andrews ef344cbd5e Fix a 'serverquota' counter calculation bug
The 'all_spilled' local variable in resolver.c:fctx_getaddresses()
is 'true' by default, and only becomes false when there is at least
one successfully found NS address. However, when a 'forward only;'
configuration is used, the code jumps over the part where it looks
for NS addresses and doesn't reset the 'all_spilled' to false, which
results in incorretly increased 'serverquota' statistics variable,
and also in invalid return error code from the function. The result
code error didn't make any differences, because all codes other than
'ISC_R_SUCCESS' or 'DNS_R_WAIT' were treated in the same way, and
the result code was never logged anywhere.

Set the default value of 'all_spilled' to 'false', and only make it
'true' before actually starting to look up NS addresses.

(cherry picked from commit e430ce7039)
2024-09-18 01:25:01 +00:00
Ondřej Surý 6c1fc4ae54 [9.18] fix: usr: Limit the outgoing UDP send queue size
If the operating system UDP queue gets full and the outgoing UDP sending
starts to be delayed, BIND 9 could exhibit memory spikes as it tries to
enqueue all the outgoing UDP messages.  Try a bit harder to deliver the
outgoing UDP messages synchronously and if that fails, drop the outgoing
DNS message that would get queued up and then timeout on the client side.

Closes #4930

Backport of MR !9506

Merge branch 'backport-4930-limit-the-UDP-send-queue-9.18' into 'bind-9.18'

See merge request isc-projects/bind9!9512
2024-09-17 15:07:38 +00:00
Ondřej Surý 3012a97d58 Limit the outgoing UDP send queue size
If the operating system UDP queue gets full and the outgoing UDP sending
starts to be delayed, BIND 9 could exhibit memory spikes as it tries to
enqueue all the outgoing UDP messages.  As those are not going to be
delivered anyway (as we argued when we stopped enlarging the operating
system send and receive buffers), try to send the UDP messages directly
using `uv_udp_try_send()` and if that fails, drop the outgoing UDP
message.

(cherry picked from commit b576c4c977)
2024-09-17 16:20:00 +02:00
Mark Andrews 5c51e044c4 [9.18] chg: dev: Remove statslock from dnssec-signzone
Silence Coverity CID 468757 and 468767 (DATA RACE read not locked) by converting dnssec-signzone to use atomics for statistics counters rather than using a lock.

Closes #4939

Backport of MR !9496

Merge branch 'backport-4939-remove-stats-lock-from-dnssec-signzone-9.18' into 'bind-9.18'

See merge request isc-projects/bind9!9501
2024-09-16 03:59:36 +00:00
Mark Andrews 4d23018660 Remove 'statslock' from dnssec-signzone
Silence Coverity CID 468757 and 468767 (DATA RACE read not locked)
by converting dnssec-signzone to use atomics for statistics counters
rather than using a lock.  This should be marginally faster than
using the lock as well when statistics are requested.

(cherry picked from commit 473cbd4e87)
2024-09-16 13:25:07 +10:00
Michal Nowak 2f4c418729 [9.18] chg: test: Replace dns.resolver module in system tests
Closes #4634

Backport of MR !9150

Merge branch 'backport-4634-drop-dns.resolver-module-from-system-tests-9.18' into 'bind-9.18'

See merge request isc-projects/bind9!9492
2024-09-12 18:58:00 +00:00
Michal Nowak 6addaef7fc Extract dns.rcode compatibility code to isctest.compat
(cherry picked from commit 8b55d0709d)
2024-09-12 19:48:31 +02:00
Michal Nowak aa302dfe24 Turn off deadline for wildcard tests
Tests that query BIND need much longer deadline to account for retries,
the default 200ms won't work.

(cherry picked from commit d2e0043ec3)
2024-09-12 19:48:31 +02:00
Michal Nowak 4e3cc58eba Extract "custom" named instances support to isctest.run module
(cherry picked from commit 2cec1de43b)
2024-09-12 19:48:31 +02:00
Michal Nowak 1220435e27 Rework query functions to retry by default
(cherry picked from commit 5929ba0f54)
2024-09-12 18:35:59 +02:00
Michal Nowak 00295ef591 Deprecate dns.resolver module in BIND 9 system tests
(cherry picked from commit cb3ffac9a7)
2024-09-12 18:35:59 +02:00
Michal Nowak f082e6800b Replace dns.resolver module in system tests
(cherry picked from commit bfe338b965)
2024-09-12 18:35:59 +02:00
Mark Andrews e8c2c9c9dc [9.18] fix: usr: Don't allow statistics-channel if libxml2 and libjson-c are unsupported
When the libxml2 and libjson-c libraries are not supported, the statistics channel can't return anything useful, so it is now disabled. Use of `statistics-channel` in `named.conf` is a fatal error.

Closes #4895

Backport of MR !9423

Merge branch 'backport-4895-link-style-sheet-to-libxml2-support-9.18' into 'bind-9.18'

See merge request isc-projects/bind9!9487
2024-09-12 04:10:38 +00:00
Mark Andrews 6023162ac5 Fix named-checkconf and statistics-channels
If neither libxml2 nor libjson_c are available have named-checkconf
fail if a statistics-channels block is specified.

(cherry picked from commit b9246418e8)
2024-09-12 13:39:38 +10:00
Mark Andrews 047fa205d7 Only configure statistics-channels if supported
(cherry picked from commit d0c8c6d7ef)
2024-09-12 13:39:36 +10:00
Mark Andrews e5ff972167 Don't create the HTTP server if libxml and libjson-c are unavailable
(cherry picked from commit 31650d9440)
2024-09-12 03:27:43 +00:00
Mark Andrews 350a15e702 Don't return the style sheet unless libxml2 is supported
If not statistics are available we don't want the style sheet
returned.

(cherry picked from commit ed81b3ae93)
2024-09-12 03:27:43 +00:00
Mark Andrews b5aa3696c5 [9.18] fix: test: The statschannel tests fails if one of libxml2 or json-c is configured
The `statschannel` system test failed if only one of `libxml2` or `json-c` is
available / configured as checks were being run against the non available
statistics page.

Closes #4919

Backport of MR !9454

Merge branch 'backport-4919-fix-statschannel-system-test-9.18' into 'bind-9.18'

See merge request isc-projects/bind9!9484
2024-09-11 23:51:01 +00:00
Mark Andrews 3333f9c94d Properly detect when libxml2 or json-c is not available
(cherry picked from commit 7de939609b)
2024-09-12 09:18:38 +10:00
Nicki Křížek f6cc09779a chg: doc: Review BIND ARM (9.18 updates)
Closes #4832

Merge branch '4832-bind-arm-review-from-2022-through-9-18' into 'bind-9.18'

See merge request isc-projects/bind9!9375
2024-09-11 13:55:49 +00:00
Suzanne GoldlustandNicki Křížek b6e4b512dd Review and update ARM documentation
Minor edits and fixes for the documentation added from 2022 through
9.18.
2024-09-11 15:21:00 +02:00
Michal Nowak dd4af9310c [9.18] chg: ci: Update code formatting
clang 19 was updated in the base image.

Backport of MR !9475

Merge branch 'backport-mnowak/fix-clang-format-9.18' into 'bind-9.18'

See merge request isc-projects/bind9!9478
2024-09-11 10:00:08 +00:00
Michal Nowak c2a6311bc3 Update to ignore fe8d6023e0 2024-09-11 11:48:33 +02:00
Michal Nowak fe8d6023e0 Update code formatting
clang 19 was updated in the base image.

(cherry picked from commit ff69d07f)
2024-09-11 11:47:10 +02:00
Nicki Křížek bae3f9d3d0 chg: test: Skip some tests on problematic OpenSSL version
Closes #4814

Merge branch '4814-skip-tests-on-problematic-openssl-version' into 'bind-9.18'

See merge request isc-projects/bind9!9425
2024-09-10 14:52:58 +00:00
Nicki Křížek b42420ab09 Skip some tests on problematic OpenSSL version
The keyfromlabel and enginepkcs11 system tests are affected by a bug in
OpenSSL 3.0.13, currently shipped by debian bookworm.
2024-09-10 15:50:21 +02:00
Nicki Křížek 1d6465ff16 [9.18] chg: usr: allow IXFR-to-AXFR fallback on DNS_R_TOOMANYRECORDS
This change allows fallback from an IXFR failure to AXFR when the reason is `DNS_R_TOOMANYRECORDS`. This is because this error condition could be temporary only in an intermediate version of IXFR transactions and it's possible that the latest version of the zone doesn't have that condition. In such a case, the secondary would never be able to update the zone (even if it could) without this fallback.

This fallback behavior is particularly useful with the recently introduced `max-records-per-type` and `max-types-per-name` options: the primary may not have these limitations and may temporarily introduce "too many" records, breaking IXFR. If the primary side subsequently deletes these records, this fallback will help recover the zone transfer failure automatically; without it, the secondary side would first need to increase the limit, which requires more operational overhead and has its own adverse effect.

Closes #4928

Backport of MR !9333

Merge branch 'backport-fallback-ixfr-to-axfr-on-toomanyrecords-9.18' into 'bind-9.18'

See merge request isc-projects/bind9!9472
2024-09-10 13:31:21 +00:00
JINMEI TatuyaandNicki Křížek a93b6f2040 allow IXFR-to-AXFR fallback on DNS_R_TOOMANYRECORDS
This change allows fallback from an IXFR failure to AXFR when the
reason is DNS_R_TOOMANYRECORDS. This is because this error condition
could be temporary only in an intermediate version of IXFR
transactions and it's possible that the latest version of the zone
doesn't have that condition. In such a case, the secondary would never
be able to update the zone (even if it could) without this fallback.

This fallback behavior is particularly useful with the recently
introduced max-records-per-type and max-types-per-name options:
the primary may not have these limitations and may temporarily
introduce "too many" records, breaking IXFR. If the primary side
subsequently deletes these records, this fallback will help recover
the zone transfer failure automatically; without it, the secondary
side would first need to increase the limit, which requires more
operational overhead and has its own adverse effect.

This change also fixes a minor glitch that DNS_R_TOOMANYRECORDS wasn't
logged in xfrin_fail.

(cherry picked from commit 7289090683)
2024-09-10 14:54:57 +02:00
Michal Nowak 1cdde5656d [9.18] chg: test: Be more patient when stopping servers in the system tests
When the TCP test is run on the busy server, the server might take a
while to wind the server down because it might still be processing all
that 300k invalid XFR requests.

Increate the rncd wait time to 120 seconds, the SIGTERM time to 300
seconds, and reduce the time to wait for ans servers from 1200 second
to just 120 seconds.

(cherry picked from commit d971472321)

Backport of MR !6847

Merge branch 'backport-ondrej-increase-the-time-to-wait-for-servers-to-gracefully-shutdown-9.18' into 'bind-9.18'

See merge request isc-projects/bind9!9467
2024-09-10 12:44:29 +00:00
Ondřej SurýandMichal Nowak 441de680c7 Be more patient when stopping servers in the system tests
When the TCP test is run on the busy server, the server might take a
while to wind the server down because it might still be processing all
that 300k invalid XFR requests.

Increate the rncd wait time to 120 seconds, the SIGTERM time to 300
seconds, and reduce the time to wait for ans servers from 1200 second
to just 120 seconds.

(cherry picked from commit d971472321)
2024-09-10 12:31:21 +02:00
Nicki Křížek c9ba8630d7 chg: doc: Set up version for BIND 9.18.31
Merge branch 'nicki/set-up-version-for-bind-9.18.31' into 'bind-9.18'

See merge request isc-projects/bind9!9464
2024-09-09 17:24:04 +00:00
Nicki Křížek 80b9b6143b Update BIND version to 9.18.31-dev 2024-09-09 19:23:05 +02:00
Nicki Křížek cdc8d69148 Update BIND version for release 2024-09-09 15:09:10 +02:00
Nicki Křížek 398423e461 new: doc: Prepare documentation for BIND 9.18.30
The statements that already exist in the grammar can't be created with
the namedconf:statement. Use a plain definition list for these
statements and add a manual anchor for each one so links to them can be
created.

Avoid using the :any: syntax in the definition lists, as that just
creates a link to the duplicate and completely unrelated statement,
which just makes the documentation more confusing.

Merge branch 'nicki/prepare-documentation-for-bind-9.18.30' into 'v9.18.30-release'

See merge request isc-private/bind9!739
2024-09-09 13:07:36 +00:00
Nicki Křížek bec3ac5725 Tweak and reword release notes 2024-09-06 14:47:47 +02:00
Nicki Křížek 010999d9c2 Fix dnssec-policy options formatting and links in ARM
The statements that already exist in the grammar can't be created with
the namedconf:statement. Use a plain definition list for these
statements and add a manual anchor for each one so links to them can be
created.

Avoid using the :any: syntax in the definition lists, as that just
creates a link to the duplicate and completely unrelated statement,
which just makes the documentation more confusing.
2024-09-05 17:42:21 +02:00
Nicki Křížek c3adfa5a89 Prepare release notes for BIND 9.18.30 2024-09-05 17:36:44 +02:00
Nicki Křížek 470ba8a39d Generate release notes 2024-09-05 17:35:14 +02:00
Nicki Křížek 5bc50e7c5f Generate changelog 2024-09-05 17:35:03 +02:00
Nicki Křížek 17efe703cc [9.18] chg: usr: Follow the number of CPU set by taskset/cpuset
Administrators may wish to constrain the set of cores that BIND 9 runs on via the 'taskset', 'cpuset' or 'numactl' programs (or equivalent on other O/S).

If the admin has used taskset, the `named` will now follow to automatically use the given number of CPUs rather than the system wide count.

Closes #4884

Backport of MR !9398

Merge branch 'backport-4884-use-cpuset-to-get-number-of-cpus-9.18' into 'bind-9.18'

See merge request isc-projects/bind9!9443
2024-09-03 13:52:32 +00:00
Ondřej SurýandNicki Křížek c8f1fa0e47 Follow the number of CPU set by taskset/cpuset
Administrators may wish to constrain the set of cores that BIND 9 runs
on via the 'taskset', 'cpuset' or 'numactl' programs (or equivalent on
other O/S), for example to achieve higher (or more stable) performance
by more closely associating threads with individual NIC rx queues. If
the admin has used taskset, it follows that BIND ought to
automatically use the given number of CPUs rather than the system wide
count.

Co-Authored-By: Ray Bellis <ray@isc.org>
(cherry picked from commit 5a2df8caf5)
2024-09-03 14:54:40 +02:00
Mark Andrews 7f6e092c05 [9.18] fix: chg: Improve performance when looking for the closest encloser when returning NSEC3 proofs
Use the fact that the database returns the longest matching part of the requested name to find the required NSEC3 record. If there are multiple versions present in the database we may have to search further.

Closes #4460

Backport of MR !9436

Merge branch 'backport-4460-auth-nsec3-many-labels-9.18' into 'bind-9.18'

See merge request isc-projects/bind9!9439
2024-08-29 21:38:37 +00:00
Mark Andrews 5d81a258e3 Return partial match when requested
Return partial match from dns_db_find/dns_db_find when requested
to short circuit the closest encloser discover process.  Most of the
time this will be the actual closest encloser but may not be when
there yet to be committed / cleaned up versions of the zone with
names below the actual closest encloser.

(cherry picked from commit d42ea08f16)
2024-08-29 21:05:54 +00:00
Michal Nowak 456904d15d [9.18] chg: test: Bump max-recursion-queries to 100 in resolver system test
With max-recursion-queries set to 50 the resolver system test was
unstable in the "checking query resolution for a domain with a valid
glueless delegation chain" check as ns1 replied with SERVFAIL.

Closes #4897

Backport of MR !9435

Merge branch 'backport-4897-resolver-ns1-max-recursion-queries-100-9.18' into 'bind-9.18'

See merge request isc-projects/bind9!9441
2024-08-29 15:32:08 +00:00
Michal Nowak 5a802a22b5 Bump max-recursion-queries to 100 in resolver system test
With max-recursion-queries set to 50 the resolver system test was
unstable in the "checking query resolution for a domain with a valid
glueless delegation chain" check as ns1 replied with SERVFAIL.

(cherry picked from commit 8e0244d300)
2024-08-29 14:41:52 +00:00
Michal Nowak 2e4e6daf98 [9.18] chg: ci: Generate TSAN stress test
Backport of MR !9334

Merge branch 'backport-mnowak/generate-tsan-stress-jobs-9.18' into 'bind-9.18'

See merge request isc-projects/bind9!9432
2024-08-28 16:39:54 +00:00
Michal Nowak 77941b7aa9 Generate TSAN stress test
(cherry picked from commit 338d4c8dd3)
2024-08-28 09:40:26 +00:00
Michal Nowak 7859024c46 [9.18] chg: ci: Cleanup stress test artifacts
Backport of MR !9424

Merge branch 'backport-mnowak/avoid-some-artifacts-in-stress-tests-9.18' into 'bind-9.18'

See merge request isc-projects/bind9!9429
2024-08-28 08:56:04 +00:00
Michal Nowak 014c0e3048 Some stress test artifacts should not be saved in CI artifact
(cherry picked from commit 6f86885304)
2024-08-28 08:01:27 +00:00
Ondřej Surý cccd26e942 [9.18] fix: dev: Stop using malloc_usable_size and malloc_size
The `malloc_usable_size()` can return size larger than originally allocated and when these sizes disagree the fortifier enabled by `_FORTIFY_SOURCE=3` detects overflow and stops the `named` execution abruptly.  Stop using these convenience functions as they are primary used for introspection-only.

Closes #4880

Backport of MR !9400

Merge branch 'backport-4880-dont-use-malloc_usable_size-9.18' into 'bind-9.18'

See merge request isc-projects/bind9!9419
2024-08-27 03:46:13 +00:00
Ondřej Surý 015b390f62 Stop using malloc_usable_size and malloc_size
Although the nanual page of malloc_usable_size says:

    Although the excess bytes can be over‐written by the application
    without ill effects, this is not good programming practice: the
    number of excess bytes in an allocation depends on the underlying
    implementation.

it looks like the premise is broken with _FORTIFY_SOURCE=3 on newer
systems and it might return a value that causes program to stop with
"buffer overflow" detected from the _FORTIFY_SOURCE.  As we do have own
implementation that tracks the allocation size that we can use to track
the allocation size, we can stop relying on this introspection function.

Also the newer manual page for malloc_usable_size changed the NOTES to:

    The value returned by malloc_usable_size() may be greater than the
    requested size of the allocation because of various internal
    implementation details, none of which the programmer should rely on.
    This function is intended to only be used for diagnostics and
    statistics; writing to the excess memory without first calling
    realloc(3) to resize the allocation is not supported.  The returned
    value is only valid at the time of the call.

Remove usage of both malloc_usable_size() and malloc_size() to be on the
safe size and only use the internal size tracking mechanism when
jemalloc is not available.

(cherry picked from commit d61712d14e)
2024-08-27 04:49:55 +02:00
Mark AndrewsandOndřej Surý b73a385696 Define ISC_ATTR_UNUSED macro for __attribute__((__unused__))
The ISC_ATTR_UNUSED macro was missing in BIND 9.18, which
complicated things when backporting merge requests from main.
As __attribute__((__unused__)) is ubiquitous, just define the
macro.
2024-08-27 04:49:55 +02:00
Michal Nowak 38a8fc87c5 [9.18] chg: ci: Drop removed system tests from cross-version-config-tests
The cross-version-config-tests job fails when a system test is removed
from the upcoming release. To avoid this, remove the system test also
from the $BIND_BASELINE_VERSION.

See the failure mode at https://gitlab.isc.org/isc-projects/bind9/-/jobs/4668947.

Backport of MR !9413

Merge branch 'backport-mnowak/remove-dialup-from-cross-version-config-tests-job-9.18' into 'bind-9.18'

See merge request isc-projects/bind9!9416
2024-08-26 15:20:47 +00:00
Michal Nowak c1af8342cb Drop removed system tests from $BIND_BASELINE_VERSION
The cross-version-config-tests job fails when a system test is removed
from the upcoming release. To avoid this, remove the system test also
from the $BIND_BASELINE_VERSION.

(cherry picked from commit 60f5f2a9d9)
2024-08-26 14:32:50 +00:00
Nicki Křížek 91c8693f7a chg: test: Re-enable keyfromlabel&enginepkcs11 tests
Closes #4814

Merge branch '4814-reenable-keyfromlabel-enginepkcs11-tests' into 'bind-9.18'

See merge request isc-projects/bind9!9412
2024-08-26 08:49:27 +00:00
Nicki Křížek c75d9734e7 Revert "Mark the keyfromlabel&enginepkcs11 tests as xfail"
This reverts commit ff983ed647.
2024-08-26 10:09:41 +02:00
Petr Špaček b4d1988c28 [9.18] fix: dev: Preserve statement tag order in documentation
This supports bit-for-bit reproducibility of built documentation.

Closes #4886

Backport of MR !9399

Merge branch 'backport-issue-4886/order-preserving-documentation-tags-9.18' into 'bind-9.18'

See merge request isc-projects/bind9!9409
2024-08-23 14:42:41 +00:00
Petr Špaček a5d06fceb7 Disallow duplicate statement tags in docs
I can't think of a use-case for them, so let's simplify code and treat
them as an invalid input.

(cherry picked from commit 5b832126b3)
2024-08-23 14:02:21 +00:00
James AddisonandPetr Špaček 3ecef74b9a Preserve de-duplicated tag order in documentation
The 'set' datatype in Python does not provide iteration-order
guarantees related to insertion-order.  That means that its
usage in the 'split_csv' helper function during documentation
build can produce nondeterministic results.

That is non-desirable for two reasons: it means that the
documentation output may appear to vary unnecessarily between
builds, and secondly there could be loss-of-information in cases
where tag order in the source documentation is significant.

This patch implements order-preserving de-duplication of tags,
allowing authors to specify tags using intentional priority
ordering, while also removing tags that appear more than once.

(cherry picked from commit 5a79b36f56)
2024-08-23 14:02:21 +00:00
Petr Špaček 2443a31350 [9.18] new: ci: Automate parts of MR workflow
Backport of MR !9244

Merge branch 'backport-pspacek/post-merge-ci-9.18' into 'bind-9.18'

See merge request isc-projects/bind9!9402
2024-08-23 08:19:16 +00:00
Petr Špaček cd79103c5f Remove milestone check from dangerfile
Milestone is automatically set by 'merged-metadata' CI job to 'Not
released yet' so it does not matter what the original value was.

(cherry picked from commit 73b950dc29)
2024-08-23 07:58:34 +00:00
Petr Špaček e3b13bfacf Remove 'Release notes' label check from dangerfile
This label is now handled automatically by 'merged-metadata' CI job.

(cherry picked from commit 146743d5a3)
2024-08-23 07:58:34 +00:00
Petr Špaček a85479639c Remove 'No CHANGES' check from dangerfile
This label is now handled automatically by 'merged-metadata' CI job.

(cherry picked from commit edf0e6415a)
2024-08-23 07:58:34 +00:00
Petr Špaček aa0e56680a Automatically adjust MR metadata after merge
1. Set milestone to 'Not released yet' after merge
   We will set milestone to actual version number when we actually tag a
   particular version. This will get rid of mass MR reassignment when we
   do last minute changes to a release plan etc.

2. Adjust No CHANGES and Release Notes MR labels to match gitchangelog
   workflow.

(cherry picked from commit d1c64d588b)
2024-08-23 07:58:34 +00:00
Petr Špaček 0a246b5cfd Mark backports CI job as non-interruptible
Previously CI job for the autobackport bot inherited "interruptible:
true" global configuration. This caused premature termination of the job
when another merge was finished before the autobackport job ran to
completion.

(cherry picked from commit 3165261ecd)
2024-08-23 07:58:34 +00:00
Matthijs Mekking 43c8ed45e5 [9.18] fix: usr: Fix algoritm rollover bug when there are two keys with the same keytag
If there is an algorithm rollover and two keys of different algorithm share the same keytags, then there is a possibility that if we check that a key matches a specific state, we are checking against the wrong key. This has been fixed by not only checking for matching key tag but also key algorithm.

Closes #4878

Backport of MR !9381

Merge branch 'backport-4878-fix-algorithm-rollover-keytag-conflict-bug-9.18' into 'bind-9.18'

See merge request isc-projects/bind9!9394
2024-08-22 12:58:16 +00:00
Matthijs Mekking bb3bf56157 Fix algorithm rollover bug wrt keytag conflicts
If there is an algorithm rollover and two keys of different algorithm
share the same keytags, then there is a possibility that if we check
that a key matches a specific state, we are checking against the wrong
key.

Fix this by not only checking for matching key id but also key
algorithm.

(cherry picked from commit f37eb33f29)
2024-08-22 10:15:02 +00:00
Matthijs Mekking 9e1bed5bdb Adjust kasp system test to get keys which signed
If there is a keytag conflict between keys with different algorithms,
we need to supply what key algorithm is used so we can get the right
public key.

For clarity, print the algorithm on the found keys after 'check_keys'.

(cherry picked from commit 7bb6d82505)
2024-08-22 10:15:01 +00:00
Michal Nowak 06d612a312 [9.18] chg: ci: Update Clang to version 19
These Clang 19-identified issues need to be addressed first:
- [x] isc-projects/bind9!9313
- [x] isc-projects/bind9!9317
- [x] isc-projects/bind9!9316
- [x] isc-projects/bind9!9315

Validation pipelines for backports:
- [x] ~"v9.21" - https://gitlab.isc.org/isc-projects/bind9/-/pipelines/191211
- [x] ~"v9.20" - https://gitlab.isc.org/isc-projects/bind9/-/pipelines/191512
- [x] ~"v9.18" - https://gitlab.isc.org/isc-projects/bind9/-/pipelines/191904

Prereq: isc-projects/images!328

Backport of MR !9296

Merge branch 'backport-mnowak/llvm-19-9.18' into 'bind-9.18'

See merge request isc-projects/bind9!9391
2024-08-22 09:09:03 +00:00
Michal Nowak b5caae0633 Use clang-format-19 to update formatting 2024-08-22 10:25:22 +02:00
Michal Nowak 07179f0897 Update Clang to version 19
(cherry picked from commit ec62fc1399)
2024-08-22 08:16:08 +00:00
Mark Andrews a59fe212a3 [9.18] chg: dev: Restore the ability to select individual unit tests
This adds the command line arguments: `-d` (debug), `-l` (list tests) and `-t test` (run this test) to the unit tests.

e.g. 
```
    % ./rdata_test -t zonemd
    [==========] selected: Running 1 test(s).
    [ RUN      ] zonemd
    [       OK ] zonemd
    [==========] selected: 1 test(s) run.
    [  PASSED  ] 1 test(s).
    % 
```

Closes #4579

Backport of MR !9384

Merge branch 'backport-4579-restore-the-ability-to-select-individual-unit-tests-9.18' into 'bind-9.18'

See merge request isc-projects/bind9!9386
2024-08-22 06:49:00 +00:00
Mark Andrews b8cdd96ff4 Extend ISC_TEST_MAIN for debugging
ISC_TEST_MAIN now supports turning on/off debugging and
running individual tests.

(cherry picked from commit d8a6ff5c3e)
2024-08-22 06:04:59 +00:00
Evan Hunt 01ee251d13 fix: dev: fix clang-scan 19 warnings
Silence warnings generated by clang-scan.

Merge branch 'each-clang-scan-errors-bind-9.18' into 'bind-9.18'

See merge request isc-projects/bind9!9388
2024-08-22 05:29:09 +00:00
Evan Hunt a1b2c85d84 ensure fd is non-negative before calling dup()
this silences a spurious warning from clang-scan 19.
2024-08-21 21:37:51 -07:00
Evan Hunt 2b58dc89f5 check for NULL before closing batchfp
this silences a warning from clang-scan 19.
2024-08-21 21:37:51 -07:00
Michal Nowak 9f9a63b04e [9.18] chg: ci: Add FreeBSD 14.1
Prereq: https://gitlab.isc.org/isc-projects/images/-/merge_requests/323

Backport of MR !9116

Merge branch 'backport-mnowak/freebsd-14.1-9.18' into 'bind-9.18'

See merge request isc-projects/bind9!9383
2024-08-22 04:11:26 +00:00
Michal Nowak 13dffbe415 Add FreeBSD 14.1
(cherry picked from commit bca3d09354)
2024-08-21 16:31:28 +00:00
Nicki Křížek 9a63dd7cb6 Merge tag 'v9.18.29' into bind-9.18 2024-08-21 16:36:08 +02:00
Arаm Sаrgsyаn 99ce0d6b83 [9.18] new: usr: Print the full path of the working directory in startup log messages
named now prints its initial working directory during startup and the
changed working directory when loading or reloading its configuration
file if it has a valid 'directory' option defined.

Closes #4731

Backport of MR !9362

Merge branch 'backport-4731-log-workdir-full-path-9.18' into 'bind-9.18'

See merge request isc-projects/bind9!9373
2024-08-21 09:25:34 +00:00
Aram Sargsyan 3832070e92 Print the full path of the working directory in startup log messages
named now prints its initial working directory during startup and the
changed working directory when loading or reloading its configuration
file if it has a valid 'directory' option defined.

(cherry picked from commit fd8e1d161f)
2024-08-21 08:20:55 +00:00
Petr Špaček ca53636043 [9.18] chg: doc: Improve changelog & release notes workflow
Related: #4847

Backport of MR !9300

Merge branch 'backport-4847-changelog-sorting-and-tweaks-9.18' into 'bind-9.18'

See merge request isc-projects/bind9!9365
2024-08-20 12:03:01 +00:00
Nicki Křížek c0ca052661 Omit MR link from release notes
When manually handling the release notes (due to rst markup, fixups
etc.), the different MR number for backports causes needless friction.
Remove the reference from release notes and keep it only in changelog
which isn't manually redacted.

(cherry picked from commit 993ba7cc7f)
2024-08-20 11:51:47 +00:00
Nicki Křížek f3367b0a83 Sort changelog & relnotes entries by issue number
To reduce the friction when handling the release notes, it is preferable
to have the sections sorted by issue number, rather than merge order.
Fallback to commit subject line if unavailable (e.g. for changelog
entries).

(cherry picked from commit 759948fffe)
2024-08-20 11:51:47 +00:00
Petr Špaček 7660611578 chg: doc: Set up version for BIND 9.18.30
Merge branch 'nicki/set-up-version-and-release-notes-for-bind-9.18.30' into 'bind-9.18'

See merge request isc-projects/bind9!9356
2024-08-20 09:05:57 +00:00
Nicki KřížekandPetr Špaček 12b123d884 Remove release note draft file
Since we've started the new changelog & release notes process, the file
for drafting release notes for the version-to-be is no longer needed.

(cherry picked from commit c795cfec54)
2024-08-20 09:05:51 +00:00
Nicki KřížekandPetr Špaček fee4b7d88a Update BIND version to 9.18.30-dev 2024-08-20 09:05:51 +00:00
Mark Andrews e04839c08e fix: usr: Checking whether a EDDSA key was private or not was broken
Checking whether a EDDSA key was private or not was broken could lead to
attempting to sign records with a public key and this could cause a
segmentation failure (read of a NULL pointer) within OpenSSL.

Closes #4855

Merge branch '4855-openssleddsa_isprivate-needs-to-supply-a-buffer' into 'bind-9.18'

See merge request isc-projects/bind9!9329
2024-08-20 00:16:34 +00:00
Mark Andrews defd84da6d Fix openssleddsa_isprivate
openssleddsa_isprivate failed to properly determine if a buffer was
private or not. Pass in a buffer so that EVP_PKEY_get_raw_private_key
fails when there is not a private key.
2024-08-19 23:38:18 +00:00
Nicki Křížek e06cb3d93b [9.18] chg: ci: Allow rerun of unstable statschannel tests under TSAN
The test_traffic_json and test_traffic_xml occasionally fail when
running under TSAN. This happens in CI and is most likely a result of
some instability that doesn't seem to be easily reproduced.

Closes #4598

Backport of MR !9293

Merge branch 'backport-4598-mark-statschannel-test-flaky-9.18' into 'bind-9.18'

See merge request isc-projects/bind9!9351
2024-08-19 15:54:58 +00:00
Nicki Křížek 9a154d66ed Allow rerun of unstable statschannel tests under TSAN
The test_traffic_json and test_traffic_xml occasionally fail when
running under TSAN. This happens in CI and is most likely a result of
some instability that doesn't seem to be easily reproduced.

(cherry picked from commit ec2fc7680a)
2024-08-19 17:54:27 +02:00
Michal Nowak d62a103045 rem: ci: Drop Oracle Linux 7
See #3729

Merge branch '3729-drop-oracle-linux-7' into 'bind-9.18'

See merge request isc-projects/bind9!9352
2024-08-19 15:41:26 +00:00
Michal Nowak 4af28f9ffc Drop Oracle Linux 7 2024-08-19 15:40:32 +00:00
Ondřej Surý 0da22fc138 [9.18] fix: dev: Change the NS_PER_SEC (and friends) from enum to #define
New version of clang (19) has introduced a stricter checks when mixing
integer (and float types) with enums.  In this case, we used enum {}
as C17 doesn't have constexpr yet.  Change the time conversion constants
to be #defined constants because of RHEL 8 compiler doesn't consider
static const unsigned int to be constant.

Closes #4845

Backport of MR !9313

Merge branch 'backport-4845-change-NS_PER_SEC-type-from-enum-to-integer-9.18' into 'bind-9.18'

See merge request isc-projects/bind9!9340
2024-08-19 15:32:14 +00:00
Ondřej Surý a49079c84c Change the NS_PER_SEC (and friends) from enum to static const
New version of clang (19) has introduced a stricter checks when mixing
integer (and float types) with enums.  In this case, we used enum {}
as C17 doesn't have constexpr yet.  Change the time conversion constants
to be #defined constants because of RHEL 8 compiler doesn't consider
static const unsigned int to be constant.

(cherry picked from commit b03e90e0d4)
2024-08-19 15:32:03 +00:00
Arаm Sаrgsyаn 26df9f6255 [9.18] chg: dev: Process also the ISC_R_CANCELED result code in rpz_rewrite()
Log canceled resolver queries (e.g. when shutting down a hung
fetch) in DEBUG3 level instead of DEBUG1 which is used for the
"unrecognized" result codes.

Closes #4797

Backport of MR !9148

Merge branch 'backport-4797-rpz_rewrite-add-ISC_R_CANCELED-processing-9.18' into 'bind-9.18'

See merge request isc-projects/bind9!9348
2024-08-19 14:17:22 +00:00
Aram Sargsyan 30238a6172 Process also the ISC_R_CANCELED result code in rpz_rewrite()
Log  canceled queries (e.g. when shutting down a hung fetch)
in DEBUG3 level instead of DEBUG1 which is used for the
"unrecognized" result codes.

(cherry picked from commit 8bb9568467)
2024-08-19 11:45:44 +00:00
Ondřej Surý b9f0df6097 [9.18] fix: dev: Check the result of dirfd() before calling unlinkat()
Instead of directly using the result of dirfd() in the unlinkat() call,
check whether the returned file descriptor is actually valid.  That
doesn't really change the logic as the unlinkat() would fail with
invalid descriptor anyway, but this is cleaner and will report the right
error returned directly by dirfd() instead of EBADF from unlinkat().

Closes #4853

Backport of MR !9316

Merge branch 'backport-4853-check-result-of-dirfd-in-isc_log-9.18' into 'bind-9.18'

See merge request isc-projects/bind9!9344
2024-08-19 11:23:13 +00:00
Ondřej Surý e08d3a7932 Check the result of dirfd() before calling unlinkat()
Instead of directly using the result of dirfd() in the unlinkat() call,
check whether the returned file descriptor is actually valid.  That
doesn't really change the logic as the unlinkat() would fail with
invalid descriptor anyway, but this is cleaner and will report the right
error returned directly by dirfd() instead of EBADF from unlinkat().

(cherry picked from commit 59f4fdebc0)
2024-08-19 11:23:05 +00:00
Ondřej Surý 887a61a408 [9.18] chg: dev: Remove code to read and parse /proc/net/if_inet6 on Linux
The getifaddr() works fine for years, so we don't have to
keep the callback to parse /proc/net/if_inet6 anymore.

Closes #4852

Backport of MR !9315

Merge branch 'backport-4852-handle-errors-from-rewind-9.18' into 'bind-9.18'

See merge request isc-projects/bind9!9342
2024-08-19 11:01:43 +00:00
Ondřej Surý bd8a1abc80 Remove code to read and parse /proc/net/if_inet6 on Linux
The getifaddr() works fine for years, so we don't have to
keep the callback to parse /proc/net/if_inet6 anymore.

(cherry picked from commit 2fbf9757b8)
2024-08-19 09:46:07 +00:00
Ondřej Surý e707ee0946 Ignore errno returned from rewind() in the interface iterator
The clang-scan 19 has reported that we are ignoring errno after the call
to rewind().  As we don't really care about the result, just silence the
error, the whole code will be removed in the development version anyway
as it is not needed.

(cherry picked from commit dda5ba53df)
2024-08-19 09:46:07 +00:00
Ondřej Surý 11add5e520 [9.18] chg: test: For TSAN builds, use libraries from /opt/tsan
The new TSAN images, the TSAN-enabled images install libraries to
opt/tsan, synchronize the configure options and CFLAGS between gcc:tsan
and clang:tsan images and set the PKG_CONFIG_PATH to /opt/tsan/lib.

Additionally, drop Debian bullseye that's EOL now.

Backport of MR !9324

Merge branch 'backport-ondrej/use-staging-tsan-images-9.18' into 'bind-9.18'

See merge request isc-projects/bind9!9326
2024-08-16 08:40:48 +00:00
Michal NowakandOndřej Surý 0bfdc2d55a Retire Debian 11 "bullseye"
A follow-up to isc-projects/bind9!9324.
2024-08-16 09:07:17 +02:00
Ondřej Surý c95a3600e9 Remove Debian bullseye jobs
The Debian bullseye has reached end-of-life, remove it from the CI.

(cherry picked from commit d02d6af2b9)
2024-08-16 09:07:17 +02:00
Ondřej Surý 60833e5dbe For TSAN builds, use libraries from /opt/tsan
The new TSAN images, the TSAN-enabled images install libraries to
/opt/tsan, synchronize the configure options and CFLAGS between gcc:tsan
and clang:tsan images and set the PKG_CONFIG_PATH to /opt/tsan/lib.

(cherry picked from commit 2a46396f29)
2024-08-16 09:07:17 +02:00
Nicki Křížek 3a8082c02b [9.18] chg: ci: Check that generated changelog entry doesn't break docs build
Since changelog entries are now generated from MR title&description,
they aren't sanity checked during a regular docs build. If these contain
special sequences that will be interpreted by sphinx, it might result in
breakage that would have to be amended manually.

Add a CI check to test a doc build with changelog after the MR is merged
to ensure that the docs can be built when generating changelog from
pristine git contents.

Related #4847

Backport of MR !9294

Merge branch 'backport-nicki/add-changelog-entry-check-9.18' into 'bind-9.18'

See merge request isc-projects/bind9!9312
2024-08-14 19:15:25 +00:00
Nicki Křížek 7f057b379d Use python3 in shebang lines for util scripts
Some distributions (notably, debian bookworm) have deprecated the
`python` interpreter in favor of `python3`. Since our scripts are
python3 anyway, use the proper numbered version in shebang to make
scripts easily executable.

(cherry picked from commit 480dcdef9a)
2024-08-14 15:43:39 +00:00
Nicki Křížek 429299cbe0 Check that generated changelog entry doesn't break docs build
Since changelog entries are now generated from MR title&description,
they aren't sanity checked during a regular docs build. If these contain
special sequences that will be interpreted by sphinx, it might result in
breakage that would have to be amended manually.

Add a CI check to test a doc build with changelog after the MR is merged
to ensure that the docs can be built when generating changelog from
pristine git contents.

(cherry picked from commit bf69e8f149)
2024-08-14 15:43:39 +00:00
Nicki Křížek 7b428c681a [9.18] chg: doc: Fix ordering of gitchangelog replacement regexs
Ensure the issue number in changelog isn't accidentally removed for backport MRs.

Backport of MR !9295

Merge branch 'backport-nicki/fix-gitchangelog-replacement-regexs-9.18' into 'bind-9.18'

See merge request isc-projects/bind9!9309
2024-08-14 15:20:55 +00:00
Nicki Křížek 46310aa771 Fix ordering of gitchangelog replacement regexs
Prior to this change, the issue number could be accidentally removed by
the `Backport of` text, depending on the order of the MR description
contents. Ensure all the removals for text in MR descriptions happen
first, and only then run the replacement regex for issue number, which
appends it to the end of the last non-empty line (which will no longer
be removed).

The only removals that happen after the replacement are guaranteed to
always happen after the end of MR description, since they're
auto-generated by gitlab when the merge commit is created, thus won't
affect the line with the issue number.

Also remove the needless isc-private/bind9 replacement. References
to private MRs are already removed by the very first regex.

(cherry picked from commit 37274bebe1)
2024-08-14 15:11:59 +00:00
Petr Špaček a697ae6d0b Update BIND version for release 2024-08-13 16:13:29 +02:00
Petr Špaček 58d5acc2aa Prepare documentation for BIND 9.18.29
Merge branch 'pspacek/prepare-documentation-for-bind-9.18.29' into 'v9.18.29-release'

See merge request isc-private/bind9!730
2024-08-13 13:57:31 +00:00
Petr ŠpačekandGreg Choules 1ad17e870a Tweak and reword release notes
Co-authored-by: Greg Choules <greg@isc.org>
2024-08-13 15:09:41 +02:00
Petr Špaček 2b491b4007 Prepare documentation for BIND 9.18.29 2024-08-13 14:38:38 +02:00
Petr Špaček 8f0d9b7fca Re-apply release note tweaks from the 9.21.0 release 2024-08-13 14:36:20 +02:00
Petr Špaček 7048b2d471 Re-apply changelog formatting tweaks from the 9.21.0 release 2024-08-13 14:24:13 +02:00
Petr Špaček b3af742926 Generate release documentation 2024-08-13 14:17:00 +02:00
Michał Kępień 944d0dc942 [9.18] fix: usr: reconfigure catz member zones during named reconfiguration
During a reconfiguration named wasn't reconfiguring catalog zones' member zones. This has been fixed.

Backport of MR !695

Closes isc-projects/bind9#4733

Merge branch '4733-fix-catz-member-zones-reconfigure-9.18' into 'v9.18.29-release'

See merge request isc-private/bind9!727
2024-08-09 07:32:07 +00:00
Aram SargsyanandMichał Kępień 2e6e4cdb55 Non empty 'catalog-zones' implies that 'allow-new-zones' is true
This condition in catalog zone processing functions is checked only
for sanity, so there is no meaning for a log message that normally
shouldn't be ever logged.

(cherry picked from commit 0b3c8ee55e6cda1f2de35aa15f6a4d82d072c309)
2024-08-09 08:52:25 +02:00
Aram SargsyanandMichał Kępień 4379141fe4 Reconfigure catz member zones during named reconfiguration
During a reconfiguration named doesn't reconfigure catalog zones
member zones. Implement the necessary code to reconfigure catz
member zones.

(cherry picked from commit fd71ed5d73ae2dc968e8782ce652fb8ef257c25e)
2024-08-09 08:52:25 +02:00
Aram SargsyanandMichał Kępień 565731ceea Test that 'rndc reconfig' reconfigures catz member zones
Catalog zone member zones should be reconfigured as all the other
zones during a reconfiguration. Test it by checking whether the newly
added allow-query setting affects a member zone.

(cherry picked from commit cd04b89dba85781c194f22ce6fe358c972a14758)
2024-08-09 08:52:25 +02:00
Michal Nowak 13ec0fa27a [9.18] chg: Make every changelog entry a separate code block
LaTeX in CI and on ReadTheDocs [fails][1] to render a PDF version of ARM if
the Changelog section is included. The running theory is that the
verbatim section of more than twenty thousand lines is too big to meet
LaTeX self-imposed constraints, and it fails with:

    ! TeX capacity exceeded, sorry [main memory size=5000000].

Or it just hangs if extra_mem_bot=30000000 is set in
/etc/texmf/texmf.d/01main_memory_bump.cnf:

    ! Dimension too large.
    \fb@put@frame ...p \ifdim \dimen@ >\ht \@tempboxa

    \fb@putboxa #1\fb@afterfra...
    l.56913 \end{sphinxVerbatim}

Make each BIND 9 release a separate code block to work around the issue.
Further split up the sections for some exceptionally large releases, for
the same reason.

[1]: https://gitlab.isc.org/isc-projects/bind9/-/jobs/4584011

Backport of MR !9266

Merge branch 'backport-mnowak/fix-arm-changelog-section-9.18' into 'bind-9.18'

See merge request isc-projects/bind9!9290
2024-08-08 16:01:59 +00:00
Michal Nowak 1e2fd565d3 Split up changelog into per-release code blocks
LaTeX in CI and on ReadTheDocs fails to render a PDF version of ARM if
the Changelog section is included. The running theory is that the
verbatim section of more than twenty thousand lines is too big to meet
LaTeX self-imposed constraints, and it fails with:

    ! TeX capacity exceeded, sorry [main memory size=5000000].

Or it just hangs if extra_mem_bot=30000000 is set in
/etc/texmf/texmf.d/01main_memory_bump.cnf:

    ! Dimension too large.
    \fb@put@frame ...p \ifdim \dimen@ >\ht \@tempboxa

    \fb@putboxa #1\fb@afterfra...
    l.56913 \end{sphinxVerbatim}

Make each BIND 9 release a separate code block to work around the issue.
Further split up the sections for some exceptionally large releases, for
the same reason.

(cherry picked from commit bc802359b0)
2024-08-08 17:25:51 +02:00
Evan Hunt fe3ae71e90 [9.18] new: usr: Tighten 'max-recursion-queries' and add 'max-query-restarts' option
There were cases in resolver.c when the `max-recursion-queries` quota was ineffective. It was possible to craft zones that would cause a resolver to waste resources by sending excessive queries while attempting to resolve a name. This has been addressed by correcting errors in the implementation of `max-recursion-queries`, and by reducing the default value from 100 to 32.

In addition, a new `max-query-restarts` option has been added which limits the number of times a recursive server will follow CNAME or DNAME records before terminating resolution. This was previously a hard-coded limit of 16, and now defaults to 11.
 
Closes #4741

Backport of MR !9281

Merge branch 'backport-4741-reclimit-restarts-9.18' into 'bind-9.18'

See merge request isc-projects/bind9!9283
2024-08-07 23:22:22 +00:00
Evan Hunt 2e04f0380c implement 'max-query-restarts'
implement, document, and test the 'max-query-restarts' option
which specifies the query restart limit - the number of times
we can follow CNAMEs before terminating resolution.

(cherry picked from commit 104f3b82fb)
2024-08-07 15:36:16 -07:00
Evan Hunt a11367ade3 reduce the max-recursion-queries default to 32
the number of iterative queries that can be sent to resolve a
name now defaults to 32 rather than 100.

(cherry picked from commit 7e3b425dc2)
2024-08-07 15:36:15 -07:00
Evan Hunt bfbc6a6c84 make "max_restarts" a configurable value
MAX_RESTARTS is no longer hard-coded; ns_server_setmaxrestarts()
and dns_client_setmaxrestarts() can now be used to modify the
max-restarts value at runtime. in both cases, the default is 11.

(cherry picked from commit c5588babaf)
2024-08-07 15:36:15 -07:00
Evan Hunt dd88a4cdfc reduce MAX_RESTARTS to 11
the number of steps that can be followed in a CNAME chain
before terminating the lookup has been reduced from 16 to 11.
(this is a hard-coded value, but will be made configurable later.)

(cherry picked from commit 05d78671bb)
2024-08-07 15:36:14 -07:00
Evan Hunt 14bce7e275 add debug logging when creating or attaching to a query counter
fctx_create() now logs at debug level 9 when the fctx attaches
to an existing counter or creates a new one.

(cherry picked from commit 825f3d68c5)
2024-08-07 15:36:14 -07:00
Evan Hunt 18e39d989f apply max-recursion-queries quota to validator queries
previously, validator queries for DNSKEY and DS records were
not counted toward the quota for max-recursion-queries; they
are now.

(cherry picked from commit af7db89513)
2024-08-07 15:36:09 -07:00
Evan Hunt 5ab4cae4ed attach query counter to NS fetches
there were cases in resolver.c when queries for NS records were
started without passing a pointer to the parent fetch's query counter;
as a result, the max-recursion-queries quota for those queries started
counting from zero, instead of sharing the limit for the parent fetch,
making the quota ineffective in some cases.

(cherry picked from commit d3b7e92783)
2024-08-07 14:51:44 -07:00
Ondřej Surý 3da167b241 [9.18] chg: test: Use new images with TSAN-enabled libraries
The new Fedora 40 TSAN images use libuv, urcu and OpenSSL libraries compiled with ThreadSanitizer.  This (in theory) should enable better detection of memory races in those (most important) libraries.

Backport of MR !9264

Merge branch 'backport-ondrej/test-new-tsan-images-9.18' into 'bind-9.18'

See merge request isc-projects/bind9!9277
2024-08-07 16:02:10 +00:00
Ondřej Surý f7014eeb3d Add configure for libraries in /usr/local for the gcc:tsan job
The TSAN-enabled libraries are installed to /usr/local, pass the
PKG_CONFIG_PATH and few other options to CFLAGS to the configure
arguments.

(cherry picked from commit ed766efc15)
2024-08-07 16:02:02 +00:00
Ondřej Surý 64fde41253 [9.18] fix: dev: Disassociate the SSL object from the cached SSL_SESSION
When the SSL object was destroyed, it would invalidate all SSL_SESSION
objects including the cached, but not yet used, TLS session objects.

Properly disassociate the SSL object from the SSL_SESSION before we
store it in the TLS session cache, so we can later destroy it without
invalidating the cached TLS sessions.

Closes #4834

Backport of MR !9271

Merge branch 'backport-4834-detach-SSL-from-cached-SSL_SESSION-9.18' into 'bind-9.18'

See merge request isc-projects/bind9!9279
2024-08-07 16:01:11 +00:00
Ondřej Surý acabe271c5 Disassociate the SSL object from the cached SSL_SESSION
When the SSL object was destroyed, it would invalidate all SSL_SESSION
objects including the cached, but not yet used, TLS session objects.

Properly disassociate the SSL object from the SSL_SESSION before we
store it in the TLS session cache, so we can later destroy it without
invalidating the cached TLS sessions.

Co-authored-by: Ondřej Surý <ondrej@isc.org>
Co-authored-by: Artem Boldariev <artem@isc.org>
Co-authored-by: Aram Sargsyan <aram@isc.org>
(cherry picked from commit c11b736e44)
2024-08-07 16:01:03 +00:00
Ondřej Surý 3ead47daff [9.18] fix: dev: Attach/detach to the listening child socket when accepting TLS
When TLS connection (TLSstream) connection was accepted, the children
listening socket was not attached to sock->server and thus it could have
been freed before all the accepted connections were actually closed.

In turn, this would cause us to call isc_tls_free() too soon - causing
cascade errors in pending SSL_read_ex() in the accepted connections.

Properly attach and detach the children listening socket when accepting
and closing the server connections.

Closes #4833

Backport of MR !9270

Merge branch 'backport-4833-tlssock-needs-to-attach-to-child-tlslistener-9.18' into 'bind-9.18'

See merge request isc-projects/bind9!9278
2024-08-07 16:00:55 +00:00
Ondřej Surý 875755d9ea Attach/detach to the listening child socket when accepting TLS
When TLS connection (TLSstream) connection was accepted, the children
listening socket was not attached to sock->server and thus it could have
been freed before all the accepted connections were actually closed.

In turn, this would cause us to call isc_tls_free() too soon - causing
cascade errors in pending SSL_read_ex() in the accepted connections.

Properly attach and detach the children listening socket when accepting
and closing the server connections.

(cherry picked from commit 684f3eb8e6)
2024-08-07 17:20:03 +02:00
Petr Špaček 0d1953d7a8 [9.18] fix: dev: Make hypothesis optional for system tests
Ensure that system tests can be executed without Python hypothesis
package.

Closes #4831

Backport of MR !9265

Merge branch 'backport-4831-isctest-make-hypothesis-optional-9.18' into 'bind-9.18'

See merge request isc-projects/bind9!9268
2024-08-07 12:11:10 +00:00
Nicki KřížekandPetr Špaček fc87a96e07 Make hypothesis optional for system tests
Ensure that system tests can be executed without Python hypothesis
package.

(cherry picked from commit e6a7695600)
2024-08-07 11:00:24 +00:00
Ondřej Surý 674420df64 [9.18] fix: dev: Don't loop indefinitely when isc_task quantum is 'unlimited'
Don't run more events than already scheduled.  If the quantum is set to
a high value, the task_run() would execute already scheduled, and all
new events that result from running event->ev_action().

Setting quantum to a number of scheduled events will postpone events
scheduled after we enter the loop here to the next task_run()
invocation.

Merge branch 'ondrej/dont-run-more-events-than-scheduled-9.18' into 'bind-9.18'

See merge request isc-projects/bind9!9257
2024-08-07 06:32:42 +00:00
Ondřej Surý 9615f5b348 Don't loop indefinitely when isc_task quantum is 'unlimited'
Don't run more events than already scheduled.  If the quantum is set to
a high value, the task_run() would execute already scheduled, and all
new events that result from running event->ev_action().

Setting quantum to a number of scheduled events will postpone events
scheduled after we enter the loop here to the next task_run()
invocation.
2024-08-07 08:27:15 +02:00
Ondřej Surý e4c483f45f [9.18] chg: dev: Use _exit() in the fatal() function
Since the fatal() isn't a correct but rather abrupt termination of the
program, we want to skip the various atexit() calls because not all
memory might be freed during fatal() call, etc.  Using _exit() instead
of exit() has this effect - the program will end, but no destructors or
atexit routines will be called.

Backport of MR !8703

Merge branch 'backport-ondrej/use-_exit-in-fatal-9.18' into 'bind-9.18'

See merge request isc-projects/bind9!9263
2024-08-06 14:11:15 +00:00
Ondřej Surý 236de53c52 Use EXIT_SUCCESS and EXIT_FAILURE
Instead of randomly using -1 or 1 as a failure status, properly utilize
the EXIT_FAILURE define that's platform specific (as it should be).

(cherry picked from commit76997983fde02d9c32aa23bda30b65f1ebd4178c)
2024-08-06 15:19:06 +02:00
Ondřej Surý 1a82a85266 Use _exit() in the fatal() function
Since the fatal() isn't a correct but rather abrupt termination of the
program, we want to skip the various atexit() calls because not all
memory might be freed during fatal() call, etc.  Using _exit() instead
of exit() has this effect - the program will end, but no destructors or
atexit routines will be called.

(cherry picked from commit 4bec711fe3)
2024-08-06 14:52:24 +02:00
Ondřej Surý c948babeeb [9.18] fix: usr: Raise the log level of priming failures
When a priming query is complete, it's currently logged at level ISC_LOG_DEBUG(1), regardless of success or failure. We are now raising it to ISC_LOG_NOTICE in the case of failure. [GL #3516]

Closes #3516

Backport of MR !9121

Merge branch 'backport-3516-log-priming-errors-9.18' into 'bind-9.18'

See merge request isc-projects/bind9!9251
2024-08-05 14:05:31 +00:00
Evan HuntandOndřej Surý 18d7be118f raise the log level of priming failures
when a priming query is complete, it's currently logged at
level ISC_LOG_INFO, regardless of success or failure. we
are now changing it to ISC_LOG_NOTICE in the case of failure
and ISC_LOG_DEBUG(1) in case of success.

(cherry picked from commit a84d54c6ff)
2024-08-05 15:31:38 +02:00
Ondřej Surý 61ff983f00 fix: usr: Add a compatibility shim for older libuv versions (< 1.19.0)
The uv_stream_get_write_queue_size() is supported only in relatively newer versions of libuv (1.19.0 or higher).  Provide a compatibility shim for this function , so BIND 9 can be built in environments with older libuv version.

Fixes: #4822

Merge branch 'uv_stream_get_write_queue_size_wrapper' into 'bind-9.18'

See merge request isc-projects/bind9!9153
2024-08-05 10:29:41 +00:00
JINMEI TatuyaandOndřej Surý b9bef2cc89 add a trivial wrapper for uv_stream_get_write_queue_size 2024-08-05 10:27:37 +00:00
Ondřej Surý 85c88483e0 [9.18] fix: test: Use LC_ALL to override all system locales
The system tests were overriding the local locale by setting LANG to C.
This does not override the locale in case there are individual LC_<*>
variables like LC_CTYPE explicitly set.

Use LC_ALL=C instead which is the proper way of overriding all currently
set locales.

Backport of MR !9109

Merge branch 'backport-ondrej/use-LC_ALL-not-LANG-9.18' into 'bind-9.18'

See merge request isc-projects/bind9!9236
2024-08-05 09:12:30 +00:00
Ondřej Surý e494854523 Use LC_ALL to override all system locales
The system tests were overriding the local locale by setting LANG to C.
This does not override the locale in case there are individual LC_<*>
variables like LC_CTYPE explicitly set.

Use LC_ALL=C instead which is the proper way of overriding all currently
set locales.
2024-08-05 09:42:50 +02:00
Mark Andrews 1222dbe9f9 [9.18] fix: usr: Remove extra newline from yaml output
I split this into two commits, one for the actual newline removal, and one for issues I found, ruining the yaml output when some errors were outputted.

Closes: #4772

Backport of MR !9112

Merge branch 'backport-yaml-indent-9.18' into 'bind-9.18'

See merge request isc-projects/bind9!9232
2024-08-05 05:17:11 +00:00
Yedaya KatsmanandMark Andrews 1b45e64d3f Remove newlines from dighost errors calls
Not all invocations had it, and this makes it more consistent with
dighost_warning. Also remove the conditional newline when not outputting
yaml

(cherry picked from commit 1dd76fe780)
2024-08-05 03:40:41 +00:00
Yedaya KatsmanandMark Andrews 87cb888a2d Remove extra newline from +yaml output
The newlines weren't needed for the yaml syntax, and took up space.

(cherry picked from commit 8986dda74a)
2024-08-05 03:40:41 +00:00
Mark Andrews bbdd888b8e [9.18] fix: dev: CID 498025 and CID 498031: Overflowed constant INTEGER_OVERFLOW
Add INSIST to fail if the multiplication would cause the variables to overflow.

Closes #4798

Backport of MR !9131

Merge branch 'backport-4798-cid-498025-and-cid-498031-overflowed-constant-integer_overflow-9.18' into 'bind-9.18'

See merge request isc-projects/bind9!9230
2024-08-05 01:38:09 +00:00
Mark Andrews 0dbda6661d Prevent overflow of bufsize
If bufsize overflows we will have an infinite loop.  In practice
this will not happen unless we have made a coding error.  Add an
INSIST to detect this condition.

    181retry:
    182        isc_buffer_allocate(mctx, &b, bufsize);
    183        result = dns_rdata_totext(rdata, NULL, b);
    184        if (result == ISC_R_NOSPACE) {
    185                isc_buffer_free(&b);

    CID 498031: (#1 of 1): Overflowed constant (INTEGER_OVERFLOW)
    overflow_const: Expression bufsize, which is equal to 0, overflows
    the type that receives it, an unsigned integer 32 bits wide.
    186                bufsize *= 2;
    187                goto retry;
    188        }

(cherry picked from commit 20ac13fb23)
2024-08-04 23:52:20 +00:00
Mark Andrews 02cb4823db Prevent overflow of size
If size overflows we will have an infinite loop.  In practice
this will not happen unless we have made a coding error.  Add
an INSIST to detect this condition.

    181        while (!done) {
    182                isc_buffer_allocate(mctx, &b, size);
    183                result = dns_rdata_totext(rdata, NULL, b);
    184                if (result == ISC_R_SUCCESS) {
    185                        printf("%.*s\n", (int)isc_buffer_usedlength(b),
    186                               (char *)isc_buffer_base(b));
    187                        done = true;
    188                } else if (result != ISC_R_NOSPACE) {
    189                        check_result(result, "dns_rdata_totext");
    190                }
    191                isc_buffer_free(&b);

    CID 498025: (#1 of 1): Overflowed constant (INTEGER_OVERFLOW)
    overflow_const: Expression size, which is equal to 0, overflows the type that
    receives it, an unsigned integer 32 bits wide.
    192                size *= 2;
    193        }

(cherry picked from commit e7ef0a60ab)
2024-08-04 23:52:20 +00:00
Petr Špaček 89724dcca3 [9.18] chg: test: Expand the wildcard system test with wider use of hypothesis
Backport of MR !8461

Merge branch 'stepan/hypothesis-9.18' into 'bind-9.18'

See merge request isc-projects/bind9!9072
2024-08-02 12:32:48 +00:00
Štěpán BalážikandPetr Špaček 4196b92f02 Add a helper for uncompressed length of dnspython's dns.name.Name
This is useful for generating using hypothesis but also for other
cases.

(cherry picked from commit 9584a7bdcd)
2024-08-02 11:22:56 +00:00
Štěpán BalážikandPetr Špaček df01e5d788 Move hypothesis strategies to isctest for later reuse
`isctest.hypothesis` seems to be a nice place to have these.

(cherry picked from commit bb1e5cfa09)
2024-08-02 11:22:56 +00:00
Štěpán BalážikandPetr Špaček d0288545f3 Disable deadlines for hypothesis tests when running in CI
The times it takes to run tests CI vary significantly enough
that it makes hypothesis test reach their deadlines and fail randomly
marking the tests as flaky.

This commit disables the deadlines when running in CI.

(cherry picked from commit f55cacbbfd)
2024-08-02 11:22:56 +00:00
Štěpán BalážikandPetr Špaček 2ae0e31138 Test nested wildcard special case in the respective system test
See final remark of RFC 4592 2.2.1. for details.

(cherry picked from commit 9943172566)
2024-08-02 11:22:56 +00:00
Štěpán BalážikandPetr Špaček 132357101e Expand the wildcard system test with wider use of hypothesis
The queries are now generated more generally (i. e. they have
multiple labels, etc.).

(cherry picked from commit d0cfbd398e)
2024-08-02 11:22:56 +00:00
Štěpán BalážikandPetr Špaček f78e41c231 Add hypothesis strategies for generating DNS names and company
The most important being `dns_names` that generates dns.name.Name
objects based on given paramaters.

No guarantees are given when it comes the uniformity of generated
samples, however it plays nicely with the hypothesis' shrinking
algorithm.

Once we use hypothesis more widely (in at least one more test) this file
should be moved for it to be reused easily.

(cherry picked from commit 5d738cd9ed)
2024-08-02 11:22:56 +00:00
Štěpán BalážikandPetr Špaček 3aac716a46 Extend isctest package with more utility functions
Check for more rcodes and various properties needed in the wildcard
test. Add a `name` module for various dns.name.Name operations (with
`prepend_label` function only now).

Expose `timeout` as a parameter of `query.tcp`/`query.udp`.

(cherry picked from commit e7d46ad8ba)
2024-08-02 11:22:56 +00:00
Štěpán BalážikandPetr Špaček 6bd6777fb7 Silent pylint's line-too-long warning as it's handled better by black
Black allows the lines with string literals to be longer, which is
convenient for descriptive error messages.

(cherry picked from commit 02d1c5fc89)
2024-08-02 11:22:56 +00:00
Petr Špaček 28e555e035 [9.18] new: doc: Clarify how to print default dnssec-policy
Backport of MR !9092

Merge branch 'backport-pspacek/doc-dnssec-policy-default-9.18' into 'bind-9.18'

See merge request isc-projects/bind9!9226
2024-08-02 09:15:16 +00:00
Petr Špaček 560f999d28 Clarify how to print default dnssec-policy
Reading the source tree is unnecessarily complicated, we now have
command line option to print defaults.

(cherry picked from commit 1e1334a322)
2024-08-02 08:27:53 +00:00
Mark Andrews 2374a1a2bd [9.18] fix: dev: Remove unnecessary operations
Decrementing optlen immediately before calling continue is unneccesary
and inconsistent with the rest of dns_message_pseudosectiontoyaml
and dns_message_pseudosectiontotext.  Coverity was also reporting
an impossible false positive overflow of optlen (CID 499061).

    4176                        } else if (optcode == DNS_OPT_CLIENT_TAG) {
    4177                                uint16_t id;
    4178                                ADD_STRING(target, "; CLIENT-TAG:");
    4179                                if (optlen == 2U) {
    4180                                        id = isc_buffer_getuint16(&optbuf);
    4181                                        snprintf(buf, sizeof(buf), " %u
", id);
    4182                                        ADD_STRING(target, buf);

    CID 499061: (#1 of 1): Overflowed constant (INTEGER_OVERFLOW)
    overflow_const: Expression optlen, which is equal to 65534, underflows
    the type that receives it, an unsigned integer 16 bits wide.
    4183                                        optlen -= 2;
    4184                                        POST(optlen);
    4185                                        continue;
    4186                                }
    4187                        } else if (optcode == DNS_OPT_SERVER_TAG) {

Backport of MR !9130

Merge branch 'backport-marka-remove-unnecessary-operations-9.18' into 'bind-9.18'

See merge request isc-projects/bind9!9224
2024-08-02 08:13:49 +00:00
Mark Andrews b0d32302b2 Remove unnecessary operations
Decrementing optlen immediately before calling continue is unneccesary
and inconsistent with the rest of dns_message_pseudosectiontoyaml
and dns_message_pseudosectiontotext.  Coverity was also reporting
an impossible false positive overflow of optlen (CID 499061).

    4176                        } else if (optcode == DNS_OPT_CLIENT_TAG) {
    4177                                uint16_t id;
    4178                                ADD_STRING(target, "; CLIENT-TAG:");
    4179                                if (optlen == 2U) {
    4180                                        id = isc_buffer_getuint16(&optbuf);
    4181                                        snprintf(buf, sizeof(buf), " %u\n", id);
    4182                                        ADD_STRING(target, buf);

    CID 499061: (#1 of 1): Overflowed constant (INTEGER_OVERFLOW)
    overflow_const: Expression optlen, which is equal to 65534, underflows
    the type that receives it, an unsigned integer 16 bits wide.
    4183                                        optlen -= 2;
    4184                                        POST(optlen);
    4185                                        continue;
    4186                                }
    4187                        } else if (optcode == DNS_OPT_SERVER_TAG) {

(cherry picked from commit 47338c2c87)
2024-08-02 06:43:03 +00:00
Mark Andrews 4b97bdda71 [9.18] fix: test: digdelv system test can report more errors than there actually are
Closes #4770

Backport of MR !9104

Merge branch 'backport-4770-digdelv-system-test-can-report-more-errors-than-they-actually-are-9.18' into 'bind-9.18'

See merge request isc-projects/bind9!9222
2024-08-02 04:19:10 +00:00
Mark Andrews cb180bf4ea Reset 'ret' to zero at start of tests
(cherry picked from commit 2dc2abd00d)
2024-08-02 03:01:48 +00:00
Mark Andrews df55c15ebb [9.18] fix: usr: fix generation of 6to4-self name expansion from IPv4 address
The period between the most significant nibble of the encoded IPv4 address and the 2.0.0.2.IP6.ARPA suffix was missing resulting in the wrong name being checked. Add system test for 6to4-self implementation.

Closes #4766

Backport of MR !9099

Merge branch 'backport-4766-add-system-test-for-6to4-self-9.18' into 'bind-9.18'

See merge request isc-projects/bind9!9218
2024-08-02 00:56:33 +00:00
Mark Andrews 80a21e75b8 check 'update-policy 6to4-self' over IPv6
(cherry picked from commit 3b0de4773b)
2024-08-02 00:09:17 +00:00
Mark Andrews 799f677313 check 'update-policy 6to4-self' over IPv4
(cherry picked from commit b28e5ff721)
2024-08-02 00:09:17 +00:00
Mark Andrews b8363ffff9 Add missing period to generated IPv4 6to4 name
The period between the most significant nibble of the IPv4 address
and the 2.0.0.2.IP6.ARPA suffix was missing resulting in the wrong
name being checked.

(cherry picked from commit bca63437a1)
2024-08-02 00:09:17 +00:00
Arаm Sаrgsyаn 97a5b8bab2 [9.18] chg: doc: update querylog documentation in ARM
Add a note that 'rndc reload' and 'rndc reconfig' can't change the
querylog option during the runtime of named.

Closes #4801

Backport of MR !9136

Merge branch 'backport-4801-arm-querylog-clarification-9.18' into 'bind-9.18'

See merge request isc-projects/bind9!9207
2024-08-01 19:26:40 +00:00
Aram Sargsyan 7752288484 Update querylog documentation in ARM
Add a note that 'rndc reload' and 'rndc reconfig' can't change the
querylog option during the runtime of named.

(cherry picked from commit 8fd7da2a9e)
2024-08-01 19:26:18 +00:00
Mark Andrews 4984afc80c [9.18] fix: usr: fix false QNAME minimisation error being reported
Remove the false positive "success resolving" log message when QNAME minimisation is in effect and the final result is NXDOMAIN.

Closes #4784

Backport of MR !9117

Merge branch 'backport-4784-false-qname-minimisation-error-being-reported-9.18' into 'bind-9.18'

See merge request isc-projects/bind9!9216
2024-08-01 06:38:16 +00:00
Mark Andrews 4649e85e3b Test that false positive "success resolving" is not logged
(cherry picked from commit 111e285214)
2024-08-01 15:58:16 +10:00
Mark Andrews 4704c28cab Cleanup old clang-format string splitting
(cherry picked from commit 6d1c7beb15)
2024-08-01 15:58:16 +10:00
Mark Andrews 7643a0322f Remove false positive qname minimisation error
Don't report qname minimisation NXDOMAIN errors when the result is
NXDOMAIN.

(cherry picked from commit f78beca942)
2024-08-01 15:58:16 +10:00
Mark Andrews 2db62a4dba [9.18] fix: usr: Dig +yaml was producing unexpected and/or invalid YAML output
Closes #4796

Backport of MR !9127

Merge branch 'backport-4796-yaml-stringify-question-and-records-9.18' into 'bind-9.18'

See merge request isc-projects/bind9!9214
2024-08-01 04:34:57 +00:00
Mark Andrews 4eb6db47ac Test yaml output with yaml specials
(cherry picked from commit fadf461761)
2024-08-01 03:48:13 +00:00
Mark Andrews 8fefb27f76 Fix yaml output
In yaml mode we emit a string for each question and record.  Certain
names and data could result in invalid yaml being produced.  Use single
quote string for all questions and records.  This requires that single
quotes get converted to two quotes within the string.

(cherry picked from commit 393d7fa78e)
2024-08-01 03:48:12 +00:00
Mark Andrews e7b9fc6d11 [9.18] chg: test: resolver system test didn't fail on all subtest errors
Closes #4774

Backport of MR !9105

Merge branch 'backport-4774-resolver-system-test-didn-t-fail-on-all-subtest-errors-9.18' into 'bind-9.18'

See merge request isc-projects/bind9!9212
2024-08-01 03:30:34 +00:00
Mark Andrews de4a087673 resolver system test didn't record all failures
(cherry picked from commit 5843b29f47)
2024-08-01 12:41:45 +10:00
Mark Andrews 8f7be89052 [9.18] fix: usr: SVBC alpn text parsing failed to reject zero length alpn
Closes #4775

Backport of MR !9106

Merge branch 'backport-4775-reject-zero-length-alpn-in-alpn-fromtext-9.18' into 'bind-9.18'

See merge request isc-projects/bind9!9210
2024-08-01 02:28:23 +00:00
Mark Andrews a8d86f0531 Check invalid alpn empty value
(cherry picked from commit fa35c67301)
2024-08-01 01:10:53 +00:00
Mark Andrews 74a8cc9db6 Check invalid alpn produced due to missing double escapes
(cherry picked from commit a49b2a3568)
2024-08-01 01:10:53 +00:00
Mark Andrews ce8356905c Properly reject zero length ALPN in commatxt_fromtext
ALPN are defined as 1*255OCTET in RFC 9460.  commatxt_fromtext was not
rejecting invalid inputs produces by missing a level of escaping
which where later caught be dns_rdata_fromwire on reception.

These inputs should have been rejected

	svcb in svcb 1 1.svcb alpn=\,abc
	svcb1 in svcb 1 1.svcb alpn=a\,\,abc

and generated 00 03 61 62 63 and 01 61 00 02 61 62 63 respectively.

The correct inputs to include commas in the alpn requires double
escaping.

	svcb in svcb 1 1.svcb alpn=\\,abc
	svcb1 in svcb 1 1.svcb alpn=a\\,\\,abc

and generate 04 2C 61 62 63 and 06 61 2C 2C 61 62 63 respectively.

(cherry picked from commit b51c9eb797)
2024-08-01 01:10:53 +00:00
Arаm Sаrgsyаn f7de909b98 [9.18] fix: usr: return SERVFAIL for a too long CNAME chain
When cutting a long CNAME chain, named was returning NOERROR 
instead of SERVFAIL (alongside with a partial answer). This
has been fixed.

Closes #4449

Backport of MR !9090

Merge branch 'backport-4449-return-servfail-for-a-long-cname-chain-9.18' into 'bind-9.18'

See merge request isc-projects/bind9!9204
2024-07-31 16:29:24 +00:00
Aram Sargsyan 6bad06ea2e Update the chain test
Update the CNAME chain test to correspond to the changed behavior,
because now named returns SERVFAIL when hitting the maximum query
restarts limit (e.g. happening when following a long CNAME chain).

In the current test auth will hit the limit and return partial data
with a SERVFAIL code, while the resolver will return no data with
a SERVFAIL code after auth returns SERVFAIL to it.

(cherry picked from commit 7751c7eca6)
2024-07-31 15:14:43 +00:00
Aram Sargsyan 27f6fc915c Test that a long CNAME chain causes SERVFAIL
Also check that the expected partial answer in returned too.

(cherry picked from commit 580f872fe1)
2024-07-31 15:14:43 +00:00
Aram Sargsyan 946931ccb7 Return SERVFAIL for a too long CNAME chain
Due to the maximum query restart limitation a long CNAME chain
it is cut after 16 queries but named still returns NOERROR.

Return SERVFAIL instead and the partial answer.

(cherry picked from commit b621f1d88e)
2024-07-31 15:14:43 +00:00
Mark Andrews 9faf355a5c [9.18] fix: usr: Properly calculate the amount of system memory
On 32 bit machines isc_meminfo_totalphys could return an incorrect value.

Closes #4799

Backport of MR !9132

Merge branch 'backport-4799-cid-498034-overflowed-return-value-integer_overflow-9.18' into 'bind-9.18'

See merge request isc-projects/bind9!9200
2024-07-31 08:50:00 +00:00
Mark Andrews 2994d6d700 Properly compute the physical memory size
On a 32 bit machine casting to size_t can still lead to an overflow.
Cast to uint64_t.  Also detect all possible negative values for
pages and pagesize to silence warning about possible negative value.

    39#if defined(_SC_PHYS_PAGES) && defined(_SC_PAGESIZE)
    	1. tainted_data_return: Called function sysconf(_SC_PHYS_PAGES),
           and a possible return value may be less than zero.
    	2. assign: Assigning: pages = sysconf(_SC_PHYS_PAGES).
    40        long pages = sysconf(_SC_PHYS_PAGES);
    41        long pagesize = sysconf(_SC_PAGESIZE);
    42
    	3. Condition pages == -1, taking false branch.
    	4. Condition pagesize == -1, taking false branch.
    43        if (pages == -1 || pagesize == -1) {
    44                return (0);
    45        }
    46
    	5. overflow: The expression (size_t)pages * pagesize might be negative,
           but is used in a context that treats it as unsigned.

    CID 498034: (#1 of 1): Overflowed return value (INTEGER_OVERFLOW)
    6. return_overflow: (size_t)pages * pagesize, which might have underflowed,
       is returned from the function.
    47        return ((size_t)pages * pagesize);
    48#endif /* if defined(_SC_PHYS_PAGES) && defined(_SC_PAGESIZE) */

(cherry picked from commit e8dbc5db92)
2024-07-31 07:30:39 +00:00
Mark Andrews 541726871d [9.18] chg: dev: Fix data race in clean_finds_at_name
Stop updating `find.result_v4` and `find.result_v4` in `clean_finds_at_name`. The values are supposed to be		static.

Closes #4118

Backport of MR !9108

Merge branch 'backport-4118-data-race-lib-dns-adb-c-1537-in-clean_finds_at_name-9.18' into 'bind-9.18'

See merge request isc-projects/bind9!9198
2024-07-31 06:33:18 +00:00
Mark Andrews c399388a66 Do not update find.result_v4 and find.result_v6
These values are supposed to be static for the life of the find and
clean_finds_at_name was updating them resulting in TSAN error
reports.

    WARNING: ThreadSanitizer: data race
    Write of size 4 at 0x000000000001 by thread T1 (mutexes: write M1, write M2):
      #0 clean_finds_at_name lib/dns/adb.c:1537
      #1 fetch_callback lib/dns/adb.c:4009
      #2 task_run lib/isc/task.c:815
      #3 isc_task_run lib/isc/task.c:896
      #4 isc__nm_async_task netmgr/netmgr.c:848
      #5 process_netievent netmgr/netmgr.c:920
      #6 process_queue netmgr/netmgr.c:1013
      #7 process_all_queues netmgr/netmgr.c:767
      #8 async_cb netmgr/netmgr.c:796
      #9 uv__async_io /usr/src/libuv-v1.44.1/src/unix/async.c:163
      #10 isc__trampoline_run lib/isc/trampoline.c:189

    Previous read of size 4 at 0x000000000001 by thread T2:
      #0 findname lib/dns/resolver.c:3749
      #1 fctx_getaddresses lib/dns/resolver.c:3993
      #2 fctx_try lib/dns/resolver.c:4390
      #3 rctx_nextserver lib/dns/resolver.c:10356
      #4 rctx_done lib/dns/resolver.c:10503
      #5 resquery_response lib/dns/resolver.c:8511
      #6 udp_recv lib/dns/dispatch.c:638
      #7 isc__nm_async_readcb netmgr/netmgr.c:2885
      #8 isc__nm_readcb netmgr/netmgr.c:2858
      #9 udp_recv_cb netmgr/udp.c:650
      #10 isc__nm_udp_read_cb netmgr/udp.c:1057
      #11 uv__udp_recvmsg /usr/src/libuv-v1.44.1/src/unix/udp.c:303
      #12 isc__trampoline_run lib/isc/trampoline.c:189

(cherry picked from commit 53a5f50e9d)
2024-07-31 05:52:18 +00:00
Mark Andrews 90313c2c8b [9.18] fix: test: Prevent intermittent setup.sh failures in the "statschannel" system test
Don't verify the just signed zone as the RRSIGs could have expired before the signing process completes

Closes #4781 #2476

Backport of MR !9114

Merge branch 'backport-4781-statschannel-setup-can-fail-due-to-short-validity-interval-9.18' into 'bind-9.18'

See merge request isc-projects/bind9!9196
2024-07-31 05:41:40 +00:00
Mark Andrews 3af3ef53a0 Disable post zone verification for manykeys
As the expiration time is now+1 the RRSIG records may expire before
the verification step happens.

(cherry picked from commit 0d69afd764)
2024-07-31 15:04:31 +10:00
Matthijs Mekking 2107a64ee6 [9.18] fix: usr: Update key lifetime and metadata after dnssec-policy reconfig
Adjust key state and timing metadata if dnssec-policy key lifetime configuration is updated, so that it also
affects existing keys.

Closes #4677

Backport of MR !9118

Merge branch 'backport-4677-dnssec-policy-key-lifetime-reconfigure-9.18' into 'bind-9.18'

See merge request isc-projects/bind9!9192
2024-07-30 15:31:37 +00:00
Matthijs Mekking d376d314af Fix kasp system test
In 9.18, 'inline-signing yes;' must also be configured explicitly for
zones using dnssec-policy without a configured 'allow-update' or
'update-policy'.
2024-07-30 15:57:28 +02:00
Matthijs Mekking 8ec554e3de No longer update key lifetime if key is retired
The key lifetime should no longer be adjusted if the key is being
retired earlier, for example because a manual rollover was started.

This would falsely be seen as a dnssec-policy lifetime reconfiguration,
and would adjust the retire/removed time again.

This also means we should update the status output, and the next
rollover scheduled is now calculated using (retire-active) instead of
key lifetime.

(cherry picked from commit 129973ebb0)
2024-07-30 13:38:04 +02:00
Matthijs Mekking 7ab4a35820 Update key lifetime and metadata after reconfig
If dnssec-policy is reconfigured and the key lifetime has changed,
update existing keys with the new lifetime and adjust the retire
and removed timing metadata accordingly.

If the key has no lifetime yet, just initialize the lifetime. It
may be that the retire/removed timing metadata has already been set.

Skip keys which goal is not set to omnipresent. These keys are already
in the progress of retiring, or still unused.

(cherry picked from commit 1cec0b0448)
2024-07-30 13:37:50 +02:00
Matthijs Mekking 55f79b34b6 Test updating dnssec-policy key lifetime
Check if the key lifetime is updated in the key files. Make sure the
inactive and removed timing metadata are adjusted accordingly.

(cherry picked from commit 2237895bb4)
2024-07-30 10:22:53 +00:00
Matthijs Mekking 6c0380db8a Move dnssec-policy to kasp-fips.conf.in
All dnssec-policy configurations are here, so why not this one?

(cherry picked from commit 93326e3e18)
2024-07-30 10:22:53 +00:00
Matthijs Mekking 381d6246d6 [9.18] fix: usr: Fix dig +timeout argument when using +https
The +timeout argument was not used on DoH connections. This has been fixed. 

Closes #4806

Merge branch '4806-dig-https-local-timeout-ignored-9.18' into 'bind-9.18'

See merge request isc-projects/bind9!9161
2024-07-30 09:41:50 +00:00
Matthijs Mekking 1f2faa8470 Fix dig connection timeout argument when using DOH
bin/dig/dighost.c calls isc_nm_httpconnect. The timeout setting
(local_timeout) is passed as the 11th argument, but the function in
lib/isc/netmgr/http.c has the timeout argument as the 11th argument.
The 10th and 11th argument were reversed. This commit fixes that.

Thanks to Nicolas Dehaine for reporting and providing the fix.
2024-07-30 08:52:05 +00:00
Nicki Křížek 0d1962b494 [9.18] chg: test: Mark the keyfromlabel&enginepkcs11 tests as xfail
The tests currently fail on debian:bookworm due to a bug in OpenSSL 3.0.13.

Related #4814

Merge branch '4814-allow-keyfromlabel-failure' into 'bind-9.18'

See merge request isc-projects/bind9!9179
2024-07-29 19:15:09 +00:00
Nicki Křížek ff983ed647 Mark the keyfromlabel&enginepkcs11 tests as xfail
The tests currently fail on debian:bookworm due to a bug in OpenSSL
3.0.13.
2024-07-29 16:55:01 +02:00
Nicki Křížek d40f9c1f74 [9.18] chg: test: Retry job in case of AWS Spot Instance interruption event
Closes #4777

Backport of MR !9107

Merge branch '4777-retry-job-aws-spot-instance-interruption-event-9.18' into 'bind-9.18'

See merge request isc-projects/bind9!9185
2024-07-29 14:52:43 +00:00
Emanuel PetrandNicki Křížek ec1a6e1339 Retry job in case of AWS Spot Instance interruption
(cherry picked from commit bbcce1bfc1)
2024-07-29 13:26:54 +00:00
Nicki Křížek 21a0b6aef7 [9.18] new: dev: generate changelog from git log
Use a single source of truth, the git log, to generate the list of CHANGES. Use the .rst format and include it in the ARM for a quick reference with proper gitlab links to issues and merge requests.

Closes #75

Backport of MR !9152

Merge branch 'nicki/add-gitchangelog-9.18' into 'bind-9.18'

See merge request isc-projects/bind9!9181
2024-07-29 13:25:27 +00:00
Nicki Křížek 1efeb8ecae Update docs and processes to use the new changelog
(cherry picked from commit bcc99213a5)
2024-07-29 14:50:39 +02:00
Nicki Křížek b2116ce43f Update dangerfile for new changelog workflow
(cherry picked from commit 91be111dc7)
2024-07-29 14:49:59 +02:00
Nicki Křížek 162be86a7c Skip pylint checks for contrib directory
The files in contrib/ directory shouldn't be subject to our pylint
check. They can come from external sources and we don't subject these to
the same standards as the rest of the BIND9 code / scripts.

(cherry picked from commit 7cbb052649)
2024-07-29 14:49:59 +02:00
Nicki Křížek 1661126532 Remove changes job and related scripts
These are no longer needed, since changelog is generated using
gitchangelog.

(cherry picked from commit 3f1a843695)
2024-07-29 14:49:56 +02:00
Nicki Křížek a88a5e2ad5 Add BIND9 configuration for gitchangelog
The configuration has been crafted to cater for BIND9 needs:
- Define actions that have an equivalent section in existing Release
  Notes
- Assume the commits that have the necessary changelog makrup are merge
  commits from GitLab and transform them into messages and proper links
- Put the resulting changelog into the proper place in
  doc/arm/changelog.rst
- Have a separate configuration for changelog and release notes. Both of
  these should be generated from the `git log`, with release notes being
  subject to more scrutiny and further editing

(cherry picked from commit 0ec8b99ea3)
2024-07-29 14:49:13 +02:00
Nicki Křížek 976ebffca5 Add new changelog file
Create new changelog and include it in the documentation. Include the
previous CHANGES as plain text without any markup.

(cherry picked from commit e9b6031e0c)
2024-07-29 14:49:09 +02:00
Nicki Křížek 84a3d8ca83 Address gitchangelog deprecation warning
(cherry picked from commit 951280bca5)
2024-07-29 12:34:08 +00:00
Nicki Křížek 3fe001ae2a Adjust gitchangelog whitespace
Format the output to produce a nicer looking rst output, similar to the
former CHANGES file.

(cherry picked from commit 1c95eeeb3f)
2024-07-29 12:34:08 +00:00
Nicki Křížek 915c2a960a Allow gitchangelog to include commit sha
Add an option which can be used to put short commit sha at the end of
each commit subject line in the generated changelog.

(cherry picked from commit c2b23fa2de)
2024-07-29 12:34:08 +00:00
Nicki Křížek 2bd901a699 Remove authors from gitchangelog output
Given our workflow, this could easily lead to misattribution. It's also
not an actionable information and it can be found in the MR / git log
instead.

(cherry picked from commit a8258d1c53)
2024-07-29 12:34:08 +00:00
Nicki Křížek ed4eb0c368 Reformat gitchangelog with black
(cherry picked from commit 9f90c1c65e)
2024-07-29 12:34:08 +00:00
Nicki Křížek e99549f6c7 Import gitchanglog 3.0.4
The  project hasn't seen any new development/changes since 2018 and it
seems unlikely we'd be able to get any changes into the upstream. Since
it's isolated into a single file and its task is fairly straighforward,
pull the code into our own repository and maintain it here as needed.

This also makes it easier to make any changes that are specific to our
project.

(cherry picked from commit 63247d8a73)
2024-07-29 12:34:07 +00:00
Nicki Křížek 3f26ac2a4d Merge tag 'v9.18.28' into bind-9.18 2024-07-23 16:10:41 +02:00
Nicki Křížek 356ab4ea24 Set up version and release notes for BIND 9.18.29
Merge branch 'nicki/set-up-version-and-release-notes-for-bind-9.18.29' into 'bind-9.18'

See merge request isc-projects/bind9!9162
2024-07-23 14:04:16 +00:00
Nicki Křížek 7c36c2d6a2 Set up release notes for BIND 9.18.29 2024-07-23 16:01:57 +02:00
Nicki Křížek 5afbbdfb6c Update BIND version to 9.18.29-dev 2024-07-23 16:01:57 +02:00
Nicki Křížek f77fadbf59 Update BIND version for release 2024-07-08 15:34:41 +02:00
Nicki Křížek 353bbfd03c Add a CHANGES marker 2024-07-08 15:34:33 +02:00
Michal NowakandNicki Křížek 0077cfd7a6 Refresh base image repos before installing from them
Stale repositories cause issue on installation in the docs:pdf CI job:

    E: Failed to fetch http://deb.debian.org/debian/pool/main/s/systemd/libsystemd-shared_252.22-1%7edeb12u1_amd64.deb  404  Not Found [IP: 2a04:4e42:78::644 80]
    E: Unable to fetch some archives, maybe run apt-get update or try with --fix-missing?

(cherry picked from commit 211a514dbd5d122a37ddb29f6db63edc86af73b7)
2024-07-08 15:34:10 +02:00
Nicki Křížek df02a1313b Merge branch 'nicki/prepare-documentation-for-bind-9.18.28' into 'v9.18.28-release'
Prepare documentation for BIND 9.18.28

See merge request isc-private/bind9!707
2024-07-08 13:11:44 +00:00
Nicki Křížek a4461699e2 Extend max-types-per-name documentation 2024-07-08 13:56:39 +02:00
Nicki Křížek 750d72c978 Move [GL #4473] to security fixes 2024-07-08 13:56:39 +02:00
Nicki Křížek d9dbb0d104 Tweak and reword release notes 2024-07-08 13:56:39 +02:00
Nicki Křížek 922f98a330 Add release note for [GL #4708] 2024-07-08 13:56:39 +02:00
Nicki Křížek 099e0fb0a3 Add release note for [GL #4736] 2024-07-08 13:56:39 +02:00
Nicki Křížek fdad7bb84b Add release note for [GL #3472] 2024-07-08 13:56:39 +02:00
Nicki Křížek 6c12c81266 Prepare release notes for BIND 9.18.28 2024-07-08 13:56:38 +02:00
Nicki Křížek 4fd679054f Use a dedicated CHANGES entry for SIG(0) removal
As opposed to the main branch (where the SIG(0) was changed), it has
been removed from the maintenance branches. Use a different changes
number to indicate there was a different solution of the issue.
2024-07-08 13:56:37 +02:00
Nicki Křížek ec3e15da3a Merge branch 'tcp-reset-connection-on-failed-send-9.18' into 'v9.18.28-release'
[9.18][CVE-2024-0760 (part 3)] Reset the TCP connection on a failed send

See merge request isc-private/bind9!722
2024-07-03 15:51:09 +00:00
Artem BoldarievandOndřej Surý c33b3d26f6 TCP/TLS DNS: unthrottle only when all input data processing
This commit ensures that we restart reading only when all DNS data in
the input buffer is processed so the we will not get into the
situation when the buffer is overrun.
2024-07-03 15:08:01 +02:00
Ondřej Surý e31190e704 Reset the TCP connection on a failed send
When sending fails, the ns__client_request() would not reset the
connection and continue as nothing is happening.  This comes from the
model that we don't care about failed UDP sends because datagrams are
unreliable anyway, but it greatly affects TCP connections with
keep-alive.

The worst case scenario is as follows:

1. the 3-way TCP handshake gets completed
2. the libuv calls the "uv_connection_cb" callback
3. the TCP connection gets queue because of the tcp-clients quota
4. the TCP client sends as many DNS messages as the buffers allow
5. the TCP connection gets dropped by the client due to the timeout
6. the TCP connection gets accepted by the server
7. the data already sent by the client gets read
8. all sending fails immediately because the TCP connection is dead
9. we consume all the data in the buffer in a very tight loop

As it doesn't make sense to trying to process more data on the TCP
connection when the sending is failing, drop the connection immediately
on the first sending error.

(cherry picked from commit bf9fd2a6ff)
2024-07-03 09:10:30 +02:00
Ondřej Surý 4b7c61381f Throttle the reading when writes are asynchronous
Be more aggressive when throttling the reading - when we can't send the
outgoing TCP synchronously with uv_try_write(), we start throttling the
reading immediately instead of waiting for the send buffers to fill up.

This should not affect behaved clients that read the data from the TCP
on the other end.

(cherry picked from commit bc3e713317)
2024-07-03 09:10:20 +02:00
Nicki Křížek 050a88898a Merge branch '3405-security-limit-the-number-of-resource-records-in-rrset-nxdomain-9.18' into 'v9.18.28-release'
[9.18][CVE-2024-1737 (part 2)] Be smarter about refusing to add many RR types to the database

See merge request isc-private/bind9!713
2024-07-02 11:05:57 +00:00
Ondřej Surý 8979166d35 Add more tests for adding many RR types to the database
More reclimit tests that test various scenarios adding combinations of
priority and non-priority RR types into the database.
2024-07-01 15:04:43 +02:00
Ondřej Surý 7f99d7e565 Be smarter about refusing to add many RR types to the database
Instead of outright refusing to add new RR types to the cache, be a bit
smarter:

1. If the new header type is in our priority list, we always add either
   positive or negative entry at the beginning of the list.

2. If the new header type is negative entry, and we are over the limit,
   we mark it as ancient immediately, so it gets evicted from the cache
   as soon as possible.

3. Otherwise add the new header after the priority headers (or at the
   head of the list).

4. If we are over the limit, evict the last entry on the normal header
   list.

(cherry picked from commit 57cd34441a)
2024-07-01 15:04:43 +02:00
Ondřej Surý 90c7c8078b Make the resolver qtype ANY test order agnostic
Instead of relying on a specific order of the RR types in the databases
pick the first RR type as returned from the cache.

(cherry picked from commit 58f660cf2b)
2024-07-01 13:15:04 +02:00
Ondřej Surý c2650f5331 Expand the list of the priority types
Add HTTPS, SVCB, SRV, PTR, NAPTR, DNSKEY and TXT records to the list of
the priority types that are put at the beginning of the slabheader list
for faster access and to avoid eviction when there are more types than
the max-types-per-name limit.

(cherry picked from commit b27c6bcce8)
2024-07-01 13:14:57 +02:00
Nicki Křížek 90be23f030 Merge branch 'tcp-do-not-unthrottle-on_isc_nm_read-v9.18' into 'v9.18.28-release'
[9.18][CVE-2024-0760 (part 2)] Do not un-throttle TCP connections on isc_nm_read(), add throttling to TLS DNS

See merge request isc-private/bind9!709
2024-06-25 08:48:37 +00:00
Artem Boldariev d4b1f7f239 Use smaller pools of requests and handles for sockets
This commit ensures that socket objects use smaller sizes for its
internal requests and handles pools. That prevents a memory allocator
from thrashing.
2024-06-18 17:54:17 +03:00
Artem Boldariev 16c1d1eb2e Avoid indefinite send re-scheduling in TLS DNS
When a peer is not reading the data we are sending it was for the TLS
DNS code to end up in a situation when it would indefinitely
reschedule send requests, effectively turning the 'uv_loop' into a
busy loop that would consume CPU cycles in endless efforts to send
outgoing data.

The main reason for that was only one send buffer dedicated for sends:
the code would re-queue sends until it is empty - that would never
happen when the remote side is not reading data.

That seems like an omission from the older day of the Network Manager
as it is quiet simple to make the code use multiple buffers for
sends. That ultimately breaks the cycle of futile send request
rescheduling.

As a side effect, this commit also gets rid of one memory copying on a
hot path.
2024-06-18 11:58:59 +03:00
Artem Boldariev c71a61c44b Introduce TCP throttling into TLS DNS code
Throttling functionality was omitted from the
c6f13f12cd. This commit fixes that,
taking into account the latest developments in this area.
2024-06-18 11:58:59 +03:00
Artem Boldariev eb4678e0b8 Do not un-throttle TCP connections on isc_nm_read()
Due to omission it was possible to un-throttle a TCP connection
previously throttled due to the peer not reading back data we are
sending.

In particular, that affected DoH code, but it could also affect other
transports (the current or future ones) that pause/resume reading
according to its internal state.

(cherry picked from commit d228aa8bbb944fbd04baf22d151fde5c33561e26)
2024-06-18 11:58:59 +03:00
Nicki Křížek 5b83419fa9 Merge branch '4507-confidential-clear-zversion-v9_18' into 'v9.18.28-release'
[9.18] [CVE-2024-4076] serve-stale zversion crash

See merge request isc-private/bind9!687
2024-06-10 17:27:54 +00:00
Matthijs MekkingandNicki Křížek acfb8508a8 Add release note for [GL #4507]
(cherry picked from commit 454f245a7047571afdfda62978ea75dda119a712)
2024-06-10 19:25:15 +02:00
Mark AndrewsandNicki Křížek 7d3042c384 Add CHANGES note for [GL #4507]
(cherry picked from commit 09ff8b1169f8be6867c0b2004d0369d246ad2994)
2024-06-10 19:24:39 +02:00
Mark AndrewsandNicki Křížek 9cfd20cd90 Clear qctx->zversion
Clear qctx->zversion when clearing qctx->zrdataset et al in
lib/ns/query.c:qctx_freedata.  The uncleared pointer could lead to
an assertion failure if zone data needed to be re-saved which could
happen with stale data support enabled.

(cherry picked from commit 179fb3532ab8d4898ab070b2db54c0ce872ef709)
2024-06-10 19:20:06 +02:00
Nicki Křížek 1e6cf868dd Merge branch 'security-4480-drop-sig0-support' into 'v9.18.28-release'
[9.18] [CVE-2024-1975] Remove support for SIG(0) message verification

See merge request isc-private/bind9!690
2024-06-10 17:17:52 +00:00
Petr ŠpačekandNicki Křížek 5aef5f1fb9 Add release note for GL #4480 2024-06-10 19:08:50 +02:00
Petr ŠpačekandNicki Křížek 8acd71b9cc Add CHANGES note for [GL #4480] 2024-06-10 19:07:00 +02:00
Aram SargsyanandNicki Křížek 227f9aa064 Adapt the upforwd test to the SIG(0) removal
Change the check so that update with SIG(0) is expected to fail.
2024-06-10 19:02:52 +02:00
Petr ŠpačekandNicki Křížek 02dffb63a8 Adapt the tsiggss test to the SIG(0) removal
Test that SIG(0) signer is NOT sent to the external socket for
authorization. It MUST NOT be considered a valid signature by
any chance.

Also check that the signer's name does not appear in authsock.pl
output.
2024-06-10 19:02:52 +02:00
Aram SargsyanandNicki Křížek 4b1f026ad9 Enable stdout autoflush in authsock.pl
With enabled buffering the output gets lost when the process
receives a TERM signal. Disable the buffering.
2024-06-10 19:02:52 +02:00
Petr ŠpačekandNicki Křížek 33007e302d Document SIG(0) verification removal 2024-06-10 19:02:51 +02:00
Petr ŠpačekandNicki Křížek bef3d2cca3 Remove support for SIG(0) message verification 2024-06-10 19:02:49 +02:00
Nicki Křížek 5220f4c977 Merge branch '3405-security-limit-the-number-of-resource-records-in-rrset-9.18' into 'v9.18.28-release'
[9.18] Add a limit to the number of RRs in RRSets

See merge request isc-private/bind9!697
2024-06-10 16:56:11 +00:00
Matthijs MekkingandNicki Křížek a97f52263b Log rekey failure as error if too many records
By default we log a rekey failure on debug level. We should probably
change the log level to error. We make an exception for when the zone
is not loaded yet, it often happens at startup that a rekey is
run before the zone is fully loaded.

(cherry picked from commit 68b840c731527e01699afaf084559152124b717a)
2024-06-10 18:51:28 +02:00
Matthijs MekkingandNicki Křížek 7bb36ae56e Log error when update fails
The new "too many records" error can make an update fail without the
error being logged. This commit fixes that.

(cherry picked from commit 558923e5405894cf976d102f0d246a28bdbb400c)
2024-06-10 18:51:28 +02:00
Evan HuntandNicki Křížek b89e516420 fix a memory leak that could occur when signing
when signatures were not added because of too many types already
existing at a node, the diff was not being cleaned up; this led to
a memory leak being reported at shutdown.

(cherry picked from commit 2825bdb1ae5be801e7ed603ba2455ed9a308f1f7)
2024-06-10 18:51:27 +02:00
Matthijs MekkingandNicki Křížek 2f5c670ce9 Add new test cases with DNSSEC signing
kasp-max-types-per-name (named2.conf.in):
An unsigned zone with RR type count on a name right below the
configured limit. Then sign the zone using KASP. Adding a RRSIG would
push it over the RR type limit per name. Signing should fail, but
the server should not crash, nor end up in infinite resign-attempt loop.

kasp-max-records-per-type-dnskey (named1.conf.in):
Test with low max-record-per-rrset limit and a DNSSEC policy requiring
more than the limit. Signing should fail.

kasp-max-types-per-name (named1.conf.in):
Each RRSIG(covered type) is counted as an individual RR type. Test the
corner case where a signed zone, which is just below the limit-1,
adds a new type - doing so would trigger signing for the new type and
thus increase the number of "types" by 2, pushing it over the limit
again.

(cherry picked from commit 14e5230f897a178221b606c242b8fbcb357704aa)
2024-06-10 18:51:27 +02:00
Matthijs MekkingandNicki Křížek 4a0118c16e Check if restart works
(cherry picked from commit 4e69ece8f27f3623a4c7a9100477a5547b94c311)
2024-06-10 18:51:27 +02:00
Matthijs MekkingandNicki Křížek 6fe1df142b Switch to inline-signing no
(cherry picked from commit 0949221c07fe102ca608899b21f1f5ac5e271953)
2024-06-10 18:51:27 +02:00
Matthijs MekkingandNicki Křížek 270512949e Add test cases that use DNSSEC signing
Add two new masterformat tests that use signing. In the case of
'under-limit-kasp', the signing will keep the number of records in the
RRset under the limit. In the case of 'on-limit-kasp', the signing
will push the number of records in the RRset over the limit, because
of the added RRSIG record.

(cherry picked from commit 4c677882e66883670990a771337ecbb5206a6faa)
2024-06-10 18:51:27 +02:00
Petr ŠpačekandNicki Křížek 5067ab6120 Remove duplicated empty zone files
(cherry picked from commit 1456b4fc7778b851256107dbc79fb67d45f752f5)
2024-06-10 18:51:26 +02:00
Petr ŠpačekandNicki Křížek aa2a1ab919 masterformat: rename zone names to reflect intended meaning
(cherry picked from commit d34bfb1eeaa2f8faab80b1620b992b5495e6f88c)
2024-06-10 18:51:26 +02:00
Petr ŠpačekandNicki Křížek e38a92cef8 Test owner name rename: a b c d e -> <number>-txt
(cherry picked from commit 6ce03f75d1935c2e1991e9c0a01c49b0099a58cb)
2024-06-10 18:51:26 +02:00
Petr ŠpačekandNicki Křížek 1a8ea606d9 Test variable rename i->_attempt
(cherry picked from commit 13417eb277cc8a30ee4ddbb6fc02442b0d8e6d3c)
2024-06-10 18:51:26 +02:00
Petr ŠpačekandNicki Křížek ac39dcb397 Test variable rename a->rrcount
(cherry picked from commit 338b45ae713cded921fd3e5494ca38bd59ff9ee8)
2024-06-10 18:51:26 +02:00
Evan HuntandNicki Křížek cdff65122e Add CHANGES and release note for [GL #3403]
(cherry picked from commit 54bcbe9a2af6332ce8ffb7190edf40533404c93d)
2024-06-10 18:51:23 +02:00
Ondřej SurýandNicki Křížek 4bdd1bf4f3 Add test for not-loading many RRsets per name on a secondary
This tests makes sure the zone with many RRsets per name is not loaded
via XFR on the secondary server.

(cherry picked from commit 4cfeed912a5e7440f04cb088a461ff47305da2e7)
2024-06-10 18:50:06 +02:00
Ondřej SurýandNicki Křížek 19dc77ac48 Add a test for not caching large number of RRsets
Send a recursive query for a large number of RRsets, which should
fail when using the default max-types-per-name setting of 100, but
succeed when the cap is disabled.

(cherry picked from commit 7e4530f847c8dc541c5e5bf9f790deed520aaa16)
2024-06-10 18:50:06 +02:00
Ondřej SurýandNicki Křížek 39d3e2a8ec Add a limit to the number of RR types for single name
Previously, the number of RR types for a single owner name was limited
only by the maximum number of the types (64k).  As the data structure
that holds the RR types for the database node is just a linked list, and
there are places where we just walk through the whole list (again and
again), adding a large number of RR types for a single owner named with
would slow down processing of such name (database node).

Add a configurable limit to cap the number of the RR types for a single
owner.  This is enforced at the database (rbtdb, qpzone, qpcache) level
and configured with new max-types-per-name configuration option that
can be configured globally, per-view and per-zone.

(cherry picked from commit 00d16211d6368b99f070c1182d8c76b3798ca1db)
2024-06-10 18:50:06 +02:00
Evan HuntandNicki Křížek 197b08009d Add a test for not caching large RRset
Send a recursive query for a large (2500 record) RRset, which should
fail when using the default max-records-per-type setting of 100, but
succeed when the cap is disabled.

(cherry picked from commit 8e3efb4e06ba68cc3f9bc5be2bacb2596bd74cb3)
2024-06-10 18:50:06 +02:00
Ondřej SurýandNicki Křížek b77606d167 Add test for not-loading and not-transfering huge RRSets
Add two new masterformat tests - the 'huge' zone fits within the ns1
limit and loads on the primary ns1 server, but must not transfer to the
ns2 secondary, and the 'uber' zone should not even load on the primary
ns1 server.

(cherry picked from commit cee9ad81db6e5a1167b311e5c2f42cf65ba457cd)
2024-06-10 18:50:05 +02:00
Ondřej SurýandNicki Křížek e699ef939e Add a limit to the number of RRs in RRSets
Previously, the number of RRs in the RRSets were internally unlimited.
As the data structure that holds the RRs is just a linked list, and
there are places where we just walk through all of the RRs, adding an
RRSet with huge number of RRs inside would slow down processing of said
RRSets.

Add a configurable limit to cap the number of the RRs in a single RRSet.
This is enforced at the database (rbtdb, qpzone, qpcache) level and
configured with new max-records-per-type configuration option that can
be configured globally, per-view and per-zone.

(cherry picked from commit 3fbd21f69a1bcbd26c4c00920e7b0a419e8762fc)
2024-06-10 18:50:03 +02:00
Nicki Křížek 3492c0deda Merge branch '4481-security-tcp-flood-9.18' into 'v9.18.28-release'
[9.18] [CVE-2024-0760] Throttle reading from TCP if the sends are not getting through

See merge request isc-private/bind9!641
2024-06-10 16:47:06 +00:00
Ondřej SurýandNicki Křížek 41eb89503c Add CHANGES and release note for [GL #4481]
(cherry picked from commit 3e4babc58e1ed169a25ae9083f8f3c7d3e8389a3)
2024-06-10 18:44:52 +02:00
Ondřej SurýandNicki Křížek 964891a794 Limit the number of DNS message processed from a single TCP read
The single TCP read can create as much as 64k divided by the minimum
size of the DNS message.  This can clog the processing thread and trash
the memory allocator because we need to do as much as ~20k allocations in
a single UV loop tick.

Limit the number of the DNS messages processed in a single UV loop tick
to just single DNS message and limit the number of the outstanding DNS
messages back to 23.  This effectively limits the number of pipelined
DNS messages to that number (this is the limit we already had before).

This reverts commit 780a89012d.
2024-06-10 18:43:46 +02:00
Ondřej SurýandNicki Křížek 0b1d70ed2a Remove the extra memory context with own arena for sending
(cherry picked from commit 8d4cc41c291f8a77a723ae8e62533538b3632d50)
2024-06-10 18:43:46 +02:00
Ondřej SurýandNicki Křížek 3f6b7f57a6 Replace the tcp_buffers memory pool with static per-loop buffer
As a single thread can process only one TCP send at the time, we don't
really need a memory pool for the TCP buffers, but it's enough to have
a single per-loop (client manager) static buffer that's being used to
assemble the DNS message and then it gets copied into own sending
buffer.

In the future, this should get optimized by exposing the uv_try API
from the network manager, and first try to send the message directly
and allocate the sending buffer only if we need to send the data
asynchronously.

(cherry picked from commit 297cc840fbaf34b9dfa1d02d88a023cd5bf5dc4a)
2024-06-10 18:43:46 +02:00
Aram SargsyanandNicki Křížek 4e70342142 ns_client: reuse TCP send buffers
Constantly allocating, reallocating and deallocating 64K TCP send
buffers by 'ns_client' instances takes too much CPU time.

There is an existing mechanism to reuse the ns_clent_t structure
associated with the handle using 'isc_nmhandle_getdata/_setdata'
(see ns_client_request()), but it doesn't work with TCP, because
every time ns_client_request() is called it gets a new handle even
for the same TCP connection, see the comments in
streamdns_on_complete_dnsmessage().

To solve the problem, we introduce an array of available (unused)
TCP buffers stored in ns_clientmgr_t structure so that a 'client'
working via TCP can have a chance to reuse one (if there is one)
instead of allocating a new one every time.
2024-06-10 18:43:45 +02:00
Ondřej SurýandNicki Křížek c6f13f12cd Throttle reading from TCP if the sends are not getting through
When TCP client would not read the DNS message sent to them, the TCP
sends inside named would accumulate and cause degradation of the
service.  Throttle the reading from the TCP socket when we accumulate
enough DNS data to be sent.  Currently this is limited in a way that a
single largest possible DNS message can fit into the buffer.

(cherry picked from commit 26006f7b44474819fac2a76dc6cd6f69f0d76828)
2024-06-10 18:43:44 +02:00
Nicki Křížek 139ff18da9 Merge branch '4473-fix-doh-intermittent-crash-v9.18' into 'v9.18.28-release'
[9.18] DoH: Avoid potential data races in our DoH implementation related to to HTTP/2 session object management and endpoints set object management

See merge request isc-private/bind9!701
2024-06-10 16:41:28 +00:00
Artem BoldarievandNicki Křížek a98607d2ce Modify release notes [GL #4473]
Mention that an intermittent BIND process termination in DoH code has
been fixed.
2024-06-10 18:37:56 +02:00
Artem BoldarievandNicki Křížek 8132f4c020 Modify CHANGES [GL #4473]
Mention that an intermittent BIND process termination in DoH code has
been fixed.

(cherry picked from commit 773a8108f307b4f6cc7776050d85432295b13a4d)
2024-06-10 18:36:17 +02:00
Artem BoldarievandNicki Křížek 998522e68e Keep the endpoints set reference within an HTTP/2 socket
This commit ensures that an HTTP endpoints set reference is stored in
a socket object associated with an HTTP/2 stream instead of
referencing the global set stored inside a listener.

This helps to prevent an issue like follows:

1. BIND is configured to serve DoH clients;
2. A client is connected and one or more HTTP/2 stream is
created. Internal pointers are now pointing to the data on the
associated HTTP endpoints set;
3. BIND is reconfigured - the new endpoints set object is created and
promoted to all listeners;
4. The old pointers to the HTTP endpoints set data are now invalid.

Instead referencing a global object that is updated on
re-configurations we now store a local reference which prevents the
endpoints set objects to go out of scope prematurely.

(cherry picked from commit b9b5d0c01a3a546c4a6a8b3bff8ae9dd31fee224)
2024-06-10 18:35:18 +02:00
Artem BoldarievandNicki Křížek b601a5b781 DoH: avoid potential use after free for HTTP/2 session objects
It was reported that HTTP/2 session might get closed or even deleted
before all async. processing has been completed.

This commit addresses that: now we are avoiding using the object when
we do not need it or specifically check if the pointers used are not
'NULL' and by ensuring that there is at least one reference to the
session object while we are doing incoming data processing.

This commit makes the code more resilient to such issues in the
future.

(cherry picked from commit 0cca550dff403c6100b7c0da8f252e7967765ba7)
2024-06-10 18:35:16 +02:00
Nicki Křížek 3be849bfab Merge branch '4661-confidential-clear-dns-fetchopt-trystale-ontimeout' into 'v9.18.28-release'
Prevent passing DNS_EVENT_TRYSTALE events to resume_dslookup()

See merge request isc-private/bind9!678
2024-06-10 16:34:02 +00:00
Mark AndrewsandNicki Křížek 6c740fa78b Add release note for [GL #4661] 2024-06-10 18:28:53 +02:00
Mark AndrewsandNicki Křížek dbc06313a6 Add CHANGES not for [GL #4661] 2024-06-10 18:28:44 +02:00
Mark AndrewsandMichał Kępień 6455527830 Clear DNS_FETCHOPT_TRYSTALE_ONTIMEOUT
When calling dns_resolver_createfetch in resolver.c with a callback
of resume_dslookup, clear DNS_FETCHOPT_TRYSTALE_ONTIMEOUT from
options as DNS_EVENT_TRYSTALE is not an expected event type and
triggers a REQUIRE.
2024-06-06 07:48:49 +02:00
345 changed files with 33880 additions and 23998 deletions
+4
View File
@@ -22,3 +22,7 @@ b8b9b4ac2c0ae88de85f4d83982edb97694959d7
6a85e79c0b349003449f9c9a64eba74a97653826
# Reformat sources with up-to-date clang-format-18
26b6ce9a569105df86911160ca9cb686b230c49a
# Reformat sources with up-to-date clang-format-19
fe8d6023e05416ba5c030bb65878a24a57aa16cb
# Reformat sources with up-to-date clang-format-19
50221d6ff1ebfbd7bc97d11a17d12f0a5926d18a
+1
View File
@@ -0,0 +1 @@
contrib/gitchangelog/changelog.rc.py
+127 -115
View File
@@ -15,7 +15,7 @@ variables:
TEST_PARALLEL_JOBS: 4
CONFIGURE: ./configure
CLANG_VERSION: 18
CLANG_VERSION: 19
CLANG: "clang-${CLANG_VERSION}"
SCAN_BUILD: "scan-build-${CLANG_VERSION}"
LLVM_SYMBOLIZER: "/usr/lib/llvm-${CLANG_VERSION}/bin/llvm-symbolizer"
@@ -55,6 +55,8 @@ variables:
BIND_STRESS_TEST_OS: linux
BIND_STRESS_TEST_ARCH: amd64
HYPOTHESIS_PROFILE: "ci"
default:
# Allow all running CI jobs to be automatically canceled when a new
# version of a branch is pushed.
@@ -62,6 +64,13 @@ default:
# See: https://docs.gitlab.com/ee/ci/pipelines/settings.html#auto-cancel-redundant-pipelines
interruptible: true
# AWS can interrupt the spot instance anytime, so let's retry the job when
# the interruption event happens to avoid a pipeline failure.
retry:
max: 2
when:
- runner_system_failure
stages:
- autoconf
- precheck
@@ -120,10 +129,6 @@ stages:
# Oracle Linux
.oraclelinux-7-amd64: &oraclelinux_7_amd64_image
image: "$CI_REGISTRY_IMAGE:oraclelinux-7-amd64"
<<: *linux_amd64
.oraclelinux-8-amd64: &oraclelinux_8_amd64_image
image: "$CI_REGISTRY_IMAGE:oraclelinux-8-amd64"
<<: *linux_amd64
@@ -134,10 +139,6 @@ stages:
# Debian
.debian-bullseye-amd64: &debian_bullseye_amd64_image
image: "$CI_REGISTRY_IMAGE:debian-bullseye-amd64"
<<: *linux_amd64
.debian-bookworm-amd64: &debian_bookworm_amd64_image
image: "$CI_REGISTRY_IMAGE:debian-bookworm-amd64"
<<: *linux_amd64
@@ -201,7 +202,7 @@ stages:
<<: *libvirt_amd64
.freebsd-14-amd64: &freebsd_14_amd64_image
image: "freebsd-14.0-x86_64"
image: "freebsd-14.1-x86_64"
<<: *libvirt_amd64
.openbsd-amd64: &openbsd_amd64_image
@@ -353,6 +354,7 @@ stages:
needs:
- job: ci-variables
artifacts: true
timeout: 2h
.system_test_common: &system_test_common
<<: *default_triggering_rules
@@ -520,18 +522,6 @@ misc:
- checklibs.out
when: on_failure
changes:
<<: *precheck_job
except:
- pipelines
script:
- sh util/tabify-changes < CHANGES > CHANGES.tmp
- diff -urNap CHANGES CHANGES.tmp
- perl util/check-changes CHANGES
- sh util/check-line-length.sh CHANGES
- rm CHANGES.tmp
needs: []
black:
<<: *precheck_job
needs: []
@@ -545,6 +535,12 @@ black:
expire_in: "1 week"
when: on_failure
vulture:
<<: *precheck_job
needs: []
script:
- vulture --exclude "*/ans*/ans.py,conftest.py,get_algorithms.py,isctest" --ignore-names "pytestmark" bin/tests/system/
ci-variables:
stage: precheck
<<: *precheck_job
@@ -588,7 +584,7 @@ pylint:
variables:
PYTHONPATH: "${CI_PROJECT_DIR}/bin/tests/system"
script:
- pylint --rcfile $CI_PROJECT_DIR/.pylintrc $(git ls-files '*.py' | grep -vE '(ans\.py|dangerfile\.py|^bin/tests/system/)')
- pylint --rcfile $CI_PROJECT_DIR/.pylintrc $(git ls-files '*.py' | grep -vE '(ans\.py|dangerfile\.py|^bin/tests/system/|^contrib/)')
# Ignore Pylint wrong-import-position error in system test to enable use of pytest.importorskip
- pylint --rcfile $CI_PROJECT_DIR/.pylintrc --disable=wrong-import-position $(git ls-files 'bin/tests/system/*.py' | grep -vE 'ans\.py')
@@ -663,6 +659,28 @@ tarball-create:
# Jobs for doc builds on Debian 12 "bookworm" (amd64)
changelog:
<<: *base_image
<<: *docs_job
rules:
- if: '$CI_MERGE_REQUEST_TITLE =~ /\s(dev|usr|pkg):/'
variables:
GIT_AUTHOR_NAME: $GITLAB_USER_NAME
GIT_AUTHOR_EMAIL: $GITLAB_USER_EMAIL
GIT_COMMITTER_NAME: $GITLAB_USER_NAME
GIT_COMMITTER_EMAIL: $GITLAB_USER_EMAIL
before_script:
- echo -e "$CI_MERGE_REQUEST_TITLE\n" > commitmsg
- sed -i 's/^Draft:\s*//' commitmsg
- echo -e "$CI_MERGE_REQUEST_DESCRIPTION" >> commitmsg
- git commit --allow-empty -F commitmsg
- ./contrib/gitchangelog/gitchangelog.py HEAD^..HEAD
needs:
- job: autoreconf
artifacts: true
artifacts:
untracked: true
docs:
<<: *default_triggering_rules
<<: *base_image
@@ -688,6 +706,7 @@ docs:pdf:
<<: *base_image
stage: docs
before_script:
- apt-get update
- apt-get -y install qpdf texlive-full texlive-xetex xindy
script:
- *configure
@@ -721,6 +740,10 @@ cross-version-config-tests:
- *configure
- make -j${BUILD_PARALLEL_JOBS:-1}
- *find_pytest
# The cross-version-config-tests job would fail when a system test is
# removed from the upcoming release. To avoid this, remove the system test
# also from the $BIND_BASELINE_VERSION.
- find bin/tests/system/ -mindepth 1 -maxdepth 1 -type d -exec sh -c 'test -e ../"$0" || rm -rfv -- "$0"' {} \;
- cd bin/tests/system
# Run the setup phase of all system tests in the most recently tagged BIND 9
# release using the binaries built for the current BIND 9 version. This
@@ -767,31 +790,6 @@ unit:gcc:alpine3.20:amd64:
- job: gcc:alpine3.20:amd64
artifacts: true
# Jobs for regular GCC builds on Oracle Linux 7 (amd64)
gcc:oraclelinux7:amd64:
variables:
CC: gcc
CFLAGS: "${CFLAGS_COMMON}"
EXTRA_CONFIGURE: "--with-libidn2"
<<: *oraclelinux_7_amd64_image
<<: *build_job
system:gcc:oraclelinux7:amd64:
<<: *oraclelinux_7_amd64_image
<<: *system_test_job
<<: *system_test_legacy
needs:
- job: gcc:oraclelinux7:amd64
artifacts: true
unit:gcc:oraclelinux7:amd64:
<<: *oraclelinux_7_amd64_image
<<: *unit_test_job
needs:
- job: gcc:oraclelinux7:amd64
artifacts: true
# Jobs for regular GCC builds on Oracle Linux 8 (amd64)
gcc:oraclelinux8:amd64:
@@ -1184,9 +1182,11 @@ unit:clang:asan:
gcc:tsan:
variables:
CC: gcc
CFLAGS: "${CFLAGS_COMMON} -fsanitize=thread"
CFLAGS: "${CFLAGS_COMMON} -Wno-stringop-overread -ggdb -O2 -fsanitize=thread"
LDFLAGS: "-fsanitize=thread"
EXTRA_CONFIGURE: "--with-libidn2 --enable-pthread-rwlock --without-jemalloc"
OPENSSL_CFLAGS: -I/opt/tsan/include
OPENSSL_LIBS: -L/opt/tsan/lib -lssl -lcrypto
EXTRA_CONFIGURE: "--with-libidn2 --enable-pthread-rwlock --without-jemalloc PKG_CONFIG_PATH=/opt/tsan/lib/pkgconfig"
<<: *tsan_fedora_40_amd64_image
<<: *build_job
@@ -1213,9 +1213,11 @@ clang:tsan:
<<: *build_job
variables:
CC: "${CLANG}"
CFLAGS: "${CFLAGS_COMMON} -fsanitize=thread"
CFLAGS: "${CFLAGS_COMMON} -ggdb -O2 -fsanitize=thread"
LDFLAGS: "-fsanitize=thread"
EXTRA_CONFIGURE: "--with-libidn2 --enable-pthread-rwlock --without-jemalloc"
OPENSSL_CFLAGS: -I/opt/tsan/include
OPENSSL_LIBS: -L/opt/tsan/lib -lssl -lcrypto
EXTRA_CONFIGURE: "--with-libidn2 --enable-pthread-rwlock --without-jemalloc PKG_CONFIG_PATH=/opt/tsan/lib/pkgconfig"
system:clang:tsan:
variables:
@@ -1235,56 +1237,33 @@ unit:clang:tsan:
- job: clang:tsan
artifacts: true
# Jobs for Debian 11 "bullseye" (amd64)
generate-tsan-stress-test-configs:
<<: *base_image
<<: *default_triggering_rules
stage: system
script:
- util/generate-tsan-stress-jobs.py > tsan-stress-test-configs.yml
artifacts:
paths:
- tsan-stress-test-configs.yml
needs: []
when: manual
clang:bullseye:amd64:
tsan:stress:
<<: *default_triggering_rules
stage: postcheck
variables:
CC: ${CLANG}
CFLAGS: "${CFLAGS_COMMON} -Wenum-conversion"
<<: *debian_bullseye_amd64_image
<<: *build_job
system:clang:bullseye:amd64:
<<: *debian_bullseye_amd64_image
<<: *system_test_job
PARENT_PIPELINE_ID: $CI_PIPELINE_ID
trigger:
include:
- artifact: tsan-stress-test-configs.yml
job: generate-tsan-stress-test-configs
needs:
- job: clang:bullseye:amd64
- job: generate-tsan-stress-test-configs
artifacts: true
unit:clang:bullseye:amd64:
<<: *debian_bullseye_amd64_image
<<: *unit_test_job
needs:
- job: clang:bullseye:amd64
- job: gcc:tsan
artifacts: true
gcc:bullseye:amd64:
variables:
CC: gcc
CFLAGS: "${CFLAGS_COMMON}"
# See https://gitlab.isc.org/isc-projects/bind9/-/issues/3444
EXTRA_CONFIGURE: "--with-libidn2 --without-jemalloc"
<<: *debian_bullseye_amd64_image
<<: *build_job
system:gcc:bullseye:amd64:
# Set up environment variables that allow the "keyfromlabel" system test to be run
variables:
DEFAULT_OPENSSL_CONF: "/etc/ssl/openssl.cnf"
OPENSSL_CONF: "/var/tmp/etc/openssl.cnf"
SOFTHSM2_CONF: "/var/tmp/softhsm2/softhsm2.conf"
SOFTHSM2_MODULE: "/usr/lib/softhsm/libsofthsm2.so"
<<: *debian_bullseye_amd64_image
<<: *system_test_job
needs:
- job: gcc:bullseye:amd64
artifacts: true
unit:gcc:bullseye:amd64:
<<: *debian_bullseye_amd64_image
<<: *unit_test_job
needs:
- job: gcc:bullseye:amd64
- job: clang:tsan
artifacts: true
# Jobs for Clang builds on Debian 12 "bookworm" (amd64)
@@ -1557,7 +1536,9 @@ respdiff:tsan:
CC: gcc
CFLAGS: "${CFLAGS_COMMON} -Og -fsanitize=thread"
LDFLAGS: "-fsanitize=thread"
EXTRA_CONFIGURE: "--disable-dnsrps --enable-pthread-rwlock --without-jemalloc"
OPENSSL_CFLAGS: -I/opt/tsan/include
OPENSSL_LIBS: -L/opt/tsan/lib -lssl -lcrypto
EXTRA_CONFIGURE: "--disable-dnsrps --enable-pthread-rwlock --without-jemalloc PKG_CONFIG_PATH=/opt/tsan/lib/pkgconfig"
MAX_DISAGREEMENTS_PERCENTAGE: "0.5"
TSAN_OPTIONS: "${TSAN_OPTIONS_DEBIAN}"
script:
@@ -1618,13 +1599,29 @@ shotgun:dot:
- job: autoreconf
artifacts: true
.stress-test-short: &stress_test_short_job
.stress-test-long: &stress_test_long_job
<<: *stress_test
artifacts:
untracked: true
exclude:
- "output/ns4/*.dtq*"
- "output/ns4/large-delta-rpz*.local"
- "output/rpz_*"
expire_in: "1 week"
when: always
timeout: 2h
.stress-test-short: &stress_test_short_job
<<: *stress_test
only:
- merge_requests
artifacts:
untracked: true
exclude:
- "output/ns4/*.dtq*"
- "output/ns4/large-delta-rpz*.local"
- "output/rpz_*"
when: always
stress:short:authoritative:fedora:40:amd64:
<<: *fedora_40_amd64_image
@@ -1731,14 +1728,6 @@ stress:short:rpz:freebsd13:amd64:
RATE: 1500
RUN_TIME: 15
.stress-test-long: &stress_test_long_job
<<: *stress_test
artifacts:
untracked: true
expire_in: "1 week"
when: always
timeout: 2h
stress:authoritative:fedora:40:amd64:
<<: *fedora_40_amd64_image
<<: *linux_amd64
@@ -1924,23 +1913,46 @@ pairwise:
variables:
- $PAIRWISE_TESTING
backports:
.post_merge_template: &post_merge
<<: *base_image
stage: postmerge
rules:
- if: '$CI_PIPELINE_SOURCE == "push" && ($CI_COMMIT_REF_NAME =~ /^bind-9.[0-9]+$/ || $CI_COMMIT_REF_NAME == $CI_DEFAULT_BRANCH)'
needs: []
# post-merge processes should run even if another MR was merged while the job was running (or queued)
interruptible: false
variables:
# automated commits will inherit identification from the user who pressed Merge button
GIT_COMMITTER_NAME: $GITLAB_USER_NAME
GIT_COMMITTER_EMAIL: $GITLAB_USER_EMAIL
# avoid leftover branches from previous jobs
GIT_STRATEGY: clone
# assumed max depth of a MR for backport
GIT_DEPTH: 200
# assumed max depth of a MR for backport or a rebased force-push
GIT_DEPTH: 1000
before_script:
# force-pushes should not trigger process automation (happens only in -sub branches)
- >
echo "previous branch tip: $CI_COMMIT_BEFORE_SHA"
- set +o pipefail; git log --format='%H' | grep --silent "$CI_COMMIT_BEFORE_SHA" && PREVIOUS_TIP_REACHABLE=1
- test "$PREVIOUS_TIP_REACHABLE" != "1" && echo "force-push detected, stop" && exit 1
# non-fast-forward merges are disabled so we have to have merge commit on top
- MERGE_REQUEST_ID="$(git log -1 --format='%b' | sed --silent -e 's/^See merge request [^!]\+!//p')"
- >
: stop if this is not a merge request
- test "$MERGE_REQUEST_ID" -ge 0
- git clone --depth 1 https://gitlab.isc.org/isc-projects/bind9-qa.git
backports:
<<: *post_merge
rules:
# -sub branches are handled manually
- if: '$CI_PIPELINE_SOURCE == "push" && ($CI_COMMIT_REF_NAME =~ /^bind-9.[0-9]+$/ || $CI_COMMIT_REF_NAME == $CI_DEFAULT_BRANCH)'
script:
# CI job token is not sufficient for push operations
- git remote get-url origin | sed -e "s/gitlab-ci-token:$CI_JOB_TOKEN/oauth2:$BIND_TEAM_WRITE_TOKEN/" | xargs git remote set-url --push origin
# force-pushing is disabled so we have to have merge request on top
- MERGE_REQUEST_ID="$(git log -1 --format='%b' | sed --silent -e 's/^See merge request [^!]\+!//p')"
- git clone --depth 1 https://gitlab.isc.org/isc-projects/bind9-qa.git
- bind9-qa/releng/backport_mr.py $CI_PROJECT_ID "$MERGE_REQUEST_ID"
merged-metadata:
<<: *post_merge
rules:
- if: '$CI_PIPELINE_SOURCE == "push" && ($CI_COMMIT_REF_NAME =~ /^bind-9.[0-9]+(-sub)?$/ || $CI_COMMIT_REF_NAME =~ /^bind-9.[0-9]+.[0-9]+-release$/ || $CI_COMMIT_REF_NAME == $CI_DEFAULT_BRANCH)'
script:
- bind9-qa/releng/after_merge.py "$CI_PROJECT_ID" "$MERGE_REQUEST_ID"
+1
View File
@@ -1,4 +1,5 @@
Alan Clegg <aclegg@isc.org>
Alessio Podda <alessio@isc.org>
Aram Sargsyan <aram@isc.org>
Artem Boldariev <artem@isc.org> <artem@boldariev.com>
Curtis Blackburn <ckb@isc.org> <ckb@freebsd11.local>
+19 -1
View File
@@ -1,10 +1,28 @@
[MASTER]
[IMPORTS]
deprecated-modules=
dns.resolver,
[MESSAGES CONTROL]
disable=
C0103, # invalid-name
C0114, # missing-module-docstring
C0115, # missing-class-docstring
C0116, # missing-function-docstring
C0209, # consider-using-f-string
C0301, # line-too-long, handled better by black
C0302, # too-many-lines
C0415, # import-outside-toplevel
R0801, # duplicate-code
R0901, # too-many-ancestors
R0902, # too-many-instance-attributes
R0903, # too-few-public-methods
R0904, # too-many-public-methods
R0911, # too-many-return-statements
R0912, # too-many-branches
R0913, # too-many-arguments
R0914, # too-many-locals
R0915, # too-many-statements
R0916, # too-many-boolean-expressions
R0917, # too-many-positional-arguments
+3 -5
View File
@@ -6,6 +6,9 @@ build:
os: ubuntu-22.04
tools:
python: "3.11"
jobs:
pre_build:
- python -m pip install -r https://gitlab.isc.org/isc-projects/bind9/-/raw/main/doc/arm/requirements.txt
# Build documentation in doc/arm/ with Sphinx
sphinx:
@@ -13,8 +16,3 @@ sphinx:
# Build all formats
formats: all
# Explicitly set the version of Python and its requirements
python:
install:
- requirements: doc/arm/requirements.txt
+2 -1
View File
@@ -105,7 +105,6 @@ Files: **/*.after*
doc/arm/*.dia
doc/arm/*.png
doc/arm/isc-logo.pdf
doc/arm/requirements.txt
doc/man/*.1in
doc/man/*.5in
doc/man/*.8in
@@ -177,6 +176,8 @@ Files: **/.clang-format
.readthedocs.yaml
.tsan-suppress
.uncrustify.cfg
contrib/gitchangelog/changelog.rc.py
contrib/gitchangelog/relnotes.rc.py
doc/misc/*.zoneopt
doc/misc/options
doc/misc/rndc.grammar
-21076
View File
File diff suppressed because it is too large Load Diff
Symlink
+1
View File
@@ -0,0 +1 @@
doc/arm/changelog.rst
+1 -1
View File
@@ -1 +1 @@
CHANGES
doc/arm/changelog.rst
+1 -32
View File
@@ -20,7 +20,6 @@ information regarding copyright ownership.
1. [Building BIND](#build)
1. [Automated testing](#testing)
1. [Documentation](#doc)
1. [Change log](#changes)
1. [Acknowledgments](#ack)
### <a name="intro"/> Introduction
@@ -49,8 +48,7 @@ ongoing maintenance and improvement. BIND is open source software
licensed under the terms of the Mozilla Public License, version 2.0.
For a detailed list of changes made throughout the history of BIND 9, see
the file [CHANGES](CHANGES). See [below](#changes) for details on the
CHANGES file format.
the [changelog](doc/arm/changelog.rst).
For up-to-date versions and release notes, see
[https://www.isc.org/download/](https://www.isc.org/download/).
@@ -154,35 +152,6 @@ can be found in the ISC Knowledgebase at
Additional information on various subjects can be found in other
`README` files throughout the source tree.
### <a name="changes"/> Change log
A detailed list of all changes that have been made throughout the
development of BIND 9 is included in the file CHANGES, with the most recent
changes listed first. Change notes include tags indicating the category of
the change that was made; these categories are:
|Category |Description |
|-------------- |-----------------------------------------------|
| [func] | New feature |
| [bug] | General bug fix |
| [security] | Fix for a significant security flaw |
| [experimental] | Used for new features when the syntax or other aspects of the design are still in flux and may change |
| [port] | Portability enhancement |
| [maint] | Updates to built-in data such as root server addresses and keys |
| [tuning] | Changes to built-in configuration defaults and constants to improve performance |
| [performance] | Other changes to improve server performance |
| [protocol] | Updates to the DNS protocol such as new RR types |
| [test] | Changes to the automatic tests, not affecting server functionality |
| [cleanup] | Minor corrections and refactoring |
| [doc] | Documentation |
| [contrib] | Changes to the contributed tools and libraries in the 'contrib' subdirectory |
| [placeholder] | Used in the main development branch to reserve change numbers for use in other branches, e.g., when fixing a bug that only exists in older releases |
In general, [func] and [experimental] tags only appear in new-feature
releases (i.e., those with version numbers ending in zero). Some new
functionality may be backported to older releases on a case-by-case basis.
All other change types may be applied to all currently supported releases.
#### Bug report identifiers
Most notes in the CHANGES file include a reference to a bug report or
+8 -8
View File
@@ -67,7 +67,7 @@ usage(void) {
"usage: %s [-chijlvz] [-p [-x]] [-t directory] "
"[named.conf]\n",
program);
exit(1);
exit(EXIT_SUCCESS);
}
/*% directory callback */
@@ -573,7 +573,7 @@ output(void *closure, const char *text, int textlen) {
UNUSED(closure);
if (fwrite(text, 1, textlen, stdout) != (size_t)textlen) {
perror("fwrite");
exit(1);
exit(EXIT_FAILURE);
}
}
@@ -653,7 +653,7 @@ main(int argc, char **argv) {
if (result != ISC_R_SUCCESS) {
fprintf(stderr, "isc_dir_chroot: %s\n",
isc_result_totext(result));
exit(1);
exit(EXIT_FAILURE);
}
break;
@@ -663,7 +663,7 @@ main(int argc, char **argv) {
case 'v':
printf("%s\n", PACKAGE_VERSION);
exit(0);
exit(EXIT_SUCCESS);
case 'x':
flags |= CFG_PRINTER_XKEY;
@@ -688,17 +688,17 @@ main(int argc, char **argv) {
default:
fprintf(stderr, "%s: unhandled option -%c\n", program,
isc_commandline_option);
exit(1);
exit(EXIT_FAILURE);
}
}
if (((flags & CFG_PRINTER_XKEY) != 0) && !print) {
fprintf(stderr, "%s: -x cannot be used without -p\n", program);
exit(1);
exit(EXIT_FAILURE);
}
if (print && list_zones) {
fprintf(stderr, "%s: -l cannot be used with -p\n", program);
exit(1);
exit(EXIT_FAILURE);
}
if (isc_commandline_index + 1 < argc) {
@@ -723,7 +723,7 @@ main(int argc, char **argv) {
if (cfg_parse_file(parser, conffile, &cfg_type_namedconf, &config) !=
ISC_R_SUCCESS)
{
exit(1);
exit(EXIT_FAILURE);
}
result = bind9_check_namedconf(config, loadplugins, nodeprecate, logc,
+19 -19
View File
@@ -82,7 +82,7 @@ usage(void) {
"%s zonename [ (filename|-) ]\n",
prog_name,
progmode == progmode_check ? "[-o filename]" : "-o filename");
exit(1);
exit(EXIT_FAILURE);
}
static void
@@ -212,7 +212,7 @@ main(int argc, char **argv) {
} else {
fprintf(stderr, "invalid argument to -i: %s\n",
isc_commandline_argument);
exit(1);
exit(EXIT_FAILURE);
}
break;
@@ -246,7 +246,7 @@ main(int argc, char **argv) {
} else {
fprintf(stderr, "invalid argument to -k: %s\n",
isc_commandline_argument);
exit(1);
exit(EXIT_FAILURE);
}
break;
@@ -257,7 +257,7 @@ main(int argc, char **argv) {
if (*endp != '\0') {
fprintf(stderr, "source serial number "
"must be numeric");
exit(1);
exit(EXIT_FAILURE);
}
break;
@@ -268,7 +268,7 @@ main(int argc, char **argv) {
if (*endp != '\0') {
fprintf(stderr, "maximum TTL "
"must be numeric");
exit(1);
exit(EXIT_FAILURE);
}
break;
@@ -285,7 +285,7 @@ main(int argc, char **argv) {
} else {
fprintf(stderr, "invalid argument to -n: %s\n",
isc_commandline_argument);
exit(1);
exit(EXIT_FAILURE);
}
break;
@@ -302,7 +302,7 @@ main(int argc, char **argv) {
} else {
fprintf(stderr, "invalid argument to -m: %s\n",
isc_commandline_argument);
exit(1);
exit(EXIT_FAILURE);
}
break;
@@ -327,7 +327,7 @@ main(int argc, char **argv) {
} else {
fprintf(stderr, "invalid argument to -r: %s\n",
isc_commandline_argument);
exit(1);
exit(EXIT_FAILURE);
}
break;
@@ -340,7 +340,7 @@ main(int argc, char **argv) {
fprintf(stderr,
"unknown or unsupported style: %s\n",
isc_commandline_argument);
exit(1);
exit(EXIT_FAILURE);
}
break;
@@ -350,13 +350,13 @@ main(int argc, char **argv) {
fprintf(stderr, "isc_dir_chroot: %s: %s\n",
isc_commandline_argument,
isc_result_totext(result));
exit(1);
exit(EXIT_FAILURE);
}
break;
case 'v':
printf("%s\n", PACKAGE_VERSION);
exit(0);
exit(EXIT_SUCCESS);
case 'w':
workdir = isc_commandline_argument;
@@ -379,7 +379,7 @@ main(int argc, char **argv) {
} else {
fprintf(stderr, "invalid argument to -M: %s\n",
isc_commandline_argument);
exit(1);
exit(EXIT_FAILURE);
}
break;
@@ -396,7 +396,7 @@ main(int argc, char **argv) {
} else {
fprintf(stderr, "invalid argument to -S: %s\n",
isc_commandline_argument);
exit(1);
exit(EXIT_FAILURE);
}
break;
@@ -408,7 +408,7 @@ main(int argc, char **argv) {
} else {
fprintf(stderr, "invalid argument to -T: %s\n",
isc_commandline_argument);
exit(1);
exit(EXIT_FAILURE);
}
break;
@@ -432,7 +432,7 @@ main(int argc, char **argv) {
default:
fprintf(stderr, "%s: unhandled option -%c\n", prog_name,
isc_commandline_option);
exit(1);
exit(EXIT_FAILURE);
}
}
@@ -441,7 +441,7 @@ main(int argc, char **argv) {
if (result != ISC_R_SUCCESS) {
fprintf(stderr, "isc_dir_chdir: %s: %s\n", workdir,
isc_result_totext(result));
exit(1);
exit(EXIT_FAILURE);
}
}
@@ -457,7 +457,7 @@ main(int argc, char **argv) {
} else {
fprintf(stderr, "unknown file format: %s\n",
inputformatstr);
exit(1);
exit(EXIT_FAILURE);
}
}
@@ -475,12 +475,12 @@ main(int argc, char **argv) {
rawversion > 1U)
{
fprintf(stderr, "unknown raw format version\n");
exit(1);
exit(EXIT_FAILURE);
}
} else {
fprintf(stderr, "unknown file format: %s\n",
outputformatstr);
exit(1);
exit(EXIT_FAILURE);
}
}
+6 -5
View File
@@ -147,7 +147,8 @@ main(int argc, char **argv) {
keyfile = isc_commandline_argument;
break;
case 'h':
usage(0);
usage(EXIT_SUCCESS);
break;
case 'k':
case 'y': /* Compatible with rndc -y. */
keyname = isc_commandline_argument;
@@ -193,15 +194,15 @@ main(int argc, char **argv) {
if (isc_commandline_option != '?') {
fprintf(stderr, "%s: invalid argument -%c\n",
program, isc_commandline_option);
usage(1);
usage(EXIT_FAILURE);
} else {
usage(0);
usage(EXIT_SUCCESS);
}
break;
default:
fprintf(stderr, "%s: unhandled option -%c\n", program,
isc_commandline_option);
exit(1);
exit(EXIT_FAILURE);
}
}
@@ -210,7 +211,7 @@ main(int argc, char **argv) {
POST(argv);
if (argc > 0) {
usage(1);
usage(EXIT_FAILURE);
}
if (alg == DST_ALG_HMACMD5) {
+10 -10
View File
@@ -139,13 +139,13 @@ main(int argc, char **argv) {
keysize = alg_bits(alg);
break;
case 'h':
usage(0);
usage(EXIT_SUCCESS);
case 'k':
case 'y':
if (progmode == progmode_confgen) {
keyname = isc_commandline_argument;
} else {
usage(1);
usage(EXIT_FAILURE);
}
break;
case 'M':
@@ -158,7 +158,7 @@ main(int argc, char **argv) {
if (progmode == progmode_confgen) {
quiet = true;
} else {
usage(1);
usage(EXIT_FAILURE);
}
break;
case 'r':
@@ -168,29 +168,29 @@ main(int argc, char **argv) {
if (progmode == progmode_confgen) {
self_domain = isc_commandline_argument;
} else {
usage(1);
usage(EXIT_FAILURE);
}
break;
case 'z':
if (progmode == progmode_confgen) {
zone = isc_commandline_argument;
} else {
usage(1);
usage(EXIT_FAILURE);
}
break;
case '?':
if (isc_commandline_option != '?') {
fprintf(stderr, "%s: invalid argument -%c\n",
program, isc_commandline_option);
usage(1);
usage(EXIT_FAILURE);
} else {
usage(0);
usage(EXIT_SUCCESS);
}
break;
default:
fprintf(stderr, "%s: unhandled option -%c\n", program,
isc_commandline_option);
exit(1);
exit(EXIT_FAILURE);
}
}
@@ -201,11 +201,11 @@ main(int argc, char **argv) {
POST(argv);
if (self_domain != NULL && zone != NULL) {
usage(1); /* -s and -z cannot coexist */
usage(EXIT_FAILURE); /* -s and -z cannot coexist */
}
if (argc > isc_commandline_index) {
usage(1);
usage(EXIT_FAILURE);
}
/* Use canonical algorithm name */
+4 -2
View File
@@ -13,14 +13,16 @@
/*! \file */
#include "util.h"
#include <stdarg.h>
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <isc/print.h>
#include "util.h"
extern bool verbose;
extern const char *progname;
@@ -45,5 +47,5 @@ fatal(const char *format, ...) {
vfprintf(stderr, format, args);
va_end(args);
fprintf(stderr, "\n");
exit(1);
_exit(EXIT_FAILURE);
}
+14 -6
View File
@@ -76,6 +76,12 @@
#define MAXNAME (DNS_NAME_MAXTEXT + 1)
/*
* Default maximum number of chained queries before we give up
* to prevent CNAME loops.
*/
#define MAX_RESTARTS 11
/* Variables used internally by delv. */
char *progname;
static isc_mem_t *mctx = NULL;
@@ -205,7 +211,7 @@ usage(void) {
"process)\n"
" +[no]yaml (Present the results as "
"YAML)\n");
exit(1);
exit(EXIT_FAILURE);
}
noreturn static void
@@ -221,7 +227,7 @@ fatal(const char *format, ...) {
vfprintf(stderr, format, args);
va_end(args);
fprintf(stderr, "\n");
exit(1);
_exit(EXIT_FAILURE);
}
static void
@@ -1132,7 +1138,7 @@ plus_option(char *option) {
if (state) {
fprintf(stderr, "Invalid option: "
"+dlv is obsolete\n");
exit(1);
exit(EXIT_FAILURE);
}
break;
case 'n': /* dnssec */
@@ -1329,7 +1335,7 @@ dash_option(char *option, char *next, bool *open_type_class) {
break;
case 'h':
usage();
exit(0);
exit(EXIT_SUCCESS);
case 'i':
no_sigs = true;
root_validation = false;
@@ -1339,7 +1345,7 @@ dash_option(char *option, char *next, bool *open_type_class) {
break;
case 'v':
fprintf(stderr, "delv %s\n", PACKAGE_VERSION);
exit(0);
exit(EXIT_SUCCESS);
default:
UNREACHABLE();
}
@@ -1472,7 +1478,7 @@ dash_option(char *option, char *next, bool *open_type_class) {
typeset = true;
} else {
fprintf(stderr, "Invalid IP address %s\n", value);
exit(1);
exit(EXIT_FAILURE);
}
return (value_from_next);
invalid_option:
@@ -1776,6 +1782,8 @@ main(int argc, char *argv[]) {
goto cleanup;
}
dns_client_setmaxrestarts(client, MAX_RESTARTS);
/* Set the nameserver */
if (server != NULL) {
addserver(client);
+21 -16
View File
@@ -121,7 +121,7 @@ usage(void) {
print_usage(stderr);
fprintf(stderr, "\nUse \"dig -h\" (or \"dig -h | more\") "
"for complete list of options\n");
exit(1);
exit(EXIT_FAILURE);
}
#endif /* if TARGET_OS_IPHONE */
@@ -717,8 +717,7 @@ printmessage(dig_query_t *query, const isc_buffer_t *msgbuf, dns_message_t *msg,
char *hash;
int pf;
printf("-\n");
printf(" type: MESSAGE\n");
printf("- type: MESSAGE\n");
printf(" message:\n");
if (isquery) {
@@ -1481,9 +1480,12 @@ plus_option(char *option, bool is_batchfile, bool *need_clone,
"specified");
goto exit_or_usage;
}
extra = strtok_r(NULL, "\0",
extra = strtok_r(NULL, "",
&last);
save_opt(lookup, code, extra);
if (extra != NULL) {
extra[-1] = ':';
}
break;
default:
goto invalid_option;
@@ -2207,6 +2209,9 @@ plus_option(char *option, bool is_batchfile, bool *need_clone,
fprintf(stderr, "Invalid option: +%s\n", option);
usage();
}
if (value != NULL) {
value[-1] = '=';
}
return (lookup);
#if !TARGET_OS_IPHONE
@@ -2279,7 +2284,7 @@ dash_option(char *option, char *next, dig_lookup_t **lookup,
break;
case 'h':
help();
exit(0);
exit(EXIT_SUCCESS);
break;
case 'i':
/* deprecated */
@@ -2299,7 +2304,7 @@ dash_option(char *option, char *next, dig_lookup_t **lookup,
break;
case 'v':
version();
exit(0);
exit(EXIT_SUCCESS);
break;
}
if (strlen(option) > 1U) {
@@ -2468,8 +2473,8 @@ dash_option(char *option, char *next, dig_lookup_t **lookup,
* secret */
usage();
}
if ((ptr3 = strtok_r(NULL, ":", &last)) != NULL) { /* secret or
* NULL */
if ((ptr3 = strtok_r(NULL, "", &last)) != NULL) { /* secret or
* NULL */
parse_hmac(ptr);
ptr = ptr2;
ptr2 = ptr3;
@@ -2480,6 +2485,10 @@ dash_option(char *option, char *next, dig_lookup_t **lookup,
/* XXXONDREJ: FIXME */
strlcpy(keynametext, ptr, sizeof(keynametext));
strlcpy(keysecret, ptr2, sizeof(keysecret));
if (ptr3 != NULL) {
ptr[-1] = ':';
}
ptr2[-1] = ':';
return (value_from_next);
case 'x':
if (*need_clone) {
@@ -2508,7 +2517,7 @@ dash_option(char *option, char *next, dig_lookup_t **lookup,
ISC_LIST_APPEND(lookup_list, *lookup, link);
} else {
fprintf(stderr, "Invalid IP address %s\n", value);
exit(1);
exit(EXIT_FAILURE);
}
return (value_from_next);
invalid_option:
@@ -2965,8 +2974,7 @@ dig_error(const char *format, ...) {
va_list args;
if (yaml) {
printf("-\n");
printf(" type: DIG_ERROR\n");
printf("- type: DIG_ERROR\n");
/*
* Print an indent before a literal block quote.
@@ -2983,10 +2991,7 @@ dig_error(const char *format, ...) {
va_start(args, format);
vprintf(format, args);
va_end(args);
if (!yaml) {
printf("\n");
}
printf("\n"); /* We get the error without a newline */
}
static void
@@ -3084,7 +3089,7 @@ void
dig_shutdown(void) {
destroy_lookup(default_lookup);
if (atomic_load(&batchname) != 0) {
if (batchfp != stdin) {
if (batchfp != NULL && batchfp != stdin) {
fclose(batchfp);
}
atomic_store(&batchname, 0);
+16 -12
View File
@@ -383,8 +383,6 @@ get_reverse(char *reverse, size_t len, char *value, bool strict) {
}
}
void (*dighost_pre_exit_hook)(void) = NULL;
#if TARGET_OS_IPHONE
void
warn(const char *format, ...) {
@@ -417,10 +415,7 @@ digexit(void) {
exitcode = 10;
}
if (fatalexit != 0) {
exitcode = fatalexit;
}
if (dighost_pre_exit_hook != NULL) {
dighost_pre_exit_hook();
_exit(fatalexit);
}
exit(exitcode);
}
@@ -435,6 +430,11 @@ fatal(const char *format, ...) {
vfprintf(stderr, format, args);
va_end(args);
fprintf(stderr, "\n");
if (fatalexit == 0 && exitcode != 0) {
fatalexit = exitcode;
} else if (fatalexit == 0) {
fatalexit = EXIT_FAILURE;
}
digexit();
}
@@ -3086,7 +3086,7 @@ start_tcp(dig_query_t *query) {
isc_nm_httpconnect(netmgr, &localaddr, &query->sockaddr,
uri, !query->lookup->https_get,
tcp_connected, connectquery, tlsctx,
sess_cache, 0, local_timeout);
sess_cache, local_timeout, 0);
#endif
} else {
isc_nm_tcpdnsconnect(netmgr, &localaddr,
@@ -3249,7 +3249,7 @@ udp_ready(isc_nmhandle_t *handle, isc_result_t eresult, void *arg) {
start_udp(next);
check_if_done();
} else {
dighost_error("no servers could be reached\n");
dighost_error("no servers could be reached");
clear_current_lookup();
}
@@ -3308,6 +3308,10 @@ start_udp(dig_query_t *query) {
return;
}
if (!port_set) {
port = 53;
}
result = get_address(query->servname, port, &query->sockaddr);
if (result != ISC_R_SUCCESS) {
/* This servname doesn't have an address. */
@@ -3432,10 +3436,10 @@ force_next(dig_query_t *query) {
isc_netaddr_fromsockaddr(&netaddr, &query->sockaddr);
isc_netaddr_format(&netaddr, buf, sizeof(buf));
dighost_error("no response from %s\n", buf);
dighost_error("no response from %s", buf);
} else {
printf("%s", l->cmdline);
dighost_error("no servers could be reached\n");
dighost_error("no servers could be reached");
}
if (exitcode < 9) {
@@ -3655,7 +3659,7 @@ tcp_connected(isc_nmhandle_t *handle, isc_result_t eresult, void *arg) {
start_tcp(next);
check_if_done();
} else {
dighost_error("no servers could be reached\n");
dighost_error("no servers could be reached");
clear_current_lookup();
}
@@ -4109,7 +4113,7 @@ recv_done(isc_nmhandle_t *handle, isc_result_t eresult, isc_region_t *region,
* and cancel the lookup.
*/
printf("%s", l->cmdline);
dighost_error("no servers could be reached\n");
dighost_error("no servers could be reached");
if (exitcode < 9) {
exitcode = 9;
+3 -2
View File
@@ -134,7 +134,7 @@ show_usage(void) {
" -W specifies how long to wait for a reply\n"
" -4 use IPv4 query transport only\n"
" -6 use IPv6 query transport only\n");
exit(1);
exit(EXIT_FAILURE);
}
static void
@@ -185,6 +185,7 @@ retry:
result = dns_rdata_totext(rdata, NULL, b);
if (result == ISC_R_NOSPACE) {
isc_buffer_free(&b);
INSIST(bufsize <= (UINT_MAX / 2));
bufsize *= 2;
goto retry;
}
@@ -662,7 +663,7 @@ pre_parse_args(int argc, char **argv) {
break;
case 'V':
version();
exit(0);
exit(EXIT_SUCCESS);
break;
case 'w':
break;
+3 -2
View File
@@ -204,6 +204,7 @@ printrdata(dns_rdata_t *rdata) {
check_result(result, "dns_rdata_totext");
}
isc_buffer_free(&b);
INSIST(size <= (UINT_MAX / 2));
size *= 2;
}
}
@@ -869,7 +870,7 @@ usage(void) {
"'host' using default server\n");
fprintf(stderr, " nslookup [-opt ...] host server # just look up "
"'host' using 'server'\n");
exit(1);
exit(EXIT_FAILURE);
}
static void
@@ -882,7 +883,7 @@ parse_args(int argc, char **argv) {
if (argv[0][0] == '-') {
if (strncasecmp(argv[0], "-ver", 4) == 0) {
version();
exit(0);
exit(EXIT_SUCCESS);
} else if (argv[0][1] != 0) {
setoption(&argv[0][1]);
} else {
+3 -2
View File
@@ -1059,7 +1059,7 @@ usage(void) {
" -T <ttl> TTL of DS records\n"
" -V print version\n"
" -v <verbosity>\n");
exit(1);
exit(EXIT_FAILURE);
}
static void
@@ -1357,5 +1357,6 @@ main(int argc, char *argv[]) {
cleanup:
print_mem_stats = true;
cleanup();
exit(0);
return (0);
}
+2 -2
View File
@@ -354,7 +354,7 @@ usage(void) {
" -V: print version information\n");
fprintf(stderr, "Output: DS or CDS RRs\n");
exit(-1);
exit(EXIT_FAILURE);
}
int
@@ -453,7 +453,7 @@ main(int argc, char **argv) {
default:
fprintf(stderr, "%s: unhandled option -%c\n", program,
isc_commandline_option);
exit(1);
exit(EXIT_FAILURE);
}
}
+2 -2
View File
@@ -290,7 +290,7 @@ usage(void) {
fprintf(stderr, " -D sync date/[+-]offset/none: set/unset "
"CDS and CDNSKEY deletion date\n");
exit(-1);
exit(EXIT_FAILURE);
}
int
@@ -397,7 +397,7 @@ main(int argc, char **argv) {
default:
fprintf(stderr, "%s: unhandled option -%c\n", program,
isc_commandline_option);
exit(1);
exit(EXIT_FAILURE);
}
}
+3 -3
View File
@@ -103,7 +103,7 @@ usage(void) {
fprintf(stderr, " K<name>+<alg>+<id>.key, "
"K<name>+<alg>+<id>.private\n");
exit(-1);
exit(EXIT_FAILURE);
}
int
@@ -334,7 +334,7 @@ main(int argc, char **argv) {
default:
fprintf(stderr, "%s: unhandled option -%c\n", program,
isc_commandline_option);
exit(1);
exit(EXIT_FAILURE);
}
}
@@ -619,7 +619,7 @@ main(int argc, char **argv) {
fatal("failed to get key %s/%s: %s", namestr, algstr,
isc_result_totext(ret));
UNREACHABLE();
exit(-1);
exit(EXIT_FAILURE);
}
/*
+2 -2
View File
@@ -209,7 +209,7 @@ usage(void) {
fprintf(stderr, " K<name>+<alg>+<id>.key, "
"K<name>+<alg>+<id>.private\n");
exit(-1);
exit(EXIT_FAILURE);
}
static void
@@ -1132,7 +1132,7 @@ main(int argc, char **argv) {
default:
fprintf(stderr, "%s: unhandled option -%c\n", program,
isc_commandline_option);
exit(1);
exit(EXIT_FAILURE);
}
}
+2 -2
View File
@@ -59,7 +59,7 @@ usage(void) {
fprintf(stderr, " K<name>+<alg>+<new id>.key, "
"K<name>+<alg>+<new id>.private\n");
exit(-1);
exit(EXIT_FAILURE);
}
int
@@ -131,7 +131,7 @@ main(int argc, char **argv) {
default:
fprintf(stderr, "%s: unhandled option -%c\n", program,
isc_commandline_option);
exit(1);
exit(EXIT_FAILURE);
}
}
+2 -2
View File
@@ -102,7 +102,7 @@ usage(void) {
fprintf(stderr, " K<name>+<alg>+<new id>.key, "
"K<name>+<alg>+<new id>.private\n");
exit(-1);
exit(EXIT_FAILURE);
}
static void
@@ -539,7 +539,7 @@ main(int argc, char **argv) {
default:
fprintf(stderr, "%s: unhandled option -%c\n", program,
isc_commandline_option);
exit(1);
exit(EXIT_FAILURE);
}
}
+23 -29
View File
@@ -140,10 +140,10 @@ static dns_masterformat_t inputformat = dns_masterformat_text;
static dns_masterformat_t outputformat = dns_masterformat_text;
static uint32_t rawversion = 1, serialnum = 0;
static bool snset = false;
static unsigned int nsigned = 0, nretained = 0, ndropped = 0;
static unsigned int nverified = 0, nverifyfailed = 0;
static atomic_uint_fast32_t nsigned = 0, nretained = 0, ndropped = 0;
static atomic_uint_fast32_t nverified = 0, nverifyfailed = 0;
static const char *directory = NULL, *dsdir = NULL;
static isc_mutex_t namelock, statslock;
static isc_mutex_t namelock;
static isc_nm_t *netmgr = NULL;
static isc_taskmgr_t *taskmgr = NULL;
static dns_db_t *gdb; /* The database */
@@ -182,11 +182,9 @@ static bool set_maxttl = false;
static dns_ttl_t maxttl = 0;
static bool no_max_check = false;
#define INCSTAT(counter) \
if (printstats) { \
LOCK(&statslock); \
counter++; \
UNLOCK(&statslock); \
#define INCSTAT(counter) \
if (printstats) { \
atomic_fetch_add_relaxed(&counter, 1); \
}
static void
@@ -3311,7 +3309,7 @@ usage(void) {
fprintf(stderr, "(default: all zone keys that have private keys)\n");
fprintf(stderr, "\tkeyfile (Kname+alg+tag)\n");
exit(0);
exit(EXIT_FAILURE);
}
static void
@@ -3329,21 +3327,24 @@ print_stats(isc_time_t *timer_start, isc_time_t *timer_finish,
uint64_t sig_ms; /* Signatures per millisecond */
FILE *out = output_stdout ? stderr : stdout;
fprintf(out, "Signatures generated: %10u\n", nsigned);
fprintf(out, "Signatures retained: %10u\n", nretained);
fprintf(out, "Signatures dropped: %10u\n", ndropped);
fprintf(out, "Signatures successfully verified: %10u\n", nverified);
fprintf(out,
"Signatures unsuccessfully "
"verified: %10u\n",
nverifyfailed);
fprintf(out, "Signatures generated: %10" PRIuFAST32 "\n",
atomic_load(&nsigned));
fprintf(out, "Signatures retained: %10" PRIuFAST32 "\n",
atomic_load(&nretained));
fprintf(out, "Signatures dropped: %10" PRIuFAST32 "\n",
atomic_load(&ndropped));
fprintf(out, "Signatures successfully verified: %10" PRIuFAST32 "\n",
atomic_load(&nverified));
fprintf(out, "Signatures unsuccessfully verified: %10" PRIuFAST32 "\n",
atomic_load(&nverifyfailed));
time_us = isc_time_microdiff(sign_finish, sign_start);
time_ms = time_us / 1000;
fprintf(out, "Signing time in seconds: %7u.%03u\n",
(unsigned int)(time_ms / 1000), (unsigned int)(time_ms % 1000));
if (time_us > 0) {
sig_ms = ((uint64_t)nsigned * 1000000000) / time_us;
sig_ms = ((uint64_t)atomic_load(&nsigned) * 1000000000) /
time_us;
fprintf(out, "Signatures per second: %7u.%03u\n",
(unsigned int)sig_ms / 1000,
(unsigned int)sig_ms % 1000);
@@ -3555,7 +3556,7 @@ main(int argc, char *argv[]) {
if (*endp != '\0') {
fprintf(stderr, "source serial number "
"must be numeric");
exit(1);
exit(EXIT_FAILURE);
}
break;
@@ -3570,7 +3571,7 @@ main(int argc, char *argv[]) {
if (*endp != '\0') {
fprintf(stderr, "maximum TTL "
"must be numeric");
exit(1);
exit(EXIT_FAILURE);
}
break;
@@ -3693,7 +3694,7 @@ main(int argc, char *argv[]) {
default:
fprintf(stderr, "%s: unhandled option -%c\n", program,
isc_commandline_option);
exit(1);
exit(EXIT_FAILURE);
}
}
@@ -3799,7 +3800,7 @@ main(int argc, char *argv[]) {
rawversion > 1U)
{
fprintf(stderr, "unknown raw format version\n");
exit(1);
exit(EXIT_FAILURE);
}
} else {
fatal("unknown file format: %s", outputformatstr);
@@ -4043,10 +4044,6 @@ main(int argc, char *argv[]) {
isc_mutex_init(&namelock);
if (printstats) {
isc_mutex_init(&statslock);
}
presign();
TIME_NOW(&sign_start);
signapex();
@@ -4108,9 +4105,6 @@ main(int argc, char *argv[]) {
}
isc_mutex_destroy(&namelock);
if (printstats) {
isc_mutex_destroy(&statslock);
}
if (!output_stdout) {
result = isc_stdio_close(outfp);
+2 -2
View File
@@ -165,7 +165,7 @@ usage(void) {
fprintf(stderr, "\t-x:\tDNSKEY record signed with KSKs only, "
"not ZSKs\n");
fprintf(stderr, "\t-z:\tAll records signed with KSKs\n");
exit(0);
exit(EXIT_SUCCESS);
}
int
@@ -271,7 +271,7 @@ main(int argc, char *argv[]) {
default:
fprintf(stderr, "%s: unhandled option -%c\n", program,
isc_commandline_option);
exit(1);
exit(EXIT_FAILURE);
}
}
+3 -2
View File
@@ -20,6 +20,7 @@
#include <inttypes.h>
#include <stdbool.h>
#include <stdlib.h>
#include <unistd.h>
#include <isc/base32.h>
#include <isc/buffer.h>
@@ -81,7 +82,7 @@ fatal(const char *format, ...) {
if (fatalcallback != NULL) {
(*fatalcallback)();
}
exit(1);
_exit(EXIT_FAILURE);
}
void
@@ -111,7 +112,7 @@ vbprintf(int level, const char *fmt, ...) {
void
version(const char *name) {
fprintf(stderr, "%s %s\n", name, PACKAGE_VERSION);
exit(0);
exit(EXIT_SUCCESS);
}
void
+4 -1
View File
@@ -174,7 +174,8 @@ options {\n\
max-clients-per-query 100;\n\
max-ncache-ttl 10800; /* 3 hours */\n\
max-recursion-depth 7;\n\
max-recursion-queries 100;\n\
max-recursion-queries 32;\n\
max-query-restarts 11;\n\
max-stale-ttl 86400; /* 1 day */\n\
message-compression yes;\n\
min-ncache-ttl 0; /* 0 hours */\n\
@@ -233,8 +234,10 @@ options {\n\
ixfr-from-differences false;\n\
max-journal-size default;\n\
max-records 0;\n\
max-records-per-type 100;\n\
max-refresh-time 2419200; /* 4 weeks */\n\
max-retry-time 1209600; /* 2 weeks */\n\
max-types-per-name 100;\n\
max-transfer-idle-in 60;\n\
max-transfer-idle-out 60;\n\
max-transfer-time-in 120;\n\
+7 -7
View File
@@ -184,7 +184,7 @@ named_main_earlyfatal(const char *format, ...) {
}
va_end(args);
exit(1);
_exit(EXIT_FAILURE);
}
noreturn static void
@@ -238,7 +238,7 @@ assertion_failed(const char *file, int line, isc_assertiontype_t type,
if (named_g_coreok) {
abort();
}
exit(1);
_exit(EXIT_FAILURE);
}
noreturn static void
@@ -278,7 +278,7 @@ library_fatal_error(const char *file, int line, const char *func,
if (named_g_coreok) {
abort();
}
exit(1);
_exit(EXIT_FAILURE);
}
static void
@@ -898,7 +898,7 @@ parse_command_line(int argc, char *argv[]) {
printf("# Built-in default values. "
"This is NOT the run-time configuration!\n");
printf("%s", named_config_getdefault());
exit(0);
exit(EXIT_SUCCESS);
case 'd':
named_g_debuglevel = parse_int(isc_commandline_argument,
"debug "
@@ -963,10 +963,10 @@ parse_command_line(int argc, char *argv[]) {
break;
case 'v':
printversion(false);
exit(0);
exit(EXIT_SUCCESS);
case 'V':
printversion(true);
exit(0);
exit(EXIT_SUCCESS);
case 'x':
/* Obsolete. No longer in use. Ignore. */
break;
@@ -985,7 +985,7 @@ parse_command_line(int argc, char *argv[]) {
case '?':
usage();
if (isc_commandline_option == '?') {
exit(0);
exit(EXIT_SUCCESS);
}
p = strchr(NAMED_MAIN_ARGS, isc_commandline_option);
if (p == NULL || *++p != ':') {
+2 -2
View File
@@ -300,10 +300,10 @@ named_os_daemonize(void) {
char buf;
n = read(dfd[0], &buf, 1);
if (n == 1) {
_exit(0);
_exit(EXIT_SUCCESS);
}
} while (n == -1 && errno == EINTR);
_exit(1);
_exit(EXIT_FAILURE);
}
(void)close(dfd[0]);
+163 -30
View File
@@ -148,11 +148,11 @@
#endif /* HAVE_LMDB */
#ifndef SIZE_MAX
#define SIZE_MAX ((size_t) - 1)
#define SIZE_MAX ((size_t)-1)
#endif /* ifndef SIZE_MAX */
#ifndef SIZE_AS_PERCENT
#define SIZE_AS_PERCENT ((size_t) - 2)
#define SIZE_AS_PERCENT ((size_t)-2)
#endif /* ifndef SIZE_AS_PERCENT */
#ifdef TUNE_LARGE
@@ -221,8 +221,9 @@
#define CHECKFATAL(op, msg) \
do { \
result = (op); \
if (result != ISC_R_SUCCESS) \
if (result != ISC_R_SUCCESS) { \
fatal(server, msg, result); \
} \
} while (0)
/*%
@@ -323,6 +324,12 @@ typedef struct catz_chgzone_event {
bool mod;
} catz_chgzone_event_t;
typedef struct catz_reconfig_data {
dns_catz_zone_t *catz;
const cfg_obj_t *config;
catz_cb_data_t *cbd;
} catz_reconfig_data_t;
typedef struct {
unsigned int magic;
#define DZARG_MAGIC ISC_MAGIC('D', 'z', 'a', 'r')
@@ -440,7 +447,7 @@ configure_zone(const cfg_obj_t *config, const cfg_obj_t *zconfig,
const cfg_obj_t *vconfig, isc_mem_t *mctx, dns_view_t *view,
dns_viewlist_t *viewlist, dns_kasplist_t *kasplist,
cfg_aclconfctx_t *aclconf, bool added, bool old_rpz_ok,
bool modify);
bool is_catz_member, bool modify);
static void
configure_zone_setviewcommit(isc_result_t result, const cfg_obj_t *zconfig,
@@ -2675,13 +2682,13 @@ catz_addmodzone_taskaction(isc_task_t *task, isc_event_t *event0) {
ns_cfgctx_t *cfg;
dns_zone_t *zone = NULL;
/*
* A non-empty 'catalog-zones' statement implies that 'allow-new-zones'
* is true, so this is expected to be non-NULL.
*/
cfg = (ns_cfgctx_t *)ev->view->new_zone_config;
if (cfg == NULL) {
isc_log_write(named_g_lctx, NAMED_LOGCATEGORY_GENERAL,
NAMED_LOGMODULE_SERVER, ISC_LOG_ERROR,
"catz: allow-new-zones statement missing from "
"config; cannot add zone from the catalog");
goto cleanup;
CHECK(ISC_R_FAILURE);
}
name = dns_catz_entry_getname(ev->entry);
@@ -2802,7 +2809,7 @@ catz_addmodzone_taskaction(isc_task_t *task, isc_event_t *event0) {
isc_buffer_free(&confbuf);
}
/*
* Fail if either dns_catz_generate_zonecfg() or cfg_parse_buffer3()
* Fail if either dns_catz_generate_zonecfg() or cfg_parse_buffer()
* failed.
*/
if (result != ISC_R_SUCCESS) {
@@ -2826,10 +2833,11 @@ catz_addmodzone_taskaction(isc_task_t *task, isc_event_t *event0) {
result = isc_task_beginexclusive(task);
RUNTIME_CHECK(result == ISC_R_SUCCESS);
dns_view_thaw(ev->view);
result = configure_zone(
cfg->config, zoneobj, cfg->vconfig, ev->cbd->server->mctx,
ev->view, &ev->cbd->server->viewlist,
&ev->cbd->server->kasplist, cfg->actx, true, false, ev->mod);
result = configure_zone(cfg->config, zoneobj, cfg->vconfig,
ev->cbd->server->mctx, ev->view,
&ev->cbd->server->viewlist,
&ev->cbd->server->kasplist, cfg->actx, true,
false, true, ev->mod);
dns_view_freeze(ev->view);
isc_task_endexclusive(task);
@@ -3027,6 +3035,86 @@ catz_modzone(dns_catz_entry_t *entry, dns_catz_zone_t *origin, dns_view_t *view,
DNS_EVENT_CATZMODZONE));
}
static void
catz_reconfigure(dns_catz_entry_t *entry, dns_view_t *view,
catz_reconfig_data_t *data) {
isc_buffer_t namebuf;
isc_buffer_t *confbuf = NULL;
const cfg_obj_t *zlist = NULL;
char nameb[DNS_NAME_FORMATSIZE];
cfg_obj_t *zoneconf = NULL;
cfg_obj_t *zoneobj = NULL;
ns_cfgctx_t *cfg = NULL;
dns_zone_t *zone = NULL;
isc_result_t result;
isc_buffer_init(&namebuf, nameb, DNS_NAME_FORMATSIZE);
dns_name_totext(dns_catz_entry_getname(entry), DNS_NAME_OMITFINALDOT,
&namebuf);
isc_buffer_putuint8(&namebuf, 0);
result = dns_view_findzone(view, dns_catz_entry_getname(entry), &zone);
if (result != ISC_R_SUCCESS) {
return;
}
/*
* A non-empty 'catalog-zones' statement implies that 'allow-new-zones'
* is true, so this is expected to be non-NULL.
*/
cfg = (ns_cfgctx_t *)view->new_zone_config;
if (cfg == NULL) {
CHECK(ISC_R_FAILURE);
}
result = dns_catz_generate_zonecfg(data->catz, entry, &confbuf);
if (result == ISC_R_SUCCESS) {
cfg_parser_reset(cfg->add_parser);
result = cfg_parse_buffer(cfg->add_parser, confbuf, "catz", 0,
&cfg_type_addzoneconf, 0, &zoneconf);
isc_buffer_free(&confbuf);
}
/*
* Fail if either dns_catz_generate_zonecfg() or cfg_parse_buffer()
* failed.
*/
if (result != ISC_R_SUCCESS) {
isc_log_write(named_g_lctx, NAMED_LOGCATEGORY_GENERAL,
NAMED_LOGMODULE_SERVER, ISC_LOG_ERROR,
"catz_reconfigure: error \"%s\" while trying to "
"generate config for member zone '%s'",
isc_result_totext(result), nameb);
goto cleanup;
}
CHECK(cfg_map_get(zoneconf, "zone", &zlist));
if (!cfg_obj_islist(zlist)) {
CHECK(ISC_R_FAILURE);
}
zoneobj = cfg_listelt_value(cfg_list_first(zlist));
result = configure_zone(data->config, zoneobj, cfg->vconfig,
data->cbd->server->mctx, view,
&data->cbd->server->viewlist,
&data->cbd->server->kasplist, cfg->actx, true,
false, true, true);
if (result != ISC_R_SUCCESS) {
isc_log_write(named_g_lctx, NAMED_LOGCATEGORY_GENERAL,
NAMED_LOGMODULE_SERVER, ISC_LOG_ERROR,
"catz_reconfigure : error \"%s\" while trying to "
"reconfigure member zone '%s'",
isc_result_totext(result), nameb);
goto cleanup;
}
cleanup:
if (zoneconf != NULL) {
cfg_obj_destroy(cfg->add_parser, &zoneconf);
}
dns_zone_detach(&zone);
}
static isc_result_t
configure_catz_zone(dns_view_t *view, dns_view_t *pview,
const cfg_obj_t *config, const cfg_listelt_t *element) {
@@ -3065,18 +3153,18 @@ configure_catz_zone(dns_view_t *view, dns_view_t *pview,
if (result == ISC_R_EXISTS) {
isc_ht_iter_t *it = NULL;
catz_reconfig_data_t data = {
.catz = zone,
.config = config,
.cbd = (catz_cb_data_t *)dns_catz_zones_get_udata(
view->catzs),
};
RUNTIME_CHECK(pview != NULL);
/*
* xxxwpk todo: reconfigure the zone!!!!
*/
cfg_obj_log(catz_obj, named_g_lctx, DNS_CATZ_ERROR_LEVEL,
"catz: catalog zone '%s' will not be reconfigured",
str);
/*
* We have to walk through all the member zones and attach
* them to current view
* We have to walk through all the member zones, attach
* them to the current view and reconfigure
*/
dns_catz_get_iterator(zone, &it);
@@ -3099,6 +3187,8 @@ configure_catz_zone(dns_view_t *view, dns_view_t *pview,
dns_zone_setview(dnszone, view);
dns_view_addzone(view, dnszone);
catz_reconfigure(entry, view, &data);
/*
* The dns_view_findzone() call above increments the
* zone's reference count, which we need to decrement
@@ -4227,7 +4317,7 @@ configure_view(dns_view_t *view, dns_viewlist_t *viewlist, cfg_obj_t *config,
const cfg_obj_t *zconfig = cfg_listelt_value(element);
CHECK(configure_zone(config, zconfig, vconfig, mctx, view,
viewlist, kasplist, actx, false,
old_rpz_ok, false));
old_rpz_ok, false, false));
zone_element_latest = element;
}
@@ -5556,6 +5646,24 @@ configure_view(dns_view_t *view, dns_viewlist_t *viewlist, cfg_obj_t *config,
dns_resolver_setclientsperquery(view->resolver, cfg_obj_asuint32(obj),
max_clients_per_query);
/*
* This is used for the cache and also as a default value
* for zone databases.
*/
obj = NULL;
result = named_config_get(maps, "max-records-per-type", &obj);
INSIST(result == ISC_R_SUCCESS);
dns_view_setmaxrrperset(view, cfg_obj_asuint32(obj));
/*
* This is used for the cache and also as a default value
* for zone databases.
*/
obj = NULL;
result = named_config_get(maps, "max-types-per-name", &obj);
INSIST(result == ISC_R_SUCCESS);
dns_view_setmaxtypepername(view, cfg_obj_asuint32(obj));
obj = NULL;
result = named_config_get(maps, "max-recursion-depth", &obj);
INSIST(result == ISC_R_SUCCESS);
@@ -5566,6 +5674,11 @@ configure_view(dns_view_t *view, dns_viewlist_t *viewlist, cfg_obj_t *config,
INSIST(result == ISC_R_SUCCESS);
dns_resolver_setmaxqueries(view->resolver, cfg_obj_asuint32(obj));
obj = NULL;
result = named_config_get(maps, "max-query-restarts", &obj);
INSIST(result == ISC_R_SUCCESS);
dns_view_setmaxrestarts(view, cfg_obj_asuint32(obj));
obj = NULL;
result = named_config_get(maps, "fetches-per-zone", &obj);
INSIST(result == ISC_R_SUCCESS);
@@ -6478,7 +6591,7 @@ configure_zone(const cfg_obj_t *config, const cfg_obj_t *zconfig,
const cfg_obj_t *vconfig, isc_mem_t *mctx, dns_view_t *view,
dns_viewlist_t *viewlist, dns_kasplist_t *kasplist,
cfg_aclconfctx_t *aclconf, bool added, bool old_rpz_ok,
bool modify) {
bool is_catz_member, bool modify) {
dns_view_t *pview = NULL; /* Production view */
dns_zone_t *zone = NULL; /* New or reused zone */
dns_zone_t *raw = NULL; /* New or reused raw zone */
@@ -6741,7 +6854,7 @@ configure_zone(const cfg_obj_t *config, const cfg_obj_t *zconfig,
}
}
if (view->catzs != NULL &&
if (!is_catz_member && view->catzs != NULL &&
dns_catz_get_zone(view->catzs, origin) != NULL)
{
zone_is_catz = true;
@@ -7064,6 +7177,13 @@ directory_callback(const char *clausename, const cfg_obj_t *obj, void *arg) {
return (result);
}
char cwd[PATH_MAX];
if (getcwd(cwd, sizeof(cwd)) == cwd) {
isc_log_write(named_g_lctx, NAMED_LOGCATEGORY_GENERAL,
NAMED_LOGMODULE_SERVER, ISC_LOG_INFO,
"the working directory is now '%s'", cwd);
}
return (ISC_R_SUCCESS);
}
@@ -8042,7 +8162,7 @@ configure_newzones(dns_view_t *view, cfg_obj_t *config, cfg_obj_t *vconfig,
CHECK(configure_zone(config, zconfig, vconfig, mctx, view,
&named_g_server->viewlist,
&named_g_server->kasplist, actx, true,
false, false));
false, false, false));
}
result = ISC_R_SUCCESS;
@@ -8226,7 +8346,7 @@ configure_newzone(const cfg_obj_t *zconfig, cfg_obj_t *config,
cfg_aclconfctx_t *actx) {
return (configure_zone(
config, zconfig, vconfig, mctx, view, &named_g_server->viewlist,
&named_g_server->kasplist, actx, true, false, false));
&named_g_server->kasplist, actx, true, false, false, false));
}
/*%
@@ -8535,6 +8655,19 @@ load_configuration(const char *filename, named_server_t *server,
&named_g_defaults) == ISC_R_SUCCESS);
}
/*
* Log the current working directory.
*/
if (first_time) {
char cwd[PATH_MAX];
if (getcwd(cwd, sizeof(cwd)) == cwd) {
isc_log_write(named_g_lctx, NAMED_LOGCATEGORY_GENERAL,
NAMED_LOGMODULE_SERVER, ISC_LOG_INFO,
"the initial working directory is '%s'",
cwd);
}
}
/*
* Parse the configuration file using the new config code.
*/
@@ -10408,7 +10541,7 @@ fatal(named_server_t *server, const char *msg, isc_result_t result) {
NAMED_LOGMODULE_SERVER, ISC_LOG_CRITICAL,
"exiting (due to fatal error)");
named_os_shutdown();
exit(1);
_exit(EXIT_FAILURE);
}
static void
@@ -13920,7 +14053,7 @@ do_addzone(named_server_t *server, ns_cfgctx_t *cfg, dns_view_t *view,
result = configure_zone(cfg->config, zoneobj, cfg->vconfig,
server->mctx, view, &server->viewlist,
&server->kasplist, cfg->actx, true, false,
false);
false, false);
dns_view_freeze(view);
isc_task_endexclusive(server->task);
@@ -14108,7 +14241,7 @@ do_modzone(named_server_t *server, ns_cfgctx_t *cfg, dns_view_t *view,
result = configure_zone(cfg->config, zoneobj, cfg->vconfig,
server->mctx, view, &server->viewlist,
&server->kasplist, cfg->actx, true, false,
true);
false, true);
dns_view_freeze(view);
exclusive = false;
+24 -2
View File
@@ -3434,6 +3434,11 @@ render_json_traffic(const isc_httpd_t *httpd, const isc_httpdurl_t *urlinfo,
#endif /* HAVE_JSON_C */
#if HAVE_LIBXML2
/*
* This is only needed if we have libxml2 and was confusingly returned if
* neither of libxml2 or json-c is configured.
*/
static isc_result_t
render_xsl(const isc_httpd_t *httpd, const isc_httpdurl_t *urlinfo, void *args,
unsigned int *retcode, const char **retmsg, const char **mimetype,
@@ -3489,6 +3494,7 @@ send:
end:
return (ISC_R_SUCCESS);
}
#endif
static void
shutdown_listener(named_statschannel_t *listener) {
@@ -3501,6 +3507,7 @@ shutdown_listener(named_statschannel_t *listener) {
isc_httpdmgr_shutdown(&listener->httpdmgr);
}
#if defined(HAVE_LIBXML2) || defined(HAVE_JSON_C)
static bool
client_ok(const isc_sockaddr_t *fromaddr, void *arg) {
named_statschannel_t *listener = arg;
@@ -3531,7 +3538,9 @@ client_ok(const isc_sockaddr_t *fromaddr, void *arg) {
return (false);
}
#endif
#if defined(HAVE_LIBXML2) || defined(HAVE_JSON_C)
static void
destroy_listener(void *arg) {
named_statschannel_t *listener = (named_statschannel_t *)arg;
@@ -3545,12 +3554,24 @@ destroy_listener(void *arg) {
isc_mutex_destroy(&listener->lock);
isc_mem_putanddetach(&listener->mctx, listener, sizeof(*listener));
}
#endif
static isc_result_t
add_listener(named_server_t *server, named_statschannel_t **listenerp,
const cfg_obj_t *listen_params, const cfg_obj_t *config,
isc_sockaddr_t *addr, cfg_aclconfctx_t *aclconfctx,
const char *socktext) {
#if !defined(HAVE_LIBXML2) && !defined(HAVE_JSON_C)
UNUSED(server);
UNUSED(listenerp);
UNUSED(listen_params);
UNUSED(config);
UNUSED(addr);
UNUSED(aclconfctx);
UNUSED(socktext);
return (ISC_R_NOTIMPLEMENTED);
#else
isc_result_t result;
named_statschannel_t *listener = NULL;
const cfg_obj_t *allow = NULL;
@@ -3616,6 +3637,8 @@ add_listener(named_server_t *server, named_statschannel_t **listenerp,
isc_httpdmgr_addurl(listener->httpdmgr,
"/xml/v" STATS_XML_VERSION_MAJOR "/traffic", false,
render_xml_traffic, server);
isc_httpdmgr_addurl(listener->httpdmgr, "/bind9.xsl", true, render_xsl,
server);
#endif /* ifdef HAVE_LIBXML2 */
#ifdef HAVE_JSON_C
isc_httpdmgr_addurl(listener->httpdmgr, "/json", false, render_json_all,
@@ -3645,8 +3668,6 @@ add_listener(named_server_t *server, named_statschannel_t **listenerp,
"/json/v" STATS_JSON_VERSION_MAJOR "/traffic",
false, render_json_traffic, server);
#endif /* ifdef HAVE_JSON_C */
isc_httpdmgr_addurl(listener->httpdmgr, "/bind9.xsl", true, render_xsl,
server);
*listenerp = listener;
isc_log_write(named_g_lctx, NAMED_LOGCATEGORY_GENERAL,
@@ -3663,6 +3684,7 @@ cleanup:
isc_mem_putanddetach(&listener->mctx, listener, sizeof(*listener));
return (result);
#endif
}
static void
+16
View File
@@ -1083,6 +1083,22 @@ named_zone_configure(const cfg_obj_t *config, const cfg_obj_t *vconfig,
dns_zone_setmaxrecords(zone, 0);
}
obj = NULL;
result = named_config_get(maps, "max-records-per-type", &obj);
INSIST(result == ISC_R_SUCCESS && obj != NULL);
dns_zone_setmaxrrperset(mayberaw, cfg_obj_asuint32(obj));
if (zone != mayberaw) {
dns_zone_setmaxrrperset(zone, 0);
}
obj = NULL;
result = named_config_get(maps, "max-types-per-name", &obj);
INSIST(result == ISC_R_SUCCESS && obj != NULL);
dns_zone_setmaxtypepername(mayberaw, cfg_obj_asuint32(obj));
if (zone != mayberaw) {
dns_zone_setmaxtypepername(zone, 0);
}
if (raw != NULL && filename != NULL) {
#define SIGNED ".signed"
size_t signedlen = strlen(filename) + sizeof(SIGNED);
+17 -17
View File
@@ -266,7 +266,7 @@ fatal(const char *format, ...) {
vfprintf(stderr, format, args);
va_end(args);
fprintf(stderr, "\n");
exit(1);
_exit(EXIT_FAILURE);
}
static void
@@ -499,7 +499,7 @@ setup_keystr(void) {
name = secretstr;
secretstr = n + 1;
if (!parse_hmac(&hmacname, keystr, s - keystr, &digestbits)) {
exit(1);
exit(EXIT_FAILURE);
}
} else {
hmacname = DNS_TSIG_HMACMD5_NAME;
@@ -1027,7 +1027,7 @@ pre_parse_args(int argc, char **argv) {
"| -k keyfile] [-p port] "
"[-v] [-V] [-P] [-T] [-4 | -6] "
"[filename]\n");
exit(1);
exit(EXIT_FAILURE);
case 'P':
for (t = 0xff00; t <= 0xfffe; t++) {
@@ -1065,7 +1065,7 @@ pre_parse_args(int argc, char **argv) {
}
}
if (doexit) {
exit(0);
exit(EXIT_SUCCESS);
}
isc_commandline_reset = true;
isc_commandline_index = 1;
@@ -1124,7 +1124,7 @@ parse_args(int argc, char **argv) {
"bad library debug value "
"'%s'\n",
isc_commandline_argument);
exit(1);
exit(EXIT_FAILURE);
}
logdebuglevel = i;
break;
@@ -1153,7 +1153,7 @@ parse_args(int argc, char **argv) {
"bad port number "
"'%s'\n",
isc_commandline_argument);
exit(1);
exit(EXIT_FAILURE);
}
break;
case 't':
@@ -1162,7 +1162,7 @@ parse_args(int argc, char **argv) {
if (result != ISC_R_SUCCESS) {
fprintf(stderr, "bad timeout '%s'\n",
isc_commandline_argument);
exit(1);
exit(EXIT_FAILURE);
}
if (timeout == 0) {
timeout = UINT_MAX;
@@ -1174,7 +1174,7 @@ parse_args(int argc, char **argv) {
if (result != ISC_R_SUCCESS) {
fprintf(stderr, "bad udp timeout '%s'\n",
isc_commandline_argument);
exit(1);
exit(EXIT_FAILURE);
}
break;
case 'r':
@@ -1183,7 +1183,7 @@ parse_args(int argc, char **argv) {
if (result != ISC_R_SUCCESS) {
fprintf(stderr, "bad udp retries '%s'\n",
isc_commandline_argument);
exit(1);
exit(EXIT_FAILURE);
}
break;
@@ -1194,19 +1194,19 @@ parse_args(int argc, char **argv) {
default:
fprintf(stderr, "%s: unhandled option: %c\n", argv[0],
isc_commandline_option);
exit(1);
exit(EXIT_FAILURE);
}
}
if (keyfile != NULL && keystr != NULL) {
fprintf(stderr, "%s: cannot specify both -k and -y\n", argv[0]);
exit(1);
exit(EXIT_FAILURE);
}
#if HAVE_GSSAPI
if (usegsstsig && (keyfile != NULL || keystr != NULL)) {
fprintf(stderr, "%s: cannot specify -g with -k or -y\n",
argv[0]);
exit(1);
exit(EXIT_FAILURE);
}
#else /* HAVE_GSSAPI */
if (usegsstsig) {
@@ -1214,7 +1214,7 @@ parse_args(int argc, char **argv) {
"%s: cannot specify -g or -o, "
"program not linked with GSS API Library\n",
argv[0]);
exit(1);
exit(EXIT_FAILURE);
}
#endif /* HAVE_GSSAPI */
@@ -1228,7 +1228,7 @@ parse_args(int argc, char **argv) {
fprintf(stderr, "could not open '%s': %s\n",
argv[isc_commandline_index],
isc_result_totext(result));
exit(1);
exit(EXIT_FAILURE);
}
}
if (!force_interactive) {
@@ -2072,7 +2072,7 @@ show_message(FILE *stream, dns_message_t *msg, const char *description) {
if (bufsz > MAXTEXT) {
fprintf(stderr, "could not allocate large enough "
"buffer to display message\n");
exit(1);
exit(EXIT_FAILURE);
}
if (buf != NULL) {
isc_buffer_free(&buf);
@@ -3457,7 +3457,7 @@ main(int argc, char **argv) {
if (seenerror) {
return (2);
} else {
return (0);
}
return (0);
}
+1 -1
View File
@@ -1014,7 +1014,7 @@ main(int argc, char **argv) {
default:
fprintf(stderr, "%s: unhandled option -%c\n", program,
isc_commandline_option);
exit(1);
exit(EXIT_FAILURE);
}
}
+2 -1
View File
@@ -18,6 +18,7 @@
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <isc/print.h>
@@ -45,5 +46,5 @@ fatal(const char *format, ...) {
vfprintf(stderr, format, args);
va_end(args);
fprintf(stderr, "\n");
exit(1);
_exit(EXIT_FAILURE);
}
+1 -1
View File
@@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python3
#
# Copyright (C) Internet Systems Consortium, Inc. ("ISC")
#
+1
View File
@@ -108,6 +108,7 @@ TESTS = \
checknames \
checkzone \
cookie \
cpu \
database \
dialup \
digdelv \
+1
View File
@@ -27,6 +27,7 @@ options {
listen-on-v6 { fd92:7065:b8e:ffff::2; };
notify no;
recursion no;
#T5 allow-query { 10.53.0.99; };
serial-query-rate 100;
dnssec-validation no;
};
+17
View File
@@ -703,6 +703,23 @@ wait_for_soa @10.53.0.2 dom3.example. dig.out.test$n || ret=1
if [ $ret -ne 0 ]; then echo_i "failed"; fi
status=$((status + ret))
# GL #4733
n=$((n + 1))
echo_i "reconfiguring secondary - checking if catz member zones are reconfigured ($n)"
ret=0
sed -e "s/^#T5//" <ns2/named1.conf.in >ns2/named.conf.tmp
copy_setports ns2/named.conf.tmp ns2/named.conf
rndccmd 10.53.0.2 reconfig || ret=1
if [ $ret -ne 0 ]; then echo_i "failed"; fi
status=$((status + ret))
n=$((n + 1))
echo_i "checking that dom3.example. is refused by secondary because of an activated allow-query ($n)"
ret=0
wait_for_no_soa @10.53.0.2 dom3.example. dig.out.test$n || ret=1
if [ $ret -ne 0 ]; then echo_i "failed"; fi
status=$((status + ret))
n=$((n + 1))
echo_i "reconfiguring secondary - reverting the bad configuration ($n)"
ret=0
+20 -3
View File
@@ -35,11 +35,28 @@ key rndc_key {
algorithm @DEFAULT_HMAC@;
};
key restart16 {
secret "1234abcd8765";
algorithm @DEFAULT_HMAC@;
};
controls {
inet 10.53.0.7 port @CONTROLPORT@ allow { any; } keys { rndc_key; };
};
zone "." {
type hint;
file "root.hint";
view restart16 {
match-clients { key restart16; none; };
max-query-restarts 16;
zone "." {
type hint;
file "root.hint";
};
};
view default {
zone "." {
type hint;
file "root.hint";
};
};
+16 -4
View File
@@ -439,12 +439,24 @@ if [ $ret != 0 ]; then echo_i "failed"; fi
status=$((status + ret))
n=$((n + 1))
echo_i "checking CNAME loops are detected ($n)"
echo_i "checking CNAME loops are detected (resolver) ($n)"
ret=0
$RNDCCMD 10.53.0.7 null --- start test$n --- 2>&1 | sed 's/^/ns7 /' | cat_i
$DIG $DIGOPTS @10.53.0.7 loop.example >dig.out.test$n
grep "status: NOERROR" dig.out.test$n >/dev/null || ret=1
grep "ANSWER: 17" dig.out.test$n >/dev/null || ret=1
$DIG $DIGOPTS @10.53.0.7 loop.example >dig.out.1.test$n
grep "status: NOERROR" dig.out.1.test$n >/dev/null || ret=1
grep "ANSWER: 12" dig.out.1.test$n >/dev/null || ret=1
# also check with max-query-restarts 16:
$DIG $DIGOPTS @10.53.0.7 -y "${DEFAULT_HMAC}:restart16:1234abcd8765" loop.example >dig.out.2.test$n
grep "status: NOERROR" dig.out.2.test$n >/dev/null || ret=1
grep "ANSWER: 17" dig.out.2.test$n >/dev/null || ret=1
n=$((n + 1))
echo_i "checking CNAME loops are detected (auth) ($n)"
ret=0
$DIG $DIGOPTS @10.53.0.2 loop.example >dig.out.test$n
grep "status: SERVFAIL" dig.out.test$n >/dev/null || ret=1
grep "max. restarts reached" dig.out.test$n >/dev/null || ret=1
grep "ANSWER: 12" dig.out.test$n >/dev/null || ret=1
if [ $ret != 0 ]; then echo_i "failed"; fi
status=$((status + ret))
+2
View File
@@ -77,6 +77,7 @@ options {
check-names primary warn;
check-names secondary ignore;
max-cache-size 20000000000000;
max-query-restarts 10;
nta-lifetime 604800;
nta-recheck 604800;
validate-except {
@@ -109,6 +110,7 @@ view "first" {
max-ixfr-ratio unlimited;
};
dnssec-validation auto;
max-query-restarts 15;
zone-statistics terse;
};
view "second" {
+21 -75
View File
@@ -24,7 +24,6 @@ pytest.importorskip("dns", minversion="2.0.0")
import dns.exception
import dns.message
import dns.name
import dns.query
import dns.rcode
import dns.rdataclass
import dns.rdatatype
@@ -60,16 +59,9 @@ def has_signed_apex_nsec(zone, response):
def do_query(server, qname, qtype, tcp=False):
query = dns.message.make_query(qname, qtype, use_edns=True, want_dnssec=True)
try:
if tcp:
response = dns.query.tcp(query, server.ip, timeout=3, port=server.ports.dns)
else:
response = dns.query.udp(query, server.ip, timeout=3, port=server.ports.dns)
except dns.exception.Timeout:
print(f"error: query timeout for query {qname} {qtype} to {server.ip}")
return None
msg = dns.message.make_query(qname, qtype, use_edns=True, want_dnssec=True)
query_func = isctest.query.tcp if tcp else isctest.query.udp
response = query_func(msg, server.ip, expected_rcode=dns.rcode.NOERROR)
return response
@@ -96,41 +88,26 @@ def verify_zone(zone, transfer):
def read_statefile(server, zone):
addr = server.ip
count = 0
keyid = 0
state = {}
response = do_query(server, zone, "DS", tcp=True)
if not isinstance(response, dns.message.Message):
print(f"error: no response for {zone}. DS from {addr}")
return {}
# fetch key id from response.
for rr in response.answer:
if rr.match(
dns.name.from_text(zone),
dns.rdataclass.IN,
dns.rdatatype.DS,
dns.rdatatype.NONE,
):
if count == 0:
keyid = list(dict(rr.items).items())[0][0].key_tag
count += 1
if response.rcode() == dns.rcode.NOERROR:
# fetch key id from response.
for rr in response.answer:
if rr.match(
dns.name.from_text(zone),
dns.rdataclass.IN,
dns.rdatatype.DS,
dns.rdatatype.NONE,
):
if count == 0:
keyid = list(dict(rr.items).items())[0][0].key_tag
count += 1
if count != 1:
print(
f"error: expected a single DS in response for {zone}. "
"from {addr}, got {count}"
)
return {}
else:
print(
f"error: {dns.rcode.to_text(response.rcode())} response for {zone}. "
"DNSKEY from {addr}"
)
return {}
assert (
count == 1
), f"expected a single DS in response for {zone} from {server.ip}, got {count}"
filename = f"ns9/K{zone}.+013+{keyid:05d}.state"
print(f"read state file {filename}")
@@ -142,7 +119,6 @@ def read_statefile(server, zone):
continue
key, val = line.strip().split(":", 1)
state[key.strip()] = val.strip()
except FileNotFoundError:
# file may not be written just yet.
return {}
@@ -151,43 +127,13 @@ def read_statefile(server, zone):
def zone_check(server, zone):
addr = server.ip
# wait until zone is fully signed.
signed = False
for _ in range(10):
response = do_query(server, zone, "NSEC")
if not isinstance(response, dns.message.Message):
print(f"error: no response for {zone}. NSEC from {addr}")
elif response.rcode() == dns.rcode.NOERROR:
signed = has_signed_apex_nsec(zone, response)
else:
print(
f"error: {dns.rcode.to_text(response.rcode())} response for {zone}. "
"NSEC from {addr}"
)
if signed:
break
time.sleep(1)
assert signed
# check zone is fully signed.
response = do_query(server, zone, "NSEC")
assert has_signed_apex_nsec(zone, response)
# check if zone if DNSSEC valid.
verified = False
transfer = do_query(server, zone, "AXFR", tcp=True)
if not isinstance(transfer, dns.message.Message):
print(f"error: no response for {zone}. AXFR from {addr}")
elif transfer.rcode() == dns.rcode.NOERROR:
verified = verify_zone(zone, transfer)
else:
print(
f"error: {dns.rcode.to_text(transfer.rcode())} response for {zone}. "
"AXFR from {addr}"
)
assert verified
assert verify_zone(zone, transfer)
def keystate_check(server, zone, key):
@@ -0,0 +1,17 @@
; Copyright (C) Internet Systems Consortium, Inc. ("ISC")
;
; SPDX-License-Identifier: MPL-2.0
;
; This Source Code Form is subject to the terms of the Mozilla Public
; License, v. 2.0. If a copy of the MPL was not distributed with this
; file, you can obtain one at https://mozilla.org/MPL/2.0/.
;
; See the COPYRIGHT file distributed with this work for additional
; information regarding copyright ownership.
$TTL 600
@ SOA ns hostmaster 2011012708 3600 1200 604800 1200
NS ns
ns A 192.0.2.1
; invalid zero length alpn (at start) due to missing double escape
svcb SVCB 1 . alpn=\,abc
@@ -0,0 +1,17 @@
; Copyright (C) Internet Systems Consortium, Inc. ("ISC")
;
; SPDX-License-Identifier: MPL-2.0
;
; This Source Code Form is subject to the terms of the Mozilla Public
; License, v. 2.0. If a copy of the MPL was not distributed with this
; file, you can obtain one at https://mozilla.org/MPL/2.0/.
;
; See the COPYRIGHT file distributed with this work for additional
; information regarding copyright ownership.
$TTL 600
@ SOA ns hostmaster 2011012708 3600 1200 604800 1200
NS ns
ns A 192.0.2.1
; invalid zero length alpn (in midddle) due to missing double escape
svcb SVCB 1 . alpn=a\,\,abc
@@ -0,0 +1,17 @@
; Copyright (C) Internet Systems Consortium, Inc. ("ISC")
;
; SPDX-License-Identifier: MPL-2.0
;
; This Source Code Form is subject to the terms of the Mozilla Public
; License, v. 2.0. If a copy of the MPL was not distributed with this
; file, you can obtain one at https://mozilla.org/MPL/2.0/.
;
; See the COPYRIGHT file distributed with this work for additional
; information regarding copyright ownership.
$TTL 600
@ SOA ns hostmaster 2011012708 3600 1200 604800 1200
NS ns
ns A 192.0.2.1
; invalid zero length alpn (at end) due to missing double escape
svcb SVCB 1 . alpn=abc\,
@@ -0,0 +1,17 @@
; Copyright (C) Internet Systems Consortium, Inc. ("ISC")
;
; SPDX-License-Identifier: MPL-2.0
;
; This Source Code Form is subject to the terms of the Mozilla Public
; License, v. 2.0. If a copy of the MPL was not distributed with this
; file, you can obtain one at https://mozilla.org/MPL/2.0/.
;
; See the COPYRIGHT file distributed with this work for additional
; information regarding copyright ownership.
$TTL 600
@ SOA ns hostmaster 2011012708 3600 1200 604800 1200
NS ns
ns A 192.0.2.1
; invalid zero length alpn at start
svcb SVCB 1 . alpn=,abc
@@ -0,0 +1,17 @@
; Copyright (C) Internet Systems Consortium, Inc. ("ISC")
;
; SPDX-License-Identifier: MPL-2.0
;
; This Source Code Form is subject to the terms of the Mozilla Public
; License, v. 2.0. If a copy of the MPL was not distributed with this
; file, you can obtain one at https://mozilla.org/MPL/2.0/.
;
; See the COPYRIGHT file distributed with this work for additional
; information regarding copyright ownership.
$TTL 600
@ SOA ns hostmaster 2011012708 3600 1200 604800 1200
NS ns
ns A 192.0.2.1
; invalid zero length alpn in midddle
svcb SVCB 1 . alpn=a,,abc
@@ -0,0 +1,17 @@
; Copyright (C) Internet Systems Consortium, Inc. ("ISC")
;
; SPDX-License-Identifier: MPL-2.0
;
; This Source Code Form is subject to the terms of the Mozilla Public
; License, v. 2.0. If a copy of the MPL was not distributed with this
; file, you can obtain one at https://mozilla.org/MPL/2.0/.
;
; See the COPYRIGHT file distributed with this work for additional
; information regarding copyright ownership.
$TTL 600
@ SOA ns hostmaster 2011012708 3600 1200 604800 1200
NS ns
ns A 192.0.2.1
; invalid zero length alpn at end
svcb SVCB 1 . alpn=abc,
+1 -1
View File
@@ -20,7 +20,7 @@ testsock6() {
fi
}
export LANG=C
export LC_ALL=C
#
+3 -5
View File
@@ -345,9 +345,7 @@ def logger(request, system_test_name):
@pytest.fixture(scope="module")
def system_test_dir(
request, env, system_test_name
): # pylint: disable=too-many-statements,too-many-locals
def system_test_dir(request, env, system_test_name):
"""
Temporary directory for executing the test.
@@ -455,7 +453,7 @@ def system_test_dir(
unlink(symlink_dst)
def _run_script( # pylint: disable=too-many-arguments
def _run_script(
env,
system_test_dir: Path,
interpreter: str,
@@ -520,7 +518,7 @@ def run_tests_sh(system_test_dir, shell):
@pytest.fixture(scope="module", autouse=True)
def system_test( # pylint: disable=too-many-arguments,too-many-statements
def system_test(
request,
env: Dict[str, str],
system_test_dir,
+8 -4
View File
@@ -121,10 +121,14 @@ def create_response(msg, tcp, first, ns10):
)
elif labels[0] != "tcponly" or tcp:
cookie = o
if len(o.data) == 8:
cookie.data = o.data + o.data
else:
cookie.data = o.data
try:
if len(o.server) == 0:
cookie.server = o.client
except AttributeError: # dnspython<2.7.0 compat
if len(o.data) == 8:
cookie.data = o.data + o.data
else:
cookie.data = o.data
r.use_edns(options=[cookie])
r.flags |= dns.flags.AA
return r
@@ -1,3 +1,5 @@
#!/bin/sh
# Copyright (C) Internet Systems Consortium, Inc. ("ISC")
#
# SPDX-License-Identifier: MPL-2.0
@@ -9,6 +11,6 @@
# See the COPYRIGHT file distributed with this work for additional
# information regarding copyright ownership.
set -e
def test_verify(run_tests_sh):
run_tests_sh()
rm -f ./named.run.*
+20
View File
@@ -0,0 +1,20 @@
/*
* Copyright (C) Internet Systems Consortium, Inc. ("ISC")
*
* SPDX-License-Identifier: MPL-2.0
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, you can obtain one at https://mozilla.org/MPL/2.0/.
*
* See the COPYRIGHT file distributed with this work for additional
* information regarding copyright ownership.
*/
options {
query-source address 10.53.0.1;
port @PORT@;
pid-file "named.pid";
listen-on { 10.53.0.1; };
listen-on-v6 { none; };
};
@@ -11,11 +11,11 @@
# See the COPYRIGHT file distributed with this work for additional
# information regarding copyright ownership.
rm -f ns*/named.lock
rm -f verify.out*
rm -f zones/*.bad
rm -f zones/*.good
rm -f zones/*.out*
rm -f zones/*.tmp
rm -f zones/K*
rm -f zones/dsset-*
. ../conf.sh
command -v cpuset >/dev/null || command -v numactl >/dev/null || command -v taskset >/dev/null || {
echo_i "This test requires cpuset, numactl, or taskset." >&2
exit 255
}
exit 0
@@ -1,4 +1,4 @@
#!/bin/sh
#!/bin/sh -e
# Copyright (C) Internet Systems Consortium, Inc. ("ISC")
#
@@ -14,4 +14,8 @@
# shellcheck source=conf.sh
. ../conf.sh
set -e
$SHELL clean.sh
copy_setports ns1/named.conf.in ns1/named.conf
+65
View File
@@ -0,0 +1,65 @@
#!/bin/sh
# Copyright (C) Internet Systems Consortium, Inc. ("ISC")
#
# SPDX-License-Identifier: MPL-2.0
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, you can obtain one at https://mozilla.org/MPL/2.0/.
#
# See the COPYRIGHT file distributed with this work for additional
# information regarding copyright ownership.
# shellcheck source=conf.sh
. ../conf.sh
status=0
n=0
CPUSET=$(command -v cpuset)
NUMACTL=$(command -v numactl)
TASKSET=$(command -v taskset)
cpulist() (
if [ -n "$CPUSET" ]; then
cpuset -g | head -1 | sed -e "s/.*: //" | tr -s ', ' '\n'
elif [ -n "$NUMACTL" ]; then
numactl --show | sed -ne 's/^physcpubind: //p' | tr -s ' ' '\n'
elif [ -n "$TASKSET" ]; then
# shellcheck disable=SC2046
seq $(taskset -c -p $$ | sed -e 's/.*: //' | tr -s ' -' ' ')
else
echo 0
fi
)
cpulimit() (
set -x
min_cpu="${1}"
shift
max_cpu="${1}"
shift
if [ -n "$CPUSET" ]; then
cpuset -l "${min_cpu}-${max_cpu}" "$@" 2>&1
elif [ -n "$NUMACTL" ]; then
numactl --physcpubind="${min_cpu}-${max_cpu}" "$@" 2>&1
elif [ -n "$TASKSET" ]; then
taskset -c "${min_cpu}-${max_cpu}" "$@" 2>&1
fi
)
ret=0
for cpu in $(cpulist); do
n=$((n + 1))
echo_i "testing that limiting CPU sets to 0-${cpu} works ($n)"
cpulimit 0 "$cpu" "$NAMED" -g >named.run.$n 2>&1 || true
ncpus=$(sed -ne 's/.*found \([0-9]*\) CPU.*\([0-9]*\) worker thread.*/\1/p' named.run.$n)
[ "$ncpus" -eq "$((cpu + 1))" ] || ret=1
done
test "$ret" -eq 0 || echo_i "failed"
status=$((status + ret))
echo_i "exit status: $status"
[ $status -eq 0 ] || exit 1
@@ -10,5 +10,5 @@
# information regarding copyright ownership.
def test_tools(run_tests_sh):
def test_cpu(run_tests_sh):
run_tests_sh()
@@ -49,3 +49,42 @@ hours 10800 A 10.53.0.2
minutes 2700 A 10.53.0.2
;TTL of 45 seconds
seconds 45 A 10.53.0.2
; domain names with yaml special values and data with ': '
yaml TXT "a: b"
'.yaml TXT "a: b"
[.yaml TXT "a: b"
{.yaml TXT "a: b"
&.yaml TXT "a: b"
#.yaml TXT "a: b"
all.yaml TXT ( \000 \001 \002 \003 \004 \005 \006 \007
\008 \009 \010 \011 \012 \013 \014 \015
\016 \017 \018 \019 \020 \021 \022 \023
\024 \025 \026 \027 \028 \029 \030 \031
\032 \033 \034 \035 \036 \037 \038 \039
\040 \041 \042 \043 \044 \045 \046 \047
\048 \049 \050 \051 \052 \053 \054 \055
\056 \057 \058 \059 \060 \061 \062 \063
\064 \065 \066 \067 \068 \069 \070 \071
\072 \073 \074 \075 \076 \077 \078 \079
\080 \081 \082 \083 \084 \085 \086 \087
\088 \089 \090 \091 \092 \093 \094 \095
\096 \097 \098 \099 \100 \101 \102 \103
\104 \105 \106 \107 \108 \109 \110 \111
\112 \113 \114 \115 \116 \117 \118 \119
\120 \121 \122 \123 \124 \125 \126 \127
\128 \129 \130 \131 \132 \133 \134 \135
\136 \137 \138 \139 \140 \141 \142 \143
\144 \145 \146 \147 \148 \149 \150 \151
\152 \153 \154 \155 \156 \157 \158 \159
\160 \161 \162 \163 \164 \165 \166 \167
\168 \169 \170 \171 \172 \173 \174 \175
\176 \177 \178 \179 \180 \181 \182 \183
\184 \185 \186 \187 \188 \189 \190 \191
\192 \193 \194 \195 \196 \197 \198 \199
\200 \201 \202 \203 \204 \205 \206 \207
\208 \209 \210 \211 \212 \213 \214 \215
\216 \217 \218 \219 \220 \221 \222 \223
\224 \225 \226 \227 \228 \229 \230 \231
\232 \233 \234 \235 \236 \237 \238 \239
\240 \241 \242 \243 \244 \245 \246 \247
\248 \249 \250 \251 \252 \253 \254 \255 )
+65
View File
@@ -662,6 +662,7 @@ if [ -x "$DIG" ]; then
n=$((n + 1))
echo_i "check that Extended DNS Error 0 is printed correctly ($n)"
ret=0
# First defined EDE code, additional text "foo".
dig_with_opts @10.53.0.3 +ednsopt=ede:0000666f6f a.example +qr >dig.out.test$n 2>&1 || ret=1
pat='^; EDE: 0 (Other): (foo)$'
@@ -671,6 +672,7 @@ if [ -x "$DIG" ]; then
n=$((n + 1))
echo_i "check that Extended DNS Error 24 is printed correctly ($n)"
ret=0
# Last defined EDE code, no additional text.
dig_with_opts @10.53.0.3 +ednsopt=ede:0018 a.example +qr >dig.out.test$n 2>&1 || ret=1
pat='^; EDE: 24 (Invalid Data)$'
@@ -680,6 +682,7 @@ if [ -x "$DIG" ]; then
n=$((n + 1))
echo_i "check that Extended DNS Error 25 is printed correctly ($n)"
ret=0
# First undefined EDE code, additional text "foo".
dig_with_opts @10.53.0.3 +ednsopt=ede:0019666f6f a.example +qr >dig.out.test$n 2>&1 || ret=1
pat='^; EDE: 25: (foo)$'
@@ -689,6 +692,7 @@ if [ -x "$DIG" ]; then
n=$((n + 1))
echo_i "check that invalid Extended DNS Error (length 0) is printed ($n)"
ret=0
# EDE payload is too short
dig_with_opts @10.53.0.3 +ednsopt=ede a.example +qr >dig.out.test$n 2>&1 || ret=1
pat='^; EDE:$'
@@ -698,6 +702,7 @@ if [ -x "$DIG" ]; then
n=$((n + 1))
echo_i "check that invalid Extended DNS Error (length 1) is printed ($n)"
ret=0
# EDE payload is too short
dig_with_opts @10.53.0.3 +ednsopt=ede:00 a.example +qr >dig.out.test$n 2>&1 || ret=1
pat='^; EDE: 00 (".")$'
@@ -708,6 +713,7 @@ if [ -x "$DIG" ]; then
if [ $HAS_PYYAML -ne 0 ]; then
n=$((n + 1))
echo_i "check that +yaml Extended DNS Error 0 is printed correctly ($n)"
ret=0
# First defined EDE code, additional text "foo".
dig_with_opts @10.53.0.3 +yaml +ednsopt=ede:0000666f6f a.example +qr >dig.out.test$n 2>&1 || ret=1
$PYTHON yamlget.py dig.out.test$n 0 message query_message_data OPT_PSEUDOSECTION EDNS EDE INFO-CODE >yamlget.out.test$n 2>&1 || ret=1
@@ -721,6 +727,7 @@ if [ -x "$DIG" ]; then
n=$((n + 1))
echo_i "check that +yaml Extended DNS Error 24 is printed correctly ($n)"
ret=0
# Last defined EDE code, no additional text.
dig_with_opts @10.53.0.3 +yaml +ednsopt=ede:0018 a.example +qr >dig.out.test$n 2>&1 || ret=1
$PYTHON yamlget.py dig.out.test$n 0 message query_message_data OPT_PSEUDOSECTION EDNS EDE INFO-CODE >yamlget.out.test$n 2>&1 || ret=1
@@ -732,6 +739,7 @@ if [ -x "$DIG" ]; then
n=$((n + 1))
echo_i "check that +yaml Extended DNS Error 25 is printed correctly ($n)"
ret=0
# First undefined EDE code, additional text "foo".
dig_with_opts @10.53.0.3 +yaml +ednsopt=ede:0019666f6f a.example +qr >dig.out.test$n 2>&1 || ret=1
$PYTHON yamlget.py dig.out.test$n 0 message query_message_data OPT_PSEUDOSECTION EDNS EDE INFO-CODE >yamlget.out.test$n 2>&1 || ret=1
@@ -745,6 +753,7 @@ if [ -x "$DIG" ]; then
n=$((n + 1))
echo_i "check that invalid Extended DNS Error (length 0) is printed ($n)"
ret=0
# EDE payload is too short
dig_with_opts @10.53.0.3 +yaml +ednsopt=ede a.example +qr >dig.out.test$n 2>&1 || ret=1
$PYTHON yamlget.py dig.out.test$n 0 message query_message_data OPT_PSEUDOSECTION EDNS EDE >yamlget.out.test$n 2>&1 || ret=1
@@ -755,6 +764,7 @@ if [ -x "$DIG" ]; then
n=$((n + 1))
echo_i "check that invalid +yaml Extended DNS Error (length 1) is printed ($n)"
ret=0
# EDE payload is too short
dig_with_opts @10.53.0.3 +yaml +ednsopt=ede:00 a.example +qr >dig.out.test$n 2>&1 || ret=1
$PYTHON yamlget.py dig.out.test$n 0 message query_message_data OPT_PSEUDOSECTION EDNS EDE >yamlget.out.test$n 2>&1 || ret=1
@@ -1407,5 +1417,60 @@ else
echo_i "$DELV is needed, so skipping these delv tests"
fi
if [ $HAS_PYYAML -ne 0 ]; then
for qname in "yaml" "'.yaml" "[.yaml" "{.yaml" "&.yaml" "#.yaml"; do
n=$((n + 1))
echo_i "check yaml special '${yaml}.example' ($n)"
ret=0
dig_with_opts @10.53.0.3 +yaml "${qname}.example" TXT +qr >dig.out.test$n 2>&1 || ret=1
$PYTHON yamlget.py dig.out.test$n 0 message query_message_data QUESTION_SECTION 0 >yamlget.out.test$n 2>&1 || ret=1
read -r value <yamlget.out.test$n
[ "$value" = "${qname}.example. IN TXT" ] || ret=1
$PYTHON yamlget.py dig.out.test$n 1 message response_message_data ANSWER_SECTION 0 >yamlget.out.test$n 2>&1 || ret=1
read -r value <yamlget.out.test$n
[ "$value" = "${qname}"'.example. 300 IN TXT "a: b"' ] || ret=1
if [ $ret -ne 0 ]; then echo_i "failed"; fi
status=$((status + ret))
done
n=$((n + 1))
echo_i "check yaml character values ($n)"
ret=0
dig_with_opts @10.53.0.3 +yaml "all.yaml.example" TXT +qr >dig.out.test$n 2>&1 || ret=1
$PYTHON yamlget.py dig.out.test$n 1 message response_message_data ANSWER_SECTION 0 >yamlget.out.test$n 2>&1 || ret=1
read -r value <yamlget.out.test$n
expected='all.yaml.example. 300 IN TXT'
expected="$expected "'"\000" "\001" "\002" "\003" "\004" "\005" "\006" "\007"'
expected="$expected "'"\008" "\009" "\010" "\011" "\012" "\013" "\014" "\015"'
expected="$expected "'"\016" "\017" "\018" "\019" "\020" "\021" "\022" "\023"'
expected="$expected "'"\024" "\025" "\026" "\027" "\028" "\029" "\030" "\031"'
expected="$expected "'" " "!" "\"" "#" "$" "%" "&" "'"'"'" "(" ")" "*" "+" ","'
expected="$expected "'"-" "." "/" "0" "1" "2" "3" "4" "5" "6" "7" "8" "9" ":"'
expected="$expected "'";" "<" "=" ">" "?" "@" "A" "B" "C" "D" "E" "F" "G" "H"'
expected="$expected "'"I" "J" "K" "L" "M" "N" "O" "P" "Q" "R" "S" "T" "U" "V"'
expected="$expected "'"W" "X" "Y" "Z" "[" "\\" "]" "^" "_" "`" "a" "b" "c" "d"'
expected="$expected "'"e" "f" "g" "h" "i" "j" "k" "l" "m" "n" "o" "p" "q" "r"'
expected="$expected "'"s" "t" "u" "v" "w" "x" "y" "z" "{" "|" "}" "~" "\127"'
expected="$expected "'"\128" "\129" "\130" "\131" "\132" "\133" "\134" "\135"'
expected="$expected "'"\136" "\137" "\138" "\139" "\140" "\141" "\142" "\143"'
expected="$expected "'"\144" "\145" "\146" "\147" "\148" "\149" "\150" "\151"'
expected="$expected "'"\152" "\153" "\154" "\155" "\156" "\157" "\158" "\159"'
expected="$expected "'"\160" "\161" "\162" "\163" "\164" "\165" "\166" "\167"'
expected="$expected "'"\168" "\169" "\170" "\171" "\172" "\173" "\174" "\175"'
expected="$expected "'"\176" "\177" "\178" "\179" "\180" "\181" "\182" "\183"'
expected="$expected "'"\184" "\185" "\186" "\187" "\188" "\189" "\190" "\191"'
expected="$expected "'"\192" "\193" "\194" "\195" "\196" "\197" "\198" "\199"'
expected="$expected "'"\200" "\201" "\202" "\203" "\204" "\205" "\206" "\207"'
expected="$expected "'"\208" "\209" "\210" "\211" "\212" "\213" "\214" "\215"'
expected="$expected "'"\216" "\217" "\218" "\219" "\220" "\221" "\222" "\223"'
expected="$expected "'"\224" "\225" "\226" "\227" "\228" "\229" "\230" "\231"'
expected="$expected "'"\232" "\233" "\234" "\235" "\236" "\237" "\238" "\239"'
expected="$expected "'"\240" "\241" "\242" "\243" "\244" "\245" "\246" "\247"'
expected="$expected "'"\248" "\249" "\250" "\251" "\252" "\253" "\254" "\255"'
[ "$value" = "$expected" ] || ret=1
if [ $ret -ne 0 ]; then echo_i "failed"; fi
status=$((status + ret))
fi
echo_i "exit status: $status"
[ $status -eq 0 ] || exit 1
+4 -5
View File
@@ -12,16 +12,15 @@
# information regarding copyright ownership.
import pytest
import isctest
pytest.importorskip("dns")
import dns.message
import dns.query
import dns.rcode
def test_connreset(named_port):
def test_connreset():
msg = dns.message.make_query(
"sub.example.", "A", want_dnssec=True, use_edns=0, payload=1232
)
ans = dns.query.udp(msg, "10.53.0.2", timeout=10, port=named_port)
assert ans.rcode() == dns.rcode.SERVFAIL
res = isctest.query.udp(msg, "10.53.0.2")
isctest.check.servfail(res)
+9 -9
View File
@@ -15,10 +15,12 @@ import os
import re
import subprocess
import isctest
import pytest
import dns.message
pytest.importorskip("dns", minversion="2.0.0")
import dns.resolver
def run_rndc(server, rndc_command):
@@ -34,15 +36,13 @@ def run_rndc(server, rndc_command):
subprocess.check_output(cmdline, stderr=subprocess.STDOUT, timeout=10)
def test_dnstap_dispatch_socket_addresses(named_port):
# Prepare for querying ns3.
resolver = dns.resolver.Resolver()
resolver.nameservers = ["10.53.0.3"]
resolver.port = named_port
def test_dnstap_dispatch_socket_addresses():
# Send some query to ns3 so that it records something in its dnstap file.
ans = resolver.resolve("mail.example.", "A")
assert ans[0].address == "10.0.0.2"
msg = dns.message.make_query("mail.example.", "A")
res = isctest.query.tcp(msg, "10.53.0.2", expected_rcode=dns.rcode.NOERROR)
assert res.answer == [
dns.rrset.from_text("mail.example.", 300, "IN", "A", "10.0.0.2")
]
# Before continuing, roll dnstap file to ensure it is flushed to disk.
run_rndc("10.53.0.3", ["dnstap", "-roll", "1"])
+4
View File
@@ -2665,6 +2665,10 @@ unspec01.example. 3600 IN UNSPEC \# 1 04
uri01.example. 3600 IN URI 10 20 "https://www.isc.org/"
uri02.example. 3600 IN URI 30 40 "https://www.isc.org/HolyCowThisSureIsAVeryLongURIRecordIDontEvenKnowWhatSomeoneWouldEverWantWithSuchAThingButTheSpecificationRequiresThatWesupportItSoHereWeGoTestingItLaLaLaLaLaLaLaSeriouslyThoughWhyWouldYouEvenConsiderUsingAURIThisLongItSeemsLikeASillyIdeaButEnhWhatAreYouGonnaDo/"
uri03.example. 3600 IN URI 30 40 ""
wallet.example. 3600 IN WALLET "currency-identifer" "wallet-identifier"
wallet-multiple.example. 3600 IN WALLET "currency-identifer1" "wallet-identifier1"
wallet-multiple.example. 3600 IN WALLET "currency-identifer1" "wallet-identifier2"
wallet-multiple.example. 3600 IN WALLET "currency-identifer2" "wallet-identifier3"
wks01.example. 3600 IN WKS 10.0.0.1 6 0 1 2 21 23
wks02.example. 3600 IN WKS 10.0.0.1 17 0 1 2 53
wks03.example. 3600 IN WKS 10.0.0.2 6 65535
+4
View File
@@ -2665,6 +2665,10 @@ unspec01.example8. 3600 IN UNSPEC \# 1 04
uri01.example8. 3600 IN URI 10 20 "https://www.isc.org/"
uri02.example8. 3600 IN URI 30 40 "https://www.isc.org/HolyCowThisSureIsAVeryLongURIRecordIDontEvenKnowWhatSomeoneWouldEverWantWithSuchAThingButTheSpecificationRequiresThatWesupportItSoHereWeGoTestingItLaLaLaLaLaLaLaSeriouslyThoughWhyWouldYouEvenConsiderUsingAURIThisLongItSeemsLikeASillyIdeaButEnhWhatAreYouGonnaDo/"
uri03.example8. 3600 IN URI 30 40 ""
wallet.example8. 3600 IN WALLET "currency-identifer" "wallet-identifier"
wallet-multiple.example8. 3600 IN WALLET "currency-identifer1" "wallet-identifier1"
wallet-multiple.example8. 3600 IN WALLET "currency-identifer1" "wallet-identifier2"
wallet-multiple.example8. 3600 IN WALLET "currency-identifer2" "wallet-identifier3"
wks01.example8. 3600 IN WKS 10.0.0.1 6 0 1 2 21 23
wks02.example8. 3600 IN WKS 10.0.0.1 17 0 1 2 53
wks03.example8. 3600 IN WKS 10.0.0.2 6 65535
+1 -1
View File
@@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python3
# Copyright (C) Internet Systems Consortium, Inc. ("ISC")
#
+1
View File
@@ -98,6 +98,7 @@ options {
tcp-initial-timeout 1200;
transfers-in 100;
transfers-out 100;
max-records-per-type 0;
};
zone "." {
+1
View File
@@ -49,6 +49,7 @@ options {
ixfr-from-differences yes;
check-integrity no;
dnssec-validation yes;
max-records-per-type 0;
transfers-in 100;
transfers-out 100;
};
+1
View File
@@ -44,6 +44,7 @@ options {
ixfr-from-differences yes;
check-integrity no;
dnssec-validation yes;
max-records-per-type 0;
};
zone "." {
+1
View File
@@ -52,6 +52,7 @@ options {
ixfr-from-differences yes;
check-integrity no;
dnssec-validation yes;
max-records-per-type 0;
};
zone "." {
+1
View File
@@ -40,6 +40,7 @@ options {
ixfr-from-differences yes;
check-integrity no;
dnssec-validation yes;
max-records-per-type 0;
};
zone "." {
+1 -1
View File
@@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python3
# Copyright (C) Internet Systems Consortium, Inc. ("ISC")
#
+49 -20
View File
@@ -563,28 +563,57 @@ hashsize(dns_db_t *db) {
* determine which implementation of dns_db_*() function to call.
*/
static dns_dbmethods_t sampledb_methods = {
attach, detach, beginload,
endload, dump, currentversion,
newversion, attachversion, closeversion,
findnode, find, findzonecut,
attachnode, detachnode, expirenode,
printnode, createiterator, findrdataset,
allrdatasets, addrdataset, subtractrdataset,
deleterdataset, issecure, nodecount,
ispersistent, overmem, settask,
getoriginnode, transfernode, getnsec3parameters,
findnsec3node, setsigningtime, getsigningtime,
resigned, isdnssec, getrrsetstats,
attach,
detach,
beginload,
endload,
dump,
currentversion,
newversion,
attachversion,
closeversion,
findnode,
find,
findzonecut,
attachnode,
detachnode,
expirenode,
printnode,
createiterator,
findrdataset,
allrdatasets,
addrdataset,
subtractrdataset,
deleterdataset,
issecure,
nodecount,
ispersistent,
overmem,
settask,
getoriginnode,
transfernode,
getnsec3parameters,
findnsec3node,
setsigningtime,
getsigningtime,
resigned,
isdnssec,
getrrsetstats,
NULL, /* rpz_attach */
NULL, /* rpz_ready */
findnodeext, findext, setcachestats,
hashsize, NULL, /* nodefullname */
NULL, /* getsize */
NULL, /* setservestalettl */
NULL, /* getservestalettl */
NULL, /* setservestalerefresh */
NULL, /* getservestalerefresh */
NULL, /* setgluecachestats */
findnodeext,
findext,
setcachestats,
hashsize,
NULL, /* nodefullname */
NULL, /* getsize */
NULL, /* setservestalettl */
NULL, /* getservestalettl */
NULL, /* setservestalerefresh */
NULL, /* getservestalerefresh */
NULL, /* setgluecachestats */
NULL, /* setmaxrrperset */
NULL /* setmaxtypepername */
};
/* Auxiliary driver functions. */
@@ -9,6 +9,9 @@
# See the COPYRIGHT file distributed with this work for additional
# information regarding copyright ownership.
import isctest.mark
@isctest.mark.supported_openssl_version
def test_enginepkcs11(run_tests_sh):
run_tests_sh()
+1
View File
@@ -14,6 +14,7 @@
#
# Clean up after forward tests.
#
rm -f ./statschannel.out.*
rm -f ./dig.out.*
rm -f ./*/named.conf
rm -f ./*/named.memstats
@@ -24,6 +24,8 @@ options {
minimal-responses yes;
};
statistics-channels { inet 10.53.0.4 port @EXTRAPORT1@ allow { localhost; }; };
zone "." {
type hint;
file "root.db";
+9
View File
@@ -107,6 +107,15 @@ grep "SERVFAIL" dig.out.$n.f2 >/dev/null || ret=1
if [ $ret != 0 ]; then echo_i "failed"; fi
status=$((status + ret))
# GL#1793
n=$((n + 1))
echo_i "checking that the 'serverquota' counter isn't increased because of the SERVFAIL in the previous check ($n)"
ret=0
"${CURL}" "http://10.53.0.4:${EXTRAPORT1}/json/v1" 2>/dev/null >statschannel.out.$n
grep -F "ServerQuota" statschannel.out.$n >/dev/null && ret=1
if [ $ret != 0 ]; then echo_i "failed"; fi
status=$((status + ret))
n=$((n + 1))
echo_i "checking for negative caching of forwarder response ($n)"
# prime the cache, shutdown the forwarder then check that we can
+7 -1
View File
@@ -481,7 +481,13 @@ amtrelay06 AMTRELAY \# 2 0004
; type 261
resinfo RESINFO qnamemin exterr=15,16,17 infourl=https://resolver.example.com/guide
; type 262 -- 32767 (unassigned)
; type 262
wallet WALLET currency-identifer wallet-identifier
wallet-multiple WALLET currency-identifer1 wallet-identifier1
wallet-multiple WALLET currency-identifer1 wallet-identifier2
wallet-multiple WALLET currency-identifer2 wallet-identifier3
; type 265 -- 32767 (unassigned)
; type 32768
ta TA 30795 1 1 (
+5 -9
View File
@@ -10,18 +10,14 @@
# information regarding copyright ownership.
import pytest
import isctest
pytest.importorskip("dns")
import dns.message
import dns.query
import dns.rcode
def test_async_hook(named_port):
msg = dns.message.make_query(
"example.com.",
"A",
)
ans = dns.query.udp(msg, "10.53.0.1", timeout=10, port=named_port)
def test_async_hook():
msg = dns.message.make_query("example.com.", "A")
res = isctest.query.udp(msg, "10.53.0.1")
# the test-async plugin changes the status of any positive answer to NOTIMP
assert ans.rcode() == dns.rcode.NOTIMP
isctest.check.notimp(res)
+20 -3
View File
@@ -20,6 +20,8 @@
# IPv6: fd92:7065:b8e:ffff::{1..11} ULA
# fd92:7065:b8e:99ff::{1..2}
# fd92:7065:b8e:ff::{1..2}
# fd92:7065:b8e:fffe::10.53.0.4
# 2002:0a35:0007::1 6to4 for 10.53.0.7
#
# We also set the MTU on the 1500 bytes to match the default MTU on physical
# interfaces, so we can properly test the cases with packets bigger than
@@ -240,7 +242,7 @@ sequence() (
max=11
case $1 in
start | up | stop | down)
for i in $(sequence 0 2); do
for i in $(sequence 0 4); do
case $i in
0) ipv6="ff" ;;
1) ipv6="99" ;;
@@ -250,8 +252,23 @@ case $1 in
for ns in $(sequence 1 $max); do
[ $i -gt 0 -a $ns -gt 2 ] && break
int=$((i * max + ns))
a=10.53.$i.$ns
aaaa=fd92:7065:b8e:${ipv6}ff::$ns
case $i in
0 | 1 | 2)
[ $i -gt 0 -a $ns -gt 3 ] && break
a=10.53.$i.$ns
aaaa=fd92:7065:b8e:${ipv6}ff::$ns
;;
3)
[ $ns -ne 4 ] && continue
a=
aaaa=fd92:7065:b8e:fffe::10.53.0.$ns
;;
4)
[ $ns -ne 1 ] && continue
a=
aaaa=2002:0a35:0007::$ns
;;
esac
case "$1" in
start | up) up ;;
stop | down) down ;;
+2
View File
@@ -12,9 +12,11 @@
from . import check
from . import instance
from . import query
from . import name
from . import rndc
from . import run
from . import log
from . import hypothesis
# isctest.mark module is intentionally NOT imported, because it relies on
# environment variables which might not be set at the time of import of the
+30 -11
View File
@@ -9,23 +9,15 @@
# See the COPYRIGHT file distributed with this work for additional
# information regarding copyright ownership.
from typing import Any, Optional
import shutil
from typing import Optional
import dns.rcode
import dns.message
import dns.zone
import isctest.log
# compatiblity with dnspython<2.0.0
try:
# In dnspython>=2.0.0, dns.rcode.Rcode class is available
# pylint: disable=invalid-name
dns_rcode = dns.rcode.Rcode # type: Any
except AttributeError:
# In dnspython<2.0.0, selected rcodes are available as integers directly
# from dns.rcode
dns_rcode = dns.rcode
from isctest.compat import dns_rcode
def rcode(message: dns.message.Message, expected_rcode) -> None:
@@ -36,6 +28,10 @@ def noerror(message: dns.message.Message) -> None:
rcode(message, dns_rcode.NOERROR)
def notimp(message: dns.message.Message) -> None:
rcode(message, dns_rcode.NOTIMP)
def servfail(message: dns.message.Message) -> None:
rcode(message, dns_rcode.SERVFAIL)
@@ -95,3 +91,26 @@ def zones_equal(
)
assert found_rdataset
assert found_rdataset.ttl == rdataset.ttl
def is_executable(cmd: str, errmsg: str) -> None:
executable = shutil.which(cmd)
assert executable is not None, errmsg
def nxdomain(message: dns.message.Message) -> None:
rcode(message, dns.rcode.NXDOMAIN)
def single_question(message: dns.message.Message) -> None:
assert len(message.question) == 1, str(message)
def empty_answer(message: dns.message.Message) -> None:
assert not message.answer, str(message)
def is_response_to(response: dns.message.Message, query: dns.message.Message) -> None:
single_question(response)
single_question(query)
assert query.is_response(response), str(response)
+24
View File
@@ -0,0 +1,24 @@
# Copyright (C) Internet Systems Consortium, Inc. ("ISC")
#
# SPDX-License-Identifier: MPL-2.0
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, you can obtain one at https://mozilla.org/MPL/2.0/.
#
# See the COPYRIGHT file distributed with this work for additional
# information regarding copyright ownership.
from typing import Any
import dns.rcode
# compatiblity with dnspython<2.0.0
try:
# In dnspython>=2.0.0, dns.rcode.Rcode class is available
# pylint: disable=invalid-name
dns_rcode = dns.rcode.Rcode # type: Any
except AttributeError:
# In dnspython<2.0.0, selected rcodes are available as integers directly
# from dns.rcode
dns_rcode = dns.rcode
@@ -1,5 +1,3 @@
#!/bin/sh
# Copyright (C) Internet Systems Consortium, Inc. ("ISC")
#
# SPDX-License-Identifier: MPL-2.0
@@ -11,7 +9,10 @@
# See the COPYRIGHT file distributed with this work for additional
# information regarding copyright ownership.
rm -f NSEC3
rm -f nsec3hash
rm -f nsec3param
rm -f testcases
try:
import hypothesis as _
except ImportError:
pass
else:
from . import settings
from . import strategies
@@ -0,0 +1,18 @@
# Copyright (C) Internet Systems Consortium, Inc. ("ISC")
#
# SPDX-License-Identifier: MPL-2.0
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, you can obtain one at https://mozilla.org/MPL/2.0/.
#
# See the COPYRIGHT file distributed with this work for additional
# information regarding copyright ownership.
import os
from hypothesis import settings
# Timing of hypothesis tests is flaky in the CI, so we disable deadlines.
settings.register_profile("ci", deadline=None)
settings.load_profile(os.getenv("HYPOTHESIS_PROFILE", "default"))
@@ -0,0 +1,170 @@
#!/usr/bin/python3
# Copyright (C) Internet Systems Consortium, Inc. ("ISC")
#
# SPDX-License-Identifier: MPL-2.0
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, you can obtain one at https://mozilla.org/MPL/2.0/.
#
# See the COPYRIGHT file distributed with this work for additional
# information regarding copyright ownership.
from typing import List
from warnings import warn
from hypothesis.strategies import (
binary,
builds,
composite,
integers,
just,
nothing,
permutations,
)
import dns.name
import dns.message
import dns.rdataclass
import dns.rdatatype
import isctest.name
@composite
def dns_names(
draw,
*,
prefix: dns.name.Name = dns.name.empty,
suffix: dns.name.Name = dns.name.root,
min_labels: int = 1,
max_labels: int = 128,
) -> dns.name.Name:
"""
This is a hypothesis strategy to be used for generating DNS names with given `prefix`, `suffix`
and with total number of labels specified by `min_labels` and `max labels`.
For example, calling
```
dns_names(
prefix=dns.name.from_text("test"),
suffix=dns.name.from_text("isc.org"),
max_labels=6
).example()
```
will result in names like `test.abc.isc.org.` or `test.abc.def.isc.org`.
There is no attempt to make the distribution of the generated names uniform in any way.
The strategy however minimizes towards shorter names with shorter labels.
It can be used with to build compound strategies, like this one which generates random DNS queries.
```
dns_queries = builds(
dns.message.make_query,
qname=dns_names(),
rdtype=dns_rdatatypes,
rdclass=dns_rdataclasses,
)
```
"""
prefix = prefix.relativize(dns.name.root)
suffix = suffix.derelativize(dns.name.root)
try:
outer_name = prefix + suffix
remaining_bytes = 255 - isctest.name.len_wire_uncompressed(outer_name)
assert remaining_bytes >= 0
except dns.name.NameTooLong:
warn(
"Maximal length name of name execeeded by prefix and suffix. Strategy won't generate any names.",
RuntimeWarning,
)
return draw(nothing())
minimum_number_of_labels_to_generate = max(0, min_labels - len(outer_name.labels))
maximum_number_of_labels_to_generate = max_labels - len(outer_name.labels)
if maximum_number_of_labels_to_generate < 0:
warn(
"Maximal number of labels execeeded by prefix and suffix. Strategy won't generate any names.",
RuntimeWarning,
)
return draw(nothing())
maximum_number_of_labels_to_generate = min(
maximum_number_of_labels_to_generate, remaining_bytes // 2
)
if maximum_number_of_labels_to_generate < minimum_number_of_labels_to_generate:
warn(
f"Minimal number set to {minimum_number_of_labels_to_generate}, but in {remaining_bytes} bytes there is only space for maximum of {maximum_number_of_labels_to_generate} labels.",
RuntimeWarning,
)
return draw(nothing())
if remaining_bytes == 0 or maximum_number_of_labels_to_generate == 0:
warn(
f"Strategy will return only one name ({outer_name}) as it exactly matches byte or label length limit.",
RuntimeWarning,
)
return draw(just(outer_name))
chosen_number_of_labels_to_generate = draw(
integers(
minimum_number_of_labels_to_generate, maximum_number_of_labels_to_generate
)
)
chosen_number_of_bytes_to_partion = draw(
integers(2 * chosen_number_of_labels_to_generate, remaining_bytes)
)
chosen_lengths_of_labels = draw(
_partition_bytes_to_labels(
chosen_number_of_bytes_to_partion, chosen_number_of_labels_to_generate
)
)
generated_labels = tuple(
draw(binary(min_size=l - 1, max_size=l - 1)) for l in chosen_lengths_of_labels
)
return dns.name.Name(prefix.labels + generated_labels + suffix.labels)
RDATACLASS_MAX = RDATATYPE_MAX = 65535
try:
dns_rdataclasses = builds(dns.rdataclass.RdataClass, integers(0, RDATACLASS_MAX))
dns_rdatatypes = builds(dns.rdatatype.RdataType, integers(0, RDATATYPE_MAX))
except AttributeError:
# In old dnspython versions, RDataTypes and RDataClasses are int and not enums.
dns_rdataclasses = integers(0, RDATACLASS_MAX) # type: ignore
dns_rdatatypes = integers(0, RDATATYPE_MAX) # type: ignore
dns_rdataclasses_without_meta = dns_rdataclasses.filter(dns.rdataclass.is_metaclass)
# NOTE: This should really be `dns_rdatatypes_without_meta = dns_rdatatypes_without_meta.filter(dns.rdatatype.is_metatype()`,
# but hypothesis then complains about the filter being too strict, so it is done in a “constructive” way.
dns_rdatatypes_without_meta = integers(0, dns.rdatatype.OPT - 1) | integers(dns.rdatatype.OPT + 1, 127) | integers(256, RDATATYPE_MAX) # type: ignore
@composite
def _partition_bytes_to_labels(
draw, remaining_bytes: int, number_of_labels: int
) -> List[int]:
two_bytes_reserved_for_label = 2
# Reserve two bytes for each label
partition = [two_bytes_reserved_for_label] * number_of_labels
remaining_bytes -= two_bytes_reserved_for_label * number_of_labels
assert remaining_bytes >= 0
# Add a random number between 0 and the remainder to each partition
for i in range(number_of_labels):
added = draw(
integers(0, min(remaining_bytes, 64 - two_bytes_reserved_for_label))
)
partition[i] += added
remaining_bytes -= added
# NOTE: Some of the remaining bytes will usually not be assigned to any label, but we don't care.
return draw(permutations(partition))
-1
View File
@@ -38,7 +38,6 @@ class NamedInstance:
```
"""
# pylint: disable=too-many-arguments
def __init__(
self,
identifier: str,
+11
View File
@@ -13,6 +13,7 @@
import os
from pathlib import Path
import ssl
import subprocess
import pytest
@@ -47,6 +48,10 @@ def is_dnsrps_available():
return True
def with_tsan(*args): # pylint: disable=unused-argument
return feature_test("--tsan")
have_libxml2 = pytest.mark.skipif(
not feature_test("--have-libxml2"), reason="libxml2 support disabled in the build"
)
@@ -59,6 +64,12 @@ dnsrps_enabled = pytest.mark.skipif(
not is_dnsrps_available(), reason="dnsrps disabled in the build"
)
supported_openssl_version = pytest.mark.skipif(
ssl.OPENSSL_VERSION_NUMBER >= 0x300000C0
and ssl.OPENSSL_VERSION_NUMBER < 0x300000E0,
reason="unsupported OpenSSL [GL #4814]",
)
try:
import flaky as flaky_pkg # type: ignore
+20
View File
@@ -0,0 +1,20 @@
# Copyright (C) Internet Systems Consortium, Inc. ("ISC")
#
# SPDX-License-Identifier: MPL-2.0
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, you can obtain one at https://mozilla.org/MPL/2.0/.
#
# See the COPYRIGHT file distributed with this work for additional
# information regarding copyright ownership.
import dns.name
def prepend_label(label: str, name: dns.name.Name) -> dns.name.Name:
return dns.name.Name((label,) + name.labels)
def len_wire_uncompressed(name: dns.name.Name) -> int:
return len(name) + sum(map(len, name.labels))
+35 -13
View File
@@ -10,32 +10,54 @@
# information regarding copyright ownership.
import os
from typing import Optional
import time
from typing import Any, Callable, Optional
import dns.query
import dns.message
import isctest.log
from isctest.compat import dns_rcode
QUERY_TIMEOUT = 10
def udp(
def generic_query(
query_func: Callable[..., Any],
message: dns.message.Message,
ip: str,
port: Optional[int] = None,
source: Optional[str] = None,
) -> dns.message.Message:
timeout: int = QUERY_TIMEOUT,
attempts: int = 10,
expected_rcode: dns_rcode = None,
) -> Any:
if port is None:
port = int(os.environ["PORT"])
return dns.query.udp(message, ip, QUERY_TIMEOUT, port=port, source=source)
res = None
for attempt in range(attempts):
try:
isctest.log.debug(
f"{query_func.__name__}(): ip={ip}, port={port}, source={source}, "
f"timeout={timeout}, attempts left={attempts-attempt}"
)
res = query_func(message, ip, timeout, port=port, source=source)
if res.rcode() == expected_rcode or expected_rcode is None:
return res
except (dns.exception.Timeout, ConnectionRefusedError) as e:
isctest.log.debug(f"{query_func.__name__}(): the '{e}' exceptio raised")
time.sleep(1)
if expected_rcode is not None:
last_rcode = dns_rcode.to_text(res.rcode()) if res else None
isctest.log.debug(
f"{query_func.__name__}(): expected rcode={dns_rcode.to_text(expected_rcode)}, last rcode={last_rcode}"
)
raise dns.exception.Timeout
def tcp(
message: dns.message.Message,
ip: str,
port: Optional[int] = None,
source: Optional[str] = None,
) -> dns.message.Message:
if port is None:
port = int(os.environ["PORT"])
return dns.query.tcp(message, ip, QUERY_TIMEOUT, port=port, source=source)
def udp(*args, **kwargs) -> Any:
return generic_query(dns.query.udp, *args, **kwargs)
def tcp(*args, **kwargs) -> Any:
return generic_query(dns.query.tcp, *args, **kwargs)
-1
View File
@@ -14,7 +14,6 @@ import os
import subprocess
# pylint: disable=too-few-public-methods
class RNDCExecutor(abc.ABC):
"""
An interface which RNDC executors have to implement in order for the
+40 -1
View File
@@ -9,14 +9,18 @@
# See the COPYRIGHT file distributed with this work for additional
# information regarding copyright ownership.
import os
import subprocess
import time
from typing import Optional
import isctest.log
from isctest.compat import dns_rcode
import dns.message
def cmd( # pylint: disable=too-many-arguments
def cmd(
args,
cwd=None,
timeout=60,
@@ -70,3 +74,38 @@ def retry_with_timeout(func, timeout, delay=1, msg=None):
if msg is None:
msg = f"{func.__module__}.{func.__qualname__} timed out after {timeout} s"
assert False, msg
def get_named_cmdline(cfg_dir, cfg_file="named.conf"):
cfg_dir = os.path.join(os.getcwd(), cfg_dir)
assert os.path.isdir(cfg_dir)
cfg_file = os.path.join(cfg_dir, cfg_file)
assert os.path.isfile(cfg_file)
named = os.getenv("NAMED")
assert named is not None
named_cmdline = [named, "-c", cfg_file, "-d", "99", "-g"]
return named_cmdline
def get_custom_named_instance(assumed_ns, ports):
# This test launches and monitors a named instance itself rather than using
# bin/tests/system/start.pl, so manually defining a NamedInstance here is
# necessary for sending RNDC commands to that instance. If this "custom"
# instance listens on 10.53.0.3, use "ns3" as the identifier passed to
# the NamedInstance constructor.
named_ports = isctest.instance.NamedPorts(
dns=ports["PORT"], rndc=ports["CONTROLPORT"]
)
instance = isctest.instance.NamedInstance(assumed_ns, named_ports)
return instance
def assert_custom_named_is_alive(named_proc, resolver_ip):
assert named_proc.poll() is None, "named isn't running"
msg = dns.message.make_query("version.bind", "TXT", "CH")
isctest.query.tcp(msg, resolver_ip, expected_rcode=dns_rcode.NOERROR)
+39
View File
@@ -65,6 +65,7 @@ zone "nil" {
type secondary;
file "myftp.db";
primaries { 10.53.0.2; };
max-records-per-type 5; # use a small value for fallback test
};
EOF
@@ -144,6 +145,44 @@ $DIG $DIGOPTS @10.53.0.1 nil. TXT | grep 'fallback AXFR' >/dev/null || ret=1
if [ $ret != 0 ]; then echo_i "failed"; fi
status=$((status + ret))
n=$((n + 1))
echo_i "testing AXFR fallback after IXFR failure (too many records) ($n)"
ret=0
# Provide an IXFR response that would cause a "too many records" condition
sendcmd <<EOF
/SOA/
nil. 300 SOA ns.nil. root.nil. 4 300 300 604800 300
/IXFR/
nil. 300 SOA ns.nil. root.nil. 4 300 300 604800 300
nil. 300 SOA ns.nil. root.nil. 3 300 300 604800 300
nil. 300 SOA ns.nil. root.nil. 4 300 300 604800 300
nil. 300 TXT "text 1"
nil. 300 TXT "text 2"
nil. 300 TXT "text 3"
nil. 300 TXT "text 4"
nil. 300 TXT "text 5"
nil. 300 TXT "text 6: causing too many records"
nil. 300 SOA ns.nil. root.nil. 4 300 300 604800 300
/AXFR/
nil. 300 SOA ns.nil. root.nil. 3 300 300 604800 300
nil. 300 NS ns.nil.
nil. 300 TXT "fallback AXFR on too many records"
/AXFR/
nil. 300 SOA ns.nil. root.nil. 3 300 300 604800 300
EOF
sleep 1
$RNDCCMD 10.53.0.1 refresh nil | sed 's/^/ns1 /' | cat_i
sleep 2
$DIG $DIGOPTS @10.53.0.1 nil. TXT | grep 'AXFR on too many records' >/dev/null || ret=1
if [ $ret != 0 ]; then echo_i "failed"; fi
status=$((status + ret))
n=$((n + 1))
echo_i "testing AXFR fallback after IXFR failure (bad SOA owner) ($n)"
ret=0
+24 -18
View File
@@ -161,13 +161,19 @@ _rndccmd() {
"$RNDC" -c ../_common/rndc.conf -p "$CONTROLPORT" -s "$@"
}
# Print IDs of keys used for generating RRSIG records for RRsets of type $1
# found in dig output file $2.
# Print IDs of keys used for generating RRSIG records for RRsets of type $1,
# matching algorithm number $2, found in dig output file $3.
# If $2 is equal to 0, any algorithm matches.
get_keys_which_signed() {
_qtype=$1
_output=$2
_alg=$2
_output=$3
# The key ID is the 11th column of the RRSIG record line.
awk -v qt="$_qtype" '$4 == "RRSIG" && $5 == qt {print $11}' <"$_output"
if [ "$_alg" = "0" ]; then
awk -v qt="$_qtype" '$4 == "RRSIG" && $5 == qt {print $11}' <"$_output"
else
awk -v alg="$_alg" -v qt="$_qtype" '$4 == "RRSIG" && $5 == qt && $6 == alg {print $11}' <"$_output"
fi
}
# Get the key ids from key files for zone $2 in directory $1.
@@ -810,19 +816,19 @@ check_keys() {
ret=0
if [ "$(key_get KEY1 EXPECT)" = "yes" ]; then
echo_i "KEY1 ID $(key_get KEY1 ID)"
echo_i "KEY1 ID $(key_get KEY1 ID) ALG $(key_get KEY1 ALG_STR)"
test "no" = "$(key_get KEY1 ID)" && _log_error "No KEY1 found for zone ${ZONE}"
fi
if [ "$(key_get KEY2 EXPECT)" = "yes" ]; then
echo_i "KEY2 ID $(key_get KEY2 ID)"
echo_i "KEY2 ID $(key_get KEY2 ID) ALG $(key_get KEY2 ALG_STR)"
test "no" = "$(key_get KEY2 ID)" && _log_error "No KEY2 found for zone ${ZONE}"
fi
if [ "$(key_get KEY3 EXPECT)" = "yes" ]; then
echo_i "KEY3 ID $(key_get KEY3 ID)"
echo_i "KEY3 ID $(key_get KEY3 ID) ALG $(key_get KEY3 ALG_STR)"
test "no" = "$(key_get KEY3 ID)" && _log_error "No KEY3 found for zone ${ZONE}"
fi
if [ "$(key_get KEY4 EXPECT)" = "yes" ]; then
echo_i "KEY4 ID $(key_get KEY4 ID)"
echo_i "KEY4 ID $(key_get KEY4 ID) ALG $(key_get KEY4 ALG_STR)"
test "no" = "$(key_get KEY4 ID)" && _log_error "No KEY4 found for zone ${ZONE}"
fi
test "$ret" -eq 0 || echo_i "failed"
@@ -908,34 +914,34 @@ _check_signatures() {
fi
if [ "$(key_get KEY1 "$_expect_type")" = "yes" ] && [ "$(key_get KEY1 "$_role")" = "yes" ]; then
get_keys_which_signed "$_qtype" "$_file" | grep "^$(key_get KEY1 ID)$" >/dev/null || return 1
get_keys_which_signed "$_qtype" "$(key_get KEY1 ALG_NUM)" "$_file" | grep "^$(key_get KEY1 ID)$" >/dev/null || return 1
numsigs=$((numsigs + 1))
elif [ "$(key_get KEY1 EXPECT)" = "yes" ]; then
get_keys_which_signed "$_qtype" "$_file" | grep "^$(key_get KEY1 ID)$" >/dev/null && return 1
get_keys_which_signed "$_qtype" "$(key_get KEY1 ALG_NUM)" "$_file" | grep "^$(key_get KEY1 ID)$" >/dev/null && return 1
fi
if [ "$(key_get KEY2 "$_expect_type")" = "yes" ] && [ "$(key_get KEY2 "$_role")" = "yes" ]; then
get_keys_which_signed "$_qtype" "$_file" | grep "^$(key_get KEY2 ID)$" >/dev/null || return 1
get_keys_which_signed "$_qtype" "$(key_get KEY2 ALG_NUM)" "$_file" | grep "^$(key_get KEY2 ID)$" >/dev/null || return 1
numsigs=$((numsigs + 1))
elif [ "$(key_get KEY2 EXPECT)" = "yes" ]; then
get_keys_which_signed "$_qtype" "$_file" | grep "^$(key_get KEY2 ID)$" >/dev/null && return 1
get_keys_which_signed "$_qtype" "$(key_get KEY2 ALG_NUM)" "$_file" | grep "^$(key_get KEY2 ID)$" >/dev/null && return 1
fi
if [ "$(key_get KEY3 "$_expect_type")" = "yes" ] && [ "$(key_get KEY3 "$_role")" = "yes" ]; then
get_keys_which_signed "$_qtype" "$_file" | grep "^$(key_get KEY3 ID)$" >/dev/null || return 1
get_keys_which_signed "$_qtype" "$(key_get KEY3 ALG_NUM)" "$_file" | grep "^$(key_get KEY3 ID)$" >/dev/null || return 1
numsigs=$((numsigs + 1))
elif [ "$(key_get KEY3 EXPECT)" = "yes" ]; then
get_keys_which_signed "$_qtype" "$_file" | grep "^$(key_get KEY3 ID)$" >/dev/null && return 1
get_keys_which_signed "$_qtype" "$(key_get KEY3 ALG_NUM)" "$_file" | grep "^$(key_get KEY3 ID)$" >/dev/null && return 1
fi
if [ "$(key_get KEY4 "$_expect_type")" = "yes" ] && [ "$(key_get KEY4 "$_role")" = "yes" ]; then
get_keys_which_signed "$_qtype" "$_file" | grep "^$(key_get KEY4 ID)$" >/dev/null || return 1
get_keys_which_signed "$_qtype" "$(key_get KEY4 ALG_NUM)" "$_file" | grep "^$(key_get KEY4 ID)$" >/dev/null || return 1
numsigs=$((numsigs + 1))
elif [ "$(key_get KEY4 EXPECT)" = "yes" ]; then
get_keys_which_signed "$_qtype" "$_file" | grep "^$(key_get KEY4 ID)$" >/dev/null && return 1
get_keys_which_signed "$_qtype" "$(key_get KEY4 ALG_NUM)" "$_file" | grep "^$(key_get KEY4 ID)$" >/dev/null && return 1
fi
lines=$(get_keys_which_signed "${_qtype}" "${_file}" | wc -l)
lines=$(get_keys_which_signed "${_qtype}" "0" "${_file}" | wc -l)
test "$lines" -eq "$numsigs" || echo_i "bad number of signatures for $_qtype (got $lines, expected $numsigs)"
test "$lines" -eq "$numsigs" || return 1
@@ -1158,7 +1164,7 @@ check_subdomain() {
_dig_with_opts "a.$ZONE" "@${SERVER}" $_qtype >"dig.out.$DIR.test$n" || _log_error "dig a.${ZONE} ${_qtype} failed"
grep "status: NOERROR" "dig.out.$DIR.test$n" >/dev/null || _log_error "mismatch status in DNS response"
grep "a.${ZONE}\..*${DEFAULT_TTL}.*IN.*${_qtype}.*10\.0\.0\.1" "dig.out.$DIR.test$n" >/dev/null || _log_error "missing a.${ZONE} ${_qtype} record in response"
lines=$(get_keys_which_signed $_qtype "dig.out.$DIR.test$n" | wc -l)
lines=$(get_keys_which_signed $_qtype 0 "dig.out.$DIR.test$n" | wc -l)
check_signatures $_qtype "dig.out.$DIR.test$n" "ZSK"
test "$ret" -eq 0 || echo_i "failed"
status=$((status + ret))
@@ -322,6 +322,16 @@ zone "unfresh-sigs.autosign" {
dnssec-policy "autosign";
};
/*
* Zone that has missing key files.
*/
zone "keyfiles-missing.autosign" {
type primary;
file "keyfiles-missing.autosign.db";
inline-signing yes;
dnssec-policy "autosign";
};
/*
* Zone that has missing private KSK.
*/
+36 -9
View File
@@ -128,15 +128,19 @@ $KEYGEN -G -k rsasha256 -l policies/kasp.conf $zone >keygen.out.$zone.2 2>&1
zone="multisigner-model2.kasp"
echo_i "setting up zone: $zone"
KSK=$($KEYGEN -a $DEFAULT_ALGORITHM -f KSK -L 3600 $zone 2>keygen.out.$zone.1)
ZSK=$($KEYGEN -a $DEFAULT_ALGORITHM -L 3600 $zone 2>keygen.out.$zone.2)
cat "${KSK}.key" | grep -v ";.*" >>"${zone}.db"
cat "${ZSK}.key" | grep -v ";.*" >>"${zone}.db"
# Import the ZSK sets of the other providers into their DNSKEY RRset.
ZSK1=$($KEYGEN -K ../ -a $DEFAULT_ALGORITHM -L 3600 $zone 2>keygen.out.$zone.1)
ZSK2=$($KEYGEN -K ../ -a $DEFAULT_ALGORITHM -L 3600 $zone 2>keygen.out.$zone.2)
# ZSK1 will be added to the unsigned zonefile.
# ZSK1 is from a different provider and is added to the unsigned zonefile.
# ZSK2 is also from a different provider and is added with a Dynamic Update.
ZSK1=$($KEYGEN -K ../ -a $DEFAULT_ALGORITHM -L 3600 $zone 2>keygen.out.$zone.3)
ZSK2=$($KEYGEN -K ../ -a $DEFAULT_ALGORITHM -L 3600 $zone 2>keygen.out.$zone.4)
cat "../${ZSK1}.key" | grep -v ";.*" >>"${zone}.db"
cat "../${ZSK1}.key" | grep -v ";.*" >"${zone}.zsk1"
rm -f "../${ZSK1}.*"
# ZSK2 will be used with a Dynamic Update.
cat "../${ZSK2}.key" | grep -v ";.*" >"${zone}.zsk2"
rm -f "../${ZSK1}.*"
rm -f "../${ZSK2}.*"
zone="rumoured.kasp"
@@ -177,11 +181,12 @@ $SIGNER -PS -x -o $zone -O raw -f "${zonefile}.signed" $infile >signer.out.$zone
setup dynamic-signed-inline-signing.kasp
T="now-1d"
csktimes="-P $T -A $T -P sync $T"
CSK=$($KEYGEN -a $DEFAULT_ALGORITHM -L 3600 -f KSK $csktimes $zone 2>keygen.out.$zone.1)
$SETTIME -s -g $O -d $O $T -k $O $T -z $O $T -r $O $T "$CSK" >settime.out.$zone.1 2>&1
cat template.db.in "${CSK}.key" >"$infile"
CSK=$($KEYGEN -K keys -a $DEFAULT_ALGORITHM -L 3600 -f KSK $csktimes $zone 2>keygen.out.$zone.1)
$SETTIME -s -g $O -d $O $T -k $O $T -z $O $T -r $O $T "keys/$CSK" >settime.out.$zone.1 2>&1
cat template.db.in "keys/${CSK}.key" >"$infile"
private_type_record $zone $DEFAULT_ALGORITHM_NUMBER "keys/$CSK" >>"$infile"
cp $infile $zonefile
$SIGNER -PS -z -x -s now-2w -e now-1mi -o $zone -f "${zonefile}.signed" $infile >signer.out.$zone.1 2>&1
$SIGNER -PS -K keys -z -x -s now-2w -e now-1mi -o $zone -f "${zonefile}.signed" $infile >signer.out.$zone.1 2>&1
# These signatures are set to expire long in the past, update immediately.
setup expired-sigs.autosign
@@ -274,6 +279,22 @@ echo "ZSK: yes" >>"${ZSK}".state
echo "Lifetime: 31536000" >>"${ZSK}".state # PT1Y
rm -f "${ZSK}".private
# These signatures are still good, but the key files will be removed
# before a second run of reconfiguring keys.
setup keyfiles-missing.autosign
T="now-6mo"
ksktimes="-P $T -A $T -P sync $T"
zsktimes="-P $T -A $T"
KSK=$($KEYGEN -a $DEFAULT_ALGORITHM -L 300 -f KSK $ksktimes $zone 2>keygen.out.$zone.1)
ZSK=$($KEYGEN -a $DEFAULT_ALGORITHM -L 300 $zsktimes $zone 2>keygen.out.$zone.2)
$SETTIME -s -g $O -d $O $T -k $O $T -r $O $T "$KSK" >settime.out.$zone.1 2>&1
$SETTIME -s -g $O -k $O $T -z $O $T "$ZSK" >settime.out.$zone.2 2>&1
cat template.db.in "${KSK}.key" "${ZSK}.key" >"$infile"
private_type_record $zone $DEFAULT_ALGORITHM_NUMBER "$KSK" >>"$infile"
private_type_record $zone $DEFAULT_ALGORITHM_NUMBER "$ZSK" >>"$infile"
cp $infile $zonefile
$SIGNER -S -x -s now-1w -e now+1w -o $zone -O raw -f "${zonefile}.signed" $infile >signer.out.$zone.1 2>&1
# These signatures are already expired, and the private ZSK is retired.
setup zsk-retired.autosign
T="now-6mo"
@@ -289,6 +310,12 @@ private_type_record $zone $DEFAULT_ALGORITHM_NUMBER "$ZSK" >>"$infile"
cp $infile $zonefile
$SIGNER -PS -x -s now-2w -e now-1mi -o $zone -O raw -f "${zonefile}.signed" $infile >signer.out.$zone.1 2>&1
$SETTIME -s -g HIDDEN "$ZSK" >settime.out.$zone.3 2>&1
# An old key that is being purged should not prevent keymgr to be run.
T1="now-1y"
T2="now-2y"
oldtimes="-P $T2 -A $T2 -I $T1 -D $T1"
OLD=$($KEYGEN -a $DEFAULT_ALGORITHM -L 300 $oldtimes $zone 2>keygen.out.$zone.3)
$SETTIME -s -g $H -k $H $T1 -z $H $T1 "$OLD" >settime.out.$zone.3 2>&1
#
# The zones at enable-dnssec.autosign represent the various steps of the

Some files were not shown because too many files have changed in this diff Show More