Problem with MySQL and Accouting-On record

Bjørn Mork bjorn at mork.no
Fri Nov 13 11:58:36 CET 2020


Ángel L. Mateo <amateo at um.es> writes:

> (3) # Executing section accounting from file /etc/freeradius/3.0/sites-enabled/buffered-sql-eduroam
> (3)   accounting {
> (3) sql: EXPAND %{tolower:type.%{%{Acct-Status-Type}:-%{Request-Processing-Stage}}.query}
> (3) sql:    --> type.accounting-on.query
> (3) sql: Using query template 'query'
> rlm_sql (sql): Reserved connection (0)
> (3) sql: EXPAND %{User-Name}
> (3) sql:    --> 
> (3) sql: SQL-User-Name set to ''
> (3) sql: EXPAND UPDATE radacct SET acctstoptime = FROM_UNIXTIME(%{integer:Event-Timestamp}), acctsessiontime	= '%{integer:Event-Timestamp}' - UNIX_TIMESTAMP(acctstarttime), acctterminatecause = '%{%{Acct-Terminate-Cause}:-NAS-Reboot}' WHERE acctstoptime IS NULL AND nasipaddress   = '%{NAS-IP-Address}' AND acctstarttime <= FROM_UNIXTIME(%{integer:Event-Timestamp})
> (3) sql:    --> UPDATE radacct SET acctstoptime = FROM_UNIXTIME(1605258058), acctsessiontime	= '1605258058' - UNIX_TIMESTAMP(acctstarttime), acctterminatecause = 'NAS-Reboot' WHERE acctstoptime IS NULL AND nasipaddress   = '155.54.213.6' AND acctstarttime <= FROM_UNIXTIME(1605258058)
> (3) sql: Executing query: UPDATE radacct SET acctstoptime = FROM_UNIXTIME(1605258058), acctsessiontime	= '1605258058' - UNIX_TIMESTAMP(acctstarttime), acctterminatecause = 'NAS-Reboot' WHERE acctstoptime IS NULL AND nasipaddress   = '155.54.213.6' AND acctstarttime <= FROM_UNIXTIME(1605258058)
> rlm_sql_mysql: Rows matched: 0  Changed: 0  Warnings: 0
> (3) sql: SQL query returned: success
> (3) sql: 0 record(s) updated
> (3) sql: Trying next query...
> (3) sql: EXPAND SELECT true
> (3) sql:    --> SELECT true
> (3) sql: Executing query: SELECT true
> (3) sql: SQL query returned: success
> (3) sql: -1 record(s) updated
> (3) sql: No additional queries configured
> rlm_sql (sql): Released connection (0)
> (3)     [sql] = noop
> (3)   } # accounting = noop
> (3) detail (/var/log/freeradius/radacct/eduroam/eduroam_sql): No response to request.  Will retry in 30 seconds
> (3) Finished request
> (3) Cleaning up request packet ID 1 with timestamp +20


The problem is obviously the "No response to request.  Will retry in 30
seconds" here.  Which is how RADIUS accounting is designed.  Requests
are repeated until acked or naked.  If not, then you might silently miss
requests. Which of course is unacceptable.

But back to the problem: You do want to ignore some of the accounting
requests. And you can define those to be ignored as the set where you
sql module returns noop.  Then simply turn that noop into ok at the end
of the accounting section:

        accounting {

                ... call the sql the accounting module etc

                # Always ACK on noop's.  Which may happen if the input is
                # considered invalid
                # the alternative would be to retransmit such packets forever...
                if (noop) {
                        ok
                }
        }


This will make your detail listener "ack" the accounting request, and it
will be removed from the work file.



Bjørn



More information about the Freeradius-Users mailing list