}
nodlogger->v(10)->info(Logr::Debug, "Sending NOD lookup", "nodqname", Logging::Loggable(qname));
vector<DNSRecord> dummy;
- directResolve(qname, QType::A, QClass::IN, dummy, nullptr, false);
+ directResolve(qname, QType::A, QClass::IN, dummy, nullptr, false, nodlogger);
}
}
return rcode;
}
- rcode = directResolve(target, qtype, QClass::IN, resolved, t_pdl);
+ auto log = g_slog->withName("lua")->withValues("method", Logging::Loggable("followCNAMERecords"));
+ rcode = directResolve(target, qtype, QClass::IN, resolved, t_pdl, log);
if (g_dns64Prefix && qtype == QType::AAAA && answerIsNOData(qtype, rcode, resolved)) {
rcode = getFakeAAAARecords(target, *g_dns64Prefix, resolved);
int getFakeAAAARecords(const DNSName& qname, ComboAddress prefix, vector<DNSRecord>& ret)
{
+ auto log = g_slog->withName("dns64")->withValues("method", Logging::Loggable("getAAAA"));
/* we pass a separate vector of records because we will be resolving the initial qname
again, possibly encountering the same CNAME(s), and we don't want to trigger the CNAME
loop detection. */
vector<DNSRecord> newRecords;
- int rcode = directResolve(qname, QType::A, QClass::IN, newRecords, t_pdl);
+ int rcode = directResolve(qname, QType::A, QClass::IN, newRecords, t_pdl, log);
ret.reserve(ret.size() + newRecords.size());
for (auto& record : newRecords) {
rr.d_content = std::make_shared<CNAMERecordContent>(newquery);
ret.push_back(rr);
- int rcode = directResolve(DNSName(newquery), QType::PTR, QClass::IN, ret, t_pdl);
+ auto log = g_slog->withName("dns64")->withValues("method", Logging::Loggable("getPTR"));
+ int rcode = directResolve(DNSName(newquery), QType::PTR, QClass::IN, ret, t_pdl, log);
g_stats.dns64prefixanswers++;
return rcode;
}
// used by PowerDNSLua - note that this neglects to add the packet count & statistics back to pdns_recursor.cc
-int directResolve(const DNSName& qname, const QType qtype, const QClass qclass, vector<DNSRecord>& ret, shared_ptr<RecursorLua4> pdl)
+int directResolve(const DNSName& qname, const QType qtype, const QClass qclass, vector<DNSRecord>& ret, shared_ptr<RecursorLua4> pdl, Logr::log_t log)
{
- return directResolve(qname, qtype, qclass, ret, pdl, SyncRes::s_qnameminimization);
+ return directResolve(qname, qtype, qclass, ret, pdl, SyncRes::s_qnameminimization, log);
}
-int directResolve(const DNSName& qname, const QType qtype, const QClass qclass, vector<DNSRecord>& ret, shared_ptr<RecursorLua4> pdl, bool qm)
+int directResolve(const DNSName& qname, const QType qtype, const QClass qclass, vector<DNSRecord>& ret, shared_ptr<RecursorLua4> pdl, bool qm, Logr::log_t slog)
{
+ auto log = slog->withValues("qname", Logging::Loggable(qname), "qtype", Logging::Loggable(qtype));
+
struct timeval now;
gettimeofday(&now, 0);
}
int res = -1;
+ const std::string msg = "Failed to resolve";
try {
res = sr.beginResolve(qname, qtype, qclass, ret, 0);
}
catch(const PDNSException& e) {
- g_log<<Logger::Error<<"Failed to resolve "<<qname<<", got pdns exception: "<<e.reason<<endl;
+ SLOG(g_log<<Logger::Error<<"Failed to resolve "<<qname<<", got pdns exception: "<<e.reason<<endl,
+ log->error(Logr::Error, e.reason, msg, "exception", Logging::Loggable("PDNSException")));
ret.clear();
}
catch(const ImmediateServFailException& e) {
- g_log<<Logger::Error<<"Failed to resolve "<<qname<<", got ImmediateServFailException: "<<e.reason<<endl;
+ SLOG(g_log<<Logger::Error<<"Failed to resolve "<<qname<<", got ImmediateServFailException: "<<e.reason<<endl,
+ log->error(Logr::Error, e.reason, msg, "exception", Logging::Loggable("ImmediateServFailException")));
ret.clear();
}
catch(const PolicyHitException& e) {
- g_log<<Logger::Error<<"Failed to resolve "<<qname<<", got a policy hit"<<endl;
+ SLOG(g_log<<Logger::Error<<"Failed to resolve "<<qname<<", got a policy hit"<<endl,
+ log->error(Logr::Error, "Policy Hit", msg, "exception", Logging::Loggable("PolicyHitException")));
ret.clear();
}
catch(const std::exception& e) {
- g_log<<Logger::Error<<"Failed to resolve "<<qname<<", got STL error: "<<e.what()<<endl;
+ SLOG(g_log<<Logger::Error<<"Failed to resolve "<<qname<<", got STL error: "<<e.what()<<endl,
+ log->error(Logr::Error, e.what(), msg, "exception", Logging::Loggable("std::exception")));
ret.clear();
}
catch(...) {
- g_log<<Logger::Error<<"Failed to resolve "<<qname<<", got an exception"<<endl;
+ SLOG(g_log<<Logger::Error<<"Failed to resolve "<<qname<<", got an exception"<<endl,
+ log->error(Logr::Error, "Exception", msg));
ret.clear();
}
void broadcastFunction(const pipefunc_t& func);
void distributeAsyncFunction(const std::string& question, const pipefunc_t& func);
-int directResolve(const DNSName& qname, const QType qtype, const QClass qclass, vector<DNSRecord>& ret, shared_ptr<RecursorLua4> pdl);
-int directResolve(const DNSName& qname, const QType qtype, const QClass qclass, vector<DNSRecord>& ret, shared_ptr<RecursorLua4> pdl, bool qm);
+int directResolve(const DNSName& qname, const QType qtype, const QClass qclass, vector<DNSRecord>& ret, shared_ptr<RecursorLua4> pdl, Logr::log_t);
+int directResolve(const DNSName& qname, const QType qtype, const QClass qclass, vector<DNSRecord>& ret, shared_ptr<RecursorLua4> pdl, bool qm, Logr::log_t);
int followCNAMERecords(std::vector<DNSRecord>& ret, const QType qtype, int oldret);
int getFakeAAAARecords(const DNSName& qname, ComboAddress prefix, vector<DNSRecord>& ret);
int getFakePTRRecords(const DNSName& qname, vector<DNSRecord>& ret);