mirror of
https://gitlab.isc.org/isc-projects/kea
synced 2025-08-30 13:37:55 +00:00
[#3119] Fixed some coverity reported defects
This commit is contained in:
parent
78acb9cec0
commit
1eb9c75f3f
@ -1426,7 +1426,7 @@ Dhcpv6Srv::buildCfgOptionList(const Pkt6Ptr& question,
|
||||
// Secondly, pool specific options. Pools are defined within a subnet, so
|
||||
// if there is no subnet, there is nothing to do.
|
||||
if (ctx.subnet_) {
|
||||
for (auto resource : ctx.allocated_resources_) {
|
||||
for (const auto& resource : ctx.allocated_resources_) {
|
||||
PoolPtr pool =
|
||||
ctx.subnet_->getPool(resource.getPrefixLength() == 128 ?
|
||||
Lease::TYPE_NA : Lease::TYPE_PD,
|
||||
@ -4211,7 +4211,7 @@ Dhcpv6Srv::processDhcp4Query(const Pkt6Ptr& dhcp4_query) {
|
||||
|
||||
void Dhcpv6Srv::classifyByVendor(const Pkt6Ptr& pkt) {
|
||||
OptionVendorClassPtr vclass;
|
||||
for (auto opt : pkt->getOptions(D6O_VENDOR_CLASS)) {
|
||||
for (const auto& opt : pkt->getOptions(D6O_VENDOR_CLASS)) {
|
||||
vclass = boost::dynamic_pointer_cast<OptionVendorClass>(opt.second);
|
||||
if (!vclass || vclass->getTuplesNum() == 0) {
|
||||
continue;
|
||||
@ -4333,7 +4333,7 @@ Dhcpv6Srv::requiredClassify(const Pkt6Ptr& pkt, AllocEngine::ClientContext6& ctx
|
||||
}
|
||||
|
||||
// And finish by pools
|
||||
for (auto resource : ctx.allocated_resources_) {
|
||||
for (const auto& resource : ctx.allocated_resources_) {
|
||||
PoolPtr pool =
|
||||
ctx.subnet_->getPool(resource.getPrefixLength() == 128 ?
|
||||
Lease::TYPE_NA : Lease::TYPE_PD,
|
||||
|
@ -1,4 +1,4 @@
|
||||
// Copyright (C) 2019-2022 Internet Systems Consortium, Inc. ("ISC")
|
||||
// Copyright (C) 2019-2023 Internet Systems Consortium, Inc. ("ISC")
|
||||
//
|
||||
// This Source Code Form is subject to the terms of the Mozilla Public
|
||||
// License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
@ -375,7 +375,7 @@ public:
|
||||
}
|
||||
}
|
||||
for (auto pair : getSubOptionConfigMap()) {
|
||||
for (auto sub_pair : pair.second) {
|
||||
for (const auto& sub_pair : pair.second) {
|
||||
const SubOptionConfigPtr& sub_cfg = sub_pair.second;
|
||||
uint16_t sub_code = sub_cfg->getCode();
|
||||
uint16_t opt_code = sub_cfg->getContainerCode();
|
||||
|
@ -1178,7 +1178,7 @@ removeIdentical(ConstElementPtr a, ConstElementPtr b) {
|
||||
isc_throw(TypeError, "Non-map Elements passed to removeIdentical");
|
||||
}
|
||||
|
||||
for (auto kv : a->mapValue()) {
|
||||
for (const auto& kv : a->mapValue()) {
|
||||
auto key = kv.first;
|
||||
if (!b->contains(key) ||
|
||||
!a->get(key)->equals(*b->get(key))) {
|
||||
@ -1196,7 +1196,7 @@ merge(ElementPtr element, ConstElementPtr other) {
|
||||
isc_throw(TypeError, "merge arguments not MapElements");
|
||||
}
|
||||
|
||||
for (auto kv : other->mapValue()) {
|
||||
for (const auto& kv : other->mapValue()) {
|
||||
auto key = kv.first;
|
||||
auto value = kv.second;
|
||||
if (value && value->getType() != Element::null) {
|
||||
@ -1517,7 +1517,7 @@ isEquivalent0(ConstElementPtr a, ConstElementPtr b, unsigned level) {
|
||||
return (false);
|
||||
}
|
||||
// iterate on the first map
|
||||
for (auto kv : a->mapValue()) {
|
||||
for (const auto& kv : a->mapValue()) {
|
||||
// get the b value for the given keyword and recurse
|
||||
ConstElementPtr item = b->get(kv.first);
|
||||
if (!item || !isEquivalent0(kv.second, item, level - 1)) {
|
||||
|
@ -162,7 +162,7 @@ CfgOption::createOptions(CfgOptionDefPtr cfg_def) {
|
||||
// Iterate over all the option descriptors in
|
||||
// all the spaces and instantiate the options
|
||||
// based on the given definitions.
|
||||
for (auto space : getOptionSpaceNames()) {
|
||||
for (const auto& space : getOptionSpaceNames()) {
|
||||
for (auto opt_desc : *(getAll(space))) {
|
||||
if (createDescriptorOption(cfg_def, space, opt_desc)) {
|
||||
// Option was recreated, let's replace the descriptor.
|
||||
@ -372,7 +372,7 @@ CfgOption::del(const std::string& option_space, const uint16_t option_code) {
|
||||
(option_space != DHCP6_OPTION_SPACE)) {
|
||||
// For each option space name iterate over the existing options.
|
||||
auto option_space_names = getOptionSpaceNames();
|
||||
for (auto option_space_from_list : option_space_names) {
|
||||
for (const auto& option_space_from_list : option_space_names) {
|
||||
// Get all options within the particular option space.
|
||||
auto options_in_space = getAll(option_space_from_list);
|
||||
for (auto option_it = options_in_space->begin();
|
||||
|
@ -251,7 +251,7 @@ ClientClassDefParser::parse(ClientClassDictionaryPtr& class_dictionary,
|
||||
}
|
||||
|
||||
// Sanity checks on built-in classes
|
||||
for (auto bn : builtinNames) {
|
||||
for (const auto& bn : builtinNames) {
|
||||
if (name == bn) {
|
||||
if (required) {
|
||||
isc_throw(DhcpConfigError, "built-in class '" << name
|
||||
|
@ -333,7 +333,7 @@ SrvConfig::applyDefaultsConfiguredGlobals(const SimpleDefaults& defaults) {
|
||||
const Element::Position pos("<default-value>", 0, 0);
|
||||
|
||||
// Let's go over all parameters we have defaults for.
|
||||
for (auto def_value : defaults) {
|
||||
for (const auto& def_value : defaults) {
|
||||
|
||||
// Try if such a parameter is there. If it is, let's
|
||||
// skip it, because user knows best *cough*.
|
||||
|
@ -442,7 +442,7 @@ const PoolPtr Subnet::getPool(Lease::Type type, const isc::asiolink::IOAddress&
|
||||
|
||||
void
|
||||
Subnet::initAllocatorsAfterConfigure() {
|
||||
for (auto allocator : allocators_) {
|
||||
for (const auto& allocator : allocators_) {
|
||||
allocator.second->initAfterConfigure();
|
||||
}
|
||||
}
|
||||
|
@ -46,7 +46,7 @@ redact(ElementPtrType const& element, list<string> json_path) {
|
||||
if (next_key == "*" || json_path.empty()) {
|
||||
// Then iterate through all the children.
|
||||
result = Element::createMap();
|
||||
for (auto kv : element->mapValue()) {
|
||||
for (const auto& kv : element->mapValue()) {
|
||||
std::string const& key(kv.first);
|
||||
ConstElementPtr const& value(kv.second);
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
// Copyright (C) 2015-2020 Internet Systems Consortium, Inc. ("ISC")
|
||||
// Copyright (C) 2015-2023 Internet Systems Consortium, Inc. ("ISC")
|
||||
//
|
||||
// This Source Code Form is subject to the terms of the Mozilla Public
|
||||
// License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
@ -80,7 +80,7 @@ StatContext::getAll() const {
|
||||
void
|
||||
StatContext::setMaxSampleCountAll(uint32_t max_samples) {
|
||||
// Let's iterate over all stored statistics...
|
||||
for (auto s : stats_) {
|
||||
for (const auto& s : stats_) {
|
||||
// ... and set count limit for each statistic.
|
||||
s.second->setMaxSampleCount(max_samples);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user