Commit 31d34a20 authored by JINMEI Tatuya's avatar JINMEI Tatuya
Browse files

sync with trunk


git-svn-id: svn://bind10.isc.org/svn/bind10/branches/trac311@3018 e5f2f494-b856-4b98-b285-d166d9295462
parents 7f997565 b711cc8c
98. [build] jinmei
The ./configure script now tries to search some common include
paths for boost header files to minimize the need for explicit
configuration with --with-boost-include. (Trac #323, svn r3006)
97. [func] jinmei
Added a micro benchmark test for query processing of b10-auth.
(Trac #308, svn r2982)
96. [bug] jinmei
Fixed two small issues with configure: Do not set CXXFLAGS so that
it can be customized; Make sure --disable-static works.
(Trac #325, r2976)
bind10-devel-20100917 released on September 17, 2010
95. [doc] jreed
Add b10-zonemgr manual page. Update other docs to introduce
this secondary manager. (Trac #341, svn r2951)
95. [bug] jreed
bin/xfrout and bin/zonemgr: Fixed some stderr output.
(Trac #342, svn r2949)
94. [bug] jelte
bin/xfrout: Fixed a problem in xfrout where only 2 or 3 RRs
were used per DNS message in the xfrout stream.
(Trac #334, r2931)
93. [bug] jinmei
lib/datasrc: A DS query could crash the library (and therefore,
e.g. the authoritative server) if some RR of the same apex name
is stored in the hot spot cache. (Trac #307, svn r2923)
92. [func]* jelte
libdns_python (the python wrappers for libdns++) has been renamed
to pydnspp (Python DNS++). Programs and libraries that used
'import libdns_python' now need to use 'import pydnspp'.
(Trac #314, r2902)
91. [func]* jinmei
lib/cc: Use const pointers and const member functions for the API
as much as possible for safer operations. Basically this does not
change the observable behavior, but some of the API were changed
in a backward incompatible manner. This change also involves more
copies, but at this moment the overhead is deemed acceptable.
(Trac #310, r2803)
90. [build] jinmei
(Darwin/Mac OS X specific) Specify DYLD_LIBRARY_PATH for tests and
experimental run under the source tree. Without this loadable
......
......@@ -17,7 +17,8 @@ This release includes the bind10 master process, b10-msgq message
bus, b10-auth authoritative DNS server (with SQLite3 backend),
b10-cmdctl remote control daemon, b10-cfgmgr configuration manager,
b10-xfrin AXFR inbound service, b10-xfrout outgoing AXFR service,
and a new libdns++ library for C++ with a python wrapper.
b10-zonemgr secondary manager, and a new libdns++ library for C++
with a python wrapper.
Documentation is included and also available via the BIND 10
website at http://bind10.isc.org/
......
......@@ -40,6 +40,14 @@ AC_HELP_STRING([--enable-static-link],
[enable_static_link=yes], [enable_static_link=no])
AM_CONDITIONAL(USE_STATIC_LINK, test $enable_static_link = yes)
# Check validity about some libtool options
if test $enable_static_link = yes -a $enable_static = no; then
AC_MSG_ERROR([--enable-static-link requires --enable-static])
fi
if test $enable_shared = no; then
AC_MSG_ERROR([BIND 10 requires shared libraries to be built])
fi
# OS dependent configuration
SET_ENV_LIBRARY_PATH=no
ENV_LIBRARY_PATH=LD_LIBRARY_PATH
......@@ -167,7 +175,6 @@ LDFLAGS=$LDFLAGS_SAVED
# specify the default warning flags in CXXFLAGS and let specific modules
# "override" the default.
CXXFLAGS=-g
werror_ok=0
# SunStudio compiler requires special compiler options for boost
......@@ -270,14 +277,31 @@ if test "$lcov" != "no"; then
fi
AC_SUBST(USE_LCOV)
#
# Configure Boost header path
#
# If explicitly specified, use it.
AC_ARG_WITH([boost-include],
AC_HELP_STRING([--with-boost-include=PATH],
[specify exact directory for Boost headers]),
[boost_include_path="$withval"])
# If not specified, try some common paths.
if test -z "$with_boost_include"; then
boostdirs="/usr/local /usr/pkg /opt /opt/local"
for d in $boostdirs
do
if test -f $d/include/boost/shared_ptr.hpp; then
boost_include_path=$d/include
break
fi
done
fi
if test "${boost_include_path}" ; then
BOOST_INCLUDES="-I${boost_include_path}"
CPPFLAGS="$CPPFLAGS $BOOST_INCLUDES"
fi
AC_CHECK_HEADERS([boost/shared_ptr.hpp boost/foreach.hpp],,
AC_MSG_ERROR([Missing required header files.]))
AC_SUBST(BOOST_INCLUDES)
#
......@@ -389,10 +413,6 @@ if test "X$ac_cv_have_devpoll" = "Xyes" -a "X$GXX" = "Xyes"; then
CPPFLAGS="$CPPFLAGS -DASIO_DISABLE_DEV_POLL=1"
fi
# Check for headers from required devel kits.
AC_CHECK_HEADERS([boost/shared_ptr.hpp boost/foreach.hpp],,
AC_MSG_ERROR([Missing required header files.]))
AC_ARG_ENABLE(man, [AC_HELP_STRING([--enable-man],
[regenerate man pages [default=no]])] ,enable_man=yes, enable_man=no)
......@@ -423,6 +443,7 @@ AC_CONFIG_FILES([Makefile
src/bin/msgq/tests/Makefile
src/bin/auth/Makefile
src/bin/auth/tests/Makefile
src/bin/auth/benchmarks/Makefile
src/bin/xfrin/Makefile
src/bin/xfrin/tests/Makefile
src/bin/xfrout/Makefile
......@@ -544,7 +565,6 @@ Package:
Flags:
DEFS: $DEFS
CPPFLAGS: $CPPFLAGS
CFLAGS: $CFLAGS
CXXFLAGS: $CXXFLAGS
B10_CXXFLAGS: $B10_CXXFLAGS
dnl includes too
......
This diff is collapsed.
......@@ -42,7 +42,7 @@
<note>
<para>
BIND 10, at this time, does not provide an recursive
BIND 10, at this time, does not provide a recursive
DNS server. It does provide a EDNS0- and DNSSEC-capable
authoritative DNS server.
</para>
......@@ -74,9 +74,9 @@
For this development prototype release, the only supported
data source backend is SQLite3. The authoritative server
requires SQLite 3.3.9 or newer.
The <command>b10-xfrin</command> and <command>b10-xfrout</command>
modules require the libpython3 library and the Python
_sqlite3.so module.
The <command>b10-xfrin</command>, <command>b10-xfrout</command>,
and <command>b10-zonemgr</command> modules require the
libpython3 library and the Python _sqlite3.so module.
</para></note>
<!-- TODO: this will change ... -->
......@@ -165,6 +165,15 @@
</simpara>
</listitem>
<listitem>
<simpara>
<command>b10-zonemgr</command> &mdash;
Secondary manager.
This process keeps track of timers and other
necessary information for BIND 10 to act as a slave server.
</simpara>
</listitem>
</itemizedlist>
</para>
......@@ -650,8 +659,9 @@ var/
The <command>bind10</command> master process will also start up
<command>b10-cmdctl</command> for admins to communicate with the
system, <command>b10-auth</command> for Authoritative DNS service,
<command>b10-xfrin</command> for inbound DNS zone transfers.
and <command>b10-xfrout</command> for outbound DNS zone transfers.
<command>b10-xfrin</command> for inbound DNS zone transfers,
<command>b10-xfrout</command> for outbound DNS zone transfers,
and <command>b10-zonemgr</command> for secondary service.
</para>
<section id="start">
......@@ -1173,14 +1183,14 @@ TODO
transfer. When received, it is stored in the BIND 10
data store, and its records can be served by
<command>b10-auth</command>.
This allows the BIND 10 server to provide
<quote>secondary</quote> service.
In combination with <command>b10-zonemgr</command> (for
automated SOA checks), this allows the BIND 10 server to
provide <quote>secondary</quote> service.
</para>
<note><simpara>
The current development release of BIND 10 only supports
AXFR. (IXFR is not supported.)
It also does not yet support automated SOA checks.
</simpara></note>
<para>
......@@ -1204,12 +1214,13 @@ TODO
sends the zone.
This is used to provide master DNS service to share zones
to secondary name servers.
The <command>b10-xfrout</command> is also used to send
NOTIFY messages to slaves.
</para>
<note><simpara>
The current development release of BIND 10 only supports
AXFR. (IXFR is not supported.)
It also does not yet support NOTIFY.
Access control is not yet provided.
</simpara></note>
......@@ -1226,6 +1237,31 @@ what is XfroutClient xfr_client??
</chapter>
<chapter id="zonemgr">
<title>Secondary Manager</title>
<para>
The <command>b10-zonemgr</command> process is started by
<command>bind10</command>.
It keeps track of SOA refresh, retry, and expire timers
and other details for BIND 10 to perform as a slave.
When the <command>b10-auth</command> authoritative DNS server
receives a NOTIFY message, <command>b10-zonemgr</command>
may tell <command>b10-xfrin</command> to do a refresh
to start an inbound zone transfer.
The secondary manager resets its counters when a new zone is
transferred in.
</para>
<note><simpara>
Access control (such as allowing notifies) is not yet provided.
The primary/secondary service is not yet complete.
</simpara></note>
<!-- TODO: lots to describe for zonemgr -->
</chapter>
<!-- TODO: how to help: run unit tests, join lists, review trac tickets -->
<!-- <index> <title>Index</title> </index> -->
......
SUBDIRS = . tests
SUBDIRS = . tests benchmarks
AM_CPPFLAGS = -I$(top_srcdir)/src/lib -I$(top_builddir)/src/lib
AM_CPPFLAGS += -I$(top_srcdir)/src/bin -I$(top_builddir)/src/bin
......@@ -59,7 +59,7 @@ b10_auth_LDADD += $(top_builddir)/src/lib/dns/libdns++.la
b10_auth_LDADD += $(top_builddir)/src/lib/config/libcfgclient.la
b10_auth_LDADD += $(top_builddir)/src/lib/cc/libcc.la
b10_auth_LDADD += $(top_builddir)/src/lib/exceptions/libexceptions.la
b10_auth_LDADD += $(top_builddir)/src/bin/auth/libasio_link.a
b10_auth_LDADD += libasio_link.a
b10_auth_LDADD += $(top_builddir)/src/lib/xfr/libxfr.la
b10_auth_LDADD += $(SQLITE_LIBS)
......
......@@ -67,7 +67,7 @@ IOAddress::toText() const {
// Note: this implementation is optimized for the case where this object
// is created from an ASIO endpoint object in a receiving code path
// by avoiding to make a copy of the base endpoint. For TCP it may not be
// a bug deal, but when we receive UDP packets at a high rate, the copy
// a big deal, but when we receive UDP packets at a high rate, the copy
// overhead might be significant.
class TCPEndpoint : public IOEndpoint {
public:
......
......@@ -207,7 +207,7 @@ public:
/// will be thrown.
///
/// Memory for the created object will be dynamically allocated. It's
/// caller's responsibility to \c delete it later.
/// the caller's responsibility to \c delete it later.
/// If resource allocation for the new object fails, a corresponding
/// standard exception will be thrown.
///
......
......@@ -69,7 +69,7 @@ private:
public:
AuthSrvImpl(const bool use_cache, AbstractXfroutClient& xfrout_client);
~AuthSrvImpl();
isc::data::ElementPtr setDbFile(const isc::data::ElementPtr config);
isc::data::ConstElementPtr setDbFile(isc::data::ConstElementPtr config);
bool processNormalQuery(const IOMessage& io_message, Message& message,
MessageRenderer& response_renderer);
......@@ -192,6 +192,16 @@ AuthSrv::getVerbose() const {
return (impl_->verbose_mode_);
}
void
AuthSrv::setCacheSlots(const size_t slots) {
impl_->cache_.setSlots(slots);
}
size_t
AuthSrv::getCacheSlots() const {
return (impl_->cache_.getSlots());
}
void
AuthSrv::setXfrinSession(AbstractSession* xfrin_session) {
impl_->xfrin_session_ = xfrin_session;
......@@ -433,7 +443,7 @@ AuthSrvImpl::processNotify(const IOMessage& io_message, Message& message,
static const string command_template_end = "\"}]}";
try {
ElementPtr notify_command = Element::fromJSON(
ConstElementPtr notify_command = Element::fromJSON(
command_template_start + question->getName().toText() +
command_template_master + remote_ip_address +
command_template_rrclass + question->getClass().toText() +
......@@ -441,7 +451,7 @@ AuthSrvImpl::processNotify(const IOMessage& io_message, Message& message,
const unsigned int seq =
xfrin_session_->group_sendmsg(notify_command, "Zonemgr",
"*", "*");
ElementPtr env, answer, parsed_answer;
ConstElementPtr env, answer, parsed_answer;
xfrin_session_->group_recvmsg(env, answer, false, seq);
int rcode;
parsed_answer = parseAnswer(rcode, answer);
......@@ -466,19 +476,17 @@ AuthSrvImpl::processNotify(const IOMessage& io_message, Message& message,
return (true);
}
ElementPtr
AuthSrvImpl::setDbFile(const isc::data::ElementPtr config) {
ElementPtr answer = isc::config::createAnswer();
ElementPtr final;
ConstElementPtr
AuthSrvImpl::setDbFile(ConstElementPtr config) {
ConstElementPtr answer = isc::config::createAnswer();
if (config && config->contains("database_file")) {
db_file_ = config->get("database_file")->stringValue();
final = config;
} else if (config_session_ != NULL) {
bool is_default;
string item("database_file");
ElementPtr value = config_session_->getValue(is_default, item);
final = Element::createMap();
ConstElementPtr value = config_session_->getValue(is_default, item);
ElementPtr final = Element::createMap();
// If the value is the default, and we are running from
// a specific directory ('from build'), we need to use
......@@ -492,6 +500,7 @@ AuthSrvImpl::setDbFile(const isc::data::ElementPtr config) {
"/bind10_zones.sqlite3");
}
final->set(item, value);
config = final;
db_file_ = value->stringValue();
} else {
......@@ -508,7 +517,7 @@ AuthSrvImpl::setDbFile(const isc::data::ElementPtr config) {
// fail, while acquiring resources in the RAII manner. We then perform
// delete and swap operations which should not fail.
DataSrcPtr datasrc_ptr(DataSrcPtr(new Sqlite3DataSrc));
datasrc_ptr->init(final);
datasrc_ptr->init(config);
data_sources_.addDataSrc(datasrc_ptr);
// The following code should be exception free.
......@@ -520,15 +529,12 @@ AuthSrvImpl::setDbFile(const isc::data::ElementPtr config) {
return (answer);
}
ElementPtr
AuthSrv::updateConfig(isc::data::ElementPtr new_config) {
ConstElementPtr
AuthSrv::updateConfig(ConstElementPtr new_config) {
try {
// the ModuleCCSession has already checked if we have
// the correct ElementPtr type as specified in our .spec file
ElementPtr answer = isc::config::createAnswer();
answer = impl_->setDbFile(new_config);
return (answer);
return (impl_->setDbFile(new_config));
} catch (const isc::Exception& error) {
if (impl_->verbose_mode_) {
cerr << "[b10-auth] error: " << error.what() << endl;
......
......@@ -69,10 +69,30 @@ public:
isc::dns::MessageRenderer& response_renderer);
void setVerbose(bool on);
bool getVerbose() const;
isc::data::ElementPtr updateConfig(isc::data::ElementPtr config);
isc::data::ConstElementPtr updateConfig(isc::data::ConstElementPtr config);
isc::config::ModuleCCSession* configSession() const;
void setConfigSession(isc::config::ModuleCCSession* config_session);
/// \brief Set or update the size (number of slots) of hot spot cache.
///
/// If the specified size is 0, it means the size will be unlimited.
/// The specified size is recorded even if the cache is disabled; the
/// new size will be effective when the cache is enabled.
///
/// This method never throws an exception.
///
/// \param slots The number of cache slots.
void setCacheSlots(const size_t slots);
/// \brief Get the current size (number of slots) of hot spot cache.
///
/// It always returns the recorded size regardless of the cache is enabled.
///
/// This method never throws an exception.
///
/// \return The current number of cache slots.
size_t getCacheSlots() const;
///
/// Note: this interface is tentative. We'll revisit the ASIO and session
/// frameworks, at which point the session will probably be passed on
......
......@@ -137,6 +137,7 @@ configuration is not defined\&.
\fBb10-cmdctl\fR(8),
\fBb10-loadzone\fR(8),
\fBb10-msgq\fR(8),
\fBb10-zonemgr\fR(8),
\fBbind10\fR(8),
BIND 10 Guide\&.
.SH "HISTORY"
......
......@@ -200,6 +200,9 @@
<citerefentry>
<refentrytitle>b10-msgq</refentrytitle><manvolnum>8</manvolnum>
</citerefentry>,
<citerefentry>
<refentrytitle>b10-zonemgr</refentrytitle><manvolnum>8</manvolnum>
</citerefentry>,
<citerefentry>
<refentrytitle>bind10</refentrytitle><manvolnum>8</manvolnum>
</citerefentry>,
......
AM_CPPFLAGS = -I$(top_srcdir)/src/lib -I$(top_builddir)/src/lib
AM_CPPFLAGS += -I$(top_srcdir)/src/bin -I$(top_builddir)/src/bin
AM_CXXFLAGS = $(B10_CXXFLAGS)
CLEANFILES = *.gcno *.gcda
noinst_PROGRAMS = query_bench
query_bench_SOURCES = query_bench.cc
query_bench_SOURCES += ../auth_srv.h ../auth_srv.cc
query_bench_LDADD = $(top_builddir)/src/lib/dns/libdns++.la
query_bench_LDADD += $(top_builddir)/src/lib/exceptions/libexceptions.la
query_bench_LDADD += $(top_builddir)/src/lib/bench/libbench.la
query_bench_LDADD += $(top_builddir)/src/lib/datasrc/libdatasrc.la
query_bench_LDADD += $(top_builddir)/src/lib/config/libcfgclient.la
query_bench_LDADD += $(top_builddir)/src/lib/cc/libcc.la
query_bench_LDADD += $(top_builddir)/src/lib/xfr/libxfr.la
query_bench_LDADD += $(top_builddir)/src/bin/auth/libasio_link.a
query_bench_LDADD += $(SQLITE_LIBS)
// Copyright (C) 2010 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
// copyright notice and this permission notice appear in all copies.
//
// THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
// REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
// AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
// INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
// LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
// OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
// PERFORMANCE OF THIS SOFTWARE.
// $Id$
#include <stdlib.h>
#include <iostream>
#include <vector>
#include <boost/shared_ptr.hpp>
#include <bench/benchmark.h>
#include <bench/benchmark_util.h>
#include <dns/buffer.h>
#include <dns/message.h>
#include <dns/messagerenderer.h>
#include <dns/name.h>
#include <dns/question.h>
#include <dns/rrclass.h>
#include <xfr/xfrout_client.h>
#include <auth/auth_srv.h>
#include <auth/asio_link.h>
using namespace std;
using namespace isc;
using namespace isc::dns;
using namespace isc::xfr;
using namespace isc::bench;
using namespace asio_link;
namespace {
// Commonly used constant:
XfroutClient xfrout_client("dummy_path"); // path doesn't matter
class QueryBenchMark {
private:
// Maintain dynamically generated objects via shared pointers because
// QueryBenchMark objects will be copied.
typedef boost::shared_ptr<AuthSrv> AuthSrvPtr;
typedef boost::shared_ptr<const IOEndpoint> IOEndpointPtr;
public:
QueryBenchMark(const int cache_slots, const char* const datasrc_file,
const BenchQueries& queries, Message& query_message,
MessageRenderer& renderer) :
server_(new AuthSrv(cache_slots >= 0 ? true : false, xfrout_client)),
queries_(queries),
query_message_(query_message),
renderer_(renderer),
dummy_socket(IOSocket::getDummyUDPSocket()),
dummy_endpoint(IOEndpointPtr(IOEndpoint::create(IPPROTO_UDP,
IOAddress("192.0.2.1"),
5300)))
{
if (cache_slots >= 0) {
server_->setCacheSlots(cache_slots);
}
server_->updateConfig(Element::fromJSON("{\"database_file\": \"" +
string(datasrc_file) + "\"}"));
}
unsigned int run() {
BenchQueries::const_iterator query;
const BenchQueries::const_iterator query_end = queries_.end();
for (query = queries_.begin(); query != query_end; ++query) {
IOMessage io_message(&(*query)[0], (*query).size(), dummy_socket,
*dummy_endpoint);
query_message_.clear(Message::PARSE);
renderer_.clear();
server_->processMessage(io_message, query_message_, renderer_);
}
return (queries_.size());
}
private:
AuthSrvPtr server_;
const BenchQueries& queries_;
Message& query_message_;
MessageRenderer& renderer_;
IOSocket& dummy_socket;
IOEndpointPtr dummy_endpoint;
};
}
namespace isc {
namespace bench {
template<>
void
BenchMark<QueryBenchMark>::printResult() const {
cout.precision(6);
cout << "Processed " << getIteration() << " queries in "
<< fixed << getDuration() << "s";
cout.precision(2);
cout << " (" << fixed << getIterationPerSecond() << "qps)" << endl;
}
}
}
namespace {
void
usage() {
cerr << "Usage: query_bench [-n iterations] datasrc_file query_datafile"
<< endl;
exit (1);
}
}
int
main(int argc, char* argv[]) {
int ch;
int iteration = 1;
while ((ch = getopt(argc, argv, "n:")) != -1) {
switch (ch) {
case 'n':
iteration = atoi(optarg);
break;
case '?':
default:
usage();
}
}
argc -= optind;
argv += optind;
if (argc < 2) {
usage();
}
const char* const datasrc_file = argv[0];
const char* const query_data_file = argv[1];
BenchQueries queries;
loadQueryData(query_data_file, queries, RRClass::IN());
OutputBuffer buffer(4096);
MessageRenderer renderer(buffer);
Message message(Message::PARSE);
cout << "Parameters:" << endl;
cout << " Iterations: " << iteration << endl;
cout << " Data Source: " << datasrc_file << endl;
cout << " Query data: file=" << query_data_file << " (" << queries.size()
<< " queries)" << endl << endl;
cout << "Benchmark enabling Hot Spot Cache with unlimited slots "
<< endl;
BenchMark<QueryBenchMark>(iteration,
QueryBenchMark(0, datasrc_file, queries, message,
renderer));
cout << "Benchmark enabling Hot Spot Cache with 10*#queries slots "
<< endl;