expired->t2_ = ctx.subnet_->getT2();
expired->cltt_ = time(NULL);
expired->subnet_id_ = ctx.subnet_->getID();
- expired->fixed_ = false;
expired->hostname_ = ctx.hostname_;
expired->fqdn_fwd_ = ctx.fwd_dns_update_;
expired->fqdn_rev_ = ctx.rev_dns_update_;
}
updateLease4Information(expired, ctx);
- expired->fixed_ = false;
LOG_DEBUG(alloc_engine_logger, ALLOC_ENGINE_DBG_TRACE_DETAIL_DATA,
ALLOC_ENGINE_V4_REUSE_EXPIRED_LEASE_DATA)
const bool fqdn_fwd, const bool fqdn_rev,
const std::string& hostname, const HWAddrPtr& hwaddr)
:addr_(addr), t1_(t1), t2_(t2), valid_lft_(valid_lft), cltt_(cltt),
- subnet_id_(subnet_id), fixed_(false), hostname_(hostname),
- fqdn_fwd_(fqdn_fwd), fqdn_rev_(fqdn_rev), hwaddr_(hwaddr),
- state_(STATE_DEFAULT) {
+ subnet_id_(subnet_id), hostname_(hostname), fqdn_fwd_(fqdn_fwd),
+ fqdn_rev_(fqdn_rev), hwaddr_(hwaddr), state_(STATE_DEFAULT) {
}
other.fqdn_rev_, other.hostname_, other.hwaddr_) {
// Copy over fields derived from Lease.
- ext_ = other.ext_;
- comments_ = other.comments_;
- fixed_ = other.fixed_;
state_ = other.state_;
// Copy the hardware address if it is defined.
: Lease(address, t1, t2, valid_lifetime, subnet_id, cltt, fqdn_fwd,
fqdn_rev, hostname, hw_address),
- ext_(0), client_id_(client_id) {
+ client_id_(client_id) {
}
std::string
valid_lft_ = other.valid_lft_;
cltt_ = other.cltt_;
subnet_id_ = other.subnet_id_;
- fixed_ = other.fixed_;
hostname_ = other.hostname_;
fqdn_fwd_ = other.fqdn_fwd_;
fqdn_rev_ = other.fqdn_rev_;
- comments_ = other.comments_;
- ext_ = other.ext_;
state_ = other.state_;
// Copy the hardware address if it is defined.
return (nullOrEqualValues(hwaddr_, other.hwaddr_) &&
nullOrEqualValues(client_id_, other.client_id_) &&
addr_ == other.addr_ &&
- ext_ == other.ext_ &&
subnet_id_ == other.subnet_id_ &&
t1_ == other.t1_ &&
t2_ == other.t2_ &&
valid_lft_ == other.valid_lft_ &&
cltt_ == other.cltt_ &&
- fixed_ == other.fixed_ &&
hostname_ == other.hostname_ &&
fqdn_fwd_ == other.fqdn_fwd_ &&
fqdn_rev_ == other.fqdn_rev_ &&
- comments_ == other.comments_ &&
state_ == other.state_);
}
t2_ == other.t2_ &&
cltt_ == other.cltt_ &&
subnet_id_ == other.subnet_id_ &&
- fixed_ == other.fixed_ &&
hostname_ == other.hostname_ &&
fqdn_fwd_ == other.fqdn_fwd_ &&
fqdn_rev_ == other.fqdn_rev_ &&
- comments_ == other.comments_ &&
state_ == other.state_);
}
/// Specifies the identification of the subnet to which the lease belongs.
SubnetID subnet_id_;
- /// @brief Fixed lease?
- ///
- /// Fixed leases are kept after they are released/expired.
- bool fixed_;
-
/// @brief Client hostname
///
/// This field may be empty
/// This information may not be available in certain cases.
HWAddrPtr hwaddr_;
- /// @brief Lease comments
- ///
- /// Currently not used. It may be used for keeping comments made by the
- /// system administrator.
- std::string comments_;
-
/// @brief Bitfield holding lease state(s).
///
/// This is a bitfield which holds the lease state. Typically, a lease
/// extensively, direct access is warranted.
struct Lease4 : public Lease {
- /// @brief Address extension
- ///
- /// It is envisaged that in some cases IPv4 address will be accompanied
- /// with some additional data. One example of such use are Address + Port
- /// solutions (or Port-restricted Addresses), where several clients may get
- /// the same address, but different port ranges. This feature is not
- /// expected to be widely used. Under normal circumstances, the value
- /// should be 0.
- uint32_t ext_;
-
/// @brief Client identifier
///
/// @todo Should this be a pointer to a client ID or the ID itself?
const bool fqdn_fwd = false, const bool fqdn_rev = false,
const std::string& hostname = "")
: Lease(addr, t1, t2, valid_lft, subnet_id, cltt, fqdn_fwd, fqdn_rev,
- hostname, hwaddr), ext_(0) {
+ hostname, hwaddr) {
if (clientid_len) {
client_id_.reset(new ClientId(clientid, clientid_len));
}
/// @brief Default constructor
///
/// Initialize fields that don't have a default constructor.
- Lease4() : Lease(0, 0, 0, 0, 0, 0, false, false, "", HWAddrPtr()), ext_(0)
+ Lease4() : Lease(0, 0, 0, 0, 0, 0, false, false, "", HWAddrPtr())
{
}
lease->addr_ = IOAddress(address);
// Initialize unused fields.
- lease->ext_ = 0; // Not saved
lease->t1_ = 0; // Not saved
lease->t2_ = 0; // Not saved
- lease->fixed_ = false; // Unused
- lease->comments_ = std::string(""); // Unused
// Set other parameters. For historical reasons, address 0 is not used.
if (address == straddress4_[0]) {
// Initialize unused fields.
lease->t1_ = 0; // Not saved
lease->t2_ = 0; // Not saved
- lease->fixed_ = false; // Unused
- lease->comments_ = std::string(""); // Unused
// Set other parameters. For historical reasons, address 0 is not used.
if (address == straddress6_[0]) {
// Initialize unused fields.
empty_lease->t1_ = 0; // Not saved
empty_lease->t2_ = 0; // Not saved
- empty_lease->fixed_ = false; // Unused
- empty_lease->comments_ = std::string(""); // Unused
empty_lease->iaid_ = 142;
empty_lease->duid_ = DuidPtr(new DUID(*duid));
empty_lease->subnet_id_ = 23;
"hostname.example.com.");
EXPECT_EQ(ADDRESS[i], static_cast<uint32_t>(lease.addr_));
- EXPECT_EQ(0, lease.ext_);
EXPECT_TRUE(util::equalValues(hwaddr_, lease.hwaddr_));
EXPECT_TRUE(util::equalValues(clientid_, lease.client_id_));
EXPECT_EQ(0, lease.t1_);
EXPECT_EQ(VALID_LIFETIME, lease.valid_lft_);
EXPECT_EQ(current_time, lease.cltt_);
EXPECT_EQ(SUBNET_ID, lease.subnet_id_);
- EXPECT_FALSE(lease.fixed_);
EXPECT_EQ("hostname.example.com.", lease.hostname_);
EXPECT_TRUE(lease.fqdn_fwd_);
EXPECT_TRUE(lease.fqdn_rev_);
- EXPECT_TRUE(lease.comments_.empty());
EXPECT_EQ(Lease::STATE_DEFAULT, lease.state_);
}
}
EXPECT_TRUE(lease1 == lease2); // Check that the reversion has made the
EXPECT_FALSE(lease1 != lease2); // ... leases equal
- ++lease1.ext_;
- EXPECT_FALSE(lease1 == lease2);
- EXPECT_TRUE(lease1 != lease2);
- lease1.ext_ = lease2.ext_;
- EXPECT_TRUE(lease1 == lease2); // Check that the reversion has made the
- EXPECT_FALSE(lease1 != lease2); // ... leases equal
-
++lease1.hwaddr_->hwaddr_[0];
EXPECT_FALSE(lease1 == lease2);
EXPECT_TRUE(lease1 != lease2);
EXPECT_TRUE(lease1 == lease2); // Check that the reversion has made the
EXPECT_FALSE(lease1 != lease2); // ... leases equal
- lease1.fixed_ = !lease1.fixed_;
- EXPECT_FALSE(lease1 == lease2);
- EXPECT_TRUE(lease1 != lease2);
- lease1.fixed_ = lease2.fixed_;
- EXPECT_TRUE(lease1 == lease2); // Check that the reversion has made the
- EXPECT_FALSE(lease1 != lease2); // ... leases equal
-
lease1.hostname_ += std::string("Something random");
EXPECT_FALSE(lease1 == lease2);
EXPECT_TRUE(lease1 != lease2);
EXPECT_TRUE(lease1 == lease2); // Check that the reversion has made the
EXPECT_FALSE(lease1 != lease2); // ... leases equal
- lease1.comments_ += std::string("Something random");
- EXPECT_FALSE(lease1 == lease2);
- EXPECT_TRUE(lease1 != lease2);
- lease1.comments_ = lease2.comments_;
- EXPECT_TRUE(lease1 == lease2); // Check that the reversion has made the
- EXPECT_FALSE(lease1 != lease2); // ... leases equal
-
lease1.state_ += 1;
EXPECT_FALSE(lease1 == lease2);
EXPECT_TRUE(lease1 != lease2);
/// Checks that the operator==() correctly compares two leases for equality.
/// As operator!=() is also defined for this class, every check on operator==()
/// is followed by the reverse check on operator!=().
-TEST(Lease6Test, OperatorEquals) {
+TEST(Lease6Test, operatorEquals) {
// check a variety of addresses with different bits set.
const IOAddress addr("2001:db8:1::456");
EXPECT_TRUE(lease1 == lease2); // Check that the reversion has made the
EXPECT_FALSE(lease1 != lease2); // ... leases equal
- lease1.fixed_ = !lease1.fixed_;
- EXPECT_FALSE(lease1 == lease2);
- EXPECT_TRUE(lease1 != lease2);
- lease1.fixed_ = lease2.fixed_;
- EXPECT_TRUE(lease1 == lease2); // Check that the reversion has made the
- EXPECT_FALSE(lease1 != lease2); // ... leases equal
-
lease1.hostname_ += std::string("Something random");
EXPECT_FALSE(lease1 == lease2);
EXPECT_TRUE(lease1 != lease2);
EXPECT_TRUE(lease1 == lease2); // Check that the reversion has made the
EXPECT_FALSE(lease1 != lease2); // ... leases equal
- lease1.comments_ += std::string("Something random");
- EXPECT_FALSE(lease1 == lease2);
- EXPECT_TRUE(lease1 != lease2);
- lease1.comments_ = lease2.comments_;
- EXPECT_TRUE(lease1 == lease2); // Check that the reversion has made the
- EXPECT_FALSE(lease1 != lease2); // ... leases equal
-
lease1.state_ += 1;
EXPECT_FALSE(lease1 == lease2);
EXPECT_TRUE(lease1 != lease2);