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

Tomek Mrugalski tomasz at isc.org
Tue Feb 27 21:04:27 UTC 2018


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



More information about the Kea-users mailing list