diff --git a/etc/inc/captiveportal.inc b/etc/inc/captiveportal.inc index 9f1094470b..94741330c4 100644 --- a/etc/inc/captiveportal.inc +++ b/etc/inc/captiveportal.inc @@ -461,6 +461,10 @@ function captiveportal_prune_old() { $timedout = false; $term_cause = 1; + /* no pruning for fixed mac address entry */ + if (portal_mac_fixed($cpdb[$i][3])) { + continue; // check next value + } /* hard timeout? */ if ($timeout) { if ((time() - $cpdb[$i][0]) >= $timeout) { @@ -1095,4 +1099,25 @@ function getNasIP() return $nasIp; } -?> +function portal_mac_fixed($clientmac) { + global $g ; + + /* open captive portal mac db */ + if (file_exists("{$g['vardb_path']}/captiveportal_mac.db")) { + $fd = @fopen("{$g['vardb_path']}/captiveportal_mac.db","r") ; + if (!$fd) { + return FALSE; + } + while (!feof($fd)) { + $mac = trim(fgets($fd)) ; + if(strcasecmp($clientmac, $mac) == 0) { + fclose($fd) ; + return TRUE ; + } + } + fclose($fd) ; + } + return FALSE ; +} + +?> \ No newline at end of file