]> git.ipfire.org Git - thirdparty/knot-resolver.git/log
thirdparty/knot-resolver.git
4 years agofail on execissive data in a packet fail-on-execissive-data
Štěpán Balážik [Wed, 20 Jan 2021 11:25:38 +0000 (12:25 +0100)] 
fail on execissive data in a packet

4 years agoMerge branch 'remove-safemode' into 'master' obs-knot-dns-deve-jq0xxt/deployments/1420 obs-knot-resolver-bs4hbr/deployments/1419
Štěpán Balážik [Wed, 27 Jan 2021 11:25:55 +0000 (12:25 +0100)] 
Merge branch 'remove-safemode' into 'master'

Rework iterate.c/selection.c error handling

Closes #640

See merge request knot/knot-resolver!1126

4 years agomention MR in NEWS
Štěpán Balážik [Wed, 27 Jan 2021 11:23:48 +0000 (12:23 +0100)] 
mention MR in NEWS

4 years agolib/selection: refactor kr_selection_error_str()
Vladimír Čunát [Tue, 26 Jan 2021 11:25:09 +0000 (12:25 +0100)] 
lib/selection: refactor kr_selection_error_str()

This way leaves less room for mistakes, etc.  It's just the idea from:
https://gitlab.nic.cz/knot/knot-resolver/-/commit/dd0c99bdb6332ba3628833a8543a5f9f33141ddd#note_191580

4 years agoiterate.c: clarify is_authoritative workaround comment 75416
Štěpán Balážik [Mon, 25 Jan 2021 08:48:57 +0000 (09:48 +0100)] 
iterate.c: clarify is_authoritative workaround comment

4 years agoselection: only report RTT if there is an answer
Štěpán Balážik [Fri, 22 Jan 2021 18:22:20 +0000 (19:22 +0100)] 
selection: only report RTT if there is an answer

Previously this would pollute the RTT cache with non-sensical
measurements from unsuccessful TCP connects for example.

4 years agomodules/rebinding: fix module logging to new server selection
Štěpán Balážik [Mon, 25 Jan 2021 09:40:13 +0000 (10:40 +0100)] 
modules/rebinding: fix module logging to new server selection

Module would crash due to the change of `request->upstream`
structure.

4 years agoselection_iter: relax NSNXAttack mitigation
Štěpán Balážik [Wed, 20 Jan 2021 18:33:14 +0000 (19:33 +0100)] 
selection_iter: relax NSNXAttack mitigation

Previously the mitigation would stop some longer benign resolutions.
We can safely zero the subquery counter when choose a concrete transport
for the query (i.e. NS name with known IP address).

4 years agoselection: force resolution of new NS name after lame delegation
Štěpán Balážik [Wed, 20 Jan 2021 15:19:18 +0000 (16:19 +0100)] 
selection: force resolution of new NS name after lame delegation

Lame delegations are weird, they breed more lame delegations on broken
zones since trying another server from the same set usualy doesn't help.
We force resolution of another NS name in hope of getting somewhere.

4 years agoiterate: interpret empty FORMERR answers correctly
Štěpán Balážik [Wed, 20 Jan 2021 10:12:12 +0000 (11:12 +0100)] 
iterate: interpret empty FORMERR answers correctly

Previously a 12B reply with FORMERR would be treated as malformed
creating a need for a workaround (switching off EDNS for every malformed
answer).

4 years agobogus_log: fix bogus_log test to new error handling
Štěpán Balážik [Tue, 19 Jan 2021 16:03:51 +0000 (17:03 +0100)] 
bogus_log: fix bogus_log test to new error handling

4 years agoresolve.c: trigger serve stale on NSNXAttack mitigation from kr_resolve_consume
Štěpán Balážik [Tue, 19 Jan 2021 15:08:22 +0000 (16:08 +0100)] 
resolve.c: trigger serve stale on NSNXAttack mitigation from kr_resolve_consume

4 years agoiterate.c: don't copy NO_MINIMIZE when following a CNAME
Štěpán Balážik [Tue, 19 Jan 2021 12:39:04 +0000 (13:39 +0100)] 
iterate.c: don't copy NO_MINIMIZE when following a CNAME

Instead copy it from the request's options.

Reasoning: Minimization might have been turned off as a workaround for
broken authoritative servers which doesn't support it. There is no
reason to drop minimization when switching zones when following a CNAME.

4 years agoselection: fix DNSSEC_BOGUS/NSNXAttack mitigation interaction
Štěpán Balážik [Thu, 14 Jan 2021 23:49:38 +0000 (00:49 +0100)] 
selection: fix DNSSEC_BOGUS/NSNXAttack mitigation interaction

When cancelling a query due to NSNXAttack mitigation when validator was
also in BOGUS state, records wouldn't be stripped from the answer.

