Kea assigns old prefix despite removing reservation
Summary:
Kea assigns prefixes from deleted reservation in spite of assigning IANA correctly.
Problem:
Kea does not remove Prefix lease when processing client that has his reservation removed.
When client returns (that has a lease with IANA and Prefix from his reservation (out of pool)), and his reservation is removed, he gets proper IANA from subnet but prefix from old lease/reservation.
How to reproduce:
- Start kea with subnet (example '2001:db8:1::/64', '2001:db8:1::50-2001:db8:1::60', prefix '3000:db8::')
- Use memfile or database for reservation - this has an effect on problem
- add reservation with host command (including IANA and prefix) reservations should be out of pool.
- Send SARR - the client gets IANA and prefix from the reservation.
- Delete reservation with host command (using IP or duid has an effect on problem)
- Do SARR from the same client again and observe what Kea sends
When using Memfile and removing reservation by IP, Kea will assign new IANA and Prefix from subnet. In any other combination (database AND/OR deleting by duid) Kea will assign a new IANA from subnet, but use the old prefix (the one from reservation)
Analizing logs, we see that Kea removes IANA lease when processing SOLICIT. Prefix lease is deleted only when memfile+remove_by_ip combination is used.
IANA lease is deleted on line 695. Prefix lease is deleted on line 726
kea_memfile.log second SARR starts on line 664
IANA lease is deleted on line 718. Prefix lease is not deleted.
kea_mysql.log second sarr starts on line 682