Hi, I've done the same exercise on my side and have the following observations based on the debug output. 1.)The rlm_counter is only interested in Accounting Stop packets. 2.)If I send two subsequent Accounting Stop requests using the radclient and the file with the Accounting Stop AVP bundles, only the first one is used and the second one is ignored due to the fact that the packet with the unique ID is already recorded in the database and thus ignored: rlm_counter: Packet Unique ID = '9c5a417fc48a9b9e' rlm_counter: Searching the database for key 'aclice' rlm_counter: Key found. rlm_counter: Counter Unique ID = '8d3af3931deff832' rlm_counter: Unique IDs for user match. Droping the request. The Packet Unique ID is created by the acct_unique module in the preacct section: [acct_unique] WARNING: Attribute NAS-Identifier was not found in request, unique ID MAY be inconsistent [acct_unique] Hashing 'NAS-Port = 0,,NAS-IP-Address = 127.0.0.1,Acct-Session-Id = "4D2BB8AC-00000099",User-Name = "alice"' [acct_unique] Acct-Unique-Session-ID = "9c5a417fc48a9b9e". ++[acct_unique] returns ok This is covered in the pre-accounting section on page 133. Since this is a simulation, in the real world the next packet will have a different value for Acct-Session-Id. So by simply changing the value of Acct-Session-Id to 4D2BB8AC-00000099 in these files containing the AVP bundles and running the session simulation again you can see the following: rlm_counter: Packet Unique ID = '56a4675037d8b965' rlm_counter: Searching the database for key 'aclice' rlm_counter: Key found. rlm_counter: Counter Unique ID = '8d3af3931deff832' rlm_counter: User=aclice, Counter=30. rlm_counter: User=aclice, New Counter=60. rlm_counter: Storing new value in database. rlm_counter: New value stored successfully. ++[daily] returns ok So the important thing to remember if you want simulate a user's session is that the value of Acc-Session-Id needs to be unique for every simulated session. A session simulation will consist of an Accounting Start and Stop request (and also may include optional Accounting Interim-Update requests). With that in mind, refer again to the description of Acct-Session-Id on page 131. Although rlm_counter is primarily used as an introduction here to better understand the counter modules, the next section covers the rlm_sqlcounter module. This module is more flexible and preferred. Hope this helps you.
On Mon, Nov 12, 2012 at 2:29 PM, Dirk van der Walt <dirkvanderwalt@gmail.com> wrote:
Although rlm_counter is primarily used as an introduction here to better understand the counter modules, the next section covers the rlm_sqlcounter module. This module is more flexible and preferred.
If it were me I'd jump directly to rlm_sqlcounter. Among other things, it uses data stored by sql accounting, where the query is fully customizable. So you can (for example) change it to "if two acct-stop packets arrive with the same Acct-Unique-Session-ID, update the record to use whicever is higher". -- Fajar
On Mon, Nov 12, 2012 at 2:25 AM, Fajar A. Nugraha <list@fajar.net> wrote:
On Mon, Nov 12, 2012 at 2:29 PM, Dirk van der Walt <dirkvanderwalt@gmail.com> wrote:
Although rlm_counter is primarily used as an introduction here to better understand the counter modules, the next section covers the rlm_sqlcounter module. This module is more flexible and preferred.
If it were me I'd jump directly to rlm_sqlcounter. Among other things, it uses data stored by sql accounting, where the query is fully customizable. So you can (for example) change it to "if two acct-stop packets arrive with the same Acct-Unique-Session-ID, update the record to use whicever is higher".
-- Fajar - List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html
Appreciated your great info. Right now I will not go with sql, this will run pfsense in a neoware box and mysql is to heavy for, but I will follow your instructions and try sql. Let u know my output, thanks!!!
participants (3)
-
Dirk van der Walt -
Fajar A. Nugraha -
Periko Support