1
1
mirror of https://github.com/systemd/systemd-stable.git synced 2025-01-08 21:17:47 +03:00

sd-dhcp-server: do not assign an address from pool when a static lease for the client ID exists

(cherry picked from commit e2ba408084)
This commit is contained in:
Yu Watanabe 2022-01-28 03:50:16 +09:00 committed by Luca Boccassi
parent 316f6bdb39
commit 71d05ec458

View File

@ -1042,9 +1042,13 @@ int dhcp_server_handle_message(sd_dhcp_server *server, DHCPMessage *message, siz
if (address == server->address)
return 0;
/* verify that the requested address is from the pool, and either
owned by the current client or free */
if (static_lease && static_lease->address == address) {
if (static_lease) {
/* Found a static lease for the client ID. */
if (static_lease->address != address)
/* The client requested an address which is different from the static lease. Refuse. */
return server_send_nak_or_ignore(server, init_reboot, req);
_cleanup_(dhcp_lease_freep) DHCPLease *lease = NULL;
usec_t time_now, expiration;