4 years agoselection: better error messages for errors
Štěpán Balážik [Thu, 14 Jan 2021 19:09:38 +0000 (20:09 +0100)] 
selection: better error messages for errors

4 years agoselection: minor fixes in commented code
Štěpán Balážik [Thu, 14 Jan 2021 17:32:43 +0000 (18:32 +0100)] 
selection: minor fixes in commented code

These will become useful once we actually use it…

4 years agoiterate: rework error handling from iterate.c
Štěpán Balážik [Thu, 14 Jan 2021 14:39:31 +0000 (15:39 +0100)] 
iterate: rework error handling from iterate.c

Previously there where resolve_badmsg and resolve_error functions used
to apply workarounds. This is now moved to selection.c and iterate.c
just provides feedback using the server selection API. Errors are now
handled centrally in selection.c:error.

4 years agoMerge branch 'ci-scan-build' into 'master' obs-knot-dns-deve-jq0xxt/deployments/1401 obs-knot-dns-deve-jq0xxt/deployments/1403 obs-knot-dns-deve-jq0xxt/deployments/1405 obs-knot-dns-deve-jq0xxt/deployments/1408 obs-knot-dns-deve-jq0xxt/deployments/1409 obs-knot-dns-deve-jq0xxt/deployments/1411 obs-knot-dns-deve-jq0xxt/deployments/1413 obs-knot-dns-deve-jq0xxt/deployments/1416 obs-knot-dns-deve-jq0xxt/deployments/1418 obs-knot-resolver-bs4hbr/deployments/1402 obs-knot-resolver-bs4hbr/deployments/1404 obs-knot-resolver-bs4hbr/deployments/1406 obs-knot-resolver-bs4hbr/deployments/1407 obs-knot-resolver-bs4hbr/deployments/1410 obs-knot-resolver-bs4hbr/deployments/1412 obs-knot-resolver-bs4hbr/deployments/1414 obs-knot-resolver-bs4hbr/deployments/1415 obs-knot-resolver-bs4hbr/deployments/1417
Tomas Krizek [Mon, 18 Jan 2021 09:52:18 +0000 (10:52 +0100)] 
Merge branch 'ci-scan-build' into 'master'

ci lint:scan-build: work around changes in meson

See merge request knot/knot-resolver!1127

4 years agoci lint:scan-build: work around changes in meson
Vladimír Čunát [Mon, 18 Jan 2021 08:16:52 +0000 (09:16 +0100)] 
ci lint:scan-build: work around changes in meson

In 1f7678ea24 meson was updated and that broke our scan-build.
Now we work around that.  Quick analysis of why:
https://github.com/mesonbuild/meson/pull/5918#issuecomment-762064902

4 years agoMerge branch 'dnstap-tests' into 'master' obs-knot-dns-deve-jq0xxt/deployments/1396 obs-knot-dns-deve-jq0xxt/deployments/1398 obs-knot-dns-deve-jq0xxt/deployments/1400 obs-knot-resolver-bs4hbr/deployments/1395 obs-knot-resolver-bs4hbr/deployments/1397 obs-knot-resolver-bs4hbr/deployments/1399
Tomas Krizek [Fri, 15 Jan 2021 14:22:31 +0000 (15:22 +0100)] 
Merge branch 'dnstap-tests' into 'master'

dnstap tests: integrate into meson, CI, etc.

See merge request knot/knot-resolver!1123

4 years agomeson: utilize test priority with sufficiently new meson 74870
Vladimír Čunát [Fri, 15 Jan 2021 13:45:40 +0000 (14:45 +0100)] 
meson: utilize test priority with sufficiently new meson

+ it's more efficient to schedule longer tests before shorter tests
- we get a warning (if meson is new enough to use priorities)

Priority numbers: I took the config tests as baseline.
I didn't touch tests with "is_parallel: false".

4 years agotests/dnstap: fix, refactor and integrate into meson and CI
Vladimír Čunát [Tue, 5 Jan 2021 15:59:48 +0000 (16:59 +0100)] 
tests/dnstap: fix, refactor and integrate into meson and CI

They need one go package which I can't find even in Debian,
so it probably can't work without network access.
The new dnstap in extra_tests runs if dnstap is built and go is found.
It also tries to keep the source tree clean.

Now both query and reply messages are tested.

In CI (after caching go deps in image) this tests only takes slightly
more time than the longest config.* tests, so that seems OK.
Even so, it's not added into the valgrind variant, as compilation
of the test still isn't split away from the run itself.

4 years agoci/debian-buster: add deps for dnstap in kresd
Vladimír Čunát [Tue, 5 Jan 2021 11:15:04 +0000 (12:15 +0100)] 
ci/debian-buster: add deps for dnstap in kresd

