From: bert hubert Date: Wed, 2 Mar 2016 12:00:19 +0000 (+0100) Subject: if you send us EDNS subnet information we did not ask for, ignore it. Increases cache... X-Git-Tag: rec-4.0.0-alpha2~26^2~3 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=7bb598a04a0d9f0ce2abe15eb597e59b84f712f5;p=pdns if you send us EDNS subnet information we did not ask for, ignore it. Increases cache hitrate for a popular CDN. --- diff --git a/pdns/lwres.cc b/pdns/lwres.cc index 2d136bfa2..f74e9d70a 100644 --- a/pdns/lwres.cc +++ b/pdns/lwres.cc @@ -67,7 +67,7 @@ int asyncresolve(const ComboAddress& ip, const DNSName& domain, int type, bool d pw.getHeader()->id=dns_random(0xffff); string ping; - + bool weWantEDNSSubnet=false; if(EDNS0Level && !doTCP) { DNSPacketWriter::optvect_t opts; if(srcmask) { @@ -76,6 +76,7 @@ int asyncresolve(const ComboAddress& ip, const DNSName& domain, int type, bool d // cout<<"Adding request mask: "<(); // this is also our return value + weWantEDNSSubnet=true; } pw.addOpt(g_outgoingEDNSBufsize, 0, g_dnssecmode == DNSSECMode::Off ? 0 : EDNSOpts::DNSSECOK, opts); @@ -186,16 +187,17 @@ int asyncresolve(const ComboAddress& ip, const DNSName& domain, int type, bool d if(EDNS0Level > 0 && getEDNSOpts(mdp, &edo)) { lwr->d_haveEDNS = true; - for(const auto& opt : edo.d_options) { - if(opt.first==8) { - EDNSSubnetOpts reso; - if(getEDNSSubnetOptsFromString(opt.second, &reso)) { - // cerr<<"EDNS Subnet response: "<