Commit graph

11958 commits

Author SHA1 Message Date
Mark Andrews
ebc43d8d66 remove duplicate #includes
(cherry picked from commit 848c1c8b8b)
2019-12-23 08:20:35 +11:00
Mark Andrews
171f2ab8d6 revert d10fbdec for lib/dns/gen.c as it is a build platform executable
(cherry picked from commit 7278f2529a)
2019-12-23 08:20:35 +11:00
Mark Andrews
7f04f2f252 Refactor loop body as copy_non_dnssec_records.
(cherry picked from commit d26e125438)
2019-12-20 22:05:24 +11:00
Ondřej Surý
364f232da8 Add failure handling when iterators don't end with ISC_R_NOMORE
(cherry picked from commit bff83b9480)
2019-12-20 22:02:32 +11:00
Ondřej Surý
a2cf6090b2 Refactor receive_secure_db to make the variables and code flow around the iterator more local
(cherry picked from commit 6012479419)
2019-12-20 22:02:32 +11:00
Mark Andrews
37567e0106 Call dns_dbiterator_destroy earlier to prevent potential deadlock.
(cherry picked from commit 9d8f9cc8f2)
2019-12-20 22:02:32 +11:00
Ondřej Surý
f42d1be5fa Change the (acl)->node_count macro to dns_acl_node_count(acl) macro to clean the global namespace
(cherry picked from commit 8120088ec7)
2019-12-18 11:11:31 +11:00
Ondřej Surý
8eac1d365d Ensure all zone_settimer() calls are done on locked zone
(cherry picked from commit cf48e8eb32)
2019-12-12 16:12:51 +01:00
Mark Andrews
02874aa472 make resolver->zspill atomic to prevent potential deadlock
(cherry picked from commit 62abb6aa82)
2019-12-12 20:22:22 +11:00
Tinderbox User
84e68460cc prep 9.14.9 2019-12-12 06:09:19 +00:00
Mark Andrews
e40c1582d6 Note bucket lock requirements and move REQUIRE inside locked section.
(cherry picked from commit 13aaeaa06f)
2019-12-11 11:01:59 +11:00
Mark Andrews
0de313fff7 lock access to fctx->nqueries
(cherry picked from commit 5589748eca)
2019-12-11 11:01:59 +11:00
Mark Andrews
8bd8ed26ed address deadlock introduced in cd2469d3cd
(cherry picked from commit fd52417f71)
2019-12-10 23:38:53 +11:00
Mark Andrews
e9704327c4 r/w of rbtdb->current_version requires that rbtdb->lock be held
(cherry picked from commit cd2469d3cd)
2019-12-03 09:09:52 +00:00
Mark Andrews
d0796289dc Assign fctx->client when fctx is created rather when the join happens.
This prevents races on fctx->client whenever a new fetch joins a existing
fetch (by calling fctx_join) as it is now invariant for the active life of
fctx.

(cherry picked from commit 9ca6ad6311)
2019-12-03 17:00:02 +11:00
Mark Andrews
7e66602cd6 back port atomic and / or support 2019-12-03 11:38:06 +11:00
Mark Andrews
c712f40676 Make fctx->attributes atomic.
FCTX_ATTR_SHUTTINGDOWN needs to be set and tested while holding the node
lock but the rest of the attributes don't as they are task locked. Making
fctx->attributes atomic allows both behaviours without races.

(cherry picked from commit 912ce87479)
2019-12-03 10:52:02 +11:00
Mark Andrews
1a7b62916c rdataset_setownercase and rdataset_getownercase need to obtain a node lock
(cherry picked from commit 637b2c4e51)
2019-11-29 07:12:44 +11:00
Mark Andrews
da0fb0fdc0 add comments 'tree_lock(write) must be held'
(cherry picked from commit 8f6aaa7230)
2019-11-27 21:59:19 +11:00
Mark Andrews
e53af115da rbtnode->nsec needs to be read while holding the tree lock
(cherry picked from commit 7cad3b2e91)
2019-11-27 21:59:18 +11:00
Evan Hunt
d445121c26 add a stats counter for clients dropped due to recursive-clients limit
(cherry picked from commit 715afa9c57)
2019-11-26 11:20:12 -08:00
Mark Andrews
d53ce94d36 move maxbuffers test to allocate_udp_buffer
(cherry picked from commit 26a93d77aa)
2019-11-26 11:53:19 +11:00
Mark Andrews
25306ea1ad Lock dispatch manager buffer_lock before accessing buffers;
Only test buffers for UDP dispatches.

