BIND 10 master, updated. ceeb87f6d539c413ebdc66e4cf718e7eb8559c45 Merge branch 'master' into trac1462

BIND 10 source code commits bind10-changes at lists.isc.org
Wed Jan 4 03:20:01 UTC 2012


The branch, master has been updated
       via  ceeb87f6d539c413ebdc66e4cf718e7eb8559c45 (commit)
       via  0fa94211a98fbfbd15bde8929c9317eeba2888d7 (commit)
       via  6c0170de9a6b46c077c9babc2858263a7dc51d83 (commit)
       via  8c0f14ccee6098c9b95c6b3962e5c47d229533fa (commit)
       via  0f43276e0bbd287aaff58fd4d025d67105d26f12 (commit)
       via  5656072ed849c848ec4014d5e6deb357b9cf5dc2 (commit)
       via  e38899e87a623f8f55768222f76a26a5a6b71671 (commit)
       via  d07b23c15f5347c80d64d612145ff144e2d5134b (commit)
       via  e99849d9e064c97545cda8826df2e05ee53cf7fa (commit)
       via  9a304b1feebd2f06ddddbf5aa5e119cff672ae55 (commit)
      from  707480d9966bc95151de93b2071ee9674c37a3b4 (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 ceeb87f6d539c413ebdc66e4cf718e7eb8559c45
Merge: 0fa94211a98fbfbd15bde8929c9317eeba2888d7 707480d9966bc95151de93b2071ee9674c37a3b4
Author: Xie Jiagui <xiejiagui at cnnic.cn>
Date:   Wed Jan 4 11:18:28 2012 +0800

    Merge branch 'master' into trac1462

commit 0fa94211a98fbfbd15bde8929c9317eeba2888d7
Author: JINMEI Tatuya <jinmei at isc.org>
Date:   Thu Dec 29 23:12:41 2011 -0800

    [1462] added (improved) a test case where serial number arithmetic is crucial.

commit 6c0170de9a6b46c077c9babc2858263a7dc51d83
Author: JINMEI Tatuya <jinmei at isc.org>
Date:   Thu Dec 29 23:01:56 2011 -0800

    [1462] added one more request_serial > current_serial case.  some comment
    cleanup, eliminating redundancy.

commit 8c0f14ccee6098c9b95c6b3962e5c47d229533fa
Author: JINMEI Tatuya <jinmei at isc.org>
Date:   Thu Dec 29 22:57:33 2011 -0800

    [1462] recovered another ixfr-to-axfr test case.

commit 0f43276e0bbd287aaff58fd4d025d67105d26f12
Author: JINMEI Tatuya <jinmei at isc.org>
Date:   Thu Dec 29 22:52:57 2011 -0800

    [1462] recovered an AXFR-style IXFR test case.

commit 5656072ed849c848ec4014d5e6deb357b9cf5dc2
Author: JINMEI Tatuya <jinmei at isc.org>
Date:   Thu Dec 29 22:38:21 2011 -0800

    [1462] some style fixes, mainly removing white spaces from blank lines.

commit e38899e87a623f8f55768222f76a26a5a6b71671
Author: Xie Jiagui <xiejiagui at cnnic.cn>
Date:   Thu Dec 29 17:46:29 2011 +0800

    [1462] Add test for Serial Object,not integer.

commit d07b23c15f5347c80d64d612145ff144e2d5134b
Author: JINMEI Tatuya <jinmei at isc.org>
Date:   Wed Dec 28 12:07:37 2011 -0800

    [1462] cleanup: removed white space in a blank line.

commit e99849d9e064c97545cda8826df2e05ee53cf7fa
Author: Xie Jiagui <xiejiagui at cnnic.cn>
Date:   Fri Dec 23 15:40:36 2011 +0800

    [1462] Changed 'int' serial to 'Serial' object.

commit 9a304b1feebd2f06ddddbf5aa5e119cff672ae55
Author: Xie Jiagui <xiejiagui at cnnic.cn>
Date:   Fri Dec 16 11:37:48 2011 +0800

    [1462] Add SOA check for the requested SOA serial is greater than
    that of the local one.

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

Summary of changes:
 src/bin/xfrout/tests/xfrout_test.py.in |   42 ++++++++++++++++++++++++++-----
 src/bin/xfrout/xfrout.py.in            |   11 +++-----
 2 files changed, 39 insertions(+), 14 deletions(-)

-----------------------------------------------------------------------
diff --git a/src/bin/xfrout/tests/xfrout_test.py.in b/src/bin/xfrout/tests/xfrout_test.py.in
index 2c7fab8..67c6008 100644
--- a/src/bin/xfrout/tests/xfrout_test.py.in
+++ b/src/bin/xfrout/tests/xfrout_test.py.in
@@ -38,7 +38,7 @@ TEST_ZONE_NAME_STR = "example.com."
 TEST_ZONE_NAME = Name(TEST_ZONE_NAME_STR)
 TEST_RRCLASS = RRClass.IN()
 IXFR_OK_VERSION = 2011111802
-IXFR_NG_VERSION = 2011112800
+IXFR_NG_VERSION = 2011111803
 SOA_CURRENT_VERSION = 2011112001
 
 # our fake socket, where we can read and insert messages
@@ -110,6 +110,9 @@ class MockDataSrcClient:
             soa_rrset = create_soa(SOA_CURRENT_VERSION)
             soa_rrset.add_rdata(soa_rrset.get_rdata()[0])
             return (ZoneFinder.SUCCESS, soa_rrset)
+        elif name == Name('maxserial.example.com'):
+            soa_rrset = create_soa(0xffffffff)
+            return (ZoneFinder.SUCCESS, soa_rrset)
         elif rrtype == RRType.SOA():
             return (ZoneFinder.SUCCESS, create_soa(SOA_CURRENT_VERSION))
         raise ValueError('Unexpected input to mock finder: bug in test case?')
@@ -718,15 +721,32 @@ class TestXfroutSession(TestXfroutSessionBase):
         self.assertNotEqual(None, self.xfrsess._iterator)
         self.assertEqual(None, self.xfrsess._jnl_reader)
 
-        # Successful case, but the requested SOA serial is equal to that of
+        # Successful case, but the requested SOA serial is greater than that of
         # the local SOA.  Both iterator and jnl_reader should be None,
         # indicating that the response will contain just one SOA.
+        self.mdata = self.create_request_data(ixfr=SOA_CURRENT_VERSION+1)
+        self.assertEqual(self.xfrsess._xfrout_setup(
+                self.getmsg(), TEST_ZONE_NAME, TEST_RRCLASS), Rcode.NOERROR())
+        self.assertEqual(None, self.xfrsess._iterator)
+        self.assertEqual(None, self.xfrsess._jnl_reader)
+
+        # Similar to the previous case, but the requested serial is equal to
+        # the local SOA.
         self.mdata = self.create_request_data(ixfr=SOA_CURRENT_VERSION)
         self.assertEqual(self.xfrsess._xfrout_setup(
                 self.getmsg(), TEST_ZONE_NAME, TEST_RRCLASS), Rcode.NOERROR())
         self.assertEqual(None, self.xfrsess._iterator)
         self.assertEqual(None, self.xfrsess._jnl_reader)
 
+        # Similar to the previous case, but the comparison should be done
+        # based on serial number arithmetic, not as integers.
+        zone_name = Name('maxserial.example.com') # whose SOA is 0xffffffff
+        self.mdata = self.create_request_data(ixfr=1, zone_name=zone_name)
+        self.assertEqual(self.xfrsess._xfrout_setup(
+                 self.getmsg(), zone_name, TEST_RRCLASS), Rcode.NOERROR())
+        self.assertEqual(None, self.xfrsess._iterator)
+        self.assertEqual(None, self.xfrsess._jnl_reader)
+
         # The data source doesn't support journaling.  Should fallback to AXFR.
         zone_name = Name('nojournal.example.com')
         self.mdata = self.create_request_data(ixfr=IXFR_OK_VERSION,
@@ -1087,7 +1107,7 @@ class TestXfroutSessionWithSQLite3(TestXfroutSessionBase):
         self.xfrsess._request_data = \
             self.create_request_data(ixfr=IXFR_OK_VERSION)
         XfroutSession._handle(self.xfrsess)
-        response = self.sock.read_msg(Message.PRESERVE_ORDER);
+        response = self.sock.read_msg(Message.PRESERVE_ORDER)
         actual_records = response.get_section(Message.SECTION_ANSWER)
         expected_records = [create_soa(2011112001), create_soa(2011111802),
                             create_soa(2011111900),
@@ -1102,11 +1122,9 @@ class TestXfroutSessionWithSQLite3(TestXfroutSessionBase):
         for (expected_rr, actual_rr) in zip(expected_records, actual_records):
             self.assertTrue(rrsets_equal(expected_rr, actual_rr))
 
-    def test_ixfr_soa_only(self):
-        # The requested SOA serial is the latest one.  The response should
-        # contain exactly one SOA of that serial.
+    def ixfr_soa_only_common_checks(self, request_serial):
         self.xfrsess._request_data = \
-            self.create_request_data(ixfr=SOA_CURRENT_VERSION)
+            self.create_request_data(ixfr=request_serial)
         XfroutSession._handle(self.xfrsess)
         response = self.sock.read_msg(Message.PRESERVE_ORDER);
         answers = response.get_section(Message.SECTION_ANSWER)
@@ -1114,6 +1132,16 @@ class TestXfroutSessionWithSQLite3(TestXfroutSessionBase):
         self.assertTrue(rrsets_equal(create_soa(SOA_CURRENT_VERSION),
                                      answers[0]))
 
+    def test_ixfr_soa_only(self):
+        # The requested SOA serial is the latest one.  The response should
+        # contain exactly one SOA of that serial.
+        self.ixfr_soa_only_common_checks(SOA_CURRENT_VERSION)
+
+    def test_ixfr_soa_only2(self):
+        # Similar to the previous test, but the requested SOA is larger than
+        # the current.
+        self.ixfr_soa_only_common_checks(SOA_CURRENT_VERSION + 1)
+
 class MyUnixSockServer(UnixSockServer):
     def __init__(self):
         self._shutdown_event = threading.Event()
diff --git a/src/bin/xfrout/xfrout.py.in b/src/bin/xfrout/xfrout.py.in
index a59fc8a..c6b3275 100755
--- a/src/bin/xfrout/xfrout.py.in
+++ b/src/bin/xfrout/xfrout.py.in
@@ -140,10 +140,9 @@ def get_rrset_len(rrset):
     return len(bytes)
 
 def get_soa_serial(soa_rdata):
-    '''Extract the serial field of an SOA RDATA and returns it as an intger.
-    (borrowed from xfrin)
+    '''Extract the serial field of an SOA RDATA and returns it as an Serial object.
     '''
-    return int(soa_rdata.to_text().split()[2])
+    return Serial(int(soa_rdata.to_text().split()[2]))
 
 class XfroutSession():
     def __init__(self, sock_fd, request_data, server, tsig_key_ring, remote,
@@ -411,11 +410,9 @@ class XfroutSession():
         # a single SOA record of the server's current version, just as
         # in AXFR".  The claim about AXFR is incorrect, but other than that,
         # we do as the RFC says.
-        # Note: until we complete #1278 we can only check equality of the
-        # two serials.  The "newer version" case would fall back to AXFR-style.
         begin_serial = get_soa_serial(remote_soa.get_rdata()[0])
         end_serial = get_soa_serial(self._soa.get_rdata()[0])
-        if begin_serial == end_serial:
+        if begin_serial >= end_serial:
             # clear both iterator and jnl_reader to signal we won't do
             # iteration in response generation
             self._iterator = None
@@ -428,7 +425,7 @@ class XfroutSession():
         # Set up the journal reader or fall back to AXFR-style IXFR
         try:
             code, self._jnl_reader = self._datasrc_client.get_journal_reader(
-                zone_name, begin_serial, end_serial)
+                zone_name, begin_serial.get_value(), end_serial.get_value())
         except isc.datasrc.NotImplemented as ex:
             # The underlying data source doesn't support journaling.
             # Fall back to AXFR-style IXFR.




More information about the bind10-changes mailing list