]> git.ipfire.org Git - thirdparty/bind9.git/log
thirdparty/bind9.git
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

5 years agoDrop unused dbtable code
Michal Nowak [Mon, 12 Oct 2020 16:20:58 +0000 (18:20 +0200)] 
Drop unused dbtable code

5 years agoMerge branch '2218-ensure-use-of-echo_i-where-possible-in-system-tests' into 'main'
Michal Nowak [Thu, 22 Oct 2020 08:16:41 +0000 (08:16 +0000)] 
Merge branch '2218-ensure-use-of-echo_i-where-possible-in-system-tests' into 'main'

Ensure use of "echo_i" where possible

Closes #2218

See merge request isc-projects/bind9!4268

5 years agoEnsure use of "echo_i" where possible
Michal Nowak [Thu, 15 Oct 2020 14:27:30 +0000 (16:27 +0200)] 
Ensure use of "echo_i" where possible

In many instances 'echo "I:' construct was used where echo_i function
should have been.

5 years agoMerge branch 'v9_17_6-release' into 'main'
Michał Kępień [Thu, 22 Oct 2020 07:02:41 +0000 (07:02 +0000)] 
Merge branch 'v9_17_6-release' into 'main'

Merge 9.17.6 release branch

See merge request isc-projects/bind9!4287

5 years agoSet up release notes for BIND 9.17.7
Michał Kępień [Thu, 22 Oct 2020 06:58:55 +0000 (08:58 +0200)] 
Set up release notes for BIND 9.17.7

5 years agoBump BIND_BASELINE_VERSION for ABI checks
Michał Kępień [Thu, 22 Oct 2020 06:58:55 +0000 (08:58 +0200)] 
Bump BIND_BASELINE_VERSION for ABI checks

5 years agoBump BIND_BASELINE_VERSION for respdiff tests
Michał Kępień [Thu, 22 Oct 2020 06:58:55 +0000 (08:58 +0200)] 
Bump BIND_BASELINE_VERSION for respdiff tests

5 years agoUpdate BIND version to 9.17.6
Michał Kępień [Mon, 12 Oct 2020 11:45:08 +0000 (13:45 +0200)] 
Update BIND version to 9.17.6

5 years agoAdd a CHANGES marker
Michał Kępień [Mon, 12 Oct 2020 11:45:08 +0000 (13:45 +0200)] 
Add a CHANGES marker

5 years agoUpdate library API versions
Michał Kępień [Mon, 12 Oct 2020 11:45:08 +0000 (13:45 +0200)] 
Update library API versions

5 years agoMerge branch 'michal/prepare-release-notes-for-bind-9.17.6' into 'v9_17_6-release'
Michał Kępień [Mon, 12 Oct 2020 11:41:44 +0000 (11:41 +0000)] 
Merge branch 'michal/prepare-release-notes-for-bind-9.17.6' into 'v9_17_6-release'

Prepare release notes for BIND 9.17.6

See merge request isc-private/bind9!214

5 years agoPrepare release notes for BIND 9.17.6
Michał Kępień [Mon, 12 Oct 2020 11:19:50 +0000 (13:19 +0200)] 
Prepare release notes for BIND 9.17.6

5 years agoReorder release notes
Michał Kępień [Mon, 12 Oct 2020 11:19:50 +0000 (13:19 +0200)] 
Reorder release notes

5 years agoTweak and reword release notes
Michał Kępień [Mon, 12 Oct 2020 11:19:50 +0000 (13:19 +0200)] 
Tweak and reword release notes

5 years agoRestore release note for GL #2146
Michał Kępień [Mon, 12 Oct 2020 11:19:50 +0000 (13:19 +0200)] 
Restore release note for GL #2146

5 years agoTweak and reword recent CHANGES entries
Michał Kępień [Mon, 12 Oct 2020 11:19:50 +0000 (13:19 +0200)] 
Tweak and reword recent CHANGES entries

5 years agoMinor documentation formatting tweaks
Michał Kępień [Mon, 12 Oct 2020 11:19:50 +0000 (13:19 +0200)] 
Minor documentation formatting tweaks

