From: Francis Dupont Date: Wed, 17 Apr 2019 10:38:14 +0000 (+0200) Subject: [465-add-subnet4-update-and-subnet6-update-commands-to-subnet-cmds-hook] Addressed... X-Git-Tag: Kea-1.6.0-beta~200 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=71eb9188033f81dab56fc5a847a39f5497398b62;p=thirdparty%2Fkea.git [465-add-subnet4-update-and-subnet6-update-commands-to-subnet-cmds-hook] Addressed comments --- diff --git a/src/bin/perfdhcp/test_control.cc b/src/bin/perfdhcp/test_control.cc index 1493a8f1e6..9ae1e9dd45 100644 --- a/src/bin/perfdhcp/test_control.cc +++ b/src/bin/perfdhcp/test_control.cc @@ -133,7 +133,7 @@ TestControl::copyIaOptions(const Pkt6Ptr& pkt_from, Pkt6Ptr& pkt_to) { .includes(CommandOptions::LeaseType::ADDRESS)) { OptionPtr option = pkt_from->getOption(D6O_IA_NA); if (!option) { - isc_throw(OptionNotFound, "IA_NA option not found in the" + isc_throw(NotFound, "IA_NA option not found in the" " server's response"); } pkt_to->addOption(option); @@ -143,7 +143,7 @@ TestControl::copyIaOptions(const Pkt6Ptr& pkt_from, Pkt6Ptr& pkt_to) { .includes(CommandOptions::LeaseType::PREFIX)) { OptionPtr option = pkt_from->getOption(D6O_IA_PD); if (!option) { - isc_throw(OptionNotFound, "IA_PD option not found in the" + isc_throw(NotFound, "IA_PD option not found in the" " server's response"); } pkt_to->addOption(option); diff --git a/src/bin/perfdhcp/test_control.h b/src/bin/perfdhcp/test_control.h index b30ddf4882..af10314b97 100644 --- a/src/bin/perfdhcp/test_control.h +++ b/src/bin/perfdhcp/test_control.h @@ -54,14 +54,6 @@ static const size_t DHCPV6_SERVERID_OFFSET = 22; /// Default DHCPV6 IA_NA offset in the packet template. static const size_t DHCPV6_IA_NA_OFFSET = 40; -/// @brief Exception thrown when the required option is not found in a packet. -class OptionNotFound : public Exception { -public: - OptionNotFound(const char* file, size_t line, const char* what) : - isc::Exception(file, line, what) { }; -}; - - /// \brief Test Control class. /// /// This class is used to run the performance test with @@ -822,8 +814,8 @@ protected: /// \param [in] pkt_from A packet from which options should be copied. /// \param [out] pkt_to A packet to which options should be copied. /// - /// \throw isc::perfdhcp::OptionNotFound if a required option is not - /// found in the packet from which options should be copied. + /// \throw isc::NotFound if a required option is not found in the + /// packet from which options should be copied. /// \throw isc::BadValue if any of the specified pointers to packets /// is NULL. void copyIaOptions(const dhcp::Pkt6Ptr& pkt_from, dhcp::Pkt6Ptr& pkt_to); diff --git a/src/lib/dhcpsrv/cfg_subnets4.cc b/src/lib/dhcpsrv/cfg_subnets4.cc index ffb323502f..348ed1d75e 100644 --- a/src/lib/dhcpsrv/cfg_subnets4.cc +++ b/src/lib/dhcpsrv/cfg_subnets4.cc @@ -48,8 +48,7 @@ CfgSubnets4::replace(const Subnet4Ptr& subnet) { auto& index = subnets_.template get(); auto subnet_it = index.find(subnet_id); if (subnet_it == index.end()) { - isc_throw(BadValue, "ID of the IPv4 subnet '" << subnet_id - << "' is not in use"); + isc_throw(BadValue, "There is no IPv4 subnet with ID " <(); auto subnet_it = index.find(subnet_id); if (subnet_it == index.end()) { - isc_throw(BadValue, "ID of the IPv6 subnet '" << subnet_id - << "' is not in use"); + isc_throw(BadValue, "There is no IPv6 subnet with ID " << subnet_id); } Subnet6Ptr old = *subnet_it; bool ret = index.replace(subnet_it, subnet); diff --git a/src/lib/dhcpsrv/dhcpsrv_messages.mes b/src/lib/dhcpsrv/dhcpsrv_messages.mes index 0dbe55b0ce..a6155f05da 100644 --- a/src/lib/dhcpsrv/dhcpsrv_messages.mes +++ b/src/lib/dhcpsrv/dhcpsrv_messages.mes @@ -1,4 +1,4 @@ -# Copyright (C) 2012-2018 Internet Systems Consortium, Inc. ("ISC") +# Copyright (C) 2012-2019 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 @@ -102,13 +102,13 @@ move to the new list parameter. % DHCPSRV_CFGMGR_UPDATE_SUBNET4 updating subnet %1 (result %2) A debug message reported when the DHCP configuration manager is updating the -specified IPv4 subnet to its database. Subnet ID and result (expected to -be true) are displayed. +specified IPv4 subnet in its current configuration. Subnet ID and result +(expected to be true) are displayed. % DHCPSRV_CFGMGR_UPDATE_SUBNET6 updating subnet %1 (result %2) A debug message reported when the DHCP configuration manager is replacing the -specified IPv6 subnet to its database. Subnet ID and result (expected to -be true) are displayed. +specified IPv6 subnet in its current configuration. Subnet ID and result +(expected to be true) are displayed. % DHCPSRV_CFGMGR_SOCKET_RAW_UNSUPPORTED use of raw sockets is unsupported on this OS, UDP sockets will be used This warning message is logged when the user specified that the diff --git a/src/lib/dhcpsrv/shared_network.cc b/src/lib/dhcpsrv/shared_network.cc index d691e73af4..8582276faa 100644 --- a/src/lib/dhcpsrv/shared_network.cc +++ b/src/lib/dhcpsrv/shared_network.cc @@ -93,7 +93,7 @@ public: static bool replace(SubnetCollectionType& subnets, const SubnetPtrType& subnet) { - // Check if the subnet is already associated with some network. + // Check if the new subnet is already associated with some network. NetworkPtr network; subnet->getSharedNetwork(network); if (network) { diff --git a/src/lib/dhcpsrv/tests/cfg_subnets4_unittest.cc b/src/lib/dhcpsrv/tests/cfg_subnets4_unittest.cc index 64f436ec53..9a1fef2f31 100644 --- a/src/lib/dhcpsrv/tests/cfg_subnets4_unittest.cc +++ b/src/lib/dhcpsrv/tests/cfg_subnets4_unittest.cc @@ -183,7 +183,7 @@ TEST(CfgSubnets4Test, replaceSubnet) { ASSERT_TRUE(returned); EXPECT_TRUE(returned == subnet); - // Rollback. + // Restore. replaced = cfg.replace(replaced); ASSERT_TRUE(replaced); EXPECT_TRUE(replaced == subnet); diff --git a/src/lib/dhcpsrv/tests/cfg_subnets6_unittest.cc b/src/lib/dhcpsrv/tests/cfg_subnets6_unittest.cc index 53124bf5ba..332f8fc1f4 100644 --- a/src/lib/dhcpsrv/tests/cfg_subnets6_unittest.cc +++ b/src/lib/dhcpsrv/tests/cfg_subnets6_unittest.cc @@ -181,7 +181,7 @@ TEST(CfgSubnets6Test, replaceSubnet) { ASSERT_TRUE(returned); EXPECT_TRUE(returned == subnet); - // Rollback. + // Restore. replaced = cfg.replace(replaced); ASSERT_TRUE(replaced); EXPECT_TRUE(replaced == subnet); diff --git a/src/lib/exceptions/exceptions.h b/src/lib/exceptions/exceptions.h index 6fa6c5ec3c..f5368c8458 100644 --- a/src/lib/exceptions/exceptions.h +++ b/src/lib/exceptions/exceptions.h @@ -169,6 +169,15 @@ public: isc::Exception(file, line, what) {} }; +/// +/// \brief A generic exception that is thrown when an object can +/// not be found. +class NotFound : public Exception { +public: + NotFound(const char* file, size_t line, const char* what) : + isc::Exception(file, line, what) {} +}; + /// /// A shortcut macro to insert known values into exception arguments. ///