]> git.ipfire.org Git - thirdparty/knot-resolver.git/commitdiff
modules/dnstap: don't do anything on loading the module
authorVladimír Čunát <vladimir.cunat@nic.cz>
Tue, 8 Feb 2022 11:46:55 +0000 (12:46 +0100)
committerVladimír Čunát <vladimir.cunat@nic.cz>
Mon, 28 Feb 2022 11:00:28 +0000 (12:00 +0100)
Usually in configuration the module is loaded in a separate command
from passing configuration to it.  For dnstap this loading would
immediately lead to opening the default socket path, even if the
configuration actually specifies (a different) path later.

Users can still force using the default by passing an empty table:
`dnstap.config({})` or `modules = { dnstap = {}}`
(though I doubt the utility of the default /tmp/dnstap.sock anyway)

modules/dnstap/dnstap.c

index f8b471fcc879a854add85bf738524616ff94d715..a137dadb740cc6d6ea36f921932fccb75a562ab4 100644 (file)
@@ -404,11 +404,12 @@ static bool find_bool(const JsonNode *node) {
 KR_EXPORT
 int dnstap_config(struct kr_module *module, const char *conf) {
        dnstap_clear(module);
+       if (!conf) return kr_ok(); /* loaded module without configuring */
        struct dnstap_data *data = module->data;
        auto_free char *sock_path = NULL;
 
        /* Empty conf passed, set default */
-       if (!conf || strlen(conf) < 1) {
+       if (strlen(conf) < 1) {
                sock_path = strdup(DEFAULT_SOCK_PATH);
        } else {