From: bert hubert Date: Fri, 1 May 2015 20:30:09 +0000 (+0200) Subject: deal with no applicable policy for a packet, plus keep a statistic for that. Spotted... X-Git-Tag: dnsdist-1.0.0-alpha1~248^2~28^2~73 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b8bc7e610d47ff5de59f153051eaa1a5162b0832;p=thirdparty%2Fpdns.git deal with no applicable policy for a packet, plus keep a statistic for that. Spotted by Matt Singh of CentralNic. --- diff --git a/pdns/dnsdist-tcp.cc b/pdns/dnsdist-tcp.cc index 22f1628bb4..dcb51f654c 100644 --- a/pdns/dnsdist-tcp.cc +++ b/pdns/dnsdist-tcp.cc @@ -112,6 +112,10 @@ void* tcpClientThread(int pipefd) ds = localPolicy->policy(getDownstreamCandidates(g_dstates.getCopy(), pool), ci.remote, qname, qtype, dh); } int dsock; + if(!ds) { + g_stats.noPolicy++; + break; + } if(sockets.count(ds->remote) == 0) { dsock=sockets[ds->remote]=setupTCPDownstream(ds->remote); } diff --git a/pdns/dnsdist.cc b/pdns/dnsdist.cc index 6526d1112b..2ab7ae6da3 100644 --- a/pdns/dnsdist.cc +++ b/pdns/dnsdist.cc @@ -442,8 +442,11 @@ try ss = policy(candidates, remote, qname, qtype, dh).get(); } - if(!ss) + if(!ss) { + g_stats.noPolicy++; continue; + + } ss->queries++; diff --git a/pdns/dnsdist.hh b/pdns/dnsdist.hh index 4ad49cfae7..387f961b5e 100644 --- a/pdns/dnsdist.hh +++ b/pdns/dnsdist.hh @@ -24,6 +24,7 @@ struct DNSDistStats stat_t downstreamTimeouts{0}; stat_t downstreamSendErrors{0}; stat_t truncFail{0}; + stat_t noPolicy{0}; double latency{0}; };