[Kea-users] flex_id hook with multiple expressions
Andreas
ml+dhcp at tibdefender.com
Tue Oct 7 14:22:53 UTC 2025
Dear list,
we are trying to match multiple combinations of Agent Remote-ID and
Circuit-ID for host reservations with the flex_id hook.
This is meant to match end customers over a whole bunch of solutions and
hardware platforms where we can’t streamline the available DHCP options
to one common expression.
Possible Remote-ID/Circuit-ID combinations:
1)
Remote-ID: 58:ac:78:cf:3a:c0
Circuit-ID: 01:9f:02:17
Concatenated String for Host Reservations: 58:ac:78:cf:3a:c0:01:9f:02:17
"identifier-expression": "concat(relay4[2].hex,relay4[1].hex)"
2)
Remote-ID: NAME_DEU.LINED.0000012345
Circuit-ID: olt1.lhn-004:1-1-01-09-16.414
Concateanted String for Host Reservations: NAME_DEU.LINED.0000012345-414
"identifier-expression": "concat(concat(relay4[2].hex,'-'),
substring(relay4[1].hex, -3, 3))"
We then tried several options to get that working with the
„identifier-expression“ parameter:
Using „or“ to differentiate between the two possibilities according to
https://kea.readthedocs.io/en/kea-3.0.1/arm/classify.html#classification-using-expressions
"identifier-expression": "concat(concat(relay4[2].hex,'-'),
substring(relay4[1].hex, -3, 3)) or concat(relay4[2].hex,relay4[1].hex)"
by specifying multiple expression in separate lines:
"identifier-expression": "concat(concat(relay4[2].hex,'-'),
substring(relay4[1].hex, -3, 3))“,
"identifier-expression": "concat(relay4[2].hex,relay4[1].hex)"
and then by adding the hook library two times:
{
"library": "/usr/lib/x86_64-linux-gnu/kea/hooks/libdhcp_flex_id.so",
"parameters": {
"identifier-expression": "concat(relay4[2].hex,relay4[1].hex)"
}
},
{
"library": "/usr/lib/x86_64-linux-gnu/kea/hooks/libdhcp_flex_id.so",
"parameters": {
"identifier-expression": "concat(concat(relay4[2].hex,'-'),
substring(relay4[1].hex, -3, 3))“
}
},
For the last two possible solutions kea only used the last definition of
the hook or the „identifier-expression" parameter. And for the first one
it simply doesn’t match.
Are there any ways to specify multiple expressions to match with the
flex_id hook?
Thanks in advance
BR
Andreas
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.isc.org/pipermail/kea-users/attachments/20251007/927976c7/attachment-0001.htm>
More information about the Kea-users
mailing list