From distro packages, just libprotobuf-c-dev and golang-any are new,
but I also broke the overlong line and reorganized its contents a bit.

4 years agoMerge branch 'dnstap-pkg' into 'master'
Tomas Krizek [Fri, 15 Jan 2021 13:51:34 +0000 (14:51 +0100)] 
Merge branch 'dnstap-pkg' into 'master'

add dnstap subpackage

Closes #655

See merge request knot/knot-resolver!1118

4 years agodistro/tests: add dnstap test
Jakub Ružička [Wed, 6 Jan 2021 16:58:40 +0000 (17:58 +0100)] 
distro/tests: add dnstap test

4 years agodistro/rpm: add dnstap subpackage
Jakub Ružička [Tue, 5 Jan 2021 14:43:53 +0000 (15:43 +0100)] 
distro/rpm: add dnstap subpackage

introduce new dependencies:

* libfstrm
* libprotobuf-c

SUSE is missing protoc-c compiler so don't build dnstap there.

4 years agodistro/deb: add dnstap subpackage
Jakub Ružička [Tue, 5 Jan 2021 12:44:51 +0000 (13:44 +0100)] 
distro/deb: add dnstap subpackage

introduce new dependencies:

* libfstrm
* libprotobuf-c

4 years agodistro/deb: remove obsolete http module script
Jakub Ružička [Tue, 5 Jan 2021 16:47:06 +0000 (17:47 +0100)] 
distro/deb: remove obsolete http module script

This is a relic of ancient times.

4 years agoMerge branch 'no-assert-return-fix' into 'master'
Tomas Krizek [Fri, 15 Jan 2021 13:23:09 +0000 (14:23 +0100)] 
Merge branch 'no-assert-return-fix' into 'master'

selection: return early from forward_choose_transport with asserts off

See merge request knot/knot-resolver!1125

4 years agoselection: return early from forward_choose_transport with asserts off
Štěpán Balážik [Fri, 15 Jan 2021 11:52:02 +0000 (12:52 +0100)] 
selection: return early from forward_choose_transport with asserts off

This lead to unintitialized values being possibly used down the line.

4 years agoMerge branch 'reorder_rr-defaults' into 'master' obs-knot-dns-deve-jq0xxt/deployments/1392 obs-knot-resolver-bs4hbr/deployments/1391
Tomas Krizek [Thu, 14 Jan 2021 16:38:18 +0000 (17:38 +0100)] 
Merge branch 'reorder_rr-defaults' into 'master'

randomize record order by default, i.e. reorder_RR(true)

See merge request knot/knot-resolver!1124

4 years agorandomize record order by default, i.e. reorder_RR(true)
Vladimír Čunát [Thu, 14 Jan 2021 12:16:06 +0000 (13:16 +0100)] 
randomize record order by default, i.e. reorder_RR(true)

It's quite cheap for us, and it might help with dumb clients
overusing the lowest IP from each set.

4 years agodaemon/engine: refactor repetitive naming in init_resolver()
Vladimír Čunát [Thu, 14 Jan 2021 11:51:39 +0000 (12:51 +0100)] 
daemon/engine: refactor repetitive naming in init_resolver()

"ctx" is the usual name elsewhere for a kr_context pointer

4 years agoMerge branch 'mempattern' into 'master' obs-knot-dns-deve-jq0xxt/deployments/1387 obs-knot-resolver-bs4hbr/deployments/1388
Tomas Krizek [Wed, 13 Jan 2021 13:21:04 +0000 (14:21 +0100)] 
Merge branch 'mempattern' into 'master'

refactor memory allocation patterns a little

See merge request knot/knot-resolver!1115

4 years agotreewide: avoid memset where it's trivial obs-knot-resolver-bs4hbr/deployments/1380
Vladimír Čunát [Mon, 4 Jan 2021 09:50:18 +0000 (10:50 +0100)] 
treewide: avoid memset where it's trivial

More idiomatic code seems better:
- for variable initialization we have = { 0 }
- (mm_)calloc for heap allocations
  sizeof: use variable instead of type (where suitable; not sure why)

4 years agocontrib/mempattern: hide mm_malloc()
Vladimír Čunát [Wed, 23 Dec 2020 07:39:33 +0000 (08:39 +0100)] 
contrib/mempattern: hide mm_malloc()

Experience proved that it can be confused with mm_alloc()
and it may not be trivial to find the mistake.

4 years agomm_ctx_mempool2(): factor out the new function
Vladimír Čunát [Tue, 22 Dec 2020 13:11:31 +0000 (14:11 +0100)] 
mm_ctx_mempool2(): factor out the new function

4 years agoutilize mm_ctx_mempool() instead of writing by hand
Vladimír Čunát [Tue, 22 Dec 2020 13:10:38 +0000 (14:10 +0100)] 
utilize mm_ctx_mempool() instead of writing by hand

