Marek Vavruša [Wed, 28 Mar 2018 05:43:53 +0000 (22:43 -0700)]
daemon: allow per-request variables in Lua
The handlers in Lua can now store per-request variables that are automatically
GC'd when the request is finished. This is useful for stateful modules,
such as DNS64 that uses internal option flags for state tracking.
The layers can now get a variable table like so:
```
local vars = kres.request_t(r):vars()
vars.hello = true
```
The variables are persisted between different layers for each request.
synchronize distro/deb with official debian packaging
Note that this is not an exact synchronization, just the salient parts
where i believe upstream wants to sync up with debian.
I've left alone indications of upstream package maintainership, and
I've left debhelper back at version 9, for example. and i've left the
differences between the shipped debian/kresd.conf (debian package
ships a minimal kresd.conf that doesn't load those four modules, in
particular).
See also discussion about this same problem in libknot from a couple
years ago:
https://bugs.debian.org/840460
I note that contrib/wire.h in knot-resolver is out of sync with
src/contrib/wire.h (and src/contrib/endian.h) from libknot. I don't
know whether there's any upstream preference for keeping these in sync
in some more reliable way than manual comparisons. For now i'm just
providing a narrow fix for the specific problem.
Vladimír Čunát [Wed, 16 May 2018 08:19:48 +0000 (10:19 +0200)]
validate: be more careful with marking RRs as insecure
In case of referrals the authoritative server might add also another NS
record(s), and this might lead to downgrading the corresponding zones.
Regressed probably in f0da0a35 !505.
Vladimír Čunát [Fri, 13 Apr 2018 16:09:31 +0000 (18:09 +0200)]
lua bindings: complete knot_pkt_t
We don't need the end, but I prefer to get rid of the exception,
as we now require libknot > 2.6 anyway and it only implies adding
a few more binding lines.
Vladimír Čunát [Tue, 24 Apr 2018 14:14:29 +0000 (16:14 +0200)]
policy docs: replace incorrect example
The example didn't work and I don't immediately see how to quickly fix
it, so let's have another more complex example instead (fished from an
older forum post of mine).
Marek Vavruša [Mon, 9 Apr 2018 07:01:53 +0000 (00:01 -0700)]
iterate: allow lame negative answers in PERMISSIVE mode
Some nameservers are hopelessly broken (ns1-ord.salesforce.com),
and will return lame negative answers which will flag the nameserver
as bad, so it wouldn't be picked for valid queries.
Marek Vavruša [Fri, 6 Apr 2018 05:43:57 +0000 (22:43 -0700)]
check per-query flags instead of global options, getter for NS name
Checking query flags instead of global context option allows setting
overrides on individual queries. The effect is the same as query flags
start by copying request flags which start by copying context options.
Marek Vavruša [Fri, 6 Apr 2018 05:48:51 +0000 (22:48 -0700)]
add bindings for the checkout layer
This one was missing from the current bindings. The checkout layer
runs when the worker attempts to send a DNS query to given upstream
when the address is already determined. The layer can add EDNS options
or update outbound query, or block particular addresses / protocol.
Marek Vavruša [Fri, 16 Mar 2018 02:27:59 +0000 (19:27 -0700)]
lib/utils: fixed memory corruption in kr_pkt_recycle and kr_pkt_clear_payload
Previous implementation forgot to clear the compression table, which is
an internal structure to packet. So when a recycled packet was reused,
it compared owners of newly inserted records with dangling pointers left
in the compression table.
This is less of a problem in query processing,
as each packet uses a memory pool, so the pointed names were never deallocated,
but it would write out wrong compression pointers because the compression
table kept pointing into packet that was now cleared and reused for something else.
It is more of a problem with packets created without a memory pool,
as the compression table kept references to memory that was already freed.
Vladimír Čunát [Mon, 23 Apr 2018 12:26:48 +0000 (14:26 +0200)]
cache: restored kr_cache_insert_rr API
This commit abstracts out stash_rrset from stash_rrarray_entry,
and fixes incrementing metrics on actual record insertion.
It then resurfaces kr_cache_insert_rr that was deleted in 2.0
using the extracted function.
vcunat separated stash_rrset_precond() later during rebase.
This is an attempt to fix two problems:
1. kresd tries to close incoming TCP connection too early. This may lead
to multiple client reconnections. This problem primarily
affects TCP/TLS clients who send several queries over single TCP connection.
2. In certain circumstances outbound TCP connection doesn't timeout
despite that fact that upstream doesn't send back any answers.
This may lead to timeouts on non-problematic queries.