Commit Graph

11860 Commits

Author SHA1 Message Date
Mark Andrews
bf63ff09c1 Queue nsec3param setting until receive_secure_serial has completed.
(cherry picked from commit 456888c00f)
2019-09-24 11:37:37 +10:00
Mark Andrews
31a905775c reinstate error handler
(cherry picked from commit 7fb0a0db53)
2019-09-13 14:29:54 +10:00
Mark Andrews
946f08db99 declare alloc_failure
(cherry picked from commit 0d23bc5b55)
2019-09-13 14:26:36 +10:00
Mark Andrews
fd395947ad declare result
(cherry picked from commit 9ee27573af)
2019-09-13 14:26:36 +10:00
Mark Andrews
57824120e4 address or suppress cppcheck warnings
(cherry picked from commit b59fe46e76)
2019-09-12 19:27:28 +10:00
Tinderbox User
2a2d8d00aa prep for 9.14.6 2019-09-09 13:34:28 +00:00
Mark Andrews
7b26e2d819 use rpzs->updater as rpz->rpzs is NULL
(cherry picked from commit 3e82a2ea9a)
2019-09-05 07:29:05 +10:00
Mark Andrews
d72f73af48 implement maxudp under windows
(cherry picked from commit 2f558854b7)
2019-09-04 10:50:00 +10:00
Ondřej Surý
77a68cbd4c 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:40 +02:00
Evan Hunt
2a58b03336 when a response-policy zone expires, unload its polices from RPZ summary
(cherry picked from commit 7ba6d592ec)
2019-08-30 13:08:48 -07:00
Evan Hunt
326ec91c8b use an rbtnodechain to walk up labels
when looking for a possible wildcard match in the RPZ summary database,
use an rbtnodechain to walk up label by label, rather than using the
node's parent pointer.

(cherry picked from commit 6e9be9a952)
2019-08-29 20:08:16 -07:00
Ondřej Surý
d17168b102 Remove the tkey_test.c from the BIND 9.14 branch, it's no-op here anyway. 2019-08-29 15:37:03 +02:00
Ondřej Surý
1c084c35f0 Fix uninitialized variable warning in restore_nsec3param() 2019-08-29 15:14:24 +02:00
Mark Andrews
768fb45660 check that open() succeeded
(cherry picked from commit 510306c654)
2019-08-29 10:26:00 +10:00
Mark Andrews
b25262b1df Add support for displaying EDNS option LLQ.
(cherry picked from commit d98f446d3f)
2019-08-28 17:22:11 +10:00
Mark Andrews
545e7cca9d add dns_zone_cdscheck to integrity checks
(cherry picked from commit cd40c9fe61)
2019-08-28 16:14:45 +10:00
Mark Andrews
45402340b6 implement getoriginnode for sdb
(cherry picked from commit 2ebc4776ca)
2019-08-28 16:14:45 +10:00
Tinderbox User
7f67efcc14 prep 9.14.5 2019-08-21 21:35:30 +00:00
Matthijs Mekking
ea0543a74f Simplify do_stats logic in rbtdb.c
(cherry picked from commit 4c0b0fa6a5)
2019-08-12 10:44:48 +02:00
Matthijs Mekking
3df7a1961f Move dnssec_keyid_max out rrsettype counters enum
(cherry picked from commit 1cd3516d54)
2019-08-12 10:43:44 +02:00
Matthijs Mekking
a8b29e051e Make rbtdb maintain stale counters
When updating the statistics for RRset types, if a header is marked
stale or ancient, the appropriate statistic counters are decremented,
then incremented.

Also fix some out of date comments.

(cherry picked from commit a3af2c57e7)
2019-08-12 10:42:23 +02:00
Matthijs Mekking
51a3ba45e1 No longer have stale tracking in stats module
Having the decrement/increment logic in stats makes the code hard
to follow. Remove it here and adjust the unit test. The caller
will be responsible for maintaining the correct increments and
decrements for statistics counters (in the following commit).

(cherry picked from commit 48332d4478)
2019-08-12 10:42:12 +02:00
Matthijs Mekking
ca4c9f3b06 Print out ancient type stats with '~' prefix.
The stale RR types are now printed with '#'.  This used to be the
prefix for RR types that were marked ancient, but commit
df50751585 changed the meaning.  It is
probably better to keep '#' for stale RR types and introduce a new
prefix for reintroducing ancient type stat counters.

(cherry picked from commit c9d56a8185)
2019-08-12 10:41:19 +02:00
Sergei Trofimovich
e39b03d06d configure.ac: autodetect 'pause' instruction presence on sparc
The change fixes the following build failure on sparc T3 and older CPUs:

