zorun/kea-hook-runscript

Unable to run the hook with debian stretch

erotel opened this issue · 7 comments

hello I tried to assemble according to the instructions. The build will be fine, but when I run a kea server it reports an error.

root@ipv6-dhcp-test:~/kea-hook-runscript-master# make g++ -o kea-hook-runscript.so -I ~/kea/src/lib -fPIC -Wno-deprecated -L /usr/local/lib -shared -lkea-dhcpsrv -lkea-dhcp++ -lkea-hooks -lkea-log -lkea-util -lkea-exceptions src/messages.o src/logger.o src/load.o src/runscript.o src/callouts.o src/version.o

root@ipv6-dhcp-test:~/kea-hook-runscript-master# /usr/local/sbin/kea-dhcp6 -c /root/kea-config/kea-test2.conf
2017-10-30 15:29:34.717 INFO  [kea-dhcp6.dhcp6/1665] DHCP6_STARTING Kea DHCPv6 server version 1.2.0 starting
2017-10-30 15:29:34.718 ERROR [kea-dhcp6.hooks/1665] HOOKS_OPEN_ERROR failed to open hook library /usr/local/lib/kea-hook-runscript.so: /usr/local/lib/kea-hook-runscript.so: undefined symbol: _ZN3isc3log6Logger6outputERKNS0_8SeverityERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE
2017-10-30 15:29:34.719 ERROR [kea-dhcp6.dhcp6/1665] DHCP6_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-hook-runscript.so(/root/kea-config/kea-test2.conf:9:3)
2017-10-30 15:29:34.719 ERROR [kea-dhcp6.dhcp6/1665] DHCP6_CONFIG_LOAD_FAIL configuration error using file: /root/kea-config/kea-test2.conf, reason: hooks libraries failed to validate - library or libraries in error are: /usr/local/lib/kea-hook-runscript.so(/root/kea-config/kea-test2.conf:9:3)
2017-10-30 15:29:34.719 ERROR [kea-dhcp6.dhcp6/1665] DHCP6_INIT_FAIL failed to initialize Kea server: configuration error using file '/root/kea-config/kea-test2.conf': hooks libraries failed to validate - library or libraries in error are: /usr/local/lib/kea-hook-runscript.so(/root/kea-config/kea-test2.conf:9:3)


root@ipv6-dhcp-test:~/kea-hook-runscript-master# uname -a
Linux ipv6-dhcp-test 4.9.0-4-amd64 #1 SMP Debian 4.9.51-1 (2017-09-28) x86_64 GNU/Linux

root@ipv6-dhcp-test:~/kea-hook-runscript-master# g++ -v
Using built-in specs.
COLLECT_GCC=g++
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/6/lto-wrapper
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Debian 6.3.0-18' --with-bugurl=file:///usr/share/doc/gcc-6/README.Bugs --enable-languages=c,ada,c++,java,go,d,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-6 --program-prefix=x86_64-linux-gnu- --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-vtable-verify --enable-libmpx --enable-plugin --enable-default-pie --with-system-zlib --disable-browser-plugin --enable-java-awt=gtk --enable-gtk-cairo --with-java-home=/usr/lib/jvm/java-1.5.0-gcj-6-amd64/jre --enable-java-home --with-jvm-root-dir=/usr/lib/jvm/java-1.5.0-gcj-6-amd64 --with-jvm-jar-dir=/usr/lib/jvm-exports/java-1.5.0-gcj-6-amd64 --with-arch-directory=amd64 --with-ecj-jar=/usr/share/java/eclipse-ecj.jar --with-target-system-zlib --enable-objc-gc=auto --enable-multiarch --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu
Thread model: posix
gcc version 6.3.0 20170516 (Debian 6.3.0-18)

root@ipv6-dhcp-test:~/kea-hook-runscript-master# /usr/local/sbin/kea-dhcp6 -v
1.2.0

zorun commented

@erotel it looks like you built Kea 1.2.0 yourself. Did you build the hook against Kea 1.1.0 from the Debian package or against your local Kea 1.2.0 install?

See the README, you may need to set environment variables KEA_INCLUDE, KEA_LIB and KEA_MSG_COMPILER to point to your Kea installation.

Im build from local Kea 1.2.0.

KEA_MSG_COMPILER = ~/kea/src/lib/log/compiler/kea-msg-compiler
KEA_INCLUDE = ~/kea/src/lib
KEA_LIB = /usr/local/lib

zorun commented

Ok, I haven't tested with Kea 1.2.0 in a while, I will give it a try at some point.

Can you maybe try with Kea 1.3.0, which was just released?

