[Kea-users] Getting the interface name in hooks

Marcin Siodelski marcin at isc.org
Wed Aug 23 09:39:14 UTC 2017


On 23.08.2017 11:24, Gokulakrishnan Gopalakrishnan wrote:
> "interfaces-config": {
> 
>         "interfaces": [ "eth0" ]
> 
>   }
> 
> Can we get the list of interface name in hooks code? In the example
> mentioned above, can we get the value "eth0" in hooks code in
> <int load(LibraryHandle&)> function?
> 
> 

To retrieve server configuration information you'd need to link your
hook library with libkea-dhcpsrv and do something like this:

#include <dhcpsrv/cfg_iface.h>

ConstCfgIfacePtr cfg =  CfgMgr::instance().getCurrentCfg()->getCfgIface();
ElementPtr iface_configuation = cfg->toElement();

The iface_configuration will now hold the conifguration structure you're
looking for.

Marcin Siodelski
ISC



More information about the Kea-users mailing list