Class attribute in accounting record.

tnt at kalik.co.yu tnt at kalik.co.yu
Mon Oct 29 16:20:15 CET 2007


You can use CHAR() in the sql statement if you recieving Class attribute
ASCII encoded.

Ivan Kalik
Kalik Informatika ISP


Dana 29/10/2007, "Mark J Elkins" <mje at posix.co.za> piše:

>My access provider is setting and sending me the "Class" attribute in an
>accounting record...
>
>I use MySQL to store such info in... and I'm using freeradius 1.1.6
>
>in order to Capture the value - I modified all accounting "Insert"
>statements to.... (as an example)
>
>accounting_start_query = "INSERT into ${acct_table1} (AcctSessionId,
>AcctUniqueId, UserName, Realm, NASIPAddress, NASPortId, NASPortType,
>AcctStartTime, AcctStopTime, AcctSessionTime, AcctAuthentic,
>ConnectInfo_start, ConnectInfo_stop, AcctInputOctets, AcctOutputOctets,
>CalledStationId, CallingStationId, AcctTerminateCause, ServiceType,
>FramedProtocol, FramedIPAddress, AcctStartDelay, AcctStopDelay, Class)
>values('%{Acct-Session-Id}', '%{Acct-Unique-Session-Id}',
>'%{SQL-User-Name}', '%{Realm}', '%{NAS-IP-Address}', '%{NAS-Port}',
>'%{NAS-Port-Type}', '%S', '0', '0', '%{Acct-Authentic}',
>'%{Telkom-Access-Type:-!SAIX} %{Connect-Info}', '', '0', '0',
>'%{Called-Station-Id}', '%{Calling-Station-Id}', '', '%{Service-Type}',
>'%{Framed-Protocol}', '%{Framed-IP-Address}', '%{Acct-Delay-Time}', '0',
>'%{Class}')"
>
>This captures the info fine.... (yes - also changed the MySQL table)
>
>| RadAcctId | AcctSessionId        | AcctUniqueId     |
>UserName                        | Realm        | NASIPAddress |
>NASPortId  | NASPortType | AcctStartTime       | AcctStopTime        |
>AcctSessionTime | AcctAuthentic | ConnectInfo_start | ConnectInfo_stop |
>AcctInputOctets | AcctOutputOctets | CalledStationId | CallingStationId
>| AcctTerminateCause | ServiceType | FramedProtocol | FramedIPAddress |
>AcctStartDelay | AcctStopDelay | Class    |
>+-----------+----------------------+------------------+---------------------------------+--------------+--------------+------------+-------------+---------------------+---------------------+-----------------+---------------+-------------------+------------------+-----------------+------------------+-----------------+------------------+--------------------+-------------+----------------+-----------------+----------------+---------------+----------+
>|  21488415 | 7/0/0/2.157_13B0EB0F | 32161edf2c7a5dec |
>xxxxxxxxxxxxxxx at xxxxxxxxxxx | realmname | 1.2.3.4 | 1879179421 |
>Virtual     | 2007-10-29 16:15:07 | 0000-00-00 00:00:00 |
>0 | RADIUS        | DSL AutoShapedVC  |                  |
>0 |                0 |                 |
>|                    | Framed-User | PPP            | 1.2.4.99
>|              0 |             0 | 0x4e5331 |
>
>
>.... However - I get a Hex String ... 0x4e5331 - where I was expecting "NS1"
>
>Reading the RFC's (with FreeRadius documentation) - this should be a
>Char Octets kindof field...
>
>Should the access provider sent the string in ASCII rather?
>Did something in FreeRadius convert the ASCII to Hex?
>What can I do to convert this on the fly into ASCII - save a bit of
>space in my Database - etc.
>
>Reading the mailing-lists archives - I see that it can contain binary
>data - thus the Hex.
>Which is "better" - to change the dictionary definition from octet to
>string or some sort of mysql function call?
>(better ==> less things to remember/patch between updates)
>The access provider states that the info provided will always be ascii
>(or translate to ascii - if decoded).
>
>--
>  .  .     ___. .__      Posix Systems - Sth Africa
> /| /|       / /__       mje at posix.co.za  -  Mark J Elkins, SCO ACE, Cisco CCIE
>/ |/ |ARK \_/ /__ LKINS  Tel: +27 12 807 0590  Cell: +27 82 601 0496
>
>-
>List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html
>
>




More information about the Freeradius-Users mailing list