opnsense / core

OPNsense GUI, API and systems backend
https://opnsense.org/
BSD 2-Clause "Simplified" License
3.27k stars 727 forks source link

feature: Adding a duplicate IP to MAC reservation causes kea to stop working #7477

Open christofferbergq opened 4 months ago

christofferbergq commented 4 months ago

Is your feature request related to a problem? Please describe.

When/if I, by mistake, make a new kea IP reservation that conflicts to an already reserved IP address. DHCP shuts down and won't start. I like for a warning/block if I try this scenario appear in the future, since the network goes down if this happens.

Steps to reproduce:

  1. Go to kea reservations in OPNsence GUI (docs: https://docs.opnsense.org/manual/dhcp.html#kea-dhcpv4)
  2. Register (at least) one MAC to IP reservation
  3. Register one more record, with another MAC, to the same IP
  4. Apply changes
  5. DHCP server kea stops working

Actual:

2024-05-19 06:36:04.859 ERROR [keap-dhcp-dhcp4/29212.0x833004000] Error: DHCP_INIT FAIL to initiate kea server: configurationerror using file /user/local etc/kea/kea-dhcp4.conf: failed to add new host using the HW adress. HH:HH:HH:HH:HH:HH and DUID (null) to the IPv4 subnet id 1 for the address 192.168.NN.NNN: There's already a reservation for this address.

Expected:

Starting kea.
INFO/keactrl: Starting /usr/local/sbin/kea-dhcp -c /usr/local/etc/kea/kea-dhcp4.conf

Fix: A rollback is needed. E.g. from the console by a wired monitor/screen and keyboarded attached.

Describe the solution you like

Warning about an already existing IP reservation for this IP, with a text that says (something similar to): this IP is already reserved, please input another one, and save/apply again.

Describe alternatives you considered

If this duplicate record can be saved, we should not break IP leasing for all other devices (incl the first, already existing, one of the dublicates). And if so, maybe a warning should be visable in the GUI everytime a user go in to the KEA reservation sections, so this can be noticed and corrected.

Additional context

Note: Similarities to the historically related (Closed) bug: #7230

"Discussed" in: https://www.reddit.com/r/opnsense/s/aAOWn64N8M

Environment

Software version used and hardware type:

OPNsense 24.1.6 (amd64). Protectli VP2420 Intel® Celeron® J6412 @ 2.00GHz (4 cores, 4 threads) Network Intel® 2.5 Gigabit Ethernet NIC ports

OPNsense-bot commented 4 months ago

Thank you for creating an issue. Since the ticket doesn't seem to be using one of our templates, we're marking this issue as low priority until further notice.

For more information about the policies for this repository, please read https://github.com/opnsense/core/blob/master/CONTRIBUTING.md for further details.

The easiest option to gain traction is to close this ticket and open a new one using one of our templates.