[Kea-users] Problems adding the premium package hooks libraries

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

[Kea-users] Problems adding the premium package hooks libraries

Dylan Masson
 Greetings,
 My company has recently purchased the premium package for Kea 1.3.0, and I have not been able to locate the hooks libraries, so that I can add their path to my config file. Does anyone have the names of the hooks libraries files? If I know the proper names, I can dig them out myself. The one from the example config in the docs doesn’t exist, so I assume that it would be something like the libdhcp_host_cmds.so, but that is in a dot-named directory, so I would guess that it isn’t the one.

Thanks,
Dyl
_______________________________________________
Kea-users mailing list
[hidden email]
https://lists.isc.org/mailman/listinfo/kea-users
Reply | Threaded
Open this post in threaded view
|

Re: [Kea-users] Problems adding the premium package hooks libraries

Marcin Siodelski
Hello Dyl,

The hooks libraries should be located in the Kea installation directory
under lib/hooks.

Marcin Siodelski
ISC


On 20.02.2018 21:37, Dylan Masson wrote:

>  Greetings,
>  My company has recently purchased the premium package for Kea 1.3.0, and I have not been able to locate the hooks libraries, so that I can add their path to my config file. Does anyone have the names of the hooks libraries files? If I know the proper names, I can dig them out myself. The one from the example config in the docs doesn’t exist, so I assume that it would be something like the libdhcp_host_cmds.so, but that is in a dot-named directory, so I would guess that it isn’t the one.
>
> Thanks,
> Dyl
> _______________________________________________
> Kea-users mailing list
> [hidden email]
> https://lists.isc.org/mailman/listinfo/kea-users
>

_______________________________________________
Kea-users mailing list
[hidden email]
https://lists.isc.org/mailman/listinfo/kea-users
Reply | Threaded
Open this post in threaded view
|

Re: [Kea-users] Problems adding the premium package hooks libraries

Francis Dupont
In reply to this post by Dylan Masson
I am working on a new hook so I have a build where "make install" works well.
Note I kept the default prefix "/usr/local", this gives:

% ls /usr/local/lib/hooks
libdhcp_flex_id.a libdhcp_host_cache.a libdhcp_legal_log.a
libdhcp_flex_id.la libdhcp_host_cache.la libdhcp_legal_log.la
libdhcp_flex_id.so libdhcp_host_cache.so libdhcp_legal_log.so
libdhcp_ha.a libdhcp_host_cmds.a libdhcp_subnet_cmds.a
libdhcp_ha.la libdhcp_host_cmds.la libdhcp_subnet_cmds.la
libdhcp_ha.so libdhcp_host_cmds.so libdhcp_subnet_cmds.so

Regards

Francis Dupont <[hidden email]>

PS: of course only the *.so are useful. If you find it is inconvenient
to get also the .a and .la, please open a (Kea trac) ticket or (better)
push a request on github fixing the install of the lease cmds hook
(the user chk hook is not installed).
_______________________________________________
Kea-users mailing list
[hidden email]
https://lists.isc.org/mailman/listinfo/kea-users
Reply | Threaded
Open this post in threaded view
|

Re: [Kea-users] Problems adding the premium package hooks libraries

Dylan Masson
In reply to this post by Marcin Siodelski
Thanks. I have added all of the .so files from that dir, including the libdhcp_host_cmds.so file, and “reservation-add” is still not showing.

I definitely built with the premium package:

     Kea source configure results:
    -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

Package:
  Name:            kea
  Version:         1.3.0
  Extended version:1.3.0 (tarball)
  OS Family:       Linux
  Using GNU sed:   yes
  Premium package: yes

