From: Francis Dupont Date: Fri, 20 Nov 2015 15:29:10 +0000 (+0100) Subject: [4097a] Switched class iterators X-Git-Tag: trac4204fd_base~2^2~23 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b66c0b8cff12a1390eb884f779b0faa3cfa313f4;p=thirdparty%2Fkea.git [4097a] Switched class iterators --- diff --git a/src/bin/dhcp4/dhcp4_srv.cc b/src/bin/dhcp4/dhcp4_srv.cc index d7c247aecd..6ae81ff634 100644 --- a/src/bin/dhcp4/dhcp4_srv.cc +++ b/src/bin/dhcp4/dhcp4_srv.cc @@ -2371,18 +2371,19 @@ Dhcpv4Srv::classSpecificProcessing(const Dhcpv4Exchange& ex) { rsp->setSiaddr(IOAddress::IPV4_ZERO_ADDRESS()); } - // Process each class - const ClientClassDefMapPtr& defs_ptr = CfgMgr::instance().getCurrentCfg()-> - getClientClassDictionary()->getClasses(); - for (ClientClassDefMap::const_iterator it = defs_ptr->begin(); - it != defs_ptr->end(); ++it) { - // Is the query in this class? - if (!it->second || !query->inClass(it->first)) { + // Process each class in the packet + const ClientClasses& classes = query->getClasses(); + for (ClientClasses::const_iterator cclass = classes.begin(); + cclass != classes.end(); ++cclass) { + // Find the client class definition for this class + const ClientClassDefPtr& ccdef = CfgMgr::instance().getCurrentCfg()-> + getClientClassDictionary()->findClass(*cclass); + if (!ccdef) { + // Not found continue; } // Get the configured options of this class - const OptionContainerPtr& options = - it->second->getCfgOption()->getAll("dhcp4"); + const OptionContainerPtr& options = ccdef->getCfgOption()->getAll("dhcp4"); if (!options || options->empty()) { continue; } diff --git a/src/lib/dhcp/pkt.h b/src/lib/dhcp/pkt.h index 2c42b5cf16..51507ec186 100644 --- a/src/lib/dhcp/pkt.h +++ b/src/lib/dhcp/pkt.h @@ -237,6 +237,12 @@ public: /// @param client_class name of the class to be added void addClass(const isc::dhcp::ClientClass& client_class); + /// @brief Returns the class set + /// + /// @note This should be used only to iterate over the class set. + /// @return + const ClientClasses& getClasses() const { return (classes_); } + /// @brief Unparsed data (in received packets). /// /// @warning This public member is accessed by derived