4 years agocontrib/mempattern: integrate other related functions
Vladimír Čunát [Tue, 22 Dec 2020 13:09:20 +0000 (14:09 +0100)] 
contrib/mempattern: integrate other related functions

4 years agocopy mempattern files from Knot DNS as they are
Vladimír Čunát [Tue, 22 Dec 2020 11:44:39 +0000 (12:44 +0100)] 
copy mempattern files from Knot DNS as they are

It seems just easier than having the copies in the current way.
I don't think the `static inline` were helping us anyway,
except for avoiding KR_EXPORT in some cases.

Still, differences when copying:
 - we use plain memset() in the implementation
   (no motivation here to use the complex memzero() approach)
 - we expose mm_malloc(), as we've been referring to it
 - we KR_EXPORT some of the functions (for lua and modules)

4 years agoMerge !1103: dnstap: log client requests + filter out internal queries
Vladimír Čunát [Wed, 13 Jan 2021 08:35:20 +0000 (09:35 +0100)] 
Merge !1103: dnstap: log client requests + filter out internal queries

4 years agodoc/upgrading: dnstap option log_responses moved
Tomas Krizek [Tue, 12 Jan 2021 11:45:17 +0000 (12:45 +0100)] 
doc/upgrading: dnstap option log_responses moved

4 years agofix trivial lint:tidy warnings
Vladimír Čunát [Fri, 8 Jan 2021 14:25:09 +0000 (15:25 +0100)] 
fix trivial lint:tidy warnings

These do not make the CI job fail, but better avoid them anyway.
I suspect they got added when we updated the CI docker image.

4 years agodnstap: represent DoT and DoH
Vladimír Čunát [Mon, 4 Jan 2021 15:28:52 +0000 (16:28 +0100)] 
dnstap: represent DoT and DoH

(instead of marking them as TCP)
This includes latest dnstap.proto, except for keeping our local changes
of the licensing comment.
https://github.com/dnstap/dnstap.pb/blob/master/dnstap.proto

4 years agotests/dnstap: Update configuration to match latest changes
Pavel Dolezal [Tue, 15 Dec 2020 14:24:11 +0000 (15:24 +0100)] 
tests/dnstap: Update configuration to match latest changes

4 years agodnstap: multiple changes
Pavel Dolezal [Tue, 15 Dec 2020 12:27:50 +0000 (13:27 +0100)] 
dnstap: multiple changes

- log queries and responses as separate dnstap messages
- use "query" instead of "request" to mirror dnstap specification
- don't export "query_zone" field in "CLIENT_*" messages

4 years agodnstap: Add optional identity and version fields
Pavel Dolezal [Mon, 14 Dec 2020 12:59:50 +0000 (13:59 +0100)] 
dnstap: Add optional identity and version fields

4 years agodnstap: optionally log client requests; don't log internal ones
Pavel Dolezal [Thu, 3 Dec 2020 09:04:53 +0000 (10:04 +0100)] 
dnstap: optionally log client requests; don't log internal ones

4 years agoMerge branch 'pkg-cznic-release' into 'master' obs-knot-dns-deve-jq0xxt/deployments/1375 obs-knot-dns-deve-jq0xxt/deployments/1378 obs-knot-resolver-bs4hbr/deployments/1376 obs-knot-resolver-bs4hbr/deployments/1377
Tomas Krizek [Mon, 11 Jan 2021 16:03:59 +0000 (17:03 +0100)] 
Merge branch 'pkg-cznic-release' into 'master'

distro: introduce upstream cznic release prefix

See merge request knot/knot-resolver!1122

4 years agodistro: introduce upstream cznic release prefix
Jakub Ružička [Fri, 8 Jan 2021 16:23:17 +0000 (17:23 +0100)] 
distro: introduce upstream cznic release prefix

using cznic.1 release string for upstream packages ensures they are
prefered over downstream ones and that their versions don't collide
which was causing issues for users with both downstream and upstream
packaging repos enabled.

Following statements are true according to `dpkg --compare-versions`:

    1.2.3-1   < 1.2.3-cznic.1
    1.2.3-999 < 1.2.3-cznic.1

So upstream packages should always take precedence over downstream
packages of the same version.

4 years agoMerge branch 'link-local-forward' into 'master' obs-knot-dns-deve-jq0xxt/deployments/1368 obs-knot-dns-deve-jq0xxt/deployments/1371 obs-knot-dns-deve-jq0xxt/deployments/1372 obs-knot-resolver-bs4hbr/deployments/1369 obs-knot-resolver-bs4hbr/deployments/1370 obs-knot-resolver-bs4hbr/deployments/1373
Štěpán Balážik [Fri, 8 Jan 2021 14:41:50 +0000 (15:41 +0100)] 
Merge branch 'link-local-forward' into 'master'

