[Kea-users] Getting the interface name in hooks

Gokulakrishnan Gopalakrishnan ggopalakrishnan at salesforce.com
Wed Aug 23 10:41:15 UTC 2017


Thanks Marcin, I just did what you mentioned in the code and printed
*iface_configuation->str()* and it prints an empty array interface.
Probably because I didn't link the hook user_chk with *libkea-dhcpsrv*.
I tried linking *libkea-dhcpsrv *by adding

libdhcp_user_chk_la_LIBADD  += $(top_builddir)/src/lib/hooks/libkea-dhcpsrv.la

in src/hooks/dhcp/user_chk/Makefile.am and did a make.

I'm getting automake-1.14: command not found. Every time editing
Makefile.am, I'm getting this error. Am I doing the linking correctly?
Am I missing something here? Please correct me if I'm wrong




On Wed, Aug 23, 2017 at 3:09 PM, Marcin Siodelski <marcin at isc.org> wrote:

> 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
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.isc.org/pipermail/kea-users/attachments/20170823/c53e71eb/attachment.htm>


More information about the Kea-users mailing list