Function Call to Get User's Attribute from Users File?

Arran Cudbard-Bell a.cudbardb at freeradius.org
Wed Oct 17 19:55:15 CEST 2012


On 17 Oct 2012, at 17:44, jobhunts02 at aol.com wrote:

> I have a vendor specific attribute, Max-Data-Bytes, defined for users to set a maximum data usage for each user.  I am using rlm_counter.c to keep track of how much a data usage a user has. When an Accounting-Request comes in, I update the total usage so far for the user. I would then like to compare this number to the user's Max-Data-Bytes value in the users file to determine if the user should be disconnected.
> 

counter module registers a paircompare on whatever you set counter-name to be, so just use this as a checkitem and it'll do all the magic to figure out the current value from the counter module.

I think the idea behind the counter module was to record session times, thought it may work for other things, it'll require patches for data counters, else you'll probably experience counter wrap.

I wouldn't attempt this on v2 as it's missing support for 64bit integers. But it shouldn't be too difficult to add 64bit counter support for v3, I suggest you start here:

https://github.com/FreeRADIUS/freeradius-server/blob/master/src/modules/rlm_counter/rlm_counter.c#L687

You'll also need to recombine Acct-Input/Output-Octers and Acct-Input/Output-Gigawords before calling the counter module in a 64bit attribute you define.

-Arran


More information about the Freeradius-Devel mailing list