[-]
[+]
|
Changed |
pdns-recursor.changes
|
|
[-]
[+]
|
Changed |
pdns-recursor.spec
^
|
|
[-]
[+]
|
Changed |
pdns-recursor-3.3.1.tar.bz2/config.h
^
|
@@ -1,4 +1,4 @@
#define SYSCONFDIR "/etc/powerdns/"
#define LOCALSTATEDIR "/var/run/"
-#define VERSION "3.3"
+#define VERSION "3.3.1"
#define RECURSOR
|
[-]
[+]
|
Changed |
pdns-recursor-3.3.1.tar.bz2/dns.cc
^
|
@@ -48,7 +48,7 @@
//! compares two dns packets, skipping the header, but including the question and the qtype
bool dnspacketLessThan(const std::string& a, const std::string& b)
{
- if(a.length() < 12 || b.length() < 12)
+ if(a.length() <= 12 || b.length() <= 12)
return a.length() < b.length();
// throw runtime_error("Error parsing question in dnspacket comparison: packet too short");
|
[-]
[+]
|
Changed |
pdns-recursor-3.3.1.tar.bz2/dnsparser.cc
^
|
@@ -317,7 +317,7 @@
void PacketReader::copyRecord(unsigned char* dest, uint16_t len)
{
if(d_pos + len > d_content.size())
- throw MOADNSException("Attempt to copy outside of packet");
+ throw out_of_range("Attempt to copy outside of packet");
memcpy(dest, &d_content.at(d_pos), len);
d_pos+=len;
@@ -574,7 +574,7 @@
{
d_notyouroffset += by;
if(d_notyouroffset > d_packet.length())
- throw range_error("dns packet out of range: "+lexical_cast<string>(d_notyouroffset) +" > "
+ throw out_of_range("dns packet out of range: "+lexical_cast<string>(d_notyouroffset) +" > "
+ lexical_cast<string>(d_packet.length()) );
}
std::string& d_packet;
|
[-]
[+]
|
Changed |
pdns-recursor-3.3.1.tar.bz2/misc.cc
^
|
@@ -672,12 +672,19 @@
hints.ai_family = AF_INET6;
hints.ai_flags = AI_NUMERICHOST;
- if(getaddrinfo(addr.c_str(), 0, &hints, &res) < 0) {
- perror("getaddrinfo");
+ int error;
+ if((error=getaddrinfo(addr.c_str(), 0, &hints, &res))) {
+ /*
+ cerr<<"Error translating IPv6 address '"<<addr<<"': ";
+ if(error==EAI_SYSTEM)
+ cerr<<strerror(errno)<<endl;
+ else
+ cerr<<gai_strerror(error)<<endl;
+ */
return -1;
}
- memcpy(ret, res->ai_addr, sizeof(*ret));
+ memcpy(ret, res->ai_addr, res->ai_addrlen);
freeaddrinfo(res);
return 0;
|
[-]
[+]
|
Changed |
pdns-recursor-3.3.1.tar.bz2/mtasker.cc
^
|
@@ -192,6 +192,9 @@
if(val && d_waitstatus==Answer)
*val=d_waitval;
d_tid=w.tid;
+ if((char*)&w < d_threads[d_tid].highestStackSeen) {
+ d_threads[d_tid].highestStackSeen = (char*)&w;
+ }
key=d_eventkey;
return d_waitstatus;
}
@@ -202,7 +205,7 @@
template<class Key, class Val>void MTasker<Key,Val>::yield()
{
d_runQueue.push(d_tid);
- if(swapcontext(d_threads[d_tid] ,&d_kernel) < 0) { // give control to the kernel
+ if(swapcontext(d_threads[d_tid].context ,&d_kernel) < 0) { // give control to the kernel
perror("swapcontext in yield");
exit(EXIT_FAILURE);
}
@@ -271,7 +274,7 @@
makecontext (uc, (void (*)(void))threadWrapper, 6, thispair.first, thispair.second, start, d_maxtid, valpair.first, valpair.second);
- d_threads[d_maxtid]=uc;
+ d_threads[d_maxtid].context = uc;
d_runQueue.push(d_maxtid++); // will run at next schedule invocation
}
@@ -290,7 +293,7 @@
{
if(!d_runQueue.empty()) {
d_tid=d_runQueue.front();
- if(swapcontext(&d_kernel, d_threads[d_tid])) {
+ if(swapcontext(&d_kernel, d_threads[d_tid].context)) {
perror("swapcontext in schedule");
exit(EXIT_FAILURE);
}
@@ -299,8 +302,8 @@
return true;
}
if(!d_zombiesQueue.empty()) {
- delete[] (char *)d_threads[d_zombiesQueue.front()]->uc_stack.ss_sp;
- delete d_threads[d_zombiesQueue.front()];
+ delete[] (char *)d_threads[d_zombiesQueue.front()].context->uc_stack.ss_sp;
+ delete d_threads[d_zombiesQueue.front()].context;
d_threads.erase(d_zombiesQueue.front());
d_zombiesQueue.pop();
return true;
@@ -369,11 +372,11 @@
}
}
-
template<class Key, class Val>void MTasker<Key,Val>::threadWrapper(uint32_t self1, uint32_t self2, tfunc_t *tf, int tid, uint32_t val1, uint32_t val2)
{
void* val = joinPtr(val1, val2);
MTasker* self = (MTasker*) joinPtr(self1, self2);
+ self->d_threads[self->d_tid].startOfStack = self->d_threads[self->d_tid].highestStackSeen = (char*)&val;
(*tf)(val);
self->d_zombiesQueue.push(tid);
@@ -388,3 +391,10 @@
{
return d_tid;
}
+
+
+//! Returns the maximum stack usage so far of this MThread
+template<class Key, class Val>unsigned int MTasker<Key,Val>::getMaxStackUsage()
+{
+ return d_threads[d_tid].startOfStack - d_threads[d_tid].highestStackSeen;
+}
|
[-]
[+]
|
Changed |
pdns-recursor-3.3.1.tar.bz2/mtasker.hh
^
|
@@ -50,8 +50,14 @@
std::queue<int> d_runQueue;
std::queue<int> d_zombiesQueue;
+ struct ThreadInfo
+ {
+ ucontext_t* context;
+ char* startOfStack;
+ char* highestStackSeen;
+ };
- typedef std::map<int, ucontext_t*> mthreads_t;
+ typedef std::map<int, ThreadInfo> mthreads_t;
mthreads_t d_threads;
int d_tid;
int d_maxtid;
@@ -66,7 +72,7 @@
EventKey key;
ucontext_t *context;
struct timeval ttd;
- int tid;
+ int tid;
};
typedef multi_index_container<
@@ -99,6 +105,7 @@
bool noProcesses();
unsigned int numProcesses();
int getTid();
+ unsigned int getMaxStackUsage();
private:
static void threadWrapper(uint32_t self1, uint32_t self2, tfunc_t *tf, int tid, uint32_t val1, uint32_t val2);
|
[-]
[+]
|
Changed |
pdns-recursor-3.3.1.tar.bz2/pdns_recursor.1
^
|
@@ -1,73 +1,53 @@
-'\" t
.\" Title: pdns_recursor
-.\" Author: [see the "AUTHOR" section]
-.\" Generator: DocBook XSL Stylesheets v1.75.1 <http://docbook.sf.net/>
-.\" Date: 02/10/2010
-.\" Manual: [FIXME: manual]
-.\" Source: [FIXME: source]
-.\" Language: English
+.\" Author:
+.\" Generator: DocBook XSL Stylesheets v1.72.0 <http://docbook.sf.net/>
+.\" Date: 03/22/2008
+.\" Manual:
+.\" Source:
.\"
-.TH "PDNS_RECURSOR" "1" "02/10/2010" "[FIXME: source]" "[FIXME: manual]"
-.\" -----------------------------------------------------------------
-.\" * set default formatting
-.\" -----------------------------------------------------------------
+.TH "PDNS_RECURSOR" "1" "03/22/2008" "" ""
.\" disable hyphenation
.nh
.\" disable justification (adjust text to left margin only)
.ad l
-.\" -----------------------------------------------------------------
-.\" * MAIN CONTENT STARTS HERE *
-.\" -----------------------------------------------------------------
.SH "NAME"
pdns_recursor \- high\-performance, simple and secure recursing nameserver
.SH "SYNOPSIS"
-.sp
\fIpdns_recursor\fR [\-\-daemon] [\-\-local\-address] [\-\-help, \-h] [\-\-allow\-from]
+.sp
.SH "DESCRIPTION"
+pdns_recursor(1) is a high performance, simple and secure recursing nameserver. It currently powers over two million internet connections.
.sp
-pdns_recursor(1) is a high performance, simple and secure recursing nameserver\&. It currently powers over two million internet connections\&.
+The recursor is configured via a configuration file, but each item in that file can be overridden on the command line.
.sp
-The recursor is configured via a configuration file, but each item in that file can be overridden on the command line\&.
+This manpage lists the core set of features needed to get the PowerDNS recursor working, for full and up to date details head to http://doc.powerdns.com/built\-in\-recursor.html
.sp
-This manpage lists the core set of features needed to get the PowerDNS recursor working, for full and up to date details head to \m[blue]\fBhttp://doc\&.powerdns\&.com/built\-in\-recursor\&.html\fR\m[]
.SH "EXAMPLES"
+To listen on 1.2.3.4 and allow the 1.2.3.0/8 subnet to recurse, and run as a daemon, execute:
.sp
-To listen on 1\&.2\&.3\&.4 and allow the 1\&.2\&.3\&.0/8 subnet to recurse, and run as a daemon, execute:
.sp
-.if n \{\
.RS 4
-.\}
.nf
-# pdns_recursor \-\-local\-address=1\&.2\&.3\&.4 \-\-allow\-from=1\&.2\&.3\&.0/8 \-\-daemon
+# pdns_recursor \-\-local\-address=1.2.3.4 \-\-allow\-from=1.2.3.0/8 \-\-daemon
.fi
-.if n \{\
.RE
-.\}
-.sp
To stop the recursor by hand, run:
.sp
-.if n \{\
+.sp
.RS 4
-.\}
.nf
# rec_control quit
.fi
-.if n \{\
.RE
-.\}
.sp
-.if n \{\
.RS 4
-.\}
.nf
-Alternatively, use the init\&.d script provided\&.
+Alternatively, use the init.d script provided.
.fi
-.if n \{\
.RE
-.\}
.SH "OPTIONS"
+For authoritative listing of options, consult the documentation referenced above.
.sp
-For authoritative listing of options, consult the documentation referenced above\&.
.PP
\-\-aaaa\-additional\-processing
.RS 4
@@ -81,17 +61,17 @@
.PP
\-\-auth\-can\-lower\-ttl
.RS 4
-Authoritative zones can transmit a TTL value that is lower than that specified in the parent zone\&. This is called a
-\fIdelegation inconsistency\fR\&. To follow RFC 2181 paragraphs 5\&.2 and 5\&.4 to the letter, enable this feature\&. This will mean a slight deterioration of performance, and it will not solve any problems, but does make the recursor more standards compliant\&. Not recommended unless you have to tick an
+Authoritative zones can transmit a TTL value that is lower than that specified in the parent zone. This is called a
+\fIdelegation inconsistency\fR. To follow RFC 2181 paragraphs 5.2 and 5.4 to the letter, enable this feature. This will mean a slight deterioration of performance, and it will not solve any problems, but does make the recursor more standards compliant. Not recommended unless you have to tick an
\fIRFC 2181 compliant\fR
-box\&. Off by default\&.
+box. Off by default.
.RE
.PP
\-\-auth\-zones
.RS 4
Comma separated list of
\fIzonename=filename\fR
-pairs\&. Zones read from these files are served authoritatively\&. Example: auth\-zones= ds9a\&.nl=/var/zones/ds9a\&.nl, powerdns\&.com=/var/zones/powerdns\&.com\&. Available since 3\&.1\&.
+pairs. Zones read from these files are served authoritatively. Example: auth\-zones= ds9a.nl=/var/zones/ds9a.nl, powerdns.com=/var/zones/powerdns.com. Available since 3.1.
.RE
.PP
\-\-chroot
@@ -106,7 +86,7 @@
.PP
\-\-config\-dir
.RS 4
-Location of configuration directory (recursor\&.conf)
+Location of configuration directory (recursor.conf)
.RE
.PP
\-\-daemon
@@ -121,12 +101,12 @@
.PP
\-\-entropy\-source
.RS 4
-Where to read new entropy from, defaults to /dev/urandom\&.
+Where to read new entropy from, defaults to /dev/urandom.
.RE
.PP
\-\-export\-etc\-hosts
.RS 4
-If set, this flag will export the host names and IP addresses mentioned in /etc/hosts\&. Available since 3\&.1\&.
+If set, this flag will export the host names and IP addresses mentioned in /etc/hosts. Available since 3.1.
.RE
.PP
\-\-fork
@@ -138,12 +118,12 @@
.RS 4
Comma separated list of
\fIzonename=IP\fR
-pairs\&. Queries for zones listed here will be forwarded to the IP address listed\&. forward\-zones= ds9a\&.nl=213\&.244\&.168\&.210, powerdns\&.com=127\&.0\&.0\&.1\&. Available since 3\&.1\&. For more details, see the manual\&.
+pairs. Queries for zones listed here will be forwarded to the IP address listed. forward\-zones= ds9a.nl=213.244.168.210, powerdns.com=127.0.0.1. Available since 3.1. For more details, see the manual.
.RE
.PP
\-\-forward\-zones\-file
.RS 4
-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\&. For more details, see the manual\&.
+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. For more details, see the manual.
.RE
.PP
\-\-hint\-file
@@ -193,8 +173,8 @@
.PP
\-\-query\-local\-address6
.RS 4
-Send out local IPv6 queries from this address\&. Disabled by default, which also disables outgoing IPv6 support\&. A useful setting is
-\fI::0\fR\&.
+Send out local IPv6 queries from this address. Disabled by default, which also disables outgoing IPv6 support. A useful setting is
+\fI::0\fR.
.RE
.PP
\-\-quiet
@@ -210,13 +190,13 @@
\-\-server\-id
.RS 4
Returned when queried for
-\fIserver\&.id\fR
+\fIserver.id\fR
TXT, defaults to hostname
.RE
.PP
\-\-serve\-rfc1918
.RS 4
-On by default, this makes the server authoritatively aware of: 10\&.in\-addr\&.arpa, 168\&.192\&.in\-addr\&.arpa and 16\-31\&.172\&.in\-addr\&.arpa, which saves load on the AS112 servers\&. Individual parts of these zones can still be loaded or forwarded\&.
+On by default, this makes the server authoritatively aware of: 10.in\-addr.arpa, 168.192.in\-addr.arpa and 16\-31.172.in\-addr.arpa, which saves load on the AS112 servers. Individual parts of these zones can still be loaded or forwarded.
.RE
.PP
\-\-setgid
@@ -251,26 +231,20 @@
.PP
\-\-version\-string
.RS 4
-string reported on version\&.pdns or version\&.bind
+string reported on version.pdns or version.bind
.RE
.SH "BUGS"
+None known. File new ones at http://wiki.powerdns.com.
.sp
-None known\&. File new ones at \m[blue]\fBhttp://wiki\&.powerdns\&.com\fR\m[]\&.
.SH "AUTHOR"
+Written by PowerDNS.COM BV, bert hubert, <bert.hubert@netherlabs.nl>
.sp
-Written by PowerDNS\&.COM BV, bert hubert, <\m[blue]\fBbert\&.hubert@netherlabs\&.nl\fR\m[]\&\s-2\u[1]\d\s+2>
.SH "RESOURCES"
+Website: http://wiki.powerdns.com, http://www.powerdns.com
.sp
-Website: \m[blue]\fBhttp://wiki\&.powerdns\&.com\fR\m[], \m[blue]\fBhttp://www\&.powerdns\&.com\fR\m[]
.SH "SEE ALSO"
-.sp
rec_control(1)
+.sp
.SH "COPYING"
+Copyright \(co 2006 PowerDNS.COM BV. Free use of this software is granted under the terms of the GNU General Public License (GPL) version 2.
.sp
-Copyright \(co 2006 PowerDNS\&.COM BV\&. Free use of this software is granted under the terms of the GNU General Public License (GPL) version 2\&.
-.SH "NOTES"
-.IP " 1." 4
-bert.hubert@netherlabs.nl
-.RS 4
-\%mailto:bert.hubert@netherlabs.nl
-.RE
|
[-]
[+]
|
Changed |
pdns-recursor-3.3.1.tar.bz2/pdns_recursor.cc
^
|
@@ -653,6 +653,8 @@
catch(...) {
L<<Logger::Error<<"Any other exception in a resolver context"<<endl;
}
+
+ g_stats.maxMThreadStackUsage = max(MT->getMaxStackUsage(), g_stats.maxMThreadStackUsage);
}
void makeControlChannelSocket()
@@ -1965,7 +1967,7 @@
::arg().set("packetcache-servfail-ttl", "maximum number of seconds to keep a cached servfail entry in packetcache")="60";
::arg().set("server-id", "Returned when queried for 'server.id' TXT or NSID, defaults to hostname")="";
::arg().set("remotes-ringbuffer-entries", "maximum number of packets to store statistics for")="0";
- ::arg().set("version-string", "string reported on version.pdns or version.bind")="PowerDNS Recursor "VERSION" $Id: pdns_recursor.cc 1712 2010-09-11 13:40:03Z ahu $";
+ ::arg().set("version-string", "string reported on version.pdns or version.bind")="PowerDNS Recursor "VERSION" $Id: pdns_recursor.cc 1745 2010-12-01 15:55:46Z ahu $";
::arg().set("allow-from", "If set, only allow these comma separated netmasks to recurse")=LOCAL_NETS;
::arg().set("allow-from-file", "If set, load allowed netmasks from this file")="";
::arg().set("entropy-source", "If set, read entropy from this file")="/dev/urandom";
|
[-]
[+]
|
Changed |
pdns-recursor-3.3.1.tar.bz2/rec_channel_rec.cc
^
|
@@ -298,11 +298,22 @@
return new uint64_t(t_RC->size());
}
+uint64_t* pleaseGetCacheBytes()
+{
+ return new uint64_t(t_RC->bytes());
+}
+
+
uint64_t doGetCacheSize()
{
return broadcastAccFunction<uint64_t>(pleaseGetCacheSize);
}
+uint64_t doGetCacheBytes()
+{
+ return broadcastAccFunction<uint64_t>(pleaseGetCacheBytes);
+}
+
uint64_t* pleaseGetCacheHits()
{
return new uint64_t(t_RC->cacheHits);
@@ -324,18 +335,28 @@
}
-
-
uint64_t* pleaseGetPacketCacheSize()
{
return new uint64_t(t_packetCache->size());
}
+uint64_t* pleaseGetPacketCacheBytes()
+{
+ return new uint64_t(t_packetCache->bytes());
+}
+
+
uint64_t doGetPacketCacheSize()
{
return broadcastAccFunction<uint64_t>(pleaseGetPacketCacheSize);
}
+uint64_t doGetPacketCacheBytes()
+{
+ return broadcastAccFunction<uint64_t>(pleaseGetPacketCacheBytes);
+}
+
+
uint64_t* pleaseGetPacketCacheHits()
{
return new uint64_t(t_packetCache->d_hits);
@@ -356,6 +377,13 @@
return broadcastAccFunction<uint64_t>(pleaseGetPacketCacheMisses);
}
+uint64_t doGetMallocated()
+{
+ // this turned out to be broken
+/* struct mallinfo mi = mallinfo();
+ return mi.uordblks; */
+ return 0;
+}
RecursorControlParser::RecursorControlParser()
{
@@ -365,12 +393,14 @@
addGetStat("cache-hits", doGetCacheHits);
addGetStat("cache-misses", doGetCacheMisses);
addGetStat("cache-entries", doGetCacheSize);
+ addGetStat("cache-bytes", doGetCacheBytes);
addGetStat("packetcache-hits", doGetPacketCacheHits);
addGetStat("packetcache-misses", doGetPacketCacheMisses);
addGetStat("packetcache-entries", doGetPacketCacheSize);
+ addGetStat("packetcache-bytes", doGetPacketCacheBytes);
-
+ addGetStat("malloc-bytes", doGetMallocated);
addGetStat("servfail-answers", &g_stats.servFails);
addGetStat("nxdomain-answers", &g_stats.nxDomains);
@@ -400,6 +430,7 @@
addGetStat("over-capacity-drops", &g_stats.overCapacityDrops);
addGetStat("no-packet-error", &g_stats.noPacketError);
addGetStat("dlg-only-drops", &SyncRes::s_nodelegated);
+ addGetStat("max-mthread-stack", &g_stats.maxMThreadStackUsage);
addGetStat("negcache-entries", boost::bind(getNegCacheSize));
addGetStat("throttle-entries", boost::bind(getThrottleSize));
@@ -455,6 +486,8 @@
static void doExitNicely()
{
+ //extern void printCallers();
+ // printCallers();
doExitGeneric(true);
}
@@ -529,8 +562,7 @@
if(cmd=="quit-nicely") {
*command=&doExitNicely;
return "bye nicely\n";
- }
-
+ }
if(cmd=="dump-cache")
return doDumpCache(begin, end);
@@ -576,6 +608,6 @@
if(cmd=="reload-zones") {
return reloadAuthAndForwards();
}
-
+
return "Unknown command '"+cmd+"'\n";
}
|
[-]
[+]
|
Changed |
pdns-recursor-3.3.1.tar.bz2/rec_control.1
^
|
@@ -2,12 +2,12 @@
.\" Title: rec_control
.\" Author: [see the "AUTHOR" section]
.\" Generator: DocBook XSL Stylesheets v1.75.1 <http://docbook.sf.net/>
-.\" Date: 08/30/2010
+.\" Date: 08/05/2010
.\" Manual: [FIXME: manual]
.\" Source: [FIXME: source]
.\" Language: English
.\"
-.TH "REC_CONTROL" "1" "08/30/2010" "[FIXME: source]" "[FIXME: manual]"
+.TH "REC_CONTROL" "1" "08/05/2010" "[FIXME: source]" "[FIXME: manual]"
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
|
[-]
[+]
|
Changed |
pdns-recursor-3.3.1.tar.bz2/recpacketcache.cc
^
|
@@ -1,4 +1,5 @@
#include <iostream>
+#include <boost/foreach.hpp>
#include "recpacketcache.hh"
#include "cachecleaner.hh"
#include "dns.hh"
@@ -62,6 +63,16 @@
return d_packetCache.size();
}
+uint64_t RecursorPacketCache::bytes()
+{
+ uint64_t sum=0;
+ BOOST_FOREACH(const struct Entry& e, d_packetCache) {
+ sum += sizeof(e) + e.d_packet.length() + 4;
+ }
+ return sum;
+}
+
+
void RecursorPacketCache::doPruneTo(unsigned int maxCached)
{
pruneCollection(d_packetCache, maxCached);
|
[-]
[+]
|
Changed |
pdns-recursor-3.3.1.tar.bz2/recpacketcache.hh
^
|
@@ -26,6 +26,7 @@
void prune();
uint64_t d_hits, d_misses;
uint64_t size();
+ uint64_t bytes();
private:
|
[-]
[+]
|
Changed |
pdns-recursor-3.3.1.tar.bz2/recursor_cache.cc
^
|
@@ -95,6 +95,7 @@
unsigned int ret=0;
for(cache_t::const_iterator i=d_cache.begin(); i!=d_cache.end(); ++i) {
+ ret+=sizeof(struct CacheEntry);
ret+=(unsigned int)i->d_qname.length();
for(vector<StoredRecord>::const_iterator j=i->d_records.begin(); j!= i->d_records.end(); ++j)
ret+=j->size();
|
[-]
[+]
|
Changed |
pdns-recursor-3.3.1.tar.bz2/recursor_cache.hh
^
|
@@ -57,7 +57,7 @@
unsigned int size() const
{
- return ( unsigned int ) 4+d_string.size();
+ return sizeof(*this) + d_string.size();
}
};
|
[-]
[+]
|
Changed |
pdns-recursor-3.3.1.tar.bz2/syncres.hh
^
|
@@ -477,6 +477,7 @@
uint64_t packetCacheHits;
uint64_t noPacketError;
time_t startupTime;
+ unsigned int maxMThreadStackUsage;
};
//! represents a running TCP/IP client session
|