Commit de5376b8 authored by Ad Schellevis's avatar Ad Schellevis

remove some unused captive_portal code

parent 5fa5cbb8
......@@ -1184,116 +1184,7 @@ function captiveportal_free_dn_ruleno($ruleno) {
unlock($cpruleslck);
}
function captiveportal_get_dn_passthru_ruleno($value) {
global $config, $g, $cpzone, $cpzoneid;
$cpcfg = $config['captiveportal'][$cpzone];
if(!isset($cpcfg['enable']))
return NULL;
$cpruleslck = lock("captiveportalrulesdn", LOCK_EX);
$ruleno = NULL;
if (file_exists("{$g['vardb_path']}/captiveportaldn.rules")) {
$rules = unserialize(file_get_contents("{$g['vardb_path']}/captiveportaldn.rules"));
unset($output);
$_gb = exec("/sbin/ipfw show | /usr/bin/grep " . escapeshellarg($value) . " | /usr/bin/grep -v grep | /usr/bin/awk '{print $5}' | /usr/bin/head -n 1", $output);
$ruleno = intval($output[0]);
if (!$rules[$ruleno])
$ruleno = NULL;
unset($rules);
}
unlock($cpruleslck);
return $ruleno;
}
/*
* This function will calculate the lowest free firewall ruleno
* within the range specified based on the actual logged on users
*
*/
function captiveportal_get_next_ipfw_ruleno($rulenos_start = 2, $rulenos_range_max = 64500) {
global $config, $g, $cpzone;
$cpcfg = $config['captiveportal'][$cpzone];
if(!isset($cpcfg['enable']))
return NULL;
$cpruleslck = lock("captiveportalrules{$cpzone}", LOCK_EX);
$ruleno = 0;
if (file_exists("{$g['vardb_path']}/captiveportal_{$cpzone}.rules")) {
$rules = unserialize(file_get_contents("{$g['vardb_path']}/captiveportal_{$cpzone}.rules"));
$ridx = $rulenos_start;
while ($ridx < $rulenos_range_max) {
if (empty($rules[$ridx])) {
$ruleno = $ridx;
$rules[$ridx] = $cpzone;
$ridx++;
$rules[$ridx] = $cpzone;
break;
} else {
/*
* This allows our traffic shaping pipes to be the in pipe the same as ruleno
* and the out pipe ruleno + 1.
*/
$ridx += 2;
}
}
} else {
$rules = array_pad(array(), $rulenos_range_max, false);
$ruleno = $rulenos_start;
$rules[$rulenos_start] = $cpzone;
$rulenos_start++;
$rules[$rulenos_start] = $cpzone;
}
file_put_contents("{$g['vardb_path']}/captiveportal_{$cpzone}.rules", serialize($rules));
unlock($cpruleslck);
unset($rules);
return $ruleno;
}
function captiveportal_free_ipfw_ruleno($ruleno) {
global $config, $g, $cpzone;
$cpcfg = $config['captiveportal'][$cpzone];
if(!isset($cpcfg['enable']))
return NULL;
$cpruleslck = lock("captiveportalrules{$cpzone}", LOCK_EX);
if (file_exists("{$g['vardb_path']}/captiveportal_{$cpzone}.rules")) {
$rules = unserialize(file_get_contents("{$g['vardb_path']}/captiveportal_{$cpzone}.rules"));
$rules[$ruleno] = false;
$ruleno++;
$rules[$ruleno] = false;
file_put_contents("{$g['vardb_path']}/captiveportal_{$cpzone}.rules", serialize($rules));
unset($rules);
}
unlock($cpruleslck);
}
function captiveportal_get_ipfw_passthru_ruleno($value) {
global $config, $g, $cpzone, $cpzoneid;
$cpcfg = $config['captiveportal'][$cpzone];
if(!isset($cpcfg['enable']))
return NULL;
$cpruleslck = lock("captiveportalrules{$cpzone}", LOCK_EX);
$ruleno = NULL;
if (file_exists("{$g['vardb_path']}/captiveportal_{$cpzone}.rules")) {
$rules = unserialize(file_get_contents("{$g['vardb_path']}/captiveportal_{$cpzone}.rules"));
unset($output);
$_gb = exec("/sbin/ipfw show | /usr/bin/grep " . escapeshellarg($value) . " | /usr/bin/grep -v grep | /usr/bin/awk '{print $1}' | /usr/bin/head -n 1", $output);
$ruleno = intval($output[0]);
if (!$rules[$ruleno])
$ruleno = NULL;
unset($rules);
}
unlock($cpruleslck);
return $ruleno;
}
/**
* This function will calculate the traffic produced by a client
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment