]> git.ipfire.org Git - thirdparty/knot-resolver.git/log
thirdparty/knot-resolver.git
4 years agoMerge branch 'aur-cleanup' into 'master' obs-knot-dns-deve-jq0xxt/deployments/1146 obs-knot-resolver-es11k1/deployments/1147 70228
Tomas Krizek [Thu, 8 Oct 2020 12:41:43 +0000 (14:41 +0200)] 
Merge branch 'aur-cleanup' into 'master'

distro/arch: cleanup

See merge request knot/knot-resolver!1071

4 years agodistro/arch: nitpicks
Tomas Krizek [Mon, 5 Oct 2020 14:33:09 +0000 (16:33 +0200)] 
distro/arch: nitpicks

4 years agodistro/arch: remove upgrade script
Tomas Krizek [Mon, 5 Oct 2020 14:18:24 +0000 (16:18 +0200)] 
distro/arch: remove upgrade script

Arch is a fast moving rolling release and users expect to upgrade
their configs. The migration period over 6 months is certainly
sufficient - remove this hard to read convoluted code.

4 years agoMerge branch 'doc-typo-fixes' into 'master'
Tomas Krizek [Thu, 8 Oct 2020 12:06:54 +0000 (14:06 +0200)] 
Merge branch 'doc-typo-fixes' into 'master'

doc: small fixes

See merge request knot/knot-resolver!1076

4 years agodoc: typo in upgrade guide
Vasek Sraier [Thu, 8 Oct 2020 11:24:47 +0000 (13:24 +0200)] 
doc: typo in upgrade guide

4 years agopolicy: changed example domain in documentation
Vasek Sraier [Thu, 8 Oct 2020 11:24:22 +0000 (13:24 +0200)] 
policy: changed example domain in documentation

4 years agoMerge branch 'doc-versions' into 'master'
Tomas Krizek [Thu, 8 Oct 2020 10:39:05 +0000 (12:39 +0200)] 
Merge branch 'doc-versions' into 'master'

doc: document what version number means

See merge request knot/knot-resolver!1075

4 years agodoc: document what version number means
Petr Špaček [Wed, 7 Oct 2020 14:02:51 +0000 (16:02 +0200)] 
doc: document what version number means

Result of discussion in MR
https://gitlab.nic.cz/knot/knot-resolver/-/merge_requests/1075

4 years agoMerge branch 'fragmentation' into 'master'
Lukas Jezek [Thu, 8 Oct 2020 10:03:16 +0000 (12:03 +0200)] 
Merge branch 'fragmentation' into 'master'

daemon/io: avoid PMTU discovery for IPv4 server side

See merge request knot/knot-resolver!1061

4 years agodaemon/io: avoid PMTU discovery for IPv4 server side
Vladimír Čunát [Tue, 15 Sep 2020 08:57:37 +0000 (10:57 +0200)] 
daemon/io: avoid PMTU discovery for IPv4 server side

This seems generally considered to be a good thing (for DNS servers).
We don't do it on client side; I can't see an easy way there.

4 years agoMerge branch 'assert-stash_rrset' into 'master' obs-knot-dns-deve-jq0xxt/deployments/1145 obs-knot-resolver-es11k1/deployments/1144
Petr Špaček [Wed, 7 Oct 2020 15:03:24 +0000 (17:03 +0200)] 
Merge branch 'assert-stash_rrset' into 'master'

validator: avoid using RRSIG from a different packet

See merge request knot/knot-resolver!1072

4 years agovalidator: avoid using RRSIG from a different packet
Vladimír Čunát [Tue, 6 Oct 2020 07:15:43 +0000 (09:15 +0200)] 
validator: avoid using RRSIG from a different packet

Restrict tried RRSIGs by qry_uid equality.
I see no use case against and it could be confusing.
(Also rewrite the conditions around to positive form.)

An assertion in cache noticed an NSEC with _SECURE rank but no RRSIG
(in practice).  It was a side-effect of still not keeping RRSIGs with
their RRs in some places.  It wasn't a security problem, as it doesn't
really matter where the signatures came from.  Theoretically it
might've lead to incorrect caching (missing usable RRSIGs), as cache
was restricting qry_uid to match, but that hasn't been noticed
in practice.

4 years agoMerge branch 'nitpick-cleanup' into 'master'
Petr Špaček [Wed, 7 Oct 2020 08:44:51 +0000 (10:44 +0200)] 
Merge branch 'nitpick-cleanup' into 'master'

contrib/cleanup: fix _cleanup_close

See merge request knot/knot-resolver!1074

4 years agocontrib/cleanup: be more correct
Vladimír Čunát [Wed, 7 Oct 2020 07:51:16 +0000 (09:51 +0200)] 
contrib/cleanup: be more correct

It's mainly about the fact that FD can be zero (though it's not common).
Our current usage is just in tests and seems fine.

