]> git.ipfire.org Git - thirdparty/bind9.git/log
thirdparty/bind9.git
5 years agoreduce timing dependencies in system tests
Evan Hunt [Sun, 27 Sep 2020 06:27:24 +0000 (23:27 -0700)] 
reduce timing dependencies in system tests

one of the tests in the resolver system test depends on dig
getting no response to its first two query attempts, and SERVFAIL
on the third after resolution times out.

using a 5-second retry timer in dig means the SERVFAIL response
could occur while dig is discarding the second query and preparing
to send the third. in this case the server's response could be
missed.  shortening the retry interval to 4 seconds ensures that
dig has already sent the third query when the SERVFAIL response
arrives.

also, the serve-stale system test could fail due to a race in which
it timed out after waiting ten seconds for a file to be written, and
the dig timeout was just a bit longer. this is addressed by extending
the dig timeout to 11 seconds for this test.

5 years agodig: use new netmgr timeout mechanism
Evan Hunt [Tue, 3 Nov 2020 05:38:56 +0000 (21:38 -0800)] 
dig: use new netmgr timeout mechanism

use isc_nmhandle_settimeout() to set read/recv timeouts, and get rid
of connect_timeout() and related functions in dighost.c.

5 years agoadd isc_nmhandle_settimeout() function
Evan Hunt [Tue, 3 Nov 2020 03:58:05 +0000 (19:58 -0800)] 
add isc_nmhandle_settimeout() function

this function sets the read timeout for the socket associated
with a netmgr handle and, if the timer is running, resets it.
for TCPDNS sockets it also sets the read timeout and resets the
timer on the outer TCP socket.

5 years agodig: setup IDN whenever printing a message
Evan Hunt [Sat, 12 Sep 2020 20:23:52 +0000 (13:23 -0700)] 
dig: setup IDN whenever printing a message

because dig now uses the netmgr, printing of response messages
happens in a different thread than setup. the IDN output filtering
procedure, which set using dns_name_settotextfilter(), is stored as
thread-local data, and so if it's set during setup, it won't be
accessible when printing. we now set it immediately before printing,
in the same thread, and clear it immedately afterward.

5 years agodig: remove "+unexpected" option
Evan Hunt [Tue, 8 Sep 2020 22:58:09 +0000 (15:58 -0700)] 
dig: remove "+unexpected" option

The network manager does not support returning UDP datagrams to
clients from unexpected sources; it is therefore not possible for
dig to accept them.  The "+[no]unexpected" option has therefore
been removed from the dig command and its documentation.

5 years agoconvert dig/host/nslookup to use the netmgr
Evan Hunt [Sat, 5 Sep 2020 23:37:24 +0000 (16:37 -0700)] 
convert dig/host/nslookup to use the netmgr

use netmgr functions instead of isc_socket for dig, host, and
nslookup. note that `dig +unexpected` is not working.

5 years agofix nmhandle attach/detach errors in tcpdnsconnect_cb()
Ondřej Surý [Wed, 4 Nov 2020 19:59:31 +0000 (20:59 +0100)] 
fix nmhandle attach/detach errors in tcpdnsconnect_cb()

we need to attach to the statichandle when connecting TCPDNS sockets,
same as with UDP.

5 years agoMerge branch 'artem/fix-build-with-DEBUG-defined' into 'main'
Artem Boldariev [Fri, 6 Nov 2020 10:40:33 +0000 (10:40 +0000)] 
Merge branch 'artem/fix-build-with-DEBUG-defined' into 'main'

Fix build with DEBUG defined (-DDEBUG)

See merge request isc-projects/bind9!4351

5 years agoFix build with DEBUG defined (-DDEBUG)
Artem Boldariev [Tue, 3 Nov 2020 11:27:35 +0000 (13:27 +0200)] 
Fix build with DEBUG defined (-DDEBUG)

The problem was introduced by commit 98b55eb4.

5 years agoMerge branch '2239-fctx-id-is-uninitialized-and-effectively-unused' into 'main'
Mark Andrews [Fri, 6 Nov 2020 02:26:11 +0000 (02:26 +0000)] 
Merge branch '2239-fctx-id-is-uninitialized-and-effectively-unused' into 'main'

Resolve "fctx:id is uninitialized and effectively unused"

Closes #2239

See merge request isc-projects/bind9!4346

5 years agoremove fctx:id field
Mark Andrews [Tue, 3 Nov 2020 03:46:49 +0000 (14:46 +1100)] 
remove fctx:id field

5 years agoMerge branch '1728-drop-big-key' into 'main'
Michal Nowak [Thu, 5 Nov 2020 16:25:32 +0000 (16:25 +0000)] 
Merge branch '1728-drop-big-key' into 'main'

Drop bigkey

Closes #1728

See merge request isc-projects/bind9!4350

5 years agoDrop bigkey
Michal Nowak [Mon, 2 Nov 2020 15:52:14 +0000 (16:52 +0100)] 
Drop bigkey

The 'bigkey' binary is not used anywhere, therefor it's sources should
be removed.

