diff options
Diffstat (limited to 'src/hooks/dhcp')
22 files changed, 47 insertions, 47 deletions
diff --git a/src/hooks/dhcp/flex_option/flex_option.cc b/src/hooks/dhcp/flex_option/flex_option.cc index aa6edd9211..b27f937489 100644 --- a/src/hooks/dhcp/flex_option/flex_option.cc +++ b/src/hooks/dhcp/flex_option/flex_option.cc @@ -141,7 +141,7 @@ FlexOptionImpl::configure(ConstElementPtr options) { if (options->empty()) { return; } - for (auto option : options->listValue()) { + for (auto const& option : options->listValue()) { parseOptionConfig(option); } } @@ -156,7 +156,7 @@ FlexOptionImpl::parseOptionConfig(ConstElementPtr option) { isc_throw(BadValue, "option element is not a map"); } // See SimpleParser::checkKeywords - for (auto entry : option->mapValue()) { + for (auto const& entry : option->mapValue()) { if (OPTION_PARAMETERS.count(entry.first) == 0) { isc_throw(BadValue, "unknown parameter '" << entry.first << "'"); } @@ -316,7 +316,7 @@ void FlexOptionImpl::parseSubOptions(ConstElementPtr sub_options, OptionConfigPtr opt_cfg, Option::Universe universe) { - for (ConstElementPtr sub_option : sub_options->listValue()) { + for (auto const& sub_option : sub_options->listValue()) { parseSubOption(sub_option, opt_cfg, universe); } } @@ -332,7 +332,7 @@ FlexOptionImpl::parseSubOption(ConstElementPtr sub_option, isc_throw(BadValue, "sub-option element is not a map"); } // See SimpleParser::checkKeywords - for (auto entry : sub_option->mapValue()) { + for (auto const& entry : sub_option->mapValue()) { if (SUB_OPTION_PARAMETERS.count(entry.first) == 0) { isc_throw(BadValue, "unknown parameter '" << entry.first << "'"); } diff --git a/src/hooks/dhcp/flex_option/flex_option.h b/src/hooks/dhcp/flex_option/flex_option.h index e26b437ed9..55fc4a71a2 100644 --- a/src/hooks/dhcp/flex_option/flex_option.h +++ b/src/hooks/dhcp/flex_option/flex_option.h @@ -286,7 +286,7 @@ public: template <typename PktType> void process(isc::dhcp::Option::Universe universe, PktType query, PktType response) { - for (auto pair : getOptionConfigMap()) { + for (auto const& pair : getOptionConfigMap()) { for (const OptionConfigPtr& opt_cfg : pair.second) { const isc::dhcp::ClientClass& client_class = opt_cfg->getClass(); @@ -374,7 +374,7 @@ public: } } } - for (auto pair : getSubOptionConfigMap()) { + for (auto const& pair : getSubOptionConfigMap()) { for (const auto& sub_pair : pair.second) { const SubOptionConfigPtr& sub_cfg = sub_pair.second; uint16_t sub_code = sub_cfg->getCode(); diff --git a/src/hooks/dhcp/high_availability/communication_state.cc b/src/hooks/dhcp/high_availability/communication_state.cc index 1c72ee287b..abde103f97 100644 --- a/src/hooks/dhcp/high_availability/communication_state.cc +++ b/src/hooks/dhcp/high_availability/communication_state.cc @@ -548,7 +548,7 @@ CommunicationState::getReport() const { } auto list = Element::createList(); - for (auto scope : getPartnerScopes()) { + for (auto const& scope : getPartnerScopes()) { list->add(Element::create(scope)); } report->set("last-scopes", list); diff --git a/src/hooks/dhcp/high_availability/ha_config_parser.cc b/src/hooks/dhcp/high_availability/ha_config_parser.cc index 7b8106e394..6e4662786a 100644 --- a/src/hooks/dhcp/high_availability/ha_config_parser.cc +++ b/src/hooks/dhcp/high_availability/ha_config_parser.cc @@ -104,7 +104,7 @@ HAConfigParser::parseAll(const HAConfigMapperPtr& config_storage, if (config_vec.empty()) { isc_throw(ConfigError, "a list of HA configurations must not be empty"); } - for (auto config : config_vec) { + for (auto const& config : config_vec) { parseOne(config_storage, config); } } @@ -374,7 +374,7 @@ HAConfigParser::parseOne(const HAConfigMapperPtr& config_storage, rel_config->validate(); auto peer_configs = rel_config->getAllServersConfig(); - for (auto peer_config : peer_configs) { + for (auto const& peer_config : peer_configs) { try { config_storage->map(peer_config.first, rel_config); @@ -404,7 +404,7 @@ void HAConfigParser::logConfigStatus(const HAConfigMapperPtr& config_storage) { LOG_INFO(ha_logger, HA_CONFIGURATION_SUCCESSFUL); - for (auto config : config_storage->getAll()) { + for (auto const& config : config_storage->getAll()) { // If lease updates are disabled, we want to make sure that the user // realizes that and that he has configured some other mechanism to // populate leases. @@ -449,7 +449,7 @@ HAConfigParser::validateRelationships(const HAConfigMapperPtr& config_storage) { return; } std::unordered_set<std::string> server_names; - for (auto config : configs) { + for (auto const& config : configs) { // Only the hot-standby mode is supported for multiple relationships. if (config->getHAMode() != HAConfig::HOT_STANDBY) { isc_throw(HAConfigValidationError, "multiple HA relationships are only supported for 'hot-standby' mode"); diff --git a/src/hooks/dhcp/high_availability/ha_impl.cc b/src/hooks/dhcp/high_availability/ha_impl.cc index c6f546156a..ac3fea0e68 100644 --- a/src/hooks/dhcp/high_availability/ha_impl.cc +++ b/src/hooks/dhcp/high_availability/ha_impl.cc @@ -47,21 +47,21 @@ HAImpl::startServices(const IOServicePtr& io_service, // Create the HA service and crank up the state machine. auto service = boost::make_shared<HAService>(id, io_service, network_state, configs[id], server_type); - for (auto peer_config : configs[id]->getAllServersConfig()) { + for (auto const& peer_config : configs[id]->getAllServersConfig()) { services_->map(peer_config.first, service); } } // Schedule a start of the services. This ensures we begin after // the dust has settled and Kea MT mode has been firmly established. io_service->post([&]() { - for (auto service : services_->getAll()) { + for (auto const& service : services_->getAll()) { service->startClientAndListener(); } }); } HAImpl::~HAImpl() { - for (auto service : services_->getAll()) { + for (auto const& service : services_->getAll()) { // Shut down the services explicitly, we need finer control // than relying on destruction order. service->stopClientAndListener(); @@ -574,7 +574,7 @@ HAImpl::commandProcessed(hooks::CalloutHandle& callout_handle) { // Process the status get command for each HA service. auto ha_relationships = Element::createList(); - for (auto service : services_->getAll()) { + for (auto const& service : services_->getAll()) { auto ha_relationship = Element::createMap(); ConstElementPtr ha_servers = service->processStatusGet(); ha_relationship->set("ha-servers", ha_servers); @@ -798,7 +798,7 @@ HAImpl::maintenanceNotifyHandler(hooks::CalloutHandle& callout_handle) { void HAImpl::maintenanceStartHandler(hooks::CalloutHandle& callout_handle) { ConstElementPtr response; - for (auto service : services_->getAll()) { + for (auto const& service : services_->getAll()) { response = service->processMaintenanceStart(); int rcode = CONTROL_RESULT_SUCCESS; static_cast<void>(parseAnswer(rcode, response)); @@ -812,7 +812,7 @@ HAImpl::maintenanceStartHandler(hooks::CalloutHandle& callout_handle) { void HAImpl::maintenanceCancelHandler(hooks::CalloutHandle& callout_handle) { ConstElementPtr response; - for (auto service : services_->getAll()) { + for (auto const& service : services_->getAll()) { response = service->processMaintenanceCancel(); } callout_handle.setArgument("response", response); diff --git a/src/hooks/dhcp/high_availability/ha_relationship_mapper.h b/src/hooks/dhcp/high_availability/ha_relationship_mapper.h index 9990258ef2..a902f2c105 100644 --- a/src/hooks/dhcp/high_availability/ha_relationship_mapper.h +++ b/src/hooks/dhcp/high_availability/ha_relationship_mapper.h @@ -47,7 +47,7 @@ public: mapping_[key] = obj; auto found = false; - for (auto o : vector_) { + for (auto const& o : vector_) { if (o == obj) { found = true; break; diff --git a/src/hooks/dhcp/high_availability/ha_service.cc b/src/hooks/dhcp/high_availability/ha_service.cc index 55c0bed647..09f72ca265 100644 --- a/src/hooks/dhcp/high_availability/ha_service.cc +++ b/src/hooks/dhcp/high_availability/ha_service.cc @@ -1658,7 +1658,7 @@ HAService::processStatusGet() const { } std::set<std::string> scopes = query_filter_.getServedScopes(); ElementPtr list = Element::createList(); - for (std::string scope : scopes) { + for (const std::string& scope : scopes) { list->add(Element::create(scope)); } local->set("scopes", list); @@ -1700,7 +1700,7 @@ HAService::processHeartbeat() { auto scopes = query_filter_.getServedScopes(); ElementPtr scopes_list = Element::createList(); - for (auto scope : scopes) { + for (auto const& scope : scopes) { scopes_list->add(Element::create(scope)); } arguments->set("scopes", scopes_list); diff --git a/src/hooks/dhcp/high_availability/libloadtests/close_unittests.cc b/src/hooks/dhcp/high_availability/libloadtests/close_unittests.cc index 36df83e94d..2fb05645f8 100644 --- a/src/hooks/dhcp/high_availability/libloadtests/close_unittests.cc +++ b/src/hooks/dhcp/high_availability/libloadtests/close_unittests.cc @@ -243,7 +243,7 @@ CloseHATest::runPartners(bool const backup /* = true */) { if (accept_partner2 > nfd) { nfd = accept_partner2; } - for (auto reader : readers) { + for (auto const& reader : readers) { if (!reader.second) { continue; } @@ -285,7 +285,7 @@ CloseHATest::runPartners(bool const backup /* = true */) { readers[fd] = true; } } - for (auto reader : readers) { + for (auto const& reader : readers) { if (!reader.second) { continue; } @@ -314,7 +314,7 @@ CloseHATest::runPartners(bool const backup /* = true */) { if (accept_partner2 >= 0) { close(accept_partner2); } - for (auto reader : readers) { + for (auto const& reader : readers) { if (!reader.second) { continue; } diff --git a/src/hooks/dhcp/high_availability/query_filter.cc b/src/hooks/dhcp/high_availability/query_filter.cc index 5e5b7b3a44..b2538ebdb5 100644 --- a/src/hooks/dhcp/high_availability/query_filter.cc +++ b/src/hooks/dhcp/high_availability/query_filter.cc @@ -338,7 +338,7 @@ QueryFilter::getServedScopes() const { std::set<std::string> QueryFilter::getServedScopesInternal() const { std::set<std::string> scope_set; - for (auto scope : scopes_) { + for (auto const& scope : scopes_) { if (scope.second) { scope_set.insert(scope.first); } @@ -474,7 +474,7 @@ uint8_t QueryFilter::loadBalanceHash(const uint8_t* key, const size_t key_len) const { uint8_t hash = static_cast<uint8_t>(key_len); - for (auto i = key_len; i > 0;) { + for (size_t i = key_len; i > 0;) { hash = loadb_mx_tbl[hash ^ key[--i]]; } diff --git a/src/hooks/dhcp/high_availability/tests/communication_state_unittest.cc b/src/hooks/dhcp/high_availability/tests/communication_state_unittest.cc index 8c33c094ed..52d1780b3f 100644 --- a/src/hooks/dhcp/high_availability/tests/communication_state_unittest.cc +++ b/src/hooks/dhcp/high_availability/tests/communication_state_unittest.cc @@ -964,7 +964,7 @@ CommunicationStateTest::getRejectedLeaseUpdatesCountFromContainerTest() { EXPECT_EQ(500, entries.size()); // Validate that we removed expired entries, not the valid ones. - for (auto entry : entries) { + for (auto const& entry : entries) { EXPECT_EQ(1, entry.ordinal_ % 2); } } diff --git a/src/hooks/dhcp/high_availability/tests/ha_service_unittest.cc b/src/hooks/dhcp/high_availability/tests/ha_service_unittest.cc index 4c4639d4fa..800d31a2cd 100644 --- a/src/hooks/dhcp/high_availability/tests/ha_service_unittest.cc +++ b/src/hooks/dhcp/high_availability/tests/ha_service_unittest.cc @@ -1226,7 +1226,7 @@ public: // to add several more leases to the backlog to exceed the limit. if (overflow) { ASSERT_NO_THROW(generateTestLeases4()); - for (auto lease : leases4_) { + for (auto const& lease : leases4_) { service_->lease_update_backlog_.push(LeaseUpdateBacklog::ADD, lease); } } @@ -1641,7 +1641,7 @@ public: // to add several more leases to the backlog to exceed the limit. if (overflow) { ASSERT_NO_THROW(generateTestLeases6()); - for (auto lease : leases6_) { + for (auto const& lease : leases6_) { service_->lease_update_backlog_.push(LeaseUpdateBacklog::ADD, lease); } } @@ -4794,7 +4794,7 @@ TEST_F(HAServiceTest, processMaintenanceNotify) { TestHAService service(1, io_service_, network_state_, config_storage); // Test transition from the states for which it is allowed. - for (auto state : valid_states) { + for (auto const& state : valid_states) { EXPECT_NO_THROW(service.transition(state, HAService::NOP_EVT)); // Process ha-maintenance-notify command that should transition the @@ -4828,7 +4828,7 @@ TEST_F(HAServiceTest, processMaintenanceNotify) { }; // Make sure that the transition from the other states is not allowed. - for (auto state : invalid_states) { + for (auto const& state : invalid_states) { EXPECT_NO_THROW(service.transition(state, HAService::NOP_EVT)); EXPECT_NO_THROW(service.runModel(HAService::NOP_EVT)); @@ -5507,7 +5507,7 @@ public: } if (!static_scopes_.empty()) { auto json_scopes = Element::createList(); - for (auto scope : static_scopes_) { + for (auto const& scope : static_scopes_) { json_scopes->add(Element::create(scope)); } response_arguments->set("scopes", json_scopes); @@ -5890,7 +5890,7 @@ public: << "'"; // Now, verify that each specified scope is handled. - for(auto scope : scopes) { + for(auto const& scope : scopes) { EXPECT_TRUE(service_->query_filter_.amServingScope(scope)) << "test failed for state '" << service_->getStateLabel(my_state.state_) << "'"; diff --git a/src/hooks/dhcp/lease_cmds/tests/lease_cmds4_unittest.cc b/src/hooks/dhcp/lease_cmds/tests/lease_cmds4_unittest.cc index 444b4be024..c01874563d 100644 --- a/src/hooks/dhcp/lease_cmds/tests/lease_cmds4_unittest.cc +++ b/src/hooks/dhcp/lease_cmds/tests/lease_cmds4_unittest.cc @@ -1541,7 +1541,7 @@ void Lease4CmdsTest::testLease4GetPaged() { EXPECT_EQ(2, page_count->intValue()); // Go over each lease and verify its correctness. - for (ConstElementPtr lease : leases->listValue()) { + for (auto const& lease : leases->listValue()) { ASSERT_EQ(Element::map, lease->getType()); ASSERT_TRUE(lease->contains("ip-address")); ConstElementPtr ip_address = lease->get("ip-address"); @@ -3128,7 +3128,7 @@ void Lease4CmdsTest::testLease4ResendDdnsEnabled() { // Expected response string. string exp_rsp = "NCR generated for: 192.0.2.1, hostname: myhost.example.com."; - for (auto scenario : scenarios) { + for (auto const& scenario : scenarios) { SCOPED_TRACE(scenario.description_); // Fetch the lease so we can update the DDNS direction flags. @@ -3220,7 +3220,7 @@ void Lease4CmdsTest::testLease4DnsRemoveD2Enabled() { }, }; - for (auto scenario : scenarios) { + for (auto const& scenario : scenarios) { SCOPED_TRACE(scenario.description_); // Let's create a lease with scenario attributes. diff --git a/src/hooks/dhcp/lease_cmds/tests/lease_cmds6_unittest.cc b/src/hooks/dhcp/lease_cmds/tests/lease_cmds6_unittest.cc index 181042b8c4..bc5e953fa5 100644 --- a/src/hooks/dhcp/lease_cmds/tests/lease_cmds6_unittest.cc +++ b/src/hooks/dhcp/lease_cmds/tests/lease_cmds6_unittest.cc @@ -1712,7 +1712,7 @@ void Lease6CmdsTest::testLease6GetPaged() { EXPECT_EQ(2, page_count->intValue()); // Go over each lease and verify its correctness. - for (ConstElementPtr lease : leases->listValue()) { + for (auto const& lease : leases->listValue()) { ASSERT_EQ(Element::map, lease->getType()); ASSERT_TRUE(lease->contains("ip-address")); ConstElementPtr ip_address = lease->get("ip-address"); @@ -3795,7 +3795,7 @@ void Lease6CmdsTest::testLease6ResendDdnsEnabled() { // Expected response string. string exp_rsp = "NCR generated for: 2001:db8:1::1, hostname: myhost.example.com."; - for (auto scenario : scenarios) { + for (auto const& scenario : scenarios) { SCOPED_TRACE(scenario.description_); // Fetch the lease so we can update the DDNS direction flags. @@ -3887,7 +3887,7 @@ void Lease6CmdsTest::testLease6DnsRemoveD2Enabled() { }, }; - for (auto scenario : scenarios) { + for (auto const& scenario : scenarios) { SCOPED_TRACE(scenario.description_); // Let's create a lease with scenario attributes. diff --git a/src/hooks/dhcp/mysql_cb/mysql_cb_dhcp4.cc b/src/hooks/dhcp/mysql_cb/mysql_cb_dhcp4.cc index c89c1316cd..992ee5740f 100644 --- a/src/hooks/dhcp/mysql_cb/mysql_cb_dhcp4.cc +++ b/src/hooks/dhcp/mysql_cb/mysql_cb_dhcp4.cc @@ -2550,7 +2550,7 @@ public: tossNonMatchingElements(server_selector, class_list); - for (auto c : class_list) { + for (auto const& c : class_list) { client_classes.addClass(c); } } diff --git a/src/hooks/dhcp/mysql_cb/mysql_cb_dhcp6.cc b/src/hooks/dhcp/mysql_cb/mysql_cb_dhcp6.cc index 2f290faad7..c32babe9f9 100644 --- a/src/hooks/dhcp/mysql_cb/mysql_cb_dhcp6.cc +++ b/src/hooks/dhcp/mysql_cb/mysql_cb_dhcp6.cc @@ -2978,7 +2978,7 @@ public: tossNonMatchingElements(server_selector, class_list); - for (auto c : class_list) { + for (auto const& c : class_list) { client_classes.addClass(c); } } diff --git a/src/hooks/dhcp/mysql_cb/mysql_cb_impl.cc b/src/hooks/dhcp/mysql_cb/mysql_cb_impl.cc index cf080f8914..13284b2548 100644 --- a/src/hooks/dhcp/mysql_cb/mysql_cb_impl.cc +++ b/src/hooks/dhcp/mysql_cb/mysql_cb_impl.cc @@ -520,7 +520,7 @@ MySqlConfigBackendImpl::createUpdateOptionDef(const db::ServerSelector& server_s auto tag = getServerTag(server_selector, "creating or updating option definition"); ElementPtr record_types = Element::createList(); - for (auto field : option_def->getRecordFields()) { + for (auto const& field : option_def->getRecordFields()) { record_types->add(Element::create(static_cast<int>(field))); } MySqlBindingPtr record_types_binding = record_types->empty() ? diff --git a/src/hooks/dhcp/mysql_cb/mysql_cb_impl.h b/src/hooks/dhcp/mysql_cb/mysql_cb_impl.h index 78eb87bd64..8592ecf955 100644 --- a/src/hooks/dhcp/mysql_cb/mysql_cb_impl.h +++ b/src/hooks/dhcp/mysql_cb/mysql_cb_impl.h @@ -730,7 +730,7 @@ public: void multipleUpdateDeleteQueries(T first_index, R... other_indexes) { std::vector<T> indexes({ first_index, other_indexes... }); db::MySqlBindingCollection empty_bindings; - for (auto index : indexes) { + for (auto const& index : indexes) { conn_.updateDeleteQuery(index, empty_bindings); } } diff --git a/src/hooks/dhcp/pgsql_cb/pgsql_cb_dhcp4.cc b/src/hooks/dhcp/pgsql_cb/pgsql_cb_dhcp4.cc index 4e7b77056f..71eb9fa91f 100644 --- a/src/hooks/dhcp/pgsql_cb/pgsql_cb_dhcp4.cc +++ b/src/hooks/dhcp/pgsql_cb/pgsql_cb_dhcp4.cc @@ -2340,7 +2340,7 @@ public: tossNonMatchingElements(server_selector, class_list); - for (auto c : class_list) { + for (auto const& c : class_list) { client_classes.addClass(c); } } diff --git a/src/hooks/dhcp/pgsql_cb/pgsql_cb_dhcp6.cc b/src/hooks/dhcp/pgsql_cb/pgsql_cb_dhcp6.cc index 06dff3f3e1..899f912613 100644 --- a/src/hooks/dhcp/pgsql_cb/pgsql_cb_dhcp6.cc +++ b/src/hooks/dhcp/pgsql_cb/pgsql_cb_dhcp6.cc @@ -2663,7 +2663,7 @@ public: tossNonMatchingElements(server_selector, class_list); - for (auto c : class_list) { + for (auto const& c : class_list) { client_classes.addClass(c); } } diff --git a/src/hooks/dhcp/pgsql_cb/pgsql_cb_impl.cc b/src/hooks/dhcp/pgsql_cb/pgsql_cb_impl.cc index 2732f7a62c..a3e1534b41 100644 --- a/src/hooks/dhcp/pgsql_cb/pgsql_cb_impl.cc +++ b/src/hooks/dhcp/pgsql_cb/pgsql_cb_impl.cc @@ -523,7 +523,7 @@ PgSqlConfigBackendImpl::createUpdateOptionDef(const db::ServerSelector& server_s in_bindings.addTempString(option_def->getEncapsulatedSpace()); ElementPtr record_types = Element::createList(); - for (auto field : option_def->getRecordFields()) { + for (auto const& field : option_def->getRecordFields()) { record_types->add(Element::create(static_cast<int>(field))); } diff --git a/src/hooks/dhcp/pgsql_cb/pgsql_cb_impl.h b/src/hooks/dhcp/pgsql_cb/pgsql_cb_impl.h index aaa76b6056..e449cb763c 100644 --- a/src/hooks/dhcp/pgsql_cb/pgsql_cb_impl.h +++ b/src/hooks/dhcp/pgsql_cb/pgsql_cb_impl.h @@ -694,7 +694,7 @@ public: void multipleUpdateDeleteQueries(T first_index, R... other_indexes) { std::vector<T> indexes({ first_index, other_indexes... }); db::PsqlBindArray in_bindings; - for (auto index : indexes) { + for (auto const& index : indexes) { updateDeleteQuery(index, in_bindings); } } diff --git a/src/hooks/dhcp/run_script/tests/run_script_unittests.cc b/src/hooks/dhcp/run_script/tests/run_script_unittests.cc index 5dc284157e..33255f0f80 100644 --- a/src/hooks/dhcp/run_script/tests/run_script_unittests.cc +++ b/src/hooks/dhcp/run_script/tests/run_script_unittests.cc @@ -67,7 +67,7 @@ namespace { string join(const ProcessEnvVars& vars) { string result; - for (auto var : vars) { + for (auto const& var : vars) { result += var + "\n"; } return (result); |