From: Piotrek Zadroga Date: Wed, 17 Apr 2024 12:22:34 +0000 (+0200) Subject: [#3294] fix reservation-del psql query X-Git-Tag: Kea-2.5.8~47 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=387edbe9b9d2fb52ca37c12d8a5faed65824349b;p=thirdparty%2Fkea.git [#3294] fix reservation-del psql query - fixing a bug where when postgresql used as hosts reservations backend and when trying to delete only one reservation with host_cmds reservation-del by ipv6 and subnet-id, all host reservations in given subnet were deleted --- diff --git a/src/lib/dhcpsrv/pgsql_host_data_source.cc b/src/lib/dhcpsrv/pgsql_host_data_source.cc index 8db86ffa49..5732f74d99 100644 --- a/src/lib/dhcpsrv/pgsql_host_data_source.cc +++ b/src/lib/dhcpsrv/pgsql_host_data_source.cc @@ -2191,7 +2191,8 @@ TaggedStatementArray tagged_statements = { { { OID_INT8, OID_VARCHAR }, "del_host_addr6", "DELETE FROM hosts USING ipv6_reservations " - " WHERE dhcp6_subnet_id = $1 AND ipv6_reservations.address = cast($2 as inet)" + " WHERE hosts.host_id = ipv6_reservations.host_id" + " AND dhcp6_subnet_id = $1 AND ipv6_reservations.address = cast($2 as inet)" }, // PgSqlHostDataSourceImpl::DEL_HOST_SUBID4_ID