Reservation client-classes too late/later as documented for depending classes
Describe the bug
Client classes that are applied from a reservation are added too late to test
against except for only-if-required
classes, even when also depending on KNOWN
(despite of what the NOTE in Kea Guide 8.3.6 says).
To Reproduce Steps to reproduce the behavior:
- Run Kea dhcpv4 with config:
"client-classes": [
{
"name": "pxe"
},
{
"name": "ipxe",
"test": "member('KNOWN') and (option[77].hex == 'iPXE') and member('pxe')",
"boot-file-name": "http://ipxe.example.com/menu.php"
},
{
"name": "not_ipxe",
"next-server": "192.168.100.6",
"boot-file-name": "undionly.kpxe"
}
]
MySQL hosts reservation:
+--------------+----------+----------------------+
| ipv4_address | hostname | dhcp4_client_classes |
+--------------+----------+----------------------+
| 167837702 | pxetest | pxe,testing |
+--------------+----------+----------------------+
- Logging set kea-dhcp4 to DEBUG, debuglevel 55
- Client "pxetest" is booted with iPXE
- Client "pxetest" does not get boot-file-name/added to class
pxe
in time to eval true onipxe
- See kea-reservation.log for details
(6. See extremely little logging for reservation classes - only reason I know they were applied at all (not even the final list mentions
pxe
!) was the warning abouttesting
after lease assignment)
Expected behavior
The server is supposed to add client-classes at reservation lookup together with KNOWN
, so classes that depend on KNOWN
and a reserved class are evaluated as true, as described in mentioned documentation.
Environment:
- Kea version: 1.5.0 from Ubuntu 19.04 repositories (manually downloaded)
- OS: Ubuntu 18.04 x64
- Which features were compiled in:
- MySQL 7.0, library 5.7.26
- PostgreSQL backend 5.0, library 100009 (not used)
- Memfile backend 2.1 (not used)
- If/which hooks where loaded in:
- lease commands
- HA
Additional Information
Current workaround is to load classes depending on reserved classes only-if-required, which means adding a require-client-classes
to all subnets/shared networks as appropriate (in my case 97% of subnets) adding a lot of configuration overhead with the possibility of very long lists in complicating setups, which kinda defeats the purpose of client classes in my mind.
Log Debuglevel 55
2019-07-08 12:15:54.796 DEBUG [kea-dhcp4.dhcpsrv/7390] DHCPSRV_CFGMGR_SUBNET4_ADDR selected subnet 192.168.100.0/24 for packet received by matching address 192.168.100.1
2019-07-08 12:15:54.796 DEBUG [kea-dhcp4.packets/7390] DHCP4_SUBNET_SELECTED [hwtype=1 52:c6:25:f5:34:ac], cid=[01:52:c6:25:f5:34:ac], tid=0xdc575936: the subnet with ID 16 was selected for client assignments
2019-07-08 12:15:54.796 DEBUG [kea-dhcp4.packets/7390] DHCP4_SUBNET_DATA [hwtype=1 52:c6:25:f5:34:ac], cid=[01:52:c6:25:f5:34:ac], tid=0xdc575936: the selected subnet details: 192.168.100.0/24
2019-07-08 12:15:54.796 DEBUG [kea-dhcp4.hosts/7390] HOSTS_CFG_GET_ALL_IDENTIFIER get all hosts with reservations using identifier: hwaddr=52C625F534AC
2019-07-08 12:15:54.796 DEBUG [kea-dhcp4.hosts/7390] HOSTS_CFG_GET_ALL_IDENTIFIER_COUNT using identifier hwaddr=52C625F534AC, found 0 host(s)
2019-07-08 12:15:54.796 DEBUG [kea-dhcp4.dhcp4/7390] DHCP4_CLASS_ASSIGNED [hwtype=1 52:c6:25:f5:34:ac], cid=[01:52:c6:25:f5:34:ac], tid=0xdc575936: client packet has been assigned to the following class(es): KNOWN
2019-07-08 12:15:54.796 DEBUG [kea-dhcp4.eval/7390] EVAL_DEBUG_MEMBER Checking membership of 'KNOWN', pushing result 'true'
2019-07-08 12:15:54.796 DEBUG [kea-dhcp4.eval/7390] EVAL_DEBUG_OPTION Pushing option 77 with value 0x69505845
2019-07-08 12:15:54.796 DEBUG [kea-dhcp4.eval/7390] EVAL_DEBUG_STRING Pushing text string 'iPXE'
2019-07-08 12:15:54.796 DEBUG [kea-dhcp4.eval/7390] EVAL_DEBUG_EQUAL Popping 0x69505845 and 0x69505845 pushing result 'true'
2019-07-08 12:15:54.796 DEBUG [kea-dhcp4.eval/7390] EVAL_DEBUG_AND Popping 'true' and 'true' pushing 'true'
2019-07-08 12:15:54.796 DEBUG [kea-dhcp4.eval/7390] EVAL_DEBUG_MEMBER Checking membership of 'pxe', pushing result 'false'
2019-07-08 12:15:54.796 DEBUG [kea-dhcp4.eval/7390] EVAL_DEBUG_AND Popping 'false' and 'true' pushing 'false'
2019-07-08 12:15:54.796 DEBUG [kea-dhcp4.options/7390] EVAL_RESULT Expression ipxe evaluated to 0
2019-07-08 12:15:54.796 DEBUG [kea-dhcp4.eval/7390] EVAL_DEBUG_OPTION Pushing option 77 with value 0x69505845
2019-07-08 12:15:54.796 DEBUG [kea-dhcp4.eval/7390] EVAL_DEBUG_STRING Pushing text string 'iPXE'
2019-07-08 12:15:54.796 DEBUG [kea-dhcp4.eval/7390] EVAL_DEBUG_EQUAL Popping 0x69505845 and 0x69505845 pushing result 'true'
2019-07-08 12:15:54.796 DEBUG [kea-dhcp4.eval/7390] EVAL_DEBUG_NOT Popping 'true' pushing 'false'
2019-07-08 12:15:54.796 DEBUG [kea-dhcp4.eval/7390] EVAL_DEBUG_MEMBER Checking membership of 'pxe', pushing result 'false'
2019-07-08 12:15:54.797 DEBUG [kea-dhcp4.eval/7390] EVAL_DEBUG_AND Popping 'false' and 'false' pushing 'false'
2019-07-08 12:15:54.797 DEBUG [kea-dhcp4.eval/7390] EVAL_DEBUG_MEMBER Checking membership of 'KNOWN', pushing result 'true'
2019-07-08 12:15:54.797 DEBUG [kea-dhcp4.eval/7390] EVAL_DEBUG_AND Popping 'true' and 'false' pushing 'false'
2019-07-08 12:15:54.797 DEBUG [kea-dhcp4.options/7390] EVAL_RESULT Expression not_ipxe evaluated to 0
2019-07-08 12:15:54.797 DEBUG [kea-dhcp4.dhcp4/7390] DHCP4_CLASS_ASSIGNED [hwtype=1 52:c6:25:f5:34:ac], cid=[01:52:c6:25:f5:34:ac], tid=0xdc575936: client packet has been assigned to the following class(es): HA_ns1-kea, ALL, VENDOR_CLASS_PXEClient:Arch:00000:UNDI:002001, deny_snom_dap_pap2t, KNOWN
2019-07-08 12:15:54.797 DEBUG [kea-dhcp4.ddns/7390] DHCP4_CLIENT_HOSTNAME_PROCESS [hwtype=1 52:c6:25:f5:34:ac], cid=[01:52:c6:25:f5:34:ac], tid=0xdc575936: processing client's Hostname option
2019-07-08 12:15:54.797 DEBUG [kea-dhcp4.dhcpsrv/7390] DHCPSRV_MYSQL_GET_CLIENTID obtaining IPv4 leases for client ID 01:52:c6:25:f5:34:ac
2019-07-08 12:15:54.797 DEBUG [kea-dhcp4.hosts/7390] HOSTS_CFG_GET_ONE_SUBNET_ID_ADDRESS4 get one host with reservation for subnet id 162 and IPv4 address 10.1.0.6
2019-07-08 12:15:54.797 DEBUG [kea-dhcp4.hosts/7390] HOSTS_CFG_GET_ALL_ADDRESS4 get all hosts with reservations for IPv4 address 10.1.0.6
2019-07-08 12:15:54.797 DEBUG [kea-dhcp4.hosts/7390] HOSTS_CFG_GET_ALL_ADDRESS4_COUNT using address 10.1.0.6, found 0 host(s)
2019-07-08 12:15:54.797 DEBUG [kea-dhcp4.hosts/7390] HOSTS_CFG_GET_ONE_SUBNET_ID_ADDRESS4_NULL host not found using subnet id 162 and address 10.1.0.6
2019-07-08 12:15:54.797 DEBUG [kea-dhcp4.hosts/7390] HOSTS_MGR_ALTERNATE_GET4_SUBNET_ID_ADDRESS4 trying alternate sources for host using subnet id 162 and address 10.1.0.6
2019-07-08 12:15:54.797 DEBUG [kea-dhcp4.dhcpsrv/7390] DHCPSRV_MYSQL_GET_ADDR4 obtaining IPv4 lease for address 10.1.0.6
2019-07-08 12:15:54.798 DEBUG [kea-dhcp4.alloc-engine/7390] ALLOC_ENGINE_V4_REQUEST_EXTEND_LEASE [hwtype=1 52:c6:25:f5:34:ac], cid=[01:52:c6:25:f5:34:ac], tid=0xdc575936: extending lifetime of the lease for address 10.1.0.6
2019-07-08 12:15:54.798 DEBUG [kea-dhcp4.dhcpsrv/7390] DHCPSRV_MYSQL_UPDATE_ADDR4 updating IPv4 lease for address 10.1.0.6
2019-07-08 12:15:54.861 DEBUG [kea-dhcp4.packets/7390] DHCP4_SUBNET_DYNAMICALLY_CHANGED [hwtype=1 52:c6:25:f5:34:ac], cid=[01:52:c6:25:f5:34:ac], tid=0xdc575936: changed selected subnet 192.168.100.0/24 to subnet 10.1.0.0/20 from shared network servers for client assignments
2019-07-08 12:15:54.861 INFO [kea-dhcp4.leases/7390] DHCP4_LEASE_ALLOC [hwtype=1 52:c6:25:f5:34:ac], cid=[01:52:c6:25:f5:34:ac], tid=0xdc575936: lease 10.1.0.6 has been allocated
2019-07-08 12:15:54.861 DEBUG [kea-dhcp4.dhcp4/7390] DHCP4_CLASS_UNCONFIGURED [hwtype=1 52:c6:25:f5:34:ac], cid=[01:52:c6:25:f5:34:ac], tid=0xdc575936: client packet belongs to an unconfigured class: testing
2019-07-08 12:15:54.861 DEBUG [kea-dhcp4.callouts/7390] HOOKS_CALLOUTS_BEGIN begin all callouts for hook leases4_committed
2019-07-08 12:15:54.861 DEBUG [kea-dhcp4.callouts/7390] HOOKS_CALLOUT_CALLED hooks library with index 2 has called a callout on hook leases4_committed that has address 0x7efe0edcb150 (callout duration: 0.123 ms)
2019-07-08 12:15:54.861 DEBUG [kea-dhcp4.callouts/7390] HOOKS_CALLOUTS_COMPLETE completed callouts for hook leases4_committed (total callouts duration: 0.123 ms)
2019-07-08 12:15:54.861 DEBUG [kea-dhcp4.hooks/7390] DHCP4_HOOK_LEASES4_COMMITTED_PARK [hwtype=1 52:c6:25:f5:34:ac], cid=[01:52:c6:25:f5:34:ac], tid=0xdc575936: packet is parked, because a callout set the next step to PARK
Contacting you Gitlab/hub