How to charge based on accounting correctly

Alan DeKok aland at deployingradius.com
Fri Jan 22 14:08:01 CET 2010


George Chelidze wrote:
> To charge a session in chunks we
> calculate a difference between the recent value and the previous one.

  Why not just update the users credit when the session is closed?


> In our case we get Interim-Update records every 15 minutes,

  No.  You *hope* to get them every 15 minutes.  You *cannot* rely on
them occurring every 15 minutes.

  Since RADIUS packets aren't ordered, it is theoretically possible to
get accounting packets out of order. e.g. start, update-2, update-1,
update-3.  You will need to ensure that you handle this, too.

> 1. Is it better to charge the whole difference between current and
> previous Session-Timeout values and later ignore any previous packets
> which arrive out of order, or it's better to charge last 15 minutes (I
> get Interim-Update records every 15 minutes as already stated above) and
> do not care about missing parts (if any) of a session?

  Store the last "session length" for a session.  If the current packet
has a smaller session length, ignore the packet.  Otherwise, look at the
difference between the stored session length, and the session length in
the current packet.  Use that time for billing, rather than the time you
received the packet.

> 2. Is it a correct behavior of a NAS to store accounting information on
> it's internal disk if it can't get acknowledgment for accounting
> request/s and resend it later?

  Yes.

  Alan DeKok.



More information about the Freeradius-Users mailing list