sqlcounter returning wrong value?

Flamur Rogova flamur at ipko.net
Wed Nov 12 10:02:53 CET 2008


liran tal wrote:
>  
> Waiting for that traffic limitation patch, Venkatesh.
> Thanks.
> 

Hi,
I was stuck with this problem too, and I came up with this solution, 
which works in my test environment.

The idea is to store allowed bytes in Tmp-Integer-0, than just use 
unlang to compare user's allowed and actual traffic bytes.

btw, maximum traffic count is 2^31 bytes, if you do it this way.


if(control:Tmp-Integer-0) {
     if("%{sql:SELECT SUM(AcctOutputOctets+AcctInputOctets) FROM radacct 
WHERE UserName='%{User-Name}' }" > "%{control:Tmp-Integer-0}" ) {
         # traffic bytes limit reached
         reject
     }
}

Regards,
Flamur



More information about the Freeradius-Users mailing list