Commit Graph

35635 Commits

Author SHA1 Message Date
Michał Kępień
3680763577 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.

(cherry picked from commit 0a76f186a5)
2022-03-14 09:04:10 +01:00
Michał Kępień
f37e0f2cbe 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.

(cherry picked from commit 96b7f9f9aa)
2022-03-14 09:04:10 +01:00
Michał Kępień
4847de9de1 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 31e5ca4bd9

(cherry picked from commit 4e0d576858)
2022-03-14 09:04:10 +01:00
Michał Kępień
0cc4ff04ec 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.

(cherry picked from commit 53ef8835c1)
2022-03-14 09:04:10 +01:00
Ondřej Surý
5ac5ec11e0 Merge branch '3203-fix-the-build-flag-order-v9_18' into 'v9_18'
Fix the remaining cases of <prog>_CFLAGS -> <prog>_CPPFLAGS [v9.18]

See merge request isc-projects/bind9!5972
2022-03-13 18:23:04 +00:00
Ondřej Surý
651af0bf65 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.

(cherry picked from commit 41a60a0e21)
2022-03-13 18:53:19 +01:00
Petr Špaček
c74d78a9ff Merge branch '2799-doc-build-fixes-v9_18' into 'v9_18'
Fix docs build [v9_18]

See merge request isc-projects/bind9!5964
2022-03-11 11:28:12 +00:00
Petr Špaček
7130576276 Fix docs build from tarball broken by MR !5254
Related: !5254
(cherry picked from commit 524fce77fe)
2022-03-11 12:23:20 +01:00
Petr Špaček
25328e2ca4 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.

(cherry picked from commit b0f6fc7f2f)
2022-03-11 12:23:19 +01:00
Petr Špaček
31d572d580 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.

(cherry picked from commit 188684a31d)
2022-03-11 12:23:15 +01:00
Ondřej Surý
c1f995cc17 Merge branch '3200-add-per-send-timer-v9_18' into 'v9_18'
Change single write timer to per-send timers [v9.18]

