2
0
mirror of https://gitlab.isc.org/isc-projects/kea synced 2025-09-01 06:25:34 +00:00

[#2707] config-set in v4 now returns hash

This commit is contained in:
Tomek Mrugalski
2023-06-21 12:46:56 +02:00
parent db6ec11cc1
commit abe38a4e5c
3 changed files with 38 additions and 14 deletions

View File

@@ -974,8 +974,14 @@ configureDhcp4Server(Dhcpv4Srv& server, isc::data::ConstElementPtr config_set,
.arg(CfgMgr::instance().getStagingCfg()->
getConfigSummary(SrvConfig::CFGSEL_ALL4));
// Also calculate SHA256 hash of the config that was just set and append it to the response.
ElementPtr config = CfgMgr::instance().getCurrentCfg()->toElement();
string hash = BaseCommandMgr::getHash(config);
ElementPtr hash_map = Element::createMap();
hash_map->set("hash", Element::create(hash));
// Everything was fine. Configuration is successful.
answer = isc::config::createAnswer(CONTROL_RESULT_SUCCESS, "Configuration successful.");
answer = isc::config::createAnswer(CONTROL_RESULT_SUCCESS, "Configuration successful.", hash_map);
return (answer);
}