Commit Graph
12399 Commits
Author SHA1 Message Date
Witold Kręcicki 0b517735f2 Always enqueue removal after replacement 2020-02-10 10:44:35 +01:00
Witold Kręcicki 3edde4d190 Fixes 2020-02-10 10:44:35 +01:00
Witold Kręcicki 918af04b9d Mark unused memory 2020-02-10 10:44:35 +01:00
Witold Kręcicki 8279b866bc Add some magic checks 2020-02-10 10:44:35 +01:00
Witold Kręcicki ac88ecbbaa Fixes 2020-02-10 10:44:35 +01:00
Witold Kręcicki bb1bd0bcac Revert "Use common isc_time"
This reverts commit 1c5ba6ba8af5fb7e65456ef8b846afdc874b77a2.
2020-02-10 10:44:35 +01:00
Witold Kręcicki d1b608e7a2 Iterator fix 2020-02-10 10:44:35 +01:00
Witold Kręcicki 6d69556eea Use common isc_time 2020-02-10 10:44:35 +01:00
Witold Kręcicki a65d7597a9 Cleanup better 2020-02-10 10:44:35 +01:00
Witold Kręcicki cc0b84e84b More fiddling 2020-02-10 10:44:35 +01:00
Witold Kręcicki 55ce821070 Some fiddling 2020-02-10 10:44:35 +01:00
Witold Kręcicki 6c4447015d Cleaning up 2020-02-10 10:44:35 +01:00
Witold Kręcicki 0209c9f9ac Cleaning up 2020-02-10 10:44:35 +01:00
Witold Kręcicki 56d8a6060b Test: ck_fifo 2020-02-10 10:44:35 +01:00
Witold Kręcicki 2a82f35029 PoC LOWAC 2020-02-10 10:44:35 +01:00
Witold Kręcicki 14a852b86d fixup! Make client resolver tasks pooled and CPU-bound 2020-02-07 11:21:49 +01:00
Witold Kręcicki 30675428d8 Fix a race in isc_socket destruction.
There was a very slim chance of a race between isc_socket_detach and
process_fd: isc_socket_detach decrements references to 0, and before it
calls destroy gets preempted. Second thread calls process_fd, increments
socket references temporarily to 1, and then gets preempted, first thread
then hits assertion in destroy() as the reference counter is now 1 and
not 0.
2020-02-07 08:42:02 +01:00
Witold Kręcicki 16dd6d8068 Use ISC_SOCKET_MAXSOCKETS at 64k no matter what the tuning would be, those affect only the recursion now 2020-02-07 08:41:53 +01:00
Witold Kręcicki 46fe61d359 Add an arena to compressctx 2020-02-07 08:41:53 +01:00
Witold Kręcicki 9fda4a4cbf Remove some stale fields from ns_client_t; make sendbuf allocated on heap 2020-02-07 08:40:25 +01:00
Witold Kręcicki e80ac06ed4 Don't update LRU if the node was recently used.
Updating LRU requires write-locking the node, which causes contention.
Update LRU only if time difference is large enough.
2020-02-07 08:40:25 +01:00
Witold Kręcicki aaa13532c2 Use libuv-provided uv_{export,import} if available 2020-02-07 08:40:25 +01:00
Witold Kręcicki 91d5c3313c Bucketed statistics.
Even though statistics are lockless they still use atomics which
might cause contention. Split stats counters into buckets, sharded
by an artificial thread identifier, to increase throughput.
2020-02-07 08:40:25 +01:00
Witold Kręcicki a1b6eae847 Don't enable NS_CLIENT_TRACE by default 2020-02-07 08:40:25 +01:00
Witold Kręcicki efc2a21590 Increase inactivehandles and inactivereqs size for better reuse. 2020-02-07 08:40:25 +01:00
Witold Kręcicki 0a21285b11 We don't need to fill udp local address every time since we are bound to it. 2020-02-07 08:40:25 +01:00
Witold Kręcicki 2985bcd7ef Make nm->recvbuf larger and heap allocated, to allow uv_recvmmsg usage. 2020-02-07 08:40:25 +01:00
Witold Kręcicki caf309a80f Fix atomics usage for mutexatomics 2020-02-07 08:40:25 +01:00
Witold Kręcicki 85a3cc6ffa Disable OpenSSL siphash.
Creation of EVP_MD_CTX and EVP_PKEY is quite expensive, until
we fix the code to reuse the context and key we'll use our own
implementation of siphash.
2020-02-07 08:40:25 +01:00
Witold Kręcicki 235c3e8685 Use the original threadid when sending a UDP packet to decrease probability of context switching 2020-02-07 08:40:25 +01:00
Witold Kręcicki 666b0f7564 Make client resolver tasks pooled and CPU-bound 2020-02-07 08:40:25 +01:00
Witold Kręcicki bcb55107ac Make isc_task_pause/isc_task_unpause thread safe.
isc_task_pause/unpause were inherently thread-unsafe - a task
could be paused only once by one thread, if the task was running
while we paused it it led to races. Fix it by making sure that
the task will pause if requested to, and by using a 'pause reference
counter' to count task pause requests - a task will be unpaused
iff all threads unpause it.

