[Kea-users] Side-loading pool configuration information from a database

Tomek Mrugalski tomasz at isc.org
Thu Aug 31 19:40:10 UTC 2017

W dniu 30.08.2017 o 09:33, Daniel Corbe pisze:
> I want to stick my pool configuration in the database.  I don't want to
> maintain it in the config file.
> Is it possible today to do this?
Not yet. The capability to store subnets (and pools) in a databases is
likely to be implemented in 1.5.

> If not, can it be implemented with hooks?
It could be, but depending on how you deploy your configuration it may
be a bit tricky to implement. We do have control_command_receive hook
that processes incoming commands. One of such commands is config-set. If
you deploy your configuration using that, rather than reading everything
from a file, you could write a hook that would get in action when
config-set command is received and ignore any other commands. Such a
hook could get the subnets and pools, convert them to JSON (or more
precisely Element structures), inject them into the arguments of
config-set and then pass it back to Kea for normal parsing.

If you're reading the configuration from a plain file, there's no easy
way to handle it. The problem is that in principle having a hook being
fired off when configuration is ready sounds like a good idea, but the
problem is how would you hook a library onto it if the configuration
that describes which library to load is being loaded? We could add a
hook configuration_changed that's called afterwards, but then you
wouldn't benefit from all the sanity checks that Kea is doing on the

If you really want to, you can write a library that's being loaded, does
not install any callouts, but instead modifies the server configuration
from within its load() function. Not 100% sure, but that should work.
Just need to do some experiments whether you need to modify staging or
current config (see CfgMgr::getStagingCfg() and
CfgMgr::getCurrentCfg()). Should work, but that's more of a hack rather
than a clean solution.


More information about the Kea-users mailing list