]> git.ipfire.org Git - thirdparty/knot-resolver.git/log
thirdparty/knot-resolver.git
4 years agodaemon/http: fix crash on large buffers and document logic issues obs-knot-resolver-8xyvhu/deployments/1795 odvr
Tomas Krizek [Fri, 23 Jul 2021 15:21:07 +0000 (17:21 +0200)] 
daemon/http: fix crash on large buffers and document logic issues

4 years agodaemon/session: fix an issue with timers obs-knot-resolver-8xyvhu/deployments/1793
Vladimír Čunát [Thu, 22 Jul 2021 16:23:37 +0000 (18:23 +0200)] 
daemon/session: fix an issue with timers

The practical problem was also mitigated by libuv >= 1.32.0 (2ee2d46)

4 years agodaemon/http: add more info to debug messagess obs-knot-resolver-8xyvhu/deployments/1791
Tomas Krizek [Wed, 21 Jul 2021 11:36:17 +0000 (13:36 +0200)] 
daemon/http: add more info to debug messagess

4 years agodaemon/http: add helper assert to detect potential memleak
Tomas Krizek [Fri, 2 Jul 2021 09:46:45 +0000 (11:46 +0200)] 
daemon/http: add helper assert to detect potential memleak

4 years agodaemon/worker: ensure HTTP headers are freed on ignored queries
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.

4 years agodaemon/http: refactor submitting to wirebuffer
Tomas Krizek [Wed, 30 Jun 2021 20:47:38 +0000 (22:47 +0200)] 
daemon/http: refactor submitting to wirebuffer

4 years agodaemon/http: ensure missing variable in URI is treated as error
Tomas Krizek [Wed, 30 Jun 2021 20:43:11 +0000 (22:43 +0200)] 
daemon/http: ensure missing variable in URI is treated as error

4 years agodaemon/http: ensure headers are freed
Tomas Krizek [Wed, 30 Jun 2021 14:20:21 +0000 (16:20 +0200)] 
daemon/http: ensure headers are freed

4 years agodaemon/http: refactor freeing headers into function
Tomas Krizek [Wed, 30 Jun 2021 14:18:54 +0000 (16:18 +0200)] 
daemon/http: refactor freeing headers into function

4 years agofixup! log: lua logging
Vladimír Čunát [Wed, 14 Jul 2021 15:57:34 +0000 (17:57 +0200)] 
fixup! log: lua logging

4 years agofixup! treewide: replace VERBOSE_STATUS, WITH_VERBOSE, etc.
Vladimír Čunát [Tue, 13 Jul 2021 17:27:07 +0000 (19:27 +0200)] 
fixup! treewide: replace VERBOSE_STATUS, WITH_VERBOSE, etc.

I forgot that in some parts of code `qry` used for logging
could really be NULL; I suppose this should be cheap enough.

4 years agolib/utils: drop a pair of unused macros
Vladimír Čunát [Tue, 13 Jul 2021 11:18:18 +0000 (13:18 +0200)] 
lib/utils: drop a pair of unused macros

4 years agotreewide: replace VERBOSE_STATUS, WITH_VERBOSE, etc.
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.

4 years agovalidate: add kr_rrset_validation_ctx_t::log_qry
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)

4 years agolib/log: add kr_log_is_debug*()
Vladimír Čunát [Mon, 12 Jul 2021 20:19:20 +0000 (22:19 +0200)] 
lib/log: add kr_log_is_debug*()

... and optimize a suspect hot path (through VERBOSE_MSG)

4 years agofixup! rework logging from control sockets (+simplify)
Vladimír Čunát [Mon, 12 Jul 2021 20:58:57 +0000 (22:58 +0200)] 
fixup! rework logging from control sockets (+simplify)

4 years agolib/log: make trace-logging not prevent normal logging
Vladimír Čunát [Mon, 12 Jul 2021 19:37:52 +0000 (21:37 +0200)] 
lib/log: make trace-logging not prevent normal logging

I think it's an old issue, but why not fix it now.
I believe it's better when these two are "independent".

Removed comment: once upon a time it belonged to auto_free
and similar macros, but somehow it survived various moves.

4 years agorework logging from control sockets (+simplify)
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

4 years agoQRVERBOSE: fix ignoring the log groups
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).

4 years agolib/log: typing improvements
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

4 years agofixup! logging: use LOG_GRP_HTTP for http lua module
Tomas Krizek [Thu, 8 Jul 2021 16:08:16 +0000 (18:08 +0200)] 
fixup! logging: use LOG_GRP_HTTP for http lua module

