Vladimír Čunát [Thu, 15 Dec 2016 15:42:24 +0000 (16:42 +0100)]
allow generating most cdefs for lua
Motivation: maintaining these by hand in kres.lua is tricky, as just
inserting or reordering the structures can do anything and isn't
detected in general. For example, `rr_array_t::at` has always
"missed a star".
A couple libknot structure fields have apparently changed name since
the old definitions were written; in most cases I renamed them in *.lua.
The file daemon/lua/kres-gen.lua will be regenerated only if explicitly
deleted. That requires building with debug symbols and gdb on $PATH.
Vladimír Čunát [Wed, 7 Dec 2016 12:53:43 +0000 (13:53 +0100)]
--verbose: warn when having no effect
... but don't raise any kind of error.
The lua function `verbose()` behaved reasonably already.
It doesn't warn, but docs for the function do mention `NLOGDEBUG`.
Vladimír Čunát [Wed, 7 Dec 2016 12:05:29 +0000 (13:05 +0100)]
--verbose: make it more efficient when not --verbose
In particular, don't require to call an externally defined function to
find if in --verbose mode or not. Now it's just an extern bool.
I'm confident the performance impact of not using -DNLOGDEBUG should be
negligible now.
This comes with a small incompatible API+ABI change, but that shouldn't
matter as we've had a couple of those already since the last release.
The "portable bytecode" produced by luajit isn't compatible when
(lib)luajit version changes or when some build-time configuration of it
changes. If you mix these up, kresd fails to start.
Vladimír Čunát [Tue, 29 Nov 2016 14:07:48 +0000 (15:07 +0100)]
hints: allow removing hints
Fixes #111.
Compatibility: it needs a new libkres.so function. If a wrong version
combination is attempted, the module just cleanly fails to load, though
it writes a slightly confusing message "no such file or directory".
Vladimír Čunát [Tue, 29 Nov 2016 10:35:22 +0000 (11:35 +0100)]
Merge !76: add EDNS(0) padding support
RFC7830 padding support on client->resolver DNSoverTLS communication.
Adds new `net.tls_padding([padding])` option that will cause the answers
to be aligned at *padding* boundaries.
Vladimír Čunát [Thu, 24 Nov 2016 08:56:16 +0000 (09:56 +0100)]
Merge !77: lua: embed bytecode instead of stripped source
It seems a bit cleaner, though impact on size and load speed should not
be noticeable. We simply install most of the lua code, as before, and I
assume that we *do* want to keep that visibility, at least by default.
Suggested on !57.
- Drop all make dependencies, so it's only generated when the file
goes missing (i.e. was explicitly deleted).
- Add checks into the generator to avoid producing empty strings on
failures. It compiled correctly and wasn't easy to debug.
- Drop all make dependencies, so it's only generated when the file
goes missing (i.e. was explicitly deleted).
- Add checks into the generator to avoid producing empty strings on
failures. It compiled correctly and wasn't easy to debug.
Vladimír Čunát [Mon, 14 Nov 2016 13:54:15 +0000 (14:54 +0100)]
lua: embed bytecode instead of stripped source
It seems a bit cleaner, though impact on size and load speed should not
be noticeable. We simply install most of the lua code, as before, and I
assume that we *do* want to keep that visibility, at least by default.
Suggested on !57.
Vladimír Čunát [Mon, 14 Nov 2016 07:13:03 +0000 (08:13 +0100)]
Merge branch 'lua-ffi-structs' into 'master'
lua ffi bindings: fix incorrect structs
Some structures have changed but lua was still using the old ABI.
I think no our lua code used the fields misplaced due to this,
except an example in documentation.
I didn't check much of the ABI in there. I wish I knew some
(half-)automatic way how to do that.
Ondřej Surý [Sat, 12 Nov 2016 09:13:54 +0000 (10:13 +0100)]
Merge branch 'allow_to_set_hostname' into 'master'
Allow to override hostname() with a lua call hostname("example.com")
This changes lua hostname() call to accept optional parameter with new hostname. This is needed to override possibly wrong name used for ephemeral certs.
Vladimír Čunát [Tue, 8 Nov 2016 18:24:28 +0000 (19:24 +0100)]
lua ffi bindings: fix incorrect structs
Some structures have changed but lua was still using the old ABI.
I think no our lua code used the fields misplaced due to this,
except an example in documentation.
I didn't check much of the ABI in there. I wish I knew some
(half-)automatic way how to do that.
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.