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

(cherry picked from commit ae9a6befa802a10fb08fbe100ee96dd03ecb9787)

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.

(cherry picked from commit afca2e3b2198eb43a97fe6edb3c5a46915389e09)

5 years agoMerge branch '2218-ensure-use-of-echo_i-where-possible-in-system-tests-v9_16' into...
Michal Nowak [Thu, 22 Oct 2020 10:50:27 +0000 (10:50 +0000)] 
Merge branch '2218-ensure-use-of-echo_i-where-possible-in-system-tests-v9_16' into 'v9_16'

[v9_16] Ensure use of "echo_i" where possible

See merge request isc-projects/bind9!4290

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_16_8-release' into 'v9_16'
Michał Kępień [Thu, 22 Oct 2020 07:16:08 +0000 (07:16 +0000)] 
Merge branch 'v9_16_8-release' into 'v9_16'

Merge 9.16.8 release branch

See merge request isc-projects/bind9!4288

5 years agoSet up release notes for BIND 9.16.9
Michał Kępień [Thu, 22 Oct 2020 07:14:31 +0000 (09:14 +0200)] 
Set up release notes for BIND 9.16.9

5 years agoBump BIND_BASELINE_VERSION for ABI checks
Michał Kępień [Thu, 22 Oct 2020 07:14:31 +0000 (09:14 +0200)] 
Bump BIND_BASELINE_VERSION for ABI checks

5 years agoBump BIND_BASELINE_VERSION for respdiff tests
Michał Kępień [Thu, 22 Oct 2020 07:14:31 +0000 (09:14 +0200)] 
Bump BIND_BASELINE_VERSION for respdiff tests

5 years agoMerge branch 'prep-release' into v9_16_8-release
Tinderbox User [Tue, 13 Oct 2020 08:41:40 +0000 (08:41 +0000)] 
Merge branch 'prep-release' into v9_16_8-release

5 years agoMerge branch 'michal/prepare-release-notes-for-bind-9.16.8' into 'v9_16_8-release'
Michał Kępień [Tue, 13 Oct 2020 08:17:54 +0000 (08:17 +0000)] 
Merge branch 'michal/prepare-release-notes-for-bind-9.16.8' into 'v9_16_8-release'

Prepare release notes for BIND 9.16.8

See merge request isc-private/bind9!217

5 years agoprep 9.16.8
Tinderbox User [Tue, 13 Oct 2020 08:40:06 +0000 (08:40 +0000)] 
prep 9.16.8

5 years agoPrepare release notes for BIND 9.16.8
Michał Kępień [Tue, 13 Oct 2020 08:08:54 +0000 (10:08 +0200)] 
Prepare release notes for BIND 9.16.8

5 years agoReorder release notes
Michał Kępień [Tue, 13 Oct 2020 08:08:54 +0000 (10:08 +0200)] 
Reorder release notes

5 years agoTweak and reword release notes
Michał Kępień [Tue, 13 Oct 2020 08:08:54 +0000 (10:08 +0200)] 
Tweak and reword release notes

5 years agoTweak and reword recent CHANGES entries
Michał Kępień [Tue, 13 Oct 2020 08:08:54 +0000 (10:08 +0200)] 
Tweak and reword recent CHANGES entries

5 years agoMinor ARM formatting tweak
Michał Kępień [Tue, 13 Oct 2020 08:08:54 +0000 (10:08 +0200)] 
Minor ARM formatting tweak

5 years agoMerge branch '1736-stub-zone-foiled-by-minimal-responses-v9_16' into 'v9_16'
Diego dos Santos Fronza [Wed, 21 Oct 2020 17:41:57 +0000 (17:41 +0000)] 
Merge branch '1736-stub-zone-foiled-by-minimal-responses-v9_16' into 'v9_16'

Resolve "stub zone foiled by minimal-responses"

See merge request isc-projects/bind9!4282

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 '2208-tcp4recverr-stat-miscount-v9_16' into 'v9_16'
Matthijs Mekking [Wed, 21 Oct 2020 06:34:19 +0000 (06:34 +0000)] 
Merge branch '2208-tcp4recverr-stat-miscount-v9_16' into 'v9_16'

Don't increment network error stats on UV_EOF

