<div dir="ltr">Marcin,<div>When I placed the code in "load(LibraryHandle&), I'm getting empty interface list, whereas if I keep the code in another hook like pkt4_send, I'm getting the proper list of interfaces.</div><div>Actually, I'd be needing this info while initializing the Kea Process itself. Can we get it somehow?</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Aug 23, 2017 at 8:02 PM, Gokulakrishnan Gopalakrishnan <span dir="ltr"><<a href="mailto:ggopalakrishnan@salesforce.com" target="_blank">ggopalakrishnan@salesforce.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Thanks Marcin. It worked</div><div class="HOEnZb"><div class="h5"><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Aug 23, 2017 at 4:28 PM, Marcin Siodelski <span dir="ltr"><<a href="mailto:marcin@isc.org" target="_blank">marcin@isc.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">You'd rather need to link with this:<br>
<br>
libdhcp_user_chk_la_LIBADD  +=<br>
$(top_builddir)/src/lib/dhcpsr<wbr>v/<a href="http://libkea-dhcpsrv.la" rel="noreferrer" target="_blank">libkea-dhcpsrv.la</a><br>
<br>
In most cases you'd also need to link with <a href="http://libkea-dhcpsrv.la" rel="noreferrer" target="_blank">libkea-dhcpsrv.la</a><br>
dependencies which you can find it its Makefile.am.<br>
<br>
As for the automake error it seems to me that you're missing<br>
automake-1.14. Perhaps you have some different version? automake-1.15?<br>
<br>
Maybe go to Kea root directory and run autoreconf --install &&<br>
./configure ... && make<br>
<br>
again.<br>
<br>
Marcin<br>
<span><br>
On 23.08.2017 12:41, Gokulakrishnan Gopalakrishnan wrote:<br>
> Thanks Marcin, I just did what you mentioned in the code and<br>
</span>> printed *iface_configuation->s<wbr>tr()* and it prints an empty array<br>
<span>> interface. Probably because I didn't link the hook user_chk<br>
</span>> with *libkea-dhcpsrv*. <br>
> I tried linking* **libkea-dhcpsrv *by adding <br>
><br>
> libdhcp_user_chk_la_LIBADD  += $(top_builddir)/src/lib/hooks/<a href="http://libkea-dhcpsrv.la" rel="noreferrer" target="_blank"><wbr>libkea-dhcpsrv.la</a> <<a href="http://libkea-dhcpsrv.la" rel="noreferrer" target="_blank">http://libkea-dhcpsrv.la</a>><br>
<span class="m_5010219006550304005im m_5010219006550304005HOEnZb">><br>
> in src/hooks/dhcp/user_chk/Mak<wbr><a href="http://efile.am">efile.am</a> and did a make.<br>
><br>
> I'm getting automake-1.14: command not found. Every time editing<br>
> Makefile.am, I'm getting this error. Am I doing the linking correctly?<br>
> Am I missing something here? Please correct me if I'm wrong<br>
><br>
><br>
><br>
><br>
> On Wed, Aug 23, 2017 at 3:09 PM, Marcin Siodelski <<a href="mailto:marcin@isc.org" target="_blank">marcin@isc.org</a><br>
</span><div class="m_5010219006550304005HOEnZb"><div class="m_5010219006550304005h5">> <mailto:<a href="mailto:marcin@isc.org" target="_blank">marcin@isc.org</a>>> wrote:<br>
><br>
>     On 23.08.2017 11:24, Gokulakrishnan Gopalakrishnan wrote:<br>
>     > "interfaces-config": {<br>
>     ><br>
>     >         "interfaces": [ "eth0" ]<br>
>     ><br>
>     >   }<br>
>     ><br>
>     > Can we get the list of interface name in hooks code? In the example<br>
>     > mentioned above, can we get the value "eth0" in hooks code in<br>
>     > <int load(LibraryHandle&)> function?<br>
>     ><br>
>     ><br>
><br>
>     To retrieve server configuration information you'd need to link your<br>
>     hook library with libkea-dhcpsrv and do something like this:<br>
><br>
>     #include <dhcpsrv/cfg_iface.h><br>
><br>
>     ConstCfgIfacePtr cfg = <br>
>     CfgMgr::instance().getCurrent<wbr>Cfg()->getCfgIface();<br>
>     ElementPtr iface_configuation = cfg->toElement();<br>
><br>
>     The iface_configuration will now hold the conifguration structure you're<br>
>     looking for.<br>
><br>
>     Marcin Siodelski<br>
>     ISC<br>
><br>
><br>
<br>
</div></div></blockquote></div><br></div>
</div></div></blockquote></div><br></div>