Commit Graph

11207 Commits

Author SHA1 Message Date
Mark Andrews
3114ff2346 make FCTX_ATTR_SHUTTINGDOWN a independent bool 2019-12-03 08:51:44 +11:00
Mark Andrews
1c61f129c3 rdataset_setownercase and rdataset_getownercase need to obtain a node lock
(cherry picked from commit 637b2c4e51)
2019-11-29 07:13:04 +11:00
Mark Andrews
449f96c7bb add comments 'tree_lock(write) must be held'
(cherry picked from commit 8f6aaa7230)
2019-11-27 18:06:05 +01:00
Mark Andrews
37f6845980 rbtnode->nsec needs to be read while holding the tree lock
(cherry picked from commit 7cad3b2e91)
2019-11-27 18:06:05 +01:00
Mark Andrews
d74a6a96c3 move maxbuffers test to allocate_udp_buffer
(cherry picked from commit 26a93d77aa)
2019-11-26 11:53:33 +11:00
Mark Andrews
1d928de33e Lock dispatch manager buffer_lock before accessing buffers;
Only test buffers for UDP dispatches.

(cherry picked from commit 011af4de71)
2019-11-26 11:53:33 +11:00
Mark Andrews
dcb21f39b6 lock disp->mgr before reading disp->mgr->buffers
(cherry picked from commit afc7389ce8)
2019-11-26 11:53:33 +11:00
Mark Andrews
9cffeb606a lock dispatch before reporting state
(cherry picked from commit 3075445ed6)
2019-11-23 08:25:47 +11:00
Mark Andrews
9d4f5f88f3 Conditional compilation of lock_callback was inconsistent with
conditional use of the function when forcing BIND to build with
older and unsupported versions of OpenSSL.
2019-11-21 10:59:16 +11:00
Evan Hunt
99203103b7 Merge tag 'v9_11_13' into merge-v9_11_13 2019-11-20 13:43:34 -08:00
Mark Andrews
a64c9fae62 use update_recordsandbytes in rbt_datafixer
(cherry picked from commit 7d4d64340e)
2019-11-20 01:01:52 +08:00
Mark Andrews
cf78ae96e5 always obtain write lock when updating version->{records,bytes}
(cherry picked from commit 0cda448248)
2019-11-20 01:01:51 +08:00
Ondřej Surý
ab4e6c2fe7 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:47 +08:00
Ondřej Surý
d2c86b2159 Internally, use {PATH,NAME}_MAX instead of ISC_DIR_{PATH,NAME}MAX 2019-11-12 09:31:40 +01:00
Samuel Thibault
88061c2acb 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:22:15 +01:00
Tinderbox User
336d24089b prep 9.11.13 2019-11-06 21:26:36 +00:00
Michał Kępień
4876a88fc0 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 21:11:20 +01:00
Ondřej Surý
b154ef1f86 Describe the polynomial backoff curve used in the quota adjustment
(cherry picked from commit 56ef09c3a1)
2019-11-06 20:50:46 +01:00
Witold Kręcicki
bc96d7b3bb 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).

Manually edits: resolve conflicts, replace isc_random_uniform
with isc_random_jitter.

(cherry picked from commit 6b2fd40269)
2019-11-06 16:30:50 +01:00
Ondřej Surý
55b0da1381 Backport isc_quota_getused() function 2019-11-06 12:54:40 +01:00
Ondřej Surý
e8bf3c60f2 Avoid an extra atomic_load() call 2019-11-06 12:54:40 +01:00
Diego Fronza
4ad2ab54cd 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 12:54:40 +01:00
Diego Fronza
5a9c5166ce 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 12:35:33 +01:00
Diego Fronza
e4ebeff0e4 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 12:35:33 +01:00
Ondřej Surý
178f2f8426 Initialize the sockaddr_in and sockaddr_in6 structures
This fixes two scan-build false positives:

context.c:441:23: warning: The left operand of '!=' is a garbage value
                    || sin.sin_port != htons(lwres_udp_port))
                       ~~~~~~~~~~~~ ^
context.c:447:25: warning: The left operand of '!=' is a garbage value
                    || sin6.sin6_port != htons(lwres_udp_port))
                       ~~~~~~~~~~~~~~ ^
2 warnings generated.

The sin and sin6 structures are used as argument to recvfrom call and
they are properly filled by the call.
2019-11-05 23:07:07 +01:00
Ondřej Surý
4e3d0cb7ac Remove a dead assignment
This fixes the following scan-build warning:

zt.c:325:12: warning: Value stored to 'zt' during its initialization is never read
        dns_zt_t *zt = params->zt;
                  ^~   ~~~~~~~~~~
1 warning generated.
2019-11-05 23:07:07 +01:00
Ondřej Surý
12f6a44256 Ensure name count stays positive in remove_nodes()
This fixes a scan-build false-positive:

rbt_test.c:914:8: warning: Assigned value is garbage or undefined
                node %= *names_count;
                     ^  ~~~~~~~~~~~~
1 warning generated.

The remove_nodes() function is always called with correct arguments
(num_names is in <1;*names_count> range), so the modulo by zero cannot
happen, but nevertheless scan-build detects this and it's easy to fix.
2019-11-05 23:07:07 +01:00
Mark Andrews
16ad444207 Record when querytsig is valid
(cherry picked from commit 4938f97c97)

