Re: [Kea-users] next-server-address in hooks for UEFI config servers

2018-05-29 Thread Gokulakrishnan Gopalakrishnan
Francis,
Currently, I'm hardcoding 'next-server' in kea.conf. Is it possible to do
it via hook code?

On Fri, May 25, 2018 at 4:23 PM, Gokulakrishnan Gopalakrishnan <
ggopalakrish...@salesforce.com> wrote:

> Thanks, Francis. If I want to get rid of hardcoding 'next-server' from
> kea.conf and move it to the hooks library by setting the field dynamically,
> what it the right way?
>
> On Fri, May 25, 2018 at 4:00 PM, Francis Dupont  wrote:
>
>> Gokulakrishnan Gopalakrishnan writes:
>> > I'm trying to assign IPs to my servers using Kea 1.3.0. Some of my
>> servers
>> > are UEFI configured ones and those are failing in getting IP.
>> > When I dig deep, I found out that setting "next-server": "192.168.1.1"
>> > manually in kea.conf works fine. I was setting next-server via hooks
>> code
>> > (pasted below).
>>
>> => next-server is a BOOTP/DHCP field, not an option. Note some of these
>> fields have a corresponding option used for instance when the field
>> is too small (can't happen with an IPv4 address :-).
>>
>> > // Add next server option to packet.
>> > opt = response->getOption(DHO_HOME_AGENT_ADDRS);
>>
>> => This option gives a list (vs one) of addresses of the Mobile IP
>> home agent. So it is something different (but if it makes the client
>> happy...).
>>
>> Regards
>>
>> Francis Dupont 
>>
>
>
___
Kea-users mailing list
Kea-users@lists.isc.org
https://lists.isc.org/mailman/listinfo/kea-users


Re: [Kea-users] next-server-address in hooks for UEFI config servers

2018-05-25 Thread Gokulakrishnan Gopalakrishnan
Thanks, Francis. If I want to get rid of hardcoding 'next-server' from
kea.conf and move it to the hooks library by setting the field dynamically,
what it the right way?

On Fri, May 25, 2018 at 4:00 PM, Francis Dupont <fdup...@isc.org> wrote:

> Gokulakrishnan Gopalakrishnan writes:
> > I'm trying to assign IPs to my servers using Kea 1.3.0. Some of my
> servers
> > are UEFI configured ones and those are failing in getting IP.
> > When I dig deep, I found out that setting "next-server": "192.168.1.1"
> > manually in kea.conf works fine. I was setting next-server via hooks code
> > (pasted below).
>
> => next-server is a BOOTP/DHCP field, not an option. Note some of these
> fields have a corresponding option used for instance when the field
> is too small (can't happen with an IPv4 address :-).
>
> > // Add next server option to packet.
> > opt = response->getOption(DHO_HOME_AGENT_ADDRS);
>
> => This option gives a list (vs one) of addresses of the Mobile IP
> home agent. So it is something different (but if it makes the client
> happy...).
>
> Regards
>
> Francis Dupont <fdup...@isc.org>
>
___
Kea-users mailing list
Kea-users@lists.isc.org
https://lists.isc.org/mailman/listinfo/kea-users


[Kea-users] next-server-address in hooks for UEFI config servers

2018-05-24 Thread Gokulakrishnan Gopalakrishnan
Hi,
I'm trying to assign IPs to my servers using Kea 1.3.0. Some of my servers
are UEFI configured ones and those are failing in getting IP.
When I dig deep, I found out that setting "next-server": "192.168.1.1"
manually in kea.conf works fine. I was setting next-server via hooks code
(pasted below).

More interesting thing is, this behavior is not observed for non-UEFI
configured servers. Am I missing something here?

OptionPtr opt;

// Add next server option to packet.
opt = response->getOption(DHO_HOME_AGENT_ADDRS);
if (opt) {
response->delOption(DHO_HOME_AGENT_ADDRS);
}
opt.reset(new OptionString(Option::V4, DHO_HOME_AGENT_ADDRS,
ipaddress_stdstring));
response->addOption(opt);

Thanks,
Gokul
___
Kea-users mailing list
Kea-users@lists.isc.org
https://lists.isc.org/mailman/listinfo/kea-users


Re: [Kea-users] DHCP Offer Decline to UEFI Configured host

2018-04-16 Thread Gokulakrishnan Gopalakrishnan
Thanks Thomas for the quick reply. We are using Kea 1.2.0
Let me try to upgrade and try to test

Sent from my iPhone

On 16-Apr-2018, at 2:31 PM, Thomas Andersen <t...@itu.dk> wrote:

Hi Gokul,



Are you on KEA 1.0? We were and had the same problem.

In my case, the issue lied in KEA 1.0 was responding with unicast no matter
what the client requested.



UEFI is a lot more strict in terms to getting reply as requested, otherwise
it will ignore the DHCP packets. It is requesting broadcast, but get a
unicast response, which from UEFI point of view is malformed.



Updating to KEA 1.3 fixed the issue for us. We then wrote a hook that can
enforce unicast replies on certain subnets.



Br,

Thomas



*From: *Kea-users <kea-users-boun...@lists.isc.org> on behalf of
Gokulakrishnan Gopalakrishnan <ggopalakrish...@salesforce.com>
*Date: *Monday, 16 April 2018 at 10.50
*To: *"kea-users@lists.isc.org" <kea-users@lists.isc.org>
*Cc: *Srikanth Boddepalli <sboddepa...@salesforce.com>
*Subject: *[Kea-users] DHCP Offer Decline to UEFI Configured host



Currently, we are using Kea to assign IPs to my server and it works well.
Now, we have configured UEFI on DELL Server and after that config, DHCP
Offer is getting declined by the server. When I queried online, there was a
change mentioned to change the boot filename and even that didn't help us
in accepting DHCP Offer.

We just shifted back to dhcpd and things started working with UEFI config.
Is there any known issue with UEFI-Kea? Do I need to change any
config/DHCPOption to assign IP for DELL Server with UEFI config?



Thanks in advance,

Gokul
___
Kea-users mailing list
Kea-users@lists.isc.org
https://lists.isc.org/mailman/listinfo/kea-users


[Kea-users] DHCP Offer Decline to UEFI Configured host

2018-04-16 Thread Gokulakrishnan Gopalakrishnan
Currently, we are using Kea to assign IPs to my server and it works well.
Now, we have configured UEFI on DELL Server and after that config, DHCP
Offer is getting declined by the server. When I queried online, there was a
change mentioned to change the boot filename and even that didn't help us
in accepting DHCP Offer.
We just shifted back to dhcpd and things started working with UEFI config.
Is there any known issue with UEFI-Kea? Do I need to change any
config/DHCPOption to assign IP for DELL Server with UEFI config?

Thanks in advance,
Gokul
___
Kea-users mailing list
Kea-users@lists.isc.org
https://lists.isc.org/mailman/listinfo/kea-users


[Kea-users] Assigning IP to Cisco Switch

2017-09-08 Thread Gokulakrishnan Gopalakrishnan
Hi
I'm migrating from dhcpd to Kea in assigning IP to Nexus 3K Cisco

Switches. I was able to assign IP using dhcpd but I'm facing issues with
Kea. I've given below the dhcpd.conf(working) and kea.conf(not working).
Please let me know where I'm doing wrong

*dhcpd.conf*

not authoritative;

option routers 192.216.22.129;

next-server 192.253.130.210;

subnet 192.250.226.208 netmask 255.255.255.248 {

class "Cisco-3k-v6" {

  match if substring(option vendor-class-identifier, 0, 22) = "Cisco
N3K-C3172TQ-10GT";

   option bootfile-name "poap_script_ops_6.0.2.U5.1.py";

 }

  default-lease-time 3600;

  max-lease-time 3600;

  option domain-name “example.net";

  option routers 192.250.226.209;

  option domain-name-servers 192.253.130.210;

  option tftp-server-name "192.253.130.210";

  pool {

allow members of "Cisco-3k-v6";

range 192.250.226.212 192.250.226.212;  }}

*Kea.conf*

"valid-lifetime": 3600,

"next-server":"192.253.130.210",

"subnet4": [ {

"pools" : [{"pool": "192.250.226.212 - 192.250.226.212"}],

"subnet" : "192.250.226.208/29",

"option-data" : [

{"name" : "routers",

"data" : "192.250.226.209"},

{"name":"boot-file-name",

"data":"poap_script_ops_6.0.2.U5.1.py"},

{"name":"tftp-server-name",

"data" : "192.253.130.210"},

{ "name":"host-name",

"data" : "example.net"},

{"name":"domain-name-servers",

"data" : "192.253.130.210"}

]}]},
___
Kea-users mailing list
Kea-users@lists.isc.org
https://lists.isc.org/mailman/listinfo/kea-users


Re: [Kea-users] Unit test Linkage issue to dhcpsrv

2017-09-08 Thread Gokulakrishnan Gopalakrishnan
Any clue here? I'm adding <# include "load_unload.cc"> in my unit test and
wondering how to fix this linkage issue. is there any other libs, I need to
add in the list

On Thu, Sep 7, 2017 at 10:55 PM, Gokulakrishnan Gopalakrishnan <
ggopalakrish...@salesforce.com> wrote:

> My user_chk hook unit test is failing with this following linkage issue:
>
>   CXXLDlibdhcp_user_chk_unittests
>
> libdhcp_user_chk_unittests-user_unittests.o: In function
> `getHostNameIPAddress':
>
> /opt/jenkins/workspace/Kea/Kea/src/hooks/dhcp/user_chk/
> tests/../../../../../src/hooks/dhcp/user_chk/load_unload.cc:195:
> undefined reference to `isc::dhcp::CfgMgr::instance()'
>
> /opt/jenkins/workspace/Kea/Kea/src/hooks/dhcp/user_chk/
> tests/../../../../../src/hooks/dhcp/user_chk/load_unload.cc:195:
> undefined reference to `isc::dhcp::CfgMgr::getStagingCfg()'
>
> /opt/jenkins/workspace/Kea/Kea/src/hooks/dhcp/user_chk/
> tests/../../../../../src/hooks/dhcp/user_chk/load_unload.cc:195:
> undefined reference to `isc::dhcp::CfgIface::use(unsigned short,
> std::string const&)'
>
> collect2: error: ld returned 1 exit status
>
> In addition to existing Makefile.am LIBS, I've added these dhcpsrv Libs
> too. Looks like I'm missing something here. Can someone please help here?
>
> libdhcp_user_chk_unittests_LDADD += $(top_builddir)/src/bin/dhcp4/libdhcp4.la
> libdhcp_user_chk_unittests_LDADD += 
> $(top_builddir)/src/lib/cfgrpt/libcfgrpt.la
> libdhcp_user_chk_unittests_LDADD += 
> $(top_builddir)/src/lib/dhcpsrv/libkea-dhcpsrv.la
> libdhcp_user_chk_unittests_LDADD += 
> $(top_builddir)/src/lib/dhcpsrv/testutils/libdhcpsrvtest.la
> libdhcp_user_chk_unittests_LDADD += 
> $(top_builddir)/src/lib/eval/libkea-eval.la
> libdhcp_user_chk_unittests_LDADD += 
> $(top_builddir)/src/lib/dhcp_ddns/libkea-dhcp_ddns.la
> libdhcp_user_chk_unittests_LDADD += 
> $(top_builddir)/src/lib/testutils/libkea-testutils.la
> libdhcp_user_chk_unittests_LDADD += 
> $(top_builddir)/src/lib/stats/libkea-stats.la
> libdhcp_user_chk_unittests_LDADD += 
> $(top_builddir)/src/lib/config/libkea-cfgclient.la
> libdhcp_user_chk_unittests_LDADD += 
> $(top_builddir)/src/lib/dhcp/tests/libdhcptest.la
>
>
___
Kea-users mailing list
Kea-users@lists.isc.org
https://lists.isc.org/mailman/listinfo/kea-users


[Kea-users] Unit test Linkage issue to dhcpsrv

2017-09-07 Thread Gokulakrishnan Gopalakrishnan
My user_chk hook unit test is failing with this following linkage issue:

  CXXLDlibdhcp_user_chk_unittests

libdhcp_user_chk_unittests-user_unittests.o: In function
`getHostNameIPAddress':

/opt/jenkins/workspace/Kea/Kea/src/hooks/dhcp/user_chk/tests/../../../../../src/hooks/dhcp/user_chk/load_unload.cc:195:
undefined reference to `isc::dhcp::CfgMgr::instance()'

/opt/jenkins/workspace/Kea/Kea/src/hooks/dhcp/user_chk/tests/../../../../../src/hooks/dhcp/user_chk/load_unload.cc:195:
undefined reference to `isc::dhcp::CfgMgr::getStagingCfg()'

/opt/jenkins/workspace/Kea/Kea/src/hooks/dhcp/user_chk/tests/../../../../../src/hooks/dhcp/user_chk/load_unload.cc:195:
undefined reference to `isc::dhcp::CfgIface::use(unsigned short,
std::string const&)'

collect2: error: ld returned 1 exit status

In addition to existing Makefile.am LIBS, I've added these dhcpsrv Libs
too. Looks like I'm missing something here. Can someone please help here?

libdhcp_user_chk_unittests_LDADD += $(top_builddir)/src/bin/dhcp4/libdhcp4.la
libdhcp_user_chk_unittests_LDADD += $(top_builddir)/src/lib/cfgrpt/libcfgrpt.la
libdhcp_user_chk_unittests_LDADD +=
$(top_builddir)/src/lib/dhcpsrv/libkea-dhcpsrv.la
libdhcp_user_chk_unittests_LDADD +=
$(top_builddir)/src/lib/dhcpsrv/testutils/libdhcpsrvtest.la
libdhcp_user_chk_unittests_LDADD += $(top_builddir)/src/lib/eval/libkea-eval.la
libdhcp_user_chk_unittests_LDADD +=
$(top_builddir)/src/lib/dhcp_ddns/libkea-dhcp_ddns.la
libdhcp_user_chk_unittests_LDADD +=
$(top_builddir)/src/lib/testutils/libkea-testutils.la
libdhcp_user_chk_unittests_LDADD +=
$(top_builddir)/src/lib/stats/libkea-stats.la
libdhcp_user_chk_unittests_LDADD +=
$(top_builddir)/src/lib/config/libkea-cfgclient.la
libdhcp_user_chk_unittests_LDADD +=
$(top_builddir)/src/lib/dhcp/tests/libdhcptest.la
___
Kea-users mailing list
Kea-users@lists.isc.org
https://lists.isc.org/mailman/listinfo/kea-users


[Kea-users] Boost conflict while building Kea

2017-09-01 Thread Gokulakrishnan Gopalakrishnan
I'm using boost1_48 to build kea. In my Centos6 box, I've installed boost
1_48. Here is my configure command.

./configure --with-boost-include=/usr/include/boost148
--with-boost-lib-dir=/usr/lib64/boost148

I'm seeing this below-mentioned error while doing 'make'. There is
already boost1_41 installed on the machine and I've installed 1_48 on
top of it.

Looks like this have caused some conflicts for boost_system. Can
someone helpme in resolving this conflicts?

17:49:09.585   u'>>>
/opt/rh/devtoolset-2/root/usr/libexec/gcc/x86_64-redhat-linux/4.8.2/ld:
warning: libboost_system.so.1.48.0, needed by
../../../src/lib/asiolink/.libs/libkea-asiolink.so, may conflict with
libboost_system.so.5\n',
17:49:09.585   u">>>
/opt/rh/devtoolset-2/root/usr/libexec/gcc/x86_64-redhat-linux/4.8.2/ld:
main.o: undefined reference to symbol
'_ZN5boost6system15system_categoryEv'\n",
17:49:09.585   u">>>
/opt/rh/devtoolset-2/root/usr/libexec/gcc/x86_64-redhat-linux/4.8.2/ld:
note: '_ZN5boost6system15system_categoryEv' is defined in DSO
/usr/lib64/libboost_system.so.1.48.0 so try adding it to the linker
command line\n",
17:49:09.585   u'>>>
/usr/lib64/libboost_system.so.1.48.0: could not read symbols: Invalid
operation\n',
17:49:09.585   u'>>> collect2: error: ld
returned 1 exit status\n',
17:49:09.585   u'>>> make[6]: *** [kea-dhcp4]
Error 1\n',
___
Kea-users mailing list
Kea-users@lists.isc.org
https://lists.isc.org/mailman/listinfo/kea-users


[Kea-users] Building Kea with C++11 compiler in Centos6

2017-08-31 Thread Gokulakrishnan Gopalakrishnan
I'm building Kea in Centos6 box, where C++11 compiler doesn't come as
default with OS. So, I installed devtoolset as mentioned in
https://hiltmon.com/blog/2015/08/09/c-plus-plus-11-on-centos-6-dot-6/

As per the blog, after installing devtoolset we have to enable C++11
compiler by using scl enable devtoolset-2 bash command. Then './configure,
make, make install' for Kea would work.

In my local Centos 6 box, this works well. But in my build machine scl
 enable devtoolset-2 bash  command doesn't work due to some limitations.
Anyways, devtoolset is installed.

Is there any other way to specify C++11 compiler to build Kea?

Thanks,
Gokul
___
Kea-users mailing list
Kea-users@lists.isc.org
https://lists.isc.org/mailman/listinfo/kea-users


Re: [Kea-users] Setting interface name while running

2017-08-24 Thread Gokulakrishnan Gopalakrishnan
Thanks use() function worked

On Thu, Aug 24, 2017 at 7:40 PM, Marcin Siodelski <mar...@isc.org> wrote:

> I guess you could simply use the CfgIface object which you retrieve by:
>
> CfgMgr::instance()->getStagingCfg()->getCfgIface() and call
>
> its use() function to set the interface name which you're planning to use.
>
> Marcin Siodelski
> ISC
>
> On 24.08.2017 15:59, Gokulakrishnan Gopalakrishnan wrote:
> > I have a use case like this. The interface name in which Kea needs to
> > listen (eg: eth0) is not known before hand. I can determine only after
> > starting Kea Process. Is there any way to set the interface name
> > during  hook?
> >
> > Thanks
> > Gokul
> >
> >
> > ___
> > Kea-users mailing list
> > Kea-users@lists.isc.org
> > https://lists.isc.org/mailman/listinfo/kea-users
> >
>
>
___
Kea-users mailing list
Kea-users@lists.isc.org
https://lists.isc.org/mailman/listinfo/kea-users


[Kea-users] Setting interface name while running

2017-08-24 Thread Gokulakrishnan Gopalakrishnan
I have a use case like this. The interface name in which Kea needs to
listen (eg: eth0) is not known before hand. I can determine only after
starting Kea Process. Is there any way to set the interface name during <
int load(LibraryHandle&)> hook?

Thanks
Gokul
___
Kea-users mailing list
Kea-users@lists.isc.org
https://lists.isc.org/mailman/listinfo/kea-users


Re: [Kea-users] Getting the interface name in hooks

2017-08-24 Thread Gokulakrishnan Gopalakrishnan
Thanks. Replacing with getStagingCfg() worked well.

On Wed, Aug 23, 2017 at 11:32 PM, Marcin Siodelski <mar...@isc.org> wrote:

> That's because the load() function is called as a result of parsing
> server configuration when your hook library is loaded. At this point
> there is no committed server configuration yet (because server
> configuration is being parsed). What you could try is:
>
> ConstCfgIfacePtr cfg =  CfgMgr::instance().getStagingCfg()->getCfgIface();
>
> instead of
>
> ConstCfgIfacePtr cfg =  CfgMgr::instance().getCurrentCfg()->getCfgIface();
>
> because "staging" configuration should already contain the information
> about interfaces (the interfaces parser is launched before the hooks
> libs parser).
>
> Give it a try.
>
> Marcin
>
> On 23.08.2017 19:57, Gokulakrishnan Gopalakrishnan wrote:
> > Marcin,
> > 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.
> > Actually, I'd be needing this info while initializing the Kea Process
> > itself. Can we get it somehow?
> >
> > On Wed, Aug 23, 2017 at 8:02 PM, Gokulakrishnan Gopalakrishnan
> > <ggopalakrish...@salesforce.com <mailto:ggopalakrish...@salesforce.com>>
> > wrote:
> >
> > Thanks Marcin. It worked
> >
> > On Wed, Aug 23, 2017 at 4:28 PM, Marcin Siodelski <mar...@isc.org
> > <mailto:mar...@isc.org>> wrote:
> >
> > You'd rather need to link with this:
> >
> > libdhcp_user_chk_la_LIBADD  +=
> > $(top_builddir)/src/lib/dhcpsrv/libkea-dhcpsrv.la
> > <http://libkea-dhcpsrv.la>
> >
> > In most cases you'd also need to link with libkea-dhcpsrv.la
> > <http://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> <http://libkea-dhcpsrv.la>
> > >
> > > in src/hooks/dhcp/user_chk/Makefile.am <http://efile.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
> > <mar...@isc.org <mailto:mar...@isc.org>
> > > <mailto:mar...@isc.org <mailto:mar...@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
> > > >  function?
> > > >
> > > >
> > >
> > > To retrieve server configuration information you'd need to
> > link your
> > > hook library with libkea-dhcpsrv and do something like
> this:
> > >
> > > #include 
> > >
> > > 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
> > >
> > >
> >
> >
> >
>
>
___
Kea-users mailing list
Kea-users@lists.isc.org
https://lists.isc.org/mailman/listinfo/kea-users


Re: [Kea-users] Getting the interface name in hooks

2017-08-23 Thread Gokulakrishnan Gopalakrishnan
Marcin,
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.
Actually, I'd be needing this info while initializing the Kea Process
itself. Can we get it somehow?

On Wed, Aug 23, 2017 at 8:02 PM, Gokulakrishnan Gopalakrishnan <
ggopalakrish...@salesforce.com> wrote:

> Thanks Marcin. It worked
>
> On Wed, Aug 23, 2017 at 4:28 PM, Marcin Siodelski <mar...@isc.org> wrote:
>
>> 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 <mar...@isc.org
>> > <mailto:mar...@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
>> > >  function?
>> > >
>> > >
>> >
>> > To retrieve server configuration information you'd need to link your
>> > hook library with libkea-dhcpsrv and do something like this:
>> >
>> > #include 
>> >
>> > 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
>> >
>> >
>>
>>
>
___
Kea-users mailing list
Kea-users@lists.isc.org
https://lists.isc.org/mailman/listinfo/kea-users


Re: [Kea-users] Getting the interface name in hooks

2017-08-23 Thread Gokulakrishnan Gopalakrishnan
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 <mar...@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
> >  function?
> >
> >
>
> To retrieve server configuration information you'd need to link your
> hook library with libkea-dhcpsrv and do something like this:
>
> #include 
>
> 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
>
___
Kea-users mailing list
Kea-users@lists.isc.org
https://lists.isc.org/mailman/listinfo/kea-users


[Kea-users] Getting the interface name in hooks

2017-08-23 Thread Gokulakrishnan Gopalakrishnan
"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  function?
___
Kea-users mailing list
Kea-users@lists.isc.org
https://lists.isc.org/mailman/listinfo/kea-users


[Kea-users] Changing the order of DHCP Options in DHCP Offer Packet

2017-07-20 Thread Gokulakrishnan Gopalakrishnan
I'm intercepting the DHCP Offer packet and reading the DHCP options present
in it. The options are present in the ascending order of its number.
I want to change the order in which the options are packed in the DHCP
Offer. Can someone help it?

Thanks,
Gokul
___
Kea-users mailing list
Kea-users@lists.isc.org
https://lists.isc.org/mailman/listinfo/kea-users


[Kea-users] Assigning IP to TOR Switch

2017-07-11 Thread Gokulakrishnan Gopalakrishnan
I'm trying to assign IP for a Cisco TOR Switch

Nexus 3K via Kea. I'm supplying option-parameters like TFTP Server,
Routers, boot file name, etc as specified here

as mandatory params. Even after changing the options multiple times, I'm
getting

POAP Failure - No valid DHCP OFFERs received

Do we need to do something specific to assign IP to Switches in Kea?

Thanks,
Gokul
___
Kea-users mailing list
Kea-users@lists.isc.org
https://lists.isc.org/mailman/listinfo/kea-users


[Kea-users] Specifying common boot-file-name

2017-07-06 Thread Gokulakrishnan Gopalakrishnan
My 'boot-file-name' is same for all the machines. Currently, I'm specifying
one for each subnet pool via option-data like

subnet4: [
{
"pools": [{...}],
"subnet" : ...,
"option-data": [ {"name":"boot-file-name", "data":"abc.0" } ]
},
{
"pools": [{...}],
"subnet" : ...,
"option-data": [ {"name":"boot-file-name", "data":"abc.0" } ]
},
..
]

How to specify one common boot file for all subnet pools?

Thanks,
Gokul
___
Kea-users mailing list
Kea-users@lists.isc.org
https://lists.isc.org/mailman/listinfo/kea-users


Re: [Kea-users] Parsing Option 82

2017-07-05 Thread Gokulakrishnan Gopalakrishnan
Thanks Christian, Itay. It helps!

On Tue, Jul 4, 2017 at 8:21 PM, Itay Rozenberg <itay.rozenb...@partner.co.il
> wrote:

> For the other one (remote_id) use getOption(RAI_OPTION_AGENT_REMOTE_ID).
>
>
>
>
>
> *From:* Kea-users [mailto:kea-users-boun...@lists.isc.org] *On Behalf Of *Itay
> Rozenberg
> *Sent:* Tuesday, July 4, 2017 5:23 PM
> *To:* 'Gokulakrishnan Gopalakrishnan'
> *Cc:* 'kea-users@lists.isc.org'
> *Subject:* Re: [Kea-users] Parsing Option 82
>
>
>
>
>
> Greetings
>
>
>
>
>
> Type 001 – circuit_id - hex, you need to convert it to ascii. (try it on
> this web site: http://www.rapidtables.com/convert/number/hex-to-ascii.htm
> )
>
> Type 002 – remote_id - Mac address
>
> Each of them can be hex or mac address.
>
>
>
> Try this:
>
> std::string hexToAscii(std::string c) {
>
> int length = c.length();
>
> std::string newString;
>
> for (int i = 0; i < length; i+=2) {
>
> std::string byte = c.substr(i, 2);
>
> char chr = (char)(int)strtol(byte.c_str(), NULL, 16);
>
> newString.push_back(chr);
>
> }
>
> return newString;
>
> }
>
>
>
>
>
>
>
> OptionPtr rai = query4_ptr->getOption(DHO_DHCP_AGENT_OPTIONS);
>
> if (rai) {
>
> OptionPtr circuit_id_opt = rai->getOption(RAI_OPTION_
> AGENT_CIRCUIT_ID);
>
> if (circuit_id_opt) {
>
> string cid = hexToAscii(circuit_id_opt->
> toHexString().substr(2));
>
>     }
>
> }
>
>
>
> For the other one (remote_id) use getOption(RAI_OPTION_AGENT_CIRCUIT_ID).
>
>
>
> itay
>
>
>
> *From:* Kea-users [mailto:kea-users-boun...@lists.isc.org
> <kea-users-boun...@lists.isc.org>] *On Behalf Of *Gokulakrishnan
> Gopalakrishnan
> *Sent:* Tuesday, July 4, 2017 2:20 PM
> *To:* kea-users@lists.isc.org
> *Subject:* [Kea-users] Parsing Option 82
>
>
>
> I'm trying to print and parse Option 82 but I couldn't understand the
> format in which it is received. My 'option->toText()' print this
>
> type=082, len=024:,
> options:
>   type=001, len=014: 01:0c:45:74:68:65:72:6e:65:74:31:2f:32:39
>   type=002, len=006: 04:62:73:56:13:bc
>
>
>
> Can someone help me to understand this value?
>
>
>
> Thanks,
>
> Gokul
>
> [image: Banner] <https://www.partner.co.il/partnertvfa>
> Powered by U‑BTech *XTRA*BANNER
> <http://www.u-btech.com/products/xtrabanner/poweredby>
>
> Please do not enrich emails sent to me
> <xban...@orange.co.il?subject=Please%20do%20not%20enrich%20emails%20sent%20to%20me%20%5BRemoval%20Code%3A%20DNE42%5D=Please%20do%20not%20enrich%20emails%20sent%20to%20me>
>
> 
> This message contains information that may be confidential or privileged.
> If you are not the intended recipient, you may not use, copy or disclose
> to anyone any of the information in this message. If you have received
> this message and are not the intended recipient, kindly notify the sender
> and delete this message from your computer.
>
> 
> This message contains information that may be confidential or privileged.
> If you are not the intended recipient, you may not use, copy or disclose
> to anyone any of the information in this message. If you have received
> this message and are not the intended recipient, kindly notify the sender
> and delete this message from your computer.
>
___
Kea-users mailing list
Kea-users@lists.isc.org
https://lists.isc.org/mailman/listinfo/kea-users


[Kea-users] Parsing Option 82

2017-07-04 Thread Gokulakrishnan Gopalakrishnan
I'm trying to print and parse Option 82 but I couldn't understand the
format in which it is received. My 'option->toText()' print this
type=082, len=024:,
options:
  type=001, len=014: 01:0c:45:74:68:65:72:6e:65:74:31:2f:32:39
  type=002, len=006: 04:62:73:56:13:bc

Can someone help me to understand this value?

Thanks,
Gokul
___
Kea-users mailing list
Kea-users@lists.isc.org
https://lists.isc.org/mailman/listinfo/kea-users


[Kea-users] Hook library .so file location after install

2017-06-27 Thread Gokulakrishnan Gopalakrishnan
I'm trying to install kea to a custom dir via ./configure --prefix=/opt/kea
After doing make and make install, I'm not seeing libdhcp_user_chk.so (hook
library) at /opt/kea/lib.

