diff --git a/modules/bindbackend/bindbackend2.cc b/modules/bindbackend/bindbackend2.cc index 1d3312ed2d1c..cf2c85cb2162 100644 --- a/modules/bindbackend/bindbackend2.cc +++ b/modules/bindbackend/bindbackend2.cc @@ -304,7 +304,7 @@ bool Bind2Backend::feedRecord(const DNSResourceRecord& rr, const DNSName& ordern // fallthrough default: if (d_of && *d_of) { - *d_of << qname << "\t" << rr.ttl << "\t" << rr.qtype.getName() << "\t" << content << endl; + *d_of << qname << "\t" << rr.ttl << "\t" << rr.qtype.toString() << "\t" << content << endl; } } return true; @@ -521,7 +521,7 @@ void Bind2Backend::insertRecord(std::shared_ptr& records, const else if (bdr.qname.isPartOf(zoneName)) bdr.qname.makeUsRelative(zoneName); else { - string msg = "Trying to insert non-zone data, name='" + bdr.qname.toLogString() + "', qtype=" + qtype.getName() + ", zone='" + zoneName.toLogString() + "'"; + string msg = "Trying to insert non-zone data, name='" + bdr.qname.toLogString() + "', qtype=" + qtype.toString() + ", zone='" + zoneName.toLogString() + "'"; if (s_ignore_broken_records) { g_log << Logger::Warning << msg << " ignored" << endl; return; @@ -805,7 +805,7 @@ void Bind2Backend::fixupOrderAndAuth(std::shared_ptr& records, records->replace(iter, bdr); } - // cerr<qname<<"\t"<qtype).getName()<<"\t"<nsec3hash<<"\t"<auth<qname<<"\t"<qtype).toString()<<"\t"<nsec3hash<<"\t"<auth<& records hashed = toBase32Hex(hashQNameWithSalt(ns3pr, rr.qname)); insertRecord(records, zoneName, rr.qname, rr.qtype, rr.content, rr.ttl, hashed, &nt.second); - // cerr<= 0) { if ((found = (safeGetBBDomainInfo(zoneId, &bbd) && qname.isPartOf(bbd.d_name)))) { @@ -1228,7 +1228,7 @@ bool Bind2Backend::get(DNSResourceRecord& r) return false; } if (d_handle.mustlog) - g_log << Logger::Warning << "Returning: '" << r.qtype.getName() << "' of '" << r.qname << "', content: '" << r.content << "'" << endl; + g_log << Logger::Warning << "Returning: '" << r.qtype.toString() << "' of '" << r.qname << "', content: '" << r.content << "'" << endl; return true; } @@ -1250,14 +1250,14 @@ void Bind2Backend::handle::reset() //#define DLOG(x) x bool Bind2Backend::handle::get_normal(DNSResourceRecord& r) { - DLOG(g_log << "Bind2Backend get() was called for " << qtype.getName() << " record for '" << qname << "' - " << d_records->size() << " available in total!" << endl); + DLOG(g_log << "Bind2Backend get() was called for " << qtype.toString() << " record for '" << qname << "' - " << d_records->size() << " available in total!" << endl); if (d_iter == d_end_iter) { return false; } while (d_iter != d_end_iter && !(qtype.getCode() == QType::ANY || (d_iter)->qtype == qtype.getCode())) { - DLOG(g_log << Logger::Warning << "Skipped " << qname << "/" << QType(d_iter->qtype).getName() << ": '" << d_iter->content << "'" << endl); + DLOG(g_log << Logger::Warning << "Skipped " << qname << "/" << QType(d_iter->qtype).toString() << ": '" << d_iter->content << "'" << endl); d_iter++; } if (d_iter == d_end_iter) { @@ -1273,7 +1273,7 @@ bool Bind2Backend::handle::get_normal(DNSResourceRecord& r) r.ttl = (d_iter)->ttl; //if(!d_iter->auth && r.qtype.getCode() != QType::A && r.qtype.getCode()!=QType::AAAA && r.qtype.getCode() != QType::NS) - // cerr<<"Warning! Unauth response for qtype "<< r.qtype.getName() << " for '"<auth; d_iter++; diff --git a/modules/ldapbackend/ldapbackend.cc b/modules/ldapbackend/ldapbackend.cc index 1ad9bc359a7e..175c719ff5b2 100644 --- a/modules/ldapbackend/ldapbackend.cc +++ b/modules/ldapbackend/ldapbackend.cc @@ -204,7 +204,7 @@ void LdapBackend::extract_entry_results(const DNSName& domain, const DNSResult& continue; qtype2 = rdata.substr(0, pos); - if (qtype2 != QType(local_result.qtype).getName()) + if (qtype2 != QType(local_result.qtype).toString()) continue; local_result.ttl = pdns_stou(rdata.substr(pos + 1)); @@ -214,7 +214,7 @@ void LdapBackend::extract_entry_results(const DNSName& domain, const DNSResult& // Not authoritative if (d_result.count("PdnsRecordNoAuth") && !d_result["PdnsRecordNoAuth"].empty()) { for (const auto& rdata : d_result["PdnsRecordNoAuth"]) { - if (rdata == QType(local_result.qtype).getName()) + if (rdata == QType(local_result.qtype).toString()) local_result.auth = false; } } @@ -233,7 +233,7 @@ void LdapBackend::extract_entry_results(const DNSName& domain, const DNSResult& } qtype2 = rdata.substr(0, pos); - if (qtype2 != QType(local_result.qtype).getName()) + if (qtype2 != QType(local_result.qtype).toString()) continue; local_result.ordername = rdata.substr(pos + 1); diff --git a/modules/ldapbackend/native.cc b/modules/ldapbackend/native.cc index bb86ea67c341..0b24a28411a9 100644 --- a/modules/ldapbackend/native.cc +++ b/modules/ldapbackend/native.cc @@ -111,7 +111,7 @@ void LdapBackend::lookup(const QType& qtype, const DNSName& qname, int zoneid, D d_results_cache.clear(); if (d_qlog) { - g_log.log("Query: '" + qname.toStringRootDot() + "|" + qtype.getName() + "'", Logger::Error); + g_log.log("Query: '" + qname.toStringRootDot() + "|" + qtype.toString() + "'", Logger::Error); } (this->*d_lookup_fcnt)(qtype, qname, dnspkt, zoneid); } @@ -146,7 +146,7 @@ void LdapBackend::lookup_simple(const QType& qtype, const DNSName& qname, DNSPac filter = "associatedDomain=" + qesc; if (qtype.getCode() != QType::ANY) { - attr = qtype.getName() + "Record"; + attr = qtype.toString() + "Record"; filter = "&(" + filter + ")(" + attr + "=*)"; attronly[0] = attr.c_str(); attributes = attronly; @@ -154,7 +154,7 @@ void LdapBackend::lookup_simple(const QType& qtype, const DNSName& qname, DNSPac filter = strbind(":target:", filter, getArg("filter-lookup")); - g_log << Logger::Debug << d_myname << " Search = basedn: " << getArg("basedn") << ", filter: " << filter << ", qtype: " << qtype.getName() << endl; + g_log << Logger::Debug << d_myname << " Search = basedn: " << getArg("basedn") << ", filter: " << filter << ", qtype: " << qtype.toString() << endl; d_search = d_pldap->search(getArg("basedn"), LDAP_SCOPE_SUBTREE, filter, attributes); } @@ -188,7 +188,7 @@ void LdapBackend::lookup_strict(const QType& qtype, const DNSName& qname, DNSPac } if (qtype.getCode() != QType::ANY) { - attr = qtype.getName() + "Record"; + attr = qtype.toString() + "Record"; filter = "&(" + filter + ")(" + attr + "=*)"; attronly[0] = attr.c_str(); attributes = attronly; @@ -196,7 +196,7 @@ void LdapBackend::lookup_strict(const QType& qtype, const DNSName& qname, DNSPac filter = strbind(":target:", filter, getArg("filter-lookup")); - g_log << Logger::Debug << d_myname << " Search = basedn: " << getArg("basedn") << ", filter: " << filter << ", qtype: " << qtype.getName() << endl; + g_log << Logger::Debug << d_myname << " Search = basedn: " << getArg("basedn") << ", filter: " << filter << ", qtype: " << qtype.toString() << endl; d_search = d_pldap->search(getArg("basedn"), LDAP_SCOPE_SUBTREE, filter, attributes); } @@ -211,7 +211,7 @@ void LdapBackend::lookup_tree(const QType& qtype, const DNSName& qname, DNSPacke filter = "associatedDomain=" + qesc; if (qtype.getCode() != QType::ANY) { - attr = qtype.getName() + "Record"; + attr = qtype.toString() + "Record"; filter = "&(" + filter + ")(" + attr + "=*)"; attronly[0] = attr.c_str(); attributes = attronly; @@ -224,7 +224,7 @@ void LdapBackend::lookup_tree(const QType& qtype, const DNSName& qname, DNSPacke dn = "dc=" + *i + "," + dn; } - g_log << Logger::Debug << d_myname << " Search = basedn: " << dn + getArg("basedn") << ", filter: " << filter << ", qtype: " << qtype.getName() << endl; + g_log << Logger::Debug << d_myname << " Search = basedn: " << dn + getArg("basedn") << ", filter: " << filter << ", qtype: " << qtype.toString() << endl; d_search = d_pldap->search(dn + getArg("basedn"), LDAP_SCOPE_BASE, filter, attributes); } @@ -314,7 +314,7 @@ bool LdapBackend::get(DNSResourceRecord& rr) rr.content = result.value; rr.auth = result.auth; - g_log << Logger::Debug << d_myname << " Record = qname: " << rr.qname << ", qtype: " << (rr.qtype).getName() << ", ttl: " << rr.ttl << ", content: " << rr.content << endl; + g_log << Logger::Debug << d_myname << " Record = qname: " << rr.qname << ", qtype: " << (rr.qtype).toString() << ", ttl: " << rr.ttl << ", content: " << rr.content << endl; return true; } diff --git a/modules/lmdbbackend/lmdbbackend.cc b/modules/lmdbbackend/lmdbbackend.cc index 03b0d5438a84..ef6b8f325ffe 100644 --- a/modules/lmdbbackend/lmdbbackend.cc +++ b/modules/lmdbbackend/lmdbbackend.cc @@ -706,7 +706,7 @@ bool LMDBBackend::list(const DNSName& target, int id, bool include_disabled) void LMDBBackend::lookup(const QType& type, const DNSName& qdomain, int zoneId, DNSPacket* p) { if (d_dolog) { - g_log << Logger::Warning << "Got lookup for " << qdomain << "|" << type.getName() << " in zone " << zoneId << endl; + g_log << Logger::Warning << "Got lookup for " << qdomain << "|" << type.toString() << " in zone " << zoneId << endl; d_dtime.set(); } @@ -736,7 +736,7 @@ void LMDBBackend::lookup(const QType& type, const DNSName& qdomain, int zoneId, } DNSName relqname = qdomain.makeRelative(hunt); - // cout<<"get will look for "<(), lrr); if (co.getQType(key.get()).getCode() && (lrr.auth || co.getQType(key.get()).getCode() == QType::NS)) { after = co.getQName(key.get()) + zonename; - // cout <<"Found auth ("<()).getName()<<", ttl = "<()).toString()<<", ttl = "<()) << endl; break; } - // cout <<" oops, " << co.getQName(key.get()) << " was not auth "<()) << " was not auth "<getRealRemote().toString()}); } - logCall("lookup", "qtype=" << qtype.getName() << ",qname=" << qname << ",domain_id=" << domain_id); + logCall("lookup", "qtype=" << qtype.toString() << ",qname=" << qname << ",domain_id=" << domain_id); lookup_result_t result = f_lookup(qtype, qname, domain_id, ctx); parseLookup(result); } diff --git a/modules/pipebackend/pipebackend.cc b/modules/pipebackend/pipebackend.cc index c16852103fc8..a5981c797d7e 100644 --- a/modules/pipebackend/pipebackend.cc +++ b/modules/pipebackend/pipebackend.cc @@ -176,7 +176,7 @@ void PipeBackend::lookup(const QType& qtype, const DNSName& qname, int zoneId, D } // abi-version = 1 // type qname qclass qtype id remote-ip-address - query << "Q\t" << qname.toStringRootDot() << "\tIN\t" << qtype.getName() << "\t" << zoneId << "\t" << remoteIP; + query << "Q\t" << qname.toStringRootDot() << "\tIN\t" << qtype.toString() << "\t" << zoneId << "\t" << remoteIP; // add the local-ip-address if abi-version is set to 2 if (d_abiVersion >= 2) diff --git a/modules/remotebackend/remotebackend.cc b/modules/remotebackend/remotebackend.cc index 64a5d41caaa5..dc30d2cc22f9 100644 --- a/modules/remotebackend/remotebackend.cc +++ b/modules/remotebackend/remotebackend.cc @@ -208,7 +208,7 @@ void RemoteBackend::lookup(const QType& qtype, const DNSName& qdomain, int zoneI Json query = Json::object{ {"method", "lookup"}, - {"parameters", Json::object{{"qtype", qtype.getName()}, {"qname", qdomain.toString()}, {"remote", remoteIP}, {"local", localIP}, {"real-remote", realRemote}, {"zone-id", zoneId}}}}; + {"parameters", Json::object{{"qtype", qtype.toString()}, {"qname", qdomain.toString()}, {"remote", remoteIP}, {"local", localIP}, {"real-remote", realRemote}, {"zone-id", zoneId}}}}; if (this->send(query) == false || this->recv(d_result) == false) { return; @@ -634,7 +634,7 @@ bool RemoteBackend::superMasterBackend(const string& ip, const DNSName& domain, for (const auto& ns : nsset) { rrset.push_back(Json::object{ - {"qtype", ns.qtype.getName()}, + {"qtype", ns.qtype.toString()}, {"qname", ns.qname.toString()}, {"qclass", QClass::IN.getCode()}, {"content", ns.content}, @@ -686,7 +686,7 @@ bool RemoteBackend::replaceRRSet(uint32_t domain_id, const DNSName& qname, const Json::array json_rrset; for (const auto& rr : rrset) { json_rrset.push_back(Json::object{ - {"qtype", rr.qtype.getName()}, + {"qtype", rr.qtype.toString()}, {"qname", rr.qname.toString()}, {"qclass", QClass::IN.getCode()}, {"content", rr.content}, @@ -696,7 +696,7 @@ bool RemoteBackend::replaceRRSet(uint32_t domain_id, const DNSName& qname, const Json query = Json::object{ {"method", "replaceRRSet"}, - {"parameters", Json::object{{"domain_id", static_cast(domain_id)}, {"qname", qname.toString()}, {"qtype", qtype.getName()}, {"trxid", static_cast(d_trxid)}, {"rrset", json_rrset}}}}; + {"parameters", Json::object{{"domain_id", static_cast(domain_id)}, {"qname", qname.toString()}, {"qtype", qtype.toString()}, {"trxid", static_cast(d_trxid)}, {"rrset", json_rrset}}}}; Json answer; if (this->send(query) == false || this->recv(answer) == false) @@ -710,7 +710,7 @@ bool RemoteBackend::feedRecord(const DNSResourceRecord& rr, const DNSName& order Json query = Json::object{ {"method", "feedRecord"}, {"parameters", Json::object{ - {"rr", Json::object{{"qtype", rr.qtype.getName()}, {"qname", rr.qname.toString()}, {"qclass", QClass::IN.getCode()}, {"content", rr.content}, {"ttl", static_cast(rr.ttl)}, {"auth", rr.auth}, {"ordername", (ordername.empty() ? Json() : ordername.toString())}}}, + {"rr", Json::object{{"qtype", rr.qtype.toString()}, {"qname", rr.qname.toString()}, {"qclass", QClass::IN.getCode()}, {"content", rr.content}, {"ttl", static_cast(rr.ttl)}, {"auth", rr.auth}, {"ordername", (ordername.empty() ? Json() : ordername.toString())}}}, {"trxid", static_cast(d_trxid)}, }}}; diff --git a/modules/tinydnsbackend/tinydnsbackend.cc b/modules/tinydnsbackend/tinydnsbackend.cc index 4853d8b52391..96b076cf7e86 100644 --- a/modules/tinydnsbackend/tinydnsbackend.cc +++ b/modules/tinydnsbackend/tinydnsbackend.cc @@ -210,7 +210,7 @@ void TinyDNSBackend::lookup(const QType& qtype, const DNSName& qdomain, int zone string key = simpleCompress(queryDomain); - DLOG(g_log << Logger::Debug << backendname << "[lookup] query for qtype [" << qtype.getName() << "] qdomain [" << qdomain << "]" << endl); + DLOG(g_log << Logger::Debug << backendname << "[lookup] query for qtype [" << qtype.toString() << "] qdomain [" << qdomain << "]" << endl); DLOG(g_log << Logger::Debug << "[lookup] key [" << makeHexDump(key) << "]" << endl); d_isWildcardQuery = false; @@ -332,7 +332,7 @@ bool TinyDNSBackend::get(DNSResourceRecord& rr) DLOG(cerr << "CONTENT: " << rr.content << endl); } catch (...) { - g_log << Logger::Error << backendname << "Failed to parse record content for " << rr.qname << " with type " << rr.qtype.getName(); + g_log << Logger::Error << backendname << "Failed to parse record content for " << rr.qname << " with type " << rr.qtype.toString(); if (d_ignorebogus) { g_log << ". Ignoring!" << endl; continue; @@ -342,7 +342,7 @@ bool TinyDNSBackend::get(DNSResourceRecord& rr) throw; } } - // DLOG(g_log< bind("domain_id", domain_id)-> bind("qname", qname)-> - bind("qtype", QType(qtype).getName())-> + bind("qtype", QType(qtype).toString())-> execute()-> reset(); } catch(SSqlException &e) { - throw PDNSException("GSQLBackend unable to update ordername and auth for " + qname.toLogString() + "|" + QType(qtype).getName() + " for domain_id "+itoa(domain_id)+": "+e.txtReason()); + throw PDNSException("GSQLBackend unable to update ordername and auth for " + qname.toLogString() + "|" + QType(qtype).toString() + " for domain_id "+itoa(domain_id)+": "+e.txtReason()); } } } else { @@ -541,12 +541,12 @@ bool GSQLBackend::updateDNSSECOrderNameAndAuth(uint32_t domain_id, const DNSName bind("auth", auth)-> bind("domain_id", domain_id)-> bind("qname", qname)-> - bind("qtype", QType(qtype).getName())-> + bind("qtype", QType(qtype).toString())-> execute()-> reset(); } catch(SSqlException &e) { - throw PDNSException("GSQLBackend unable to nullify ordername and update auth for " + qname.toLogString() + "|" + QType(qtype).getName() + " for domain_id "+itoa(domain_id)+": "+e.txtReason()); + throw PDNSException("GSQLBackend unable to nullify ordername and update auth for " + qname.toLogString() + "|" + QType(qtype).toString() + " for domain_id "+itoa(domain_id)+": "+e.txtReason()); } } } @@ -1111,13 +1111,13 @@ void GSQLBackend::lookup(const QType &qtype,const DNSName &qname, int domain_id, d_query_name = "basic-query"; d_query_stmt = &d_NoIdQuery_stmt; (*d_query_stmt)-> - bind("qtype", qtype.getName())-> + bind("qtype", qtype.toString())-> bind("qname", qname); } else { d_query_name = "id-query"; d_query_stmt = &d_IdQuery_stmt; (*d_query_stmt)-> - bind("qtype", qtype.getName())-> + bind("qtype", qtype.toString())-> bind("qname", qname)-> bind("domain_id", domain_id); } @@ -1141,7 +1141,7 @@ void GSQLBackend::lookup(const QType &qtype,const DNSName &qname, int domain_id, execute(); } catch(SSqlException &e) { - throw PDNSException("GSQLBackend unable to lookup '" + qname.toLogString() + "|" + qtype.getName() + "':"+e.txtReason()); + throw PDNSException("GSQLBackend unable to lookup '" + qname.toLogString() + "|" + qtype.toString() + "':"+e.txtReason()); } d_list=false; @@ -1199,7 +1199,7 @@ bool GSQLBackend::listSubZone(const DNSName &zone, int domain_id) { bool GSQLBackend::get(DNSResourceRecord &r) { - // g_log << "GSQLBackend get() was called for "< bind("domain_id", domain_id)-> bind("qname", qname)-> - bind("qtype", qt.getName())-> + bind("qtype", qt.toString())-> execute()-> reset(); } else { @@ -1483,7 +1483,7 @@ bool GSQLBackend::replaceRRSet(uint32_t domain_id, const DNSName& qname, const Q } } catch (SSqlException &e) { - throw PDNSException("GSQLBackend unable to delete RRSet " + qname.toLogString() + "|" + qt.getName() + ": "+e.txtReason()); + throw PDNSException("GSQLBackend unable to delete RRSet " + qname.toLogString() + "|" + qt.toString() + ": "+e.txtReason()); } if (rrset.empty()) { @@ -1493,12 +1493,12 @@ bool GSQLBackend::replaceRRSet(uint32_t domain_id, const DNSName& qname, const Q d_DeleteCommentRRsetQuery_stmt-> bind("domain_id", domain_id)-> bind("qname", qname)-> - bind("qtype", qt.getName())-> + bind("qtype", qt.toString())-> execute()-> reset(); } catch (SSqlException &e) { - throw PDNSException("GSQLBackend unable to delete comment for RRSet " + qname.toLogString() + "|" + qt.getName() + ": "+e.txtReason()); + throw PDNSException("GSQLBackend unable to delete comment for RRSet " + qname.toLogString() + "|" + qt.toString() + ": "+e.txtReason()); } } for(const auto& rr: rrset) { @@ -1528,7 +1528,7 @@ bool GSQLBackend::feedRecord(const DNSResourceRecord &r, const DNSName &ordernam bind("content",content)-> bind("ttl",r.ttl)-> bind("priority",prio)-> - bind("qtype",r.qtype.getName())-> + bind("qtype",r.qtype.toString())-> bind("domain_id",r.domain_id)-> bind("disabled",r.disabled)-> bind("qname",r.qname); @@ -1548,7 +1548,7 @@ bool GSQLBackend::feedRecord(const DNSResourceRecord &r, const DNSName &ordernam reset(); } catch (SSqlException &e) { - throw PDNSException("GSQLBackend unable to feed record " + r.qname.toLogString() + "|" + r.qtype.getName() + ": "+e.txtReason()); + throw PDNSException("GSQLBackend unable to feed record " + r.qname.toLogString() + "|" + r.qtype.toString() + ": "+e.txtReason()); } return true; // XXX FIXME this API should not return 'true' I think -ahu } @@ -1715,7 +1715,7 @@ void GSQLBackend::feedComment(const Comment& comment) d_InsertCommentQuery_stmt-> bind("domain_id",comment.domain_id)-> bind("qname",comment.qname)-> - bind("qtype",comment.qtype.getName())-> + bind("qtype",comment.qtype.toString())-> bind("modified_at",comment.modified_at)-> bind("account",comment.account)-> bind("content",comment.content)-> @@ -1723,7 +1723,7 @@ void GSQLBackend::feedComment(const Comment& comment) reset(); } catch (SSqlException &e) { - throw PDNSException("GSQLBackend unable to feed comment for RRSet '" + comment.qname.toLogString() + "|" + comment.qtype.getName() + "': "+e.txtReason()); + throw PDNSException("GSQLBackend unable to feed comment for RRSet '" + comment.qname.toLogString() + "|" + comment.qtype.toString() + "': "+e.txtReason()); } } @@ -1739,12 +1739,12 @@ bool GSQLBackend::replaceComments(const uint32_t domain_id, const DNSName& qname d_DeleteCommentRRsetQuery_stmt-> bind("domain_id",domain_id)-> bind("qname", qname)-> - bind("qtype",qt.getName())-> + bind("qtype",qt.toString())-> execute()-> reset(); } catch (SSqlException &e) { - throw PDNSException("GSQLBackend unable to delete comment for RRSet '" + qname.toLogString() + "|" + qt.getName() + "': "+e.txtReason()); + throw PDNSException("GSQLBackend unable to delete comment for RRSet '" + qname.toLogString() + "|" + qt.toString() + "': "+e.txtReason()); } for(const auto& comment: comments) { diff --git a/pdns/common_startup.cc b/pdns/common_startup.cc index 60c81cad963c..5c978564ef7d 100644 --- a/pdns/common_startup.cc +++ b/pdns/common_startup.cc @@ -470,7 +470,7 @@ try remote = question.getRemote().toString() + "<-" + question.getRealRemote().toString(); else remote = question.getRemote().toString(); - g_log << Logger::Notice<<"Remote "<< remote <<" wants '" << question.qdomain<<"|"<(value.validity - now), QType(value.qtype).getName().c_str(), rcode, entry.first, value.len, value.tcp, static_cast(value.added)); + fprintf(fp.get(), "%s %" PRId64 " %s ; rcode %" PRIu8 ", key %" PRIu32 ", length %" PRIu16 ", tcp %d, added %" PRId64 "\n", value.qname.toString().c_str(), static_cast(value.validity - now), QType(value.qtype).toString().c_str(), rcode, entry.first, value.len, value.tcp, static_cast(value.added)); } catch(...) { fprintf(fp.get(), "; error printing '%s'\n", value.qname.empty() ? "EMPTY" : value.qname.toString().c_str()); diff --git a/pdns/dnsdist-dynblocks.hh b/pdns/dnsdist-dynblocks.hh index 80a0dca6034a..e3c1a6247a64 100644 --- a/pdns/dnsdist-dynblocks.hh +++ b/pdns/dnsdist-dynblocks.hh @@ -312,7 +312,7 @@ public: } result << "QType rules: " << std::endl; for (const auto& rule : d_qtypeRules) { - result << "- " << QType(rule.first).getName() << ": " << rule.second.toString() << std::endl; + result << "- " << QType(rule.first).toString() << ": " << rule.second.toString() << std::endl; } result << "Excluded Subnets: " << d_excludedSubnets.toString() << std::endl; result << "Excluded Domains: " << d_excludedDomains.toString() << std::endl; diff --git a/pdns/dnsdist-lua-actions.cc b/pdns/dnsdist-lua-actions.cc index 707afe83e369..c4f6250a7c45 100644 --- a/pdns/dnsdist-lua-actions.cc +++ b/pdns/dnsdist-lua-actions.cc @@ -754,10 +754,10 @@ class LogAction : public DNSAction, public boost::noncopyable if (!d_fp) { if (!d_verboseOnly || g_verbose) { if (d_includeTimestamp) { - infolog("[%u.%u] Packet from %s for %s %s with id %d", static_cast(dq->queryTime->tv_sec), static_cast(dq->queryTime->tv_nsec), dq->remote->toStringWithPort(), dq->qname->toString(), QType(dq->qtype).getName(), dq->getHeader()->id); + infolog("[%u.%u] Packet from %s for %s %s with id %d", static_cast(dq->queryTime->tv_sec), static_cast(dq->queryTime->tv_nsec), dq->remote->toStringWithPort(), dq->qname->toString(), QType(dq->qtype).toString(), dq->getHeader()->id); } else { - infolog("Packet from %s for %s %s with id %d", dq->remote->toStringWithPort(), dq->qname->toString(), QType(dq->qtype).getName(), dq->getHeader()->id); + infolog("Packet from %s for %s %s with id %d", dq->remote->toStringWithPort(), dq->qname->toString(), QType(dq->qtype).toString(), dq->getHeader()->id); } } } @@ -785,10 +785,10 @@ class LogAction : public DNSAction, public boost::noncopyable } else { if (d_includeTimestamp) { - fprintf(d_fp.get(), "[%llu.%lu] Packet from %s for %s %s with id %d\n", static_cast(dq->queryTime->tv_sec), static_cast(dq->queryTime->tv_nsec), dq->remote->toStringWithPort().c_str(), dq->qname->toString().c_str(), QType(dq->qtype).getName().c_str(), dq->getHeader()->id); + fprintf(d_fp.get(), "[%llu.%lu] Packet from %s for %s %s with id %d\n", static_cast(dq->queryTime->tv_sec), static_cast(dq->queryTime->tv_nsec), dq->remote->toStringWithPort().c_str(), dq->qname->toString().c_str(), QType(dq->qtype).toString().c_str(), dq->getHeader()->id); } else { - fprintf(d_fp.get(), "Packet from %s for %s %s with id %d\n", dq->remote->toStringWithPort().c_str(), dq->qname->toString().c_str(), QType(dq->qtype).getName().c_str(), dq->getHeader()->id); + fprintf(d_fp.get(), "Packet from %s for %s %s with id %d\n", dq->remote->toStringWithPort().c_str(), dq->qname->toString().c_str(), QType(dq->qtype).toString().c_str(), dq->getHeader()->id); } } } @@ -844,19 +844,19 @@ class LogResponseAction : public DNSResponseAction, public boost::noncopyable if (!d_fp) { if (!d_verboseOnly || g_verbose) { if (d_includeTimestamp) { - infolog("[%u.%u] Answer to %s for %s %s (%s) with id %d", static_cast(dr->queryTime->tv_sec), static_cast(dr->queryTime->tv_nsec), dr->remote->toStringWithPort(), dr->qname->toString(), QType(dr->qtype).getName(), RCode::to_s(dr->getHeader()->rcode), dr->getHeader()->id); + infolog("[%u.%u] Answer to %s for %s %s (%s) with id %d", static_cast(dr->queryTime->tv_sec), static_cast(dr->queryTime->tv_nsec), dr->remote->toStringWithPort(), dr->qname->toString(), QType(dr->qtype).toString(), RCode::to_s(dr->getHeader()->rcode), dr->getHeader()->id); } else { - infolog("Answer to %s for %s %s (%s) with id %d", dr->remote->toStringWithPort(), dr->qname->toString(), QType(dr->qtype).getName(), RCode::to_s(dr->getHeader()->rcode), dr->getHeader()->id); + infolog("Answer to %s for %s %s (%s) with id %d", dr->remote->toStringWithPort(), dr->qname->toString(), QType(dr->qtype).toString(), RCode::to_s(dr->getHeader()->rcode), dr->getHeader()->id); } } } else { if (d_includeTimestamp) { - fprintf(d_fp.get(), "[%llu.%lu] Answer to %s for %s %s (%s) with id %d\n", static_cast(dr->queryTime->tv_sec), static_cast(dr->queryTime->tv_nsec), dr->remote->toStringWithPort().c_str(), dr->qname->toString().c_str(), QType(dr->qtype).getName().c_str(), RCode::to_s(dr->getHeader()->rcode).c_str(), dr->getHeader()->id); + fprintf(d_fp.get(), "[%llu.%lu] Answer to %s for %s %s (%s) with id %d\n", static_cast(dr->queryTime->tv_sec), static_cast(dr->queryTime->tv_nsec), dr->remote->toStringWithPort().c_str(), dr->qname->toString().c_str(), QType(dr->qtype).toString().c_str(), RCode::to_s(dr->getHeader()->rcode).c_str(), dr->getHeader()->id); } else { - fprintf(d_fp.get(), "Answer to %s for %s %s (%s) with id %d\n", dr->remote->toStringWithPort().c_str(), dr->qname->toString().c_str(), QType(dr->qtype).getName().c_str(), RCode::to_s(dr->getHeader()->rcode).c_str(), dr->getHeader()->id); + fprintf(d_fp.get(), "Answer to %s for %s %s (%s) with id %d\n", dr->remote->toStringWithPort().c_str(), dr->qname->toString().c_str(), QType(dr->qtype).toString().c_str(), RCode::to_s(dr->getHeader()->rcode).c_str(), dr->getHeader()->id); } } return Action::None; diff --git a/pdns/dnsdist-lua-inspection.cc b/pdns/dnsdist-lua-inspection.cc index f23430d64306..163df71d0442 100644 --- a/pdns/dnsdist-lua-inspection.cc +++ b/pdns/dnsdist-lua-inspection.cc @@ -476,7 +476,7 @@ void setupLuaInspection(LuaContext& luaCtx) if (c.dh.opcode != 0) { extra = " (" + Opcode::to_s(c.dh.opcode) + ")"; } - out.insert(make_pair(c.when, (fmt % DiffTime(now, c.when) % c.requestor.toStringWithPort() % "" % htons(c.dh.id) % c.name.toString() % qt.getName() % "" % (c.dh.tc ? "TC" : "") % (c.dh.rd? "RD" : "") % (c.dh.aa? "AA" : "") % ("Question" + extra)).str() )) ; + out.insert(make_pair(c.when, (fmt % DiffTime(now, c.when) % c.requestor.toStringWithPort() % "" % htons(c.dh.id) % c.name.toString() % qt.toString() % "" % (c.dh.tc ? "TC" : "") % (c.dh.rd? "RD" : "") % (c.dh.aa? "AA" : "") % ("Question" + extra)).str() )) ; if(limit && *limit==++num) break; @@ -514,10 +514,10 @@ void setupLuaInspection(LuaContext& luaCtx) } if (c.usec != std::numeric_limits::max()) { - out.insert(make_pair(c.when, (fmt % DiffTime(now, c.when) % c.requestor.toStringWithPort() % c.ds.toStringWithPort() % htons(c.dh.id) % c.name.toString() % qt.getName() % (c.usec/1000.0) % (c.dh.tc ? "TC" : "") % (c.dh.rd? "RD" : "") % (c.dh.aa? "AA" : "") % (RCode::to_s(c.dh.rcode) + extra)).str() )) ; + out.insert(make_pair(c.when, (fmt % DiffTime(now, c.when) % c.requestor.toStringWithPort() % c.ds.toStringWithPort() % htons(c.dh.id) % c.name.toString() % qt.toString() % (c.usec/1000.0) % (c.dh.tc ? "TC" : "") % (c.dh.rd? "RD" : "") % (c.dh.aa? "AA" : "") % (RCode::to_s(c.dh.rcode) + extra)).str() )) ; } else { - out.insert(make_pair(c.when, (fmt % DiffTime(now, c.when) % c.requestor.toStringWithPort() % c.ds.toStringWithPort() % htons(c.dh.id) % c.name.toString() % qt.getName() % "T.O" % (c.dh.tc ? "TC" : "") % (c.dh.rd? "RD" : "") % (c.dh.aa? "AA" : "") % (RCode::to_s(c.dh.rcode) + extra)).str() )) ; + out.insert(make_pair(c.when, (fmt % DiffTime(now, c.when) % c.requestor.toStringWithPort() % c.ds.toStringWithPort() % htons(c.dh.id) % c.name.toString() % qt.toString() % "T.O" % (c.dh.tc ? "TC" : "") % (c.dh.rd? "RD" : "") % (c.dh.aa? "AA" : "") % (RCode::to_s(c.dh.rcode) + extra)).str() )) ; } if (limit && *limit == ++num) { diff --git a/pdns/dnsdist-tcp.cc b/pdns/dnsdist-tcp.cc index 32af86fcc9df..aa27cb2a51d1 100644 --- a/pdns/dnsdist-tcp.cc +++ b/pdns/dnsdist-tcp.cc @@ -761,7 +761,7 @@ static void handleQuery(std::shared_ptr& state, cons } ++state->d_currentQueriesCount; - vinfolog("Got query for %s|%s from %s (%s, %d bytes), relayed to %s", query.d_idstate.qname.toLogString(), QType(query.d_idstate.qtype).getName(), state->d_proxiedRemote.toStringWithPort(), (state->d_ci.cs->tlsFrontend ? "DoT" : "TCP"), query.d_buffer.size(), ds->getName()); + vinfolog("Got query for %s|%s from %s (%s, %d bytes), relayed to %s", query.d_idstate.qname.toLogString(), QType(query.d_idstate.qtype).toString(), state->d_proxiedRemote.toStringWithPort(), (state->d_ci.cs->tlsFrontend ? "DoT" : "TCP"), query.d_buffer.size(), ds->getName()); downstreamConnection->queueQuery(std::move(query), downstreamConnection); } diff --git a/pdns/dnsdist.cc b/pdns/dnsdist.cc index f474c79c91e5..0b4c5b316b55 100644 --- a/pdns/dnsdist.cc +++ b/pdns/dnsdist.cc @@ -1248,7 +1248,7 @@ ProcessQueryResult processQuery(DNSQuestion& dq, ClientState& cs, LocalHolders& if (!selectedBackend) { ++g_stats.noPolicy; - vinfolog("%s query for %s|%s from %s, no policy applied", g_servFailOnNoPolicy ? "ServFailed" : "Dropped", dq.qname->toLogString(), QType(dq.qtype).getName(), dq.remote->toStringWithPort()); + vinfolog("%s query for %s|%s from %s, no policy applied", g_servFailOnNoPolicy ? "ServFailed" : "Dropped", dq.qname->toLogString(), QType(dq.qtype).toString(), dq.remote->toStringWithPort()); if (g_servFailOnNoPolicy) { dq.getHeader()->rcode = RCode::ServFail; dq.getHeader()->qr = true; @@ -1419,7 +1419,7 @@ static void processUDPQuery(ClientState& cs, LocalHolders& holders, const struct ++g_stats.downstreamSendErrors; } - vinfolog("Got query for %s|%s from %s, relayed to %s", ids->qname.toLogString(), QType(ids->qtype).getName(), proxiedRemote.toStringWithPort(), ss->getName()); + vinfolog("Got query for %s|%s from %s, relayed to %s", ids->qname.toLogString(), QType(ids->qtype).toString(), proxiedRemote.toStringWithPort(), ss->getName()); } catch(const std::exception& e){ vinfolog("Got an error in UDP question thread while parsing a query from %s, id %d: %s", proxiedRemote.toStringWithPort(), queryId, e.what()); @@ -1736,7 +1736,7 @@ static void healthChecksThread() ++g_stats.downstreamTimeouts; // this is an 'actively' discovered timeout vinfolog("Had a downstream timeout from %s (%s) for query for %s|%s from %s", dss->remote.toStringWithPort(), dss->getName(), - ids.qname.toLogString(), QType(ids.qtype).getName(), ids.origRemote.toStringWithPort()); + ids.qname.toLogString(), QType(ids.qtype).toString(), ids.origRemote.toStringWithPort()); struct timespec ts; gettime(&ts); diff --git a/pdns/dnsdistdist/dnsdist-healthchecks.cc b/pdns/dnsdistdist/dnsdist-healthchecks.cc index 395a500a1d0e..ac013d2c02d3 100644 --- a/pdns/dnsdistdist/dnsdist-healthchecks.cc +++ b/pdns/dnsdistdist/dnsdist-healthchecks.cc @@ -136,7 +136,7 @@ static bool handleResponse(std::shared_ptr& data) if (receivedName != data->d_checkName || receivedType != data->d_checkType || receivedClass != data->d_checkClass) { if (g_verboseHealthChecks) { - infolog("Backend %s responded to health check with an invalid qname (%s vs %s), qtype (%s vs %s) or qclass (%d vs %d)", ds->getNameWithAddr(), receivedName.toLogString(), data->d_checkName.toLogString(), QType(receivedType).getName(), QType(data->d_checkType).getName(), receivedClass, data->d_checkClass); + infolog("Backend %s responded to health check with an invalid qname (%s vs %s), qtype (%s vs %s) or qclass (%d vs %d)", ds->getNameWithAddr(), receivedName.toLogString(), data->d_checkName.toLogString(), QType(receivedType).toString(), QType(data->d_checkType).toString(), receivedClass, data->d_checkClass); } return false; } diff --git a/pdns/dnsdistdist/dnsdist-rules.hh b/pdns/dnsdistdist/dnsdist-rules.hh index a9f690ca9ff5..e19d363e126e 100644 --- a/pdns/dnsdistdist/dnsdist-rules.hh +++ b/pdns/dnsdistdist/dnsdist-rules.hh @@ -635,7 +635,7 @@ public: string toString() const override { QType qt(d_qtype); - return "qtype=="+qt.getName(); + return "qtype=="+qt.toString(); } private: uint16_t d_qtype; @@ -828,7 +828,7 @@ public: section = "AR"; break; } - return std::to_string(d_minCount) + " <= " + QType(d_type).getName() + " records in " + section + " <= "+ std::to_string(d_maxCount); + return std::to_string(d_minCount) + " <= " + QType(d_type).toString() + " records in " + section + " <= "+ std::to_string(d_maxCount); } private: uint16_t d_type; diff --git a/pdns/dnsdistdist/dnsdist-secpoll.cc b/pdns/dnsdistdist/dnsdist-secpoll.cc index 5742aba4a473..79e3f69f494f 100644 --- a/pdns/dnsdistdist/dnsdist-secpoll.cc +++ b/pdns/dnsdistdist/dnsdist-secpoll.cc @@ -170,7 +170,7 @@ static std::string getSecPollStatus(const std::string& queriedName, int timeout= if (receivedName != sentName || receivedType != QType::TXT || receivedClass != QClass::IN) { if (g_verbose) { - warnlog("Invalid answer, either the qname (%s / %s), qtype (%s / %s) or qclass (%s / %s) does not match, received from the secpoll stub resolver %s", receivedName, sentName, QType(receivedType).getName(), QType(QType::TXT).getName(), QClass(receivedClass).toString(), QClass::IN.toString(), dest.toString()); + warnlog("Invalid answer, either the qname (%s / %s), qtype (%s / %s) or qclass (%s / %s) does not match, received from the secpoll stub resolver %s", receivedName, sentName, QType(receivedType).toString(), QType(QType::TXT).toString(), QClass(receivedClass).toString(), QClass::IN.toString(), dest.toString()); } continue; } diff --git a/pdns/dnsdistdist/doh.cc b/pdns/dnsdistdist/doh.cc index 08bf9376fad0..7dcefdd21dea 100644 --- a/pdns/dnsdistdist/doh.cc +++ b/pdns/dnsdistdist/doh.cc @@ -587,7 +587,7 @@ static int processDOHQuery(DOHUnit* du) throw; } - vinfolog("Got query for %s|%s from %s (https), relayed to %s", ids->qname.toString(), QType(ids->qtype).getName(), remote.toStringWithPort(), ss->getName()); + vinfolog("Got query for %s|%s from %s (https), relayed to %s", ids->qname.toString(), QType(ids->qtype).toString(), remote.toStringWithPort(), ss->getName()); } catch(const std::exception& e) { vinfolog("Got an error in DOH question thread while parsing a query from %s, id %d: %s", remote.toStringWithPort(), queryId, e.what()); diff --git a/pdns/dnspcap2calidns.cc b/pdns/dnspcap2calidns.cc index 7348010ab9f8..77265999d101 100644 --- a/pdns/dnspcap2calidns.cc +++ b/pdns/dnspcap2calidns.cc @@ -100,7 +100,7 @@ int main(int argc, char **argv) const ComboAddress requestor = pr.getSource(); - fp << qname << " " << QType(qtype).getName() << " " << requestor.toString() << endl; + fp << qname << " " << QType(qtype).toString() << " " << requestor.toString() << endl; } } catch (const std::exception& e) { diff --git a/pdns/dnsproxy.cc b/pdns/dnsproxy.cc index 4487cce5b385..be12827a7ec7 100644 --- a/pdns/dnsproxy.cc +++ b/pdns/dnsproxy.cc @@ -270,7 +270,7 @@ void DNSProxy::mainloop() } i->second.complete->setRcode(mdp.d_header.rcode); } else { - g_log<second.aname<<" ALIAS "<second.qname<<" over UDP, "<second.qtype).getName()<<"-record query returned "<second.aname<<" ALIAS "<second.qname<<" over UDP, "<second.qtype).toString()<<"-record query returned "<second.complete->clearRecords(); i->second.complete->setRcode(RCode::ServFail); } diff --git a/pdns/filterpo.cc b/pdns/filterpo.cc index b5f66d8f6a60..3521721ed25f 100644 --- a/pdns/filterpo.cc +++ b/pdns/filterpo.cc @@ -681,7 +681,7 @@ void DNSFilterEngine::Zone::dumpNamedPolicy(FILE* fp, const DNSName& name, const { auto records = pol.getRecords(name); for (const auto& dr : records) { - fprintf(fp, "%s %" PRIu32 " IN %s %s\n", dr.d_name.toString().c_str(), dr.d_ttl, QType(dr.d_type).getName().c_str(), dr.d_content->getZoneRepresentation().c_str()); + fprintf(fp, "%s %" PRIu32 " IN %s %s\n", dr.d_name.toString().c_str(), dr.d_ttl, QType(dr.d_type).toString().c_str(), dr.d_content->getZoneRepresentation().c_str()); } } @@ -737,7 +737,7 @@ void DNSFilterEngine::Zone::dumpAddrPolicy(FILE* fp, const Netmask& nm, const DN auto records = pol.getRecords(full); for (const auto& dr : records) { - fprintf(fp, "%s %" PRIu32 " IN %s %s\n", dr.d_name.toString().c_str(), dr.d_ttl, QType(dr.d_type).getName().c_str(), dr.d_content->getZoneRepresentation().c_str()); + fprintf(fp, "%s %" PRIu32 " IN %s %s\n", dr.d_name.toString().c_str(), dr.d_ttl, QType(dr.d_type).toString().c_str(), dr.d_content->getZoneRepresentation().c_str()); } } diff --git a/pdns/ixfr.cc b/pdns/ixfr.cc index 7b47f1affd79..9b1b4b33d34d 100644 --- a/pdns/ixfr.cc +++ b/pdns/ixfr.cc @@ -212,7 +212,7 @@ vector, vector > > getIXFRDeltas(const ComboAd if(!primarySOA) { // we have not seen the first SOA record yet if (r.first.d_type != QType::SOA) { - throw std::runtime_error("The first record of the IXFR answer for zone '"+zone.toLogString()+"' from primary '"+primary.toStringWithPort()+"' is not a SOA ("+QType(r.first.d_type).getName()+")"); + throw std::runtime_error("The first record of the IXFR answer for zone '"+zone.toLogString()+"' from primary '"+primary.toStringWithPort()+"' is not a SOA ("+QType(r.first.d_type).toString()+")"); } auto sr = getRR(r.first); @@ -245,7 +245,7 @@ vector, vector > > getIXFRDeltas(const ComboAd if(r.first.d_type == QType::OPT) continue; - throw std::runtime_error("Unexpected record (" +QType(r.first.d_type).getName()+") in non-answer section ("+std::to_string(r.first.d_place)+")in IXFR response for zone '"+zone.toLogString()+"' from primary '"+primary.toStringWithPort()); + throw std::runtime_error("Unexpected record (" +QType(r.first.d_type).toString()+") in non-answer section ("+std::to_string(r.first.d_place)+")in IXFR response for zone '"+zone.toLogString()+"' from primary '"+primary.toStringWithPort()); } r.first.d_name.makeUsRelative(zone); diff --git a/pdns/ixfrdist.cc b/pdns/ixfrdist.cc index bb48caad71ae..6774ed362492 100644 --- a/pdns/ixfrdist.cc +++ b/pdns/ixfrdist.cc @@ -469,14 +469,14 @@ static void updateThread(const string& workdir, const uint16_t& keep, const uint static bool checkQuery(const MOADNSParser& mdp, const ComboAddress& saddr, const bool udp = true, const string& logPrefix="") { vector info_msg; - g_log<registerMember("qdomainzone", [](const DNSPacket &p) -> DNSName { return p.qdomainzone; }, [](DNSPacket &p, const DNSName& name) { p.qdomainzone = name; }); d_lw->registerMember("d_peer_principal", [](const DNSPacket &p) -> std::string { return p.d_peer_principal; }, [](DNSPacket &p, const std::string &princ) { p.d_peer_principal = princ; }); - d_lw->registerMember("qtype", [](const DNSPacket &p) -> const std::string { return p.qtype.getName(); }, [](DNSPacket &p, const std::string &type) { p.qtype = type; }); + d_lw->registerMember("qtype", [](const DNSPacket &p) -> const std::string { return p.qtype.toString(); }, [](DNSPacket &p, const std::string &type) { p.qtype = type; }); /* End of DNSPacket */ diff --git a/pdns/lua-base4.cc b/pdns/lua-base4.cc index c67e6d8a102c..ba48fc617aeb 100644 --- a/pdns/lua-base4.cc +++ b/pdns/lua-base4.cc @@ -151,9 +151,9 @@ void BaseLua4::prepareContext() { // QType d_lw->writeFunction("newQType", [](const string& s) { QType q; q = s; return q; }); d_lw->registerFunction("getCode", &QType::getCode); - d_lw->registerFunction("getName", &QType::getName); + d_lw->registerFunction("getName", &QType::toString); d_lw->registerEqFunction([](const QType& a, const QType& b){ return a == b;}); // operator overloading confuses LuaContext - d_lw->registerToStringFunction(&QType::getName); + d_lw->registerToStringFunction(&QType::toString); // Netmask d_lw->writeFunction("newNetmask", [](const string& s) { return Netmask(s); }); diff --git a/pdns/lua-record.cc b/pdns/lua-record.cc index 31d4647ac286..c93f9ba7a863 100644 --- a/pdns/lua-record.cc +++ b/pdns/lua-record.cc @@ -1000,7 +1000,7 @@ std::vector> luaSynth(const std::string& code, cons ret.push_back(DNSRecordContent::mastermake(qtype, QClass::IN, content_it )); } } catch(std::exception &e) { - g_log << Logger::Info << "Lua record ("< p.getMaxReplyLen()) { - g_log< "< "< PacketHandler::doQuestion(DNSPacket& p) return r; } - // g_log<setRcode(RCode::Refused); @@ -1503,7 +1503,7 @@ std::unique_ptr PacketHandler::doQuestion(DNSPacket& p) if (rr.dr.d_type == QType::RRSIG) // RRSIGS are added later any way. continue; // TODO: this actually means addRRSig should check if the RRSig is already there - // cerr<<"Auth: "< PacketHandler::doQuestion(DNSPacket& p) throw; // we WANT to die at this point } catch(const std::exception &e) { - g_log<setRcode(RCode::ServFail); S.inc("servfail-packets"); diff --git a/pdns/pdns_recursor.cc b/pdns/pdns_recursor.cc index 72588567aca1..a59b4948962c 100644 --- a/pdns/pdns_recursor.cc +++ b/pdns/pdns_recursor.cc @@ -1083,7 +1083,7 @@ static PolicyResult handlePolicyHit(const DNSFilterEngine::Policy& appliedPolicy } if (sr.doLog() && appliedPolicy.d_type != DNSFilterEngine::PolicyType::None) { - g_log << Logger::Warning << dc->d_mdp.d_qname << "|" << QType(dc->d_mdp.d_qtype).getName() << appliedPolicy.getLogString() << endl; + g_log << Logger::Warning << dc->d_mdp.d_qname << "|" << QType(dc->d_mdp.d_qtype).toString() << appliedPolicy.getLogString() << endl; } if (appliedPolicy.d_zoneData && appliedPolicy.d_zoneData->d_extendedErrorCode) { @@ -1350,7 +1350,7 @@ static bool udrCheckUniqueDNSRecord(const DNSName& dname, uint16_t qtype, const if (t_udrDBp && t_udrDBp->isUniqueResponse(ss.str())) { if (g_udrLog) { // This should also probably log to a dedicated file. - g_log<d_mdp.d_qname<<"|"<d_mdp.d_qtype).getName()<getRemote()<<" validates correctly"<d_mdp.d_qname<<"|"<d_mdp.d_qtype).toString()<getRemote()<<" validates correctly"<d_mdp.d_qname<<"|"<d_mdp.d_qtype).getName()<getRemote()<<" validates as Insecure"<d_mdp.d_qname<<"|"<d_mdp.d_qtype).toString()<getRemote()<<" validates as Insecure"<ad=0; @@ -1898,27 +1898,27 @@ static void startDoResolve(void *p) if(t_bogusqueryring) t_bogusqueryring->push_back(make_pair(dc->d_mdp.d_qname, dc->d_mdp.d_qtype)); if(g_dnssecLogBogus || sr.doLog() || g_dnssecmode == DNSSECMode::ValidateForLog) { - g_log<d_mdp.d_qname<<"|"<d_mdp.d_qtype).getName()<getRemote()<<" validates as "<d_mdp.d_qname<<"|"<d_mdp.d_qtype).toString()<getRemote()<<" validates as "<cd && (g_dnssecmode == DNSSECMode::ValidateAll || dc->d_mdp.d_header.ad || DNSSECOK)) { if(sr.doLog()) { - g_log<d_mdp.d_qname<<"|"<d_mdp.d_qtype).getName()<<" because recursor or query demands it for Bogus results"<d_mdp.d_qname<<"|"<d_mdp.d_qtype).toString()<<" because recursor or query demands it for Bogus results"<rcode=RCode::ServFail; goto sendit; } else { if(sr.doLog()) { - g_log<d_mdp.d_qname<<"|"<d_mdp.d_qtype).getName()<d_mdp.d_qname<<"|"<d_mdp.d_qtype).toString()<getRemote()<<" during validation of '"<d_mdp.d_qname<<"|"<d_mdp.d_qtype).getName()<<"' because: "<getRemote()<<" during validation of '"<d_mdp.d_qname<<"|"<d_mdp.d_qtype).toString()<<"' because: "<rcode=RCode::ServFail; goto sendit; } diff --git a/pdns/pdnsutil.cc b/pdns/pdnsutil.cc index bc99b51fedc1..9ce08dcbd098 100644 --- a/pdns/pdnsutil.cc +++ b/pdns/pdnsutil.cc @@ -363,7 +363,7 @@ static int checkZone(DNSSECKeeper &dk, UeberBackend &B, const DNSName& zone, con stringtok(parts, rr.content); if(parts.size() < 7) { - cout<<"[Warning] SOA autocomplete is deprecated, missing field(s) in SOA content: "<getZoneRepresentation(false); } if(!pdns_iequals(tmp, rr.content)) { - cout<<"[Warning] Parsed and original record content are not equal: "<(drc); if (svcbrc->getPriority() == 0 && svcbrc->hasParams()) { - cout<<"[Warning] Aliasform "<hasParam(SvcParam::mandatory)) { auto keys = svcbrc->getParam(SvcParam::mandatory).getMandatory(); for (auto const &k: keys) { if (!svcbrc->hasParam(k)) { - cout<<"[Warning] "<(toLower(content.str()), rr.ttl)); if (ret.second == false && ret.first->second != rr.ttl) { - cout<<"[Error] TTL mismatch in rrset: '"<second<<" != "<second<<" != "<feedRecord(rr, DNSName()); @@ -1537,7 +1537,7 @@ static int addOrReplaceRecord(bool addOrReplace, const vector& cmds) { } if(!addOrReplace) { - cout<<"Current records for "<getZoneRepresentation(true); @@ -1554,7 +1554,7 @@ static int addOrReplaceRecord(bool addOrReplace, const vector& cmds) { di.backend->lookup(rr.qtype, name, di.id); cout<<"New rrset:"<get(rr)) { - cout<commitTransaction(); return EXIT_SUCCESS; diff --git a/pdns/qtype.cc b/pdns/qtype.cc index e4b1f5ca9ac4..b3d7d1408734 100644 --- a/pdns/qtype.cc +++ b/pdns/qtype.cc @@ -126,7 +126,7 @@ bool QType::isMetadataType() const return false; } -const string QType::getName() const +const string QType::toString() const { const auto& name = numbers.find(code); if (name != numbers.cend()) { diff --git a/pdns/qtype.hh b/pdns/qtype.hh index ae9c682e5ff4..d76ccfcbe378 100644 --- a/pdns/qtype.hh +++ b/pdns/qtype.hh @@ -31,7 +31,7 @@ t="CNAME"; cout<getZoneRepresentation().c_str(), vStateToString(ne.d_validationState).c_str()); } diff --git a/pdns/recursordist/taskqueue.cc b/pdns/recursordist/taskqueue.cc index 847ed88b3727..ad0eba7632fd 100644 --- a/pdns/recursordist/taskqueue.cc +++ b/pdns/recursordist/taskqueue.cc @@ -68,7 +68,7 @@ bool TaskQueue::runOnce(bool logErrors) vector ret; sr.setRefreshAlmostExpired(task.d_refreshMode); try { - g_log << Logger::Debug << "TaskQueue: resolving " << task.d_qname.toString() << '|' << QType(task.d_qtype).getName() << endl; + g_log << Logger::Debug << "TaskQueue: resolving " << task.d_qname.toString() << '|' << QType(task.d_qtype).toString() << endl; sr.beginResolve(task.d_qname, QType(task.d_qtype), QClass::IN, ret); } catch (const std::exception& e) { @@ -93,7 +93,7 @@ bool TaskQueue::runOnce(bool logErrors) } else { // Deadline passed - g_log << Logger::Debug << "TaskQueue: deadline for " << task.d_qname.toString() << '|' << QType(task.d_qtype).getName() << " passed" << endl; + g_log << Logger::Debug << "TaskQueue: deadline for " << task.d_qname.toString() << '|' << QType(task.d_qtype).toString() << " passed" << endl; d_expired++; } return true; diff --git a/pdns/recursordist/test-negcache_cc.cc b/pdns/recursordist/test-negcache_cc.cc index 7cffa8128702..666083da756d 100644 --- a/pdns/recursordist/test-negcache_cc.cc +++ b/pdns/recursordist/test-negcache_cc.cc @@ -21,7 +21,7 @@ static recordsAndSignatures genRecsAndSigs(const DNSName& name, const uint16_t q if (sigs) { rec.d_type = QType::RRSIG; - rec.d_content = std::make_shared(QType(qtype).getName() + " 5 3 600 2037010100000000 2037010100000000 24567 dummy data"); + rec.d_content = std::make_shared(QType(qtype).toString() + " 5 3 600 2037010100000000 2037010100000000 24567 dummy data"); ret.signatures.push_back(rec); } @@ -65,7 +65,7 @@ BOOST_AUTO_TEST_CASE(test_get_entry) BOOST_CHECK(ret); BOOST_CHECK_EQUAL(ne.d_name, qname); - BOOST_CHECK_EQUAL(ne.d_qtype.getName(), QType(0).getName()); + BOOST_CHECK_EQUAL(ne.d_qtype.toString(), QType(0).toString()); BOOST_CHECK_EQUAL(ne.d_auth, auth); } @@ -89,7 +89,7 @@ BOOST_AUTO_TEST_CASE(test_get_entry2038) BOOST_CHECK(ret); BOOST_CHECK_EQUAL(ne.d_name, qname); - BOOST_CHECK_EQUAL(ne.d_qtype.getName(), QType(0).getName()); + BOOST_CHECK_EQUAL(ne.d_qtype.toString(), QType(0).toString()); BOOST_CHECK_EQUAL(ne.d_auth, auth); } @@ -133,7 +133,7 @@ BOOST_AUTO_TEST_CASE(test_get_NODATA_entry) BOOST_CHECK(ret); BOOST_CHECK_EQUAL(ne.d_name, qname); - BOOST_CHECK_EQUAL(ne.d_qtype.getName(), QType(1).getName()); + BOOST_CHECK_EQUAL(ne.d_qtype.toString(), QType(1).toString()); BOOST_CHECK_EQUAL(ne.d_auth, auth); NegCache::NegCacheEntry ne2; @@ -159,7 +159,7 @@ BOOST_AUTO_TEST_CASE(test_getRootNXTrust_entry) BOOST_CHECK(ret); BOOST_CHECK_EQUAL(ne.d_name, qname); - BOOST_CHECK_EQUAL(ne.d_qtype.getName(), QType(0).getName()); + BOOST_CHECK_EQUAL(ne.d_qtype.toString(), QType(0).toString()); BOOST_CHECK_EQUAL(ne.d_auth, auth); } diff --git a/pdns/recursordist/test-syncres_cc3.cc b/pdns/recursordist/test-syncres_cc3.cc index 9e6f51376d86..53457477bc6b 100644 --- a/pdns/recursordist/test-syncres_cc3.cc +++ b/pdns/recursordist/test-syncres_cc3.cc @@ -30,7 +30,7 @@ BOOST_AUTO_TEST_CASE(test_cache_auth) int res = sr->beginResolve(target, QType(QType::A), QClass::IN, ret); BOOST_CHECK_EQUAL(res, RCode::NoError); BOOST_REQUIRE_EQUAL(ret.size(), 1U); - BOOST_REQUIRE_EQUAL(QType(ret.at(0).d_type).getName(), QType(QType::A).getName()); + BOOST_REQUIRE_EQUAL(QType(ret.at(0).d_type).toString(), QType(QType::A).toString()); BOOST_CHECK_EQUAL(getRR(ret.at(0))->getCA().toString(), ComboAddress("192.0.2.2").toString()); /* check that we correctly cached only the answer entry, not the additional one */ @@ -38,7 +38,7 @@ BOOST_AUTO_TEST_CASE(test_cache_auth) vector cached; BOOST_REQUIRE_GT(g_recCache->get(now, target, QType(QType::A), true, &cached, who), 0); BOOST_REQUIRE_EQUAL(cached.size(), 1U); - BOOST_REQUIRE_EQUAL(QType(cached.at(0).d_type).getName(), QType(QType::A).getName()); + BOOST_REQUIRE_EQUAL(QType(cached.at(0).d_type).toString(), QType(QType::A).toString()); BOOST_CHECK_EQUAL(getRR(cached.at(0))->getCA().toString(), ComboAddress("192.0.2.2").toString()); } @@ -295,7 +295,7 @@ BOOST_AUTO_TEST_CASE(test_special_types) size_t queriesCount = 0; sr->setAsyncCallback([&queriesCount](const ComboAddress& ip, const DNSName& domain, int type, bool doTCP, bool sendRDQuery, int EDNS0Level, struct timeval* now, boost::optional& srcmask, boost::optional context, LWResult* res, bool* chained) { - cerr << "asyncresolve called to ask " << ip.toStringWithPort() << " about " << domain.toString() << " / " << QType(type).getName() << " over " << (doTCP ? "TCP" : "UDP") << " (rd: " << sendRDQuery << ", EDNS0 level: " << EDNS0Level << ")" << endl; + cerr << "asyncresolve called to ask " << ip.toStringWithPort() << " about " << domain.toString() << " / " << QType(type).toString() << " over " << (doTCP ? "TCP" : "UDP") << " (rd: " << sendRDQuery << ", EDNS0 level: " << EDNS0Level << ")" << endl; queriesCount++; return LWResult::Result::Timeout; }); diff --git a/pdns/reczones.cc b/pdns/reczones.cc index caae18954f69..a5430c85157e 100644 --- a/pdns/reczones.cc +++ b/pdns/reczones.cc @@ -407,10 +407,10 @@ std::shared_ptr parseAuthAndForwards() dr.d_place = DNSResourceRecord::ANSWER; } catch (std::exception& e) { - throw PDNSException("Error parsing record '" + rr.qname.toLogString() + "' of type " + rr.qtype.getName() + " in zone '" + headers.first + "' from file '" + headers.second + "': " + e.what()); + throw PDNSException("Error parsing record '" + rr.qname.toLogString() + "' of type " + rr.qtype.toString() + " in zone '" + headers.first + "' from file '" + headers.second + "': " + e.what()); } catch (...) { - throw PDNSException("Error parsing record '" + rr.qname.toLogString() + "' of type " + rr.qtype.getName() + " in zone '" + headers.first + "' from file '" + headers.second + "'"); + throw PDNSException("Error parsing record '" + rr.qname.toLogString() + "' of type " + rr.qtype.toString() + " in zone '" + headers.first + "' from file '" + headers.second + "'"); } ad.d_records.insert(dr); diff --git a/pdns/resolver.cc b/pdns/resolver.cc index 1f569c4d1885..5cde2e88f344 100644 --- a/pdns/resolver.cc +++ b/pdns/resolver.cc @@ -354,7 +354,7 @@ void Resolver::getSoaSerial(const ComboAddress& ipport, const DNSName &domain, u throw ResolverException("Query to '" + ipport.toLogString() + "' for SOA of '" + domain.toLogString() + "' produced no answers"); if(res[0].qtype.getCode() != QType::SOA) - throw ResolverException("Query to '" + ipport.toLogString() + "' for SOA of '" + domain.toLogString() + "' produced a "+res[0].qtype.getName()+" record"); + throw ResolverException("Query to '" + ipport.toLogString() + "' for SOA of '" + domain.toLogString() + "' produced a "+res[0].qtype.toString()+" record"); vectorparts; stringtok(parts, res[0].content); diff --git a/pdns/rfc2136handler.cc b/pdns/rfc2136handler.cc index 12f007655f15..0890693a28ca 100644 --- a/pdns/rfc2136handler.cc +++ b/pdns/rfc2136handler.cc @@ -95,17 +95,17 @@ uint PacketHandler::performUpdate(const string &msgPrefix, const DNSRecord *rr, QType rrType = QType(rr->d_type); if (rrType == QType::NSEC || rrType == QType::NSEC3) { - g_log<d_name<<"|"<d_name<<"|"<d_name<<"|"<d_name<<"|"<d_name != di->zone) { - g_log<d_name<<"|"<d_name<<"|"<d_class == QClass::IN) { // 3.4.2.2 QClass::IN means insert or update - DLOG(g_log<d_name<<"|"<d_name<<"|"<backend->replaceRRSet(di->id, oldRec->qname, oldRec->qtype, rrset); *updatedSerial = true; changedRecords++; - g_log<d_name<<"|"<d_name<<"|"< 0) { di->backend->replaceRRSet(di->id, rr->d_name, rrType, rrset); - g_log<d_name<<"|"<d_name<<"|"<d_name<<"|"<d_name<<"|"< 0) { di->backend->replaceRRSet(di->id, rr->d_name, rrType, rrset); - g_log<d_name<<"|"<d_name<<"|"<d_name<<"|"<d_name<<"|"<d_name<<"|"<d_name<<"|"<d_name); // always remove any ENT's in the place where we're going to add a record. auto newRec = DNSResourceRecord::fromWire(*rr); newRec.domain_id = di->id; @@ -359,7 +359,7 @@ uint PacketHandler::performUpdate(const string &msgPrefix, const DNSRecord *rr, // Delete records - section 3.4.2.3 and 3.4.2.4 with the exception of the 'always leave 1 NS rule' as that's handled by // the code that calls this performUpdate(). if ((rr->d_class == QClass::ANY || rr->d_class == QClass::NONE) && rrType != QType::SOA) { // never delete a SOA. - DLOG(g_log<d_name<<"; QClass:"<d_class<<"; rrType: "<d_name<<"; QClass:"<d_class<<"; rrType: "<backend->replaceRRSet(di->id, rr->d_name, rrType, rrset); - g_log<d_name<<"|"<d_name<<"|"<d_name<<"|"<d_name<<"|"<d_update_policy_lua != nullptr) { if (this->d_update_policy_lua->updatePolicy(rr->d_name, QType(rr->d_type), di.zone, p) == false) { - g_log<d_name << "/" << QType(rr->d_type).getName() << ": Not permitted by policy"<d_name << "/" << QType(rr->d_type).toString() << ": Not permitted by policy"<d_name << "/" << QType(rr->d_type).getName() << ": Permitted by policy"<d_name << "/" << QType(rr->d_type).toString() << ": Permitted by policy"<get(rec)) ; - g_log<d_name << "/" << QType(rr->d_type).getName() << ": Data other than CNAME exists for the same name"<d_name << "/" << QType(rr->d_type).toString() << ": Data other than CNAME exists for the same name"<abortTransaction(); return RCode::Refused; } @@ -911,7 +911,7 @@ int PacketHandler::processUpdate(DNSPacket& p) { // leave database handle in a consistent state while (di.backend->get(rec)) ; - g_log<d_name << "/" << QType(rr->d_type).getName() << ": CNAME exists for the same name"<d_name << "/" << QType(rr->d_type).toString() << ": CNAME exists for the same name"<abortTransaction(); return RCode::Refused; } diff --git a/pdns/slavecommunicator.cc b/pdns/slavecommunicator.cc index 619c7e66605b..29c309892e6c 100644 --- a/pdns/slavecommunicator.cc +++ b/pdns/slavecommunicator.cc @@ -270,7 +270,7 @@ static vector doAxfr(const ComboAddress& raddr, const DNSName continue; if(!rec.qname.isPartOf(domain)) { - g_log< doAxfr(const ComboAddress& raddr, const DNSName for(auto& rr : out) { if(!rr.qname.isPartOf(domain)) { - g_log< > StatBag::getRing(const string &name) } else if(d_dnsnameqtyperings.count(name)) { auto raw = d_dnsnameqtyperings[name].get(); for (auto const &e : raw) { - ret.push_back(make_pair(std::get<0>(e.first).toLogString() + "/" + std::get<1>(e.first).getName(), e.second)); + ret.push_back(make_pair(std::get<0>(e.first).toLogString() + "/" + std::get<1>(e.first).toString(), e.second)); } } return ret; diff --git a/pdns/stubresolver.cc b/pdns/stubresolver.cc index 3951be74b3cb..4b3a47ab7ad8 100644 --- a/pdns/stubresolver.cc +++ b/pdns/stubresolver.cc @@ -126,7 +126,7 @@ int stubDoResolve(const DNSName& qname, uint16_t qtype, vector& r pw.getHeader()->id=dns_random_uint16(); pw.getHeader()->rd=1; - string queryNameType = qname.toString() + "|" + QType(qtype).getName(); + string queryNameType = qname.toString() + "|" + QType(qtype).toString(); string msg ="Doing stub resolving for '" + queryNameType + "', using resolvers: "; for (const auto& server : s_resolversForStub) { msg += server.toString() + ", "; diff --git a/pdns/syncres.cc b/pdns/syncres.cc index 50586d8603c0..359ef78e8408 100644 --- a/pdns/syncres.cc +++ b/pdns/syncres.cc @@ -699,7 +699,7 @@ int SyncRes::doResolve(const DNSName &qname, const QType qtype, vector s_maxdepth) { string msg = "More than " + std::to_string(s_maxdepth) + " (max-recursion-depth) levels of recursion needed while resolving " + qname.toLogString(); @@ -857,7 +857,7 @@ int SyncRes::doResolveNoQNameMinimization(const DNSName &qname, const QType qtyp if(!(d_updatingRootNS && qtype.getCode()==QType::NS && qname.isRoot())) { if(d_cacheonly) { // very limited OOB support LWResult lwr; - LOG(prefix<end()) { @@ -1001,7 +1001,7 @@ int SyncRes::doResolveNoQNameMinimization(const DNSName &qname, const QType qtyp return 0; } - LOG(prefix<getZoneRepresentation()<<"', validation state is "<getZoneRepresentation()<<"', validation state is "< "< "<get(d_now.tv_sec, sqname, sqt, !wasForwardRecurse && d_requireAuthData, &cset, d_cacheRemote, d_refresh, d_routingTag, d_doDNSSEC ? &signatures : nullptr, d_doDNSSEC ? &authorityRecs : nullptr, &d_wasVariable, &cachedState, &wasCachedAuth) > 0) { - LOG(prefix<first.name, i->second.records, i->second.signatures, depth); } else { - LOG(d_prefix<<"Validating non-additional "<first.type).getName()<<" record for "<first.name<first.type).toString()<<" record for "<first.name<first.name, QType(i->first.type), i->second.records, i->second.signatures); } } @@ -3644,7 +3644,7 @@ bool SyncRes::processRecords(const std::string& prefix, const DNSName& qname, co } else if (!done && rec.d_place == DNSResourceRecord::AUTHORITY && rec.d_type == QType::SOA && lwr.d_rcode == RCode::NoError && qname.isPartOf(rec.d_name)) { - LOG(prefix< s_maxtotusec) { - throw ImmediateServFailException("Too much time waiting for "+qname.toLogString()+"|"+qtype.getName()+", timeouts: "+std::to_string(d_timeouts) +", throttles: "+std::to_string(d_throttledqueries) + ", queries: "+std::to_string(d_outqueries)+", "+std::to_string(d_totUsec/1000)+"msec"); + throw ImmediateServFailException("Too much time waiting for "+qname.toLogString()+"|"+qtype.toString()+", timeouts: "+std::to_string(d_timeouts) +", throttles: "+std::to_string(d_throttledqueries) + ", queries: "+std::to_string(d_outqueries)+", "+std::to_string(d_totUsec/1000)+"msec"); } if(doTCP) { @@ -4204,7 +4204,7 @@ int SyncRes::doResolveAt(NsSet &nameservers, DNSName auth, bool flawedNSSet, con } for(remoteIP = remoteIPs.cbegin(); remoteIP != remoteIPs.cend(); ++remoteIP) { - LOG(prefix<toStringWithPort() <<", asking '"<toStringWithPort() <<", asking '"<getRemote().toString() + "<-" + packet->getRealRemote().toString(); else remote_text = packet->getRemote().toString(); - g_log << Logger::Notice<<"TCP Remote "<< remote_text <<" wants '" << packet->qdomain<<"|"<qtype.getName() << + g_log << Logger::Notice<<"TCP Remote "<< remote_text <<" wants '" << packet->qdomain<<"|"<qtype.toString() << "', do = " <d_dnssecOk <<", bufsize = "<< packet->getMaxReplyLen(); } @@ -1052,7 +1052,7 @@ int TCPNameserver::doIXFR(std::unique_ptr& q, int outsock) return 0; } } else if (rr->d_type != QType::TSIG && rr->d_type != QType::OPT) { - g_log<d_type).getName()<d_type).toString()<setRcode(RCode::FormErr); sendPacket(outpacket,outsock); return 0; diff --git a/pdns/test-dnsrecords_cc.cc b/pdns/test-dnsrecords_cc.cc index 0f7161d0db4e..da3c667c804c 100644 --- a/pdns/test-dnsrecords_cc.cc +++ b/pdns/test-dnsrecords_cc.cc @@ -268,12 +268,12 @@ BOOST_AUTO_TEST_CASE(test_record_types) { const broken_marker broken = val.get<4>(); if (lq != q.getCode()) n = 0; - if (q.getCode() != QType::TSIG && q.getCode() != 65226) BOOST_CHECK_MESSAGE(QType::names.find(q.getName()) != QType::names.end(), "qtype " << q.getName() << " not registered in QType::names"); + if (q.getCode() != QType::TSIG && q.getCode() != 65226) BOOST_CHECK_MESSAGE(QType::names.find(q.toString()) != QType::names.end(), "qtype " << q.toString() << " not registered in QType::names"); BOOST_CHECK_MESSAGE(q.getCode() >= lq, "record types should be sorted such that qtype " << q.getCode() << " is before " << lq); lq = q.getCode(); n++; - BOOST_TEST_CHECKPOINT("Checking record type " << q.getName() << " test #" << n); - BOOST_TEST_MESSAGE("Checking record type " << q.getName() << " test #" << n); + BOOST_TEST_CHECKPOINT("Checking record type " << q.toString() << " test #" << n); + BOOST_TEST_MESSAGE("Checking record type " << q.toString() << " test #" << n); try { std::string recData; auto rec = DNSRecordContent::mastermake(q.getCode(), 1, inval); @@ -306,10 +306,10 @@ BOOST_AUTO_TEST_CASE(test_record_types) { recData = makeHexDump(recData); REC_CHECK_EQUAL(recData, cmpData); } catch (std::runtime_error &err) { - REC_CHECK_MESSAGE(false, q.getName() << ": " << err.what()); + REC_CHECK_MESSAGE(false, q.toString() << ": " << err.what()); continue; } - REC_FAIL_XSUCCESS(q.getName() << " test #" << n << " has unexpectedly passed") + REC_FAIL_XSUCCESS(q.toString() << " test #" << n << " has unexpectedly passed") } } @@ -365,8 +365,8 @@ BOOST_AUTO_TEST_CASE(test_record_types_bad_values) { if (lq != q.getCode()) n = 0; lq = q.getCode(); n++; - BOOST_TEST_CHECKPOINT("Checking bad value for record type " << q.getName() << " test #" << n); - BOOST_TEST_MESSAGE("Checking bad value for record type " << q.getName() << " test #" << n); + BOOST_TEST_CHECKPOINT("Checking bad value for record type " << q.toString() << " test #" << n); + BOOST_TEST_MESSAGE("Checking bad value for record type " << q.toString() << " test #" << n); vector packet; DNSPacketWriter pw(packet, DNSName("unit.test"), q.getCode()); @@ -387,7 +387,7 @@ BOOST_AUTO_TEST_CASE(test_record_types_bad_values) { }, std::exception, test_dnsrecords_cc_predicate ); - if (success) REC_FAIL_XSUCCESS(q.getName() << " test #" << n << " has unexpectedly passed"); // a bad record was detected when it was supposed not to be detected + if (success) REC_FAIL_XSUCCESS(q.toString() << " test #" << n << " has unexpectedly passed"); // a bad record was detected when it was supposed not to be detected } else { BOOST_CHECK_EXCEPTION( { diff --git a/pdns/test-ueberbackend_cc.cc b/pdns/test-ueberbackend_cc.cc index 3921b02fa760..6da2d46ea747 100644 --- a/pdns/test-ueberbackend_cc.cc +++ b/pdns/test-ueberbackend_cc.cc @@ -400,7 +400,7 @@ static void checkRecordExists(const std::vector& records, const D return; } } - BOOST_CHECK_MESSAGE(false, "Record " + name.toString() + "/" + QType(type).getName() + " - " + std::to_string(zoneId) + " not found"); + BOOST_CHECK_MESSAGE(false, "Record " + name.toString() + "/" + QType(type).toString() + " - " + std::to_string(zoneId) + " not found"); } BOOST_AUTO_TEST_CASE(test_simple) { diff --git a/pdns/test-zoneparser_tng_cc.cc b/pdns/test-zoneparser_tng_cc.cc index 1075a75323e7..665710944355 100644 --- a/pdns/test-zoneparser_tng_cc.cc +++ b/pdns/test-zoneparser_tng_cc.cc @@ -43,7 +43,7 @@ BOOST_AUTO_TEST_CASE(test_tng_record_types) { // see if these agree BOOST_CHECK_EQUAL(rr.qname.toString(), host); BOOST_CHECK_EQUAL(rr.ttl, ttl); - BOOST_CHECK_EQUAL(rr.qtype.getName(), type); + BOOST_CHECK_EQUAL(rr.qtype.toString(), type); if (rr.qtype == QType::SOA) continue; // FIXME400 remove trailing dots from data if (*(rr.content.rbegin()) != '.' && *(data.rbegin()) == '.') @@ -92,7 +92,7 @@ BOOST_AUTO_TEST_CASE(test_tng_record_generate) { BOOST_CHECK_EQUAL(rr.qname.toString(), exp); BOOST_CHECK_EQUAL(rr.ttl, 86400U); BOOST_CHECK_EQUAL(rr.qclass, 1U); - BOOST_CHECK_EQUAL(rr.qtype.getName(), "A"); + BOOST_CHECK_EQUAL(rr.qtype.toString(), "A"); BOOST_CHECK_EQUAL(rr.content, "1.2.3.4"); } } @@ -113,7 +113,7 @@ BOOST_AUTO_TEST_CASE(test_tng_record_generate) { BOOST_CHECK_EQUAL(rr.qname.toString(), exp); BOOST_CHECK_EQUAL(rr.ttl, 86400U); BOOST_CHECK_EQUAL(rr.qclass, 1U); - BOOST_CHECK_EQUAL(rr.qtype.getName(), "A"); + BOOST_CHECK_EQUAL(rr.qtype.toString(), "A"); BOOST_CHECK_EQUAL(rr.content, "1.2.3.4"); } } @@ -161,7 +161,7 @@ BOOST_AUTO_TEST_CASE(test_tng_upgrade) { DNSResourceRecord rr; zp.get(rr); - BOOST_CHECK_EQUAL(rr.qtype.getName(), QType(QType::A).getName()); + BOOST_CHECK_EQUAL(rr.qtype.toString(), QType(QType::A).toString()); BOOST_CHECK_EQUAL(rr.content, std::string("192.0.3.4")); } diff --git a/pdns/validate.cc b/pdns/validate.cc index 901b085d40b3..8d18956a02ab 100644 --- a/pdns/validate.cc +++ b/pdns/validate.cc @@ -247,7 +247,7 @@ bool isNSEC3AncestorDelegation(const DNSName& signer, const DNSName& owner, cons static bool provesNoDataWildCard(const DNSName& qname, const uint16_t qtype, const DNSName& closestEncloser, const cspmap_t& validrrsets) { const DNSName wildcard = g_wildcarddnsname + closestEncloser; - LOG("Trying to prove that there is no data in wildcard for "<d_next)) { - LOG("Denies existence of type "<isSet(qtype)<<", next: "<d_next<isSet(qtype)<<", next: "<d_next< "<d_nexthash)<d_nexthash)) { - LOG("Denies existence of name "<isOptOut()) { @@ -837,7 +837,7 @@ dState getDenial(const cspmap_t &validrrsets, const DNSName& qname, const uint16 /* RFC 7129 section-5.6 */ if (needWildcardProof && !provesNSEC3NoWildCard(closestEncloser, qtype, validrrsets, &wildcardExists, cache)) { if (!isOptOut) { - LOG("But the existence of a wildcard is not denied for "< productServerStatisticsFetch(const std::string& name) static void validateGatheredRRType(const DNSResourceRecord& rr) { if (rr.qtype.getCode() == QType::OPT || rr.qtype.getCode() == QType::TSIG) { - throw ApiException("RRset "+rr.qname.toString()+" IN "+rr.qtype.getName()+": invalid type given"); + throw ApiException("RRset "+rr.qname.toString()+" IN "+rr.qtype.toString()+": invalid type given"); } } @@ -549,7 +549,7 @@ static void gatherRecords(UeberBackend& B, const string& logprefix, const Json& } catch(std::exception& e) { - throw ApiException("Record "+rr.qname.toString()+"/"+rr.qtype.getName()+" '"+content+"': "+e.what()); + throw ApiException("Record "+rr.qname.toString()+"/"+rr.qtype.toString()+" '"+content+"': "+e.what()); } new_records.push_back(rr); @@ -1426,13 +1426,13 @@ static void checkNewRecords(vector& records) { if (previous.qname == rec.qname) { if (previous.qtype == rec.qtype) { if (onlyOneEntryTypes.count(rec.qtype.getCode()) != 0) { - throw ApiException("RRset "+rec.qname.toString()+" IN "+rec.qtype.getName()+" has more than one record"); + throw ApiException("RRset "+rec.qname.toString()+" IN "+rec.qtype.toString()+" has more than one record"); } if (previous.content == rec.content) { - throw ApiException("Duplicate record in RRset " + rec.qname.toString() + " IN " + rec.qtype.getName() + " with content \"" + rec.content + "\""); + throw ApiException("Duplicate record in RRset " + rec.qname.toString() + " IN " + rec.qtype.toString() + " with content \"" + rec.content + "\""); } } else if (exclusiveEntryTypes.count(rec.qtype.getCode()) != 0 || exclusiveEntryTypes.count(previous.qtype.getCode()) != 0) { - throw ApiException("RRset "+rec.qname.toString()+" IN "+rec.qtype.getName()+": Conflicts with another RRset"); + throw ApiException("RRset "+rec.qname.toString()+" IN "+rec.qtype.toString()+": Conflicts with another RRset"); } } @@ -1440,7 +1440,7 @@ static void checkNewRecords(vector& records) { try { checkHostnameCorrectness(rec); } catch (const std::exception& e) { - throw ApiException("RRset "+rec.qname.toString()+" IN "+rec.qtype.getName() + " " + e.what()); + throw ApiException("RRset "+rec.qname.toString()+" IN "+rec.qtype.toString() + " " + e.what()); } previous = rec; @@ -1652,7 +1652,7 @@ static void apiServerZones(HttpRequest* req, HttpResponse* resp) { for(auto& rr : new_records) { rr.qname.makeUsLowerCase(); if (!rr.qname.isPartOf(zonename) && rr.qname != zonename) - throw ApiException("RRset "+rr.qname.toString()+" IN "+rr.qtype.getName()+": Name is out of zone"); + throw ApiException("RRset "+rr.qname.toString()+" IN "+rr.qtype.toString()+": Name is out of zone"); apiCheckQNameAllowedCharacters(rr.qname.toString()); if (rr.qtype.getCode() == QType::SOA && rr.qname==zonename) { @@ -1874,7 +1874,7 @@ static void apiServerZoneExport(HttpRequest* req, HttpResponse* resp) { rr.qname.toString() << "\t" << rr.ttl << "\t" << "IN" << "\t" << - rr.qtype.getName() << "\t" << + rr.qtype.toString() << "\t" << makeApiRecordContent(rr.qtype, rr.content) << endl; } @@ -1992,7 +1992,7 @@ static void patchZone(UeberBackend& B, HttpRequest* req, HttpResponse* resp) { if(seen.count({qname, qtype, changetype})) { - throw ApiException("Duplicate RRset "+qname.toString()+" IN "+qtype.getName()+" with changetype: "+changetype); + throw ApiException("Duplicate RRset "+qname.toString()+" IN "+qtype.toString()+" with changetype: "+changetype); } seen.insert({qname, qtype, changetype}); @@ -2005,13 +2005,13 @@ static void patchZone(UeberBackend& B, HttpRequest* req, HttpResponse* resp) { else if (changetype == "REPLACE") { // we only validate for REPLACE, as DELETE can be used to "fix" out of zone records. if (!qname.isPartOf(zonename) && qname != zonename) - throw ApiException("RRset "+qname.toString()+" IN "+qtype.getName()+": Name is out of zone"); + throw ApiException("RRset "+qname.toString()+" IN "+qtype.toString()+": Name is out of zone"); bool replace_records = rrset["records"].is_array(); bool replace_comments = rrset["comments"].is_array(); if (!replace_records && !replace_comments) { - throw ApiException("No change for RRset " + qname.toString() + " IN " + qtype.getName()); + throw ApiException("No change for RRset " + qname.toString() + " IN " + qtype.toString()); } new_records.clear(); @@ -2064,12 +2064,12 @@ static void patchZone(UeberBackend& B, HttpRequest* req, HttpResponse* resp) { while (di.backend->get(rr)) ; - throw ApiException("RRset "+qname.toString()+" IN "+qtype.getName()+": Conflicts with pre-existing RRset"); + throw ApiException("RRset "+qname.toString()+" IN "+qtype.toString()+": Conflicts with pre-existing RRset"); } } if (dname_seen && ns_seen && qname != zonename) { - throw ApiException("RRset "+qname.toString()+" IN "+qtype.getName()+": Cannot have both NS and DNAME except in zone apex"); + throw ApiException("RRset "+qname.toString()+" IN "+qtype.toString()+": Cannot have both NS and DNAME except in zone apex"); } if (!new_records.empty() && ent_present) { QType qt_ent{0}; @@ -2212,7 +2212,7 @@ static void apiServerSearchData(HttpRequest* req, HttpResponse* resp) { auto object = Json::object { { "object_type", "record" }, { "name", rr.qname.toString() }, - { "type", rr.qtype.getName() }, + { "type", rr.qtype.toString() }, { "ttl", (double)rr.ttl }, { "disabled", rr.disabled }, { "content", makeApiRecordContent(rr.qtype, rr.content) } @@ -2232,7 +2232,7 @@ static void apiServerSearchData(HttpRequest* req, HttpResponse* resp) { auto object = Json::object { { "object_type", "comment" }, { "name", c.qname.toString() }, - { "type", c.qtype.getName() }, + { "type", c.qtype.toString() }, { "content", c.content } }; if ((val = zoneIdZone.find(c.domain_id)) != zoneIdZone.end()) { diff --git a/pdns/zone2json.cc b/pdns/zone2json.cc index b4aee1c6cd08..9da32bf5d54f 100644 --- a/pdns/zone2json.cc +++ b/pdns/zone2json.cc @@ -175,7 +175,7 @@ try obj["name"] = i->name.toString(); while(zpt.get(rr)) - recs.push_back(emitRecord(i->name.toString(), rr.qname, rr.qtype.getName(), rr.content, rr.ttl)); + recs.push_back(emitRecord(i->name.toString(), rr.qname, rr.qtype.toString(), rr.content, rr.ttl)); obj["records"] = recs; Json tmp = obj; cout<