zorun / kea-hook-runscript

This a hook for the Kea DHCP server that allows to run an external script at various points in the processing of DHCP requests and responses.
Mozilla Public License 2.0
54 stars 23 forks source link

Any chance to get this working on kea-dhcp 1.8.0? #21

Closed Talkabout closed 4 years ago

Talkabout commented 4 years ago

Hi,

I am using this hook in my environment and on 1.6.2 it was working great. Unfortunately I am not able to get it run on 1.8.0. I am getting an error that "hook library cannot be validated". Further details in the log:

17:19:56.112 kea-dhcp4.hooks HOOKS_OPEN_ERROR failed to open hook library /usr/local/lib/kea/hooks/kea-hook-runscript.so: /usr/local/lib/kea/hooks/kea-hook-runscript.so: undefined symbol: _ZN3isc3log23checkExcessPlaceholdersEPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEj 17:19:56.112 kea-dhcp4.dhcp4 DHCP4_PARSER_FAIL failed to create or run parser for configuration element hooks-libraries: hooks libraries failed to validate - library or libraries in error are: /usr/local/lib/kea/hooks/kea-hook-runscript.so(/usr/local/etc/kea/kea-dhcp4.conf:179:3)

Any idea why it does not work although compiles fine?

Thanks!

Bye

zorun commented 4 years ago

The newest Kea version with which this hook is known to work is 1.6.

But first, are you sure that you compiled the hook with the same version of Kea you are running?

The failing symbol looks like it's checkExcessPlaceholders in src/lib/log/log_formatter.cc. This code has been here for 8 years, so it's strange it should fail now. These are the last changes to this code in Kea: https://gitlab.isc.org/isc-projects/kea/-/issues/1266 and https://gitlab.isc.org/isc-projects/kea/-/merge_requests/807

Talkabout commented 4 years ago

Well, I am sure to have it compiled with the same version, but I am not sure that I have done the cleanup correctly beforehand (moving from 1.6.2 to 1.8.0). Thanks for the information, I will try to compile it again from scratch, maybe it will work then.

Talkabout commented 4 years ago

Executed "make distclean", compiled again and now the hook is loaded properly. Thanks for your support on that!

zorun commented 4 years ago

Great! Everything works fine with Kea 1.8.0 then?

Talkabout commented 4 years ago

It seems so at the moment, but I have to verify that again because currently I am setting up the cluster environment with multiple servers. After that I should be able to give a final statement.

Talkabout commented 4 years ago

I have checked again and the script is executed correctly, so from my point of view everything is working. Thanks!

Talkabout commented 4 years ago

One more thing: the hook runs only fine if kea-dhcp server is running single threaded. When trying to use multi-threading

"multi-threading": { "enable-multi-threading": true, "thread-pool-size": 4, "packet-queue-size": 16 }

the hook fails to load. I assume that for multi threading support the implementation needs to be adjusted.

Bye

zorun commented 4 years ago

Yes, hooks need to explicitly signal support for multi-threading. At first glance it doesn't look safe to do this by default for this hook, but I'm open to suggestions if people need this.

Thanks for the feedback about 1.8!