I don't think that other negative FDs are possible, but I'm lazy to find
"proof" in POSIX and using other negative values than -1 doesn't make
sense to me anyway (might be an assert, I guess).

4 years agoMerge branch 'meson-skip-77' into 'master' obs-knot-dns-deve-jq0xxt/deployments/1134 obs-knot-dns-deve-jq0xxt/deployments/1137 obs-knot-dns-deve-jq0xxt/deployments/1138 obs-knot-dns-deve-jq0xxt/deployments/1140 obs-knot-dns-deve-jq0xxt/deployments/1143 obs-knot-resolver-es11k1/deployments/1135 obs-knot-resolver-es11k1/deployments/1136 obs-knot-resolver-es11k1/deployments/1139 obs-knot-resolver-es11k1/deployments/1141 obs-knot-resolver-es11k1/deployments/1142
Petr Špaček [Fri, 2 Oct 2020 12:19:29 +0000 (14:19 +0200)] 
Merge branch 'meson-skip-77' into 'master'

meson: mark skipped config tests as skipped

See merge request knot/knot-resolver!1067

4 years agomeson: mark skipped config tests as skipped
Tomas Krizek [Thu, 1 Oct 2020 13:04:48 +0000 (15:04 +0200)] 
meson: mark skipped config tests as skipped

Using exit code 77 lets meson know to classify tests as skipped instead
of failed or passed.

Works since meson 0.37.

https://mesonbuild.com/Unit-tests.html#skipped-tests-and-hard-errors

4 years agoMerge branch 'doh-endpoint-dns-query' into 'master'
Petr Špaček [Fri, 2 Oct 2020 12:13:00 +0000 (14:13 +0200)] 
Merge branch 'doh-endpoint-dns-query' into 'master'

modules/http: answer to /dns-query endpoint as well

See merge request knot/knot-resolver!1069

4 years agomodules/http: answer to /dns-query endpoint as well
Tomas Krizek [Fri, 2 Oct 2020 11:04:01 +0000 (13:04 +0200)] 
modules/http: answer to /dns-query endpoint as well

When using DoH, it seems /dns-query is a more common convetion for
an endpoint name. Let's use it in addition to /doh, since it doesn't
hurt anything and makes kresd more alike the other DoH implementations
out there. It'll also play more nicely with kdig, which uses /dns-query
as default as well.

4 years agoMerge branch 'disable-clang-warning' into 'master'
Petr Špaček [Fri, 2 Oct 2020 11:02:34 +0000 (13:02 +0200)] 
Merge branch 'disable-clang-warning' into 'master'

clang: silence useless warning in lib/layer.h

See merge request knot/knot-resolver!1068

4 years agoclang: silence useless warning in lib/layer.h
Tomas Krizek [Fri, 2 Oct 2020 08:23:40 +0000 (10:23 +0200)] 
clang: silence useless warning in lib/layer.h

This silences the following warning, which frequently appears in Travis
CI.

./lib/layer.h:51:21: warning: result of comparison of constant 32 with
expression of type 'enum kr_layer_state' is always true
[-Wtautological-constant-out-of-range-compare]
        return s >= 0 && s < (1 << 5);
                         ~ ^ ~~~~~~~~

4 years agoMerge !1011: tty: buffer incomplete command from previous syscall
Vladimír Čunát [Fri, 2 Oct 2020 07:53:26 +0000 (09:53 +0200)] 
Merge !1011: tty: buffer incomplete command from previous syscall

4 years agodaemon/io_tty_process_input: add a few comments
Vladimír Čunát [Thu, 17 Sep 2020 09:14:50 +0000 (11:14 +0200)] 
daemon/io_tty_process_input: add a few comments

4 years agodaemon/io_tty_process_input: remove a special case
Vladimír Čunát [Wed, 16 Sep 2020 11:10:44 +0000 (13:10 +0200)] 
daemon/io_tty_process_input: remove a special case

After changes in this MR, sending an empty newline evaluates in lua
as nil, and that seems fine.  Let's drop this piece of code;
it was broken now anyway (incorrect `io_mode_text` part).

4 years agodaemon/io_tty_process_input: simplify looping logic
Vladimír Čunát [Wed, 16 Sep 2020 10:49:50 +0000 (12:49 +0200)] 
daemon/io_tty_process_input: simplify looping logic

4 years agodaemon/io_tty_process_input: utilize auto_free
Vladimír Čunát [Wed, 16 Sep 2020 10:40:31 +0000 (12:40 +0200)] 
daemon/io_tty_process_input: utilize auto_free

4 years agodaemon/io_tty_process_input: reduce nesting depth
Vladimír Čunát [Wed, 16 Sep 2020 09:42:06 +0000 (11:42 +0200)] 
daemon/io_tty_process_input: reduce nesting depth