5 years agoMerge branch '1736-stub-zone-foiled-by-minimal-responses' into 'main'
Diego dos Santos Fronza [Wed, 21 Oct 2020 15:06:04 +0000 (15:06 +0000)] 
Merge branch '1736-stub-zone-foiled-by-minimal-responses' into 'main'

Resolve "stub zone foiled by minimal-responses"

Closes #1736

See merge request isc-projects/bind9!4113

5 years agoAdd CHANGES entry
Diego Fronza [Thu, 10 Sep 2020 18:51:46 +0000 (15:51 -0300)] 
Add CHANGES entry

5 years agoAdjusted additional system test (NS, non-root zone)
Diego Fronza [Fri, 2 Oct 2020 15:07:59 +0000 (12:07 -0300)] 
Adjusted additional system test (NS, non-root zone)

After the updates from this branch, BIND now sends glue records for
NS queries even when configured with minimal-responses yes.

5 years agoAdded test for the proposed fix
Diego Fronza [Thu, 10 Sep 2020 18:33:15 +0000 (15:33 -0300)] 
Added test for the proposed fix

This test is very simple, two nameserver instances are created:
    - ns4: master, with 'minimal-responses yes', authoritative
        for example. zone
    - ns5: slave, stub zone

The first thing verified is the transfer of zone data from master
to slave, which should be saved in ns5/example.db.

After that, a query is issued to ns5 asking for target.example.
TXT, a record present in the master database with the "test" string
as content.

If that query works, it means stub zone successfully request
nameserver addresses from master, ns4.example. A/AAAA

The presence of both A/AAAA records for ns4 is also verified in the
stub zone local file, ns5/example.db.

5 years agoAlways return address records in additional section for NS queries
Diego Fronza [Wed, 30 Sep 2020 20:22:39 +0000 (17:22 -0300)] 
Always return address records in additional section for NS queries

5 years agoFix transfer of glue records in stub zones if master has minimal-responses set
Diego Fronza [Thu, 10 Sep 2020 18:09:14 +0000 (15:09 -0300)] 
Fix transfer of glue records in stub zones if master has minimal-responses set

Stub zones don't make use of AXFR/IXFR for the transfering of zone
data, instead, a single query is issued to the master asking for
their nameserver records (NS).

That works fine unless master is configured with 'minimal-responses'
set to yes, in which case glue records are not provided by master
in the answer with nameservers authoritative for the zone, leaving
stub zones with incomplete databases.

This commit fix this problem in a simple way, when the answer with
the authoritative nameservers is received from master (stub_callback),
for each nameserver listed (save_nsrrset), a A and AAAA records for
the name is verified in the additional section, and if not present
a query is created to resolve the corresponsing missing glue.

A struct 'stub_cb_args' was added to keep relevant information for
performing a query, like TSIG key, udp size, dscp value, etc, this
information is borrowed from, and created within function 'ns_query',
where the resolving of nameserver from master starts.

A new field was added to the struct 'dns_stub', an atomic integer,
namely pending_requests, which is used to keep how many queries are
created when resolving nameserver addresses that were missing in
the glue.

When the value of pending_requests is zero we know we can release
resources, adjust zone timers, dump to zone file, etc.

5 years agoMerge branch '1490-run-unit-tests-on-openbsd-in-ci' into 'main'
Michal Nowak [Wed, 21 Oct 2020 11:15:23 +0000 (11:15 +0000)] 
Merge branch '1490-run-unit-tests-on-openbsd-in-ci' into 'main'

Add OpenBSD unit tests to CI

Closes #1490

See merge request isc-projects/bind9!4269

5 years agoRun unit tests on OpenBSD in GitLab CI
Michal Nowak [Mon, 19 Oct 2020 05:47:57 +0000 (07:47 +0200)] 
Run unit tests on OpenBSD in GitLab CI

Unlike other maintained BIND branches, the "main" BIND branch does not
require Kyua for running unit tests, which has been an obstacle for
adding an OpenBSD unit test job to GitLab CI.  Experiments show that a
complete BIND unit test suite completes in a few minutes on OpenBSD and
that unit tests are not as severely affected by OpenBSD performance
issues as system tests are.  Add a GitLab CI job which runs unit tests
on OpenBSD to every pipeline.

