diff --git a/dnstap/dnstap.c b/dnstap/dnstap.c index 5d0420f6f..631ccd7ad 100644 --- a/dnstap/dnstap.c +++ b/dnstap/dnstap.c @@ -39,6 +39,8 @@ #include "config.h" #include #include +#include +#include #include "sldns/sbuffer.h" #include "util/config_file.h" #include "util/net_help.h" @@ -118,6 +120,18 @@ dt_msg_init(const struct dt_env *env, } } +/* check that the socket file can be opened and exists, print error if not */ +static void +check_socket_file(const char* socket_path) +{ + struct stat statbuf; + memset(&statbuf, 0, sizeof(statbuf)); + if(stat(socket_path, &statbuf) < 0) { + log_warn("could not open dnstap-socket-path: %s, %s", + socket_path, strerror(errno)); + } +} + struct dt_env * dt_create(const char *socket_path, unsigned num_workers) { @@ -134,6 +148,7 @@ dt_create(const char *socket_path, unsigned num_workers) socket_path); log_assert(socket_path != NULL); log_assert(num_workers > 0); + check_socket_file(socket_path); env = (struct dt_env *) calloc(1, sizeof(struct dt_env)); if (!env) diff --git a/doc/Changelog b/doc/Changelog index 3002473f1..0f2372b84 100644 --- a/doc/Changelog +++ b/doc/Changelog @@ -1,6 +1,8 @@ 22 October 2018: Wouter - Fix #4192: unbound-control-setup generates keys not readable by group. + - check that the dnstap socket file can be opened and exists, print + error if not. 22 October 2018: Ralph - Change fast-server-num default to 3.