freeradius accounting off based on time

Phil Mayers p.mayers at imperial.ac.uk
Thu Sep 20 16:36:51 CEST 2012


On 20/09/12 14:43, Mohsen Saeedi wrote:
> Hi
> I'm using chillispot with freeradius. i wrote a perl module for user
> traffic accounting with freeradius sql module to limit users total
> traffic at the month or at the week. i defined a few attribute fot this
> purpose. and the question is :
> I need to enable a free traffic for all user at the specific time. for
> example from 22:00 to 06:00. how can i enable it for our users? we don't
> want to calculate this free traffic in the user total traffic and it
> should free at the specific time.

This isn't easy. RADIUS accounting packets contain the *total* amount of 
traffic up until that point, so you'll need to do some work.

Basically, for each accounting packet you'll have to subtract the 
*previous* packets byte values. Then during your "free" period, do 
nothing, and during your "charged" period, add the delta to the users 
quota usage.

It won't be exact - you can't control the arrival time of accounting 
packets, only suggest an interval, so you might count a few minutes 
either side of when you want.

It will be quite a bit of work, and you'll need to be familiar with SQL 
(or whatever you store your accounting) as well as FreeRADIUS.


More information about the Freeradius-Users mailing list