No other change, for clarity.

4 years agodaemon/io tty: use more proper uv_ type
Vladimír Čunát [Tue, 15 Sep 2020 16:06:02 +0000 (18:06 +0200)] 
daemon/io tty: use more proper uv_ type

These are not TCP connections.  It has worked fine so far, but...

4 years agodaemon/io: don't expose io_stream_* types
Vladimír Čunát [Tue, 15 Sep 2020 12:20:35 +0000 (14:20 +0200)] 
daemon/io: don't expose io_stream_* types

We don't need them anywhere, so let's keep their scope small.

4 years agodaemon/lua: tests for control socket
Petr Špaček [Tue, 30 Jun 2020 14:58:22 +0000 (16:58 +0200)] 
daemon/lua: tests for control socket

4 years agodaemon/io: Buffer incomplete command from previous syscall
Lukáš Ježek [Tue, 16 Jun 2020 08:26:53 +0000 (10:26 +0200)] 
daemon/io: Buffer incomplete command from previous syscall

vcunat change some parts of this, mainly around memory allocation.

4 years agodaemon/io: save tty mode as local process state
Lukáš Ježek [Thu, 23 Apr 2020 06:53:04 +0000 (08:53 +0200)] 
daemon/io: save tty mode as local process state

4 years agoMerge branch 'ci-obs-retry' into 'master' obs-knot-dns-deve-jq0xxt/deployments/1132 obs-knot-resolver-es11k1/deployments/1133
Tomas Krizek [Thu, 1 Oct 2020 12:58:48 +0000 (14:58 +0200)] 
Merge branch 'ci-obs-retry' into 'master'

ci: re-try OBS distrotests

See merge request knot/knot-resolver!1066

4 years agoci: re-try OBS distrotests
Tomas Krizek [Tue, 29 Sep 2020 10:15:31 +0000 (12:15 +0200)] 
ci: re-try OBS distrotests

Often, the VM fails to boot (even twice in the row, as already handled
by the test itself) which leads to false negative result.

These nightly tests fail far too often (at least on of the ~7 tests) and
generate annoying notifications.

Adding yet another layer of retries should reduce the number of false
negatives without diminishing the value of the test (since the real
packaging issues are 100 % reproducible).

4 years agoMerge branch 'ci_deckard_fix' into 'master' obs-knot-dns-deve-jq0xxt/deployments/1120 obs-knot-dns-deve-jq0xxt/deployments/1123 obs-knot-dns-deve-jq0xxt/deployments/1125 obs-knot-dns-deve-jq0xxt/deployments/1126 obs-knot-dns-deve-jq0xxt/deployments/1129 obs-knot-dns-deve-jq0xxt/deployments/1130 obs-knot-resolver-es11k1/deployments/1121 obs-knot-resolver-es11k1/deployments/1122 obs-knot-resolver-es11k1/deployments/1124 obs-knot-resolver-es11k1/deployments/1127 obs-knot-resolver-es11k1/deployments/1128 obs-knot-resolver-es11k1/deployments/1131
Tomas Krizek [Fri, 25 Sep 2020 14:07:12 +0000 (16:07 +0200)] 
Merge branch 'ci_deckard_fix' into 'master'

ci: fix Deckard integration so it throws errors up the stack

Closes #611

See merge request knot/knot-resolver!1065

4 years agoci: fix Deckard integration so it throws errors up the stack
Petr Špaček [Fri, 25 Sep 2020 12:58:06 +0000 (14:58 +0200)] 
ci: fix Deckard integration so it throws errors up the stack

Fixes: #611
4 years agoMerge branch 'ci-dag-ta' into 'master' obs-knot-dns-deve-jq0xxt/deployments/1116 obs-knot-resolver-es11k1/deployments/1117
Petr Špaček [Thu, 24 Sep 2020 06:56:02 +0000 (08:56 +0200)] 
Merge branch 'ci-dag-ta' into 'master'

ci: use DAG & clenaup

See merge request knot/knot-resolver!1064

4 years agoci: refactor dependencies using DAG
Tomas Krizek [Wed, 23 Sep 2020 13:20:03 +0000 (15:20 +0200)] 
ci: refactor dependencies using DAG

Use DAG dependencies to allow more precise control when a test
suite should be executed. It also enabled use of more descriptive
pipeline stages.

4 years agoci: disable deckard tests for forks
Tomas Krizek [Wed, 23 Sep 2020 11:53:55 +0000 (13:53 +0200)] 
ci: disable deckard tests for forks

4 years agoci: remove duplicate non-functioning packaging tests
Tomas Krizek [Wed, 23 Sep 2020 11:47:46 +0000 (13:47 +0200)] 
ci: remove duplicate non-functioning packaging tests

These tests are currently failing and since they're sort of
duplicate, and we want to get rid of them anyway, I'm removing
them from CI.

