From 6f9f079e658e15d12ce7523628b696f7408616b1 Mon Sep 17 00:00:00 2001 From: Scott Ullrich Date: Fri, 27 May 2005 23:07:38 +0000 Subject: Use arp table to deterimine when we need to flush an old captive portal user from the pf table --- etc/inc/captiveportal.inc | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) (limited to 'etc/inc') diff --git a/etc/inc/captiveportal.inc b/etc/inc/captiveportal.inc index 7ec1fd4..4c4e5a9 100644 --- a/etc/inc/captiveportal.inc +++ b/etc/inc/captiveportal.inc @@ -263,8 +263,8 @@ function captiveportal_prune_old() { /* if an idle timeout is specified, get last activity timestamp from pf */ // XXX: we need a solution for this. if (!$timedout && $idletimeout) { - $lastact = captiveportal_get_last_activity($cpdb[$i][1]); - if ($lastact && ((time() - $lastact) >= $idletimeout)) + $isactive = captiveportal_get_last_activity($cpdb[$i][2]); + if($isactive == 0) $timedout = true; } @@ -439,18 +439,11 @@ function captiveportal_allowedip_configure() { } /* get last activity timestamp given pf table item */ -function captiveportal_get_last_activity($ruleno) { +function captiveportal_get_last_activity($ip) { - // XXX: this needs a solution - //exec("/sbin/ipfw -T list {$ruleno} 2>/dev/null", $ipfwoutput); + $info = `/usr/sbin/arp | /usr/bin/grep $ip`; - /* - if ($ipfwoutput[0]) { - $ri = explode(" ", $ipfwoutput[0]); - if ($ri[1]) - return $ri[1]; - } - */ + if($info <> "") return 1; return 0; } -- cgit v1.1