mirror of
https://gitlab.isc.org/isc-projects/kea
synced 2025-09-02 15:05:16 +00:00
[4321] Got rid of used once include_address_
This commit is contained in:
@@ -57,7 +57,6 @@ public:
|
|||||||
|
|
||||||
/// @brief IAID used for IA_NA.
|
/// @brief IAID used for IA_NA.
|
||||||
uint32_t na_iaid_;
|
uint32_t na_iaid_;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
};
|
};
|
||||||
@@ -117,6 +116,9 @@ Dhcpv6SrvTest::acquireAndDecline(Dhcp6Client& client,
|
|||||||
ASSERT_TRUE(declined_global);
|
ASSERT_TRUE(declined_global);
|
||||||
uint64_t before_global = declined_cnt->getInteger().first;
|
uint64_t before_global = declined_cnt->getInteger().first;
|
||||||
|
|
||||||
|
/// Determines if the client will include address in the messages it sends.
|
||||||
|
bool include_address_ = true;
|
||||||
|
|
||||||
// Let's tamper with the address if necessary.
|
// Let's tamper with the address if necessary.
|
||||||
switch (addr_type) {
|
switch (addr_type) {
|
||||||
case VALID_ADDR:
|
case VALID_ADDR:
|
||||||
@@ -129,7 +131,7 @@ Dhcpv6SrvTest::acquireAndDecline(Dhcp6Client& client,
|
|||||||
break;
|
break;
|
||||||
case NO_ADDR:
|
case NO_ADDR:
|
||||||
// Tell the client to not include an address in its IA_NA
|
// Tell the client to not include an address in its IA_NA
|
||||||
client.includeAddress(false);
|
include_address_ = false;
|
||||||
break;
|
break;
|
||||||
case NO_IA:
|
case NO_IA:
|
||||||
// Tell the client to not include IA_NA at all
|
// Tell the client to not include IA_NA at all
|
||||||
@@ -144,7 +146,7 @@ Dhcpv6SrvTest::acquireAndDecline(Dhcp6Client& client,
|
|||||||
client.config_.leases_[0].iaid_ = iaid2;
|
client.config_.leases_[0].iaid_ = iaid2;
|
||||||
|
|
||||||
// Ok, let's decline the lease.
|
// Ok, let's decline the lease.
|
||||||
ASSERT_NO_THROW(client.doDecline());
|
ASSERT_NO_THROW(client.doDecline(include_address_));
|
||||||
|
|
||||||
// Let's check if there's a lease
|
// Let's check if there's a lease
|
||||||
Lease6Ptr lease = LeaseMgrFactory::instance().getLease6(Lease::TYPE_NA,
|
Lease6Ptr lease = LeaseMgrFactory::instance().getLease6(Lease::TYPE_NA,
|
||||||
|
@@ -103,8 +103,7 @@ Dhcp6Client::Dhcp6Client() :
|
|||||||
use_client_id_(true),
|
use_client_id_(true),
|
||||||
use_rapid_commit_(false),
|
use_rapid_commit_(false),
|
||||||
client_ias_(),
|
client_ias_(),
|
||||||
fqdn_(),
|
fqdn_() {
|
||||||
include_address_(true) {
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Dhcp6Client::Dhcp6Client(boost::shared_ptr<NakedDhcpv6Srv>& srv) :
|
Dhcp6Client::Dhcp6Client(boost::shared_ptr<NakedDhcpv6Srv>& srv) :
|
||||||
@@ -120,8 +119,7 @@ Dhcp6Client::Dhcp6Client(boost::shared_ptr<NakedDhcpv6Srv>& srv) :
|
|||||||
use_client_id_(true),
|
use_client_id_(true),
|
||||||
use_rapid_commit_(false),
|
use_rapid_commit_(false),
|
||||||
client_ias_(),
|
client_ias_(),
|
||||||
fqdn_(),
|
fqdn_() {
|
||||||
include_address_(true) {
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@@ -551,7 +549,7 @@ Dhcp6Client::doConfirm() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
Dhcp6Client::doDecline() {
|
Dhcp6Client::doDecline(const bool include_address) {
|
||||||
Pkt6Ptr query = createMsg(DHCPV6_DECLINE);
|
Pkt6Ptr query = createMsg(DHCPV6_DECLINE);
|
||||||
if (!forced_server_id_) {
|
if (!forced_server_id_) {
|
||||||
query->addOption(context_.response_->getOption(D6O_SERVERID));
|
query->addOption(context_.response_->getOption(D6O_SERVERID));
|
||||||
@@ -559,7 +557,7 @@ Dhcp6Client::doDecline() {
|
|||||||
query->addOption(forced_server_id_);
|
query->addOption(forced_server_id_);
|
||||||
}
|
}
|
||||||
|
|
||||||
generateIAFromLeases(query);
|
generateIAFromLeases(query, include_address);
|
||||||
|
|
||||||
context_.query_ = query;
|
context_.query_ = query;
|
||||||
sendMsg(context_.query_);
|
sendMsg(context_.query_);
|
||||||
@@ -573,7 +571,8 @@ Dhcp6Client::doDecline() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
Dhcp6Client::generateIAFromLeases(const Pkt6Ptr& query) {
|
Dhcp6Client::generateIAFromLeases(const Pkt6Ptr& query,
|
||||||
|
const bool include_address) {
|
||||||
/// @todo: add support for IAPREFIX here.
|
/// @todo: add support for IAPREFIX here.
|
||||||
|
|
||||||
for (std::vector<Lease6>::const_iterator lease = config_.leases_.begin();
|
for (std::vector<Lease6>::const_iterator lease = config_.leases_.begin();
|
||||||
@@ -584,7 +583,7 @@ Dhcp6Client::generateIAFromLeases(const Pkt6Ptr& query) {
|
|||||||
|
|
||||||
Option6IAPtr ia(new Option6IA(D6O_IA_NA, lease->iaid_));
|
Option6IAPtr ia(new Option6IA(D6O_IA_NA, lease->iaid_));
|
||||||
|
|
||||||
if (include_address_) {
|
if (include_address) {
|
||||||
ia->addOption(OptionPtr(new Option6IAAddr(D6O_IAADDR,
|
ia->addOption(OptionPtr(new Option6IAAddr(D6O_IAADDR,
|
||||||
lease->addr_, lease->preferred_lft_, lease->valid_lft_)));
|
lease->addr_, lease->preferred_lft_, lease->valid_lft_)));
|
||||||
}
|
}
|
||||||
|
@@ -292,7 +292,8 @@ public:
|
|||||||
///
|
///
|
||||||
/// This function simulates sending the Decline message to the server and
|
/// This function simulates sending the Decline message to the server and
|
||||||
/// receiving the server's response.
|
/// receiving the server's response.
|
||||||
void doDecline();
|
/// @param include_address should the address be included?
|
||||||
|
void doDecline(const bool include_address = true);
|
||||||
|
|
||||||
/// @brief Performs stateless (inf-request / reply) exchange.
|
/// @brief Performs stateless (inf-request / reply) exchange.
|
||||||
///
|
///
|
||||||
@@ -590,8 +591,8 @@ public:
|
|||||||
const asiolink::IOAddress& prefix =
|
const asiolink::IOAddress& prefix =
|
||||||
asiolink::IOAddress::IPV6_ZERO_ADDRESS());
|
asiolink::IOAddress::IPV6_ZERO_ADDRESS());
|
||||||
|
|
||||||
/// @brief Removes IAs specified with @ref includeAddress and
|
/// @brief Removes IAs specified by @ref requestAddress and
|
||||||
/// @ref includePrefix methods.
|
/// @ref requestPrefix methods.
|
||||||
///
|
///
|
||||||
/// If this method is called and the client initiates an exchange with
|
/// If this method is called and the client initiates an exchange with
|
||||||
/// a server the client will only include IAs for which it has leases.
|
/// a server the client will only include IAs for which it has leases.
|
||||||
@@ -647,13 +648,6 @@ public:
|
|||||||
void useFQDN(const uint8_t flags, const std::string& fqdn_name,
|
void useFQDN(const uint8_t flags, const std::string& fqdn_name,
|
||||||
Option6ClientFqdn::DomainNameType fqdn_type);
|
Option6ClientFqdn::DomainNameType fqdn_type);
|
||||||
|
|
||||||
/// @brief Controls whether the client should send an addres in IA_NA
|
|
||||||
///
|
|
||||||
/// @param send should the address be included?
|
|
||||||
void includeAddress(const bool send) {
|
|
||||||
include_address_ = send;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// @brief Lease configuration obtained by the client.
|
/// @brief Lease configuration obtained by the client.
|
||||||
Configuration config_;
|
Configuration config_;
|
||||||
|
|
||||||
@@ -693,8 +687,9 @@ public:
|
|||||||
/// @brief Generates IA_NA based on lease information
|
/// @brief Generates IA_NA based on lease information
|
||||||
///
|
///
|
||||||
/// @param query generated IA_NA options will be added here
|
/// @param query generated IA_NA options will be added here
|
||||||
void
|
/// @param include_address should the address be included?
|
||||||
generateIAFromLeases(const Pkt6Ptr& query);
|
void generateIAFromLeases(const Pkt6Ptr& query,
|
||||||
|
const bool include_address = true);
|
||||||
|
|
||||||
/// @brief Adds extra option (an option the client will always send)
|
/// @brief Adds extra option (an option the client will always send)
|
||||||
///
|
///
|
||||||
@@ -859,12 +854,6 @@ private:
|
|||||||
|
|
||||||
/// @brief FQDN requested by the client.
|
/// @brief FQDN requested by the client.
|
||||||
Option6ClientFqdnPtr fqdn_;
|
Option6ClientFqdnPtr fqdn_;
|
||||||
|
|
||||||
/// @brief Determines if the client will include address in the messages
|
|
||||||
/// it sends.
|
|
||||||
///
|
|
||||||
/// @todo this flag is currently supported in Decline only.
|
|
||||||
bool include_address_;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // end of namespace isc::dhcp::test
|
} // end of namespace isc::dhcp::test
|
||||||
|
Reference in New Issue
Block a user