See merge request isc-projects/bind9!5963
2022-03-11 10:26:40 +00:00
Ondřej Surý
ab2dfec43f Add CHANGES and release note for [GL #3200]
(cherry picked from commit 8ace9e0c62)
2022-03-11 10:52:43 +01:00
Ondřej Surý
6fbf582f18 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.

(cherry picked from commit 49c804f8b7)
2022-03-11 10:52:22 +01:00
Ondřej Surý
fd351a60ff 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.

(cherry picked from commit 6ddac2d56d)
2022-03-11 10:52:22 +01:00
Ondřej Surý
27e47c5101 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.

(cherry picked from commit a761aa59e3)
2022-03-11 10:52:22 +01:00
Petr Špaček
923ea06654 Merge branch '2799-documentation-for-administrative-tools-is-out-of-sync-with-manual-pages-v9_18' into 'v9_18'
Fix Administrative Tools section in the ARM [v9_18]

See merge request isc-projects/bind9!5958
2022-03-10 19:23:08 +00:00
Tony Finch
98604b21a5 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.

(cherry picked from commit 178aef5b8c)
2022-03-10 20:18:52 +01:00
Petr Špaček
42069e5f16 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.

(cherry picked from commit 785f6d470f)
2022-03-10 20:18:52 +01:00
Suzanne Goldlust
3554ec4615 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
(cherry picked from commit 2d2d87a615)
2022-03-10 20:18:52 +01:00
Tony Finch
85a8e8f21a In the ARM appendix, sort man page sections alphabetically
(cherry picked from commit 315b3c3a1a)
2022-03-10 20:18:52 +01:00
Petr Špaček
158092f9b7 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
(cherry picked from commit 9992f7808c)
2022-03-10 20:18:52 +01:00
Petr Špaček
bab233d766 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
(cherry picked from commit 2e42414522)
2022-03-10 20:18:52 +01:00
Petr Špaček
1ffe6d19cb Remove nonexistent option -r from confgen man pages
Fixes omission in !269.

Fixes: #2826
(cherry picked from commit 473d5a8d03)
2022-03-10 20:18:46 +01:00
Tony Finch
cb4f8d5348 Merge branch '3199-doc-dev-v9_18' into 'v9_18'
Remove documentation for `rndc keydone`

See merge request isc-projects/bind9!5957
2022-03-10 15:42:46 +00:00
Tony Finch
59372ede60 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.

(cherry picked from commit e532d39146)
2022-03-10 14:53:21 +00:00
Tony Finch
20ee59d6a9 Drop references to Windows in doc/dev
Windows is not a supported platform any more.

(cherry picked from commit 037468f6a4)
2022-03-10 14:53:21 +00:00
Tony Finch
9aeec183cf 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.

(cherry picked from commit 328d11297d)
2022-03-10 14:53:21 +00:00
Tony Finch
c9b6dba4a9 Drop documents that have been folded into doc/dev/dev.md
There is no need to keep obsolete duplicate docs around.

(cherry picked from commit ec1e8e7001)
2022-03-10 14:53:21 +00:00
Tony Finch
8f7f5b5941 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.

(cherry picked from commit 6be83f2eb7)
2022-03-10 14:53:21 +00:00
Ondřej Surý
f462590546 Merge branch 'ondrej/remove-ATOMIC_VAR_INIT-v9_18' into 'v9_18'
Remove usage of deprecated ATOMIC_VAR_INIT() macro

See merge request isc-projects/bind9!5950
2022-03-09 09:33:25 +00:00
Ondřej Surý
913e64e8e1 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

(cherry picked from commit f251d69eba)
2022-03-09 09:25:37 +01:00
Ondřej Surý
b37b98cf3b Merge branch 'ondrej/lib/isc/ht.c-cleanup-v9_18' into 'v9_18'
Make isc_ht_init() and isc_ht_iter_create() return void [v9.18]

See merge request isc-projects/bind9!5946
2022-03-08 19:47:21 +00:00
Ondřej Surý
ebe2baec95 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.

(cherry picked from commit d128656d2e)
2022-03-08 20:47:06 +01:00
Ondřej Surý
ce9908cb4e Make isc_ht_init() and isc_ht_iter_create() 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.

(cherry picked from commit 8fa27365ec)
2022-03-08 20:47:06 +01:00
Ondřej Surý
ddc6479792 Merge branch 'ondrej/lib/isc/heap.c-cleanup-v9_18' into 'v9_18'
Make isc_heap_create() and isc_heap_insert() return void

See merge request isc-projects/bind9!5944
2022-03-08 19:25:46 +00:00
Ondřej Surý
b3d0c95e68 Make isc_heap_create() and isc_heap_insert() 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.

(cherry picked from commit bbb4cdb92d)
2022-03-08 20:24:54 +01:00
Ondřej Surý
09aede730b Merge branch '2201-reimplement-set_tcp_maxseg-for-netmgr-v9_18' into 'v9_18'
Set minimum MTU (1280) on IPv6 sockets

See merge request isc-projects/bind9!5942
2022-03-08 10:58:04 +00:00
Ondřej Surý
b1878aa2ac Add CHANGES note for [GL #2201]
(cherry picked from commit 67dbe0ae4d)
2022-03-08 11:12:44 +01:00
Ondřej Surý
445ce0c165 Set TCP maximum segment size to minimum size of 1220
Previously the socket code would set the TCPv6 maximum segment size to
minimum value to prevent IP fragmentation for TCP.  This was not yet
implemented for the network manager.

Implement network manager functions to set and use minimum MTU socket
option and set the TCP_MAXSEG socket option for both IPv4 and IPv6 and
use those to clamp the TCP maximum segment size for TCP, TCPDNS and
TLSDNS layers in the network manager to 1220 bytes, that is 1280 (IPv6
minimum link MTU) minus 40 (IPv6 fixed header) minus 20 (TCP fixed
header)

We already rely on a similar value for UDP to prevent IP fragmentation
and it make sense to use the same value for IPv4 and IPv6 because the
modern networks are required to support IPv6 packet sizes.  If there's
need for small TCP segment values, the MTU on the interfaces needs to be
properly configured.

(cherry picked from commit 8098a58581)
2022-03-08 11:12:43 +01:00
Ondřej Surý
2a31f19817 Set minimum MTU (1280) on IPv6 sockets
The IPV6_USE_MIN_MTU socket option directs the IP layer to limit the
IPv6 packet size to the minimum required supported MTU from the base
IPv6 specification, i.e. 1280 bytes.  Many implementations of TCP
running over IPv6 neglect to check the IPV6_USE_MIN_MTU value when
performing MSS negotiation and when constructing a TCP segment despite
MSS being defined to be the MTU less the IP and TCP header sizes (60
bytes for IPv6).  This leads to oversized IPv6 packets being sent
resulting in unintended Path Maximum Transport Unit Discovery (PMTUD)
being performed and to fragmented IPv6 packets being sent.

Add and use a function to set socket option to limit the MTU on IPv6
sockets to the minimum MTU (1280) both for UDP and TCP.

(cherry picked from commit 5d34a14f22)
2022-03-08 11:12:43 +01:00
Ondřej Surý
fea6d595e2 Merge branch 'aram-fix-dns_request_createraw-cleanup-bug-v9_18' into 'v9_18'
[v9_18] Fix a function cleanup bug in dns_request_createraw()

See merge request isc-projects/bind9!5939
2022-03-08 09:00:50 +00:00
Aram Sargsyan
8f2e287a56 Fix a function cleanup bug in dns_request_createraw
When get_dispatch() returns an error code, the dns_request_createraw()
function jumps to the `cleanup` label, which will leave a previous
attachment to the `request` pointer unattached.

Fix the issue by jumping to the `detach` label instead.

(cherry picked from commit 963f6a2203)
2022-03-08 10:00:00 +01:00
Ondřej Surý
df3a9e1286 Merge branch '3193-null-pointer-dereferences-in-udp_ready-v9_18' into 'v9_18'
Fix null pointer dereferences in udp_ready() (v9.18)

See merge request isc-projects/bind9!5936
2022-03-08 08:59:21 +00:00
Ondřej Surý
c13e191e52 Fix null pointer dereferences in udp_ready()
The query pointer was detached too early leading to null pointer
reference.  Move the query_detach() after the query->canceled check.

(cherry picked from commit 9d8e8a4fcc)
2022-03-08 09:59:06 +01:00
Ondřej Surý
1996d1b91b Merge branch 'ondrej/refactor-tooling-around-lib/gen/dns.c-v9_18' into 'v9_18'
Merge lib/dns/gen.h contents to lib/dns/gen.c (v9.18)

See merge request isc-projects/bind9!5933
2022-03-08 08:57:36 +00:00
Ondřej Surý
898d0f8ee2 Replace AX_CC_FOR_BUILD with AX_PROG_CC_FOR_BUILD
The AX_PROG_CC_FOR_BUILD implementation to find a native CC compiler is
slightly better because it uses AC_PROG_CC and AC_PROG_CPP to find the
native compiler instead of just defaulting to `gcc` as AX_CC_FOR_BUILD
does.

AX_PROG_CC_FOR_BUILD also sets BUILD_EXEEXT that we already use in the
Makefile.am for `lib/dns/gen` while AX_CC_FOR_BUILD uses
EXEEXT_FOR_BUILD.

(cherry picked from commit b5a5eed7a0)
2022-03-08 09:55:28 +01:00
Ondřej Surý
d9e54ad0dd Merge lib/dns/gen.h contents to lib/dns/gen.c
Formerly, the gen.h header contained a compatibility layer between Win32
and POSIX platforms.  Since we have already dropped the Win32 build, we
can merged gen.h into gen.c as the header file is not used elsewhere.

(cherry picked from commit f24b26188d)
2022-03-08 09:55:28 +01:00
Ondřej Surý
22b8eaf11d Merge branch 'ondrej-use-locked-queue-v9_18' into 'v9_18'
Replace netievent lock-free queue with simple locked queue (v9.18)

See merge request isc-projects/bind9!5932
2022-03-08 08:54:46 +00:00
Ondřej Surý
6c29cba8c5 Add CHANGES note for [GL #3180]
(cherry picked from commit d75b953489)
2022-03-08 09:52:54 +01:00
Ondřej Surý
555bdb9f82 Replace netievent lock-free queue with simple locked queue
The current implementation of isc_queue uses Michael-Scott lock-free
queue that in turn uses hazard pointers.  It was discovered that the way
we use the isc_queue, such complicated mechanism isn't really needed,
because most of the time, we either execute the work directly when on
nmthread (in case of UDP) or schedule the work from the matching
nmthreads.

Replace the current implementation of the isc_queue with a simple locked
ISC_LIST.  There's a slight improvement - since copying the whole list
is very lightweight - we move the queue into a new list before we start
the processing and locking just for moving the queue and not for every
single item on the list.

NOTE: There's a room for future improvements - since we don't guarantee
the order in which the netievents are processed, we could have two lists
- one unlocked that would be used when scheduling the work from the
matching thread and one locked that would be used from non-matching
thread.

(cherry picked from commit 6bd025942c)
2022-03-08 09:52:39 +01:00