```
sparc-unknown-linux-gnu-gcc ... -O2 -mcpu=niagara2 ... -c rwlock.c
{standard input}: Assembler messages:
{standard input}:398: Error: Architecture mismatch on "pause ".
{standard input}:398: (Requires v9e|v9v|v9m|m8; requested architecture is v9b.)
make[1]: *** [Makefile:280: rwlock.o] Error 1
```

`pause` insutruction exists only on `-mcpu=niagara4` (`T4`) and upper.

The change adds `pause` configure-time autodetection and uses it if available.
config.h.in got new `HAVE_SPARC_PAUSE` knob. Fallback is a fall-through no-op.

Build-tested on:

- sparc-unknown-linux-gnu-gcc (no `pause`, build succeeds)
- sparc-unknown-linux-gnu-gcc -mcpu=niagara4 (`pause`, build succeeds)

Reported-by: Rolf Eike Beer
Bug: https://bugs.gentoo.org/691708
Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
(cherry picked from commit a5ad6b16c5)
2019-08-08 14:03:29 +02:00
Ondřej Surý
ebc48cda26 Have the dns_client hold a .references until all external references are removed
so that cleanup can all be done in dns_client_destroy().

(cherry picked from commit e80c4c3431)
2019-08-07 12:15:32 +02:00
Mark Andrews
e394632703 Have the view hold a weakref until all external references are removed
so that cleanup can all be done in dns_view_weakattach().

(cherry picked from commit be8af3afb7)
2019-08-07 12:15:32 +02:00
Ondřej Surý
232140edae lib/dns/resolver.c: Convert (dns_view_t *)->weakrefs to isc_refcount_t
There's a deadlock in BIND 9 code where (dns_view_t){ .lock } and
(dns_resolver_t){ .buckets[i].lock } gets locked in different order.  When
view->weakrefs gets converted to a reference counting we can reduce the locking
in dns_view_weakdetach only to cases where it's the last instance of the
dns_view_t object.

(cherry picked from commit a7c9a52c89)
2019-08-07 12:00:50 +02:00
Mark Andrews
2e85ede202 Store the DS and RRSIG(DS) with trust dns_trust_pending_answer
so that the validator can validate the records as part of validating
the current request.

(cherry picked from commit 57a328d67e)
2019-08-02 15:34:22 +10:00
Mark Andrews
f2ab4eb376 remove invalid comment
(cherry picked from commit 9cfd0ecccf)
2019-08-01 16:07:00 +10:00
Mark Andrews
a15e89c3d6 keep rpzs around until everything referencing it has gone
(cherry picked from commit 9b10cfef56)
2019-08-01 16:06:59 +10:00
Mark Andrews
d4551764fd maintain a reference to 'rpz' when calling rpz.c:update_quantum
(cherry picked from commit 53800281fe)
2019-08-01 16:06:59 +10:00
Mark Andrews
f0fa5ce397 check that bits 64..71 in a dns64 prefix are zero
(cherry picked from commit a7ec7eb6ed)
2019-07-31 22:35:14 +10:00
Mark Andrews
f6d6fb8124 handle connect() returning ETIMEDOUT on a non-blocking socket
(cherry picked from commit 91a0cb5da3)
2019-07-31 11:02:30 +10:00
Michał Kępień
8d0cdb54ee Do not use legacy time zone names
"PST8PDT" is a legacy time zone name whose use in modern code is
discouraged.  It so happens that using this time zone with musl libc
time functions results in different output than for other libc
implementations, which breaks the lib/isc/tests/time_test unit test.
Use the "America/Los_Angeles" time zone instead in order to get
consistent output across all tested libc implementations.

(cherry picked from commit f4daf6e0e7)
2019-07-30 21:25:47 +02:00
Michał Kępień
149ffc529d Tweak buffer sizes to prevent compilation warnings
For some libc implementations, BUFSIZ is small enough (e.g. 1024 for
musl libc) to trigger compilation warnings about insufficient size of
certain buffers.  Since the relevant buffers are used for printing DNS
names, increase their size to '(n + 1) * DNS_NAME_FORMATSIZE', where 'n'
is the number of DNS names which are printed to a given buffer.  This
results in somewhat arbitrary, albeit nicely-aligned and large enough
buffer sizes.

(cherry picked from commit 3384455659)
2019-07-30 21:25:46 +02:00
Michał Kępień
3f341b996d Always include <errno.h> instead of <sys/errno.h>
Including <sys/errno.h> instead of <errno.h> raises a compiler warning
when building against musl libc.  Always include <errno.h> instead of
<sys/errno.h> to prevent that compilation warning from being triggered
and to achieve consistency in this regard across the entire source tree.

(cherry picked from commit b5cd146033)
2019-07-30 21:25:46 +02:00
Michał Kępień
80669d8c89 Unify header ordering in unit tests
Make sure all unit tests include headers in a similar order:

 1. Three headers which must be included before <cmocka.h>.
 2. System headers.
 3. UNIT_TESTING definition, followed by the <cmocka.h> header.
 4. libisc headers.
 5. Headers from other BIND libraries.
 6. Local headers.