4 years agofixup! logging: use dedicated DOTAUTH log for experimental auth DoT
Tomas Krizek [Thu, 8 Jul 2021 16:07:46 +0000 (18:07 +0200)] 
fixup! logging: use dedicated DOTAUTH log for experimental auth DoT

4 years agologging: fix GNUTLS logging
Tomas Krizek [Thu, 8 Jul 2021 15:49:29 +0000 (17:49 +0200)] 
logging: fix GNUTLS logging

- ensure gnutls logging can be turned on/off by using GNUTLS log group
- keep TLS / TLSCLIENT as log groups for our TLS logs and use GNUTLS
  instead

4 years agologging: use LOG_GRP_HTTP for http lua module
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.

4 years agologging: nitpicks
Tomas Krizek [Thu, 8 Jul 2021 14:40:42 +0000 (16:40 +0200)] 
logging: nitpicks

4 years agologging: use dedicated DOTAUTH log for experimental auth DoT
Tomas Krizek [Thu, 8 Jul 2021 14:40:32 +0000 (16:40 +0200)] 
logging: use dedicated DOTAUTH log for experimental auth DoT

4 years agologging: rename *_log_groups() function to plural
Tomas Krizek [Thu, 8 Jul 2021 14:31:27 +0000 (16:31 +0200)] 
logging: rename *_log_groups() function to plural

Plural makes more sense to me here, since it can take a table with
multiple entries as input.

4 years agologging: add test for log groups
Tomas Krizek [Thu, 8 Jul 2021 11:32:37 +0000 (13:32 +0200)] 
logging: add test for log groups

Besides testing the API, running this test also ensures all log groups
have been properly defined (as long as kr_assertions are turned on).

4 years agologging: add missing LOG_GRP_PLAN
Tomas Krizek [Wed, 7 Jul 2021 15:17:55 +0000 (17:17 +0200)] 
logging: add missing LOG_GRP_PLAN

4 years agologging: fix get_log_group()
Tomas Krizek [Thu, 8 Jul 2021 11:30:22 +0000 (13:30 +0200)] 
logging: fix get_log_group()

To ensure all log groups have been properly defined, iterate over the
entire enum. If a value is missing, assert will be triggered.

Also fixes groups with number >=32 (32bit value was used to test
whether group is set before).

4 years agologging: add LOG_GRP_DEVEL
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.

4 years agologging: print group name padded to 6 characters
Tomas Krizek [Thu, 8 Jul 2021 01:37:43 +0000 (03:37 +0200)] 
logging: print group name padded to 6 characters

Add space padding when printing the group name to allow usage of
regular group names in lua code (e.g. "io" instead of "io    ").

4 years agologging: add get_log_group() with better API
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.

4 years agologging: ensure get/set_log_level behaves consistently
Tomas Krizek [Wed, 7 Jul 2021 13:45:26 +0000 (15:45 +0200)] 
logging: ensure get/set_log_level behaves consistently

Ensure both these functions return string that represents the log level.

Also avoid using printf - it'd probably break API when using map().

4 years agolib: make NOTICE the default log level
Tomas Krizek [Wed, 7 Jul 2021 13:22:01 +0000 (15:22 +0200)] 
lib: make NOTICE the default log level

I think notice is a good default - it should be used for scarce messages
that the user should see, while info level provides more low level info.

It could make sense to increase the log level to info if running with
journalctl (but it might be overkill).

4 years agodaemon/main: log interactive message properly
Tomas Krizek [Wed, 7 Jul 2021 13:21:41 +0000 (15:21 +0200)] 
daemon/main: log interactive message properly

4 years agofixup! log: fix CI tests
Lukáš Ježek [Fri, 2 Jul 2021 13:45:20 +0000 (15:45 +0200)] 
fixup! log: fix CI tests

4 years agolog: fix kr_log_fmt SIGSEGV crash
Lukáš Ježek [Fri, 2 Jul 2021 13:15:01 +0000 (15:15 +0200)] 
log: fix kr_log_fmt SIGSEGV crash

4 years agolog: use kr_log_debug instead kr_log_verbose
Lukáš Ježek [Fri, 2 Jul 2021 13:09:29 +0000 (15:09 +0200)] 
log: use kr_log_debug instead kr_log_verbose

4 years agolog: fix CI tests
Lukáš Ježek [Fri, 2 Jul 2021 07:32:51 +0000 (09:32 +0200)] 
log: fix CI tests