5 years agoMerge branch '2195-freebsd-dnstap-system-test-failure' into 'main'
Diego dos Santos Fronza [Tue, 20 Oct 2020 13:20:04 +0000 (13:20 +0000)] 
Merge branch '2195-freebsd-dnstap-system-test-failure' into 'main'

Resolve "FreeBSD dnstap system test failure"

Closes #2195

See merge request isc-projects/bind9!4213

5 years agoFix dnstap system test on FreeBSD
Diego Fronza [Thu, 1 Oct 2020 17:04:05 +0000 (14:04 -0300)] 
Fix dnstap system test on FreeBSD

This commit ensures that dnstap output files captured
by fstrm_capture are properly flushed before any attempt
on reading them with dnstap-read is done.

By reading fstrm-capture source code it was noticed that
signal SIGHUP is used to flush the capture file.

5 years agoMerge branch '2208-tcp4recverr-stat-miscount' into 'main'
Matthijs Mekking [Tue, 20 Oct 2020 11:57:35 +0000 (11:57 +0000)] 
Merge branch '2208-tcp4recverr-stat-miscount' into 'main'

Don't increment network error stats on UV_EOF

Closes #2208

See merge request isc-projects/bind9!4274

5 years agoDon't increment network error stats on UV_EOF
Matthijs Mekking [Tue, 20 Oct 2020 08:57:16 +0000 (10:57 +0200)] 
Don't increment network error stats on UV_EOF

When networking statistics was added to the netmgr (in commit
5234a8e00a6ae1df738020f27544594ccb8d5215), two lines were added that
increment the 'STATID_RECVFAIL' statistic: One if 'uv_read_start'
fails and one at the end of the 'read_cb'.  The latter happens
if 'nread < 0'.

According to the libuv documentation, I/O read callbacks (such as for
files and sockets) are passed a parameter 'nread'. If 'nread' is less
than 0, there was an error and 'UV_EOF' is the end of file error, which
you may want to handle differently.

In other words, we should not treat EOF as a RECVFAIL error.

5 years agoMerge branch 'marka-fix-not-enough-categories' into 'main'
Mark Andrews [Thu, 15 Oct 2020 01:02:49 +0000 (01:02 +0000)] 
Merge branch 'marka-fix-not-enough-categories' into 'main'

Tune the minimum number of expected categories.

See merge request isc-projects/bind9!4216

5 years agoDrop the expected minimum number of buckets to 4.
Mark Andrews [Fri, 2 Oct 2020 02:27:54 +0000 (12:27 +1000)] 
Drop the expected minimum number of buckets to 4.

The previous value of 5 produced too many false errors.

5 years agoMerge branch 'marka-rrl-mdig-burst' into 'main'
Mark Andrews [Thu, 15 Oct 2020 00:37:59 +0000 (00:37 +0000)] 
Merge branch 'marka-rrl-mdig-burst' into 'main'

Try to improve rrl timing

See merge request isc-projects/bind9!4126

5 years agoTry to improve rrl timing
Mark Andrews [Wed, 16 Sep 2020 02:40:52 +0000 (12:40 +1000)] 
Try to improve rrl timing

Add a +burst option to mdig so that we have a second to setup the
mdig calls then they run at the start of the next second.

RRL uses 'queries in a second' as a approximation to
'queries per second'. Getting the bursts of traffic to all happen in
the same second should prevent false negatives in the system test.

We now have a second to setup the traffic in.  Then the traffic should
be sent at the start of the next second.  If that still fails we
should move to +burst=<now+2> (further extend mdig) instead of the
implicit <now+1> as the trigger second.

5 years agoMerge branch '2209-tsan-error-bin-named-controlconf-c-related' into 'main'
Mark Andrews [Thu, 15 Oct 2020 00:01:36 +0000 (00:01 +0000)] 
Merge branch '2209-tsan-error-bin-named-controlconf-c-related' into 'main'

Resolve "TSAN error bin/named/controlconf.c related."

Closes #2209

See merge request isc-projects/bind9!4257

5 years agoComplete the isc_nmhandle_detach() in the worker thread.
Mark Andrews [Mon, 12 Oct 2020 06:51:09 +0000 (17:51 +1100)] 
Complete the isc_nmhandle_detach() in the worker thread.

