[Kea-users] Getting the interface name in hooks

Marcin Siodelski marcin at isc.org
Wed Aug 23 10:58:33 UTC 2017


You'd rather need to link with this:

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

In most cases you'd also need to link with libkea-dhcpsrv.la
dependencies which you can find it its Makefile.am.

As for the automake error it seems to me that you're missing
automake-1.14. Perhaps you have some different version? automake-1.15?

Maybe go to Kea root directory and run autoreconf --install &&
./configure ... && make

again.

Marcin

On 23.08.2017 12:41, Gokulakrishnan Gopalakrishnan wrote:
> 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 <http://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
> <mailto: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
> 
> 




More information about the Kea-users mailing list