Skip to content

Commit d202904

Browse files
committed
[#3049] Addressed review comments
Spelling, clean ups, doxygen Split DdnsParams out to its own files: new file: src/lib/dhcpsrv/ddns_params.cc new file: src/lib/dhcpsrv/ddns_params.h
1 parent b9372f4 commit d202904

25 files changed

+429
-367
lines changed

src/bin/dhcp4/tests/fqdn_unittest.cc

+1-1
Original file line numberDiff line numberDiff line change
@@ -3100,7 +3100,7 @@ TEST_F(NameDhcpv4SrvTest, ddnsTtlMaxTest) {
31003100
TEST_F(NameDhcpv4SrvTest, poolDdnsParametersTest) {
31013101
// A configuration with following pools:
31023102
// 1. Specifies a qualifying suffix
3103-
// 2. Specifes no DDNS parameters
3103+
// 2. Specifies no DDNS parameters
31043104
// 3. Disables DDNS updates
31053105
// 4. Specifies a qualifying suffix but disables DDNS updates
31063106
std::string config = R"(

src/bin/dhcp6/dhcp6_srv.cc

+4-4
Original file line numberDiff line numberDiff line change
@@ -5093,11 +5093,11 @@ Dhcpv6Srv::checkPostAssignmentChanges(const Pkt6Ptr& question, Pkt6Ptr& answer,
50935093
}
50945094
}
50955095

5096-
// Check if the subnet was dynamnically changed by the allocation engine.
5096+
// Check if the subnet was dynamically changed by the allocation engine.
50975097
if (ctx.subnet_ && orig_subnet && (orig_subnet->getID() != ctx.subnet_->getID())) {
5098-
// We get the network for logging only. It should always be set as this a dynamic
5099-
// change should only happen within shared-networks. Not having one might not be
5100-
// an error if a hook changed the subnet?
5098+
// We get the network for logging only. It should always be set as
5099+
// this a dynamic change should only happen within shared-networks.
5100+
// Not having one might not be an error if a hook changed the subnet?
51015101
SharedNetwork6Ptr network;
51025102
orig_subnet->getSharedNetwork(network);
51035103
LOG_DEBUG(packet6_logger, DBG_DHCP6_BASIC_DATA, DHCP6_SUBNET_DYNAMICALLY_CHANGED)

src/bin/dhcp6/dhcp6_srv.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -1032,7 +1032,7 @@ class Dhcpv6Srv : public process::Daemon {
10321032
///
10331033
/// Updates the context DDNS parameters to include those from the pool
10341034
/// associated with the first active NA lease address and then checks
1035-
/// to see if the subnet has been dynamicaly changed. If either the
1035+
/// to see if the subnet has been dynamically changed. If either the
10361036
/// pool has DDNS parameters or the subnet has changed the FQDN and
10371037
/// DDNS flags are recalculated in the event the pool or subnet change
10381038
/// introduced different parameter values otherwise the function returns.

src/bin/dhcp6/tests/fqdn_unittest.cc

+27-20
Original file line numberDiff line numberDiff line change
@@ -255,8 +255,8 @@ class FqdnDhcpv6SrvTest : public Dhcpv6SrvTest {
255255
///
256256
/// @param iaid IAID
257257
/// @param pkt A DHCPv6 message to which the IA option should be added.
258-
/// @param cxt allocation engine context to which IA option should be
259-
/// added.
258+
/// @param cxt allocation engine context to which IA option should be
259+
/// added.
260260
void addIA(const uint32_t iaid, const IOAddress& addr, Pkt6Ptr& pkt,
261261
AllocEngine::ClientContext6& ctx) {
262262
Option6IAPtr opt_ia = generateIA(D6O_IA_NA, iaid, 1500, 3000);
@@ -275,8 +275,8 @@ class FqdnDhcpv6SrvTest : public Dhcpv6SrvTest {
275275
/// @param iaid IAID
276276
/// @param status_code Status code
277277
/// @param pkt A DHCPv6 message to which the option should be added.
278-
/// @param cxt allocation engine context to which IA option should be
279-
/// added.
278+
/// @param cxt allocation engine context to which IA option should be
279+
/// added.
280280
void addIA(const uint32_t iaid, const uint16_t status_code, Pkt6Ptr& pkt,
281281
AllocEngine::ClientContext6& ctx) {
282282
Option6IAPtr opt_ia = generateIA(D6O_IA_NA, iaid, 1500, 3000);
@@ -696,7 +696,7 @@ class FqdnDhcpv6SrvTest : public Dhcpv6SrvTest {
696696
ASSERT_TRUE(pool);
697697
}
698698

699-
/// @brief Verifies that DDNS TTL parameters are used when specified.
699+
/// @brief Verifies that DDNS TTL parameters are used when specified.
700700
///
701701
/// @param valid_flt lease life time
702702
/// @param ddns_ttl_percent expected configured value for ddns-ttl-percent
@@ -725,7 +725,7 @@ class FqdnDhcpv6SrvTest : public Dhcpv6SrvTest {
725725

726726
// Create an IA.
727727
Option6IAPtr opt_ia = generateIA(D6O_IA_NA, 1234, 1500, 3000);
728-
Option6IAAddrPtr opt_iaaddr(new Option6IAAddr(D6O_IAADDR,
728+
Option6IAAddrPtr opt_iaaddr(new Option6IAAddr(D6O_IAADDR,
729729
IOAddress("2001:db8:1::1"),
730730
valid_lft, valid_lft));
731731
opt_ia->addOption(opt_iaaddr);
@@ -2239,15 +2239,15 @@ TEST_F(FqdnDhcpv6SrvTest, ddnsTtlTest) {
22392239
testDdnsTtlParameters(2100, // valid lft
22402240
Optional<double>(), // percent
22412241
999, // ttl
2242-
Optional<uint32_t>(), // min
2242+
Optional<uint32_t>(), // min
22432243
Optional<uint32_t>()); // max
22442244
}
22452245

22462246
// Verify the ddns-ttl-min is used when specified.
22472247
TEST_F(FqdnDhcpv6SrvTest, ddnsTtlMinTest) {
22482248
testDdnsTtlParameters(2100, // valid lft
22492249
Optional<double>(), // percent
2250-
Optional<uint32_t>(), // ttl
2250+
Optional<uint32_t>(), // ttl
22512251
800, // ttl-min
22522252
Optional<uint32_t>()); // ttl-max
22532253
}
@@ -2256,19 +2256,19 @@ TEST_F(FqdnDhcpv6SrvTest, ddnsTtlMinTest) {
22562256
TEST_F(FqdnDhcpv6SrvTest, ddnsTtlMaxTest) {
22572257
testDdnsTtlParameters(2100, // valid lft
22582258
Optional<double>(), // percent
2259-
Optional<uint32_t>(), // ttl
2259+
Optional<uint32_t>(), // ttl
22602260
Optional<uint32_t>(), // ttl-min
2261-
500); // ttl-max
2261+
500); // ttl-max
22622262
}
22632263

2264-
// Verify pool-level DDNS pararmeters are used.
2264+
// Verify pool-level DDNS parameters are used.
22652265
// We don't verify all of them, just enough
22662266
// enough to ensure proper scoping of values.
22672267
TEST_F(FqdnDhcpv6SrvTest, poolDdnsParametersTest) {
22682268

22692269
// A configuration with following pools:
22702270
// 1. Specifies a qualifying suffix
2271-
// 2. Specifes no DDNS parameters
2271+
// 2. Specifies no DDNS parameters
22722272
// 3. Disables DDNS updates
22732273
// 4. Specifies a qualifying suffix but disables DDNS updates
22742274
std::string config = R"(
@@ -2358,18 +2358,23 @@ TEST_F(FqdnDhcpv6SrvTest, poolDdnsParametersTest) {
23582358
query->setIndex(ETH0_INDEX);
23592359

23602360
// Add the client id.
2361-
OptionPtr client_id(new Option(Option::V6, D6O_CLIENTID, scenario.raw_duid_));
2361+
OptionPtr client_id(new Option(Option::V6, D6O_CLIENTID,
2362+
scenario.raw_duid_));
23622363
query->addOption(client_id);
23632364
query->addOption(srv_->getServerID());
23642365

23652366
// Add an IA requesting the expected address.
23662367
Option6IAPtr ia = generateIA(D6O_IA_NA, 234, 1500, 3000);
2367-
OptionPtr hint_opt(new Option6IAAddr(D6O_IAADDR, scenario.expected_address_, 300, 500));
2368+
OptionPtr hint_opt(new Option6IAAddr(D6O_IAADDR,
2369+
scenario.expected_address_,
2370+
300, 500));
23682371
ia->addOption(hint_opt);
23692372
query->addOption(ia);
23702373

2371-
// Add an FQDN option. We set it to partial to ensure we qualify it with a suffix.
2372-
query->addOption(createClientFqdn(Option6ClientFqdn::FLAG_S, scenario.client_fqdn_,
2374+
// Add an FQDN option. We set it to partial to ensure we qualify
2375+
// it with a suffix.
2376+
query->addOption(createClientFqdn(Option6ClientFqdn::FLAG_S,
2377+
scenario.client_fqdn_,
23732378
Option6ClientFqdn::PARTIAL));
23742379

23752380
// Process the REQUEST.
@@ -2392,16 +2397,18 @@ TEST_F(FqdnDhcpv6SrvTest, poolDdnsParametersTest) {
23922397

23932398
// Check that we got the address we requested.
23942399
tmp = ia->getOption(D6O_IAADDR);
2395-
boost::shared_ptr<Option6IAAddr> addr = boost::dynamic_pointer_cast<Option6IAAddr>(tmp);
2400+
boost::shared_ptr<Option6IAAddr> addr
2401+
= boost::dynamic_pointer_cast<Option6IAAddr>(tmp);
23962402
ASSERT_TRUE(addr);
23972403
EXPECT_EQ(addr->getAddress(), scenario.expected_address_);
23982404

23992405
// Check that the lease exists with the correct FDQN.
2400-
Lease6Ptr lease = LeaseMgrFactory::instance().getLease6(Lease::TYPE_NA, addr->getAddress());
2406+
Lease6Ptr lease = LeaseMgrFactory::instance().getLease6(Lease::TYPE_NA,
2407+
addr->getAddress());
24012408
ASSERT_TRUE(lease);
24022409
EXPECT_EQ(lease->hostname_, scenario.expected_fqdn_);
24032410

2404-
// Verfiy the FQDN in the response is correct.
2411+
// Verify the FQDN in the response is correct.
24052412
Option6ClientFqdnPtr fqdn;
24062413
ASSERT_TRUE(fqdn = boost::dynamic_pointer_cast<
24072414
Option6ClientFqdn>(reply->getOption(D6O_CLIENT_FQDN)));
@@ -2415,7 +2422,7 @@ TEST_F(FqdnDhcpv6SrvTest, poolDdnsParametersTest) {
24152422
verifyNameChangeRequest(isc::dhcp_ddns::CHG_ADD, true, true,
24162423
scenario.expected_address_.toText(),
24172424
scenario.expected_dhcid_,
2418-
0, 4000,
2425+
0, 4000,
24192426
scenario.expected_fqdn_);
24202427
}
24212428
}

src/lib/dhcpsrv/Makefile.am

+3-1
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,7 @@ libkea_dhcpsrv_la_SOURCES += timer_mgr.cc timer_mgr.h
139139
libkea_dhcpsrv_la_SOURCES += tracking_lease_mgr.cc tracking_lease_mgr.h
140140
libkea_dhcpsrv_la_SOURCES += utils.h
141141
libkea_dhcpsrv_la_SOURCES += writable_host_data_source.h
142+
libkea_dhcpsrv_la_SOURCES += ddns_params.cc ddns_params.h
142143

143144
# Configuration parsers
144145
libkea_dhcpsrv_la_SOURCES += parsers/base_network_parser.cc
@@ -348,7 +349,8 @@ libkea_dhcpsrv_include_HEADERS = \
348349
subnet_selector.h \
349350
timer_mgr.h \
350351
utils.h \
351-
writable_host_data_source.h
352+
writable_host_data_source.h \
353+
ddns_params.h
352354

353355
if FUZZING
354356
libkea_dhcpsrv_include_HEADERS += \

src/lib/dhcpsrv/cfg_hosts_util.cc

+1-1
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ void CfgHostsList::internalize(ConstElementPtr list) {
5555
isc_throw(BadValue, "internal error: CfgHostsList::internalize: "
5656
"no reservations for subnet ID " << subnet_id);
5757
}
58-
map_.insert(std::make_pair(subnet_id,
58+
map_.insert(std::make_pair(subnet_id,
5959
boost::const_pointer_cast<Element>(resvs)));
6060
}
6161
}

src/lib/dhcpsrv/database_backends.dox

+15-15
Original file line numberDiff line numberDiff line change
@@ -128,26 +128,26 @@
128128

129129
- <b>address</b> - IPv4 address \n
130130
type: string \n
131-
example: 192.0.2.1
131+
example: 192.0.2.1
132132

133-
- <b>hwaddr</b> - hardware address (without the hardware type) \n
134-
type: string \n
133+
- <b>hwaddr</b> - hardware address (without the hardware type) \n
134+
type: string \n
135135
example: 00:01:02:03:04:05
136-
137-
- <b>client_id</b> - client identifier \n
136+
137+
- <b>client_id</b> - client identifier \n
138138
type: string \n
139139
example: 01:02:03:03:04:aa:bb:cc
140140

141141
- <b>valid_lifetime</b> - valid lifetime \n
142-
type: uint32_t \n
142+
type: uint32_t \n
143143
example: 200
144144

145145
- <b>expire</b> - expiration date \n
146146
type: uint64_t (cltt + valid lifetime) \n
147147
example: 1733517739
148148

149-
- <b>subnet_id</b> - DHCPv4 subnet identifier \n
150-
type: int32_t (0 and max excluded) \n
149+
- <b>subnet_id</b> - DHCPv4 subnet identifier \n
150+
type: int32_t (0 and max excluded) \n
151151
example: 1
152152

153153
- <b>fqdn_fwd</b> - FQDN forward DNS RR update flag \n
@@ -161,17 +161,17 @@
161161
- <b>hostname</b> - hostname \n
162162
type: string (separators are escaped) \n
163163
example: foo.bar
164-
164+
165165
- <b>state</b> - lease state \n
166166
type: int32_t (0 = assigned, 1 = declined, 2 = expired-reclaimed, 3 = released) \n
167167
example: 0
168168

169169
- <b>user_context</b> - user context \n
170-
type: string (separators are escaped) \n
170+
type: string (separators are escaped) \n
171171
example: <tt>{ \"foo\": true }</tt>
172172

173-
- <b>pool_id</b> - pool identifier \n
174-
type: uint32_t \n
173+
- <b>pool_id</b> - pool identifier \n
174+
type: uint32_t \n
175175
example: 0
176176

177177
for instance:
@@ -244,11 +244,11 @@
244244
example: <tt>{ \"foo\": true }</tt>
245245

246246
- <b>hwtype</b> - hardware type \n
247-
type: uint16_t (can be empty/omitted) \n
247+
type: uint16_t (can be empty/omitted) \n
248248
example: 1
249249

250250
- <b>hwaddr_source</b> - source of hardware address and type \n
251-
tyoe: uint32_t (one bit from an 8 bit mask, can be empty/omitted) \n
251+
tyoe: uint32_t (one bit from an 8 bit mask, can be empty/omitted) \n
252252
example: 0
253253

254254
- <b>pool_id</b> - pool identifier \n
@@ -259,7 +259,7 @@
259259
\verbatim
260260
2001:db8::1,00:01:02:03:04:05:06:0f,200,800,8,100,0,7,128,1,1,,,1,{ \"foo\": true },,,0\n
261261
\endverbatim
262-
262+
263263
More examples can be found in unit tests.
264264

265265
@section dhcpdb-host Host Backends

0 commit comments

Comments
 (0)