From: Bert Hubert Date: Mon, 19 Feb 2007 21:04:32 +0000 (+0000) Subject: implement 'forward-zones-file' for large amounts of forwarded zones, remove TSC manip... X-Git-Tag: pdns-2.9.21~82 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=4b8b58e1b9b2479aa0a84959ae58f432cb45b097;p=pdns implement 'forward-zones-file' for large amounts of forwarded zones, remove TSC manipulation code from default compilation, disable speedups that sometimes caused problems git-svn-id: svn://svn.powerdns.com/pdns/trunk/pdns@963 d19b8d6e-7fed-0310-83ef-9ca221ded41b --- diff --git a/pdns/docs/pdns.sgml b/pdns/docs/pdns.sgml index 3d2d2986a..2ca238aad 100644 --- a/pdns/docs/pdns.sgml +++ b/pdns/docs/pdns.sgml @@ -6844,6 +6844,15 @@ local0.err /var/log/pdns.err + + forward-zones-file + + + Same as forward-zones, parsed from a file. Only 1 zone is allowed per line, specified as follows: + ds9a.nl=213.244.168.210. Available since 3.1.5. + + + hint-file diff --git a/pdns/docs/pdns_recursor.1.txt b/pdns/docs/pdns_recursor.1.txt index 5b33f6ff2..66ffed482 100644 --- a/pdns/docs/pdns_recursor.1.txt +++ b/pdns/docs/pdns_recursor.1.txt @@ -89,6 +89,11 @@ For authoritative listing of options, consult the documentation referenced above auth-zones= ds9a.nl=213.244.168.210, powerdns.com=127.0.0.1. Available since 3.1. +--forward-zones-file:: + listed here will be forwarded to the IP address listed. + One zone per line, like: ds9a.nl=213.244.168.210 + Available since 3.1.5 + --hint-file:: If set, load root hints from this file diff --git a/pdns/misc.hh b/pdns/misc.hh index 2ee9dcfa8..f7a2b66bc 100644 --- a/pdns/misc.hh +++ b/pdns/misc.hh @@ -19,7 +19,7 @@ #ifndef MISC_HH #define MISC_HH -#if 1 +#if 0 #define RDTSC(qp) \ do { \ unsigned long lowPart, highPart; \ diff --git a/pdns/pdns_recursor.cc b/pdns/pdns_recursor.cc index 82c7ce8d1..648453703 100644 --- a/pdns/pdns_recursor.cc +++ b/pdns/pdns_recursor.cc @@ -819,10 +819,10 @@ void handleNewUDPQuestion(int fd, boost::any& var) char data[1500]; ComboAddress fromaddr; socklen_t addrlen=sizeof(fromaddr); - uint64_t tsc1, tsc2; + // uint64_t tsc1, tsc2; if((len=recvfrom(fd, data, sizeof(data), 0, (sockaddr *)&fromaddr, &addrlen)) >= 0) { - RDTSC(tsc1); + // RDTSC(tsc1); g_stats.addRemote(fromaddr); if(g_allowFrom && !g_allowFrom->match(&fromaddr)) { @@ -841,6 +841,7 @@ void handleNewUDPQuestion(int fd, boost::any& var) } else { ++g_stats.qcounter; +#if 0 uint16_t type; char qname[256]; try { @@ -892,6 +893,7 @@ void handleNewUDPQuestion(int fd, boost::any& var) g_stats.noShuntWrongQuestion++; } slow: +#endif DNSComboWriter* dc = new DNSComboWriter(data, len, g_now); dc->setSocket(fd); dc->setRemote(&fromaddr); @@ -1481,6 +1483,37 @@ void parseAuthAndForwards() } } + if(!::arg()["forward-zones-file"].empty()) { + L< fp=shared_ptr(rfp, fclose); + + char line[1024]; + vector parts; + int linenum=0; + uint64_t before = SyncRes::s_domainmap.size(); + while(linenum++, fgets(line, sizeof(line)-1, fp.get())) { + parts.clear(); + stringtok(parts,line,"=, "); + if(parts.empty()) + continue; + if(parts.size()<2) + throw AhuException("Error parsing line "+lexical_cast(linenum)+" of " +::arg()["forward-zones-file"]); + trim(parts[0]); + trim(parts[1]); + parts[0]=toCanonic("", parts[0]); + ad.d_server=parts[1]; + // cerr<<"Inserting '"<