Generic PostgreSQL backend ignores AAAA (IPv6) addresses

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Generic PostgreSQL backend ignores AAAA (IPv6) addresses

Stephane Bortzmeyer
I have AAAA (IPv6 addresses) in my zone file and zone2sql happily
loads them into PostgreSQL:

powerdns=# select name,type,content from records where type='AAAA';
    name    | type |           content            
------------+------+------------------------------
 ns3.nic.fr | AAAA | 2001:660:1180:1:192:134:0:49

But, when replying to a NS query, they are not loaded in the
additional section:

; <<>> DiG 9.2.1 <<>> @fr-powerdns-pgsql.dnsexp ns fr.
;; global options:  printcmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 16078
;; flags: qr aa rd; QUERY: 1, ANSWER: 8, AUTHORITY: 0, ADDITIONAL: 4

;; QUESTION SECTION:
;fr.                            IN      NS

;; ANSWER SECTION:
fr.                     345600  IN      NS      ns3.domain-registry.nl.
fr.                     345600  IN      NS      ns-ext.vix.com.
fr.                     345600  IN      NS      dns.cs.wisc.edu.
fr.                     345600  IN      NS      dns.princeton.edu.
fr.                     345600  IN      NS      dns.inria.fr.
fr.                     345600  IN      NS      ns3.nic.fr.
fr.                     345600  IN      NS      ns2.nic.fr.
fr.                     345600  IN      NS      ns1.nic.fr.

;; ADDITIONAL SECTION:
dns.inria.fr.           345600  IN      A       193.51.208.13
ns3.nic.fr.             345600  IN      A       192.134.0.49
ns2.nic.fr.             345600  IN      A       192.93.0.4
ns1.nic.fr.             345600  IN      A       192.93.0.1

;; Query time: 11 msec
;; SERVER: 192.134.7.253#53(fr-powerdns-pgsql.dnsexp)
;; WHEN: Wed Mar 12 14:53:12 2003
;; MSG SIZE  rcvd: 287

PowerDNS still delivers the proper reply when asked directly for a
AAAA record. But this behaviour is annoying. Both BIND9 and nsd adds
the AAAA to the additional section.

Reply | Threaded
Open this post in threaded view
|

Re: Generic PostgreSQL backend ignores AAAA (IPv6) addresses

bert hubert
On Wed, Mar 12, 2003 at 02:55:01PM +0100, Stephane Bortzmeyer wrote:

> But, when replying to a NS query, they are not loaded in the
> additional section:

indeed - this was not done so far as it is a performance penalty and rarely
needed. But it was high time this was added. You can turn AAAA additional
processing on with "do-ipv6-additional-processing" in the configuration:

RCS file: /var/cvsroot/pdns/pdns/common_startup.cc,v
retrieving revision 1.12
diff -u -B -b -r1.12 common_startup.cc
--- pdns/common_startup.cc 4 Mar 2003 18:33:39 -0000 1.12
+++ pdns/common_startup.cc 12 Mar 2003 14:06:36 -0000
@@ -91,6 +91,7 @@
   arg().set("webserver-password","Password required for accessing the webserver")="";
 
   arg().setSwitch("out-of-zone-additional-processing","Do out of zone additional processing")="no";
+  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";
@@ -162,7 +163,7 @@
   N->send(AD.A);
   numanswered++;
   int diff=AD.A->d_dt.udiff();
-  avg_latency=(int)(0.999*avg_latency+0.001*diff);
+  avg_latency=(int)(1023*avg_latency/1024+diff/1024);
 
   delete AD.A;  
 
RCS file: /var/cvsroot/pdns/pdns/packethandler.cc,v
retrieving revision 1.10
diff -u -B -b -r1.10 packethandler.cc
--- pdns/packethandler.cc 25 Feb 2003 12:36:49 -0000 1.10
+++ pdns/packethandler.cc 12 Mar 2003 14:06:37 -0000
@@ -50,6 +50,7 @@
   d_doCNAME = (arg()["skip-cname"]=="no");
   d_doRecursion= arg().mustDo("recursor");
   d_logDNSDetails= arg().mustDo("log-dns-details");
+  d_doIPv6AdditionalProcessing = arg().mustDo("do-ipv6-additional-processing");
 }
 
 DNSBackend *PacketHandler::getBackend()
@@ -302,7 +303,6 @@
     DLOG(L<<Logger::Warning<<"This packet needs additional processing!"<<endl);
 
     vector<DNSResourceRecord> arrs=r->getAPRecords();
-    
     for(vector<DNSResourceRecord>::const_iterator i=arrs.begin();
  i!=arrs.end();
  ++i) {
@@ -306,7 +306,11 @@
     for(vector<DNSResourceRecord>::const_iterator i=arrs.begin();
  i!=arrs.end();
  ++i) {
+
       B.lookup("A",i->content,p);  
+
+    retryWithIpV6:
+
       bool foundOne=false;
       while(B.get(rr)) {
  foundOne=true;
@@ -337,6 +341,10 @@
     // L<<Logger::Error<<"Trying to do additional processing for answer to '"<<p->qdomain<<"' query: "<<re.reason<<endl;
   }
  }
+      }
+      if(d_doIPv6AdditionalProcessing) {
+ B.lookup("AAAA", i->content, p);
+ goto retryWithIpV6;
       }
     }
   }

===================================================================
RCS file: /var/cvsroot/pdns/pdns/packethandler.hh,v
retrieving revision 1.4
diff -u -B -b -r1.4 packethandler.hh
--- pdns/packethandler.hh 21 Jan 2003 10:42:34 -0000 1.4
+++ pdns/packethandler.hh 12 Mar 2003 14:06:37 -0000
@@ -97,6 +97,7 @@
   bool d_doWildcards;
   bool d_doCNAME;
   bool d_logDNSDetails;
+  bool d_doIPv6AdditionalProcessing;
 
   UeberBackend B; // every thread an own instance
 };


--
http://www.PowerDNS.com      Open source, database driven DNS Software
http://lartc.org           Linux Advanced Routing & Traffic Control HOWTO
http://netherlabs.nl                         Consulting
Reply | Threaded
Open this post in threaded view
|

Re: Generic PostgreSQL backend ignores AAAA (IPv6) addresses

bert hubert
In reply to this post by Stephane Bortzmeyer
On Wed, Mar 12, 2003 at 02:55:01PM +0100, Stephane Bortzmeyer wrote:
> I have AAAA (IPv6 addresses) in my zone file and zone2sql happily
> loads them into PostgreSQL:

ignore my last patch :-( It is bogus. Will fix soonest.

Regards,

bert

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