From 00de7de690df0beb8fff755518890878c1c7e41c Mon Sep 17 00:00:00 2001 From: jim-p Date: Thu, 4 Feb 2016 15:57:19 -0500 Subject: Fix multi-session time counting for the FreeRADIUS start/stop case. Ticket #2164 --- src/etc/inc/captiveportal.inc | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/etc/inc/captiveportal.inc b/src/etc/inc/captiveportal.inc index 1d173fe..1714a40 100644 --- a/src/etc/inc/captiveportal.inc +++ b/src/etc/inc/captiveportal.inc @@ -905,10 +905,17 @@ function captiveportal_disconnect($dbent, $radiusservers, $term_cause = 1, $stop /* this client needs to be deleted - remove ipfw rules */ if (isset($config['captiveportal'][$cpzone]['radacct_enable']) && !empty($radiusservers)) { + if ($config['captiveportal'][$cpzone]['reauthenticateacct'] == "stopstartfreeradius") { + /* Interim updates are on so the session time must be reported as the elapsed time since the previous interim update. */ + $session_time = ($stop_time - $dbent[0]) % 60; + $start_time = $stop_time - $session_time; + } else { + $start_time = $dbent[0]; + } RADIUS_ACCOUNTING_STOP($dbent[1], // ruleno $dbent[4], // username $dbent[5], // sessionid - $dbent[0], // start time + $start_time, // start time $radiusservers, $dbent[2], // clientip $dbent[3], // clientmac -- cgit v1.1