BIND 10 trac2218_2, updated. ee538e573d559fc8912465fa8161cd975287e807 [2218] Remove duplicate copies of NSEC3 data
BIND 10 source code commits
bind10-changes at lists.isc.org
Fri Sep 21 07:35:53 UTC 2012
The branch, trac2218_2 has been updated
via ee538e573d559fc8912465fa8161cd975287e807 (commit)
from 6419f929bd1e7eb951fe1c0c0debc7e8ae30a59a (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 ee538e573d559fc8912465fa8161cd975287e807
Author: Mukund Sivaraman <muks at isc.org>
Date: Fri Sep 21 13:03:00 2012 +0530
[2218] Remove duplicate copies of NSEC3 data
-----------------------------------------------------------------------
Summary of changes:
.../datasrc/memory/tests/zone_finder_unittest.cc | 52 +-------------------
src/lib/datasrc/tests/faked_nsec3.cc | 46 +++++++++++------
src/lib/datasrc/tests/faked_nsec3.h | 9 ++++
3 files changed, 42 insertions(+), 65 deletions(-)
-----------------------------------------------------------------------
diff --git a/src/lib/datasrc/memory/tests/zone_finder_unittest.cc b/src/lib/datasrc/memory/tests/zone_finder_unittest.cc
index 4892861..b14d5d6 100644
--- a/src/lib/datasrc/memory/tests/zone_finder_unittest.cc
+++ b/src/lib/datasrc/memory/tests/zone_finder_unittest.cc
@@ -46,23 +46,6 @@ namespace {
using result::SUCCESS;
using result::EXIST;
-// Some faked NSEC3 hash values commonly used in tests and the faked NSEC3Hash
-// object.
-//
-// For apex (example.org)
-const char* const apex_hash = "0P9MHAVEQVM6T7VBL5LOP2U3T2RP3TOM";
-const char* const apex_hash_lower = "0p9mhaveqvm6t7vbl5lop2u3t2rp3tom";
-// For ns1.example.org
-const char* const ns1_hash = "2T7B4G4VSA5SMI47K61MV5BV1A22BOJR";
-// For w.example.org
-const char* const w_hash = "01UDEMVP1J2F7EG6JEBPS17VP3N8I58H";
-// For x.y.w.example.org (lower-cased)
-const char* const xyw_hash = "2vptu5timamqttgl4luu9kg21e0aor3s";
-// For zzz.example.org.
-const char* const zzz_hash = "R53BQ7CC2UVMUBFU5OCMM6PERS9TK9EN";
-
-typedef map<Name, string> NSEC3HashMap;
-typedef NSEC3HashMap::value_type NSEC3HashPair;
NSEC3HashMap nsec3_hash_map;
// A faked NSEC3 hash calculator for convenience. Tests that need to use
@@ -90,40 +73,7 @@ public:
const isc::dns::RRClass& rrclass) :
memory::InMemoryZoneFinder(zone_data, rrclass)
{
- // Build pre-defined hash
- nsec3_hash_map.clear();
- nsec3_hash_map[Name("example.org")] = apex_hash;
- nsec3_hash_map[Name("www.example.org")] = "2S9MHAVEQVM6T7VBL5LOP2U3T2RP3TOM";
- nsec3_hash_map[Name("xxx.example.org")] = "Q09MHAVEQVM6T7VBL5LOP2U3T2RP3TOM";
- nsec3_hash_map[Name("yyy.example.org")] = "0A9MHAVEQVM6T7VBL5LOP2U3T2RP3TOM";
- nsec3_hash_map[Name("x.y.w.example.org")] =
- "2VPTU5TIMAMQTTGL4LUU9KG21E0AOR3S";
- nsec3_hash_map[Name("y.w.example.org")] = "K8UDEMVP1J2F7EG6JEBPS17VP3N8I58H";
- nsec3_hash_map[Name("w.example.org")] = w_hash;
- nsec3_hash_map[Name("zzz.example.org")] = zzz_hash;
- nsec3_hash_map[Name("smallest.example.org")] =
- "00000000000000000000000000000000";
- nsec3_hash_map[Name("largest.example.org")] =
- "UUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUU";
-
- nsec3_hash_map[Name("n0.example.org")] =
- "00000000000000000000000000000000";
- nsec3_hash_map[Name("n1.example.org")] =
- "01UDEMVP1J2F7EG6JEBPS17VP3N8I58H";
- nsec3_hash_map[Name("n2.example.org")] =
- "02UDEMVP1J2F7EG6JEBPS17VP3N8I58H";
- nsec3_hash_map[Name("n3.example.org")] =
- "0P9MHAVEQVM6T7VBL5LOP2U3T2RP3TOM";
- nsec3_hash_map[Name("n4.example.org")] =
- "11111111111111111111111111111111";
- nsec3_hash_map[Name("n5.example.org")] =
- "2T7B4G4VSA5SMI47K61MV5BV1A22BOJR";
- nsec3_hash_map[Name("n6.example.org")] =
- "44444444444444444444444444444444";
- nsec3_hash_map[Name("n7.example.org")] =
- "R53BQ7CC2UVMUBFU5OCMM6PERS9TK9EN";
- nsec3_hash_map[Name("n8.example.org")] =
- "ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ";
+ buildFakeNSEC3Map(nsec3_hash_map);
}
void setFakeNSEC3Calculate() {
diff --git a/src/lib/datasrc/tests/faked_nsec3.cc b/src/lib/datasrc/tests/faked_nsec3.cc
index b702d28..7f17fca 100644
--- a/src/lib/datasrc/tests/faked_nsec3.cc
+++ b/src/lib/datasrc/tests/faked_nsec3.cc
@@ -53,20 +53,7 @@ private:
NSEC3HashMap map_;
public:
TestNSEC3Hash() {
- // Build pre-defined hash
- map_[Name("example.org")] = apex_hash;
- map_[Name("www.example.org")] = "2S9MHAVEQVM6T7VBL5LOP2U3T2RP3TOM";
- map_[Name("xxx.example.org")] = "Q09MHAVEQVM6T7VBL5LOP2U3T2RP3TOM";
- map_[Name("yyy.example.org")] = "0A9MHAVEQVM6T7VBL5LOP2U3T2RP3TOM";
- map_[Name("x.y.w.example.org")] =
- "2VPTU5TIMAMQTTGL4LUU9KG21E0AOR3S";
- map_[Name("y.w.example.org")] = "K8UDEMVP1J2F7EG6JEBPS17VP3N8I58H";
- map_[Name("w.example.org")] = w_hash;
- map_[Name("zzz.example.org")] = zzz_hash;
- map_[Name("smallest.example.org")] =
- "00000000000000000000000000000000";
- map_[Name("largest.example.org")] =
- "UUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUU";
+ buildFakeNSEC3Map(map_);
}
virtual string calculate(const Name& name) const {
const NSEC3HashMap::const_iterator found = map_.find(name);
@@ -95,6 +82,37 @@ NSEC3Hash* TestNSEC3HashCreator::create(const rdata::generic::NSEC3&) const {
}
void
+buildFakeNSEC3Map(NSEC3HashMap& fmap)
+{
+ // Build pre-defined hash
+ fmap.clear();
+ fmap[Name("example.org")] = apex_hash;
+ fmap[Name("www.example.org")] = "2S9MHAVEQVM6T7VBL5LOP2U3T2RP3TOM";
+ fmap[Name("xxx.example.org")] = "Q09MHAVEQVM6T7VBL5LOP2U3T2RP3TOM";
+ fmap[Name("yyy.example.org")] = "0A9MHAVEQVM6T7VBL5LOP2U3T2RP3TOM";
+ fmap[Name("x.y.w.example.org")] =
+ "2VPTU5TIMAMQTTGL4LUU9KG21E0AOR3S";
+ fmap[Name("y.w.example.org")] = "K8UDEMVP1J2F7EG6JEBPS17VP3N8I58H";
+ fmap[Name("w.example.org")] = w_hash;
+ fmap[Name("zzz.example.org")] = zzz_hash;
+ fmap[Name("smallest.example.org")] =
+ "00000000000000000000000000000000";
+ fmap[Name("largest.example.org")] =
+ "UUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUU";
+
+ // These are used by the findNSEC3Walk test.
+ fmap[Name("n0.example.org")] = "00000000000000000000000000000000";
+ fmap[Name("n1.example.org")] = "01UDEMVP1J2F7EG6JEBPS17VP3N8I58H";
+ fmap[Name("n2.example.org")] = "02UDEMVP1J2F7EG6JEBPS17VP3N8I58H";
+ fmap[Name("n3.example.org")] = "0P9MHAVEQVM6T7VBL5LOP2U3T2RP3TOM";
+ fmap[Name("n4.example.org")] = "11111111111111111111111111111111";
+ fmap[Name("n5.example.org")] = "2T7B4G4VSA5SMI47K61MV5BV1A22BOJR";
+ fmap[Name("n6.example.org")] = "44444444444444444444444444444444";
+ fmap[Name("n7.example.org")] = "R53BQ7CC2UVMUBFU5OCMM6PERS9TK9EN";
+ fmap[Name("n8.example.org")] = "ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ";
+}
+
+void
findNSEC3Check(bool expected_matched, uint8_t expected_labels,
const string& expected_closest,
const string& expected_next,
diff --git a/src/lib/datasrc/tests/faked_nsec3.h b/src/lib/datasrc/tests/faked_nsec3.h
index 8c1857c..1552c79 100644
--- a/src/lib/datasrc/tests/faked_nsec3.h
+++ b/src/lib/datasrc/tests/faked_nsec3.h
@@ -18,9 +18,11 @@
#include <datasrc/zone.h>
#include <dns/nsec3hash.h>
+#include <dns/name.h>
#include <stdint.h>
#include <string>
+#include <map>
namespace isc {
namespace datasrc {
@@ -64,6 +66,13 @@ public:
const;
};
+typedef std::map<isc::dns::Name, std::string> NSEC3HashMap;
+typedef NSEC3HashMap::value_type NSEC3HashPair;
+
+// Build the test map with the fake NSEC3 hashes.
+void
+buildFakeNSEC3Map(NSEC3HashMap& fmap);
+
// Check the result against expected values. It directly calls EXPECT_ macros
void
findNSEC3Check(bool expected_matched, uint8_t expected_labels,
More information about the bind10-changes
mailing list