2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-08-30 14:07:59 +00:00
Commit Graph

1782 Commits

Author SHA1 Message Date
Ondřej Surý
c47fad2431 Replace the OASIS PKCS#11 header file with one from p11-kit
The OASIS pkcs11.h header has a restrictive license.  Replace the
pkcs11.h pkcs11f.h and pkcs11t.h headers with pkcs11.h from p11-kit.

For source distribution, the license for the OASIS headers itself
doesn't pose any licensing problem when combined with MPL license, but
it possibly creates problem for downstream distributors of BIND 9.
2019-09-16 04:47:50 -04:00
Ondřej Surý
aea3631fd5 Check isc_mutex_{lock,unlock}() return values in mutexatomic.h shim 2019-09-13 10:55:14 +02:00
Ondřej Surý
aeea5ece97 Remove now useless ISC_MEMFLAG_NOLOCK memflag
Previously the libisc allocator had ability to run unlocked when threading was
disabled.  As the threading is now always on, remove the ISC_MEMFLAG_NOLOCK
memory flag as it serves no purpose.
2019-09-12 09:26:09 +02: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ý
1b716a39f5 Simplify isc_mem_create() to always use defaults and never fail
Previously, the isc_mem_create() and isc_mem_createx() functions took `max_size`
and `target_size` as first two arguments.  Those values were never used in the
BIND 9 code.  The refactoring removes those arguments and let BIND 9 always use
the default values.

Previously, the isc_mem_create() and isc_mem_createx() functions could have
failed because of failed memory allocation.  As this was no longer true and the
functions have always returned ISC_R_SUCCESS, the have been refactored to return
void.
2019-09-12 09:26:09 +02:00
Mark Andrews
2f558854b7 implement maxudp under windows 2019-09-04 10:04:14 +10: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ý
a912f31398 Add new default siphash24 cookie algorithm, but keep AES as legacy
This commit changes the BIND cookie algorithms to match
draft-sury-toorop-dnsop-server-cookies-00.  Namely, it changes the Client Cookie
algorithm to use SipHash 2-4, adds the new Server Cookie algorithm using SipHash
2-4, and changes the default for the Server Cookie algorithm to be siphash24.