4 years agolog: lua logging
Lukáš Ježek [Thu, 24 Jun 2021 11:53:22 +0000 (13:53 +0200)] 
log: lua logging

4 years agolog: fix CI tests
Lukáš Ježek [Tue, 22 Jun 2021 12:25:42 +0000 (14:25 +0200)] 
log: fix CI tests

4 years agolog: shortening LOG_GRP_<SOMETHING> to <SOMETHING>
Lukáš Ježek [Fri, 18 Jun 2021 13:02:17 +0000 (15:02 +0200)] 
log: shortening LOG_GRP_<SOMETHING> to <SOMETHING>

4 years agolog: remove hard-coded prefix from log messages
Lukáš Ježek [Fri, 18 Jun 2021 08:14:56 +0000 (10:14 +0200)] 
log: remove hard-coded prefix from log messages

4 years agolog: add level prefix to each message
Lukáš Ježek [Tue, 15 Jun 2021 10:35:53 +0000 (12:35 +0200)] 
log: add level prefix to each message

4 years agolog: remove NOVERBOSELOG option
Lukáš Ježek [Thu, 10 Jun 2021 12:00:28 +0000 (14:00 +0200)] 
log: remove NOVERBOSELOG option

4 years agolog: lua: add list_log_group
Lukáš Ježek [Wed, 9 Jun 2021 11:32:34 +0000 (13:32 +0200)] 
log: lua: add list_log_group

4 years agofixup! log: add syslog target, systemd
Lukáš Ježek [Wed, 9 Jun 2021 12:11:34 +0000 (14:11 +0200)] 
fixup! log: add syslog target, systemd

4 years agofixup! log: groups lua interface
Lukáš Ježek [Wed, 9 Jun 2021 11:04:33 +0000 (13:04 +0200)] 
fixup! log: groups lua interface

4 years agofixup! log: split to groups
Lukáš Ježek [Wed, 9 Jun 2021 09:47:00 +0000 (11:47 +0200)] 
fixup! log: split to groups

4 years agofixup! log: add syslog target, systemd
Lukáš Ježek [Wed, 9 Jun 2021 09:34:27 +0000 (11:34 +0200)] 
fixup! log: add syslog target, systemd

4 years agofixup! log: groups lua interface
Lukáš Ježek [Wed, 9 Jun 2021 07:35:20 +0000 (09:35 +0200)] 
fixup! log: groups lua interface

4 years agofixup! log: lua interface
Lukáš Ježek [Wed, 9 Jun 2021 07:15:05 +0000 (09:15 +0200)] 
fixup! log: lua interface

4 years agofixup! log: remove kr_verbose_set
Lukáš Ježek [Wed, 9 Jun 2021 06:48:07 +0000 (08:48 +0200)] 
fixup! log: remove kr_verbose_set

4 years agofixup! log: split to groups
Lukáš Ježek [Fri, 4 Jun 2021 08:32:31 +0000 (10:32 +0200)] 
fixup! log: split to groups

4 years agofixup! log: lua interface
Lukáš Ježek [Fri, 4 Jun 2021 08:27:21 +0000 (10:27 +0200)] 
fixup! log: lua interface

4 years agofixup! log: remove kr_verbose_set
Lukáš Ježek [Fri, 4 Jun 2021 08:23:17 +0000 (10:23 +0200)] 
fixup! log: remove kr_verbose_set

4 years agolog: groups lua interface
Lukáš Ježek [Fri, 28 May 2021 13:18:11 +0000 (15:18 +0200)] 
log: groups lua interface

4 years agolog: fix journal metadata
Lukáš Ježek [Tue, 25 May 2021 14:15:44 +0000 (16:15 +0200)] 
log: fix journal metadata

4 years agolog: split to groups
Lukáš Ježek [Mon, 24 May 2021 09:13:53 +0000 (11:13 +0200)] 
log: split to groups

4 years agolog: lua interface
Lukáš Ježek [Tue, 18 May 2021 06:42:13 +0000 (08:42 +0200)] 
log: lua interface

4 years agolog: add syslog target, systemd
Lukáš Ježek [Thu, 13 May 2021 08:50:57 +0000 (10:50 +0200)] 
log: add syslog target, systemd

4 years agolog: remove kr_verbose_status
Lukáš Ježek [Tue, 4 May 2021 10:03:26 +0000 (12:03 +0200)] 
log: remove kr_verbose_status

