Lines 1-2429
Link Here
|
1 |
https://github.com/PowerDNS/pdns/commit/e6a9dde524b5 |
|
|
2 |
|
3 |
--- arguments.cc.orig 2018-03-29 13:04:45 UTC |
4 |
+++ arguments.cc |
5 |
@@ -443,7 +443,7 @@ bool ArgvMap::file(const char *fname, bool lax, bool i |
6 |
set("include-dir","Directory to include configuration files from"); |
7 |
|
8 |
if(!parseFile(fname, "", lax)) { |
9 |
- L << Logger::Warning << "Unable to open " << fname << std::endl; |
10 |
+ g_log << Logger::Warning << "Unable to open " << fname << std::endl; |
11 |
return false; |
12 |
} |
13 |
|
14 |
@@ -453,7 +453,7 @@ bool ArgvMap::file(const char *fname, bool lax, bool i |
15 |
gatherIncludes(extraConfigs); |
16 |
for(const std::string& fn : extraConfigs) { |
17 |
if (!file(fn.c_str(), lax, true)) { |
18 |
- L << Logger::Error << fn << " could not be parsed" << std::endl; |
19 |
+ g_log << Logger::Error << fn << " could not be parsed" << std::endl; |
20 |
throw ArgException(fn + " could not be parsed"); |
21 |
} |
22 |
} |
23 |
@@ -471,18 +471,18 @@ void ArgvMap::gatherIncludes(std::vector<std::string> |
24 |
|
25 |
// stat |
26 |
if (stat(params["include-dir"].c_str(), &st)) { |
27 |
- L << Logger::Error << params["include-dir"] << " does not exist!" << std::endl; |
28 |
+ g_log << Logger::Error << params["include-dir"] << " does not exist!" << std::endl; |
29 |
throw ArgException(params["include-dir"] + " does not exist!"); |
30 |
} |
31 |
|
32 |
// wonder if it's accessible directory |
33 |
if (!S_ISDIR(st.st_mode)) { |
34 |
- L << Logger::Error << params["include-dir"] << " is not a directory" << std::endl; |
35 |
+ g_log << Logger::Error << params["include-dir"] << " is not a directory" << std::endl; |
36 |
throw ArgException(params["include-dir"] + " is not a directory"); |
37 |
} |
38 |
|
39 |
if (!(dir = opendir(params["include-dir"].c_str()))) { |
40 |
- L << Logger::Error << params["include-dir"] << " is not accessible" << std::endl; |
41 |
+ g_log << Logger::Error << params["include-dir"] << " is not accessible" << std::endl; |
42 |
throw ArgException(params["include-dir"] + " is not accessible"); |
43 |
} |
44 |
|
45 |
@@ -494,7 +494,7 @@ void ArgvMap::gatherIncludes(std::vector<std::string> |
46 |
namebuf << params["include-dir"].c_str() << "/" << ent->d_name; // FIXME: Use some path separator |
47 |
// ensure it's readable file |
48 |
if (stat(namebuf.str().c_str(), &st) || !S_ISREG(st.st_mode)) { |
49 |
- L << Logger::Error << namebuf.str() << " is not a file" << std::endl; |
50 |
+ g_log << Logger::Error << namebuf.str() << " is not a file" << std::endl; |
51 |
closedir(dir); |
52 |
throw ArgException(namebuf.str() + " does not exist!"); |
53 |
} |
54 |
--- dns.hh.orig 2018-03-29 13:04:45 UTC |
55 |
+++ dns.hh |
56 |
@@ -225,7 +225,6 @@ inline uint16_t * getFlagsFromDNSHeader(struct dnshead |
57 |
#define FLAGS_CD_OFFSET (12) |
58 |
#endif |
59 |
|
60 |
-#define L theL() |
61 |
extern time_t s_starttime; |
62 |
|
63 |
uint32_t hashQuestion(const char* packet, uint16_t len, uint32_t init); |
64 |
--- gss_context.cc.orig 2018-03-29 13:04:45 UTC |
65 |
+++ gss_context.cc |
66 |
@@ -456,17 +456,17 @@ bool gss_add_signature(const DNSName& context, const s |
67 |
string tmp_mac; |
68 |
GssContext gssctx(context); |
69 |
if (!gssctx.valid()) { |
70 |
- L<<Logger::Error<<"GSS context '"<<context<<"' is not valid"<<endl; |
71 |
+ g_log<<Logger::Error<<"GSS context '"<<context<<"' is not valid"<<endl; |
72 |
for(const string& error : gssctx.getErrorStrings()) { |
73 |
- L<<Logger::Error<<"GSS error: "<<error<<endl;; |
74 |
+ g_log<<Logger::Error<<"GSS error: "<<error<<endl;; |
75 |
} |
76 |
return false; |
77 |
} |
78 |
|
79 |
if (!gssctx.sign(message, tmp_mac)) { |
80 |
- L<<Logger::Error<<"Could not sign message using GSS context '"<<context<<"'"<<endl; |
81 |
+ g_log<<Logger::Error<<"Could not sign message using GSS context '"<<context<<"'"<<endl; |
82 |
for(const string& error : gssctx.getErrorStrings()) { |
83 |
- L<<Logger::Error<<"GSS error: "<<error<<endl;; |
84 |
+ g_log<<Logger::Error<<"GSS error: "<<error<<endl;; |
85 |
} |
86 |
return false; |
87 |
} |
88 |
@@ -477,17 +477,17 @@ bool gss_add_signature(const DNSName& context, const s |
89 |
bool gss_verify_signature(const DNSName& context, const std::string& message, const std::string& mac) { |
90 |
GssContext gssctx(context); |
91 |
if (!gssctx.valid()) { |
92 |
- L<<Logger::Error<<"GSS context '"<<context<<"' is not valid"<<endl; |
93 |
+ g_log<<Logger::Error<<"GSS context '"<<context<<"' is not valid"<<endl; |
94 |
for(const string& error : gssctx.getErrorStrings()) { |
95 |
- L<<Logger::Error<<"GSS error: "<<error<<endl;; |
96 |
+ g_log<<Logger::Error<<"GSS error: "<<error<<endl;; |
97 |
} |
98 |
return false; |
99 |
} |
100 |
|
101 |
if (!gssctx.verify(message, mac)) { |
102 |
- L<<Logger::Error<<"Could not verify message using GSS context '"<<context<<"'"<<endl; |
103 |
+ g_log<<Logger::Error<<"Could not verify message using GSS context '"<<context<<"'"<<endl; |
104 |
for(const string& error : gssctx.getErrorStrings()) { |
105 |
- L<<Logger::Error<<"GSS error: "<<error<<endl;; |
106 |
+ g_log<<Logger::Error<<"GSS error: "<<error<<endl;; |
107 |
} |
108 |
return false; |
109 |
} |
110 |
--- logger.cc.orig 2018-03-29 13:04:45 UTC |
111 |
+++ logger.cc |
112 |
@@ -32,15 +32,9 @@ extern StatBag S; |
113 |
#include "namespaces.hh" |
114 |
|
115 |
pthread_once_t Logger::s_once; |
116 |
-pthread_key_t Logger::s_loggerKey; |
117 |
+pthread_key_t Logger::g_loggerKey; |
118 |
|
119 |
-Logger &theL(const string &pname) |
120 |
-{ |
121 |
- static Logger l("", LOG_DAEMON); |
122 |
- if(!pname.empty()) |
123 |
- l.setName(pname); |
124 |
- return l; |
125 |
-} |
126 |
+Logger g_log("", LOG_DAEMON); |
127 |
|
128 |
void Logger::log(const string &msg, Urgency u) |
129 |
{ |
130 |
@@ -104,7 +98,7 @@ void Logger::setName(const string &_name) |
131 |
|
132 |
void Logger::initKey() |
133 |
{ |
134 |
- if(pthread_key_create(&s_loggerKey, perThreadDestructor)) |
135 |
+ if(pthread_key_create(&g_loggerKey, perThreadDestructor)) |
136 |
unixDie("Creating thread key for logger"); |
137 |
} |
138 |
|
139 |
@@ -139,13 +133,13 @@ void Logger::perThreadDestructor(void* buf) |
140 |
|
141 |
Logger::PerThread* Logger::getPerThread() |
142 |
{ |
143 |
- void *buf=pthread_getspecific(s_loggerKey); |
144 |
+ void *buf=pthread_getspecific(g_loggerKey); |
145 |
PerThread* ret; |
146 |
if(buf) |
147 |
ret = (PerThread*) buf; |
148 |
else { |
149 |
ret = new PerThread(); |
150 |
- pthread_setspecific(s_loggerKey, (void*)ret); |
151 |
+ pthread_setspecific(g_loggerKey, (void*)ret); |
152 |
} |
153 |
return ret; |
154 |
} |
155 |
--- logger.hh.orig 2018-03-29 13:04:45 UTC |
156 |
+++ logger.hh |
157 |
@@ -70,9 +70,9 @@ class Logger (public) |
158 |
void resetFlags(){flags=0;open();} //!< zero the flags |
159 |
/** Use this to stream to your log, like this: |
160 |
\code |
161 |
- L<<"This is an informational message"<<endl; // logged at default loglevel (Info) |
162 |
- L<<Logger::Warning<<"Out of diskspace"<<endl; // Logged as a warning |
163 |
- L<<"This is an informational message"<<endl; // logged AGAIN at default loglevel (Info) |
164 |
+ g_log<<"This is an informational message"<<endl; // logged at default loglevel (Info) |
165 |
+ g_log<<Logger::Warning<<"Out of diskspace"<<endl; // Logged as a warning |
166 |
+ g_log<<"This is an informational message"<<endl; // logged AGAIN at default loglevel (Info) |
167 |
\endcode |
168 |
*/ |
169 |
Logger& operator<<(const char *s); |
170 |
@@ -113,10 +113,10 @@ class Logger (public) |
171 |
bool d_disableSyslog; |
172 |
bool d_timestamps{true}; |
173 |
static pthread_once_t s_once; |
174 |
- static pthread_key_t s_loggerKey; |
175 |
+ static pthread_key_t g_loggerKey; |
176 |
}; |
177 |
|
178 |
-extern Logger &theL(const string &pname=""); |
179 |
+extern Logger g_log; |
180 |
|
181 |
#ifdef VERBOSELOG |
182 |
#define DLOG(x) x |
183 |
--- lua-recursor4.cc.orig 2018-03-29 13:04:45 UTC |
184 |
+++ lua-recursor4.cc |
185 |
@@ -286,7 +286,7 @@ RecursorLua4::RecursorLua4(const std::string& fname) |
186 |
cas.insert(boost::get<ComboAddress>(in)); |
187 |
} |
188 |
} |
189 |
- catch(std::exception& e) { theL() <<Logger::Error<<e.what()<<endl; } |
190 |
+ catch(std::exception& e) { g_log <<Logger::Error<<e.what()<<endl; } |
191 |
}); |
192 |
|
193 |
d_lw->registerFunction<bool(cas_t::*)(const ComboAddress&)>("check",[](const cas_t& cas, const ComboAddress&ca) { |
194 |
@@ -451,7 +451,7 @@ RecursorLua4::RecursorLua4(const std::string& fname) |
195 |
} |
196 |
} |
197 |
catch(std::exception& e) { |
198 |
- theL() <<Logger::Error<<e.what()<<endl; |
199 |
+ g_log <<Logger::Error<<e.what()<<endl; |
200 |
} |
201 |
} |
202 |
); |
203 |
@@ -461,7 +461,7 @@ RecursorLua4::RecursorLua4(const std::string& fname) |
204 |
|
205 |
|
206 |
d_lw->writeFunction("pdnslog", [](const std::string& msg, boost::optional<int> loglevel) { |
207 |
- theL() << (Logger::Urgency)loglevel.get_value_or(Logger::Warning) << msg<<endl; |
208 |
+ g_log << (Logger::Urgency)loglevel.get_value_or(Logger::Warning) << msg<<endl; |
209 |
}); |
210 |
typedef vector<pair<string, int> > in_t; |
211 |
vector<pair<string, boost::variant<int, in_t, struct timeval* > > > pd{ |
212 |
@@ -719,7 +719,7 @@ loop:; |
213 |
dq.udpAnswer = GenUDPQueryResponse(dq.udpQueryDest, dq.udpQuery); |
214 |
auto cbFunc = d_lw->readVariable<boost::optional<luacall_t>>(dq.udpCallback).get_value_or(0); |
215 |
if(!cbFunc) { |
216 |
- theL()<<Logger::Error<<"Attempted callback for Lua UDP Query/Response which could not be found"<<endl; |
217 |
+ g_log<<Logger::Error<<"Attempted callback for Lua UDP Query/Response which could not be found"<<endl; |
218 |
return false; |
219 |
} |
220 |
bool result=cbFunc(&dq); |
221 |
--- lua-recursor4.hh.orig 2018-03-29 13:04:45 UTC |
222 |
+++ lua-recursor4.hh |
223 |
@@ -43,9 +43,7 @@ unsigned int getRecursorThreadId(); |
224 |
class LuaContext; |
225 |
|
226 |
#if defined(HAVE_LUA) |
227 |
-#undef L |
228 |
#include "ext/luawrapper/include/LuaContext.hpp" |
229 |
-#define L theL() |
230 |
#endif |
231 |
|
232 |
// pdns_ffi_param_t is a lightuserdata |
233 |
--- lwres.cc.orig 2018-03-29 13:04:45 UTC |
234 |
+++ lwres.cc |
235 |
@@ -236,7 +236,7 @@ int asyncresolve(const ComboAddress& ip, const DNSName |
236 |
|
237 |
if(domain != mdp.d_qname) { |
238 |
if(!mdp.d_qname.empty() && domain.toString().find((char)0) == string::npos /* ugly */) {// embedded nulls are too noisy, plus empty domains are too |
239 |
- L<<Logger::Notice<<"Packet purporting to come from remote server "<<ip.toString()<<" contained wrong answer: '" << domain << "' != '" << mdp.d_qname << "'" << endl; |
240 |
+ g_log<<Logger::Notice<<"Packet purporting to come from remote server "<<ip.toString()<<" contained wrong answer: '" << domain << "' != '" << mdp.d_qname << "'" << endl; |
241 |
} |
242 |
// unexpected count has already been done @ pdns_recursor.cc |
243 |
goto out; |
244 |
@@ -276,7 +276,7 @@ int asyncresolve(const ComboAddress& ip, const DNSName |
245 |
} |
246 |
catch(std::exception &mde) { |
247 |
if(::arg().mustDo("log-common-errors")) |
248 |
- L<<Logger::Notice<<"Unable to parse packet from remote server "<<ip.toString()<<": "<<mde.what()<<endl; |
249 |
+ g_log<<Logger::Notice<<"Unable to parse packet from remote server "<<ip.toString()<<": "<<mde.what()<<endl; |
250 |
lwr->d_rcode = RCode::FormErr; |
251 |
g_stats.serverParseError++; |
252 |
#ifdef HAVE_PROTOBUF |
253 |
@@ -287,7 +287,7 @@ int asyncresolve(const ComboAddress& ip, const DNSName |
254 |
return 1; // success - oddly enough |
255 |
} |
256 |
catch(...) { |
257 |
- L<<Logger::Notice<<"Unknown error parsing packet from remote server"<<endl; |
258 |
+ g_log<<Logger::Notice<<"Unknown error parsing packet from remote server"<<endl; |
259 |
} |
260 |
|
261 |
g_stats.serverParseError++; |
262 |
--- pdns_recursor.cc.orig 2018-03-29 13:04:45 UTC |
263 |
+++ pdns_recursor.cc |
264 |
@@ -367,12 +367,12 @@ static void setSocketBuffer(int fd, int optname, uint3 |
265 |
socklen_t len=sizeof(psize); |
266 |
|
267 |
if(!getsockopt(fd, SOL_SOCKET, optname, (char*)&psize, &len) && psize > size) { |
268 |
- L<<Logger::Error<<"Not decreasing socket buffer size from "<<psize<<" to "<<size<<endl; |
269 |
+ g_log<<Logger::Error<<"Not decreasing socket buffer size from "<<psize<<" to "<<size<<endl; |
270 |
return; |
271 |
} |
272 |
|
273 |
if (setsockopt(fd, SOL_SOCKET, optname, (char*)&size, sizeof(size)) < 0 ) |
274 |
- L<<Logger::Error<<"Unable to raise socket buffer size to "<<size<<": "<<strerror(errno)<<endl; |
275 |
+ g_log<<Logger::Error<<"Unable to raise socket buffer size to "<<size<<": "<<strerror(errno)<<endl; |
276 |
} |
277 |
|
278 |
|
279 |
@@ -415,7 +415,7 @@ class UDPClientSocks (public) |
280 |
closesocket(*fd); |
281 |
} |
282 |
catch(const PDNSException& e) { |
283 |
- L<<Logger::Error<<"Error closing UDP socket after connect() failed: "<<e.reason<<endl; |
284 |
+ g_log<<Logger::Error<<"Error closing UDP socket after connect() failed: "<<e.reason<<endl; |
285 |
} |
286 |
|
287 |
if(err==ENETUNREACH) // Seth "My Interfaces Are Like A Yo Yo" Arnold special |
288 |
@@ -453,7 +453,7 @@ class UDPClientSocks (public) |
289 |
closesocket(*i); |
290 |
} |
291 |
catch(const PDNSException& e) { |
292 |
- L<<Logger::Error<<"Error closing returned UDP socket: "<<e.reason<<endl; |
293 |
+ g_log<<Logger::Error<<"Error closing returned UDP socket: "<<e.reason<<endl; |
294 |
} |
295 |
|
296 |
d_socks.erase(i++); |
297 |
@@ -569,7 +569,7 @@ int arecvfrom(char *data, size_t len, int flags, const |
298 |
*d_len=packet.size(); |
299 |
memcpy(data,packet.c_str(),min(len,*d_len)); |
300 |
if(*nearMissLimit && pident.nearMisses > *nearMissLimit) { |
301 |
- L<<Logger::Error<<"Too many ("<<pident.nearMisses<<" > "<<*nearMissLimit<<") bogus answers for '"<<domain<<"' from "<<fromaddr.toString()<<", assuming spoof attempt."<<endl; |
302 |
+ g_log<<Logger::Error<<"Too many ("<<pident.nearMisses<<" > "<<*nearMissLimit<<") bogus answers for '"<<domain<<"' from "<<fromaddr.toString()<<", assuming spoof attempt."<<endl; |
303 |
g_stats.spoofCount++; |
304 |
return -1; |
305 |
} |
306 |
@@ -589,7 +589,7 @@ static void writePid(void) |
307 |
if(of) |
308 |
of<< Utility::getpid() <<endl; |
309 |
else |
310 |
- L<<Logger::Error<<"Writing pid for "<<Utility::getpid()<<" to "<<s_pidfname<<" failed: "<<strerror(errno)<<endl; |
311 |
+ g_log<<Logger::Error<<"Writing pid for "<<Utility::getpid()<<" to "<<s_pidfname<<" failed: "<<strerror(errno)<<endl; |
312 |
} |
313 |
|
314 |
TCPConnection::TCPConnection(int fd, const ComboAddress& addr) : d_remote(addr), d_fd(fd) |
315 |
@@ -602,10 +602,10 @@ TCPConnection::~TCPConnection() |
316 |
{ |
317 |
try { |
318 |
if(closesocket(d_fd) < 0) |
319 |
- L<<Logger::Error<<"Error closing socket for TCPConnection"<<endl; |
320 |
+ g_log<<Logger::Error<<"Error closing socket for TCPConnection"<<endl; |
321 |
} |
322 |
catch(const PDNSException& e) { |
323 |
- L<<Logger::Error<<"Error closing TCPConnection socket: "<<e.reason<<endl; |
324 |
+ g_log<<Logger::Error<<"Error closing TCPConnection socket: "<<e.reason<<endl; |
325 |
} |
326 |
|
327 |
if(t_tcpClientCounts->count(d_remote) && !(*t_tcpClientCounts)[d_remote]--) |
328 |
@@ -858,12 +858,12 @@ static void startDoResolve(void *p) |
329 |
|
330 |
|
331 |
if(!g_quiet || tracedQuery) { |
332 |
- L<<Logger::Warning<<t_id<<" ["<<MT->getTid()<<"/"<<MT->numProcesses()<<"] " << (dc->d_tcp ? "TCP " : "") << "question for '"<<dc->d_mdp.d_qname<<"|" |
333 |
+ g_log<<Logger::Warning<<t_id<<" ["<<MT->getTid()<<"/"<<MT->numProcesses()<<"] " << (dc->d_tcp ? "TCP " : "") << "question for '"<<dc->d_mdp.d_qname<<"|" |
334 |
<<DNSRecordContent::NumberToType(dc->d_mdp.d_qtype)<<"' from "<<dc->getRemote(); |
335 |
if(!dc->d_ednssubnet.source.empty()) { |
336 |
- L<<" (ecs "<<dc->d_ednssubnet.source.toString()<<")"; |
337 |
+ g_log<<" (ecs "<<dc->d_ednssubnet.source.toString()<<")"; |
338 |
} |
339 |
- L<<endl; |
340 |
+ g_log<<endl; |
341 |
} |
342 |
|
343 |
sr.setId(MT->getTid()); |
344 |
@@ -926,7 +926,7 @@ static void startDoResolve(void *p) |
345 |
} |
346 |
catch(ImmediateServFailException &e) { |
347 |
if(g_logCommonErrors) |
348 |
- L<<Logger::Notice<<"Sending SERVFAIL to "<<dc->getRemote()<<" during resolve of '"<<dc->d_mdp.d_qname<<"' because: "<<e.reason<<endl; |
349 |
+ g_log<<Logger::Notice<<"Sending SERVFAIL to "<<dc->getRemote()<<" during resolve of '"<<dc->d_mdp.d_qname<<"' because: "<<e.reason<<endl; |
350 |
res = RCode::ServFail; |
351 |
} |
352 |
|
353 |
@@ -1048,7 +1048,7 @@ static void startDoResolve(void *p) |
354 |
boost::split(lines, trace, boost::is_any_of("\n")); |
355 |
for(const string& line : lines) { |
356 |
if(!line.empty()) |
357 |
- L<<Logger::Warning<< line << endl; |
358 |
+ g_log<<Logger::Warning<< line << endl; |
359 |
} |
360 |
} |
361 |
} |
362 |
@@ -1065,14 +1065,14 @@ static void startDoResolve(void *p) |
363 |
if(!shouldNotValidate && sr.isDNSSECValidationRequested()) { |
364 |
try { |
365 |
if(sr.doLog()) { |
366 |
- L<<Logger::Warning<<"Starting validation of answer to "<<dc->d_mdp.d_qname<<"|"<<QType(dc->d_mdp.d_qtype).getName()<<" for "<<dc->d_remote.toStringWithPort()<<endl; |
367 |
+ g_log<<Logger::Warning<<"Starting validation of answer to "<<dc->d_mdp.d_qname<<"|"<<QType(dc->d_mdp.d_qtype).getName()<<" for "<<dc->d_remote.toStringWithPort()<<endl; |
368 |
} |
369 |
|
370 |
auto state = sr.getValidationState(); |
371 |
|
372 |
if(state == Secure) { |
373 |
if(sr.doLog()) { |
374 |
- L<<Logger::Warning<<"Answer to "<<dc->d_mdp.d_qname<<"|"<<QType(dc->d_mdp.d_qtype).getName()<<" for "<<dc->d_remote.toStringWithPort()<<" validates correctly"<<endl; |
375 |
+ g_log<<Logger::Warning<<"Answer to "<<dc->d_mdp.d_qname<<"|"<<QType(dc->d_mdp.d_qtype).getName()<<" for "<<dc->d_remote.toStringWithPort()<<" validates correctly"<<endl; |
376 |
} |
377 |
|
378 |
// Is the query source interested in the value of the ad-bit? |
379 |
@@ -1081,34 +1081,34 @@ static void startDoResolve(void *p) |
380 |
} |
381 |
else if(state == Insecure) { |
382 |
if(sr.doLog()) { |
383 |
- L<<Logger::Warning<<"Answer to "<<dc->d_mdp.d_qname<<"|"<<QType(dc->d_mdp.d_qtype).getName()<<" for "<<dc->d_remote.toStringWithPort()<<" validates as Insecure"<<endl; |
384 |
+ g_log<<Logger::Warning<<"Answer to "<<dc->d_mdp.d_qname<<"|"<<QType(dc->d_mdp.d_qtype).getName()<<" for "<<dc->d_remote.toStringWithPort()<<" validates as Insecure"<<endl; |
385 |
} |
386 |
|
387 |
pw.getHeader()->ad=0; |
388 |
} |
389 |
else if(state == Bogus) { |
390 |
if(g_dnssecLogBogus || sr.doLog() || g_dnssecmode == DNSSECMode::ValidateForLog) { |
391 |
- L<<Logger::Warning<<"Answer to "<<dc->d_mdp.d_qname<<"|"<<QType(dc->d_mdp.d_qtype).getName()<<" for "<<dc->d_remote.toStringWithPort()<<" validates as Bogus"<<endl; |
392 |
+ g_log<<Logger::Warning<<"Answer to "<<dc->d_mdp.d_qname<<"|"<<QType(dc->d_mdp.d_qtype).getName()<<" for "<<dc->d_remote.toStringWithPort()<<" validates as Bogus"<<endl; |
393 |
} |
394 |
|
395 |
// Does the query or validation mode sending out a SERVFAIL on validation errors? |
396 |
if(!pw.getHeader()->cd && (g_dnssecmode == DNSSECMode::ValidateAll || dc->d_mdp.d_header.ad || DNSSECOK)) { |
397 |
if(sr.doLog()) { |
398 |
- L<<Logger::Warning<<"Sending out SERVFAIL for "<<dc->d_mdp.d_qname<<"|"<<QType(dc->d_mdp.d_qtype).getName()<<" because recursor or query demands it for Bogus results"<<endl; |
399 |
+ g_log<<Logger::Warning<<"Sending out SERVFAIL for "<<dc->d_mdp.d_qname<<"|"<<QType(dc->d_mdp.d_qtype).getName()<<" because recursor or query demands it for Bogus results"<<endl; |
400 |
} |
401 |
|
402 |
pw.getHeader()->rcode=RCode::ServFail; |
403 |
goto sendit; |
404 |
} else { |
405 |
if(sr.doLog()) { |
406 |
- L<<Logger::Warning<<"Not sending out SERVFAIL for "<<dc->d_mdp.d_qname<<"|"<<QType(dc->d_mdp.d_qtype).getName()<<" Bogus validation since neither config nor query demands this"<<endl; |
407 |
+ g_log<<Logger::Warning<<"Not sending out SERVFAIL for "<<dc->d_mdp.d_qname<<"|"<<QType(dc->d_mdp.d_qtype).getName()<<" Bogus validation since neither config nor query demands this"<<endl; |
408 |
} |
409 |
} |
410 |
} |
411 |
} |
412 |
catch(ImmediateServFailException &e) { |
413 |
if(g_logCommonErrors) |
414 |
- L<<Logger::Notice<<"Sending SERVFAIL to "<<dc->getRemote()<<" during validation of '"<<dc->d_mdp.d_qname<<"|"<<QType(dc->d_mdp.d_qtype).getName()<<"' because: "<<e.reason<<endl; |
415 |
+ g_log<<Logger::Notice<<"Sending SERVFAIL to "<<dc->getRemote()<<" during validation of '"<<dc->d_mdp.d_qname<<"|"<<QType(dc->d_mdp.d_qtype).getName()<<"' because: "<<e.reason<<endl; |
416 |
pw.getHeader()->rcode=RCode::ServFail; |
417 |
goto sendit; |
418 |
} |
419 |
@@ -1195,7 +1195,7 @@ static void startDoResolve(void *p) |
420 |
addCMsgSrcAddr(&msgh, cbuf, &dc->d_local, 0); |
421 |
} |
422 |
if(sendmsg(dc->d_socket, &msgh, 0) < 0 && g_logCommonErrors) |
423 |
- L<<Logger::Warning<<"Sending UDP reply to client "<<dc->d_remote.toStringWithPort()<<" failed with: "<<strerror(errno)<<endl; |
424 |
+ g_log<<Logger::Warning<<"Sending UDP reply to client "<<dc->d_remote.toStringWithPort()<<" failed with: "<<strerror(errno)<<endl; |
425 |
|
426 |
if(!SyncRes::s_nopacketcache && !variableAnswer && !sr.wasVariable() ) { |
427 |
t_packetCache->insertResponsePacket(dc->d_tag, dc->d_qhash, dc->d_mdp.d_qname, dc->d_mdp.d_qtype, dc->d_mdp.d_qclass, |
428 |
@@ -1221,11 +1221,11 @@ static void startDoResolve(void *p) |
429 |
bool hadError=true; |
430 |
|
431 |
if(wret == 0) |
432 |
- L<<Logger::Error<<"EOF writing TCP answer to "<<dc->getRemote()<<endl; |
433 |
+ g_log<<Logger::Error<<"EOF writing TCP answer to "<<dc->getRemote()<<endl; |
434 |
else if(wret < 0 ) |
435 |
- L<<Logger::Error<<"Error writing TCP answer to "<<dc->getRemote()<<": "<< strerror(errno) <<endl; |
436 |
+ g_log<<Logger::Error<<"Error writing TCP answer to "<<dc->getRemote()<<": "<< strerror(errno) <<endl; |
437 |
else if((unsigned int)wret != 2 + packet.size()) |
438 |
- L<<Logger::Error<<"Oops, partial answer sent to "<<dc->getRemote()<<" for "<<dc->d_mdp.d_qname<<" (size="<< (2 + packet.size()) <<", sent "<<wret<<")"<<endl; |
439 |
+ g_log<<Logger::Error<<"Oops, partial answer sent to "<<dc->getRemote()<<" for "<<dc->d_mdp.d_qname<<" (size="<< (2 + packet.size()) <<", sent "<<wret<<")"<<endl; |
440 |
else |
441 |
hadError=false; |
442 |
|
443 |
@@ -1250,16 +1250,16 @@ static void startDoResolve(void *p) |
444 |
} |
445 |
float spent=makeFloat(sr.getNow()-dc->d_now); |
446 |
if(!g_quiet) { |
447 |
- L<<Logger::Error<<t_id<<" ["<<MT->getTid()<<"/"<<MT->numProcesses()<<"] answer to "<<(dc->d_mdp.d_header.rd?"":"non-rd ")<<"question '"<<dc->d_mdp.d_qname<<"|"<<DNSRecordContent::NumberToType(dc->d_mdp.d_qtype); |
448 |
- L<<"': "<<ntohs(pw.getHeader()->ancount)<<" answers, "<<ntohs(pw.getHeader()->arcount)<<" additional, took "<<sr.d_outqueries<<" packets, "<< |
449 |
+ g_log<<Logger::Error<<t_id<<" ["<<MT->getTid()<<"/"<<MT->numProcesses()<<"] answer to "<<(dc->d_mdp.d_header.rd?"":"non-rd ")<<"question '"<<dc->d_mdp.d_qname<<"|"<<DNSRecordContent::NumberToType(dc->d_mdp.d_qtype); |
450 |
+ g_log<<"': "<<ntohs(pw.getHeader()->ancount)<<" answers, "<<ntohs(pw.getHeader()->arcount)<<" additional, took "<<sr.d_outqueries<<" packets, "<< |
451 |
sr.d_totUsec/1000.0<<" netw ms, "<< spent*1000.0<<" tot ms, "<< |
452 |
sr.d_throttledqueries<<" throttled, "<<sr.d_timeouts<<" timeouts, "<<sr.d_tcpoutqueries<<" tcp connections, rcode="<< res; |
453 |
|
454 |
if(!shouldNotValidate && sr.isDNSSECValidationRequested()) { |
455 |
- L<< ", dnssec="<<vStates[sr.getValidationState()]; |
456 |
+ g_log<< ", dnssec="<<vStates[sr.getValidationState()]; |
457 |
} |
458 |
|
459 |
- L<<endl; |
460 |
+ g_log<<endl; |
461 |
|
462 |
} |
463 |
|
464 |
@@ -1307,28 +1307,28 @@ static void startDoResolve(void *p) |
465 |
dc=0; |
466 |
} |
467 |
catch(PDNSException &ae) { |
468 |
- L<<Logger::Error<<"startDoResolve problem "<<makeLoginfo(dc)<<": "<<ae.reason<<endl; |
469 |
+ g_log<<Logger::Error<<"startDoResolve problem "<<makeLoginfo(dc)<<": "<<ae.reason<<endl; |
470 |
delete dc; |
471 |
} |
472 |
catch(MOADNSException& e) { |
473 |
- L<<Logger::Error<<"DNS parser error "<<makeLoginfo(dc) <<": "<<dc->d_mdp.d_qname<<", "<<e.what()<<endl; |
474 |
+ g_log<<Logger::Error<<"DNS parser error "<<makeLoginfo(dc) <<": "<<dc->d_mdp.d_qname<<", "<<e.what()<<endl; |
475 |
delete dc; |
476 |
} |
477 |
catch(std::exception& e) { |
478 |
- L<<Logger::Error<<"STL error "<< makeLoginfo(dc)<<": "<<e.what(); |
479 |
+ g_log<<Logger::Error<<"STL error "<< makeLoginfo(dc)<<": "<<e.what(); |
480 |
|
481 |
// Luawrapper nests the exception from Lua, so we unnest it here |
482 |
try { |
483 |
std::rethrow_if_nested(e); |
484 |
} catch(const std::exception& ne) { |
485 |
- L<<". Extra info: "<<ne.what(); |
486 |
+ g_log<<". Extra info: "<<ne.what(); |
487 |
} catch(...) {} |
488 |
|
489 |
- L<<endl; |
490 |
+ g_log<<endl; |
491 |
delete dc; |
492 |
} |
493 |
catch(...) { |
494 |
- L<<Logger::Error<<"Any other exception in a resolver context "<< makeLoginfo(dc) <<endl; |
495 |
+ g_log<<Logger::Error<<"Any other exception in a resolver context "<< makeLoginfo(dc) <<endl; |
496 |
} |
497 |
|
498 |
g_stats.maxMThreadStackUsage = max(MT->getMaxStackUsage(), g_stats.maxMThreadStackUsage); |
499 |
@@ -1436,7 +1436,7 @@ static void handleRunningTCPQuestion(int fd, FDMultipl |
500 |
} |
501 |
if(!bytes || bytes < 0) { |
502 |
if(g_logCommonErrors) |
503 |
- L<<Logger::Error<<"TCP client "<< conn->d_remote.toString() <<" disconnected after first byte"<<endl; |
504 |
+ g_log<<Logger::Error<<"TCP client "<< conn->d_remote.toString() <<" disconnected after first byte"<<endl; |
505 |
t_fdm->removeReadFD(fd); |
506 |
return; |
507 |
} |
508 |
@@ -1444,7 +1444,7 @@ static void handleRunningTCPQuestion(int fd, FDMultipl |
509 |
else if(conn->state==TCPConnection::GETQUESTION) { |
510 |
ssize_t bytes=recv(conn->getFD(), conn->data + conn->bytesread, conn->qlen - conn->bytesread, 0); |
511 |
if(!bytes || bytes < 0 || bytes > std::numeric_limits<std::uint16_t>::max()) { |
512 |
- L<<Logger::Error<<"TCP client "<< conn->d_remote.toString() <<" disconnected while reading question body"<<endl; |
513 |
+ g_log<<Logger::Error<<"TCP client "<< conn->d_remote.toString() <<" disconnected while reading question body"<<endl; |
514 |
t_fdm->removeReadFD(fd); |
515 |
return; |
516 |
} |
517 |
@@ -1459,7 +1459,7 @@ static void handleRunningTCPQuestion(int fd, FDMultipl |
518 |
catch(MOADNSException &mde) { |
519 |
g_stats.clientParseError++; |
520 |
if(g_logCommonErrors) |
521 |
- L<<Logger::Error<<"Unable to parse packet from TCP client "<< conn->d_remote.toString() <<endl; |
522 |
+ g_log<<Logger::Error<<"Unable to parse packet from TCP client "<< conn->d_remote.toString() <<endl; |
523 |
return; |
524 |
} |
525 |
dc->d_tcpConnection = conn; // carry the torch |
526 |
@@ -1503,14 +1503,14 @@ static void handleRunningTCPQuestion(int fd, FDMultipl |
527 |
} |
528 |
catch(const std::exception& e) { |
529 |
if(g_logCommonErrors) |
530 |
- L<<Logger::Warning<<"Error parsing a query packet qname='"<<qname<<"' for tag determination, setting tag=0: "<<e.what()<<endl; |
531 |
+ g_log<<Logger::Warning<<"Error parsing a query packet qname='"<<qname<<"' for tag determination, setting tag=0: "<<e.what()<<endl; |
532 |
} |
533 |
} |
534 |
} |
535 |
catch(const std::exception& e) |
536 |
{ |
537 |
if(g_logCommonErrors) |
538 |
- L<<Logger::Warning<<"Error parsing a query packet for tag determination, setting tag=0: "<<e.what()<<endl; |
539 |
+ g_log<<Logger::Warning<<"Error parsing a query packet for tag determination, setting tag=0: "<<e.what()<<endl; |
540 |
} |
541 |
} |
542 |
#ifdef HAVE_PROTOBUF |
543 |
@@ -1530,20 +1530,20 @@ static void handleRunningTCPQuestion(int fd, FDMultipl |
544 |
} |
545 |
catch(std::exception& e) { |
546 |
if(g_logCommonErrors) |
547 |
- L<<Logger::Warning<<"Error parsing a TCP query packet for edns subnet: "<<e.what()<<endl; |
548 |
+ g_log<<Logger::Warning<<"Error parsing a TCP query packet for edns subnet: "<<e.what()<<endl; |
549 |
} |
550 |
} |
551 |
#endif |
552 |
if(dc->d_mdp.d_header.qr) { |
553 |
delete dc; |
554 |
g_stats.ignoredCount++; |
555 |
- L<<Logger::Error<<"Ignoring answer from TCP client "<< conn->d_remote.toString() <<" on server socket!"<<endl; |
556 |
+ g_log<<Logger::Error<<"Ignoring answer from TCP client "<< conn->d_remote.toString() <<" on server socket!"<<endl; |
557 |
return; |
558 |
} |
559 |
if(dc->d_mdp.d_header.opcode) { |
560 |
delete dc; |
561 |
g_stats.ignoredCount++; |
562 |
- L<<Logger::Error<<"Ignoring non-query opcode from TCP client "<< conn->d_remote.toString() <<" on server socket!"<<endl; |
563 |
+ g_log<<Logger::Error<<"Ignoring non-query opcode from TCP client "<< conn->d_remote.toString() <<" on server socket!"<<endl; |
564 |
return; |
565 |
} |
566 |
else { |
567 |
@@ -1569,7 +1569,7 @@ static void handleNewTCPQuestion(int fd, FDMultiplexer |
568 |
closesocket(newsock); |
569 |
} |
570 |
catch(const PDNSException& e) { |
571 |
- L<<Logger::Error<<"Error closing TCP socket after an over capacity drop: "<<e.reason<<endl; |
572 |
+ g_log<<Logger::Error<<"Error closing TCP socket after an over capacity drop: "<<e.reason<<endl; |
573 |
} |
574 |
return; |
575 |
} |
576 |
@@ -1578,14 +1578,14 @@ static void handleNewTCPQuestion(int fd, FDMultiplexer |
577 |
t_remotes->push_back(addr); |
578 |
if(t_allowFrom && !t_allowFrom->match(&addr)) { |
579 |
if(!g_quiet) |
580 |
- L<<Logger::Error<<"["<<MT->getTid()<<"] dropping TCP query from "<<addr.toString()<<", address not matched by allow-from"<<endl; |
581 |
+ g_log<<Logger::Error<<"["<<MT->getTid()<<"] dropping TCP query from "<<addr.toString()<<", address not matched by allow-from"<<endl; |
582 |
|
583 |
g_stats.unauthorizedTCP++; |
584 |
try { |
585 |
closesocket(newsock); |
586 |
} |
587 |
catch(const PDNSException& e) { |
588 |
- L<<Logger::Error<<"Error closing TCP socket after an ACL drop: "<<e.reason<<endl; |
589 |
+ g_log<<Logger::Error<<"Error closing TCP socket after an ACL drop: "<<e.reason<<endl; |
590 |
} |
591 |
return; |
592 |
} |
593 |
@@ -1595,7 +1595,7 @@ static void handleNewTCPQuestion(int fd, FDMultiplexer |
594 |
closesocket(newsock); // don't call TCPConnection::closeAndCleanup here - did not enter it in the counts yet! |
595 |
} |
596 |
catch(const PDNSException& e) { |
597 |
- L<<Logger::Error<<"Error closing TCP socket after an overflow drop: "<<e.reason<<endl; |
598 |
+ g_log<<Logger::Error<<"Error closing TCP socket after an overflow drop: "<<e.reason<<endl; |
599 |
} |
600 |
return; |
601 |
} |
602 |
@@ -1687,14 +1687,14 @@ static string* doProcessUDPQuestion(const std::string& |
603 |
} |
604 |
catch(const std::exception& e) { |
605 |
if(g_logCommonErrors) |
606 |
- L<<Logger::Warning<<"Error parsing a query packet qname='"<<qname<<"' for tag determination, setting tag=0: "<<e.what()<<endl; |
607 |
+ g_log<<Logger::Warning<<"Error parsing a query packet qname='"<<qname<<"' for tag determination, setting tag=0: "<<e.what()<<endl; |
608 |
} |
609 |
} |
610 |
} |
611 |
catch(const std::exception& e) |
612 |
{ |
613 |
if(g_logCommonErrors) |
614 |
- L<<Logger::Warning<<"Error parsing a query packet for tag determination, setting tag=0: "<<e.what()<<endl; |
615 |
+ g_log<<Logger::Warning<<"Error parsing a query packet for tag determination, setting tag=0: "<<e.what()<<endl; |
616 |
} |
617 |
} |
618 |
|
619 |
@@ -1732,7 +1732,7 @@ static string* doProcessUDPQuestion(const std::string& |
620 |
} |
621 |
#endif /* HAVE_PROTOBUF */ |
622 |
if(!g_quiet) |
623 |
- L<<Logger::Notice<<t_id<< " question answered from packet cache tag="<<ctag<<" from "<<fromaddr.toString()<<endl; |
624 |
+ g_log<<Logger::Notice<<t_id<< " question answered from packet cache tag="<<ctag<<" from "<<fromaddr.toString()<<endl; |
625 |
|
626 |
g_stats.packetCacheHits++; |
627 |
SyncRes::s_queries++; |
628 |
@@ -1747,7 +1747,7 @@ static string* doProcessUDPQuestion(const std::string& |
629 |
addCMsgSrcAddr(&msgh, cbuf, &destaddr, 0); |
630 |
} |
631 |
if(sendmsg(fd, &msgh, 0) < 0 && g_logCommonErrors) |
632 |
- L<<Logger::Warning<<"Sending UDP reply to client "<<fromaddr.toStringWithPort()<<" failed with: "<<strerror(errno)<<endl; |
633 |
+ g_log<<Logger::Warning<<"Sending UDP reply to client "<<fromaddr.toStringWithPort()<<" failed with: "<<strerror(errno)<<endl; |
634 |
|
635 |
if(response.length() >= sizeof(struct dnsheader)) { |
636 |
struct dnsheader tmpdh; |
637 |
@@ -1760,14 +1760,14 @@ static string* doProcessUDPQuestion(const std::string& |
638 |
} |
639 |
} |
640 |
catch(std::exception& e) { |
641 |
- L<<Logger::Error<<"Error processing or aging answer packet: "<<e.what()<<endl; |
642 |
+ g_log<<Logger::Error<<"Error processing or aging answer packet: "<<e.what()<<endl; |
643 |
return 0; |
644 |
} |
645 |
|
646 |
if(t_pdl) { |
647 |
if(t_pdl->ipfilter(fromaddr, destaddr, *dh)) { |
648 |
if(!g_quiet) |
649 |
- L<<Logger::Notice<<t_id<<" ["<<MT->getTid()<<"/"<<MT->numProcesses()<<"] DROPPED question from "<<fromaddr.toStringWithPort()<<" based on policy"<<endl; |
650 |
+ g_log<<Logger::Notice<<t_id<<" ["<<MT->getTid()<<"/"<<MT->numProcesses()<<"] DROPPED question from "<<fromaddr.toStringWithPort()<<" based on policy"<<endl; |
651 |
g_stats.policyDrops++; |
652 |
return 0; |
653 |
} |
654 |
@@ -1775,7 +1775,7 @@ static string* doProcessUDPQuestion(const std::string& |
655 |
|
656 |
if(MT->numProcesses() > g_maxMThreads) { |
657 |
if(!g_quiet) |
658 |
- L<<Logger::Notice<<t_id<<" ["<<MT->getTid()<<"/"<<MT->numProcesses()<<"] DROPPED question from "<<fromaddr.toStringWithPort()<<", over capacity"<<endl; |
659 |
+ g_log<<Logger::Notice<<t_id<<" ["<<MT->getTid()<<"/"<<MT->numProcesses()<<"] DROPPED question from "<<fromaddr.toStringWithPort()<<", over capacity"<<endl; |
660 |
|
661 |
g_stats.overCapacityDrops++; |
662 |
return 0; |
663 |
@@ -1832,7 +1832,7 @@ static void handleNewUDPQuestion(int fd, FDMultiplexer |
664 |
|
665 |
if(t_allowFrom && !t_allowFrom->match(&fromaddr)) { |
666 |
if(!g_quiet) |
667 |
- L<<Logger::Error<<"["<<MT->getTid()<<"] dropping UDP query from "<<fromaddr.toString()<<", address not matched by allow-from"<<endl; |
668 |
+ g_log<<Logger::Error<<"["<<MT->getTid()<<"] dropping UDP query from "<<fromaddr.toString()<<", address not matched by allow-from"<<endl; |
669 |
|
670 |
g_stats.unauthorizedUDP++; |
671 |
return; |
672 |
@@ -1840,7 +1840,7 @@ static void handleNewUDPQuestion(int fd, FDMultiplexer |
673 |
BOOST_STATIC_ASSERT(offsetof(sockaddr_in, sin_port) == offsetof(sockaddr_in6, sin6_port)); |
674 |
if(!fromaddr.sin4.sin_port) { // also works for IPv6 |
675 |
if(!g_quiet) |
676 |
- L<<Logger::Error<<"["<<MT->getTid()<<"] dropping UDP query from "<<fromaddr.toStringWithPort()<<", can't deal with port 0"<<endl; |
677 |
+ g_log<<Logger::Error<<"["<<MT->getTid()<<"] dropping UDP query from "<<fromaddr.toStringWithPort()<<", can't deal with port 0"<<endl; |
678 |
|
679 |
g_stats.clientParseError++; // not quite the best place to put it, but needs to go somewhere |
680 |
return; |
681 |
@@ -1851,12 +1851,12 @@ static void handleNewUDPQuestion(int fd, FDMultiplexer |
682 |
if(dh->qr) { |
683 |
g_stats.ignoredCount++; |
684 |
if(g_logCommonErrors) |
685 |
- L<<Logger::Error<<"Ignoring answer from "<<fromaddr.toString()<<" on server socket!"<<endl; |
686 |
+ g_log<<Logger::Error<<"Ignoring answer from "<<fromaddr.toString()<<" on server socket!"<<endl; |
687 |
} |
688 |
else if(dh->opcode) { |
689 |
g_stats.ignoredCount++; |
690 |
if(g_logCommonErrors) |
691 |
- L<<Logger::Error<<"Ignoring non-query opcode "<<dh->opcode<<" from "<<fromaddr.toString()<<" on server socket!"<<endl; |
692 |
+ g_log<<Logger::Error<<"Ignoring non-query opcode "<<dh->opcode<<" from "<<fromaddr.toString()<<" on server socket!"<<endl; |
693 |
} |
694 |
else { |
695 |
string question(data, (size_t)len); |
696 |
@@ -1889,12 +1889,12 @@ static void handleNewUDPQuestion(int fd, FDMultiplexer |
697 |
catch(MOADNSException& mde) { |
698 |
g_stats.clientParseError++; |
699 |
if(g_logCommonErrors) |
700 |
- L<<Logger::Error<<"Unable to parse packet from remote UDP client "<<fromaddr.toString() <<": "<<mde.what()<<endl; |
701 |
+ g_log<<Logger::Error<<"Unable to parse packet from remote UDP client "<<fromaddr.toString() <<": "<<mde.what()<<endl; |
702 |
} |
703 |
catch(std::runtime_error& e) { |
704 |
g_stats.clientParseError++; |
705 |
if(g_logCommonErrors) |
706 |
- L<<Logger::Error<<"Unable to parse packet from remote UDP client "<<fromaddr.toString() <<": "<<e.what()<<endl; |
707 |
+ g_log<<Logger::Error<<"Unable to parse packet from remote UDP client "<<fromaddr.toString() <<": "<<e.what()<<endl; |
708 |
} |
709 |
} |
710 |
else { |
711 |
@@ -1938,17 +1938,17 @@ static void makeTCPServerSockets(unsigned int threadId |
712 |
|
713 |
int tmp=1; |
714 |
if(setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, &tmp, sizeof tmp)<0) { |
715 |
- L<<Logger::Error<<"Setsockopt failed for TCP listening socket"<<endl; |
716 |
+ g_log<<Logger::Error<<"Setsockopt failed for TCP listening socket"<<endl; |
717 |
exit(1); |
718 |
} |
719 |
if(sin.sin6.sin6_family == AF_INET6 && setsockopt(fd, IPPROTO_IPV6, IPV6_V6ONLY, &tmp, sizeof(tmp)) < 0) { |
720 |
- L<<Logger::Error<<"Failed to set IPv6 socket to IPv6 only, continuing anyhow: "<<strerror(errno)<<endl; |
721 |
+ g_log<<Logger::Error<<"Failed to set IPv6 socket to IPv6 only, continuing anyhow: "<<strerror(errno)<<endl; |
722 |
} |
723 |
|
724 |
#ifdef TCP_DEFER_ACCEPT |
725 |
if(setsockopt(fd, SOL_TCP, TCP_DEFER_ACCEPT, &tmp, sizeof tmp) >= 0) { |
726 |
if(i==locals.begin()) |
727 |
- L<<Logger::Error<<"Enabled TCP data-ready filter for (slight) DoS protection"<<endl; |
728 |
+ g_log<<Logger::Error<<"Enabled TCP data-ready filter for (slight) DoS protection"<<endl; |
729 |
} |
730 |
#endif |
731 |
|
732 |
@@ -1966,10 +1966,10 @@ static void makeTCPServerSockets(unsigned int threadId |
733 |
#ifdef TCP_FASTOPEN |
734 |
int fastOpenQueueSize = ::arg().asNum("tcp-fast-open"); |
735 |
if (setsockopt(fd, IPPROTO_TCP, TCP_FASTOPEN, &fastOpenQueueSize, sizeof fastOpenQueueSize) < 0) { |
736 |
- L<<Logger::Error<<"Failed to enable TCP Fast Open for listening socket: "<<strerror(errno)<<endl; |
737 |
+ g_log<<Logger::Error<<"Failed to enable TCP Fast Open for listening socket: "<<strerror(errno)<<endl; |
738 |
} |
739 |
#else |
740 |
- L<<Logger::Warning<<"TCP Fast Open configured but not supported for listening socket"<<endl; |
741 |
+ g_log<<Logger::Warning<<"TCP Fast Open configured but not supported for listening socket"<<endl; |
742 |
#endif |
743 |
} |
744 |
|
745 |
@@ -1986,9 +1986,9 @@ static void makeTCPServerSockets(unsigned int threadId |
746 |
// we don't need to update g_listenSocketsAddresses since it doesn't work for TCP/IP: |
747 |
// - fd is not that which we know here, but returned from accept() |
748 |
if(sin.sin4.sin_family == AF_INET) |
749 |
- L<<Logger::Error<<"Listening for TCP queries on "<< sin.toString() <<":"<<st.port<<endl; |
750 |
+ g_log<<Logger::Error<<"Listening for TCP queries on "<< sin.toString() <<":"<<st.port<<endl; |
751 |
else |
752 |
- L<<Logger::Error<<"Listening for TCP queries on ["<< sin.toString() <<"]:"<<st.port<<endl; |
753 |
+ g_log<<Logger::Error<<"Listening for TCP queries on ["<< sin.toString() <<"]:"<<st.port<<endl; |
754 |
} |
755 |
} |
756 |
|
757 |
@@ -2021,7 +2021,7 @@ static void makeUDPServerSockets(unsigned int threadId |
758 |
throw PDNSException("Making a UDP server socket for resolver: "+netstringerror()); |
759 |
} |
760 |
if (!setSocketTimestamps(fd)) |
761 |
- L<<Logger::Warning<<"Unable to enable timestamp reporting for socket"<<endl; |
762 |
+ g_log<<Logger::Warning<<"Unable to enable timestamp reporting for socket"<<endl; |
763 |
|
764 |
if(IsAnyAddress(sin)) { |
765 |
if(sin.sin4.sin_family == AF_INET) |
766 |
@@ -2033,7 +2033,7 @@ static void makeUDPServerSockets(unsigned int threadId |
767 |
g_fromtosockets.insert(fd); |
768 |
#endif |
769 |
if(sin.sin6.sin6_family == AF_INET6 && setsockopt(fd, IPPROTO_IPV6, IPV6_V6ONLY, &one, sizeof(one)) < 0) { |
770 |
- L<<Logger::Error<<"Failed to set IPv6 socket to IPv6 only, continuing anyhow: "<<strerror(errno)<<endl; |
771 |
+ g_log<<Logger::Error<<"Failed to set IPv6 socket to IPv6 only, continuing anyhow: "<<strerror(errno)<<endl; |
772 |
} |
773 |
} |
774 |
if( ::arg().mustDo("non-local-bind") ) |
775 |
@@ -2060,9 +2060,9 @@ static void makeUDPServerSockets(unsigned int threadId |
776 |
deferredAdds[threadId].push_back(make_pair(fd, handleNewUDPQuestion)); |
777 |
g_listenSocketsAddresses[fd]=sin; // this is written to only from the startup thread, not from the workers |
778 |
if(sin.sin4.sin_family == AF_INET) |
779 |
- L<<Logger::Error<<"Listening for UDP queries on "<< sin.toString() <<":"<<st.port<<endl; |
780 |
+ g_log<<Logger::Error<<"Listening for UDP queries on "<< sin.toString() <<":"<<st.port<<endl; |
781 |
else |
782 |
- L<<Logger::Error<<"Listening for UDP queries on ["<< sin.toString() <<"]:"<<st.port<<endl; |
783 |
+ g_log<<Logger::Error<<"Listening for UDP queries on ["<< sin.toString() <<"]:"<<st.port<<endl; |
784 |
} |
785 |
} |
786 |
|
787 |
@@ -2075,7 +2075,7 @@ static void daemonize(void) |
788 |
|
789 |
int i=open("/dev/null",O_RDWR); /* open stdin */ |
790 |
if(i < 0) |
791 |
- L<<Logger::Critical<<"Unable to open /dev/null: "<<stringerror()<<endl; |
792 |
+ g_log<<Logger::Critical<<"Unable to open /dev/null: "<<stringerror()<<endl; |
793 |
else { |
794 |
dup2(i,0); /* stdin */ |
795 |
dup2(i,1); /* stderr */ |
796 |
@@ -2105,35 +2105,35 @@ static void doStats(void) |
797 |
uint64_t cacheMisses = broadcastAccFunction<uint64_t>(pleaseGetCacheMisses); |
798 |
|
799 |
if(g_stats.qcounter && (cacheHits + cacheMisses) && SyncRes::s_queries && SyncRes::s_outqueries) { |
800 |
- L<<Logger::Notice<<"stats: "<<g_stats.qcounter<<" questions, "<< |
801 |
+ g_log<<Logger::Notice<<"stats: "<<g_stats.qcounter<<" questions, "<< |
802 |
broadcastAccFunction<uint64_t>(pleaseGetCacheSize)<< " cache entries, "<< |
803 |
broadcastAccFunction<uint64_t>(pleaseGetNegCacheSize)<<" negative entries, "<< |
804 |
(int)((cacheHits*100.0)/(cacheHits+cacheMisses))<<"% cache hits"<<endl; |
805 |
|
806 |
- L<<Logger::Notice<<"stats: throttle map: " |
807 |
+ g_log<<Logger::Notice<<"stats: throttle map: " |
808 |
<< broadcastAccFunction<uint64_t>(pleaseGetThrottleSize) <<", ns speeds: " |
809 |
<< broadcastAccFunction<uint64_t>(pleaseGetNsSpeedsSize)<<endl; |
810 |
- L<<Logger::Notice<<"stats: outpacket/query ratio "<<(int)(SyncRes::s_outqueries*100.0/SyncRes::s_queries)<<"%"; |
811 |
- L<<Logger::Notice<<", "<<(int)(SyncRes::s_throttledqueries*100.0/(SyncRes::s_outqueries+SyncRes::s_throttledqueries))<<"% throttled, " |
812 |
+ g_log<<Logger::Notice<<"stats: outpacket/query ratio "<<(int)(SyncRes::s_outqueries*100.0/SyncRes::s_queries)<<"%"; |
813 |
+ g_log<<Logger::Notice<<", "<<(int)(SyncRes::s_throttledqueries*100.0/(SyncRes::s_outqueries+SyncRes::s_throttledqueries))<<"% throttled, " |
814 |
<<SyncRes::s_nodelegated<<" no-delegation drops"<<endl; |
815 |
- L<<Logger::Notice<<"stats: "<<SyncRes::s_tcpoutqueries<<" outgoing tcp connections, "<< |
816 |
+ g_log<<Logger::Notice<<"stats: "<<SyncRes::s_tcpoutqueries<<" outgoing tcp connections, "<< |
817 |
broadcastAccFunction<uint64_t>(pleaseGetConcurrentQueries)<<" queries running, "<<SyncRes::s_outgoingtimeouts<<" outgoing timeouts"<<endl; |
818 |
|
819 |
- //L<<Logger::Notice<<"stats: "<<g_stats.ednsPingMatches<<" ping matches, "<<g_stats.ednsPingMismatches<<" mismatches, "<< |
820 |
+ //g_log<<Logger::Notice<<"stats: "<<g_stats.ednsPingMatches<<" ping matches, "<<g_stats.ednsPingMismatches<<" mismatches, "<< |
821 |
//g_stats.noPingOutQueries<<" outqueries w/o ping, "<< g_stats.noEdnsOutQueries<<" w/o EDNS"<<endl; |
822 |
|
823 |
- L<<Logger::Notice<<"stats: " << broadcastAccFunction<uint64_t>(pleaseGetPacketCacheSize) << |
824 |
+ g_log<<Logger::Notice<<"stats: " << broadcastAccFunction<uint64_t>(pleaseGetPacketCacheSize) << |
825 |
" packet cache entries, "<<(int)(100.0*broadcastAccFunction<uint64_t>(pleaseGetPacketCacheHits)/SyncRes::s_queries) << "% packet cache hits"<<endl; |
826 |
|
827 |
time_t now = time(0); |
828 |
if(lastOutputTime && lastQueryCount && now != lastOutputTime) { |
829 |
- L<<Logger::Notice<<"stats: "<< (SyncRes::s_queries - lastQueryCount) / (now - lastOutputTime) <<" qps (average over "<< (now - lastOutputTime) << " seconds)"<<endl; |
830 |
+ g_log<<Logger::Notice<<"stats: "<< (SyncRes::s_queries - lastQueryCount) / (now - lastOutputTime) <<" qps (average over "<< (now - lastOutputTime) << " seconds)"<<endl; |
831 |
} |
832 |
lastOutputTime = now; |
833 |
lastQueryCount = SyncRes::s_queries; |
834 |
} |
835 |
else if(statsWanted) |
836 |
- L<<Logger::Notice<<"stats: no stats yet!"<<endl; |
837 |
+ g_log<<Logger::Notice<<"stats: no stats yet!"<<endl; |
838 |
|
839 |
statsWanted=false; |
840 |
} |
841 |
@@ -2184,19 +2184,19 @@ static void houseKeeping(void *) |
842 |
} |
843 |
catch(std::exception& e) |
844 |
{ |
845 |
- L<<Logger::Error<<"Exception while performing security poll: "<<e.what()<<endl; |
846 |
+ g_log<<Logger::Error<<"Exception while performing security poll: "<<e.what()<<endl; |
847 |
} |
848 |
catch(PDNSException& e) |
849 |
{ |
850 |
- L<<Logger::Error<<"Exception while performing security poll: "<<e.reason<<endl; |
851 |
+ g_log<<Logger::Error<<"Exception while performing security poll: "<<e.reason<<endl; |
852 |
} |
853 |
catch(ImmediateServFailException &e) |
854 |
{ |
855 |
- L<<Logger::Error<<"Exception while performing security poll: "<<e.reason<<endl; |
856 |
+ g_log<<Logger::Error<<"Exception while performing security poll: "<<e.reason<<endl; |
857 |
} |
858 |
catch(...) |
859 |
{ |
860 |
- L<<Logger::Error<<"Exception while performing security poll"<<endl; |
861 |
+ g_log<<Logger::Error<<"Exception while performing security poll"<<endl; |
862 |
} |
863 |
|
864 |
} |
865 |
@@ -2206,7 +2206,7 @@ static void houseKeeping(void *) |
866 |
catch(PDNSException& ae) |
867 |
{ |
868 |
s_running=false; |
869 |
- L<<Logger::Error<<"Fatal error in housekeeping thread: "<<ae.reason<<endl; |
870 |
+ g_log<<Logger::Error<<"Fatal error in housekeeping thread: "<<ae.reason<<endl; |
871 |
throw; |
872 |
} |
873 |
} |
874 |
@@ -2301,11 +2301,11 @@ static void handlePipeRequest(int fd, FDMultiplexer::f |
875 |
} |
876 |
catch(std::exception& e) { |
877 |
if(g_logCommonErrors) |
878 |
- L<<Logger::Error<<"PIPE function we executed created exception: "<<e.what()<<endl; // but what if they wanted an answer.. we send 0 |
879 |
+ g_log<<Logger::Error<<"PIPE function we executed created exception: "<<e.what()<<endl; // but what if they wanted an answer.. we send 0 |
880 |
} |
881 |
catch(PDNSException& e) { |
882 |
if(g_logCommonErrors) |
883 |
- L<<Logger::Error<<"PIPE function we executed created PDNS exception: "<<e.reason<<endl; // but what if they wanted an answer.. we send 0 |
884 |
+ g_log<<Logger::Error<<"PIPE function we executed created PDNS exception: "<<e.reason<<endl; // but what if they wanted an answer.. we send 0 |
885 |
} |
886 |
if(tmsg->wantAnswer) { |
887 |
if(write(g_pipes[t_id].writeFromThread, &resp, sizeof(resp)) != sizeof(resp)) { |
888 |
@@ -2406,10 +2406,10 @@ static void handleRCC(int fd, FDMultiplexer::funcparam |
889 |
command(); |
890 |
} |
891 |
catch(std::exception& e) { |
892 |
- L<<Logger::Error<<"Error dealing with control socket request: "<<e.what()<<endl; |
893 |
+ g_log<<Logger::Error<<"Error dealing with control socket request: "<<e.what()<<endl; |
894 |
} |
895 |
catch(PDNSException& ae) { |
896 |
- L<<Logger::Error<<"Error dealing with control socket request: "<<ae.reason<<endl; |
897 |
+ g_log<<Logger::Error<<"Error dealing with control socket request: "<<ae.reason<<endl; |
898 |
} |
899 |
} |
900 |
|
901 |
@@ -2496,7 +2496,7 @@ static void handleUDPServerResponse(int fd, FDMultiple |
902 |
else { |
903 |
g_stats.serverParseError++; |
904 |
if(g_logCommonErrors) |
905 |
- L<<Logger::Error<<"Unable to parse packet from remote UDP server "<< fromaddr.toString() << |
906 |
+ g_log<<Logger::Error<<"Unable to parse packet from remote UDP server "<< fromaddr.toString() << |
907 |
": packet smaller than DNS header"<<endl; |
908 |
} |
909 |
|
910 |
@@ -2520,7 +2520,7 @@ static void handleUDPServerResponse(int fd, FDMultiple |
911 |
pident.fd=fd; |
912 |
|
913 |
if(!dh.qr && g_logCommonErrors) { |
914 |
- L<<Logger::Notice<<"Not taking data from question on outgoing socket from "<< fromaddr.toStringWithPort() <<endl; |
915 |
+ g_log<<Logger::Notice<<"Not taking data from question on outgoing socket from "<< fromaddr.toStringWithPort() <<endl; |
916 |
} |
917 |
|
918 |
if(!dh.qdcount || // UPC, Nominum, very old BIND on FormErr, NSD |
919 |
@@ -2535,7 +2535,7 @@ static void handleUDPServerResponse(int fd, FDMultiple |
920 |
} |
921 |
catch(std::exception& e) { |
922 |
g_stats.serverParseError++; // won't be fed to lwres.cc, so we have to increment |
923 |
- L<<Logger::Warning<<"Error in packet from remote nameserver "<< fromaddr.toStringWithPort() << ": "<<e.what() << endl; |
924 |
+ g_log<<Logger::Warning<<"Error in packet from remote nameserver "<< fromaddr.toStringWithPort() << ": "<<e.what() << endl; |
925 |
return; |
926 |
} |
927 |
} |
928 |
@@ -2568,7 +2568,7 @@ retryWithName: |
929 |
} |
930 |
g_stats.unexpectedCount++; // if we made it here, it really is an unexpected answer |
931 |
if(g_logCommonErrors) { |
932 |
- L<<Logger::Warning<<"Discarding unexpected packet from "<<fromaddr.toStringWithPort()<<": "<< (pident.domain.empty() ? "<empty>" : pident.domain.toString())<<", "<<pident.type<<", "<<MT->d_waiters.size()<<" waiters"<<endl; |
933 |
+ g_log<<Logger::Warning<<"Discarding unexpected packet from "<<fromaddr.toStringWithPort()<<": "<< (pident.domain.empty() ? "<empty>" : pident.domain.toString())<<", "<<pident.type<<", "<<MT->d_waiters.size()<<" waiters"<<endl; |
934 |
} |
935 |
} |
936 |
else if(fd >= 0) { |
937 |
@@ -2585,13 +2585,13 @@ FDMultiplexer* getMultiplexer() |
938 |
return ret; |
939 |
} |
940 |
catch(FDMultiplexerException &fe) { |
941 |
- L<<Logger::Error<<"Non-fatal error initializing possible multiplexer ("<<fe.what()<<"), falling back"<<endl; |
942 |
+ g_log<<Logger::Error<<"Non-fatal error initializing possible multiplexer ("<<fe.what()<<"), falling back"<<endl; |
943 |
} |
944 |
catch(...) { |
945 |
- L<<Logger::Error<<"Non-fatal error initializing possible multiplexer"<<endl; |
946 |
+ g_log<<Logger::Error<<"Non-fatal error initializing possible multiplexer"<<endl; |
947 |
} |
948 |
} |
949 |
- L<<Logger::Error<<"No working multiplexer found!"<<endl; |
950 |
+ g_log<<Logger::Error<<"No working multiplexer found!"<<endl; |
951 |
exit(1); |
952 |
} |
953 |
|
954 |
@@ -2602,7 +2602,7 @@ static string* doReloadLuaScript() |
955 |
try { |
956 |
if(fname.empty()) { |
957 |
t_pdl.reset(); |
958 |
- L<<Logger::Error<<t_id<<" Unloaded current lua script"<<endl; |
959 |
+ g_log<<Logger::Error<<t_id<<" Unloaded current lua script"<<endl; |
960 |
return new string("unloaded\n"); |
961 |
} |
962 |
else { |
963 |
@@ -2610,11 +2610,11 @@ static string* doReloadLuaScript() |
964 |
} |
965 |
} |
966 |
catch(std::exception& e) { |
967 |
- L<<Logger::Error<<t_id<<" Retaining current script, error from '"<<fname<<"': "<< e.what() <<endl; |
968 |
+ g_log<<Logger::Error<<t_id<<" Retaining current script, error from '"<<fname<<"': "<< e.what() <<endl; |
969 |
return new string("retaining current script, error from '"+fname+"': "+e.what()+"\n"); |
970 |
} |
971 |
|
972 |
- L<<Logger::Warning<<t_id<<" (Re)loaded lua script from '"<<fname<<"'"<<endl; |
973 |
+ g_log<<Logger::Warning<<t_id<<" (Re)loaded lua script from '"<<fname<<"'"<<endl; |
974 |
return new string("(re)loaded '"+fname+"'\n"); |
975 |
} |
976 |
|
977 |
@@ -2655,7 +2655,7 @@ static void checkLinuxIPv6Limits() |
978 |
if(readFileIfThere("/proc/sys/net/ipv6/route/max_size", &line)) { |
979 |
int lim=std::stoi(line); |
980 |
if(lim < 16384) { |
981 |
- L<<Logger::Error<<"If using IPv6, please raise sysctl net.ipv6.route.max_size, currently set to "<<lim<<" which is < 16384"<<endl; |
982 |
+ g_log<<Logger::Error<<"If using IPv6, please raise sysctl net.ipv6.route.max_size, currently set to "<<lim<<" which is < 16384"<<endl; |
983 |
} |
984 |
} |
985 |
#endif |
986 |
@@ -2669,11 +2669,11 @@ static void checkOrFixFDS() |
987 |
unsigned int hardlimit= getFilenumLimit(true); |
988 |
if(hardlimit >= wantFDs) { |
989 |
setFilenumLimit(wantFDs); |
990 |
- L<<Logger::Warning<<"Raised soft limit on number of filedescriptors to "<<wantFDs<<" to match max-mthreads and threads settings"<<endl; |
991 |
+ g_log<<Logger::Warning<<"Raised soft limit on number of filedescriptors to "<<wantFDs<<" to match max-mthreads and threads settings"<<endl; |
992 |
} |
993 |
else { |
994 |
int newval = (hardlimit - 25) / g_numWorkerThreads; |
995 |
- L<<Logger::Warning<<"Insufficient number of filedescriptors available for max-mthreads*threads setting! ("<<hardlimit<<" < "<<wantFDs<<"), reducing max-mthreads to "<<newval<<endl; |
996 |
+ g_log<<Logger::Warning<<"Insufficient number of filedescriptors available for max-mthreads*threads setting! ("<<hardlimit<<" < "<<wantFDs<<"), reducing max-mthreads to "<<newval<<endl; |
997 |
g_maxMThreads = newval; |
998 |
setFilenumLimit(hardlimit); |
999 |
} |
1000 |
@@ -2744,24 +2744,24 @@ void parseACLs() |
1001 |
|
1002 |
allowFrom->addMask(line); |
1003 |
} |
1004 |
- L<<Logger::Warning<<"Done parsing " << allowFrom->size() <<" allow-from ranges from file '"<<::arg()["allow-from-file"]<<"' - overriding 'allow-from' setting"<<endl; |
1005 |
+ g_log<<Logger::Warning<<"Done parsing " << allowFrom->size() <<" allow-from ranges from file '"<<::arg()["allow-from-file"]<<"' - overriding 'allow-from' setting"<<endl; |
1006 |
} |
1007 |
else if(!::arg()["allow-from"].empty()) { |
1008 |
vector<string> ips; |
1009 |
stringtok(ips, ::arg()["allow-from"], ", "); |
1010 |
|
1011 |
- L<<Logger::Warning<<"Only allowing queries from: "; |
1012 |
+ g_log<<Logger::Warning<<"Only allowing queries from: "; |
1013 |
for(vector<string>::const_iterator i = ips.begin(); i!= ips.end(); ++i) { |
1014 |
allowFrom->addMask(*i); |
1015 |
if(i!=ips.begin()) |
1016 |
- L<<Logger::Warning<<", "; |
1017 |
- L<<Logger::Warning<<*i; |
1018 |
+ g_log<<Logger::Warning<<", "; |
1019 |
+ g_log<<Logger::Warning<<*i; |
1020 |
} |
1021 |
- L<<Logger::Warning<<endl; |
1022 |
+ g_log<<Logger::Warning<<endl; |
1023 |
} |
1024 |
else { |
1025 |
if(::arg()["local-address"]!="127.0.0.1" && ::arg().asNum("local-port")==53) |
1026 |
- L<<Logger::Error<<"WARNING: Allowing queries from all IP addresses - this can be a security risk!"<<endl; |
1027 |
+ g_log<<Logger::Error<<"WARNING: Allowing queries from all IP addresses - this can be a security risk!"<<endl; |
1028 |
allowFrom = nullptr; |
1029 |
} |
1030 |
|
1031 |
@@ -2789,7 +2789,7 @@ static std::map<unsigned int, std::set<int> > parseCPU |
1032 |
const std::string value = ::arg()["cpu-map"]; |
1033 |
|
1034 |
if (!value.empty() && !isSettingThreadCPUAffinitySupported()) { |
1035 |
- L<<Logger::Warning<<"CPU mapping requested but not supported, skipping"<<endl; |
1036 |
+ g_log<<Logger::Warning<<"CPU mapping requested but not supported, skipping"<<endl; |
1037 |
return result; |
1038 |
} |
1039 |
|
1040 |
@@ -2818,7 +2818,7 @@ static std::map<unsigned int, std::set<int> > parseCPU |
1041 |
} |
1042 |
} |
1043 |
catch(const std::exception& e) { |
1044 |
- L<<Logger::Error<<"Error parsing cpu-map entry '"<<part<<"': "<<e.what()<<endl; |
1045 |
+ g_log<<Logger::Error<<"Error parsing cpu-map entry '"<<part<<"': "<<e.what()<<endl; |
1046 |
} |
1047 |
} |
1048 |
|
1049 |
@@ -2831,34 +2831,34 @@ static void setCPUMap(const std::map<unsigned int, std |
1050 |
if (cpuMapping != cpusMap.cend()) { |
1051 |
int rc = mapThreadToCPUList(tid, cpuMapping->second); |
1052 |
if (rc == 0) { |
1053 |
- L<<Logger::Info<<"CPU affinity for worker "<<n<<" has been set to CPU map:"; |
1054 |
+ g_log<<Logger::Info<<"CPU affinity for worker "<<n<<" has been set to CPU map:"; |
1055 |
for (const auto cpu : cpuMapping->second) { |
1056 |
- L<<Logger::Info<<" "<<cpu; |
1057 |
+ g_log<<Logger::Info<<" "<<cpu; |
1058 |
} |
1059 |
- L<<Logger::Info<<endl; |
1060 |
+ g_log<<Logger::Info<<endl; |
1061 |
} |
1062 |
else { |
1063 |
- L<<Logger::Warning<<"Error setting CPU affinity for worker "<<n<<" to CPU map:"; |
1064 |
+ g_log<<Logger::Warning<<"Error setting CPU affinity for worker "<<n<<" to CPU map:"; |
1065 |
for (const auto cpu : cpuMapping->second) { |
1066 |
- L<<Logger::Info<<" "<<cpu; |
1067 |
+ g_log<<Logger::Info<<" "<<cpu; |
1068 |
} |
1069 |
- L<<Logger::Info<<strerror(rc)<<endl; |
1070 |
+ g_log<<Logger::Info<<strerror(rc)<<endl; |
1071 |
} |
1072 |
} |
1073 |
} |
1074 |
|
1075 |
static int serviceMain(int argc, char*argv[]) |
1076 |
{ |
1077 |
- L.setName(s_programname); |
1078 |
- L.disableSyslog(::arg().mustDo("disable-syslog")); |
1079 |
- L.setTimestamps(::arg().mustDo("log-timestamp")); |
1080 |
+ g_log.setName(s_programname); |
1081 |
+ g_log.disableSyslog(::arg().mustDo("disable-syslog")); |
1082 |
+ g_log.setTimestamps(::arg().mustDo("log-timestamp")); |
1083 |
|
1084 |
if(!::arg()["logging-facility"].empty()) { |
1085 |
int val=logFacilityToLOG(::arg().asNum("logging-facility") ); |
1086 |
if(val >= 0) |
1087 |
- theL().setFacility(val); |
1088 |
+ g_log.setFacility(val); |
1089 |
else |
1090 |
- L<<Logger::Error<<"Unknown logging facility "<<::arg().asNum("logging-facility") <<endl; |
1091 |
+ g_log<<Logger::Error<<"Unknown logging facility "<<::arg().asNum("logging-facility") <<endl; |
1092 |
} |
1093 |
|
1094 |
showProductVersion(); |
1095 |
@@ -2871,7 +2871,7 @@ static int serviceMain(int argc, char*argv[]) |
1096 |
vector<string> addrs; |
1097 |
if(!::arg()["query-local-address6"].empty()) { |
1098 |
SyncRes::s_doIPv6=true; |
1099 |
- L<<Logger::Warning<<"Enabling IPv6 transport for outgoing queries"<<endl; |
1100 |
+ g_log<<Logger::Warning<<"Enabling IPv6 transport for outgoing queries"<<endl; |
1101 |
|
1102 |
stringtok(addrs, ::arg()["query-local-address6"], ", ;"); |
1103 |
for(const string& addr : addrs) { |
1104 |
@@ -2879,7 +2879,7 @@ static int serviceMain(int argc, char*argv[]) |
1105 |
} |
1106 |
} |
1107 |
else { |
1108 |
- L<<Logger::Warning<<"NOT using IPv6 for outgoing queries - set 'query-local-address6=::' to enable"<<endl; |
1109 |
+ g_log<<Logger::Warning<<"NOT using IPv6 for outgoing queries - set 'query-local-address6=::' to enable"<<endl; |
1110 |
} |
1111 |
addrs.clear(); |
1112 |
stringtok(addrs, ::arg()["query-local-address"], ", ;"); |
1113 |
@@ -2888,7 +2888,7 @@ static int serviceMain(int argc, char*argv[]) |
1114 |
} |
1115 |
} |
1116 |
catch(std::exception& e) { |
1117 |
- L<<Logger::Error<<"Assigning local query addresses: "<<e.what(); |
1118 |
+ g_log<<Logger::Error<<"Assigning local query addresses: "<<e.what(); |
1119 |
exit(99); |
1120 |
} |
1121 |
|
1122 |
@@ -2904,7 +2904,7 @@ static int serviceMain(int argc, char*argv[]) |
1123 |
else if(::arg()["dnssec"]=="log-fail") |
1124 |
g_dnssecmode=DNSSECMode::ValidateForLog; |
1125 |
else { |
1126 |
- L<<Logger::Error<<"Unknown DNSSEC mode "<<::arg()["dnssec"]<<endl; |
1127 |
+ g_log<<Logger::Error<<"Unknown DNSSEC mode "<<::arg()["dnssec"]<<endl; |
1128 |
exit(1); |
1129 |
} |
1130 |
|
1131 |
@@ -2918,7 +2918,7 @@ static int serviceMain(int argc, char*argv[]) |
1132 |
loadRecursorLuaConfig(::arg()["lua-config-file"], ::arg().mustDo("daemon")); |
1133 |
} |
1134 |
catch (PDNSException &e) { |
1135 |
- L<<Logger::Error<<"Cannot load Lua configuration: "<<e.reason<<endl; |
1136 |
+ g_log<<Logger::Error<<"Cannot load Lua configuration: "<<e.reason<<endl; |
1137 |
exit(1); |
1138 |
} |
1139 |
|
1140 |
@@ -2931,21 +2931,21 @@ static int serviceMain(int argc, char*argv[]) |
1141 |
ips.push_back("0.0.0.0"); |
1142 |
ips.push_back("::"); |
1143 |
|
1144 |
- L<<Logger::Warning<<"Will not send queries to: "; |
1145 |
+ g_log<<Logger::Warning<<"Will not send queries to: "; |
1146 |
for(vector<string>::const_iterator i = ips.begin(); i!= ips.end(); ++i) { |
1147 |
SyncRes::addDontQuery(*i); |
1148 |
if(i!=ips.begin()) |
1149 |
- L<<Logger::Warning<<", "; |
1150 |
- L<<Logger::Warning<<*i; |
1151 |
+ g_log<<Logger::Warning<<", "; |
1152 |
+ g_log<<Logger::Warning<<*i; |
1153 |
} |
1154 |
- L<<Logger::Warning<<endl; |
1155 |
+ g_log<<Logger::Warning<<endl; |
1156 |
} |
1157 |
|
1158 |
g_quiet=::arg().mustDo("quiet"); |
1159 |
|
1160 |
g_weDistributeQueries = ::arg().mustDo("pdns-distributes-queries"); |
1161 |
if(g_weDistributeQueries) { |
1162 |
- L<<Logger::Warning<<"PowerDNS Recursor itself will distribute queries over threads"<<endl; |
1163 |
+ g_log<<Logger::Warning<<"PowerDNS Recursor itself will distribute queries over threads"<<endl; |
1164 |
} |
1165 |
|
1166 |
setupDelegationOnly(); |
1167 |
@@ -3030,7 +3030,7 @@ static int serviceMain(int argc, char*argv[]) |
1168 |
|
1169 |
g_numWorkerThreads = ::arg().asNum("threads"); |
1170 |
if (g_numWorkerThreads < 1) { |
1171 |
- L<<Logger::Warning<<"Asked to run with 0 threads, raising to 1 instead"<<endl; |
1172 |
+ g_log<<Logger::Warning<<"Asked to run with 0 threads, raising to 1 instead"<<endl; |
1173 |
g_numWorkerThreads = 1; |
1174 |
} |
1175 |
|
1176 |
@@ -3068,8 +3068,8 @@ static int serviceMain(int argc, char*argv[]) |
1177 |
} |
1178 |
|
1179 |
if(::arg().mustDo("daemon")) { |
1180 |
- L<<Logger::Warning<<"Calling daemonize, going to background"<<endl; |
1181 |
- L.toConsole(Logger::Critical); |
1182 |
+ g_log<<Logger::Warning<<"Calling daemonize, going to background"<<endl; |
1183 |
+ g_log.toConsole(Logger::Critical); |
1184 |
daemonize(); |
1185 |
loadRecursorLuaConfig(::arg()["lua-config-file"], false); |
1186 |
} |
1187 |
@@ -3081,7 +3081,7 @@ static int serviceMain(int argc, char*argv[]) |
1188 |
|
1189 |
#ifdef HAVE_LIBSODIUM |
1190 |
if (sodium_init() == -1) { |
1191 |
- L<<Logger::Error<<"Unable to initialize sodium crypto library"<<endl; |
1192 |
+ g_log<<Logger::Error<<"Unable to initialize sodium crypto library"<<endl; |
1193 |
exit(99); |
1194 |
} |
1195 |
#endif |
1196 |
@@ -3103,16 +3103,16 @@ static int serviceMain(int argc, char*argv[]) |
1197 |
char *ns; |
1198 |
ns = getenv("NOTIFY_SOCKET"); |
1199 |
if (ns != nullptr) { |
1200 |
- L<<Logger::Error<<"Unable to chroot when running from systemd. Please disable chroot= or set the 'Type' for this service to 'simple'"<<endl; |
1201 |
+ g_log<<Logger::Error<<"Unable to chroot when running from systemd. Please disable chroot= or set the 'Type' for this service to 'simple'"<<endl; |
1202 |
exit(1); |
1203 |
} |
1204 |
#endif |
1205 |
if (chroot(::arg()["chroot"].c_str())<0 || chdir("/") < 0) { |
1206 |
- L<<Logger::Error<<"Unable to chroot to '"+::arg()["chroot"]+"': "<<strerror (errno)<<", exiting"<<endl; |
1207 |
+ g_log<<Logger::Error<<"Unable to chroot to '"+::arg()["chroot"]+"': "<<strerror (errno)<<", exiting"<<endl; |
1208 |
exit(1); |
1209 |
} |
1210 |
else |
1211 |
- L<<Logger::Error<<"Chrooted to '"<<::arg()["chroot"]<<"'"<<endl; |
1212 |
+ g_log<<Logger::Error<<"Chrooted to '"<<::arg()["chroot"]<<"'"<<endl; |
1213 |
} |
1214 |
|
1215 |
s_pidfname=::arg()["socket-dir"]+"/"+s_programname+".pid"; |
1216 |
@@ -3137,7 +3137,7 @@ static int serviceMain(int argc, char*argv[]) |
1217 |
|
1218 |
const auto cpusMap = parseCPUMap(); |
1219 |
if(g_numThreads == 1) { |
1220 |
- L<<Logger::Warning<<"Operating unthreaded"<<endl; |
1221 |
+ g_log<<Logger::Warning<<"Operating unthreaded"<<endl; |
1222 |
#ifdef HAVE_SYSTEMD |
1223 |
sd_notify(0, "READY=1"); |
1224 |
#endif |
1225 |
@@ -3146,7 +3146,7 @@ static int serviceMain(int argc, char*argv[]) |
1226 |
} |
1227 |
else { |
1228 |
pthread_t tid; |
1229 |
- L<<Logger::Warning<<"Launching "<< g_numThreads <<" threads"<<endl; |
1230 |
+ g_log<<Logger::Warning<<"Launching "<< g_numThreads <<" threads"<<endl; |
1231 |
for(unsigned int n=0; n < g_numThreads; ++n) { |
1232 |
pthread_create(&tid, 0, recursorThread, (void*)(long)n); |
1233 |
|
1234 |
@@ -3177,16 +3177,16 @@ try |
1235 |
#ifdef HAVE_PROTOBUF |
1236 |
t_uuidGenerator = std::unique_ptr<boost::uuids::random_generator>(new boost::uuids::random_generator()); |
1237 |
#endif |
1238 |
- L<<Logger::Warning<<"Done priming cache with root hints"<<endl; |
1239 |
+ g_log<<Logger::Warning<<"Done priming cache with root hints"<<endl; |
1240 |
|
1241 |
try { |
1242 |
if(!::arg()["lua-dns-script"].empty()) { |
1243 |
t_pdl = std::make_shared<RecursorLua4>(::arg()["lua-dns-script"]); |
1244 |
- L<<Logger::Warning<<"Loaded 'lua' script from '"<<::arg()["lua-dns-script"]<<"'"<<endl; |
1245 |
+ g_log<<Logger::Warning<<"Loaded 'lua' script from '"<<::arg()["lua-dns-script"]<<"'"<<endl; |
1246 |
} |
1247 |
} |
1248 |
catch(std::exception &e) { |
1249 |
- L<<Logger::Error<<"Failed to load 'lua' script from '"<<::arg()["lua-dns-script"]<<"': "<<e.what()<<endl; |
1250 |
+ g_log<<Logger::Error<<"Failed to load 'lua' script from '"<<::arg()["lua-dns-script"]<<"': "<<e.what()<<endl; |
1251 |
_exit(99); |
1252 |
} |
1253 |
|
1254 |
@@ -3215,16 +3215,16 @@ try |
1255 |
t_fdm=getMultiplexer(); |
1256 |
if(!t_id) { |
1257 |
if(::arg().mustDo("webserver")) { |
1258 |
- L<<Logger::Warning << "Enabling web server" << endl; |
1259 |
+ g_log<<Logger::Warning << "Enabling web server" << endl; |
1260 |
try { |
1261 |
new RecursorWebServer(t_fdm); |
1262 |
} |
1263 |
catch(PDNSException &e) { |
1264 |
- L<<Logger::Error<<"Exception: "<<e.reason<<endl; |
1265 |
+ g_log<<Logger::Error<<"Exception: "<<e.reason<<endl; |
1266 |
exit(99); |
1267 |
} |
1268 |
} |
1269 |
- L<<Logger::Error<<"Enabled '"<< t_fdm->getName() << "' multiplexer"<<endl; |
1270 |
+ g_log<<Logger::Error<<"Enabled '"<< t_fdm->getName() << "' multiplexer"<<endl; |
1271 |
} |
1272 |
|
1273 |
t_fdm->addReadFD(g_pipes[t_id].readToThread, handlePipeRequest); |
1274 |
@@ -3268,7 +3268,7 @@ try |
1275 |
for(expired_t::iterator i=expired.begin() ; i != expired.end(); ++i) { |
1276 |
shared_ptr<TCPConnection> conn=any_cast<shared_ptr<TCPConnection> >(i->second); |
1277 |
if(g_logCommonErrors) |
1278 |
- L<<Logger::Warning<<"Timeout from remote TCP client "<< conn->d_remote.toString() <<endl; |
1279 |
+ g_log<<Logger::Warning<<"Timeout from remote TCP client "<< conn->d_remote.toString() <<endl; |
1280 |
t_fdm->removeReadFD(i->first); |
1281 |
} |
1282 |
} |
1283 |
@@ -3308,15 +3308,15 @@ try |
1284 |
} |
1285 |
} |
1286 |
catch(PDNSException &ae) { |
1287 |
- L<<Logger::Error<<"Exception: "<<ae.reason<<endl; |
1288 |
+ g_log<<Logger::Error<<"Exception: "<<ae.reason<<endl; |
1289 |
return 0; |
1290 |
} |
1291 |
catch(std::exception &e) { |
1292 |
- L<<Logger::Error<<"STL Exception: "<<e.what()<<endl; |
1293 |
+ g_log<<Logger::Error<<"STL Exception: "<<e.what()<<endl; |
1294 |
return 0; |
1295 |
} |
1296 |
catch(...) { |
1297 |
- L<<Logger::Error<<"any other exception in main: "<<endl; |
1298 |
+ g_log<<Logger::Error<<"any other exception in main: "<<endl; |
1299 |
return 0; |
1300 |
} |
1301 |
|
1302 |
@@ -3450,7 +3450,7 @@ int main(int argc, char **argv) |
1303 |
::arg().setCmd("help","Provide a helpful message"); |
1304 |
::arg().setCmd("version","Print version string"); |
1305 |
::arg().setCmd("config","Output blank configuration"); |
1306 |
- L.toConsole(Logger::Info); |
1307 |
+ g_log.toConsole(Logger::Info); |
1308 |
::arg().laxParse(argc,argv); // do a lax parse |
1309 |
|
1310 |
string configname=::arg()["config-dir"]+"/recursor.conf"; |
1311 |
@@ -3466,12 +3466,12 @@ int main(int argc, char **argv) |
1312 |
} |
1313 |
|
1314 |
if(!::arg().file(configname.c_str())) |
1315 |
- L<<Logger::Warning<<"Unable to parse configuration file '"<<configname<<"'"<<endl; |
1316 |
+ g_log<<Logger::Warning<<"Unable to parse configuration file '"<<configname<<"'"<<endl; |
1317 |
|
1318 |
::arg().parse(argc,argv); |
1319 |
|
1320 |
if( !::arg()["chroot"].empty() && !::arg()["api-config-dir"].empty() && !::arg().mustDo("api-readonly") ) { |
1321 |
- L<<Logger::Error<<"Using chroot and a writable API is not possible"<<endl; |
1322 |
+ g_log<<Logger::Error<<"Using chroot and a writable API is not possible"<<endl; |
1323 |
exit(EXIT_FAILURE); |
1324 |
} |
1325 |
|
1326 |
@@ -3505,21 +3505,21 @@ int main(int argc, char **argv) |
1327 |
if(!g_quiet && logUrgency < Logger::Info) { // Logger::Info=6, Logger::Debug=7 |
1328 |
logUrgency = Logger::Info; // if you do --quiet=no, you need Info to also see the query log |
1329 |
} |
1330 |
- L.setLoglevel(logUrgency); |
1331 |
- L.toConsole(logUrgency); |
1332 |
+ g_log.setLoglevel(logUrgency); |
1333 |
+ g_log.toConsole(logUrgency); |
1334 |
|
1335 |
serviceMain(argc, argv); |
1336 |
} |
1337 |
catch(PDNSException &ae) { |
1338 |
- L<<Logger::Error<<"Exception: "<<ae.reason<<endl; |
1339 |
+ g_log<<Logger::Error<<"Exception: "<<ae.reason<<endl; |
1340 |
ret=EXIT_FAILURE; |
1341 |
} |
1342 |
catch(std::exception &e) { |
1343 |
- L<<Logger::Error<<"STL Exception: "<<e.what()<<endl; |
1344 |
+ g_log<<Logger::Error<<"STL Exception: "<<e.what()<<endl; |
1345 |
ret=EXIT_FAILURE; |
1346 |
} |
1347 |
catch(...) { |
1348 |
- L<<Logger::Error<<"any other exception in main: "<<endl; |
1349 |
+ g_log<<Logger::Error<<"any other exception in main: "<<endl; |
1350 |
ret=EXIT_FAILURE; |
1351 |
} |
1352 |
|
1353 |
--- randomhelper.cc.orig 2018-03-29 13:04:45 UTC |
1354 |
+++ randomhelper.cc |
1355 |
@@ -11,11 +11,11 @@ |
1356 |
|
1357 |
void seedRandom(const string& source) |
1358 |
{ |
1359 |
- L<<Logger::Warning<<"Reading random entropy from '"<<source<<"'"<<endl; |
1360 |
+ g_log<<Logger::Warning<<"Reading random entropy from '"<<source<<"'"<<endl; |
1361 |
|
1362 |
int fd=open(source.c_str(), O_RDONLY); |
1363 |
if(fd < 0) { |
1364 |
- L<<Logger::Error<<"Unable to open source of random '"<<source<<"': "<<stringerror()<<endl; |
1365 |
+ g_log<<Logger::Error<<"Unable to open source of random '"<<source<<"': "<<stringerror()<<endl; |
1366 |
exit(EXIT_FAILURE); |
1367 |
} |
1368 |
char seed[16]; |
1369 |
@@ -24,12 +24,12 @@ void seedRandom(const string& source) |
1370 |
while(pos!=sizeof(seed)) { |
1371 |
ret = read(fd, seed+pos, sizeof(seed)-pos); |
1372 |
if(ret < 0) { |
1373 |
- L<<Logger::Error<<"Unable to read random seed from "<<source<<": "<<stringerror()<<endl; |
1374 |
+ g_log<<Logger::Error<<"Unable to read random seed from "<<source<<": "<<stringerror()<<endl; |
1375 |
close(fd); |
1376 |
exit(EXIT_FAILURE); |
1377 |
} |
1378 |
if(!ret) { |
1379 |
- L<<Logger::Error<<"Unable to read random seed from "<<source<<": end of file"<<endl; |
1380 |
+ g_log<<Logger::Error<<"Unable to read random seed from "<<source<<": end of file"<<endl; |
1381 |
close(fd); |
1382 |
exit(EXIT_FAILURE); |
1383 |
} |
1384 |
--- rec-carbon.cc.orig 2018-03-29 13:04:45 UTC |
1385 |
+++ rec-carbon.cc |
1386 |
@@ -60,20 +60,20 @@ try |
1387 |
|
1388 |
int ret=asendtcp(msg, &s); // this will actually do the right thing waiting on the connect |
1389 |
if(ret < 0) |
1390 |
- L<<Logger::Warning<<"Error writing carbon data to "<<remote.toStringWithPort()<<": "<<strerror(errno)<<endl; |
1391 |
+ g_log<<Logger::Warning<<"Error writing carbon data to "<<remote.toStringWithPort()<<": "<<strerror(errno)<<endl; |
1392 |
if(ret==0) |
1393 |
- L<<Logger::Warning<<"Timeout connecting/writing carbon data to "<<remote.toStringWithPort()<<endl; |
1394 |
+ g_log<<Logger::Warning<<"Timeout connecting/writing carbon data to "<<remote.toStringWithPort()<<endl; |
1395 |
} |
1396 |
} |
1397 |
catch(PDNSException& e) |
1398 |
{ |
1399 |
- L<<Logger::Error<<"Error in carbon thread: "<<e.reason<<endl; |
1400 |
+ g_log<<Logger::Error<<"Error in carbon thread: "<<e.reason<<endl; |
1401 |
} |
1402 |
catch(std::exception& e) |
1403 |
{ |
1404 |
- L<<Logger::Error<<"Error in carbon thread: "<<e.what()<<endl; |
1405 |
+ g_log<<Logger::Error<<"Error in carbon thread: "<<e.what()<<endl; |
1406 |
} |
1407 |
catch(...) |
1408 |
{ |
1409 |
- L<<Logger::Error<<"Unknown error in carbon thread"<<endl; |
1410 |
+ g_log<<Logger::Error<<"Unknown error in carbon thread"<<endl; |
1411 |
} |
1412 |
--- rec-lua-conf.cc.orig 2018-03-29 13:04:45 UTC |
1413 |
+++ rec-lua-conf.cc |
1414 |
@@ -123,14 +123,14 @@ void loadRecursorLuaConfig(const std::string& fname, b |
1415 |
zone->reserve(zoneSizeHint); |
1416 |
} |
1417 |
} |
1418 |
- theL()<<Logger::Warning<<"Loading RPZ from file '"<<filename<<"'"<<endl; |
1419 |
+ g_log<<Logger::Warning<<"Loading RPZ from file '"<<filename<<"'"<<endl; |
1420 |
zone->setName(polName); |
1421 |
loadRPZFromFile(filename, zone, defpol, maxTTL); |
1422 |
lci.dfe.addZone(zone); |
1423 |
- theL()<<Logger::Warning<<"Done loading RPZ from file '"<<filename<<"'"<<endl; |
1424 |
+ g_log<<Logger::Warning<<"Done loading RPZ from file '"<<filename<<"'"<<endl; |
1425 |
} |
1426 |
catch(const std::exception& e) { |
1427 |
- theL()<<Logger::Error<<"Unable to load RPZ zone from '"<<filename<<"': "<<e.what()<<endl; |
1428 |
+ g_log<<Logger::Error<<"Unable to load RPZ zone from '"<<filename<<"': "<<e.what()<<endl; |
1429 |
} |
1430 |
}); |
1431 |
|
1432 |
@@ -186,11 +186,11 @@ void loadRecursorLuaConfig(const std::string& fname, b |
1433 |
zoneIdx = lci.dfe.addZone(zone); |
1434 |
} |
1435 |
catch(const std::exception& e) { |
1436 |
- theL()<<Logger::Error<<"Problem configuring 'rpzMaster': "<<e.what()<<endl; |
1437 |
+ g_log<<Logger::Error<<"Problem configuring 'rpzMaster': "<<e.what()<<endl; |
1438 |
exit(1); // FIXME proper exit code? |
1439 |
} |
1440 |
catch(const PDNSException& e) { |
1441 |
- theL()<<Logger::Error<<"Problem configuring 'rpzMaster': "<<e.reason<<endl; |
1442 |
+ g_log<<Logger::Error<<"Problem configuring 'rpzMaster': "<<e.reason<<endl; |
1443 |
exit(1); // FIXME proper exit code? |
1444 |
} |
1445 |
|
1446 |
@@ -201,11 +201,11 @@ void loadRecursorLuaConfig(const std::string& fname, b |
1447 |
} |
1448 |
} |
1449 |
catch(const std::exception& e) { |
1450 |
- theL()<<Logger::Error<<"Problem starting RPZIXFRTracker thread: "<<e.what()<<endl; |
1451 |
+ g_log<<Logger::Error<<"Problem starting RPZIXFRTracker thread: "<<e.what()<<endl; |
1452 |
exit(1); // FIXME proper exit code? |
1453 |
} |
1454 |
catch(const PDNSException& e) { |
1455 |
- theL()<<Logger::Error<<"Problem starting RPZIXFRTracker thread: "<<e.reason<<endl; |
1456 |
+ g_log<<Logger::Error<<"Problem starting RPZIXFRTracker thread: "<<e.reason<<endl; |
1457 |
exit(1); // FIXME proper exit code? |
1458 |
} |
1459 |
}); |
1460 |
@@ -238,7 +238,7 @@ void loadRecursorLuaConfig(const std::string& fname, b |
1461 |
} |
1462 |
} |
1463 |
catch(std::exception& e) { |
1464 |
- theL()<<Logger::Error<<"Error in addSortList: "<<e.what()<<endl; |
1465 |
+ g_log<<Logger::Error<<"Error in addSortList: "<<e.what()<<endl; |
1466 |
} |
1467 |
}); |
1468 |
|
1469 |
@@ -293,14 +293,14 @@ void loadRecursorLuaConfig(const std::string& fname, b |
1470 |
} |
1471 |
} |
1472 |
else { |
1473 |
- theL()<<Logger::Error<<"Only one protobuf server can be configured, we already have "<<lci.protobufServer->toString()<<endl; |
1474 |
+ g_log<<Logger::Error<<"Only one protobuf server can be configured, we already have "<<lci.protobufServer->toString()<<endl; |
1475 |
} |
1476 |
} |
1477 |
catch(std::exception& e) { |
1478 |
- theL()<<Logger::Error<<"Error while starting protobuf logger to '"<<server_<<": "<<e.what()<<endl; |
1479 |
+ g_log<<Logger::Error<<"Error while starting protobuf logger to '"<<server_<<": "<<e.what()<<endl; |
1480 |
} |
1481 |
catch(PDNSException& e) { |
1482 |
- theL()<<Logger::Error<<"Error while starting protobuf logger to '"<<server_<<": "<<e.reason<<endl; |
1483 |
+ g_log<<Logger::Error<<"Error while starting protobuf logger to '"<<server_<<": "<<e.reason<<endl; |
1484 |
} |
1485 |
}); |
1486 |
|
1487 |
@@ -313,14 +313,14 @@ void loadRecursorLuaConfig(const std::string& fname, b |
1488 |
} |
1489 |
} |
1490 |
else { |
1491 |
- theL()<<Logger::Error<<"Only one protobuf server can be configured, we already have "<<lci.protobufServer->toString()<<endl; |
1492 |
+ g_log<<Logger::Error<<"Only one protobuf server can be configured, we already have "<<lci.protobufServer->toString()<<endl; |
1493 |
} |
1494 |
} |
1495 |
catch(std::exception& e) { |
1496 |
- theL()<<Logger::Error<<"Error while starting protobuf logger to '"<<server_<<": "<<e.what()<<endl; |
1497 |
+ g_log<<Logger::Error<<"Error while starting protobuf logger to '"<<server_<<": "<<e.what()<<endl; |
1498 |
} |
1499 |
catch(PDNSException& e) { |
1500 |
- theL()<<Logger::Error<<"Error while starting protobuf logger to '"<<server_<<": "<<e.reason<<endl; |
1501 |
+ g_log<<Logger::Error<<"Error while starting protobuf logger to '"<<server_<<": "<<e.reason<<endl; |
1502 |
} |
1503 |
}); |
1504 |
#endif |
1505 |
@@ -330,22 +330,22 @@ void loadRecursorLuaConfig(const std::string& fname, b |
1506 |
g_luaconfs.setState(lci); |
1507 |
} |
1508 |
catch(const LuaContext::ExecutionErrorException& e) { |
1509 |
- theL()<<Logger::Error<<"Unable to load Lua script from '"+fname+"': "; |
1510 |
+ g_log<<Logger::Error<<"Unable to load Lua script from '"+fname+"': "; |
1511 |
try { |
1512 |
std::rethrow_if_nested(e); |
1513 |
} catch(const std::exception& exp) { |
1514 |
// exp is the exception that was thrown from inside the lambda |
1515 |
- theL() << exp.what() << std::endl; |
1516 |
+ g_log << exp.what() << std::endl; |
1517 |
} |
1518 |
catch(const PDNSException& exp) { |
1519 |
// exp is the exception that was thrown from inside the lambda |
1520 |
- theL() << exp.reason << std::endl; |
1521 |
+ g_log << exp.reason << std::endl; |
1522 |
} |
1523 |
throw; |
1524 |
|
1525 |
} |
1526 |
catch(std::exception& err) { |
1527 |
- theL()<<Logger::Error<<"Unable to load Lua script from '"+fname+"': "<<err.what()<<endl; |
1528 |
+ g_log<<Logger::Error<<"Unable to load Lua script from '"+fname+"': "<<err.what()<<endl; |
1529 |
throw; |
1530 |
} |
1531 |
|
1532 |
--- rec-snmp.cc.orig 2018-03-29 13:04:45 UTC |
1533 |
+++ rec-snmp.cc |
1534 |
@@ -144,12 +144,12 @@ static int handleCounter64Stats(netsnmp_mib_handler* h |
1535 |
static void registerCounter64Stat(const char* name, const oid statOID[], size_t statOIDLength) |
1536 |
{ |
1537 |
if (statOIDLength != OID_LENGTH(questionsOID)) { |
1538 |
- L<<Logger::Error<<"Invalid OID for SNMP Counter64 statistic "<<std::string(name)<<endl; |
1539 |
+ g_log<<Logger::Error<<"Invalid OID for SNMP Counter64 statistic "<<std::string(name)<<endl; |
1540 |
return; |
1541 |
} |
1542 |
|
1543 |
if (s_statsMap.find(statOID[statOIDLength - 1]) != s_statsMap.end()) { |
1544 |
- L<<Logger::Error<<"OID for SNMP Counter64 statistic "<<std::string(name)<<" has already been registered"<<endl; |
1545 |
+ g_log<<Logger::Error<<"OID for SNMP Counter64 statistic "<<std::string(name)<<" has already been registered"<<endl; |
1546 |
return; |
1547 |
} |
1548 |
|
1549 |
--- rec_channel_rec.cc.orig 2018-03-29 13:04:45 UTC |
1550 |
+++ rec_channel_rec.cc |
1551 |
@@ -389,7 +389,7 @@ string doSetDnssecLogBogus(T begin, T end) |
1552 |
|
1553 |
if (pdns_iequals(*begin, "on") || pdns_iequals(*begin, "yes")) { |
1554 |
if (!g_dnssecLogBogus) { |
1555 |
- L<<Logger::Warning<<"Enabling DNSSEC Bogus logging, requested via control channel"<<endl; |
1556 |
+ g_log<<Logger::Warning<<"Enabling DNSSEC Bogus logging, requested via control channel"<<endl; |
1557 |
g_dnssecLogBogus = true; |
1558 |
return "DNSSEC Bogus logging enabled\n"; |
1559 |
} |
1560 |
@@ -398,7 +398,7 @@ string doSetDnssecLogBogus(T begin, T end) |
1561 |
|
1562 |
if (pdns_iequals(*begin, "off") || pdns_iequals(*begin, "no")) { |
1563 |
if (g_dnssecLogBogus) { |
1564 |
- L<<Logger::Warning<<"Disabling DNSSEC Bogus logging, requested via control channel"<<endl; |
1565 |
+ g_log<<Logger::Warning<<"Disabling DNSSEC Bogus logging, requested via control channel"<<endl; |
1566 |
g_dnssecLogBogus = false; |
1567 |
return "DNSSEC Bogus logging disabled\n"; |
1568 |
} |
1569 |
@@ -436,7 +436,7 @@ string doAddNTA(T begin, T end) |
1570 |
if (begin != end) |
1571 |
why += " "; |
1572 |
} |
1573 |
- L<<Logger::Warning<<"Adding Negative Trust Anchor for "<<who<<" with reason '"<<why<<"', requested via control channel"<<endl; |
1574 |
+ g_log<<Logger::Warning<<"Adding Negative Trust Anchor for "<<who<<" with reason '"<<why<<"', requested via control channel"<<endl; |
1575 |
g_luaconfs.modify([who, why](LuaConfigItems& lci) { |
1576 |
lci.negAnchors[who] = why; |
1577 |
}); |
1578 |
@@ -454,7 +454,7 @@ string doClearNTA(T begin, T end) |
1579 |
return "No Negative Trust Anchor specified, doing nothing.\n"; |
1580 |
|
1581 |
if (begin + 1 == end && *begin == "*"){ |
1582 |
- L<<Logger::Warning<<"Clearing all Negative Trust Anchors, requested via control channel"<<endl; |
1583 |
+ g_log<<Logger::Warning<<"Clearing all Negative Trust Anchors, requested via control channel"<<endl; |
1584 |
g_luaconfs.modify([](LuaConfigItems& lci) { |
1585 |
lci.negAnchors.clear(); |
1586 |
}); |
1587 |
@@ -482,7 +482,7 @@ string doClearNTA(T begin, T end) |
1588 |
string removed(""); |
1589 |
bool first(true); |
1590 |
for (auto const &entry : toRemove) { |
1591 |
- L<<Logger::Warning<<"Clearing Negative Trust Anchor for "<<entry<<", requested via control channel"<<endl; |
1592 |
+ g_log<<Logger::Warning<<"Clearing Negative Trust Anchor for "<<entry<<", requested via control channel"<<endl; |
1593 |
g_luaconfs.modify([entry](LuaConfigItems& lci) { |
1594 |
lci.negAnchors.erase(entry); |
1595 |
}); |
1596 |
@@ -536,17 +536,17 @@ string doAddTA(T begin, T end) |
1597 |
} |
1598 |
|
1599 |
try { |
1600 |
- L<<Logger::Warning<<"Adding Trust Anchor for "<<who<<" with data '"<<what<<"', requested via control channel"; |
1601 |
+ g_log<<Logger::Warning<<"Adding Trust Anchor for "<<who<<" with data '"<<what<<"', requested via control channel"; |
1602 |
g_luaconfs.modify([who, what](LuaConfigItems& lci) { |
1603 |
auto ds = unique_ptr<DSRecordContent>(dynamic_cast<DSRecordContent*>(DSRecordContent::make(what))); |
1604 |
lci.dsAnchors[who].insert(*ds); |
1605 |
}); |
1606 |
broadcastAccFunction<uint64_t>(boost::bind(pleaseWipePacketCache, who, true)); |
1607 |
- L<<Logger::Warning<<endl; |
1608 |
+ g_log<<Logger::Warning<<endl; |
1609 |
return "Added Trust Anchor for " + who.toStringRootDot() + " with data " + what + "\n"; |
1610 |
} |
1611 |
catch(std::exception &e) { |
1612 |
- L<<Logger::Warning<<", failed: "<<e.what()<<endl; |
1613 |
+ g_log<<Logger::Warning<<", failed: "<<e.what()<<endl; |
1614 |
return "Unable to add Trust Anchor for " + who.toStringRootDot() + ": " + e.what() + "\n"; |
1615 |
} |
1616 |
} |
1617 |
@@ -581,7 +581,7 @@ string doClearTA(T begin, T end) |
1618 |
string removed(""); |
1619 |
bool first(true); |
1620 |
for (auto const &entry : toRemove) { |
1621 |
- L<<Logger::Warning<<"Removing Trust Anchor for "<<entry<<", requested via control channel"<<endl; |
1622 |
+ g_log<<Logger::Warning<<"Removing Trust Anchor for "<<entry<<", requested via control channel"<<endl; |
1623 |
g_luaconfs.modify([entry](LuaConfigItems& lci) { |
1624 |
lci.dsAnchors.erase(entry); |
1625 |
}); |
1626 |
@@ -987,7 +987,7 @@ void registerAllStats() |
1627 |
|
1628 |
static void doExitGeneric(bool nicely) |
1629 |
{ |
1630 |
- L<<Logger::Error<<"Exiting on user request"<<endl; |
1631 |
+ g_log<<Logger::Error<<"Exiting on user request"<<endl; |
1632 |
extern RecursorControlChannel s_rcc; |
1633 |
s_rcc.~RecursorControlChannel(); |
1634 |
|
1635 |
@@ -1308,7 +1308,7 @@ string RecursorControlParser::getAnswer(const string& |
1636 |
|
1637 |
try { |
1638 |
loadRecursorLuaConfig(::arg()["lua-config-file"], false); |
1639 |
- L<<Logger::Warning<<"Reloaded Lua configuration file '"<<::arg()["lua-config-file"]<<"', requested via control channel"<<endl; |
1640 |
+ g_log<<Logger::Warning<<"Reloaded Lua configuration file '"<<::arg()["lua-config-file"]<<"', requested via control channel"<<endl; |
1641 |
return "Reloaded Lua configuration file '"+::arg()["lua-config-file"]+"'\n"; |
1642 |
} |
1643 |
catch(std::exception& e) { |
1644 |
@@ -1333,7 +1333,7 @@ string RecursorControlParser::getAnswer(const string& |
1645 |
|
1646 |
if(cmd=="reload-acls") { |
1647 |
if(!::arg()["chroot"].empty()) { |
1648 |
- L<<Logger::Error<<"Unable to reload ACL when chroot()'ed, requested via control channel"<<endl; |
1649 |
+ g_log<<Logger::Error<<"Unable to reload ACL when chroot()'ed, requested via control channel"<<endl; |
1650 |
return "Unable to reload ACL when chroot()'ed, please restart\n"; |
1651 |
} |
1652 |
|
1653 |
@@ -1342,12 +1342,12 @@ string RecursorControlParser::getAnswer(const string& |
1654 |
} |
1655 |
catch(std::exception& e) |
1656 |
{ |
1657 |
- L<<Logger::Error<<"Reloading ACLs failed (Exception: "<<e.what()<<")"<<endl; |
1658 |
+ g_log<<Logger::Error<<"Reloading ACLs failed (Exception: "<<e.what()<<")"<<endl; |
1659 |
return e.what() + string("\n"); |
1660 |
} |
1661 |
catch(PDNSException& ae) |
1662 |
{ |
1663 |
- L<<Logger::Error<<"Reloading ACLs failed (PDNSException: "<<ae.reason<<")"<<endl; |
1664 |
+ g_log<<Logger::Error<<"Reloading ACLs failed (PDNSException: "<<ae.reason<<")"<<endl; |
1665 |
return ae.reason + string("\n"); |
1666 |
} |
1667 |
return "ok\n"; |
1668 |
@@ -1386,7 +1386,7 @@ string RecursorControlParser::getAnswer(const string& |
1669 |
|
1670 |
if(cmd=="reload-zones") { |
1671 |
if(!::arg()["chroot"].empty()) { |
1672 |
- L<<Logger::Error<<"Unable to reload zones and forwards when chroot()'ed, requested via control channel"<<endl; |
1673 |
+ g_log<<Logger::Error<<"Unable to reload zones and forwards when chroot()'ed, requested via control channel"<<endl; |
1674 |
return "Unable to reload zones and forwards when chroot()'ed, please restart\n"; |
1675 |
} |
1676 |
return reloadAuthAndForwards(); |
1677 |
--- recursor_cache.hh.orig 2018-03-29 13:04:45 UTC |
1678 |
+++ recursor_cache.hh |
1679 |
@@ -30,7 +30,6 @@ |
1680 |
#include <iostream> |
1681 |
#include "dnsrecords.hh" |
1682 |
#include <boost/utility.hpp> |
1683 |
-#undef L |
1684 |
#include <boost/multi_index_container.hpp> |
1685 |
#include <boost/multi_index/ordered_index.hpp> |
1686 |
#include <boost/multi_index/hashed_index.hpp> |
1687 |
@@ -42,7 +41,6 @@ |
1688 |
#include "validate.hh" |
1689 |
#undef max |
1690 |
|
1691 |
-#define L theL() |
1692 |
#include "namespaces.hh" |
1693 |
using namespace ::boost::multi_index; |
1694 |
|
1695 |
--- reczones.cc.orig 2018-03-29 13:04:45 UTC |
1696 |
+++ reczones.cc |
1697 |
@@ -119,10 +119,10 @@ static void makeNameToIPZone(std::shared_ptr<SyncRes:: |
1698 |
ad.d_records.insert(dr); |
1699 |
|
1700 |
if(newMap->count(dr.d_name)) { |
1701 |
- L<<Logger::Warning<<"Hosts file will not overwrite zone '"<<dr.d_name<<"' already loaded"<<endl; |
1702 |
+ g_log<<Logger::Warning<<"Hosts file will not overwrite zone '"<<dr.d_name<<"' already loaded"<<endl; |
1703 |
} |
1704 |
else { |
1705 |
- L<<Logger::Warning<<"Inserting forward zone '"<<dr.d_name<<"' based on hosts file"<<endl; |
1706 |
+ g_log<<Logger::Warning<<"Inserting forward zone '"<<dr.d_name<<"' based on hosts file"<<endl; |
1707 |
ad.d_name=dr.d_name; |
1708 |
(*newMap)[ad.d_name]=ad; |
1709 |
} |
1710 |
@@ -165,11 +165,11 @@ static void makeIPToNamesZone(std::shared_ptr<SyncRes: |
1711 |
} |
1712 |
|
1713 |
if(newMap->count(dr.d_name)) { |
1714 |
- L<<Logger::Warning<<"Will not overwrite zone '"<<dr.d_name<<"' already loaded"<<endl; |
1715 |
+ g_log<<Logger::Warning<<"Will not overwrite zone '"<<dr.d_name<<"' already loaded"<<endl; |
1716 |
} |
1717 |
else { |
1718 |
if(ipparts.size()==4) |
1719 |
- L<<Logger::Warning<<"Inserting reverse zone '"<<dr.d_name<<"' based on hosts file"<<endl; |
1720 |
+ g_log<<Logger::Warning<<"Inserting reverse zone '"<<dr.d_name<<"' based on hosts file"<<endl; |
1721 |
ad.d_name = dr.d_name; |
1722 |
(*newMap)[ad.d_name]=ad; |
1723 |
} |
1724 |
@@ -215,15 +215,15 @@ void convertServersForAD(const std::string& input, Syn |
1725 |
|
1726 |
for(vector<string>::const_iterator iter = servers.begin(); iter != servers.end(); ++iter) { |
1727 |
if(verbose && iter != servers.begin()) |
1728 |
- L<<", "; |
1729 |
+ g_log<<", "; |
1730 |
|
1731 |
ComboAddress addr=parseIPAndPort(*iter, 53); |
1732 |
if(verbose) |
1733 |
- L<<addr.toStringWithPort(); |
1734 |
+ g_log<<addr.toStringWithPort(); |
1735 |
ad.d_servers.push_back(addr); |
1736 |
} |
1737 |
if(verbose) |
1738 |
- L<<endl; |
1739 |
+ g_log<<endl; |
1740 |
} |
1741 |
|
1742 |
void* pleaseWipeNegCache() |
1743 |
@@ -243,7 +243,7 @@ string reloadAuthAndForwards() |
1744 |
std::shared_ptr<SyncRes::domainmap_t> original=SyncRes::getDomainMap(); |
1745 |
|
1746 |
try { |
1747 |
- L<<Logger::Warning<<"Reloading zones, purging data from cache"<<endl; |
1748 |
+ g_log<<Logger::Warning<<"Reloading zones, purging data from cache"<<endl; |
1749 |
|
1750 |
if (original) { |
1751 |
for(const auto& i : *original) { |
1752 |
@@ -302,13 +302,13 @@ string reloadAuthAndForwards() |
1753 |
return "ok\n"; |
1754 |
} |
1755 |
catch(std::exception& e) { |
1756 |
- L<<Logger::Error<<"Encountered error reloading zones, keeping original data: "<<e.what()<<endl; |
1757 |
+ g_log<<Logger::Error<<"Encountered error reloading zones, keeping original data: "<<e.what()<<endl; |
1758 |
} |
1759 |
catch(PDNSException& ae) { |
1760 |
- L<<Logger::Error<<"Encountered error reloading zones, keeping original data: "<<ae.reason<<endl; |
1761 |
+ g_log<<Logger::Error<<"Encountered error reloading zones, keeping original data: "<<ae.reason<<endl; |
1762 |
} |
1763 |
catch(...) { |
1764 |
- L<<Logger::Error<<"Encountered unknown error reloading zones, keeping original data"<<endl; |
1765 |
+ g_log<<Logger::Error<<"Encountered unknown error reloading zones, keeping original data"<<endl; |
1766 |
} |
1767 |
return "reloading failed, see log\n"; |
1768 |
} |
1769 |
@@ -336,7 +336,7 @@ std::shared_ptr<SyncRes::domainmap_t> parseAuthAndForw |
1770 |
// headers.first=toCanonic("", headers.first); |
1771 |
if(n==0) { |
1772 |
ad.d_rdForward = false; |
1773 |
- L<<Logger::Error<<"Parsing authoritative data for zone '"<<headers.first<<"' from file '"<<headers.second<<"'"<<endl; |
1774 |
+ g_log<<Logger::Error<<"Parsing authoritative data for zone '"<<headers.first<<"' from file '"<<headers.second<<"'"<<endl; |
1775 |
ZoneParserTNG zpt(headers.second, DNSName(headers.first)); |
1776 |
DNSResourceRecord rr; |
1777 |
DNSRecord dr; |
1778 |
@@ -356,13 +356,13 @@ std::shared_ptr<SyncRes::domainmap_t> parseAuthAndForw |
1779 |
} |
1780 |
} |
1781 |
else { |
1782 |
- L<<Logger::Error<<"Redirecting queries for zone '"<<headers.first<<"' "; |
1783 |
+ g_log<<Logger::Error<<"Redirecting queries for zone '"<<headers.first<<"' "; |
1784 |
if(n == 2) { |
1785 |
- L<<"with recursion "; |
1786 |
+ g_log<<"with recursion "; |
1787 |
ad.d_rdForward = true; |
1788 |
} |
1789 |
else ad.d_rdForward = false; |
1790 |
- L<<"to: "; |
1791 |
+ g_log<<"to: "; |
1792 |
|
1793 |
convertServersForAD(headers.second, ad, ";"); |
1794 |
if(n == 2) { |
1795 |
@@ -376,7 +376,7 @@ std::shared_ptr<SyncRes::domainmap_t> parseAuthAndForw |
1796 |
} |
1797 |
|
1798 |
if(!::arg()["forward-zones-file"].empty()) { |
1799 |
- L<<Logger::Warning<<"Reading zone forwarding information from '"<<::arg()["forward-zones-file"]<<"'"<<endl; |
1800 |
+ g_log<<Logger::Warning<<"Reading zone forwarding information from '"<<::arg()["forward-zones-file"]<<"'"<<endl; |
1801 |
SyncRes::AuthDomain ad; |
1802 |
FILE *rfp=fopen(::arg()["forward-zones-file"].c_str(), "r"); |
1803 |
|
1804 |
@@ -421,7 +421,7 @@ std::shared_ptr<SyncRes::domainmap_t> parseAuthAndForw |
1805 |
ad.d_name = DNSName(domain); |
1806 |
(*newMap)[ad.d_name]=ad; |
1807 |
} |
1808 |
- L<<Logger::Warning<<"Done parsing " << newMap->size() - before<<" forwarding instructions from file '"<<::arg()["forward-zones-file"]<<"'"<<endl; |
1809 |
+ g_log<<Logger::Warning<<"Done parsing " << newMap->size() - before<<" forwarding instructions from file '"<<::arg()["forward-zones-file"]<<"'"<<endl; |
1810 |
} |
1811 |
|
1812 |
if(::arg().mustDo("export-etc-hosts")) { |
1813 |
@@ -430,7 +430,7 @@ std::shared_ptr<SyncRes::domainmap_t> parseAuthAndForw |
1814 |
|
1815 |
ifstream ifs(fname.c_str()); |
1816 |
if(!ifs) { |
1817 |
- L<<Logger::Warning<<"Could not open /etc/hosts for reading"<<endl; |
1818 |
+ g_log<<Logger::Warning<<"Could not open /etc/hosts for reading"<<endl; |
1819 |
} |
1820 |
else { |
1821 |
string searchSuffix = ::arg()["export-etc-hosts-search-suffix"]; |
1822 |
@@ -462,7 +462,7 @@ std::shared_ptr<SyncRes::domainmap_t> parseAuthAndForw |
1823 |
} |
1824 |
} |
1825 |
if(::arg().mustDo("serve-rfc1918")) { |
1826 |
- L<<Logger::Warning<<"Inserting rfc 1918 private space zones"<<endl; |
1827 |
+ g_log<<Logger::Warning<<"Inserting rfc 1918 private space zones"<<endl; |
1828 |
parts.clear(); |
1829 |
parts.push_back("127"); |
1830 |
makeIPToNamesZone(newMap, parts); |
1831 |
--- remote_logger.cc.orig 2018-03-29 13:04:45 UTC |
1832 |
+++ remote_logger.cc |
1833 |
@@ -21,7 +21,7 @@ bool RemoteLogger::reconnect() |
1834 |
} |
1835 |
catch(const std::exception& e) { |
1836 |
#ifdef WE_ARE_RECURSOR |
1837 |
- L<<Logger::Warning<<"Error connecting to remote logger "<<d_remote.toStringWithPort()<<": "<<e.what()<<std::endl; |
1838 |
+ g_log<<Logger::Warning<<"Error connecting to remote logger "<<d_remote.toStringWithPort()<<": "<<e.what()<<std::endl; |
1839 |
#else |
1840 |
warnlog("Error connecting to remote logger %s: %s", d_remote.toStringWithPort(), e.what()); |
1841 |
#endif |
1842 |
@@ -54,7 +54,7 @@ void RemoteLogger::worker() |
1843 |
} |
1844 |
catch(const std::runtime_error& e) { |
1845 |
#ifdef WE_ARE_RECURSOR |
1846 |
- L<<Logger::Info<<"Error sending data to remote logger "<<d_remote.toStringWithPort()<<": "<< e.what()<<endl; |
1847 |
+ g_log<<Logger::Info<<"Error sending data to remote logger "<<d_remote.toStringWithPort()<<": "<< e.what()<<endl; |
1848 |
#else |
1849 |
vinfolog("Error sending data to remote logger (%s): %s", d_remote.toStringWithPort(), e.what()); |
1850 |
#endif |
1851 |
--- rpzloader.cc.orig 2018-03-29 13:04:45 UTC |
1852 |
+++ rpzloader.cc |
1853 |
@@ -110,7 +110,7 @@ void RPZRecordToPolicy(const DNSRecord& dr, std::share |
1854 |
else if(!crcTarget.empty() && !crcTarget.isRoot() && crcTarget.getRawLabel(crcTarget.countLabels() - 1).compare(0, rpzPrefix.length(), rpzPrefix) == 0) { |
1855 |
/* this is very likely an higher format number or a configuration error, |
1856 |
let's just ignore it. */ |
1857 |
- L<<Logger::Info<<"Discarding unsupported RPZ entry "<<crcTarget.toString()<<" for "<<dr.d_name<<endl; |
1858 |
+ g_log<<Logger::Info<<"Discarding unsupported RPZ entry "<<crcTarget.toString()<<" for "<<dr.d_name<<endl; |
1859 |
return; |
1860 |
} |
1861 |
else { |
1862 |
@@ -177,9 +177,9 @@ void RPZRecordToPolicy(const DNSRecord& dr, std::share |
1863 |
|
1864 |
shared_ptr<SOARecordContent> loadRPZFromServer(const ComboAddress& master, const DNSName& zoneName, std::shared_ptr<DNSFilterEngine::Zone> zone, boost::optional<DNSFilterEngine::Policy> defpol, uint32_t maxTTL, const TSIGTriplet& tt, size_t maxReceivedBytes, const ComboAddress& localAddress, uint16_t axfrTimeout) |
1865 |
{ |
1866 |
- L<<Logger::Warning<<"Loading RPZ zone '"<<zoneName<<"' from "<<master.toStringWithPort()<<endl; |
1867 |
+ g_log<<Logger::Warning<<"Loading RPZ zone '"<<zoneName<<"' from "<<master.toStringWithPort()<<endl; |
1868 |
if(!tt.name.empty()) |
1869 |
- L<<Logger::Warning<<"With TSIG key '"<<tt.name<<"' of algorithm '"<<tt.algo<<"'"<<endl; |
1870 |
+ g_log<<Logger::Warning<<"With TSIG key '"<<tt.name<<"' of algorithm '"<<tt.algo<<"'"<<endl; |
1871 |
|
1872 |
ComboAddress local(localAddress); |
1873 |
if (local == ComboAddress()) |
1874 |
@@ -213,11 +213,11 @@ shared_ptr<SOARecordContent> loadRPZFromServer(const C |
1875 |
throw PDNSException("Total AXFR time exceeded!"); |
1876 |
} |
1877 |
if(last != time(0)) { |
1878 |
- L<<Logger::Info<<"Loaded & indexed "<<nrecords<<" policy records so far"<<endl; |
1879 |
+ g_log<<Logger::Info<<"Loaded & indexed "<<nrecords<<" policy records so far"<<endl; |
1880 |
last=time(0); |
1881 |
} |
1882 |
} |
1883 |
- L<<Logger::Info<<"Done: "<<nrecords<<" policy records active, SOA: "<<sr->getZoneRepresentation()<<endl; |
1884 |
+ g_log<<Logger::Info<<"Done: "<<nrecords<<" policy records active, SOA: "<<sr->getZoneRepresentation()<<endl; |
1885 |
return sr; |
1886 |
} |
1887 |
|
1888 |
@@ -300,11 +300,11 @@ void RPZIXFRTracker(const ComboAddress& master, boost: |
1889 |
setRPZZoneNewState(polName, sr->d_st.serial, zone->size(), true); |
1890 |
} |
1891 |
catch(const std::exception& e) { |
1892 |
- theL()<<Logger::Warning<<"Unable to load RPZ zone '"<<zoneName<<"' from '"<<master<<"': '"<<e.what()<<"'. (Will try again in "<<refresh<<" seconds...)"<<endl; |
1893 |
+ g_log<<Logger::Warning<<"Unable to load RPZ zone '"<<zoneName<<"' from '"<<master<<"': '"<<e.what()<<"'. (Will try again in "<<refresh<<" seconds...)"<<endl; |
1894 |
incRPZFailedTransfers(polName); |
1895 |
} |
1896 |
catch(const PDNSException& e) { |
1897 |
- theL()<<Logger::Warning<<"Unable to load RPZ zone '"<<zoneName<<"' from '"<<master<<"': '"<<e.reason<<"'. (Will try again in "<<refresh<<" seconds...)"<<endl; |
1898 |
+ g_log<<Logger::Warning<<"Unable to load RPZ zone '"<<zoneName<<"' from '"<<master<<"': '"<<e.reason<<"'. (Will try again in "<<refresh<<" seconds...)"<<endl; |
1899 |
incRPZFailedTransfers(polName); |
1900 |
} |
1901 |
|
1902 |
@@ -323,7 +323,7 @@ void RPZIXFRTracker(const ComboAddress& master, boost: |
1903 |
|
1904 |
sleep(refresh); |
1905 |
|
1906 |
- L<<Logger::Info<<"Getting IXFR deltas for "<<zoneName<<" from "<<master.toStringWithPort()<<", our serial: "<<getRR<SOARecordContent>(dr)->d_st.serial<<endl; |
1907 |
+ g_log<<Logger::Info<<"Getting IXFR deltas for "<<zoneName<<" from "<<master.toStringWithPort()<<", our serial: "<<getRR<SOARecordContent>(dr)->d_st.serial<<endl; |
1908 |
vector<pair<vector<DNSRecord>, vector<DNSRecord> > > deltas; |
1909 |
|
1910 |
ComboAddress local(localAddress); |
1911 |
@@ -333,13 +333,13 @@ void RPZIXFRTracker(const ComboAddress& master, boost: |
1912 |
try { |
1913 |
deltas = getIXFRDeltas(master, zoneName, dr, tt, &local, maxReceivedBytes); |
1914 |
} catch(std::runtime_error& e ){ |
1915 |
- L<<Logger::Warning<<e.what()<<endl; |
1916 |
+ g_log<<Logger::Warning<<e.what()<<endl; |
1917 |
incRPZFailedTransfers(polName); |
1918 |
continue; |
1919 |
} |
1920 |
if(deltas.empty()) |
1921 |
continue; |
1922 |
- L<<Logger::Info<<"Processing "<<deltas.size()<<" delta"<<addS(deltas)<<" for RPZ "<<zoneName<<endl; |
1923 |
+ g_log<<Logger::Info<<"Processing "<<deltas.size()<<" delta"<<addS(deltas)<<" for RPZ "<<zoneName<<endl; |
1924 |
|
1925 |
auto luaconfsLocal = g_luaconfs.getLocal(); |
1926 |
const std::shared_ptr<DNSFilterEngine::Zone> oldZone = luaconfsLocal->dfe.getZone(zoneIdx); |
1927 |
@@ -352,7 +352,7 @@ void RPZIXFRTracker(const ComboAddress& master, boost: |
1928 |
const auto& remove = delta.first; |
1929 |
const auto& add = delta.second; |
1930 |
if(remove.empty()) { |
1931 |
- L<<Logger::Warning<<"IXFR update is a whole new zone"<<endl; |
1932 |
+ g_log<<Logger::Warning<<"IXFR update is a whole new zone"<<endl; |
1933 |
newZone->clear(); |
1934 |
fullUpdate = true; |
1935 |
} |
1936 |
@@ -365,11 +365,11 @@ void RPZIXFRTracker(const ComboAddress& master, boost: |
1937 |
// cout<<"Got good removal of SOA serial "<<oldsr->d_st.serial<<endl; |
1938 |
} |
1939 |
else |
1940 |
- L<<Logger::Error<<"GOT WRONG SOA SERIAL REMOVAL, SHOULD TRIGGER WHOLE RELOAD"<<endl; |
1941 |
+ g_log<<Logger::Error<<"GOT WRONG SOA SERIAL REMOVAL, SHOULD TRIGGER WHOLE RELOAD"<<endl; |
1942 |
} |
1943 |
else { |
1944 |
totremove++; |
1945 |
- L<<(g_logRPZChanges ? Logger::Info : Logger::Debug)<<"Had removal of "<<rr.d_name<<" from RPZ zone "<<zoneName<<endl; |
1946 |
+ g_log<<(g_logRPZChanges ? Logger::Info : Logger::Debug)<<"Had removal of "<<rr.d_name<<" from RPZ zone "<<zoneName<<endl; |
1947 |
RPZRecordToPolicy(rr, newZone, false, defpol, maxTTL); |
1948 |
} |
1949 |
} |
1950 |
@@ -379,19 +379,19 @@ void RPZIXFRTracker(const ComboAddress& master, boost: |
1951 |
continue; |
1952 |
if(rr.d_type == QType::SOA) { |
1953 |
auto newsr = getRR<SOARecordContent>(rr); |
1954 |
- // L<<Logger::Info<<"New SOA serial for "<<zoneName<<": "<<newsr->d_st.serial<<endl; |
1955 |
+ // g_log<<Logger::Info<<"New SOA serial for "<<zoneName<<": "<<newsr->d_st.serial<<endl; |
1956 |
if (newsr) { |
1957 |
sr = newsr; |
1958 |
} |
1959 |
} |
1960 |
else { |
1961 |
totadd++; |
1962 |
- L<<(g_logRPZChanges ? Logger::Info : Logger::Debug)<<"Had addition of "<<rr.d_name<<" to RPZ zone "<<zoneName<<endl; |
1963 |
+ g_log<<(g_logRPZChanges ? Logger::Info : Logger::Debug)<<"Had addition of "<<rr.d_name<<" to RPZ zone "<<zoneName<<endl; |
1964 |
RPZRecordToPolicy(rr, newZone, true, defpol, maxTTL); |
1965 |
} |
1966 |
} |
1967 |
} |
1968 |
- L<<Logger::Info<<"Had "<<totremove<<" RPZ removal"<<addS(totremove)<<", "<<totadd<<" addition"<<addS(totadd)<<" for "<<zoneName<<" New serial: "<<sr->d_st.serial<<endl; |
1969 |
+ g_log<<Logger::Info<<"Had "<<totremove<<" RPZ removal"<<addS(totremove)<<", "<<totadd<<" addition"<<addS(totadd)<<" for "<<zoneName<<" New serial: "<<sr->d_st.serial<<endl; |
1970 |
newZone->setSerial(sr->d_st.serial); |
1971 |
setRPZZoneNewState(polName, sr->d_st.serial, newZone->size(), fullUpdate); |
1972 |
|
1973 |
--- secpoll-recursor.cc.orig 2018-03-29 13:04:45 UTC |
1974 |
+++ secpoll-recursor.cc |
1975 |
@@ -55,7 +55,7 @@ void doSecPoll(time_t* last_secpoll) |
1976 |
} |
1977 |
|
1978 |
if(state == Bogus) { |
1979 |
- L<<Logger::Error<<"Could not retrieve security status update for '" +pkgv+ "' on '"<<query<<"', DNSSEC validation result was Bogus!"<<endl; |
1980 |
+ g_log<<Logger::Error<<"Could not retrieve security status update for '" +pkgv+ "' on '"<<query<<"', DNSSEC validation result was Bogus!"<<endl; |
1981 |
if(g_security_status == 1) // If we were OK, go to unknown |
1982 |
g_security_status = 0; |
1983 |
return; |
1984 |
@@ -79,18 +79,18 @@ void doSecPoll(time_t* last_secpoll) |
1985 |
} |
1986 |
else { |
1987 |
if(pkgv.find("0.0.") != 0) |
1988 |
- L<<Logger::Warning<<"Could not retrieve security status update for '" +pkgv+ "' on '"<<query<<"', RCODE = "<< RCode::to_s(res)<<endl; |
1989 |
+ g_log<<Logger::Warning<<"Could not retrieve security status update for '" +pkgv+ "' on '"<<query<<"', RCODE = "<< RCode::to_s(res)<<endl; |
1990 |
else |
1991 |
- L<<Logger::Warning<<"Ignoring response for security status update, this is a non-release version."<<endl; |
1992 |
+ g_log<<Logger::Warning<<"Ignoring response for security status update, this is a non-release version."<<endl; |
1993 |
|
1994 |
if(g_security_status == 1) // it was ok, now it is unknown |
1995 |
g_security_status = 0; |
1996 |
} |
1997 |
|
1998 |
if(g_security_status == 2) { |
1999 |
- L<<Logger::Error<<"PowerDNS Security Update Recommended: "<<g_security_message<<endl; |
2000 |
+ g_log<<Logger::Error<<"PowerDNS Security Update Recommended: "<<g_security_message<<endl; |
2001 |
} |
2002 |
else if(g_security_status == 3) { |
2003 |
- L<<Logger::Error<<"PowerDNS Security Update Mandatory: "<<g_security_message<<endl; |
2004 |
+ g_log<<Logger::Error<<"PowerDNS Security Update Mandatory: "<<g_security_message<<endl; |
2005 |
} |
2006 |
} |
2007 |
--- syncres.cc.orig 2018-03-29 13:04:45 UTC |
2008 |
+++ syncres.cc |
2009 |
@@ -75,7 +75,7 @@ bool SyncRes::s_nopacketcache; |
2010 |
bool SyncRes::s_rootNXTrust; |
2011 |
bool SyncRes::s_noEDNS; |
2012 |
|
2013 |
-#define LOG(x) if(d_lm == Log) { L <<Logger::Warning << x; } else if(d_lm == Store) { d_trace << x; } |
2014 |
+#define LOG(x) if(d_lm == Log) { g_log <<Logger::Warning << x; } else if(d_lm == Store) { d_trace << x; } |
2015 |
|
2016 |
static void accountAuthLatency(int usec, int family) |
2017 |
{ |
2018 |
@@ -2855,23 +2855,23 @@ int SyncRes::getRootNS(struct timeval now, asyncresolv |
2019 |
return res; |
2020 |
} |
2021 |
catch(const PDNSException& e) { |
2022 |
- L<<Logger::Error<<"Failed to update . records, got an exception: "<<e.reason<<endl; |
2023 |
+ g_log<<Logger::Error<<"Failed to update . records, got an exception: "<<e.reason<<endl; |
2024 |
} |
2025 |
catch(const ImmediateServFailException& e) { |
2026 |
- L<<Logger::Error<<"Failed to update . records, got an exception: "<<e.reason<<endl; |
2027 |
+ g_log<<Logger::Error<<"Failed to update . records, got an exception: "<<e.reason<<endl; |
2028 |
} |
2029 |
catch(const std::exception& e) { |
2030 |
- L<<Logger::Error<<"Failed to update . records, got an exception: "<<e.what()<<endl; |
2031 |
+ g_log<<Logger::Error<<"Failed to update . records, got an exception: "<<e.what()<<endl; |
2032 |
} |
2033 |
catch(...) { |
2034 |
- L<<Logger::Error<<"Failed to update . records, got an exception"<<endl; |
2035 |
+ g_log<<Logger::Error<<"Failed to update . records, got an exception"<<endl; |
2036 |
} |
2037 |
|
2038 |
if(!res) { |
2039 |
- L<<Logger::Notice<<"Refreshed . records"<<endl; |
2040 |
+ g_log<<Logger::Notice<<"Refreshed . records"<<endl; |
2041 |
} |
2042 |
else |
2043 |
- L<<Logger::Error<<"Failed to update . records, RCODE="<<res<<endl; |
2044 |
+ g_log<<Logger::Error<<"Failed to update . records, RCODE="<<res<<endl; |
2045 |
|
2046 |
return res; |
2047 |
} |
2048 |
--- test-syncres_cc.cc.orig 2018-03-29 13:04:45 UTC |
2049 |
+++ test-syncres_cc.cc |
2050 |
@@ -101,16 +101,16 @@ LuaConfigItems::LuaConfigItems() |
2051 |
|
2052 |
static void init(bool debug=false) |
2053 |
{ |
2054 |
- L.setName("test"); |
2055 |
- L.disableSyslog(true); |
2056 |
+ g_log.setName("test"); |
2057 |
+ g_log.disableSyslog(true); |
2058 |
|
2059 |
if (debug) { |
2060 |
- L.setLoglevel((Logger::Urgency)(6)); // info and up |
2061 |
- L.toConsole(Logger::Info); |
2062 |
+ g_log.setLoglevel((Logger::Urgency)(6)); // info and up |
2063 |
+ g_log.toConsole(Logger::Info); |
2064 |
} |
2065 |
else { |
2066 |
- L.setLoglevel(Logger::None); |
2067 |
- L.toConsole(Logger::Error); |
2068 |
+ g_log.setLoglevel(Logger::None); |
2069 |
+ g_log.toConsole(Logger::Error); |
2070 |
} |
2071 |
|
2072 |
seedRandom("/dev/urandom"); |
2073 |
--- unix_utility.cc.orig 2018-03-29 13:04:45 UTC |
2074 |
+++ unix_utility.cc |
2075 |
@@ -84,22 +84,22 @@ void Utility::setBindAny(int af, sock_t sock) |
2076 |
(void) one; // avoids 'unused var' warning on systems that have none of the defines checked below |
2077 |
#ifdef IP_FREEBIND |
2078 |
if (setsockopt(sock, IPPROTO_IP, IP_FREEBIND, &one, sizeof(one)) < 0) |
2079 |
- theL()<<Logger::Warning<<"Warning: IP_FREEBIND setsockopt failed: "<<strerror(errno)<<endl; |
2080 |
+ g_log<<Logger::Warning<<"Warning: IP_FREEBIND setsockopt failed: "<<strerror(errno)<<endl; |
2081 |
#endif |
2082 |
|
2083 |
#ifdef IP_BINDANY |
2084 |
if (af == AF_INET) |
2085 |
if (setsockopt(sock, IPPROTO_IP, IP_BINDANY, &one, sizeof(one)) < 0) |
2086 |
- theL()<<Logger::Warning<<"Warning: IP_BINDANY setsockopt failed: "<<strerror(errno)<<endl; |
2087 |
+ g_log<<Logger::Warning<<"Warning: IP_BINDANY setsockopt failed: "<<strerror(errno)<<endl; |
2088 |
#endif |
2089 |
#ifdef IPV6_BINDANY |
2090 |
if (af == AF_INET6) |
2091 |
if (setsockopt(sock, IPPROTO_IPV6, IPV6_BINDANY, &one, sizeof(one)) < 0) |
2092 |
- theL()<<Logger::Warning<<"Warning: IPV6_BINDANY setsockopt failed: "<<strerror(errno)<<endl; |
2093 |
+ g_log<<Logger::Warning<<"Warning: IPV6_BINDANY setsockopt failed: "<<strerror(errno)<<endl; |
2094 |
#endif |
2095 |
#ifdef SO_BINDANY |
2096 |
if (setsockopt(sock, SOL_SOCKET, SO_BINDANY, &one, sizeof(one)) < 0) |
2097 |
- theL()<<Logger::Warning<<"Warning: SO_BINDANY setsockopt failed: "<<strerror(errno)<<endl; |
2098 |
+ g_log<<Logger::Warning<<"Warning: SO_BINDANY setsockopt failed: "<<strerror(errno)<<endl; |
2099 |
#endif |
2100 |
} |
2101 |
|
2102 |
@@ -128,22 +128,22 @@ void Utility::dropGroupPrivs( int uid, int gid ) |
2103 |
{ |
2104 |
if(gid) { |
2105 |
if(setgid(gid)<0) { |
2106 |
- theL()<<Logger::Critical<<"Unable to set effective group id to "<<gid<<": "<<stringerror()<<endl; |
2107 |
+ g_log<<Logger::Critical<<"Unable to set effective group id to "<<gid<<": "<<stringerror()<<endl; |
2108 |
exit(1); |
2109 |
} |
2110 |
else |
2111 |
- theL()<<Logger::Info<<"Set effective group id to "<<gid<<endl; |
2112 |
+ g_log<<Logger::Info<<"Set effective group id to "<<gid<<endl; |
2113 |
|
2114 |
struct passwd *pw=getpwuid(uid); |
2115 |
if(!pw) { |
2116 |
- theL()<<Logger::Warning<<"Unable to determine user name for uid "<<uid<<endl; |
2117 |
+ g_log<<Logger::Warning<<"Unable to determine user name for uid "<<uid<<endl; |
2118 |
if (setgroups(0, NULL)<0) { |
2119 |
- theL()<<Logger::Critical<<"Unable to drop supplementary gids: "<<stringerror()<<endl; |
2120 |
+ g_log<<Logger::Critical<<"Unable to drop supplementary gids: "<<stringerror()<<endl; |
2121 |
exit(1); |
2122 |
} |
2123 |
} else { |
2124 |
if (initgroups(pw->pw_name, gid)<0) { |
2125 |
- theL()<<Logger::Critical<<"Unable to set supplementary groups: "<<stringerror()<<endl; |
2126 |
+ g_log<<Logger::Critical<<"Unable to set supplementary groups: "<<stringerror()<<endl; |
2127 |
exit(1); |
2128 |
} |
2129 |
} |
2130 |
@@ -156,11 +156,11 @@ void Utility::dropUserPrivs( int uid ) |
2131 |
{ |
2132 |
if(uid) { |
2133 |
if(setuid(uid)<0) { |
2134 |
- theL()<<Logger::Critical<<"Unable to set effective user id to "<<uid<<": "<<stringerror()<<endl; |
2135 |
+ g_log<<Logger::Critical<<"Unable to set effective user id to "<<uid<<": "<<stringerror()<<endl; |
2136 |
exit(1); |
2137 |
} |
2138 |
else |
2139 |
- theL()<<Logger::Info<<"Set effective user id to "<<uid<<endl; |
2140 |
+ g_log<<Logger::Info<<"Set effective user id to "<<uid<<endl; |
2141 |
} |
2142 |
} |
2143 |
|
2144 |
@@ -188,7 +188,7 @@ int Utility::makeGidNumeric(const string &group) |
2145 |
errno=0; |
2146 |
struct group *gr=getgrnam(group.c_str()); |
2147 |
if(!gr) { |
2148 |
- theL()<<Logger::Critical<<"Unable to look up gid of group '"<<group<<"': "<< (errno ? strerror(errno) : "not found") <<endl; |
2149 |
+ g_log<<Logger::Critical<<"Unable to look up gid of group '"<<group<<"': "<< (errno ? strerror(errno) : "not found") <<endl; |
2150 |
exit(1); |
2151 |
} |
2152 |
newgid=gr->gr_gid; |
2153 |
@@ -204,7 +204,7 @@ int Utility::makeUidNumeric(const string &username) |
2154 |
if(!(newuid=atoi(username.c_str()))) { |
2155 |
struct passwd *pw=getpwnam(username.c_str()); |
2156 |
if(!pw) { |
2157 |
- theL()<<Logger::Critical<<"Unable to look up uid of user '"<<username<<"': "<< (errno ? strerror(errno) : "not found") <<endl; |
2158 |
+ g_log<<Logger::Critical<<"Unable to look up uid of user '"<<username<<"': "<< (errno ? strerror(errno) : "not found") <<endl; |
2159 |
exit(1); |
2160 |
} |
2161 |
newuid=pw->pw_uid; |
2162 |
--- validate-recursor.cc.orig 2018-03-29 13:04:45 UTC |
2163 |
+++ validate-recursor.cc |
2164 |
@@ -13,7 +13,7 @@ bool checkDNSSECDisabled() { |
2165 |
bool warnIfDNSSECDisabled(const string& msg) { |
2166 |
if(g_dnssecmode == DNSSECMode::Off) { |
2167 |
if (!msg.empty()) |
2168 |
- L<<Logger::Warning<<msg<<endl; |
2169 |
+ g_log<<Logger::Warning<<msg<<endl; |
2170 |
return true; |
2171 |
} |
2172 |
return false; |
2173 |
--- validate.cc.orig 2018-03-29 13:04:45 UTC |
2174 |
+++ validate.cc |
2175 |
@@ -8,7 +8,7 @@ |
2176 |
bool g_dnssecLOG{false}; |
2177 |
uint16_t g_maxNSEC3Iterations{0}; |
2178 |
|
2179 |
-#define LOG(x) if(g_dnssecLOG) { L <<Logger::Warning << x; } |
2180 |
+#define LOG(x) if(g_dnssecLOG) { g_log <<Logger::Warning << x; } |
2181 |
void dotEdge(DNSName zone, string type1, DNSName name1, string tag1, string type2, DNSName name2, string tag2, string color=""); |
2182 |
void dotNode(string type, DNSName name, string tag, string content); |
2183 |
string dotName(string type, DNSName name, string tag); |
2184 |
--- version.cc.orig 2018-03-29 13:04:45 UTC |
2185 |
+++ version.cc |
2186 |
@@ -71,22 +71,22 @@ string productTypeApiType() { |
2187 |
|
2188 |
void showProductVersion() |
2189 |
{ |
2190 |
- theL()<<Logger::Warning<<productName()<<" "<< VERSION << " (C) 2001-2017 " |
2191 |
+ g_log<<Logger::Warning<<productName()<<" "<< VERSION << " (C) 2001-2017 " |
2192 |
"PowerDNS.COM BV" << endl; |
2193 |
- theL()<<Logger::Warning<<"Using "<<(sizeof(unsigned long)*8)<<"-bits mode. " |
2194 |
+ g_log<<Logger::Warning<<"Using "<<(sizeof(unsigned long)*8)<<"-bits mode. " |
2195 |
"Built using " << compilerVersion() |
2196 |
#ifndef REPRODUCIBLE |
2197 |
<<" on " __DATE__ " " __TIME__ " by " BUILD_HOST |
2198 |
#endif |
2199 |
<<"."<< endl; |
2200 |
- theL()<<Logger::Warning<<"PowerDNS comes with ABSOLUTELY NO WARRANTY. " |
2201 |
+ g_log<<Logger::Warning<<"PowerDNS comes with ABSOLUTELY NO WARRANTY. " |
2202 |
"This is free software, and you are welcome to redistribute it " |
2203 |
"according to the terms of the GPL version 2." << endl; |
2204 |
} |
2205 |
|
2206 |
void showBuildConfiguration() |
2207 |
{ |
2208 |
- theL()<<Logger::Warning<<"Features: "<< |
2209 |
+ g_log<<Logger::Warning<<"Features: "<< |
2210 |
#ifdef HAVE_BOTAN |
2211 |
"botan" << BOTAN_VERSION_MAJOR << "." << BOTAN_VERSION_MINOR << " " << |
2212 |
#endif |
2213 |
@@ -115,12 +115,12 @@ void showBuildConfiguration() |
2214 |
endl; |
2215 |
#ifdef PDNS_MODULES |
2216 |
// Auth only |
2217 |
- theL()<<Logger::Warning<<"Built-in modules: "<<PDNS_MODULES<<endl; |
2218 |
+ g_log<<Logger::Warning<<"Built-in modules: "<<PDNS_MODULES<<endl; |
2219 |
#endif |
2220 |
#ifdef PDNS_CONFIG_ARGS |
2221 |
#define double_escape(s) #s |
2222 |
#define escape_quotes(s) double_escape(s) |
2223 |
- theL()<<Logger::Warning<<"Configured with: "<<escape_quotes(PDNS_CONFIG_ARGS)<<endl; |
2224 |
+ g_log<<Logger::Warning<<"Configured with: "<<escape_quotes(PDNS_CONFIG_ARGS)<<endl; |
2225 |
#undef escape_quotes |
2226 |
#undef double_escape |
2227 |
#endif |
2228 |
--- webserver.cc.orig 2018-03-29 13:04:45 UTC |
2229 |
+++ webserver.cc |
2230 |
@@ -39,12 +39,12 @@ json11::Json HttpRequest::json() |
2231 |
{ |
2232 |
string err; |
2233 |
if(this->body.empty()) { |
2234 |
- L<<Logger::Debug<<"HTTP: JSON document expected in request body, but body was empty" << endl; |
2235 |
+ g_log<<Logger::Debug<<"HTTP: JSON document expected in request body, but body was empty" << endl; |
2236 |
throw HttpBadRequestException(); |
2237 |
} |
2238 |
json11::Json doc = json11::Json::parse(this->body, err); |
2239 |
if (doc.is_null()) { |
2240 |
- L<<Logger::Debug<<"HTTP: parsing of JSON document failed:" << err << endl; |
2241 |
+ g_log<<Logger::Debug<<"HTTP: parsing of JSON document failed:" << err << endl; |
2242 |
throw HttpBadRequestException(); |
2243 |
} |
2244 |
return doc; |
2245 |
@@ -132,13 +132,13 @@ static void apiWrapper(WebServer::HandlerFunction hand |
2246 |
resp->headers["access-control-allow-origin"] = "*"; |
2247 |
|
2248 |
if (api_key.empty()) { |
2249 |
- L<<Logger::Error<<"HTTP API Request \"" << req->url.path << "\": Authentication failed, API Key missing in config" << endl; |
2250 |
+ g_log<<Logger::Error<<"HTTP API Request \"" << req->url.path << "\": Authentication failed, API Key missing in config" << endl; |
2251 |
throw HttpUnauthorizedException("X-API-Key"); |
2252 |
} |
2253 |
bool auth_ok = req->compareHeader("x-api-key", api_key) || req->getvars["api-key"]==api_key; |
2254 |
|
2255 |
if (!auth_ok) { |
2256 |
- L<<Logger::Error<<"HTTP Request \"" << req->url.path << "\": Authentication by API Key failed" << endl; |
2257 |
+ g_log<<Logger::Error<<"HTTP Request \"" << req->url.path << "\": Authentication by API Key failed" << endl; |
2258 |
throw HttpUnauthorizedException("X-API-Key"); |
2259 |
} |
2260 |
|
2261 |
@@ -181,7 +181,7 @@ static void webWrapper(WebServer::HandlerFunction hand |
2262 |
if (!web_password.empty()) { |
2263 |
bool auth_ok = req->compareAuthorization(web_password); |
2264 |
if (!auth_ok) { |
2265 |
- L<<Logger::Debug<<"HTTP Request \"" << req->url.path << "\": Web Authentication failed" << endl; |
2266 |
+ g_log<<Logger::Debug<<"HTTP Request \"" << req->url.path << "\": Web Authentication failed" << endl; |
2267 |
throw HttpUnauthorizedException("Basic"); |
2268 |
} |
2269 |
} |
2270 |
@@ -206,11 +206,11 @@ void WebServer::handleRequest(HttpRequest& req, HttpRe |
2271 |
|
2272 |
try { |
2273 |
if (!req.complete) { |
2274 |
- L<<Logger::Debug<<"HTTP: Incomplete request" << endl; |
2275 |
+ g_log<<Logger::Debug<<"HTTP: Incomplete request" << endl; |
2276 |
throw HttpBadRequestException(); |
2277 |
} |
2278 |
|
2279 |
- L<<Logger::Debug<<"HTTP: Handling request \"" << req.url.path << "\"" << endl; |
2280 |
+ g_log<<Logger::Debug<<"HTTP: Handling request \"" << req.url.path << "\"" << endl; |
2281 |
|
2282 |
YaHTTP::strstr_map_t::iterator header; |
2283 |
|
2284 |
@@ -225,33 +225,33 @@ void WebServer::handleRequest(HttpRequest& req, HttpRe |
2285 |
|
2286 |
YaHTTP::THandlerFunction handler; |
2287 |
if (!YaHTTP::Router::Route(&req, handler)) { |
2288 |
- L<<Logger::Debug<<"HTTP: No route found for \"" << req.url.path << "\"" << endl; |
2289 |
+ g_log<<Logger::Debug<<"HTTP: No route found for \"" << req.url.path << "\"" << endl; |
2290 |
throw HttpNotFoundException(); |
2291 |
} |
2292 |
|
2293 |
try { |
2294 |
handler(&req, &resp); |
2295 |
- L<<Logger::Debug<<"HTTP: Result for \"" << req.url.path << "\": " << resp.status << ", body length: " << resp.body.size() << endl; |
2296 |
+ g_log<<Logger::Debug<<"HTTP: Result for \"" << req.url.path << "\": " << resp.status << ", body length: " << resp.body.size() << endl; |
2297 |
} |
2298 |
catch(HttpException&) { |
2299 |
throw; |
2300 |
} |
2301 |
catch(PDNSException &e) { |
2302 |
- L<<Logger::Error<<"HTTP ISE for \""<< req.url.path << "\": Exception: " << e.reason << endl; |
2303 |
+ g_log<<Logger::Error<<"HTTP ISE for \""<< req.url.path << "\": Exception: " << e.reason << endl; |
2304 |
throw HttpInternalServerErrorException(); |
2305 |
} |
2306 |
catch(std::exception &e) { |
2307 |
- L<<Logger::Error<<"HTTP ISE for \""<< req.url.path << "\": STL Exception: " << e.what() << endl; |
2308 |
+ g_log<<Logger::Error<<"HTTP ISE for \""<< req.url.path << "\": STL Exception: " << e.what() << endl; |
2309 |
throw HttpInternalServerErrorException(); |
2310 |
} |
2311 |
catch(...) { |
2312 |
- L<<Logger::Error<<"HTTP ISE for \""<< req.url.path << "\": Unknown Exception" << endl; |
2313 |
+ g_log<<Logger::Error<<"HTTP ISE for \""<< req.url.path << "\": Unknown Exception" << endl; |
2314 |
throw HttpInternalServerErrorException(); |
2315 |
} |
2316 |
} |
2317 |
catch(HttpException &e) { |
2318 |
resp = e.response(); |
2319 |
- L<<Logger::Debug<<"HTTP: Error result for \"" << req.url.path << "\": " << resp.status << endl; |
2320 |
+ g_log<<Logger::Debug<<"HTTP: Error result for \"" << req.url.path << "\": " << resp.status << endl; |
2321 |
string what = YaHTTP::Utility::status2text(resp.status); |
2322 |
if(req.accept_html) { |
2323 |
resp.headers["Content-Type"] = "text/html; charset=utf-8"; |
2324 |
@@ -311,14 +311,14 @@ try { |
2325 |
client->writenWithTimeout(reply.c_str(), reply.size(), timeout); |
2326 |
} |
2327 |
catch(PDNSException &e) { |
2328 |
- L<<Logger::Error<<"HTTP Exception: "<<e.reason<<endl; |
2329 |
+ g_log<<Logger::Error<<"HTTP Exception: "<<e.reason<<endl; |
2330 |
} |
2331 |
catch(std::exception &e) { |
2332 |
if(strstr(e.what(), "timeout")==0) |
2333 |
- L<<Logger::Error<<"HTTP STL Exception: "<<e.what()<<endl; |
2334 |
+ g_log<<Logger::Error<<"HTTP STL Exception: "<<e.what()<<endl; |
2335 |
} |
2336 |
catch(...) { |
2337 |
- L<<Logger::Error<<"HTTP: Unknown exception"<<endl; |
2338 |
+ g_log<<Logger::Error<<"HTTP: Unknown exception"<<endl; |
2339 |
} |
2340 |
|
2341 |
WebServer::WebServer(const string &listenaddress, int port) : d_server(nullptr) |
2342 |
@@ -331,10 +331,10 @@ void WebServer::bind() |
2343 |
{ |
2344 |
try { |
2345 |
d_server = createServer(); |
2346 |
- L<<Logger::Warning<<"Listening for HTTP requests on "<<d_server->d_local.toStringWithPort()<<endl; |
2347 |
+ g_log<<Logger::Warning<<"Listening for HTTP requests on "<<d_server->d_local.toStringWithPort()<<endl; |
2348 |
} |
2349 |
catch(NetworkError &e) { |
2350 |
- L<<Logger::Error<<"Listening on HTTP socket failed: "<<e.what()<<endl; |
2351 |
+ g_log<<Logger::Error<<"Listening on HTTP socket failed: "<<e.what()<<endl; |
2352 |
d_server = nullptr; |
2353 |
} |
2354 |
} |
2355 |
@@ -359,28 +359,28 @@ void WebServer::go() |
2356 |
} else { |
2357 |
ComboAddress remote; |
2358 |
if (client->getRemote(remote)) |
2359 |
- L<<Logger::Error<<"Webserver closing socket: remote ("<< remote.toString() <<") does not match 'webserver-allow-from'"<<endl; |
2360 |
+ g_log<<Logger::Error<<"Webserver closing socket: remote ("<< remote.toString() <<") does not match 'webserver-allow-from'"<<endl; |
2361 |
} |
2362 |
} |
2363 |
catch(PDNSException &e) { |
2364 |
- L<<Logger::Error<<"PDNSException while accepting a connection in main webserver thread: "<<e.reason<<endl; |
2365 |
+ g_log<<Logger::Error<<"PDNSException while accepting a connection in main webserver thread: "<<e.reason<<endl; |
2366 |
} |
2367 |
catch(std::exception &e) { |
2368 |
- L<<Logger::Error<<"STL Exception while accepting a connection in main webserver thread: "<<e.what()<<endl; |
2369 |
+ g_log<<Logger::Error<<"STL Exception while accepting a connection in main webserver thread: "<<e.what()<<endl; |
2370 |
} |
2371 |
catch(...) { |
2372 |
- L<<Logger::Error<<"Unknown exception while accepting a connection in main webserver thread"<<endl; |
2373 |
+ g_log<<Logger::Error<<"Unknown exception while accepting a connection in main webserver thread"<<endl; |
2374 |
} |
2375 |
} |
2376 |
} |
2377 |
catch(PDNSException &e) { |
2378 |
- L<<Logger::Error<<"PDNSException in main webserver thread: "<<e.reason<<endl; |
2379 |
+ g_log<<Logger::Error<<"PDNSException in main webserver thread: "<<e.reason<<endl; |
2380 |
} |
2381 |
catch(std::exception &e) { |
2382 |
- L<<Logger::Error<<"STL Exception in main webserver thread: "<<e.what()<<endl; |
2383 |
+ g_log<<Logger::Error<<"STL Exception in main webserver thread: "<<e.what()<<endl; |
2384 |
} |
2385 |
catch(...) { |
2386 |
- L<<Logger::Error<<"Unknown exception in main webserver thread"<<endl; |
2387 |
+ g_log<<Logger::Error<<"Unknown exception in main webserver thread"<<endl; |
2388 |
} |
2389 |
_exit(1); |
2390 |
} |
2391 |
--- ws-recursor.cc.orig 2018-03-29 13:04:45 UTC |
2392 |
+++ ws-recursor.cc |
2393 |
@@ -584,11 +584,11 @@ void AsyncServerNewConnectionMT(void *p) { |
2394 |
} |
2395 |
} catch (NetworkError &e) { |
2396 |
// we're running in a shared process/thread, so can't just terminate/abort. |
2397 |
- L<<Logger::Warning<<"Network error in web thread: "<<e.what()<<endl; |
2398 |
+ g_log<<Logger::Warning<<"Network error in web thread: "<<e.what()<<endl; |
2399 |
return; |
2400 |
} |
2401 |
catch (...) { |
2402 |
- L<<Logger::Warning<<"Unknown error in web thread"<<endl; |
2403 |
+ g_log<<Logger::Warning<<"Unknown error in web thread"<<endl; |
2404 |
|
2405 |
return; |
2406 |
} |
2407 |
@@ -638,18 +638,18 @@ try { |
2408 |
|
2409 |
// now send the reply |
2410 |
if (asendtcp(data, client.get()) == -1 || data.empty()) { |
2411 |
- L<<Logger::Error<<"Failed sending reply to HTTP client"<<endl; |
2412 |
+ g_log<<Logger::Error<<"Failed sending reply to HTTP client"<<endl; |
2413 |
} |
2414 |
} |
2415 |
catch(PDNSException &e) { |
2416 |
- L<<Logger::Error<<"HTTP Exception: "<<e.reason<<endl; |
2417 |
+ g_log<<Logger::Error<<"HTTP Exception: "<<e.reason<<endl; |
2418 |
} |
2419 |
catch(std::exception &e) { |
2420 |
if(strstr(e.what(), "timeout")==0) |
2421 |
- L<<Logger::Error<<"HTTP STL Exception: "<<e.what()<<endl; |
2422 |
+ g_log<<Logger::Error<<"HTTP STL Exception: "<<e.what()<<endl; |
2423 |
} |
2424 |
catch(...) { |
2425 |
- L<<Logger::Error<<"HTTP: Unknown exception"<<endl; |
2426 |
+ g_log<<Logger::Error<<"HTTP: Unknown exception"<<endl; |
2427 |
} |
2428 |
|
2429 |
void AsyncWebServer::go() { |