I noticed libkea-hooks.so is present at /opt/kea/lib. is this equivalent of
the user_chk lib? If not, what is the way to get the user_chk lib copied to
/opt/kea/lib automatically?

Thanks,

Gokul
___
Kea-users mailing list
Kea-users@lists.isc.org
https://lists.isc.org/mailman/listinfo/kea-users


Re: [Kea-users] Custom Subnet in Hooks

2017-06-21 Thread Gokulakrishnan Gopalakrishnan
Thanks Francis

On Wed, Jun 21, 2017 at 2:20 PM, Francis Dupont <fdup...@isc.org> wrote:

> Gokulakrishnan Gopalakrishnan writes:
> > I'm exploring Kea hooks for assigning Subnets. In subnet4_select(...) we
> > can select a subnet among the existing list of subnets. I'm just curious
> > whether we can select a custom subnet which is not defined at Kea.conf
> file?
> > Eg:
> > Kea.conf has 2 subnets defined - 192.168.1.0/24, 192.168.2.0/24
> > In subnet4_select(...) can we assign subnet of 192.168.3.0/24 and
> > subsequently assign IP of 192.168.3.10 to that host?
>
> => you can't assign a value which does not exist. Now you have access
> to everything from a hook so you can create a subnet object and assign
> it, at least in theory (i.e. this hook code should be a bit hard to write).
>
> Regards
>
> Francis Dupont <fdup...@isc.org>
>
___
Kea-users mailing list
Kea-users@lists.isc.org
https://lists.isc.org/mailman/listinfo/kea-users


