]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
add Event-Timestamp. Helps with #2887
authorAlan T. DeKok <aland@freeradius.org>
Fri, 16 Aug 2019 20:02:56 +0000 (16:02 -0400)
committerAlan T. DeKok <aland@freeradius.org>
Fri, 16 Aug 2019 20:02:56 +0000 (16:02 -0400)
packets should have timestamps.  If they don't, use the servers
idea of "now"

raddb/sites-available/default

index 1cac244587b189cc8670bc7c0c88a906dfbc6e8a..ea41cb0fd785549130a68eb1bdcdf4bdfdf29e16 100644 (file)
@@ -1396,9 +1396,18 @@ recv Accounting-Request {
        #  The start time is: NOW - delay - session_length
        #
 #      update request {
-#              &FreeRADIUS-Acct-Session-Start-Time = "%{expr: %l - %{%{Acct-Session-Time}:-0} - %{%{Acct-Delay-Time}:-0}}"
+#              &FreeRADIUS-Acct-Session-Start-Time = "%{expr: %{%{Event-Timestamp}:-%l} - %{%{Acct-Session-Time}:-0} - %{%{Acct-Delay-Time}:-0}}"
 #      }
 
+       #
+       #  The packet should have a timestamp.  If not, use "now" from the server.
+       #
+       if (!&Event-Timestamp) {
+               update request {
+                       Event-Timestamp := "%l"
+               }
+       }
+
        #
        #  Ensure that we have a semi-unique identifier for every
        #  request, as many NAS boxes are broken.