See merge request isc-projects/bind9!4277

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.

(cherry picked from commit 6c5ff9421875a1fcdfb8f03ac01afe292075d8d2)

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

Fix dnstap system test on FreeBSD

See merge request isc-projects/bind9!4275

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 'marka-fix-not-enough-categories-v9_16' into 'v9_16'
Mark Andrews [Thu, 15 Oct 2020 02:14:15 +0000 (02:14 +0000)] 
Merge branch 'marka-fix-not-enough-categories-v9_16' into 'v9_16'

Drop the expected minimum number of buckets to 4.

See merge request isc-projects/bind9!4265

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.

(cherry picked from commit 0abb49034e3fe7a04a8065602490724b6ff920b7)

5 years agoMerge branch 'marka-rrl-mdig-burst-v9_16' into 'v9_16'
Mark Andrews [Thu, 15 Oct 2020 01:11:06 +0000 (01:11 +0000)] 
Merge branch 'marka-rrl-mdig-burst-v9_16' into 'v9_16'

Try to improve rrl timing

See merge request isc-projects/bind9!4263

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.

(cherry picked from commit 92cdc7b6c7eec674fa03e7f87854cd5528c37f48)

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

Complete the isc_nmhandle_detach() in the worker thread.

See merge request isc-projects/bind9!4262

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>

(cherry picked from commit f95ba8aa2071fa72e3730eeb8ee78ef9454ffa5b)

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

Clean the last remnant of ISC_PLATFORM_HAVEIPV6 macro

See merge request isc-projects/bind9!4254

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.

(cherry picked from commit 96ac91a18a6e506824c63d10a05e532d584ff5c1)

5 years agoMerge branch 'ondrej/clean-netmgr-callback-locks-v9_16' into 'v9_16'
Ondřej Surý [Thu, 8 Oct 2020 06:50:23 +0000 (06:50 +0000)] 
Merge branch 'ondrej/clean-netmgr-callback-locks-v9_16' into 'v9_16'

Clean netmgr callback locks (v9.16)

See merge request isc-projects/bind9!4252

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.

(cherry picked from commit e8b56acb49f65b5143cd3f0d6f5e863df625a4c7)

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.

(cherry picked from commit d86a74d8a4c1c530baa714bbbad78fba9a4b29ab)

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

Restore the dns_message_reset() call before the dns_dispatch_getnext()

See merge request isc-projects/bind9!4249

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.

(cherry picked from commit 1f63bb15b3ce0984ecf1971c2736477e5c3ac67f)

5 years agoMerge branch 'matthijs-kasp-test-requires-python-v9_16' into 'v9_16'
Michał Kępień [Wed, 7 Oct 2020 20:20:47 +0000 (20:20 +0000)] 
Merge branch 'matthijs-kasp-test-requires-python-v9_16' into 'v9_16'

The kasp system test requires Python

See merge request isc-projects/bind9!4244

5 years agoMerge branch 'he32-test-fix-v9_16' into 'v9_16'
Matthijs Mekking [Wed, 7 Oct 2020 13:30:41 +0000 (13:30 +0000)] 
Merge branch 'he32-test-fix-v9_16' into 'v9_16'

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

See merge request isc-projects/bind9!4236

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".

(cherry picked from commit 7c3f62082bb0c6776ff560f0aef09ad2dfdf77ea)

5 years agoThe kasp system test requires Python
Matthijs Mekking [Wed, 7 Oct 2020 11:37:13 +0000 (13:37 +0200)] 
The kasp system test requires Python

Only run the "kasp" system test if the path to the Python interpreter is
set.

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

Silence Coverity REVERSE_INULL report

See merge request isc-projects/bind9!4238

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

(cherry picked from commit f0a66cb5aadd741c799f80079a86389d0423c3a3)

5 years agoMerge branch '2183-dns-flag-day-2020-v9_16' into 'v9_16'
Ondřej Surý [Tue, 6 Oct 2020 12:22:05 +0000 (12:22 +0000)] 
Merge branch '2183-dns-flag-day-2020-v9_16' into 'v9_16'

Resolve "DNS Flag Day 2020"

See merge request isc-projects/bind9!4229

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

(cherry picked from commit 096d41b4e266c003cc3e6234c864f0a7d15145ab)

