Determining domain-name option for a lease
Sorry if the gitlab issue tracker isn't the place to discuss Kea development. The kea-dev mailing list doesn't seem to be very active. If this isn't the place for discussion, please let me know where these types of discussions take place and I will gladly close this issue and pivot there.
I need to determine the domain-name option for a given lease. The use-case here is for a simple hook library that interfaces with the Unbound DNS Resolver to insert, update, and delete local RR data entries for hosts as leases come and go.
So far I've managed to grab the subnet_id_
from the lease object, used that to lookup the subnet from CfgSubnets4
and then can use getCfgOption
on the subnet to determine the domain name (DHO_DOMAIN_NAME
). However, this is obviously a naive approach as the actual domain-name transmitted to the client would be the result of whatever configuration level "won" precedence for that option.
The current Kea options precedence order is (from most important to least): host reservation, pool, subnet, shared network, class, global.\
The flowchart I've worked out in my head is:
- Determine the subnet from which a lease originated from (
lease->subnet_id_
) - Check if host reservation exists and if that reservation contains domain-name option, if so use that value.
- Check the pool level, if so use that value.
- Check the subnet level, if so use that value.
- Check shared network level, if so use that value.
- Check class level, if so use that value.
- Finally, check global level, if so use that value.
There must be some code somewhere in Kea that performs this determination, I just need to find that and learn how to call it accordingly.