* Fix sqlcounter wrong memory free. PR #4192 from Jorge Pereira
* Accept slow writes from proxies over TCP, which allows the
server to make more progress when it receives partial packets.
+ * Add 'weeklycounter' for rlm_sqlcounter.
FreeRADIUS 3.0.23 Thu 10 Jun 2021 12:00:00 EDT urgency=low
Feature improvements
$INCLUDE ${modconfdir}/sql/counter/${dialect}/${.:instance}.conf
}
+sqlcounter weeklycounter {
+ sql_module_instance = sql
+ dialect = ${modules.sql.dialect}
+
+ counter_name = Weekly-Session-Time
+ check_name = Max-Weekly-Session
+ reply_name = Session-Timeout
+
+ key = User-Name
+ reset = weekly
+
+ $INCLUDE ${modconfdir}/sql/counter/${dialect}/${.:instance}.conf
+}
+
sqlcounter monthlycounter {
sql_module_instance = sql
dialect = ${modules.sql.dialect}
--- /dev/null
+#
+# This query properly handles calls that span from the
+# previous reset period into the current period but
+# involves more work for the SQL server than those
+# below
+#
+query = "\
+ SELECT SUM(acctsessiontime - GREATEST((%%b - UNIX_TIMESTAMP(acctstarttime)), 0)) \
+ FROM radacct \
+ WHERE username = '%{${key}}' \
+ AND UNIX_TIMESTAMP(acctstarttime) + acctsessiontime > '%%b'"
--- /dev/null
+#
+# This query properly handles calls that span from the
+# previous reset period into the current period but
+# involves more work for the SQL server than those
+# below
+#
+query = "\
+ SELECT SUM(AcctSessionTime - GREATEST((%%b - EXTRACT(epoch FROM AcctStartTime)), 0)) \
+ FROM radacct \
+ WHERE UserName='%{${key}}' \
+ AND EXTRACT(epoch FROM AcctStartTime) + AcctSessionTime > '%%b'"
+
--- /dev/null
+#
+# This query properly handles calls that span from the
+# previous reset period into the current period but
+# involves more work for the SQL server than those
+# below
+#
+query = "\
+ SELECT SUM(acctsessiontime - GREATEST((%%b - strftime('%%s', acctstarttime)), 0)) \
+ FROM radacct \
+ WHERE username = '%{${key}}' \
+ AND (strftime('%%s', acctstarttime) + acctsessiontime) > %%b"
+