Patch for raddb/sql/mysql/ippool.conf

Chris Moules chris at gms.lu
Fri Jul 31 15:27:16 CEST 2009


Sorry this is not a GIT patch.

Here are two minor fixes to the MySQL ippool.conf file.

1) A Syntax correction for the alternative 'allocate-find' query.

2) There was an issue with the 'start-update' query updating more than it should.
I am using IMSI codes as my pool-key. In the case that a phone disconnects, but no Acct-Stop is received the expiry_time is 
updated every time that this phone reconnects as only the NAS and the pool-key are used as update limiters.

By including at least the framedipaddress this is solved.

As both the 'stop-clear' and 'alive-update' sections are using the 3 additional qualifiers, it makes sense to use them here too. 
(I see no reason no to).

Regards

Chris

--- ippool.conf.orig    2009-07-31 15:16:38.000000000 +0200
+++ ippool.conf 2009-07-31 15:17:57.000000000 +0200
@@ -39,7 +39,7 @@
  # ## use this query instead
  # allocate-find = "SELECT framedipaddress FROM ${ippool_table} \
  #  WHERE pool_name = '%{control:Pool-Name}' \
-#  AND expiry_time = NULL \
+#  AND expiry_time IS NULL \
  #  ORDER BY RAND() \
  #  LIMIT 1 \
  #  FOR UPDATE"
@@ -67,7 +67,10 @@
  ## START record arrives
  start-update = "UPDATE ${ippool_table} \
   SET expiry_time = NOW() + INTERVAL ${lease-duration} SECOND \
- WHERE nasipaddress = '%{NAS-IP-Address}' AND  pool_key = '${pool-key}'"
+ WHERE nasipaddress = '%{NAS-IP-Address}' AND  pool_key = '${pool-key}' \
+ AND username = '%{User-Name}' \
+ AND callingstationid = '%{Calling-Station-Id}' \
+ AND framedipaddress = '%{Framed-IP-Address}'"

  ## This series of queries frees an IP number when an accounting
  ## STOP record arrives



More information about the Freeradius-Devel mailing list