- Fix to apply chroot to dnstap-socket-path, if chroot is enabled.

This commit is contained in:
W.C.A. Wijngaards 2020-08-24 14:55:16 +02:00
parent 45712de9a2
commit 45d4cbaa42
3 changed files with 11 additions and 3 deletions

View file

@ -134,9 +134,15 @@ dt_create(struct config_file* cfg)
if(cfg->dnstap && cfg->dnstap_socket_path && cfg->dnstap_socket_path[0] && if(cfg->dnstap && cfg->dnstap_socket_path && cfg->dnstap_socket_path[0] &&
(cfg->dnstap_ip==NULL || cfg->dnstap_ip[0]==0)) { (cfg->dnstap_ip==NULL || cfg->dnstap_ip[0]==0)) {
char* p = fname_after_chroot(cfg->dnstap_socket_path, cfg, 1);
if(!p) {
log_err("malloc failure");
return NULL;
}
verbose(VERB_OPS, "attempting to connect to dnstap socket %s", verbose(VERB_OPS, "attempting to connect to dnstap socket %s",
cfg->dnstap_socket_path); p);
check_socket_file(cfg->dnstap_socket_path); check_socket_file(p);
free(p);
} }
env = (struct dt_env *) calloc(1, sizeof(struct dt_env)); env = (struct dt_env *) calloc(1, sizeof(struct dt_env));

View file

@ -279,7 +279,8 @@ int dt_io_thread_apply_cfg(struct dt_io_thread* dtio, struct config_file *cfg)
return 0; return 0;
} }
free(dtio->socket_path); free(dtio->socket_path);
dtio->socket_path = strdup(cfg->dnstap_socket_path); dtio->socket_path = fname_after_chroot(cfg->dnstap_socket_path,
cfg, 1);
if(!dtio->socket_path) { if(!dtio->socket_path) {
log_err("dnstap setup: malloc failure"); log_err("dnstap setup: malloc failure");
return 0; return 0;

View file

@ -2,6 +2,7 @@
- Fix that dnstap reconnects do not spam the log with the repeated - Fix that dnstap reconnects do not spam the log with the repeated
attempts. Attempts on the timer are only logged on high verbosity, attempts. Attempts on the timer are only logged on high verbosity,
if they produce a connection failure error. if they produce a connection failure error.
- Fix to apply chroot to dnstap-socket-path, if chroot is enabled.
20 August 2020: Ralph 20 August 2020: Ralph
- Fix stats double count issue (#289). - Fix stats double count issue (#289).