2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-08-28 21:17:54 +00:00

439 Commits

Author SHA1 Message Date
Ondřej Surý
344d66aaff Add HalfSipHash 2-4 reference implementation
The HalfSipHash implementation has 32-bit keys and returns 32-bit
value.
2020-07-21 08:44:26 +02:00
Ondřej Surý
21d751dfc7 Remove OpenSSL based SipHash 2-4 implementation
Creation of EVP_MD_CTX and EVP_PKEY is quite expensive, so until we fix the code
to reuse the OpenSSL contexts and keys we'll use our own implementation of
siphash instead of trying to integrate with OpenSSL.
2020-07-21 08:44:26 +02:00
Michal Nowak
5bbc6dd7f1 Fix "make dist"
Make various adjustments necessary to enable "make dist" to build a BIND
source tarball whose contents are complete enough to build binaries, run
unit & system tests, and generate documentation on Unix systems.

Known outstanding issues:

  - "make distcheck" does not work yet.
  - Tests do not work for out-of-tree source-tarball-based builds.
  - Source tarballs are not complete enough for building on Windows.

All of the above will be addressed in due course.
2020-06-05 13:19:49 +02:00
Michal Nowak
eddece7841
Associate unit test data dir with a more specific variable
Having 'TESTS', the Automake variable and 'TESTS' the unit test data dir
seems confusing, lets rename the latter to to 'TESTS_DIR'.
2020-06-04 12:56:57 +02:00
Witold Kręcicki
4a8d9250cf tests: fix isc/socket_test.c teardown
In case of a test failure we weren't tearing down sockets and tasks
properly, causing the test to hang instead of failing nicely.
2020-06-03 13:16:28 +02:00
Michal Nowak
bfa6ecb796
Provide unit test driver
This adds a unit test driver for BIND with Automake.  It runs the unit
test program provided as its sole command line argument and then looks
for a core dump generated by that test program.  If one is found, the
driver prints the backtrace into the test log.
2020-05-21 12:13:01 +02:00
Ondřej Surý
86f322133f Fix the noinst_LTLIBRARIES -> check_LTLIBRARIES in libisc and libdns unit tests 2020-04-27 15:18:31 +02:00
Evan Hunt
17a1bafc08 Restore behaviour of "make test" and "make unit"
Add recursive "test" and "unit" rules, which execute "make check"
in specific directories - "make test" runs the system tests, and
"make unit" runs the unit tests.
2020-04-27 15:02:30 +02:00
Ondřej Surý
978c7b2e89 Complete rewrite the BIND 9 build system
The rewrite of BIND 9 build system is a large work and cannot be reasonable
split into separate merge requests.  Addition of the automake has a positive
effect on the readability and maintainability of the build system as it is more
declarative, it allows conditional and we are able to drop all of the custom
make code that BIND 9 developed over the years to overcome the deficiencies of
autoconf + custom Makefile.in files.

This squashed commit contains following changes:

- conversion (or rather fresh rewrite) of all Makefile.in files to Makefile.am
  by using automake