root@ipv6-dhcp-test:~/kea-hook-runscript-master# /usr/local/sbin/kea-dhcp6 -c /root/kea-config/kea-test2.conf
2017-10-31 19:22:27.848 INFO  [kea-dhcp6.dhcp6/28662] DHCP6_STARTING Kea DHCPv6 server version 1.3.0 starting
2017-10-31 19:22:27.849 ERROR [kea-dhcp6.hooks/28662] HOOKS_INCORRECT_VERSION hook library /usr/local/lib/kea-hook-runscript.so is at version 4, require version 5
2017-10-31 19:22:27.850 ERROR [kea-dhcp6.dhcp6/28662] DHCP6_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-hook-runscript.so(/root/kea-config/kea-test2.conf:9:3)
2017-10-31 19:22:27.850 ERROR [kea-dhcp6.dhcp6/28662] DHCP6_CONFIG_LOAD_FAIL configuration error using file: /root/kea-config/kea-test2.conf, reason: hooks libraries failed to validate - library or libraries in error are: /usr/local/lib/kea-hook-runscript.so(/root/kea-config/kea-test2.conf:9:3)
2017-10-31 19:22:27.850 ERROR [kea-dhcp6.dhcp6/28662] DHCP6_INIT_FAIL failed to initialize Kea server: configuration error using file '/root/kea-config/kea-test2.conf': hooks libraries failed to validate - library or libraries in error are: /usr/local/lib/kea-hook-runscript.so(/root/kea-config/kea-test2.conf:9:3)
root@ipv6-dhcp-test:~/kea-hook-runscript-master# cat /root/kea-config/kea-test2.conf
{
    "Dhcp6": {


        "renew-timer": 100,
        "rebind-timer": 200,
        "preferred-lifetime": 300,
        "valid-lifetime": 400,
         "hooks-libraries": [
            {
              "library": "/usr/local/lib/kea-hook-runscript.so",
                "parameters": {
                "script": "/root/bebug.sh"
                  }
            }
        ],
        "lease-database": {
            "type": "memfile",
            "persist": true,
            "name": "/tmp/kea-leases6.csv",
            "lfc-interval": 1800
        },
        "interfaces-config": {
            "interfaces": [  "vlan1011/2a07:9c0:1:1:216:3eff:fe23:b111" ]
        },
        "option-data": [ {
        "name": "dns-servers",
        "data": "2001:db8::1, 2001:db8::2"
         } ],
        "mac-sources": ["duid"],
        "subnet6": [
            {
                "subnet": "2001:db8::/64",
                "id": 1024,
                "interface" : "vlan1011",
                "pools": [
                    { "pool": "2001:db8::100-2001:db8::ffff" }
                ],
                "pd-pools": [
                    {
                        "prefix": "2a07:9c0:6701::",
                        "prefix-len": 48,
                        "delegated-len": 56
                    }
                ],
                "reservations": [
                    {
                        "hw-address": "00:0C:42:A1:AB:79",
                    "prefixes": [ "2a07:9c0:6701:0800::/56" ]

                    },
                    {
                        "hw-address": "00:0C:42:96:C5:87",
                    "prefixes": [ "2a07:9c0:6701::/56" ]

                    },
                    {
                        "hw-address": "18:D6:C7:51:ED:3B",
                    "prefixes": [ "2a07:9c0:6701:200::/56" ]

                    }


                ]
            }
        ]
    },

"Logging": {
    "loggers": [
        {
            "name": "kea-dhcp6.packets",
            "output_options": [
                {
                    "output": "/var/log/kea-debug.log",
                    "maxver": 8,
                    "maxsize": 204800,
                    "flush": true
                }
            ],
            "severity": "DEBUG",
            "debuglevel": 99
        },
        {
            "name": "kea-dhcp6.leases",
            "output_options": [
                {
                    "output": "stdout"
                }
            ],
            "severity": "INFO",
            "debuglevel": 99
        }

   ]
}



}

now im test in debian jessie,compile in local kea v 1.3.0
test default config /kea-hook-runscript-master/examples/slash32_leases/kea-dhcp4.conf

root@ipv6-dhcp-server:~/kea-config# /usr/local/sbin/kea-dhcp4 -c /root/kea-config/kea-dhcp4.conf
2017-11-02 11:51:25.597 INFO  [kea-dhcp4.dhcp4/12049] DHCP4_STARTING Kea DHCPv4 server version 1.3.0 starting
2017-11-02 11:51:25.598 ERROR [kea-dhcp4.hooks/12049] HOOKS_OPEN_ERROR failed to open hook library /usr/local/lib/hooks/kea-hook-runscript.so: /usr/local/lib/hooks/kea-hook-runscript.so: undefined symbol: _ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED1Ev
2017-11-02 11:51:25.598 ERROR [kea-dhcp4.dhcp4/12049] 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/hooks/kea-hook-runscript.so(/root/kea-config/kea-dhcp4.conf:8:3)
2017-11-02 11:51:25.599 ERROR [kea-dhcp4.dhcp4/12049] DHCP4_CONFIG_LOAD_FAIL configuration error using file: /root/kea-config/kea-dhcp4.conf, reason: hooks libraries failed to validate - library or libraries in error are: /usr/local/lib/hooks/kea-hook-runscript.so(/root/kea-config/kea-dhcp4.conf:8:3)
2017-11-02 11:51:25.599 ERROR [kea-dhcp4.dhcp4/12049] DHCP4_INIT_FAIL failed to initialize Kea server: configuration error using file '/root/kea-config/kea-dhcp4.conf': hooks libraries failed to validate - library or libraries in error are: /usr/local/lib/hooks/kea-hook-runscript.so(/root/kea-config/kea-dhcp4.conf:8:3)

zorun commented

Closing because it's been 3 years, and stretch is now oldstable.