lib/selection: allow forwarding to link local address

See merge request knot/knot-resolver!1116

4 years agolib/selection: allow forwarding to link local address
Štěpán Balážik [Fri, 8 Jan 2021 14:41:50 +0000 (15:41 +0100)] 
lib/selection: allow forwarding to link local address

This is done by changing the type of address field in struct choice to
union inaddr and moving some conversion around.

4 years agoMerge branch 'doh2-memleak' into 'master' obs-knot-dns-deve-jq0xxt/deployments/1366 obs-knot-resolver-bs4hbr/deployments/1365
Tomas Krizek [Thu, 7 Jan 2021 14:02:38 +0000 (15:02 +0100)] 
Merge branch 'doh2-memleak' into 'master'

daemon/http: fix memleak

See merge request knot/knot-resolver!1117

4 years agodaemon/http: use memmove() for session buffer write
Tomas Krizek [Thu, 7 Jan 2021 12:36:49 +0000 (13:36 +0100)] 
daemon/http: use memmove() for session buffer write

Since session buffer contains both the raw http data and the resulting
decoded DNS packet, memmove() should be used instead of memcpy().

4 years agodaemon/http: ensure uri_path is freed for POST
Tomas Krizek [Thu, 7 Jan 2021 12:35:21 +0000 (13:35 +0100)] 
daemon/http: ensure uri_path is freed for POST

Since #636 was implemented, uri_path is also saved for POST requests and
thus needs to be freed.

4 years agodaemon/http: fix memleak
Tomas Krizek [Tue, 5 Jan 2021 12:08:35 +0000 (13:08 +0100)] 
daemon/http: fix memleak

The http_data structure is allocated in http_write_pkt() and the last
callback that uses it is on_pkt_write(), so it should be responsible for
freeing the memory.

This used to leak a small amount of memory on every DoH response.

4 years agoMerge !1119: ci: add sonarcloud build
Vladimír Čunát [Thu, 7 Jan 2021 10:38:31 +0000 (11:38 +0100)] 
Merge !1119: ci: add sonarcloud build

4 years agoci: add sonarcloud build 74391 74404
Tomas Krizek [Tue, 5 Jan 2021 15:43:37 +0000 (16:43 +0100)] 
ci: add sonarcloud build

4 years agoMerge branch 'tumbleweed_errors' into 'master' obs-knot-dns-deve-jq0xxt/deployments/1362 obs-knot-resolver-bs4hbr/deployments/1361
Tomas Krizek [Wed, 6 Jan 2021 14:25:22 +0000 (15:25 +0100)] 
Merge branch 'tumbleweed_errors' into 'master'

daemon/worker.c: fix warning from compilation without asserts

See merge request knot/knot-resolver!1120

4 years agodaemon/worker.c: fix warning from compilation without asserts
Štěpán Balážik [Wed, 6 Jan 2021 12:06:25 +0000 (13:06 +0100)] 
daemon/worker.c: fix warning from compilation without asserts

I kept the changes (especially the one in qr_task_on_send) as local as
possible while hopefully preserving the invariants other functions in
worker rely upon.

4 years agoMerge branch 'daf-clear' into 'master' obs-knot-dns-deve-jq0xxt/deployments/1356 obs-knot-resolver-bs4hbr/deployments/1357
Tomas Krizek [Tue, 5 Jan 2021 09:28:02 +0000 (10:28 +0100)] 
Merge branch 'daf-clear' into 'master'

daf: Add clear method

See merge request knot/knot-resolver!1114

4 years agodaf: Add clear method
Vladimír Čunát [Wed, 30 Dec 2020 10:25:16 +0000 (11:25 +0100)] 
daf: Add clear method

Make it easier to delete all rules specified in daf.

4 years agoMerge !1110: docker: add dnstap support obs-knot-dns-deve-jq0xxt/deployments/1352 obs-knot-resolver-bs4hbr/deployments/1353
Vladimír Čunát [Mon, 4 Jan 2021 12:57:57 +0000 (13:57 +0100)] 
Merge !1110: docker: add dnstap support

4 years agodocker: add dnstap support
Tomas Krizek [Fri, 11 Dec 2020 11:26:32 +0000 (12:26 +0100)] 
docker: add dnstap support

4 years agoMerge !1030: server selection rewrite obs-knot-dns-deve-jq0xxt/deployments/1344 obs-knot-dns-deve-jq0xxt/deployments/1347 obs-knot-dns-deve-jq0xxt/deployments/1348 obs-knot-dns-deve-jq0xxt/deployments/1350 obs-knot-resolver-bs4hbr/deployments/1345 obs-knot-resolver-bs4hbr/deployments/1346 obs-knot-resolver-bs4hbr/deployments/1349 obs-knot-resolver-bs4hbr/deployments/1351
Vladimír Čunát [Thu, 31 Dec 2020 16:01:38 +0000 (17:01 +0100)] 
Merge !1030: server selection rewrite

