fix for one crash! Re: [Pdns-users] 2.8 / 2.9 signal 11 problem

bert hubert ahu at ds9a.nl
Wed May 14 19:11:25 UTC 2003


On Wed, May 14, 2003 at 09:16:55AM +0200, Roeland Buisman wrote:
> I have kind of the following problem, but i'm using Pdsn 2.8 and 2.9
> 
> on one of the 3 nameservers suddenly pdns does not work anymore. They did
> work all 3 for 10 days, then i received the following error, when starting/
> monitoring pdns:

I've fixed this - this problem has existed for a loooong time!

Index: packethandler.cc
===================================================================
RCS file: /var/cvsroot/pdns/pdns/packethandler.cc,v
retrieving revision 1.14
diff -u -B -b -r1.14 packethandler.cc
--- packethandler.cc	5 Apr 2003 19:31:52 -0000	1.14
+++ packethandler.cc	14 May 2003 19:07:46 -0000
@@ -304,24 +304,32 @@
     DLOG(L<<Logger::Warning<<"This packet needs additional processing!"<<endl);
 
     vector<DNSResourceRecord *> arrs=r->getAPRecords();
+    vector<DNSResourceRecord> crrs;
+
     for(vector<DNSResourceRecord *>::const_iterator i=arrs.begin();
-	i!=arrs.end();
+	i!=arrs.end();	++i) 
+      crrs.push_back(**i);
+
+    // we now have a copy, push_back on packet might reallocate!
+
+    for(vector<DNSResourceRecord>::const_iterator i=crrs.begin();
+	i!=crrs.end();
 	++i) {
       
-      if((*i)->qtype.getCode()==QType::NS && !B.getSOA((*i)->qname,sd)) { // drop AA in case of non-SOA-level NS answer
+      if(i->qtype.getCode()==QType::NS && !B.getSOA(i->qname,sd)) { // drop AA in case of non-SOA-level NS answer
 	r->d.aa=false;
-	(*i)->d_place=DNSResourceRecord::AUTHORITY;
+	//	i->d_place=DNSResourceRecord::AUTHORITY; // XXX FIXME
       }
 
       QType qtypes[2];
       qtypes[0]="A"; qtypes[1]="AAAA";
       for(int n=0;n < d_doIPv6AdditionalProcessing + 1; ++n) {
-	B.lookup(qtypes[n],(*i)->content,p);  
+	B.lookup(qtypes[n],i->content,p);  
 	bool foundOne=false;
 	while(B.get(rr)) {
 	  foundOne=true;
-	  if(rr.domain_id!=(*i)->domain_id && arg()["out-of-zone-additional-processing"]=="no") {
-	    DLOG(L<<Logger::Warning<<"Not including out-of-zone additional processing of "<<(*i)->qname<<" ("<<rr.qname<<")"<<endl);
+	  if(rr.domain_id!=i->domain_id && arg()["out-of-zone-additional-processing"]=="no") {
+	    DLOG(L<<Logger::Warning<<"Not including out-of-zone additional processing of "<<i->qname<<" ("<<rr.qname<<")"<<endl);
 	    continue; // not adding out-of-zone additional data
 	  }
 	  
@@ -333,7 +341,7 @@
 	  if(d_doRecursion && DP->recurseFor(p)) {
 	    try {
 	      Resolver resolver;
-	      resolver.resolve(arg()["recursor"],(*i)->content.c_str(),QType::A);
+	      resolver.resolve(arg()["recursor"],i->content.c_str(),QType::A);
 	      Resolver::res_t res=resolver.result();
 	      for(Resolver::res_t::const_iterator j=res.begin();j!=res.end();++j) {
 		if(j->d_place==DNSResourceRecord::ANSWER) {
@@ -791,6 +799,9 @@
 
     if(doAdditionalProcessingAndDropAA(p,r)<0)
       return 0;
+    
+
+    
     
 
     r->wrapup(); // needed for inserting in cache



-- 
http://www.PowerDNS.com      Open source, database driven DNS Software 
http://lartc.org           Linux Advanced Routing & Traffic Control HOWTO


More information about the Pdns-users mailing list