Add siphash24 cookie algorithm, and make it keep legacy aes as
2019-07-21 15:16:28 -04:00
Witold Kręcicki
92424e23fa Special, for-tests-only, mode with atomics emulated by a mutex-locked variable - useful for finding atomics congestions 2019-07-09 16:09:36 +02:00
Ondřej Surý
49462cf974 Make isc_rwlock.c thread-safe
The ThreadSanitizer found several possible data races in our rwlock
implementation.  This commit changes all the unprotected variables to atomic and
also changes the explicit memory ordering (atomic_<foo>_explicit(..., <order>)
functions to use our convenience macros (atomic_<foo>_<order>).
2019-07-03 00:05:34 -04:00
Ondřej Surý
570f358252 Add atomic_compare_exchange_strong_relaxed convenience macro 2019-07-03 00:05:34 -04:00
Ondřej Surý
e3e6888946 Make the usage of json-c objects opaque to the caller
The json-c have previously leaked into the global namespace leading
to forced -I<include_path> for every compilation unit using isc/xml.h
header.  This MR fixes the usage making the caller object opaque.
2019-06-25 12:04:20 +02:00
Ondřej Surý
0771dd3be8 Make the usage of libxml2 opaque to the caller
The libxml2 have previously leaked into the global namespace leading
to forced -I<include_path> for every compilation unit using isc/xml.h
header.  This MR fixes the usage making the caller object opaque.
2019-06-25 12:01:32 +02:00
Ondřej Surý
ac3d9b97a3 Fix Windows build by moving #include <pthread.h> to correct #ifdef block 2019-06-05 11:17:19 -07:00
Mark Andrews
5d5d751c7f teach cppcheck that _assert_int_equal and _assert_int_not_equal don't return on failure 2019-06-03 23:04:10 -04:00
Ondřej Surý
14ecd7d79e Revise the Windows section of <isc/endian.h>
Add a comment and remove redundant definitions.
2019-06-03 14:13:23 +02:00
Ondřej Surý
7e05848870 Revise the macOS section of <isc/endian.h>
Move the macOS section of <isc/endian.h> to a lower spot as it is
believed not to be the most popular platform for running BIND.  Add a
comment and remove redundant definitions.
2019-06-03 14:13:23 +02:00
Ondřej Surý
2e54b1be29 Make <isc/endian.h> detect GNU rather than Linux
Instead of only supporting Linux, try making <isc/endian.h> support
other GNU platforms as well.  Since some compilers define __GNUC__ on
BSDs (e.g. Clang on FreeBSD), move the relevant section to the bottom of
the platform-specific part of <isc/endian.h>, so that it only gets
evaluated when more specific platform determination criteria are not
met.  Also include <byteswap.h> so that any byte-swapping macros which
may be defined in that file on older platforms are used in the fallback
definitions of the nonstandard hto[bl]e{16,32,64}() and
[bl]e{16,32,64}toh() conversion functions.
2019-06-03 14:13:23 +02:00
Ondřej Surý
387cc00121 Add Solaris support for <isc/endian.h>
While Solaris does not support the nonstandard hto[bl]e{16,32,64}() and
[bl]e{16,32,64}toh() conversion functions, it does have some
byte-swapping macros available in <sys/byteorder.h>.  Ensure these
macros are used in the fallback definitions of the aforementioned
nonstandard functions.
2019-06-03 14:13:23 +02:00
Ondřej Surý
85059c2937 Add fallback definitions to <isc/endian.h>
Since the hto[bl]e{16,32,64}() and [bl]e{16,32,64}toh() conversion
functions are nonstandard, add fallback definitions of these functions
to <isc/endian.h>, so that their unavailability does not prevent
compilation from succeeding.
2019-06-03 14:13:23 +02:00
Michał Kępień
7ab1fb2a8d Fix <isc/endian.h> on BSD systems
Current versions of DragonFly BSD, FreeBSD, NetBSD, and OpenBSD all
support the modern variants of functions converting values between host
and big-endian/little-endian byte order while older ones might not.
Ensure <isc/endian.h> works properly in both cases.
2019-06-03 14:13:23 +02:00
Witold Kręcicki
02bbf1e2b9 Add --enable-pthread-rwlock option 2019-05-30 16:10:16 +02:00
Ondřej Surý
4501f646ee Implement isc_rwlock_downgrade using pthreads and single atomic_bool 2019-05-30 16:10:16 +02:00
Ondřej Surý
64fbffbbaa Use simple pthread_rwlock in place of our custom adaptive rwlock 2019-05-30 16:10:16 +02:00
Ondřej Surý
4d2d3b49ce Cleanup the way we detect json-c library to use only pkg-config 2019-05-29 15:08:52 +02:00
Mark Andrews
505ec918d7 include <isc/string.h> for isc_string_strerror_r prototype 2019-05-24 16:27:40 +10:00
Ondřej Surý
d5055665ca Remove isc_hash_reverse function 2019-05-21 10:23:17 +00:00
Ondřej Surý
2e7d82443f Convert isc_hash functions to use isc_siphash24 2019-05-21 10:23:13 +00:00
Ondřej Surý
a197df137a Add reference SipHash 2-4 implementation 2019-05-20 19:01:31 +02:00
Ondřej Surý
0efc36c19a Add portable <isc/endian.h> header 2019-05-20 19:01:31 +02:00
Ondřej Surý
eb8c9bdd55 Make lib/isc/app.c opaque and thread-safe
This work cleans up the API which includes couple of things:

1. Make the isc_appctx_t type fully opaque

2. Protect all access to the isc_app_t members via stdatomics

3. sigwait() is part of POSIX.1, remove dead non-sigwait code

4. Remove unused code: isc_appctx_set{taskmgr,sockmgr,timermgr}
2019-05-20 18:13:02 +02:00
Ondřej Surý
ab389695b0 Add most useful relaxed and acquire-relase stdatomic convenience macros
The header file <isc/atomic.h> now contains convenience macros for
most useful explicit memory ordering for C11 stdatomics, only relaxed
and acquire-release semantics is being used.  These macros SHOULD be
used instead of atomic_<func>_explicit functions.
2019-05-13 12:17:21 +07:00
Evan Hunt
2f3876d187 refactor tcpquota and pipeline refs; allow special-case overrun in isc_quota
- if the TCP quota has been exceeded but there are no clients listening
  for new connections on the interface, we can now force attachment to the
  quota using isc_quota_force(), instead of carrying on with the quota not
  attached.
- the TCP client quota is now referenced via a reference-counted
  'ns_tcpconn' object, one of which is created whenever a client begins
  listening for new connections, and attached to by members of that
  client's pipeline group. when the last reference to the tcpconn
  object is detached, it is freed and the TCP quota slot is released.
- reduce code duplication by adding mark_tcp_active() function
- convert counters to stdatomic

(cherry picked from commit a8dd133d270873b736c1be9bf50ebaa074f5b38f)
(cherry picked from commit 4a8fc979c4)
2019-04-25 16:32:05 +02:00
Ondřej Surý
2e40cc94dc On non-GNUC systems, use uintmax_t in the ISC_ALIGN macro 2019-04-18 12:55:25 +02:00
Mark Andrews
a520662ed4 allow dlz to signal that the view's transfer acl should be used 2019-03-11 14:27:13 +11:00
Mark Andrews
435ae2f29a Handle EDQUOT and ENOSPC errors 2019-03-07 21:02:48 -08:00
Mark Andrews
cb913177ae improve clang / cmocka integration 2019-03-05 10:20:29 -08:00
Ondřej Surý
3a3e75042d Remove support for compiling without assertions (Both ISC_CHECK_ALL, ISC_CHECK_NONE are now gone) 2019-01-31 11:16:08 +01:00
Evan Hunt
39527e9c36 Moved the unix version to lib/isc/unix/include/isc so it's more obvious in the future that it isn't the only copy 2019-01-30 09:37:38 +01:00
Witold Kręcicki
a003908af4 Fix a race in access to manager->tasks in taskmgr
Make taskmgr->mode and boolean state flags (exclusive, paused, exiting) atomic.
2019-01-29 03:32:29 -05:00
Evan Hunt
995134ce76 rename struct members to avoid a name collision on BSD 2019-01-28 10:59:48 -08:00
Witold Kręcicki
0af500a2c5 - Make isc_quota use atomics instead of locks
- Use getters for isc_quota parameters, make fields private
- Fix a potential data race with recursion clients limits logging
2019-01-25 04:26:49 -05:00
Witold Kręcicki
814bfa23b2 Add atomic_store_relaxed and atomic_load_relaxed macros to isc/atomic.h, fix issues in isc/stdatomic.h 2019-01-25 04:26:49 -05:00
Ondřej Surý
e2cdf066ea Remove message catalogs 2019-01-09 23:44:26 +01:00
Mark Andrews
5e8b772ad1 Ensure base64/base32/hex fields in DNS records that should be non-empty are. 2019-01-09 18:04:21 +11:00
Ondřej Surý
ff7c868f25 __SANITIZE_ADDRESS__ needs to be defined to 1 2018-12-19 22:02:37 +01:00
Ondřej Surý
8903d68d69 gcc defines __SANITIZE_ADDRESS__ and not __ADDRESS_SANITIZER__, use the correct #define 2018-12-19 12:24:59 +01:00
Ondřej Surý
e1ce3a3d42 Define __ADDRESS_SANITIZER__ if compiling under clang's AddressSanitizer 2018-12-19 09:54:37 +01:00
Ondřej Surý
953a957dfa Just #define isc_refcount_increment0() to isc_refcount_increment() 2018-12-05 14:16:41 +01:00
Ondřej Surý
8537adef4c The isc_refcount_decrement must use memory_order_release and isc_refcount_destroy must run thread barrier with memory_order_require 2018-12-05 14:11:53 +01:00