]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
Ensure IP updated is from the correct pool
authorNick Porter <nick@portercomputing.co.uk>
Thu, 18 Jan 2024 17:43:36 +0000 (17:43 +0000)
committerNick Porter <nick@portercomputing.co.uk>
Thu, 18 Jan 2024 18:12:55 +0000 (18:12 +0000)
In case IPs exist in more than one pool.

raddb/mods-config/sql/ippool/mssql/queries.conf
raddb/mods-config/sql/ippool/mysql/queries.conf
raddb/mods-config/sql/ippool/oracle/queries.conf
raddb/mods-config/sql/ippool/postgresql/queries.conf
raddb/mods-config/sql/ippool/sqlite/queries.conf

index 0a8cd64742ed22cf83df4fcee2d8d24fee00239c..d8a8dd8aa08a074421d76ed66c1f0f6affff1874 100644 (file)
@@ -156,7 +156,8 @@ pool_check = "\
 #      SET \
 #              gateway = '${gateway}', owner = '${owner}', \
 #              expiry_time = DATEADD(SECOND,${offer_duration},CURRENT_TIMESTAMP) \
-#      WHERE address = '%{reply.${allocated_address_attr}}'"
+#      WHERE address = '%{reply.${allocated_address_attr}}' \
+#              AND pool_name = '%{control.${pool_name}}'"
 
 #
 #  Use a stored procedure to find AND allocate the address. Read and customise
index dbed130d3e1b973e951ab5d04bd8f5786fda0ff3..929d38cd66c9422678d92032aab5a7a6b19e107b 100644 (file)
@@ -119,7 +119,8 @@ alloc_update = "\
        SET \
                gateway = '${gateway}', owner = '${owner}', \
                expiry_time = NOW() + INTERVAL ${offer_duration} SECOND \
-       WHERE address = '%{reply.${allocated_address_attr}}'"
+       WHERE address = '%{reply.${allocated_address_attr}}' \
+               AND pool_name = '%{control.${pool_name}}'"
 
 #
 #  Use a stored procedure to find AND allocate the address. Read and customise
index c4b2e91999261be4d28de7bc52bfd10a3a98f5de..b93ef5a4965eb790fa6902f4f0dbe17870c67034 100644 (file)
@@ -108,7 +108,8 @@ pool_check = "\
 #              gateway = '${gateway}', \
 #              owner = '${owner}', \
 #              expiry_time = current_timestamp + INTERVAL '${offer_duration}' second(1) \
-#      WHERE address = '%{reply.${allocated_address_attr}}'"
+#      WHERE address = '%{reply.${allocated_address_attr}}' \
+#              AND pool_name = '%{control.${pool_name}}'"
 
 
 #
index 19f4da6f3f66f2104a6495b929a1cdfd20e884ef..bb33b7b97f86ab60d41326715c418267fe2bfc7a 100644 (file)
@@ -112,7 +112,8 @@ alloc_find = "\
 #              gateway = '${gateway}', \
 #              owner = '${owner}', \
 #              expiry_time = 'now'::timestamp(0) + '${offer_duration} second'::interval \
-#      WHERE address = '%{reply.${allocated_address_attr}}'"
+#      WHERE address = '%{reply.${allocated_address_attr}}' \
+#              AND pool_name = '%{control.${pool_name}}'"
 
 #
 #  If the SELECT and UPDATE are in separate queries then set the following
index cb4bb1c6262e127f76f87d9a69e1742ea2331996..df7384e449ba4acaa8ecb48bc7ec507ce0f723fb 100644 (file)
@@ -104,7 +104,8 @@ alloc_update = "\
                gateway = '${gateway}', \
                owner = '${owner}', \
                expiry_time = datetime(strftime('%%s', 'now') + ${offer_duration}, 'unixepoch') \
-       WHERE address = '%{reply.${allocated_address_attr}}'"
+       WHERE address = '%{reply.${allocated_address_attr}}' \
+               AND pool_name = '%{control.${pool_name}}'"
 
 
 #