Also make sure header file names are sorted alphabetically within each
block of #include directives.

(cherry picked from commit 5381ac0fcc)
2019-07-30 21:25:45 +02:00
Michał Kępień
77dc5be6b4 Include <sched.h> where necessary for musl libc
All unit tests define the UNIT_TESTING macro, which causes <cmocka.h> to
replace malloc(), calloc(), realloc(), and free() with its own functions
tracking memory allocations.  In order for this not to break
compilation, the system header declaring the prototypes for these
standard functions must be included before <cmocka.h>.

Normally, these prototypes are only present in <stdlib.h>, so we make
sure it is included before <cmocka.h>.  However, musl libc also defines
the prototypes for calloc() and free() in <sched.h>, which is included
by <pthread.h>, which is included e.g. by <isc/mutex.h>.  Thus, unit
tests including "dnstest.h" (which includes <isc/mem.h>, which includes
<isc/mutex.h>) after <cmocka.h> will not compile with musl libc as for
these programs, <sched.h> will be included after <cmocka.h>.

Always including <cmocka.h> after all other header files is not a
feasible solution as that causes the mock assertion macros defined in
<isc/util.h> to mangle the contents of <cmocka.h>, thus breaking
compilation.  We cannot really use the __noreturn__ or analyzer_noreturn
attributes with cmocka assertion functions because they do return if the
tested condition is true.  The problem is that what BIND unit tests do
is incompatible with Clang Static Analyzer's assumptions: since we use
cmocka, our custom assertion handlers are present in a shared library
(i.e. it is the cmocka library that checks the assertion condition, not
a macro in unit test code).  Redefining cmocka's assertion macros in
<isc/util.h> is an ugly hack to overcome that problem - unfortunately,
this is the only way we can think of to make Clang Static Analyzer
properly process unit test code.  Giving up on Clang Static Analyzer
being able to properly process unit test code is not a satisfactory
solution.

Undefining _GNU_SOURCE for unit test code could work around the problem
(musl libc's <sched.h> only defines the prototypes for calloc() and
free() when _GNU_SOURCE is defined), but doing that could introduce
discrepancies for unit tests including entire *.c files, so it is also
not a good solution.

All in all, including <sched.h> before <cmocka.h> for all affected unit
tests seems to be the most benign way of working around this musl libc
quirk.  While quite an ugly solution, it achieves our goals here, which
are to keep the benefit of proper static analysis of unit test code and
to fix compilation against musl libc.

(cherry picked from commit 59528d0e9d)
2019-07-30 21:25:30 +02:00
Evan Hunt
326349228a fix a bug that could cause an assert when configuring "geoip continent"
- incidentally fixed some typos in log messages
2019-07-25 15:55:00 -04:00
Ondřej Surý
16610d5477 Fix the lib/dns/tests/Makefile.in to work without LD_WRAP
(cherry picked from commit b558346437)
2019-07-23 09:06:12 -04:00
Mark Andrews
2524d76133 named-checkconf failed to report dnstap-output missing
from named.conf when dnstap was specified

(cherry picked from commit a4f38bec6a)
2019-07-23 21:09:34 +10:00
Evan Hunt
b8e6b68d88 Make the symbol wrapping work with dynamic linking
When the unit test is linked with dynamic libraries, the wrapping
doesn't occur, probably because it's different translation unit.

To workaround the issue, we provide thin wrappers with *real* symbol
names that just call the mocked functions.

(cherry picked from commit 839ed7894b)
2019-07-22 17:20:19 -04:00
Ondřej Surý
6ba4b02d67 Fix the configure.ac and Makefile.in to correctly test for --wrap
(cherry picked from commit 135519e59a)
2019-07-22 17:19:51 -04:00
Mark Andrews
4e63bacc04 Do not attempt to perform a DNS64 rewrite if RPZ returns NODATA.
(cherry picked from commit 1eb640049c)
2019-07-23 05:10:41 +10:00
Ondřej Surý
196b342bc9 Add new default siphash24 cookie algorithm
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.  The change doesn't make the SipHash 2-4 to be the default algorithm, this
is up to the operator.
2019-07-21 17:30:53 -04:00
Ondřej Surý
84ff6a6963 Revise the Windows section of <isc/endian.h>
Add a comment and remove redundant definitions.
2019-07-21 15:37:22 -04:00
Ondřej Surý
c727a31eab 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-07-21 15:37:22 -04:00
Ondřej Surý
a98c7408fc 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-07-21 15:37:22 -04:00
Ondřej Surý
5b0f81e549 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-07-21 15:37:22 -04:00
Ondřej Surý
973d2991a0 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-07-21 15:37:22 -04:00