mirror of
https://gitlab.isc.org/isc-projects/kea
synced 2025-08-29 21:18:02 +00:00
[#225] Addressed review comments
Mostly minor nits and cosmetics: modified: doc/sphinx/arm/dhcp4-srv.rst doc/sphinx/arm/dhcp6-srv.rst src/bin/dhcp6/tests/fqdn_unittest.cc src/lib/dhcpsrv/ncr_generator.cc src/lib/dhcpsrv/parsers/base_network_parser.h src/lib/dhcpsrv/srv_config.h src/lib/dhcpsrv/tests/client_class_def_parser_unittest.cc src/lib/dhcpsrv/tests/ncr_generator_unittest.cc
This commit is contained in:
parent
962ce5f31f
commit
bacd10114d
@ -3409,7 +3409,6 @@ The default configuration and values would appear as follows:
|
||||
"ddns-qualifying-suffix": "",
|
||||
"ddns-update-on-renew": false,
|
||||
"ddns-use-conflict-resolution": true,
|
||||
"ddns-ttl-percent": 0.75,
|
||||
"hostname-char-set": "",
|
||||
"hostname-char-replacement": ""
|
||||
...
|
||||
|
@ -2992,7 +2992,6 @@ The default configuration and values would appear as follows:
|
||||
"ddns-qualifying-suffix": "",
|
||||
"ddns-update-on-renew": false,
|
||||
"ddns-use-conflict-resolution": true,
|
||||
"ddns-ttl-percent": 0.75,
|
||||
"hostname-char-set": "",
|
||||
"hostname-char-replacement": ""
|
||||
...
|
||||
|
@ -2144,8 +2144,8 @@ TEST_F(FqdnDhcpv6SrvTest, processRequestRenew) {
|
||||
}
|
||||
}
|
||||
|
||||
// Verify that ddns-ttl-percent can be used to calculate
|
||||
// NCR lifetime.
|
||||
// Verify that when specified ddns-ttl-percent is used to calculate
|
||||
// the lease length in an NCR.
|
||||
TEST_F(FqdnDhcpv6SrvTest, ddnsTtlPercent) {
|
||||
// Create Reply message with Client Id and Server id.
|
||||
Pkt6Ptr answer = generateMessageWithIds(DHCPV6_REPLY);
|
||||
@ -2178,5 +2178,4 @@ TEST_F(FqdnDhcpv6SrvTest, ddnsTtlPercent) {
|
||||
0, 500, "", false, subnet_->getDdnsTtlPercent());
|
||||
}
|
||||
|
||||
|
||||
} // end of anonymous namespace
|
||||
|
@ -32,7 +32,6 @@ namespace {
|
||||
/// @param label Client identification information in the textual format.
|
||||
/// This is used for logging purposes.
|
||||
/// @param subnet subnet to which the lease belongs.
|
||||
/// use conflict resolution.
|
||||
///
|
||||
/// @tparam LeasePtrType Pointer to a lease.
|
||||
/// @tparam IdentifierType HW Address, Client Identifier or DUID.
|
||||
@ -130,7 +129,7 @@ void queueNCR(const NameChangeType& chg_type, const Lease6Ptr& lease) {
|
||||
|
||||
uint32_t calculateDdnsTtl(uint32_t lease_lft, const util::Optional<double>& ddns_ttl_percent) {
|
||||
// If we have a configured percentage use it to calculate TTL.
|
||||
if (!ddns_ttl_percent.unspecified() && (ddns_ttl_percent.get() > 0.0000)) {
|
||||
if (!ddns_ttl_percent.unspecified() && (ddns_ttl_percent.get() > 0.0)) {
|
||||
uint32_t new_lft = static_cast<uint32_t>(round(ddns_ttl_percent.get() * lease_lft));
|
||||
if (new_lft > 0) {
|
||||
return (new_lft);
|
||||
|
@ -99,6 +99,7 @@ protected:
|
||||
/// - ddns-generated-prefix
|
||||
/// - ddns-qualifying-suffix
|
||||
/// - ddns-use-conflict-resolution
|
||||
/// - ddns-update-on-renew
|
||||
/// - ddns-ttl-percent
|
||||
///
|
||||
/// @param network_data Data element holding shared network
|
||||
|
@ -155,7 +155,7 @@ public:
|
||||
/// This value, if greater than zero, is used to calculate the lease lifetime
|
||||
/// passed to D2 in the NCR. Otherwise the value is calculated per RFC 4702.
|
||||
///
|
||||
/// @return True if conflict resolution should be used.
|
||||
/// @return TTL percent as an Optional.
|
||||
util::Optional<double> getTtlPercent() const;
|
||||
|
||||
/// @brief Returns the subnet-id of the subnet associated with these parameters
|
||||
|
@ -2072,7 +2072,7 @@ TEST_F(ClientClassDefParserTest, offerLft) {
|
||||
|
||||
auto offer_lft = cclass->getOfferLft();
|
||||
ASSERT_FALSE(offer_lft.unspecified());
|
||||
EXPECT_EQ(99, offer_lft);
|
||||
EXPECT_EQ(99, offer_lft.get());
|
||||
}
|
||||
|
||||
// Test verifies that the parser rejects bogus offer-lifetime value.
|
||||
|
@ -732,6 +732,10 @@ TEST_F(NCRGenerator4Test, withTtlPercent) {
|
||||
"000001E356D43E5F0A496D65BCA24D982D646140813E3"
|
||||
"B03AB370BFF46BFA309AE7BFD", true, ttl_percent);
|
||||
}
|
||||
|
||||
double dnum = -1.0;
|
||||
uint32_t inum = static_cast<uint32_t>(round(dnum * 3400));
|
||||
std::cout << "inums is: " << inum << std::endl;
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user