From: Bert Hubert Date: Sun, 22 Jun 2008 20:05:06 +0000 (+0000) Subject: third batch - includes new setting 'max-cache-entries' X-Git-Tag: rec-3.1.7.1~24 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=dea466f3e991bb168ef3f753117d9e97f8d4b0ae;p=thirdparty%2Fpdns.git third batch - includes new setting 'max-cache-entries' git-svn-id: svn://svn.powerdns.com/pdns/trunk/pdns@1217 d19b8d6e-7fed-0310-83ef-9ca221ded41b --- diff --git a/pdns/common_startup.cc b/pdns/common_startup.cc index 278ead77ed..83d2e77963 100644 --- a/pdns/common_startup.cc +++ b/pdns/common_startup.cc @@ -39,86 +39,88 @@ ArgvMap &arg() void declareArguments() { - arg().set("local-port","The port on which we listen")="53"; - arg().setSwitch("log-failed-updates","If PDNS should log failed update requests")=""; - arg().setSwitch("log-dns-details","If PDNS should log DNS non-erroneous details")=""; - arg().setSwitch("allow-recursion-override","Set this so that local data fully overrides the recursor")="no"; - arg().set("urlredirector","Where we send hosts to that need to be url redirected")="127.0.0.1"; - arg().set("smtpredirector","Our smtpredir MX host")="a.misconfigured.powerdns.smtp.server"; - arg().set("local-address","Local IP addresses to which we bind")="0.0.0.0"; - arg().set("local-ipv6","Local IP address to which we bind")=""; - arg().set("query-local-address","Source IP address for sending queries")=""; - arg().set("max-queue-length","Maximum queuelength before considering situation lost")="5000"; - arg().set("soa-serial-offset","Make sure that no SOA serial is less than this number")="0"; - - arg().setCmd("help","Provide a helpful message"); - arg().setCmd("version","Output version and compilation date"); - arg().setCmd("config","Provide configuration file on standard output"); - arg().setCmd("list-modules","Lists all modules available"); - arg().setCmd("no-config","Don't parse configuration file"); + ::arg().set("local-port","The port on which we listen")="53"; + ::arg().setSwitch("log-failed-updates","If PDNS should log failed update requests")=""; + ::arg().setSwitch("log-dns-details","If PDNS should log DNS non-erroneous details")=""; + ::arg().setSwitch("allow-recursion-override","Set this so that local data fully overrides the recursor")="no"; + ::arg().set("urlredirector","Where we send hosts to that need to be url redirected")="127.0.0.1"; + ::arg().set("smtpredirector","Our smtpredir MX host")="a.misconfigured.powerdns.smtp.server"; + ::arg().set("local-address","Local IP addresses to which we bind")="0.0.0.0"; + ::arg().set("local-ipv6","Local IP address to which we bind")=""; + ::arg().set("query-local-address","Source IP address for sending queries")=""; + ::arg().set("max-queue-length","Maximum queuelength before considering situation lost")="5000"; + ::arg().set("soa-serial-offset","Make sure that no SOA serial is less than this number")="0"; + + ::arg().setCmd("help","Provide a helpful message"); + ::arg().setCmd("version","Output version and compilation date"); + ::arg().setCmd("config","Provide configuration file on standard output"); + ::arg().setCmd("list-modules","Lists all modules available"); + ::arg().setCmd("no-config","Don't parse configuration file"); - arg().set("version-string","PowerDNS version in packets - full, anonymous, powerdns or custom")="full"; - arg().set("control-console","Debugging switch - don't use")="no"; // but I know you will! - arg().set("fancy-records","Process URL and MBOXFW records")="no"; - arg().set("wildcard-url","Process URL and MBOXFW records")="no"; - arg().set("wildcards","Honor wildcards in the database")=""; - arg().set("loglevel","Amount of logging. Higher is more. Do not set below 3")="4"; - arg().set("default-soa-name","name to insert in the SOA record if none set in the backend")="a.misconfigured.powerdns.server"; - arg().set("distributor-threads","Default number of Distributor (backend) threads to start")="3"; - arg().set("queue-limit","Maximum number of milliseconds to queue a query")="1500"; - arg().set("recursor","If recursion is desired, IP address of a recursing nameserver")="no"; - arg().set("lazy-recursion","Only recurse if question cannot be answered locally")="yes"; - arg().set("allow-recursion","List of subnets that are allowed to recurse")="0.0.0.0/0"; - arg().set("pipebackend-abi-version","Version of the pipe backend ABI")="1"; + ::arg().set("version-string","PowerDNS version in packets - full, anonymous, powerdns or custom")="full"; + ::arg().set("control-console","Debugging switch - don't use")="no"; // but I know you will! + ::arg().set("fancy-records","Process URL and MBOXFW records")="no"; + ::arg().set("wildcard-url","Process URL and MBOXFW records")="no"; + ::arg().set("wildcards","Honor wildcards in the database")=""; + ::arg().set("loglevel","Amount of logging. Higher is more. Do not set below 3")="4"; + ::arg().set("default-soa-name","name to insert in the SOA record if none set in the backend")="a.misconfigured.powerdns.server"; + ::arg().set("distributor-threads","Default number of Distributor (backend) threads to start")="3"; + ::arg().set("queue-limit","Maximum number of milliseconds to queue a query")="1500"; + ::arg().set("recursor","If recursion is desired, IP address of a recursing nameserver")="no"; + ::arg().set("lazy-recursion","Only recurse if question cannot be answered locally")="yes"; + ::arg().set("allow-recursion","List of subnets that are allowed to recurse")="0.0.0.0/0"; + ::arg().set("pipebackend-abi-version","Version of the pipe backend ABI")="1"; - arg().set("disable-tcp","Do not listen to TCP queries")="no"; - arg().set("disable-axfr","Do not allow zone transfers")="no"; + ::arg().set("disable-tcp","Do not listen to TCP queries")="no"; + ::arg().set("disable-axfr","Do not allow zone transfers")="no"; - arg().set("config-name","Name of this virtual configuration - will rename the binary image")=""; + ::arg().set("config-name","Name of this virtual configuration - will rename the binary image")=""; - arg().set("load-modules","Load this module - supply absolute or relative path")=""; - arg().set("launch","Which backends to launch and order to query them in")=""; - arg().setSwitch("disable-axfr","Disable zonetransfers but do allow TCP queries")="no"; - arg().set("allow-axfr-ips","Allow zonetransfers only to these subnets")="0.0.0.0/0"; - arg().set("slave-cycle-interval","Reschedule failed SOA serial checks once every .. seconds")="60"; + ::arg().set("load-modules","Load this module - supply absolute or relative path")=""; + ::arg().set("launch","Which backends to launch and order to query them in")=""; + ::arg().setSwitch("disable-axfr","Disable zonetransfers but do allow TCP queries")="no"; + ::arg().set("allow-axfr-ips","Allow zonetransfers only to these subnets")="0.0.0.0/0"; + ::arg().set("slave-cycle-interval","Reschedule failed SOA serial checks once every .. seconds")="60"; - arg().setSwitch("slave","Act as a slave")="no"; - arg().setSwitch("master","Act as a master")="no"; - arg().setSwitch("guardian","Run within a guardian process")="no"; - arg().setSwitch("skip-cname","Do not perform CNAME indirection for each query")="no"; - arg().setSwitch("strict-rfc-axfrs","Perform strictly rfc compliant axfrs (very slow)")="no"; - arg().setSwitch("send-root-referral","Send out old-fashioned root-referral instead of ServFail in case of no authority")="no"; - - arg().setSwitch("webserver","Start a webserver for monitoring")="no"; - arg().setSwitch("webserver-print-arguments","If the webserver should print arguments")="no"; - arg().set("webserver-address","IP Address of webserver to listen on")="127.0.0.1"; - arg().set("webserver-port","Port of webserver to listen on")="8081"; - arg().set("webserver-password","Password required for accessing the webserver")=""; - - arg().setSwitch("out-of-zone-additional-processing","Do out of zone additional processing")="yes"; - arg().setSwitch("do-ipv6-additional-processing", "Do AAAA additional processing")="no"; - arg().setSwitch("query-logging","Hint backends that queries should be logged")="no"; + ::arg().setSwitch("slave","Act as a slave")="no"; + ::arg().setSwitch("master","Act as a master")="no"; + ::arg().setSwitch("guardian","Run within a guardian process")="no"; + ::arg().setSwitch("skip-cname","Do not perform CNAME indirection for each query")="no"; + ::arg().setSwitch("strict-rfc-axfrs","Perform strictly rfc compliant axfrs (very slow)")="no"; + ::arg().setSwitch("send-root-referral","Send out old-fashioned root-referral instead of ServFail in case of no authority")="no"; + + ::arg().setSwitch("webserver","Start a webserver for monitoring")="no"; + ::arg().setSwitch("webserver-print-arguments","If the webserver should print arguments")="no"; + ::arg().set("webserver-address","IP Address of webserver to listen on")="127.0.0.1"; + ::arg().set("webserver-port","Port of webserver to listen on")="8081"; + ::arg().set("webserver-password","Password required for accessing the webserver")=""; + + ::arg().setSwitch("out-of-zone-additional-processing","Do out of zone additional processing")="yes"; + ::arg().setSwitch("do-ipv6-additional-processing", "Do AAAA additional processing")="no"; + ::arg().setSwitch("query-logging","Hint backends that queries should be logged")="no"; - arg().set("cache-ttl","Seconds to store packets in the PacketCache")="20"; - arg().set("recursive-cache-ttl","Seconds to store packets in the PacketCache")="10"; - arg().set("negquery-cache-ttl","Seconds to store packets in the PacketCache")="60"; - arg().set("query-cache-ttl","Seconds to store packets in the PacketCache")="20"; - arg().set("soa-minimum-ttl","Default SOA mininum ttl")="3600"; - - arg().set("soa-refresh-default","Default SOA refresh")="10800"; - arg().set("soa-retry-default","Default SOA retry")="3600"; - arg().set("soa-expire-default","Default SOA expire")="604800"; - - arg().set("trusted-notification-proxy", "IP address of incoming notification proxy")=""; - - arg().set("default-ttl","Seconds a result is valid if not set otherwise")="3600"; - arg().set("max-tcp-connections","Maximum number of TCP connections")="10"; - arg().setSwitch("no-shuffle","Set this to prevent random shuffling of answers - for regression testing")="off"; - - arg().setSwitch( "use-logfile", "Use a log file (Windows only)" )= "no"; - arg().set( "logfile", "Logfile to use (Windows only)" )= "pdns.log"; - arg().set("setuid","If set, change user id to this uid for more security")=""; - arg().set("setgid","If set, change group id to this gid for more security")=""; + ::arg().set("cache-ttl","Seconds to store packets in the PacketCache")="20"; + ::arg().set("recursive-cache-ttl","Seconds to store packets in the PacketCache")="10"; + ::arg().set("negquery-cache-ttl","Seconds to store packets in the PacketCache")="60"; + ::arg().set("query-cache-ttl","Seconds to store packets in the PacketCache")="20"; + ::arg().set("soa-minimum-ttl","Default SOA mininum ttl")="3600"; + + ::arg().set("soa-refresh-default","Default SOA refresh")="10800"; + ::arg().set("soa-retry-default","Default SOA retry")="3600"; + ::arg().set("soa-expire-default","Default SOA expire")="604800"; + + ::arg().set("trusted-notification-proxy", "IP address of incoming notification proxy")=""; + + ::arg().set("default-ttl","Seconds a result is valid if not set otherwise")="3600"; + ::arg().set("max-tcp-connections","Maximum number of TCP connections")="10"; + ::arg().setSwitch("no-shuffle","Set this to prevent random shuffling of answers - for regression testing")="off"; + + ::arg().setSwitch( "use-logfile", "Use a log file (Windows only)" )= "no"; + ::arg().set( "logfile", "Logfile to use (Windows only)" )= "pdns.log"; + ::arg().set("setuid","If set, change user id to this uid for more security")=""; + ::arg().set("setgid","If set, change group id to this gid for more security")=""; + + ::arg().set("max-cache-entries", "Maximum number of cache entries")="1000000"; } @@ -270,30 +272,30 @@ void mainthread() Utility::srandom(time(0)); int newgid=0; - if(!arg()["setgid"].empty()) - newgid=Utility::makeGidNumeric(arg()["setgid"]); + if(!::arg()["setgid"].empty()) + newgid=Utility::makeGidNumeric(::arg()["setgid"]); int newuid=0; - if(!arg()["setuid"].empty()) - newuid=Utility::makeUidNumeric(arg()["setuid"]); + if(!::arg()["setuid"].empty()) + newuid=Utility::makeUidNumeric(::arg()["setuid"]); #ifndef WIN32 - if(!arg()["chroot"].empty()) { - if(arg().mustDo("master") || arg().mustDo("slave")) + if(!::arg()["chroot"].empty()) { + if(::arg().mustDo("master") || ::arg().mustDo("slave")) gethostbyname("a.root-servers.net"); // this forces all lookup libraries to be loaded - if(chroot(arg()["chroot"].c_str())<0 || chdir("/")<0) { - L<onlyFrom(arg()["allow-recursion"]); + if(::arg().mustDo("recursor")){ + DP=new DNSProxy(::arg()["recursor"]); + DP->onlyFrom(::arg()["allow-recursion"]); DP->go(); } // NOW SAFE TO CREATE THREADS! @@ -302,17 +304,17 @@ void mainthread() pthread_t qtid; StatWebServer sws; - if(arg().mustDo("webserver")) + if(::arg().mustDo("webserver")) sws.go(); - if(arg().mustDo("slave") || arg().mustDo("master")) + if(::arg().mustDo("slave") || ::arg().mustDo("master")) Communicator.go(); if(TN) TN->go(); // tcp nameserver launch // fork(); (this worked :-)) - DNSDistributor *D= new DNSDistributor(arg().asNum("distributor-threads")); // the big dispatcher! + DNSDistributor *D= new DNSDistributor(::arg().asNum("distributor-threads")); // the big dispatcher! pthread_create(&qtid,0,qthread,static_cast(D)); // receives packets void *p; diff --git a/pdns/common_startup.hh b/pdns/common_startup.hh index be439c71db..6ae0d2eb3b 100644 --- a/pdns/common_startup.hh +++ b/pdns/common_startup.hh @@ -20,7 +20,7 @@ #ifndef COMMON_STARTUP_HH #define COMMON_STARTUP_HH - +#include "packetcache.hh" #include "utility.hh" #include "arguments.hh" #include "communicator.hh"