From 614bfa37ebf86560330357bdb7cccbbf3464ed94 Mon Sep 17 00:00:00 2001 From: Remi Gacogne Date: Fri, 30 Sep 2016 18:41:04 +0200 Subject: [PATCH] dnsdist: Don't mix "real" and monotonic time for TCP queries Otherwise the time stored in the response ring makes no sense. --- pdns/dnsdist-tcp.cc | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/pdns/dnsdist-tcp.cc b/pdns/dnsdist-tcp.cc index 5a8f774bf5..f3719d6c51 100644 --- a/pdns/dnsdist-tcp.cc +++ b/pdns/dnsdist-tcp.cc @@ -265,8 +265,11 @@ void* tcpClientThread(int pipefd) string poolname; int delayMsec=0; + /* we need this one to be accurate ("real") for the protobuf message */ + struct timespec queryRealTime; struct timespec now; - gettime(&now, true); + gettime(&now); + gettime(&queryRealTime, true); if (!processQuery(localDynBlockNMG, localDynBlockSMT, localRulactions, blockFilter, dq, poolname, &delayMsec, now)) { goto drop; @@ -433,7 +436,7 @@ void* tcpClientThread(int pipefd) } dh = (struct dnsheader*) response; - DNSResponse dr(&qname, qtype, qclass, &ci.cs->local, &ci.remote, dh, responseSize, responseLen, true, &now); + DNSResponse dr(&qname, qtype, qclass, &ci.cs->local, &ci.remote, dh, responseSize, responseLen, true, &queryRealTime); #ifdef HAVE_PROTOBUF dr.uniqueId = dq.uniqueId; #endif -- 2.47.2