(cherry picked from commit 011af4de71)
2019-11-26 11:53:19 +11:00
Mark Andrews
fbcf160346 lock disp->mgr before reading disp->mgr->buffers
(cherry picked from commit afc7389ce8)
2019-11-26 11:53:19 +11:00
Mark Andrews
e99156043f lock dispatch before reporting state
(cherry picked from commit 3075445ed6)
2019-11-23 08:25:33 +11:00
Evan Hunt
ff2a28351a BIND 9.14.8
-----BEGIN PGP SIGNATURE-----
 
 iQKTBAABCgB9FiEEMLkz2A/OPZgaLTj7DJm3DvT8uwcFAl3DPEZfFIAAAAAALgAo
 aXNzdWVyLWZwckBub3RhdGlvbnMub3BlbnBncC5maWZ0aGhvcnNlbWFuLm5ldDMw
 QjkzM0Q4MEZDRTNEOTgxQTJEMzhGQjBDOTlCNzBFRjRGQ0JCMDcACgkQDJm3DvT8
 uwegDA/+KanAT7LMyK0WAqIBVtDAt+b0iO3EKviEGUs5M/GT2QUZyUy3nCKLGO4T
 UHi9CaGKgv1DUFG4/PX2CqJLZqVTFneaZ8P4Q402A9I16K9pWHfNeMnTtv5omjbw
 LQzWIn7KEeNdoZzVUDfachVM1kb0DttQBsVAjYW7HxQrBMfJOfB5WZljtAhxZ+42
 Zi3c7EjutP+hB+fDtm95pRwxpKvW/pV6UcvqYNpt0Qq5YyEaYTRuSh6tMgGJPLFY
 yRJbXhkz+xSUXg7W7r+ZJBTR9xlXZemnIT2sM+4bvsXqXtTdlSlsQm6DLDSZJ4G2
 Qoa00ggOriZDMVHMTGYWqKTEZ1izGoxQdo7x3Do7kJMUfCfdA5fBcDLzaX97Gu0o
 h7pruWyZxcGIFfkTwSkX3dbvOrRCJ0hLjq3nPSvWywp4Ysx/zteFM6JKuZ+3zpJx
 cuoGbZReRmf2SDvuihsbKWpTVJ+5VOCbs9aUu0LtMaKKUquYHu/Wa8aBItOeZyP8
 n6QThvM+lQ8f25xwmW+c8CbqGz58Km/Kj+ifdXLUQi7/ru6YR+8vxJJ8a5dXzjjq
 3JsLoVSGfgStxejR2ZUMl/9waZGbRZ1HWnxdODTDjA7DFBlfXO1a2OY7jS8iUj1i
 HSL00s0tKoNBNM0vv4KrRd1ULFaV0L5df4jQIfrq4LGTwbVjmRU=
 =ZGQl
 -----END PGP SIGNATURE-----

Merge tag 'v9_14_8' into merge-v9_14_8
2019-11-20 13:39:46 -08:00
Mark Andrews
637fb4cdb4 use update_recordsandbytes in rbt_datafixer
(cherry picked from commit 7d4d64340e)
2019-11-20 00:59:12 +08:00
Mark Andrews
83ce99a389 always obtain write lock when updating version->{records,bytes}
(cherry picked from commit 0cda448248)
2019-11-20 00:59:12 +08:00
Ondřej Surý
dc8eafee57 lib/dns/resolver.c: Call dns_adb_endudpfetch() only for UDP queries
The dns_adb_beginudpfetch() is called only for UDP queries, but
the dns_adb_endudpfetch() is called for all queries, including
TCP.  This messages the quota counting in adb.c.

(cherry picked from commit a5189eefa5)
2019-11-19 03:48:32 +08:00
Samuel Thibault
1100d198e4 hurd: Fix build
Move PATH_MAX, NAME_MAX, IOV_MAX default definitions to the common
<isc/platform.h>.

(cherry picked from commit d10fbdec84)
2019-11-12 09:27:19 +01:00
Tinderbox User
efee30c516 prep 9.14.8 2019-11-06 21:29:08 +00:00
Witold Kręcicki
68012b2c82 libns: Rename ns_tcpconn refs member to clients 2019-11-06 16:37:13 +01:00
Witold Kręcicki
ea5dae9e25 Limit query pipelining within each TCP connection
Previously, there was no limit to the number of concurrently served
queries over one pipelined TCP connection; an unlimited number of
queries sent over a single TCP connection could have potentially
exhausted the server's resources.
2019-11-06 16:37:13 +01:00
Michał Kępień
ae933dec2c Do not use <sys/sysctl.h> on Linux
glibc 2.30 deprecated the <sys/sysctl.h> header [1].  However, that
header is still used on other Unix-like systems, so only prevent it from
being used on Linux, in order to prevent compiler warnings from being
triggered.

[1] https://sourceware.org/ml/libc-alpha/2019-08/msg00029.html

(cherry picked from commit 65a8b53bd0)
2019-11-06 16:00:02 +01:00
Witold Kręcicki
662d10cba7 Jitter signatures times when adding dynamic records.
When doing regular signing expiry time is jittered to make sure
that the re-signing times are not clumped together. This expands
this behaviour to expiry times of dynamically added records.

