BIND 10 trac2310, updated. 2ca96761f12b10e51faa6e394617baffbb68afdd [2310] added a test case where the original TTL is smaller than SOA minttl.

BIND 10 source code commits bind10-changes at lists.isc.org
Mon Jan 28 18:47:16 UTC 2013


The branch, trac2310 has been updated
       via  2ca96761f12b10e51faa6e394617baffbb68afdd (commit)
       via  b122fa56ec0caf72e351f973c9ef337b2b3122c1 (commit)
       via  ed2adc060ea123c5a6fec274950fdc68cde48059 (commit)
      from  4760fba1fcc4d0fdb762b69cd6090002b9190be1 (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 2ca96761f12b10e51faa6e394617baffbb68afdd
Author: JINMEI Tatuya <jinmei at isc.org>
Date:   Mon Jan 28 10:46:27 2013 -0800

    [2310] added a test case where the original TTL is smaller than SOA minttl.

commit b122fa56ec0caf72e351f973c9ef337b2b3122c1
Author: JINMEI Tatuya <jinmei at isc.org>
Date:   Mon Jan 28 10:41:43 2013 -0800

    [2310] clarify/simplify the use of origin with textToRRset.
    
    also moved convertRRset insde InMemoryZoneFinderTest class as a member
    function so it can access origin_.

commit ed2adc060ea123c5a6fec274950fdc68cde48059
Author: JINMEI Tatuya <jinmei at isc.org>
Date:   Mon Jan 28 10:28:56 2013 -0800

    [2310] added some implementation notes as comment for in-memory findAtOrigin.

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

Summary of changes:
 src/lib/datasrc/memory/zone_finder.cc              |   10 +++++
 .../datasrc/tests/memory/zone_finder_unittest.cc   |   47 +++++++++++++-------
 2 files changed, 40 insertions(+), 17 deletions(-)

-----------------------------------------------------------------------
diff --git a/src/lib/datasrc/memory/zone_finder.cc b/src/lib/datasrc/memory/zone_finder.cc
index ea8f9d1..56c4110 100644
--- a/src/lib/datasrc/memory/zone_finder.cc
+++ b/src/lib/datasrc/memory/zone_finder.cc
@@ -765,6 +765,16 @@ InMemoryZoneFinder::findAll(const isc::dns::Name& name,
                                                           options))));
 }
 
+// The implementation is a special case of the generic findInternal: we know
+// the qname should have an "exact match" and its node is accessible via
+// getOriginNode(); and, since there should be at least SOA RR at the origin
+// the case of CNAME can be eliminated (these should be guaranteed at the load
+// or update time, but even if they miss a corner case and allows a CNAME to
+// be added at origin, the zone is broken anyway, so we'd just let this
+// method return garbage, too).  As a result, there can be only too cases
+// for the result codes: SUCCESS if the requested type of RR exists; NXRRSET
+// otherwise.  Due to its simplicity we implement it separately, rather than
+// sharing the code with findInternal.
 boost::shared_ptr<ZoneFinder::Context>
 InMemoryZoneFinder::findAtOrigin(const isc::dns::RRType& type,
                                  bool use_minttl,
diff --git a/src/lib/datasrc/tests/memory/zone_finder_unittest.cc b/src/lib/datasrc/tests/memory/zone_finder_unittest.cc
index abfbe1d..055708d 100644
--- a/src/lib/datasrc/tests/memory/zone_finder_unittest.cc
+++ b/src/lib/datasrc/tests/memory/zone_finder_unittest.cc
@@ -53,23 +53,6 @@ namespace {
 using result::SUCCESS;
 using result::EXIST;
 
-/// \brief expensive rrset converter
-///
-/// converts any specialized rrset (which may not have implemented some
-/// methods for efficiency) into a 'full' RRsetPtr, for easy use in test
-/// checks.
-///
-/// Done very inefficiently through text representation, speed should not
-/// be a concern here.
-ConstRRsetPtr
-convertRRset(ConstRRsetPtr src) {
-    // If the type is SOA, textToRRset performs a stricter check, so we should
-    // specify the origin.
-    const Name& origin = (src->getType() == RRType::SOA()) ?
-        src->getName() : Name::ROOT_NAME();
-    return (textToRRset(src->toText(), src->getClass(), origin));
-}
-
 /// \brief Test fixture for the InMemoryZoneFinder class
 class InMemoryZoneFinderTest : public ::testing::Test {
     // A straightforward pair of textual RR(set) and a RRsetPtr variable
@@ -195,6 +178,10 @@ protected:
                 *zone_data[i].rrset = textToRRset(zone_data[i].text, class_,
                                                   origin_);
             } else {
+                // For other data, we should rather omit the origin (the root
+                // name will be used by default); there's some out-of-zone
+                // name, which would trigger an exception if we specified
+                // origin_.
                 *zone_data[i].rrset = textToRRset(zone_data[i].text);
             }
         }
@@ -211,6 +198,24 @@ protected:
         updater_.add(rrset, rrset->getRRsig());
     }
 
+    /// \brief expensive rrset converter
+    ///
+    /// converts any specialized rrset (which may not have implemented some
+    /// methods for efficiency) into a 'full' RRsetPtr, for easy use in test
+    /// checks.
+    ///
+    /// Done very inefficiently through text representation, speed should not
+    /// be a concern here.
+    ConstRRsetPtr
+    convertRRset(ConstRRsetPtr src) {
+        // If the type is SOA, textToRRset performs a stricter check, so we
+        // should specify the origin.  For now we don't use out-of-zone
+        // owner names (e.g. for pathological cases) with this method, so it
+        // works for all test data.  If future changes break this assumption
+        // we should adjust it.
+        return (textToRRset(src->toText(), class_, origin_));
+    }
+
     // Some data to test with
     const RRClass class_;
     const Name origin_;
@@ -734,6 +739,14 @@ TEST_F(InMemoryZoneFinderTest, findAtOriginWithMinTTL) {
                      ZoneFinder::RESULT_DEFAULT, NULL,
                      ZoneFinder::FIND_DEFAULT, false);
 
+    // If the found RRset has a smaller TTL than SOA, the original TTL should
+    // win.
+    rr_a_->setTTL(RRTTL(10));
+    addToZoneData(rr_a_);
+    findAtOriginTest(RRType::A(), ZoneFinder::SUCCESS, true, rr_a_,
+                     ZoneFinder::RESULT_DEFAULT, NULL,
+                     ZoneFinder::FIND_DEFAULT, true);
+
     // If no RRset is returned, use_minttl doesn't matter (it shouldn't cause
     // disruption)
     findAtOriginTest(RRType::TXT(), ZoneFinder::NXRRSET, true, ConstRRsetPtr(),



More information about the bind10-changes mailing list