BIND 10 master, updated. 57b06f8cb6681f591fa63f25a053eb6f422896ef [master] Merge branch 'trac1502'
BIND 10 source code commits
bind10-changes at lists.isc.org
Fri Dec 30 08:19:46 UTC 2011
The branch, master has been updated
via 57b06f8cb6681f591fa63f25a053eb6f422896ef (commit)
via 8f3f6eeff43f670d0c0f71216b87483b73d33607 (commit)
via 760720cb251366fe37bae4a06ce6e0e45ae02a33 (commit)
via cc48c3a82c718f490fc7029eb08a7fb6441c80c5 (commit)
from be309bf010ba993fb13e79bb4ce8802d8dacf0a4 (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 57b06f8cb6681f591fa63f25a053eb6f422896ef
Merge: be309bf 8f3f6ee
Author: JINMEI Tatuya <jinmei at isc.org>
Date: Fri Dec 30 00:18:54 2011 -0800
[master] Merge branch 'trac1502'
-----------------------------------------------------------------------
Summary of changes:
src/lib/python/isc/xfrin/diff.py | 18 ++++++++++++-
src/lib/python/isc/xfrin/libxfrin_messages.mes | 4 +-
src/lib/python/isc/xfrin/tests/diff_tests.py | 30 ++++++++++++++++++++++-
3 files changed, 46 insertions(+), 6 deletions(-)
-----------------------------------------------------------------------
diff --git a/src/lib/python/isc/xfrin/diff.py b/src/lib/python/isc/xfrin/diff.py
index 38b7f39..80fa909 100644
--- a/src/lib/python/isc/xfrin/diff.py
+++ b/src/lib/python/isc/xfrin/diff.py
@@ -162,19 +162,33 @@ class Diff:
and do more merging, but such diffs should be rare in practice anyway,
so we don't bother and do it this simple way.
"""
+ def same_type(rrset1, rrset2):
+ '''A helper routine to identify whether two RRsets are of the
+ same 'type'. For RRSIGs we should consider type covered, too.
+ '''
+ if rrset1.get_type() != isc.dns.RRType.RRSIG() or \
+ rrset2.get_type != isc.dns.RRType.RRSIG():
+ return rrset1.get_type() == rrset2.get_type()
+ # RR type of the both RRsets is RRSIG. Compare type covered.
+ # We know they have exactly one RDATA.
+ sigdata1 = rrset1.get_rdata()[0].to_text().split()[0]
+ sigdata2 = rrset2.get_rdata()[0].to_text().split()[0]
+ return sigdata1 == sigdata2
+
buf = []
for (op, rrset) in self.__buffer:
old = buf[-1][1] if len(buf) > 0 else None
if old is None or op != buf[-1][0] or \
rrset.get_name() != old.get_name() or \
- rrset.get_type() != old.get_type():
+ (not same_type(rrset, old)):
buf.append((op, isc.dns.RRset(rrset.get_name(),
rrset.get_class(),
rrset.get_type(),
rrset.get_ttl())))
if rrset.get_ttl() != buf[-1][1].get_ttl():
logger.warn(LIBXFRIN_DIFFERENT_TTL, rrset.get_ttl(),
- buf[-1][1].get_ttl())
+ buf[-1][1].get_ttl(), rrset.get_name(),
+ rrset.get_class(), rrset.get_type())
for rdatum in rrset.get_rdata():
buf[-1][1].add_rdata(rdatum)
self.__buffer = buf
diff --git a/src/lib/python/isc/xfrin/libxfrin_messages.mes b/src/lib/python/isc/xfrin/libxfrin_messages.mes
index 203e31f..b948e02 100644
--- a/src/lib/python/isc/xfrin/libxfrin_messages.mes
+++ b/src/lib/python/isc/xfrin/libxfrin_messages.mes
@@ -15,10 +15,10 @@
# No namespace declaration - these constants go in the global namespace
# of the libxfrin_messages python module.
-% LIBXFRIN_DIFFERENT_TTL multiple data with different TTLs (%1, %2) on %3/%4. Adjusting %2 -> %1.
+% LIBXFRIN_DIFFERENT_TTL multiple data with different TTLs (%1, %2) on %3/%4/%5. Adjusting %2 -> %1.
The xfrin module received an update containing multiple rdata changes for the
same RRset. But the TTLs of these don't match each other. As we combine them
-together, the later one get's overwritten to the earlier one in the sequence.
+together, the latter one gets overwritten to the earlier one in the sequence.
% LIBXFRIN_NO_JOURNAL disabled journaling for updates to %1 on %2
An attempt was made to create a Diff object with journaling enabled, but
diff --git a/src/lib/python/isc/xfrin/tests/diff_tests.py b/src/lib/python/isc/xfrin/tests/diff_tests.py
index 9944404..7c1158a 100644
--- a/src/lib/python/isc/xfrin/tests/diff_tests.py
+++ b/src/lib/python/isc/xfrin/tests/diff_tests.py
@@ -99,6 +99,8 @@ class DiffTest(unittest.TestCase):
in the tested module.
"""
self.__warn_called = True
+ # Also log the message so we can check the log format (manually)
+ self.orig_logger.warn(*args)
def commit(self):
"""
@@ -430,7 +432,7 @@ class DiffTest(unittest.TestCase):
Test the TTL handling. A warn function should have been called if they
differ, but that's all, it should not crash or raise.
"""
- orig_logger = isc.xfrin.diff.logger
+ self.orig_logger = isc.xfrin.diff.logger
try:
isc.xfrin.diff.logger = self
diff = Diff(self, Name('example.org.'))
@@ -451,7 +453,30 @@ class DiffTest(unittest.TestCase):
self.assertEqual(self.__ttl, diff.get_buffer()[0][1].get_ttl())
self.assertTrue(self.__warn_called)
finally:
- isc.xfrin.diff.logger = orig_logger
+ isc.xfrin.diff.logger = self.orig_logger
+
+ def test_rrsig_ttl(self):
+ '''Similar to the previous test, but for RRSIGs of different covered
+ types.
+
+ They shouldn't be compacted.
+
+ '''
+ diff = Diff(self, Name('example.org.'))
+ rrsig1 = RRset(Name('example.org'), self.__rrclass,
+ RRType.RRSIG(), RRTTL(3600))
+ rrsig1.add_rdata(Rdata(RRType.RRSIG(), self.__rrclass,
+ 'A 5 3 3600 20000101000000 20000201000000 ' +
+ '0 example.org. FAKEFAKEFAKE'))
+ diff.add_data(rrsig1)
+ rrsig2 = RRset(Name('example.org'), self.__rrclass,
+ RRType.RRSIG(), RRTTL(1800))
+ rrsig2.add_rdata(Rdata(RRType.RRSIG(), self.__rrclass,
+ 'AAAA 5 3 3600 20000101000000 20000201000000 ' +
+ '1 example.org. FAKEFAKEFAKE'))
+ diff.add_data(rrsig2)
+ diff.compact()
+ self.assertEqual(2, len(diff.get_buffer()))
def test_relpace(self):
"""
@@ -463,4 +488,5 @@ class DiffTest(unittest.TestCase):
if __name__ == "__main__":
isc.log.init("bind10")
+ isc.log.resetUnitTestRootLogger()
unittest.main()
More information about the bind10-changes
mailing list