]> granicus.if.org Git - pdns/commitdiff
improve error message when checking remote master for freshness - now include rcode
authorBert Hubert <bert.hubert@netherlabs.nl>
Mon, 11 Apr 2011 08:36:34 +0000 (08:36 +0000)
committerBert Hubert <bert.hubert@netherlabs.nl>
Mon, 11 Apr 2011 08:36:34 +0000 (08:36 +0000)
git-svn-id: svn://svn.powerdns.com/pdns/trunk/pdns@2149 d19b8d6e-7fed-0310-83ef-9ca221ded41b

pdns/dns.cc
pdns/dns.hh
pdns/resolver.cc

index 74c60cac41419e412329c9dac454e7265b92b844..d3a6d2382cb3201acd04103ea1e22633f8d36de4 100644 (file)
@@ -194,3 +194,10 @@ string& attodot(string &str)
    return str;
 }
 
+string strrcode(unsigned char rcode)
+{
+  static const char* rcodes[]={"No Error", "FormErr", "SERVFAIL", "NXDOMAIN", "NotImp", "Refused", "", "", "", "Not Auth"};
+  if((rcode < sizeof(rcodes) / sizeof(*rcodes)) && *rcodes[rcode])
+    return rcodes[rcode];
+  return "Err#"+lexical_cast<string>((int)rcode);
+}
index da8fd77b5887f0635ca85995c1d46ab4fcc69cc8..9674e2facf0ca2410b7b5f1c07a825b1914ef857 100644 (file)
@@ -274,5 +274,5 @@ void fillSOAData(const string &content, SOAData &data);
 /** for use by DNSPacket, converts a SOAData class to a ascii line again */
 string serializeSOAData(const SOAData &data);
 string &attodot(string &str);  //!< for when you need to insert an email address in the SOA
-
+string strrcode(unsigned char rcode);
 #endif
index e317f07196feb6efa69508a0ea631910313ce316..5072ff7e70fa0da14fa028e3ea102ef9e284f84d 100644 (file)
@@ -224,7 +224,7 @@ bool Resolver::tryGetSOASerial(string* domain, uint32_t *theirSerial, uint32_t *
   *domain = stripDot(mdp.d_qname);
   
   if(mdp.d_answers.empty())
-    throw ResolverException("Query to '" + fromaddr.toStringWithPort() + "' for SOA of '" + *domain + "' produced no results");
+    throw ResolverException("Query to '" + fromaddr.toStringWithPort() + "' for SOA of '" + *domain + "' produced no results (error code: "+strrcode(mdp.d_header.rcode)+")");
   
   if(mdp.d_qtype != QType::SOA)
     throw ResolverException("Query to '" + fromaddr.toStringWithPort() + "' for SOA of '" + *domain + "' returned wrong record type");