2
0
mirror of https://gitlab.isc.org/isc-projects/kea synced 2025-09-05 08:25:16 +00:00

[#1836] get server identifier from client class value

This commit is contained in:
Razvan Becheriu
2021-06-19 15:38:40 +03:00
parent c7b88df5c8
commit f04bb7b3a8
6 changed files with 312 additions and 19 deletions

View File

@@ -3687,6 +3687,29 @@ Dhcpv4Srv::acceptServerId(const Pkt4Ptr& query) const {
return (true);
}
// Check if the server identifier is configured at client class level.
const ClientClasses& classes = query->getClasses();
for (ClientClasses::const_iterator cclass = classes.cbegin();
cclass != classes.cend(); ++cclass) {
// Find the client class definition for this class
const ClientClassDefPtr& ccdef = CfgMgr::instance().getCurrentCfg()->
getClientClassDictionary()->findClass(*cclass);
if (!ccdef) {
continue;
}
if (ccdef->getCfgOption()->empty()) {
// Skip classes which don't configure options
continue;
}
OptionCustomPtr context_opt_server_id = boost::dynamic_pointer_cast<OptionCustom>
(ccdef->getCfgOption()->get(DHCP4_OPTION_SPACE, DHO_DHCP_SERVER_IDENTIFIER).option_);
if (context_opt_server_id && (context_opt_server_id->readAddress() == server_id)) {
return (true);
}
}
// Finally, it is possible that the server identifier is specified
// on the global level.
ConstCfgOptionPtr cfg_global_options = cfg->getCfgOption();