Related #612

4 years agoci: remove obsolete Turris build
Tomas Krizek [Wed, 23 Sep 2020 11:44:16 +0000 (13:44 +0200)] 
ci: remove obsolete Turris build

The turris build was never migrated to support meson and these
files have been obsolete for far too long now.

4 years agoci: don't run ta_update after build
Tomas Krizek [Wed, 23 Sep 2020 11:32:21 +0000 (13:32 +0200)] 
ci: don't run ta_update after build

This test fails far too often due to conditions inside the CI
environment. This test is already executed in test:valgrind without
paralelism, so let's keep it there instead.

4 years agoMerge branch 'worker-submit-cleanup' into 'master' obs-knot-dns-deve-jq0xxt/deployments/1115 obs-knot-resolver-es11k1/deployments/1114
Tomas Krizek [Wed, 23 Sep 2020 12:28:18 +0000 (14:28 +0200)] 
Merge branch 'worker-submit-cleanup' into 'master'

daemon/worker and daemon/session cleanup

See merge request knot/knot-resolver!1058

4 years agodaemon/session: use common naming convention in the entire file
Tomas Krizek [Thu, 13 Aug 2020 14:34:24 +0000 (16:34 +0200)] 
daemon/session: use common naming convention in the entire file

Rename "s" to "session" to be consistent with all the other
session_*() functions to make it easier to read.

4 years agodaemon/worker: simplify err handling in worker_submit()
Tomas Krizek [Tue, 8 Sep 2020 08:42:03 +0000 (10:42 +0200)] 
daemon/worker: simplify err handling in worker_submit()

If pkt was NULL, the function would return error from parse_packet(),
which would then have no effect besides returning an error code from
worker_submit(). There were also needless checks that pkt is indeed
not NULL in cases where it was no longer possible for it to be so.

This also removes assert(false) statements and simply return an error.

4 years agodaemon/worker: use proper name for packet in worker_submit()
Tomas Krizek [Tue, 8 Sep 2020 08:28:51 +0000 (10:28 +0200)] 
daemon/worker: use proper name for packet in worker_submit()

The variable name query is misleading, since the passed in packet
can actually be a response as well (or a malformed packet).

4 years agodaemon/io: don't notify worker on udp_recv() errors
Tomas Krizek [Wed, 26 Aug 2020 11:13:51 +0000 (13:13 +0200)] 
daemon/io: don't notify worker on udp_recv() errors

The action doesn't increase any counter or do any error handling.
It would simply SEGFAULT. Even if it didn't worker_submit() would
just return an error code.

4 years agoMerge branch 'wirebuf-ioerror' into 'master'
Tomas Krizek [Wed, 23 Sep 2020 11:07:46 +0000 (13:07 +0200)] 
Merge branch 'wirebuf-ioerror' into 'master'

daemon: handle IO error when processing wire buffer

See merge request knot/knot-resolver!1054

4 years agodaemon/worker: fix connection teardown in tls_hs_cb()
Tomas Krizek [Fri, 4 Sep 2020 10:47:54 +0000 (12:47 +0200)] 
daemon/worker: fix connection teardown in tls_hs_cb()

Ensure both tasklist and waitinglist is always cleared when tearing down
connection (otherwise the session close will fail on assert).

The previous assert could be triggered when the while loop in the code
above would successfuly perform qr_task_send() for one of the
tasks in waitinglist and then fail on a subsequent one.

4 years agodaemon: handle IO error when processing wire buffer
Tomas Krizek [Thu, 3 Sep 2020 11:10:04 +0000 (13:10 +0200)] 
daemon: handle IO error when processing wire buffer

