diff options
author | Razvan Becheriu <razvan@isc.org> | 2022-03-21 19:11:51 +0100 |
---|---|---|
committer | Tomek Mrugalski <tomek@isc.org> | 2022-04-22 10:20:47 +0200 |
commit | dd993f66916688a8f3c4f39521695bbe7d4364af (patch) | |
tree | 1d00a92bb450c9d00e97f42851f663c31dbb9385 /src | |
parent | Apply 1 suggestion(s) to 1 file(s) (diff) | |
download | kea-dd993f66916688a8f3c4f39521695bbe7d4364af.tar.xz kea-dd993f66916688a8f3c4f39521695bbe7d4364af.zip |
[#2352] added more debug messages
Diffstat (limited to 'src')
-rw-r--r-- | src/lib/dhcpsrv/cfg_subnets4.cc | 131 | ||||
-rw-r--r-- | src/lib/dhcpsrv/cfg_subnets6.cc | 120 | ||||
-rw-r--r-- | src/lib/dhcpsrv/dhcpsrv_messages.cc | 20 | ||||
-rw-r--r-- | src/lib/dhcpsrv/dhcpsrv_messages.h | 10 | ||||
-rw-r--r-- | src/lib/dhcpsrv/dhcpsrv_messages.mes | 40 |
5 files changed, 201 insertions, 120 deletions
diff --git a/src/lib/dhcpsrv/cfg_subnets4.cc b/src/lib/dhcpsrv/cfg_subnets4.cc index b62ad159b1..1b27738d28 100644 --- a/src/lib/dhcpsrv/cfg_subnets4.cc +++ b/src/lib/dhcpsrv/cfg_subnets4.cc @@ -93,13 +93,11 @@ CfgSubnets4::merge(CfgOptionDefPtr cfg_def, CfgSharedNetworks4Ptr networks, // Iterate over the subnets to be merged. They will replace the existing // subnets with the same id. All new subnets will be inserted into the // configuration into which we're merging. - auto other_subnets = other.getAll(); - for (auto other_subnet = other_subnets->begin(); - other_subnet != other_subnets->end(); - ++other_subnet) { + auto const& other_subnets = other.getAll(); + for (auto const& other_subnet : (*other_subnets)) { // Check if there is a subnet with the same ID. - auto subnet_id_it = index_id.find((*other_subnet)->getID()); + auto subnet_id_it = index_id.find(other_subnet->getID()); if (subnet_id_it != index_id.end()) { // Subnet found. @@ -107,7 +105,7 @@ CfgSubnets4::merge(CfgOptionDefPtr cfg_def, CfgSharedNetworks4Ptr networks, // If the existing subnet and other subnet // are the same instance skip it. - if (existing_subnet == *other_subnet) { + if (existing_subnet == other_subnet) { continue; } @@ -129,7 +127,7 @@ CfgSubnets4::merge(CfgOptionDefPtr cfg_def, CfgSharedNetworks4Ptr networks, } // Check if there is a subnet with the same prefix. - auto subnet_prefix_it = index_prefix.find((*other_subnet)->toText()); + auto subnet_prefix_it = index_prefix.find(other_subnet->toText()); if (subnet_prefix_it != index_prefix.end()) { // Subnet found. @@ -153,26 +151,28 @@ CfgSubnets4::merge(CfgOptionDefPtr cfg_def, CfgSharedNetworks4Ptr networks, } // Create the subnet's options based on the given definitions. - (*other_subnet)->getCfgOption()->createOptions(cfg_def); - for (auto pool : (*other_subnet)->getPoolsWritable(Lease::TYPE_V4)) { + other_subnet->getCfgOption()->createOptions(cfg_def); + + // Create the options for pool based on the given definitions. + for (auto const& pool : other_subnet->getPoolsWritable(Lease::TYPE_V4)) { pool->getCfgOption()->createOptions(cfg_def); } // Add the "other" subnet to the our collection of subnets. - static_cast<void>(subnets_.insert(*other_subnet)); + static_cast<void>(subnets_.insert(other_subnet)); // If it belongs to a shared network, find the network and // add the subnet to it - std::string network_name = (*other_subnet)->getSharedNetworkName(); + std::string network_name = other_subnet->getSharedNetworkName(); if (!network_name.empty()) { SharedNetwork4Ptr network = networks->getByName(network_name); if (network) { - network->add(*other_subnet); + network->add(other_subnet); } else { // This implies the shared-network collection we were given // is out of sync with the subnets we were given. isc_throw(InvalidOperation, "Cannot assign subnet ID of " - << (*other_subnet)->getID() + << other_subnet->getID() << " to shared network: " << network_name << ", network does not exist"); } @@ -252,10 +252,8 @@ CfgSubnets4::initSelector(const Pkt4Ptr& query) { Subnet4Ptr CfgSubnets4::selectSubnet4o6(const SubnetSelector& selector) const { - - for (Subnet4Collection::const_iterator subnet = subnets_.begin(); - subnet != subnets_.end(); ++subnet) { - Cfg4o6& cfg4o6 = (*subnet)->get4o6(); + for (auto const& subnet : subnets_) { + Cfg4o6& cfg4o6 = subnet->get4o6(); // Is this an 4o6 subnet at all? if (!cfg4o6.enabled()) { @@ -271,34 +269,38 @@ CfgSubnets4::selectSubnet4o6(const SubnetSelector& selector) const { IOAddress last = lastAddrInPrefix(pref.first, pref.second); if ((first <= selector.remote_address_) && (selector.remote_address_ <= last)) { - return (*subnet); + return (subnet); } } // Second match criteria: check if the interface-id matches if (cfg4o6.getInterfaceId() && selector.interface_id_ && cfg4o6.getInterfaceId()->equals(selector.interface_id_)) { - return (*subnet); + return (subnet); } // Third match criteria: check if the interface name matches if (!cfg4o6.getIface4o6().empty() && !selector.iface_name_.empty() && cfg4o6.getIface4o6() == selector.iface_name_) { - return (*subnet); + return (subnet); } } + LOG_DEBUG(dhcpsrv_logger, DHCPSRV_DBG_TRACE, DHCPSRV_SUBNET4O6_SELECT_FAILED); + // Ok, wasn't able to find any matching subnet. return (Subnet4Ptr()); } Subnet4Ptr CfgSubnets4::selectSubnet(const SubnetSelector& selector) const { - // First use RAI link select sub-option or subnet select option if (!selector.option_select_.isV4Zero()) { return (selectSubnet(selector.option_select_, selector.client_classes_)); + } else { + LOG_DEBUG(dhcpsrv_logger, DHCPSRV_DBG_TRACE, + DHCPSRV_SUBNET4_SELECT_FAILED_NO_RAI_OPTIONS_ADDRESS); } // If relayed message has been received, try to match the giaddr with the @@ -307,30 +309,39 @@ CfgSubnets4::selectSubnet(const SubnetSelector& selector) const { // addresses across all subnets, but we need to verify that for all subnets // before we can try to use the giaddr to match with the subnet prefix. if (!selector.giaddr_.isV4Zero()) { - for (Subnet4Collection::const_iterator subnet = subnets_.begin(); - subnet != subnets_.end(); ++subnet) { + for (auto const& subnet : subnets_) { // If relay information is specified for this subnet, it must match. // Otherwise, we ignore this subnet. - if ((*subnet)->hasRelays()) { - if (!(*subnet)->hasRelayAddress(selector.giaddr_)) { + if (subnet->hasRelays()) { + if (!subnet->hasRelayAddress(selector.giaddr_)) { continue; } } else { // Relay information is not specified on the subnet level, // so let's try matching on the shared network level. SharedNetwork4Ptr network; - (*subnet)->getSharedNetwork(network); + subnet->getSharedNetwork(network); if (!network || !(network->hasRelayAddress(selector.giaddr_))) { continue; } } // If a subnet meets the client class criteria return it. - if ((*subnet)->clientSupported(selector.client_classes_)) { - return (*subnet); + if (subnet->clientSupported(selector.client_classes_)) { + LOG_DEBUG(dhcpsrv_logger, DHCPSRV_DBG_TRACE, + DHCPSRV_CFGMGR_SUBNET4_RELAY) + .arg(subnet->toText()) + .arg(selector.giaddr_.toText()); + return (subnet); } } + LOG_DEBUG(dhcpsrv_logger, DHCPSRV_DBG_TRACE, + DHCPSRV_SUBNET4_SELECT_BY_RELAY_ADDRESS_FAILED) + .arg(selector.giaddr_.toText()); + } else { + LOG_DEBUG(dhcpsrv_logger, DHCPSRV_DBG_TRACE, + DHCPSRV_SUBNET4_SELECT_FAILED_NO_RELAY_ADDRESS); } // If we got to this point it means that we were not able to match the @@ -382,6 +393,9 @@ CfgSubnets4::selectSubnet(const SubnetSelector& selector) const { // Unable to find a suitable address to use for subnet selection. if (address.isV4Zero()) { + LOG_DEBUG(dhcpsrv_logger, DHCPSRV_DBG_TRACE, + DHCPSRV_SUBNET4_SELECT_FAILED_NO_ADDRESS); + return (Subnet4Ptr()); } @@ -393,15 +407,13 @@ CfgSubnets4::selectSubnet(const SubnetSelector& selector) const { Subnet4Ptr CfgSubnets4::selectSubnet(const std::string& iface, const ClientClasses& client_classes) const { - for (Subnet4Collection::const_iterator subnet = subnets_.begin(); - subnet != subnets_.end(); ++subnet) { - + for (auto const& subnet : subnets_) { Subnet4Ptr subnet_selected; // First, try subnet specific interface name. - if (!(*subnet)->getIface(Network4::Inheritance::NONE).empty()) { - if ((*subnet)->getIface(Network4::Inheritance::NONE) == iface) { - subnet_selected = (*subnet); + if (!subnet->getIface(Network4::Inheritance::NONE).empty()) { + if (subnet->getIface(Network4::Inheritance::NONE) == iface) { + subnet_selected = subnet; } } else { @@ -409,38 +421,40 @@ CfgSubnets4::selectSubnet(const std::string& iface, // we can match with shared network specific setting of // the interface. SharedNetwork4Ptr network; - (*subnet)->getSharedNetwork(network); + subnet->getSharedNetwork(network); if (network && (network->getIface(Network4::Inheritance::NONE) == iface)) { - subnet_selected = (*subnet); + subnet_selected = subnet; } } if (subnet_selected) { - // If a subnet meets the client class criteria return it. if (subnet_selected->clientSupported(client_classes)) { LOG_DEBUG(dhcpsrv_logger, DHCPSRV_DBG_TRACE, DHCPSRV_CFGMGR_SUBNET4_IFACE) - .arg((*subnet)->toText()) + .arg(subnet->toText()) .arg(iface); return (subnet_selected); } } } + LOG_DEBUG(dhcpsrv_logger, DHCPSRV_DBG_TRACE, + DHCPSRV_SUBNET4_SELECT_BY_INTERFACE_FAILED) + .arg(iface); + // Failed to find a subnet. return (Subnet4Ptr()); } Subnet4Ptr CfgSubnets4::getSubnet(const SubnetID id) const { - /// @todo: Once this code is migrated to multi-index container, use /// an index rather than full scan. - for (auto subnet = subnets_.begin(); subnet != subnets_.end(); ++subnet) { - if ((*subnet)->getID() == id) { - return (*subnet); + for (auto const& subnet : subnets_) { + if (subnet->getID() == id) { + return (subnet); } } return (Subnet4Ptr()); @@ -449,23 +463,26 @@ CfgSubnets4::getSubnet(const SubnetID id) const { Subnet4Ptr CfgSubnets4::selectSubnet(const IOAddress& address, const ClientClasses& client_classes) const { - for (Subnet4Collection::const_iterator subnet = subnets_.begin(); - subnet != subnets_.end(); ++subnet) { + for (auto const& subnet : subnets_) { // Address is in range for the subnet prefix, so return it. - if (!(*subnet)->inRange(address)) { + if (!subnet->inRange(address)) { continue; } // If a subnet meets the client class criteria return it. - if ((*subnet)->clientSupported(client_classes)) { + if (subnet->clientSupported(client_classes)) { LOG_DEBUG(dhcpsrv_logger, DHCPSRV_DBG_TRACE, DHCPSRV_CFGMGR_SUBNET4_ADDR) - .arg((*subnet)->toText()) + .arg(subnet->toText()) .arg(address.toText()); - return (*subnet); + return (subnet); } } + LOG_DEBUG(dhcpsrv_logger, DHCPSRV_DBG_TRACE, + DHCPSRV_SUBNET4_SELECT_BY_ADDRESS_FAILED) + .arg(address.toText()); + // Failed to find a subnet. return (Subnet4Ptr()); } @@ -476,9 +493,8 @@ CfgSubnets4::removeStatistics() { // For each v4 subnet currently configured, remove the statistic. StatsMgr& stats_mgr = StatsMgr::instance(); - for (Subnet4Collection::const_iterator subnet4 = subnets_.begin(); - subnet4 != subnets_.end(); ++subnet4) { - SubnetID subnet_id = (*subnet4)->getID(); + for (auto const& subnet4 : subnets_) { + SubnetID subnet_id = subnet4->getID(); stats_mgr.del(StatsMgr::generateName("subnet", subnet_id, "total-addresses")); @@ -504,15 +520,13 @@ CfgSubnets4::updateStatistics() { using namespace isc::stats; StatsMgr& stats_mgr = StatsMgr::instance(); - for (Subnet4Collection::const_iterator subnet4 = subnets_.begin(); - subnet4 != subnets_.end(); ++subnet4) { - SubnetID subnet_id = (*subnet4)->getID(); + for (auto const& subnet4 : subnets_) { + SubnetID subnet_id = subnet4->getID(); stats_mgr.setValue(StatsMgr:: generateName("subnet", subnet_id, "total-addresses"), static_cast<int64_t> - ((*subnet4)->getPoolCapacity(Lease:: - TYPE_V4))); + (subnet4->getPoolCapacity(Lease::TYPE_V4))); const std::string& name = StatsMgr::generateName("subnet", subnet_id, "cumulative-assigned-addresses"); if (!stats_mgr.getObservation(name)) { @@ -530,9 +544,8 @@ ElementPtr CfgSubnets4::toElement() const { ElementPtr result = Element::createList(); // Iterate subnets - for (Subnet4Collection::const_iterator subnet = subnets_.cbegin(); - subnet != subnets_.cend(); ++subnet) { - result->add((*subnet)->toElement()); + for (auto const& subnet : subnets_) { + result->add(subnet->toElement()); } return (result); } diff --git a/src/lib/dhcpsrv/cfg_subnets6.cc b/src/lib/dhcpsrv/cfg_subnets6.cc index e21ebd4e3c..1b968c75ff 100644 --- a/src/lib/dhcpsrv/cfg_subnets6.cc +++ b/src/lib/dhcpsrv/cfg_subnets6.cc @@ -93,13 +93,11 @@ CfgSubnets6::merge(CfgOptionDefPtr cfg_def, CfgSharedNetworks6Ptr networks, // Iterate over the subnets to be merged. They will replace the existing // subnets with the same id. All new subnets will be inserted into the // configuration into which we're merging. - auto other_subnets = other.getAll(); - for (auto other_subnet = other_subnets->begin(); - other_subnet != other_subnets->end(); - ++other_subnet) { + auto const& other_subnets = other.getAll(); + for (auto const& other_subnet : *other_subnets) { // Check if there is a subnet with the same ID. - auto subnet_it = index_id.find((*other_subnet)->getID()); + auto subnet_it = index_id.find(other_subnet->getID()); if (subnet_it != index_id.end()) { // Subnet found. @@ -107,7 +105,7 @@ CfgSubnets6::merge(CfgOptionDefPtr cfg_def, CfgSharedNetworks6Ptr networks, // If the existing subnet and other subnet // are the same instance skip it. - if (existing_subnet == *other_subnet) { + if (existing_subnet == other_subnet) { continue; } @@ -125,7 +123,7 @@ CfgSubnets6::merge(CfgOptionDefPtr cfg_def, CfgSharedNetworks6Ptr networks, } // Check if there is a subnet with the same prefix. - auto subnet_prefix_it = index_prefix.find((*other_subnet)->toText()); + auto subnet_prefix_it = index_prefix.find(other_subnet->toText()); if (subnet_prefix_it != index_prefix.end()) { // Subnet found. @@ -149,32 +147,33 @@ CfgSubnets6::merge(CfgOptionDefPtr cfg_def, CfgSharedNetworks6Ptr networks, } // Create the subnet's options based on the given definitions. - (*other_subnet)->getCfgOption()->createOptions(cfg_def); + other_subnet->getCfgOption()->createOptions(cfg_def); // Create the options for pool based on the given definitions. - for (auto pool : (*other_subnet)->getPoolsWritable(Lease::TYPE_NA)) { + for (auto const& pool : other_subnet->getPoolsWritable(Lease::TYPE_NA)) { pool->getCfgOption()->createOptions(cfg_def); } - for (auto pool : (*other_subnet)->getPoolsWritable(Lease::TYPE_PD)) { + // Create the options for pd pool based on the given definitions. + for (auto const& pool : other_subnet->getPoolsWritable(Lease::TYPE_PD)) { pool->getCfgOption()->createOptions(cfg_def); } // Add the "other" subnet to the our collection of subnets. - static_cast<void>(subnets_.insert(*other_subnet)); + static_cast<void>(subnets_.insert(other_subnet)); // If it belongs to a shared network, find the network and // add the subnet to it - std::string network_name = (*other_subnet)->getSharedNetworkName(); + std::string network_name = other_subnet->getSharedNetworkName(); if (!network_name.empty()) { SharedNetwork6Ptr network = networks->getByName(network_name); if (network) { - network->add(*other_subnet); + network->add(other_subnet); } else { // This implies the shared-network collection we were given // is out of sync with the subnets we were given. isc_throw(InvalidOperation, "Cannot assign subnet ID of " - << (*other_subnet)->getID() + << other_subnet->getID() << " to shared network: " << network_name << ", network does not exist"); } @@ -244,7 +243,6 @@ CfgSubnets6::selectSubnet(const SubnetSelector& selector) const { // If relay agent link address is set, we're dealing with a relayed message. } else { - // Find the subnet using the Interface Id option, if present. subnet = selectSubnet(selector.interface_id_, selector.client_classes_); @@ -265,79 +263,79 @@ Subnet6Ptr CfgSubnets6::selectSubnet(const asiolink::IOAddress& address, const ClientClasses& client_classes, const bool is_relay_address) const { - // If the specified address is a relay address we first need to match // it with the relay addresses specified for all subnets. if (is_relay_address) { - for (Subnet6Collection::const_iterator subnet = subnets_.begin(); - subnet != subnets_.end(); ++subnet) { + for (auto const& subnet : subnets_) { // If the specified address matches a relay address, return this // subnet. - if ((*subnet)->hasRelays()) { - if (!(*subnet)->hasRelayAddress(address)) { + if (subnet->hasRelays()) { + if (!subnet->hasRelayAddress(address)) { continue; } } else { SharedNetwork6Ptr network; - (*subnet)->getSharedNetwork(network); + subnet->getSharedNetwork(network); if (!network || !network->hasRelayAddress(address)) { continue; } } - if ((*subnet)->clientSupported(client_classes)) { + if (subnet->clientSupported(client_classes)) { // The relay address is matching the one specified for a subnet // or its shared network. LOG_DEBUG(dhcpsrv_logger, DHCPSRV_DBG_TRACE, DHCPSRV_CFGMGR_SUBNET6_RELAY) - .arg((*subnet)->toText()).arg(address.toText()); - return (*subnet); + .arg(subnet->toText()).arg(address.toText()); + return (subnet); } } } // No success so far. Check if the specified address is in range // with any subnet. - for (Subnet6Collection::const_iterator subnet = subnets_.begin(); - subnet != subnets_.end(); ++subnet) { - if ((*subnet)->inRange(address) && - (*subnet)->clientSupported(client_classes)) { + for (auto const& subnet : subnets_) { + if (subnet->inRange(address) && subnet->clientSupported(client_classes)) { LOG_DEBUG(dhcpsrv_logger, DHCPSRV_DBG_TRACE, DHCPSRV_CFGMGR_SUBNET6) - .arg((*subnet)->toText()).arg(address.toText()); - return (*subnet); + .arg(subnet->toText()).arg(address.toText()); + return (subnet); } } + LOG_DEBUG(dhcpsrv_logger, DHCPSRV_DBG_TRACE, + DHCPSRV_SUBNET6_SELECT_BY_ADDRESS_FAILED) + .arg(address.toText()); + // Nothing found. return (Subnet6Ptr()); } - Subnet6Ptr CfgSubnets6::selectSubnet(const std::string& iface_name, const ClientClasses& client_classes) const { - // If empty interface specified, we can't select subnet by interface. if (!iface_name.empty()) { - for (Subnet6Collection::const_iterator subnet = subnets_.begin(); - subnet != subnets_.end(); ++subnet) { + for (auto const& subnet : subnets_) { // If interface name matches with the one specified for the subnet // and the client is not rejected based on the classification, // return the subnet. - if (((*subnet)->getIface() == iface_name) && - (*subnet)->clientSupported(client_classes)) { - + if ((subnet->getIface() == iface_name) && + subnet->clientSupported(client_classes)) { LOG_DEBUG(dhcpsrv_logger, DHCPSRV_DBG_TRACE, DHCPSRV_CFGMGR_SUBNET6_IFACE) - .arg((*subnet)->toText()).arg(iface_name); - return (*subnet); + .arg(subnet->toText()).arg(iface_name); + return (subnet); } } } + LOG_DEBUG(dhcpsrv_logger, DHCPSRV_DBG_TRACE, + DHCPSRV_SUBNET6_SELECT_BY_INTERFACE_FAILED) + .arg(iface_name); + // No subnet found for this interface name. return (Subnet6Ptr()); } @@ -348,34 +346,37 @@ CfgSubnets6::selectSubnet(const OptionPtr& interface_id, // We can only select subnet using an interface id, if the interface // id is known. if (interface_id) { - for (Subnet6Collection::const_iterator subnet = subnets_.begin(); - subnet != subnets_.end(); ++subnet) { + for (auto const& subnet : subnets_) { // If interface id matches for the subnet and the subnet is not // rejected based on the classification. - if ((*subnet)->getInterfaceId() && - (*subnet)->getInterfaceId()->equals(interface_id) && - (*subnet)->clientSupported(client_classes)) { + if (subnet->getInterfaceId() && + subnet->getInterfaceId()->equals(interface_id) && + subnet->clientSupported(client_classes)) { LOG_DEBUG(dhcpsrv_logger, DHCPSRV_DBG_TRACE, DHCPSRV_CFGMGR_SUBNET6_IFACE_ID) - .arg((*subnet)->toText()); - return (*subnet); + .arg(subnet->toText()); + return (subnet); } } + + LOG_DEBUG(dhcpsrv_logger, DHCPSRV_DBG_TRACE, + DHCPSRV_SUBNET6_SELECT_BY_INTERFACE_ID_FAILED) + .arg(interface_id->toText()); } + // No subnet found. return (Subnet6Ptr()); } Subnet6Ptr CfgSubnets6::getSubnet(const SubnetID id) const { - /// @todo: Once this code is migrated to multi-index container, use /// an index rather than full scan. - for (auto subnet = subnets_.begin(); subnet != subnets_.end(); ++subnet) { - if ((*subnet)->getID() == id) { - return (*subnet); + for (auto const& subnet : subnets_) { + if (subnet->getID() == id) { + return (subnet); } } return (Subnet6Ptr()); @@ -387,9 +388,8 @@ CfgSubnets6::removeStatistics() { StatsMgr& stats_mgr = StatsMgr::instance(); // For each v6 subnet currently configured, remove the statistics. - for (Subnet6Collection::const_iterator subnet6 = subnets_.begin(); - subnet6 != subnets_.end(); ++subnet6) { - SubnetID subnet_id = (*subnet6)->getID(); + for (auto const& subnet6 : subnets_) { + SubnetID subnet_id = subnet6->getID(); stats_mgr.del(StatsMgr::generateName("subnet", subnet_id, "total-nas")); stats_mgr.del(StatsMgr::generateName("subnet", subnet_id, @@ -423,19 +423,18 @@ CfgSubnets6::updateStatistics() { StatsMgr& stats_mgr = StatsMgr::instance(); // For each v6 subnet currently configured, calculate totals - for (Subnet6Collection::const_iterator subnet6 = subnets_.begin(); - subnet6 != subnets_.end(); ++subnet6) { - SubnetID subnet_id = (*subnet6)->getID(); + for (auto const& subnet6 : subnets_) { + SubnetID subnet_id = subnet6->getID(); stats_mgr.setValue(StatsMgr::generateName("subnet", subnet_id, "total-nas"), static_cast<int64_t> - ((*subnet6)->getPoolCapacity(Lease::TYPE_NA))); + (subnet6->getPoolCapacity(Lease::TYPE_NA))); stats_mgr.setValue(StatsMgr::generateName("subnet", subnet_id, "total-pds"), static_cast<int64_t> - ((*subnet6)->getPoolCapacity(Lease::TYPE_PD))); + (subnet6->getPoolCapacity(Lease::TYPE_PD))); const std::string& name_nas = StatsMgr::generateName("subnet", subnet_id, "cumulative-assigned-nas"); @@ -460,9 +459,8 @@ ElementPtr CfgSubnets6::toElement() const { ElementPtr result = Element::createList(); // Iterate subnets - for (Subnet6Collection::const_iterator subnet = subnets_.cbegin(); - subnet != subnets_.cend(); ++subnet) { - result->add((*subnet)->toElement()); + for (auto const& subnet : subnets_) { + result->add(subnet->toElement()); } return (result); } diff --git a/src/lib/dhcpsrv/dhcpsrv_messages.cc b/src/lib/dhcpsrv/dhcpsrv_messages.cc index 7e8f2881b1..efb6ddede3 100644 --- a/src/lib/dhcpsrv/dhcpsrv_messages.cc +++ b/src/lib/dhcpsrv/dhcpsrv_messages.cc @@ -217,6 +217,16 @@ extern const isc::log::MessageID DHCPSRV_PGSQL_UPDATE_ADDR6 = "DHCPSRV_PGSQL_UPD extern const isc::log::MessageID DHCPSRV_QUEUE_NCR = "DHCPSRV_QUEUE_NCR"; extern const isc::log::MessageID DHCPSRV_QUEUE_NCR_FAILED = "DHCPSRV_QUEUE_NCR_FAILED"; extern const isc::log::MessageID DHCPSRV_QUEUE_NCR_SKIP = "DHCPSRV_QUEUE_NCR_SKIP"; +extern const isc::log::MessageID DHCPSRV_SUBNET4O6_SELECT_FAILED = "DHCPSRV_SUBNET4O6_SELECT_FAILED"; +extern const isc::log::MessageID DHCPSRV_SUBNET4_SELECT_BY_ADDRESS_FAILED = "DHCPSRV_SUBNET4_SELECT_BY_ADDRESS_FAILED"; +extern const isc::log::MessageID DHCPSRV_SUBNET4_SELECT_BY_INTERFACE_FAILED = "DHCPSRV_SUBNET4_SELECT_BY_INTERFACE_FAILED"; +extern const isc::log::MessageID DHCPSRV_SUBNET4_SELECT_BY_RELAY_ADDRESS_FAILED = "DHCPSRV_SUBNET4_SELECT_BY_RELAY_ADDRESS_FAILED"; +extern const isc::log::MessageID DHCPSRV_SUBNET4_SELECT_FAILED_NO_ADDRESS = "DHCPSRV_SUBNET4_SELECT_FAILED_NO_ADDRESS"; +extern const isc::log::MessageID DHCPSRV_SUBNET4_SELECT_FAILED_NO_RAI_OPTIONS_ADDRESS = "DHCPSRV_SUBNET4_SELECT_FAILED_NO_RAI_OPTIONS_ADDRESS"; +extern const isc::log::MessageID DHCPSRV_SUBNET4_SELECT_FAILED_NO_RELAY_ADDRESS = "DHCPSRV_SUBNET4_SELECT_FAILED_NO_RELAY_ADDRESS"; +extern const isc::log::MessageID DHCPSRV_SUBNET6_SELECT_BY_ADDRESS_FAILED = "DHCPSRV_SUBNET6_SELECT_BY_ADDRESS_FAILED"; +extern const isc::log::MessageID DHCPSRV_SUBNET6_SELECT_BY_INTERFACE_FAILED = "DHCPSRV_SUBNET6_SELECT_BY_INTERFACE_FAILED"; +extern const isc::log::MessageID DHCPSRV_SUBNET6_SELECT_BY_INTERFACE_ID_FAILED = "DHCPSRV_SUBNET6_SELECT_BY_INTERFACE_ID_FAILED"; extern const isc::log::MessageID DHCPSRV_TIMERMGR_CALLBACK_FAILED = "DHCPSRV_TIMERMGR_CALLBACK_FAILED"; extern const isc::log::MessageID DHCPSRV_TIMERMGR_REGISTER_TIMER = "DHCPSRV_TIMERMGR_REGISTER_TIMER"; extern const isc::log::MessageID DHCPSRV_TIMERMGR_RUN_TIMER_OPERATION = "DHCPSRV_TIMERMGR_RUN_TIMER_OPERATION"; @@ -443,6 +453,16 @@ const char* values[] = { "DHCPSRV_QUEUE_NCR", "%1: Name change request to %2 DNS entry queued: %3", "DHCPSRV_QUEUE_NCR_FAILED", "%1: queuing %2 name change request failed for lease %3: %4", "DHCPSRV_QUEUE_NCR_SKIP", "%1: skip queuing name change request for lease: %2", + "DHCPSRV_SUBNET4O6_SELECT_FAILED", "Failed to select any subnet for the DHCPv4o6 packet", + "DHCPSRV_SUBNET4_SELECT_BY_ADDRESS_FAILED", "Failed to select any subnet using address: %1", + "DHCPSRV_SUBNET4_SELECT_BY_INTERFACE_FAILED", "Failed to select any subnet using interface: %1", + "DHCPSRV_SUBNET4_SELECT_BY_RELAY_ADDRESS_FAILED", "Failed to select any subnet using relay address: %1", + "DHCPSRV_SUBNET4_SELECT_FAILED_NO_ADDRESS", "Failed to select any subnet because no suitable address to use for subnet selection was found.", + "DHCPSRV_SUBNET4_SELECT_FAILED_NO_RAI_OPTIONS_ADDRESS", "Failed to select any subnet because no suitable address to use for subnet selection was found in the relay supplied options.", + "DHCPSRV_SUBNET4_SELECT_FAILED_NO_RELAY_ADDRESS", "Failed to select any subnet because no relay address to use for subnet selection was found.", + "DHCPSRV_SUBNET6_SELECT_BY_ADDRESS_FAILED", "Failed to select any subnet using address: %1", + "DHCPSRV_SUBNET6_SELECT_BY_INTERFACE_FAILED", "Failed to select any subnet using interface: %1", + "DHCPSRV_SUBNET6_SELECT_BY_INTERFACE_ID_FAILED", "Failed to select any subnet using interface-id: %1", "DHCPSRV_TIMERMGR_CALLBACK_FAILED", "running handler for timer %1 caused exception: %2", "DHCPSRV_TIMERMGR_REGISTER_TIMER", "registering timer: %1, using interval: %2 ms", "DHCPSRV_TIMERMGR_RUN_TIMER_OPERATION", "running operation for timer: %1", diff --git a/src/lib/dhcpsrv/dhcpsrv_messages.h b/src/lib/dhcpsrv/dhcpsrv_messages.h index e219050cb5..48280f6edb 100644 --- a/src/lib/dhcpsrv/dhcpsrv_messages.h +++ b/src/lib/dhcpsrv/dhcpsrv_messages.h @@ -218,6 +218,16 @@ extern const isc::log::MessageID DHCPSRV_PGSQL_UPDATE_ADDR6; extern const isc::log::MessageID DHCPSRV_QUEUE_NCR; extern const isc::log::MessageID DHCPSRV_QUEUE_NCR_FAILED; extern const isc::log::MessageID DHCPSRV_QUEUE_NCR_SKIP; +extern const isc::log::MessageID DHCPSRV_SUBNET4O6_SELECT_FAILED; +extern const isc::log::MessageID DHCPSRV_SUBNET4_SELECT_BY_ADDRESS_FAILED; +extern const isc::log::MessageID DHCPSRV_SUBNET4_SELECT_BY_INTERFACE_FAILED; +extern const isc::log::MessageID DHCPSRV_SUBNET4_SELECT_BY_RELAY_ADDRESS_FAILED; +extern const isc::log::MessageID DHCPSRV_SUBNET4_SELECT_FAILED_NO_ADDRESS; +extern const isc::log::MessageID DHCPSRV_SUBNET4_SELECT_FAILED_NO_RAI_OPTIONS_ADDRESS; +extern const isc::log::MessageID DHCPSRV_SUBNET4_SELECT_FAILED_NO_RELAY_ADDRESS; +extern const isc::log::MessageID DHCPSRV_SUBNET6_SELECT_BY_ADDRESS_FAILED; +extern const isc::log::MessageID DHCPSRV_SUBNET6_SELECT_BY_INTERFACE_FAILED; +extern const isc::log::MessageID DHCPSRV_SUBNET6_SELECT_BY_INTERFACE_ID_FAILED; extern const isc::log::MessageID DHCPSRV_TIMERMGR_CALLBACK_FAILED; extern const isc::log::MessageID DHCPSRV_TIMERMGR_REGISTER_TIMER; extern const isc::log::MessageID DHCPSRV_TIMERMGR_RUN_TIMER_OPERATION; diff --git a/src/lib/dhcpsrv/dhcpsrv_messages.mes b/src/lib/dhcpsrv/dhcpsrv_messages.mes index dc873a2fdc..1401945107 100644 --- a/src/lib/dhcpsrv/dhcpsrv_messages.mes +++ b/src/lib/dhcpsrv/dhcpsrv_messages.mes @@ -1095,6 +1095,46 @@ reverse update is disabled for this lease or the DNS updates are disabled in the configuration. The first argument includes the client identification information. The second argument includes the leased address. +% DHCPSRV_SUBNET4O6_SELECT_FAILED Failed to select any subnet for the DHCPv4o6 packet +A debug message issued when the server was unable to select any subnet for the +DHCPv4o6 packet. + +% DHCPSRV_SUBNET4_SELECT_BY_ADDRESS_FAILED Failed to select any subnet using address: %1 +A debug message issued when the server was unable to select any subnet using +specified address. + +% DHCPSRV_SUBNET4_SELECT_BY_INTERFACE_FAILED Failed to select any subnet using interface: %1 +A debug message issued when the server was unable to select any subnet using +specified interface name. + +% DHCPSRV_SUBNET4_SELECT_BY_RELAY_ADDRESS_FAILED Failed to select any subnet using relay address: %1 +A debug message issued when the server was unable to select any subnet using +the specified relay address. + +% DHCPSRV_SUBNET4_SELECT_FAILED_NO_ADDRESS Failed to select any subnet because no suitable address to use for subnet selection was found. +A debug message issued when the server was unable to select any subnet because +no suitable address to use for subnet selection was found. + +% DHCPSRV_SUBNET4_SELECT_FAILED_NO_RAI_OPTIONS_ADDRESS Failed to select any subnet because no suitable address to use for subnet selection was found in the relay supplied options. +A debug message issued when the server was unable to select any subnet because +no suitable address to use for subnet selection was found in the relay supplied options. + +% DHCPSRV_SUBNET4_SELECT_FAILED_NO_RELAY_ADDRESS Failed to select any subnet because no relay address to use for subnet selection was found. +A debug message issued when the server was unable to select any subnet because +no relay address to use for subnet selection was found. + +% DHCPSRV_SUBNET6_SELECT_BY_ADDRESS_FAILED Failed to select any subnet using address: %1 +A debug message issued when the server was unable to select any subnet using +specified address. + +% DHCPSRV_SUBNET6_SELECT_BY_INTERFACE_FAILED Failed to select any subnet using interface: %1 +A debug message issued when the server was unable to select any subnet using +specified interface name. + +% DHCPSRV_SUBNET6_SELECT_BY_INTERFACE_ID_FAILED Failed to select any subnet using interface-id: %1 +A debug message issued when the server was unable to select any subnet using +specified interface id. + % DHCPSRV_TIMERMGR_CALLBACK_FAILED running handler for timer %1 caused exception: %2 This error message is emitted when the timer elapsed and the operation associated with this timer has thrown an exception. |