<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">

<head>
<meta http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<meta name=Generator content="Microsoft Word 12 (filtered medium)">
<!--[if !mso]>
<style>
v\:* {behavior:url(#default#VML);}
o\:* {behavior:url(#default#VML);}
w\:* {behavior:url(#default#VML);}
.shape {behavior:url(#default#VML);}
</style>
<![endif]-->
<style>
<!--
 /* Font Definitions */
 @font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
@font-face
        {font-family:Consolas;
        panose-1:2 11 6 9 2 2 4 3 2 4;}
 /* Style Definitions */
 p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman","serif";
        color:black;}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
pre
        {mso-style-priority:99;
        mso-style-link:"HTML Preformatted Char";
        margin:0cm;
        margin-bottom:.0001pt;
        font-size:10.0pt;
        font-family:"Courier New";
        color:black;}
span.HTMLPreformattedChar
        {mso-style-name:"HTML Preformatted Char";
        mso-style-priority:99;
        mso-style-link:"HTML Preformatted";
        font-family:Consolas;
        color:black;}
span.EmailStyle19
        {mso-style-type:personal-reply;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-size:10.0pt;}
@page Section1
        {size:612.0pt 792.0pt;
        margin:70.85pt 70.85pt 2.0cm 70.85pt;}
div.Section1
        {page:Section1;}
-->
</style>
<!--[if gte mso 9]><xml>
 <o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
 <o:shapelayout v:ext="edit">
  <o:idmap v:ext="edit" data="1" />
 </o:shapelayout></xml><![endif]-->
</head>

<body bgcolor=white lang=DE link=blue vlink=purple>

<div class=Section1>

<p class=MsoNormal><span lang=EN-US>rlm_sqlcounter: Sent Reply-Item for user
scott, Type=Session-Traffic-Limit, value=12792<br>
<br>
</span><span lang=EN-US style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'><o:p></o:p></span></p>

<p class=MsoNormal><span lang=EN-US style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'>Which part don’t you understand? Sqlcounter returned it.
How does the log part of the RADIUS Packet looks like? It should contain the “Session-Traffic-Limit”
if it can be found in the dictionary, right?<o:p></o:p></span></p>

<p class=MsoNormal><span lang=EN-US style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'><o:p> </o:p></span></p>

<p class=MsoNormal><span lang=EN-US style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'>E:S<o:p></o:p></span></p>

<p class=MsoNormal><span lang=EN-US style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'><o:p> </o:p></span></p>

<div>

<div style='border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0cm 0cm 0cm'>

<p class=MsoNormal><b><span lang=EN-US style='font-size:10.0pt;font-family:
"Tahoma","sans-serif";color:windowtext'>From:</span></b><span lang=EN-US
style='font-size:10.0pt;font-family:"Tahoma","sans-serif";color:windowtext'>
freeradius-users-bounces+edvin.seferovic=kolp.at@lists.freeradius.org
[mailto:freeradius-users-bounces+edvin.seferovic=kolp.at@lists.freeradius.org] <b>On
Behalf Of </b>Alexandre Chapellon<br>
<b>Sent:</b> Samstag, 06. September 2008 01:53<br>
<b>To:</b> FreeRadius users mailing list<br>
<b>Subject:</b> sqlcounters for traffic<o:p></o:p></span></p>

</div>

</div>

<p class=MsoNormal><o:p> </o:p></p>

<p class=MsoNormal>I want to se sqlcounters to count bytes transferred from
clients so that i manage quota.<br>
Aiming this i configured the following counter:<br>
<br>
sqlcounter bytesQuota {<br>
        counter-name = traffic_quota<br>
        check-name = Max-Traffic<br>
        reply-name = Session-Traffic-Limit<br>
        sqlmod-inst = mysqldb<br>
        key = User-Name<br>
        reset = hourly<br>
        query = "SELECT
SUM(acctinputoctets + acctoutputoctets) FROM radacct WHERE
UserName='%{%k}'"<br>
}<br>
<br>
My first problem is that the Session-Traffic-Limit (from the redback
dictionnary) is not returned. I can't see it neither in the output of radtest
nor with radsniff.<br>
Yet, looking at the output of radiusd -X i can see it's correctly understood by
freeradius:<br>
<br>
rlm_sqlcounter: Check item is greater than query result<br>
rlm_sqlcounter: Authorized user scott, check_item=12000, counter=10891<br>
rlm_sqlcounter: Sent Reply-Item for user scott, Type=Session-Traffic-Limit,
value=12792<br>
++[bytesQuota] returns ok<br>
<br>
Does anyone has a clue?<br>
<br>
Alexandre Chapellon a écrit : <o:p></o:p></p>

<p class=MsoNormal>You're right, adding the name of my sqlcounter in the
instantiate section lake it works.<br>
thx :)<br>
<br>
Alan DeKok a écrit : <o:p></o:p></p>

<pre>Alexandre Chapellon wrote:<o:p></o:p></pre><pre>  <o:p></o:p></pre>

<blockquote style='margin-top:5.0pt;margin-bottom:5.0pt'><pre>whenever i launch freeradius -X I get the folloawing error:<o:p></o:p></pre><pre>/etc/freeradius/users[205]: Parse error (check) for entry scott: Invalid<o:p></o:p></pre><pre>octet string "101" for attribute name "Max-Traffic"<o:p></o:p></pre><pre>    <o:p></o:p></pre></blockquote>

<pre><o:p> </o:p></pre><pre>  The modules are initialized in *order*.  The sqlcounter module creates<o:p></o:p></pre><pre>the attributes on the fly.  But... it can't do this if it hasn't been<o:p></o:p></pre><pre>run yet.<o:p></o:p></pre><pre><o:p> </o:p></pre><pre>  <o:p></o:p></pre>

<blockquote style='margin-top:5.0pt;margin-bottom:5.0pt'><pre>Line 205 is the line where user scott is defined in users files.<o:p></o:p></pre><pre>I have tryed setting up my own dictionnary (which i think shouldn't be<o:p></o:p></pre><pre>needed) with the Max-Traffic attribute defined as interger<o:p></o:p></pre><pre><o:p> </o:p></pre><pre>VENDOR ME<o:p></o:p></pre><pre>ATTRIBUTE       Max-Traffic     1       integer<o:p></o:p></pre><pre>    <o:p></o:p></pre></blockquote>

<pre><o:p> </o:p></pre><pre>  That isn't the correct dictionary file format, but it's not relevant,<o:p></o:p></pre><pre>either.<o:p></o:p></pre><pre><o:p> </o:p></pre><pre>  <o:p></o:p></pre>

<blockquote style='margin-top:5.0pt;margin-bottom:5.0pt'><pre>But that doesn't help. I have read all over the web that sqlcounter with<o:p></o:p></pre><pre>mysql are considered as stable enough for production , so am quite<o:p></o:p></pre><pre>surprised of this issue...<o:p></o:p></pre><pre>Any idea?<o:p></o:p></pre><pre>    <o:p></o:p></pre></blockquote>

<pre><o:p> </o:p></pre><pre>  List "sqlcounter" in the "instantiate" section.  It will be<o:p></o:p></pre><pre>initialized before the "users" file is read.<o:p></o:p></pre><pre><o:p> </o:p></pre><pre>  Alan DeKok.<o:p></o:p></pre><pre>-<o:p></o:p></pre><pre>List info/subscribe/unsubscribe? See <a
href="http://www.freeradius.org/list/users.html">http://www.freeradius.org/list/users.html</a><o:p></o:p></pre><pre><o:p> </o:p></pre><pre>  <o:p></o:p></pre><pre><o:p> </o:p></pre><pre
style='text-align:center'>

<hr size=4 width="90%" align=center>

</pre><pre><o:p> </o:p></pre><pre>-<o:p></o:p></pre><pre>List info/subscribe/unsubscribe? See <a
href="http://www.freeradius.org/list/users.html">http://www.freeradius.org/list/users.html</a><o:p></o:p></pre></div>

</body>

</html>