]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
logging and root-correctness in the pipe-backend
authorPieter Lexis <pieter.lexis@powerdns.com>
Tue, 28 Jun 2016 09:08:48 +0000 (11:08 +0200)
committerPieter Lexis <pieter.lexis@powerdns.com>
Fri, 1 Jul 2016 12:34:56 +0000 (14:34 +0200)
docs/markdown/authoritative/backend-pipe.md
modules/pipebackend/pipebackend.cc

index 854a5b04bab40730af9a4dcf2f6e579b084613d0..b80958d49e1065ddaa99136619660ecfd198f6ce 100644 (file)
@@ -68,7 +68,8 @@ If this time is ever exceeded, the backend is declared dead and a new process is
 
 If set, only questions matching this regular expression are even sent to the backend.
 This makes sure that most of PowerDNS does not slow down if you you deploy a slow backend.
-A query for 'www.powerdns.com' would be presented to the regex as 'www.powerdns.com', a matching regex would be '^www.powerdns.com$'.
+A query for 'www.powerdns.com' would be presented to the regex as 'www.powerdns.com', a matching regex would be `^www\.powerdns\.com$`.
+**Note**: to match the root domain, use a dot, e.g. `^\.$`
 
 # PipeBackend protocol
 Questions come in over a file descriptor, by default standard input.
index 7806093d423203c2faf98db39b94f5f41fab1d23..7beed8e34253fd8fd5eb1e8ab1eb4747d2429a78 100644 (file)
@@ -144,7 +144,7 @@ void PipeBackend::lookup(const QType& qtype,const DNSName& qname, DNSPacket *pkt
   try {
     launch();
     d_disavow=false;
-    if(d_regex && !d_regex->match(qname.toStringNoDot())) {
+    if(d_regex && !d_regex->match(qname.toStringRootDot())) {
       if(::arg().mustDo("query-logging"))
         L<<Logger::Error<<"Query for '"<<qname<<"' failed regex '"<<d_regexstr<<"'"<<endl;
       d_disavow=true; // don't pass to backend
@@ -160,7 +160,7 @@ void PipeBackend::lookup(const QType& qtype,const DNSName& qname, DNSPacket *pkt
       }
       // abi-version = 1
       // type    qname           qclass  qtype   id      remote-ip-address
-      query<<"Q\t"<<qname.toStringNoDot()<<"\tIN\t"<<qtype.getName()<<"\t"<<zoneId<<"\t"<<remoteIP;
+      query<<"Q\t"<<qname.toStringRootDot()<<"\tIN\t"<<qtype.getName()<<"\t"<<zoneId<<"\t"<<remoteIP;
 
       // add the local-ip-address if abi-version is set to 2
       if (d_abiVersion >= 2)
@@ -191,7 +191,7 @@ bool PipeBackend::list(const DNSName& target, int inZoneId, bool include_disable
 
     // type    qname           qclass  qtype   id      ip-address
     if (d_abiVersion >= 4)
-      query<<"AXFR\t"<<inZoneId<<"\t"<<target.toStringNoDot();
+      query<<"AXFR\t"<<inZoneId<<"\t"<<target.toStringRootDot();
     else
       query<<"AXFR\t"<<inZoneId;