Vladimír Čunát [Tue, 8 Nov 2016 16:02:43 +0000 (17:02 +0100)]
layer: refactor and better describe the API
- The API and ABI for modules changes slightly (details below).
KR_MODULE_API is bumped to avoid loading incompatible code.
We have bumped libkres ABIVER since the last release 1.1.1,
so leaving that one intact.
- Make KR_STATE_YIELD not reuse 0 value anymore.
It's easy to e.g. return kr_ok() by mistake.
- struct kr_layer_t:
* ::mm was unused, uninitialized, etc.
* Make ::state an int, as it was everywhere else.
* void *data was ugly and always containing struct kr_request *
- struct kr_layer_api:
* Drop the void* parameter from ::begin, as it was only used
for the request which is available as ctx->req anyway
(formerly ctx->data).
* Drop ::fail. It wasn't even called. Modules can watch for
KR_STATE_FAIL in ::finish.
- Document the apparent meaning of the layer interface, deduced mainly
from the way it's used in the code. Caveats:
* enum knot_layer_state handling seems to assume that it holds exactly
one of the possibilities at a time. The cookie module does NOT
follow that (intentionally), apparently depending on the exact
implementation of the handling at that moment. It feels fragile.
* I was unable to deduce a plausible description of when ::reset is
called. It's practically unused in modules, too.
Vladimír Čunát [Wed, 2 Nov 2016 10:17:23 +0000 (11:17 +0100)]
Merge branch 'p/lru-rebased' into 'master'
lru: new implementation and also interface
The implementation is now a hybrid, slightly described at top of `lib/generic/lru.h`. Also the API is changed a bit, leading to slight simplification of our use patterns. (EDITED)
Vladimír Čunát [Wed, 31 Aug 2016 15:21:47 +0000 (17:21 +0200)]
lru: new implementation and also interface
The implementation is now similar to set-associative caches
that x86 CPU use. Also the API is changed a bit, leading to
slight simplification of our use patterns.
Ondřej Surý [Tue, 18 Oct 2016 07:39:10 +0000 (09:39 +0200)]
Dynamically resolve SONAME for libknot and libzscanner from Makefile
and set libknot_SONAME and libzscanner_SONAME as lua literals.
Remove now obsolete libpath lua function - use find_soname from
platform.mk to define <arg>_SONAME, add lua_pushliteral to
daemon/engine.c and add -D to daemon/daemon.mk for any new library
loaded from Lua.
Based on [issue 28](https://github.com/CZ-NIC/knot-resolver/issues/28), we were able to boost kresd performance running in a Docker container on DockerCloud by nearly 100% by binding to a single interface:ipaddress. It might be handy for other users to know.
Ondřej Surý [Mon, 3 Oct 2016 11:15:52 +0000 (13:15 +0200)]
Merge branch 'p/net.listen' into 'master'
net.listen: make it more flexible
As noted in #94, it feels natural to call it like:
``net.listen({net.lo, '192.168.1.1'})``
Also minor fixes were done in that function and corresponding docs.
Vladimír Čunát [Wed, 7 Sep 2016 12:46:16 +0000 (14:46 +0200)]
net.listen: make it more flexible
As noted in #94, it feels natural to call it like:
``net.listen({net.lo, '192.168.1.1'})``
Also, minor fixes were done in that function and corresponding docs.
Vladimír Čunát [Wed, 24 Aug 2016 15:08:53 +0000 (17:08 +0200)]
don't use kr_crypto_reinit()
We called kr_crypto_init() just before forking and then _reinit() in
all children, but we never did any cryptography in-between - better
initialize after forking.
Note: the function is KR_EXPORT. It might not be useful anymore, but
its removal would require bumping libkres soname.
Ondřej Surý [Wed, 24 Aug 2016 12:03:29 +0000 (14:03 +0200)]
Reuse packet_source address when retrying over TCP. This prevents
timeouts over TCP when <n> first nameservers timeout over UDP as
previously the TCP would connect again to the first and only the
first nameserver in task->addrlist.
This would need to be ultimately fixed in TCP Fast Retransmit.
Marek Vavrusa [Wed, 24 Aug 2016 00:28:47 +0000 (17:28 -0700)]
lib/resolve: track rtt of all tried servers
when doing fast retransmit, each address may be
contacted 1-N times, but previously only cumulative
RTT was tracked for the NS that sent the answer.
now the approximate query start time is subtracted
from cumulative RTT to give an idea how long it
took since the query was actually sent, and all
the NSs that didn't respond within their retransmit
windows are penalised too
Marek Vavrusa [Tue, 23 Aug 2016 21:17:40 +0000 (14:17 -0700)]
lib/resolve: fixed 0x20 with retransmit
bcf3f4b made query_finalize() to be called on
each outbound query before sending, so each
retransmitted query got different 0x20 case
and the only responses from the latest contacted
NS matched.
reverted back the old behaviour where query case
is randomised when an outbound query is generated,
not before sending