This function is empty now, so it needs to be implemented.
using namespace isc;
using namespace isc::asiolink;
+using namespace isc::d2;
using namespace isc::dhcp;
using namespace isc::util;
using namespace std;
.arg(query->toText());
try {
+ NameChangeRequestPtr ncr;
switch (query->getType()) {
case DHCPV6_SOLICIT:
rsp = processSolicit(query);
break;
case DHCPV6_REQUEST:
- rsp = processRequest(query);
+ rsp = processRequest(query, ncr);
break;
case DHCPV6_RENEW:
- rsp = processRenew(query);
+ rsp = processRenew(query, ncr);
break;
case DHCPV6_REBIND:
- rsp = processRebind(query);
+ rsp = processRebind(query, ncr);
break;
case DHCPV6_CONFIRM:
break;
case DHCPV6_RELEASE:
- rsp = processRelease(query);
+ rsp = processRelease(query, ncr);
break;
case DHCPV6_DECLINE:
} catch (const std::exception& e) {
LOG_ERROR(dhcp6_logger, DHCP6_PACKET_SEND_FAIL).arg(e.what());
}
+
} else {
LOG_ERROR(dhcp6_logger, DHCP6_PACK_FAIL);
}
}
void
-Dhcpv6Srv::processClientFqdn(const Pkt6Ptr& question, Pkt6Ptr& answer) {
+Dhcpv6Srv::processClientFqdn(const Pkt6Ptr& question, Pkt6Ptr& answer,
+ NameChangeRequestPtr& ncr) {
// Get Client FQDN Option from the client's message. If this option hasn't
// been included, do nothing.
Option6ClientFqdnPtr fqdn = boost::dynamic_pointer_cast<
if (include_fqdn) {
answer->addOption(fqdn_resp);
}
+
+ createNameChangeRequest(answer, fqdn_resp, ncr);
+}
+
+void
+Dhcpv6Srv::createNameChangeRequest(const Pkt6Ptr&,
+ const Option6ClientFqdnPtr&,
+ isc::d2::NameChangeRequestPtr&) {
+ // @todo Create NameChangeRequest here.
}
+
OptionPtr
Dhcpv6Srv::assignIA_NA(const Subnet6Ptr& subnet, const DuidPtr& duid,
Pkt6Ptr question, boost::shared_ptr<Option6IA> ia) {
assignLeases(solicit, advertise);
- processClientFqdn(solicit, advertise);
+ NameChangeRequestPtr ncr;
+ processClientFqdn(solicit, advertise, ncr);
return (advertise);
}
Pkt6Ptr
-Dhcpv6Srv::processRequest(const Pkt6Ptr& request) {
+Dhcpv6Srv::processRequest(const Pkt6Ptr& request,
+ NameChangeRequestPtr& ncr) {
sanityCheck(request, MANDATORY, MANDATORY);
assignLeases(request, reply);
- processClientFqdn(request, reply);
+ processClientFqdn(request, reply, ncr);
return (reply);
}
Pkt6Ptr
-Dhcpv6Srv::processRenew(const Pkt6Ptr& renew) {
+Dhcpv6Srv::processRenew(const Pkt6Ptr& renew,
+ NameChangeRequestPtr& ncr) {
sanityCheck(renew, MANDATORY, MANDATORY);
appendDefaultOptions(renew, reply);
appendRequestedOptions(renew, reply);
- processClientFqdn(renew, reply);
+ processClientFqdn(renew, reply, ncr);
renewLeases(renew, reply);
}
Pkt6Ptr
-Dhcpv6Srv::processRebind(const Pkt6Ptr& rebind) {
+Dhcpv6Srv::processRebind(const Pkt6Ptr& rebind,
+ NameChangeRequestPtr&) {
/// @todo: Implement this
Pkt6Ptr reply(new Pkt6(DHCPV6_REPLY, rebind->getTransid()));
return reply;
}
Pkt6Ptr
-Dhcpv6Srv::processRelease(const Pkt6Ptr& release) {
+Dhcpv6Srv::processRelease(const Pkt6Ptr& release,
+ NameChangeRequestPtr&) {
sanityCheck(release, MANDATORY, MANDATORY);
#ifndef DHCPV6_SRV_H
#define DHCPV6_SRV_H
+#include <d2/ncr_msg.h>
#include <dhcp/dhcp6.h>
#include <dhcp/duid.h>
#include <dhcp/option.h>
+#include <dhcp/option6_client_fqdn.h>
#include <dhcp/option6_ia.h>
#include <dhcp/option_definition.h>
#include <dhcp/pkt6.h>
/// @param request a message received from client
///
/// @return REPLY message or NULL
- Pkt6Ptr processRequest(const Pkt6Ptr& request);
+ Pkt6Ptr processRequest(const Pkt6Ptr& request,
+ isc::d2::NameChangeRequestPtr& ncr);
/// @brief Stub function that will handle incoming RENEW messages.
///
/// @param renew message received from client
- Pkt6Ptr processRenew(const Pkt6Ptr& renew);
+ Pkt6Ptr processRenew(const Pkt6Ptr& renew,
+ isc::d2::NameChangeRequestPtr& ncr);
/// @brief Stub function that will handle incoming REBIND messages.
///
/// @param rebind message received from client
- Pkt6Ptr processRebind(const Pkt6Ptr& rebind);
+ Pkt6Ptr processRebind(const Pkt6Ptr& rebind,
+ isc::d2::NameChangeRequestPtr& ncr);
/// @brief Stub function that will handle incoming CONFIRM messages.
///
/// @brief Stub function that will handle incoming RELEASE messages.
///
/// @param release message received from client
- Pkt6Ptr processRelease(const Pkt6Ptr& release);
+ Pkt6Ptr processRelease(const Pkt6Ptr& release,
+ isc::d2::NameChangeRequestPtr& ncr);
/// @brief Stub function that will handle incoming DECLINE messages.
///
///
/// @param question Client's message.
/// @param answer Server's response to the client.
- void processClientFqdn(const Pkt6Ptr& question, Pkt6Ptr& answer);
+ void processClientFqdn(const Pkt6Ptr& question, Pkt6Ptr& answer,
+ d2::NameChangeRequestPtr& ncr);
+
+ /// @brief Creates a @c isc::d2::NameChangeRequest based on the DHCPv6
+ /// Client FQDN %Option stored in the response to the client.
+ ///
+ /// The @c isc:d2::NameChangeRequest class encapsulates the request from
+ /// the DHCPv6 server to the DHCP-DDNS module to perform DNS Update.
+ ///
+ /// @param answer A response being sent to a client.
+ /// @param fqdn_answer A DHCPv6 Client FQDN %Option which is included in the
+ /// response message sent to a client.
+ /// @param [out] ncr A @c isc::d2::NameChangeRequest object to be sent to
+ /// the DHCP-DDNS module as a result of the Client FQDN %Option processing.
+ void createNameChangeRequest(const Pkt6Ptr& answer,
+ const Option6ClientFqdnPtr& fqdn_answer,
+ isc::d2::NameChangeRequestPtr& ncr);
/// @brief Attempts to renew received addresses
///
#include <asiolink/io_address.h>
#include <config/ccsession.h>
+#include <d2/ncr_msg.h>
#include <dhcp/dhcp6.h>
#include <dhcp/duid.h>
#include <dhcp/option.h>
using namespace isc;
using namespace isc::asiolink;
using namespace isc::config;
+using namespace isc::d2;
using namespace isc::data;
using namespace isc::dhcp;
using namespace isc::util;
int rcode_;
ConstElementPtr comment_;
+
+ // A NameChangeRequest used in many tests.
+ NameChangeRequestPtr ncr_;
};
// Provides suport for tests against a preconfigured subnet6
// A pool used in most tests
Pool6Ptr pool_;
+
};
class FqdnDhcpv6SrvTest : public NakedDhcpv6SrvTest {
}
- ASSERT_NO_THROW(srv.processClientFqdn(question, answer));
+ ASSERT_NO_THROW(srv.processClientFqdn(question, answer, ncr_));
Option6ClientFqdnPtr answ_fqdn = getClientFqdnOption(answer);
ASSERT_TRUE(answ_fqdn);
req->addOption(srv.getServerID());
// Pass it to the server and hope for a REPLY
- Pkt6Ptr reply = srv.processRequest(req);
+ Pkt6Ptr reply = srv.processRequest(req, ncr_);
// check that we get the right NAK
checkNakResponse (reply, DHCPV6_REPLY, 1234, STATUS_NoAddrsAvail);
req->addOption(srv.getServerID());
// Pass it to the server and hope for a REPLY
- Pkt6Ptr reply = srv.processRenew(req);
+ Pkt6Ptr reply = srv.processRenew(req, ncr_);
// check that we get the right NAK
checkNakResponse (reply, DHCPV6_REPLY, 1234, STATUS_NoBinding);
req->addOption(srv.getServerID());
// Pass it to the server and hope for a REPLY
- Pkt6Ptr reply = srv.processRelease(req);
+ Pkt6Ptr reply = srv.processRelease(req, ncr_);
// check that we get the right NAK
checkNakResponse (reply, DHCPV6_REPLY, 1234, STATUS_NoBinding);
req->addOption(srv.getServerID());
// Pass it to the server and hope for a REPLY
- Pkt6Ptr reply = srv.processRequest(req);
+ Pkt6Ptr reply = srv.processRequest(req, ncr_);
// check if we get response at all
checkResponse(reply, DHCPV6_REPLY, 1234);
req3->addOption(srv.getServerID());
// Pass it to the server and get an advertise
- Pkt6Ptr reply1 = srv.processRequest(req1);
- Pkt6Ptr reply2 = srv.processRequest(req2);
- Pkt6Ptr reply3 = srv.processRequest(req3);
+ Pkt6Ptr reply1 = srv.processRequest(req1, ncr_);
+ Pkt6Ptr reply2 = srv.processRequest(req2, ncr_);
+ Pkt6Ptr reply3 = srv.processRequest(req3, ncr_);
// check if we get response at all
checkResponse(reply1, DHCPV6_REPLY, 1234);
req->addOption(srv.getServerID());
// Pass it to the server and hope for a REPLY
- Pkt6Ptr reply = srv.processRenew(req);
+ Pkt6Ptr reply = srv.processRenew(req, ncr_);
// Check if we get response at all
checkResponse(reply, DHCPV6_REPLY, 1234);
// Case 1: No lease known to server
// Pass it to the server and hope for a REPLY
- Pkt6Ptr reply = srv.processRenew(req);
+ Pkt6Ptr reply = srv.processRenew(req, ncr_);
// Check if we get response at all
checkResponse(reply, DHCPV6_REPLY, transid);
ASSERT_TRUE(LeaseMgrFactory::instance().addLease(lease));
// Pass it to the server and hope for a REPLY
- reply = srv.processRenew(req);
+ reply = srv.processRenew(req, ncr_);
checkResponse(reply, DHCPV6_REPLY, transid);
tmp = reply->getOption(D6O_IA_NA);
ASSERT_TRUE(tmp);
req->addOption(generateClientId(13)); // generate different DUID
// (with length 13)
- reply = srv.processRenew(req);
+ reply = srv.processRenew(req, ncr_);
checkResponse(reply, DHCPV6_REPLY, transid);
tmp = reply->getOption(D6O_IA_NA);
ASSERT_TRUE(tmp);
req->addOption(srv.getServerID());
// Pass it to the server and hope for a REPLY
- Pkt6Ptr reply = srv.processRelease(req);
+ Pkt6Ptr reply = srv.processRelease(req, ncr_);
// Check if we get response at all
checkResponse(reply, DHCPV6_REPLY, 1234);
SCOPED_TRACE("CASE 1: No lease known to server");
// Pass it to the server and hope for a REPLY
- Pkt6Ptr reply = srv.processRelease(req);
+ Pkt6Ptr reply = srv.processRelease(req, ncr_);
// Check if we get response at all
checkResponse(reply, DHCPV6_REPLY, transid);
ASSERT_TRUE(LeaseMgrFactory::instance().addLease(lease));
// Pass it to the server and hope for a REPLY
- reply = srv.processRelease(req);
+ reply = srv.processRelease(req, ncr_);
checkResponse(reply, DHCPV6_REPLY, transid);
tmp = reply->getOption(D6O_IA_NA);
ASSERT_TRUE(tmp);
req->addOption(generateClientId(13)); // generate different DUID
// (with length 13)
- reply = srv.processRelease(req);
+ reply = srv.processRelease(req, ncr_);
checkResponse(reply, DHCPV6_REPLY, transid);
tmp = reply->getOption(D6O_IA_NA);
ASSERT_TRUE(tmp);
// Test server's response when client requests that server delegates the AAAA
// update to the client and this delegation is not allowed.
TEST_F(FqdnDhcpv6SrvTest, clientAAAAUpdateNotAllowed) {
- SCOPED_TRACE("Client AAAA Update is not allowed");
testFqdn(DHCPV6_SOLICIT, true, 0, "myhost.example.com.",
Option6ClientFqdn::FULL, FQDN_FLAG_S | FQDN_FLAG_O,
"myhost.example.com.");