2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-08-22 18:19:42 +00:00

35679 Commits

Author SHA1 Message Date
Tony Finch
ccc6378355
More man page option hyperlinks
The dig man page wanted -h option hyperlink and anchor, and there
were a couple of missing cross-references in the rndc man page.
2022-03-14 10:46:36 +01:00
Petr Špaček
a85df3ff9c
Add hyperlinks from program options to definition in man pages
Side-effect of hyperlinking is that typos in program and option names
are now detected by Sphinx.

Candidate -options were detected using:
    find -name *.rst | xargs grep '``-[^`]'
and then modified from ``-o`` to :option:`-o` using regex
    s/``\(-[^`]\+\)``/:option:`\1`/
+ manual modifications where necessary.

Non-hyphenated options were detected by looking at context around
program names:
    find bin -name *.rst | xargs -I{} -n1 basename {} .rst | sort -u
and grepping for program name with trailing whitespace.

Stand-alone program names like ``named`` are not hyperlinked in this
commit.
2022-03-14 10:46:36 +01:00
Petr Špaček
5f0ee7c303
Fix rndc command in release notes for 9.17.12
rndc checkds does not exist, it should have been rndc dnssec

Related: #2488, !4813
2022-03-14 10:46:36 +01:00
Petr Špaček
8537878c01
Add semantic markup for program names into manual pages
It allows to cross-reference options in man pages from other
documents using :option:`named -g` syntax.
2022-03-14 10:46:36 +01:00
Petr Špaček
ec30944aa4
Denote all command line options using semantic markup (.. option::)
The markup allows referencing individual options, and also makes them
more legible (no more thin red text on gray background).

Most of the work was done using regexes:
    s/^``-\(.*\)``$/.. option:: -\1\r/
    s/^``+\(.*\)``$/.. option:: +\1\r/
on bin/**/*.rst files along with visual inspection and hand-edits,
mostly for positional arguments.

Regex for rndc.rst:
    s/^``\(.*\)``/.. option:: \1\r/
+ hand edits to remove extra asterisk and whitespace here and there.
2022-03-14 10:46:32 +01:00
Michał Kępień
e9f4d00bf0 Merge branch 'michal/tidy-setup-of-python-based-tests' into 'main'
Tidy setup of Python-based tests

See merge request isc-projects/bind9!5960
2022-03-14 08:30:05 +00:00
Michał Kępień
173ad9cf46 Tweak Automake conditionals for pytest-based tests
Since pytest itself skips tests using dnspython if the latter is not
available, also using Automake conditionals for silently skipping
pytest-based tests requiring dnspython is redundant and hides
information.  Allow all pytest-based tests requiring dnspython to be run
whenever pytest itself is available, in order to ensure test skipping is
done in a uniform manner.

Note that the above reasoning only applies to pytest-based tests, so
similar adjustments were not made for shell-based tests using Python
scripts that require dnspython ("chain", "cookie", "dnssec", "qmin").
2022-03-14 08:59:32 +01:00
Michał Kępień
00392921f0 Rework skipping long tests
The ability to conveniently mark tests which should only be run when the
CI_ENABLE_ALL_TESTS environment variable is set seems to be useful on a
general level and therefore it should not be limited to the "timeouts"
system test, where it is currently used.

pytest documentation [1] suggests to reuse commonly used test markers by
putting them all in a single Python module which then has to be imported
by test files that want to use the markers defined therein.  Follow that
advice by creating a new bin/tests/system/pytest_custom_markers.py
Python module containing the relevant marker definitions.

Note that "import pytest_custom_markers" works from a test-specific
subdirectory because pytest modifies sys.path so that it contains the
paths to all parent directories containing a conftest.py file (and
bin/tests/system/ is one).  PyLint does not like that, though, so add a
relevant PyLint suppression.

The above changes make bin/tests/system/timeouts/conftest.py redundant,
so remove it.

[1] https://docs.pytest.org/en/7.0.x/how-to/skipping.html#id1
2022-03-14 08:59:32 +01:00
Michał Kępień
49312d6bb2 Rework imports in dnspython-based system tests
Ensure all "import dns.*" statements are always placed after
pytest.importorskip('dns') calls, in order to allow the latter to
fulfill their purpose.  Explicitly import all dnspython modules used by
each dnspython-based test to avoid relying on nested imports.  Replace
function-scoped imports with global imports to reduce code duplication.
2022-03-14 08:59:32 +01:00
Michał Kępień
05c97f2329 Fix skipping tests requiring dnspython
The intended purpose of the @pytest.mark.dnspython{,2} decorators was to
cause dnspython-based tests to be skipped if dnspython is not available
(or not recent enough).  However, a number of system tests employing
those decorators contain global "import dns.resolver" statements which
trigger ImportError exceptions during test initialization if dnspython
is not available.  In other words, the @pytest.mark.dnspython{,2}
decorators serve no useful purpose.

Currently, whenever a Python-based test requires dnspython, that
requirement applies to all tests in a given *.py file.  Given that,
employ global pytest.importorskip() calls to ensure dnspython-based
parts of various system tests are skipped when dnspython is not
available.  Remove all occurrences of the @pytest.mark.dnspython{,2}
decorators (and all associated code) to prevent confusion.
2022-03-14 08:59:32 +01:00
Michał Kępień
704ad2907f Fix skipping tests requiring the requests module
The intended purpose of the @pytest.mark.requests decorator was to cause
Python-based parts of the "statschannel" system test to be skipped if
the requests Python module is not available.  However, both
tests-json.py and tests-xml.py contain a global "import requests"
statement which triggers ImportError exceptions during test
initialization if the requests module is not available.  In other words,
the @pytest.mark.requests decorator serves no useful purpose.

Since all tests in both tests-json.py and tests-xml.py depend on the
requests Python module, employ pytest.importorskip() to ensure the
Python-based parts of the "statschannel" system test are skipped when
the requests module is not available.  Remove all occurrences of the
@pytest.mark.requests decorator (and all associated code) to prevent
confusion.
2022-03-14 08:59:32 +01:00
Michał Kępień
286b57c7f1 Simplify skipping tests depending on libxml2
All tests in bin/tests/system/statschannel/tests-xml.py require libxml2
support to be enabled in BIND 9 at build-time.  Instead of applying the
same pytest.mark.skipif() decorator to every test in that file, set the
'pytestmark' global accordingly in order to immediately skip all tests
in tests-xml.py if libxml2 support is not compiled in.

Remove all occurrences of the @pytest.mark.xml decorator (and all
associated code) from the "statschannel" system test as the
xml.etree.ElementTree module is a part of the Python standard library
since Python 2.5 (so checking whether it is available is redundant) and
checking for libxml2 support in the tested BIND 9 build is already
handled by setting the 'pytestmark' global accordingly.
2022-03-14 08:59:32 +01:00
Michał Kępień
0a76f186a5 Simplify skipping tests depending on json-c
All tests in bin/tests/system/statschannel/tests-json.py require json-c
support to be enabled in BIND 9 at build-time.  Instead of applying the
same pytest.mark.skipif() decorator to every test in that file, set the
'pytestmark' global accordingly in order to immediately skip all tests
in tests-json.py if json-c support is not compiled in.

Remove all occurrences of the @pytest.mark.json decorator (and all
associated code) from the "statschannel" system test as the json module
is a part of the Python standard library since Python 2.6 (so checking
whether it is available is redundant) and checking for json-c support in
the tested BIND 9 build is already handled by setting the 'pytestmark'
global accordingly.

Also remove a related excerpt from bin/tests/system/rpzextra/conftest.py
as it is a copy-paste artifact that serves no purpose in the "rpzextra"
system test.
2022-03-14 08:59:32 +01:00
Michał Kępień
96b7f9f9aa Refactor "statschannel" test's helper modules
The "statschannel" system test contains two Python helper modules:

  - generic.py: test functions directly invoked by both tests-json.py
    and test-xml.py,

  - helper.py: helper functions invoked by test functions in generic.py.

The above logic for splitting helper functions into Python modules
prevents selective test skipping from working due to unconditional
import statements being present in both helper modules.  For example, if
dnspython is not available on the test host, tests-json.py imports
generic.py, which in turn imports helper.py, which in turn attempts to
import various dnspython modules, triggering ImportError exceptions
during test initialization.  Various decorators used for some tests
(like @pytest.mark.dnspython) suggest that such a scenario should be
handled gracefully, but that is not the case - modifying the test
collection in conftest.py does not prevent pytest from failing due to
import errors.

Fix by moving helper functions around to achieve a different split:

  - generic.py: helper functions only relying on the Python standard
    library,

  - generic_dnspython.py: helper functions requiring dnspython.

Only two tests in tests-{json,xml}.py need dnspython to work
(test_traffic_json(), test_traffic_xml()).  Since all
dnspython-dependent code is now present in generic_dnspython.py, employ
pytest.importorskip() in those two tests to ensure they can be
selectively skipped when dnspython is not available.  Adjust other code
to account for the revised Python helper module layout.  Remove all
occurrences of the @pytest.mark.dnspython decorator (and all associated
code) from the "statschannel" system test to prevent confusion.
2022-03-14 08:59:32 +01:00
Michał Kępień
4e0d576858 Improve test discovery logic in get_ports.sh
The find invocation used by the bin/tests/system/get_ports.sh script
("find . -maxdepth 1 -mindepth 1 -type d") assumes the list of
directories in bin/tests/system/ remains unchanged throughout the run
time of a single system test suite.  With pytest in use and the
conftest.py file now present in bin/tests/system/, that assumption is no
longer true as a __pycache__ directory may be created when the first
pytest-based test is started.  Since the list of names returned by the
above find invocation serves as a fixed-size array of "port range
slots", any changes to that list during a system test suite run may lead
to port assignment collisions [1].

Fix by making the find invocation more nuanced, so that it only returns
names of directories containing test code.  Squash a grep / cut pipeline
into a single awk invocation.

[1] see commit 31e5ca4bd9f50b9e0ad5a88685225afacb073a8a
2022-03-14 08:59:32 +01:00
Michał Kępień
53ef8835c1 Reuse common port-related test fixtures
Most Python-based system tests need to know which ports were assigned to
a given test by bin/tests/system/get_ports.sh.  This is currently
handled by inspecting the values of various environment variables (set
by bin/tests/system/run.sh) and passing the port numbers to Python
scripts via pytest fixtures.  However, this glue code has so far been
copy-pasted into each system test using it, rather than reused.

Since pytest also looks for conftest.py files in parent directories,
move commonly used fixtures to bin/tests/system/conftest.py.  Set the
scope of all the moved fixtures to "session" as their return values are
only based on environment variables, so there is no point in recreating
them for every test requesting them.  Adjust test code accordingly.
2022-03-14 08:59:32 +01:00
Ondřej Surý
342c06c335 Merge branch '3203-fix-the-build-flag-order' into 'main'
Fix the remaining cases of <prog>_CFLAGS -> <prog>_CPPFLAGS

Closes #3203

See merge request isc-projects/bind9!5971
2022-03-13 17:50:50 +00:00
Ondřej Surý
41a60a0e21 Fix the remaining cases of <prog>_CFLAGS -> <prog>_CPPFLAGS
Building BIND 9 with older version of BIND 9 installed would result in
build failure.  Fix the last two remaining cases where <prog>_CFLAGS was
being used leading to wrong order of the build flags on the command line.
2022-03-13 17:42:09 +01:00
Petr Špaček
b103f516d0 Merge branch '2799-doc-build-fixes' into 'main'
Fix docs build

See merge request isc-projects/bind9!5961
2022-03-11 11:20:50 +00:00
Petr Špaček
524fce77fe
Fix docs build from tarball broken by MR !5254
Related: !5254
2022-03-11 10:54:39 +01:00
Petr Špaček
b0f6fc7f2f
Shorten artifact retention for docs:tarball job to one day
We now run both docs and docs:tarball jobs at the same time and keeping
artifacts for longer period of time is a waste.

Artifacts for docs job has to be kept for long period of time because
they are used by scripts behind bind.isc.org web site.
2022-03-11 10:54:35 +01:00
Petr Špaček
188684a31d
Always check if docs can be built from tarball
The docs:tarball job is deemed to be cheap enough to run all the time
and it catches omissions in dist targets of Makefiles.

MR !5254 was missing changes to dist target in Makefile and broke docs
build from tarball without us noticing during pipeline run on the MR,
and it manifested itself only on scheduled pipelines which include
docs:tarball job.
2022-03-11 10:52:28 +01:00
Ondřej Surý
53dd4f02c1 Merge branch '3200-add-per-send-timer' into 'main'
Change single write timer to per-send timers

Closes #3200

See merge request isc-projects/bind9!5955
2022-03-11 09:39:58 +00:00
Ondřej Surý
8ace9e0c62 Add CHANGES and release note for [GL #3200] 2022-03-11 09:58:02 +01:00
Ondřej Surý
49c804f8b7 Cleanup the nmhandle attach/detach in httpd.c
In httpd.c, the send callback can directly call read callback without
calling isc_nm_resumeread().  When per-send timeout was added, this
could lead to use-after-free when shutting down the named.

Cleanup the way how we attach to .readhandle and .sendhandle, so there's
assurance that .readhandle will be always non-NULL when reading and
.sendhandle will be always non-NULL when sending.

Additionally, it was found that the implementation ignored the
"Connection: close" header and it worked only accidentally by closing
the connection after the first read from the TCP socket.  This has been
also fixed.
2022-03-11 09:57:10 +01:00
Ondřej Surý
6ddac2d56d On shutdown, reset the established TCP connections
Previously, the established TCP connections (both client and server)
would be gracefully closed waiting for the write timeout.

Don't wait for TCP connections to gracefully shutdown, but directly
reset them for faster shutdown.
2022-03-11 09:56:57 +01:00
Ondřej Surý
a761aa59e3 Change single write timer to per-send timers
Previously, there was a single per-socket write timer that would get
restarted for every new write.  This turned out to be insufficient
because the other side could keep reseting the timer, and never reading
back the responses.

Change the single write timer to per-send timer which would in turn
reset the TCP connection on the first send timeout.
2022-03-11 09:56:57 +01:00
Petr Špaček
1357d44605 Merge branch '2799-documentation-for-administrative-tools-is-out-of-sync-with-manual-pages' into 'main'
Fix Administrative Tools section in the ARM

Closes #2799 and #2826

See merge request isc-projects/bind9!5254
2022-03-10 19:17:03 +00:00
Tony Finch
178aef5b8c
Refer to RFC 4592 for DNS wildcards
The named-checkzone(1) and named-compilezone(1) manual pages used to
refer to the description of wildcards in RFC 1034.
2022-03-10 20:13:23 +01:00
Petr Špaček
785f6d470f
Generate diffs in tarball-create CI job
Usually it is just nits and it is much easier to debug when you actually
can see what the differences were.
2022-03-10 20:13:22 +01:00
Suzanne Goldlust
2d2d87a615
Fix Tools for Use With the Name Server Daemon in the ARM
Remove outdated command references from ARM section
3.3.1. Tools for Use With the Name Server Daemon
and replace them with links to man pages.

Fixes: #2799
2022-03-10 20:13:22 +01:00
Tony Finch
315b3c3a1a
In the ARM appendix, sort man page sections alphabetically 2022-03-10 20:13:22 +01:00
Petr Špaček
9992f7808c
Split out named-compilezone and named-checkzone man pages
Both utilities were included as one man page, but this caused a problem:
Sphinx directive .. include was used twice on the same file, which
prevented us from using labels (or anything with unique identifier) in
the man pages. This effectivelly prevented linking to them.

Splitting man pages allows us to solve the linking problems and also
clearly make text easier to follow because it does not mention two tools
at the same time.

This change causes duplication of text, but given the frequecy of changes
to these tools I think it is acceptable. I've considered deduplication
using smaller .rst snippets which get included into both man pages,
but it would require more sed scripting to handle defaults etc. and
I think it would be way too complex solution for this problem.

Related: #2799
2022-03-10 20:13:22 +01:00
Petr Špaček
2e42414522
Split out ddns-confgen and tsig-keygen man pages
Both utilities were included as one man page, but this caused a problem:
Sphinx directive .. include was used twice on the same file, which
prevented us from using labels (or anything with unique identifier) in
the man pages. This effectivelly prevented linking to them.

Splitting man pages allows us to solve the linking problems and also
clearly make text easier to follow because it does not mention two tools
at the same time.

This change causes duplication of text, but given the frequecy of changes
to these tools I think it is acceptable.

Related: #2799
2022-03-10 20:13:22 +01:00
Petr Špaček
473d5a8d03
Remove nonexistent option -r from confgen man pages
Fixes omission in !269.

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

Closes #3199

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

Closes #3189

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

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

Closes #3188

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

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

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

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

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

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

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

Change the function(s) to return void and remove the extra checks in
the code that uses them.
2022-03-08 14:51:55 +01:00