sqlcounter returning wrong value?

Venkatesh K kaevee at gmail.com
Sun Nov 9 05:00:13 CET 2008


Hi Liran,

On Sun, Nov 9, 2008 at 4:16 AM, liran tal <liransgarage at gmail.com> wrote:
> Hey Venkatesh,
>
> On Fri, Oct 31, 2008 at 2:26 AM, Venkatesh K <kaevee at gmail.com> wrote:
>>
>> 2008/10/31  <tnt at kalik.net>:
>> > It does make sense. rlm_sqlcounterworks like this toward the time of the
>> > reset: lets say you have an hour left, your limit is 20 hours and you
>> > have signed in 15 minutes before counter reset time.  When code
>> > calculates that you can be online at reset time it doesn't return your
>> > allowance (1 hour) but adds the limit for the next conting period (20
>> > hours) to the remaining time (15 minutes) and returns that value (20
>> > hours and 15 minutes). Reasoning is that your session shouldn't be
>> > discontinued after an hour becouse 15 minutes into the session new limit
>> > should come into force (and session limit can't be changed during the
>> > session).
>> >
>> > In your case there is about 2,000,000 left on the counter but only a few
>> > thousand seconds left to the end of the reset period, so code will add
>> > those few thousands to the next period limit (26,000,000) and return
>> > that value. Code doesn't "know" are you counting data or time as
>> > there is  no such configuration item.
>> >
>> > Venkatesh had posted the patch that switches off this peace of code for
>> > data counters by introducing that configuration item. You should try it.
>>
>> rlm_sqlcounter has one more limitation. In version 1.1.7, the maximum
>> counter value was limited to <2G whereas in 2.1.1 it seems to be <4G.
>> This imposes an artificial limitation of maximum of 4GB of downloads.
>> I had a workaround where I patched rlm_sqlcounter to limit the per
>> session downloads to 4GB if allowed usage exceeds 4GB.
>>
>> Except this issue, I think, with the patch I posted earlier, one
>> should be fine with rlm_sqlcounter. If someone needs a patch to work
>> around the 2GB/4GB limit, I will post the patch.
>
>
> Sorry for the late reply.
> I applied your patch and now data counters work as expected with a minor
> exception, the 2Gb limit
> as you have stated previously. Possibly you could also post the patch for
> the 2Gb/4Gb limit?
> I'm hoping it's compatible with FR 1.1.7 as well.
>

It is ok. I am happy to know it works for you. I will email you a
patch for 1.1.7 in couple of days. The patch is going to impose
certain limitations on you. The maximum return value should be less
than unsigned integer(32bit). The maximum reply value for data will be
limited to 4GB even if actual value is more than 4GB. So, there will
be a per session limit of 4GB though user is authorized to transfer
more data.

Regards,

Venkatesh. K



More information about the Freeradius-Users mailing list