Commit f49e5405 authored by Jeremy C. Reed's avatar Jeremy C. Reed
Browse files

[master]Merge branch 'master' of ssh://git.bind10.isc.org//var/bind10/git/bind10

typos in ChangeLog fixed
parents 2ff30d5d b881b03e
624. [bug] jinmei
logging: prevented multiple BIND 10 processes from generating
multiple small log files when they dumped logs to files and try
to roll over them simultaneously. This fix relies on a feature of
underling logging library (log4cplus) version 1.1.0 or higher,
so the problem can still happen if BIND 10 is built with an older
version of log4cplus. (But this is expected to happen rarely in
any case unless a verbose debug level is specified).
(Trac #1622, git 5da8f8131b1224c99603852e1574b2a1adace236)
623. [func] tmark
Created the initial, bare-bones implementation of DHCP-DDNS service
process class, D2Process, and the abstract class from which it derives,
DProcessBase. D2Process will provide the DHCP-DDNS specific event loop
and business logic.
(Trac #2955, git dbe4772246039a1257b6492936fda2a8600cd245)
622. [func]* jinmei
b10-xfrin now has tighter control on the choice of IXFR or AXFR
through zones/request_ixfr configuration item. It includes
the new "IXFR only" behavior for some special cases. b10-xfrin
now also uses AXFR whenever necessary, so it is now safe to try
IXFR by default and it's made the default. The previous
use_ixfr configuration item was deprecated and triggers startup
failure if specified; configuration using use_ixfr should be
updated.
(Trac #2911, git 8118f8e4e9c0ad3e7b690bbce265a163e4f8767a)
621. [func] team
libdns++: All Rdata classes now use the generic lexer in
constructors from text. This means that the name fields in such
......
......@@ -2725,11 +2725,8 @@ TODO
<para>
The <command>b10-xfrin</command> process supports both AXFR and
IXFR. Due to some implementation limitations of the current
development release, however, it only tries AXFR by default,
and care should be taken to enable IXFR.
IXFR.
</para>
<!-- TODO: http://bind10.isc.org/ticket/1279 -->
<section>
<title>Configuration for Incoming Zone Transfers</title>
......@@ -2763,34 +2760,82 @@ TODO
&gt; <userinput>config set Xfrin/zones[0]/tsig_key "<option>example.key</option>"</userinput>
</section>
<section>
<title>Enabling IXFR</title>
<para>
As noted above, <command>b10-xfrin</command> uses AXFR for
zone transfers by default. To enable IXFR for zone transfers
for a particular zone, set the <varname>use_ixfr</varname>
configuration parameter to <quote>true</quote>.
In the above example of configuration sequence, you'll need
to add the following before performing <userinput>commit</userinput>:
<screen>&gt; <userinput>config set Xfrin/zones[0]/use_ixfr true</userinput></screen>
</para>
<section id="request_ixfr">
<title>Control the use of IXFR</title>
<para>
By default, <command>b10-xfrin</command> uses IXFR for
transferring zones specified in
the <varname>Xfrin/zones</varname> list of the configuration,
unless it doesn't know the current SOA serial of the zone
(including the case where the zone has never transferred or
locally loaded), in which case it automatically uses AXFR.
If the attempt of IXFR fails, <command>b10-xfrin</command>
automatically retries the transfer using AXFR.
In general, this works for any master server implementations
including those that don't support IXFR and in any local state
of the zone. So there should normally be no need to configure
on whether to use IXFR.
</para>
<para>
In some cases, however, it may be desirable to specify how and
whether to use IXFR and AXFR.
The <varname>request_ixfr</varname> configuration item under
<varname>Xfrin/zones</varname> can be used to control such
policies.
It can take the following values.
</para>
<variablelist>
<varlistentry>
<term>yes</term>
<listitem>
<simpara>
This is the default behavior as described above.
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>no</term>
<listitem>
<simpara>
Only use AXFR. Note that this value normally shouldn't
be needed thanks to the automatic fallback from IXFR to IXFR.
A possible case where this value needs to be used is
that the master server has a bug and crashes if it
receives an IXFR request.
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>only</term>
<listitem>
<simpara>
Only use IXFR except when the current SOA serial is not
known.
This value has a severe drawback, that is, if the master
server does not support IXFR zone transfers never
succeed (except for the very first one, which will use AXFR),
and the zone will eventually expire.
Therefore it should not be used in general.
Still, in some special cases the use of this value may
make sense. For example, if the operator is sure that
the master server supports IXFR and the zone is very
large, they may want to avoid falling back to AXFR as
it can be more expensive.
</simpara>
</listitem>
</varlistentry>
</variablelist>
<note>
<simpara>
There used to be a boolean configuration item named
<varname>use_ixfr</varname>.
It was deprecated for the finer control described above.
The <varname>request_ixfr</varname> item should be used instead.
</simpara>
</note>
<!-- TODO: http://bind10.isc.org/ticket/1279 -->
<note><simpara>
One reason why IXFR is disabled by default in the current
release is because it does not support automatic fallback from IXFR to
AXFR when it encounters a primary server that doesn't support
outbound IXFR (and, not many existing implementations support
it). Another, related reason is that it does not use AXFR even
if it has no knowledge about the zone (like at the very first
time the secondary server is set up). IXFR requires the
"current version" of the zone, so obviously it doesn't work
in this situation and AXFR is the only workable choice.
The current release of <command>b10-xfrin</command> does not
make this selection automatically.
These features will be implemented in a near future
version, at which point we will enable IXFR by default.
</simpara></note>
</section>
<!-- TODO:
......@@ -2854,6 +2899,23 @@ what if a NOTIFY is sent?
<screen>&gt; <userinput>Xfrin retransfer zone_name="<option>foo.example.org</option>" master=<option>192.0.2.99</option></userinput></screen>
</para>
<para>
The <command>retransfer</command> command always uses AXFR.
To use IXFR for a zone that has already been transferred once,
use the <command>refresh</command> command.
It honors the <varname>Xfrin/zones/request_ixfr</varname>
configuration item (see <xref linkend="request_ixfr"/>.), and
if it's configured to use IXFR, it will be used.
</para>
<para>
Both the <command>retransfer</command>
and <command>refresh</command> commands can be used for
an initial transfer before setting up secondary
configurations.
In this case AXFR will be used for the obvious reason.
</para>
</section>
<section>
......@@ -2879,7 +2941,6 @@ http://bind10.isc.org/wiki/ScalableZoneLoadDesign#a7.2UpdatingaZone
</para>
</section>
<!-- TODO: can that retransfer be used to identify a new zone? -->
<!-- TODO: what if doesn't exist at that master IP? -->
</chapter>
......@@ -5506,6 +5567,23 @@ TODO; there's a ticket to determine these levels, see #1074
If this is 0, no maximum file size is used.
</para>
<note>
<simpara>
Due to a limitation of the underlying logging library
(log4cplus), rolling over the log files (from ".1" to
".2", etc) may show odd results: There can be
multiple small files at the timing of roll over. This
can happen when multiple BIND 10 processes try to roll
over the files simultaneously.
Version 1.1.0 of log4cplus solved this problem, so if
this or higher version of log4cplus is used to build
BIND 10, it shouldn't happen. Even for older versions
it is normally expected to happen rarely unless the log
messages are produced very frequently by multiple
different processes.
</simpara>
</note>
</section>
<section>
......
......@@ -80,6 +80,12 @@ public:
return (FindResult());
}
}
virtual ConstZoneTableAccessorPtr
getZoneTableAccessor(const std::string&, bool) const {
isc_throw(isc::NotImplemented,
"getZoneTableAccessor not implemented for SingletonList");
}
private:
DataSourceClient& client_;
};
......
/b10-d2
/b10-d2.8
/d2_messages.cc
/d2_messages.h
/spec_config.h
/spec_config.h.pre
......@@ -48,12 +48,17 @@ pkglibexec_PROGRAMS = b10-d2
b10_d2_SOURCES = main.cc
b10_d2_SOURCES += d2_log.cc d2_log.h
b10_d2_SOURCES += d_process.h
b10_d2_SOURCES += d2_process.cc d2_process.h
nodist_b10_d2_SOURCES = d2_messages.h d2_messages.cc
EXTRA_DIST += d2_messages.mes
b10_d2_LDADD = $(top_builddir)/src/lib/log/libb10-log.la
b10_d2_LDADD += $(top_builddir)/src/lib/exceptions/libb10-exceptions.la
b10_d2_LDADD += $(top_builddir)/src/lib/asiolink/libb10-asiolink.la
b10_d2_LDADD += $(top_builddir)/src/lib/cc/libb10-cc.la
b10_d2_LDADD += $(top_builddir)/src/lib/config/libb10-cfgclient.la
b10_d2dir = $(pkgdatadir)
b10_d2_DATA = d2.spec
......@@ -14,15 +14,35 @@
$NAMESPACE isc::d2
% D2_STARTING : process starting
This is a debug message issued during a D2 process startup.
% D2CTL_STARTING DHCP-DDNS controller starting, pid: %1
This is an informational message issued when controller for DHCP-DDNS
service first starts.
% D2_START_INFO pid: %1, verbose: %2, standalone: %3
This is a debug message issued during the D2 process startup.
It lists some information about the parameters with which the
process is running.
% D2CTL_STOPPING DHCP-DDNS controller is exiting
This is an informational message issued when the controller is exiting
following a shut down (normal or otherwise) of the DDHCP-DDNS process.
% D2_SHUTDOWN : process is performing a normal shutting down
This is a debug message issued when a D2 process shuts down
normally in response to command to stop.
% D2PRC_SHUTDOWN DHCP-DDNS process is performing a normal shut down
This is a debug message issued when the service process has been instructed
to shut down by the controller.
% D2PRC_RUN_ENTER process has entered the event loop
This is a debug message issued when the D2 process enters it's
run method.
% D2PRC_RUN_EXIT process is exiting the event loop
This is a debug message issued when the D2 process exits the
in event loop.
% D2PRC_FAILED process experienced a fatal error: %1
This is a debug message issued when the D2 process encounters an
unrecoverable error from within the event loop.
% D2PRC_CONFIGURE new configuration received: %1
This is a debug message issued when the D2 process configure method
has been invoked.
% D2PRC_COMMAND command directive received, command: %1 - args: %2
This is a debug message issued when the D2 process command method
has been invoked.
// Copyright (C) 2013 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.
#include <config/ccsession.h>
#include <d2/d2_log.h>
#include <d2/d2_process.h>
using namespace asio;
namespace isc {
namespace d2 {
D2Process::D2Process(const char* name, IOServicePtr io_service)
: DProcessBase(name, io_service) {
};
void
D2Process::init() {
};
int
D2Process::run() {
// Until shut down or an fatal error occurs, wait for and
// execute a single callback. This is a preliminary implementation
// that is likely to evolve as development progresses.
// To use run(), the "managing" layer must issue an io_service::stop
// or the call to run will continue to block, and shutdown will not
// occur.
LOG_DEBUG(d2_logger, DBGLVL_START_SHUT, D2PRC_RUN_ENTER);
IOServicePtr& io_service = getIoService();
while (!shouldShutdown()) {
try {
io_service->run_one();
} catch (const std::exception& ex) {
LOG_FATAL(d2_logger, D2PRC_FAILED).arg(ex.what());
return (EXIT_FAILURE);
}
}
LOG_DEBUG(d2_logger, DBGLVL_START_SHUT, D2PRC_RUN_EXIT);
return (EXIT_SUCCESS);
};
int
D2Process::shutdown() {
LOG_DEBUG(d2_logger, DBGLVL_START_SHUT, D2PRC_SHUTDOWN);
setShutdownFlag(true);
return (0);
}
isc::data::ConstElementPtr
D2Process::configure(isc::data::ConstElementPtr config_set) {
// @TODO This is the initial implementation which simply accepts
// any content in config_set as valid. This is sufficient to
// allow participation as a BIND10 module, while D2 configuration support
// is being developed.
LOG_DEBUG(d2_logger, DBGLVL_TRACE_BASIC,
D2PRC_CONFIGURE).arg(config_set->str());
return (isc::config::createAnswer(0, "Configuration accepted."));
}
isc::data::ConstElementPtr
D2Process::command(const std::string& command, isc::data::ConstElementPtr args){
// @TODO This is the initial implementation. If and when D2 is extended
// to support its own commands, this implementation must change. Otherwise
// it should reject all commands as it does now.
LOG_DEBUG(d2_logger, DBGLVL_TRACE_BASIC,
D2PRC_COMMAND).arg(command).arg(args->str());
return (isc::config::createAnswer(1, "Unrecognized command:" + command));
}
D2Process::~D2Process() {
};
}; // namespace isc::d2
}; // namespace isc
// Copyright (C) 2013 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.
#ifndef D2_PROCESS_H
#define D2_PROCESS_H
#include <d2/d_process.h>
namespace isc {
namespace d2 {
/// @brief @TODO DHCP-DDNS Application Process
///
/// D2Process provides the top level application logic for DHCP-driven DDNS
/// update processing. It provides the asynchronous event processing required
/// to receive DNS mapping change requests and carry them out.
/// It implements the DProcessBase interface, which structures it such that it
/// is a managed "application", controlled by a management layer.
class D2Process : public DProcessBase {
public:
/// @brief Constructor
///
/// @param name name is a text label for the process. Generally used
/// in log statements, but otherwise arbitrary.
/// @param io_service is the io_service used by the caller for
/// asynchronous event handling.
///
/// @throw DProcessBaseError is io_service is NULL.
D2Process(const char* name, IOServicePtr io_service);
/// @brief Will be used after instantiation to perform initialization
/// unique to D2. This will likely include interactions with QueueMgr and
/// UpdateMgr, to prepare for request receipt and processing.
virtual void init();
/// @brief Implements the process's event loop.
/// The initial implementation is quite basic, surrounding calls to
/// io_service->runOne() with a test of the shutdown flag.
/// Once invoked, the method will continue until the process itself is
/// exiting due to a request to shutdown or some anomaly forces an exit.
/// @return returns 0 upon a successful, "normal" termination, non
/// zero to indicate an abnormal termination.
virtual int run();
// @TODO need brief
virtual int shutdown();
// @TODO need brief
/// @brief Processes the given configuration.
///
/// This method may be called multiple times during the process lifetime.
/// Certainly once during process startup, and possibly later if the user
/// alters configuration. This method must not throw, it should catch any
/// processing errors and return a success or failure answer as described
/// below.
///
/// @param config_set a new configuration (JSON) for the process
/// @return an Element that contains the results of configuration composed
/// of an integer status value (0 means successful, non-zero means failure),
/// and a string explanation of the outcome.
virtual isc::data::ConstElementPtr configure(isc::data::ConstElementPtr
config_set);
// @TODO need brief
/// @brief Processes the given command.
///
/// This method is called to execute any custom commands supported by the
/// process. This method must not throw, it should catch any processing
/// errors and return a success or failure answer as described below.
///
/// @param command is a string label representing the command to execute.
/// @param args is a set of arguments (if any) required for the given
/// command.
/// @return an Element that contains the results of command composed
/// of an integer status value (0 means successful, non-zero means failure),
/// and a string explanation of the outcome.
virtual isc::data::ConstElementPtr command(const std::string& command,
isc::data::ConstElementPtr args);
// @TODO need brief
virtual ~D2Process();
};
}; // namespace isc::d2
}; // namespace isc
#endif
// Copyright (C) 2013 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.
#ifndef D_PROCESS_H
#define D_PROCESS_H
#include <asiolink/asiolink.h>
#include <cc/data.h>
#include <boost/shared_ptr.hpp>
#include <exceptions/exceptions.h>
typedef boost::shared_ptr<isc::asiolink::IOService> IOServicePtr;
namespace isc {
namespace d2 {
/// @brief Exception thrown if the process encountered an operational error.
class DProcessBaseError : public isc::Exception {
public:
DProcessBaseError(const char* file, size_t line, const char* what) :
isc::Exception(file, line, what) { };
};
/// @brief Application Process Interface
///
/// DProcessBase is an abstract class represents the primary "application"
/// level object in a "managed" asynchronous application. It provides a uniform
/// interface such that a managing layer can construct, intialize, and start
/// the application's event loop. The event processing is centered around the
/// use of isc::asiolink::io_service. The io_service is shared between the
/// the managing layer and the DProcessBase. This allows management layer IO
/// such as directives to be sensed and handled, as well as processing IO
/// activity specific to the application. In terms of management layer IO,
/// there are methods shutdown, configuration updates, and commands unique
/// to the application.
class DProcessBase {
public:
/// @brief Constructor
///
/// @param name name is a text label for the process. Generally used
/// in log statements, but otherwise arbitrary.
/// @param io_service is the io_service used by the caller for
/// asynchronous event handling.
///
/// @throw DProcessBaseError is io_service is NULL.
DProcessBase(const char* name, IOServicePtr io_service) : name_(name),
io_service_(io_service), shut_down_flag_(false) {
if (!io_service_) {
isc_throw (DProcessBaseError, "IO Service cannot be null");
}
};
/// @brief May be used after instantiation to perform initialization unique
/// to application. It must be invoked prior to invoking run. This would
/// likely include the creation of additional IO sources and their
/// integration into the io_service.
virtual void init() = 0;
/// @brief Implements the process's event loop. In its simplest form it
/// would an invocation io_service_->run(). This method should not exit
/// until the process itself is exiting due to a request to shutdown or
/// some anomaly is forcing an exit.
/// @return returns EXIT_SUCCESS upon a successful, normal termination,
/// and EXIT_FAILURE to indicate an abnormal termination.
virtual int run() = 0;
/// @brief Implements the process's shutdown processing. When invoked, it
/// should ensure that the process gracefully exits the run method.
virtual int shutdown() = 0;
/// @brief Processes the given configuration.
///
/// This method may be called multiple times during the process lifetime.
/// Certainly once during process startup, and possibly later if the user
/// alters configuration. This method must not throw, it should catch any
/// processing errors and return a success or failure answer as described
/// below.
///
/// @param config_set a new configuration (JSON) for the process
/// @return an Element that contains the results of configuration composed
/// of an integer status value (0 means successful, non-zero means failure),
/// and a string explanation of the outcome.
virtual isc::data::ConstElementPtr configure(isc::data::ConstElementPtr
config_set) = 0;
/// @brief Processes the given command.
///
/// This method is called to execute any custom commands supported by the
/// process. This method must not throw, it should catch any processing
/// errors and return a success or failure answer as described below.
///
/// @param command is a string label representing the command to execute.
/// @param args is a set of arguments (if any) required for the given
/// command.
/// @return an Element that contains the results of command composed
/// of an integer status value (0 means successful, non-zero means failure),
/// and a string explanation of the outcome.
virtual isc::data::ConstElementPtr command(
const std::string& command, isc::data::ConstElementPtr args) = 0;
/// @brief Destructor
virtual ~DProcessBase(){};
bool shouldShutdown() {
return (shut_down_flag_);
}
void setShutdownFlag(bool value) {
shut_down_flag_ = value;
}
const std::string& getName() const {
return (name_);
}
IOServicePtr& getIoService() {
return (io_service_);
}
private:
/// @brief Text label for the process. Generally used in log statements,
/// but otherwise can be arbitrary.
std::string name_;
/// @brief The IOService to be used for asynchronous event handling.
IOServicePtr io_service_;
/// @brief Boolean flag set when shutdown has been requested.
bool shut_down_flag_;
};
/// @brief Defines a shared pointer to DProcessBase.
typedef boost::shared_ptr<DProcessBase> DProcessBasePtr;
}; // namespace isc::d2
}; // namespace isc