On Mon, Mar 01, 2004 at 09:22:56AM +0300, Alexander Lunyov wrote:
>     Well, i'm using exppp (http://shs.sumy.ua/, but it's in russian) on
>     FreeBSD box, and exppp understands his own attributes
>     (Exppp-Traffic-Limit and such), and i think it can kick user when
>     traffic exceeds. How can freeradius tell exppp, how much octets
>     user have for session? I mean, if all accounting information is in
>     mysql base, radius have to do simple SELECT to sql with sum()'s,
>     then substract this value (it will be number of octets) from some
>     fixed value of limit and give the result to exppp as
>     Exppp-Traffic-Limit. Well, or something like that. Can it be done
>     in FreeRadius? I mean, all those sql queries, substraction and all
>     of that?

You could configure a default entry like this:
DEFAULT Exppp-Traffic-Limit := %{sql:SELECT ...}

assuming you already have an instance of sql module.


>     Oh, it's interesting! I think something like this will help
>     (rlm_sqlcounter):
> 
> sqlcounter monthlytraffic {
>                 counter-name = Monthly-Traffic
>                 check-name = Max-Monthly-Traffic
>                 sqlmod-inst = sql
>                 key = User-Name
>                 reset = monthly
> 
>                 query = "SELECT (sum(AcctInputOctets)+sum(AcctOutputOctets))
>                 FROM radacct WHERE UserName='%{%k}' AND
>                 Month(AcctStopTime) =(Month(NOW())-1) AND
>                 Year(AcctStopTime) = Year(NOW())"
>     }

No, WHERE UserName = '%k' or WHERE UserName = '%u'.

You could probably use %b - unix time value of begginning of reset period
instead of Month()/Year()/NOW() calculations.


>     But, if i've understanded it right, this module reflects only on
>     logon process, i mean, it won't pass no attributes to NAS, it just
>     reject user if user's traffic is over, am i right? Still, radius
>     have to return traffic limit value to NAS (exppp), how can it (or i) do this?

rlm_counter adds Session-Timeout to the reply only if count-attribute is
Acct-Session-Time, but rlm_sqlcounter seems to always add Session-Timeout.
Not sane, really. You could try to patch rlm_sqlcounter to accept a new
configuration value, say reply-attribute defaulting to Session-Timeout.


-- 
Fduch M. Pravking

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

Reply via email to