2
0
mirror of https://gitlab.isc.org/isc-projects/kea synced 2025-08-30 21:45:37 +00:00

[#1139] Extended commentary

The commentary explaning why we do another client classification evaluation
pass has been extended per review comments.
This commit is contained in:
Marcin Siodelski
2020-03-19 10:17:01 +01:00
parent 2ac4e47cb5
commit 2229ae696f
2 changed files with 26 additions and 8 deletions

View File

@@ -201,10 +201,19 @@ Dhcpv4Exchange::Dhcpv4Exchange(const AllocEnginePtr& alloc_engine,
if ((global_host && !global_host->getClientClasses4().empty()) ||
(!sn && current_host && !current_host->getClientClasses4().empty())) {
// We have already evaluated client classes and some of them may
// be in conflict with the reserved classes. Therefore, we need to
// remove those that were assigned as a result of evaluation.
// That preserves built-in classes and the classes set explicitly
// by the hooks libraries.
// be in conflict with the reserved classes. Suppose there are
// two classes defined in the server configuration: first_class
// and second_class and the test for the second_class it looks
// like this: "not member('first_class')". If the first_class
// initially evaluates to false, the second_class evaluates to
// true. If the first_class is now set within the hosts reservations
// and we don't remove the previously evaluated second_class we'd
// end up with both first_class and second_class evaluated to
// true. In order to avoid that, we have to remove the classes
// evaluated in the first pass and evaluate them again. As
// a result, the first_class set via the host reservation will
// replace the second_class because the second_class will this
// time evaluate to false as desired.
const ClientClassDictionaryPtr& dict =
CfgMgr::instance().getCurrentCfg()->getClientClassDictionary();
const ClientClassDefListPtr& defs_ptr = dict->getClasses();

View File

@@ -439,10 +439,19 @@ Dhcpv6Srv::initContext(const Pkt6Ptr& pkt,
if ((global_host && !global_host->getClientClasses6().empty()) ||
(!sn && current_host && !current_host->getClientClasses6().empty())) {
// We have already evaluated client classes and some of them may
// be in conflict with the reserved classes. Therefore, we need to
// remove those that were assigned as a result of evaluation.
// That preserves built-in classes and the classes set explicitly
// by the hooks libraries.
// be in conflict with the reserved classes. Suppose there are
// two classes defined in the server configuration: first_class
// and second_class and the test for the second_class it looks
// like this: "not member('first_class')". If the first_class
// initially evaluates to false, the second_class evaluates to
// true. If the first_class is now set within the hosts reservations
// and we don't remove the previously evaluated second_class we'd
// end up with both first_class and second_class evaluated to
// true. In order to avoid that, we have to remove the classes
// evaluated in the first pass and evaluate them again. As
// a result, the first_class set via the host reservation will
// replace the second_class because the second_class will this
// time evaluate to false as desired.
const ClientClassDictionaryPtr& dict =
CfgMgr::instance().getCurrentCfg()->getClientClassDictionary();
const ClientClassDefListPtr& defs_ptr = dict->getClasses();