Vladimír Čunát [Tue, 10 Aug 2021 08:42:54 +0000 (10:42 +0200)]
modules/dns64: add kr_query::flags.DNS64_DISABLE
It's not a perfect solution and with the future policy engine it will
hopefully be better, but it's really trivial to add this already.
(should've done that years ago)
Tomas Krizek [Wed, 18 Aug 2021 13:18:27 +0000 (15:18 +0200)]
doh2: ensure memory from unsent streams is freed
The nghttp2 on_stream_close callback is only called for streams that are
properly closed. If we need to tear down the HTTP connection due to any
reason (e.g. IO error in underlying layer), some streams may not be
propely closed.
Due to HTTP/2 flow control, we may also wait indefinitely for the data
to be written. This can also cause the stream to never be properly
closed.
To handle these cases, a reference of allocated data is kept and we
ensure everything is freed once we're closing the http session.
Vladimír Čunát [Mon, 9 Aug 2021 08:00:12 +0000 (10:00 +0200)]
modules/bogus_log nits
- use notice log level instead of error
The failure is often a normal condition but we probably want it
logged by default (after explicitly loading the module).
- don't repeat the "dnssec" word twice in a row (+update docs)
- docs bogus_log.frequent(): we format tables differently (old change)
Vladimír Čunát [Fri, 6 Aug 2021 17:17:18 +0000 (19:17 +0200)]
policy trace-logging improvements
The logs can be triggered from policy actions, in per-request fashion:
- they're on LOG_DEBUG level but always sent, regardless of log config
- those messages will show double group tags: "[reqdbg][foo ]"
(but they lack proper meta-data - about location of the log's origin)
- reqdbg is *in addition* to normal logs, so the lines may be duplicated
if that's how the logging was configured
Vladimír Čunát [Fri, 6 Aug 2021 09:52:26 +0000 (11:52 +0200)]
adjust RR-dumping style a little
The former "default" dumping style isn't really used anywhere in Knot.
The only visible difference is that RRSIGs are now logged *without*
replacing their TTLs by the original non-decremented TTL values.
That can avoid some confusion when reading debug logs.
(Those original TTLs are still shown a bit further on each line.)
Vladimír Čunát [Mon, 9 Aug 2021 06:41:55 +0000 (08:41 +0200)]
lua kres.type: add new constants
This is all that's missing in comparison to enum knot_rr_type.
For now I didn't remove types that aren't present there (anymore),
even though noone would miss them, most likely.
We don't need to restrict our built-in path defaults to PATH_MAX
characters, as they just can't be that long and it's not an issue if we
shoot over it anyway - opening such a file would only fail.
Tomas Krizek [Fri, 2 Jul 2021 08:48:32 +0000 (10:48 +0200)]
daemon/worker: ensure HTTP headers are freed on ignored queries
Ignored queries never call create_request() where ownership of headers
is taken care of. They need to be explicitly cleared instead, because
we're the owners of the pointer here.
Vladimír Čunát [Wed, 28 Jul 2021 19:00:07 +0000 (21:00 +0200)]
lib/log.h: improve readability (hopefully)
* improve order
- follow grouping of topics more closely (targets, groups, levels)
- order kr_log_LEVEL by severity
* move unneeded <stdarg.h>
* improve doc-comments
- some claims there were even wrong now
- describe some log levels at kr_log_LEVEL
Vladimír Čunát [Wed, 28 Jul 2021 17:29:51 +0000 (19:29 +0200)]
lib/log level names: disregard SYSLOG_NAMES
It's a non-standard feature of syslog.h and I don't think it's worth
the trouble.
We didn't really utilize it; someone would have to #define it,
and moreover we would get into problems if this wasn't being done
the same on all places including log.h.
Making the names adapt to the platform would also mean that
config files and docs wouldn't be portable.
Vladimír Čunát [Wed, 28 Jul 2021 16:26:59 +0000 (18:26 +0200)]
lib/log.h nit: tweak macro for __LINE__
- we don't need doubling the layer in this case,
as the SD_JOURNAL_METADATA macro adds a layer already
- `TO_STR` was perhaps a too short name and could collide
Vladimír Čunát [Tue, 13 Jul 2021 11:05:40 +0000 (13:05 +0200)]
treewide: replace VERBOSE_STATUS, WITH_VERBOSE, etc.
The main problem there was ignoring the log groups,
and VERBOSE_STATUS also ignores trace-logging.
Typically the new kr_log_is_debug*() are the best choice.
In a couple places with heavy WITH_VERBOSE usage it's
instead locally redefined to consider the right group.
Vladimír Čunát [Tue, 13 Jul 2021 10:06:28 +0000 (12:06 +0200)]
validate: add kr_rrset_validation_ctx_t::log_qry
... so we can use it for more precise logging. Some calls get simpler.
In particular, without the associated request, we can't produce anything
into trace-logs, which could be confusing. Normal logs will benefit, too.
(more precise replacement of WITH_VERBOSE will come in a subsequent commit)
Vladimír Čunát [Mon, 12 Jul 2021 18:02:12 +0000 (20:02 +0200)]
rework logging from control sockets (+simplify)
- unify interactive mode to stdout
- use its own logging group
- elevated log level when the command throws an exception
- don't try detecting that the logs go back into the same console
(yes, in that case you can see some lines twice)
- don't make the binary mode turn off logging
Vladimír Čunát [Mon, 12 Jul 2021 20:00:15 +0000 (22:00 +0200)]
QRVERBOSE: fix ignoring the log groups
It would be yet another condition to check; overall I think the
necessary checks would get too complex to be done in a macro
and therefore copied all over the place.
Note: it's interesting that such a change reduces binary size
by about 3% (on master), and I suspect that speed won't suffer at all
(after that TODO is done).
Vladimír Čunát [Mon, 12 Jul 2021 09:27:17 +0000 (11:27 +0200)]
lib/log: typing improvements
- const for names of log groups
- enum kr_log_group for a single log group
- the kr_log_groups bitmap doesn't need to be exposed or even exported
- return bool instead of int
Tomas Krizek [Thu, 8 Jul 2021 15:07:10 +0000 (17:07 +0200)]
logging: use LOG_GRP_HTTP for http lua module
It's better to use separate log group, to separate between logs that
come from the lua module vs native C implementation. It is also more
descriptive, since http modules is used for other stuff besides its
deprecated DoH.
Tomas Krizek [Thu, 8 Jul 2021 11:28:11 +0000 (13:28 +0200)]
logging: add LOG_GRP_DEVEL
This serves two purposes:
1. As a utility logger during development.
2. As the last entry in enum - to make iteration over the values
possible. Changing the value of LOG_GRP_DEVEL shouldn't be an issue,
since it shouldn't be used in production code.
Tomas Krizek [Wed, 7 Jul 2021 15:15:08 +0000 (17:15 +0200)]
logging: add get_log_group() with better API
The function returns a table where key is the group name and the value
is either true (when logging selected group), or nil (when group isn't
selected).
This replaces the list_log_group() which didn't really work.