]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[#2618] Fixed shadow
authorFrancis Dupont <fdupont@isc.org>
Sun, 2 Jun 2024 18:53:05 +0000 (20:53 +0200)
committerFrancis Dupont <fdupont@isc.org>
Wed, 5 Jun 2024 08:13:55 +0000 (10:13 +0200)
34 files changed:
src/bin/d2/tests/d2_cfg_mgr_unittests.cc
src/bin/dhcp4/tests/hooks_unittest.cc
src/bin/dhcp4/tests/inform_unittest.cc
src/bin/dhcp6/tests/hooks_unittest.cc
src/bin/perfdhcp/command_options.cc
src/bin/perfdhcp/tests/stats_mgr_unittest.cc
src/hooks/dhcp/high_availability/ha_config_parser.cc
src/hooks/dhcp/high_availability/tests/lease_update_backlog_unittest.cc
src/hooks/dhcp/perfmon/tests/alarm_unittests.cc
src/hooks/dhcp/user_chk/user_file.cc
src/lib/dhcp/iface_mgr_bsd.cc
src/lib/dhcp/iface_mgr_sun.cc
src/lib/dhcp/pkt4.cc
src/lib/dhcp/tests/libdhcp++_unittest.cc
src/lib/dhcp/tests/packet_queue4_unittest.cc
src/lib/dhcp/tests/packet_queue6_unittest.cc
src/lib/dhcpsrv/cb_ctl_dhcp4.cc
src/lib/dhcpsrv/cb_ctl_dhcp6.cc
src/lib/dhcpsrv/host_mgr.cc
src/lib/dhcpsrv/lease_mgr.cc
src/lib/dhcpsrv/memfile_lease_mgr.cc
src/lib/dhcpsrv/parsers/dhcp_parsers.cc
src/lib/dhcpsrv/parsers/shared_network_parser.cc
src/lib/dhcpsrv/tests/alloc_engine4_unittest.cc
src/lib/dhcpsrv/tests/cfg_option_unittest.cc
src/lib/dhcpsrv/tests/flq_allocator_unittest.cc
src/lib/dhcpsrv/tests/ip_range_permutation_unittest.cc
src/lib/dhcpsrv/tests/shared_network_unittest.cc
src/lib/dns/rdata.cc
src/lib/dns/tests/rdata_tkey_unittest.cc
src/lib/dns/tests/rdata_tsig_unittest.cc
src/lib/dns/tests/rdata_unittest.h
src/lib/log/tests/message_initializer_1_unittest.cc
src/lib/tcp/tcp_stream_msg.cc

index 12c95a7f5ba3ef915a5d479870d1640c52aec15b..62a71139702e1854d2304e04c4196e5f7d5f1dc0 100644 (file)
@@ -929,7 +929,6 @@ TEST_F(D2CfgMgrTest, configPermutations) {
     //  3. data - configuration text to parse
     //  4. convert data into JSON text
     //  5. submit JSON for parsing
-    isc::data::ConstElementPtr test;
     ASSERT_TRUE(tests->get("test-list"));
     for (auto const& test : tests->get("test-list")->listValue()) {
         // Grab the description.
index d0f7a4a6160b36a1ed7b355eaee53a36039f2bb2..416bc09fcdb3d0184bbe3b4222ce3ff7ae6e5a20 100644 (file)
@@ -3489,8 +3489,7 @@ TEST_F(LoadUnloadDhcpv4SrvTest, Dhcpv4SrvConfigured) {
         if (parameters.empty()) {
             EXPECT_EQ(0, status_code);
             string expected = "{ \"arguments\": { \"hash\": \"";
-            ConstElementPtr config =
-                CfgMgr::instance().getStagingCfg()->toElement();
+            config = CfgMgr::instance().getStagingCfg()->toElement();
             expected += BaseCommandMgr::getHash(config);
             expected += "\" }, \"result\": 0, \"text\": ";
             expected += "\"Configuration successful.\" }";
index 50697d57178cea13a5c5c4d1c38047a9d65b9289..a91e45d70ce9f1be5aaa333679c8c5f363dcd896 100644 (file)
@@ -551,9 +551,9 @@ TEST_F(InformTest, messageFieldsLongOptions) {
     // then restored.
     uint32_t count = 0;
     uint8_t index = 0;
-    for (auto const& option : client.getContext().query_->options_) {
-        if (option.first == 231) {
-            for (auto const& value : option.second->getData()) {
+    for (auto const& opt : client.getContext().query_->options_) {
+        if (opt.first == 231) {
+            for (auto const& value : opt.second->getData()) {
                 ASSERT_EQ(value, index);
                 index++;
             }
@@ -563,11 +563,11 @@ TEST_F(InformTest, messageFieldsLongOptions) {
     ASSERT_EQ(1, count);
 
     count = 0;
-    for (auto const& option : resp->options_) {
-        if (option.first == DHO_DHCP_AGENT_OPTIONS) {
-            for (auto const& suboption: option.second->getOptions()) {
+    for (auto const& opt : resp->options_) {
+        if (opt.first == DHO_DHCP_AGENT_OPTIONS) {
+            for (auto const& suboption: opt.second->getOptions()) {
                 if (suboption.first == RAI_OPTION_AGENT_CIRCUIT_ID) {
-                    uint8_t index = 0;
+                    index = 0;
                     for (auto const& value : suboption.second->getData()) {
                         ASSERT_EQ(value, index);
                         index++;
@@ -588,10 +588,10 @@ TEST_F(InformTest, messageFieldsLongOptions) {
 
     count = 0;
     string value = "";
-    for (auto const& option : resp->options_) {
-        if (option.second->getType() == 240) {
-            value += string(reinterpret_cast<const char*>(&option.second->getData()[0]),
-                            option.second->getData().size());
+    for (auto const& opt : resp->options_) {
+        if (opt.second->getType() == 240) {
+            value += string(reinterpret_cast<const char*>(&opt.second->getData()[0]),
+                            opt.second->getData().size());
             count++;
         }
     }
index 6b6170a555f09f2763f1647734d3000649044cb4..6a4d0f512c5dced39b846a5e322da8fa0b3a713c 100644 (file)
@@ -5716,8 +5716,7 @@ TEST_F(LoadUnloadDhcpv6SrvTest, Dhcpv6SrvConfigured) {
         if (parameters.empty()) {
             EXPECT_EQ(0, status_code);
             string expected = "{ \"arguments\": { \"hash\": \"";
-            ConstElementPtr config =
-                CfgMgr::instance().getStagingCfg()->toElement();
+            config = CfgMgr::instance().getStagingCfg()->toElement();
             expected += BaseCommandMgr::getHash(config);
             expected += "\" }, \"result\": 0, \"text\": ";
             expected += "\"Configuration successful.\" }";
index 85d58a2d1b3c1c39c04cfadca72bdd8b60ec72f5..84de94c1076f165cdf9084b06d5c3a763c3121d3 100644 (file)
@@ -503,9 +503,9 @@ CommandOptions::initialize(int argc, char** argv, bool print_cmd_line) {
             }
 
             // Create and remember the option.
-            OptionPtr opt(new Option(ipversion_ == 4 ? Option::V4 : Option::V6,
-                                     code, bin));
-            extra_opts_.insert(make_pair(code, opt));
+            OptionPtr option(new Option(ipversion_ == 4 ? Option::V4 : Option::V6,
+                                        code, bin));
+            extra_opts_.insert(make_pair(code, option));
             break;
         }
         case 'p':
index 54253d5b8bdb364704a70d0b358407801272b0c9..498ab517739da2a58a72cb8682930e2d76904f51 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2012-2021 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2012-2024 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
@@ -232,14 +232,14 @@ public:
             // with transaction ids of already sent packets.
             Pkt4ModifiablePtr sent_packet(createPacket4(DHCPDISCOVER,
                                                     transid[i] + 1));
-            Pkt4ModifiablePtr rcvd_packet(createPacket4(DHCPOFFER,
-                                                        transid[i] + 1));
+            Pkt4ModifiablePtr rcvd_packet2(createPacket4(DHCPOFFER,
+                                                         transid[i] + 1));
             ASSERT_NO_THROW(
                 stats_mgr->passSentPacket(ExchangeType::DO, sent_packet)
             ) << "failure for transaction id " << transid[i];
 
             ASSERT_NO_THROW(
-                stats_mgr->passRcvdPacket(ExchangeType::DO, rcvd_packet);
+                stats_mgr->passRcvdPacket(ExchangeType::DO, rcvd_packet2);
             ) << "failure for transaction id " << transid[i];
         }
 
index 18747ae964a1e819259a11d44e819fc74d818131..f7349e0872124bb3edec3bdcc25c6b1fbce00e50 100644 (file)
@@ -104,8 +104,8 @@ HAConfigParser::parseAll(const HAConfigMapperPtr& config_storage,
     if (config_vec.empty()) {
         isc_throw(ConfigError, "a list of HA configurations must not be empty");
     }
-    for (auto const& config : config_vec) {
-        parseOne(config_storage, config);
+    for (auto const& cfg : config_vec) {
+        parseOne(config_storage, cfg);
     }
 }
 
index a1cbe62ab99d3791ee72fb54fd77c05878e1a9ad..f84d3ce997e08a920c73a2be6860d7f6c371d37f 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2020-2021 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2020-2024 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
@@ -49,8 +49,8 @@ TEST(LeaseUpdateBacklogTest, pushAndPop) {
     // Try to pop all lease updates.
     LeaseUpdateBacklog::OpType op_type;
     for (auto i = 0; i < 5; ++i) {
-        auto lease = backlog.pop(op_type);
-        ASSERT_TRUE(lease);
+        auto l = backlog.pop(op_type);
+        ASSERT_TRUE(l);
         ASSERT_EQ(i % 2 ? LeaseUpdateBacklog::ADD : LeaseUpdateBacklog::DELETE, op_type);
     }
 
index 0814dc457457fa27b777a72bae60086ed92d88e8..e0653a0788026be64d99fd308b81f236fe1d8672 100644 (file)
@@ -290,7 +290,6 @@ TEST(Alarm, checkSample) {
         usleep(50);
 
         // Invoke checkSample() with the scenario sample duration.  It should not throw.
-        bool should_report;
         ASSERT_NO_THROW_LOG(should_report = alarm->checkSample(scenario.sample_, report_interval));
 
         //  Verify that we returned the expected value for a reportable event (or not).
index cd3b34aa2f538d4984ce151286bdd4061f709118..ebf4c128a6c54c4dce3925b62ce4955cbdc0dff0 100644 (file)
@@ -85,7 +85,6 @@ UserFile::makeUser(const std::string& user_string) {
     // Iterate over the elements, saving of "type" and "id" to their
     // respective locals.  Anything else is assumed to be an option so
     // add it to the local property map.
-    std::pair<std::string, isc::data::ConstElementPtr> element_pair;
     for (auto const& element_pair : elements->mapValue()) {
         // Get the element's label.
         std::string label = element_pair.first;
index 7d373f1501062bdbc3fa2629da8178ef58adf931..959eb9546766eb05d8055561c1e30b06da70affc 100644 (file)
@@ -114,13 +114,13 @@ IfaceMgr::detectIfaces(bool update_only) {
     freeifaddrs(iflist);
 
     // Interfaces registering
-    for (auto const& iface_iter : ifaces) {
+    for (auto const& iface_it : ifaces) {
         IfacePtr iface;
         if (update_only) {
-            iface = getIface(iface_iter.first);
+            iface = getIface(iface_it.first);
         }
         if (!iface) {
-            addInterface(iface_iter.second);
+            addInterface(iface_it.second);
         }
     }
 }
index 4f1cd36c030ab9ff7199c6374443840181cb99c4..6376f3262ec966bcbbcee3868181085115e7c467 100644 (file)
@@ -114,13 +114,13 @@ IfaceMgr::detectIfaces(bool update_only) {
     freeifaddrs(iflist);
 
     // Interfaces registering
-    for (auto const& iface_iter : ifaces) {
+    for (auto const& iface_it : ifaces) {
         IfacePtr iface;
         if (update_only) {
-            iface = getIface(iface_iter.first);
+            iface = getIface(iface_it.first);
         }
         if (!iface) {
-            addInterface(iface_iter.second);
+            addInterface(iface_it.second);
         }
     }
 }
index 78031012453fc83c91fad406b5282f6f81745296..d552eead5613c92223e5002954a67fe04495a38d 100644 (file)
@@ -123,7 +123,7 @@ Pkt4::pack() {
 
         /// Create a ManagedScopedOptionsCopyContainer to handle storing and
         /// restoration of copied options.
-        ManagedScopedOptionsCopyContainer scoped_options;
+        ManagedScopedOptionsCopyContainer m_scoped_options;
 
         // The RFC3396 adds support for long options split over multiple options
         // using the same code.
@@ -132,7 +132,7 @@ Pkt4::pack() {
         // options will differ from the ones instantiated by the
         // @ref OptionDefinition::optionFactory. At this stage the server should
         // not do anything useful with the options beside packing.
-        LibDHCP::splitOptions4(options_, scoped_options.scoped_options_);
+        LibDHCP::splitOptions4(options_, m_scoped_options.scoped_options_);
 
         // Call packOptions4() with parameter,"top", true. This invokes
         // logic to emit the message type option first.
index f6f262aeef0b042102e0573d2973234556de5a63..086de7400581a778f46692d0c5db216435ad9796 100644 (file)
@@ -1746,21 +1746,21 @@ TEST_F(LibDhcpTest, extendVivso) {
     for (auto const& option : options) {
         ASSERT_EQ(option.second->getType(), DHO_VIVSO_SUBOPTIONS);
         OptionCollection suboptions = option.second->getOptions();
-        OptionPtr suboption;
+        OptionPtr subopt;
         OptionVendorPtr vendor = boost::dynamic_pointer_cast<OptionVendor>(option.second);
         ASSERT_TRUE(vendor);
         if (vendor->getVendorId() == 1) {
             ASSERT_EQ(suboptions.size(), 3);
-            suboption = option.second->getOption(16);
-            ASSERT_TRUE(suboption);
-            suboption = option.second->getOption(32);
-            ASSERT_TRUE(suboption);
-            suboption = option.second->getOption(64);
-            ASSERT_TRUE(suboption);
+            subopt = option.second->getOption(16);
+            ASSERT_TRUE(subopt);
+            subopt = option.second->getOption(32);
+            ASSERT_TRUE(subopt);
+            subopt = option.second->getOption(64);
+            ASSERT_TRUE(subopt);
         } else if (vendor->getVendorId() == 2) {
             ASSERT_EQ(suboptions.size(), 1);
-            suboption = option.second->getOption(128);
-            ASSERT_TRUE(suboption);
+            subopt = option.second->getOption(128);
+            ASSERT_TRUE(subopt);
         } else {
             FAIL() << "unexpected vendor type: " << vendor->getVendorId();
         }
index 58164f27e2ed666e2e1b8937c66b2200c197f2a4..4bf604debb9be6556a3a86e9e9f74ba1b51c7493 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2018-2019,2021 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2018-2024 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
@@ -109,7 +109,7 @@ TEST(PacketQueueRing4, enqueueDequeueTest) {
     // Enqueue five packets.  The first two should be pushed off.
     SocketInfo sock1(isc::asiolink::IOAddress("127.0.0.1"), 777, 10);
 
-    for (int i = 1; i < 6; ++i) {
+    for (unsigned i = 1; i < 6; ++i) {
         Pkt4Ptr pkt(new Pkt4(DHCPDISCOVER, 1000+i));
         ASSERT_NO_THROW(q->enqueuePacket(pkt, sock1));
     }
@@ -120,7 +120,7 @@ TEST(PacketQueueRing4, enqueueDequeueTest) {
 
     // We should have transids 1003,1004,1005
     Pkt4Ptr pkt;
-    for (int i = 3; i < 6; ++i) {
+    for (unsigned i = 3; i < 6; ++i) {
         ASSERT_NO_THROW(pkt = q->dequeuePacket());
         ASSERT_TRUE(pkt);
         EXPECT_EQ(1000 + i, pkt->getTransid());
@@ -134,9 +134,9 @@ TEST(PacketQueueRing4, enqueueDequeueTest) {
     ASSERT_FALSE(pkt);
 
     // Enqueue three more packets.
-    for (int i = 0; i < 3; ++i) {
-        Pkt4Ptr pkt(new Pkt4(DHCPDISCOVER, 1000+i));
-        ASSERT_NO_THROW(q->enqueuePacket(pkt, sock1));
+    for (unsigned i = 0; i < 3; ++i) {
+        Pkt4Ptr dis(new Pkt4(DHCPDISCOVER, 1000+i));
+        ASSERT_NO_THROW(q->enqueuePacket(dis, sock1));
     }
 
     checkIntStat(q, "size", 3);
@@ -153,7 +153,7 @@ TEST(PacketQueueRing4, peekPushPopTest) {
     PacketQueueRing4 q("kea-ring4", 3);
 
     // Push five packets onto the end. The first two should get pushed off.
-    for (int i = 1; i < 6; ++i) {
+    for (unsigned i = 1; i < 6; ++i) {
         Pkt4Ptr pkt(new Pkt4(DHCPDISCOVER, 1000+i));
         ASSERT_NO_THROW(q.pushPacket(pkt));
     }
@@ -276,7 +276,7 @@ TEST(TestQueue4, eatPacketsTest) {
 
     Pkt4Ptr pkt;
     // Let's add five packets.
-    for (int i = 1; i < 6; ++i) {
+    for (unsigned i = 1; i < 6; ++i) {
         pkt.reset(new Pkt4(DHCPDISCOVER, 1000 + i));
         ASSERT_NO_THROW(q.enqueuePacket(pkt, sock));
         ASSERT_EQ(i, q.getSize());
index 52fb0dc3d7433b2d5ec8855200b3a45d58e5eeb7..0e9c7d2690521e6469137dee81c635f066a73a3b 100644 (file)
@@ -110,7 +110,7 @@ TEST(PacketQueueRing6, enqueueDequeueTest) {
     // Enqueue five packets.  The first two should be pushed off.
     SocketInfo sock1(isc::asiolink::IOAddress("127.0.0.1"), 777, 10);
 
-    for (int i = 1; i < 6; ++i) {
+    for (unsigned i = 1; i < 6; ++i) {
         Pkt6Ptr pkt(new Pkt6(DHCPV6_SOLICIT, 1000+i));
         ASSERT_NO_THROW(q->enqueuePacket(pkt, sock1));
     }
@@ -121,7 +121,7 @@ TEST(PacketQueueRing6, enqueueDequeueTest) {
 
     // We should have transids 1003,1004,1005
     Pkt6Ptr pkt;
-    for (int i = 3; i < 6; ++i) {
+    for (unsigned i = 3; i < 6; ++i) {
         ASSERT_NO_THROW(pkt = q->dequeuePacket());
         ASSERT_TRUE(pkt);
         EXPECT_EQ(1000 + i, pkt->getTransid());
@@ -135,9 +135,9 @@ TEST(PacketQueueRing6, enqueueDequeueTest) {
     ASSERT_FALSE(pkt);
 
     // Enqueue three more packets.
-    for (int i = 0; i < 3; ++i) {
-        Pkt6Ptr pkt(new Pkt6(DHCPV6_SOLICIT, 1000+i));
-        ASSERT_NO_THROW(q->enqueuePacket(pkt, sock1));
+    for (unsigned i = 0; i < 3; ++i) {
+        Pkt6Ptr sol(new Pkt6(DHCPV6_SOLICIT, 1000+i));
+        ASSERT_NO_THROW(q->enqueuePacket(sol, sock1));
     }
 
     checkIntStat(q, "size", 3);
@@ -154,7 +154,7 @@ TEST(PacketQueueRing6, peekPushPopTest) {
     PacketQueueRing6 q("kea-ring6", 3);
 
     // Push five packets onto the end. The first two should get pushed off.
-    for (int i = 1; i < 6; ++i) {
+    for (unsigned i = 1; i < 6; ++i) {
         Pkt6Ptr pkt(new Pkt6(DHCPV6_SOLICIT, 1000+i));
         ASSERT_NO_THROW(q.pushPacket(pkt));
     }
@@ -277,7 +277,7 @@ TEST(TestQueue6, eatPacketsTest) {
 
     Pkt6Ptr pkt;
     // Let's add five packets.
-    for (int i = 1; i < 6; ++i) {
+    for (unsigned i = 1; i < 6; ++i) {
         pkt.reset(new Pkt6(DHCPV6_SOLICIT, 1000 + i));
         ASSERT_NO_THROW(q.enqueuePacket(pkt, sock));
         ASSERT_EQ(i, q.getSize());
index 211681bce4b9773a22ab388ea10fb472aae8f86f..0768a7c4ae951275b253cabff6719561fe751075 100644 (file)
@@ -235,7 +235,7 @@ CBControlDHCPv4::databaseConfigApply(const BackendSelector& backend_selector,
     // We're only affected by the allocator change if this is the update from
     // the configuration backend.
     if (cb_update) {
-        auto allocator = CfgMgr::instance().getCurrentCfg()->getConfiguredGlobal(CfgGlobals::ALLOCATOR);
+        allocator = CfgMgr::instance().getCurrentCfg()->getConfiguredGlobal(CfgGlobals::ALLOCATOR);
         if (allocator && (allocator->getType() == Element::string)) {
             allocator_changed = (global_allocator != allocator->stringValue());
         }
index 1ed48208100ca86cdb3213af318170910b2358b1..4dfed59f56ce8a34f0cbfad63dc40da60f95ef21 100644 (file)
@@ -241,7 +241,7 @@ CBControlDHCPv6::databaseConfigApply(const db::BackendSelector& backend_selector
     // We're only affected by the allocator change if this is the update from
     // the configuration backend.
     if (cb_update) {
-        auto allocator = CfgMgr::instance().getCurrentCfg()->getConfiguredGlobal(CfgGlobals::ALLOCATOR);
+        allocator = CfgMgr::instance().getCurrentCfg()->getConfiguredGlobal(CfgGlobals::ALLOCATOR);
         if (allocator && (allocator->getType() == Element::string)) {
             allocator_changed = (global_allocator != allocator->stringValue());
         }
@@ -249,7 +249,7 @@ CBControlDHCPv6::databaseConfigApply(const db::BackendSelector& backend_selector
         // The address allocator hasn't changed. So, let's check if the PD allocator
         // has changed.
         if (!allocator_changed) {
-            auto allocator = CfgMgr::instance().getCurrentCfg()->getConfiguredGlobal(CfgGlobals::PD_ALLOCATOR);
+            allocator = CfgMgr::instance().getCurrentCfg()->getConfiguredGlobal(CfgGlobals::PD_ALLOCATOR);
             if (allocator && (allocator->getType() == Element::string)) {
                 allocator_changed = (global_pd_allocator != allocator->stringValue());
             }
index eb9ebb91b595ad601f550e091fc7f3a5fd523d52..c57eae451576cc92f24f779d62e9eadd39128cfe 100644 (file)
@@ -966,8 +966,8 @@ HostMgr::setIPReservationsUnique(const bool unique) {
             ip_reservations_unique_ = true;
             LOG_WARN(hosts_logger, HOSTS_MGR_NON_UNIQUE_IP_UNSUPPORTED)
                 .arg(source->getType());
-            for (auto const& source : alternate_sources_) {
-                source->setIPReservationsUnique(true);
+            for (auto const& src : alternate_sources_) {
+                src->setIPReservationsUnique(true);
             }
             return (false);
         }
index ab769dd814f7b2f95a34e572a7566a7ddce16c2e..ec46fe2f972bebf14d11e62ae948da5491355f27 100644 (file)
@@ -143,18 +143,18 @@ LeaseMgr::recountLeaseStats4() {
                 stats_mgr.setValue(name_da, zero);
             }
 
-            const std::string& name_rec_dec(StatsMgr::generateName("subnet", subnet_id,
-                                                                   StatsMgr::generateName("pool", pool->getID(),
+            const std::string& pname_rec_dec(StatsMgr::generateName("subnet", subnet_id,
+                                                                    StatsMgr::generateName("pool", pool->getID(),
                                                                                           "reclaimed-declined-addresses")));
-            if (!stats_mgr.getObservation(name_rec_dec)) {
-                stats_mgr.setValue(name_rec_dec, zero);
+            if (!stats_mgr.getObservation(pname_rec_dec)) {
+                stats_mgr.setValue(pname_rec_dec, zero);
             }
 
-            const std::string& name_rec(StatsMgr::generateName("subnet", subnet_id,
-                                                               StatsMgr::generateName("pool", pool->getID(),
+            const std::string& pname_rec(StatsMgr::generateName("subnet", subnet_id,
+                                                                StatsMgr::generateName("pool", pool->getID(),
                                                                                       "reclaimed-leases")));
-            if (!stats_mgr.getObservation(name_rec)) {
-                stats_mgr.setValue(name_rec, zero);
+            if (!stats_mgr.getObservation(pname_rec)) {
+                stats_mgr.setValue(pname_rec, zero);
             }
         }
     }
index db4f5d577c789fdcfb6b9a53622cc614f6654bcf..5cbe808b5c6666e0d433c55330e4832056a2def4 100644 (file)
@@ -2584,12 +2584,12 @@ Memfile_LeaseMgr::wipeLeases4(const SubnetID& subnet_id) {
 
     // Try to get the lease using the DUID, IAID and lease type.
     std::pair<Lease4StorageSubnetIdIndex::const_iterator,
-              Lease4StorageSubnetIdIndex::const_iterator> l =
+              Lease4StorageSubnetIdIndex::const_iterator> r =
         idx.equal_range(subnet_id);
 
     // Let's collect all leases.
     Lease4Collection leases;
-    BOOST_FOREACH(auto const& lease, l) {
+    BOOST_FOREACH(auto const& lease, r) {
         leases.push_back(lease);
     }
 
@@ -2613,12 +2613,12 @@ Memfile_LeaseMgr::wipeLeases6(const SubnetID& subnet_id) {
 
     // Try to get the lease using the DUID, IAID and lease type.
     std::pair<Lease6StorageSubnetIdIndex::const_iterator,
-              Lease6StorageSubnetIdIndex::const_iterator> l =
+              Lease6StorageSubnetIdIndex::const_iterator> r =
         idx.equal_range(subnet_id);
 
     // Let's collect all leases.
     Lease6Collection leases;
-    BOOST_FOREACH(auto const& lease, l) {
+    BOOST_FOREACH(auto const& lease, r) {
         leases.push_back(lease);
     }
 
index 45d9db3a1fab69d5339ba860e9e5fad9c40a7f6b..aeb794250025dfa501707208bd9eba1a23d50487 100644 (file)
@@ -896,7 +896,7 @@ Subnet4ConfigParser::initSubnet(data::ConstElementPtr params,
             string prefix = subnet4o6.substr(0, slash);
             string lenstr = subnet4o6.substr(slash + 1);
 
-            uint8_t len = 128;
+            len = 128;
             try {
                 len = boost::lexical_cast<unsigned int>(lenstr.c_str());
             } catch (const boost::bad_lexical_cast &) {
index 95e444339d3bbb34a8c26e0dd1fe6004f4ecf7a1..3a6915f60dbbd7c29648db4d7a0e1a9af2681950 100644 (file)
@@ -248,7 +248,7 @@ SharedNetwork6Parser::parse(const data::ConstElementPtr& shared_network_data,
 
         // Make sure that the network name has been specified. The name is required
         // to create a SharedNetwork6 object.
-        std::string name = getString(shared_network_data, "name");
+        name = getString(shared_network_data, "name");
         shared_network.reset(new SharedNetwork6(name));
 
         ElementPtr mutable_params;
index 09c9a3665909761a69777b6ed7b4951f3e64115f..73939315b2db534e0380bc5dd59b375b03f71d54 100644 (file)
@@ -4037,7 +4037,6 @@ TEST_F(AllocEngine4Test, storeExtendedInfoEnabled4) {
                                     false, false, "", false);
 
     // Iterate over the test scenarios.
-    Lease4Ptr lease;
     for (auto const& scenario : scenarios) {
         SCOPED_TRACE(scenario.description_);
 
@@ -4141,8 +4140,6 @@ TEST_F(AllocEngine4Test, storeExtendedInfoDisabled4) {
                                     IOAddress::IPV4_ZERO_ADDRESS(),
                                     false, false, "", false);
 
-    Lease4Ptr lease;
-
     // Iterate over the test scenarios.
     for (auto const& scenario : scenarios) {
         SCOPED_TRACE(scenario.description_);
index 573899b7ab6e815dc81967d95208f1e4224aaaf1..636cc4a4cb5b1b7992d26f022a6cc2cc85173186 100644 (file)
@@ -744,14 +744,14 @@ TEST_F(CfgOptionTest, encapsulate) {
                 OptionUint8Ptr second_level_uint8 = boost::dynamic_pointer_cast<
                     OptionUint8>(second_level_opt.second);
                 ASSERT_TRUE(second_level_uint8);
-                const unsigned value = static_cast<
+                const unsigned value2 = static_cast<
                     unsigned>(second_level_uint8->getValue());
                 // Certain sub-options should have a value of 3, other the values
                 // of 4.
                 if (second_level_uint8->getType() < 20) {
-                    EXPECT_EQ(3, value);
+                    EXPECT_EQ(3, value2);
                 } else {
-                    EXPECT_EQ(4, value);
+                    EXPECT_EQ(4, value2);
                 }
             }
         }
index cca8b28ce13bd7065100685832c883e9a7d7bd78..eb9a368e8c4d2fde7d4d2c0ed4f4298b84ae81f8 100644 (file)
@@ -132,11 +132,11 @@ TEST_F(FreeLeaseQueueAllocatorTest4, singlePoolWithAllocations) {
         ++i;
     }
 
-    for (auto i = 0; i < 5; ++i) {
-        IOAddress candidate = alloc.pickAddress(cc_, clientid_, IOAddress("0.0.0.0"));
+    for (auto j = 0; j < 5; ++j) {
+        candidate = alloc.pickAddress(cc_, clientid_, IOAddress("0.0.0.0"));
         EXPECT_TRUE(subnet_->inPool(Lease::TYPE_V4, candidate));
         EXPECT_TRUE(subnet_->inPool(Lease::TYPE_V4, candidate, cc_));
-        auto lease = createLease4(candidate, i);
+        auto lease = createLease4(candidate, j);
         EXPECT_TRUE(lease_mgr.addLease(lease));
     }
 
@@ -179,8 +179,8 @@ TEST_F(FreeLeaseQueueAllocatorTest4, singlePoolWithReclamations) {
         }
         ++i;
     }
-    for (auto i = 0; i < 5; ++i) {
-        IOAddress candidate = alloc.pickAddress(cc_, clientid_, IOAddress("0.0.0.0"));
+    for (auto j = 0; j < 5; ++j) {
+        candidate = alloc.pickAddress(cc_, clientid_, IOAddress("0.0.0.0"));
         EXPECT_TRUE(subnet_->inPool(Lease::TYPE_V4, candidate));
         EXPECT_TRUE(subnet_->inPool(Lease::TYPE_V4, candidate, cc_));
         auto lease = lease_mgr.getLease4(candidate);
@@ -460,8 +460,8 @@ TEST_F(FreeLeaseQueueAllocatorTest6, singlePoolWithAllocations) {
         ++i;
     }
 
-    for (auto i = 0; i < 8; ++i) {
-        IOAddress candidate = alloc.pickAddress(cc_, duid_, IOAddress("::"));
+    for (auto j = 0; j < 8; ++j) {
+       candidate = alloc.pickAddress(cc_, duid_, IOAddress("::"));
         EXPECT_TRUE(subnet_->inPool(Lease::TYPE_NA, candidate));
         EXPECT_TRUE(subnet_->inPool(Lease::TYPE_NA, candidate, cc_));
         auto lease = createLease6(Lease::TYPE_NA, candidate, i);
@@ -508,8 +508,8 @@ TEST_F(FreeLeaseQueueAllocatorTest6, singlePoolWithReclamations) {
         ++i;
     }
 
-    for (auto i = 0; i < 8; ++i) {
-        IOAddress candidate = alloc.pickAddress(cc_, duid_, IOAddress("::"));
+    for (auto j = 0; j < 8; ++j) {
+       candidate = alloc.pickAddress(cc_, duid_, IOAddress("::"));
         EXPECT_TRUE(subnet_->inPool(Lease::TYPE_NA, candidate));
         EXPECT_TRUE(subnet_->inPool(Lease::TYPE_NA, candidate, cc_));
         auto lease = lease_mgr.getLease6(Lease::TYPE_NA, candidate);
@@ -643,7 +643,7 @@ TEST_F(FreeLeaseQueueAllocatorTest6, clientClasses) {
    for (auto i = 0; i < 20; ++i) {
        // Allocate random addresses and make sure they belong to the
        // pools associated with the class bar.
-       IOAddress candidate = alloc.pickAddress(cc_, duid_, IOAddress("::"));
+       candidate = alloc.pickAddress(cc_, duid_, IOAddress("::"));
        EXPECT_FALSE(candidate.isV6Zero());
        EXPECT_TRUE(lease_mgr.addLease(createLease6(Lease::TYPE_NA, candidate, i+50)));
        addresses_set.insert(candidate);
@@ -655,7 +655,7 @@ TEST_F(FreeLeaseQueueAllocatorTest6, clientClasses) {
    // All pools should now be available.
    cc_.insert("foo");
    for (auto i = 0; i < 27; ++i) {
-       IOAddress candidate = alloc.pickAddress(cc_, duid_, IOAddress("::"));
+       candidate = alloc.pickAddress(cc_, duid_, IOAddress("::"));
        addresses_set.insert(candidate);
        EXPECT_TRUE(lease_mgr.addLease(createLease6(Lease::TYPE_NA, candidate, i+100)));
        EXPECT_TRUE(subnet_->inRange(candidate));
@@ -766,11 +766,11 @@ TEST_F(FreeLeaseQueueAllocatorTest6, singlePdPoolWithAllocations) {
         ++i;
     }
 
-    for (auto i = 0; i < 128; ++i) {
+    for (auto j = 0; j < 128; ++j) {
         candidate = alloc.pickPrefix(cc_, pool, duid_, Allocator::PREFIX_LEN_HIGHER, IOAddress("::"), 0);
         EXPECT_TRUE(subnet_->inPool(Lease::TYPE_PD, candidate));
         EXPECT_TRUE(subnet_->inPool(Lease::TYPE_PD, candidate, cc_));
-        auto lease = createLease6(Lease::TYPE_PD, candidate, i);
+        auto lease = createLease6(Lease::TYPE_PD, candidate, j);
         EXPECT_TRUE(lease_mgr.addLease(lease));
     }
 
@@ -823,7 +823,7 @@ TEST_F(FreeLeaseQueueAllocatorTest6, singlePdPoolWithReclamations) {
         ++i;
     }
 
-    for (auto i = 0; i < 128; ++i) {
+    for (auto j = 0; j < 128; ++j) {
         candidate = alloc.pickPrefix(cc_, pool, duid_, Allocator::PREFIX_LEN_HIGHER, IOAddress("::"), 0);
         EXPECT_TRUE(subnet_->inPool(Lease::TYPE_PD, candidate));
         EXPECT_TRUE(subnet_->inPool(Lease::TYPE_PD, candidate, cc_));
index 92fbceda6ea24cdda0ca262cefc6467f6f219be1..1afa3b1ee821b7907e332872d053256ca0621efa 100644 (file)
@@ -47,7 +47,7 @@ TEST(IPRangePermutationTest, ipv4) {
         bool done = false;
         // Call the next() function 95 times. The first 91 calls should return non-zero
         // IP addresses.
-        for (auto i = 0; i < 95; ++i) {
+        for (auto j = 0; j < 95; ++j) {
             auto next = perm.next(done);
             if (!next.isV4Zero()) {
                 // Make sure the returned address is within the range.
@@ -56,7 +56,7 @@ TEST(IPRangePermutationTest, ipv4) {
             }
             // If we went over all addresses in the range, the flags indicating that
             // the permutation is exhausted should be set to true.
-            if (i >= 90) {
+            if (j >= 90) {
                 EXPECT_TRUE(done);
                 EXPECT_TRUE(perm.exhausted());
             } else {
@@ -110,7 +110,7 @@ TEST(IPRangePermutationTest, ipv6) {
         std::set<IOAddress> addrs;
         std::vector<IOAddress> ordered_addrs;
         bool done = false;
-        for (auto i = 0; i < 44335; ++i) {
+        for (auto j = 0; j < 44335; ++j) {
             auto next = perm.next(done);
             if (!next.isV6Zero()) {
                 // Make sure that the address is within the range.
@@ -119,7 +119,7 @@ TEST(IPRangePermutationTest, ipv6) {
             }
             // If we went over all addresses in the range, the flags indicating that
             // the permutation is exhausted should be set to true.
-            if (i >= 44333) {
+            if (j >= 44333) {
                 EXPECT_TRUE(done);
                 EXPECT_TRUE(perm.exhausted());
             } else {
@@ -171,7 +171,7 @@ TEST(IPRangePermutationTest, pd) {
         std::set<IOAddress> addrs;
         std::vector<IOAddress> ordered_addrs;
         bool done = false;
-        for (auto i = 0; i < 257; ++i) {
+        for (auto j = 0; j < 257; ++j) {
             auto next = perm.next(done);
             if (!next.isV6Zero()) {
                 // Make sure the prefix is within the range.
@@ -180,7 +180,7 @@ TEST(IPRangePermutationTest, pd) {
             }
             // If we went over all delegated prefixes in the range, the flags indicating
             // that the permutation is exhausted should be set to true.
-            if (i >= 255) {
+            if (j >= 255) {
                 EXPECT_TRUE(done);
                 EXPECT_TRUE(perm.exhausted());
             } else {
index 98c24bde1e132ab5e416b3ffbe91a5f41993cf56..7e1fb44764f7ce9b5401a58e78aca36c352208e0 100644 (file)
@@ -377,11 +377,11 @@ TEST(SharedNetwork4Test, getNextSubnet) {
     // Collect networks associated with our subnets in the vector.
     std::vector<SharedNetwork4Ptr> networks;
     for (auto i = 0; i < subnets.size(); ++i) {
-        SharedNetwork4Ptr network;
-        subnets[i]->getSharedNetwork(network);
-        ASSERT_TRUE(network) << "failed to retrieve shared network for a"
+        SharedNetwork4Ptr net;
+        subnets[i]->getSharedNetwork(net);
+        ASSERT_TRUE(net) << "failed to retrieve shared network for a"
             << " subnet id " << subnets[i]->getID();
-        networks.push_back(network);
+        networks.push_back(net);
     }
 
     // All subnets should be associated with the same network.
@@ -1127,11 +1127,11 @@ TEST(SharedNetwork6Test, getNextSubnet) {
     // Collect networks associated with our subnets in the vector.
     std::vector<SharedNetwork6Ptr> networks;
     for (auto i = 0; i < subnets.size(); ++i) {
-        SharedNetwork6Ptr network;
-        subnets[i]->getSharedNetwork(network);
-        ASSERT_TRUE(network) << "failed to retrieve shared network for a"
+        SharedNetwork6Ptr net;
+        subnets[i]->getSharedNetwork(net);
+        ASSERT_TRUE(net) << "failed to retrieve shared network for a"
             << " subnet id " << subnets[i]->getID();
-        networks.push_back(network);
+        networks.push_back(net);
     }
 
     // All subnets should be associated with the same network.
index b175dfa4064f092a401d18825903814afb050ff0..fec5d2d97e1e3728df296fa0b63b5aa25f0e16ed 100644 (file)
@@ -239,17 +239,17 @@ Generic::constructFromLexer(MasterLexer& lexer) {
         string hex_part;
         // Whitespace is allowed within hex data, so read to the end of input.
         while (true) {
-            const MasterToken& token =
+            const MasterToken& rdtoken =
                 lexer.getNextToken(MasterToken::STRING, true);
-            if ((token.getType() == MasterToken::END_OF_FILE) ||
-                (token.getType() == MasterToken::END_OF_LINE)) {
+            if ((rdtoken.getType() == MasterToken::END_OF_FILE) ||
+                (rdtoken.getType() == MasterToken::END_OF_LINE)) {
                 // Unget the last read token as createRdata() expects us
                 // to leave it at the end-of-line or end-of-file when we
                 // return.
                 lexer.ungetToken();
                 break;
             }
-            token.getString(hex_part);
+            rdtoken.getString(hex_part);
             hex_txt.append(hex_part);
         }
 
index 31c64bc910329ecc9673f305444f60b66977bcdd..40ca68b789170e3180b62497879834642c21f908 100644 (file)
@@ -102,7 +102,7 @@ protected:
     }
 
     template <typename Output>
-    void toWireCommonChecks(Output& output) const;
+    void toWireCommonChecks(Output& output);
 
     const string valid_text1;
     const string valid_text2;
@@ -343,9 +343,7 @@ TEST_F(Rdata_TKEY_Test, assignment) {
 
 template <typename Output>
 void
-Rdata_TKEY_Test::toWireCommonChecks(Output& output) const {
-    vector<uint8_t> expect_data;
-
+Rdata_TKEY_Test::toWireCommonChecks(Output& output) {
     output.clear();
     expect_data.clear();
     rdata_tkey.toWire(output);
index a9cab140b57d788ede97fb7b0838e142fbbee44f..c128911526345bcc54c65c07c49af8ac5dff75ad 100644 (file)
@@ -95,7 +95,7 @@ protected:
     }
 
     template <typename Output>
-    void toWireCommonChecks(Output& output) const;
+    void toWireCommonChecks(Output& output);
 
     const string valid_text1;
     const string valid_text2;
@@ -328,9 +328,7 @@ TEST_F(Rdata_TSIG_Test, assignment) {
 
 template <typename Output>
 void
-Rdata_TSIG_Test::toWireCommonChecks(Output& output) const {
-    vector<uint8_t> expect_data;
-
+Rdata_TSIG_Test::toWireCommonChecks(Output& output) {
     output.clear();
     expect_data.clear();
     rdata_tsig.toWire(output);
index b2ba483170690508a172abd89ad133e6ab55341b..20a376d7facf6e24b75dea6130846a056f55ceea 100644 (file)
@@ -55,13 +55,13 @@ protected:
         }
 
         std::stringstream ss(rdata_txt);
-        MasterLexer lexer;
-        lexer.pushSource(ss);
+        MasterLexer llexer;
+        llexer.pushSource(ss);
         if (throw_lexer_version) {
-            EXPECT_THROW(RdataType rdata(lexer, origin, MasterLoader::DEFAULT,
+            EXPECT_THROW(RdataType rdata(llexer, origin, MasterLoader::DEFAULT,
                                          loader_cb), ExForLexer);
         } else {
-            EXPECT_EQ(0, RdataType(lexer, origin, MasterLoader::DEFAULT,
+            EXPECT_EQ(0, RdataType(llexer, origin, MasterLoader::DEFAULT,
                                    loader_cb).compare(rdata_expected));
         }
     }
index c34139a01e1d6cf7c178a83cdebbb8ad95397f9f..aa8ddbbc0efb847d3df8997cd184be1df27e13d8 100644 (file)
@@ -225,8 +225,15 @@ TEST(MessageInitializerTest1, duplicates) {
         "DUPE", "dupe",
         NULL
     };
+#if defined(__GNUC__) || defined(__clang__)
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wshadow"
+#endif
     const MessageInitializer init_message_initializer_unittest_1(dupe);
     const MessageInitializer init_message_initializer_unittest_2(dupe);
+#if defined(__GNUC__) || defined(__clang__)
+#pragma GCC diagnostic pop
+#endif
 
     MessageInitializer::loadDictionary();
     // Should be a dupe now
index 439ac8382dfe42207caf7c32afa35484ff6bc618..ebc1232d8c45e14c00a1a93f620f20c51d5d7885 100644 (file)
@@ -74,7 +74,7 @@ TcpStreamRequest::logFormatRequest(const size_t limit) const {
                << ", data: "
                << isc::util::str::dumpAsHex(wire_data_.data(), max);
     } catch (const std::exception& ex) {
-        std::stringstream output;
+        output = std::stringstream();
         output << "logFormatRequest error: " << ex.what();
     }