diff options
author | Ermal <eri@pfsense.org> | 2013-11-23 19:32:49 +0000 |
---|---|---|
committer | Ermal <eri@pfsense.org> | 2013-11-23 19:32:49 +0000 |
commit | fcaf17090a6ef2beb85f1220048b3e7ea53b105d (patch) | |
tree | c09f90957e58479666f1e545feb5c053e8d64dca | |
parent | e5f2cf3a94efd552a3e19fb2ea7dcee36a00df79 (diff) | |
download | pfsense-fcaf17090a6ef2beb85f1220048b3e7ea53b105d.zip pfsense-fcaf17090a6ef2beb85f1220048b3e7ea53b105d.tar.gz |
Catch up with mac needed for all operations in the table nowdays.
-rw-r--r-- | etc/inc/captiveportal.inc | 18 | ||||
-rw-r--r-- | usr/local/captiveportal/radius_accounting.inc | 2 | ||||
-rwxr-xr-x | usr/local/www/status_captiveportal.php | 2 | ||||
-rw-r--r-- | usr/local/www/widgets/widgets/captive_portal_status.widget.php | 4 |
4 files changed, 13 insertions, 13 deletions
diff --git a/etc/inc/captiveportal.inc b/etc/inc/captiveportal.inc index b7a7850..0da28d9 100644 --- a/etc/inc/captiveportal.inc +++ b/etc/inc/captiveportal.inc @@ -664,7 +664,7 @@ function captiveportal_prune_old() { $uidletimeout = (is_numeric($cpentry[8])) ? $cpentry[8] : $idletimeout; /* if an idle timeout is specified, get last activity timestamp from ipfw */ if (!$timedout && $uidletimeout > 0) { - $lastact = captiveportal_get_last_activity($cpentry[2]); + $lastact = captiveportal_get_last_activity($cpentry[2], $cpentry[3]); /* If the user has logged on but not sent any traffic they will never be logged out. * We "fix" this by setting lastact to the login timestamp. */ @@ -712,8 +712,8 @@ function captiveportal_prune_old() { $cpentry[2], // clientip $cpentry[3], // clientmac 10); // NAS Request - $_gb = @pfSense_ipfw_Tableaction($cpzone, IP_FW_TABLE_ZERO_ENTRY_STATS, 1, $cpentry[2]); - $_gb = @pfSense_ipfw_Tableaction($cpzone, IP_FW_TABLE_ZERO_ENTRY_STATS, 2, $cpentry[2]); + $_gb = @pfSense_ipfw_Tableaction($cpzone, IP_FW_TABLE_ZERO_ENTRY_STATS, 1, $cpentry[2], $cpentry[3]); + $_gb = @pfSense_ipfw_Tableaction($cpzone, IP_FW_TABLE_ZERO_ENTRY_STATS, 2, $cpentry[2], $cpentry[3]); RADIUS_ACCOUNTING_START($cpentry[1], // ruleno $cpentry[4], // username $cpentry[5], // sessionid @@ -856,8 +856,8 @@ function captiveportal_disconnect($dbent, $radiusservers,$term_cause = 1,$stop_t if (is_ipaddr($dbent[2])) { /* Delete client's ip entry from tables 1 and 2. */ - $_gb = @pfSense_ipfw_Tableaction($cpzone, IP_FW_TABLE_DEL, 1, $dbent[2]); - $_gb = @pfSense_ipfw_Tableaction($cpzone, IP_FW_TABLE_DEL, 2, $dbent[2]); + $_gb = @pfSense_ipfw_Tableaction($cpzone, IP_FW_TABLE_DEL, 1, $dbent[2], $dbent[3]); + $_gb = @pfSense_ipfw_Tableaction($cpzone, IP_FW_TABLE_DEL, 2, $dbent[2], $dbent[3]); /* XXX: Redundant?! Ensure all pf(4) states are killed. */ $_gb = @pfSense_kill_states($dbent[2]); $_gb = @pfSense_kill_srcstates($dbent[2]); @@ -1096,10 +1096,10 @@ function captiveportal_allowedip_configure() { } /* get last activity timestamp given client IP address */ -function captiveportal_get_last_activity($ip) { +function captiveportal_get_last_activity($ip, $mac = NULL) { global $cpzone; - $ipfwoutput = pfSense_ipfw_getTablestats($cpzone, 1, $ip); + $ipfwoutput = pfSense_ipfw_getTablestats($cpzone, 1, $ip, $mac); /* Reading only from one of the tables is enough of approximation. */ if (is_array($ipfwoutput)) { return $ipfwoutput['timestamp']; @@ -1544,7 +1544,7 @@ function captiveportal_get_ipfw_passthru_ruleno($value) { * */ -function getVolume($ip) { +function getVolume($ip, $mac = NULL) { global $config, $cpzone; $reverse = empty($config['captiveportal'][$cpzone]['reverseacct']) ? false : true; @@ -1552,7 +1552,7 @@ function getVolume($ip) { // Initialize vars properly, since we don't want NULL vars $volume['input_pkts'] = $volume['input_bytes'] = $volume['output_pkts'] = $volume['output_bytes'] = 0 ; - $ipfw = pfSense_ipfw_getTablestats($cpzone, 1, $ip); + $ipfw = pfSense_ipfw_getTablestats($cpzone, 1, $ip, $mac); if (is_array($ipfw)) { if ($reverse) { $volume['output_pkts'] = $ipfw['packets']; diff --git a/usr/local/captiveportal/radius_accounting.inc b/usr/local/captiveportal/radius_accounting.inc index d2b4d50..3d0bc0a 100644 --- a/usr/local/captiveportal/radius_accounting.inc +++ b/usr/local/captiveportal/radius_accounting.inc @@ -176,7 +176,7 @@ function RADIUS_ACCOUNTING_STOP($ruleno,$username,$sessionid,$start_time,$radius $radiusvendor = $config['captiveportal'][$cpzone]['radiusvendor'] ? $config['captiveportal'][$cpzone]['radiusvendor'] : null; $stop_time = (empty($stop_time)) ? time() : $stop_time; $session_time = $stop_time - $start_time; - $volume = getVolume($clientip); + $volume = getVolume($clientip, $clientmac); $volume['input_bytes_radius'] = remainder($volume['input_bytes']); $volume['input_gigawords'] = gigawords($volume['input_bytes']); $volume['output_bytes_radius'] = remainder($volume['output_bytes']); diff --git a/usr/local/www/status_captiveportal.php b/usr/local/www/status_captiveportal.php index 2325b3c..d84e9b2 100755 --- a/usr/local/www/status_captiveportal.php +++ b/usr/local/www/status_captiveportal.php @@ -172,7 +172,7 @@ $mac_man = load_mac_manufacturer_table(); <td class="listr"><?=$cpent[4];?> </td> <td class="listr"><?=htmlspecialchars(date("m/d/Y H:i:s", $cpent[0]));?></td> <?php if ($_GET['showact']): - $last_act = captiveportal_get_last_activity($cpent[2]); ?> + $last_act = captiveportal_get_last_activity($cpent[2], $cpent[3]); ?> <td class="listr"><?php if ($last_act != 0) echo htmlspecialchars(date("m/d/Y H:i:s", $last_act));?></td> <?php endif; ?> <td valign="middle" class="list" nowrap> diff --git a/usr/local/www/widgets/widgets/captive_portal_status.widget.php b/usr/local/www/widgets/widgets/captive_portal_status.widget.php index 245b65b..d773877 100644 --- a/usr/local/www/widgets/widgets/captive_portal_status.widget.php +++ b/usr/local/www/widgets/widgets/captive_portal_status.widget.php @@ -67,7 +67,7 @@ foreach ($a_cp as $cpzone => $cp) { foreach ($cpdb as $cpent) { $cpent[10] = $cpzone; if ($_GET['showact']) - $cpent[11] = captiveportal_get_last_activity($cpent[2]); + $cpent[11] = captiveportal_get_last_activity($cpent[2], $cpentry[3]); $cpdb_all[] = $cpent; } } @@ -111,4 +111,4 @@ if ($_GET['order']) { <a href="?order=<?=$_GET['order'];?>&showact=<?=$_GET['showact'];?>&act=del&zone=<?=$cpent[10];?>&id=<?=$cpent[5];?>" onclick="return confirm('Do you really want to disconnect this client?')"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_x.gif" width="17" height="17" border="0" alt="x" /></a></td> </tr> <?php endforeach; ?> -</table>
\ No newline at end of file +</table> |