[svn] commit: r817 - in /branches/each-ds/src/lib/auth/cpp: data_source.cc data_source.h

BIND 10 source code commits bind10-changes at lists.isc.org
Sun Feb 14 08:34:04 UTC 2010


Author: each
Date: Sun Feb 14 08:34:04 2010
New Revision: 817

Log:
fixed a bug in findAddrs(): it was only returning success if both A *and*
AAAA were found at a node.

Modified:
    branches/each-ds/src/lib/auth/cpp/data_source.cc
    branches/each-ds/src/lib/auth/cpp/data_source.h

Modified: branches/each-ds/src/lib/auth/cpp/data_source.cc
==============================================================================
--- branches/each-ds/src/lib/auth/cpp/data_source.cc (original)
+++ branches/each-ds/src/lib/auth/cpp/data_source.cc Sun Feb 14 08:34:04 2010
@@ -23,20 +23,14 @@
         if (rrset->getType() == RRType::NS()) {
             const rdata::generic::NS& ns =
                 dynamic_cast<const rdata::generic::NS&>(rd);
-            const Name& nsname(ns.getNSName());
-
-            // Don't bother with A/AAAA record in the additional section
-            // if they match the qname/qtype that we've already answered.
-            if (nsname != q.qname() || q.qtype() != RRType::A()) {
-                QueryTask t(nsname, q.qclass(), RRType::A(),
-                            Section::ADDITIONAL(), QueryTask::GETADDITIONAL); 
-                q.tasks().push(t);
-            }
-            if (nsname != q.qname() || q.qtype() != RRType::AAAA()) {
-                QueryTask t(nsname, q.qclass(), RRType::AAAA(),
-                            Section::ADDITIONAL(), QueryTask::GETADDITIONAL); 
-                q.tasks().push(t);
-            }
+
+            // XXX: For smaller responses, we should try to omit A/AAAA
+            // in the additional section if they are already in the answer
+            // section, but for now we don't.
+            QueryTask t(ns.getNSName(), q.qclass(), RRType::ANY(),
+                        Section::ADDITIONAL(), QueryTask::ADDR_QUERY,
+                        QueryTask::GETADDITIONAL); 
+            q.tasks().push(t);
         } else if (rrset->getType() == RRType::MX()) {
             const rdata::generic::MX& mx =
                 dynamic_cast<const rdata::generic::MX&>(rd);

Modified: branches/each-ds/src/lib/auth/cpp/data_source.h
==============================================================================
--- branches/each-ds/src/lib/auth/cpp/data_source.h (original)
+++ branches/each-ds/src/lib/auth/cpp/data_source.h Sun Feb 14 08:34:04 2010
@@ -134,13 +134,26 @@
                                RRsetList& target,
                                RRsetList& sigs) const {
         Result r;
-        r = findRRset(q, qname, qclass, RRType::A(), target, sigs);
-        if (r != SUCCESS) {
-            return (r);
-        }
-
-        r = findRRset(q, qname, qclass, RRType::AAAA(), target, sigs);
-        return (r);
+        bool a = false, aaaa = false;
+        r = findExactRRset(q, qname, qclass, RRType::A(), target, sigs);
+        if (r == SUCCESS) {
+            a = true;
+        } else if (r != TYPE_NOT_FOUND) {
+            return (r);
+        }
+
+        r = findExactRRset(q, qname, qclass, RRType::AAAA(), target, sigs);
+        if (r == SUCCESS) {
+            aaaa = true;
+        } else if (r != TYPE_NOT_FOUND) {
+            return (r);
+        }
+
+        if (a || aaaa) {
+            return (SUCCESS);
+        } else {
+            return (TYPE_NOT_FOUND);
+        }
     }
 
     virtual Result findReferral(const Query& q,
@@ -153,7 +166,7 @@
         bool found_ds = false;
         bool found_dname = false;
 
-        r = findRRset(q, qname, qclass, RRType::NS(), target, sigs);
+        r = findExactRRset(q, qname, qclass, RRType::NS(), target, sigs);
         if (r == SUCCESS) {
             found_ns = true;
         } else if (r != TYPE_NOT_FOUND) {
@@ -164,14 +177,14 @@
         // implemented.
 
 #if 0
-        r = findRRset(q, qname, qclass, RRType::DS(), target, sigs);
+        r = findExactRRset(q, qname, qclass, RRType::DS(), target, sigs);
         if (r == SUCCESS) {
             found_ds = true;
         } else if (r != TYPE_NOT_FOUND) {
             return (r);
         }
 
-        r = findRRset(q, qname, qclass, RRType::DNAME(), target, sigs);
+        r = findExactRRset(q, qname, qclass, RRType::DNAME(), target, sigs);
         if (r == SUCCESS) {
             found_dname = true;
         } else if (r != TYPE_NOT_FOUND) {




More information about the bind10-changes mailing list