]> granicus.if.org Git - pdns/commitdiff
add lowercase-outgoing flag
authorPeter van Dijk <peter.van.dijk@powerdns.com>
Tue, 9 Feb 2016 13:21:25 +0000 (14:21 +0100)
committerPeter van Dijk <peter.van.dijk@powerdns.com>
Wed, 10 Feb 2016 10:45:39 +0000 (11:45 +0100)
pdns/pdns_recursor.cc

index d9412cdc00feccb996508d37dcef741e58b04c53..9463894cd84f246bbd338d8b78c02ac77f84c257 100644 (file)
@@ -79,6 +79,7 @@ unsigned int g_networkTimeoutMsec;
 uint64_t g_latencyStatSize;
 bool g_logCommonErrors;
 bool g_anyToTcp;
+bool g_lowercaseOutgoing;
 uint16_t g_udpTruncationThreshold;
 __thread shared_ptr<RecursorLua>* t_pdl;
 
@@ -553,6 +554,10 @@ void startDoResolve(void *p)
     pw.getHeader()->id=dc->d_mdp.d_header.id;
     pw.getHeader()->rd=dc->d_mdp.d_header.rd;
 
+    // DO NOT MOVE THIS CODE UP!
+    if (g_lowercaseOutgoing)
+      dc->d_mdp.d_qname = toLower(dc->d_mdp.d_qname);
+
     uint32_t minTTL=std::numeric_limits<uint32_t>::max();
 
     SyncRes sr(dc->d_now);
@@ -2016,6 +2021,8 @@ int serviceMain(int argc, char*argv[])
   g_anyToTcp = ::arg().mustDo("any-to-tcp");
   g_udpTruncationThreshold = ::arg().asNum("udp-truncation-threshold");
 
+  g_lowercaseOutgoing = ::arg().mustDo("lowercase-outgoing");
+
   makeUDPServerSockets();
   makeTCPServerSockets();
 
@@ -2323,6 +2330,7 @@ int main(int argc, char **argv)
     ::arg().setSwitch( "pdns-distributes-queries", "If PowerDNS itself should distribute queries over threads")="";
     ::arg().setSwitch( "root-nx-trust", "If set, believe that an NXDOMAIN from the root means the TLD does not exist")="no";
     ::arg().setSwitch( "any-to-tcp","Answer ANY queries with tc=1, shunting to TCP" )="no";
+    ::arg().setSwitch( "lowercase-outgoing","Force outgoing questions to lowercase")="no";
     ::arg().set("udp-truncation-threshold", "Maximum UDP response size before we truncate")="1680";
     ::arg().set("minimum-ttl-override", "Set under adverse conditions, a minimum TTL")="0";
     ::arg().set("max-qperq", "Maximum outgoing queries per query")="50";