BIND 10 trac2436, updated. 4209615da0b85838cc481a7ad602d7783bfdd78a [2436] Use example.org instead of root zone
BIND 10 source code commits
bind10-changes at lists.isc.org
Wed Jan 9 10:15:39 UTC 2013
The branch, trac2436 has been updated
via 4209615da0b85838cc481a7ad602d7783bfdd78a (commit)
via aff266bfb0c5ea0d8553fb249aacd91f4f414476 (commit)
via 30bb4f426cc06433dbfdbad4d6080ff9ab80ca10 (commit)
via f8dfc94a4a5941def5a4624f7755c0478b8d6375 (commit)
via 5bfa13805e9a9ee2585426ddd8807175eac1a6a3 (commit)
via ba7d30083a692af134c9b4c52b92b7856b34096a (commit)
via e18d03ada70eab16d6f5855b1bf95e78167c4c82 (commit)
from 7174cca8bf02759d3947f2bdc5437e11c362d2a7 (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 4209615da0b85838cc481a7ad602d7783bfdd78a
Author: Michal 'vorner' Vaner <michal.vaner at nic.cz>
Date: Wed Jan 9 11:14:37 2013 +0100
[2436] Use example.org instead of root zone
Just to be closer to real life, no special reason.
commit aff266bfb0c5ea0d8553fb249aacd91f4f414476
Author: Michal 'vorner' Vaner <michal.vaner at nic.cz>
Date: Wed Jan 9 11:06:43 2013 +0100
[2436] Test that warnings don't disrupt loading
commit 30bb4f426cc06433dbfdbad4d6080ff9ab80ca10
Author: Michal 'vorner' Vaner <michal.vaner at nic.cz>
Date: Wed Jan 9 11:06:13 2013 +0100
[2436] More renaming from validation to check
For consistency.
commit f8dfc94a4a5941def5a4624f7755c0478b8d6375
Author: Michal 'vorner' Vaner <michal.vaner at nic.cz>
Date: Wed Jan 9 11:05:15 2013 +0100
[2436] Fix comment typo and make it clearer
commit 5bfa13805e9a9ee2585426ddd8807175eac1a6a3
Author: Michal 'vorner' Vaner <michal.vaner at nic.cz>
Date: Wed Jan 9 10:43:12 2013 +0100
[2436] Proper terminology in comment
commit ba7d30083a692af134c9b4c52b92b7856b34096a
Author: Michal 'vorner' Vaner <michal.vaner at nic.cz>
Date: Wed Jan 9 10:39:49 2013 +0100
[2436] Tweak log messages
And their IDs. Just slight clarifications.
commit e18d03ada70eab16d6f5855b1bf95e78167c4c82
Author: Michal 'vorner' Vaner <michal.vaner at nic.cz>
Date: Wed Jan 9 10:26:12 2013 +0100
[2436] Remove fixed bug from man page
-----------------------------------------------------------------------
Summary of changes:
src/bin/loadzone/b10-loadzone.xml | 16 +--------
src/lib/datasrc/datasrc_messages.mes | 24 +++++++-------
src/lib/datasrc/tests/Makefile.am | 1 +
src/lib/datasrc/tests/testdata/checkwarn.zone | 4 +++
src/lib/datasrc/tests/testdata/novalidate.zone | 6 ++--
src/lib/datasrc/tests/zone_loader_unittest.cc | 42 +++++++++++++++++++-----
src/lib/datasrc/zone_loader.cc | 6 ++--
src/lib/datasrc/zone_loader.h | 5 +--
8 files changed, 61 insertions(+), 43 deletions(-)
create mode 100644 src/lib/datasrc/tests/testdata/checkwarn.zone
-----------------------------------------------------------------------
diff --git a/src/bin/loadzone/b10-loadzone.xml b/src/bin/loadzone/b10-loadzone.xml
index 8c55f9b..aa14053 100644
--- a/src/bin/loadzone/b10-loadzone.xml
+++ b/src/bin/loadzone/b10-loadzone.xml
@@ -224,21 +224,7 @@
<refsect1>
<title>BUGS</title>
<para>
- As of the initial implementation, the underlying library that
- this tool uses does not fully validate the loaded zone; for
- example, loading will succeed even if it doesn't have the SOA or
- NS record at its origin name. Such checks will be implemented
- in a near future version, but until then, the
- <command>b10-loadzone</command> performs the existence of the
- SOA and NS records by itself. However, <command>b10-loadzone</command>
- only warns about it, and does not cancel the load itself.
- If this warning message is produced, it's the user's
- responsibility to fix the errors and reload it. When the
- library is updated with the post load checks, it will be more
- sophisticated and the such zone won't be successfully loaded.
- </para>
- <para>
- There are some other issues noted in the DESCRIPTION section.
+ There are some issues noted in the DESCRIPTION section.
</para>
</refsect1>
</refentry><!--
diff --git a/src/lib/datasrc/datasrc_messages.mes b/src/lib/datasrc/datasrc_messages.mes
index cfe52a0..6ac9db0 100644
--- a/src/lib/datasrc/datasrc_messages.mes
+++ b/src/lib/datasrc/datasrc_messages.mes
@@ -70,6 +70,19 @@ The maximum allowed number of items of the hotspot cache is set to the given
number. If there are too many, some of them will be dropped. The size of 0
means no limit.
+% DATASRC_CHECK_ERROR post-load check of zone %1/%2 failed: %3
+The zone was loaded into the data source successfully, but the content fails
+basic sanity checks. See the message if you want to know what exactly is wrong
+with the data. The data can not be used and previous version, if any, will be
+preserved.
+
+% DATASRC_CHECK_WARNING %1/%2: %3
+The zone was loaded into the data source successfully, but there's some problem
+with the content. The problem does not stop the new version from being used
+(though there may be other problems that do, see DATASRC_CHECK_ERROR),
+but it should still be checked and fixed. See the message to know what exactly
+is wrong with the data.
+
% DATASRC_DATABASE_COVER_NSEC_UNSUPPORTED %1 doesn't support DNSSEC when asked for NSEC data covering %2
The datasource tried to provide an NSEC proof that the named domain does not
exist, but the database backend doesn't support DNSSEC. No proof is included
@@ -844,14 +857,3 @@ data source.
% DATASRC_UNEXPECTED_QUERY_STATE unexpected query state
This indicates a programming error. An internal task of unknown type was
generated.
-
-% DATASRC_VALIDATE_ERROR validation of zone %1/%2 failed: %3
-The zone was loaded into the data source successfully, but the content fails
-basic sanity checks. See the message if you want to know what exactly is wrong
-with the data. The data can not be used and previous version, if any, will be
-preserved.
-
-% DATASRC_VALIDATE_WARNING %1/%2: %3
-The zone was loaded, but there's some problem with the content. The problem
-is not serious enough to make the zone unusable, but it should still be checked
-and fixed. See the message to know what exactly is wrong with the data.
diff --git a/src/lib/datasrc/tests/Makefile.am b/src/lib/datasrc/tests/Makefile.am
index 2508585..7c61826 100644
--- a/src/lib/datasrc/tests/Makefile.am
+++ b/src/lib/datasrc/tests/Makefile.am
@@ -119,3 +119,4 @@ EXTRA_DIST += testdata/newschema.sqlite3
EXTRA_DIST += testdata/oldschema.sqlite3
EXTRA_DIST += testdata/static.zone
EXTRA_DIST += testdata/novalidate.zone
+EXTRA_DIST += testdata/checkwarn.zone
diff --git a/src/lib/datasrc/tests/testdata/checkwarn.zone b/src/lib/datasrc/tests/testdata/checkwarn.zone
new file mode 100644
index 0000000..e985085
--- /dev/null
+++ b/src/lib/datasrc/tests/testdata/checkwarn.zone
@@ -0,0 +1,4 @@
+example.org. 86400 IN SOA a.root-servers.net. nstld.verisign-grs.com. 2010030802 1800 900 604800 86400
+example.org. 86400 IN NS ns.example.org.
+; Missing the address for the nameserver. This should generate a warning, but not error.
+www.example.org. 3600 IN A 192.0.2.1
diff --git a/src/lib/datasrc/tests/testdata/novalidate.zone b/src/lib/datasrc/tests/testdata/novalidate.zone
index f5a1ca6..4bbf12a 100644
--- a/src/lib/datasrc/tests/testdata/novalidate.zone
+++ b/src/lib/datasrc/tests/testdata/novalidate.zone
@@ -1,3 +1,3 @@
-. 86400 IN SOA a.root-servers.net. nstld.verisign-grs.com. 2010030802 1800 900 604800 86400
-; Missing the NS here, will generate an error in validation
-www. 3600 IN A 192.0.2.1
+example.org. 86400 IN SOA a.root-servers.net. nstld.verisign-grs.com. 2010030802 1800 900 604800 86400
+; Missing the NS here, will generate an error in post-load check of the zone.
+www.example.org. 3600 IN A 192.0.2.1
diff --git a/src/lib/datasrc/tests/zone_loader_unittest.cc b/src/lib/datasrc/tests/zone_loader_unittest.cc
index 7433c2f..3c5e502 100644
--- a/src/lib/datasrc/tests/zone_loader_unittest.cc
+++ b/src/lib/datasrc/tests/zone_loader_unittest.cc
@@ -186,10 +186,10 @@ protected:
{}
void prepareSource(const Name& zone, const char* filename) {
// TODO:
- // Currently, load uses an urelated implementation. In the long term,
- // the method will probably be deprecated. At that time, we should
- // probably prepare the data in some other way (using sqlite3 or
- // something). This is simpler for now.
+ // Currently, load uses an implementation unrelated to the ZoneLoader.
+ // In the long term, the method will probably be deprecated. At that
+ // time, we should probably prepare the data in some other way (using
+ // sqlite3 or something). This is simpler for now.
source_client_.load(zone, string(TEST_DATA_DIR) + "/" + filename);
}
private:
@@ -422,8 +422,8 @@ TEST_F(ZoneLoaderTest, loadSyntaxError) {
}
// Test there's validation of the data in the zone loader.
-TEST_F(ZoneLoaderTest, loadValidation) {
- ZoneLoader loader(destination_client_, Name::ROOT_NAME(),
+TEST_F(ZoneLoaderTest, loadCheck) {
+ ZoneLoader loader(destination_client_, Name("example.org"),
TEST_DATA_DIR "/novalidate.zone");
EXPECT_THROW(loader.loadIncremental(10), ZoneContentError);
// The messages go to the log. We don't have an easy way to examine them.
@@ -431,13 +431,37 @@ TEST_F(ZoneLoaderTest, loadValidation) {
}
// The same test, but for copying from other data source
-TEST_F(ZoneLoaderTest, copyValidation) {
- prepareSource(Name::ROOT_NAME(), "novalidate.zone");
- ZoneLoader loader(destination_client_, Name::ROOT_NAME(), source_client_);
+TEST_F(ZoneLoaderTest, copyCheck) {
+ prepareSource(Name("example.org"), "novalidate.zone");
+ ZoneLoader loader(destination_client_, Name("example.org"),
+ source_client_);
EXPECT_THROW(loader.loadIncremental(10), ZoneContentError);
// The messages go to the log. We don't have an easy way to examine them.
EXPECT_FALSE(destination_client_.commit_called_);
}
+// Check a warning doesn't disrupt the loading of the zone
+TEST_F(ZoneLoaderTest, loadCheckWarn) {
+ ZoneLoader loader(destination_client_, Name("example.org"),
+ TEST_DATA_DIR "/checkwarn.zone");
+ EXPECT_TRUE(loader.loadIncremental(10));
+ // The messages go to the log. We don't have an easy way to examine them.
+ // But the zone was committed and contains all 3 RRs
+ EXPECT_TRUE(destination_client_.commit_called_);
+ EXPECT_EQ(3, destination_client_.rrsets_.size());
+}
+
+TEST_F(ZoneLoaderTest, copyCheckWarn) {
+ prepareSource(Name("example.org"), "checkwarn.zone");
+ ZoneLoader loader(destination_client_, Name("example.org"),
+ source_client_);
+ EXPECT_TRUE(loader.loadIncremental(10));
+ // The messages go to the log. We don't have an easy way to examine them.
+ // But the zone was committed and contains all 3 RRs
+ EXPECT_TRUE(destination_client_.commit_called_);
+ EXPECT_EQ(3, destination_client_.rrsets_.size());
+
+}
+
}
diff --git a/src/lib/datasrc/zone_loader.cc b/src/lib/datasrc/zone_loader.cc
index 348c52b..41a13ab 100644
--- a/src/lib/datasrc/zone_loader.cc
+++ b/src/lib/datasrc/zone_loader.cc
@@ -110,7 +110,7 @@ void
logWarning(const dns::Name* zone_name, const dns::RRClass* rrclass,
const std::string& reason)
{
- LOG_WARN(logger, DATASRC_VALIDATE_WARNING).arg(*zone_name).arg(*rrclass).
+ LOG_WARN(logger, DATASRC_CHECK_WARNING).arg(*zone_name).arg(*rrclass).
arg(reason);
}
@@ -118,7 +118,7 @@ void
logError(const dns::Name* zone_name, const dns::RRClass* rrclass,
const std::string& reason)
{
- LOG_ERROR(logger, DATASRC_VALIDATE_ERROR).arg(*zone_name).arg(*rrclass).
+ LOG_ERROR(logger, DATASRC_CHECK_ERROR).arg(*zone_name).arg(*rrclass).
arg(reason);
}
@@ -154,7 +154,7 @@ ZoneLoader::loadIncremental(size_t limit) {
callbacks(boost::bind(&logError, &zone_name, &zone_class, _1),
boost::bind(&logWarning, &zone_name, &zone_class, _1));
if (!dns::checkZone(zone_name, zone_class, collection, callbacks)) {
- // Validation failed.
+ // The post-load check failed.
loaded_ok_ = false;
isc_throw(ZoneContentError, "Errors found when validating zone " <<
zone_name << "/" << zone_class);
diff --git a/src/lib/datasrc/zone_loader.h b/src/lib/datasrc/zone_loader.h
index 292360f..c7e5ccd 100644
--- a/src/lib/datasrc/zone_loader.h
+++ b/src/lib/datasrc/zone_loader.h
@@ -48,7 +48,7 @@ public:
{}
};
-/// \brief Exception thrown when the zone doesn't validate.
+/// \brief Exception thrown when the zone doesn't pass post-load check.
///
/// This is thrown by the ZoneLoader when the zone is loaded, but it
/// doesn't pass basic sanity checks.
@@ -138,7 +138,8 @@ public:
/// After the last RR is loaded, a sanity check of the zone is performed by
/// isc::dns::validateZone. It reports errors and warnings by logging them
/// directly. If there are any errors, a ZoneContentError exception is
- /// thrown.
+ /// thrown and the load is aborted (preserving the old version of zone, if
+ /// any).
///
/// \param limit The maximum allowed number of RRs to be loaded during this
/// call.
More information about the bind10-changes
mailing list