From 73f6ce7d6eca51f0e8f62717e18e764787ab6528 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20=C4=8Cun=C3=A1t?= <vladimir.cunat@nic.cz> Date: Tue, 8 Feb 2022 12:46:55 +0100 Subject: [PATCH] modules/dnstap: don't do anything on loading the module 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 | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/modules/dnstap/dnstap.c b/modules/dnstap/dnstap.c index f8b471fcc..a137dadb7 100644 --- a/modules/dnstap/dnstap.c +++ b/modules/dnstap/dnstap.c @@ -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 { -- GitLab