This fixes the following assert:
daemon/worker.c:1157: qr_task_finalize: Assertion `!session_flags(source_session)->closing' failed.

Scenario which leads to the above error:
1. We're using a stateful protocol.
2. Enough data arrive in a single tcp_recv() call to put at least
   two queries into the session's wire buffer.
3. session_wirebuf_process() calls worker_submit() which calls
   qr_task_step().
4. In the qr_task_step() the query state changes to KR_STATE_DONE,
   then qr_task_finalize() is called.
5. qr_task_send() is called, but it fails. This is where
   qr_task_finalize() closes the session, but used to return no error.
6. When the next query is processed in session_wirebuf_process(),
   steps 3 and 4 are followed and qr_task_finalize() is called.
7. Since the session is already closed, the assert is triggered.

Debugging this was a lot of fun... All hail the rr debugger!

4 years agoMerge branch 'ci-update-knot3.0' into 'master' obs-knot-dns-deve-jq0xxt/deployments/1092 obs-knot-dns-deve-jq0xxt/deployments/1094 obs-knot-dns-deve-jq0xxt/deployments/1096 obs-knot-dns-deve-jq0xxt/deployments/1099 obs-knot-dns-deve-jq0xxt/deployments/1101 obs-knot-dns-deve-jq0xxt/deployments/1103 obs-knot-dns-deve-jq0xxt/deployments/1104 obs-knot-resolver-es11k1/deployments/1093 obs-knot-resolver-es11k1/deployments/1095 obs-knot-resolver-es11k1/deployments/1097 obs-knot-resolver-es11k1/deployments/1098 obs-knot-resolver-es11k1/deployments/1100 obs-knot-resolver-es11k1/deployments/1102 obs-knot-resolver-es11k1/deployments/1105
Tomas Krizek [Wed, 16 Sep 2020 11:53:56 +0000 (13:53 +0200)] 
Merge branch 'ci-update-knot3.0' into 'master'

CI: update knot3.0

See merge request knot/knot-resolver!1062

4 years agoci: pylint: fix raise-missing-from warning (W0707)
Lukáš Ježek [Wed, 16 Sep 2020 11:09:43 +0000 (13:09 +0200)] 
ci: pylint: fix raise-missing-from warning (W0707)

4 years agoci: use docker image with knot 3.0
Lukáš Ježek [Mon, 14 Sep 2020 13:57:20 +0000 (15:57 +0200)] 
ci: use docker image with knot 3.0

4 years agoMerge !1060: utils/cache_gc: fix a rebase error causing GC crashes obs-knot-dns-deve-jq0xxt/deployments/1088 obs-knot-dns-deve-jq0xxt/deployments/1089 obs-knot-resolver-es11k1/deployments/1087 obs-knot-resolver-es11k1/deployments/1090
Vladimír Čunát [Mon, 14 Sep 2020 08:54:36 +0000 (10:54 +0200)] 
Merge !1060: utils/cache_gc: fix a rebase error causing GC crashes

4 years agoutils/cache_gc: fix a rebase error causing GC crashes obs-knot-resolver-bs4hbr/deployments/1080
Vladimír Čunát [Fri, 11 Sep 2020 08:17:47 +0000 (10:17 +0200)] 
utils/cache_gc: fix a rebase error causing GC crashes

It's one of the places still using Knot's void* and I managed to pass
the wrong `db` :-/

4 years agoMerge branch 'timeout_timer_fix' into 'master' obs-knot-dns-deve-jq0xxt/deployments/1077 obs-knot-dns-deve-jq0xxt/deployments/1082 obs-knot-dns-deve-jq0xxt/deployments/1083 obs-knot-dns-deve-jq0xxt/deployments/1086 obs-knot-resolver-es11k1/deployments/1078 obs-knot-resolver-es11k1/deployments/1081 obs-knot-resolver-es11k1/deployments/1084 obs-knot-resolver-es11k1/deployments/1085
Tomas Krizek [Thu, 10 Sep 2020 15:52:45 +0000 (17:52 +0200)] 
Merge branch 'timeout_timer_fix' into 'master'

improve precision of UDP timeout measurement

See merge request knot/knot-resolver!1047

4 years agodaemon/worker: code style nitpicks
Tomas Krizek [Thu, 10 Sep 2020 14:55:48 +0000 (16:55 +0200)] 
daemon/worker: code style nitpicks

4 years agodaemon/worker: start retransmit timer after UDP packet is sent
Štěpán Balážik [Wed, 19 Aug 2020 08:52:17 +0000 (10:52 +0200)] 
daemon/worker: start retransmit timer after UDP packet is sent

Previously this was done *before* calling uv_udp_send which lead to many
early retransmits (significant amount of time might pass between calling
uv_udp_send and the moment the packet is actually send to the wire).

4 years agoMerge branch 'cache-api-typesafe' into 'master' obs-knot-resolver-bs4hbr/deployments/1079
Petr Špaček [Thu, 10 Sep 2020 09:30:10 +0000 (11:30 +0200)] 
Merge branch 'cache-api-typesafe' into 'master'

lib/cache: type safety of the cache API pointers

See merge request knot/knot-resolver!1049

4 years agolib/cache kr_cdb_api::space_usage(): also use kr_cdb_pt
Vladimír Čunát [Sat, 22 Aug 2020 09:47:51 +0000 (11:47 +0200)] 
lib/cache kr_cdb_api::space_usage(): also use kr_cdb_pt

- The malloc-free pair could be avoided without difficulty,
  but it seemed like premature optimization.
- The libknot functions make error handling a bit difficult
  (zero is theoretically valid and doesn't show error type),
  but writing this properly without libknot would need 10-20
  additional lines of code and the risk of encountering errors
  in this function seems very low anyway.

4 years agolib/cache: type safety of the cache API pointers
Vladimír Čunát [Sat, 22 Aug 2020 08:24:35 +0000 (10:24 +0200)] 
lib/cache: type safety of the cache API pointers

See the definition of kr_cdb_pt for details.

4 years agoMerge !1026: net: split the EDNS buffer size into upstream and downstream obs-knot-dns-deve-jq0xxt/deployments/1076 obs-knot-resolver-es11k1/deployments/1075
Vladimír Čunát [Wed, 9 Sep 2020 16:38:37 +0000 (18:38 +0200)] 
Merge !1026: net: split the EDNS buffer size into upstream and downstream

4 years agonet: split the EDNS buffer size into upstream and downstream
Vladimír Čunát [Wed, 9 Sep 2020 14:34:27 +0000 (16:34 +0200)] 
net: split the EDNS buffer size into upstream and downstream

(Tiny nitpicks addressed by vcunat.)

4 years agoMerge !1055: workarounds: remove *.in-addr.arpa.net NO_0X20 workarrounds
Vladimír Čunát [Wed, 9 Sep 2020 14:17:15 +0000 (16:17 +0200)] 
Merge !1055: workarounds: remove *.in-addr.arpa.net NO_0X20 workarrounds

4 years agoworkarounds: remove *.in-addr.arpa.net NO_0X20 workarrounds
Štěpán Balážik [Fri, 4 Sep 2020 10:04:18 +0000 (12:04 +0200)] 
workarounds: remove *.in-addr.arpa.net NO_0X20 workarrounds

The Internet has changed, turktel ones are fixed, edatel one does not
work at all.

4 years agoMerge branch 'release-5-1-3' into 'master' obs-knot-dns-deve-jq0xxt/deployments/1073 obs-knot-resolver-8xyvhu/deployments/1072 obs-knot-resolver-es11k1/deployments/1074 obs-knot-resolver-kv62s6/deployments/1071 v5.1.3
Tomas Krizek [Tue, 8 Sep 2020 11:08:36 +0000 (13:08 +0200)] 
Merge branch 'release-5-1-3' into 'master'

release 5.1.3

See merge request knot/knot-resolver!1059

4 years agorelease 5.1.3
Tomas Krizek [Tue, 8 Sep 2020 10:38:40 +0000 (12:38 +0200)] 
release 5.1.3

4 years agoMerge branch 'cache-forking' into 'master'
Tomas Krizek [Tue, 8 Sep 2020 10:26:35 +0000 (12:26 +0200)] 
Merge branch 'cache-forking' into 'master'

cache-forking fixes

See merge request knot/knot-resolver!1042

4 years agogc: NEWS, last fix for v5.1.3
Petr Špaček [Tue, 8 Sep 2020 10:25:00 +0000 (12:25 +0200)] 
gc: NEWS, last fix for v5.1.3

4 years agocache: fix race in assert_right_version obs-knot-resolver-bs4hbr/deployments/1068
Petr Špaček [Mon, 7 Sep 2020 14:08:05 +0000 (16:08 +0200)] 
cache: fix race in assert_right_version

This change fixes race condition in assert_right_version(). Racy
situation:
- Two instances have the (empty) cache open: New binary and old binary.
- New binary executes count() inside assert_right_version(), which
  internally starts RO transaction. Returned count is 0.
- Old binary does some writes (RW transaction parallel to RO in the first
  process).
- New binary skips cache clear because cache was empty at the time of check.
- Result: The old binary wrote data with an old format into cache which
  was not cleared and silenty changed version number to a new one.

This is not complete fix because we lack mechanism to detect cache format
change at run-time, but at least it removes one nasty corner case and
cost of this change seems to be minimal.

4 years agolib/cache: switch .cachelock to fcntl()
Vladimír Čunát [Fri, 4 Sep 2020 18:54:52 +0000 (20:54 +0200)] 
lib/cache: switch .cachelock to fcntl()

This gives us correctness, especially on "staleness" detection.
For simplicity we now don't remove "stale" .cachelock on opening cache,
but it doesn't obstruct us in any way (and overflow will remove it).

4 years agolib/cache: tweaks round transactions
Vladimír Čunát [Fri, 4 Sep 2020 17:31:51 +0000 (19:31 +0200)] 
lib/cache: tweaks round transactions

- The switched order is documented not to make difference,
  but it seems much clearer this way.
- MDB_TXN_FULL wasn't handled correctly (a reversed condition)
  and current LMDB code indicates that such transaction is
  not recoverable anyway... so we give up on trying.

4 years agolib/cache: avoid printing relative paths to cache
Vladimír Čunát [Fri, 4 Sep 2020 17:24:21 +0000 (19:24 +0200)] 
lib/cache: avoid printing relative paths to cache

4 years agolib/cache: improve debugging prints
Petr Špaček [Fri, 4 Sep 2020 17:19:18 +0000 (19:19 +0200)] 
lib/cache: improve debugging prints

(This has shared authorship, basically, mostly from MR suggestions.)

4 years agocache, GC: improve handling of LMDB maxsize
Vladimír Čunát [Thu, 27 Aug 2020 13:08:48 +0000 (15:08 +0200)] 
cache, GC: improve handling of LMDB maxsize

This version seems to work OK.  Unfortunately we had to resort to
an extra write and cache reopening when attempting to set cache size.
And even so, decreasing the size can't really be done, so we only warn
about failing to do that.

4 years agogc: print cache usage in every cycle if in verbose mode
Petr Špaček [Tue, 25 Aug 2020 15:01:46 +0000 (17:01 +0200)] 
gc: print cache usage in every cycle if in verbose mode

4 years agogc: verbose mode is now runtime option
Petr Špaček [Tue, 25 Aug 2020 15:01:08 +0000 (17:01 +0200)] 
gc: verbose mode is now runtime option

4 years agoutils/cache_gc nitpick: more precise error prints
Vladimír Čunát [Mon, 24 Aug 2020 16:01:59 +0000 (18:01 +0200)] 
utils/cache_gc nitpick: more precise error prints

4 years agoutils/cache_gc nitpick: print time in milliseconds
Vladimír Čunát [Mon, 24 Aug 2020 15:55:25 +0000 (17:55 +0200)] 
utils/cache_gc nitpick: print time in milliseconds

For the usual use cases, whole milliseconds seem to make more sense
than seconds with 10ms precision.

4 years agoutils/cache_gc: comments and cleanup in kr_cache_gc()
Vladimír Čunát [Fri, 21 Aug 2020 09:40:49 +0000 (11:40 +0200)] 
utils/cache_gc: comments and cleanup in kr_cache_gc()

4 years agotests: fine tune integration test for GC
Vladimír Čunát [Mon, 24 Aug 2020 15:47:29 +0000 (17:47 +0200)] 
tests: fine tune integration test for GC

TL;DR: tune the test - now it works quite reliably for me,
though it's perhaps not nice.

With 1 MiB cache it's not easy to avoid overflows, as the defaults are
meant for much larger sizes.  Normal GC target is to decrease usage
by 10% when above 80% in 100 records per transaction.  That just won't
work reliable due to 10% being only 25 pages.

This commit makes the test run GC with more suitable tuning and
frequently pauses kresd to give GC better chance to catch up.

4 years agotests: integration test for GC
Petr Špaček [Wed, 19 Aug 2020 13:36:42 +0000 (15:36 +0200)] 
tests: integration test for GC

GC should prevent cache from overflowing.

4 years agotests: integration test for cache overflow situation
Petr Špaček [Wed, 19 Aug 2020 10:18:09 +0000 (12:18 +0200)] 
tests: integration test for cache overflow situation

Resolvers must answer queries even if the shared cache overflown during query processing.

4 years agolib/cache: run check_health() every five seconds
Vladimír Čunát [Wed, 19 Aug 2020 09:39:19 +0000 (11:39 +0200)] 
lib/cache: run check_health() every five seconds

... in case of usage from kresd (GC does it a bit differently).

4 years agolib/cache check_health(): also detect size changes
Vladimír Čunát [Wed, 19 Aug 2020 08:23:04 +0000 (10:23 +0200)] 
lib/cache check_health(): also detect size changes

This is important for GC - otherwise the usage computation would be
wrong after another process changed size (without replacing the file).

4 years agolib/cache: abort() if emergency cache-clear fails
Vladimír Čunát [Tue, 18 Aug 2020 16:45:28 +0000 (18:45 +0200)] 
lib/cache: abort() if emergency cache-clear fails

As the code has been so far, there's no usable cache in that case
and some code just can't handle that.  Up to now we were getting
SIGSEGV from inside LMDB on the next attempted operation.

We might consider loosening preallocation in that case or even
retrying after a short sleep.  Systemd's restart after hold-off
timeout has an effect similar to the short sleep.

4 years agoutils/cache_gc: tolerate ESPACE unless twice in a row
Vladimír Čunát [Tue, 18 Aug 2020 09:34:43 +0000 (11:34 +0200)] 
utils/cache_gc: tolerate ESPACE unless twice in a row

In the unlikely case that GC happens "too late", it could fail when
deleting, in which case it seems best to reopen the cache and try again,
as it will probably be deleted by a kresd instance by the next interval.

4 years agoutils/cache_gc: avoid too long RO transactions
Vladimír Čunát [Mon, 17 Aug 2020 17:15:04 +0000 (19:15 +0200)] 
utils/cache_gc: avoid too long RO transactions

Until now the analyzing pass over full DB was taking place
in a single RO transaction.  For an unknown reason this caused kresd
processes to get MDB_MAP_FULL from mdb_put(), even though clearly there
were plenty free pages at that point.

Basic experiments show that 1k steps are OK and 10k steps are not.

4 years agoutils/cache_gc: handle one more error
Vladimír Čunát [Mon, 17 Aug 2020 17:13:59 +0000 (19:13 +0200)] 
utils/cache_gc: handle one more error

though I've never seen it happening.

4 years agolib/cache: abort transactions on errors
Vladimír Čunát [Mon, 17 Aug 2020 08:38:20 +0000 (10:38 +0200)] 
lib/cache: abort transactions on errors

This apparently gets rid of MDB_BAD_TXN failures that we were getting
when cache overflows.  Unfortunately LMDB docs don't mention that
after operation failures one should abort the corresponding transaction.

4 years agolib/cache nitpick: more consistent naming
Vladimír Čunát [Mon, 17 Aug 2020 07:52:09 +0000 (09:52 +0200)] 
lib/cache nitpick: more consistent naming

4 years agoutils/cache_gc: utilize kr_cdb_api::check_health()
Vladimír Čunát [Fri, 14 Aug 2020 14:47:13 +0000 (16:47 +0200)] 
utils/cache_gc: utilize kr_cdb_api::check_health()

Now it should keep working if the file has been replaced.

4 years agoWIP: lib/cache: factor out kr_cdb_api::check_health()
Vladimír Čunát [Fri, 14 Aug 2020 12:15:18 +0000 (14:15 +0200)] 
WIP: lib/cache: factor out kr_cdb_api::check_health()

FIXME: review, testing, etc.

A couple functions got folded into cdb_open_env(), as the split was
complicating situation (mainly around error handling).

4 years agoMerge branch 'upgrading' into 'master' obs-knot-dns-deve-jq0xxt/deployments/1069 obs-knot-resolver-es11k1/deployments/1070
Petr Špaček [Mon, 7 Sep 2020 15:13:34 +0000 (17:13 +0200)] 
Merge branch 'upgrading' into 'master'

doc: upcoming changes

See merge request knot/knot-resolver!1057

4 years agodoc: DNS Flag Day 2020 warning
Petr Špaček [Mon, 7 Sep 2020 14:30:46 +0000 (16:30 +0200)] 
doc: DNS Flag Day 2020 warning

4 years agodoc: DoH without TLS or over HTTP 1 is deprecated
Petr Špaček [Mon, 7 Sep 2020 07:14:51 +0000 (09:14 +0200)] 
doc: DoH without TLS or over HTTP 1 is deprecated

4 years agodoc: new section in upgrading guide about upcoming changes
Petr Špaček [Mon, 7 Sep 2020 07:00:53 +0000 (09:00 +0200)] 
doc: new section in upgrading guide about upcoming changes

4 years agoMerge branch 'luarocks-install-version' into 'master'
Petr Špaček [Mon, 7 Sep 2020 14:48:41 +0000 (16:48 +0200)] 
Merge branch 'luarocks-install-version' into 'master'

scripts, docs: specify lua version in `luarocks install`

Closes #601

See merge request knot/knot-resolver!1052

4 years agoscripts, docs: specify lua version in `luarocks install`
Vladimír Čunát [Mon, 31 Aug 2020 07:29:44 +0000 (09:29 +0200)] 
scripts, docs: specify lua version in `luarocks install`

On some systems luarocks defaults to other lua version (e.g. Fedora),
so the result would not be usable from kresd.  I didn't touch scripts
for older distro versions (Debian < 10, Ubuntu < 20.04, CentOS 7).

4 years agoMerge branch 'libdnssec-3.0' into 'master' obs-knot-dns-deve-jq0xxt/deployments/1055 obs-knot-dns-deve-jq0xxt/deployments/1058 obs-knot-dns-deve-jq0xxt/deployments/1061 obs-knot-dns-deve-jq0xxt/deployments/1063 obs-knot-dns-deve-jq0xxt/deployments/1064 obs-knot-dns-deve-jq0xxt/deployments/1066 obs-knot-resolver-bs4hbr/deployments/1059 obs-knot-resolver-es11k1/deployments/1056 obs-knot-resolver-es11k1/deployments/1057 obs-knot-resolver-es11k1/deployments/1060 obs-knot-resolver-es11k1/deployments/1062 obs-knot-resolver-es11k1/deployments/1065 obs-knot-resolver-es11k1/deployments/1067
Tomas Krizek [Tue, 1 Sep 2020 14:54:11 +0000 (16:54 +0200)] 
Merge branch 'libdnssec-3.0' into 'master'

lib/dnssec: fix build against libdnssec 3.0

See merge request knot/knot-resolver!1053

4 years agolib/dnssec: fix build against libdnssec 3.0
Vladimír Čunát [Tue, 1 Sep 2020 10:44:15 +0000 (12:44 +0200)] 
lib/dnssec: fix build against libdnssec 3.0

It hasn't been released yet, but this patch fixes build against
current Knot master already.