Vladimír Čunát [Thu, 2 May 2019 12:15:23 +0000 (14:15 +0200)]
lib/nsrep: refactor a piece of code
This is yet another logically equivalent change after 270d9964.
Now it's written in a way that expresses the original intention more
clearly and without copy&paste or long lines.
It seems easiest to verify by inspecting the meaning of the code
*separartely* for the two cases, based on condition:
cur_addr_score < KR_NS_TIMEOUT
Vladimír Čunát [Mon, 13 May 2019 14:46:48 +0000 (16:46 +0200)]
daemon TCP to upstream: don't send wrong message length
See the added comments. Such bugs are tricky, because the old code
would typically work just fine, only if libuv/OS decided to postpone
copying the data (perhaps large load), we would send two bytes from
this address on C stack - their later value (hard to predict what).
Security risks: the two bytes might theoretically contain information
that was more or less private and we just send it to some DNS server
(possibly over unencrypted TCP), but ATM I find it very unlikely that
this bug could be practically exploited.
Tomas Krizek [Wed, 17 Apr 2019 13:13:28 +0000 (15:13 +0200)]
systemd: use 44353 for DoH port
Using 443 as the default port presents too many packaging challenges.
DoH requires configuration to be useful anyway, so users are free to
override this value as they see fit.
Petr Špaček [Tue, 16 Apr 2019 10:31:05 +0000 (12:31 +0200)]
tests: disable output buffering in config tests
Output buffering in tests made debugging much harder because crash in
middle of operation discarded while buffer and left us without a trace
what was going on.
Vladimír Čunát [Fri, 12 Apr 2019 13:06:02 +0000 (15:06 +0200)]
simplify approach to bind()
The complication is that we need to work with addresses and
just file-descriptors passed from some parent process.
The former approach lead to logical duplication of some steps;
now we add a step converting addresses to file-descriptors.
Thanks to that we always do bind() without touching libuv,
so the problem with forking disappears :-)
Vladimír Čunát [Tue, 16 Apr 2019 10:52:16 +0000 (12:52 +0200)]
lua net.interfaces(): fix mac addresses
Only the first byte was being shown since 3ab77332.
I can't see at all why this part was changed;
the buffer is (and was) way overlong for this,
so writing one zero byte just after the end is OK.
Vladimír Čunát [Fri, 12 Apr 2019 07:22:15 +0000 (09:22 +0200)]
lib/generic/lru: try to resolve alignof warnings
We run meson with -std=gnu11, but apparently some compiler still
complained about it. Unfortunately it wouldn't be easy to use
standard C11 in this case.
Vladimír Čunát [Wed, 3 Apr 2019 17:51:28 +0000 (19:51 +0200)]
lua module layers: avoid incorrect returns on errors
The layer functions are supposed to return the new state.
We've been lucky that errors are negative numbers and thus
they typically passed the (status & KR_STATE_FAIL) test.
Vladimír Čunát [Thu, 14 Mar 2019 12:09:48 +0000 (13:09 +0100)]
module API+ABI: remove one level of indirection
... for layers and props. This breaks C module API+ABI.
It seemed weird to repeatedly call a function that returns a pointer
to a structure in which we find the function we want to actually call.
We've never used changing these functions AFAIK, and the target
functions could easily be written to change their behavior instead
(i.e. move the indirection *inside* the function).
When breaking this, I also removed these two (_layers and _props)
from the dynamic symbols (to be) exported from the C modules.
They always pointed to memory belonging inside the module,
and they seem quite sensible to be set up by the _init symbol instead.
Petr Špaček [Thu, 11 Apr 2019 13:57:06 +0000 (15:57 +0200)]
table_print: simplification
As far as I understand the debug.sethook('call') descrption we are not
going to have any locals except function parameters so we can simplify
the code.
Vladimír Čunát [Mon, 8 Apr 2019 13:54:43 +0000 (15:54 +0200)]
modules/http DoH: allocate req.qsource on req.pool
The problem is that C structures are not scanned by lua GC,
so we'd have to keep these alive in some other way; therefore
it's simpler to just use the mempool.