]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[#4373] Fix postgresql pick logic
authorThomas Markwalder <tmark@isc.org>
Tue, 31 Mar 2026 12:52:08 +0000 (08:52 -0400)
committerThomas Markwalder <tmark@isc.org>
Tue, 31 Mar 2026 14:33:50 +0000 (14:33 +0000)
Fix the if clause on the second try pick in sflqPickFreeLease*

modified:   src/share/database/scripts/pgsql/dhcpdb_create.pgsql
modified:   src/share/database/scripts/pgsql/upgrade_032_to_033.sh.in

src/share/database/scripts/pgsql/dhcpdb_create.pgsql
src/share/database/scripts/pgsql/upgrade_032_to_033.sh.in

index 0fcf432495491db87d3c8b3caccc5d187c23c47d..bf001162434aedfe532392b0935c668daa1199f9 100644 (file)
@@ -6945,7 +6945,7 @@ BEGIN
     -- Didn't find one, so try front half of the range, including
     -- the last pick. This avoids returning nothing if there is only
     -- one address free.
-    IF (free_address IS NULL AND last_address != p_start_address)
+    IF (free_address IS NULL)
     THEN
         SELECT f.address INTO free_address FROM free_lease4 f
             LEFT JOIN lease4 ON f.address = lease4.address
@@ -7300,7 +7300,7 @@ BEGIN
     -- Didn't find one, so try front half of the range, including
     -- the last pick. This avoids returning nothing if there is only
     -- one address free.
-    IF (free_address IS NULL AND bin_last_address != bin_start_address)
+    IF (free_address IS NULL)
     THEN
         SELECT f.address INTO free_address FROM free_lease6 f
             LEFT JOIN lease6 on f.address = lease6.address
index 039a2f8df9585f7003c164ea6fac66a4efbdc035..846a84d621d4b05beb4694893cc2cac470ada5b6 100755 (executable)
@@ -231,7 +231,7 @@ BEGIN
     -- Didn't find one, so try front half of the range, including
     -- the last pick. This avoids returning nothing if there is only
     -- one address free.
-    IF (free_address IS NULL AND last_address != p_start_address)
+    IF (free_address IS NULL)
     THEN
         SELECT f.address INTO free_address FROM free_lease4 f
             LEFT JOIN lease4 ON f.address = lease4.address
@@ -587,7 +587,7 @@ BEGIN
     -- Didn't find one, so try front half of the range, including
     -- the last pick. This avoids returning nothing if there is only
     -- one address free.
-    IF (free_address IS NULL AND bin_last_address != bin_start_address)
+    IF (free_address IS NULL)
     THEN
         SELECT f.address INTO free_address FROM free_lease6 f
             LEFT JOIN lease6 on f.address = lease6.address