[Kea-users] flex-id reservation from db
Marcin Jurczuk
spock at omegastar.eu
Thu Nov 20 20:16:50 UTC 2025
I noticed DEBUG log saying:
DEBUG FLEX_ID_NO_IDENTIFIER_EXPRESSION identifier-expression is either not
specified or empty
How is this possible ?
czw., 20 lis 2025 o 21:03 Marcin Jurczuk <spock at omegastar.eu> napisał(a):
> Hi,
>
>
> I'm trying to have flex-id reservation based on option 82.1. I can't
> force KEA to do correct loopup in DB. I've enabled postgresql query
> snooping and I don't see correct query:
>
> Here is my setup:
> ..
> {
> "library": "/usr/lib/kea/hooks/libdhcp_flex_id.so",
> "parameters": {
> "identifier-expression": "substring(relay4[1].text, 0, 12)",
> "replace-client-id": true
> }
> }
>
> "host-reservation-identifiers": [ "hw-address", "duid", "circuit-id",
> "client-id", "flex-id" ],
>
> I've added reservation via API:
> {
> "command": "reservation-add",
> "arguments": {
> "operation-target":"database",
> "reservation": {
> "flex-id": "'DSNGCF232E15'"
> }
> }
> }
>
> I see it reservation in db table after adding it
> SQL logging shows number of queries like this;
> postgres-1 | 2025-11-20 19:56:40 UTC [361]: [59-1]
> user=kea,db=keadhcp,app=[unknown],client=172.18.0.8 DETAIL: parameters: $1
> = '0', $2 = '0', $3 = '\x04f41c435c8c'
> postgres-1 | 2025-11-20 19:56:40 UTC [361]: [60-1]
> user=kea,db=keadhcp,app=[unknown],client=172.18.0.8 LOG: execute
> get_host_subid4_dhcpid: SELECT h.host_id, h.dhcp_identifier,
> h.dhcp_identifier_type, h.dhcp4_subnet_id, h.dhcp6_subnet_id,
> h.ipv4_address, h.hostname, h.dhcp4_client_classes,
> h.dhcp6_client_classes, h.user_context, h.dhcp4_next_server,
> h.dhcp4_server_hostname, h.dhcp4_boot_file_name, h.auth_key,
> o.option_id, o.code, o.value, o.formatted_value, o.space, o.persistent,
> o.cancelled, o.user_context, o.client_classes FROM hosts AS h LEFT JOIN
> dhcp4_options AS o ON h.host_id = o.host_id WHERE h.dhcp4_subnet_id = $1
> AND h.dhcp_identifier_type = $2 AND h.dhcp_identifier = $3 ORDER BY
> h.host_id, o.option_id
>
> $2 parameter (h.dhcp_identifier_type) is tested by lea only for 0,2,3 -
> flex_id is 4..
>
> Am I missing something else ?
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.isc.org/pipermail/kea-users/attachments/20251120/9079095f/attachment.htm>
More information about the Kea-users
mailing list