create_dhcp_reservation rewrote an existing reservation and called /api/kea/service/reconfigure even when the reservation already held exactly what was asked (e.g. a retried provisioning job). On OPNsense that reconfigure stops and starts Kea, which once left a firewall without DHCP (NetOrk/netork#1142/#1143). An unchanged reservation is now left alone.
Changes
create_dhcp_reservation keeps the matched searchReservation row and returns early when it already matches.
New _kea_reservation_unchanged(row, wanted, subnet_cidr): subnet as UUID or CIDR, MAC normalised (napalm_device_types.dhcp.normalize_mac), IP, hostname and description exact; a missing field counts as different (writes once too often rather than skipping a needed write).
delete_dhcp_reservation_and_lease already reconfigures only when it deleted something; unchanged.
Return contract unchanged; no version bump (plain fix, as in earlier fix commits).
Why no reload instead of the restart: in opnsense/core 26.7.7 (and master) the Kea ServiceController keeps reconfigureForceRestart() = true and actions_kea.conf has no [reload] action, so the REST API offers no soft reload. Options are collected in NetOrk/netork#1324.
Driver suite: 438 passed. netOrk tests touching provisioning/DHCP with this driver: 138 passed.
## Summary
`create_dhcp_reservation` rewrote an existing reservation and called `/api/kea/service/reconfigure` even when the reservation already held exactly what was asked (e.g. a retried provisioning job). On OPNsense that reconfigure stops and starts Kea, which once left a firewall without DHCP (NetOrk/netork#1142/#1143). An unchanged reservation is now left alone.
## Changes
- `create_dhcp_reservation` keeps the matched `searchReservation` row and returns early when it already matches.
- New `_kea_reservation_unchanged(row, wanted, subnet_cidr)`: subnet as UUID or CIDR, MAC normalised (`napalm_device_types.dhcp.normalize_mac`), IP, hostname and description exact; a missing field counts as different (writes once too often rather than skipping a needed write).
- `delete_dhcp_reservation_and_lease` already reconfigures only when it deleted something; unchanged.
- Return contract unchanged; no version bump (plain fix, as in earlier fix commits).
Why no reload instead of the restart: in opnsense/core 26.7.7 (and master) the Kea `ServiceController` keeps `reconfigureForceRestart()` = true and `actions_kea.conf` has no `[reload]` action, so the REST API offers no soft reload. Options are collected in NetOrk/netork#1324.
## Related Issue
Refs NetOrk/netork#1187 (closed there by the pin bump)
## Testing
- New: `test_unchanged_reservation_is_neither_written_nor_reconfigured` (subnet as CIDR and as UUID, MAC in another notation) — red before, green after.
- New: `test_reservation_differing_in_one_field_is_written_and_reconfigured` (hw_address, hostname, description, subnet).
- Driver suite: 438 passed. netOrk tests touching provisioning/DHCP with this driver: 138 passed.
create_dhcp_reservation rewrote an existing reservation and called
service/reconfigure even when it already held exactly what was asked, e.g.
on a retried provisioning job. reconfigure stops and starts Kea (the Kea
service controller keeps reconfigureForceRestart() = true and configd has no
reload action), which once left a firewall without DHCP. A reservation whose
subnet, MAC (normalised), IP, hostname and description already match is now
left alone.
Refs NetOrk/netork#1187
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Summary
create_dhcp_reservationrewrote an existing reservation and called/api/kea/service/reconfigureeven when the reservation already held exactly what was asked (e.g. a retried provisioning job). On OPNsense that reconfigure stops and starts Kea, which once left a firewall without DHCP (NetOrk/netork#1142/#1143). An unchanged reservation is now left alone.Changes
create_dhcp_reservationkeeps the matchedsearchReservationrow and returns early when it already matches._kea_reservation_unchanged(row, wanted, subnet_cidr): subnet as UUID or CIDR, MAC normalised (napalm_device_types.dhcp.normalize_mac), IP, hostname and description exact; a missing field counts as different (writes once too often rather than skipping a needed write).delete_dhcp_reservation_and_leasealready reconfigures only when it deleted something; unchanged.Why no reload instead of the restart: in opnsense/core 26.7.7 (and master) the Kea
ServiceControllerkeepsreconfigureForceRestart()= true andactions_kea.confhas no[reload]action, so the REST API offers no soft reload. Options are collected in NetOrk/netork#1324.Related Issue
Refs NetOrk/netork#1187 (closed there by the pin bump)
Testing
test_unchanged_reservation_is_neither_written_nor_reconfigured(subnet as CIDR and as UUID, MAC in another notation) — red before, green after.test_reservation_differing_in_one_field_is_written_and_reconfigured(hw_address, hostname, description, subnet).