When incrementally re-signing a zone use the full jitter range if
the server appears to have been offline for greater than 5 minutes
otherwise use a small jitter range of 3600 seconds.  This will stop
the signatures becoming more clustered if the server has been off
line for a significant period of time (> 5 minutes).

(cherry picked from commit 6b2fd40269)
2019-11-06 15:14:16 +01:00
Ondřej Surý
bc760310cd Avoid an extra atomic_load() call 2019-11-06 11:29:35 +01:00
Diego Fronza
d5cc3ed381 Added TCP high-water statistics variable
This variable will report the maximum number of simultaneous tcp clients
that BIND has served while running.

It can be verified by running rndc status, then inspect "tcp high-water:
count", or by generating statistics file, rndc stats, then inspect the
line with "TCP connection high-water" text.

The tcp-highwater variable is atomically updated based on an existing
tcp-quota system handled in ns/client.c.

(cherry picked from commit 66fe8627de)
2019-11-06 11:26:22 +01:00
Diego Fronza
faf3cbe62d Add functions for collecting high-water counters
Add {isc,ns}_stats_{update_if_greater,get_counter}() functions that
are used to set and collect high-water type of statistics.

(cherry picked from commit a544e2e300)
2019-11-06 11:26:22 +01:00
Diego Fronza
733720a3f2 Change the isc_stat_t type to isc__atomic_statcounter_t
The isc_stat_t type was too similar to isc_stats_t type, so the name was
changed to something more distinguishable.

(cherry picked from commit eb5611a770)
2019-11-06 11:26:22 +01:00
Diego Fronza
02555bb7a5 Change the isc_statscounter_t type from int to C99 int_fast64_t type
For TCP high-water work, we need to keep the used integer types widths
in sync.

Note: int_fast32_t is used on WIN32 platform
(cherry picked from commit 0fc98ef2d5)
2019-11-06 11:26:22 +01:00
Ondřej Surý
1ab5685d25 Describe the polynomial backoff curve used in the quota adjustment
(cherry picked from commit 56ef09c3a1)
2019-11-05 11:06:04 +01:00
Ondřej Surý
027f2c1518 libdns: add missing checks for return values in dnstap unit test
Related scan-build report:

dnstap_test.c:169:2: warning: Value stored to 'result' is never read
        result = dns_test_makeview("test", &view);
        ^        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
dnstap_test.c:193:2: warning: Value stored to 'result' is never read
        result = dns_compress_init(&cctx, -1, dt_mctx);
        ^        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2 warnings generated.

(cherry picked from commit e9acad638e)
2019-11-05 09:49:24 +01:00
Ondřej Surý
72f9846be6 libdns: Change check_dnskey_sigs() return type to void to match the reality how the function is used
(cherry picked from commit 64cf5144a6)
2019-11-05 09:48:51 +01:00
Ondřej Surý
1be8170888 libdns: Remove useless checks for ISC_R_MEMORY, which cannot happen now
(cherry picked from commit 80b55d25de)
2019-11-05 09:48:50 +01:00
Michał Kępień
b2ee3fa0bb Prevent TCP failures from affecting EDNS stats
EDNS mechanisms only apply to DNS over UDP.  Thus, errors encountered
while sending DNS queries over TCP must not influence EDNS timeout
statistics.

(cherry picked from commit fce3c93ea2)
2019-10-31 09:54:23 +01:00
Michał Kępień
61370994fc Prevent query loops for misbehaving servers
If a TCP connection fails while attempting to send a query to a server,
the fetch context will be restarted without marking the target server as
a bad one.  If this happens for a server which:

  - was already marked with the DNS_FETCHOPT_EDNS512 flag,
  - responds to EDNS queries with the UDP payload size set to 512 bytes,
  - does not send response packets larger than 512 bytes,

and the response for the query being sent is larger than 512 byes, then
named will pointlessly alternate between sending UDP queries with EDNS
UDP payload size set to 512 bytes (which are responded to with truncated
answers) and TCP connections until the fetch context retry limit is
reached.  Prevent such query loops by marking the server as bad for a
given fetch context if the advertised EDNS UDP payload size for that
server gets reduced to 512 bytes and it is impossible to reach it using
TCP.

(cherry picked from commit 6cd115994e)
2019-10-31 08:49:09 +01:00
Mark Andrews
cdf114078b Log DNS_R_UNCHANGED from sync_secure_journal() at info level in receive_secure_serial()
(cherry picked from commit 8eb09f3232)
2019-10-30 12:13:01 +11:00
Mark Andrews
85d89c00da accept 0 for dnskey-sig-validity (indicates off)
(cherry picked from commit 20647657f9)
2019-10-25 07:12:03 +11:00
Mark Andrews
c46f4d14f5 check for relationship between dnstap and dnstap-output seperately
(cherry picked from commit c2fcc9f16f)
2019-10-22 08:23:32 +11:00
Tinderbox User
6330f2c6c8 Merge branch 'security-v9_14' into v9_14 2019-10-19 23:34:28 +00:00