summaryrefslogtreecommitdiffstats
path: root/etc
diff options
context:
space:
mode:
authorScott Ullrich <sullrich@pfsense.org>2006-10-01 22:56:41 +0000
committerScott Ullrich <sullrich@pfsense.org>2006-10-01 22:56:41 +0000
commit6d8f4f7510cbe6a37082d2e8307a97b30068d029 (patch)
tree1eeca97fe2c2e23bb4f5dc510d733e4554713268 /etc
parent4b7cf2041982b07212ec10eb129c19ef82f722a9 (diff)
downloadpfsense-6d8f4f7510cbe6a37082d2e8307a97b30068d029.zip
pfsense-6d8f4f7510cbe6a37082d2e8307a97b30068d029.tar.gz
Duplicate function for compatibility.
Diffstat (limited to 'etc')
-rw-r--r--etc/inc/captiveportal.inc25
1 files changed, 25 insertions, 0 deletions
diff --git a/etc/inc/captiveportal.inc b/etc/inc/captiveportal.inc
index 1c44870..f85ef54 100644
--- a/etc/inc/captiveportal.inc
+++ b/etc/inc/captiveportal.inc
@@ -946,6 +946,31 @@ function captiveportal_write_elements() {
*
*/
+function get_next_ipfw_ruleno($rulenos_start = 10000, $rulenos_range_max = 9899) {
+
+ exec("/sbin/ipfw show", $fwrules);
+ foreach ($fwrules as $fwrule) {
+ preg_match("/^(\d+)\s+/", $fwrule, $matches);
+ $rulenos_used[] = $matches[1];
+ }
+ $rulenos_used = array_unique($rulenos_used);
+ $rulenos_range = count($rulenos_used);
+ if ($rulenos_range > $rulenos_range_max) {
+ return NULL;
+ }
+ $rulenos_pool = range($rulenos_start, ($rulenos_start + $rulenos_range));
+ $rulenos_free = array_diff($rulenos_pool, $rulenos_used);
+ $ruleno = array_shift($rulenos_free);
+
+ return $ruleno;
+}
+
+/*
+ * This function will calculate the lowest free firewall ruleno
+ * within the range specified based on the actual installed rules
+ *
+ */
+
function captiveportal_get_next_ipfw_ruleno($rulenos_start = 10000, $rulenos_range_max = 9899) {
exec("/sbin/ipfw show", $fwrules);
OpenPOWER on IntegriCloud