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: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Mark Lovatt
Sent: Dienstag, 16. Mai 2006 14:04
To: [EMAIL PROTECTED]; '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: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] 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: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Mark Lovatt
Sent: Dienstag, 16. Mai 2006 12:51
To: [email protected]
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

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

Reply via email to