Sorry, the values I gave before were on a test db after I tested out the stop queries in the dialup.conf fille manually, so the values were incorrect. Here is the correct info
mysql> select sum(acctinputoctets + acctoutputoctets ) from radacct where username='scotty'; +------------------------------------------+ | sum(acctinputoctets + acctoutputoctets ) | +------------------------------------------+ | 1840263628 | +------------------------------------------+ 1 row in set (0.00 sec) mysql> select * from radcheck where username='scotty'; +------+----------+--------------------+----+------------+ | id | username | attribute | op | value | +------+----------+--------------------+----+------------+ | 5192 | Scotty | Auth-Type | := | Perl | | 5191 | Scotty | databank | := | -302340151 | | 5190 | Scotty | Cleartext-Password | := | DALNIC | +------+----------+--------------------+----+------------+ 3 rows in set (0.00 sec) original databank value = 262141750 as you can see the amount of traffic used, far exceeds what was "assigned" originally. I understand the negative value, Its something I can deal with to be a certain amount off but this is really bad. When I ran the queries manually I noticed that without quoting the radcheck.value in the accounting_stop_query_alt querie, it would not update the radcheck.value for databank. but once it is quoted seems, to work. I am going to keep an eye on it to see if it resolves itself. Im not too clued up on freeradius, so just to clear my mind to only way for a session to end is on a stop request(correct?) and even if interim updates are send, on the stop request it will show all data used in the session (not just just since the last update) On Mon, Feb 7, 2011 at 11:13 AM, Brian Candler <[email protected]> wrote: > On Mon, Feb 07, 2011 at 08:48:27AM +0200, Tyller D wrote: > > if ( $device =~ /^nomadix/i ) { > > if ($DATABANK != '') { > > if ( $DATABANK le 0 ) { > > $RAD_REPLY{'Reply-Message'} > > = "You have no more Data Left"; > > return RLM_MODULE_REJECT; > > }else { > > return RLM_MODULE_REJECT; > > > > $RAD_REPLY{'Nomadix-MaxBytesDown'} = "$DATABANK"; > > } > > That logic returns RLM_MODULE_REJECT in both branches of the if statement, > so I imagine you haven't copy-pasted it correctly. But I think I see what > you're getting at. > You are correct, it was a copy error > > > exctract from radcheck: > > +------+----------+--------------------+----+----------+ > > | id | username | attribute | op | value | > > +------+----------+--------------------+----+----------+ > > | 3069 | Joe | databank | := | 52428800 | > > | 3068 | Joe | Cleartext-Password | := | Joe123 | > > | 3070 | Joe | Auth-Type | := | Perl | > > +------+----------+--------------------+----+----------+ > > OK, so you're using radcheck as a convenient place to store the user's > remaining quota. I guess that should work. > > > but it not always exectuting stop request correctly because > > mysql> select sum(acctinputoctets + acctoutputoctets) from radacct > > where username='scotty'; > > +-----------------------------------------+ > > | sum(acctinputoctets + acctoutputoctets) | > > +-----------------------------------------+ > > | 1840263628 | > > +-----------------------------------------+ > > mysql> select value from radcheck where username='scotty' and > > attribute='databank'; > > +------------+ > > | value | > > +------------+ > > | -302340151 | > > +------------+ > > Well, those are two different things. The databank value will be whatever > original value you put in databank (which you haven't told us), minus the > bytes in and bytes out. So that would be correct if the initial value was > 1537923477 > > I have to say this looks like a pretty fragile way of doing accounting, > because you are relying 100% on Stop packets. This means: > > (1) A lost stop packet will not update databank > > (2) If a user stays online solidly for months, they won't get their quota > updated in the database > > Doing accounting based on interim-update packets is more robust. However, > they are cumulative (each interim-update packet shows the *total* used so > far for that session, just as if it were a Stop packet), so you can't just > subtract them from an accumulator. You need to add together the last > values > seen for each session. > - > List info/subscribe/unsubscribe? See > http://www.freeradius.org/list/users.html > This is something that I have been wanting to look at but I need to get this atleast to work as it should and I can update the process when I have some time. Thanks for the advice.
- List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html

