try {
len = recvmsg(cs->udpFD, &msgh, 0);
g_rings.clientRing.push_back(remote);
- if(len < (int)sizeof(struct dnsheader))
+ if(len < (int)sizeof(struct dnsheader)) {
+ g_stats.nonCompliantQueries++;
continue;
+ }
g_stats.queries++;
if(!acl->match(remote)) {
+ vinfolog("Query from %s dropped because of ACL", remote.toStringWithPort());
g_stats.aclDrops++;
continue;
}
- if(dh->qr) // don't respond to responses
+ if(dh->qr) { // don't respond to responses
+ g_stats.nonCompliantQueries++;
continue;
+ }
const uint16_t * flags = getFlagsFromDNSHeader(dh);
const uint16_t origFlags = *flags;
if(!ss) {
g_stats.noPolicy++;
- continue;
-
+ continue;
}
ss->queries++;
}
}
+ if(g_dstates.getCopy().empty()) {
+ errlog("No downstream servers defined: all packets will get dropped");
+ // you might define them later, but you need to know
+ }
+
for(auto& dss : g_dstates.getCopy()) { // it is a copy, but the internal shared_ptrs are the real deal
if(dss->availability==DownstreamState::Availability::Auto) {
bool newState=upCheck(dss->remote);
stat_t responses{0};
stat_t servfailResponses{0};
stat_t queries{0};
+ stat_t nonCompliantQueries{0};
stat_t aclDrops{0};
stat_t blockFilter{0};
stat_t ruleDrop{0};
{"latency-avg10000", &latencyAvg10000}, {"latency-avg1000000", &latencyAvg1000000},
{"uptime", uptimeOfProcess},
{"real-memory-usage", getRealMemoryUsage},
- {"fd-usage", getOpenFileDescriptors}
+ {"fd-usage", getOpenFileDescriptors},
+ {"noncompliant-queries", &nonCompliantQueries}
};
};