5 years agoAdjust legacy tests for default 1232 EDNS Buffer Size
Ondřej Surý [Mon, 5 Oct 2020 16:17:49 +0000 (18:17 +0200)] 
Adjust legacy tests for default 1232 EDNS Buffer Size

* legacy test was just expecting default server EDNS buffer size to be 4096,
  the test needed the adjustment to reset the buffer sizes back to 4096.

(cherry picked from commit 354a2e102d5b8b0a73c9bcea14a4af7091ed6e31)

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

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

(cherry picked from commit f1556f8c4126eced7cf71de3dfc007dbd9940c4a)

5 years agoChange the default ENDS buffer size to 1232 for DNS Flag Day 2020
Ondřej Surý [Wed, 23 Sep 2020 12:47:26 +0000 (14:47 +0200)] 
Change the default ENDS buffer size to 1232 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 minimal
required changes by changing the defaults for `edns-udp-size`,
`max-udp-size` and `nocookie-udp-size` to `1232` (the value picked by
DNS Flag Day 2020).

(cherry picked from commit bb990030d344dafe40a62fe5ed2741de28b8ca66)

5 years agoMerge branch 'marka-run-sh-fixups-v9_16' into 'v9_16'
Mark Andrews [Tue, 6 Oct 2020 06:22:00 +0000 (06:22 +0000)] 
Merge branch 'marka-run-sh-fixups-v9_16' into 'v9_16'

run.sh fixups for v9 16

See merge request isc-projects/bind9!4233

5 years agorun.sh failed to exit with a error code when it should
Mark Andrews [Tue, 6 Oct 2020 00:53:22 +0000 (11:53 +1100)] 
run.sh failed to exit with a error code when it should

* if a core was detected 'status' was not updated.
* if a tsan or asan error was detected 'status' was not updated.

5 years agorun.sh failed to report when system test failed.
Mark Andrews [Tue, 6 Oct 2020 00:50:16 +0000 (11:50 +1100)] 
run.sh failed to report when system test failed.

5 years agoMerge branch 'marka-rndc-rst-fix-dnssec' into 'v9_16'
Mark Andrews [Tue, 6 Oct 2020 06:01:05 +0000 (06:01 +0000)] 
Merge branch 'marka-rndc-rst-fix-dnssec' into 'v9_16'

rndc.rst fix dnssec markup

See merge request isc-projects/bind9!4232

5 years agoincorrect markup in rndc.rst lead to bad layout
Mark Andrews [Tue, 6 Oct 2020 00:09:05 +0000 (11:09 +1100)] 
incorrect markup in rndc.rst lead to bad layout

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

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

See merge request isc-projects/bind9!4228

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.

(cherry picked from commit fd975a551dc23b18c2a63105c0b2bb9cf0015021)

5 years agoUse uv_os_sock_t instead of uv_os_fd_t for sockets
Ondřej Surý [Mon, 5 Oct 2020 10:25:19 +0000 (12:25 +0200)] 
Use uv_os_sock_t instead of uv_os_fd_t for sockets

On POSIX based systems both uv_os_sock_t and uv_os_fd_t are both typedef
to int.  That's not true on Windows, where uv_os_sock_t is SOCKET and
uv_os_fd_t is HANDLE and they differ in level of indirection.

(cherry picked from commit acb6ad9e3c1b1c873c0cd535262cbe7730b5b750)

5 years agoRefactor isc__nm_socket_freebind() to take fd and sa_family as args
Ondřej Surý [Mon, 5 Oct 2020 09:17:52 +0000 (11:17 +0200)] 
Refactor isc__nm_socket_freebind() to take fd and sa_family as args

The isc__nm_socket_freebind() has been refactored to match other
isc__nm_socket_...() helper functions and take uv_os_fd_t and
sa_family_t as function arguments.

(cherry picked from commit 9dc01a636b45686714f29f8814d8dad422754c25)