Don't remove from queue when pausing task - we lock the queue lock
(expensive), while it's unlikely that the task will be running -
and we'll remove it anyway in dispatcher
2020-02-07 08:40:25 +01:00
Witold Kręcicki b5afff59c2 Increase nodelock count for both cache and regular db. 2020-02-07 08:40:25 +01:00
Witold Kręcicki 79fc0e3f01 Use isc_rwlock for isc_result tables 2020-02-07 08:40:25 +01:00
Witold Kręcicki b21e515e1b Make ns_client mctxpool more thread-friendly by sharding it by netmgr threadid 2020-02-07 08:40:24 +01:00
Witold Kręcicki b42ac28eb1 Don't check if the client is on recursing list (requires locking) if it's not RECURSING 2020-02-07 08:40:24 +01:00
Matthijs Mekking e6c5ecd698 Update kasp test with CDNSKEY checks
Add checks to the kasp system test to verify CDNSKEY publication.
This test is not entirely complete, because when there is a CDNSKEY
available but there should not be one for KEY N, it is hard to tell
whether the existing CDNSKEY actually belongs to KEY N or another
key.

The check works if we expect a CDNSKEY although we cannot guarantee
that the CDNSKEY is correct: The test verifies existence, not
correctness of the record.
2020-02-06 11:02:22 +01:00
Matthijs Mekking a9a9aa7fd8 Add parentheses around return values 2020-02-06 10:17:22 +01:00
Matthijs Mekking b378d0371f Fix kasp bug new KSK on restart [#1593]
When you do a restart or reconfig of named, or rndc loadkeys, this
triggers the key manager to run.  The key manager will check if new
keys need to be created. If there is an active key, and key rollover
is scheduled far enough away, no new key needs to be created.

However, there was a bug that when you just start to sign your zone,
it takes a while before the KSK becomes an active key. An active KSK
has its DS submitted or published, but before the key manager allows
that, the DNSKEY needs to be omnipresent. If you restart named
or rndc loadkeys in quick succession when you just started to sign
your zone, new keys will be created because the KSK is not yet
considered active.

Fix is to check for introducing as well as active keys. These keys
all have in common that their goal is to become omnipresent.
2020-02-06 10:17:22 +01:00
Michal Nowak 7f0fcb8a3e Windows: Prevent tools from clashing with named in system tests
In system tests on Windows tool's local port can sometimes clash with
'named'. On Unix the system is poked for the minimal local port,
otherwise is set to 32768 as a sane minimum. For Windows we don't
poke but set a hardcoded limit; this change aligns the limit with
Unix and changes it to 32768.
2020-02-05 10:03:09 +00:00
Mark Andrews fccf65a585 'dctx' must be non NULL, remove test.
1549 cleanup:
1550        if (dctx->dbiter != NULL)
1551                dns_dbiterator_destroy(&dctx->dbiter);
1552        if (dctx->db != NULL)
1553                dns_db_detach(&dctx->db);

	CID 1452686 (#1 of 1): Dereference before null check (REVERSE_INULL)
	check_after_deref: Null-checking dctx suggests that it may
	be null, but it has already been dereferenced on all paths
	leading to the check.

1554        if (dctx != NULL)
1555                isc_mem_put(mctx, dctx, sizeof(*dctx));
2020-02-05 18:37:17 +11:00
Mark Andrews 7ba1af0280 'lcfg' must be non NULL, remove test.
389        else

	CID 1452695 (#1 of 1): Dereference before null check (REVERSE_INULL)
	check_after_deref: Null-checking lcfg suggests that it may
	be null, but it has already been dereferenced on all paths
	leading to the check.

390                if (lcfg != NULL)
391                        isc_logconfig_destroy(&lcfg);
2020-02-05 18:37:17 +11:00
Mark Andrews 0312e73e16 'closest' must be non NULL, remove test.
6412 cleanup:
6413        dns_rdataset_disassociate(&neg);
6414        dns_rdataset_disassociate(&negsig);

	CID 1452700 (#1 of 1): Dereference before null check (REVERSE_INULL)
	check_after_deref: Null-checking closest suggests that it
	may be null, but it has already been dereferenced on all
	paths leading to the check.

6415        if (closest != NULL)
6416                free_noqname(mctx, &closest);
2020-02-05 18:37:17 +11:00
Mark Andrews 2e189bb053 'stub' cannot be non NULL, remove test.
13429 cleanup:
13430        cancel_refresh(zone);

	CID 1452702 (#1 of 1): Dereference before null check (REVERSE_INULL)
	check_after_deref: Null-checking stub suggests that it may
	be null, but it has already been dereferenced on all paths
	leading to the check.

13431        if (stub != NULL) {
13432                stub->magic = 0;
2020-02-05 18:37:17 +11:00
Mark Andrews 1b1a94ea6d 'noqname' must be non NULL, remove test.
6367cleanup:
6368        dns_rdataset_disassociate(&neg);
6369        dns_rdataset_disassociate(&negsig);

	CID 1452704 (#1 of 1): Dereference before null check
	(REVERSE_INULL) check_after_deref: Null-checking noqname
	suggests that it may be null, but it has already been
	dereferenced on all paths leading to the check.

6370        if (noqname != NULL)
6371                free_noqname(mctx, &noqname);
2020-02-05 18:37:17 +11:00
Mark Andrews e4d08c0232 'event' must be non NULL, remove test.
1401        }

	CID 1453455 (#1 of 1): Dereference before null check (REVERSE_INULL)
	check_after_deref: Null-checking event suggests that it may be null,
	but it has already been dereferenced on all paths leading to the check.

1402        if (event != NULL)
1403                isc_event_free(ISC_EVENT_PTR(&event));
2020-02-05 18:37:17 +11:00
Mark Andrews 1efc7550a3 keymgr_keyrole couldn't emit "NOSIGN".
92        } else {
 93                return ("ZSK");
 94        }

	CID 1455900 (#1 of 1): Structurally dead code (UNREACHABLE)
	unreachable: This code cannot be reached: return "NOSIGN";.

 95        return ("NOSIGN");
2020-02-05 18:37:17 +11:00
Mark Andrews 5fc9efba30 Remove dead error code.
128        return (ISC_R_SUCCESS);
129

	CID 1456146 (#1 of 1): Structurally dead code (UNREACHABLE)
	unreachable: This code cannot be reached: {
	   if (dst->labels[i] != N....

130        do {
2020-02-05 18:37:17 +11:00
Mark Andrews aa101260d9 'indentctx' is always defined. Just use it.
402        ctx->serve_stale_ttl = 0;

	notnull: At condition indentctx, the value of indentctx
	cannot be NULL.  dead_error_condition: The condition indentctx
	must be true.

	CID 1456147 (#1 of 1): Logically dead code (DEADCODE)
	dead_error_line: Execution cannot reach the expression
	default_indent inside this statement: ctx->indent = (indentctx
	? ....

403        ctx->indent = indentctx ? *indentctx : default_indent;
2020-02-05 18:37:17 +11:00
Mark Andrews 0be2dc9f22 break was on wrong line.
959                break;

	CID 1457872 (#1 of 1): Structurally dead code (UNREACHABLE)
	unreachable: This code cannot be reached:
	isc__nm_incstats(sock->mgr,....

 960                isc__nm_incstats(sock->mgr, sock->statsindex[STATID_ACTIVE]);
 961        default:
2020-02-05 18:37:17 +11:00