[Kea-users] Custom Subnet in Hooks

2017-06-20 Thread Gokulakrishnan Gopalakrishnan
I'm exploring Kea hooks for assigning Subnets. In subnet4_select(...) we
can select a subnet among the existing list of subnets. I'm just curious
whether we can select a custom subnet which is not defined at Kea.conf file?
Eg:
Kea.conf has 2 subnets defined - 192.168.1.0/24, 192.168.2.0/24
In subnet4_select(...) can we assign subnet of 192.168.3.0/24 and
subsequently assign IP of 192.168.3.10 to that host?

Thanks,
Gokul
___
Kea-users mailing list
Kea-users@lists.isc.org
https://lists.isc.org/mailman/listinfo/kea-users


Re: [Kea-users] Help - Making HTTPS Call from Kea Hook Library

2017-06-19 Thread Gokulakrishnan Gopalakrishnan
Thanks Francis for the help. I tried solution #2, it worked well.
Now I want for a fresh install. so, after untar'ing the kea src, I edited
configure (appended -lcrypto with -lssl) and did usual installation
(configure, make, make install) and it worked well too. Hope this is a
recommended way.

On Thu, Jun 15, 2017 at 11:27 PM, Francis Dupont <fdup...@isc.org> wrote:

> Gokulakrishnan Gopalakrishnan writes:
> > ...
> > for making HTTPS Call using boost. While starting the server, I'm getting
> > error loading user_chk lib (*undefined Symbol: SSL_library_unit*).
>
> => the cryptolink library uses either the Botan or the OpenSSL crypto
> backend (it was initially Botan only but I added OpenSSL to provide
> an alternative, e.g. for people requiring a certified crypto).
> So if you build Kea with the OpenSSL backend you get the -lcrypto
> dependeny, i.e. the low level OpenSSL library. Note that we chose to
> not include direct HTTPS/TLS support inside Kea even both Botan and
> OpenSSL support TLS, of course with very different API.
> To conclude in your case you need the second SSL/TLS OpenSSL library -lssl
>
> > to build the library with "-lcrypto - lssl". I'm bit confused on how to
> > change the Makefile to build the library using these two libs.
>
> => you have two choices:
>  - you modify the Makefile.am and rerun autoconf, configure, etc
>
>  - you patch config.status to add -lssl in a variable definition
>   for instance the one with -lcrypto (i.e. you substitute "-lcrypto"
>   by "-lcrypto -lssl" everywhere) and you rerun it by:
>   sh ./config.status
>
> I use often the second solution because it is quick but it is dirty too
> so if it fixes your problem you have to try the first/clean way after.
>
> // Extra notes for corner cases, mainly the hook library case
>
> Note the order can matter (in theory it should not but in practice
> it could). And if you are working with a DSO (aka hook library)
> things can become really complex as hooks are loaded using dlopen()
> so anything the hook can need must be available in the Kea binary.
>
> There are already a few hacks to enforce some symbols to be visible,
> you have an example at the end of src/lib/eval/lexer.ll you can
> adapt to enforce a reference to a symbol in -lssl (without this
> the dynamic library libssl.so will be skipped by ld when the Kea
> binary is built). So if you have the -lssl not adding the library
> you should:
>  - check if the libssl.so is linked by something like
>   libtool --mode=execute ldd kea-dhcp4
>  (with libtool kea-dhcp4 is a shell script, the real binary is in
>   the src/bin/dhcp4/.libs directory and ldd applied directly on it
>   just returns errors saying it can't find libraries)
>   ldd on Linux and BSDs returns the list of dynamic libraries used
>   by the binary
>
>  - if libssl.so is not listed by ldd then add a hack at the end of
>   src/lib/cryptolink/openssl_link.cc with a reference to a libssl.so
>   symbol. Choose one (e.g., SSL_library_init), add its include
>   () and a call to it as in lexer.ll. Note the function
>   will be never really called but it will be referenced.
>   Rebuild and recheck.
>
> Regards
>
> Francis Dupont <fdup...@isc.org>
>
> PS: I assume you use dynamic linking on Linux or BSD. If you use static
> linking (./configure --enable-static-link) and/or Apple OS X / macOS
> some details change.
>
___
Kea-users mailing list
Kea-users@lists.isc.org
https://lists.isc.org/mailman/listinfo/kea-users


[Kea-users] Help - Making HTTPS Call from Kea Hook Library

2017-06-15 Thread Gokulakrishnan Gopalakrishnan
Hi,
I'm exploring Kea 1.2.0 and its example Hook Library user_chk. I've built
Kea with Boost 1.48, OpenSSL 1.0.1. My requirement is to make a HTTPS GET
Call from the user_chk library. I'm using this

example
for making HTTPS Call using boost. While starting the server, I'm getting
error loading user_chk lib (*undefined Symbol: SSL_library_unit*). When I
searched around this error, the suggestion

was
to build the library with "-lcrypto - lssl". I'm bit confused on how to
change the Makefile to build the library using these two libs. I'm
observing that -lcrypto is already added to Makefile (CRYPTO_LIBS). Even I
tried changing CRYPTO_LIBS = -lcrypto -lssl in the Makefile of user_chk/
but no change observed. Can someone help me in getting rid of the error?

Thanks in advance,
Gokul
___
Kea-users mailing list
Kea-users@lists.isc.org
https://lists.isc.org/mailman/listinfo/kea-users