5 years agoAdd helper function to enable DF (don't fragment) flag on UDP sockets
Ondřej Surý [Mon, 5 Oct 2020 08:51:40 +0000 (10:51 +0200)] 
Add helper function to enable DF (don't fragment) flag on UDP sockets

This commits add isc__nm_socket_dontfrag() helper functions.

(cherry picked from commit d685bbc82240b8f1c20bec748a5725844221c61d)

5 years agoAdd SO_REUSEPORT and SO_INCOMING_CPU helper functions
Ondřej Surý [Mon, 5 Oct 2020 08:40:02 +0000 (10:40 +0200)] 
Add SO_REUSEPORT and SO_INCOMING_CPU helper functions

The setting of SO_REUSE**** and SO_INCOMING_CPU have been moved into a
separate helper functions.

(cherry picked from commit 5daaca714678e7d2fb40f7730899bfc59dee7f28)

5 years agoMerge branch '1749-rndc-dnssec-rollover-v9_16' into 'v9_16'
Matthijs Mekking [Mon, 5 Oct 2020 09:49:00 +0000 (09:49 +0000)] 
Merge branch '1749-rndc-dnssec-rollover-v9_16' into 'v9_16'

Resolve "rndc trigger rollover"

See merge request isc-projects/bind9!4226

5 years agoUse default algorithm in kasp test if possible
Matthijs Mekking [Fri, 4 Sep 2020 14:35:01 +0000 (16:35 +0200)] 
Use default algorithm in kasp test if possible

These tests don't require a specific algorithm so they should use
the DEFAULT_ALGORITHM from 'conf.sh.common'.

(cherry picked from commit 78c09f5622e513e134cdd26e2254146b0ea0f5ae)

5 years agoUse explicit result codes for 'rndc dnssec' cmd
Matthijs Mekking [Fri, 4 Sep 2020 09:42:52 +0000 (11:42 +0200)] 
Use explicit result codes for 'rndc dnssec' cmd

It is better to add new result codes than to overload existing codes.

(cherry picked from commit 70d1ec432fba09e2125a34bcd35cfd4113555ee2)

5 years agoVarious rndc dnssec -checkds fixes
Matthijs Mekking [Mon, 24 Aug 2020 08:05:28 +0000 (10:05 +0200)] 
Various rndc dnssec -checkds fixes

While working on 'rndc dnssec -rollover' I noticed the following
(small) issues:

- The key files where updated with hints set to "-when" and that
  should always be "now.
- The kasp system test did not properly update the test number when
  calling 'rndc dnssec -checkds' (and ensuring that works).
- There was a missing ']' in the rndc.c help output.

(cherry picked from commit edc53fc4160095bb32b05982c2a623ac4e7c6ab7)

5 years agoTest rndc rollover inactive key
Matthijs Mekking [Mon, 24 Aug 2020 08:03:02 +0000 (10:03 +0200)] 
Test rndc rollover inactive key

When users (accidentally) try to roll an inactive key, throw an error.

(cherry picked from commit fcd34abb9eaf4722d103598c979bc6c3678e48d0)

5 years agoAdd rndc dnssec -rollover command
Matthijs Mekking [Fri, 21 Aug 2020 13:38:00 +0000 (15:38 +0200)] 
Add rndc dnssec -rollover command

This command is similar in arguments as -checkds so refactor the
'named_server_dnssec' function accordingly.  The only difference
are that:

- It does not take a "publish" or "withdrawn" argument.
- It requires the key id to be set (add a check to make sure).

Add tests that will trigger rollover immediately and one that
schedules a test in the future.

(cherry picked from commit e826facadb71388587d4efe6d21797bdfd671226)

5 years agoAdd manual key rollover logic
Matthijs Mekking [Fri, 21 Aug 2020 13:31:57 +0000 (15:31 +0200)] 
Add manual key rollover logic

Add to the keymgr a function that will schedule a rollover. This
basically means setting the time when the key needs to retire,
and updating the key lifetime, then update the state file. The next
time that named runs the keymgr the new lifetime will be taken into
account.

(cherry picked from commit df8276aef086408422e602a0d13d9d81d354f09a)

5 years agoMerge branch '1870-fix-after-backport-to-9_11_s-v9_16' into 'v9_16'
Matthijs Mekking [Mon, 5 Oct 2020 09:19:24 +0000 (09:19 +0000)] 
Merge branch '1870-fix-after-backport-to-9_11_s-v9_16' into 'v9_16'

Change condition for rndc dumpdb -expired

See merge request isc-projects/bind9!4225

5 years agoChange condition for rndc dumpdb -expired
Matthijs Mekking [Fri, 2 Oct 2020 07:12:23 +0000 (09:12 +0200)] 
Change condition for rndc dumpdb -expired

After backporting #1870 to 9.11-S I saw that the condition check there
is different than in the main branch. In 9.11-S "stale" can mean
stale and serve-stale, or not active (awaiting cleanup). In 9.16 and
later versions, "stale" is stale and serve-stale, and "ancient" means
not active (awaiting cleanup). An "ancient" RRset is one that is not
active (TTL expired) and is not eligble for serve-stale.

Update the condition for rndc dumpdb -expired to closer match what is
in 9.11-S.

(cherry picked from commit 5614454c3b37ef342f6b413ea671711b399f3901)

5 years agoMerge branch '2171-dnssec-policy-weird-algo-15-bug-v9_16' into 'v9_16'
Matthijs Mekking [Fri, 2 Oct 2020 09:19:39 +0000 (09:19 +0000)] 
Merge branch '2171-dnssec-policy-weird-algo-15-bug-v9_16' into 'v9_16'

Resolve "dnssec-policy behaviour for algorithm 15 keys different to algorithm 8 keys"

See merge request isc-projects/bind9!4222

5 years agoFix a timing issue in kasp system test
Matthijs Mekking [Thu, 1 Oct 2020 09:07:05 +0000 (11:07 +0200)] 
Fix a timing issue in kasp system test

Sometimes, not all keys have been created in time before 'check_keys'
is called. Run a 'retry_quiet' on checking the number of keys before
continuing checking the key data.

(cherry picked from commit af3b01497602d943ad399d8f6274d27a76d7751b)

5 years agoFix kasp min key size bug
Matthijs Mekking [Thu, 1 Oct 2020 09:05:01 +0000 (11:05 +0200)] 
Fix kasp min key size bug

The minimal size for RSASHA1, RSASHA256 is 512, but due to bad
assignment it was set to 1024.

(cherry picked from commit 7c555254fe97825c4bfeaa08aa6d349c6fd2c636)

5 years agoTest migration to dnssec-policy with views
Matthijs Mekking [Wed, 30 Sep 2020 08:06:37 +0000 (10:06 +0200)] 
Test migration to dnssec-policy with views

This test case is unrelated to the fix for #2171 but was added to
reproduce the problem.

(cherry picked from commit 621093fe6943e49fa7c3fcd94bc95f33e4cbc51e)

5 years agoMinor fix in kasp system test
Matthijs Mekking [Wed, 30 Sep 2020 08:04:27 +0000 (10:04 +0200)] 
Minor fix in kasp system test

The 'wait_for_nsec' does not need to add TSIG because it calls
'dig_with_opts' and that already checks for TSIG.

(cherry picked from commit 43c6806779eaf0b155e2e37357a2a639ed018404)

5 years agoAdd change and note for #2171
Matthijs Mekking [Wed, 30 Sep 2020 08:03:43 +0000 (10:03 +0200)] 
Add change and note for #2171

This is a bug that needs to be noted.

(cherry picked from commit d6d41e96a30cd82fe7fef01bd92b20ef83c0487d)

5 years agoFix Ed25519 and Ed448 in dnssec-policy keymgr
Matthijs Mekking [Wed, 30 Sep 2020 07:57:45 +0000 (09:57 +0200)] 
Fix Ed25519 and Ed448 in dnssec-policy keymgr

The kasp code had bad implicit size values for the cryptographic
algorithms Ed25519 and Ed448. When creating keys they would never
match the dnssec-policy, leading to new attempts to create keys.

These algorithms were previously not yet added to the system tests,
due to lack of availability on some systems.

(cherry picked from commit 0e207392ec61ae7d215bcf58ad9e1a510a971aba)

5 years agoAdd kasp tests for Ed25519 and Ed448
Matthijs Mekking [Wed, 30 Sep 2020 07:53:19 +0000 (09:53 +0200)] 
Add kasp tests for Ed25519 and Ed448

Use the testcrypto script to see if these algorithms are supported by
openssl. If so, add the specific configuration to the named.conf file
and touch a file to indicate support. If the file exists, the
corresponding setup and tests are performed.

(cherry picked from commit 7be1835795d4c0710a8e61dd7775d7e10d0aa877)

5 years agoMerge branch '2139-rrset-order-fixes-and-cleanups-v9_16' into 'v9_16'
Michał Kępień [Fri, 2 Oct 2020 07:19:19 +0000 (07:19 +0000)] 
Merge branch '2139-rrset-order-fixes-and-cleanups-v9_16' into 'v9_16'

[v9_16] "rrset-order" fixes and cleanups

See merge request isc-projects/bind9!4218

5 years agoAdd CHANGES entries
Michał Kępień [Fri, 2 Oct 2020 06:41:43 +0000 (08:41 +0200)] 
Add CHANGES entries

(cherry picked from commit 27c815a220a1b18756cc643f3ec1c16635fedda2)

5 years agoRework "rrset-order" documentation
Michał Kępień [Fri, 2 Oct 2020 06:41:43 +0000 (08:41 +0200)] 
Rework "rrset-order" documentation

Certain parts of the existing documentation for the "rrset-order"
statement are incorrect, others are ambiguous.  Rework the relevant
section of the ARM to make it clear and up-to-date with the source code.

(cherry picked from commit 2ac04dc9305438f424a3a11c540d505e44db013e)

5 years agoAdd tests for "order none" RRset ordering rules
Michał Kępień [Fri, 2 Oct 2020 06:41:43 +0000 (08:41 +0200)] 
Add tests for "order none" RRset ordering rules

Make sure "order none" RRset ordering rules are tested in the
"rrsetorder" system test just like all other rule types are.  As the
check for the case of no "rrset-order" rule matching a given RRset also
tests "order none" (rather than "order random", as the test code may
suggest at first glance), replace the test code for that case so that it
matches other "order none" tests.

(cherry picked from commit abdd4c89fc7f4bf8f2eb502fa00e9d19f92bbdc5)

5 years agoAllow "order none" in "rrset-order" rules
Michał Kępień [Fri, 2 Oct 2020 06:41:43 +0000 (08:41 +0200)] 
Allow "order none" in "rrset-order" rules

named-checkconf treats the following configuration as valid:

    options {
        rrset-order {
            order none;
        };
    };

Yet, the above configuration causes named to crash on startup with:

    order.c:74: REQUIRE(mode == 0x00000800 || mode == 0x00000400 || mode == 0x00800000) failed, back trace

Add DNS_RDATASETATTR_NONE to the list of RRset ordering modes accepted
by dns_order_add() to allow "order none" to be used in "rrset-order"
rules.  This both prevents the aforementioned crashes and addresses the
discrepancy between named-checkconf and named.

(cherry picked from commit dbcf683c1a57f49876e329fca183cb39d20ca3a4)

5 years agoMerge branch 'ondrej/fix-split-string-warnings-clang-12-v9_16' into 'v9_16'
Ondřej Surý [Thu, 1 Oct 2020 16:47:21 +0000 (16:47 +0000)] 
Merge branch 'ondrej/fix-split-string-warnings-clang-12-v9_16' into 'v9_16'

Fix the clang 12 warnings with multi-line strings in string arrays

See merge request isc-projects/bind9!4212

5 years agoFix the clang 12 warnings with multi-line strings in string arrays
Ondřej Surý [Wed, 16 Sep 2020 08:33:01 +0000 (10:33 +0200)] 
Fix the clang 12 warnings with multi-line strings in string arrays

The clang 12 has a new warning that warns when using multi-line strings
in the string arrays, f.e.:

    { "aa",
      "b"
      "b",
      "cc" }

would generate warning like this:

    private_test.c:162:7: error: suspicious concatenation of string literals in an array initialization; did you mean to separate the elements with a comma? [-Werror,-Wstring-concatenation]
                                      "33333/RSASHA1" };
                                      ^
    private_test.c:161:7: note: place parentheses around the string literal to silence warning
                                      "Done removing signatures for key "
                                      ^
    private_test.c:197:7: error: suspicious concatenation of string literals in an array initialization; did you mean to separate the elements with a comma? [-Werror,-Wstring-concatenation]
                                      "NSEC chain",
                                      ^
    private_test.c:196:7: note: place parentheses around the string literal to silence warning
                                      "Removing NSEC3 chain 1 0 30 DEAF / creating "
                                      ^
    2 errors generated.

(cherry picked from commit 7b07f22969149ceb24ad9491696fabb66c333524)

5 years agoMerge branch 'ondrej/cherry-picked-netmgr-v9_16' into 'v9_16'
Ondřej Surý [Thu, 1 Oct 2020 16:30:38 +0000 (16:30 +0000)] 
Merge branch 'ondrej/cherry-picked-netmgr-v9_16' into 'v9_16'

Synchronize the netmgr changes with main branch

See merge request isc-projects/bind9!4211

5 years agoAdd separate prefetch nmhandle to ns_client_t
Ondřej Surý [Tue, 15 Sep 2020 10:55:03 +0000 (12:55 +0200)] 
Add separate prefetch nmhandle to ns_client_t

As the query_prefetch() or query_rpzfetch() could be called during
"regular" fetch, we need to introduce separate storage for attaching
the nmhandle during prefetching the records.  The query_prefetch()
and query_rpzfetch() are guarded for re-entrance by .query.prefetch
member of ns_client_t, so we can reuse the same .prefetchhandle for
both.

(cherry picked from commit d4976e0ebeb6a29a6844d83bcd4be626fb9f8fbf)

5 years agoCHANGES
Evan Hunt [Thu, 3 Sep 2020 22:44:33 +0000 (15:44 -0700)] 
CHANGES

(cherry picked from commit e460e321bd9d1789bdd8b1e79272e7001337a97c)

5 years agofix LD_WRAP test in configure
Evan Hunt [Sat, 5 Sep 2020 19:10:35 +0000 (12:10 -0700)] 
fix LD_WRAP test in configure

The LD_WRAP test in configure was broken, and failed to
indicate LD_WRAP support correctly, resulting in some unit
tests failing to run.

(cherry picked from commit cfa4ea64bc06685f210a4187dcc05cc0aac84851)

5 years agoRefactor the pausing/unpausing and finishing the nm_thread
Ondřej Surý [Wed, 23 Sep 2020 19:49:46 +0000 (21:49 +0200)] 
Refactor the pausing/unpausing and finishing the nm_thread

The isc_nm_pause(), isc_nm_resume() and finishing the nm_thread() from
nm_destroy() has been refactored, so all use the netievents instead of
directly touching the worker structure members.  This allows us to
remove most of the locking as the .paused and .finished members are
always accessed from the matching nm_thread.

When shutting down the nm_thread(), instead of issuing uv_stop(), we
just shutdown the .async handler, so all uv_loop_t events are properly
finished first and uv_run() ends gracefully with no outstanding active
handles in the loop.

(cherry picked from commit e5ab137ba3181d7dbf761843d06027822e5b9683)

5 years agotracing of active sockets and handles
Witold Kręcicki [Wed, 2 Sep 2020 15:57:44 +0000 (17:57 +0200)] 
tracing of active sockets and handles

If NETMGR_TRACE is defined, we now maintain a list of active sockets
in the netmgr object and a list of active handles in each socket
object; by walking the list and printing `backtrace` in a debugger
we can see where they were created, to assist in in debugging of
reference counting errors.

On shutdown, if netmgr finds there are still active sockets after
waiting, isc__nm_dump_active() will be called to log the list of
active sockets and their underlying handles, along with some details
about them.

(cherry picked from commit 00e04a86c8b6828a066573031cc539adab565061)

5 years agolimit the time we wait for netmgr to be destroyed
Evan Hunt [Thu, 16 Jul 2020 00:57:58 +0000 (17:57 -0700)] 
limit the time we wait for netmgr to be destroyed

if more than 10 seconds pass while we wait for netmgr events to
finish running on shutdown, something is almost certainly wrong
and we should assert and crash.

(cherry picked from commit 2f2d60a9898faeeb8e9c8d7b80061d7e7845687c)

5 years agoadd more logging to the shutdown system test
Evan Hunt [Thu, 16 Jul 2020 22:47:58 +0000 (15:47 -0700)] 
add more logging to the shutdown system test

the test server running in shutdown/resolver was not logging
any debug info, which made it difficult to diagnose test failures.

(cherry picked from commit cc7ceace7dcaade77e7197e9ca2cd916edb7e51a)

5 years agoproperly lock the setting/unsetting of callbacks in isc_nmsocket_t
Ondřej Surý [Fri, 11 Sep 2020 08:53:31 +0000 (10:53 +0200)] 
properly lock the setting/unsetting of callbacks in isc_nmsocket_t

changes to socket callback functions were not thread safe.

(cherry picked from commit 89c534d3b9eddba5e2aaaaf54a5ff24bbe38257a)

5 years agochange from isc_nmhandle_ref/unref to isc_nmhandle attach/detach
Evan Hunt [Thu, 3 Sep 2020 20:31:27 +0000 (13:31 -0700)] 
change from isc_nmhandle_ref/unref to isc_nmhandle attach/detach

Attaching and detaching handle pointers will make it easier to
determine where and why reference counting errors have occurred.

A handle needs to be referenced more than once when multiple
asynchronous operations are in flight, so callers must now maintain
multiple handle pointers for each pending operation. For example,
ns_client objects now contain:

        - reqhandle:    held while waiting for a request callback (query,
                        notify, update)
        - sendhandle:   held while waiting for a send callback
        - fetchhandle:  held while waiting for a recursive fetch to
                        complete
        - updatehandle: held while waiting for an update-forwarding
                        task to complete

(cherry picked from commit 57b4dde9749c88d21d1dc8afd22201224cf83cab)

5 years agoassorted small netmgr-related changes
Witold Kręcicki [Wed, 10 Jun 2020 09:32:39 +0000 (11:32 +0200)] 
assorted small netmgr-related changes

- rename isc_nmsocket_t->tcphandle to statichandle
- cancelread functions now take handles instead of sockets
- add a 'client' flag in socket objects, currently unused, to
  indicate whether it is to be used as a client or server socket

(cherry picked from commit 7eb4564895037d72c46150acb6a8fc04edf4f8d9)

5 years agoUse different allocators for UDP and TCP
Evan Hunt [Thu, 2 Jul 2020 14:27:38 +0000 (16:27 +0200)] 
Use different allocators for UDP and TCP

Each worker has a receive buffer with space for 20 DNS messages of up
to 2^16 bytes each, and the allocator function passed to uv_read_start()
or uv_udp_recv_start() will reserve a portion of it for use by sockets.
UDP can use recvmmsg() and so it needs that entire space, but TCP reads
one message at a time.

This commit introduces separate allocator functions for TCP and UDP
setting different buffer size limits, so that libuv will provide the
correct buffer sizes to each of them.

(cherry picked from commit 38264b6a4d272dbbe948cf66eef9634041d14f98)

5 years agonetmgr: retry binding with IP_FREEBIND when EADDRNOTAVAIL is returned.
Witold Kręcicki [Tue, 21 Jul 2020 11:29:14 +0000 (13:29 +0200)] 
netmgr: retry binding with IP_FREEBIND when EADDRNOTAVAIL is returned.

When a new IPv6 interface/address appears it's first in a tentative
state - in which we cannot bind to it, yet it's already being reported
by the route socket. Because of that BIND9 is unable to listen on any
newly detected IPv6 addresses. Fix it by setting IP_FREEBIND option (or
equivalent option on other OSes) and then retrying bind() call.

(cherry picked from commit a0f7d28967f95c904614bbe44efde789e430a80e)

5 years agouse handles for isc_nm_pauseread() and isc_nm_resumeread()
Evan Hunt [Wed, 1 Jul 2020 23:17:09 +0000 (16:17 -0700)] 
use handles for isc_nm_pauseread() and isc_nm_resumeread()

by having these functions act on netmgr handles instead of socket
objects, they can be used in callback functions outside the netgmr.

(cherry picked from commit 55896df79d9f537577834375cb21676e8176b5ed)

5 years agodon't use exclusive mode for rndc commands that don't need it
Evan Hunt [Wed, 15 Apr 2020 21:37:47 +0000 (14:37 -0700)] 
don't use exclusive mode for rndc commands that don't need it

"showzone" and "tsig-list" both used exclusive mode unnecessarily;
changing this will simplify future refactoring a bit.

(cherry picked from commit 002c328437e7dbc59bbbc23d5bfea5bd6150bdc9)