Stale Session and Simultaneous-Use Question

Deepak d88pak at
Sun Aug 16 13:17:01 CEST 2009

On Sat, Aug 15, 2009 at 4:26 PM, Marinko Tarlac<mangia81 at> wrote:
> Just like I said... I already posted one solution on this list. In the same
> mail you will find 3 php lines for cron script and instructions for adding
> one column to radacct table...
> I won't be at home next 10 days so I'll post it again later if you can't
> find it...
> Best regards

Thanks for that.

I have searched and followed previous discussions regarding this
issues, which were quite old but no conclusion regarding the solution.

I guess there is no single solution which fits all problem (as kind of
problem is determined by the business logic).

At least I have general idea now.

In my case, I am trying to implement in (only) prepaid scenario. I
guess when AP is down and unique Session ID is lost, there is no way
to automatically detect the stale session from checking "radacct"
table only.

In my case (only prepaid) I can check (and detect) if user session
time is way far beyond his allowed time and do necessary adjustment.
There is still one flaw left in this logic as I have no way to find
out how much time user have consumed before the AP went down. If I
simply remove the entry from "radacct" table (which is equivalent to
rolling back his/her time) may solve the problem but with one flaw
again. If user have 30 mins left in his/her prepaid account and the AP
went down at his 25th minute session, he/she will get back all his 30
mins again (this can be one solution if acceptable).

Instead I plan to do this adjustment by hand (custom SQL) if user ever

My Logic:
User have to bear some time loss too. Some allocated time (about 15
mins) will be removed from his account when this happens. He/she can
use the account if there are still some time left after this action.


acctstoptime = acctstarttime + 900 (15 mins)
acctsessiontime = 900

But before doing this, I am not sure about some fields in "radacct"
table and their possible values

1) nasportid - What is this? sometimes I see it set as "1" and in
other entries it is set to "0"

2) Can I leave the "acctinputoctets" and "acctoutputoctets" as it is
(even if there is 0)? Since I don't plan to restrict the user on
bandwidth I don't need accurate data transfer accounting.

3) acctterminatecause - What are the possible values here? In my
table, I can see "User-Request" and "Session-Timeout". In the link I
mentioned in my previous post uses "User-Reset". This is the part I am
not sure on what is the appropriate value to use in this field.

Some suggestion is greatly appreciated.

Also I would like to see your cron script. Probably I can customize to
my own solution.

Thanks again

Registered Linux User #460714
Currently Using Fedora 10, CentOS 5.3

More information about the Freeradius-Users mailing list