diff options
author | Thomas Markwalder <tmark@isc.org> | 2024-12-10 20:16:16 +0100 |
---|---|---|
committer | Thomas Markwalder <tmark@isc.org> | 2024-12-16 16:30:16 +0100 |
commit | 9631120607df1d11e8a6ee6580ccd6e4912215b8 (patch) | |
tree | 14edd54e3a62f5ca9928bb9a4a32cb1caa9aedf5 /src | |
parent | [#3663] Add ddns ttl columns to mysql schema (diff) | |
download | kea-9631120607df1d11e8a6ee6580ccd6e4912215b8.tar.xz kea-9631120607df1d11e8a6ee6580ccd6e4912215b8.zip |
[#3663] MySQL CB hook now supports ddns-ttl params
Changes to be committed:
modified: src/hooks/dhcp/mysql/mysql_cb_dhcp4.cc
modified: src/hooks/dhcp/mysql/mysql_cb_dhcp6.cc
modified: src/hooks/dhcp/mysql/mysql_query_macros_dhcp.h
modified: src/lib/dhcpsrv/testutils/generic_cb_dhcp4_unittest.cc
modified: src/lib/dhcpsrv/testutils/generic_cb_dhcp6_unittest.cc
Diffstat (limited to 'src')
-rw-r--r-- | src/hooks/dhcp/mysql/mysql_cb_dhcp4.cc | 114 | ||||
-rw-r--r-- | src/hooks/dhcp/mysql/mysql_cb_dhcp6.cc | 106 | ||||
-rw-r--r-- | src/hooks/dhcp/mysql/mysql_query_macros_dhcp.h | 16 | ||||
-rw-r--r-- | src/lib/dhcpsrv/testutils/generic_cb_dhcp4_unittest.cc | 9 | ||||
-rw-r--r-- | src/lib/dhcpsrv/testutils/generic_cb_dhcp6_unittest.cc | 8 |
5 files changed, 217 insertions, 36 deletions
diff --git a/src/hooks/dhcp/mysql/mysql_cb_dhcp4.cc b/src/hooks/dhcp/mysql/mysql_cb_dhcp4.cc index 872c420bc5..78dd421a9f 100644 --- a/src/hooks/dhcp/mysql/mysql_cb_dhcp4.cc +++ b/src/hooks/dhcp/mysql/mysql_cb_dhcp4.cc @@ -360,6 +360,10 @@ public: MySqlBinding::createInteger<uint32_t>(), // cache_max_age MySqlBinding::createInteger<uint32_t>(), // offer lifetime MySqlBinding::createString(ALLOCATOR_TYPE_BUF_LENGTH), // allocator + MySqlBinding::createInteger<float>(), // ddns_ttl_percent + MySqlBinding::createInteger<uint32_t>(), // ddns_ttl + MySqlBinding::createInteger<uint32_t>(), // ddns_ttl_min + MySqlBinding::createInteger<uint32_t>(), // ddns_ttl_max MySqlBinding::createString(SERVER_TAG_BUF_LENGTH) // server_tag }; @@ -614,7 +618,27 @@ public: last_subnet->setAllocatorType(out_bindings[73]->getString()); } - // server_tag at 74. + // ddns_ttl_percent at 74. + if (!out_bindings[74]->amNull()) { + last_subnet->setDdnsTtlPercent(out_bindings[74]->getFloat()); + } + + // ddns_ttl at 75. + if (!out_bindings[75]->amNull()) { + last_subnet->setDdnsTtl(out_bindings[75]->getInteger<uint32_t>()); + } + + // ddns_ttl_min at 76. + if (!out_bindings[76]->amNull()) { + last_subnet->setDdnsTtlMin(out_bindings[76]->getInteger<uint32_t>()); + } + + // ddns_ttl_max at 77. + if (!out_bindings[77]->amNull()) { + last_subnet->setDdnsTtlMax(out_bindings[77]->getInteger<uint32_t>()); + } + + // server_tag at 78. // Subnet ready. Add it to the list. auto ret = subnets.insert(last_subnet); @@ -627,10 +651,10 @@ public: } } - // Check for new server tags at 74. - if (!out_bindings[74]->amNull() && - (last_tag != out_bindings[74]->getString())) { - last_tag = out_bindings[74]->getString(); + // Check for new server tags at 78. + if (!out_bindings[78]->amNull() && + (last_tag != out_bindings[78]->getString())) { + last_tag = out_bindings[78]->getString(); if (!last_tag.empty() && !last_subnet->hasServerTag(ServerTag(last_tag))) { last_subnet->setServerTag(last_tag); } @@ -1069,7 +1093,11 @@ public: MySqlBinding::condCreateFloat(subnet->getCacheThreshold(Network::Inheritance::NONE)), condCreateInteger<uint32_t>(subnet->getCacheMaxAge(Network::Inheritance::NONE)), condCreateInteger<uint32_t>(subnet->getOfferLft(Network::Inheritance::NONE)), - MySqlBinding::condCreateString(subnet->getAllocatorType(Network::Inheritance::NONE)) + MySqlBinding::condCreateString(subnet->getAllocatorType(Network::Inheritance::NONE)), + MySqlBinding::condCreateFloat(subnet->getDdnsTtlPercent(Network::Inheritance::NONE)), + condCreateInteger<uint32_t>(subnet->getDdnsTtl(Network::Inheritance::NONE)), + condCreateInteger<uint32_t>(subnet->getDdnsTtlMin(Network::Inheritance::NONE)), + condCreateInteger<uint32_t>(subnet->getDdnsTtlMax(Network::Inheritance::NONE)), }; MySqlTransaction transaction(conn_); @@ -1321,6 +1349,10 @@ public: MySqlBinding::createInteger<uint32_t>(), // cache_max_age MySqlBinding::createInteger<uint32_t>(), // offer lifetime MySqlBinding::createString(ALLOCATOR_TYPE_BUF_LENGTH), // allocator + MySqlBinding::createInteger<float>(), // ddns_ttl_percent + MySqlBinding::createInteger<uint32_t>(), // ddns_ttl + MySqlBinding::createInteger<uint32_t>(), // ddns_ttl_min + MySqlBinding::createInteger<uint32_t>(), // ddns_ttl_max MySqlBinding::createString(SERVER_TAG_BUF_LENGTH) // server_tag }; @@ -1522,7 +1554,27 @@ public: last_network->setAllocatorType(out_bindings[47]->getString()); } - // server_tag at 48. + // ddns_ttl_percent at 48. + if (!out_bindings[48]->amNull()) { + last_network->setDdnsTtlPercent(out_bindings[48]->getFloat()); + } + + // ddns_ttl at 49. + if (!out_bindings[49]->amNull()) { + last_network->setDdnsTtl(out_bindings[49]->getInteger<uint32_t>()); + } + + // ddns_ttl_min at 50. + if (!out_bindings[50]->amNull()) { + last_network->setDdnsTtlMin(out_bindings[50]->getInteger<uint32_t>()); + } + + // ddns_ttl_max at 51. + if (!out_bindings[51]->amNull()) { + last_network->setDdnsTtlMax(out_bindings[51]->getInteger<uint32_t>()); + } + + // server_tag at 52. // Add the shared network. auto ret = shared_networks.push_back(last_network); @@ -1536,9 +1588,9 @@ public: } // Check for new server tags. - if (!out_bindings[48]->amNull() && - (last_tag != out_bindings[48]->getString())) { - last_tag = out_bindings[48]->getString(); + if (!out_bindings[52]->amNull() && + (last_tag != out_bindings[52]->getString())) { + last_tag = out_bindings[52]->getString(); if (!last_tag.empty() && !last_network->hasServerTag(ServerTag(last_tag))) { last_network->setServerTag(last_tag); } @@ -1693,7 +1745,11 @@ public: MySqlBinding::condCreateFloat(shared_network->getCacheThreshold(Network::Inheritance::NONE)), condCreateInteger<uint32_t>(shared_network->getCacheMaxAge(Network::Inheritance::NONE)), condCreateInteger<uint32_t>(shared_network->getOfferLft(Network::Inheritance::NONE)), - MySqlBinding::condCreateString(shared_network->getAllocatorType(Network::Inheritance::NONE)) + MySqlBinding::condCreateString(shared_network->getAllocatorType(Network::Inheritance::NONE)), + MySqlBinding::condCreateFloat(shared_network->getDdnsTtlPercent(Network::Inheritance::NONE)), + condCreateInteger<uint32_t>(shared_network->getDdnsTtl(Network::Inheritance::NONE)), + condCreateInteger<uint32_t>(shared_network->getDdnsTtlMin(Network::Inheritance::NONE)), + condCreateInteger<uint32_t>(shared_network->getDdnsTtlMax(Network::Inheritance::NONE)) }; MySqlTransaction transaction(conn_); @@ -3208,9 +3264,14 @@ TaggedStatementArray tagged_statements = { { " cache_threshold," " cache_max_age," " offer_lifetime," - " allocator" + " allocator," + " ddns_ttl_percent," + " ddns_ttl," + " ddns_ttl_min," + " ddns_ttl_max" ") VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?," - " ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)" }, + " ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?," + " ?, ?, ?, ?)" }, // Insert association of the subnet with a server. { MySqlConfigBackendDHCPv4Impl::INSERT_SUBNET4_SERVER, @@ -3257,9 +3318,14 @@ TaggedStatementArray tagged_statements = { { " cache_threshold," " cache_max_age," " offer_lifetime," - " allocator" + " allocator," + " ddns_ttl_percent," + " ddns_ttl," + " ddns_ttl_min," + " ddns_ttl_max" ") VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?," - " ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)" }, + " ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?," + " ?, ?, ?, ?)" }, // Insert association of the shared network with a server. { MySqlConfigBackendDHCPv4Impl::INSERT_SHARED_NETWORK4_SERVER, @@ -3369,9 +3435,13 @@ TaggedStatementArray tagged_statements = { { " reservations_in_subnet = ?," " reservations_out_of_pool = ?," " cache_threshold = ?," - " cache_max_age = ?, " - " offer_lifetime = ?, " - " allocator = ? " + " cache_max_age = ?," + " offer_lifetime = ?," + " allocator = ?," + " ddns_ttl_percent = ?," + " ddns_ttl = ?," + " ddns_ttl_min = ?," + " ddns_ttl_max = ? " "WHERE subnet_id = ? OR subnet_prefix = ?" }, // Update existing shared network. @@ -3408,8 +3478,12 @@ TaggedStatementArray tagged_statements = { { " reservations_out_of_pool = ?," " cache_threshold = ?," " cache_max_age = ?," - " offer_lifetime = ?, " - " allocator = ? " + " offer_lifetime = ?," + " allocator = ?," + " ddns_ttl_percent = ?," + " ddns_ttl = ?," + " ddns_ttl_min = ?," + " ddns_ttl_max = ? " "WHERE name = ?" }, // Update existing option definition. diff --git a/src/hooks/dhcp/mysql/mysql_cb_dhcp6.cc b/src/hooks/dhcp/mysql/mysql_cb_dhcp6.cc index 9c0c61e264..3d2bd8bb69 100644 --- a/src/hooks/dhcp/mysql/mysql_cb_dhcp6.cc +++ b/src/hooks/dhcp/mysql/mysql_cb_dhcp6.cc @@ -394,6 +394,10 @@ public: MySqlBinding::createInteger<uint32_t>(), // cache_max_age MySqlBinding::createString(ALLOCATOR_TYPE_BUF_LENGTH), // allocator MySqlBinding::createString(ALLOCATOR_TYPE_BUF_LENGTH), // pd_allocator + MySqlBinding::createInteger<float>(), // ddns_ttl_percent + MySqlBinding::createInteger<uint32_t>(), // ddns_ttl + MySqlBinding::createInteger<uint32_t>(), // ddns_ttl_min + MySqlBinding::createInteger<uint32_t>(), // ddns_ttl_max MySqlBinding::createString(SERVER_TAG_BUF_LENGTH) // server_tag }; @@ -637,7 +641,27 @@ public: last_subnet->setPdAllocatorType(out_bindings[98]->getString()); } - // server_tag (99 / last) + // ddns_ttl_percent at 99 + if (!out_bindings[99]->amNull()) { + last_subnet->setDdnsTtlPercent(out_bindings[99]->getFloat()); + } + + // ddns_ttl at 100 + if (!out_bindings[100]->amNull()) { + last_subnet->setDdnsTtl(out_bindings[100]->getInteger<uint32_t>()); + } + + // ddns_ttl_min at 101 + if (!out_bindings[101]->amNull()) { + last_subnet->setDdnsTtlMin(out_bindings[101]->getInteger<uint32_t>()); + } + + // ddns_ttl_max at 102 + if (!out_bindings[102]->amNull()) { + last_subnet->setDdnsTtlMax(out_bindings[102]->getInteger<uint32_t>()); + } + + // server_tag (103 / last) // Subnet ready. Add it to the list. auto ret = subnets.insert(last_subnet); @@ -651,9 +675,9 @@ public: } // Check for new server tags. - if (!out_bindings[99]->amNull() && - (last_tag != out_bindings[99]->getString())) { - last_tag = out_bindings[99]->getString(); + if (!out_bindings[103]->amNull() && + (last_tag != out_bindings[103]->getString())) { + last_tag = out_bindings[103]->getString(); if (!last_tag.empty() && !last_subnet->hasServerTag(ServerTag(last_tag))) { last_subnet->setServerTag(last_tag); } @@ -1293,7 +1317,11 @@ public: MySqlBinding::condCreateFloat(subnet->getCacheThreshold(Network::Inheritance::NONE)), condCreateInteger<uint32_t>(subnet->getCacheMaxAge(Network::Inheritance::NONE)), MySqlBinding::condCreateString(subnet->getAllocatorType(Network::Inheritance::NONE)), - MySqlBinding::condCreateString(subnet->getPdAllocatorType(Network::Inheritance::NONE)) + MySqlBinding::condCreateString(subnet->getPdAllocatorType(Network::Inheritance::NONE)), + MySqlBinding::condCreateFloat(subnet->getDdnsTtlPercent(Network::Inheritance::NONE)), + condCreateInteger<uint32_t>(subnet->getDdnsTtl(Network::Inheritance::NONE)), + condCreateInteger<uint32_t>(subnet->getDdnsTtlMin(Network::Inheritance::NONE)), + condCreateInteger<uint32_t>(subnet->getDdnsTtlMax(Network::Inheritance::NONE)) }; MySqlTransaction transaction(conn_); @@ -1623,6 +1651,10 @@ public: MySqlBinding::createInteger<uint32_t>(), // cache_max_age MySqlBinding::createString(ALLOCATOR_TYPE_BUF_LENGTH), // allocator MySqlBinding::createString(ALLOCATOR_TYPE_BUF_LENGTH), // pd_allocator + MySqlBinding::createInteger<float>(), // ddns_ttl_percent + MySqlBinding::createInteger<uint32_t>(), // ddns_ttl + MySqlBinding::createInteger<uint32_t>(), // ddns_ttl_min + MySqlBinding::createInteger<uint32_t>(), // ddns_ttl_max MySqlBinding::createString(SERVER_TAG_BUF_LENGTH) // server_tag }; @@ -1824,7 +1856,27 @@ public: last_network->setPdAllocatorType(out_bindings[48]->getString()); } - // server_tag at 49. + // ddns_ttl_percent at 49. + if (!out_bindings[49]->amNull()) { + last_network->setDdnsTtlPercent(out_bindings[49]->getFloat()); + } + + // ddns_ttl at 50. + if (!out_bindings[50]->amNull()) { + last_network->setDdnsTtl(out_bindings[50]->getInteger<uint32_t>()); + } + + // ddns_ttl_min at 51. + if (!out_bindings[51]->amNull()) { + last_network->setDdnsTtlMin(out_bindings[51]->getInteger<uint32_t>()); + } + + // ddns_ttl_max at 52. + if (!out_bindings[52]->amNull()) { + last_network->setDdnsTtlMax(out_bindings[52]->getInteger<uint32_t>()); + } + + // server_tag at 53. // Add the shared network. auto ret = shared_networks.push_back(last_network); @@ -1838,9 +1890,9 @@ public: } // Check for new server tags. - if (!out_bindings[49]->amNull() && - (last_tag != out_bindings[49]->getString())) { - last_tag = out_bindings[49]->getString(); + if (!out_bindings[53]->amNull() && + (last_tag != out_bindings[53]->getString())) { + last_tag = out_bindings[53]->getString(); if (!last_tag.empty() && !last_network->hasServerTag(ServerTag(last_tag))) { last_network->setServerTag(last_tag); } @@ -2006,7 +2058,11 @@ public: MySqlBinding::condCreateFloat(shared_network->getCacheThreshold(Network::Inheritance::NONE)), condCreateInteger<uint32_t>(shared_network->getCacheMaxAge(Network::Inheritance::NONE)), MySqlBinding::condCreateString(shared_network->getAllocatorType(Network::Inheritance::NONE)), - MySqlBinding::condCreateString(shared_network->getPdAllocatorType(Network::Inheritance::NONE)) + MySqlBinding::condCreateString(shared_network->getPdAllocatorType(Network::Inheritance::NONE)), + MySqlBinding::condCreateFloat(shared_network->getDdnsTtlPercent(Network::Inheritance::NONE)), + condCreateInteger<uint32_t>(shared_network->getDdnsTtl(Network::Inheritance::NONE)), + condCreateInteger<uint32_t>(shared_network->getDdnsTtlMin(Network::Inheritance::NONE)), + condCreateInteger<uint32_t>(shared_network->getDdnsTtlMax(Network::Inheritance::NONE)), }; MySqlTransaction transaction(conn_); @@ -3613,9 +3669,14 @@ TaggedStatementArray tagged_statements = { { " cache_threshold," " cache_max_age," " allocator," - " pd_allocator" + " pd_allocator," + " ddns_ttl_percent," + " ddns_ttl," + " ddns_ttl_min," + " ddns_ttl_max" ") VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?," - " ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)" }, + " ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?," + " ?, ?, ?, ?)" }, // Insert association of the subnet with a server. { MySqlConfigBackendDHCPv6Impl::INSERT_SUBNET6_SERVER, @@ -3667,9 +3728,14 @@ TaggedStatementArray tagged_statements = { { " cache_threshold," " cache_max_age," " allocator," - " pd_allocator" + " pd_allocator," + " ddns_ttl_percent," + " ddns_ttl," + " ddns_ttl_min," + " ddns_ttl_max" ") VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?," - " ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)" }, + " ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?," + " ?, ?, ?, ?)" }, // Insert association of the shared network with a server. { MySqlConfigBackendDHCPv6Impl::INSERT_SHARED_NETWORK6_SERVER, @@ -3777,7 +3843,11 @@ TaggedStatementArray tagged_statements = { { " cache_threshold = ?," " cache_max_age = ?," " allocator = ?," - " pd_allocator = ? " + " pd_allocator = ?," + " ddns_ttl_percent = ?," + " ddns_ttl = ?," + " ddns_ttl_min = ?," + " ddns_ttl_max = ? " "WHERE subnet_id = ? OR subnet_prefix = ?" }, // Update existing shared network. @@ -3815,7 +3885,11 @@ TaggedStatementArray tagged_statements = { { " cache_threshold = ?," " cache_max_age = ?," " allocator = ?," - " pd_allocator = ? " + " pd_allocator = ?," + " ddns_ttl_percent = ?," + " ddns_ttl = ?," + " ddns_ttl_min = ?," + " ddns_ttl_max = ? " "WHERE name = ?" }, // Update existing option definition. diff --git a/src/hooks/dhcp/mysql/mysql_query_macros_dhcp.h b/src/hooks/dhcp/mysql/mysql_query_macros_dhcp.h index 1f6f45bc42..7815b22b77 100644 --- a/src/hooks/dhcp/mysql/mysql_query_macros_dhcp.h +++ b/src/hooks/dhcp/mysql/mysql_query_macros_dhcp.h @@ -124,6 +124,10 @@ namespace { " s.cache_max_age," \ " s.offer_lifetime, " \ " s.allocator, " \ + " s.ddns_ttl_percent," \ + " s.ddns_ttl," \ + " s.ddns_ttl_min," \ + " s.ddns_ttl_max," \ " srv.tag " \ "FROM dhcp4_subnet AS s " \ server_join \ @@ -260,6 +264,10 @@ namespace { " s.cache_max_age," \ " s.allocator," \ " s.pd_allocator," \ + " s.ddns_ttl_percent," \ + " s.ddns_ttl," \ + " s.ddns_ttl_min," \ + " s.ddns_ttl_max," \ " srv.tag " \ "FROM dhcp6_subnet AS s " \ server_join \ @@ -477,6 +485,10 @@ namespace { " n.cache_max_age," \ " n.offer_lifetime, " \ " n.allocator, " \ + " n.ddns_ttl_percent," \ + " n.ddns_ttl," \ + " n.ddns_ttl_min," \ + " n.ddns_ttl_max," \ " s.tag " \ "FROM dhcp4_shared_network AS n " \ server_join \ @@ -561,6 +573,10 @@ namespace { " n.cache_max_age," \ " n.allocator," \ " n.pd_allocator," \ + " n.ddns_ttl_percent," \ + " n.ddns_ttl," \ + " n.ddns_ttl_min," \ + " n.ddns_ttl_max," \ " s.tag " \ "FROM dhcp6_shared_network AS n " \ server_join \ diff --git a/src/lib/dhcpsrv/testutils/generic_cb_dhcp4_unittest.cc b/src/lib/dhcpsrv/testutils/generic_cb_dhcp4_unittest.cc index ed830e3b7f..b6b3b6ad70 100644 --- a/src/lib/dhcpsrv/testutils/generic_cb_dhcp4_unittest.cc +++ b/src/lib/dhcpsrv/testutils/generic_cb_dhcp4_unittest.cc @@ -131,6 +131,7 @@ GenericConfigBackendDHCPv4Test::initTestSubnets() { subnet->setCacheMaxAge(20); subnet->setOfferLft(77); subnet->setAllocatorType("random"); + subnet->setDdnsTtl(880); Pool4Ptr pool1(new Pool4(IOAddress("192.0.2.10"), IOAddress("192.0.2.20"))); @@ -145,6 +146,7 @@ GenericConfigBackendDHCPv4Test::initTestSubnets() { subnet->getCfgOption()->add(*test_options_[1], test_options_[1]->space_name_); subnet->getCfgOption()->add(*test_options_[2], test_options_[2]->space_name_); + test_subnets_.push_back(subnet); // Adding another subnet with the same subnet id to test @@ -186,6 +188,9 @@ GenericConfigBackendDHCPv4Test::initTestSubnets() { subnet->setDdnsReplaceClientNameMode(D2ClientConfig::ReplaceClientNameMode::RCM_WHEN_PRESENT); subnet->setDdnsGeneratedPrefix("myhost"); subnet->setDdnsQualifyingSuffix("example.org"); + subnet->setDdnsTtlPercent(0.50); + subnet->setDdnsTtlMin(300); + subnet->setDdnsTtlMax(700); subnet->getCfgOption()->add(*test_options_[0], test_options_[0]->space_name_); @@ -229,6 +234,9 @@ GenericConfigBackendDHCPv4Test::initTestSharedNetworks() { shared_network->setCacheMaxAge(21); shared_network->setOfferLft(78); shared_network->setAllocatorType("iterative"); + shared_network->setDdnsTtlPercent(0.70); + shared_network->setDdnsTtlMin(200); + shared_network->setDdnsTtlMax(800); // Add several options to the shared network. shared_network->getCfgOption()->add(*test_options_[2], test_options_[2]->space_name_); @@ -255,6 +263,7 @@ GenericConfigBackendDHCPv4Test::initTestSharedNetworks() { shared_network->setDdnsReplaceClientNameMode(D2ClientConfig::ReplaceClientNameMode::RCM_WHEN_PRESENT); shared_network->setDdnsGeneratedPrefix("myhost"); shared_network->setDdnsQualifyingSuffix("example.org"); + shared_network->setDdnsTtl(9000); shared_network->getCfgOption()->add(*test_options_[0], test_options_[0]->space_name_); test_networks_.push_back(shared_network); diff --git a/src/lib/dhcpsrv/testutils/generic_cb_dhcp6_unittest.cc b/src/lib/dhcpsrv/testutils/generic_cb_dhcp6_unittest.cc index 620f08b0d5..9ed2d44854 100644 --- a/src/lib/dhcpsrv/testutils/generic_cb_dhcp6_unittest.cc +++ b/src/lib/dhcpsrv/testutils/generic_cb_dhcp6_unittest.cc @@ -126,6 +126,7 @@ GenericConfigBackendDHCPv6Test::initTestSubnets() { subnet->setDdnsSendUpdates(false); subnet->setAllocatorType("random"); subnet->setPdAllocatorType("iterative"); + subnet->setDdnsTtl(880); Pool6Ptr pool1(new Pool6(Lease::TYPE_NA, IOAddress("2001:db8::10"), @@ -213,6 +214,9 @@ GenericConfigBackendDHCPv6Test::initTestSubnets() { subnet->setDdnsReplaceClientNameMode(D2ClientConfig::ReplaceClientNameMode::RCM_WHEN_PRESENT); subnet->setDdnsGeneratedPrefix("myhost"); subnet->setDdnsQualifyingSuffix("example.org"); + subnet->setDdnsTtlPercent(0.50); + subnet->setDdnsTtlMin(300); + subnet->setDdnsTtlMax(700); subnet->getCfgOption()->add(*test_options_[0], test_options_[0]->space_name_); @@ -256,6 +260,9 @@ GenericConfigBackendDHCPv6Test::initTestSharedNetworks() { shared_network->setDdnsSendUpdates(false); shared_network->setAllocatorType("iterative"); shared_network->setPdAllocatorType("random"); + shared_network->setDdnsTtlPercent(0.70); + shared_network->setDdnsTtlMin(200); + shared_network->setDdnsTtlMax(800); // Add several options to the shared network. shared_network->getCfgOption()->add(*test_options_[2], test_options_[2]->space_name_); @@ -284,6 +291,7 @@ GenericConfigBackendDHCPv6Test::initTestSharedNetworks() { shared_network->setDdnsReplaceClientNameMode(D2ClientConfig::ReplaceClientNameMode::RCM_WHEN_PRESENT); shared_network->setDdnsGeneratedPrefix("myhost"); shared_network->setDdnsQualifyingSuffix("example.org"); + shared_network->setDdnsTtl(9000); shared_network->getCfgOption()->add(*test_options_[0], test_options_[0]->space_name_); test_networks_.push_back(shared_network); |