5 years agoMerge branch 'michal/miscellaneous-windows-tweaks' into 'main'
Michał Kępień [Thu, 5 Nov 2020 14:06:43 +0000 (14:06 +0000)] 
Merge branch 'michal/miscellaneous-windows-tweaks' into 'main'

Miscellaneous Windows tweaks

Closes images#10

See merge request isc-projects/bind9!4354

5 years agoFix detection of CMake-built libuv on Windows
Michał Kępień [Thu, 5 Nov 2020 10:45:19 +0000 (11:45 +0100)] 
Fix detection of CMake-built libuv on Windows

As of libuv 1.36.0, CMake is the only supported build method for libuv
on Windows.  Account for that fact by adjusting the relevant paths and
DLL file names used in the win32utils/Configure script.  Update
Windows-specific documentation accordingly.

5 years agoUse "image" key in Windows GitLab CI job templates
Michał Kępień [Thu, 5 Nov 2020 10:45:19 +0000 (11:45 +0100)] 
Use "image" key in Windows GitLab CI job templates

Our GitLab Runner Custom executor scripts now use the "image" key for
determining the Windows Docker image to use for a given CI job.  Update
.gitlab-ci.yml to reflect that change.

5 years agoMerge branch 'michal/rpz-system-test-fix-fast-expire' into 'main'
Michał Kępień [Thu, 5 Nov 2020 07:03:30 +0000 (07:03 +0000)] 
Merge branch 'michal/rpz-system-test-fix-fast-expire' into 'main'

"rpz" system test: fix intermittent false positive (expired RPZ zone)

See merge request isc-projects/bind9!4357

5 years agoWait for the "fast-expire" zone to be transferred
Michał Kępień [Thu, 5 Nov 2020 06:53:43 +0000 (07:53 +0100)] 
Wait for the "fast-expire" zone to be transferred

In order for a "fast-expire/IN: response-policy zone expired" message to
be logged in ns3/named.run, the "fast-expire" zone must first be
transferred in by that server.  However, with unfavorable timing, ns3
may be stopped before it manages to fetch the "fast-expire" zone from
ns5 and after the latter has been reconfigured to no longer serve that
zone.  In such a case, the "rpz" system test will report a false
positive for the relevant check.  Prevent that from happening by
ensuring ns3 manages to transfer the "fast-expire" zone before getting
shut down.

5 years agoMerge branch '2243-cid-312970-incorrect-expression-copy_paste_error-in-tcp-c' into...
Mark Andrews [Thu, 5 Nov 2020 00:32:06 +0000 (00:32 +0000)] 
Merge branch '2243-cid-312970-incorrect-expression-copy_paste_error-in-tcp-c' into 'main'

Resolve "CID 312970: Incorrect expression (COPY_PASTE_ERROR) in tcp.c"

Closes #2243

See merge request isc-projects/bind9!4355

5 years agoIncorrect result code passed to failed_connect_cb
Mark Andrews [Wed, 4 Nov 2020 04:20:13 +0000 (15:20 +1100)] 
Incorrect result code passed to failed_connect_cb

    *** CID 312970:  Incorrect expression  (COPY_PASTE_ERROR) /lib/isc/netmgr/tcp.c: 282 in tcp_connect_cb()
    276      }
    277
    278      isc__nm_incstats(sock->mgr, sock->statsindex[STATID_CONNECT]);
    279      r = uv_tcp_getpeername(&sock->uv_handle.tcp, (struct sockaddr *)&ss,
    280             &(int){ sizeof(ss) });
    281      if (r != 0) {
    >>>     CID 312970:  Incorrect expression  (COPY_PASTE_ERROR)
    >>>     "status" in "isc___nm_uverr2result(status, true, "netmgr/tcp.c", 282U)" looks like a copy-paste error.
    282      failed_connect_cb(sock, req, isc__nm_uverr2result(status));
    283      return;
    284      }
    285
    286      atomic_store(&sock->connecting, false);
    287

5 years agoMerge branch 'matthijs-test-multi-signer-model' into 'main'
Matthijs Mekking [Wed, 4 Nov 2020 13:27:22 +0000 (13:27 +0000)] 
Merge branch 'matthijs-test-multi-signer-model' into 'main'

Add a test for RFC 8901 signer model 2

See merge request isc-projects/bind9!4306

5 years agokasp test: Use DEFAULT_ALGORITHM in tests.sh
Matthijs Mekking [Mon, 2 Nov 2020 10:04:07 +0000 (11:04 +0100)] 
kasp test: Use DEFAULT_ALGORITHM in tests.sh

Some setup scripts uses DEFAULT_ALGORITHM in their dnssec-policy
and/or initial signing. The tests still used the literal values
13, ECDSAP256SHA256, and 256. Replace those occurrences where
appropriate.

5 years agoAdd a test for RFC 8901 signer model 2
Matthijs Mekking [Mon, 26 Oct 2020 16:42:31 +0000 (17:42 +0100)] 
Add a test for RFC 8901 signer model 2

The new 'dnssec-policy' was already compatible with multi-signer
model 2, now we also have a test for it.