- the libtool is now properly integrated with automake (the way we used it
  was rather hackish as the only official way how to use libtool is via
  automake

- the dynamic module loading was rewritten from a custom patchwork to libtool's
  libltdl (which includes the patchwork to support module loading on different
  systems internally)

- conversion of the unit test executor from kyua to automake parallel driver

- conversion of the system test executor from custom make/shell to automake
  parallel driver

- The GSSAPI has been refactored, the custom SPNEGO on the basis that
  all major KRB5/GSSAPI (mit-krb5, heimdal and Windows) implementations
  support SPNEGO mechanism.

- The various defunct tests from bin/tests have been removed:
  bin/tests/optional and bin/tests/pkcs11

- The text files generated from the MD files have been removed, the
  MarkDown has been designed to be readable by both humans and computers

- The xsl header is now generated by a simple sed command instead of
  perl helper

- The <irs/platform.h> header has been removed

- cleanups of configure.ac script to make it more simpler, addition of multiple
  macros (there's still work to be done though)

- the tarball can now be prepared with `make dist`

- the system tests are partially able to run in oot build

Here's a list of unfinished work that needs to be completed in subsequent merge
requests:

- `make distcheck` doesn't yet work (because of system tests oot run is not yet
  finished)

- documentation is not yet built, there's a different merge request with docbook
  to sphinx-build rst conversion that needs to be rebased and adapted on top of
  the automake

- msvc build is non functional yet and we need to decide whether we will just
  cross-compile bind9 using mingw-w64 or fix the msvc build

- contributed dlz modules are not included neither in the autoconf nor automake
2020-04-21 14:19:48 +02:00
Ondřej Surý
4df5a5832c Remove files generated by autotools 2020-04-21 14:19:30 +02:00
Witold Kręcicki
62f738ba48 Fix detaching the extra quotas in the quota_test 2020-04-21 14:17:20 +02:00
Ondřej Surý
54defc8b78 Enable quota_test in Kyuafile 2020-04-21 12:30:11 +02:00
Witold Kręcicki
d151a10f30 Add a quota attach function with a callback, some code cleanups.
We introduce a isc_quota_attach_cb function - if ISC_R_QUOTA is returned
at the time the function is called, then a callback will be called when
there's quota available (with quota already attached). The callbacks are
organized as a LIFO queue in the quota structure.
It's needed for TCP client quota -  with old networking code we had one
single place where tcp clients quota was processed so we could resume
accepting when the we had spare slots, but it's gone with netmgr - now
we need to notify the listener/accepter that there's quota available so
that it can resume accepting.

Remove unused isc_quota_force() function.

The isc_quote_reserve and isc_quota_release were used only internally
from the quota.c and the tests.  We should not expose API we are not
using.
2020-03-30 07:43:10 +00:00
Mark Andrews
0b793166d0 Refactor the isc_log API so it cannot fail on memory failures
The isc_mem API now crashes on memory allocation failure, and this is
the next commit in series to cleanup the code that could fail before,
but cannot fail now, e.g. isc_result_t return type has been changed to
void for the isc_log API functions that could only return ISC_R_SUCCESS.
2020-03-18 09:05:59 +01:00
Evan Hunt
6b76646037 fix a pointer-to-int cast error 2020-03-17 13:00:29 -07:00
Ondřej Surý
4e114f8ed6 Stop leaking OpenSSL types and defines in the isc/md.h
The <isc/md.h> header directly included <openssl/evp.h> header which
enforced all users of the libisc library to explicitly list the include
path to OpenSSL and link with -lcrypto.  By hiding the specific
implementation into the private namespace, we no longer enforce this.
In the long run, this might also allow us to switch cryptographic
library implementation without affecting the downstream users.

While making the isc_md_type_t type opaque, the API using the data type
was changed to use the pointer to isc_md_type_t instead of using the
type directly.
2020-03-17 09:11:13 +01:00
Ondřej Surý
3178974f0c Use the new sorting rules to regroup #include headers 2020-03-09 16:19:22 +01:00
Michał Kępień
fc967ba092 Add ZLIB_LIBS to ISCLIBS
When --with-zlib is passed to ./configure (or when the latter
autodetects zlib's presence), libisc uses certain zlib functions and
thus libisc's users should be linked against zlib in that case.  Adjust
Makefile variables appropriately to prevent shared build failures caused
by underlinking.
2020-02-28 15:22:29 +01:00
Witold Krecicki
0fe149b2fa Fix lib/isc/tests/socket_test hangs 2020-02-20 11:39:15 +01:00
Ondřej Surý
5777c44ad0 Reformat using the new rules 2020-02-14 09:31:05 +01:00
Evan Hunt
e851ed0bb5 apply the modified style 2020-02-13 15:05:06 -08:00
Ondřej Surý
056e133c4c Use clang-tidy to add curly braces around one-line statements
The command used to reformat the files in this commit was:

./util/run-clang-tidy \
	-clang-tidy-binary clang-tidy-11
	-clang-apply-replacements-binary clang-apply-replacements-11 \
	-checks=-*,readability-braces-around-statements \
	-j 9 \
	-fix \
	-format \
	-style=file \
	-quiet
clang-format -i --style=format $(git ls-files '*.c' '*.h')
uncrustify -c .uncrustify.cfg --replace --no-backup $(git ls-files '*.c' '*.h')
clang-format -i --style=format $(git ls-files '*.c' '*.h')
2020-02-13 22:07:21 +01:00
Ondřej Surý
f50b1e0685 Use clang-format to reformat the source files 2020-02-12 15:04:17 +01:00
Ondřej Surý
c73e5866c4 Refactor the isc_buffer_allocate() usage using the semantic patch
The isc_buffer_allocate() function now cannot fail with ISC_R_MEMORY.
This commit removes all the checks on the return code using the semantic
patch from previous commit, as isc_buffer_allocate() now returns void.
2020-02-03 08:29:00 +01:00
Ondřej Surý
5eb3f71a3e Refactor the isc_mempool_create() usage using the semantic patch
The isc_mempool_create() function now cannot fail with ISC_R_MEMORY.
This commit removes all the checks on the return code using the semantic
patch from previous commit, as isc_mempool_create() now returns void.
2020-02-03 08:27:16 +01:00
Witold Kręcicki
1beba0fa59 Unit test for the taskmgr pause/unpause race 2020-01-21 10:06:19 +01:00
Ondřej Surý
afc4867e99 Remove use of PTHREAD_MUTEX_INITIALIZER in tests
Remove the pthread specific static initializer in favor of dynamic
initialization.
2020-01-13 09:09:03 +01:00
Ondřej Surý
4f7d1298a8 Use isc_threadresult_t instead of pthread specific void * return type
The ISC thread API already defines isc_threadresult_t type,
but we are using a pthread specific return type (void *).
2020-01-13 09:08:48 +01:00
Witold Kręcicki
70f80a3ec7 fix a problem with the mem_test unit test
isc_mem_traceflag_test messes with stdout/stderr, which can cause
problems with subsequent tests (no output, libuv problems).  Moving that
test case to the end ensures there are no side effects.
2019-11-17 18:59:40 -08:00
Ondřej Surý
23964dbbbc Change the shared completion->done variable to atomic_bool in socket_test.c 2019-11-17 09:38:36 +08:00
Evan Hunt
bd9f5c3c19 fix netmgr setup/teardown issues; setup and teardown only once in timer_test
- the netmgr was not correctly being specified when creating the task
  manager, and was cleaned up in the wrong order when shutting down.
- on freebsd, timer_test appears to be prone to failure if the
  netmgr is set up and torn down before and after ever test case, but
  less so if it's only set up once at the beginning and once at the
  end.
2019-11-13 14:47:47 +01:00
Ondřej Surý
aca0f88750 Remove the assertions from subthreads and use global errcnt to record errors 2019-11-13 14:47:47 +01:00
Ondřej Surý
2c3589e22a Lock the lasttime variable that's concurrently accessed between threads 2019-11-13 14:47:47 +01:00
Ondřej Surý
b9cb4c94fa Directly embed ../timer.c in timer_test.c for better assertion testing 2019-11-13 14:47:47 +01:00
Ondřej Surý
8de64964a3 Refactor the way we use memory context from isctest.c
This commit renames isctest {mctx,lctx} to test_{mctx,lctx} and cleans
up their usage in the individual unit tests.  This allows embedding
library .c files directly into the unit tests.
2019-11-13 14:47:47 +01:00
Evan Hunt
b9a5508e52 remove ISC_QUEUE as it is no longer used 2019-11-07 11:55:37 -08:00
Evan Hunt
36ee430327 optionally associate a netmgr with a task manager when creating
When a task manager is created, we can now specify an `isc_nm`
object to associate with it; thereafter when the task manager is
placed into exclusive mode, the network manager will be paused.
2019-11-07 11:55:37 -08:00
Evan Hunt
48d003edf7 use netmgr in libisc unit tests 2019-11-07 11:55:37 -08:00
Evan Hunt
64e1a4a398 temporarily move ISC_QUEUE to list.h
The double-locked queue implementation is still currently in use
in ns_client, but will be replaced by a fetch-and-add array queue.
This commit moves it from queue.h to list.h so that queue.h can be
used for the new data structure, and clean up dependencies between
list.h and types.h. Later, when the ISC_QUEUE is no longer is use,
it will be removed completely.
2019-11-07 11:55:37 -08:00
Ondřej Surý
a0d3614a60 Remove randomly scattered additional style check suppressions that caused unmatchedSuppression 2019-10-03 09:04:27 +02:00
Ondřej Surý
2230b9d55d Disable benchmark tests when Thread Sanitizer is enabled 2019-10-02 14:09:33 +02:00
Ondřej Surý
e06a34674a Convert all variables accessed between multiple threads to atomic 2019-10-02 13:41:45 +02:00
Ondřej Surý
07879f354c Properly initialize atomic variables 2019-10-02 13:09:33 +02:00
Ondřej Surý
76e954124a lib/isc/tests/task_test.c: Convert all variables accessed between multiple threads to atomic 2019-10-02 13:09:28 +02:00
Ondřej Surý
9ff02c8170 Silence false positive warning from Clang 10 in random_test.c 2019-09-26 14:58:18 +02:00
Mark Andrews
b59fe46e76 address or suppress cppcheck warnings 2019-09-12 17:59:28 +10:00
Ondřej Surý
19fbdef31e Remove unused isc_mem_createx() function
The isc_mem_createx() function was only used in the tests to eliminate using the
default flags (which as of writing this commit message was ISC_MEMFLAG_INTERNAL
and ISC_MEMFLAG_FILL).  This commit removes the isc_mem_createx() function from
the public API.
2019-09-12 09:26:09 +02:00
Ondřej Surý
4957255d13 Use the semantic patch to change the usage isc_mem_create() to new API 2019-09-12 09:26:09 +02:00
Ondřej Surý
6fd3259560 Fix alignment issues in the native implementation of isc_siphash24()
The native implementation's conversion from the uint8_t buffers to uint64_t now
follows the reference implementation that doesn't require aligned buffers.
2019-09-02 13:21:07 +02:00
Ondřej Surý
46919579bb Make isc_thread_join() assert internally on failure
Previously isc_thread_join() would return ISC_R_UNEXPECTED on a failure to
create new thread.  All such occurences were caught and wrapped into assert
function at higher level.  The function was simplified to assert directly in the
isc_thread_join() function and all caller level assertions were removed.
2019-07-31 11:56:58 +02:00