unlang dailycounter

Alan DeKok aland at deployingradius.com
Thu May 7 15:22:15 CEST 2015


On May 6, 2015, at 7:22 PM, Pablo Umanzor <info at redlibre.cl> wrote:
> - a NAS with unlang rule (match a nas-ip-address) to get internet access 1
> hour per day to computer wired pc
> - in the same building there are wireless hotspots that doesn't match the
> unlang rule and controlled by another NAS
> 
> * both NASes managed by the same Freeradius server (radacct table)

  That's the key.  Because the counter module uses the radacct table to track the users time on the network.   So putting accounting for *both* NASes into the same table will cause the counter module to count logins from both NASes.

  The solution is to look at the SQL query for the dailycounter modules.  See raddb/mods-config/sql/counter/

  For PosgreSQL, it's:

query = "\
	SELECT SUM(AcctSessionTime - GREATER((%%b - AcctStartTime::ABSTIME::INT4), 0)) \
	FROM radacct \
	WHERE UserName='%{${key}}' \
	AND AcctStartTime::ABSTIME::INT4 + AcctSessionTime > '%%b'"

  Just add another AND statement which selects only the WiFi NAS.  You'll have to look at your SQL DB documentation for the exact syntax.  But there are tons of examples in the other SQL directories.

  Alan DeKok.




More information about the Freeradius-Users mailing list