Hi Marcel

I don't know if i'm right, or if it's related to your problem, but if you check the source of rlm_sqlcounter (rlm_sqlcounter.c), you may see that this module seems really time based (Alan will correct me if i'm wrong). Indeed the module contains a function that make it possible for a user to start using its next month's quota, if the integer returned by the check-name is greater than the number of seconds untill the reset time. In your case this would suggest you compare bytes your with seconds, and mso maybe you allow sometime user to use their quota twice a month, or something like this.

Once again what I say here needs  to be checked, but i'm almost sure sqlcounter mechanism are time related.



Marcel Grandemange a écrit :

I have a working FreeRadius installation used for PPPOE clients using a Mikrotik NAS (Essentialy Linux)

 

 

I am using Freeradius to limit data a user can send/receive within a month and automatically reset it every month.

 

I used an example from chilliuspot hotspot for this.

 

However what im noticing is sometimes a customer gets denied access because he has exceeded he’s monthly allowance, however when I check the

Db this is not the case cause it’s the beginning of month.

 

 

This only happens sometimes so im lost!

 

 

I use sqlcounter.conf for the counter part of things and INCLUDE this from radius.conf.

 

 

sqlcounter monthlytraffic {

                 counter-name = Monthly-Traffic

                 check-name = Max-Monthly-Traffic

                 reply-name = Mikrotik-Xmit-Limit-Gigawords

                 sqlmod-inst = sql

                 key = User-Name

                 reset = monthly

query = "SELECT SUM(AcctInputOctets - GREATEST((%b - UNIX_TIMESTAMP(AcctStartTime)), 0))+ SUM(AcctOutputOctets -GREATEST((%b - UNIX_TIMESTAMP(AcctStartTime)), 0)) FROM radacct WHERE UserName='%{%k}' AND UNIX_TIMESTAMP(AcctStartTime) + AcctSessionTime > '%b'"

}

 

 

Anybody for input? I would greately appreciate help here! A Work around is to simply increase he’s allowance till he is allowed to connect!


- List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html