before the classification was added to Kea is used, or class naming is
inconsistent.
+% DHCP4_CLASS_UNKNOWN on-demand class %1 has no definition
+This debug message informs that a class is listed for late evaluation but
+has no definition.
+
+% DHCP4_CLASS_UNTESTABLE on-demand class %1 has no test expression
+This debug message informs that a class was listed for late evaluation but
+its definition does not include a test expression to evaluate.
+
% DHCP4_CLIENTID_IGNORED_FOR_LEASES %1: not using client identifier for lease allocation for subnet %2
This debug message is issued when the server is processing the DHCPv4 message
for which client identifier will not be used when allocating new lease or
const ClientClassDefPtr& ccdef = CfgMgr::instance().getCurrentCfg()->
getClientClassDictionary()->findClass(*cclass);
if (!ccdef) {
- // Not found: the class is not configured
- if (((*cclass).size() <= VENDOR_CLASS_PREFIX.size()) ||
- ((*cclass).compare(0, VENDOR_CLASS_PREFIX.size(), VENDOR_CLASS_PREFIX) != 0)) {
- // Not a VENDOR_CLASS_* so should be configured
+ // Not found: the class is built-in or not configured
+ if (!isClientClassBuiltIn(*cclass)) {
LOG_DEBUG(dhcp4_logger, DBG_DHCP4_BASIC, DHCP4_CLASS_UNCONFIGURED)
.arg(ex.getQuery()->getLabel())
.arg(*cclass);
for (ClientClasses::const_iterator cclass = classes.cbegin();
cclass != classes.cend(); ++cclass) {
const ClientClassDefPtr class_def = dict->findClass(*cclass);
- // Todo: log unknown classes
if (!class_def) {
+ LOG_DEBUG(dhcp4_logger, DBG_DHCP4_BASIC, DHCP4_CLASS_UNKNOWN)
+ .arg(*cclass);
continue;
}
const ExpressionPtr& expr_ptr = class_def->getMatchExpr();
// Nothing to do without an expression to evaluate
if (!expr_ptr) {
+ LOG_DEBUG(dhcp4_logger, DBG_DHCP4_BASIC, DHCP4_CLASS_UNTESTABLE)
+ .arg(*cclass);
continue;
}
// Evaluate the expression which can return false (no match),
before the classification was added to Kea is used, or class naming is
inconsistent.
+% DHCP6_CLASS_UNKNOWN on-demand class %1 has no definition
+This debug message informs that a class is listed for late evaluation but
+has no definition.
+
+% DHCP6_CLASS_UNTESTABLE on-demand class %1 has no test expression
+This debug message informs that a class was listed for late evaluation but
+its definition does not include a test expression to evaluate.
+
% DHCP6_COMMAND_RECEIVED received command %1, arguments: %2
A debug message listing the command (and possible arguments) received
from the Kea control system by the IPv6 DHCP server.
const ClientClassDefPtr& ccdef = CfgMgr::instance().getCurrentCfg()->
getClientClassDictionary()->findClass(*cclass);
if (!ccdef) {
- // Not found: the class is not configured
- if (((*cclass).size() <= VENDOR_CLASS_PREFIX.size()) ||
- ((*cclass).compare(0, VENDOR_CLASS_PREFIX.size(), VENDOR_CLASS_PREFIX) != 0)) {
- // Not a VENDOR_CLASS_* so should be configured
+ // Not found: the class is built-in or not configured
+ if (!isClientClassBuiltIn(*cclass)) {
LOG_DEBUG(dhcp6_logger, DBG_DHCP6_BASIC, DHCP6_CLASS_UNCONFIGURED)
.arg(question->getLabel())
.arg(*cclass);
for (ClientClasses::const_iterator cclass = classes.cbegin();
cclass != classes.cend(); ++cclass) {
const ClientClassDefPtr class_def = dict->findClass(*cclass);
- // Todo: log unknown classes
if (!class_def) {
+ LOG_DEBUG(dhcp6_logger, DBG_DHCP6_BASIC, DHCP6_CLASS_UNKNOWN)
+ .arg(*cclass);
continue;
}
const ExpressionPtr& expr_ptr = class_def->getMatchExpr();
// Nothing to do without an expression to evaluate
if (!expr_ptr) {
+ LOG_DEBUG(dhcp6_logger, DBG_DHCP6_BASIC, DHCP6_CLASS_UNTESTABLE)
+ .arg(*cclass);
continue;
}
// Evaluate the expression which can return false (no match),
return (result);
}
+std::list<std::string>
+builtinPrefixes = {
+ "VENDOR_CLASS_", "AFTER_", "EXTERNAL_"
+};
+
+bool
+isClientClassBuiltIn(const ClientClass& client_class) {
+ for (std::list<std::string>::const_iterator bt = builtinPrefixes.cbegin();
+ bt != builtinPrefixes.cend(); ++bt) {
+ if (client_class.size() <= bt->size()) {
+ continue;
+ }
+ auto mis = std::mismatch(bt->cbegin(), bt->cend(), client_class.cbegin());
+ if (mis.first == bt->cend()) {
+ return true;
+ }
+ }
+
+ return false;
+}
+
+bool
+isClientClassKnown(ClientClassDictionaryPtr& class_dictionary,
+ const ClientClass& client_class) {
+ // First check built-in prefixes
+ if (isClientClassBuiltIn(client_class)) {
+ return (true);
+ }
+
+ // Second check already defined, i.e. in the dictionary
+ ClientClassDefPtr def = class_dictionary->findClass(client_class);
+ if (def) {
+ return (true);
+ }
+
+ // Unknown...
+ return (false);
+}
+
} // namespace isc::dhcp
} // namespace isc
/// @brief Defines a pointer to a ClientClassDictionary
typedef boost::shared_ptr<ClientClassDictionary> ClientClassDictionaryPtr;
+/// @brief List of built-in client class prefixes
+/// i.e. VENDOR_CLASS_, AFTER_ and EXTERNAL_.
+extern std::list<std::string> builtinPrefixes;
+
+/// @brief Check if a client class name is builtin.
+///
+/// @param client_class A client class name to look for.
+/// @return true if built-in, false if not.
+bool isClientClassBuiltIn(const ClientClass& client_class);
+
+
+/// @brief Check if a client class name is already known,
+/// i.e. beginning by a built-in prefix or in the dictionary,
+///
+/// @param class_dictionary A class dictionary where to look for.
+/// @param client_class A client class name to look for.
+/// @return true if known or built-in, false if not.
+bool isClientClassKnown(ClientClassDictionaryPtr& class_dictionary,
+ const ClientClass& client_class);
+
} // namespace isc::dhcp
} // namespace isc
}
}
-std::list<std::string>
-ClientClassDefParser::builtinPrefixes = {
- "VENDOR_CLASS_", "AFTER_", "EXTERNAL_"
-};
-
-bool
-ClientClassDefParser::isClientClassKnown(ClientClassDictionaryPtr& class_dictionary,
- const ClientClass& client_class) {
- // First check built-in prefixes
- for (std::list<std::string>::const_iterator bt = builtinPrefixes.cbegin();
- bt != builtinPrefixes.cend(); ++bt) {
- if (client_class.size() <= bt->size()) {
- continue;
- }
- auto mis = std::mismatch(bt->cbegin(), bt->cend(), client_class.cbegin());
- if (mis.first == bt->cend()) {
- return true;
- }
- }
-
- // Second check already defined, i.e. in the dictionary
- ClientClassDefPtr def = class_dictionary->findClass(client_class);
- if (def) {
- return (true);
- }
-
- // Unknown...
- return (false);
-}
-
// ****************** ClientClassDefListParser ************************
ClientClassDictionaryPtr
/// @throw DhcpConfigError if parsing was unsuccessful.
void parse(ClientClassDictionaryPtr& class_dictionary,
isc::data::ConstElementPtr client_class_def, uint16_t family);
-
- /// @brief List of built-in client class prefixes
- /// i.e. VENDOR_CLASS_, AFTER_ and EXTERNAL_.
- static std::list<std::string> builtinPrefixes;
-
- /// @brief Check if a client class name is already known,
- /// i.e. beginning by a built-in prefix or in the dictionary,
- ///
- /// @param class_dictionary A class dictionary where to look for.
- /// @param client_class A client class name to look for.
- /// @return true if known or built-in, false if not.
- static bool
- isClientClassKnown(ClientClassDictionaryPtr& class_dictionary,
- const ClientClass& client_class);
};
/// @brief Defines a pointer to a ClientClassDefParser