manipulating subnet choice from shared network with class from global reservation does not work in kea v6
configuration:
{
"Dhcp6": {
"client-classes": [
{
"name": "special"
},
{
"name": "NOTspecial",
"test": "not member('special')"
}
],
"hooks-libraries": [],
"interfaces-config": {
"interfaces": [
"enp0s9"
]
},
"lease-database": {
"type": "memfile"
},
"loggers": [
{
"debuglevel": 99,
"name": "kea-dhcp6",
"output_options": [
{
"output": "/home/wlodek/installed/git-thread/var/log/kea.log"
}
],
"severity": "DEBUG"
}
],
"multi-threading": {
"enable-multi-threading": true,
"packet-queue-size": 16,
"thread-pool-size": 2
},
"option-data": [],
"preferred-lifetime": 3000,
"rebind-timer": 2000,
"renew-timer": 1000,
"reservation-mode": "global",
"reservations": [
{
"client-classes": [
"special"
],
"hw-address": "01:02:03:04:05:07"
}
],
"shared-networks": [
{
"interface": "enp0s9",
"name": "name-abc",
"subnet6": [
{
"client-class": "NOTspecial",
"interface": "enp0s9",
"pools": [
{
"pool": "2001:db8:a::1-2001:db8:a::1"
}
],
"subnet": "2001:db8:a::/64"
},
{
"client-class": "special",
"interface": "enp0s9",
"pools": [
{
"pool": "2001:db8:b::1-2001:db8:b::1"
}
],
"reservation-mode": "all",
"reservations": [
{
"hw-address": "01:02:03:04:05:07",
"ip-addresses": [
"2001:db8:a::1111"
]
}
],
"subnet": "2001:db8:b::/64"
}
]
}
],
"subnet6": [],
"valid-lifetime": 4000
}
}
Scenario: client haas a global reservation with a class, with that class he should get specific subnet from shared-network, and than with reservation from subnet level should get specific address from this subnet.
logs of address selection:
2020-08-10 02:20:11.281 DEBUG [kea-dhcp6.dhcpsrv/18466.140536017057536] DHCPSRV_CFGMGR_SUBNET6_IFACE selected subnet 2001:db8:a::/64 for packet received over interface enp0s9
2020-08-10 02:20:11.281 DEBUG [kea-dhcp6.packets/18466.140536017057536] DHCP6_SUBNET_SELECTED duid=[00:03:00:01:01:02:03:04:05:07], tid=0xdfecd6: the subnet with ID 1 was selected for client assignments
2020-08-10 02:20:11.281 DEBUG [kea-dhcp6.packets/18466.140536017057536] DHCP6_SUBNET_DATA duid=[00:03:00:01:01:02:03:04:05:07], tid=0xdfecd6: the selected subnet details: 2001:db8:a::/64
2020-08-10 02:20:11.281 DEBUG [kea-dhcp6.hosts/18466.140536017057536] HOSTS_CFG_GET_ONE_SUBNET_ID_IDENTIFIER get one host with IPv6 reservation for subnet id 0, identified by hwaddr=010203040507
2020-08-10 02:20:11.281 DEBUG [kea-dhcp6.hosts/18466.140536017057536] HOSTS_CFG_GET_ALL_IDENTIFIER get all hosts with reservations using identifier: hwaddr=010203040507
2020-08-10 02:20:11.281 DEBUG [kea-dhcp6.hosts/18466.140536017057536] HOSTS_CFG_GET_ALL_IDENTIFIER_HOST using identifier: hwaddr=010203040507, found host: hwaddr=010203040507 ipv6_subnet_id=2 hostname=(empty) ipv4_reservation=(no) siaddr=(no) sname=(empty) file=(empty) key=(empty) ipv6_reservation0=2001:db8:a::1111
2020-08-10 02:20:11.281 DEBUG [kea-dhcp6.hosts/18466.140536017057536] HOSTS_CFG_GET_ALL_IDENTIFIER_HOST using identifier: hwaddr=010203040507, found host: hwaddr=010203040507 ipv6_subnet_id=0 hostname=(empty) ipv4_reservation=(no) siaddr=(no) sname=(empty) file=(empty) key=(empty) ipv6_reservations=(none) dhcp6_class0=special
2020-08-10 02:20:11.281 DEBUG [kea-dhcp6.hosts/18466.140536017057536] HOSTS_CFG_GET_ALL_IDENTIFIER_COUNT using identifier hwaddr=010203040507, found 2 host(s)
2020-08-10 02:20:11.281 DEBUG [kea-dhcp6.hosts/18466.140536017057536] HOSTS_CFG_GET_ONE_SUBNET_ID_IDENTIFIER_HOST using subnet id 0 and identifier hwaddr=010203040507, found host: hwaddr=010203040507 ipv6_subnet_id=0 hostname=(empty) ipv4_reservation=(no) siaddr=(no) sname=(empty) file=(empty) key=(empty) ipv6_reservations=(none) dhcp6_class0=special
2020-08-10 02:20:11.282 DEBUG [kea-dhcp6.dhcp6/18466.140536017057536] DHCP6_CLASS_ASSIGNED duid=[00:03:00:01:01:02:03:04:05:07], tid=0xdfecd6: client packet has been assigned to the following class(es): ALL, special
2020-08-10 02:20:11.282 DEBUG [kea-dhcp6.eval/18466.140536017057536] EVAL_DEBUG_MEMBER Checking membership of 'special', pushing result 'true'
2020-08-10 02:20:11.282 DEBUG [kea-dhcp6.eval/18466.140536017057536] EVAL_DEBUG_NOT Popping 'true' pushing 'false'
2020-08-10 02:20:11.282 DEBUG [kea-dhcp6.dhcp6/18466.140536017057536] EVAL_RESULT Expression NOTspecial evaluated to 0
2020-08-10 02:20:11.282 DEBUG [kea-dhcp6.dhcp6/18466.140536017057536] DHCP6_CLASS_ASSIGNED duid=[00:03:00:01:01:02:03:04:05:07], tid=0xdfecd6: client packet has been assigned to the following class(es): KNOWN
2020-08-10 02:20:11.282 DEBUG [kea-dhcp6.leases/18466.140536017057536] DHCP6_PROCESS_IA_NA_REQUEST duid=[00:03:00:01:01:02:03:04:05:07], tid=0xdfecd6: server is processing IA_NA option with iaid=41204 and hint=2001:db8:b::1
2020-08-10 02:20:11.282 DEBUG [kea-dhcp6.dhcpsrv/18466.140536017057536] DHCPSRV_MEMFILE_GET_IAID_DUID obtaining IPv6 leases for IAID 41204 and DUID 00:03:00:01:01:02:03:04:05:07 and lease type IA_NA
2020-08-10 02:20:11.282 DEBUG [kea-dhcp6.alloc-engine/18466.140536017057536] ALLOC_ENGINE_V6_ALLOC_NO_LEASES_HR no leases found but reservations exist for client duid=[00:03:00:01:01:02:03:04:05:07], tid=0xdfecd6
2020-08-10 02:20:11.283 DEBUG [kea-dhcp6.alloc-engine/18466.140536017057536] ALLOC_ENGINE_V6_ALLOC_UNRESERVED no static reservations available - trying to dynamically allocate leases for client duid=[00:03:00:01:01:02:03:04:05:07], tid=0xdfecd6
2020-08-10 02:20:11.283 DEBUG [kea-dhcp6.dhcpsrv/18466.140536017057536] DHCPSRV_MEMFILE_GET_ADDR6 obtaining IPv6 lease for address 2001:db8:b::1 and lease type IA_NA
full logs attached kea.log
Feature introduced in #1139 (closed) and works perfectly on pool level :)