Closes #447

4 years agoadd NEWS entry
Vladimír Čunát [Thu, 31 Dec 2020 14:54:31 +0000 (15:54 +0100)] 
add NEWS entry

4 years agolib/selection: minor refactorings and comments
Vladimír Čunát [Tue, 22 Dec 2020 10:29:39 +0000 (11:29 +0100)] 
lib/selection: minor refactorings and comments

Small things I've noticed while reading it all.
- line breaks: I believe <90 is OK, as usually the attempts to reduce
  lengths impair readability
- avoid unnecessary casts; usually the type was visible
  on the same line anyway
- avoid `|` on booleans
- one block gets de-indented (often badly shown in diffs)
- no need for UNRECOVERABLE_ERRORS in a header (and a weird one, too)
- recoverability from failed assertions (in case they're turned off)

4 years agolib/selection: tweak computation of RTT estimates
Vladimír Čunát [Tue, 29 Dec 2020 14:51:50 +0000 (15:51 +0100)] 
lib/selection: tweak computation of RTT estimates

- fix switched \alpha and \beta from the RFC (no big deal, I think)
- use the same order as in the RFC (perhaps that caused the switch?)
- avoid floating-point arithmetics (it's simple with these formulas)
- simplify the the backoff formula (MINs instead of branches)

4 years agolib/selection: refactor usage of bytes_to_ip()
Vladimír Čunát [Tue, 29 Dec 2020 09:17:13 +0000 (10:17 +0100)] 
lib/selection: refactor usage of bytes_to_ip()

4 years agolib/selection: be more careful around rtt_state.dead_since
Vladimír Čunát [Tue, 29 Dec 2020 08:28:16 +0000 (09:28 +0100)] 
lib/selection: be more careful around rtt_state.dead_since

It's all because the timestamp that we're using isn't (guaranteed to be)
meaningful across reboots or different machines, whereas our cache even
persists by default.

4 years agolib/selection: tweak how cache is used
Vladimír Čunát [Mon, 28 Dec 2020 09:09:18 +0000 (10:09 +0100)] 
lib/selection: tweak how cache is used

- standardize cache key choice and ensure impossibility of collisions
- comment on interaction with GC; it would be better to give RTT
  priority over most of other records
- be more robust wrt. value in cache

4 years agoselection: server selection rewrite
Štěpán Balážik [Fri, 20 Mar 2020 18:43:11 +0000 (19:43 +0100)] 
selection: server selection rewrite

Design discussion: #447
Code discussion: !1030

4 years agotests: fix knot-resolver specific Deckard tests
Štěpán Balážik [Mon, 26 Oct 2020 10:41:43 +0000 (11:41 +0100)] 
tests: fix knot-resolver specific Deckard tests

4 years agodeckard: update for the new server selection
Štěpán Balážik [Thu, 17 Dec 2020 14:34:23 +0000 (15:34 +0100)] 
deckard: update for the new server selection

4 years agoiterate: accept parent-side records for nameservers 73870
Vladimír Čunát [Mon, 16 Nov 2020 13:28:49 +0000 (14:28 +0100)] 
iterate: accept parent-side records for nameservers

When resolving just NS names and addresses which won't go to answers,
our cache can satisfy them with just parent-side records.
Now we also make iterator consistent with that, and it will cut short
if a delegation satisfies what the kr_query wants.

There's a general risk that we will never get the child-side records,
and in practice the parent-side ones are sometimes "less accurate".
This change may increase this risk (to NS addresses in particular),
but we'd better consider addressing the risk later and systematically.
A suggestion is to refresh the records asynchronously:
https://tools.ietf.org/html/draft-ietf-dnsop-ns-revalidation

---
State before this commit lead to a weird behaviour where some IPv4-only
tests in Deckard (namely `iter_pcdiff.rpl`) were failing with IPv6
turned off.

This was due to the resolvers' internal preference towards AAAA records
for NS names.  With IPv6 networking on, NS name resolution was first
done for AAAA record and the glue (containing A record for the NS name
in question) from parent zone was put into cache.  As the AAAA
resolution failed (there is no AAAA for this NS name), A was queried
next and was satisfied from cache.

With IPv6 off, there is no query for the AAAA record, so no A record
from glue gets put in to the cache.  A record is resolved first, and
resolution ignores the glue in parent zone and continue to the child
zone which might be broken (intentionally in the case of that
`iter_pcdiff.rpl` test).

4 years agoMerge branch 'view-tweaks' into 'master' obs-knot-dns-deve-jq0xxt/deployments/1313 obs-knot-dns-deve-jq0xxt/deployments/1314 obs-knot-dns-deve-jq0xxt/deployments/1316 obs-knot-dns-deve-jq0xxt/deployments/1319 obs-knot-dns-deve-jq0xxt/deployments/1321 obs-knot-dns-deve-jq0xxt/deployments/1322 obs-knot-dns-deve-jq0xxt/deployments/1324 obs-knot-dns-deve-jq0xxt/deployments/1327 obs-knot-dns-deve-jq0xxt/deployments/1329 obs-knot-dns-deve-jq0xxt/deployments/1330 obs-knot-dns-deve-jq0xxt/deployments/1332 obs-knot-dns-deve-jq0xxt/deployments/1334 obs-knot-dns-deve-jq0xxt/deployments/1337 obs-knot-dns-deve-jq0xxt/deployments/1339 obs-knot-dns-deve-jq0xxt/deployments/1340 obs-knot-dns-deve-jq0xxt/deployments/1343 obs-knot-resolver-bs4hbr/deployments/1312 obs-knot-resolver-bs4hbr/deployments/1315 obs-knot-resolver-bs4hbr/deployments/1317 obs-knot-resolver-bs4hbr/deployments/1318 obs-knot-resolver-bs4hbr/deployments/1320 obs-knot-resolver-bs4hbr/deployments/1323 obs-knot-resolver-bs4hbr/deployments/1325 obs-knot-resolver-bs4hbr/deployments/1326 obs-knot-resolver-bs4hbr/deployments/1328 obs-knot-resolver-bs4hbr/deployments/1331 obs-knot-resolver-bs4hbr/deployments/1333 obs-knot-resolver-bs4hbr/deployments/1335 obs-knot-resolver-bs4hbr/deployments/1336 obs-knot-resolver-bs4hbr/deployments/1338 obs-knot-resolver-bs4hbr/deployments/1341 obs-knot-resolver-bs4hbr/deployments/1342
Tomas Krizek [Tue, 15 Dec 2020 10:41:17 +0000 (11:41 +0100)] 
Merge branch 'view-tweaks' into 'master'

view tweaks

See merge request knot/knot-resolver!1112

4 years agoview: documentation nitpicks
Vladimír Čunát [Mon, 14 Dec 2020 11:01:52 +0000 (12:01 +0100)] 
view: documentation nitpicks

4 years agoview.addr(): throw error on bad subnet
Vladimír Čunát [Mon, 14 Dec 2020 10:54:55 +0000 (11:54 +0100)] 
view.addr(): throw error on bad subnet

It's more consistent with what we do.  Now it will look like:
[system] error while loading config: .../lib/knot-resolver/kres_modules/view.lua:28: failed to parse subnet [::1]/128 (workdir '/foo/bar')

4 years agolib/utils kr_straddr_subnet(): fix some error detection
Vladimír Čunát [Mon, 14 Dec 2020 10:50:10 +0000 (11:50 +0100)] 
lib/utils kr_straddr_subnet(): fix some error detection

inet_pton() has slightly unexpected return values.
Only one function was wrong; I don't count the unused kr_straddr_join().

4 years agoMerge !1111: doc: policy - improve clarity of links obs-knot-dns-deve-jq0xxt/deployments/1304 obs-knot-dns-deve-jq0xxt/deployments/1306 obs-knot-dns-deve-jq0xxt/deployments/1308 obs-knot-dns-deve-jq0xxt/deployments/1309 obs-knot-resolver-es11k1/deployments/1303 obs-knot-resolver-es11k1/deployments/1305 obs-knot-resolver-es11k1/deployments/1307 obs-knot-resolver-es11k1/deployments/1310
Vladimír Čunát [Fri, 11 Dec 2020 15:30:23 +0000 (16:30 +0100)] 
Merge !1111: doc: policy - improve clarity of links

4 years agodoc: make links to policies more consistent
Tomas Krizek [Fri, 11 Dec 2020 15:05:30 +0000 (16:05 +0100)] 
doc: make links to policies more consistent

4 years agodoc: use :any: to refer to non-function policies
Tomas Krizek [Fri, 11 Dec 2020 14:42:22 +0000 (15:42 +0100)] 
doc: use :any: to refer to non-function policies

:func: directive automatically always adds brackets. This results in
links such as "policy.PASS()", which can be confusing, since the actual
policy is supposed to be "policy.PASS".

Using :any: results in links without the added brackets, which makes
non-function policies less confusing.

4 years agoMerge branch 'prometheus-labels' into 'master'
Tomas Krizek [Fri, 11 Dec 2020 10:57:01 +0000 (11:57 +0100)] 
Merge branch 'prometheus-labels' into 'master'

Transform Graphite tags into Prometheus labels

Closes #650

See merge request knot/knot-resolver!1109

4 years agoMove transform step to a separate function
Héctor Molinero Fernández [Thu, 10 Dec 2020 19:01:50 +0000 (20:01 +0100)] 
Move transform step to a separate function

4 years agoTransform Graphite tags into Prometheus labels
Héctor Molinero Fernández [Wed, 9 Dec 2020 21:15:02 +0000 (22:15 +0100)] 
Transform Graphite tags into Prometheus labels

4 years agoMerge branch 'release-5-2-1' into 'master' obs-knot-dns-deve-jq0xxt/deployments/1300 obs-knot-dns-deve-jq0xxt/deployments/1302 obs-knot-resolver-8xyvhu/deployments/1298 obs-knot-resolver-es11k1/deployments/1299 obs-knot-resolver-es11k1/deployments/1301 obs-knot-resolver-kv62s6/deployments/1297 v5.2.1
Tomas Krizek [Wed, 9 Dec 2020 09:42:16 +0000 (10:42 +0100)] 
Merge branch 'release-5-2-1' into 'master'

release 5.2.1

See merge request knot/knot-resolver!1108

4 years agorelease 5.2.1 obs-knot-resolver-bs4hbr/deployments/1294
Tomas Krizek [Tue, 8 Dec 2020 17:57:35 +0000 (18:57 +0100)] 
release 5.2.1

4 years agoMerge branch 'renumber_fix' into 'master' obs-knot-dns-deve-jq0xxt/deployments/1295 obs-knot-resolver-es11k1/deployments/1296
Tomas Krizek [Tue, 8 Dec 2020 18:38:09 +0000 (19:38 +0100)] 
Merge branch 'renumber_fix' into 'master'

Renumber module fix

See merge request knot/knot-resolver!1107

4 years agofix renumber module configuration with multiple IP addresses
Christophe Nowicki [Tue, 7 Jul 2020 16:00:59 +0000 (18:00 +0200)] 
fix renumber module configuration with multiple IP addresses

4 years agorenumber tests
Petr Špaček [Wed, 8 Jul 2020 06:39:51 +0000 (08:39 +0200)] 
renumber tests

4 years agoconfig tests: generalize check_answer
Petr Špaček [Mon, 10 Aug 2020 15:30:30 +0000 (17:30 +0200)] 
config tests: generalize check_answer

Finally it does not rely on ordering in the answer.
Stringification seemed like an easy hack for tests, let's see how it
works in the long term.

4 years agotests: verbose stack traces from config tests
Petr Špaček [Wed, 8 Jul 2020 12:44:59 +0000 (14:44 +0200)] 
tests: verbose stack traces from config tests

4 years agotests: print stack traces from check_answer callback function
Petr Špaček [Wed, 8 Jul 2020 12:43:09 +0000 (14:43 +0200)] 
tests: print stack traces from check_answer callback function

4 years agotests: typo fix
Petr Špaček [Wed, 8 Jul 2020 07:21:36 +0000 (09:21 +0200)] 
tests: typo fix

4 years agotests: detect empty config test sets
Petr Špaček [Wed, 8 Jul 2020 07:21:09 +0000 (09:21 +0200)] 
tests: detect empty config test sets

4 years agotests: sort config test order in modules/meson.build
Petr Špaček [Wed, 8 Jul 2020 06:38:31 +0000 (08:38 +0200)] 
tests: sort config test order in modules/meson.build

4 years agoMerge branch 'auto_free-generic' into 'master'
Tomas Krizek [Tue, 8 Dec 2020 15:23:30 +0000 (16:23 +0100)] 
Merge branch 'auto_free-generic' into 'master'

contrib/cleanup: loosen type-checking in auto_free

See merge request knot/knot-resolver!1100

4 years agocontrib/cleanup: loosen type-checking in auto_free
Vladimír Čunát [Mon, 30 Nov 2020 06:39:24 +0000 (07:39 +0100)] 
contrib/cleanup: loosen type-checking in auto_free

- advantage:    `auto_free anyType *foo;` works (for anyType != char)
- disadvantage: `auto_free anyType bar;` is also accepted,
  though I expect such problems will be relatively easy to debug.

4 years agoMerge branch 'ci-gh-actions-fix' into 'master'
Tomas Krizek [Tue, 8 Dec 2020 10:45:08 +0000 (11:45 +0100)] 
Merge branch 'ci-gh-actions-fix' into 'master'

ci: improve GH actions error handling

See merge request knot/knot-resolver!1106

4 years agoci: improve GH actions error handling
Tomas Krizek [Mon, 7 Dec 2020 09:42:30 +0000 (10:42 +0100)] 
ci: improve GH actions error handling