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

Doesn't build against Kea 1.6 #15

Closed dmcken closed 4 years ago

dmcken commented 5 years ago

Good Day,

Installed Kea from the package repo at cloudsmith.

Attempted to compile this hook and got "kea-msg-compiler: command not found", seems this is no longer included in 1.6 to get it I had to download the 1.5 tarball and compile to get the command (after trying the 1.6 tarball and compiling that).

Attempting to compile against the 1.6 headers yields the following:

airlink@dhcp001:~/kea-hook-runscript$ make /home/airlink/kea-1.5.0/src/lib/log/compiler/kea-msg-compiler -d src/ src/messages.mes touch s-messages g++ -MMD -MP -c -I /usr/include/kea -fPIC -Wno-deprecated -std=c++11 -o src/messages.o src/messages.cc g++ -MMD -MP -c -I /usr/include/kea -fPIC -Wno-deprecated -std=c++11 -o src/logger.o src/logger.cc g++ -MMD -MP -c -I /usr/include/kea -fPIC -Wno-deprecated -std=c++11 -o src/load.o src/load.cc g++ -MMD -MP -c -I /usr/include/kea -fPIC -Wno-deprecated -std=c++11 -o src/runscript.o src/runscript.cc g++ -MMD -MP -c -I /usr/include/kea -fPIC -Wno-deprecated -std=c++11 -o src/callouts.o src/callouts.cc src/callouts.cc: In function ‘void extract_lease4(std::vector<std::cxx11::basicstring >&, isc::dhcp::Lease4Ptr)’: src/callouts.cc:158:69: error: ‘struct isc::dhcp::Lease4’ has no member named ‘t1’ env.push_back("KEA_LEASE4_RENEW_TIMER=" + std::tostring(lease->t1)); ^~~ src/callouts.cc:159:70: error: ‘struct isc::dhcp::Lease4’ has no member named ‘t2_’ env.push_back("KEA_LEASE4_REBIND_TIMER=" + std::tostring(lease->t2)); ^~~ src/callouts.cc: In function ‘void extract_lease6(std::vector<std::cxx11::basicstring >&, isc::dhcp::Lease6Ptr)’: src/callouts.cc:178:69: error: ‘struct isc::dhcp::Lease6’ has no member named ‘t1’ env.push_back("KEA_LEASE6_RENEW_TIMER=" + std::tostring(lease->t1)); ^~~ src/callouts.cc:179:70: error: ‘struct isc::dhcp::Lease6’ has no member named ‘t2_’ env.push_back("KEA_LEASE6_REBIND_TIMER=" + std::tostring(lease->t2)); ^~~ Makefile:15: recipe for target 'src/callouts.o' failed make: *** [src/callouts.o] Error 1

Compiling against the 1.5 code works and generates the kea-hook-runscript.so file but it doesn't load into the 1.6 server. Error is as follows:

DHCP4_CONFIG_LOAD_FAIL configuration error using file: /etc/kea/kea-dhcp4.conf, reason: hooks libraries failed to validate

zorun commented 4 years ago

The build issue is fixed by #16, but the issue with missing kea-msg-compiler is not, so reopening.

zorun commented 4 years ago

@dmcken which OS are you using, and how are you building Kea 1.6?

I see no change related to kea-msg-compiler between Kea 1.5 and Kea 1.6.

zorun commented 4 years ago

Ah, I now see that you mention you use a Kea package produced by ISC. It is possible that ISC decided not to include kea-msg-compiler in their packages. It is normally included by default, as evidenced by the Debian and Arch Linux packages:

https://packages.debian.org/sid/amd64/kea-common/filelist https://www.archlinux.org/packages/community/x86_64/kea/

So, please ask ISC about this (and point out to them that you need this program in their packages), or use the 1.6 tarball just for kea-msg-compiler.

zorun commented 4 years ago

To workaround this issue, I am now generating tarball releases with pre-built messages, so that you don't need kea-msg-compiler when building.

Have a look at the 1.3.1 tarball and build instructions in README.