isc_nmhandle_detach() needs to complete in the same thread
as shutdown_walk_cb() to avoid a race.  Clear the caller's
pointer then pass control to the worker if necessary.

    WARNING: ThreadSanitizer: data race
    Write of size 8 at 0x000000000001 by thread T1:
    #0 isc_nmhandle_detach lib/isc/netmgr/netmgr.c:1258:15
    #1 control_command bin/named/controlconf.c:388:3
    #2 dispatch lib/isc/task.c:1152:7
    #3 run lib/isc/task.c:1344:2

    Previous read of size 8 at 0x000000000001 by thread T2:
    #0 isc_nm_pauseread lib/isc/netmgr/netmgr.c:1449:33
    #1 recv_data lib/isccc/ccmsg.c:109:2
    #2 isc__nm_tcp_shutdown lib/isc/netmgr/tcp.c:1157:4
    #3 shutdown_walk_cb lib/isc/netmgr/netmgr.c:1515:3
    #4 uv_walk <null>
    #5 process_queue lib/isc/netmgr/netmgr.c:659:4
    #6 process_normal_queue lib/isc/netmgr/netmgr.c:582:10
    #7 process_queues lib/isc/netmgr/netmgr.c:590:8
    #8 async_cb lib/isc/netmgr/netmgr.c:548:2
    #9 <null> <null>

5 years agoMerge branch 'ondrej/little-socket-fixes' into 'main'
Ondřej Surý [Thu, 8 Oct 2020 07:02:15 +0000 (07:02 +0000)] 
Merge branch 'ondrej/little-socket-fixes' into 'main'

Various little fixes in the old socket code

See merge request isc-projects/bind9!4253

5 years agoClean the last remnant of ISC_PLATFORM_HAVEIPV6 macro
Ondřej Surý [Thu, 8 Oct 2020 06:26:28 +0000 (08:26 +0200)] 
Clean the last remnant of ISC_PLATFORM_HAVEIPV6 macro

In set_sndbuf() we were using ISC_PLATFORM_HAVEIPV6 macro that doesn't
exist anymore, because we assume that IPv6 support is always available.

5 years agoAlways set the DF flag (not only when CMSG is available)
Ondřej Surý [Thu, 8 Oct 2020 06:26:28 +0000 (08:26 +0200)] 
Always set the DF flag (not only when CMSG is available)

By mistake, we were setting the DF flag only when CMSG was available for
said platform.

5 years agoMerge branch 'ondrej/clean-netmgr-callback-locks' into 'main'
Ondřej Surý [Thu, 8 Oct 2020 05:42:39 +0000 (05:42 +0000)] 
Merge branch 'ondrej/clean-netmgr-callback-locks' into 'main'

Clean the locking around nm callbacks

See merge request isc-projects/bind9!4220

5 years agoClone the csock in accept_connection(), not in callback
Ondřej Surý [Fri, 18 Sep 2020 10:27:40 +0000 (12:27 +0200)] 
Clone the csock in accept_connection(), not in callback

If we clone the csock (children socket) in TCP accept_connection()
instead of passing the ssock (server socket) to the call back and
cloning it there we unbreak the assumption that every socket is handled
inside it's own worker thread and therefore we can get rid of (at least)
callback locking.

5 years agoChange the isc__nm_tcpdns_stoplistening() to be asynchronous event
Ondřej Surý [Fri, 2 Oct 2020 07:28:29 +0000 (09:28 +0200)] 
Change the isc__nm_tcpdns_stoplistening() to be asynchronous event

The isc__nm_tcpdns_stoplistening() would call isc__nmsocket_clearcb()
that would clear the .accept_cb from non-netmgr thread.  Change the
tcpdns_stoplistening to enqueue ievent that would get processed in the
right netmgr thread to avoid locking.

5 years agoMerge branch '2204-investigate-pipeline-system-test-failure' into 'main'
Mark Andrews [Thu, 8 Oct 2020 05:21:52 +0000 (05:21 +0000)] 
Merge branch '2204-investigate-pipeline-system-test-failure' into 'main'

Resolve "Investigate pipeline system test failure"