4 years agolog: remove kr_verbose_set
Lukáš Ježek [Tue, 4 May 2021 08:39:33 +0000 (10:39 +0200)] 
log: remove kr_verbose_set

4 years agolog: add log levels
Lukáš Ježek [Fri, 30 Apr 2021 07:39:23 +0000 (09:39 +0200)] 
log: add log levels

4 years agoMerge branch 'selection-txn' into 'master' obs-knot-dns-deve-jq0xxt/deployments/1734 obs-knot-dns-deve-jq0xxt/deployments/1736 obs-knot-dns-deve-jq0xxt/deployments/1738 obs-knot-dns-deve-jq0xxt/deployments/1740 obs-knot-dns-deve-jq0xxt/deployments/1742 obs-knot-resolver-es11k1/deployments/1733 obs-knot-resolver-es11k1/deployments/1735 obs-knot-resolver-es11k1/deployments/1737 obs-knot-resolver-es11k1/deployments/1739 obs-knot-resolver-es11k1/deployments/1741
Tomas Krizek [Fri, 18 Jun 2021 11:52:38 +0000 (11:52 +0000)] 
Merge branch 'selection-txn' into 'master'

lib/selection: be more careful with RO transactions

See merge request knot/knot-resolver!1184

4 years agolib/selection: be more careful with RO transactions
Vladimír Čunát [Fri, 21 May 2021 15:29:25 +0000 (17:29 +0200)] 
lib/selection: be more careful with RO transactions

They probably couldn't hang open for long, as each client request
should cause some cache-searching and thus close it, and even with
queries stopping I haven't managed to find a case where it would be
left open but... it's nicer to clean up and it should be very cheap.

4 years agoMerge branch 'task-refcount-minimal' into 'master'
Tomas Krizek [Fri, 18 Jun 2021 10:51:12 +0000 (10:51 +0000)] 
Merge branch 'task-refcount-minimal' into 'master'

daemon/worker: fix a memory leak

See merge request knot/knot-resolver!1182

4 years agodaemon/worker: fix a memory leak
Vladimír Čunát [Tue, 1 Jun 2021 14:26:04 +0000 (16:26 +0200)] 
daemon/worker: fix a memory leak

Discovered case: TCP write towards upstream fails due to ECONNRESET,
and on this place of code we "forget" the whole qr_task and thus its
corresponding kr_request, so it remains unanswered and using memory.

4 years agoMerge branch 'ci-centos8' into 'master'
Tomas Krizek [Fri, 18 Jun 2021 08:17:28 +0000 (08:17 +0000)] 
Merge branch 'ci-centos8' into 'master'

ci: allow failure of CentOS 8 packaging tests

See merge request knot/knot-resolver!1185

4 years agoci: allow failure of CentOS 8 packaging tests
Tomas Krizek [Wed, 16 Jun 2021 09:32:16 +0000 (11:32 +0200)] 
ci: allow failure of CentOS 8 packaging tests

Once again there's an issue with libuv-devel. Since the distro is EOL in
6 months, I'm not going to waste effort with investigating or fixing it.

4 years agoMerge branch 'disable-asserts' into 'master' obs-knot-dns-deve-jq0xxt/deployments/1718 obs-knot-dns-deve-jq0xxt/deployments/1720 obs-knot-dns-deve-jq0xxt/deployments/1722 obs-knot-dns-deve-jq0xxt/deployments/1724 obs-knot-dns-deve-jq0xxt/deployments/1726 obs-knot-dns-deve-jq0xxt/deployments/1728 obs-knot-dns-deve-jq0xxt/deployments/1730 obs-knot-dns-deve-jq0xxt/deployments/1732 obs-knot-resolver-es11k1/deployments/1717 obs-knot-resolver-es11k1/deployments/1719 obs-knot-resolver-es11k1/deployments/1721 obs-knot-resolver-es11k1/deployments/1723 obs-knot-resolver-es11k1/deployments/1725 obs-knot-resolver-es11k1/deployments/1727 obs-knot-resolver-es11k1/deployments/1729 obs-knot-resolver-es11k1/deployments/1731
Tomas Krizek [Thu, 10 Jun 2021 10:57:01 +0000 (10:57 +0000)] 
Merge branch 'disable-asserts' into 'master'

meson: disable assertions

See merge request knot/knot-resolver!1183

4 years agomeson: disable assertions
Tomas Krizek [Thu, 10 Jun 2021 09:28:49 +0000 (11:28 +0200)] 
meson: disable assertions

