[Kea-users] Combining class definitions with or/and operands
mxhajduczenia at gmail.com
mxhajduczenia at gmail.com
Wed May 1 00:44:54 UTC 2024
Just a foreword, I am experimenting with the class definitions and different
test structures, since the examples provided in the official documentation
are very limited. Specifically, I created these match conditions, and they
seem to work just fine
"client-classes": [
{
"name": "CTS19-RPDs",
"test": "pkt4.mac == 0x0020a361415b or pkt4.mac ==
0x001848fe8f35"
},
{
"name": "CTS17-RPDs",
"test": "(pkt4.mac == 0x0020a3283bfb) or (pkt4.mac ==
0x0020a3263a4b) or (pkt4.mac == 0x0020a3263a6b) or (pkt4.mac ==
0x0020a35a1b0b)"
},
{
"name": "CTS18-RPDs",
"test": "(pkt4.mac == 0x0020a325c53b) or (pkt4.mac ==
0x0018480ae57d) or (pkt4.mac == 0x0020a32b08bb) or (pkt4.mac ==
0x0020a328e02b) or (pkt4.mac == 0x0020a357fc6b) or (pkt4.mac ==
0x0020a358a5bb) or (pkt4.mac == 0x0020a35eb56b) or (pkt4.mac ==
0x0020a35ecadb) or (pkt4.mac == 0x0018480ae35f) or (pkt4.mac ==
0x0018480ae903) or (pkt4.mac == 0x0020a35dfb3b) or (pkt4.mac ==
0x0020a380378b) or (pkt4.mac == 0x0020a34f93cb)"
}
],
As you can see, the test structure seems to not care for brackets () or not,
and does the matching well even with very long conditions.
Where the question comes is with the "client-class" statement in individual
pool / subnet definitions. In the following example, the client class
statement contains an 'or' combination for three different classes defined
before. It parses fine, but . it does not seem to work. All examples I can
find show a single entry in the client-class, but I am wondering whether the
example below is a mistake and the parser should throw an error or not. I do
know I can create another class that combines three previous classes into
one, but I find this cleaner to read, where the match in client-class is
performed on and/or combined structure of different atomic classes.
{
"id": 1,
"subnet": "172.27.60.16/28",
"relay": {
"ip-addresses": [ "172.27.60.17" ]
},
"pools": [
{
"pool": "172.27.60.18 - 172.27.60.30",
"client-class": "CTS19-RPDs or CTS18-RPDs or
CTS17-RPDs"
}
],
"option-data": [
{
"space": "dhcp4",
"name": "subnet-mask",
"code": 1,
"data": "255.255.255.240"
},
{
"space": "dhcp4",
"name": "routers",
"code": 3,
"data": "172.27.60.17"
},
{
"space": "dhcp4",
"name": "vendor-encapsulated-options",
"code": 43,
"csv-format": false,
"data": "3d04ac1b3d04"
}
]
},
Is the above shown "client-class" match condition a valid example and should
it work?
Regards
Marek
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.isc.org/pipermail/kea-users/attachments/20240430/e1d04696/attachment.htm>
More information about the Kea-users
mailing list