Commit Graph

32974 Commits

Author SHA1 Message Date
Ondřej Surý
0f57732d13 Skip the zero, xfer and ixfr tests on non-Linux platforms
Due to the platform differences, on non-Linux platforms, the xfer and
ixfr tests fails and zero test gets stuck.

This commit will get reverted when we add support for netmgr
multi-threading.
2020-12-01 17:24:06 +01:00
Ondřej Surý
0ba697fe8c The cmocka.h header MUST be included before isc/util.h gets included
The isc/util.h header redefine the DbC checks (REQUIRE, INSIST, ...)  to
be cmocka "fake" assertions.  However that means that cmocka.h needs to
be included after UNIT_TESTING is defined but before isc/util.h is
included.  Because isc/util.h is included in most of the project headers
this means that the sequence MUST be:

    #define UNIT_TESTING
    #include <cmocka.h>

    #include <isc/_anything_.h>

See !2204 for other header requirements for including cmocka.h.
2020-12-01 16:47:25 +01:00
Ondřej Surý
c26a2ea134 Add release note for known issue #2137 2020-12-01 16:47:25 +01:00
Ondřej Surý
9811361c4b Add CHANGES note for multiple netmgr issues 2020-12-01 16:47:25 +01:00
Ondřej Surý
634bdfb16d Refactor netmgr and add more unit tests
This is a part of the works that intends to make the netmgr stable,
testable, maintainable and tested.  It contains a numerous changes to
the netmgr code and unfortunately, it was not possible to split this
into smaller chunks as the work here needs to be committed as a complete
works.

NOTE: There's a quite a lot of duplicated code between udp.c, tcp.c and
tcpdns.c and it should be a subject to refactoring in the future.

The changes that are included in this commit are listed here
(extensively, but not exclusively):

* The netmgr_test unit test was split into individual tests (udp_test,
  tcp_test, tcpdns_test and newly added tcp_quota_test)

* The udp_test and tcp_test has been extended to allow programatic
  failures from the libuv API.  Unfortunately, we can't use cmocka
  mock() and will_return(), so we emulate the behaviour with #define and
  including the netmgr/{udp,tcp}.c source file directly.

* The netievents that we put on the nm queue have variable number of
  members, out of these the isc_nmsocket_t and isc_nmhandle_t always
  needs to be attached before enqueueing the netievent_<foo> and
  detached after we have called the isc_nm_async_<foo> to ensure that
  the socket (handle) doesn't disappear between scheduling the event and
  actually executing the event.

* Cancelling the in-flight TCP connection using libuv requires to call
  uv_close() on the original uv_tcp_t handle which just breaks too many
  assumptions we have in the netmgr code.  Instead of using uv_timer for
  TCP connection timeouts, we use platform specific socket option.

* Fix the synchronization between {nm,async}_{listentcp,tcpconnect}

  When isc_nm_listentcp() or isc_nm_tcpconnect() is called it was
  waiting for socket to either end up with error (that path was fine) or
  to be listening or connected using condition variable and mutex.

  Several things could happen:

    0. everything is ok

    1. the waiting thread would miss the SIGNAL() - because the enqueued
       event would be processed faster than we could start WAIT()ing.
       In case the operation would end up with error, it would be ok, as
       the error variable would be unchanged.

    2. the waiting thread miss the sock->{connected,listening} = `true`
       would be set to `false` in the tcp_{listen,connect}close_cb() as
       the connection would be so short lived that the socket would be
       closed before we could even start WAIT()ing

* The tcpdns has been converted to using libuv directly.  Previously,
  the tcpdns protocol used tcp protocol from netmgr, this proved to be
  very complicated to understand, fix and make changes to.  The new
  tcpdns protocol is modeled in a similar way how tcp netmgr protocol.
  Closes: #2194, #2283, #2318, #2266, #2034, #1920