The libraries re in the config:

    "hooks-libraries": [
  {
      "library": "/usr/local/lib/hooks/libdhcp_host_cmds.so",
//      "parameters": {
//          "param1": "foo"
//      }
  },
{
      "library": "/usr/local/lib/hooks/libdhcp_lease_cmds.so",
//      "parameters": {
//          "param1": "foo"
//      }
  },
{
      "library": "/usr/local/lib/hooks/libdhcp_flex_id.so",
//      "parameters": {
//          "param1": "foo"
//      }
  },
{
      "library": "/usr/local/lib/hooks/libdhcp_legal_log.so",
//      "parameters": {
//          "param1": "foo"
//      }
  }
    ]

And I am getting the statistics commands, but not the reservation ones:

# curl -X POST -H "Content-Type: application/json" -d '{ "command": "list-commands", "service": [ "dhcp4" ]  }' http://127.0.0.1:8080/
[ { "arguments": [ "build-report", "config-get", "config-reload", "config-set", "config-test", "config-write", "leases-reclaim", "libreload", "list-commands", "shutdown", "statistic-get", "statistic-get-all", "statistic-remove", "statistic-remove-all", "statistic-reset", "statistic-reset-all", "version-get" ], "result": 0 } ][


Any other suggestions?

Thanks,
Dyl


On Feb 21, 2018, at 3:56 AM, Marcin Siodelski <[hidden email]> wrote:

libdhcp_host_cmds.so


_______________________________________________
Kea-users mailing list
[hidden email]
https://lists.isc.org/mailman/listinfo/kea-users
Reply | Threaded
Open this post in threaded view
|

Re: [Kea-users] Problems adding the premium package hooks libraries

Francis Dupont
Dylan Masson writes:
> Thanks. I have added all of the .so files from that dir, including the
> libdhcp_host_cmds.so file, and "reservation-add" is
> still not showing.

> {
>       "library": "/usr/local/lib/hooks/libdhcp_flex_id.so",

=> you should include only needed hooks. Some, for instance flex-id,
require a parameter so can fail to initialize.

> And I am getting the statistics commands, but not the reservation ones:

=> you should get it: one of the unit tests of the host cmds hook
explicitely checks the result of list-commands (I know because I
copied this code).  Now it is not a system test... I'll check when
I'll get some free time (tomorrow? surely before Monday if it is not
solved before).

Regards

Francis Dupont <[hidden email]>
_______________________________________________
Kea-users mailing list
[hidden email]
https://lists.isc.org/mailman/listinfo/kea-users
Reply | Threaded
Open this post in threaded view
|

Re: [Kea-users] Problems adding the premium package hooks libraries

Tomek Mrugalski
In reply to this post by Dylan Masson
On 02/20/18 21:37, Dylan Masson wrote:
> Greetings, My company has recently purchased the premium package for
> Kea 1.3.0, and I have not been able to locate the hooks libraries,
> so that I can add their path to my config file. Does anyone have the
> names of the hooks libraries files? If I know the proper names, I
> can dig them out myself. The one from the example config in the docs
> doesn’t exist, so I assume that it would be something like the
> libdhcp_host_cmds.so, but that is in a dot-named directory, so I
> would guess that it isn’t the one.
Hi Dylan,

It was brought to my attention that your issue with the hook libraries
installation hasn't been resolved yet. Please accept my apologies.
The last message in this thread was from Francis, one of ISC engineers.
We assumed the lack of response from you meant the problem has been
resolved. We stand corrected.

There are couple steps needed to use the premium hook libraries.

Apologies for the list being lengthy and covering steps that seem
obvious, but I wanted to make sure the description is as complete
as possible.

1. You need to extract the tarball into premium/ directory of the kea
sources. Since configure detected premium package, you did this
correctly.

2. Rerun configure. You showed the output of configure script that
showed premium package, so that's done as well.

3. Rebuild and install. I assume you did build (make) and install
(sudo make install) the libraries, right? The exact installation
location depends whether you specified --prefix parameter for
configure script. If you haven't, the default is /usr/local/lib/hooks/.
You can verify the libraries are installed properly with this command:

$ ls -l /usr/local/lib/hooks/*.so

You should see

/usr/local/lib/hooks/libdhcp_flex_id.so
/usr/local/lib/hooks/libdhcp_host_cmds.so
/usr/local/lib/hooks/libdhcp_lease_cmds.so
/usr/local/lib/hooks/libdhcp_legal_log.so

4. Edit your config file to load the libraries you want to use. Please
keep in mind that while host_cmds and legal_log can in general run
without any parameters, the flex_id library has one mandatory parameter
called identifier-expression. If you simply add all three library, this
one will fail to load.

When loading a library, Kea will log the following messages:

INFO  [kea-dhcp4.host_cmds_hooks/19862] HOST_CMDS_INIT_OK loading Host Commands hooks library successful
INFO  [kea-dhcp4.hooks/19862] HOOKS_LIBRARY_LOADED hooks library /usr/local/lib/hooks/libdhcp_host_cmds.so successfully loaded

I edited my config file to match exactly what you specified in your
e-mail and got an error:
ERROR [kea-dhcp4.flex-id/19862] FLEX_ID_EXPRESSION_NOT_DEFINED Expression (identifier-expression) is not defined.
ERROR [kea-dhcp4.hooks/19862] HOOKS_LOAD_ERROR 'load' function in hook library /usr/local/lib/hooks/libdhcp_flex_id.so returned error 1

Ten the following errors are printed:

ERROR [kea-dhcp4.dhcp4/20144] DHCP4_PARSER_COMMIT_FAIL parser failed to commit changes: One or more hook libraries failed to load
ERROR [kea-dhcp4.dhcp4/20144] DHCP4_CONFIG_LOAD_FAIL configuration error using file: /tmp/hooks.json, reason: One or more hook libraries failed to load
ERROR [kea-dhcp4.dhcp4/20144] DHCP4_INIT_FAIL failed to initialize Kea server: configuration error using file '/tmp/hooks.json': One or more hook libraries failed to load

That's because of the aforementioned identifier-expression being
mandatory parameter is not specified in your config file. If you don't
know what identifier-expression to use, you likely don't need flex-id yet.

Another problem in the config file you showed in your mail from Feb. 21st
is that you have trailing comas aftee each library name. with the
parameters commented out and a coma in previous line, the config file
is not a valid JSON and Kea would refuse to load it.

Are you sure this is the config file you're trying to load? Kea should
refuse it. Maybe Kea starts with a different config and you're simply
editing wrong file?

Can you confirm that your log file indeed has lines with
HOST_CMDS_INIT_OK and HOOKS_LIBRARY_LOADED? Please keep in mind that
both of those are printed on INFO level, so unless you have very quiet
logging setup, you should see them. If in doubt, simply comment out
all logging in your config file, so Kea will fall back to its default
logging level, which is to print INFO messages on the standard output.
You should see those logs in your console.

5. If the library is indeed loaded and you still don't see the commands,
there is something weird. It's hard for me to speculate what's going
on in here, but here are couple ideas. Are you sure you have only one
Kea instance running? Perhaps you have one installed from your Linux
distro and another one compiled from sources? Those two would use
different locations of the config file. Perhaps your ctrl-agent
connected to the wrong instance?

You should also verify that the config file you are editing has
control socket specified. It's an entry similar to this:

   "control-socket": {
        "socket-type": "unix",
        "socket-name": "/tmp/kea4-ctrl-socket"
    },

As a debugging measure you may bypass the whole control agent and talk
to Kea directly over Unix socket, e.g. using socat tool:

# echo '{ "command": "list-commands" }' | socat - UNIX:/tmp/kea4-ctrl-socket

Does the response to this lists the reservation-* commands?
If not, we will continue investigating.
If yes, great!

No matter what the outcome is, I'd appreciate a lot if you let us know
how did it go.

On a related note, we need to describe the installation procedure
better. I'll make sure that is taken care of.

hope that helps,
Tomek Mrugalski
ISC
_______________________________________________
Kea-users mailing list
[hidden email]
https://lists.isc.org/mailman/listinfo/kea-users