From: bert hubert Date: Mon, 8 Oct 2018 09:05:19 +0000 (+0200) Subject: fix shadowed variable, move to d_ecsFound, fix indentation X-Git-Tag: rec-4.2.0-alpha1~42^2~13 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=1ef18cab40fe1a554a7e0843fdf4d5959db4e4d4;p=thirdparty%2Fpdns.git fix shadowed variable, move to d_ecsFound, fix indentation --- diff --git a/pdns/dnsdist.cc b/pdns/dnsdist.cc index 213ea51fec..21e76401ae 100644 --- a/pdns/dnsdist.cc +++ b/pdns/dnsdist.cc @@ -1411,13 +1411,12 @@ static void processUDPQuery(ClientState& cs, LocalHolders& holders, const struct boost::optional subnet; uint16_t cachedResponseSize = dq.size; uint32_t allowExpired = ss ? 0 : g_staleCacheEntriesTTL; - - if (dq.useECS && ((ss && ss->useECS) || (!ss && serverPool->getECS()))) { - if (packetCache && !dq.skipCache) { - dnssecOK = (getEDNSZ(dq) & EDNS_HEADER_FLAG_DO); - } - boost::optional subnet; + if (packetCache && !dq.skipCache) { + dnssecOK = (getEDNSZ(dq) & EDNS_HEADER_FLAG_DO); + } + + if (dq.useECS && ((ss && ss->useECS) || (!ss && serverPool->getECS()))) { if (packetCache && !dq.skipCache && packetCache->get(dq, consumed, dh->id, query, &cachedResponseSize, &cacheKeyNoECS, subnet, dnssecOK, allowExpired)) { goto sendIt; } diff --git a/pdns/pdns_recursor.cc b/pdns/pdns_recursor.cc index baa655025c..42196b7e05 100644 --- a/pdns/pdns_recursor.cc +++ b/pdns/pdns_recursor.cc @@ -1486,12 +1486,12 @@ static void startDoResolve(void *p) } sendit:; - if(g_useIncomingECS && haveEDNS && !sr.wasVariable()) { + if(g_useIncomingECS && dc->d_ecsFound && !sr.wasVariable()) { // cerr<<"Stuffing in a 0 scope because answer is static"<d_ednssubnet.source; ComboAddress sa; - memset(&sa, 0, sizeof(sa)); + sa.reset(); sa.sin4.sin_family = eo.source.getNetwork().sin4.sin_family; eo.scope = Netmask(sa, 0); @@ -1568,7 +1568,7 @@ static void startDoResolve(void *p) g_log<getRemote()<<" failed with: "<insertResponsePacket(dc->d_tag, dc->d_qhash, std::move(dc->d_query), dc->d_mdp.d_qname, dc->d_mdp.d_qtype, dc->d_mdp.d_qclass,