Closes #2204

See merge request isc-projects/bind9!4247

5 years agoRestore the dns_message_reset() call before the dns_dispatch_getnext()
Mark Andrews [Wed, 7 Oct 2020 23:55:35 +0000 (10:55 +1100)] 
Restore the dns_message_reset() call before the dns_dispatch_getnext()

This was accidentally lost in the process of moving rmessage from fctx
to query.  Without this dns_message_setclass() will fail.

5 years agoMerge branch 'matthijs-kasp-test-requires-python' into 'main'
Matthijs Mekking [Wed, 7 Oct 2020 15:22:23 +0000 (15:22 +0000)] 
Merge branch 'matthijs-kasp-test-requires-python' into 'main'

The kasp system test requires Python

See merge request isc-projects/bind9!4241

5 years agoThe kasp system test requires Python
Matthijs Mekking [Wed, 7 Oct 2020 07:39:06 +0000 (09:39 +0200)] 
The kasp system test requires Python

Only run the kasp system test if HAVE_PYTHON.

5 years agoMerge branch 'marka-wait-for-isc_nm_stoplistening' into 'main'
Mark Andrews [Wed, 7 Oct 2020 08:15:44 +0000 (08:15 +0000)] 
Merge branch 'marka-wait-for-isc_nm_stoplistening' into 'main'

Wait for isc_nm_stoplistening() to complete

See merge request isc-projects/bind9!4217

5 years agoFix the data race on shutdown/reconfig in control channel
Mark Andrews [Fri, 2 Oct 2020 06:17:51 +0000 (16:17 +1000)] 
Fix the data race on shutdown/reconfig in control channel

The controllistener could be freed before the event posted by
isc_nm_stoplistening() has been processed. This commit adds
a reference counter to the controllistener to determine when
to free the listener.

5 years agoMerge branch '2200-the-fuzzer-dns_message_parser-c-is-leaking-memory' into 'main'
Mark Andrews [Tue, 6 Oct 2020 13:20:36 +0000 (13:20 +0000)] 
Merge branch '2200-the-fuzzer-dns_message_parser-c-is-leaking-memory' into 'main'

Resolve "The fuzzer dns_message_parse.c is leaking memory."

Closes #2200

See merge request isc-projects/bind9!4239

5 years agoinvalidate cctx on error
Mark Andrews [Tue, 6 Oct 2020 12:50:01 +0000 (23:50 +1100)] 
invalidate cctx on error

5 years agoMerge branch 'marka-create_query-fix-REVERSE_INULL' into 'main'
Mark Andrews [Tue, 6 Oct 2020 12:33:56 +0000 (12:33 +0000)] 
Merge branch 'marka-create_query-fix-REVERSE_INULL' into 'main'

Silence Coverity REVERSE_INULL report

Closes #2198

See merge request isc-projects/bind9!4234

5 years agoSilence Coverity REVERSE_INULL report
Mark Andrews [Tue, 6 Oct 2020 06:34:09 +0000 (17:34 +1100)] 
Silence Coverity REVERSE_INULL report

message does not need to be tested to NULL

5 years agoMerge branch 'he32-test-fix' into 'main'
Matthijs Mekking [Tue, 6 Oct 2020 08:28:12 +0000 (08:28 +0000)] 
Merge branch 'he32-test-fix' into 'main'

Avoid a non-standard bashism: use of "==" in "test".

See merge request isc-projects/bind9!4235

5 years agoAvoid a non-standard bashism: use of "==" in "test".
Havard Eidnes [Fri, 2 Oct 2020 12:54:57 +0000 (14:54 +0200)] 
Avoid a non-standard bashism: use of "==" in "test".

5 years agoMerge branch 'marka-render_buf-was-too-big' into 'main'
Mark Andrews [Tue, 6 Oct 2020 07:37:30 +0000 (07:37 +0000)] 
Merge branch 'marka-render_buf-was-too-big' into 'main'

render_buf was too big

See merge request isc-projects/bind9!4231

5 years agorender buf was too big
Mark Andrews [Mon, 5 Oct 2020 22:49:28 +0000 (09:49 +1100)] 
render buf was too big

