Associate option 43, code 1 with a client class using Postgres
Hi all, I am setting up ubnt.unifi-address vendor-specific option with Postgres; everything works as expected if the configuratiion is "hardcoded" in the configuration file, like here:
"option-def": [
{
"name": "unifi-address",
"code": 1,
"space": "ubnt",
"type": "ipv4-address",
"array": false
}
],
"client-classes": [
{
"name": "ubnt",
"test": "option[vendor-class-identifier].text == 'ubnt'",
"option-def": [
{
"name": "vendor-encapsulated-options",
"code": 43,
"space": "dhcp4",
"type": "empty",
"encapsulate": "ubnt"
}
],
"option-data": [
{
"name": "unifi-address",
"space": "ubnt",
"data": "123.123.123.123"
},
{
"name": "vendor-encapsulated-options"
}
]
}
],
Additionally, if I have this configuration in the database the option is also sent, but it's sent regardless if the client matches the client-class:
keadb=# select * from dhcp4_option_def;
id | code | name | space | type | modification_ts | is_array | encapsulate | record_types | user_context | class_id
----+------+-----------------------------+-------+------+-------------------------------+----------+-------------+--------------+--------------+----------
3 | 1 | unifi-address | ubnt | 10 | 2024-02-06 09:35:01.055685+00 | f | | | |
4 | 43 | vendor-encapsulated-options | dhcp4 | 0 | 2024-02-07 08:47:48.873602+00 | f | ubnt | | |
(2 rows)
keadb=# select * from dhcp4_option_def_server;
option_def_id | server_id | modification_ts
---------------+-----------+-------------------------------
3 | 1 | 2024-02-06 10:18:21.478424+00
4 | 1 | 2024-02-07 08:48:25.798256+00
keadb=# select * from dhcp4_options;
option_id | code | value | formatted_value | space | persistent | dhcp_client_class | dhcp4_subnet_id | host_id | scope_id | user_context | shared_network_name | pool_id | modification_ts | cancelled
-----------+------+-------+-------------------------------------+-------+------------+-------------------+-----------------+---------+----------+--------------+---------------------+---------+-------------------------------+-----------
...
1 | 43 | | | dhcp4 | f | | | | 0 | | | | 2024-02-06 10:14:53.913124+00 | f
27 | 1 | | 123.123.123.123 | ubnt | f | | | | 0 | | | | 2024-02-04 09:58:52.903827+00 | f
...
(23 rows)
keadb=# select * from dhcp4_options_server;
option_id | server_id | modification_ts
-----------+-----------+-------------------------------
27 | 1 | 2024-02-06 10:29:05.870566+00
1 | 1 | 2024-02-07 08:49:19.538328+00
(2 rows)
- client class is defined as:
keadb=# select * from dhcp4_client_class;
id | name | test | next_server | server_hostname | boot_file_name | only_if_required | valid_lifetime | min_valid_lifetime | max_valid_lifetime | depend_on_known_directly | follow_class_name | modification_ts | user_context | offer_lifetime
----+------+------------------------------------------------+-------------+-----------------+----------------+------------------+----------------+--------------------+--------------------+--------------------------+-------------------+-------------------------------+--------------+----------------
8 | ubnt | option[vendor-class-identifier].text == 'ubnt' | | | | t | | | | f | | 2024-02-04 10:14:23.624558+00 |
I know I have to change dhcp_client_class, scope_id in dhcp4_options table and class_id in dhcp4_option_def, but I wonder if there's more than that to associate the options to the class, so they match the "hardcoded" configuration snippet I posted?
Let me know if you need anything else from me. Thank you