rlm_sqlcounter developer required

Seferovic Edvin edvin.seferovic at kolp.at
Tue May 16 19:22:44 CEST 2006


Well, you just hit the point where you have to alter the code of freeradius
( rlm_sqlcounter to be precise ). Sqlcounter returns SessionTime ( as usual
). You have to change sqlcounter.c.. the function sqlcounter_authorize has
the part that you would like to change. Here you should check the
documentation of your NAS to be sure which attribute it expects to become
from a freeradius server ( probably something Like *Octets ). Then add this
attribute to the dictionary file of the server and you should need to add it
to the header file which contains attributes and their numbers. Be sure that
you have the same number like in the dictionary file.

 

In the function sqlcounter_authorize ( line 676 ) you'll find reply_item =
paircreate(PW_SOMETHING, PW_TYPE_INTEGER)) in an ELSE block. Instead of
PW_SOMETHING, you should enter PW_YOUR_ATTRIBUTE_NAME !! 

 

Recompile, install and freeradius will return your attribute to NAS (
actually - it will return the difference between check-name and the value
which is returned by the query ).

 

Hope this helps...

 

I will probably send a patch to freeradius developers that will contain this
functionality ( returning a specific value ) for traffic accounting ( ie ).

 

Regards,

 

Edvin Seferovic

 

  _____  

From: freeradius-users-bounces+edvin.seferovic=kolp.at at lists.freeradius.org
[mailto:freeradius-users-bounces+edvin.seferovic=kolp.at at lists.freeradius.or
g] On Behalf Of Mark Lovatt
Sent: Dienstag, 16. Mai 2006 14:04
To: edvin.seferovic at kolp.at; 'FreeRadius users mailing list'
Subject: RE: rlm_sqlcounter developer required

 

I have been able to configure it to count traffic instead of time, but only
when a user first logs in, it'll then allow or deny them access, however it
doesn't return any attributes such as Max-Input_octets = ??, where ?? is
some value(ie account balance) less the sum of acctinputoctets, this would
allow the NAS to disconnect a client during the session, ie client has 5Mb
on their account, they login but are disconnected after 5Mb of throughput.

 

This is what I've done so far, but it only works on login and doesn't return
any attributes:

 

sqlcounter monthlybandwidthcounter {

                counter-name = Max-Bytes

                check-name = Max-Bytes

                sqlmod-inst = sql

                key = User-Name

                reset = monthly

                Reply-Message = "You have reached your bandwidth cap for
this Month"

                query = "SELECT sum(AcctOutputOctets) + sum(AcctInputOctets)
FROM radacct where UserName = '%{%k}'"

        }

 

I'm using a Colubris MSC-5200

 

R

 

Mark

 

  _____  

From:
freeradius-users-bounces+mlovatt=catalystmanagement.co.uk at lists.freeradius.o
rg
[mailto:freeradius-users-bounces+mlovatt=catalystmanagement.co.uk at lists.free
radius.org] On Behalf Of Seferovic Edvin
Sent: 16 May 2006 11:59
To: 'FreeRadius users mailing list'
Subject: RE: rlm_sqlcounter developer required

 

Hi,

 

I have been working with sqlcounter and for few of my installations I have
changed it funcionality so it is able to count traffic instead of time. 

 

What do you need ? What is your NAS ?

 

Send me a mail off the list if you need some specific solution.

 

Regards,

 

Edvin

 

  _____  

From: freeradius-users-bounces+edvin.seferovic=kolp.at at lists.freeradius.org
[mailto:freeradius-users-bounces+edvin.seferovic=kolp.at at lists.freeradius.or
g] On Behalf Of Mark Lovatt
Sent: Dienstag, 16. Mai 2006 12:51
To: freeradius-users at lists.freeradius.org
Subject: rlm_sqlcounter developer required

 

Hi,

 

I'm using rlm_sqlcounter to limit the amount of time my users can stay
connected to a NAS, which works very well, as you know, it SUMS the amount
of time a users has been online by querying the radacct table then returns a
Session-Timeout attribute.

 

My NAS supports Max-Input_octets and Max-Output-Octets attributes, I'd like
to perform an SQL SUM on AccInputOctets and AccOutputOctets during the
authorize phase then return these two attributes to set the max amount of
bandwidth a user can use.

 

I've spent all day reading about rlm_sqlcounter, this functionality isn't
available but has been talked about previously, what I'm really asking for,
since my C knowledge is a little rusty and I'm a bit pressed for time is for
one of you guys to patch this module for me, for a price of course.

 

R

 

Mark 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freeradius.org/pipermail/freeradius-users/attachments/20060516/f809b8b4/attachment.html>


More information about the Freeradius-Users mailing list