]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
When clearing entries, set expiry time to now. Addresses #786
authorAlan T. DeKok <aland@freeradius.org>
Wed, 10 Sep 2014 12:50:35 +0000 (08:50 -0400)
committerAlan T. DeKok <aland@freeradius.org>
Wed, 10 Sep 2014 12:52:32 +0000 (08:52 -0400)
This is so that the allocate_find will return the oldest IP.
And, the allocate_find will now use an index, rather than
potentially scanning the entire table

raddb/mods-config/sql/ippool-dhcp/mysql/queries.conf

index 0a5d7effe2a540909b44a36917ac3ca84290ffbe..bbea23a8f9393e49ae81b2d009e17e02ea367c0c 100644 (file)
@@ -30,7 +30,7 @@ allocate_clear = "\
                pool_key = 0, \
                callingstationid = '', \
                username = '', \
-               expiry_time = NULL \
+               expiry_time = NOW() \
        WHERE expiry_time <= NOW() - INTERVAL 1 SECOND \
        AND nasipaddress = '%{Nas-IP-Address}'"
 
@@ -64,7 +64,7 @@ allocate_find = "\
 #      SELECT framedipaddress \
 #      FROM ${ippool_table} \
 #      WHERE pool_name = '%{control:Pool-Name}' \
-#      AND expiry_time IS NULL \
+#      AND expiry_time < NOW() \
 #      ORDER BY RAND() \
 #      LIMIT 1 \
 #      FOR UPDATE"