summaryrefslogtreecommitdiffstats
path: root/usr
diff options
context:
space:
mode:
authorErmal <eri@pfsense.org>2012-12-17 10:44:41 +0000
committerErmal <eri@pfsense.org>2012-12-17 10:44:41 +0000
commitaea564088a335bef9c9d6fb55409dd0ad65b3049 (patch)
treec78785555ef59e7d0fb85190ad652b42550cc712 /usr
parent0faf09f7ffdf8c188ce72b6c5cc4f33bc9e069a8 (diff)
downloadpfsense-aea564088a335bef9c9d6fb55409dd0ad65b3049.zip
pfsense-aea564088a335bef9c9d6fb55409dd0ad65b3049.tar.gz
Separate ipfw rule no db from limiter ones. Since ipfw has per instance feature while dummynet/limiters is a single instance.
Diffstat (limited to 'usr')
-rwxr-xr-xusr/local/www/services_captiveportal_ip_edit.php19
-rwxr-xr-xusr/local/www/services_captiveportal_mac.php20
-rwxr-xr-xusr/local/www/services_captiveportal_mac_edit.php7
3 files changed, 23 insertions, 23 deletions
diff --git a/usr/local/www/services_captiveportal_ip_edit.php b/usr/local/www/services_captiveportal_ip_edit.php
index d6d3570..92642b8 100755
--- a/usr/local/www/services_captiveportal_ip_edit.php
+++ b/usr/local/www/services_captiveportal_ip_edit.php
@@ -84,7 +84,6 @@ $a_allowedips =& $config['captiveportal'][$cpzone]['allowedip'];
if (isset($id) && $a_allowedips[$id]) {
$pconfig['ip'] = $a_allowedips[$id]['ip'];
$pconfig['sn'] = $a_allowedips[$id]['sn'];
- $pconfig['dir'] = $a_allowedips[$id]['dir'];
$pconfig['bw_up'] = $a_allowedips[$id]['bw_up'];
$pconfig['bw_down'] = $a_allowedips[$id]['bw_down'];
$pconfig['descr'] = $a_allowedips[$id]['descr'];
@@ -124,7 +123,6 @@ if ($_POST) {
$ip = array();
$ip['ip'] = $_POST['ip'];
$ip['sn'] = $_POST['sn'];
- $ip['dir'] = $_POST['dir'];
$ip['descr'] = $_POST['descr'];
if ($_POST['bw_up'])
$ip['bw_up'] = $_POST['bw_up'];
@@ -173,23 +171,6 @@ include("head.inc");
<td colspan="2" valign="top" class="listtopic"><?=gettext("Edit allowed ip rule");?></td>
</tr>
<tr>
- <td width="22%" valign="top" class="vncellreq"><?=gettext("Direction"); ?></td>
- <td width="78%" class="vtable">
- <select name="dir" class="formfld">
- <?php
- $dirs = array(gettext("Both"),gettext("From"),gettext("To")) ;
- foreach ($dirs as $dir):
- ?>
- <option value="<?=strtolower($dir);?>" <?php if (strtolower($dir) == strtolower($pconfig['dir'])) echo "selected";?> >
- <?=htmlspecialchars($dir);?>
- </option>
- <?php endforeach; ?>
- </select>
- <br>
- <span class="vexpl"><?=gettext("Use"); ?> <em><?=gettext("From"); ?></em> <?=gettext("to always allow an IP address through the captive portal (without authentication)"); ?>.
- <?=gettext("Use"); ?> <em><?=gettext("To"); ?></em> <?=gettext("to allow access from all clients (even non-authenticated ones) behind the portal to this IP address"); ?>.</span></td>
- </tr>
- <tr>
<td width="22%" valign="top" class="vncellreq"><?=gettext("IP address"); ?></td>
<td width="78%" class="vtable">
<?=$mandfldhtml;?><input name="ip" type="text" class="formfld unknown" id="ip" size="17" value="<?=htmlspecialchars($pconfig['ip']);?>">
diff --git a/usr/local/www/services_captiveportal_mac.php b/usr/local/www/services_captiveportal_mac.php
index a98138a..b9a8938 100755
--- a/usr/local/www/services_captiveportal_mac.php
+++ b/usr/local/www/services_captiveportal_mac.php
@@ -104,9 +104,15 @@ if ($_POST) {
if ($found == true) {
$ruleno = captiveportal_get_ipfw_passthru_ruleno($_POST['delmac']);
if ($ruleno) {
- captiveportal_free_ipfw_ruleno($ruleno, true);
+ captiveportal_free_ipfw_ruleno($ruleno);
+ $pipeno = captiveportal_get_dn_passthru_ruleno($_POST['delmac']);
+ if ($pipeno)
+ captiveportal_free_dn_ruleno($pipeno);
captiveportal_ipfw_set_context($cpzone);
- mwexec("/sbin/ipfw delete {$ruleno}; /sbin/ipfw delete " . ++$ruleno);
+ if (!empty($pipeno))
+ mwexec("/sbin/ipfw -q delete {$ruleno}; /sbin/ipfw -q delete " . ++$ruleno . "; /sbin/ipfw -q pipe delete {$pipeno}; /sbin/ipfw -q pipe delete " . (++$pipeno));
+ else
+ mwexec("/sbin/ipfw -q delete {$ruleno}; /sbin/ipfw -q delete " . ++$ruleno);
}
unset($a_passthrumacs[$idx]);
write_config();
@@ -123,9 +129,15 @@ if ($_GET['act'] == "del") {
if ($a_passthrumacs[$_GET['id']]) {
$ruleno = captiveportal_get_ipfw_passthru_ruleno($a_passthrumacs[$_GET['id']]['mac']);
if ($ruleno) {
- captiveportal_ipfw_set_context($cpzone);
captiveportal_free_ipfw_ruleno($ruleno);
- mwexec("/sbin/ipfw delete {$ruleno}; /sbin/ipfw delete " . ++$ruleno);
+ $pipeno = captiveportal_get_dn_passthru_ruleno($_POST['delmac']);
+ if ($pipeno)
+ captiveportal_free_dn_ruleno($pipeno);
+ captiveportal_ipfw_set_context($cpzone);
+ if (!empty($pipeno))
+ mwexec("/sbin/ipfw -q delete {$ruleno}; /sbin/ipfw -q delete " . ++$ruleno . "; /sbin/ipfw -q pipe delete {$pipeno}; /sbin/ipfw -q pipe delete " . (++$pipeno));
+ else
+ mwexec("/sbin/ipfw -q delete {$ruleno}; /sbin/ipfw -q delete " . ++$ruleno);
}
unset($a_passthrumacs[$_GET['id']]);
write_config();
diff --git a/usr/local/www/services_captiveportal_mac_edit.php b/usr/local/www/services_captiveportal_mac_edit.php
index e4bf5a4..90c2ee9 100755
--- a/usr/local/www/services_captiveportal_mac_edit.php
+++ b/usr/local/www/services_captiveportal_mac_edit.php
@@ -144,6 +144,13 @@ if ($_POST) {
$ruleno = captiveportal_get_ipfw_passthru_ruleno($oldmac);
if ($ruleno) {
captiveportal_free_ipfw_ruleno($ruleno);
+ $pipeno = captiveportal_get_dn_passthru_ruleno($_POST['delmac']);
+ if ($pipeno) {
+ captiveportal_free_dn_ruleno($pipeno);
+ $rules .= "pipe delete {$pipeno}\n";
+ ++$pipeno;
+ $rules .= "pipe delete {$pipeno}\n";
+ }
$rules = "delete {$ruleno}\n";
$rules .= "delete " . ++$ruleno . "\n";
}
OpenPOWER on IntegriCloud