Commit 4063c0a8 authored by Marcin Siodelski's avatar Marcin Siodelski
Browse files

[3251] Merge branch 'master' into trac3251

parents cef44a40 7715d341
......@@ -13,7 +13,7 @@ TAGS
*.log
*.trs
config.h.in~
/aclocal.m4
/autom4te.cache/
/config.guess
......
720. [func] tmark
Added the initial implementation of the class, NameAddTransaction,
to b10-dhcp-ddns. This class provides a state machine which implements
the logic required to remove forward and reverse DNS entries as described
in RFC 4703, section 5.5. This includes the ability to construct the
necessary DNS requests.
(Trac# 3088, git ca58ac00fce4cb5f46e534d7ffadb2db4e4ffaf3)
719. [func] tomek
b10-dhcp4: Support for sending back client-id (RFC6842) has been
added now. Also a configuration parameter (echo-client-id) has
been added, so it is possible to enable backward compatibility
("echo-client-id false").
(Trac #3210, git 88a4858db206dfcd53a227562198f308f7779a72)
718. [func] dclink, tomek
libdhcp++: Interface detection implemented for FreeBSD, NetBSD,
OpenBSD, Mac OS X and Solaris 11. Thanks to David Carlier for
contributing a patch.
(Trac #2246, git d8045b5e1580a1d0b89a232fd61c10d25a95e769)
717. [bug] marcin
Fixed the bug which incorrectly treated DHCPv4 option codes 224-254 as
standard options, barring them from being used as custom options.
(Trac #2772, git c6158690c389d75686545459618ae0bf16f2cdb8)
716. [func] marcin
perfdhcp: added support for sending DHCPv6 Relese messages at the specified
rate and measure performance. The orphan messages counters are not
displayed for individual exchanges anymore. The following ticket: #3261
has been submitted to implement global orphan counting for all exchange
types.
(Trac #3181, git 684524bc130080e4fa31b65edfd14d58eec37e50)
715. [bug] marcin
libdhcp++: Used the CMSG_SPACE instead of CMSG_LEN macro to calculate
msg_controllen field of the DHCPv6 message. Use of CMSG_LEN causes
......@@ -13,7 +47,7 @@
b10-dhcp-ddns. The class now generates all DNS update request variations
needed to fulfill it's state machine in compliance with RFC 4703, sections
5.3 and 5.4.
(Trac# 3207, git dceca9554cb9410dd8d12371b68198b797cb6cfb)
(Trac# 3241, git dceca9554cb9410dd8d12371b68198b797cb6cfb)
712. [func] marcin,dclink
b10-dhcp4: If server fails to open a socket on one interface it
......@@ -30,7 +64,7 @@
reverse DNS entries for a given FQDN. It does not yet construct
the actual DNS update requests, this will be added under Trac#
3241.
(Trac# 3207, git 8f99da735a9f39d514c40d0a295f751dc8edfbcd)
(Trac# 3087, git 8f99da735a9f39d514c40d0a295f751dc8edfbcd)
710. [build] jinmei
Fixed various build time issues for MacOS X 10.9. Those include
......
This diff is collapsed.
......@@ -4419,6 +4419,29 @@ Dhcp4/subnet4 [] list (default)
</section>
<section id="dhcp4-echo-client-id">
<title>Echoing client-id (RFC6842)</title>
<para>Original DHCPv4 spec (RFC2131) states that the DHCPv4
server must not send back client-id options when responding to
clients. However, in some cases that confused clients that did
not have MAC address or client-id. See RFC6842 for details. That
behavior has changed with the publication of RFC6842 which
updated RFC2131. That update now states that the server must
send client-id if client sent it. That is the default behaviour
that Kea offers. However, in some cases older devices that do
not support RFC6842 may refuse to accept responses that include
client-id option. To enable backward compatibility, an optional
configuration parameter has been introduced. To configure it,
use the following commands:</para>
<screen>
&gt; <userinput>config add Dhcp4/echo-client-id</userinput>
&gt; <userinput>config set Dhcp4/echo-client-id False</userinput>
&gt; <userinput>config commit</userinput>
</screen>
</section>
<section id="dhcp4-std">
<title>Supported Standards</title>
<para>The following standards and draft standards are currently
......@@ -4429,7 +4452,8 @@ Dhcp4/subnet4 [] list (default)
REQUEST, RELEASE, ACK, and NAK.</simpara>
</listitem>
<listitem>
<simpara><ulink url="http://tools.ietf.org/html/rfc2132">RFC 2132</ulink>: Supported options are: PAD (0),
<simpara><ulink url="http://tools.ietf.org/html/rfc2132">RFC 2132</ulink>:
Supported options are: PAD (0),
END(255), Message Type(53), DHCP Server Identifier (54),
Domain Name (15), DNS Servers (6), IP Address Lease Time
(51), Subnet mask (1), and Routers (3).</simpara>
......@@ -4437,6 +4461,10 @@ Dhcp4/subnet4 [] list (default)
<listitem>
<simpara><ulink url="http://tools.ietf.org/html/rfc3046">RFC 3046</ulink>:
Relay Agent Information option is supported.</simpara>
<simpara><ulink url="http://tools.ietf.org/html/rfc6842">RFC 6842</ulink>:
Server by default sends back client-id option. That capability may be
disabled. See <xref linkend="dhcp4-echo-client-id"/> for details.
</simpara>
</listitem>
</itemizedlist>
</section>
......@@ -4460,21 +4488,6 @@ Dhcp4/renew-timer 1000 integer (default)
&gt; <userinput>config commit</userinput></screen>
</para>
</listitem>
<listitem>
<simpara>During the initial IPv4 node configuration, the
server is expected to send packets to a node that does not
have IPv4 address assigned yet. The server requires
certain tricks (or hacks) to transmit such packets. This
is not implemented yet, therefore DHCPv4 server supports
relayed traffic only (that is, normal point to point
communication).</simpara>
</listitem>
<listitem>
<simpara>Upon start, the server will open sockets on all
interfaces that are not loopback, are up and running and
have IPv4 address.</simpara>
</listitem>
<listitem>
<simpara>The DHCPv4 server does not support
......@@ -4484,7 +4497,7 @@ Dhcp4/renew-timer 1000 integer (default)
available from <ulink url="http://www.isc.org/software/dhcp"/>.</simpara>
</listitem>
<listitem>
<simpara>Interface detection is currently working on Linux
<simpara>Raw sockets operation is working on Linux
only. See <xref linkend="iface-detect"/> for details.</simpara>
</listitem>
<listitem>
......@@ -5401,10 +5414,6 @@ Dhcp6/renew-timer 1000 integer (default)
<listitem>
<simpara>DNS Update is not supported.</simpara>
</listitem>
<listitem>
<simpara>Interface detection is currently working on Linux
only. See <xref linkend="iface-detect"/> for details.</simpara>
</listitem>
</itemizedlist>
</section>
......@@ -5439,16 +5448,17 @@ Dhcp6/renew-timer 1000 integer (default)
<!-- TODO: point to doxygen docs -->
<section id="iface-detect">
<title>Interface detection</title>
<title>Interface detection and Socket handling</title>
<para>Both the DHCPv4 and DHCPv6 components share network
interface detection routines. Interface detection is
currently only supported on Linux systems.</para>
<para>For non-Linux systems, there is currently a stub
implementation provided. The interface manager detects loopback
interfaces only as their name (lo or lo0) can be easily predicted.
Please contact the BIND 10 development team if you are interested
in running DHCP components on systems other than Linux.</para>
currently supported on Linux, all BSD family (FreeBSD, NetBSD,
OpenBSD), Mac OS X and Solaris 11 systems.</para>
<para>DHCPv4 requires special raw socket processing to send and receive
packets from hosts that do not have IPv4 address assigned yet. Support
for this operation is implemented on Linux only, so it is likely that
DHCPv4 component will not work in certain cases on systems other than
Linux.</para>
</section>
<!--
......
......@@ -65,6 +65,7 @@ b10_dhcp_ddns_SOURCES += d2_zone.cc d2_zone.h
b10_dhcp_ddns_SOURCES += dns_client.cc dns_client.h
b10_dhcp_ddns_SOURCES += labeled_value.cc labeled_value.h
b10_dhcp_ddns_SOURCES += nc_add.cc nc_add.h
b10_dhcp_ddns_SOURCES += nc_remove.cc nc_remove.h
b10_dhcp_ddns_SOURCES += nc_trans.cc nc_trans.h
b10_dhcp_ddns_SOURCES += state_model.cc state_model.h
......
......@@ -325,19 +325,19 @@ message but the attempt to send it suffered a unexpected error. This is most
likely a programmatic error, rather than a communications issue. Some or all
of the DNS updates requested as part of this request did not succeed.
% DHCP_DDNS_FORWARD_ADD_BUILD_FAILURE A DNS update message to add a forward DNS entry could not be constructed for this request: %1, reason: %2
% DHCP_DDNS_FORWARD_ADD_BUILD_FAILURE DNS udpate message to add a forward DNS entry could not be constructed for this request: %1, reason: %2
This is an error message issued when an error occurs attempting to construct
the server bound packet requesting a forward address addition. This is due
to invalid data contained in the NameChangeRequest. The request will be aborted.
This is most likely a configuration issue.
% DHCP_DDNS_FORWARD_REPLACE_BUILD_FAILURE A DNS update message to replace a forward DNS entry could not be constructed from this request: %1, reason: %2
% DHCP_DDNS_FORWARD_REPLACE_BUILD_FAILURE DNS update message to replace a forward DNS entry could not be constructed from this request: %1, reason: %2
This is an error message issued when an error occurs attempting to construct
the server bound packet requesting a forward address replacement. This is
due to invalid data contained in the NameChangeRequest. The request will be
aborted. This is most likely a configuration issue.
% DHCP_DDNS_REVERSE_REPLACE_BUILD_FAILURE A DNS update message to replace a reverse DNS entry could not be constructed from this request: %1, reason: %2
% DHCP_DDNS_REVERSE_REPLACE_BUILD_FAILURE DNS update message to replace a reverse DNS entry could not be constructed from this request: %1, reason: %2
This is an error message issued when an error occurs attempting to construct
the server bound packet requesting a reverse PTR replacement. This is
due to invalid data contained in the NameChangeRequest. The request will be
......@@ -347,7 +347,94 @@ aborted. This is most likely a configuration issue.
This is a debug message issued after DHCP_DDNS has submitted DNS mapping
additions which were received and accepted by an appropriate DNS server.
% DHCP_DDNS_ADD_FAILED DHCP_DDNS failed attempting to make DNS mapping additions for this request: %1
% DHCP_DDNS_ADD_FAILED DHCP_DDNS failed attempting to make DNS mapping additions for this request: %1, event: %2
This is an error message issued after DHCP_DDNS attempts to submit DNS mapping
entry additions have failed. The precise reason for the failure should be
documented in preceding log entries.
% DHCP_DDNS_FORWARD_REMOVE_ADDRS_BUILD_FAILURE DNS udpate message to remove a forward DNS Address entry could not be constructed for this request: %1, reason: %2
This is an error message issued when an error occurs attempting to construct
the server bound packet requesting a forward address (A or AAAA) removal. This
is due to invalid data contained in the NameChangeRequest. The request will be
aborted. This is most likely a configuration issue.
% DHCP_DDNS_FORWARD_REMOVE_ADDRS_REJECTED DNS Server, %1, rejected a DNS update request to remove the forward address mapping for FQDN, %2, with an RCODE: %3
This is an error message issued when an update was rejected by the DNS server
it was sent to for the reason given by the RCODE. The rcode values are defined
in RFC 2136.
% DHCP_DDNS_FORWARD_REMOVE_ADDRS_IO_ERROR DHCP_DDNS encountered an IO error sending a forward mapping address removal for FQDN %1 to DNS server %2
This is an error message issued when a communication error occurs while
DHCP_DDNS is carrying out a forward address remove. The application will retry
against the same server or others as appropriate.
% DHCP_DDNS_FORWARD_REMOVE_ADDRS_RESP_CORRUPT DHCP_DDNS received a corrupt response from the DNS server, %1, while removing forward address mapping for FQDN, %2
This is an error message issued when the response received by DHCP_DDNS, to a
update request to remove a forward address mapping, is mangled or malformed.
The application will retry against the same server or others as appropriate.
% DHCP_DDNS_FORWARD_REMOVE_ADDRS_BAD_DNSCLIENT_STATUS DHCP_DDNS received an unknown DNSClient status: %1, while removing a forward address mapping for FQDN %2 to DNS server %3
This is an error message issued when DNSClient returns an unrecognized status
while DHCP_DDNS was removing a forward address mapping. The request will be
aborted. This is most likely a programmatic issue and should be reported.
% DHCP_DDNS_FORWARD_REMOVE_RRS_BUILD_FAILURE DNS udpate message to remove forward DNS RR entries could not be constructed for this request: %1, reason: %2
This is an error message issued when an error occurs attempting to construct
the server bound packet requesting forward RR (DHCID RR) removal. This is due
to invalid data contained in the NameChangeRequest. The request will be aborted.This is most likely a configuration issue.
% DHCP_DDNS_FORWARD_REMOVE_RRS_REJECTED DNS Server, %1, rejected a DNS update request to remove forward RR entries for FQDN, %2, with an RCODE: %3
This is an error message issued when an update was rejected by the DNS server
it was sent to for the reason given by the RCODE. The rcode values are defined
in RFC 2136.
% DHCP_DDNS_FORWARD_REMOVE_RRS_IO_ERROR DHCP_DDNS encountered an IO error sending a forward RR removal for FQDN %1 to DNS server %2
This is an error message issued when a communication error occurs while
DHCP_DDNS is carrying out a forward RR remove. The application will retry
against the same server.
% DHCP_DDNS_FORWARD_REMOVE_RRS_RESP_CORRUPT DHCP_DDNS received a corrupt response from the DNS server, %1, while removing forward RRs for FQDN, %2
This is an error message issued when the response received by DHCP_DDNS, to a
update request to remove forward RRs mapping, is mangled or malformed.
The application will retry against the same server or others as appropriate.
% DHCP_DDNS_FORWARD_REMOVE_RRS_BAD_DNSCLIENT_STATUS DHCP_DDNS received an unknown DNSClient status: %1, while removing forward RRs for FQDN %2 to DNS server %3
This is an error message issued when DNSClient returns an unrecognized status
while DHCP_DDNS was removing forward RRs. The request will be aborted. This is
most likely a programmatic issue and should be reported.
% DHCP_DDNS_REVERSE_REMOVE_BUILD_FAILURE DNS update message to remove a reverse DNS entry could not be constructed from this request: %1, reason: %2
This is an error message issued when an error occurs attempting to construct
the server bound packet requesting a reverse PTR removal. This is
due to invalid data contained in the NameChangeRequest. The request will be
aborted. This is most likely a configuration issue.
% DHCP_DDNS_REVERSE_REMOVE_REJECTED DNS Server, %1, rejected a DNS update request to remove the reverse mapping for FQDN, %2, with an RCODE: %3
This is an error message issued when an update was rejected by the DNS server
it was sent to for the reason given by the RCODE. The rcode values are defined
in RFC 2136.
% DHCP_DDNS_REVERSE_REMOVE_IO_ERROR DHCP_DDNS encountered an IO error sending a reverse mapping remove for FQDN %1 to DNS server %2
This is an error message issued when a communication error occurs while
DHCP_DDNS is carrying out a reverse address update. The application will
retry against the same server or others as appropriate.
% DHCP_DDNS_REVERSE_REMOVE_RESP_CORRUPT DHCP_DDNS received a corrupt response from the DNS server, %1, while removing reverse address mapping for FQDN, %2
This is an error message issued when the response received by DHCP_DDNS, to a
update request to remove a reverse address, is mangled or malformed.
The application will retry against the same server or others as appropriate.
% DHCP_DDNS_REVERSE_REMOVE_BAD_DNSCLIENT_STATUS DHCP_DDNS received an unknown DNSClient status: %1, while removing reverse address mapping for FQDN %2 to DNS server %3
This is an error message issued when DNSClient returns an unrecognized status
while DHCP_DDNS was removing a reverse address mapping. The request will be
aborted. This is most likely a programmatic issue and should be reported.
% DHCP_DDNS_REMOVE_SUCCEEDED DHCP_DDNS successfully removed the DNS mapping addition for this request: %1
This is a debug message issued after DHCP_DDNS has submitted DNS mapping
removals which were received and accepted by an appropriate DNS server.
% DHCP_DDNS_REMOVE_FAILED DHCP_DDNS failed attempting to make DNS mapping removals for this request: %1, event: %2
This is an error message issued after DHCP_DDNS attempts to submit DNS mapping
entry removals have failed. The precise reason for the failure should be
documented in preceding log entries.
......@@ -54,17 +54,25 @@ NameAddTransaction::defineEvents() {
// Call superclass impl first.
NameChangeTransaction::defineEvents();
// Define NCT events.
// Define NameAddTransaction events.
defineEvent(FQDN_IN_USE_EVT, "FQDN_IN_USE_EVT");
defineEvent(FQDN_NOT_IN_USE_EVT, "FQDN_NOT_IN_USE_EVT");
}
void
NameAddTransaction::verifyEvents() {
// Call superclass impl first.
// Call superclass implementation first to verify its events. These are
// events common to all transactions, and they must be defined.
// SELECT_SERVER_EVT
// SERVER_SELECTED_EVT
// SERVER_IO_ERROR_EVT
// NO_MORE_SERVERS_EVT
// IO_COMPLETED_EVT
// UPDATE_OK_EVT
// UPDATE_FAILED_EVT
NameChangeTransaction::verifyEvents();
// Verify NCT events.
// Verify NameAddTransaction events by attempting to fetch them.
getEvent(FQDN_IN_USE_EVT);
getEvent(FQDN_NOT_IN_USE_EVT);
}
......@@ -74,7 +82,7 @@ NameAddTransaction::defineStates() {
// Call superclass impl first.
NameChangeTransaction::defineStates();
// Define the states.
// Define NameAddTransaction states.
defineState(READY_ST, "READY_ST",
boost::bind(&NameAddTransaction::readyHandler, this));
......@@ -102,10 +110,16 @@ NameAddTransaction::defineStates() {
}
void
NameAddTransaction::verifyStates() {
// Call superclass impl first.
// Call superclass implementation first to verify its states. These are
// states common to all transactions, and they must be defined.
// READY_ST
// SELECTING_FWD_SERVER_ST
// SELECTING_REV_SERVER_ST
// PROCESS_TRANS_OK_ST
// PROCESS_TRANS_FAILED_ST
NameChangeTransaction::verifyStates();
// Verify NCT states. This ensures that derivations provide the handlers.
// Verify NameAddTransaction states by attempting to fetch them.
getState(ADDING_FWD_ADDRS_ST);
getState(REPLACING_FWD_ADDRS_ST);
getState(REPLACING_REV_PTRS_ST);
......@@ -541,7 +555,9 @@ void
NameAddTransaction::processAddFailedHandler() {
switch(getNextEvent()) {
case UPDATE_FAILED_EVT:
LOG_ERROR(dctl_logger, DHCP_DDNS_ADD_FAILED).arg(getNcr()->toText());
case NO_MORE_SERVERS_EVT:
LOG_ERROR(dctl_logger, DHCP_DDNS_ADD_FAILED).arg(getNcr()->toText())
.arg(getContextStr());
setNcrStatus(dhcp_ddns::ST_FAILED);
endModel();
break;
......@@ -560,27 +576,28 @@ NameAddTransaction::buildAddFwdAddressRequest() {
// Construct dns::Name from NCR fqdn.
dns::Name fqdn(dns::Name(getNcr()->getFqdn()));
// Content on this request is based on RFC 4703, section 5.3.1
// First build the Prerequisite Section.
// Create 'FQDN Is Not In Use' prerequisite (RFC 2136, section 2.4.5)
// Add the RR to prerequisite section.
// Create 'FQDN Is Not In Use' prerequisite and add it to the
// prerequisite section.
// Based on RFC 2136, section 2.4.5
dns::RRsetPtr prereq(new dns::RRset(fqdn, dns::RRClass::NONE(),
dns::RRType::ANY(), dns::RRTTL(0)));
request->addRRset(D2UpdateMessage::SECTION_PREREQUISITE, prereq);
// Next build the Update Section.
// Create the FQDN/IP 'add' RR (RFC 2136, section 2.5.1)
// Set the message RData to lease address.
// Add the RR to update section.
// 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)));
addLeaseAddressRdata(update);
request->addRRset(D2UpdateMessage::SECTION_UPDATE, update);
// Now create the FQDN/DHCID 'add' RR per RFC 4701)
// Set the message RData to DHCID.
// Add the RR to update section.
// 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)));
addDhcidRdata(update);
......@@ -598,17 +615,19 @@ NameAddTransaction::buildReplaceFwdAddressRequest() {
// Construct dns::Name from NCR fqdn.
dns::Name fqdn(dns::Name(getNcr()->getFqdn()));
// Content on this request is based on RFC 4703, section 5.3.2
// First build the Prerequisite Section.
// Create an 'FQDN Is In Use' prerequisite (RFC 2136, section 2.4.4)
// Add it to the pre-requisite section.
// Create an 'FQDN Is In Use' prerequisite and add it to the
// pre-requisite section.
// Based on RFC 2136, section 2.4.4
dns::RRsetPtr prereq(new dns::RRset(fqdn, dns::RRClass::ANY(),
dns::RRType::ANY(), dns::RRTTL(0)));
request->addRRset(D2UpdateMessage::SECTION_PREREQUISITE, prereq);
// Now create an DHCID matches prerequisite RR.
// Set the RR's RData to DHCID.
// Add it to the pre-requisite section.
// Create an DHCID matches prerequisite RR and add it to the
// pre-requisite section.
// Based on RFC 2136, section 2.4.2.
prereq.reset(new dns::RRset(fqdn, dns::RRClass::IN(),
dns::RRType::DHCID(), dns::RRTTL(0)));
addDhcidRdata(prereq);
......@@ -616,16 +635,14 @@ NameAddTransaction::buildReplaceFwdAddressRequest() {
// Next build the Update Section.
// Create the FQDN/IP 'delete' RR (RFC 2136, section 2.5.1)
// Set the message RData to lease address.
// Add the RR to update section.
// 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(),
getAddressRRType(), dns::RRTTL(0)));
request->addRRset(D2UpdateMessage::SECTION_UPDATE, update);
// Create the FQDN/IP 'add' RR (RFC 2136, section 2.5.1)
// Set the message RData to lease address.
// Add the RR to update section.
// 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)));
addLeaseAddressRdata(update);
......@@ -644,6 +661,7 @@ NameAddTransaction::buildReplaceRevPtrsRequest() {
std::string rev_addr = D2CfgMgr::reverseIpAddress(getNcr()->getIpAddress());
dns::Name rev_ip(rev_addr);
// 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.
......
......@@ -34,9 +34,10 @@ public:
/// @brief Embodies the "life-cycle" required to carry out a DDNS Add update.
///
/// NameAddTransaction implements a state machine for adding (or replacing) a
/// forward DNS mapping. This state machine is based upon the processing logic
/// described in RFC 4703, Sections 5.3 and 5.4. That logic may be paraphrased
/// as follows:
/// forward and/or reverse DNS mapping. This state machine is based upon the
/// processing logic described in RFC 4703, Sections 5.3 and 5.4. That logic
/// may be paraphrased as follows:
///
/// @code
///
/// If the request includes a forward change:
......@@ -109,7 +110,8 @@ protected:
/// @brief Validates the contents of the set of events.
///
/// Invokes NameChangeTransaction's implementation and then verifies the
/// Add transaction's events.
/// Add transaction's. This tests that the needed events are in the event
/// dictionary.
///
/// @throw StateModelError if an event value is undefined.
virtual void verifyEvents();
......@@ -125,7 +127,8 @@ protected:
/// @brief Validates the contents of the set of states.
///
/// Invokes NameChangeTransaction's implementation and then verifies the
/// Add transaction's states.
/// Add transaction's states. This tests that the needed states are in the
/// state dictionary.
///
/// @throw StateModelError if an event value is undefined.
virtual void verifyStates();
......@@ -166,7 +169,7 @@ protected:
/// handler simply attempts to select the next server.
///
/// Transitions to:
/// - ADDING_REV_PTRS_ST with next event of SERVER_SELECTED upon successful
/// - ADDING_FWD_ADDRS_ST with next event of SERVER_SELECTED upon successful
/// server selection
///
/// - PROCESS_TRANS_FAILED with next event of NO_MORE_SERVERS_EVT upon
......@@ -329,7 +332,7 @@ protected:
/// - PROCESS_TRANS_OK_ST with a next event of UPDATE_OK_EVT upon
/// successful replacement.
///
/// - PROCESS_TRANS_FAILED_ST with a next event of UPDATE_OK_EVT If the
/// - PROCESS_TRANS_FAILED_ST with a next event of UPDATE_FAILED_EVT If the
/// DNS server rejected the update for any reason or the IO completed
/// with an unrecognized status.
///
......@@ -365,8 +368,10 @@ protected:
/// @brief State handler for PROCESS_TRANS_FAILED_ST.
///
/// Entered from:
/// - SELECTING_FWD_SERVER_ST with a next event of NO_MORE_SERVERS
/// - ADDING_FWD_ADDRS_ST with a next event of UPDATE_FAILED_EVT
/// - REPLACING_FWD_ADDRS_ST with a next event of UPDATE_FAILED_EVT
/// - SELECTING_REV_SERVER_ST with a next event of NO_MORE_SERVERS
/// - REPLACING_REV_PTRS_ST with a next event of UPDATE_FAILED_EVT
///
/// Sets the transaction status to indicate failure and ends
......@@ -438,7 +443,7 @@ protected:
void buildReplaceRevPtrsRequest();
};
/// @brief Defines a pointer to a NameChangeTransaction.
/// @brief Defines a pointer to a NameAddTransaction.
typedef boost::shared_ptr<NameAddTransaction> NameAddTransactionPtr;
} // namespace isc::d2
......
This diff is collapsed.
// 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 NC_REMOVE_H
#define NC_REMOVE_H
/// @file nc_remove.h This file defines the class NameRemoveTransaction.
#include <d2/nc_trans.h>
namespace isc {
namespace d2 {
/// @brief Thrown if the NameRemoveTransaction encounters a general error.
class NameRemoveTransactionError : public isc::Exception {
public:
NameRemoveTransactionError(const char* file, size_t line,
const char* what) :
isc::Exception(file, line, what) { };
};
/// @brief Embodies the "life-cycle" required to carry out a DDNS Remove update.
///
/// NameRemoveTransaction implements a state machine for removing a forward
/// and/or reverse DNS mappings. This state machine is based upon the processing
/// logic described in RFC 4703, Section 5.5. That logic may be paraphrased as
/// follows:
///
/// @code
///
/// If the request includes a forward change:
/// Select a forward server
/// Send the server a request to remove client's specific forward address RR
/// If it succeeds or the server responds with name no longer in use
/// Send a server a request to delete any other RRs for that FQDN, such
/// as the DHCID RR.
/// otherwise
/// abandon the update
///
/// If the request includes a reverse change:
/// Select a reverse server
/// Send a server a request to delete reverse entry (PTR RR)
///
/// @endcode
///
/// This class derives from NameChangeTransaction from which it inherits
/// states, events, and methods common to NameChangeRequest processing.
class NameRemoveTransaction : public NameChangeTransaction {
public:
//@{ Additional states needed for NameRemove state model.
/// @brief State that attempts to remove specific forward address record.
static const int REMOVING_FWD_ADDRS_ST = NCT_DERIVED_STATE_MIN + 1;
/// @brief State that attempts to remove any other forward RRs for the DHCID
static const int REMOVING_FWD_RRS_ST = NCT_DERIVED_STATE_MIN + 2;
/// @brief State that attempts to remove reverse PTR records
static const int REMOVING_REV_PTRS_ST = NCT_DERIVED_STATE_MIN + 3;
//@}
//@{ Additional events needed for NameRemove state model.
/// @brief Event sent when replace attempt to fails with address not in use.
/// @todo Currently none have been identified.
//@}
/// @brief Constructor
///
/// Instantiates an Remove transaction that is ready to be started.
///
/// @param io_service IO service to be used for IO processing
/// @param ncr is the NameChangeRequest to fulfill
/// @param forward_domain is the domain to use for forward DNS updates
/// @param reverse_domain is the domain to use for reverse DNS updates
///
/// @throw NameRemoveTransaction error if given request is not a CHG_REMOVE,
/// NameChangeTransaction error for base class construction errors.
NameRemoveTransaction(IOServicePtr& io_service,
dhcp_ddns::NameChangeRequestPtr& ncr,
DdnsDomainPtr& forward_domain,
DdnsDomainPtr& reverse_domain);
/// @brief Destructor
virtual ~NameRemoveTransaction();
protected:
/// @brief Adds events defined by NameRemoveTransaction to the event set.
///