From: Bert Hubert Date: Thu, 23 Jan 2003 15:34:53 +0000 (+0000) Subject: more pdns recursor stats X-Git-Tag: pdns-2.9.5~5 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=c75a6a9ebc016794a3c9915497294f28d683cf27;p=thirdparty%2Fpdns.git more pdns recursor stats git-svn-id: svn://svn.powerdns.com/pdns/trunk/pdns@140 d19b8d6e-7fed-0310-83ef-9ca221ded41b --- diff --git a/ChangeLog b/ChangeLog index e5c2537f00..f662b7989e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -8,6 +8,7 @@ Changes since 2.9.4: - UltraSparc alignment issues Chris Andrews - compression (Mark Bergsma) - SRV records (Ueli Heuer) + - updated J root-server IP address in the recursor Changes since 2.9.3a: feat - make *all* sql in gsqlbackends available for configuration (Martin Klebermass/bert hubert) diff --git a/configure.in b/configure.in index fd76920661..4e21df632a 100644 --- a/configure.in +++ b/configure.in @@ -1,6 +1,6 @@ dnl intro AC_INIT(pdns/receiver.cc) -AM_INIT_AUTOMAKE(pdns, 2.9.4) +AM_INIT_AUTOMAKE(pdns, 2.9.5) AC_CANONICAL_HOST AM_CONFIG_HEADER(config.h) AC_C_BIGENDIAN diff --git a/pdns/backends/gsql/gsqlbackend.cc b/pdns/backends/gsql/gsqlbackend.cc index e8f3f4abd4..9e9fd06ec5 100644 --- a/pdns/backends/gsql/gsqlbackend.cc +++ b/pdns/backends/gsql/gsqlbackend.cc @@ -1,4 +1,4 @@ -// $Id: gsqlbackend.cc,v 1.5 2003/01/02 20:15:26 ahu Exp $ +// $Id: gsqlbackend.cc,v 1.6 2003/01/23 15:34:53 ahu Exp $ #include #include @@ -370,6 +370,7 @@ bool GSQLBackend::get(DNSResourceRecord &r) else r.qname=row[5]; r.qtype=row[3]; + r.last_modified=0; r.domain_id=atoi(row[4].c_str()); return true; diff --git a/pdns/dnspacket.cc b/pdns/dnspacket.cc index 9394d4f2b1..59228c07f4 100644 --- a/pdns/dnspacket.cc +++ b/pdns/dnspacket.cc @@ -16,7 +16,7 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -// $Id: dnspacket.cc,v 1.15 2003/01/21 15:04:02 ahu Exp $ +// $Id: dnspacket.cc,v 1.16 2003/01/23 15:34:53 ahu Exp $ #include "utility.hh" #include @@ -304,16 +304,7 @@ void DNSPacket::addMXRecord(const string &domain, const string &mx, int priority toqname(domain,&piece1); char piece2[12]; - - piece2[0]=0; - - piece2[1]=15; // MX - piece2[2]=0; - piece2[3]=1; // IN - - putLong(piece2+4,ttl); - piece2[8]=0; - piece2[9]=0; // need to fill this in + makeHeader(piece2,QType::MX,ttl); // start of payload for which we need to specify the length in 8 & 9 @@ -526,15 +517,7 @@ void DNSPacket::addSOARecord(const string &domain, const string & content, u_int toqname(domain, &piece1); char p[10]; - - p[0]=0; - p[1]=6; // SOA - p[2]=0; - p[3]=1; // IN - - putLong(p+4,ttl); - p[8]=0; - p[9]=0; // need to fill this in (length) + makeHeader(p,QType::SOA,ttl); string piece3; toqname(soadata.nameserver,&piece3, false); @@ -615,16 +598,7 @@ void DNSPacket::addRPRecord(const string &domain, const string &content, u_int32 toqname(domain.c_str(),&piece1); char p[10]; - - p[0]=0; - p[1]=17; // RP - p[2]=0; - p[3]=1; // IN - - putLong(p+4,ttl); - - p[8]=0; - p[9]=0; // need to fill this in + makeHeader(p,17,ttl); // content contains: mailbox-name more-info-domain (Separated by a space) unsigned int pos; @@ -835,9 +809,6 @@ void DNSPacket::addHINFORecord(string domain, string content, u_int32_t ttl) char p[10]; makeHeader(p,QType::HINFO,ttl); - p[8]=0; - p[9]=0; // need to fill this in - unsigned int offset=content.find(" "); string cpu, host; if(offset==string::npos) { @@ -879,15 +850,7 @@ void DNSPacket::addNSRecord(string domain, string server, u_int32_t ttl, DNSReso toqname(domain, &piece1); char p[10]; - - p[0]=0; - p[1]=2; // NS - p[2]=0; - p[3]=1; // IN - putLong(p+4,ttl); - - p[8]=0; - p[9]=0; // need to fill this in + makeHeader(p,QType::NS,ttl); string piece3; string::size_type pos=server.find('@'); // chop off @ diff --git a/pdns/docs/pdns.sgml b/pdns/docs/pdns.sgml index 41ceab5489..827be45d75 100644 --- a/pdns/docs/pdns.sgml +++ b/pdns/docs/pdns.sgml @@ -11,7 +11,7 @@ - v2.1 $Date: 2003/01/21 15:04:02 $ + v2.1 $Date: 2003/01/23 15:34:53 $ @@ -96,6 +96,10 @@ for example. Cooperation between the both halves of PDNS is also almost seamless. As a result, 'non-lazy recursion' has been dropped. See for more details. + + Furthermore, the recursor only works on Linux and Solaris (probably, untested). FreeBSD does not support the required functions. + If you know any important FreeBSD people, plea with them to support set/get/swapcontext! + The 'Contributor of the Month' award goes to Mark Bergsma who has responded to our plea for help with the label compressor and contributed a wonderfully simple and right fix that allows PDNS to compress just as well as Other namerervers out there. An honorary mention goes to @@ -141,6 +145,11 @@ Yet more UltraSPARC alignment issues fixed (Chris Andrews). + + + Dropped non-lazy recursion, nobody was using it. + + Label compression was improved so we can now fit all . records in 436 bytes, this used to be 460! (Code & formal @@ -152,6 +161,13 @@ SRV support (incoming and outgoing), submitted by Ueli Heuer. + + + Generic backends do not support SOA serial autocalculation, it appears. Could lead to random SOA serials in case + of a serial of 0 in the database. Fixed so that 0 stays zero in that case. Don't set the SOA serial to 0 when using + Generic MySQL or Generic PostgreSQL! + + @@ -3238,11 +3254,11 @@ name IN A 1.2.3.4 mysql> CREATE TABLE records ( id int(11) NOT NULL auto_increment, - domain_id int(11) default NULL, - name varchar(255) default NULL, - type varchar(6) default NULL, + domain_id int(11) NOT NULL, + name varchar(255) NOT NULL, + type varchar(6) NOT NULL, content varchar(255) default NULL, - ttl int(11) default NULL, + ttl int(11) NOT NULL, prio int(11) default NULL, change_date int(11) default NULL, PRIMARY KEY (id), @@ -4012,118 +4028,121 @@ local0.err /var/log/pdns.err not proceed from the authoritative database. - PowerDNS resolver/recursing nameserver + + PowerDNS resolver/recursing nameserver + + As of 2.9.4, a small recursor comes with PowerDNS. The algorithm is influenced by the works of Dan J. Bernstein although + all mistakes are ours. Here are the current faults, so nobody can accuse us of false advertising: + + + Only ignores stale cache entries, does not actually clean them up. May replace them with newer data, however. + + + Only compiles on Linux and possibly Solaris. FreeBSD 4.x decided not to support the + POSIX get/set/swapcontext functions. Bug your favorite FreeBSD kernel or libc maintainer for a fix, + or ask him to port MTasker (see below) to your operating system. + + + It does not do TCP yet, and may have big problems with truncated packets. + + + + + To compile, add --enable-recursor to configure and the file pdns_recursor will be + compiled. To run on a different port, use ./syncres --local-port=53. + To bind to another address, use the local-address setting. + + + + + PowerDNS author bert hubert has the pdns recursor in production and browsing with it works for him. Furthermore, the LARTC + mailinglist (2000 subscribers) is using the pdns recursing nameserver. + + + + + Good points: + + + Uses MTasker (homepage) + + + Can handle thousands of concurrent questions + + + Code is written linearly, sequentially, which means that there are no problems with 'query restart' or anything. + + + Relies heavily on Standard C++ Library infrastructure, which makes for little code (406 core lines). + + + Is very verbose in showing how recursion actually works. + + + The algorithm is simple and quite nifty. + + + + pdns_recursor settings - As of 2.9.4, a small recursor comes with PowerDNS. The algorithm is influenced by the works of Dan J. Bernstein although - all mistakes are ours. Here are the current faults, so nobody can accuse us of false advertising: - - - Only ignores stale cache entries, does not actually clean them up. May replace them with newer data, however. - - - Only compiles on Linux and possibly Solaris. FreeBSD 4.x decided not to support the - POSIX get/set/swapcontext functions. Bug your favorite FreeBSD kernel or libc maintainer for a fix, - or ask him to port MTasker (see below) to your operating system. - - - It does not do TCP yet, and may have big problems with truncated packets. - - + At startup, the recursing nameserver reads the file recursor.conf from the configuration directory, + often /etc/powerdns or /usr/local/etc. - To compile, add --enable-recursor to configure and the file pdns_recursor will be - compiled. To run on a different port, use ./syncres --local-port=53. - To bind to another address, use the local-address setting. - + The following settings can be configured: + + + aaaa-additional-processing + + + If turned on, the recursor will attempt to add AAAA IPv6 records to questions for MX records and NS records. + Can be quite slow as absence of these records in earlier answers does not guarantee their non-existance. Can double + the amount of queries needed. Off by default. + + + + + daemon + + + Operate in the background, which is the default. + + + + + + local-address + + + Local IP address (singular) to bind to. Defaults to all addresses. + + + + + + local-port + + + Local port (singular) to bind to. Defaults to 53. + + + + + trace + + + If turned on, output impressive heaps of logging. May destroy performance under load. + + + + - - - PowerDNS author bert hubert has the pdns recursor in production and browsing with it works for him. Furthermore, the LARTC - mailinglist (2000 subscribers) is using the pdns recursing nameserver. - - - + + Statistics - Good points: - - - Uses MTasker (homepage) - - - Can handle thousands of concurrent questions - - - Code is written linearly, sequentially, which means that there are no problems with 'query restart' or anything. - - - Relies heavily on Standard C++ Library infrastructure, which makes for little code (406 core lines). - - - Is very verbose in showing how recursion actually works. - - - The algorithm is simple and quite nifty. - - + Every half our or so, the recursor outputs a line with statistics. More infrastructure is planned so as to allow + for Cricket or MRTG graphs. - pdns_recursor settings - - - - aaaa-additional-processing - - - If turned on, the recursor will attempt to add AAAA IPv6 records to questions for MX records and NS records. - Can be quite slow as absence of these records in earlier answers does not guarantee their non-existance. Can double - the amount of queries needed. - - - - - daemon - - - Operate in the background. - - - - - - local-address - - - Local IP address (singular) to bind to. - - - - - - local-port - - - Local port (singular) to bind to. Defaults to 5300! - - - - - local-port - - - Local port (singular) to bind to. Defaults to 5300! - - - - - trace - - - If turned on, output impressive heaps of logging. May destroy performance under load. - - - - - - Master/Slave operation & replication @@ -4978,6 +4997,30 @@ local0.err /var/log/pdns.err + + Q: Can I use a MySQL database with the Windows version of PowerDNS? + + + A: You can. MySQL support is supplied through the ODBC backend, which is compiled into the main binary. + So if you want to use MySQL you can change the pdns.conf file, which is located in the PowerDNS for Windows directory, to use the + correct ODBC data sources. + + If you don't know how to use ODBC with MySQL: + + + Download MyODBC from http://www.mysql.com/ + + + Install the MySQL ODBC driver. + + + Then you can follow the instructions located in . + But instead of selecting the Microsoft Access Driver you select the MySQL ODBC Driver and configure it to use your MySQL database. + + For other databases for which an ODBC driver is available, the procedure is the same as this example. + + + Backend developer HOWTO @@ -5540,11 +5583,11 @@ while(<>) CREATE TABLE records ( id int(11) NOT NULL auto_increment, - domain_id int(11) default NULL, - name varchar(255) default NULL, - type varchar(6) default NULL, - content varchar(255) default NULL, - ttl int(11) default NULL, + domain_id int(11) NOT NULL, + name varchar(255) NOT NULL, + type varchar(6) NOT NULL, + content varchar(255) NOT NULL, + ttl int(11) NOT NULL, prio int(11) default NULL, change_date int(11) default NULL, PRIMARY KEY (id), @@ -5764,7 +5807,7 @@ while(<>) MasterYes SlaveYes SuperslaveYes - AutoserialYes + AutoserialNO CaseAll lower Module name < 2.9.3pgmysql Module name > 2.9.2gmysql and gpgsql diff --git a/pdns/packethandler.cc b/pdns/packethandler.cc index f34ffbcbfa..0da42f29b1 100644 --- a/pdns/packethandler.cc +++ b/pdns/packethandler.cc @@ -33,7 +33,6 @@ #include "resolver.hh" #include "communicator.hh" #include "dnsproxy.hh" -#include "recbcomm.hh" extern StatBag S; extern PacketCache PC; @@ -149,7 +148,7 @@ int PacketHandler::doDNSCheckRequest(DNSPacket *p, DNSPacket *r, string &target) DNSResourceRecord rr; if (p->qclass == 3 && p->qtype.getName() == "HINFO") { - rr.content = "PowerDNS $Id: packethandler.cc,v 1.7 2003/01/21 10:42:34 ahu Exp $"; + rr.content = "PowerDNS $Id: packethandler.cc,v 1.8 2003/01/23 15:34:53 ahu Exp $"; rr.ttl = 5; rr.qname=target; rr.qtype=13; // hinfo @@ -165,7 +164,7 @@ int PacketHandler::doVersionRequest(DNSPacket *p, DNSPacket *r, string &target) { DNSResourceRecord rr; if(p->qtype.getCode()==QType::TXT && target=="version.bind") {// TXT - rr.content="Served by POWERDNS "VERSION" $Id: packethandler.cc,v 1.7 2003/01/21 10:42:34 ahu Exp $"; + rr.content="Served by POWERDNS "VERSION" $Id: packethandler.cc,v 1.8 2003/01/23 15:34:53 ahu Exp $"; rr.ttl=5; rr.qname=target; rr.qtype=QType::TXT; // TXT diff --git a/pdns/pdns_recursor.cc b/pdns/pdns_recursor.cc index d636978194..5402a6001c 100644 --- a/pdns/pdns_recursor.cc +++ b/pdns/pdns_recursor.cc @@ -23,6 +23,7 @@ #include #include #include +#include #include #include #include "mtasker.hh" @@ -49,18 +50,6 @@ ArgvMap &arg() int d_clientsock; int d_serversock; - -/* -Jan 20 00:21:40 [48570] new question arrived for 'idealx.com|MX' from 127.0.0.1 -Jan 20 00:21:40 [48571] new question arrived for 'idealx.com|MX' from 127.0.0.1 -Jan 20 00:21:40 [48572] new question arrived for 'idealx.com|MX' from 127.0.0.1 -Jan 20 00:21:40 [48573] new question arrived for 'idealx.com|MX' from 127.0.0.1 -Jan 20 00:21:44 [48573] sent answer to question for 'idealx.com|MX' to 127.0.0.1, 0 answers, 0 additional, sent 2 packets, rcode=2 -Jan 20 00:21:44 [48573] sent answer to question for 'idealx.com|MX' to 127.0.0.1, 0 answers, 0 additional, sent 2 packets, rcode=2 -Jan 20 00:21:44 [48573] sent answer to question for 'idealx.com|MX' to 127.0.0.1, 0 answers, 0 additional, sent 2 packets, rcode=2 -Jan 20 00:21:44 [48573] sent answer to question for 'idealx.com|MX' to 127.0.0.1, 0 answers, 0 additional, sent 2 packets, rcode=2 -*/ - struct PacketID { u_int16_t id; @@ -83,7 +72,7 @@ bool operator<(const PacketID& a, const PacketID& b) return false; } -MTasker MT(200000); +MTasker MT(100000); // could probably be way lower /* these two functions are used by LWRes */ int asendto(const char *data, int len, int flags, struct sockaddr *toaddr, int addrlen, int id) @@ -108,7 +97,6 @@ int arecvfrom(char *data, int len, int flags, struct sockaddr *toaddr, socklen_t return 1; } - typedef map > cache_t; cache_t cache; int cacheHits, cacheMisses; @@ -118,10 +106,10 @@ int getCache(const string &qname, const QType& qt, set* res) if(j!=cache.end() && j->first==toLower(qname)+"|"+qt.getName() && j->second.begin()->ttl>(unsigned int)time(0)) { if(res) *res=j->second; - cacheHits++; + return (unsigned int)j->second.begin()->ttl-time(0); } - cacheMisses++; + return -1; } @@ -138,7 +126,7 @@ void init(void) // prime root cache static char*ips[]={"198.41.0.4", "128.9.0.107", "192.33.4.12", "128.8.10.90", "192.203.230.10", "192.5.5.241", "192.112.36.4", "128.63.2.53", - "192.36.148.17","198.41.0.10", "193.0.14.129", "198.32.64.12", "202.12.27.33"}; + "192.36.148.17","192.58.128.30", "193.0.14.129", "198.32.64.12", "202.12.27.33"}; DNSResourceRecord arr, nsrr; arr.qtype=QType::A; arr.ttl=time(0)+3600000; @@ -164,6 +152,7 @@ void init(void) void startDoResolve(void *p) { try { + bool quiet=arg().mustDo("quiet"); DNSPacket P=*(DNSPacket *)p; delete (DNSPacket *)p; @@ -174,7 +163,9 @@ void startDoResolve(void *p) R->setRA(true); SyncRes sr; - L<getData(); sendto(d_serversock,buffer,R->len,0,(struct sockaddr *)(R->remote),R->d_socklen); - L<d.ancount)<<" answers, "<d.arcount)<<" additional, took "<d.ancount)<<" answers, "<d.arcount)<<" additional, took "<1800) { - if(qcounter) { - L<1800) { + doStats(); last_stat=time(0); } if(time(0)-last_rootupdate>7200) { @@ -307,13 +313,24 @@ int main(int argc, char **argv) arg().set("soa-minimum-ttl","Don't change")="0"; arg().set("soa-serial-offset","Don't change")="0"; arg().set("aaaa-additional-processing","turn on to do AAAA additional processing (slow)")="off"; - arg().set("local-port","port to listen on")="5300"; + arg().set("local-port","port to listen on")="53"; arg().set("local-address","port to listen on")="0.0.0.0"; arg().set("trace","if we should output heaps of logging")="off"; - arg().set("daemon","Operate as a daemon")="no"; + arg().set("daemon","Operate as a daemon")="yes"; + arg().set("quiet","Suppress logging of questions and answers")="off"; + arg().set("config-dir","Location of configuration directory (recursor.conf)")=SYSCONFDIR; arg().setCmd("help","Provide a helpful message"); + L.toConsole(Logger::Warning); + arg().laxParse(argc,argv); // do a lax parse + + string configname=arg()["config-dir"]+"/recursor.conf"; + cleanSlashes(configname); + + if(!arg().file(configname.c_str())) + L< s_negcache; private: struct GetBestNSAnswer; int doResolveAt(set nameservers, string auth, const string &qname, const QType &qtype, vector&ret, @@ -54,14 +54,14 @@ private: vector shuffle(set &nameservers); bool moreSpecificThan(const string& a, const string &b); string getA(const string &qname, int depth, set& beenthere); - + private: string d_prefix; static bool s_log; bool d_cacheonly; bool d_nocache; LWRes d_lwr; - static map s_negcache; + struct GetBestNSAnswer { string qname;