2
0
mirror of https://gitlab.isc.org/isc-projects/kea synced 2025-08-30 05:27:55 +00:00

[#1950] Checkpoint: extended d2_srv_configured

This commit is contained in:
Francis Dupont 2021-07-12 17:40:15 +02:00
parent ddab7688c2
commit 3e6160d9f3
2 changed files with 16 additions and 6 deletions

View File

@ -50,7 +50,8 @@ to the end of this list.
- @b Arguments:
- name: @b io_context, type: isc::asiolink::IOServicePtr, direction: <b>in</b>
- name: @b json_config, type: isc::data::ConstElementPtr, direction: <b>in</b>
- name: @b server_config, type: isc::dhcp::SrvConfigPtr, direction: <b>in</b>
- name: @b server_config, type: isc::d2::D2CfgContextPtr, direction: <b>in</b>
- name: @b error, type: std::string, direction: <b>out</b>
- @b Description: this callout is executed when the server has completed
its (re)configuration. The server provides received and parsed configuration
@ -58,9 +59,11 @@ to the end of this list.
object which is used by the server to run asynchronous operations. The hooks
libraries can use this IOService object to schedule asynchronous tasks which
are triggered by the Kea DHCP DDNS's main loop. The hook library should hold
the provided pointer until the library is unloaded.
the provided pointer until the library is unloaded. The D2CfgContext
object provides access to the D2 running configuration.
- <b>Next step status</b>: Status codes returned by the callouts installed on
this hook point are ignored.
- <b>Next step status</b>: If any callout sets the status to DROP, the server
considers the configuration is incorrect and rejects it using the error
string as an error message.
*/

View File

@ -271,6 +271,7 @@ D2Process::configure(isc::data::ConstElementPtr config_set, bool check_only) {
// to the common IO service object, new server configuration in the JSON
// format and with the pointer to the configuration storage where the
// parsed configuration is stored.
std::string error("");
if (HooksManager::calloutsPresent(Hooks.hooks_index_d2_srv_configured_)) {
CalloutHandlePtr callout_handle = HooksManager::createCalloutHandle();
@ -278,12 +279,18 @@ D2Process::configure(isc::data::ConstElementPtr config_set, bool check_only) {
callout_handle->setArgument("json_config", config_set);
callout_handle->setArgument("server_config",
getD2CfgMgr()->getD2CfgContext());
callout_handle->setArgument("error", error);
HooksManager::callCallouts(Hooks.hooks_index_d2_srv_configured_,
*callout_handle);
// Ignore status code as none of them would have an effect on further
// operation.
// The config can be rejected by a hook.
if (callout_handle->getStatus() == CalloutHandle::NEXT_STEP_DROP) {
callout_handle->getArgument("error", error);
reconf_queue_flag_ = false;
answer = isc::config::createAnswer(1, error);
return (answer);
}
}
// If we are here, configuration was valid, at least it parsed correctly