Make sure assertions are turned off - we use our own mechanism
(implemented in !1146), so this mostly affects foreign code, like Knot
DNS headers.

https://gitlab.nic.cz/knot/knot-resolver/-/merge_requests/1146#note_203044

4 years agoMerge branch 'apkg' into 'master'
Tomas Krizek [Thu, 10 Jun 2021 10:53:42 +0000 (10:53 +0000)] 
Merge branch 'apkg' into 'master'

distro: add apkg support

See merge request knot/knot-resolver!1178

4 years agoci: reorder pipeline
Tomas Krizek [Thu, 10 Jun 2021 10:18:21 +0000 (12:18 +0200)] 
ci: reorder pipeline

4 years agoci: reuse pkg artifacts obs-knot-resolver-bs4hbr/deployments/1715
Tomas Krizek [Tue, 8 Jun 2021 14:52:40 +0000 (16:52 +0200)] 
ci: reuse pkg artifacts

4 years agoscripts: remove scripts obsoleted by apkg
Tomas Krizek [Tue, 8 Jun 2021 14:25:10 +0000 (16:25 +0200)] 
scripts: remove scripts obsoleted by apkg

4 years agodistro/pkg: support custom release numbers
Tomas Krizek [Tue, 8 Jun 2021 14:15:31 +0000 (16:15 +0200)] 
distro/pkg: support custom release numbers

4 years agoscripts: update OBS source creation script
Tomas Krizek [Tue, 8 Jun 2021 13:38:45 +0000 (15:38 +0200)] 
scripts: update OBS source creation script

4 years agoci: switch to Debian 11
Tomas Krizek [Mon, 7 Jun 2021 15:19:26 +0000 (17:19 +0200)] 
ci: switch to Debian 11

4 years agoscripts/make-archive: allow creation of tagged archive
Tomas Krizek [Mon, 7 Jun 2021 11:42:43 +0000 (13:42 +0200)] 
scripts/make-archive: allow creation of tagged archive

4 years agoci: split pkgtest into separate child pipeline
Tomas Krizek [Tue, 1 Jun 2021 13:31:30 +0000 (15:31 +0200)] 
ci: split pkgtest into separate child pipeline

4 years agoci: build and install packages with apkg
Tomas Krizek [Tue, 18 May 2021 13:03:28 +0000 (15:03 +0200)] 
ci: build and install packages with apkg

4 years agodistro: add apkg support
Jakub Ružička [Tue, 16 Feb 2021 16:42:25 +0000 (17:42 +0100)] 
distro: add apkg support

4 years agomove distro files into apkg template dir
Jakub Ružička [Tue, 16 Feb 2021 16:34:18 +0000 (17:34 +0100)] 
move distro files into apkg template dir

4 years agoMerge branch 'kind-doh-legacy' into 'master'
Tomas Krizek [Thu, 10 Jun 2021 09:17:00 +0000 (09:17 +0000)] 
Merge branch 'kind-doh-legacy' into 'master'

rename kind="doh" to kind="doh_legacy"

See merge request knot/knot-resolver!1180

4 years agorename kind="doh" to kind="doh_legacy"
Tomas Krizek [Thu, 27 May 2021 13:20:53 +0000 (15:20 +0200)] 
rename kind="doh" to kind="doh_legacy"

The purpose of this change is to make it harder to accidentally use the
legacy DoH implementation and free up the "doh" kind which may be used
as an alias to a modern implementation in the future.

