From 7b5da4ecc5818db943f231b898d7c70e549592bb Mon Sep 17 00:00:00 2001 From: Remi Gacogne Date: Wed, 10 Feb 2016 12:40:09 +0100 Subject: [PATCH] dnsdist: Display the query ID and remote IP when parsing fails --- pdns/dnsdist.cc | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/pdns/dnsdist.cc b/pdns/dnsdist.cc index c87b8f118..d6cbd8b3a 100644 --- a/pdns/dnsdist.cc +++ b/pdns/dnsdist.cc @@ -537,6 +537,7 @@ try auto localDynBlock = g_dynblockNMG.getLocal(); struct msghdr msgh; struct iovec iov; + uint16_t queryId = 0; /* used by HarvestDestinationAddress */ char cbuf[256]; remote.sin6.sin6_family=cs->local.sin6.sin6_family; @@ -549,6 +550,7 @@ try #endif char* query = packet; ssize_t ret = recvmsg(cs->udpFD, &msgh, 0); + queryId = 0; cs->queries++; g_stats.queries++; @@ -595,6 +597,7 @@ try #endif struct dnsheader* dh = (struct dnsheader*) query; + queryId = ntohs(dh->id); if(dh->qr) { // don't respond to responses g_stats.nonCompliantQueries++; @@ -775,7 +778,7 @@ try vinfolog("Got query from %s, relayed to %s", remote.toStringWithPort(), ss->getName()); } catch(std::exception& e){ - errlog("Got an error in UDP question thread: %s", e.what()); + errlog("Got an error in UDP question thread while parsing a query from %s, id %d: %s", remote.toStringWithPort(), queryId, e.what()); } } return 0; -- 2.40.0