Commit a0156927 authored by Mukund Sivaraman's avatar Mukund Sivaraman
Browse files

Merge branch 'master' into trac2390_2

parents 814eb8ad 971ac669
563. [build] jinmei
Added --disable-rpath configure option to avoid embedding library
paths to binaries. Patch from Adam Tkac.
(Trac #2667, git 1c50c5a6ee7e9675e3ab154f2c7f975ef519fca2)
562. [func]* vorner
The b10-xfrin now performs basic sanity check on just received
zone. It'll reject severely broken zones (such as missng NS
records).
(Trac #2439, git 44699b4b18162581cd1dd39be5fb76ca536012e6)
561. [bug] kambe, jelte
b10-stats-httpd no longer dumps request information to the console,
but uses the bind10 logging system. Additionally, the logging
......
SUBDIRS = guide
EXTRA_DIST = version.ent.in
EXTRA_DIST = version.ent.in differences.txt
devel:
mkdir -p html
......
Differences of Bind 10 to other software
========================================
Bind 9
------
TODO: There are definitely more differences than just this.
* When an incoming zone transfer fails, for example because the
received zone doesn't contain a NS record, bind 9 stops serving the
zone and returns SERVFAIL to queries for that zone. Bind 10 still
uses the previous version of zone.
......@@ -14,9 +14,10 @@ AC_LANG([C++])
# Checks for BIND 10 headers and libraries
AX_ISC_BIND10
# We use -R, -rpath etc so the resulting program will be more likekly to
# We use -R option etc so the resulting program will be more likekly to
# "just work" by default. Embedding a specific library path is a controversial
# practice, though; if you don't like it you can remove the following setting.
# practice, though; if you don't like it you can remove the following setting,
# or use the --disable-rpath option.
if test "x$BIND10_RPATH" != "x"; then
LDFLAGS="$LDFLAGS $BIND10_RPATH"
fi
......
......@@ -3,44 +3,54 @@ dnl
dnl @summary figure out whether and which "rpath" linker option is available
dnl
dnl This macro checks if the linker supports an option to embed a path
dnl to a runtime library (often installed in an uncommon place), such as
dnl gcc's -rpath option. If found, it sets the ISC_RPATH_FLAG variable to
dnl to a runtime library (often installed in an uncommon place), such as the
dnl commonly used -R option. If found, it sets the ISC_RPATH_FLAG variable to
dnl the found option flag. The main configure.ac can use it as follows:
dnl if test "x$ISC_RPATH_FLAG" != "x"; then
dnl LDFLAGS="$LDFLAGS ${ISC_RPATH_FLAG}/usr/local/lib/some_library"
dnl fi
dnl
dnl If you pass --disable-rpath to configure, ISC_RPATH_FLAG is not set
AC_DEFUN([AX_ISC_RPATH], [
# We'll tweak both CXXFLAGS and CCFLAGS so this function will work whichever
# language is used in the main script. Note also that it's not LDFLAGS;
# technically this is a linker flag, but we've noticed $LDFLAGS can be placed
# where the compiler could interpret it as a compiler option, leading to
# subtle failure mode. So, in the check below using the compiler flag is
# safer (in the actual Makefiles the flag should be set in LDFLAGS).
CXXFLAGS_SAVED="$CXXFLAGS"
CXXFLAGS="$CXXFLAGS -Wl,-R/usr/lib"
CCFLAGS_SAVED="$CCFLAGS"
CCFLAGS="$CCFLAGS -Wl,-R/usr/lib"
AC_ARG_ENABLE(rpath,
[AC_HELP_STRING([--disable-rpath], [don't hardcode library path into binaries])],
rpath=$enableval, rpath=yes)
if test x$rpath != xno; then
# We'll tweak both CXXFLAGS and CCFLAGS so this function will work
# whichever language is used in the main script. Note also that it's not
#LDFLAGS; technically this is a linker flag, but we've noticed $LDFLAGS
# can be placed where the compiler could interpret it as a compiler
# option, leading to subtle failure mode. So, in the check below using
# the compiler flag is safer (in the actual Makefiles the flag should be
# set in LDFLAGS).
CXXFLAGS_SAVED="$CXXFLAGS"
CXXFLAGS="$CXXFLAGS -Wl,-R/usr/lib"
CCFLAGS_SAVED="$CCFLAGS"
CCFLAGS="$CCFLAGS -Wl,-R/usr/lib"
# check -Wl,-R and -R rather than gcc specific -rpath to be as portable
# as possible. -Wl,-R seems to be safer, so we try it first. In some cases
# -R is not actually recognized but AC_TRY_LINK doesn't fail due to that.
AC_MSG_CHECKING([whether -Wl,-R flag is available in linker])
AC_TRY_LINK([],[],
[ AC_MSG_RESULT(yes)
ISC_RPATH_FLAG=-Wl,-R
],[ AC_MSG_RESULT(no)
AC_MSG_CHECKING([whether -R flag is available in linker])
CXXFLAGS="$CXXFLAGS_SAVED -R"
CCFLAGS="$CCFLAGS_SAVED -R"
# check -Wl,-R and -R rather than gcc specific -rpath to be as portable
# as possible. -Wl,-R seems to be safer, so we try it first. In some
# cases -R is not actually recognized but AC_TRY_LINK doesn't fail due to
# that.
AC_MSG_CHECKING([whether -Wl,-R flag is available in linker])
AC_TRY_LINK([],[],
[ AC_MSG_RESULT(yes)
ISC_RPATH_FLAG=-Wl,-R
],[ AC_MSG_RESULT(no)
AC_MSG_CHECKING([whether -R flag is available in linker])
CXXFLAGS="$CXXFLAGS_SAVED -R"
CCFLAGS="$CCFLAGS_SAVED -R"
AC_TRY_LINK([], [],
[ AC_MSG_RESULT([yes; note that -R is more sensitive about the position in option arguments])
ISC_RPATH_FLAG=-R
],[ AC_MSG_RESULT(no) ])
])
])
CXXFLAGS=$CXXFLAGS_SAVED
CCFLAGS=$CCFLAGS_SAVED
CXXFLAGS=$CXXFLAGS_SAVED
CCFLAGS=$CCFLAGS_SAVED
fi
])dnl AX_ISC_RPATH
......@@ -93,7 +93,7 @@
file. It has the same name, with ".backup" appended to it. If a
file of that name already exists, the file will have the suffix
".backup-1". If that exists, the file will be suffixed ".backup-2",
and so on). Exit status is 0 if the upgrade is either succesful or
and so on). Exit status is 0 if the upgrade is either successful or
aborted by the user, and non-zero if there is an error.
</para>
......
......@@ -687,7 +687,7 @@ public:
virtual void commit() {
if (options_ == NULL) {
isc_throw(isc::InvalidOperation, "parser logic error: storage must be set before "
"commiting option data.");
"committing option data.");
} else if (!option_descriptor_.option) {
// Before we can commit the new option should be configured. If it is not
// than somebody must have called commit() before build().
......@@ -1855,7 +1855,7 @@ configureDhcp4Server(Dhcpv4Srv&, ConstElementPtr config_set) {
LOG_INFO(dhcp4_logger, DHCP4_CONFIG_COMPLETE).arg(config_details);
// Everything was fine. Configuration is successful.
answer = isc::config::createAnswer(0, "Configuration commited.");
answer = isc::config::createAnswer(0, "Configuration committed.");
return (answer);
}
......
......@@ -61,6 +61,7 @@ Dhcpv4Srv::Dhcpv4Srv(uint16_t port, const char* dbconfig) {
string srvid_file = CfgMgr::instance().getDataDir() + "/" + string(SERVER_ID_FILE);
if (loadServerID(srvid_file)) {
LOG_DEBUG(dhcp4_logger, DBG_DHCP4_START, DHCP4_SERVERID_LOADED)
.arg(srvidToString(getServerID()))
.arg(srvid_file);
} else {
generateServerID();
......
......@@ -716,7 +716,7 @@ public:
virtual void commit() {
if (options_ == NULL) {
isc_throw(isc::InvalidOperation, "parser logic error: storage must be set before "
"commiting option data.");
"committing option data.");
} else if (!option_descriptor_.option) {
// Before we can commit the new option should be configured. If it is not
// than somebody must have called commit() before build().
......@@ -1908,7 +1908,7 @@ configureDhcp6Server(Dhcpv6Srv&, ConstElementPtr config_set) {
LOG_INFO(dhcp6_logger, DHCP6_CONFIG_COMPLETE).arg(config_details);
// Everything was fine. Configuration is successful.
answer = isc::config::createAnswer(0, "Configuration commited.");
answer = isc::config::createAnswer(0, "Configuration committed.");
return (answer);
}
......
......@@ -78,6 +78,7 @@ Dhcpv6Srv::Dhcpv6Srv(uint16_t port)
string duid_file = CfgMgr::instance().getDataDir() + "/" + string(SERVER_DUID_FILE);
if (loadServerID(duid_file)) {
LOG_DEBUG(dhcp6_logger, DBG_DHCP6_START, DHCP6_SERVERID_LOADED)
.arg(duidToString(getServerID()))
.arg(duid_file);
} else {
generateServerID();
......
......@@ -153,13 +153,19 @@ class MockCC(MockModuleCCSession):
def remove_remote_config(self, module_name):
pass
class MockRRsetCollection:
'''
A mock RRset collection. We don't use it really (we mock the method that
it is passed to too), so it's empty.
'''
pass
class MockDataSourceClient():
'''A simple mock data source client.
This class provides a minimal set of wrappers related the data source
API that would be used by Diff objects. For our testing purposes they
only keep truck of the history of the changes.
only keep track of the history of the changes.
'''
def __init__(self):
self.force_fail = False # if True, raise an exception on commit
......@@ -217,6 +223,12 @@ class MockDataSourceClient():
self._journaling_enabled = journaling
return self
def get_rrset_collection(self):
'''
Pretend to be a zone updater and provide a (dummy) rrset collection.
'''
return MockRRsetCollection()
def add_rrset(self, rrset):
self.diffs.append(('add', rrset))
......@@ -726,11 +738,27 @@ class TestXfrinConnection(unittest.TestCase):
'tsig_1st': None,
'tsig_2nd': None
}
self.__orig_check_zone = xfrin.check_zone
xfrin.check_zone = self.__check_zone
self._check_zone_result = True
self._check_zone_params = None
def tearDown(self):
self.conn.close()
if os.path.exists(TEST_DB_FILE):
os.remove(TEST_DB_FILE)
xfrin.check_zone = self.__orig_check_zone
def __check_zone(self, name, rrclass, rrsets, callbacks):
'''
A mock function used instead of dns.check_zone.
'''
self._check_zone_params = (name, rrclass, rrsets, callbacks)
# Call both callbacks to see they do nothing. This checks
# the transfer depends on the result only.
callbacks[0]("Test error")
callbacks[1]("Test warning")
return self._check_zone_result
def _create_normal_response_data(self):
# This helper method creates a simple sequence of DNS messages that
......@@ -825,6 +853,7 @@ class TestAXFR(TestXfrinConnection):
def tearDown(self):
time.time = self.orig_time_time
super().tearDown()
def __create_mock_tsig(self, key, error, has_last_signature=True):
# This helper function creates a MockTSIGContext for a given key
......@@ -1297,6 +1326,33 @@ class TestAXFR(TestXfrinConnection):
[[('add', ns_rr), ('add', a_rr), ('add', soa_rrset)]],
self.conn._datasrc_client.committed_diffs)
def test_axfr_response_fail_validation(self):
"""
Test we reject a zone transfer if it fails the check_zone validation.
"""
a_rr = self._create_a('192.0.2.1')
self.conn._send_query(RRType.AXFR())
self.conn.reply_data = self.conn.create_response_data(
questions=[Question(TEST_ZONE_NAME, TEST_RRCLASS,
RRType.AXFR())],
# begin serial=1230, end serial=1234. end will be used.
answers=[begin_soa_rrset, a_rr, soa_rrset])
# Make it fail the validation
self._check_zone_result = False
self.assertRaises(XfrinZoneError, self.conn._handle_xfrin_responses)
self.assertEqual(type(XfrinAXFREnd()), type(self.conn.get_xfrstate()))
self.assertEqual([], self.conn._datasrc_client.committed_diffs)
# Check the validation is called with the correct parameters
self.assertEqual(TEST_ZONE_NAME, self._check_zone_params[0])
self.assertEqual(TEST_RRCLASS, self._check_zone_params[1])
self.assertTrue(isinstance(self._check_zone_params[2],
MockRRsetCollection))
# Check we can safely call the callbacks. They have no sideeffects
# we can check (checking logging is hard), but we at least check
# they don't crash.
self._check_zone_params[3][0]("Test error")
self._check_zone_params[3][1]("Test warning")
def test_axfr_response_extra(self):
'''Test with an extra RR after the end of AXFR session.
......@@ -1499,6 +1555,15 @@ class TestAXFR(TestXfrinConnection):
self.conn.response_generator = self._create_normal_response_data
self.assertEqual(self.conn.do_xfrin(False), XFRIN_FAIL)
def test_do_xfrin_invalid_zone(self):
"""
Test receiving an invalid zone. We mock the check and see the whole
transfer is rejected.
"""
self._check_zone_result = False
self.conn.response_generator = self._create_normal_response_data
self.assertEqual(self.conn.do_xfrin(False), XFRIN_FAIL)
def test_do_soacheck_and_xfrin(self):
self.conn.response_generator = self._create_soa_response_data
self.assertEqual(self.conn.do_xfrin(True), XFRIN_OK)
......@@ -1576,6 +1641,26 @@ class TestIXFRResponse(TestXfrinConnection):
[[('delete', begin_soa_rrset), ('add', soa_rrset)]],
self.conn._datasrc_client.committed_diffs)
def test_ixfr_response_fail_validation(self):
'''
An IXFR that fails validation later on. Check it is rejected.
'''
self.conn.reply_data = self.conn.create_response_data(
questions=[Question(TEST_ZONE_NAME, TEST_RRCLASS, RRType.IXFR())],
answers=[soa_rrset, begin_soa_rrset, soa_rrset, soa_rrset])
self._check_zone_result = False
self.assertRaises(XfrinZoneError, self.conn._handle_xfrin_responses)
self.assertEqual([], self.conn._datasrc_client.committed_diffs)
self.assertEqual(TEST_ZONE_NAME, self._check_zone_params[0])
self.assertEqual(TEST_RRCLASS, self._check_zone_params[1])
self.assertTrue(isinstance(self._check_zone_params[2],
MockRRsetCollection))
# Check we can safely call the callbacks. They have no sideeffects
# we can check (checking logging is hard), but we at least check
# they don't crash.
self._check_zone_params[3][0]("Test error")
self._check_zone_params[3][1]("Test warning")
def test_ixfr_response_multi_sequences(self):
'''Similar to the previous case, but with multiple diff seqs.
......
......@@ -36,6 +36,7 @@ from isc.xfrin.diff import Diff
from isc.server_common.auth_command import auth_loadzone_command
from isc.server_common.tsig_keyring import init_keyring, get_keyring
from isc.log_messages.xfrin_messages import *
from isc.dns import *
isc.log.init("b10-xfrin", buffer=True)
logger = isc.log.Logger("xfrin")
......@@ -45,13 +46,6 @@ logger = isc.log.Logger("xfrin")
DBG_PROCESS = logger.DBGLVL_TRACE_BASIC
DBG_COMMANDS = logger.DBGLVL_TRACE_DETAIL
try:
from pydnspp import *
except ImportError as e:
# C++ loadable module may not be installed; even so the xfrin process
# must keep running, so we warn about it and move forward.
logger.error(XFRIN_IMPORT_DNS, str(e))
isc.util.process.rename()
# If B10_FROM_BUILD is set in the environment, we use data files
......@@ -100,8 +94,17 @@ class XfrinProtocolError(Exception):
'''
pass
class XfrinZoneError(Exception):
'''
An exception raised when the received zone is broken enough to be unusable.
'''
pass
class XfrinZoneUptodate(Exception):
'''TBD
'''
Thrown when the zone is already up to date, so there's no need to download
the zone. This is not really an error case (but it's still an exceptional
condition and the control flow is different than usual).
'''
pass
......@@ -427,10 +430,10 @@ class XfrinIXFRAdd(XfrinState):
conn.get_transfer_stats().ixfr_changeset_count += 1
soa_serial = get_soa_serial(rr.get_rdata()[0])
if soa_serial == conn._end_serial:
# The final part is there. Check all was signed
# and commit it to the database.
conn._check_response_tsig_last()
conn._diff.commit()
# The final part is there. Finish the transfer by
# checking the last TSIG (if required), the zone data and
# commiting.
conn.finish_transfer()
self.set_xfrstate(conn, XfrinIXFREnd())
return True
elif soa_serial != conn._current_serial:
......@@ -500,15 +503,11 @@ class XfrinAXFREnd(XfrinState):
"""
Final processing after processing an entire AXFR session.
In this process all the AXFR changes are committed to the
data source.
There might be more actions here, but for now we simply return False,
indicating there will be no more message to receive.
This simply calls the finish_transfer method of the connection
that ensures it is signed by TSIG (if required), the zone data
is valid and commits it.
"""
conn._check_response_tsig_last()
conn._diff.commit()
conn.finish_transfer()
return False
class XfrinTransferStats:
......@@ -805,6 +804,31 @@ class XfrinConnection(asyncore.dispatcher):
raise XfrinProtocolError('TSIG verify fail: no TSIG on last '+
'message')
def __validate_error(self, reason):
'''
Used as error callback below.
'''
logger.error(XFRIN_ZONE_INVALID, self._zone_name, self._rrclass,
reason)
def __validate_warning(self, reason):
'''
Used as warning callback below.
'''
logger.warn(XFRIN_ZONE_WARN, self._zone_name, self._rrclass, reason)
def finish_transfer(self):
"""
Perform any necessary checks after a transfer. Then complete the
transfer by commiting the transaction into the data source.
"""
self._check_response_tsig_last()
if not check_zone(self._zone_name, self._rrclass,
self._diff.get_rrset_collection(),
(self.__validate_error, self.__validate_warning)):
raise XfrinZoneError('Validation of the new zone failed')
self._diff.commit()
def __parse_soa_response(self, msg, response_data):
'''Parse a response to SOA query and extract the SOA from answer.
......@@ -950,8 +974,16 @@ class XfrinConnection(asyncore.dispatcher):
# of trying another primary server, etc, but for now we treat it
# as "success".
pass
except XfrinZoneError:
# The log message doesn't contain the exception text, since there's
# only one place where the exception is thrown now and it'd be the
# same generic message every time.
logger.error(XFRIN_INVALID_ZONE_DATA, self.zone_str(),
format_addrinfo(self._master_addrinfo))
ret = XFRIN_FAIL
except XfrinProtocolError as e:
logger.info(XFRIN_XFR_TRANSFER_PROTOCOL_ERROR, req_str,
# FIXME: Why is this .info? Even the messageID contains "ERROR".
logger.info(XFRIN_XFR_TRANSFER_PROTOCOL_VIOLATION, req_str,
self.zone_str(),
format_addrinfo(self._master_addrinfo), str(e))
ret = XFRIN_FAIL
......
......@@ -77,6 +77,11 @@ is not equal to the requested SOA serial.
There was an error importing the python DNS module pydnspp. The most
likely cause is a PYTHONPATH problem.
% XFRIN_INVALID_ZONE_DATA zone %1 received from %2 is broken and unusable
The zone was received, but it failed sanity validation. The previous version
of zone (if any is available) will be used. Look for previous
XFRIN_ZONE_INVALID messages to see the exact problem(s).
% XFRIN_IXFR_TRANSFER_SUCCESS incremental IXFR transfer of zone %1 succeeded (messages: %2, changesets: %3, deletions: %4, additions: %5, bytes: %6, run time: %7 seconds, %8 bytes/second)
The IXFR transfer for the given zone was successful.
The provided information contains the following values:
......@@ -205,7 +210,7 @@ such that the remote server doesn't support IXFR, we don't have the SOA record
(or the zone at all), we are out of sync, etc. In many of these situations,
AXFR could still work. Therefore we try that one in case it helps.
% XFRIN_XFR_TRANSFER_PROTOCOL_ERROR %1 transfer of zone %2 with %3 failed: %4
% XFRIN_XFR_TRANSFER_PROTOCOL_VIOLATION %1 transfer of zone %2 with %3 failed: %4
The XFR transfer for the given zone has failed due to a protocol
error, such as an unexpected response from the primary server. The
error is shown in the log message. It may be because the primary
......@@ -232,6 +237,12 @@ zones at a higher level. In future it is more likely that a separate
zone management framework is provided, and the situation where the
given zone isn't found in xfrout will be treated as an error.
% XFRIN_ZONE_INVALID Newly received zone %1/%2 fails validation: %3
The zone was received successfully, but it failed validation. The problem
is severe enough that the new version of zone is discarded and the old version,
if any, will stay in use. New transfer will be attempted after some time.
The problem needs to be fixed in the zone data on the remote server.
% XFRIN_ZONE_MULTIPLE_SOA Zone %1 has %2 SOA RRs
On starting an xfrin session, it is identified that the zone to be
transferred has multiple SOA RRs. Such a zone is broken, but could be
......@@ -258,3 +269,9 @@ the latest version of the zone. But if the primary server is known to
be the real source of the zone, some unexpected inconsistency may have
happened, and you may want to take a closer look. In this case xfrin
doesn't perform subsequent zone transfer.
% XFRIN_ZONE_WARN Newly received zone %1/%2 has a problem: %3
The zone was received successfully, but when checking it, it was discovered
there's some issue with it. It might be correct, but it should be checked
and possibly fixed on the remote server. The problem is described in the
message. The problem does not stop the zone from being used.
......@@ -197,6 +197,16 @@ modify the database). This is what the client would do when such RRs
were given in a DNS response according to RFC2181. The data in
database should be checked and fixed.
% DATASRC_DATABASE_JOURNALREADER_BADDATA failed to convert a diff to RRset in %1/%2 on %3 between %4 and %5: %6
This is an error message indicating that a zone's diff is broken and
the data source library failed to convert it to a valid RRset. The
most likely cause of this is that someone has manually modified the
zone's diff in the database and inserted invalid data as a result.
The zone's name and class, database name, and the start and end
serials, and an additional detail of the error are shown in the
message. The administrator should examine the diff in the database
to find any invalid data and fix it.
% DATASRC_DATABASE_JOURNALREADER_END %1/%2 on %3 from %4 to %5
This is a debug message indicating that the program (successfully)
reaches the end of sequences of a zone's differences. The zone's name
......@@ -215,16 +225,6 @@ a zone's difference sequences from a database-based data source. The
zone's name and class, database name, and the start and end serials
are shown in the message.
% DATASRC_DATABASE_JOURNALREADER_BADDATA failed to convert a diff to RRset in %1/%2 on %3 between %4 and %5: %6
This is an error message indicating that a zone's diff is broken and
the data source library failed to convert it to a valid RRset. The
most likely cause of this is that someone has manually modified the
zone's diff in the database and inserted invalid data as a result.
The zone's name and class, database name, and the start and end
serials, and an additional detail of the error are shown in the
message. The administrator should examine the diff in the database
to find any invalid data and fix it.
% DATASRC_DATABASE_NO_MATCH not match for %2/%3/%4 in %1
No match (not even a wildcard) was found in the named data source for the given
name/type/class in the data source.
......@@ -442,6 +442,10 @@ shown name, the search tries the superdomain name that share the shown
www.example.com. with shown label count of 3, example.com. is being
tried).
% DATASRC_MEM_FIND_TYPE_AT_ORIGIN origin query for type %1 in in-memory zone %2/%3 successful
Debug information. A specific type RRset is requested at a zone origin
of an in-memory zone and it is found.
% DATASRC_MEM_FIND_ZONE looking for zone '%1'
Debug information. A zone object for this zone is being searched for in the
in-memory data source.
......
......@@ -59,8 +59,7 @@ TreeNodeRRset::getName() const {
const RRTTL&
TreeNodeRRset::getTTL() const {
if (ttl_ == NULL) {
util::InputBuffer ttl_buffer(rdataset_->getTTLData(),
sizeof(uint32_t));
util::InputBuffer ttl_buffer(ttl_data_, sizeof(uint32_t));
ttl_ = new RRTTL(ttl_buffer);
}
......@@ -169,7 +168,7 @@ TreeNodeRRset::toWire(AbstractMessageRenderer& renderer) const {
// Render the main (non RRSIG) RRs
const size_t rendered_rdata_count =
writeRRs(renderer, rdataset_->getRdataCount(), name_labels,
rdataset_->type, rrclass_, rdataset_->getTTLData(), reader,
rdataset_->type, rrclass_, ttl_data_, reader,
&RdataReader::iterateRdata);
if (renderer.isTruncated()) {
return (rendered_rdata_count);
......@@ -180,7 +179,7 @@ TreeNodeRRset::toWire(AbstractMessageRenderer& renderer) const {
// Render any RRSIGs, if we supposed to do so
const size_t rendered_rrsig_count = dnssec_ok_ ?
writeRRs(renderer, rrsig_count_, name_labels, RRType::RRSIG(),
rrclass_, rdataset_->getTTLData(), reader,
rrclass_, ttl_data_, reader,
&RdataReader::iterateSingleSig) : 0;
return (rendered_rdata_count + rendered_rrsig_count);
......
......@@ -112,12 +112,34 @@ public:
const RdataSet* rdataset, bool dnssec_ok) :
node_(node), rdataset_(rdataset),
rrsig_count_(rdataset_->getSigRdataCount()), rrclass_(rrclass),
dnssec_ok_(dnssec_ok), name_(NULL), realname_(NULL), ttl_(NULL)
dnssec_ok_(dnssec_ok), name_(NULL), realname_(NULL),
ttl_data_(rdataset->getTTLData()), ttl_(NULL)
{}
/// \brief Constructor with a specific TTL.
///
/// This constructor is mostly the same as the normal version, but takes
/// an extra parameter, \c ttl_data. It's expected to point to a memory
/// region at least for 32 bits, and the corresponding 32-bit data will
/// be used as wire-format TTL value of the RRset, instead of the TTL
/// associated with \c rdataset.
///
/// It's the caller's responsibility to guarantee the memory region is
/// valid and intact throughout the lifetime of the RRset.
///
/// \throw None
TreeNodeRRset(const dns::RRClass& rrclass, const ZoneNode* node,
const RdataSet* rdataset, bool dnssec_ok,
const void* ttl_data) :
node_(node), rdataset_(rdataset),
rrsig_count_(rdataset_->getSigRdataCount()), rrclass_(rrclass),
dnssec_ok_(dnssec_ok), name_(NULL), realname_(NULL),
ttl_data_(ttl_data), ttl_(NULL)
{}
/// \brief Constructor for wildcard-expanded owner name.
///
/// This constructor is mostly the same as the other version, but takes
/// This constructor is mostly the same as the normal version, but takes
/// an extra parameter, \c realname. It effectively overrides the owner
/// name of the RRset; wherever the owner name is used (e.g., in the
/// \c toWire() method), the specified name will be used instead of
......@@ -133,7 +155,7 @@ public:
node_(node), rdataset_(rdataset),
rrsig_count_(rdataset_->getSigRdataCount()), rrclass_(rrclass),
dnssec_ok_(dnssec_ok), name_(NULL), realname_(new dns::Name(realname)),
ttl_(NULL)
ttl_data_(rdataset->getTTLData()), ttl_(NULL)
{}