summaryrefslogtreecommitdiff
path: root/usr.sbin/nsd/dnstap/dnstap_collector.c
diff options
context:
space:
mode:
Diffstat (limited to 'usr.sbin/nsd/dnstap/dnstap_collector.c')
-rw-r--r--usr.sbin/nsd/dnstap/dnstap_collector.c17
1 files changed, 15 insertions, 2 deletions
diff --git a/usr.sbin/nsd/dnstap/dnstap_collector.c b/usr.sbin/nsd/dnstap/dnstap_collector.c
index 1578bdfb00e..1a0bc85250f 100644
--- a/usr.sbin/nsd/dnstap/dnstap_collector.c
+++ b/usr.sbin/nsd/dnstap/dnstap_collector.c
@@ -65,10 +65,24 @@ struct dt_collector* dt_collector_create(struct nsd* nsd)
int bufsz = buffer_capacity(dt_col->send_buffer);
sv[0] = -1; /* For receiving by parent (dnstap-collector) */
sv[1] = -1; /* For sending by child (server childs) */
- if(socketpair(AF_UNIX, SOCK_DGRAM | SOCK_NONBLOCK, 0, sv) < 0) {
+ if(socketpair(AF_UNIX, SOCK_DGRAM
+#ifdef SOCK_NONBLOCK
+ | SOCK_NONBLOCK
+#endif
+ , 0, sv) < 0) {
error("dnstap_collector: cannot create communication channel: %s",
strerror(errno));
}
+#ifndef SOCK_NONBLOCK
+ if (fcntl(sv[0], F_SETFL, O_NONBLOCK) == -1) {
+ log_msg(LOG_ERR, "dnstap_collector receive fd fcntl "
+ "failed: %s", strerror(errno));
+ }
+ if (fcntl(sv[1], F_SETFL, O_NONBLOCK) == -1) {
+ log_msg(LOG_ERR, "dnstap_collector send fd fcntl "
+ "failed: %s", strerror(errno));
+ }
+#endif
if(setsockopt(sv[0], SOL_SOCKET, SO_RCVBUF, &bufsz, sizeof(bufsz))) {
log_msg(LOG_ERR, "setting dnstap_collector "
"receive buffer size failed: %s", strerror(errno));
@@ -422,7 +436,6 @@ void dt_collector_start(struct dt_collector* dt_col, struct nsd* nsd)
#endif
udb_base_free_keep_mmap(nsd->task[0]);
udb_base_free_keep_mmap(nsd->task[1]);
- namedb_close_udb(nsd->db); /* keeps mmap */
namedb_close(nsd->db);
dt_collector_run(dt_col, nsd);