summaryrefslogtreecommitdiffstats
path: root/usr/local/www/services_captiveportal_ip_edit.php
diff options
context:
space:
mode:
authorErmal <eri@pfsense.org>2010-04-20 00:39:16 +0000
committerErmal <eri@pfsense.org>2010-04-20 00:40:02 +0000
commit6ce61a8fd6423e5b7cd851ebbfab3486523db9b6 (patch)
tree64dbac1a32815d2de8f3181e3bc52f81c8fcbd9b /usr/local/www/services_captiveportal_ip_edit.php
parentc443bb14cb89462e8f19f8e60527b970f3344bfb (diff)
downloadpfsense-6ce61a8fd6423e5b7cd851ebbfab3486523db9b6.zip
pfsense-6ce61a8fd6423e5b7cd851ebbfab3486523db9b6.tar.gz
Add a new option which allows the admin user to configure CP so that it automatically enters an MAC passthru entry. The MAC is taken from login details and has to be removed manually. Also do improvements on rules handling and pipes. Add some optmizations. Teach the GUI/backend on ip/mac passthrough to configure a bw limit for this entries.
Diffstat (limited to 'usr/local/www/services_captiveportal_ip_edit.php')
-rwxr-xr-xusr/local/www/services_captiveportal_ip_edit.php38
1 files changed, 28 insertions, 10 deletions
diff --git a/usr/local/www/services_captiveportal_ip_edit.php b/usr/local/www/services_captiveportal_ip_edit.php
index 93628ba..4e1b661 100755
--- a/usr/local/www/services_captiveportal_ip_edit.php
+++ b/usr/local/www/services_captiveportal_ip_edit.php
@@ -67,8 +67,9 @@ if (isset($_POST['id']))
if (isset($id) && $a_allowedips[$id]) {
$pconfig['ip'] = $a_allowedips[$id]['ip'];
+ $pconfig['bw_up'] = $a_allowedips[$id]['bw_up'];
+ $pconfig['bw_down'] = $a_allowedips[$id]['bw_down'];
$pconfig['descr'] = $a_allowedips[$id]['descr'];
- $pconfig['dir'] = $a_allowedips[$id]['dir'];
}
if ($_POST) {
@@ -85,6 +86,10 @@ if ($_POST) {
if (($_POST['ip'] && !is_ipaddr($_POST['ip']))) {
$input_errors[] = "A valid IP address must be specified. [".$_POST['ip']."]";
}
+ if ($_POST['bw_up'] && !is_numeric($_POST['bw_up']))
+ $input_errors[] = "Upload speed needs to be an integer";
+ if ($_POST['bw_down'] && !is_numeric($_POST['bw_down']))
+ $input_errors[] = "Download speed needs to be an integer";
foreach ($a_allowedips as $ipent) {
if (isset($id) && ($a_allowedips[$id]) && ($a_allowedips[$id] === $ipent))
@@ -100,8 +105,10 @@ if ($_POST) {
$ip = array();
$ip['ip'] = $_POST['ip'];
$ip['descr'] = $_POST['descr'];
- $ip['dir'] = $_POST['dir'];
-
+ if ($_POST['bw_up'])
+ $ip['bw_up'] = $_POST['bw_up'];
+ if ($_POST['bw_down'])
+ $ip['bw_down'] = $_POST['bw_down'];
if (isset($id) && $a_allowedips[$id])
$a_allowedips[$id] = $ip;
else
@@ -111,10 +118,7 @@ if ($_POST) {
write_config();
if (isset($config['captiveportal']['enable'])) {
- if ($ip['dir'] == "from")
- mwexec("/sbin/ipfw table 1 add " . $ip['ip']);
- else
- mwexec("/sbin/ipfw table 2 add " . $ip['ip']);
+ mwexec("/sbin/ipfw table 1 add " . $ip['ip']);
}
header("Location: services_captiveportal_ip.php");
@@ -130,7 +134,8 @@ include("head.inc");
<?php if ($input_errors) print_input_errors($input_errors); ?>
<form action="services_captiveportal_ip_edit.php" method="post" name="iform" id="iform">
<table width="100%" border="0" cellpadding="6" cellspacing="0">
- <tr>
+<?php if (false): ?>
+ <tr>
<td width="22%" valign="top" class="vncellreq">Direction</td>
<td width="78%" class="vtable">
<select name="dir" class="formselect">
@@ -146,20 +151,33 @@ include("head.inc");
<span class="vexpl">Use <em>From</em> to always allow an IP address through the captive portal (without authentication).
Use <em>To</em> to allow access from all clients (even non-authenticated ones) behind the portal to this IP address.</span></td>
</tr>
- <tr>
+<?php endif; ?>
+ <tr>
<td width="22%" valign="top" class="vncellreq">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']);?>">
<br>
<span class="vexpl">IP address</span></td>
</tr>
- <tr>
+ <tr>
<td width="22%" valign="top" class="vncell">Description</td>
<td width="78%" class="vtable">
<input name="descr" type="text" class="formfld unknown" id="descr" size="40" value="<?=htmlspecialchars($pconfig['descr']);?>">
<br> <span class="vexpl">You may enter a description here
for your reference (not parsed).</span></td>
</tr>
+ <tr>
+ <td width="22%" valign="top" class="vncell">Bandwidth up</td>
+ <td width="78%" class="vtable">
+ <input name="bw_up" type="text" class="formfld unknown" id="bw_up" size="10" value="<?=htmlspecialchars($pconfig['bw_up']);?>">
+ <br> <span class="vexpl">Enter a upload limit to be enforced on this mac-address in Kbit/s</span></td>
+ </tr>
+ <tr>
+ <td width="22%" valign="top" class="vncell">Bandwidth down</td>
+ <td width="78%" class="vtable">
+ <input name="bw_down" type="text" class="formfld unknown" id="bw_down" size="10" value="<?=htmlspecialchars($pconfig['bw_down']);?>">
+ <br> <span class="vexpl">Enter a download limit to be enforced on this mac-address in Kbit/s</span></td>
+ </tr>
<tr>
<td width="22%" valign="top">&nbsp;</td>
<td width="78%">
OpenPOWER on IntegriCloud