BIND 10 trac2282, updated. 89476cd22065c79ba1c7dd48a29f0fc958917b39 [2282] small optimization: allow findNode() to ignore out-of-zone names

BIND 10 source code commits bind10-changes at lists.isc.org
Wed Sep 26 04:31:17 UTC 2012


The branch, trac2282 has been updated
       via  89476cd22065c79ba1c7dd48a29f0fc958917b39 (commit)
      from  00bbd50bb77e798708891f177003ad1d01bf9dbe (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 89476cd22065c79ba1c7dd48a29f0fc958917b39
Author: JINMEI Tatuya <jinmei at isc.org>
Date:   Tue Sep 25 21:30:11 2012 -0700

    [2282] small optimization: allow findNode() to ignore out-of-zone names
    
    then we can include the out-of-zone check as part of findNode() operation.

-----------------------------------------------------------------------

Summary of changes:
 src/lib/datasrc/memory/zone_finder.cc |   29 ++++++++++++++---------------
 1 file changed, 14 insertions(+), 15 deletions(-)

-----------------------------------------------------------------------
diff --git a/src/lib/datasrc/memory/zone_finder.cc b/src/lib/datasrc/memory/zone_finder.cc
index 9e52097..962570c 100644
--- a/src/lib/datasrc/memory/zone_finder.cc
+++ b/src/lib/datasrc/memory/zone_finder.cc
@@ -391,11 +391,15 @@ public:
 // caught above.
 //
 // If none of the above succeeds, we conclude the name doesn't exist in
-// the zone, and throw an OutOfZone exception.
+// the zone, and throw an OutOfZone exception by default.  If the optional
+// out_of_zone_ok is true, it returns an NXDOMAIN result with NULL data so
+// the caller can take an action to it (technically it's not "NXDOMAIN",
+// but the caller is assumed not to rely on the difference.)
 FindNodeResult findNode(const ZoneData& zone_data,
                         const LabelSequence& name_labels,
                         ZoneChain& node_path,
-                        ZoneFinder::FindOptions options)
+                        ZoneFinder::FindOptions options,
+                        bool out_of_zone_ok = false)
 {
     ZoneNode* node = NULL;
     FindState state((options & ZoneFinder::FIND_GLUE_OK) != 0);
@@ -488,7 +492,11 @@ FindNodeResult findNode(const ZoneData& zone_data,
         return (FindNodeResult(ZoneFinder::NXDOMAIN, nsec_node, nsec_rds));
     } else {
         // If the name is neither an exact or partial match, it is
-        // out of bailiwick, which is considered an error.
+        // out of bailiwick, which is considered an error, unless the caller
+        // is willing to accept it.
+        if (out_of_zone_ok) {
+            return (FindNodeResult(ZoneFinder::NXDOMAIN, NULL, NULL));
+        }
         isc_throw(OutOfZone, name_labels << " not in " <<
                              zone_data.getOriginNode()->getName());
     }
@@ -654,20 +662,11 @@ InMemoryZoneFinder::Context::findAdditional(
         return;
     }
 
-    // Ignore out-of-zone names
-    uint8_t labels_buf[LabelSequence::MAX_SERIALIZED_LENGTH];
-    const NameComparisonResult cmp =
-        zone_data_->getOriginNode()->getAbsoluteLabels(labels_buf).
-        compare(name_labels);
-    if ((cmp.getRelation() != NameComparisonResult::SUPERDOMAIN) &&
-        (cmp.getRelation() != NameComparisonResult::EQUAL)) {
-        return;
-    }
-
-    // Find the zone node for the additional name
+    // Find the zone node for the additional name.  By passing true as the
+    // last parameter of findNode() we ignore out-of-zone names.
     ZoneChain node_path;
     const FindNodeResult node_result =
-        findNode(*zone_data_, name_labels, node_path, options);
+        findNode(*zone_data_, name_labels, node_path, options, true);
     // we only need non-empty exact match
     if (node_result.code != SUCCESS) {
         return;



More information about the bind10-changes mailing list