4 years agoMerge branch 'improve-assertions' into 'master' obs-knot-dns-deve-jq0xxt/deployments/1675 obs-knot-dns-deve-jq0xxt/deployments/1678 obs-knot-dns-deve-jq0xxt/deployments/1680 obs-knot-dns-deve-jq0xxt/deployments/1682 obs-knot-dns-deve-jq0xxt/deployments/1684 obs-knot-dns-deve-jq0xxt/deployments/1686 obs-knot-dns-deve-jq0xxt/deployments/1688 obs-knot-dns-deve-jq0xxt/deployments/1690 obs-knot-dns-deve-jq0xxt/deployments/1692 obs-knot-dns-deve-jq0xxt/deployments/1694 obs-knot-dns-deve-jq0xxt/deployments/1696 obs-knot-dns-deve-jq0xxt/deployments/1698 obs-knot-dns-deve-jq0xxt/deployments/1700 obs-knot-dns-deve-jq0xxt/deployments/1709 obs-knot-dns-deve-jq0xxt/deployments/1714 obs-knot-resolver-es11k1/deployments/1674 obs-knot-resolver-es11k1/deployments/1677 obs-knot-resolver-es11k1/deployments/1679 obs-knot-resolver-es11k1/deployments/1681 obs-knot-resolver-es11k1/deployments/1683 obs-knot-resolver-es11k1/deployments/1685 obs-knot-resolver-es11k1/deployments/1687 obs-knot-resolver-es11k1/deployments/1689 obs-knot-resolver-es11k1/deployments/1691 obs-knot-resolver-es11k1/deployments/1693 obs-knot-resolver-es11k1/deployments/1695 obs-knot-resolver-es11k1/deployments/1697 obs-knot-resolver-es11k1/deployments/1699 obs-knot-resolver-es11k1/deployments/1708 obs-knot-resolver-es11k1/deployments/1713
Tomas Krizek [Wed, 26 May 2021 08:03:51 +0000 (08:03 +0000)] 
Merge branch 'improve-assertions' into 'master'

lib/utils: define kr_require(), kr_assume() macros

Closes #495

See merge request knot/knot-resolver!1146

4 years agotreewide: rename assumptions to kr_assert() / kr_fails_assert()
Tomas Krizek [Tue, 25 May 2021 12:17:23 +0000 (14:17 +0200)] 
treewide: rename assumptions to kr_assert() / kr_fails_assert()

To (hopefully) improve readability, rename the typical macro usage of:

    if (!kr_assume(x)) y; // to
    if (kr_fails_assert(x)) y;

As a convenience, replace the assert without a return value to a more
simple version:

    (void)!kr_assume(x);  // becomes
    kr_assert(x);

4 years agolib/dnssec/ta.c: replace asserts
Tomas Krizek [Tue, 25 May 2021 10:40:01 +0000 (12:40 +0200)] 
lib/dnssec/ta.c: replace asserts

4 years agolib/utils kr_ranked_rrarray_add(): clarify RRset sizes
Vladimír Čunát [Mon, 17 May 2021 11:05:02 +0000 (13:05 +0200)] 
lib/utils kr_ranked_rrarray_add(): clarify RRset sizes

4 years agolib/cache assertions: saving to cache is not critical
Vladimír Čunát [Fri, 14 May 2021 09:05:05 +0000 (11:05 +0200)] 
lib/cache assertions: saving to cache is not critical

4 years agolib/cache: simplify rdataset_dematerialize()
Vladimír Čunát [Fri, 14 May 2021 08:44:26 +0000 (10:44 +0200)] 
lib/cache: simplify rdataset_dematerialize()

Trying to handle the NULL here was pointless, so let's simplify.
As it was, it couldn't trigger anyway (would crash earlier).

4 years agolib/cache entry2answer(): trigger failures before jumps
Vladimír Čunát [Wed, 12 May 2021 17:22:01 +0000 (19:22 +0200)] 
lib/cache entry2answer(): trigger failures before jumps

It's a little more verbose, but it should be more valuable in case
we encounter them.

4 years agotreewide: minor C11 cleanup
Vladimír Čunát [Wed, 12 May 2021 17:03:37 +0000 (19:03 +0200)] 
treewide: minor C11 cleanup

4 years agolib/utils kr_fail(): don't mangle errno
Vladimír Čunát [Wed, 12 May 2021 11:48:00 +0000 (13:48 +0200)] 
lib/utils kr_fail(): don't mangle errno

4 years agolib/cookies/nonce.c: remove assert.h include
Lukáš Ježek [Fri, 23 Apr 2021 08:49:47 +0000 (10:49 +0200)] 
lib/cookies/nonce.c: remove assert.h include

4 years agotreewide: eradicate "assert" in comments to fix CI
Vladimír Čunát [Thu, 15 Apr 2021 12:28:35 +0000 (14:28 +0200)] 
treewide: eradicate "assert" in comments to fix CI

4 years agoci: check for "assert" in most C files
Vladimír Čunát [Thu, 15 Apr 2021 11:59:48 +0000 (13:59 +0200)] 
ci: check for "assert" in most C files

4 years agolib/utils kr_fail(): simple rate limit for forking
Vladimír Čunát [Thu, 15 Apr 2021 10:07:09 +0000 (12:07 +0200)] 
lib/utils kr_fail(): simple rate limit for forking

Default 5 minutes (but off).
Randomize the delays +-25%.