Commit 6b203826 authored by Mukund Sivaraman's avatar Mukund Sivaraman
Browse files

Merge branch 'master' into trac2000

parents f9daba2b 670577e8
753. [func] muks
libdns++: the unknown/generic (RFC 3597) RDATA class now uses the
generic lexer in constructors from text.
(Trac #2426, git 0770d2df84e5608371db3a47e0456eb2a340b5f4)
752. [func] tmark
If configured to do so, b10-dhcp4 will now create DHCP-DDNS update
requests and send them to b10-dhcp-ddns for processing.
(Trac# 3329, git 4546dd186782eec5cfcb4ddb61b0a3aa5c700751)
751. [func] muks
The BIND 10 zone loader now supports the $GENERATE directive (a
BIND 9 extension).
(Trac #2430, git b05064f681231fe7f8571253c5786f4ff0f2ca03)
750. [func] tomek
b10-dhcp4, b10-dhcp6: Simple client classification has been
implemented. Incoming packets can be assigned to zero or more
client classes. It is possible to restrict subnet usage to a given
client class. User's Guide and Developer's Guide has been updated.
(Trac #3274, git 1791d19899b92a6ee411199f664bdfc690ec08b2)
749. [bug] tmark
b10-dhcp-ddns now sets the TTL value in RRs that add A, AAAA, or PTR DNS
entries to the lease length provided in instigating NameChangeRequest.
This corrected a bug in which the TTL was always set to 0.
(Trac# 3299, git dbacf27ece77f3d857da793341c6bd31ef1ea239)
748. [bug] marcin
b10-dhcp4 server picks a subnet, to assign address for a directly
connected client, using IP address of the interface on which the
client's message has been received. If the message is received on
the interface for which there is no suitable subnet, the message
is discarded. Also, the subnet for renewing client which unicasts
its request, is selected using ciaddr.
(Trac #3242, git 9e571cc217d6b1a2fd6fdae1565fcc6fde6d08b1)
747. [bug] marcin
libdhcpsrv: server configuration mechanism allows creating definitions
for standard options for which Kea doesn't provide a definition yet.
Without this, the server administrator couldn't configure options for
which a definition didn't exist.
(Trac# 3309, git 16a6ed6e48a6a950670c4874a2e81b1faf287d99)
746. [func] tomek
IOAddress no longer exposes underlying asio objects. The getAddress()
method has been removed and replaced with several convenience methods.
(Trac #1485, git ecdb62db16b3f3d447db4a9d2a4079d5260431f0)
745. [bug] muks
b10-auth now returns rcode=REFUSED for all questions with
qtype=RRSIG (i.e., where RRSIGs are queried directly). This is
because RRSIGs are meaningless without being bundled alongside the
RRs they cover.
(Trac #2226, git 68d24e65c9c3dfee38adfbe1c93367b0083f9a58)
744. [func] marcin
b10-dhcp6: Refactored the code which is processing Client FQDN option.
The major user-visible change is that server generates DDNS
NameChangeRequest for the first IPv6 address (instead of all)
acquired by a client. Also, the server generates fully qualified domain
name from acquired IPv6 address, if the client sends an empty name in
Client FQDN option.
(Trac# 3295, git aa1c94a54114e848c64771fde308fc9ac0c00fd0)
743. [func] tmark
b10-dhcp4 now responds with changes in DDNS behavior based upon
configuration parameters specified through its dhcp-ddns configuration
element. The parameters now supported are override-no-update,
override-client-update, replace-client-name, generated-prefix, and
qualifying-suffix.
(Trac# 3282, git 42b1f1e4c4f5aa48b7588233402876f5012c043c)
742. [func] muks
The authoritative server now includes the datasource configuration
when logging some errors with the
AUTH_DATASRC_CLIENTS_BUILDER_RECONFIGURE_ERROR message ID.
(Trac #2756, git 31872754f36c840b4ec0b412a86afe9f38be86e0)
741. [bug] shane
Remove hard-coded (and unnecessary) TSIG key from error message.
This also prevents a crash if the TSIG name is missing.
(Trac #3099, git 0ba8bbabe09756a4627e80aacdbb5050407faaac)
740. [func] muks
When displaying messages about mismatched configuration data types
in entered values (between the supplied value type and expected
schema type), bindctl now includes both the supplied and expected
configuration data types in the returned error. The user has more
information on what caused the error now.
(Trac #3239, git 84d5eda2a6ae0d737aef68d56023fc33fef623e6)
739. [bug] muks
Various minor updates were made to the SSHFP RDATA parser. Mainly,
the SSHFP constructor no longer throws an isc::BadValue exception.
generic::SSHFP::getFingerprintLen() was also renamed to
getFingerprintLength().
(Trac #3287, git 2f26d781704618c6007ba896ad3d9e0c107d04b0)
738. [bug] muks
b10-auth now correctly processes NXDOMAIN results in the root zone
when using a SQLite3 data source.
(Trac #2951, git 13685cc4580660eaf5b041b683a2d2f31fd24de3)
737. [func] muks
b10-auth now additionally logs the source address and port when
DNS messages with unsupported opcodes are received.
(Trac #1516, git 71611831f6d1aaaea09143d4837eddbd1d67fbf4)
736. [bug] wlodek
b10-dhcp6 is now capable to determine if a received
message is addressed to it, using server identifier option.
The messages with non-matching server identifier are dropped.
(Trac #2892, git 3bd69e9b4ab9be231f7c966fd62b95a4e1595901)
735. [doc] stephen
Expanded Developer's Guide to include chapter on logging.
(Trac #2566, git a08d702839d9df6cddefeccab1e7e657377145de)
734. [bug] marcin
libdhcp++: fixed a bug which caused an error when setting boolean
values for an option. Also, bind10-guide has been updated with the
examples how to set the boolean values for an option.
(Trac# 3292, git 7c4c0514ede3cffc52d8c2874cdbdb74ced5f4ac)
733. [bug] marcin
libdhcp++: a function which opens IPv6/UDPv6 sockets for the
DHCPv6 server, gracefully handles errors to bind socket to
a multicast address.
(Trac #3288, git 76ace0c46a5fe0e53a29dad093b817ad6c891f1b)
732. [func] tomek
b10-dhcp4, b10-dhcp6: Support for simplified client classification
added. Incoming packets are now assigned to a client class based on
......
......@@ -109,7 +109,9 @@ make distcheck
There are other useful switches which can be passed to configure. It is
always a good idea to use \c --enable-logger-checks, which does sanity
checks on logger parameters. If you happen to modify anything in the
checks on logger parameters. Use \c --enable-debug to enable various
additional consistency checks that reduce performance but help during
development. If you happen to modify anything in the
documentation, use \c --enable-generate-docs. If you are modifying DHCP
code, you are likely to be interested in enabling the MySQL backend for
DHCP. Note that if the backend is not enabled, MySQL specific unit-tests
......
......@@ -86,10 +86,10 @@
* - @subpage libdhcp_ddns
*
* @section miscellaneousTopics Miscellaneous Topics
* - @subpage LoggingApi
* - @subpage LoggingApiOverview
* - @subpage LoggingApiLoggerNames
* - @subpage LoggingApiLoggingMessages
* - @subpage logBind10Logging
* - @subpage logBasicIdeas
* - @subpage logDeveloperUse
* - @subpage logNotes
* - @subpage SocketSessionUtility
* - <a href="./doxygen-error.log">Documentation warnings and errors</a>
*
......
This diff is collapsed.
......@@ -383,11 +383,11 @@ This message is also logged when the forwarding is restarted (for instance
if b10-ddns is restarted and the internal connection needs to be created
again), in which case it should be followed by AUTH_START_DDNS_FORWARDER.
% AUTH_UNSUPPORTED_OPCODE unsupported opcode: %1
% AUTH_UNSUPPORTED_OPCODE unsupported opcode %1 received from %2
This is a debug message, produced when a received DNS packet being
processed by the authoritative server has been found to contain an
unsupported opcode. (The opcode is included in the message.) The server
will return an error code of NOTIMPL to the sender.
unsupported opcode. (The opcode and sender details are included in the
message.) The server will return an error code of NOTIMPL to the sender.
% AUTH_XFRIN_CHANNEL_CREATED XFRIN session channel created
This is a debug message indicating that the authoritative server has
......
......@@ -297,6 +297,8 @@ public:
///
/// \param server The DNSServer as passed to processMessage()
/// \param message The response as constructed by processMessage()
/// \param stats_attrs Object to store message attributes in for use
/// with statistics
/// \param done If true, it indicates there is a response.
/// this value will be passed to server->resume(bool)
void resumeServer(isc::asiodns::DNSServer* server,
......@@ -440,12 +442,9 @@ makeErrorMessage(MessageRenderer& renderer, Message& message,
message.setRcode(rcode);
RendererHolder holder(renderer, &buffer, stats_attrs);
if (tsig_context.get() != NULL) {
message.toWire(renderer, *tsig_context);
stats_attrs.setResponseTSIG(true);
} else {
message.toWire(renderer);
}
message.toWire(renderer, tsig_context.get());
stats_attrs.setResponseTSIG(tsig_context.get() != NULL);
LOG_DEBUG(auth_logger, DBG_AUTH_MESSAGES, AUTH_SEND_ERROR_RESPONSE)
.arg(renderer.getLength()).arg(message);
}
......@@ -499,7 +498,7 @@ AuthSrv::processMessage(const IOMessage& io_message, Message& message,
impl_->resumeServer(server, message, stats_attrs, false);
return;
}
} catch (const Exception& ex) {
} catch (const isc::Exception& ex) {
LOG_DEBUG(auth_logger, DBG_AUTH_DETAIL, AUTH_HEADER_PARSE_FAIL)
.arg(ex.what());
impl_->resumeServer(server, message, stats_attrs, false);
......@@ -523,7 +522,7 @@ AuthSrv::processMessage(const IOMessage& io_message, Message& message,
stats_attrs);
impl_->resumeServer(server, message, stats_attrs, true);
return;
} catch (const Exception& ex) {
} catch (const isc::Exception& ex) {
LOG_DEBUG(auth_logger, DBG_AUTH_DETAIL, AUTH_PACKET_PARSE_FAILED)
.arg(ex.what());
makeErrorMessage(impl_->renderer_, message, buffer, Rcode::SERVFAIL(),
......@@ -582,8 +581,9 @@ AuthSrv::processMessage(const IOMessage& io_message, Message& message,
Rcode::NOTIMP(), stats_attrs, tsig_context);
}
} else if (opcode != Opcode::QUERY()) {
const IOEndpoint& remote_ep = io_message.getRemoteEndpoint();
LOG_DEBUG(auth_logger, DBG_AUTH_DETAIL, AUTH_UNSUPPORTED_OPCODE)
.arg(message.getOpcode().toText());
.arg(message.getOpcode().toText()).arg(remote_ep);
makeErrorMessage(impl_->renderer_, message, buffer,
Rcode::NOTIMP(), stats_attrs, tsig_context);
} else if (message.getRRCount(Message::SECTION_QUESTION) != 1) {
......@@ -660,7 +660,7 @@ AuthSrvImpl::processNormalQuery(const IOMessage& io_message,
stats_attrs);
return (true);
}
} catch (const Exception& ex) {
} catch (const isc::Exception& ex) {
LOG_ERROR(auth_logger, AUTH_PROCESS_FAIL).arg(ex.what());
makeErrorMessage(renderer_, message, buffer, Rcode::SERVFAIL(),
stats_attrs);
......@@ -671,12 +671,9 @@ AuthSrvImpl::processNormalQuery(const IOMessage& io_message,
const bool udp_buffer =
(io_message.getSocket().getProtocol() == IPPROTO_UDP);
renderer_.setLengthLimit(udp_buffer ? remote_bufsize : 65535);
if (tsig_context.get() != NULL) {
message.toWire(renderer_, *tsig_context);
stats_attrs.setResponseTSIG(true);
} else {
message.toWire(renderer_);
}
message.toWire(renderer_, tsig_context.get());
stats_attrs.setResponseTSIG(tsig_context.get() != NULL);
LOG_DEBUG(auth_logger, DBG_AUTH_MESSAGES, AUTH_SEND_NORMAL_RESPONSE)
.arg(renderer_.getLength()).arg(message);
return (true);
......@@ -823,7 +820,7 @@ AuthSrvImpl::processNotify(const IOMessage& io_message, Message& message,
.arg(parsed_answer->str());
return (false);
}
} catch (const Exception& ex) {
} catch (const isc::Exception& ex) {
LOG_ERROR(auth_logger, AUTH_ZONEMGR_COMMS).arg(ex.what());
return (false);
}
......@@ -833,12 +830,8 @@ AuthSrvImpl::processNotify(const IOMessage& io_message, Message& message,
message.setRcode(Rcode::NOERROR());
RendererHolder holder(renderer_, &buffer, stats_attrs);
if (tsig_context.get() != NULL) {
message.toWire(renderer_, *tsig_context);
stats_attrs.setResponseTSIG(true);
} else {
message.toWire(renderer_);
}
message.toWire(renderer_, tsig_context.get());
stats_attrs.setResponseTSIG(tsig_context.get() != NULL);
return (true);
}
......
......@@ -104,6 +104,8 @@ public:
/// process. It's normally a reference to an xfr::XfroutClient object,
/// but can refer to a local mock object for testing (or other
/// experimental) purposes.
/// \param ddns_forwarder Forwarder to which DDNS UPDATE requests
/// are passed to
AuthSrv(isc::xfr::AbstractXfroutClient& xfrout_client,
isc::util::io::BaseSocketSessionForwarder& ddns_forwarder);
~AuthSrv();
......
......@@ -37,20 +37,6 @@ using namespace isc::dns;
using namespace isc::datasrc;
using namespace isc::dns::rdata;
// This is a "constant" vector storing desired RR types for the additional
// section. The vector is filled first time it's used.
namespace {
const vector<RRType>&
A_AND_AAAA() {
static vector<RRType> needed_types;
if (needed_types.empty()) {
needed_types.push_back(RRType::A());
needed_types.push_back(RRType::AAAA());
}
return (needed_types);
}
}
namespace isc {
namespace auth {
......@@ -393,6 +379,17 @@ Query::process(datasrc::ClientList& client_list,
response_->setRcode(Rcode::SERVFAIL());
return;
}
if (qtype == RRType::RRSIG()) {
// We will not serve RRSIGs directly. See #2226 and the
// following thread for discussion why:
// http://www.ietf.org/mail-archive/web/dnsext/current/msg07123.html
// RRSIGs go together with their covered RRset.
response_->setHeaderFlag(Message::HEADERFLAG_AA);
response_->setRcode(Rcode::REFUSED());
return;
}
ZoneFinder& zfinder = *result.finder_;
// We have authority for a zone that contain the query name (possibly
......
......@@ -286,6 +286,9 @@ public:
answers_.reserve(RESERVE_RRSETS);
authorities_.reserve(RESERVE_RRSETS);
additionals_.reserve(RESERVE_RRSETS);
a_and_aaaa_.push_back(isc::dns::RRType::A());
a_and_aaaa_.push_back(isc::dns::RRType::AAAA());
}
......@@ -488,6 +491,15 @@ private:
std::vector<isc::dns::ConstRRsetPtr> answers_;
std::vector<isc::dns::ConstRRsetPtr> authorities_;
std::vector<isc::dns::ConstRRsetPtr> additionals_;
private:
/// \brief Returns a reference to a pre-initialized vector (see the
/// \c Query constructor).
const std::vector<isc::dns::RRType>& A_AND_AAAA() const {
return (a_and_aaaa_);
}
std::vector<isc::dns::RRType> a_and_aaaa_;
};
}
......
......@@ -44,6 +44,7 @@
#include <util/unittests/mock_socketsession.h>
#include <dns/tests/unittest_util.h>
#include <util/unittests/wiredata.h>
#include <testutils/dnsmessage_test.h>
#include <testutils/srv_test.h>
#include <testutils/mockups.h>
......@@ -82,8 +83,9 @@ using namespace isc::testutils;
using namespace isc::server_common::portconfig;
using namespace isc::auth::unittest;
using isc::UnitTestUtil;
using boost::scoped_ptr;
using isc::auth::statistics::Counters;
using isc::util::unittests::matchWireData;
using boost::scoped_ptr;
namespace {
const char* const CONFIG_TESTDB =
......@@ -1072,10 +1074,9 @@ TEST_F(AuthSrvTest, builtInQueryViaDNSServer) {
response_message, response_obuffer);
createBuiltinVersionResponse(default_qid, response_data);
EXPECT_PRED_FORMAT4(UnitTestUtil::matchWireData,
response_obuffer->getData(),
response_obuffer->getLength(),
&response_data[0], response_data.size());
matchWireData(&response_data[0], response_data.size(),
response_obuffer->getData(),
response_obuffer->getLength());
// After it has been run, the message should be cleared
EXPECT_EQ(0, parse_message->getRRCount(Message::SECTION_QUESTION));
......@@ -1095,10 +1096,9 @@ TEST_F(AuthSrvTest, builtInQuery) {
server.processMessage(*io_message, *parse_message, *response_obuffer,
&dnsserv);
createBuiltinVersionResponse(default_qid, response_data);
EXPECT_PRED_FORMAT4(UnitTestUtil::matchWireData,
response_obuffer->getData(),
response_obuffer->getLength(),
&response_data[0], response_data.size());
matchWireData(&response_data[0], response_data.size(),
response_obuffer->getData(),
response_obuffer->getLength());
checkAllRcodeCountersZeroExcept(Rcode::NOERROR(), 1);
}
......@@ -1114,10 +1114,9 @@ TEST_F(AuthSrvTest, iqueryViaDNSServer) {
UnitTestUtil::readWireData("iquery_response_fromWire.wire",
response_data);
EXPECT_PRED_FORMAT4(UnitTestUtil::matchWireData,
response_obuffer->getData(),
response_obuffer->getLength(),
&response_data[0], response_data.size());
matchWireData(&response_data[0], response_data.size(),
response_obuffer->getData(),
response_obuffer->getLength());
}
// Install a Sqlite3 data source with testing data.
......
......@@ -22,6 +22,7 @@
#include <dns/message.h>
#include <dns/master_loader.h>
#include <dns/name.h>
#include <dns/labelsequence.h>
#include <dns/nsec3hash.h>
#include <dns/opcode.h>
#include <dns/rcode.h>
......@@ -245,6 +246,13 @@ public:
isc_throw(isc::Unexpected, "unexpected name for NSEC3 test: "
<< name);
}
virtual string calculate(const LabelSequence& ls) const {
assert(ls.isAbsolute());
// This is not very optimal, but it's only going to be used in
// tests.
const Name name(ls.toText());
return (calculate(name));
}
virtual bool match(const rdata::generic::NSEC3PARAM&) const {
return (true);
}
......@@ -1215,6 +1223,13 @@ TEST_P(QueryTest, exactMatchMultipleQueries) {
www_a_txt, zone_ns_txt, ns_addrs_txt);
}
TEST_P(QueryTest, qtypeIsRRSIG) {
// Directly querying for RRSIGs should result in rcode=REFUSED.
EXPECT_NO_THROW(query.process(*list_, qname, RRType::RRSIG(), response));
responseCheck(response, Rcode::REFUSED(), AA_FLAG, 0, 0, 0,
"", "", "");
}
TEST_P(QueryTest, exactMatchIgnoreSIG) {
// Check that we do not include the RRSIG when not requested even when
// we receive it from the data source.
......
......@@ -446,8 +446,9 @@ WARNING: The Python readline module isn't available, so some command line
raise CmdMissParamSyntaxError(cmd.module, cmd.command, name)
param_nr += 1
# Convert parameter value according parameter spec file.
# Ignore check for commands belongs to module 'config' or 'execute
# Convert parameter value according to parameter spec
# file. Ignore check for commands belonging to module 'config'
# or 'execute'.
if cmd.module != CONFIG_MODULE_NAME and\
cmd.module != command_sets.EXECUTE_MODULE_NAME:
for param_name in cmd.params:
......
......@@ -142,7 +142,7 @@ DNSClientImpl::operator()(asiodns::IOFetch::Result result) {
try {
response_->fromWire(response_buf);
} catch (const Exception& ex) {
} catch (const isc::Exception& ex) {
status = DNSClient::INVALID_RESPONSE;
LOG_DEBUG(dctl_logger, DBGLVL_TRACE_DETAIL,
DHCP_DDNS_INVALID_RESPONSE).arg(ex.what());
......
// Copyright (C) 2013 Internet Systems Consortium, Inc. ("ISC")
// Copyright (C) 2013-2014 Internet Systems Consortium, Inc. ("ISC")
//
// Permission to use, copy, modify, and/or distribute this software for any
// purpose with or without fee is hereby granted, provided that the above
......@@ -143,8 +143,8 @@ public:
/// @param ns_addr DNS server address.
/// @param ns_port DNS server port.
/// @param update A DNS Update message to be sent to the server.
/// @param wait A timeout (in seconds) for the response. If a response is
/// not received within the timeout, exchange is interrupted. This value
/// @param wait A timeout (in milliseconds) for the response. If a response
/// is not received within the timeout, exchange is interrupted. This value
/// must not exceed maximal value for 'int' data type.
/// @param tsig_key An @c isc::dns::TSIGKey object representing TSIG
/// context which will be used to render the DNS Update message.
......@@ -173,8 +173,8 @@ public:
/// @param ns_addr DNS server address.
/// @param ns_port DNS server port.
/// @param update A DNS Update message to be sent to the server.
/// @param wait A timeout (in seconds) for the response. If a response is
/// not received within the timeout, exchange is interrupted. This value
/// @param wait A timeout (in milliseconds) for the response. If a response
/// is not received within the timeout, exchange is interrupted. This value
/// must not exceed maximal value for 'int' data type.
void doUpdate(asiolink::IOService& io_service,
const asiolink::IOAddress& ns_addr,
......
// Copyright (C) 2013 Internet Systems Consortium, Inc. ("ISC")
// Copyright (C) 2014 Internet Systems Consortium, Inc. ("ISC")
//
// Permission to use, copy, modify, and/or distribute this software for any
// purpose with or without fee is hereby granted, provided that the above
......@@ -588,10 +588,13 @@ NameAddTransaction::buildAddFwdAddressRequest() {
// Next build the Update Section.
// Create the TTL based on lease length.
dns::RRTTL lease_ttl(getNcr()->getLeaseLength());
// Create the FQDN/IP 'add' RR and add it to the to update section.
// Based on RFC 2136, section 2.5.1
dns::RRsetPtr update(new dns::RRset(fqdn, dns::RRClass::IN(),
getAddressRRType(), dns::RRTTL(0)));
getAddressRRType(), lease_ttl));
addLeaseAddressRdata(update);
request->addRRset(D2UpdateMessage::SECTION_UPDATE, update);
......@@ -599,7 +602,7 @@ NameAddTransaction::buildAddFwdAddressRequest() {
// Now create the FQDN/DHCID 'add' RR and add it to update section.
// Based on RFC 2136, section 2.5.1
update.reset(new dns::RRset(fqdn, dns::RRClass::IN(),
dns::RRType::DHCID(), dns::RRTTL(0)));
dns::RRType::DHCID(), lease_ttl));
addDhcidRdata(update);
request->addRRset(D2UpdateMessage::SECTION_UPDATE, update);
......@@ -635,6 +638,9 @@ NameAddTransaction::buildReplaceFwdAddressRequest() {
// Next build the Update Section.
// Create the TTL based on lease length.
dns::RRTTL lease_ttl(getNcr()->getLeaseLength());
// Create the FQDN/IP 'delete' RR and add it to the update section.
// Based on RFC 2136, section 2.5.2
dns::RRsetPtr update(new dns::RRset(fqdn, dns::RRClass::ANY(),
......@@ -644,7 +650,7 @@ NameAddTransaction::buildReplaceFwdAddressRequest() {
// Create the FQDN/IP 'add' RR and add it to the update section.
// Based on RFC 2136, section 2.5.1
update.reset(new dns::RRset(fqdn, dns::RRClass::IN(),
getAddressRRType(), dns::RRTTL(0)));
getAddressRRType(), lease_ttl));
addLeaseAddressRdata(update);
request->addRRset(D2UpdateMessage::SECTION_UPDATE, update);
......@@ -661,6 +667,9 @@ NameAddTransaction::buildReplaceRevPtrsRequest() {
std::string rev_addr = D2CfgMgr::reverseIpAddress(getNcr()->getIpAddress());
dns::Name rev_ip(rev_addr);
// Create the TTL based on lease length.
dns::RRTTL lease_ttl(getNcr()->getLeaseLength());
// Content on this request is based on RFC 4703, section 5.4
// Reverse replacement has no prerequisites so straight on to
// building the Update section.
......@@ -678,14 +687,14 @@ NameAddTransaction::buildReplaceRevPtrsRequest() {
// Create the FQDN/IP PTR 'add' RR, add the FQDN as the PTR Rdata
// then add it to update section.
update.reset(new dns::RRset(rev_ip, dns::RRClass::IN(),
dns::RRType::PTR(), dns::RRTTL(0)));
dns::RRType::PTR(), lease_ttl));
addPtrRdata(update);
request->addRRset(D2UpdateMessage::SECTION_UPDATE, update);
// Create the FQDN/IP PTR 'add' RR, add the DHCID Rdata
// then add it to update section.
update.reset(new dns::RRset(rev_ip, dns::RRClass::IN(),
dns::RRType::DHCID(), dns::RRTTL(0)));
dns::RRType::DHCID(), lease_ttl));
addDhcidRdata(update);
request->addRRset(D2UpdateMessage::SECTION_UPDATE, update);
......
......@@ -263,8 +263,16 @@ public:
ASSERT_NO_THROW(message.setRcode(Rcode(Rcode::NOERROR_CODE)));
ASSERT_NO_THROW(message.setZone(Name("example.com"), RRClass::IN()));
// Set the response wait time to 0 so as our test is not hanging. This
// should cause instant timeout.
/// @todo The timeout value could be set to 0 to trigger timeout
/// instantly. However, it may lead to situations that the message sent
/// in one test will not be dropped by the kernel by the time, the next
/// test starts. This will lead to intermittent unit test errors as
/// described in the ticket http://bind10.isc.org/ticket/3265.
/// Increasing the timeout to a non-zero value mitigates this problem.
/// The proper way to solve this problem is to receive the packet
/// on our own and drop it. Such a fix will need to be applied not only
/// to this test but also for other tests that rely on arbitrary timeout
/// values.
const int timeout = 500;
// The doUpdate() function starts asynchronous message exchange with DNS
// server. When message exchange is done or timeout occurs, the
......@@ -324,8 +332,10 @@ public:
corrupt_response));
// The socket is now ready to receive the data. Let's post some request
// message then.
const int timeout = 5;
// message then. Set timeout to some reasonable value to make sure that
// there is sufficient amount of time for the test to generate a
// response.
const int timeout = 500;
expected_++;
dns_client_->doUpdate(service_, IOAddress(TEST_ADDRESS), TEST_PORT,
message, timeout);
......
......@@ -16,6 +16,8 @@
#include <dns/opcode.h>
#include <dns/messagerenderer.h>
#include <nc_test_utils.h>
#include <asio.hpp>
#include <asiolink/udp_endpoint.h>
#include <gtest/gtest.h>
......@@ -42,7 +44,9 @@ FauxServer::FauxServer(asiolink::IOService& io_service,
server_socket_.reset(new asio::ip::udp::socket(io_service_.get_io_service(),
asio::ip::udp::v4()));
server_socket_->set_option(asio::socket_base::reuse_address(true));
server_socket_->bind(asio::ip::udp::endpoint(address_.getAddress(), port_));
isc::asiolink::UDPEndpoint endpoint(address_, port_);
server_socket_->bind(endpoint.getASIOEndpoint());