Commit aa1c94a5 authored by Marcin Siodelski's avatar Marcin Siodelski
Browse files

[master] Merge branch 'trac3295_2'

Conflicts:
	src/bin/dhcp6/dhcp6_srv.cc
parents 16750ef2 e1938e5c
......@@ -852,17 +852,14 @@ Dhcpv4Srv::createNameChangeRequests(const Lease4Ptr& lease,
// removal request for non-existent hostname.
// - A server has performed reverse, forward or both updates.
// - FQDN data between the new and old lease do not match.
if ((lease->hostname_ != old_lease->hostname_) ||
(lease->fqdn_fwd_ != old_lease->fqdn_fwd_) ||
(lease->fqdn_rev_ != old_lease->fqdn_rev_)) {
if (!lease->hasIdenticalFqdn(*old_lease)) {
queueNameChangeRequest(isc::dhcp_ddns::CHG_REMOVE,
old_lease);
// If FQDN data from both leases match, there is no need to update.
} else if ((lease->hostname_ == old_lease->hostname_) &&
(lease->fqdn_fwd_ == old_lease->fqdn_fwd_) &&
(lease->fqdn_rev_ == old_lease->fqdn_rev_)) {
} else if (lease->hasIdenticalFqdn(*old_lease)) {
return;
}
}
......
......@@ -104,13 +104,7 @@ in its response to the client.
This debug message is logged when server has found the DHCPv6 Client FQDN Option
sent by a client and started processing it.
% DHCP6_DDNS_REMOVE_EMPTY_HOSTNAME FQDN for the lease being deleted is empty: %1
This error message is issued when a lease being deleted contains an indication
that the DNS Update has been performed for it, but the FQDN is missing for this
lease. This is an indication that someone may have messed up in the lease
database.
% DHCP6_DDNS_REMOVE_INVALID_HOSTNAME FQDN for the lease being deleted has invalid format: %1
% DHCP6_DDNS_REMOVE_INVALID_HOSTNAME invalid FQDN: %1 for the lease: %2 when removing DNS bindings
This error message is issued when a lease being deleted contains an indication
that the DNS Update has been performed for it, but the FQDN held in the lease
database has invalid format and can't be transformed to the canonical on-wire
......@@ -237,6 +231,11 @@ but the lease does not contain any client identification. This is most
likely due to a software error: please raise a bug report. As a temporary
workaround, manually remove the lease entry from the database.
% DHCP6_NAME_GEN_UPDATE_FAIL failed to update the lease using address %1, after generating FQDN for a client, reason: %2
This message indicates the failure when trying to update the lease and/or
options in the server's response with the hostname generated by the server
from the acquired address.
% DHCP6_NOT_RUNNING IPv6 DHCP server is not running
A warning message is issued when an attempt is made to shut down the
IPv6 DHCP server but it is not running.
......
This diff is collapsed.
......@@ -224,15 +224,17 @@ protected:
/// @param subnet subnet the client is connected to
/// @param duid client's duid
/// @param query client's message (typically SOLICIT or REQUEST)
/// @param answer server's response to the client's message. This
/// message should contain Client FQDN option being sent by the server
/// to the client (if the client sent this option to the server).
/// @param ia pointer to client's IA_NA option (client's request)
/// @param fqdn A DHCPv6 Client FQDN %Option generated in a response to the
/// FQDN option sent by a client.
///
/// @return IA_NA option (server's response)
OptionPtr assignIA_NA(const isc::dhcp::Subnet6Ptr& subnet,
const isc::dhcp::DuidPtr& duid,
const isc::dhcp::Pkt6Ptr& query,
Option6IAPtr ia,
const Option6ClientFqdnPtr& fqdn);
const isc::dhcp::Pkt6Ptr& answer,
Option6IAPtr ia);
/// @brief Processes IA_PD option (and assigns prefixes if necessary).
///
......@@ -260,12 +262,14 @@ protected:
/// @param subnet subnet the sender belongs to
/// @param duid client's duid
/// @param query client's message
/// @param answer server's response to the client's message. This
/// message should contain Client FQDN option being sent by the server
/// to the client (if the client sent this option to the server).
/// @param ia IA_NA option that is being renewed
/// @param fqdn DHCPv6 Client FQDN Option included in the server's response
/// @return IA_NA option (server's response)
OptionPtr renewIA_NA(const Subnet6Ptr& subnet, const DuidPtr& duid,
const Pkt6Ptr& query, boost::shared_ptr<Option6IA> ia,
const Option6ClientFqdnPtr& fqdn);
const Pkt6Ptr& query, const Pkt6Ptr& answer,
boost::shared_ptr<Option6IA> ia);
/// @brief Renews specific IA_PD option
///
......@@ -362,11 +366,10 @@ protected:
/// @todo: Extend this method once TA and PD becomes supported
///
/// @param question client's message (with requested IA_NA)
/// @param answer server's message (IA_NA options will be added here)
/// @param fqdn an FQDN option generated in a response to the client's
/// FQDN option.
void assignLeases(const Pkt6Ptr& question, Pkt6Ptr& answer,
const Option6ClientFqdnPtr& fqdn);
/// @param answer server's message (IA_NA options will be added here).
/// This message should contain Client FQDN option being sent by the server
/// to the client (if the client sent this option to the server).
void assignLeases(const Pkt6Ptr& question, Pkt6Ptr& answer);
/// @brief Processes Client FQDN Option.
///
......@@ -375,7 +378,7 @@ protected:
/// Received option comprises flags field which controls what DNS updates
/// server should do. Server may override client's preference based on
/// the current configuration. Server indicates that it has overridden
/// the preference by storing DHCPv6 Client Fqdn %Option with the
/// the preference by storing DHCPv6 Client FQDN option with the
/// appropriate flags in the response to a client. This option is also
/// used to communicate the client's domain-name which should be sent
/// to the DNS in the update. Again, server may act upon the received
......@@ -386,25 +389,10 @@ protected:
/// held in this function.
///
/// @param question Client's message.
///
/// @return FQDN option produced in the response to the client's message.
Option6ClientFqdnPtr processClientFqdn(const Pkt6Ptr& question);
/// @brief Adds DHCPv6 Client FQDN %Option to the server response.
///
/// This function will add the specified FQDN option into the server's
/// response when FQDN is not NULL and server is either configured to
/// always include the FQDN in the response or client requested it using
/// %Option Request %Option.
/// This function is exception safe.
///
/// @param question A message received from the client.
/// @param [out] answer A server's response where FQDN option will be added.
/// @param fqdn A DHCPv6 Client FQDN %Option to be added to the server's
/// response to a client.
void appendClientFqdn(const Pkt6Ptr& question,
Pkt6Ptr& answer,
const Option6ClientFqdnPtr& fqdn);
/// @param answer Server's response to a client. If server generated
/// Client FQDN option for the client, this option is stored in this
/// object.
void processClientFqdn(const Pkt6Ptr& question, const Pkt6Ptr& answer);
/// @brief Creates a number of @c isc::dhcp_ddns::NameChangeRequest objects
/// based on the DHCPv6 Client FQDN %Option.
......@@ -420,11 +408,9 @@ protected:
///
/// @todo Add support for multiple IAADDR options in the IA_NA.
///
/// @param answer A message beging sent to the Client.
/// @param fqdn_answer A DHCPv6 Client FQDN %Option which is included in the
/// response message sent to a client.
void createNameChangeRequests(const Pkt6Ptr& answer,
const Option6ClientFqdnPtr& fqdn_answer);
/// @param answer A message beging sent to the Client. If it holds the
/// Client FQDN option, this option is used to create NameChangeRequests.
void createNameChangeRequests(const Pkt6Ptr& answer);
/// @brief Creates a @c isc::dhcp_ddns::NameChangeRequest which requests
/// removal of DNS entries for a particular lease.
......@@ -460,10 +446,7 @@ protected:
/// as IA_NA/IAADDR to reply packet.
/// @param renew client's message asking for renew
/// @param reply server's response
/// @param fqdn A DHCPv6 Client FQDN %Option generated in the response to the
/// client's FQDN option.
void renewLeases(const Pkt6Ptr& renew, Pkt6Ptr& reply,
const Option6ClientFqdnPtr& fqdn);
void renewLeases(const Pkt6Ptr& renew, Pkt6Ptr& reply);
/// @brief Attempts to release received addresses
///
......@@ -564,6 +547,48 @@ private:
/// @param errmsg An error message containing a cause of the failure.
static void ifaceMgrSocket6ErrorHandler(const std::string& errmsg);
/// @brief Generate FQDN to be sent to a client if none exists.
///
/// This function is meant to be called by the functions which process
/// client's messages. The function should be called after a function
/// which creates FQDN option for the client. This option must exist
/// in the answer message specified as an argument. It must also be
/// called after functions which assign leases for a client. The
/// IA options being a result of lease acquisition must be appended
/// to the message specified as a parameter.
///
/// If the Client FQDN option being present in the message carries empty
/// hostname, this function will attempt to generate hostname from the
/// IPv6 address being acquired by the client. The IPv6 address is retrieved
/// from the IA_NA option carried in the specified message. If multiple
/// addresses are present in the particular IA_NA option or multiple IA_NA
/// options exist, the first address found is selected.
///
/// The IPv6 address is converted to the hostname using the following
/// pattern:
/// @code
/// prefix-converted-ip-address.domain-name-suffix.
/// @endcode
/// where:
/// - prefix is a configurable prefix string appended to all auto-generated
/// hostnames.
/// - converted-ip-address is created by replacing all colons from the IPv6
/// address with hyphens.
/// - domain-name-suffix is a suffix for a domain name that, together with
/// the other parts, constitute the fully qualified domain name.
///
/// When hostname is successfully generated, it is either used to update
/// FQDN-related fields in a lease database or to update the Client FQDN
/// option being sent back to the client. The lease database update is
/// NOT performed if Advertise message is being processed.
///
/// @param answer Message being sent to a client, which may hold IA_NA
/// and Client FQDN options to be used to generate name for a client.
///
/// @throw isc::Unexpected if specified message is NULL. This is treated
/// as a programmatic error.
void generateFqdn(const Pkt6Ptr& answer);
/// @brief Allocation Engine.
/// Pointer to the allocation engine that we are currently using
/// It must be a pointer, because we will support changing engines
......
This diff is collapsed.
// Copyright (C) 2012-2013 Internet Systems Consortium, Inc. ("ISC")
// Copyright (C) 2012-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
......@@ -294,11 +294,12 @@ AllocEngine::AllocEngine(AllocType engine_type, unsigned int attempts,
Lease6Collection
AllocEngine::allocateLeases6(const Subnet6Ptr& subnet, const DuidPtr& duid,
uint32_t iaid, const IOAddress& hint,
const uint32_t iaid, const IOAddress& hint,
Lease::Type type, const bool fwd_dns_update,
const bool rev_dns_update,
const std::string& hostname, bool fake_allocation,
const isc::hooks::CalloutHandlePtr& callout_handle) {
const isc::hooks::CalloutHandlePtr& callout_handle,
Lease6Collection& old_leases) {
try {
AllocatorPtr allocator = getAllocator(type);
......@@ -316,37 +317,49 @@ AllocEngine::allocateLeases6(const Subnet6Ptr& subnet, const DuidPtr& duid,
isc_throw(InvalidOperation, "DUID is mandatory for allocation");
}
// check if there's existing lease for that subnet/duid/iaid combination.
// Check if there's existing lease for that subnet/duid/iaid
// combination.
/// @todo: Make this generic (cover temp. addrs and prefixes)
Lease6Collection existing = LeaseMgrFactory::instance().getLeases6(type,
*duid, iaid, subnet->getID());
// There is at least one lease for this client. We will return these
// leases for the client, but we may need to update FQDN information.
if (!existing.empty()) {
// we have at least one lease already. This is a returning client,
// probably after his reboot.
return (existing);
// Return old leases so the server can see what has changed.
old_leases = existing;
return (updateFqdnData(existing, fwd_dns_update, rev_dns_update,
hostname, fake_allocation));
}
// check if the hint is in pool and is available
// This is equivalent of subnet->inPool(hint), but returns the pool
Pool6Ptr pool = boost::dynamic_pointer_cast<Pool6>(subnet->getPool(type, hint, false));
Pool6Ptr pool = boost::dynamic_pointer_cast<
Pool6>(subnet->getPool(type, hint, false));
if (pool) {
/// @todo: We support only one hint for now
Lease6Ptr lease = LeaseMgrFactory::instance().getLease6(type, hint);
if (!lease) {
/// @todo: check if the hint is reserved once we have host support
/// implemented
// the hint is valid and not currently used, let's create a lease for it
lease = createLease6(subnet, duid, iaid, hint, pool->getLength(),
type, fwd_dns_update, rev_dns_update,
/// @todo: check if the hint is reserved once we have host
/// support implemented
// The hint is valid and not currently used, let's create a
// lease for it
lease = createLease6(subnet, duid, iaid, hint,
pool->getLength(), type,
fwd_dns_update, rev_dns_update,
hostname, callout_handle, fake_allocation);
// It can happen that the lease allocation failed (we could have lost
// the race condition. That means that the hint is lo longer usable and
// we need to continue the regular allocation path.
// It can happen that the lease allocation failed (we could
// have lost the race condition. That means that the hint is
// lo longer usable and we need to continue the regular
// allocation path.
if (lease) {
// We are allocating a new lease (not renewing). So, the
// old lease should be NULL.
old_leases.push_back(Lease6Ptr());
/// @todo: We support only one lease per ia for now
Lease6Collection collection;
collection.push_back(lease);
......@@ -354,6 +367,11 @@ AllocEngine::allocateLeases6(const Subnet6Ptr& subnet, const DuidPtr& duid,
}
} else {
if (lease->expired()) {
// Copy an existing, expired lease so as it can be returned
// to the caller.
Lease6Ptr old_lease(new Lease6(*lease));
old_leases.push_back(old_lease);
/// We found a lease and it is expired, so we can reuse it
lease = reuseExpiredLease(lease, subnet, duid, iaid,
pool->getLength(),
......@@ -414,6 +432,10 @@ AllocEngine::allocateLeases6(const Subnet6Ptr& subnet, const DuidPtr& duid,
rev_dns_update, hostname,
callout_handle, fake_allocation);
if (lease) {
// We are allocating a new lease (not renewing). So, the
// old lease should be NULL.
old_leases.push_back(Lease6Ptr());
Lease6Collection collection;
collection.push_back(lease);
return (collection);
......@@ -424,6 +446,11 @@ AllocEngine::allocateLeases6(const Subnet6Ptr& subnet, const DuidPtr& duid,
// allocation attempts.
} else {
if (existing->expired()) {
// Copy an existing, expired lease so as it can be returned
// to the caller.
Lease6Ptr old_lease(new Lease6(*existing));
old_leases.push_back(old_lease);
existing = reuseExpiredLease(existing, subnet, duid, iaid,
prefix_len, fwd_dns_update,
rev_dns_update, hostname,
......@@ -1037,6 +1064,30 @@ Lease4Ptr AllocEngine::createLease4(const SubnetPtr& subnet,
}
}
Lease6Collection
AllocEngine::updateFqdnData(const Lease6Collection& leases,
const bool fwd_dns_update,
const bool rev_dns_update,
const std::string& hostname,
const bool fake_allocation) {
Lease6Collection updated_leases;
for (Lease6Collection::const_iterator lease_it = leases.begin();
lease_it != leases.end(); ++lease_it) {
Lease6Ptr lease(new Lease6(**lease_it));
lease->fqdn_fwd_ = fwd_dns_update;
lease->fqdn_rev_ = rev_dns_update;
lease->hostname_ = hostname;
if (!fake_allocation &&
((lease->fqdn_fwd_ != (*lease_it)->fqdn_fwd_) ||
(lease->fqdn_rev_ != (*lease_it)->fqdn_rev_) ||
(lease->hostname_ != (*lease_it)->hostname_))) {
LeaseMgrFactory::instance().updateLease6(lease);
}
updated_leases.push_back(lease);
}
return (updated_leases);
}
AllocEngine::AllocatorPtr AllocEngine::getAllocator(Lease::Type type) {
std::map<Lease::Type, AllocatorPtr>::const_iterator alloc = allocators_.find(type);
......
// Copyright (C) 2012-2013 Internet Systems Consortium, Inc. ("ISC")
// Copyright (C) 2012-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
......@@ -338,14 +338,21 @@ protected:
/// an address for SOLICIT that is not really allocated (true)
/// @param callout_handle a callout handle (used in hooks). A lease callouts
/// will be executed if this parameter is passed.
/// @param [out] old_leases Collection to which this function will append
/// old leases. Leases are stored in the same order as in the
/// collection of new leases, being returned. For newly allocated
/// leases (not renewed) the NULL pointers are stored in this
/// collection as old leases.
///
/// @return Allocated IPv6 leases (may be empty if allocation failed)
Lease6Collection
allocateLeases6(const Subnet6Ptr& subnet, const DuidPtr& duid, uint32_t iaid,
allocateLeases6(const Subnet6Ptr& subnet, const DuidPtr& duid,
const uint32_t iaid,
const isc::asiolink::IOAddress& hint, Lease::Type type,
const bool fwd_dns_update, const bool rev_dns_update,
const std::string& hostname, bool fake_allocation,
const isc::hooks::CalloutHandlePtr& callout_handle);
const isc::hooks::CalloutHandlePtr& callout_handle,
Lease6Collection& old_leases);
/// @brief returns allocator for a given pool type
/// @param type type of pool (V4, IA, TA or PD)
......@@ -489,6 +496,28 @@ private:
const isc::hooks::CalloutHandlePtr& callout_handle,
bool fake_allocation = false);
/// @brief Updates FQDN data for a collection of leases.
///
/// @param leases Collection of leases for which FQDN data should be
/// updated.
/// @param fwd_dns_update Boolean value which indicates whether forward FQDN
/// update was performed for each lease (true) or not (false).
/// @param rev_dns_update Boolean value which indicates whether reverse FQDN
/// update was performed for each lease (true) or not (false).
/// @param hostname Client hostname associated with a lease.
/// @param fake_allocation Boolean value which indicates that it is a real
/// lease allocation, e.g. Request message is processed (false), or address
/// is just being picked as a result of processing Solicit (true). In the
/// latter case, the FQDN data should not be updated in the lease database.
///
/// @return Collection of leases with updated FQDN data. Note that returned
/// collection holds updated FQDN data even for fake allocation.
Lease6Collection updateFqdnData(const Lease6Collection& leases,
const bool fwd_dns_update,
const bool rev_dns_update,
const std::string& hostname,
const bool fake_allocation);
/// @brief a pointer to currently used allocator
///
/// For IPv4, there will be only one allocator: TYPE_V4
......
// Copyright (C) 2012-2013 Internet Systems Consortium, Inc. ("ISC")
// Copyright (C) 2012-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
......@@ -56,6 +56,13 @@ bool Lease::expired() const {
return (expire_time < time(NULL));
}
bool
Lease::hasIdenticalFqdn(const Lease& other) const {
return (hostname_ == other.hostname_ &&
fqdn_fwd_ == other.fqdn_fwd_ &&
fqdn_rev_ == other.fqdn_rev_);
}
Lease4::Lease4(const Lease4& other)
: Lease(other.addr_, other.t1_, other.t2_, other.valid_lft_,
other.subnet_id_, other.cltt_, other.fqdn_fwd_,
......
// 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
......@@ -141,6 +141,14 @@ struct Lease {
/// @return true if the lease is expired
bool expired() const;
/// @brief Returns true if the other lease has equal FQDN data.
///
/// @param other Lease which FQDN data is to be compared with our lease.
///
/// @return Boolean value which indicates whether FQDN data of the other
/// lease is equal to the FQDN data of our lease (true) or not (false).
bool hasIdenticalFqdn(const Lease& other) const;
};
/// @brief Structure that holds a lease for IPv4 address
......
......@@ -94,22 +94,56 @@ public:
duid_ = DuidPtr(new DUID(vector<uint8_t>(8, 0x42)));
iaid_ = 42;
// instantiate cfg_mgr
// Initialize a subnet and short address pool.
initSubnet(IOAddress("2001:db8:1::"),
IOAddress("2001:db8:1::10"),
IOAddress("2001:db8:1::20"));
initFqdn("", false, false);
factory_.create("type=memfile");
}
/// @brief Configures a subnet and adds one pool to it.
///
/// This function removes existing v6 subnets before configuring
/// a new one.
///
/// @param subnet Address of a subnet to be configured.
/// @param pool_start First address in the address pool.
/// @param pool_end Last address in the address pool.
void initSubnet(const IOAddress& subnet, const IOAddress& pool_start,
const IOAddress& pool_end) {
CfgMgr& cfg_mgr = CfgMgr::instance();
cfg_mgr.deleteSubnets6();
subnet_ = Subnet6Ptr(new Subnet6(subnet, 56, 1, 2, 3, 4));
pool_ = Pool6Ptr(new Pool6(Lease::TYPE_NA, pool_start, pool_end));
// Configure normal address pool
subnet_ = Subnet6Ptr(new Subnet6(IOAddress("2001:db8:1::"), 56, 1, 2, 3, 4));
pool_ = Pool6Ptr(new Pool6(Lease::TYPE_NA, IOAddress("2001:db8:1::10"),
IOAddress("2001:db8:1::20")));
subnet_->addPool(pool_);
// Configure PD pool
pd_pool_ = Pool6Ptr(new Pool6(Lease::TYPE_PD, IOAddress("2001:db8:1::"), 56, 64));
pd_pool_ = Pool6Ptr(new Pool6(Lease::TYPE_PD, subnet, 56, 64));
subnet_->addPool(pd_pool_);
cfg_mgr.addSubnet6(subnet_);
factory_.create("type=memfile");
}
/// @brief Initializes FQDN data for a test.
///
/// The initialized values are used by the test fixture class members to
/// verify the correctness of a lease.
///
/// @param hostname Hostname to be assigned to a lease.
/// @param fqdn_fwd Indicates whether or not to perform forward DNS update
/// for a lease.
/// @param fqdn_fwd Indicates whether or not to perform reverse DNS update
/// for a lease.
void initFqdn(const std::string& hostname, const bool fqdn_fwd,
const bool fqdn_rev) {
hostname_ = hostname;
fqdn_fwd_ = fqdn_fwd;
fqdn_rev_ = fqdn_rev;
}
/// @brief attempts to convert leases collection to a single lease
......@@ -151,8 +185,9 @@ public:
EXPECT_EQ(subnet_->getT1(), lease->t1_);
EXPECT_EQ(subnet_->getT2(), lease->t2_);
EXPECT_EQ(exp_pd_len, lease->prefixlen_);
EXPECT_TRUE(false == lease->fqdn_fwd_);
EXPECT_TRUE(false == lease->fqdn_rev_);
EXPECT_EQ(fqdn_fwd_, lease->fqdn_fwd_);
EXPECT_EQ(fqdn_rev_, lease->fqdn_rev_);
EXPECT_EQ(hostname_, lease->hostname_);
EXPECT_TRUE(*lease->duid_ == *duid_);
/// @todo: check cltt
}
......@@ -211,7 +246,7 @@ public:
Lease6Ptr lease;
EXPECT_NO_THROW(lease = expectOneLease(engine->allocateLeases6(subnet_,
duid_, iaid_, hint, type, false, false,
"", fake, CalloutHandlePtr())));
"", fake, CalloutHandlePtr(), old_leases_)));
// Check that we got a lease
EXPECT_TRUE(lease);
......@@ -275,7 +310,7 @@ public:
Lease6Ptr lease;
EXPECT_NO_THROW(lease = expectOneLease(engine->allocateLeases6(subnet_,
duid_, iaid_, requested, type, false, false, "", false,
CalloutHandlePtr())));
CalloutHandlePtr(), old_leases_)));
// Check that we got a lease
ASSERT_TRUE(lease);
......@@ -319,7 +354,7 @@ public:
Lease6Ptr lease;
EXPECT_NO_THROW(lease = expectOneLease(engine->allocateLeases6(subnet_,
duid_, iaid_, hint, type, false,
false, "", false, CalloutHandlePtr())));
false, "", false, CalloutHandlePtr(), old_leases_)));
// Check that we got a lease
ASSERT_TRUE(lease);
......@@ -353,7 +388,14 @@ public:
Subnet6Ptr subnet_; ///< subnet6 (used in tests)
Pool6Ptr pool_; ///< NA pool belonging to subnet_
Pool6Ptr pd_pool_; ///< PD pool belonging to subnet_
std::string hostname_; ///< Hostname
bool fqdn_fwd_; ///< Perform forward update for a lease.
bool fqdn_rev_; ///< Perform reverse update for a lease.
LeaseMgrFactory factory_; ///< pointer to LeaseMgr factory
/// @brief Collection of leases being replaced by newly allocated or renewed
/// leases.
Lease6Collection old_leases_;
};
/// @brief Used in Allocation Engine tests for IPv4
......@@ -521,13 +563,13 @@ TEST_F(AllocEngine6Test, allocateAddress6Nulls) {
Lease6Ptr lease;
EXPECT_NO_THROW(lease = expectOneLease(engine->allocateLeases6(
Subnet6Ptr(), duid_, iaid_, IOAddress("::"), Lease::TYPE_NA,
false, false, "", false, CalloutHandlePtr())));
false, false, "", false, CalloutHandlePtr(), old_leases_)));
ASSERT_FALSE(lease);
// Allocations without DUID are not allowed either
EXPECT_NO_THROW(lease = expectOneLease(engine->allocateLeases6(subnet_,
DuidPtr(), iaid_, IOAddress("::"), Lease::TYPE_NA, false,
false, "", false, CalloutHandlePtr())));
false, "", false, CalloutHandlePtr(), old_leases_)));
ASSERT_FALSE(lease);
}
......@@ -765,19 +807,18 @@ TEST_F(AllocEngine6Test, smallPool6) {
ASSERT_TRUE(engine);
IOAddress addr("2001:db8:1::ad");
CfgMgr& cfg_mgr = CfgMgr::instance();
cfg_mgr.deleteSubnets6(); // Get rid of the default test configuration
// Create configuration similar to other tests, but with a single address pool
subnet_ = Subnet6Ptr(new Subnet6(IOAddress("2001:db8:1::"), 56, 1, 2, 3, 4));
pool_ = Pool6Ptr(new Pool6(Lease::TYPE_NA, addr, addr)); // just a single address
subnet_->addPool(pool_);
cfg_mgr.addSubnet6(subnet_);
// Create a subnet with a pool that has one address.