BIND 10 trac1067, updated. fe8f3314300936f71cc89535ecd3f0f3cad3804c [1067] "FIX" different TTL instead of throwing

BIND 10 source code commits bind10-changes at lists.isc.org
Wed Aug 17 13:46:56 UTC 2011


The branch, trac1067 has been updated
       via  fe8f3314300936f71cc89535ecd3f0f3cad3804c (commit)
      from  2bb551be853647c25005d1ab167e17ada7a5bfc5 (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 fe8f3314300936f71cc89535ecd3f0f3cad3804c
Author: Michal 'vorner' Vaner <michal.vaner at nic.cz>
Date:   Wed Aug 17 15:45:40 2011 +0200

    [1067] "FIX" different TTL instead of throwing
    
    When we iterate and find out that there are RRs in an RRset with
    different TTL, we go for the lowest of them instead of throwing and give
    a warning.

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

Summary of changes:
 src/lib/datasrc/database.cc                |    8 ++++++--
 src/lib/datasrc/datasrc_messages.mes       |    7 +++++++
 src/lib/datasrc/tests/database_unittest.cc |    3 ++-
 3 files changed, 15 insertions(+), 3 deletions(-)

-----------------------------------------------------------------------
diff --git a/src/lib/datasrc/database.cc b/src/lib/datasrc/database.cc
index d5e8f59..196cf6f 100644
--- a/src/lib/datasrc/database.cc
+++ b/src/lib/datasrc/database.cc
@@ -352,8 +352,12 @@ public:
         RRsetPtr rrset(new RRset(name, class_, rtype, RRTTL(ttl)));
         while (data_ready_ && name_ == name_str && rtype_str == rtype_) {
             if (ttl_ != ttl) {
-                isc_throw(DataSourceError, "TTLs in rrset " + name_str + "/" +
-                          rtype_str + " differ");
+                LOG_WARN(logger, DATASRC_DATABASE_ITERATE_TTL_DIFF).
+                    arg(name_).arg(ttl).arg(ttl_);
+                if (ttl < ttl_) {
+                    ttl_ = ttl;
+                    rrset->setTTL(RRTTL(ttl));
+                }
             }
             rrset->addRdata(rdata::createRdata(rtype, class_, rdata_));
             getData();
diff --git a/src/lib/datasrc/datasrc_messages.mes b/src/lib/datasrc/datasrc_messages.mes
index ef1b26f..c2d99f3 100644
--- a/src/lib/datasrc/datasrc_messages.mes
+++ b/src/lib/datasrc/datasrc_messages.mes
@@ -114,6 +114,13 @@ While iterating through the zone, the program reached end of the data.
 While iterating through the zone, the program extracted next RRset from it.
 The name and RRtype of the RRset is indicated in the message.
 
+% DATASRC_DATABASE_ITERATE_TTL_DIFF TTL for %1/%2 differs (%3 and %4)
+While iterating through the zone, the time to live for RRs of the given RRset
+was discovered not to be the same the same This isn't allowed on the wire and
+is considered generally broken, so we set it to the lowest of them internaly
+(but we don't modify the database). But the data in database should better be
+checked and fixed by human.
+
 % DATASRC_DO_QUERY handling query for '%1/%2'
 A debug message indicating that a query for the given name and RR type is being
 processed.
diff --git a/src/lib/datasrc/tests/database_unittest.cc b/src/lib/datasrc/tests/database_unittest.cc
index 48319ea..f5e785c 100644
--- a/src/lib/datasrc/tests/database_unittest.cc
+++ b/src/lib/datasrc/tests/database_unittest.cc
@@ -554,8 +554,9 @@ TEST_F(DatabaseClientTest, iterator) {
 // This has inconsistent TTL in the set (the rest, like nonsense in
 // the data is handled in rdata itself).
 TEST_F(DatabaseClientTest, badIterator) {
+    // It should not throw, but get the lowest one of them
     ZoneIteratorPtr it(client_->getIterator(Name("bad.example.org")));
-    EXPECT_THROW(it->getNextRRset(), DataSourceError);
+    EXPECT_EQ(it->getNextRRset()->getTTL(), isc::dns::RRTTL(300));
 }
 
 // checks if the given rrset matches the




More information about the bind10-changes mailing list