<div dir="ltr"><div> </div>
<div>I've actually tested the sqlcounter for a data counter for both weekly and monthly resets and that doesn't work well either...</div>
<div>This is odd because people have reported this working so... it is either something in the configuration that I'm missing</div>
<div>or I really don't know what's going on but the counter seem to behave as expected.</div>
<div> </div>
<div> </div>
<div>Regards,</div>
<div>Liran.<br><br></div>
<div class="gmail_quote">2008/10/25 <span dir="ltr"><<a href="mailto:tnt@kalik.net">tnt@kalik.net</a>></span><br>
<blockquote class="gmail_quote" style="PADDING-LEFT: 1ex; MARGIN: 0px 0px 0px 0.8ex; BORDER-LEFT: #ccc 1px solid">OK. This where the "problem" comes from:<br><br>               /*<br>                *      If we are near a reset then add the next<br>
                *      limit, so that the user will not need to<br>                *      login again<br>                */<br>               if (data->reset_time &&<br>                   (res >= (data->reset_time - request->timestamp))) {<br>
                       res = data->reset_time - request->timestamp;<br>                       res += check_vp->vp_integer;<br>               }<br><br>(that's rlm_sqlcounter.c line about 710 in 2.0.5)<br><br>Sqlcounter was designed for time counters. When your allowance (limit -<br>
time used) is greater than the time left in the period, time left in the<br>period is added to the limit and sent as reply.<br><br>This will create problems for data counters since limit values are much<br>greater than those for time counters. As a workaround I would suggest<br>
that you comment this out if you are using data counters.<br><br>Perhaps there is a case for adding another configuration item to<br>sqlcounter that would determine what is counted time or data. Then for<br>data counters this can be skipped or replaced with something like:<br>
<br>if (data->reset_time && (trigger >= (data->reset_time -<br>request->timestamp))) {<br>    res += check_vp->vp_integer;<br>}<br><br>where trigger would be set to a minute for hourly counter and hour for<br>
daily, weekly and monthly counters. I am sorry but I don't know how to<br>write a patch.<br>
<div class="Ih2E3d"><br>Ivan Kalik<br>Kalik Informatika ISP<br><br></div>
<div class="Ih2E3d">Dana 24/10/2008, "liran tal" <<a href="mailto:liransgarage@gmail.com">liransgarage@gmail.com</a>> piše:<br><br>>Hey Ivan<br>><br>>2008/10/24 <<a href="mailto:tnt@kalik.net">tnt@kalik.net</a>><br>
><br>>> It (daily sqlcounter) does the same in 2.0.5:<br>>><br>>> rlm_sqlcounter: Authorized user jagoda, check_item=10000000, counter=2635<br>>> rlm_sqlcounter: Sent Reply-Item for user jagoda, Type=Session-Timeout,<br>
>> value=10027850<br>>><br>>> Returns value that is greater than the limit. I am using noreset<br>>> sqlcounter and that one works fine.<br>><br>><br>>Thanks for confirming this on a more up to date version.<br>
>Alan, this smells like a bug (unless we missed something along the way),<br>>should I open up a bug ticket?<br>>And what would be the chances it can be backported to 1.1.7?<br>><br>>Thanks,<br>>Liran.<br>
<br></div>
<div>
<div></div>
<div class="Wj3C7c">-<br>List info/subscribe/unsubscribe? See <a href="http://www.freeradius.org/list/users.html" target="_blank">http://www.freeradius.org/list/users.html</a><br></div></div></blockquote></div><br></div>