]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
clean up handling of Acct-Delay-Time
authorAlan T. DeKok <aland@freeradius.org>
Fri, 15 Sep 2023 12:33:51 +0000 (08:33 -0400)
committerAlan T. DeKok <aland@freeradius.org>
Fri, 15 Sep 2023 12:33:51 +0000 (08:33 -0400)
use new edit expressions, and check for sane Event-Timestamp

raddb/sites-available/detail

index e922e4bb95fdcd209af6d42f6fa1eb30926d2b38..68b6852af445c5b21738f21728a903e364782dcf 100644 (file)
@@ -235,7 +235,13 @@ server detail {
 #  The detail file reader runs the normal RADIUS / DHCP / etc. processing sections.
 #
 recv Accounting-Request {
-       &request.Acct-Delay-Time := "%{expr:%{%{Acct-Delay-Time}:-0} + %c - %(integer:%{%{Event-Timestamp}:-%{Packet-Original-Timestamp}})}"
+       if (!&Event-Timestamp) {
+               &Event-Timestamp := &Packet-Original-Timestamp
+       }
+
+       if (&Event-Timestamp < %c) {
+               &request.Acct-Delay-Time += %c - &Event-Timestamp
+       }
 
        #
        #  We handled the packet successfully.  Run the "send ok" section.