]> granicus.if.org Git - pdns/commitdiff
No need to copy the response from the healthcheck, it's not going anywhere
authorRemi Gacogne <rgacogne-github@coredump.fr>
Tue, 17 Nov 2015 09:25:19 +0000 (10:25 +0100)
committerRemi Gacogne <rgacogne-github@coredump.fr>
Tue, 17 Nov 2015 10:01:21 +0000 (11:01 +0100)
pdns/dnsdist.cc

index abc24eae6237fa062f602fa67b8926507454ab21..f1264bd0fb57713b364f9df7c63257546a26c913 100644 (file)
@@ -575,23 +575,18 @@ try
   ComboAddress dest=remote;
   sock.recvFrom(reply, dest);
 
-  // dnsparser.cc is not included in dnsdist right now
-  // MOADNSParser mdp(reply);
-  // dnsheader const * responseHeader = &mdp.d_header;
-  struct dnsheader responseHeader;
+  const dnsheader * responseHeader = (const dnsheader *) reply.c_str();
 
-  if (reply.size() < sizeof(responseHeader))
+  if (reply.size() < sizeof(*responseHeader))
     return false;
 
-  memcpy(&responseHeader, reply.c_str(), sizeof(responseHeader));
-
-  if (responseHeader.id != requestHeader->id)
+  if (responseHeader->id != requestHeader->id)
     return false;
-  if (!responseHeader.qr)
+  if (!responseHeader->qr)
     return false;
-  if (responseHeader.rcode == RCode::ServFail)
+  if (responseHeader->rcode == RCode::ServFail)
     return false;
-  if (mustResolve && (responseHeader.rcode == RCode::NXDomain || responseHeader.rcode == RCode::Refused))
+  if (mustResolve && (responseHeader->rcode == RCode::NXDomain || responseHeader->rcode == RCode::Refused))
     return false;
 
   // XXX fixme do bunch of checking here etc