From 231d3b6bba63ec5ab626876d904d95089d6bacca Mon Sep 17 00:00:00 2001 From: Remi Gacogne Date: Tue, 17 Nov 2015 10:25:19 +0100 Subject: [PATCH] No need to copy the response from the healthcheck, it's not going anywhere --- pdns/dnsdist.cc | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/pdns/dnsdist.cc b/pdns/dnsdist.cc index abc24eae6..f1264bd0f 100644 --- a/pdns/dnsdist.cc +++ b/pdns/dnsdist.cc @@ -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 -- 2.40.0