5 years agoMerge branch '2244-nta-related-crash-after-reconfiguring-views' into 'main'
Mark Andrews [Tue, 3 Nov 2020 12:47:43 +0000 (12:47 +0000)] 
Merge branch '2244-nta-related-crash-after-reconfiguring-views' into 'main'

Resolve "NTA-related crash after reconfiguring views"

Closes #2244

See merge request isc-projects/bind9!4345

5 years agoAdd CHANGES for [GL #2244]
Mark Andrews [Tue, 3 Nov 2020 00:30:05 +0000 (11:30 +1100)] 
Add CHANGES for [GL #2244]

5 years agoCall nta_detach() before dns_view_weakdetach() so view is available.
Mark Andrews [Tue, 3 Nov 2020 00:25:55 +0000 (11:25 +1100)] 
Call nta_detach() before dns_view_weakdetach() so view is available.

5 years agoMerge branch 'marka-fixup-dnssec' into 'main'
Mark Andrews [Tue, 3 Nov 2020 00:48:58 +0000 (00:48 +0000)] 
Merge branch 'marka-fixup-dnssec' into 'main'

dnssec system test needs python and perl

See merge request isc-projects/bind9!4342

5 years agodnssec system test needs python and perl
Mark Andrews [Mon, 2 Nov 2020 03:58:59 +0000 (14:58 +1100)] 
dnssec system test needs python and perl

5 years agoMerge branch '2227-tcp-connection-closed-second-fix' into 'main'
Ondřej Surý [Mon, 2 Nov 2020 22:52:01 +0000 (22:52 +0000)] 
Merge branch '2227-tcp-connection-closed-second-fix' into 'main'

Fix improper closed connection handling in tcpdns.

Closes #2227

See merge request isc-projects/bind9!4341

5 years agoPut up additional safe guards to not use inactive/closed tcpdns socket
Ondřej Surý [Mon, 2 Nov 2020 14:55:12 +0000 (15:55 +0100)] 
Put up additional safe guards to not use inactive/closed tcpdns socket

When we are operating on the tcpdns socket, we need to double check
whether the socket or its outerhandle or its listener or its mgr is
still active and when not, bail out early.

5 years agoAdd CHANGES note for [GL #2227]
Ondřej Surý [Mon, 2 Nov 2020 14:00:49 +0000 (15:00 +0100)] 
Add CHANGES note for [GL #2227]

5 years agoFix improper closed connection handling in tcpdns.
Witold Kręcicki [Sat, 31 Oct 2020 20:08:53 +0000 (21:08 +0100)] 
Fix improper closed connection handling in tcpdns.

If dnslisten_readcb gets a read callback it needs to verify that the
outer socket wasn't closed in the meantime, and issue a CANCELED callback
if it was.

5 years agoMerge branch '2237-placeholder' into 'main'
Michał Kępień [Mon, 2 Nov 2020 11:25:30 +0000 (11:25 +0000)] 
Merge branch '2237-placeholder' into 'main'

Add placeholder for #2237

See merge request isc-projects/bind9!4343

5 years agoAdd placeholder for #2237
Michał Kępień [Mon, 2 Nov 2020 11:24:11 +0000 (12:24 +0100)] 
Add placeholder for #2237

5 years agoMerge branch '2235-add-netmgr-functions-to-support-outgoing-dns-queries' into 'main'
Ondřej Surý [Fri, 30 Oct 2020 13:40:18 +0000 (13:40 +0000)] 
Merge branch '2235-add-netmgr-functions-to-support-outgoing-dns-queries' into 'main'

Resolve "Add netmgr functions to support outgoing DNS queries"

Closes #2235

See merge request isc-projects/bind9!4318

5 years agoCHANGES
Evan Hunt [Thu, 29 Oct 2020 01:00:20 +0000 (18:00 -0700)] 
CHANGES

5 years agocheck return value from uv_tcp_getpeername() when connecting
Evan Hunt [Thu, 29 Oct 2020 22:42:09 +0000 (15:42 -0700)] 
check return value from uv_tcp_getpeername() when connecting

if we can't determine the peer, the connect should fail.

5 years agoadd a netmgr unit test
Ondřej Surý [Tue, 27 Oct 2020 16:12:41 +0000 (17:12 +0100)] 
add a netmgr unit test

tests of UDP and TCP cases including:
- sending and receiving
- closure sockets without reading or sending
- closure of sockets at various points while sending and receiving
- since the teste is multithreaded, cmocka now aborts tests on the
  first failure, so that failures in subthreads are caught and
  reported correctly.

5 years agoset REUSEPORT and REUSEADDR on TCP sockets if needed
Evan Hunt [Thu, 29 Oct 2020 18:15:26 +0000 (11:15 -0700)] 
set REUSEPORT and REUSEADDR on TCP sockets if needed

When binding a TCP socket, if bind() fails with EADDRINUSE,
try again with REUSEPORT/REUSEADDR (or the equivalent options).

5 years agoFix more races between connect and shutdown
Ondřej Surý [Thu, 29 Oct 2020 11:04:00 +0000 (12:04 +0100)] 
Fix more races between connect and shutdown

There were more races that could happen while connecting to a
socket while closing or shutting down the same socket.  This
commit introduces a .closing flag to guard the socket from
being closed twice.

5 years agoFix a race between isc__nm_async_shutdown() and new sends/reads
Ondřej Surý [Tue, 27 Oct 2020 19:00:08 +0000 (20:00 +0100)] 
Fix a race between isc__nm_async_shutdown() and new sends/reads

There was a data race where a new event could be scheduled after
isc__nm_async_shutdown() had cleaned up all the dangling UDP/TCP
sockets from the loop.

5 years agoRefactor udp_recv_cb()
Ondřej Surý [Mon, 26 Oct 2020 16:31:55 +0000 (17:31 +0100)] 
Refactor udp_recv_cb()

- more logical code flow.
- propagate errors back to the caller.
- add a 'reading' flag and call the callback from failed_read_cb()
  only when it the socket was actively reading.

5 years agoFix netmgr read/connect timeout issues
Ondřej Surý [Mon, 26 Oct 2020 13:19:37 +0000 (14:19 +0100)] 
Fix netmgr read/connect timeout issues

- don't bother closing sockets that are already closing.
- UDP read timeout timer was not stopped after reading.
- improve handling of TCP connection failures.

5 years agoAdd isc__nm_udp_shutdown() function
Ondřej Surý [Mon, 26 Oct 2020 11:30:54 +0000 (12:30 +0100)] 
Add isc__nm_udp_shutdown() function

This function will be called during isc_nm_closedown() to ensure
that all UDP sockets are closed and detached.

5 years agoadd netmgr functions to support outgoing DNS queries
Evan Hunt [Sat, 5 Sep 2020 18:07:40 +0000 (11:07 -0700)] 
add netmgr functions to support outgoing DNS queries

- isc_nm_tcpdnsconnect() sets up up an outgoing TCP DNS connection.
- isc_nm_tcpconnect(), _udpconnect() and _tcpdnsconnect() now take a
  timeout argument to ensure connections time out and are correctly
  cleaned up on failure.
- isc_nm_read() now supports UDP; it reads a single datagram and then
  stops until the next time it's called.
- isc_nm_cancelread() now runs asynchronously to prevent assertion
  failure if reading is interrupted by a non-network thread (e.g.
  a timeout).
- isc_nm_cancelread() can now apply to UDP sockets.
- added shim code to support UDP connection in versions of libuv
  prior to 1.27, when uv_udp_connect() was added

all these functions will be used to support outgoing queries in dig,
xfrin, dispatch, etc.

5 years agoMerge branch 'mnowak/OpenBSD_6.8' into 'main'
Michał Kępień [Fri, 30 Oct 2020 09:39:33 +0000 (09:39 +0000)] 
Merge branch 'mnowak/OpenBSD_6.8' into 'main'

Add OpenBSD 6.8

See merge request isc-projects/bind9!4298

5 years agoUpdate to OpenBSD 6.8
Michal Nowak [Mon, 19 Oct 2020 07:45:47 +0000 (09:45 +0200)] 
Update to OpenBSD 6.8

5 years agoMerge branch 'mnowak/add-freebsd12.2' into 'main'
Michal Nowak [Thu, 29 Oct 2020 15:01:23 +0000 (15:01 +0000)] 
Merge branch 'mnowak/add-freebsd12.2' into 'main'

Update to FreeBSD 12.2

See merge request isc-projects/bind9!4323

5 years agoUpdate to FreeBSD 12.2
Michal Nowak [Thu, 29 Oct 2020 09:19:50 +0000 (10:19 +0100)] 
Update to FreeBSD 12.2

5 years agoMerge branch 'mnowak/add-fedora-33' into 'main'
Michal Nowak [Thu, 29 Oct 2020 14:45:04 +0000 (14:45 +0000)] 
Merge branch 'mnowak/add-fedora-33' into 'main'

Add Fedora 33

See merge request isc-projects/bind9!4326

5 years agoAdd Fedora 33
Michal Nowak [Mon, 19 Oct 2020 07:43:25 +0000 (09:43 +0200)] 
Add Fedora 33

5 years agoMerge branch '2236-resolver-sometimes-treats-signed-insecure-zone-with-broken-dnskey...
Mark Andrews [Thu, 29 Oct 2020 13:46:53 +0000 (13:46 +0000)] 
Merge branch '2236-resolver-sometimes-treats-signed-insecure-zone-with-broken-dnskey-as-bogus' into 'main'

Resolve "Resolver sometimes treats signed, insecure zone with broken DNSKEY as bogus"

Closes #2236

See merge request isc-projects/bind9!4319

5 years agoAdd CHANGES note for [GL #2236]
Mark Andrews [Wed, 28 Oct 2020 01:09:06 +0000 (12:09 +1100)] 
Add CHANGES note for [GL #2236]

5 years agoCheck that a zone in the process of being signed resolves
Mark Andrews [Wed, 28 Oct 2020 05:40:36 +0000 (16:40 +1100)] 
Check that a zone in the process of being signed resolves

ans10 simulates a local anycast server which has both signed and
unsigned instances of a zone.  'A' queries get answered from the
signed instance.  Everything else gets answered from the unsigned
instance.  The resulting answer should be insecure.

5 years agoHandle DNS_R_NCACHENXRRSET in fetch_callback_{dnskey,validator}()
Mark Andrews [Wed, 28 Oct 2020 00:58:38 +0000 (11:58 +1100)] 
Handle DNS_R_NCACHENXRRSET in fetch_callback_{dnskey,validator}()

DNS_R_NCACHENXRRSET can be return when zones are in transition state
from being unsigned to signed and signed to unsigned.  The validation
should be resumed and should result in a insecure answer.

5 years agoMerge branch '2227-tcp-connection-closed-fix' into 'main'
Ondřej Surý [Thu, 29 Oct 2020 12:21:05 +0000 (12:21 +0000)] 
Merge branch '2227-tcp-connection-closed-fix' into 'main'

Properly handle outer TCP connection closed in TCPDNS.

Closes #2227

See merge request isc-projects/bind9!4309

5 years agoAdd CHANGES and release note for GL #2227
Witold Kręcicki [Tue, 27 Oct 2020 09:09:30 +0000 (10:09 +0100)] 
Add CHANGES and release note for GL #2227

5 years agoProperly handle outer TCP connection closed in TCPDNS.
Witold Kręcicki [Tue, 27 Oct 2020 09:09:30 +0000 (10:09 +0100)] 
Properly handle outer TCP connection closed in TCPDNS.

If the connection is closed while we're processing the request
we might access TCPDNS outerhandle which is already reset. Check
for this condition and call the callback with ISC_R_CANCELED result.

5 years agoMerge branch 'each-rpz-test-typo' into 'main'
Evan Hunt [Thu, 29 Oct 2020 05:33:40 +0000 (05:33 +0000)] 
Merge branch 'each-rpz-test-typo' into 'main'

fix a typo in rpz test

See merge request isc-projects/bind9!4320

5 years agofix a typo in rpz test
Evan Hunt [Thu, 29 Oct 2020 01:01:49 +0000 (18:01 -0700)] 
fix a typo in rpz test

"tcp-only" was not being tested correctly in the RPZ system test
because the option to the "digcmd" function that causes queries to
be sent via TCP was misspelled in one case, and was being interpreted
as a query name.

the "ckresult" function has also been changed to be case sensitive
for consistency with "digcmd".

5 years agoMerge branch 'ondrej/use-libuv-instead-libltdl' into 'main'
Ondřej Surý [Wed, 28 Oct 2020 16:28:49 +0000 (16:28 +0000)] 
Merge branch 'ondrej/use-libuv-instead-libltdl' into 'main'

Replace ltdl with libuv shared library handling interface

See merge request isc-projects/bind9!4278

5 years agoAdd CHANGES note for !4278
Ondřej Surý [Thu, 22 Oct 2020 13:09:48 +0000 (15:09 +0200)] 
Add CHANGES note for !4278

5 years agoFix possible NULL dereference in cd->dlz_destroy()
Ondřej Surý [Tue, 27 Oct 2020 13:18:43 +0000 (14:18 +0100)] 
Fix possible NULL dereference in cd->dlz_destroy()

If the call to cd->dlz_create() in dlopen_dlz_create() fails, cd->dbdata
may be NULL when dlopen_dlz_destroy() gets called in the cleanup path
and passing NULL to the cd->dlz_destroy() callback may cause a NULL
dereference.  Ensure that does not happen by checking whether cd->dbdata
is non-NULL before calling the cd->dlz_destroy() callback.

5 years agoUse libuv's shared library handling capabilities
Ondřej Surý [Tue, 20 Oct 2020 21:51:08 +0000 (23:51 +0200)] 
Use libuv's shared library handling capabilities

While libltdl is a feature-rich library, BIND 9 code only uses its basic
capabilities, which are also provided by libuv and which BIND 9 already
uses for other purposes.  As libuv's cross-platform shared library
handling interface is modeled after the POSIX dlopen() interface,
converting code using the latter to the former is simple.  Replace
libltdl function calls with their libuv counterparts, refactoring the
code as necessary.  Remove all use of libltdl from the BIND 9 source
tree.

5 years agoRefactor the cleanup code in lt_dl code
Ondřej Surý [Tue, 20 Oct 2020 21:51:08 +0000 (23:51 +0200)] 
Refactor the cleanup code in lt_dl code

The cleanup code that would clean the object after plugin/dlz/dyndb
loading has failed was duplicating the destructor for the object, so
instead of the extra code, we just use the destructor instead.

5 years agoUnify lt_dlopen() error handling
Ondřej Surý [Wed, 28 Oct 2020 14:25:44 +0000 (15:25 +0100)] 
Unify lt_dlopen() error handling

Make sure an error gets logged when any lt_dlopen() call in the source
tree fails.  Also make sure that NULL values returned by lt_dlerror()
are replaced with a generic error message to prevent passing NULL as an
argument for the %s format specifier.

5 years agoRemove redundant lt_dlerror() calls
Ondřej Surý [Mon, 26 Oct 2020 10:14:49 +0000 (11:14 +0100)] 
Remove redundant lt_dlerror() calls

The redundant lt_dlerror() calls were taken from the examples to clean
any previous errors from lt_dl...() calls.  However upon code
inspection, it was discovered there are no such paths that could cause
the lt_dlerror() to return spurious error messages.

5 years agoMerge branch 'mnowak/enhanced-test-portability' into 'main'
Michal Nowak [Tue, 27 Oct 2020 11:24:10 +0000 (11:24 +0000)] 
Merge branch 'mnowak/enhanced-test-portability' into 'main'

POSIX compatibility fixes to system test

See merge request isc-projects/bind9!4310

5 years agoReplace a seq invocation with a shell loop
Michal Nowak [Tue, 27 Oct 2020 09:30:21 +0000 (10:30 +0100)] 
Replace a seq invocation with a shell loop

seq is not portable.  Use a while loop instead to make the "dnssec"
system test script POSIX-compatible.

5 years agoGet rid of bashisms in string comparisons
Michal Nowak [Tue, 27 Oct 2020 09:20:05 +0000 (10:20 +0100)] 
Get rid of bashisms in string comparisons

The double equal sign ('==') is a Bash-specific string comparison
operator.  Ensure the single equal sign ('=') is used in all POSIX shell
scripts in the system test suite in order to retain their portability.

5 years agoMerge branch 'mnowak/add-stress-test-to-CI' into 'main'
Michal Nowak [Mon, 26 Oct 2020 17:02:37 +0000 (17:02 +0000)] 
Merge branch 'mnowak/add-stress-test-to-CI' into 'main'

Add stress test to CI

See merge request isc-projects/bind9!3716

5 years agoAdd "stress" tests to GitLab CI
Michal Nowak [Tue, 16 Jun 2020 12:19:41 +0000 (14:19 +0200)] 
Add "stress" tests to GitLab CI

Run "stress" tests for scheduled pipelines and pipelines created for
tags.  These tests were previously only performed manually (as part of
pre-release testing of each new BIND version).  Their purpose is to
detect memory leaks and potential performance issues.

As the run time of each "stress" test itself is set to 1 hour, set the
GitLab CI job timeout to 2 hours in order to account for the extra time
needed to set the test up and gather its results.

5 years agoMerge branch 'mnowak/openbsd-fix-gdb-in-system-test' into 'main'
Michal Nowak [Mon, 26 Oct 2020 13:59:07 +0000 (13:59 +0000)] 
Merge branch 'mnowak/openbsd-fix-gdb-in-system-test' into 'main'

Fix system test backtrace generation on OpenBSD

See merge request isc-projects/bind9!4272

5 years agoFix system test backtrace generation on OpenBSD
Michal Nowak [Mon, 19 Oct 2020 11:33:32 +0000 (13:33 +0200)] 
Fix system test backtrace generation on OpenBSD

On Linux core dump contains absolute path to crashed binary

    Core was generated by `/home/newman/isc/ws/bind9/bin/named/.libs/lt-named -D glue-ns1 -X named.lock -m'.

However, on OpenBSD there's only a basename

    Core was generated by `named'.

This commit adds support for the latter, retains the former.

5 years agoMerge branch '2226-tsan-error-in-dispatch-c' into 'main'
Mark Andrews [Fri, 23 Oct 2020 20:08:43 +0000 (20:08 +0000)] 
Merge branch '2226-tsan-error-in-dispatch-c' into 'main'

Resolve "TSAN error in dispatch.c accessing disp->portentry"

Closes #2226

See merge request isc-projects/bind9!4286

5 years agoHold qid->lock when calling deref_portentry() as
Mark Andrews [Thu, 22 Oct 2020 05:13:06 +0000 (16:13 +1100)] 
Hold qid->lock when calling deref_portentry() as

socket_search() need portentry to be unchanging.

    WARNING: ThreadSanitizer: data race
    Write of size 8 at 0x000000000001 by thread T1 (mutexes: write M1):
    #0 deref_portentry lib/dns/dispatch.c:630
    #1 deactivate_dispsocket lib/dns/dispatch.c:861
    #2 udp_recv lib/dns/dispatch.c:1105
    #3 udp_exrecv lib/dns/dispatch.c:1028
    #4 dispatch lib/isc/task.c:1152
    #5 run lib/isc/task.c:1344
    #6 <null> <null>

    Previous read of size 8 at 0x000000000001 by thread T2 (mutexes: write M1, write M2):
    #0 socket_search lib/dns/dispatch.c:661
    #1 get_dispsocket lib/dns/dispatch.c:744
    #2 dns_dispatch_addresponse lib/dns/dispatch.c:3120
    #3 resquery_send lib/dns/resolver.c:2467
    #4 fctx_query lib/dns/resolver.c:2217
    #5 fctx_try lib/dns/resolver.c:4245
    #6 fctx_timeout lib/dns/resolver.c:4570
    #7 dispatch lib/isc/task.c:1152
    #8 run lib/isc/task.c:1344
    #9 <null> <null>

5 years agoMerge branch '2215-dns_zoneflag_noixfr-is-misnamed' into 'main'
Mark Andrews [Fri, 23 Oct 2020 13:23:47 +0000 (13:23 +0000)] 
Merge branch '2215-dns_zoneflag_noixfr-is-misnamed' into 'main'

Resolve "DNS_ZONEFLAG_NOIXFR is misnamed"

Closes #2215

See merge request isc-projects/bind9!4285

5 years agoDNS_ZONEFLAG_NOIXFR should be DNS_ZONEFLG_NOIXFR
Mark Andrews [Thu, 22 Oct 2020 04:03:59 +0000 (15:03 +1100)] 
DNS_ZONEFLAG_NOIXFR should be DNS_ZONEFLG_NOIXFR

5 years agoMerge branch 'mnowak/ifconfig.sh-use-posix-shell' into 'main'
Michal Nowak [Fri, 23 Oct 2020 08:40:33 +0000 (08:40 +0000)] 
Merge branch 'mnowak/ifconfig.sh-use-posix-shell' into 'main'

Use POSIX shell in ifconfig.sh.in

See merge request isc-projects/bind9!4297

5 years agoUse a POSIX shell in bin/tests/system/ifconfig.sh
Michal Nowak [Fri, 23 Oct 2020 07:07:44 +0000 (09:07 +0200)] 
Use a POSIX shell in bin/tests/system/ifconfig.sh

Some non-POSIX shells, like /bin/csh on FreeBSD, are unable to execute
the config.guess file:

    + /bin/csh /var/tmp/gitlab_runner/builds/YdCaoq4b/0/mnowak/bind9/config.guess
    timestamp=2018-02-24: Command not found.
    me=config.guess: Command not found.
    Unmatched '"'.

When ./configure is run, it attempts to locate a POSIX-compliant shell.
Use the result of that search in the bin/tests/system/ifconfig.sh
script.

5 years agoMerge branch 'marka-update-gitignore' into 'main'
Mark Andrews [Thu, 22 Oct 2020 23:41:44 +0000 (23:41 +0000)] 
Merge branch 'marka-update-gitignore' into 'main'

update gitignore

See merge request isc-projects/bind9!4250

5 years agoupdate gitignore
Mark Andrews [Thu, 8 Oct 2020 05:29:09 +0000 (16:29 +1100)] 
update gitignore

5 years agoMerge branch '2221-netmgr-fixes-from-unit-testing' into 'main'
Ondřej Surý [Thu, 22 Oct 2020 21:50:20 +0000 (21:50 +0000)] 
Merge branch '2221-netmgr-fixes-from-unit-testing' into 'main'

Fix the problems found when writing the unit test for netmgr

See merge request isc-projects/bind9!4283

5 years agoCHANGES
Evan Hunt [Thu, 22 Oct 2020 20:38:09 +0000 (13:38 -0700)] 
CHANGES

5 years agoPostpone the isc_app_shutdown() after rndc response has been sent
Ondřej Surý [Thu, 22 Oct 2020 10:32:18 +0000 (12:32 +0200)] 
Postpone the isc_app_shutdown() after rndc response has been sent

When `rndc stop` is received, the isc_app_shutdown() was being called
before response to the rndc client has been sent; as the
isc_app_shutdown() also tears down the netmgr, the message was never
sent and rndc would complain about connection being interrupted in the
middle of the transaction.  We now postpone the shutdown after the rndc
response has been sent.

5 years agoFix the data race when read-writing sock->active by using cmpxchg
Ondřej Surý [Thu, 22 Oct 2020 08:07:56 +0000 (10:07 +0200)] 
Fix the data race when read-writing sock->active by using cmpxchg

5 years agoIgnore and don't log ISC_R_NOTCONNECTED from uv_accept()
Ondřej Surý [Wed, 21 Oct 2020 22:17:03 +0000 (00:17 +0200)] 
Ignore and don't log ISC_R_NOTCONNECTED from uv_accept()

When client disconnects before the connection can be accepted, the named
would log a spurious log message:

    error: Accepting TCP connection failed: socket is not connected

We now ignore the ISC_R_NOTCONNECTED result code and log only other
errors

5 years agoFix the isc_nm_closedown() to actually close the pending connections
Ondřej Surý [Wed, 21 Oct 2020 10:52:09 +0000 (12:52 +0200)] 
Fix the isc_nm_closedown() to actually close the pending connections

1. The isc__nm_tcp_send() and isc__nm_tcp_read() was not checking
   whether the socket was still alive and scheduling reads/sends on
   closed socket.

2. The isc_nm_read(), isc_nm_send() and isc_nm_resumeread() have been
   changed to always return the error conditions via the callbacks, so
   they always succeed.  This applies to all protocols (UDP, TCP and
   TCPDNS).

5 years agoFix the way tcp_send_direct() is used
Ondřej Surý [Wed, 21 Oct 2020 06:56:21 +0000 (08:56 +0200)] 
Fix the way tcp_send_direct() is used

There were two problems how tcp_send_direct() was used:

1. The tcp_send_direct() can return ISC_R_CANCELED (or translated error
   from uv_tcp_send()), but the isc__nm_async_tcpsend() wasn't checking
   the error code and not releasing the uvreq in case of an error.

2. In isc__nm_tcp_send(), when the TCP send is already in the right
   netthread, it uses tcp_send_direct() to send the TCP packet right
   away.  When that happened the uvreq was not freed, and the error code
   was returned to the caller.  We need to return ISC_R_SUCCESS and
   rather use the callback to report an error in such case.

5 years agoDetach the sock->server in uv_close() callback, not before
Ondřej Surý [Tue, 20 Oct 2020 19:03:27 +0000 (21:03 +0200)] 
Detach the sock->server in uv_close() callback, not before

5 years agoExplicitly stop reading before closing the nmtcpsocket
Ondřej Surý [Tue, 20 Oct 2020 18:57:19 +0000 (20:57 +0200)] 
Explicitly stop reading before closing the nmtcpsocket

When closing the socket that is actively reading from the stream, the
read_cb() could be called between uv_close() and close callback when the
server socket has been already detached hence using sock->statichandle
after it has been already freed.

5 years agoProper handling of socket references in case of TCP conn failure.
Witold Kręcicki [Tue, 20 Oct 2020 14:06:54 +0000 (16:06 +0200)] 
Proper handling of socket references in case of TCP conn failure.

5 years agoDon't crash if isc_uv_export returns an error in accept_connection.
Witold Kręcicki [Tue, 20 Oct 2020 10:55:58 +0000 (12:55 +0200)] 
Don't crash if isc_uv_export returns an error in accept_connection.

isc_uv_export can return an error - e.g. EMFILE (from dup), handle this
nicely.

5 years agoFix the way udp_send_direct() is used
Ondřej Surý [Tue, 20 Oct 2020 06:07:44 +0000 (08:07 +0200)] 
Fix the way udp_send_direct() is used

There were two problems how udp_send_direct() was used:

1. The udp_send_direct() can return ISC_R_CANCELED (or translated error
   from uv_udp_send()), but the isc__nm_async_udpsend() wasn't checking
   the error code and not releasing the uvreq in case of an error.

2. In isc__nm_udp_send(), when the UDP send is already in the right
   netthread, it uses udp_send_direct() to send the UDP packet right
   away.  When that happened the uvreq was not freed, and the error code
   was returned to the caller.  We need to return ISC_R_SUCCESS and
   rather use the callback to report an error in such case.

5 years agoMerge branch 'mnowak/test-coverage-visualization' into 'main'
Michal Nowak [Thu, 22 Oct 2020 12:47:15 +0000 (12:47 +0000)] 
Merge branch 'mnowak/test-coverage-visualization' into 'main'

Enable Test Coverage Visualization in merge requests

See merge request isc-projects/bind9!3875

5 years agoEnable Test Coverage Visualization for merge requests
Michal Nowak [Thu, 22 Oct 2020 07:36:17 +0000 (09:36 +0200)] 
Enable Test Coverage Visualization for merge requests

This feature allows GitLab to visualize test coverage information in the
file diff view of merge requests.

This commit makes the gcov CI job depend on the following chain of jobs:

    gcc:buster:amd64 → unit:gcc:buster:amd64 → system:gcc:buster:amd64

The reason for running the last two jobs above sequentially rather than
in parallel is that both of them create *.gcda files (containing
coverage data) in the same locations.  While some way of merging these
files from different job artifact archives could probably be designed
with the help of additional tools, the simplest thing to do is not to
run unit test and system test jobs in parallel, carrying *.gcda files
over between jobs as gcov knows how to append coverage data to existing
*.gcda files.

Also note that test coverage will not be visualized if any of the jobs
in the above dependency chain fails (because the gcov job will not be
run).

5 years agoMerge branch '2060-identify-unused-source-files-via-gcov-ci-job' into 'main'
Michal Nowak [Thu, 22 Oct 2020 11:29:04 +0000 (11:29 +0000)] 
Merge branch '2060-identify-unused-source-files-via-gcov-ci-job' into 'main'

Resolve "Identify unused source files via gcov CI job"

Closes #2060

See merge request isc-projects/bind9!4261

5 years agoAdd CHANGES entry
Michal Nowak [Wed, 21 Oct 2020 14:03:24 +0000 (16:03 +0200)] 
Add CHANGES entry

5 years agoDrop unused bufferlist code
Michal Nowak [Wed, 14 Oct 2020 09:46:03 +0000 (11:46 +0200)] 
Drop unused bufferlist code

5 years agoDrop unused portlist code
Michal Nowak [Mon, 12 Oct 2020 17:21:37 +0000 (19:21 +0200)] 
Drop unused portlist code