[Kea-users] Problem when using libdhcp_subnet_cmds.so in kea 2.7.7
Darren Ankney
darren.ankney at gmail.com
Sat Apr 19 09:40:05 UTC 2025
Hello,
That is indeed true. The API will write out a complex file. This is
because Kea is dumping the configuration from memory, which includes
all of the defaults. There isn't a way around this that I am aware
of.
Thank you,
Darren Ankney
On Mon, Apr 14, 2025 at 10:01 AM tachibanashita at outlook.com
<tachibanashita at outlook.com> wrote:
>
> Hi Darren,
>
> I have tested config-write and it worked. But I do notice the generated json file includes all the default parameters. It’s not as clear as your conf file. I am wondering if you have some helper code which can convert between them?
>
>
>
> Best,
> Yu
>
>
> On Apr 14, 2025, at 8:04 AM, tachibanashita at outlook.com wrote:
>
> Make sense, let me test on it. Thank you, Darren!
>
>
>
>
> On Apr 13, 2025, at 7:19 AM, Darren Ankney <darren.ankney at gmail.com> wrote:
>
> You will need to perform a config-write to write the changes to the config file. The changes made by API commands are only in memory until a config-write is performed.
>
> On Thu, Apr 10, 2025 at 12:56 PM tachibanashita at outlook.com <tachibanashita at outlook.com> wrote:
>>
>> Hi Razvan,
>>
>>
>> I run the API and now I got the return code “0” which according to the document should mean success. However, when I checked the kea-dhcp6.conf file on the target host, I still see the original configuration. I restarted the kea-dhcp6 service, but the configuration still hasn’t changed. I also tested the “subnet6-del” command and observed the same behaviors.
>>
>> Did I miss something else?
>>
>>
>>
>> ➜ ~ curl -X POST -H "Content-Type: application/json" -d '{ "command": "subnet6-update", "service": ["dhcp6"], "arguments": {"subnet6": [{"id": 1,"subnet": "fd74:5656:15e2:20::/64"}] } }' http://192.168.100.112:8000/ -s | jq
>> [
>> {
>> "arguments": {
>> "subnets": [
>> {
>> "id": 1,
>> "subnet": "fd74:5656:15e2:20::/64"
>> }
>> ]
>> },
>> "result": 0,
>> "text": "IPv6 subnet updated"
>> }
>> ]
>>
>>
>> ➜ ~ curl -X POST -H "Content-Type: application/json" -d '{ "command": "subnet6-del", "service": ["dhcp6"],"arguments": {"id": 1} }' http://192.168.100.112:8000/ -s | jq
>> [
>> {
>> "arguments": {
>> "subnets": [
>> {
>> "id": 1,
>> "subnet": "fd74:5656:15e2:10::/64"
>> }
>> ]
>> },
>> "result": 0,
>> "text": "IPv6 subnet fd74:5656:15e2:10::/64 (id 1) deleted"
>> }
>> ]
>>
>>
>> # Finally, we list the subnets from which we will be leasing addresses.
>> "subnet6": [
>> {
>> "id": 1,
>> "subnet": "fd74:5656:15e2:10::/64",
>> "pools": [
>> {
>> "pool": "fd74:5656:15e2:10::200-fd74:5656:15e2:10::9999"
>> }
>> ],
>> "interface": "ens18"
>> }
>> ],
>>
>>
>>
>>
>> On Apr 10, 2025, at 9:22 AM, Razvan Becheriu <razvan at isc.org> wrote:
>>
>> In this file you can find the CA endpoint : address and port.
>>
>> Please use these for commands.
>>
>> Regards,
>> Razvan
>>
>>
>> ________________________________
>> From: Razvan <razvan at isc.org>
>> To: Kea <kea-users at lists.isc.org>
>> Cc: Kea <kea-users at lists.isc.org>
>> Date: Thursday, 10 April 2025 4:08 PM EEST
>> Subject: Re: [Kea-users] Problem when using libdhcp_subnet_cmds.so in kea 2.7.7
>>
>> can you please attach/paste the content of
>>
>> /etc/kea/kea-ctrl-agent.conf
>>
>>
>> Thank you,
>> Razvan
>>
>> ________________________________
>> From: tachibanashita <tachibanashita at outlook.com>
>> To: Kea <kea-users at lists.isc.org>
>> Date: Thursday, 10 April 2025 3:53 PM EEST
>> Subject: Re: [Kea-users] Problem when using libdhcp_subnet_cmds.so in kea 2.7.7
>>
>> Hi Raven,
>>
>> Thank you for your response! I run the curl command from my laptop which is in the same LAN as both kea hosts, both have the control-agent running. I just tried to put standby node kea02 with .112 IP in “in-maintenance” mode and tried to send API again, but still got the same error.
>>
>>
>>
>> systemctl status kea-ctrl-agent.service
>> ● kea-ctrl-agent.service - Kea Control Agent
>> Loaded: loaded (/usr/lib/systemd/system/kea-ctrl-agent.service; enabled; vendor preset: disabled)
>> Active: active (running) since Tue 2025-04-08 21:04:55 EDT; 1 day 11h ago
>> Docs: man:kea-ctrl-agent(8)
>> Main PID: 1178 (kea-ctrl-agent)
>> Tasks: 1 (limit: 11016)
>> Memory: 8.1M
>> CGroup: /system.slice/kea-ctrl-agent.service
>> └─1178 /usr/sbin/kea-ctrl-agent -c /etc/kea/kea-ctrl-agent.conf
>>
>> ● kea-ctrl-agent.service - Kea Control Agent
>> Loaded: loaded (/usr/lib/systemd/system/kea-ctrl-agent.service; enabled; vendor preset: disabled)
>> Active: active (running) since Tue 2025-04-08 21:12:34 EDT; 1 day 11h ago
>> Docs: man:kea-ctrl-agent(8)
>> Main PID: 2523 (kea-ctrl-agent)
>> Tasks: 1 (limit: 11016)
>> Memory: 2.2M
>> CGroup: /system.slice/kea-ctrl-agent.service
>> └─2523 /usr/sbin/kea-ctrl-agent -c /etc/kea/kea-ctrl-agent.conf
>>
>>
>> ~ curl -X POST -H "Content-Type: application/json" -d '{ "command": "status-get", "service": [ "dhcp6" ] }' http://192.168.100.111:8001/ -s | jq
>> [
>> {
>> "arguments": {
>> "dhcp-state": {
>> "disabled-by-db-connection": [],
>> "disabled-by-local-command": [],
>> "disabled-by-remote-command": [],
>> "disabled-by-user": false,
>> "globally-disabled": false
>> },
>> "extended-info-tables": false,
>> "high-availability": [
>> {
>> "ha-mode": "hot-standby",
>> "ha-servers": {
>> "local": {
>> "role": "primary",
>> "scopes": [
>> "kea01"
>> ],
>> "server-name": "kea01",
>> "state": "partner-in-maintenance",
>> "system-time": "2025-04-10 12:46:22"
>> },
>> "remote": {
>> "age": 1,
>> "analyzed-packets": 0,
>> "clock-skew": 0,
>> "communication-interrupted": false,
>> "connecting-clients": 0,
>> "in-touch": true,
>> "last-scopes": [],
>> "last-state": "in-maintenance",
>> "role": "standby",
>> "server-name": "kea02",
>> "system-time": "2025-04-10 12:46:22",
>> "unacked-clients": 0,
>> "unacked-clients-left": 0
>> }
>> }
>> }
>> ],
>> "multi-threading-enabled": true,
>> "packet-queue-size": 64,
>> "packet-queue-statistics": [
>> 1.0,
>> 0.999629,
>> 0.546155
>> ],
>> "pid": 3342,
>> "reload": 124098,
>> "sockets": {
>> "status": "ready"
>> },
>> "thread-pool-size": 4,
>> "uptime": 124098
>> },
>> "result": 0
>> }
>> ]
>> ➜ ~ curl -X POST -H "Content-Type: application/json" -d '{ "command": "subnet6-del", "arguments": {"id": 1} }' http://192.168.100.112:8001/ -s | jq
>> [
>> {
>> "result": 1,
>> "text": "invalid thread pool state change to paused performed by worker thread"
>> }
>> ]
>> ➜ ~ curl -X POST -H "Content-Type: application/json" -d '{ "command": "subnet6-del", "arguments": {"id": 1} }' http://192.168.100.111:8001/ -s | jq
>> [
>> {
>> "result": 1,
>> "text": "invalid thread pool state change to paused performed by worker thread"
>> }
>> ]
>>
>>
>>
>>
>> On Apr 9, 2025, at 11:40 PM, Razvan Becheriu <razvan at isc.org> wrote:
>> Hi,
>>
>> I think you are sending the command to the HA endpoint. That is reserved for HA commands.
>>
>> Please use the control channel endpoint or CA endpoint instead.
>>
>> Regards,
>> Razvan
>>
>>
>> ________________________________
>> From: tachibanashita <tachibanashita at outlook.com>
>> To: kea-users <kea-users at lists.isc.org>
>> Date: Wednesday, 9 April 2025 9:28 PM EEST
>> Subject: [Kea-users] Problem when using libdhcp_subnet_cmds.so in kea 2.7.7
>>
>> Greetings,
>>
>>
>> I have upgraded my kea lab from 2.6.1 to 2.7.7 and installed the package for hooks. Now I am testing the libdhcp_subnet_cmds.so library.
>>
>> But I found that I could only run those status check commands successfully, but I am not able to modify any configurations as you can see the examples below. It happened to all the commands which could modify the configuration.
>>
>> I adjusted the format of my arguments to match the example in your document, but it didn’t work. I added the -u option to curl as the root user, but still not working. Instead of running the curl command remotely, I run it in the same Linux host but still the same. I tried to Google this error but couldn’t find any match including your kea message documentation. I run the curl command against both primary and standby nodes, but still not working.
>>
>> When I used -v mode for curl command, I can see it does return code 200, so I don’t think it’s other issue than kea hook function itself.
>>
>> Can you let me know if I missed anything?
>>
>>
>>
>>
>> Successful tests:
>>
>> ➜ ~ curl -X POST -H "Content-Type: application/json" -d '{ "command": "subnet6-list" }' http://192.168.100.111:8001/ -s | jq
>> [
>> {
>> "arguments": {
>> "subnets": [
>> {
>> "id": 1,
>> "subnet": "ff12:5656:15e2:10::/64"
>> }
>> ]
>> },
>> "result": 0,
>> "text": "1 IPv6 subnet found"
>> }
>> ]
>>
>> Unsuccessful tests:
>>
>> ➜ ~ curl -X POST -H "Content-Type: application/json" -d '{ "command": "subnet6-del", "arguments": {"id": 1} }' http://192.168.100.111:8001/ -s | jq
>> [
>> {
>> "result": 1,
>> "text": "invalid thread pool state change to paused performed by worker thread"
>> }
>> ]
>>
>> ➜ ~ curl -X POST -H "Content-Type: application/json" -d '{ "command": "subnet6-add", "arguments": {"subnet6": [{"id": 2,"subnet": "ff12:5656:15e2:10::/64"}] } }' http://192.168.100.111:8001/ -s | jq
>> [
>> {
>> "result": 1,
>> "text": "invalid thread pool state change to paused performed by worker thread"
>> }
>> ]
>> ➜ ~ curl -X POST -H "Content-Type: application/json" -d '{ "command": "subnet6-update", "arguments": {"subnet6": [{"id": 1,"subnet": "ff12:5656:15e2:20::/64"}] } }' http://192.168.100.111:8001/ -s | jq
>> [
>> {
>> "result": 1,
>> "text": "invalid thread pool state change to paused performed by worker thread"
>> }
>> ]
>>
>> Verbose mode:
>> ➜ ~ curl -v -X POST -H "Content-Type: application/json" -d '{ "command": "subnet6-update", "arguments": {"id": 1} }' http://192.168.100.112:8001/ -s | jq
>> * Trying 192.168.100.112:8001...
>> * Connected to 192.168.100.112 (192.168.100.112) port 8001
>> > POST / HTTP/1.1
>> > Host: 192.168.100.112:8001
>> > User-Agent: curl/8.7.1
>> > Accept: */*
>> > Content-Type: application/json
>> > Content-Length: 56
>> >
>> } [56 bytes data]
>> * upload completely sent off: 56 bytes
>> < HTTP/1.1 200 OK
>> < Content-Length: 100
>> < Content-Type: application/json
>> < Date: Wed, 09 Apr 2025 18:21:37 GMT
>> <
>> { [100 bytes data]
>> * Connection #0 to host 192.168.100.112 left intact
>> [
>> {
>> "result": 1,
>> "text": "invalid thread pool state change to paused performed by worker thread"
>> }
>> ]
>>
>>
>>
>> Best Regards,
>> Yu
>>
>>
>> --
>> ISC funds the development of this software with paid support subscriptions. Contact us at https://www.isc.org/contact/ for more information.
>>
>> To unsubscribe visit https://lists.isc.org/mailman/listinfo/kea-users.
>>
>> Kea-users mailing list
>> Kea-users at lists.isc.org
>> https://lists.isc.org/mailman/listinfo/kea-users
>>
>> --
>> ISC funds the development of this software with paid support subscriptions. Contact us at https://www.isc.org/contact/ for more information.
>>
>> To unsubscribe visit https://lists.isc.org/mailman/listinfo/kea-users.
>>
>> Kea-users mailing list
>> Kea-users at lists.isc.org
>> https://lists.isc.org/mailman/listinfo/kea-users
>>
>>
>> --
>> ISC funds the development of this software with paid support subscriptions. Contact us at https://www.isc.org/contact/ for more information.
>>
>> To unsubscribe visit https://lists.isc.org/mailman/listinfo/kea-users.
>>
>> Kea-users mailing list
>> Kea-users at lists.isc.org
>> https://lists.isc.org/mailman/listinfo/kea-users
>
> --
> ISC funds the development of this software with paid support subscriptions. Contact us at https://www.isc.org/contact/ for more information.
>
> To unsubscribe visit https://lists.isc.org/mailman/listinfo/kea-users.
>
> Kea-users mailing list
> Kea-users at lists.isc.org
> https://lists.isc.org/mailman/listinfo/kea-users
>
>
> --
> ISC funds the development of this software with paid support subscriptions. Contact us at https://www.isc.org/contact/ for more information.
>
> To unsubscribe visit https://lists.isc.org/mailman/listinfo/kea-users.
>
> Kea-users mailing list
> Kea-users at lists.isc.org
> https://lists.isc.org/mailman/listinfo/kea-users
>
>
> --
> ISC funds the development of this software with paid support subscriptions. Contact us at https://www.isc.org/contact/ for more information.
>
> To unsubscribe visit https://lists.isc.org/mailman/listinfo/kea-users.
>
> Kea-users mailing list
> Kea-users at lists.isc.org
> https://lists.isc.org/mailman/listinfo/kea-users
More information about the Kea-users
mailing list