*/
ids->age = 0;
unsigned int consumed;
- DNSName qname(packet, responseLen, sizeof(dnsheader), false, &qtype, &qclass, &consumed);
+ DNSName qname;
+ try {
+ // XXX will this move?
+ qname=DNSName(packet, responseLen, sizeof(dnsheader), false, &qtype, &qclass, &consumed);
+ }
+ catch(std::exception& e) {
+ infolog("Backend %s sent us a response that did not parse: %s", state->remote.toStringWithPort(), e.what());
+ g_stats.nonCompliantResponses++;
+ continue;
+ }
if (qtype != ids->qtype || qclass != ids->qclass || qname != ids->qname)
continue;
// goal in life - if you send us a reasonably normal packet, we'll get Z for you, otherwise 0
int getEDNSZ(const char* packet, unsigned int len)
+try
{
struct dnsheader* dh =(struct dnsheader*)packet;
uint8_t* z = (uint8_t*)packet+sizeof(dnsheader)+pos+consumed+DNS_TYPE_SIZE+DNS_CLASS_SIZE+EDNS_EXTENDED_RCODE_SIZE+EDNS_VERSION_SIZE;
return 0x100 * (*z) + *(z+1);
}
+catch(...)
+{
+ return 0;
+}
void spoofResponseFromString(DNSQuestion& dq, const string& spoofContent)
{
stat_t servfailResponses{0};
stat_t queries{0};
stat_t nonCompliantQueries{0};
+ stat_t nonCompliantResponses{0};
stat_t rdQueries{0};
stat_t emptyQueries{0};
stat_t aclDrops{0};
{"uptime", uptimeOfProcess},
{"real-memory-usage", getRealMemoryUsage},
{"noncompliant-queries", &nonCompliantQueries},
+ {"noncompliant-responses", &nonCompliantResponses},
{"rdqueries", &rdQueries},
{"empty-queries", &emptyQueries},
{"cache-hits", &cacheHits},