This commit was cherry-picked from v9_14 and it fixes the following
scan-build warnings:

tsig.c:1030:20: warning: Assigned value is garbage or undefined
                        tsig.timesigned = querytsig.timesigned;
                                        ^ ~~~~~~~~~~~~~~~~~~~~
tsig.c:1092:26: warning: The right operand of '<' is a garbage value
                        if (response && bytes < querytsig.siglen)
                                              ^ ~~~~~~~~~~~~~~~~
2 warnings generated.
2019-11-05 23:06:29 +01:00
Ondřej Surý
c1587e8587 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:53:18 +01:00
Ondřej Surý
0c277c7053 libdns: Remove useless checks for ISC_R_MEMORY, which cannot happen now
(cherry picked from commit 80b55d25de)
2019-11-05 09:49:57 +01:00
Michał Kępień
e6dd9db0e4 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:55:06 +01:00
Michał Kępień
a6331686a8 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:50:48 +01:00
Mark Andrews
5a28b235c8 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:38 +11:00
Tinderbox User
5dfdc818d2 Merge branch 'v9_11_12' into v9_11 2019-10-24 05:58:38 +00:00
Mark Andrews
5f67de5b7b check for relationship between dnstap and dnstap-output seperately
(cherry picked from commit c2fcc9f16f)
2019-10-22 10:28:16 +11:00
Michał Kępień
cacba609c7 Suppress cppcheck 1.89 false positive
cppcheck 1.89 emits a false positive for lib/isc/sha1.c:

    lib/isc/sha1.c:273:16: error: Uninitialized variable: block [uninitvar]
     (void)memmove(block, buffer, 64);
                   ^
    lib/isc/sha1.c:272:10: note: Assignment 'block=&workspace', assigned value is <Uninit>
     block = &workspace;
             ^
    lib/isc/sha1.c:273:16: note: Uninitialized variable: block
     (void)memmove(block, buffer, 64);
                   ^

This message started appearing with cppcheck 1.89 [1], but it will be
gone in the next release [2], so just suppress it for the time being.

[1] af214e8212

[2] 2595b82634
2019-10-17 11:13:30 +02:00
Mark Andrews
42f998ee14 Detect partial prefixes / incomplete IPv4 address in acls.
(cherry picked from commit fb87e669fb)
2019-10-14 22:12:16 +11:00
Mark Andrews
d2c51b9c4b Address cppcheck reports
(cherry picked from commit fcebc4f15b)
2019-10-04 14:34:21 +10:00
Ondřej Surý
fc48cdf6a9 lib/lwres/getipnode.c: Resolve possible Null pointer dereference (from Cppcheck) 2019-10-03 14:42:30 +02:00
Ondřej Surý
b06f36a726 lib/isc/include/isc/stdatomic.h: Suppress preprocessorErrorDirective error from Cppcheck 2019-10-03 14:21:47 +02:00
Ondřej Surý
61b3ab76a5 lib/isc/random.c: Suppress preprocessorErrorDirective error from Cppcheck 2019-10-03 14:21:47 +02:00
Ondřej Surý
d26c36a338 Remove randomly scattered additional style check suppressions that caused unmatchedSuppression
(cherry picked from commit a0d3614a60)
2019-10-03 14:21:47 +02:00
Ondřej Surý
99a71e6efa lib/isccfg/parser.c: Fix invalid order of DbC checks that could cause dereference before NULL check
(cherry picked from commit f855f09a55)
2019-10-03 14:21:46 +02:00
Ondřej Surý
d2ca36346f lib/isccfg/aclconf.c: Suppress nullPointerRedundantCheck false positive
(cherry picked from commit 09232213d7)
2019-10-03 14:21:46 +02:00
Ondřej Surý
8f23f39fee lib/isc/unix/socket.c: Suppress preprocessorErrorDirective error from Cppcheck
(cherry picked from commit 026cf2ff4f)
2019-10-03 14:21:46 +02:00
Ondřej Surý
0e8e4c9174 lib/isc/task.c: Fix invalid order of DbC checks that could cause dereference before NULL check
(cherry picked from commit c662969da1)
2019-10-03 14:21:46 +02:00
Ondřej Surý
91999a143d lib/isc/pkc11.c: Fix possible NULL pointer dereference in push_attribute()
(cherry picked from commit e8948fd9b4)
2019-10-03 14:21:46 +02:00
Ondřej Surý
7accb1029f lib/isc/buffer.c: Fix invalid order of DbC checks that could cause dereference before NULL check
(cherry picked from commit e9f30fc211)
2019-10-03 14:21:46 +02:00
Ondřej Surý
1506ad6e76 lib/dns/tsig.c: Suppress Cppcheck false positive error uninitStructMember
(cherry picked from commit 8f2ad12d0a)
2019-10-03 14:21:46 +02:00
Ondřej Surý
49d017aa75 lib/dns/tests/rbt_serialize_test.c: Fix dereference before DbC check
(cherry picked from commit 14c174d921)
2019-10-03 14:21:46 +02:00