* The tcp and tcpdns is now not using isc_uv_import/isc_uv_export to
  pass accepted TCP sockets between netthreads, but instead (similar to
  UDP) uses per netthread uv_loop listener.  This greatly reduces the
  complexity as the socket is always run in the associated nm and uv
  loops, and we are also not touching the libuv internals.

  There's an unfortunate side effect though, the new code requires
  support for load-balanced sockets from the operating system for both
  UDP and TCP (see #2137).  If the operating system doesn't support the
  load balanced sockets (either SO_REUSEPORT on Linux or SO_REUSEPORT_LB
  on FreeBSD 12+), the number of netthreads is limited to 1.

* The netmgr has now two debugging #ifdefs:

  1. Already existing NETMGR_TRACE prints any dangling nmsockets and
     nmhandles before triggering assertion failure.  This options would
     reduce performance when enabled, but in theory, it could be enabled
     on low-performance systems.

  2. New NETMGR_TRACE_VERBOSE option has been added that enables
     extensive netmgr logging that allows the software engineer to
     precisely track any attach/detach operations on the nmsockets and
     nmhandles.  This is not suitable for any kind of production
     machine, only for debugging.

* The tlsdns netmgr protocol has been split from the tcpdns and it still
  uses the old method of stacking the netmgr boxes on top of each other.
  We will have to refactor the tlsdns netmgr protocol to use the same
  approach - build the stack using only libuv and openssl.

* Limit but not assert the tcp buffer size in tcp_alloc_cb
  Closes: #2061
2020-12-01 16:47:07 +01:00
Mark Andrews
3a36662207 Merge branch '2305-adjust-recursion-limits' into 'main'
Adjust recursion limits

Closes #2305

See merge request isc-projects/bind9!4424
2020-12-01 13:51:16 +00:00
Mark Andrews
ab0bf49203 Adjust default value of "max-recursion-queries"
Since the queries sent towards root and TLD servers are now included in
the count (as a result of the fix for CVE-2020-8616),
"max-recursion-queries" has a higher chance of being exceeded by
non-attack queries.  Increase its default value from 75 to 100.
2020-12-01 23:47:23 +11:00
Mark Andrews
1d11013a18 Merge branch '2315-bind-9-11-22-9-11-25-fails-to-build-for-aep-hsm-native-pkcs11' into 'main'
Resolve "BIND 9.11.22 - 9.11.25 fails to build for AEP HSM native pkcs11"

Closes #2315

See merge request isc-projects/bind9!4441
2020-12-01 12:15:57 +00:00
Mark Andrews
356243aaec Add release note for [GL #2315] 2020-12-01 10:52:41 +01:00
Mark Andrews
11a3545e32 Add CHANGES 2020-12-01 10:46:58 +11:00
Mark Andrews
49b9219bb3 Fix misplaced declaration 2020-12-01 10:46:58 +11:00
Michal Nowak
90298dfc18 Merge branch 'mnowak/drop_headerdep_test.sh.in' into 'main'
Drop bin/tests/headerdep_test.sh.in, revise OPTIONS.md

See merge request isc-projects/bind9!4401
2020-11-27 12:14:29 +00:00
Michal Nowak
9567cefd39 Drop bin/tests/headerdep_test.sh.in
The bin/tests/headerdep_test.sh script has not been updated since it was
first created and it cannot be used as-is with the current BIND source
code.  Better tools (e.g. "include-what-you-use") emerged since the
script was committed back in 2000, so instead of trying to bring it up
to date, remove it from the source repository.
2020-11-27 13:11:41 +01:00
Michal Nowak
e0e644352c Revise OPTIONS.md
- The STD_CDEFINES build-time variable was dropped when the build
    system was migrated to Automake.  CPPFLAGS is the variable which
    should now be used for setting preprocessor macros.

  - Sort the list of preprocessor macros which affect BIND behavior.
    Remove ISC_BUFFER_USEINLINE from the list as it can be controlled
    using its relevant ./configure option (--enable-buffer-useinline).
    Rename NS_RUN_PID_DIR to NAMED_RUN_PID_DIR to match the source code.

  - Tweak Markdown formatting.
2020-11-27 13:11:41 +01:00
Mark Andrews
3d7a0e7af7 Merge branch '2275-tighten-dns-cookie-response-handling' into 'main'
Resolve "Tighten DNS COOKIE response handling"

Closes #2275

See merge request isc-projects/bind9!4391
2020-11-26 21:10:28 +00:00
Mark Andrews
d0dd71380b Add release note for [GL #2275] 2020-11-26 20:48:46 +00:00
Mark Andrews
15e7a4b047 Add CHANGES note for [GL #2275] 2020-11-26 20:48:46 +00:00
Mark Andrews
304df53991 Add comment about cookie sizes 2020-11-26 20:48:46 +00:00
Mark Andrews
bd9155590e Check that missing cookies are handled 2020-11-26 20:48:46 +00:00
Mark Andrews
0e3b1f5a25 Tighten DNS COOKIE response handling
Fallback to TCP when we have already seen a DNS COOKIE response
from the given address and don't have one in this UDP response. This
could be a server that has turned off DNS COOKIE support, a
misconfigured anycast server with partial DNS COOKIE support, or a
spoofed response. Falling back to TCP is the correct behaviour in
all 3 cases.
2020-11-26 20:48:46 +00:00
Michal Nowak
8fed3b3e17 Merge branch '2224-fixup-core-back-traces' into 'main'
Resolve "Fixup core back traces."

Closes #2224

See merge request isc-projects/bind9!4279
2020-11-26 17:03:43 +00:00
Michal Nowak
6428fc26af Write traceback file to the same directory as core file
The traceback files could overwrite each other on systems which do not
use different core dump file names for different processes.  Prevent
that by writing the traceback file to the same directory as the core
dump file.

These changes still do not prevent the operating system from overwriting
a core dump file if the same binary crashes multiple times in the same
directory and core dump files are named identically for different
processes.
2020-11-26 18:01:34 +01:00
Mark Andrews
0f0a006c7e Unify whitespace in bin/tests/system/run.sh.in
Replace tabs with spaces to make whitespace consistent across the entire
bin/tests/system/run.sh.in script.
2020-11-26 18:01:33 +01:00
Diego dos Santos Fronza
9d56be5ab2 Merge branch '2281-cid-313104-error-handling-issues-in-lib-ns-query-c' into 'main'
Resolve "CID 313104: Error handling issues in lib/ns/query.c"

Closes #2281

See merge request isc-projects/bind9!4416
2020-11-26 14:57:02 +00:00
Diego Fronza
95add01643 Silence coverity warnings in query.c
Return value of dns_db_getservestalerefresh() and
dns_db_getservestalettl() functions were previously unhandled.

This commit purposefully ignore those return values since there is
no side effect if those results are != ISC_R_SUCCESS, it also supress
Coverity warnings.
2020-11-26 14:55:14 +00:00
Matthijs Mekking
5434529a77 Merge branch '1620-dnssec-policy-nsec3-saltlen-followup' into 'main'
Add one missing check to nsec3param unit test

See merge request isc-projects/bind9!4432
2020-11-26 14:40:34 +00:00
Matthijs Mekking
dff01583db Add one missing check to nsec3param unit test
Caught this missing check with clang-build while backporting #1620
to the v9_16 branch.
2020-11-26 12:40:22 +00:00
Michał Kępień
dcb8394c0c Merge branch 'michal/use-proper-cmocka-macros-for-pointer-checks' into 'main'
Use proper cmocka macros for pointer checks

See merge request isc-projects/bind9!4415
2020-11-26 12:12:02 +00:00
Michał Kępień
f440600126 Use proper cmocka macros for pointer checks
Make sure pointer checks in unit tests use cmocka assertion macros
dedicated for use with pointers instead of those dedicated for use with
integers or booleans.
2020-11-26 13:10:40 +01:00
Michał Kępień
1c9273a40b Merge branch '2310-update-release-checklist' into 'main'
Update release checklist

See merge request isc-projects/bind9!4425
2020-11-26 12:08:09 +00:00
Michał Kępień
a83f838a6f Update release checklist
Add an item to the release checklist to make sure the man pages
generated during release preparation are formatted correctly.
2020-11-26 13:07:19 +01:00
Michał Kępień
07c0db2661 Merge branch 'v9_17_7-release' into 'main'
Merge 9.17.7 release branch

See merge request isc-projects/bind9!4426
2020-11-26 11:19:45 +00:00
Michał Kępień
2011a86881 Set up release notes for BIND 9.17.8 2020-11-26 12:16:49 +01:00
Michał Kępień
2bb071ec06 Bump BIND_BASELINE_VERSION for ABI checks 2020-11-26 12:16:49 +01:00
Michał Kępień
09aa4a564d Update BIND version to 9.17.7 2020-11-26 12:12:17 +01:00
Michał Kępień
7475ba842d Add a CHANGES marker 2020-11-26 12:12:17 +01:00
Michał Kępień
2bb0a5dcdb Update library API versions 2020-11-26 12:12:17 +01:00
Michał Kępień
1328a7cbda Merge branch 'michal/prepare-release-notes-for-bind-9.17.7' into 'v9_17_7-release'
Prepare release notes for BIND 9.17.7

See merge request isc-private/bind9!220
2020-11-26 12:12:17 +01:00
Michał Kępień
3a447d02b4 Prepare release notes for BIND 9.17.7 2020-11-26 12:12:17 +01:00
Michał Kępień
42cf594b37 Add release note for GL #2244 2020-11-26 12:12:17 +01:00
Michał Kępień
563f8a78e9 Add release note for GL #2236 2020-11-26 12:12:17 +01:00
Michał Kępień
572bc05aca Add release note for GL #1736 2020-11-26 12:12:17 +01:00
Michał Kępień
a4dea3c70c Reorder release notes 2020-11-26 12:12:17 +01:00
Michał Kępień
59221c4b3b Tweak and reword release notes 2020-11-26 12:12:17 +01:00
Michał Kępień
429cac9d1a Tweak and reword recent CHANGES entries 2020-11-26 12:12:17 +01:00
Michał Kępień
3f7ddefdd1 Remove any mention of "make depend" from README.md 2020-11-26 12:12:17 +01:00
Matthijs Mekking
84bf7ce4a6 Merge branch '1620-dnssec-policy-nsec3-saltlen' into 'main'
Resolve "dnssec-policy NSEC3 support"

Closes #1620

See merge request isc-projects/bind9!4299
2020-11-26 10:12:26 +00:00
Matthijs Mekking
64db30942d Add NSEC3PARAM unit test, refactor zone.c
Add unit test to ensure the right NSEC3PARAM event is scheduled in
'dns_zone_setnsec3param()'.  To avoid scheduling and managing actual
tasks, split up the 'dns_zone_setnsec3param()' function in two parts:

1. 'dns__zone_lookup_nsec3param()' that will check if the requested
   NSEC3 parameters already exist, and if a new salt needs to be
   generated.

2. The actual scheduling of the new NSEC3PARAM event (if needed).
2020-11-26 10:43:59 +01:00
Matthijs Mekking
6b5d7357df Detect NSEC3 salt collisions
When generating a new salt, compare it with the previous NSEC3
paremeters to ensure the new parameters are different from the
previous ones.

This moves the salt generation call from 'bin/named/*.s' to
'lib/dns/zone.c'. When setting new NSEC3 parameters, you can set a new
function parameter 'resalt' to enforce a new salt to be generated. A
new salt will also be generated if 'salt' is set to NULL.

Logging salt with zone context can now be done with 'dnssec_log',
removing the need for 'dns_nsec3_log_salt'.
2020-11-26 10:43:59 +01:00
Matthijs Mekking
3b4c764b43 Add zone context to "generated salt" logs 2020-11-26 10:43:59 +01:00