From: Pieter Lexis Date: Fri, 10 Jul 2015 11:33:25 +0000 (+0200) Subject: DNSName: fix dnsscope.cc X-Git-Tag: dnsdist-1.0.0-alpha1~248^2~57^2~3^2~11 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=68ca579c756db0b3a6b61e9c40821d8d3734c4d0;p=pdns DNSName: fix dnsscope.cc --- diff --git a/pdns/dnsscope.cc b/pdns/dnsscope.cc index 5b1aeed71..8dd175862 100644 --- a/pdns/dnsscope.cc +++ b/pdns/dnsscope.cc @@ -5,6 +5,7 @@ #include "statbag.hh" #include "dnspcap.hh" #include "dnsparser.hh" +#include "dnsname.hh" #include #include #include @@ -42,7 +43,7 @@ struct comboCompare class StatNode { public: - void submit(const std::string& domain, int rcode, const ComboAddress& remote); + void submit(const DNSName& domain, int rcode, const ComboAddress& remote); void submit(deque& labels, const std::string& domain, int rcode, const ComboAddress& remote); string name; @@ -131,13 +132,17 @@ void StatNode::visit(visitor_t visitor, Stat &newstat, int depth) const } -void StatNode::submit(const std::string& domain, int rcode, const ComboAddress& remote) +void StatNode::submit(const DNSName& domain, int rcode, const ComboAddress& remote) { // cerr<<"FIRST submit called on '"< parts; - stringtok(parts, domain, "."); - if(parts.empty()) + vector tmp = domain.getRawLabels(); + if(tmp.empty()) return; + + deque parts; + for(auto const i : tmp) { + parts.push_back(i); + } children[parts.back()].submit(parts, "", rcode, remote); } @@ -376,7 +381,7 @@ try lowestTime=min((time_t)lowestTime, (time_t)pr.d_pheader.ts.tv_sec); highestTime=max((time_t)highestTime, (time_t)pr.d_pheader.ts.tv_sec); - string name=mdp.d_qname+"|"+DNSRecordContent::NumberToType(mdp.d_qtype); + string name=mdp.d_qname.toString()+"|"+DNSRecordContent::NumberToType(mdp.d_qtype); QuestionIdentifier qi=QuestionIdentifier::create(pr.getSource(), pr.getDest(), mdp);