sqlcounter returning wrong value?

liran tal liransgarage at gmail.com
Sat Oct 25 17:38:35 CEST 2008


I've actually tested the sqlcounter for a data counter for both weekly and
monthly resets and that doesn't work well either...
This is odd because people have reported this working so... it is either
something in the configuration that I'm missing
or I really don't know what's going on but the counter seem to behave as
expected.


Regards,
Liran.

2008/10/25 <tnt at kalik.net>

> OK. This where the "problem" comes from:
>
>                /*
>                 *      If we are near a reset then add the next
>                 *      limit, so that the user will not need to
>                 *      login again
>                 */
>                if (data->reset_time &&
>                    (res >= (data->reset_time - request->timestamp))) {
>                        res = data->reset_time - request->timestamp;
>                        res += check_vp->vp_integer;
>                }
>
> (that's rlm_sqlcounter.c line about 710 in 2.0.5)
>
> Sqlcounter was designed for time counters. When your allowance (limit -
> time used) is greater than the time left in the period, time left in the
> period is added to the limit and sent as reply.
>
> This will create problems for data counters since limit values are much
> greater than those for time counters. As a workaround I would suggest
> that you comment this out if you are using data counters.
>
> Perhaps there is a case for adding another configuration item to
> sqlcounter that would determine what is counted time or data. Then for
> data counters this can be skipped or replaced with something like:
>
> if (data->reset_time && (trigger >= (data->reset_time -
> request->timestamp))) {
>     res += check_vp->vp_integer;
> }
>
> where trigger would be set to a minute for hourly counter and hour for
> daily, weekly and monthly counters. I am sorry but I don't know how to
> write a patch.
>
> Ivan Kalik
> Kalik Informatika ISP
>
> Dana 24/10/2008, "liran tal" <liransgarage at gmail.com> piše:
>
> >Hey Ivan
> >
> >2008/10/24 <tnt at kalik.net>
> >
> >> It (daily sqlcounter) does the same in 2.0.5:
> >>
> >> rlm_sqlcounter: Authorized user jagoda, check_item=10000000,
> counter=2635
> >> rlm_sqlcounter: Sent Reply-Item for user jagoda, Type=Session-Timeout,
> >> value=10027850
> >>
> >> Returns value that is greater than the limit. I am using noreset
> >> sqlcounter and that one works fine.
> >
> >
> >Thanks for confirming this on a more up to date version.
> >Alan, this smells like a bug (unless we missed something along the way),
> >should I open up a bug ticket?
> >And what would be the chances it can be backported to 1.1.7?
> >
> >Thanks,
> >Liran.
>
>  -
> List info/subscribe/unsubscribe? See
> http://www.freeradius.org/list/users.html
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freeradius.org/pipermail/freeradius-users/attachments/20081025/de7849d1/attachment.html>


More information about the Freeradius-Users mailing list