It was misdeclared as a array of pointers (uint8_t*[]) and there
where too many elements (64 * 1024) instead of (64 * 1024 - 1).

5 years agoMerge branch '2183-dns-flag-day-2020' into 'main'
Ondřej Surý [Mon, 5 Oct 2020 15:13:12 +0000 (15:13 +0000)] 
Merge branch '2183-dns-flag-day-2020' into 'main'

Resolve "DNS Flag Day 2020"

Closes #2183

See merge request isc-projects/bind9!4179

5 years agoAdd text describing the changes done in the MR in more detail
Ondřej Surý [Wed, 30 Sep 2020 16:38:32 +0000 (18:38 +0200)] 
Add text describing the changes done in the MR in more detail

5 years agoEnable DF (don't fragment) flag on listening UDP sockets
Ondřej Surý [Mon, 5 Oct 2020 08:51:40 +0000 (10:51 +0200)] 
Enable DF (don't fragment) flag on listening UDP sockets

This commits uses the isc__nm_socket_dontfrag() helper function to
enable setting DF bit on the outgoing UDP packets.

5 years agoChange the default EDNS buffer size for dig, mdig and host to 1232
Ondřej Surý [Wed, 30 Sep 2020 16:18:05 +0000 (18:18 +0200)] 
Change the default EDNS buffer size for dig, mdig and host to 1232

The dig should behave closely to how the resolver code in `named` work,
so we need to change the buffer size in dig, mdig and host too.

5 years agoAdjust legacy and digdelv tests for default 1232 EDNS Buffer Size
Ondřej Surý [Wed, 23 Sep 2020 14:36:44 +0000 (16:36 +0200)] 
Adjust legacy and digdelv tests for default 1232 EDNS Buffer Size

* the legacy test with -T maxudp512 will just fail, e.g. if the packets
  larger than 512 octets are dropped along the path, the proper response
  is to fail

* digdelv test was just expecting default server EDNS buffer size to be
  4096, the test needed only slight adjustment

5 years agoSimplify the EDNS buffer size logic for DNS Flag Day 2020
Ondřej Surý [Wed, 23 Sep 2020 12:47:26 +0000 (14:47 +0200)] 
Simplify the EDNS buffer size logic for DNS Flag Day 2020

The DNS Flag Day 2020 aims to remove the IP fragmentation problem from
the UDP DNS communication.  In this commit, we implement the required
changes and simplify the logic for picking the EDNS Buffer Size.

1. The defaults for `edns-udp-size`, `max-udp-size` and
   `nocookie-udp-size` have been changed to `1232` (the value picked by
   DNS Flag Day 2020).

2. The probing heuristics that would try 512->4096->1432->1232 buffer
   sizes has been removed and the resolver will always use just the
   `edns-udp-size` value.

3. Instead of just disabling the PMTUD mechanism on the UDP sockets, we
   now set IP_DONTFRAG (IPV6_DONTFRAG) flag.  That means that the UDP
   packets won't get ever fragmented.  If the ICMP packets are lost the
   UDP will just timeout and eventually be retried over TCP.

5 years agoMerge branch 'ondrej/refactor-setsockopt' into 'main'
Ondřej Surý [Mon, 5 Oct 2020 14:11:55 +0000 (14:11 +0000)] 
Merge branch 'ondrej/refactor-setsockopt' into 'main'

Refactor the setsockopt() code in network manager into helper functions

See merge request isc-projects/bind9!4227

5 years agoSplit reusing the addr/port and load-balancing socket options
Ondřej Surý [Mon, 5 Oct 2020 11:14:04 +0000 (13:14 +0200)] 
Split reusing the addr/port and load-balancing socket options

The SO_REUSEADDR, SO_REUSEPORT and SO_REUSEPORT_LB has different meaning
on different platform. In this commit, we split the function to set the
reuse of address/port and setting the load-balancing into separate
functions.

The libuv library already have multiplatform support for setting
SO_REUSEADDR and SO_REUSEPORT that allows binding to the same address
and port, but unfortunately, when used after the load-balancing socket
options have been already set, it overrides the previous setting, so we
need our own helper function to enable the SO_REUSEADDR/SO_REUSEPORT
first and then enable the load-balancing socket option.