summaryrefslogtreecommitdiffstats
path: root/usr/local/www
diff options
context:
space:
mode:
authorSeth Mos <seth.mos@dds.nl>2011-01-26 15:40:32 +0100
committerSeth Mos <seth.mos@dds.nl>2011-01-26 15:40:32 +0100
commit9740fad81dce0f9389f157ac739473d17ad67839 (patch)
treec71eeae7d425f0bc7c42ded5b9dcbb904a44cce5 /usr/local/www
parent2259901018552f8a8432e295b8d6064fa918cda0 (diff)
parentee4fc984e1169a180457b3a10e011fab04fd0f31 (diff)
downloadpfsense-9740fad81dce0f9389f157ac739473d17ad67839.zip
pfsense-9740fad81dce0f9389f157ac739473d17ad67839.tar.gz
Merge remote branch 'upstream/master'
Conflicts: etc/inc/system.inc
Diffstat (limited to 'usr/local/www')
-rwxr-xr-xusr/local/www/diag_backup.php6
-rwxr-xr-xusr/local/www/fbegin.inc5
-rwxr-xr-xusr/local/www/firewall_nat_1to1_edit.php6
-rwxr-xr-xusr/local/www/firewall_rules.php3
-rwxr-xr-xusr/local/www/firewall_rules_edit.php2
-rwxr-xr-xusr/local/www/guiconfig.inc20
-rwxr-xr-xusr/local/www/pkg_mgr.php13
-rwxr-xr-xusr/local/www/pkg_mgr_install.php4
-rwxr-xr-xusr/local/www/pkg_mgr_installed.php13
-rwxr-xr-xusr/local/www/services_captiveportal.php15
-rwxr-xr-xusr/local/www/services_captiveportal_filemanager.php3
-rwxr-xr-xusr/local/www/services_captiveportal_hostname.php188
-rwxr-xr-xusr/local/www/services_captiveportal_hostname_edit.php217
-rwxr-xr-xusr/local/www/services_captiveportal_ip.php3
-rwxr-xr-xusr/local/www/services_captiveportal_ip_edit.php131
-rwxr-xr-xusr/local/www/services_captiveportal_mac.php3
-rw-r--r--usr/local/www/services_captiveportal_vouchers.php3
-rw-r--r--usr/local/www/vpn_openvpn_client.php20
-rw-r--r--usr/local/www/vpn_openvpn_server.php45
-rw-r--r--usr/local/www/wizards/openvpn_wizard.inc12
-rw-r--r--usr/local/www/wizards/openvpn_wizard.xml22
-rw-r--r--usr/local/www/wizards/traffic_shaper_wizard.inc39
-rwxr-xr-xusr/local/www/wizards/traffic_shaper_wizard_dedicated.inc65
-rwxr-xr-xusr/local/www/wizards/traffic_shaper_wizard_multi_all.inc43
-rw-r--r--usr/local/www/wizards/traffic_shaper_wizard_multi_lan.inc35
25 files changed, 733 insertions, 183 deletions
diff --git a/usr/local/www/diag_backup.php b/usr/local/www/diag_backup.php
index 6ff65fe..5892f06 100755
--- a/usr/local/www/diag_backup.php
+++ b/usr/local/www/diag_backup.php
@@ -223,7 +223,7 @@ if ($_POST) {
* Backup RRD Data
*/
if(!$_POST['donotbackuprrd']) {
- $data = str_replace("</pfsense>", "\t<rrddata>", $data);
+ $data = str_replace("</" . $g['xml_rootobj'] . ">", "\t<rrddata>", $data);
$rrd_files_var_db_rrd = split("\n",`cd /var/db/rrd && ls *.rrd`);
foreach($rrd_files_var_db_rrd as $rrd) {
if($rrd) {
@@ -237,7 +237,7 @@ if ($_POST) {
}
}
$data .= "\t</rrddata>\n";
- $data .= "</pfsense>\n";
+ $data .= "</" . $g['xml_rootobj'] . ">\n";
}
$size = strlen($data);
@@ -315,7 +315,7 @@ if ($_POST) {
if(file_exists("{$g['tmp_path']}/config.cache"))
unlink("{$g['tmp_path']}/config.cache");
$config = parse_config(true);
- /* extract out rrd items, unset from $confgi when done */
+ /* extract out rrd items, unset from $config when done */
if($config['rrddata']) {
foreach($config['rrddata']['rrddatafile'] as $rrd) {
$rrd_fd = fopen("{$g['vardb_path']}/rrd/{$rrd['filename']}", "w");
diff --git a/usr/local/www/fbegin.inc b/usr/local/www/fbegin.inc
index c2d5955..2b3da3b 100755
--- a/usr/local/www/fbegin.inc
+++ b/usr/local/www/fbegin.inc
@@ -426,5 +426,10 @@ function add_to_menu($url, $name) {
<br />
<?php
+/* if upgrade in progress, alert user */
+if(is_subsystem_dirty('packagelock')) {
+ $pgtitle = array(gettext("System"),gettext("Package Manager"));
+ print_info_box(gettext("Packages are currently being reinstalled in the background.<p>Do not make changes in the GUI until this is complete.") . "<p><img src='/themes/{$g['theme']}/images/icons/icon_fw-update.gif'>");
+}
$pgtitle_output = true;
?>
diff --git a/usr/local/www/firewall_nat_1to1_edit.php b/usr/local/www/firewall_nat_1to1_edit.php
index b6a307a..1a3ce77 100755
--- a/usr/local/www/firewall_nat_1to1_edit.php
+++ b/usr/local/www/firewall_nat_1to1_edit.php
@@ -310,7 +310,7 @@ function typesel_change() {
<tr>
<td width="22%" valign="top" class="vncellreq"><?=gettext("External subnet IP"); ?></td>
<td width="78%" class="vtable">
- <input name="external" type="text" class="formfldalias" id="external" size="20" value="<?=htmlspecialchars($pconfig['external']);?>">
+ <input name="external" type="text" class="formfld" id="external" size="20" value="<?=htmlspecialchars($pconfig['external']);?>">
<br/>
<span class="vexpl"><?=gettext("Enter the external (usually on a WAN) subnet's starting address for the 1:1 mapping. The subnet mask from the internal address below will be applied to this IP address."); ?><br>
<?=gettext("Hint: this is generally an address owned by the router itself on the selected interface."); ?></span>
@@ -358,7 +358,7 @@ function typesel_change() {
<tr>
<td><?=gettext("Address:"); ?>&nbsp;&nbsp;</td>
<td>
- <input name="src" type="text" class="formfldalias" id="src" size="20" value="<?php if (!is_specialnet($pconfig['src'])) echo htmlspecialchars($pconfig['src']);?>"> /
+ <input name="src" type="text" class="formfld" id="src" size="20" value="<?php if (!is_specialnet($pconfig['src'])) echo htmlspecialchars($pconfig['src']);?>"> /
<select name="srcmask" class="formselect" id="srcmask">
<?php for ($i = 31; $i > 0; $i--): ?>
<option value="<?=$i;?>" <?php if ($i == $pconfig['srcmask']) echo "selected"; ?>><?=$i;?></option>
@@ -413,7 +413,7 @@ function typesel_change() {
<tr>
<td><?=gettext("Address:"); ?>&nbsp;&nbsp;</td>
<td>
- <input name="dst" type="text" class="formfldalias" id="dst" size="20" value="<?php if (!is_specialnet($pconfig['dst'])) echo htmlspecialchars($pconfig['dst']);?>">
+ <input name="dst" type="text" class="formfld" id="dst" size="20" value="<?php if (!is_specialnet($pconfig['dst'])) echo htmlspecialchars($pconfig['dst']);?>">
/
<select name="dstmask" class="formselect" id="dstmask">
<?php
diff --git a/usr/local/www/firewall_rules.php b/usr/local/www/firewall_rules.php
index 4072383..d09b39f 100755
--- a/usr/local/www/firewall_rules.php
+++ b/usr/local/www/firewall_rules.php
@@ -838,9 +838,6 @@ if($_REQUEST['undodrag']) {
"to the rule order. Everything that isn't explicitly passed is blocked " .
"by default. ");?>
</li>
-<li>
- <?=gettext("You may drag and drop rules using your mouse to reorder the rule ordering.");?>
-</li>
</ul>
</td>
</tr>
diff --git a/usr/local/www/firewall_rules_edit.php b/usr/local/www/firewall_rules_edit.php
index fe24ad8..a6809f2 100755
--- a/usr/local/www/firewall_rules_edit.php
+++ b/usr/local/www/firewall_rules_edit.php
@@ -1311,7 +1311,7 @@ $i--): ?>
?>
</select>
<br />
- <span class="vexpl"><?=gettext("Choose the Out queue/Virtual interface only if you have selected In too.")."<br/>".gettext("The Out selection is applied to traffic going out the interface the rule is created, In is the incoming one.")."<br/>".gettext("If you are creating a rule on the Floating tab if the direction is In then the same rules apply, if the direction is out the selections are reverted Out is for incoming and In is for outgoing and if you do not select any direction use only the In since the Out selection does not make sense in there to prevent oddities.");?></span>
+ <span class="vexpl"><?=gettext("Choose the Out queue/Virtual interface only if you have also selected In.")."<br/>".gettext("The Out selection is applied to traffic leaving the interface where the rule is created, In is applied to traffic coming into the chosen interface.")."<br/>".gettext("If you are creating a floating rule, if the direction is In then the same rules apply, if the direction is out the selections are reverted Out is for incoming and In is for outgoing.");?></span>
</div>
</td>
</tr>
diff --git a/usr/local/www/guiconfig.inc b/usr/local/www/guiconfig.inc
index 70f9459..ab5a1c9 100755
--- a/usr/local/www/guiconfig.inc
+++ b/usr/local/www/guiconfig.inc
@@ -881,7 +881,7 @@ function echo_array($array,$return_me=false){
* RESULT
* null
******/
-function display_top_tabs(& $tab_array) {
+function display_top_tabs(& $tab_array, $no_drop_down = false) {
global $HTTP_SERVER_VARS;
global $config;
global $g;
@@ -896,16 +896,15 @@ function display_top_tabs(& $tab_array) {
*/
/* empty string code */
- if ($tab_array_indent == '')
- {
+ if ($tab_array_indent == '') {
$tab_array_indent = 0;
}
- if ($tab_array_space == '')
- {
+
+ if ($tab_array_space == '') {
$tab_array_space = 1;
}
- if ($tab_array_char_limit == '')
- {
+
+ if ($tab_array_char_limit == '') {
$tab_array_char_limit = 82;
}
@@ -956,6 +955,11 @@ function display_top_tabs(& $tab_array) {
foreach ($tab_array as $ta)
$tabcharcount = $tabcharcount + strlen($ta[0]);
+ if($no_drop_down == true) {
+ $tabcharcount = 0;
+ unset($tab_array_char_limit);
+ }
+
// If the character count of the tab names is > 670
// then show a select item dropdown menubox.
if($tabcharcount > $tab_array_char_limit) {
@@ -975,7 +979,6 @@ function display_top_tabs(& $tab_array) {
echo " function tabs_will_go(obj){ document.location = obj.value; }";
echo "</script>";
} else {
- //////>>>
echo "<div class=\"newtabmenu\" style=\"margin:{$tab_array_space}px {$tab_array_indent}px; width:775px;\">\n";
echo "<!-- Tabbed bar code-->\n";
echo "<ul class=\"newtabmenu\">\n";
@@ -989,7 +992,6 @@ function display_top_tabs(& $tab_array) {
$tabscounter++;
}
echo "</ul>\n</div>\n";
- ////////>>>>
}
}
diff --git a/usr/local/www/pkg_mgr.php b/usr/local/www/pkg_mgr.php
index 3c1ba89..15097a6 100755
--- a/usr/local/www/pkg_mgr.php
+++ b/usr/local/www/pkg_mgr.php
@@ -44,6 +44,19 @@ require_once("globals.inc");
require_once("guiconfig.inc");
require_once("pkg-utils.inc");
+/* if upgrade in progress, alert user */
+if(is_subsystem_dirty('packagelock')) {
+ $pgtitle = array(gettext("System"),gettext("Package Manager"));
+ include("head.inc");
+ echo "<body link=\"#0000CC\" vlink=\"#0000CC\" alink=\"#0000CC\">\n";
+ include("fbegin.inc");
+ echo "Please wait while packages are reinstalled in the background.";
+ include("fend.inc");
+ echo "</body>";
+ echo "</html>";
+ exit;
+}
+
$pkg_info = get_pkg_info('all', array("noembedded", "name", "category", "website", "version", "status", "descr", "maintainer", "required_version", "maximum_version", "pkginfolink", "supportedbybsdperimeter"));
if($pkg_info) {
$fout = fopen("{$g['tmp_path']}/pkg_info.cache", "w");
diff --git a/usr/local/www/pkg_mgr_install.php b/usr/local/www/pkg_mgr_install.php
index 1abcae6..8659b8e 100755
--- a/usr/local/www/pkg_mgr_install.php
+++ b/usr/local/www/pkg_mgr_install.php
@@ -67,9 +67,9 @@ include("head.inc");
<tr>
<td>
<?php
- $version = file_get_contents("/etc/version");
+// $version = file_get_contents("/etc/version");
$tab_array = array();
- $tab_array[] = array("{$version} " . gettext("packages"), false, "pkg_mgr.php");
+ $tab_array[] = array(gettext("Available packages"), false, "pkg_mgr.php");
// $tab_array[] = array("Packages for any platform", false, "pkg_mgr.php?ver=none");
// $tab_array[] = array("Packages for a different platform", $requested_version == "other" ? true : false, "pkg_mgr.php?ver=other");
$tab_array[] = array(gettext("Installed packages"), false, "pkg_mgr_installed.php");
diff --git a/usr/local/www/pkg_mgr_installed.php b/usr/local/www/pkg_mgr_installed.php
index 48c9677..02fb8d3 100755
--- a/usr/local/www/pkg_mgr_installed.php
+++ b/usr/local/www/pkg_mgr_installed.php
@@ -40,6 +40,19 @@
require_once("guiconfig.inc");
require_once("pkg-utils.inc");
+/* if upgrade in progress, alert user */
+if(is_subsystem_dirty('packagelock')) {
+ $pgtitle = array(gettext("System"),gettext("Package Manager"));
+ include("head.inc");
+ echo "<body link=\"#0000CC\" vlink=\"#0000CC\" alink=\"#0000CC\">\n";
+ include("fbegin.inc");
+ echo "Please wait while packages are reinstalled in the background.";
+ include("fend.inc");
+ echo "</body>";
+ echo "</html>";
+ exit;
+}
+
if(is_array($config['installedpackages']['package'])) {
foreach($config['installedpackages']['package'] as $instpkg) {
$tocheck[] = $instpkg['name'];
diff --git a/usr/local/www/services_captiveportal.php b/usr/local/www/services_captiveportal.php
index baa5610..8d12c7c 100755
--- a/usr/local/www/services_captiveportal.php
+++ b/usr/local/www/services_captiveportal.php
@@ -82,7 +82,7 @@ $pconfig['radmac_secret'] = $config['captiveportal']['radmac_secret'];
$pconfig['reauthenticate'] = isset($config['captiveportal']['reauthenticate']);
$pconfig['reauthenticateacct'] = $config['captiveportal']['reauthenticateacct'];
$pconfig['httpslogin_enable'] = isset($config['captiveportal']['httpslogin']);
-$pconfig['httpsname'] = strtolower($config['captiveportal']['httpsname']);
+$pconfig['preauthurl'] = strtolower($config['captiveportal']['preauthurl']);
$pconfig['cert'] = base64_decode($config['captiveportal']['certificate']);
$pconfig['cacert'] = base64_decode($config['captiveportal']['cacertificate']);
$pconfig['key'] = base64_decode($config['captiveportal']['private-key']);
@@ -198,6 +198,7 @@ if ($_POST) {
$config['captiveportal']['reauthenticateacct'] = $_POST['reauthenticateacct'];
$config['captiveportal']['httpslogin'] = $_POST['httpslogin_enable'] ? true : false;
$config['captiveportal']['httpsname'] = $_POST['httpsname'];
+ $config['captiveportal']['preauthurl'] = $_POST['preauthurl'];
$config['captiveportal']['peruserbw'] = $_POST['peruserbw'] ? true : false;
$config['captiveportal']['bwdefaultdn'] = $_POST['bwdefaultdn'];
$config['captiveportal']['bwdefaultup'] = $_POST['bwdefaultup'];
@@ -314,9 +315,10 @@ function enable_change(enable_change) {
$tab_array[] = array(gettext("Captive portal"), true, "services_captiveportal.php");
$tab_array[] = array(gettext("Pass-through MAC"), false, "services_captiveportal_mac.php");
$tab_array[] = array(gettext("Allowed IP addresses"), false, "services_captiveportal_ip.php");
+ $tab_array[] = array(gettext("Allowed Hostnames"), false, "services_captiveportal_hostname.php");
$tab_array[] = array(gettext("Vouchers"), false, "services_captiveportal_vouchers.php");
$tab_array[] = array(gettext("File Manager"), false, "services_captiveportal_filemanager.php");
- display_top_tabs($tab_array);
+ display_top_tabs($tab_array, true);
?> </td></tr>
<tr>
<td class="tabcont">
@@ -397,7 +399,14 @@ value="<?=htmlspecialchars($pconfig['maxprocperip']);?>"> <?=gettext("per client
<?=gettext("If enabled, a popup window will appear when clients are allowed through the captive portal. This allows clients to explicitly disconnect themselves before the idle or hard timeout occurs."); ?></td>
</tr>
<tr>
- <td valign="top" class="vncell"><?=gettext("Redirection URL"); ?></td>
+ <td valign="top" class="vncell"><?=gettext("Pre-authentication redirect URL"); ?> </td>
+ <td class="vtable">
+ <input name="preauthurl" type="text" class="formfld url" id="preauthurl" size="60" value="<?=htmlspecialchars($pconfig['preauthurl']);?>"><br>
+ <?php printf(gettext("Use this field to set \$PORTAL_REDIRURL\$ variable which can be accessed using your custom captive portal index.php page or error pages."));?>
+ </td>
+ </tr>
+ <tr>
+ <td valign="top" class="vncell"><?=gettext("After authentication Redirection URL"); ?></td>
<td class="vtable">
<input name="redirurl" type="text" class="formfld url" id="redirurl" size="60" value="<?=htmlspecialchars($pconfig['redirurl']);?>">
<br>
diff --git a/usr/local/www/services_captiveportal_filemanager.php b/usr/local/www/services_captiveportal_filemanager.php
index bba925f..7bc61ec 100755
--- a/usr/local/www/services_captiveportal_filemanager.php
+++ b/usr/local/www/services_captiveportal_filemanager.php
@@ -139,9 +139,10 @@ include("head.inc");
$tab_array[] = array(gettext("Captive portal"), false, "services_captiveportal.php");
$tab_array[] = array(gettext("Pass-through MAC"), false, "services_captiveportal_mac.php");
$tab_array[] = array(gettext("Allowed IP addresses"), false, "services_captiveportal_ip.php");
+ $tab_array[] = array(gettext("Allowed Hostnames"), false, "services_captiveportal_hostname.php");
$tab_array[] = array(gettext("Vouchers"), false, "services_captiveportal_vouchers.php");
$tab_array[] = array(gettext("File Manager"), true, "services_captiveportal_filemanager.php");
- display_top_tabs($tab_array);
+ display_top_tabs($tab_array, true);
?> </td></tr>
<tr>
<td class="tabcont">
diff --git a/usr/local/www/services_captiveportal_hostname.php b/usr/local/www/services_captiveportal_hostname.php
new file mode 100755
index 0000000..3668a35
--- /dev/null
+++ b/usr/local/www/services_captiveportal_hostname.php
@@ -0,0 +1,188 @@
+<?php
+/*
+ services_captiveportal_hostname.php
+ Copyright (C) 2011 Scott Ullrich <sullrich@gmail.com>
+ All rights reserved.
+
+ Originally part of m0n0wall (http://m0n0.ch/wall)
+ Copyright (C) 2004 Dinesh Nair <dinesh@alphaque.com>
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ 1. Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+
+ 2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+
+ THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
+ INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
+ AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
+ OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ POSSIBILITY OF SUCH DAMAGE.
+*/
+/*
+ pfSense_BUILDER_BINARIES: /sbin/ipfw
+ pfSense_MODULE: captiveportal
+*/
+
+##|+PRIV
+##|*IDENT=page-services-captiveportal-allowedhostnames
+##|*NAME=Services: Captive portal: Allowed IPs page
+##|*DESCR=Allow access to the 'Services: Captive portal: Allowed IPs' page.
+##|*MATCH=services_captiveportal_ip.php*
+##|-PRIV
+
+$statusurl = "status_captiveportal.php";
+$logurl = "diag_logs_auth.php";
+
+require("guiconfig.inc");
+require("functions.inc");
+require("filter.inc");
+require("shaper.inc");
+require("captiveportal.inc");
+
+$pgtitle = array(gettext("Services"),gettext("Captive portal"));
+
+if (!is_array($config['captiveportal']['allowedhostname']))
+ $config['captiveportal']['allowedhostname'] = array();
+
+$a_allowedhostnames = &$config['captiveportal']['allowedhostname'] ;
+
+if ($_GET['act'] == "del") {
+ if ($a_allowedhostnames[$_GET['id']]) {
+ $ipent = $a_allowedhostnames[$_GET['id']];
+
+ if (isset($config['captiveportal']['enable'])) {
+ if (!empty($ipent['sn']))
+ $ipent['ip'] .= "/{$ipent['sn']}";
+ $ip = gethostbyname($ipent['ip']);
+ if(is_ipaddr($ip)) {
+ mwexec("/sbin/ipfw table 3 delete {$ip}");
+ mwexec("/sbin/ipfw table 4 delete {$ip}");
+ mwexec("/sbin/ipfw table 5 delete {$ip}");
+ mwexec("/sbin/ipfw table 6 delete {$ip}");
+ mwexec("/sbin/ipfw table 7 delete {$ip}");
+ mwexec("/sbin/ipfw table 8 delete {$ip}");
+ mwexec("/sbin/ipfw table 9 delete {$ip}");
+ mwexec("/sbin/ipfw table 10 delete {$ip}");
+ }
+ }
+
+ unset($a_allowedhostnames[$_GET['id']]);
+ write_config();
+ header("Location: services_captiveportal_hostname.php");
+ exit;
+ }
+}
+
+
+include("head.inc");
+?>
+<?php include("fbegin.inc"); ?>
+<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
+<form action="services_captiveportal_hostname.php" method="post">
+<?php if ($savemsg) print_info_box($savemsg); ?>
+<table width="100%" border="0" cellpadding="0" cellspacing="0">
+ <tr><td class="tabnavtbl">
+<?php
+ $tab_array = array();
+ $tab_array[] = array(gettext("Captive portal"), false, "services_captiveportal.php");
+ $tab_array[] = array(gettext("Pass-through MAC"), false, "services_captiveportal_mac.php");
+ $tab_array[] = array(gettext("Allowed IP Addresses"), false, "services_captiveportal_ip.php");
+ $tab_array[] = array(gettext("Allowed Hostnames"), true, "services_captiveportal_hostname.php");
+ $tab_array[] = array(gettext("Vouchers"), false, "services_captiveportal_vouchers.php");
+ $tab_array[] = array(gettext("File Manager"), false, "services_captiveportal_filemanager.php");
+ display_top_tabs($tab_array, true);
+?>
+ </td></tr>
+ <tr>
+ <td class="tabcont">
+ <table width="100%" border="0" cellpadding="0" cellspacing="0">
+ <tr>
+ <td width="30%" class="listhdrr"><?=gettext("Hostname"); ?></td>
+ <td width="60%" class="listhdr"><?=gettext("Description"); ?></td>
+ <td width="10%" class="list">
+ <table border="0" cellspacing="0" cellpadding="1">
+ <tr>
+ <td width="17" heigth="17"></td>
+ <td><a href="services_captiveportal_hostname_edit.php"><img src="/themes/<?php echo $g['theme']; ?>/images/icons/icon_plus.gif" title="<?=gettext("add address"); ?>" width="17" height="17" border="0"></a></td>
+ </tr>
+ </table>
+ </td>
+ </tr>
+ <?php $i = 0; foreach ($a_allowedhostnames as $ip): ?>
+ <tr ondblclick="document.location='services_captiveportal_hostname_edit.php?id=<?=$i;?>'">
+ <td class="listlr">
+ <?php
+ if($ip['dir'] == "to") {
+ echo "any <img src=\"/themes/{$g['theme']}/images/icons/icon_in.gif\" width=\"11\" height=\"11\" align=\"absmiddle\"> ";
+ }
+ if($ip['dir'] == "both") {
+ echo "<img src=\"/themes/{$g['theme']}/images/icons/icon_pass.gif\" width=\"11\" height=\"11\" align=\"absmiddle\"> ";
+ }
+ echo strtolower($ip['hostname']);
+ if($ip['dir'] == "from") {
+ echo "<img src=\"/themes/{$g['theme']}/images/icons/icon_in.gif\" width=\"11\" height=\"11\" align=\"absmiddle\"> any";
+ }
+
+ ?>
+ </td>
+ <td class="listbg">
+ <?=htmlspecialchars($ip['descr']);?>&nbsp;
+ </td>
+ <td valign="middle" nowrap class="list"> <a href="services_captiveportal_hostname_edit.php?id=<?=$i;?>"><img src="/themes/<?php echo $g['theme']; ?>/images/icons/icon_e.gif" title="<?=gettext("edit address"); ?>" width="17" height="17" border="0"></a>
+ &nbsp;<a href="services_captiveportal_hostname.php?act=del&id=<?=$i;?>" onclick="return confirm('<?=gettext("Do you really want to delete this address?"); ?>')"><img src="/themes/<?php echo $g['theme']; ?>/images/icons/icon_x.gif" title="<?=gettext("delete address"); ?>" width="17" height="17" border="0"></a></td>
+ </tr>
+ <?php $i++; endforeach; ?>
+ <tr>
+ <td class="list" colspan="2">&nbsp;</td>
+ <td class="list">
+ <table border="0" cellspacing="0" cellpadding="1">
+ <tr>
+ <td width="17" heigth="17"></td>
+ <td><a href="services_captiveportal_hostname_edit.php"><img src="/themes/<?php echo $g['theme']; ?>/images/icons/icon_plus.gif" title="<?=gettext("add address"); ?>" width="17" height="17" border="0"></a></td>
+ </tr>
+ </table>
+ </td>
+ </tr>
+ <tr>
+ <td colspan="2" class="list"><p class="vexpl"><span class="red"><strong>
+ <?=gettext("Note:"); ?><br>
+ </strong></span>
+ <?=gettext("Adding allowed Hostnames will allow a DNS hostname access to/from access through the captive portal without being taken to the portal page. This can be used for a web server serving images for the portal page or a DNS server on another network, for example. By specifying <em>from</em> addresses, it may be used to always allow pass-through access from a client behind the captive portal."); ?></p>
+ <table border="0" cellspacing="0" cellpadding="0">
+ <tr>
+ <td><span class="vexpl"><?=gettext("any"); ?> <img src="/themes/<?=$g['theme'];?>/images/icons/icon_in.gif" width="11" height="11" align="absmiddle"> x.x.x.x </span></td>
+ <td><span class="vexpl"><?=gettext("All connections"); ?> <strong><?=gettext("to"); ?></strong> <?=gettext("the Hostname are allowed"); ?></span></td>
+ </tr>
+ <tr>
+ <td colspan="5" height="4"></td>
+ </tr>
+ <tr>
+ <td>x.x.x.x <span class="vexpl"><img src="/themes/<?=$g['theme'];?>/images/icons/icon_in.gif" width="11" height="11" align="absmiddle"></span> <?=gettext("any"); ?>&nbsp;&nbsp;&nbsp; </td>
+ <td><span class="vexpl"><?=gettext("All connections"); ?> <strong><?=gettext("from"); ?></strong> <?=gettext("the Hostname are allowed"); ?> </span></td>
+ </tr>
+ <tr>
+ <td><span class="vexpl"><img src="/themes/<?=$g['theme'];?>/images/icons/icon_pass.gif" width="11" height="11" align="right"></span>&nbsp;&nbsp;&nbsp;&nbsp; </td>
+ <td><span class="vexpl"> All connections <strong>to</strong> and <strong>from</strong> the Hostname are allowed </span></td>
+ </tr>
+ </table></td>
+ <td class="list">&nbsp;</td>
+ </tr>
+ </table>
+ </td>
+ </tr>
+ </table>
+</form>
+<?php include("fend.inc"); ?>
+</body>
+</html>
diff --git a/usr/local/www/services_captiveportal_hostname_edit.php b/usr/local/www/services_captiveportal_hostname_edit.php
new file mode 100755
index 0000000..b6e580a
--- /dev/null
+++ b/usr/local/www/services_captiveportal_hostname_edit.php
@@ -0,0 +1,217 @@
+<?php
+/*
+ services_captiveportal_hostname_edit.php
+ Copyright (C) 2011 Scott Ullrich <sullrich@gmail.com>
+ All rights reserved.
+
+ Originally part of m0n0wall (http://m0n0.ch/wall)
+ Copyright (C) 2004 Dinesh Nair <dinesh@alphaque.com>
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ 1. Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+
+ 2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+
+ THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
+ INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
+ AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
+ OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ POSSIBILITY OF SUCH DAMAGE.
+*/
+/*
+ pfSense_BUILDER_BINARIES: /sbin/ipfw
+ pfSense_MODULE: captiveportal
+*/
+
+##|+PRIV
+##|*IDENT=page-services-captiveportal-editallowedhostnames
+##|*NAME=Services: Captive portal: Edit Allowed IPs page
+##|*DESCR=Allow access to the 'Services: Captive portal: Edit Allowed IPs' page.
+##|*MATCH=services_captiveportal_hostname_edit.php*
+##|-PRIV
+
+function allowedhostnamescmp($a, $b) {
+ return strcmp($a['hostname'], $b['hostname']);
+}
+
+function allowedhostnames_sort() {
+ global $g, $config;
+ usort($config['captiveportal']['allowedhostname'],"allowedhostname");
+}
+
+$statusurl = "status_captiveportal.php";
+$logurl = "diag_logs_auth.php";
+
+require("guiconfig.inc");
+require("functions.inc");
+require("filter.inc");
+require("shaper.inc");
+require("captiveportal.inc");
+
+$pgtitle = array(gettext("Services"),gettext("Captive portal"),gettext("Edit allowed Hostname"));
+
+if (!is_array($config['captiveportal']['allowedhostname']))
+ $config['captiveportal']['allowedhostname'] = array();
+
+$a_allowedhostnames = &$config['captiveportal']['allowedhostname'];
+
+$id = $_GET['id'];
+if (isset($_POST['id']))
+ $id = $_POST['id'];
+
+if (isset($id) && $a_allowedhostnames[$id]) {
+ $pconfig['hostname'] = $a_allowedhostnames[$id]['hostname'];
+ $pconfig['sn'] = $a_allowedhostnames[$id]['sn'];
+ $pconfig['dir'] = $a_allowedhostnames[$id]['dir'];
+ $pconfig['bw_up'] = $a_allowedhostnames[$id]['bw_up'];
+ $pconfig['bw_down'] = $a_allowedhostnames[$id]['bw_down'];
+ $pconfig['descr'] = $a_allowedhostnames[$id]['descr'];
+}
+
+if ($_POST) {
+
+ unset($input_errors);
+ $pconfig = $_POST;
+
+ /* input validation */
+ $reqdfields = explode(" ", "hostname");
+ $reqdfieldsn = array(gettext("Allowed Hostname"));
+
+ do_input_validation($_POST, $reqdfields, $reqdfieldsn, &$input_errors);
+
+ if (($_POST['hostname'] && !is_hostname($_POST['hostname'])))
+ $input_errors[] = sprintf(gettext("A valid Hostname must be specified. [%s]"), $_POST['hostname']);
+
+ if ($_POST['bw_up'] && !is_numeric($_POST['bw_up']))
+ $input_errors[] = gettext("Upload speed needs to be an integer");
+ if ($_POST['bw_down'] && !is_numeric($_POST['bw_down']))
+ $input_errors[] = gettext("Download speed needs to be an integer");
+
+ foreach ($a_allowedhostnames as $ipent) {
+ if (isset($id) && ($a_allowedhostnames[$id]) && ($a_allowedhostnames[$id] === $ipent))
+ continue;
+
+ if ($ipent['hostname'] == $_POST['hostname']){
+ $input_errors[] = sprintf("[%s] %s.", $_POST['hostname'], gettext("already allowed")) ;
+ break ;
+ }
+ }
+
+ if (!$input_errors) {
+ $ip = array();
+ $ip['hostname'] = $_POST['hostname'];
+ $ip['sn'] = $_POST['sn'];
+ $ip['dir'] = $_POST['dir'];
+ $ip['descr'] = $_POST['descr'];
+ if ($_POST['bw_up'])
+ $ip['bw_up'] = $_POST['bw_up'];
+ if ($_POST['bw_down'])
+ $ip['bw_down'] = $_POST['bw_down'];
+ if (isset($id) && $a_allowedhostnames[$id]) {
+ $oldip = $a_allowedhostnames[$id]['hostname'];
+ if (!empty($a_allowedhostnames[$id]['sn']))
+ $oldip .= "/{$a_allowedhostnames[$id]['sn']}";
+ $a_allowedhostnames[$id] = $ip;
+ } else {
+ $oldip = $ip['hostname'];
+ if (!empty($$ip['sn']))
+ $oldip .= "/{$$ip['sn']}";
+ $a_allowedhostnames[] = $ip;
+ }
+ allowedhostnames_sort();
+
+ write_config();
+
+ if (isset($config['captiveportal']['enable']) && is_module_loaded("ipfw.ko")) {
+ $rules = "";
+ $hostname = gethostbyname($oldip);
+ if($hostname)
+ for ($i = 3; $i < 10; $i++)
+ $rules .= "table {$i} delete {$hostname}\n";
+ $hostname = gethostbyname($ip);
+ if(is_ipaddr($hostname))
+ $rules .= captiveportal_allowedip_configure_entry($hostname);
+ file_put_contents("{$g['tmp_path']}/allowedhostname_tmp{$id}", $rules);
+ mwexec("/sbin/ipfw -q {$g['tmp_path']}/allowedhostname_tmp{$id}");
+ @unlink("{$g['tmp_path']}/allowedhostname_tmp{$id}");
+ }
+
+ header("Location: services_captiveportal_hostname.php");
+ exit;
+ }
+}
+
+include("head.inc");
+
+?>
+<?php include("fbegin.inc"); ?>
+<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
+<?php if ($input_errors) print_input_errors($input_errors); ?>
+ <form action="services_captiveportal_hostname_edit.php" method="post" name="iform" id="iform">
+ <table width="100%" border="0" cellpadding="6" cellspacing="0">
+ <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 Hostname 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 Hostname"); ?>.</span></td>
+ </tr>
+ <tr>
+ <td width="22%" valign="top" class="vncellreq"><?=gettext("Hostname"); ?></td>
+ <td width="78%" class="vtable">
+ <?=$mandfldhtml;?><input name="hostname" type="text" class="formfld unknown" id="hostname" size="17" value="<?=htmlspecialchars($pconfig['hostname']);?>">
+ <br>
+ <span class="vexpl"><?=gettext("Hostname");?>.</span></td>
+ </tr>
+ <tr>
+ <td width="22%" valign="top" class="vncell"><?=gettext("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"><?=gettext("You may enter a description here for your reference (not parsed)"); ?>.</span></td>
+ </tr>
+ <tr>
+ <td width="22%" valign="top" class="vncell"><?=gettext("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"><?=gettext("Enter a upload limit to be enforced on this Hostname in Kbit/s"); ?></span></td>
+ </tr>
+ <tr>
+ <td width="22%" valign="top" class="vncell"><?=gettext("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"><?=gettext("Enter a download limit to be enforced on this Hostname in Kbit/s"); ?></span></td>
+ </tr>
+ <tr>
+ <td width="22%" valign="top">&nbsp;</td>
+ <td width="78%">
+ <input name="Submit" type="submit" class="formbtn" value="<?=gettext("Save"); ?>">
+ <?php if (isset($id) && $a_allowedhostnames[$id]): ?>
+ <input name="id" type="hidden" value="<?=htmlspecialchars($id);?>">
+ <?php endif; ?>
+ </td>
+ </tr>
+ </table>
+</form>
+<?php include("fend.inc"); ?>
+</body>
+</html>
diff --git a/usr/local/www/services_captiveportal_ip.php b/usr/local/www/services_captiveportal_ip.php
index 25615e6..d636f8a 100755
--- a/usr/local/www/services_captiveportal_ip.php
+++ b/usr/local/www/services_captiveportal_ip.php
@@ -93,9 +93,10 @@ include("head.inc");
$tab_array[] = array(gettext("Captive portal"), false, "services_captiveportal.php");
$tab_array[] = array(gettext("Pass-through MAC"), false, "services_captiveportal_mac.php");
$tab_array[] = array(gettext("Allowed IP addresses"), true, "services_captiveportal_ip.php");
+ $tab_array[] = array(gettext("Allowed Hostnames"), false, "services_captiveportal_hostname.php");
$tab_array[] = array(gettext("Vouchers"), false, "services_captiveportal_vouchers.php");
$tab_array[] = array(gettext("File Manager"), false, "services_captiveportal_filemanager.php");
- display_top_tabs($tab_array);
+ display_top_tabs($tab_array, true);
?>
</td></tr>
<tr>
diff --git a/usr/local/www/services_captiveportal_ip_edit.php b/usr/local/www/services_captiveportal_ip_edit.php
index d6119ce..fd87c5b 100755
--- a/usr/local/www/services_captiveportal_ip_edit.php
+++ b/usr/local/www/services_captiveportal_ip_edit.php
@@ -1,8 +1,10 @@
<?php
/*
services_captiveportal_ip_edit.php
- part of m0n0wall (http://m0n0.ch/wall)
-
+ Copyright (C) 2011 Scott Ullrich <sullrich@gmail.com>
+ All rights reserved.
+
+ Originally part of m0n0wall (http://m0n0.ch/wall)
Copyright (C) 2004 Dinesh Nair <dinesh@alphaque.com>
All rights reserved.
@@ -29,7 +31,7 @@
*/
/*
pfSense_BUILDER_BINARIES: /sbin/ipfw
- pfSense_MODULE: captiveportal
+ pfSense_MODULE: captiveportal
*/
##|+PRIV
@@ -44,9 +46,9 @@ function allowedipscmp($a, $b) {
}
function allowedips_sort() {
- global $g, $config;
+ global $g, $config;
- usort($config['captiveportal']['allowedip'],"allowedipscmp");
+ usort($config['captiveportal']['allowedip'],"allowedipscmp");
}
$statusurl = "status_captiveportal.php";
@@ -89,13 +91,14 @@ if ($_POST) {
do_input_validation($_POST, $reqdfields, $reqdfieldsn, &$input_errors);
- if (($_POST['ip'] && !is_ipaddr($_POST['ip']))) {
+ if (($_POST['ip'] && !is_ipaddr($_POST['ip'])))
$input_errors[] = sprintf(gettext("A valid IP address must be specified. [%s]"), $_POST['ip']);
- }
+
if ($_POST['bw_up'] && !is_numeric($_POST['bw_up']))
- $input_errors[] = gettext("Upload speed needs to be an integer");
- if ($_POST['bw_down'] && !is_numeric($_POST['bw_down']))
- $input_errors[] = gettext("Download speed needs to be an integer");
+ $input_errors[] = gettext("Upload speed needs to be an integer");
+
+ if ($_POST['bw_down'] && !is_numeric($_POST['bw_down']))
+ $input_errors[] = gettext("Download speed needs to be an integer");
foreach ($a_allowedips as $ipent) {
if (isset($id) && ($a_allowedips[$id]) && ($a_allowedips[$id] === $ipent))
@@ -114,9 +117,9 @@ if ($_POST) {
$ip['dir'] = $_POST['dir'];
$ip['descr'] = $_POST['descr'];
if ($_POST['bw_up'])
- $ip['bw_up'] = $_POST['bw_up'];
- if ($_POST['bw_down'])
- $ip['bw_down'] = $_POST['bw_down'];
+ $ip['bw_up'] = $_POST['bw_up'];
+ if ($_POST['bw_down'])
+ $ip['bw_down'] = $_POST['bw_down'];
if (isset($id) && $a_allowedips[$id]) {
$oldip = $a_allowedips[$id]['ip'];
if (!empty($a_allowedips[$id]['sn']))
@@ -124,8 +127,8 @@ if ($_POST) {
$a_allowedips[$id] = $ip;
} else {
$oldip = $ip['ip'];
- if (!empty($$ip['sn']))
- $oldip .= "/{$$ip['sn']}";
+ if (!empty($ip['sn']))
+ $oldip .= "/{$ip['sn']}";
$a_allowedips[] = $ip;
}
allowedips_sort();
@@ -153,65 +156,69 @@ include("head.inc");
<?php include("fbegin.inc"); ?>
<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
<?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">
+ <form action="services_captiveportal_ip_edit.php" method="post" name="iform" id="iform">
+ <table width="100%" border="0" cellpadding="6" cellspacing="0">
<tr>
- <td width="22%" valign="top" class="vncellreq"><?=gettext("Direction"); ?></td>
- <td width="78%" class="vtable">
+ <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): ?>
+ 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>
+ <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']);?>">
+ /<select name='sn' class="formselect" id='sn'>
+ <?php for ($i = 32; $i >= 1; $i--): ?>
+ <option value="<?=$i;?>" <?php if ($i == $pconfig['sn']) echo "selected"; ?>><?=$i;?></option>
+ <?php endfor; ?>
+ </select>
+ <br>
+ <span class="vexpl"><?=gettext("IP address and subnet mask. Use /32 for a single IP");?>.</span>
+ </td>
+ </tr>
+ <tr>
+ <td width="22%" valign="top" class="vncell"><?=gettext("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"><?=gettext("You may enter a description here for your reference (not parsed)"); ?>.</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']);?>">
- /<select name='sn' class="formselect" id='sn'>
- <?php for ($i = 32; $i >= 1; $i--): ?>
- <option value="<?=$i;?>" <?php if ($i == $pconfig['sn']) echo "selected"; ?>><?=$i;?></option>
- <?php endfor; ?>
- </select>
- <br>
- <span class="vexpl"><?=gettext("IP address and subnet mask. Use /32 for a single IP");?>.</span></td>
- </tr>
+ <td width="22%" valign="top" class="vncell"><?=gettext("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"><?=gettext("Enter a upload limit to be enforced on this IP address in Kbit/s"); ?></span>
+ </td>
+ </tr>
<tr>
- <td width="22%" valign="top" class="vncell"><?=gettext("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"><?=gettext("You may enter a description here " .
- "for your reference (not parsed)"); ?>.</span></td>
- </tr>
+ <td width="22%" valign="top" class="vncell"><?=gettext("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"><?=gettext("Enter a download limit to be enforced on this IP address in Kbit/s"); ?></span>
+ </td>
+ </tr>
<tr>
- <td width="22%" valign="top" class="vncell"><?=gettext("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"><?=gettext("Enter a upload limit to be enforced on this IP address in Kbit/s"); ?></span></td>
- </tr>
- <tr>
- <td width="22%" valign="top" class="vncell"><?=gettext("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"><?=gettext("Enter a download limit to be enforced on this IP address in Kbit/s"); ?></span></td>
- </tr>
- <tr>
- <td width="22%" valign="top">&nbsp;</td>
- <td width="78%">
- <input name="Submit" type="submit" class="formbtn" value="<?=gettext("Save"); ?>">
- <?php if (isset($id) && $a_allowedips[$id]): ?>
- <input name="id" type="hidden" value="<?=htmlspecialchars($id);?>">
- <?php endif; ?>
- </td>
- </tr>
- </table>
+ <td width="22%" valign="top">&nbsp;</td>
+ <td width="78%">
+ <input name="Submit" type="submit" class="formbtn" value="<?=gettext("Save"); ?>">
+ <?php if (isset($id) && $a_allowedips[$id]): ?>
+ <input name="id" type="hidden" value="<?=htmlspecialchars($id);?>">
+ <?php endif; ?>
+ </td>
+ </tr>
+ </table>
</form>
<?php include("fend.inc"); ?>
</body>
diff --git a/usr/local/www/services_captiveportal_mac.php b/usr/local/www/services_captiveportal_mac.php
index bbcd217..25c250c 100755
--- a/usr/local/www/services_captiveportal_mac.php
+++ b/usr/local/www/services_captiveportal_mac.php
@@ -134,9 +134,10 @@ include("head.inc");
$tab_array[] = array(gettext("Captive portal"), false, "services_captiveportal.php");
$tab_array[] = array(gettext("Pass-through MAC"), true, "services_captiveportal_mac.php");
$tab_array[] = array(gettext("Allowed IP addresses"), false, "services_captiveportal_ip.php");
+ $tab_array[] = array(gettext("Allowed Hostnames"), false, "services_captiveportal_hostname.php");
$tab_array[] = array(gettext("Vouchers"), false, "services_captiveportal_vouchers.php");
$tab_array[] = array(gettext("File Manager"), false, "services_captiveportal_filemanager.php");
- display_top_tabs($tab_array);
+ display_top_tabs($tab_array, true);
?>
</td></tr>
<tr>
diff --git a/usr/local/www/services_captiveportal_vouchers.php b/usr/local/www/services_captiveportal_vouchers.php
index 680a9e1..2ad0217 100644
--- a/usr/local/www/services_captiveportal_vouchers.php
+++ b/usr/local/www/services_captiveportal_vouchers.php
@@ -377,9 +377,10 @@ function enable_change(enable_change) {
$tab_array[] = array(gettext("Captive portal"), false, "services_captiveportal.php");
$tab_array[] = array(gettext("Pass-through MAC"), false, "services_captiveportal_mac.php");
$tab_array[] = array(gettext("Allowed IP addresses"), false, "services_captiveportal_ip.php");
+ $tab_array[] = array(gettext("Allowed Hostnames"), false, "services_captiveportal_hostname.php");
$tab_array[] = array(gettext("Vouchers"), true, "services_captiveportal_vouchers.php");
$tab_array[] = array(gettext("File Manager"), false, "services_captiveportal_filemanager.php");
- display_top_tabs($tab_array);
+ display_top_tabs($tab_array, true);
?>
</ul>
</td>
diff --git a/usr/local/www/vpn_openvpn_client.php b/usr/local/www/vpn_openvpn_client.php
index 96f67bf..d2374b2 100644
--- a/usr/local/www/vpn_openvpn_client.php
+++ b/usr/local/www/vpn_openvpn_client.php
@@ -125,6 +125,7 @@ if($_GET['act']=="edit"){
} else
$pconfig['shared_key'] = base64_decode($a_client[$id]['shared_key']);
$pconfig['crypto'] = $a_client[$id]['crypto'];
+ $pconfig['engine'] = $a_server[$id]['engine'];
$pconfig['tunnel_network'] = $a_client[$id]['tunnel_network'];
$pconfig['remote_network'] = $a_client[$id]['remote_network'];
@@ -254,6 +255,7 @@ if ($_POST) {
$client['shared_key'] = base64_encode($pconfig['shared_key']);
}
$client['crypto'] = $pconfig['crypto'];
+ $client['engine'] = $pconfig['engine'];
$client['tunnel_network'] = $pconfig['tunnel_network'];
$client['remote_network'] = $pconfig['remote_network'];
@@ -716,6 +718,24 @@ if ($savemsg)
</select>
</td>
</tr>
+ <tr id="engine">
+ <td width="22%" valign="top" class="vncellreq"><?=gettext("Hardware Crypto"); ?></td>
+ <td width="78%" class="vtable">
+ <select name="engine" class="formselect">
+ <?php
+ $engines = openvpn_get_engines();
+ foreach ($engines as $name => $desc):
+ $selected = '';
+ if ($name == $pconfig['engine'])
+ $selected = ' selected';
+ ?>
+ <option value="<?=$name;?>"<?=$selected?>>
+ <?=htmlspecialchars($desc);?>
+ </option>
+ <?php endforeach; ?>
+ </select>
+ </td>
+ </tr>
<tr>
<td colspan="2" class="list" height="12"></td>
</tr>
diff --git a/usr/local/www/vpn_openvpn_server.php b/usr/local/www/vpn_openvpn_server.php
index 9d7c00d..0f751e7 100644
--- a/usr/local/www/vpn_openvpn_server.php
+++ b/usr/local/www/vpn_openvpn_server.php
@@ -126,6 +126,7 @@ if($_GET['act']=="edit"){
} else
$pconfig['shared_key'] = base64_decode($a_server[$id]['shared_key']);
$pconfig['crypto'] = $a_server[$id]['crypto'];
+ $pconfig['engine'] = $a_server[$id]['engine'];
$pconfig['tunnel_network'] = $a_server[$id]['tunnel_network'];
$pconfig['remote_network'] = $a_server[$id]['remote_network'];
@@ -176,6 +177,8 @@ if($_GET['act']=="edit"){
// just in case the modes switch
$pconfig['autokey_enable'] = "yes";
$pconfig['autotls_enable'] = "yes";
+
+ $pconfig['duplicate_cn'] = isset($a_server[$id]['duplicate_cn']);
}
}
@@ -322,6 +325,7 @@ if ($_POST) {
$server['shared_key'] = base64_encode($pconfig['shared_key']);
}
$server['crypto'] = $pconfig['crypto'];
+ $server['engine'] = $pconfig['engine'];
$server['tunnel_network'] = $pconfig['tunnel_network'];
$server['remote_network'] = $pconfig['remote_network'];
@@ -364,7 +368,10 @@ if ($_POST) {
if ($pconfig['dns_server_enable'])
$server['nbdd_server1'] = $pconfig['nbdd_server1'];
}
-
+
+ if ($_POST['duplicate_cn'] == "yes")
+ $server['duplicate_cn'] = true;
+
if (isset($id) && $a_server[$id])
$a_server[$id] = $server;
else
@@ -867,6 +874,24 @@ if ($savemsg)
</select>
</td>
</tr>
+ <tr id="engine">
+ <td width="22%" valign="top" class="vncellreq"><?=gettext("Hardware Crypto"); ?></td>
+ <td width="78%" class="vtable">
+ <select name="engine" class="formselect">
+ <?php
+ $engines = openvpn_get_engines();
+ foreach ($engines as $name => $desc):
+ $selected = '';
+ if ($name == $pconfig['engine'])
+ $selected = ' selected';
+ ?>
+ <option value="<?=$name;?>"<?=$selected?>>
+ <?=htmlspecialchars($desc);?>
+ </option>
+ <?php endforeach; ?>
+ </select>
+ </td>
+ </tr>
<tr id="strictusercn">
<td width="22%" valign="top" class="vncell"><?=gettext("Strict User/CN Matching"); ?></td>
<td width="78%" class="vtable">
@@ -1012,6 +1037,24 @@ if ($savemsg)
</table>
</td>
</tr>
+ <tr id="duplicate_cn">
+ <td width="22%" valign="top" class="vncell"><?=gettext("Duplicate Connections"); ?></td>
+ <td width="78%" class="vtable">
+ <table border="0" cellpadding="2" cellspacing="0">
+ <tr>
+ <td>
+ <?php set_checked($pconfig['duplicate_cn'],$chk); ?>
+ <input name="duplicate_cn" type="checkbox" value="yes" <?=$chk;?>/>
+ </td>
+ <td>
+ <span class="vexpl">
+ <?=gettext("Allow multiple concurrent connections from clients using the same Common Name.<br/>NOTE: This is not generally recommended, but may be needed for some scenarios."); ?>
+ </span>
+ </td>
+ </tr>
+ </table>
+ </td>
+ </tr>
</table>
<table width="100%" border="0" cellpadding="6" cellspacing="0" id="client_opts">
diff --git a/usr/local/www/wizards/openvpn_wizard.inc b/usr/local/www/wizards/openvpn_wizard.inc
index 35bca7c..5af4510 100644
--- a/usr/local/www/wizards/openvpn_wizard.inc
+++ b/usr/local/www/wizards/openvpn_wizard.inc
@@ -321,6 +321,15 @@ function step10_stepbeforeformdisplay() {
$opt['value'] = $name;
$pkg['step'][$stepid]['fields']['field'][$idx]['options']['option'][] = $opt;
}
+ } else if ($field['name'] == "engine") {
+ $pkg['step'][$stepid]['fields']['field'][$idx]['options']['option'] = array();
+ $engines = openvpn_get_engines();
+ foreach ($engines as $name => $desc) {
+ $opt = array();
+ $opt['name'] = $desc;
+ $opt['value'] = $name;
+ $pkg['step'][$stepid]['fields']['field'][$idx]['options']['option'][] = $opt;
+ }
} else if ($field['name'] == "nbttype") {
$pkg['step'][$stepid]['fields']['field'][$idx]['options']['option'] = array();
foreach ($netbios_nodetypes as $type => $name) {
@@ -550,6 +559,8 @@ function step12_submitphpaction() {
$server['passtos'] = $pconfig['step10']['tos'];
if (isset($pconfig['step10']['interclient']))
$server['client2client'] = $pconfig['step10']['interclient'];
+ if (isset($pconfig['step10']['duplicate_cn']))
+ $server['duplicate_cn'] = $pconfig['step10']['duplicate_cn'];
if (isset($pconfig['step10']['dynip']))
$server['dynamic_ip'] = $pconfig['step10']['dynip'];
if (isset($pconfig['step10']['addrpool']))
@@ -579,6 +590,7 @@ function step12_submitphpaction() {
$server['netbios_enable'] = $pconfig['step10']['nbtenable'];
}
$server['crypto'] = $pconfig['step10']['crypto'];
+ $server['engine'] = $pconfig['step10']['engine'];
if (isset($pconfig['step11']['ovpnrule'])) {
$rule = array();
diff --git a/usr/local/www/wizards/openvpn_wizard.xml b/usr/local/www/wizards/openvpn_wizard.xml
index e60aa6e..5a7ca5b 100644
--- a/usr/local/www/wizards/openvpn_wizard.xml
+++ b/usr/local/www/wizards/openvpn_wizard.xml
@@ -692,6 +692,19 @@
<description>&lt;br/&gt;The method used to encrypt traffic between endpoints. This setting must match on the client and server side, but is otherwise set however you like. Certain algorithms will perform better on different hardware, depending on the availability of supported VPN accelerator chips.</description>
</field>
<field>
+ <name>engine</name>
+ <type>select</type>
+ <displayname>Hardware Crypto</displayname>
+ <bindstofield>ovpnserver->step10->engine</bindstofield>
+ <options>
+ <option>
+ <name>dummy</name>
+ <value>dummy</value>
+ </option>
+ </options>
+ <description>&lt;br/&gt;The hardware cryptographic accelerator to use for this VPN connection, if any.</description>
+ </field>
+ <field>
<type>listtopic</type>
<name>Tunnel Settings</name>
</field>
@@ -748,6 +761,13 @@
<bindstofield>ovpnserver->step10->interclient</bindstofield>
</field>
<field>
+ <displayname>Duplicate Connections</displayname>
+ <name>duplicate_cn</name>
+ <type>checkbox</type>
+ <description>Allow multiple concurrent connections from clients using the same Common Name.&lt;br/&gt;NOTE: This is not generally recommended, but may be needed for some scenarios.</description>
+ <bindstofield>ovpnserver->step10->duplicate_cn</bindstofield>
+ </field>
+ <field>
<type>listtopic</type>
<name>Client Settings</name>
</field>
@@ -942,4 +962,4 @@
<stepsubmitphpaction>step12_submitphpaction();</stepsubmitphpaction>
<includefile>/usr/local/www/wizards/openvpn_wizard.inc</includefile>
</step>
-</pfsensewizard>
+</pfsensewizard> \ No newline at end of file
diff --git a/usr/local/www/wizards/traffic_shaper_wizard.inc b/usr/local/www/wizards/traffic_shaper_wizard.inc
index 31da91a..b684fb6 100644
--- a/usr/local/www/wizards/traffic_shaper_wizard.inc
+++ b/usr/local/www/wizards/traffic_shaper_wizard.inc
@@ -223,7 +223,7 @@ function step2_stepsubmitphpaction() {
/* Input Validation */
$steps = intval($config['ezshaper']['step1']['numberofconnections']);
for ($i = 0; $i < $steps; $i++) {
- for ($j = $i + 1; $j < $steps; $j++) {
+ for ($j = $i + 1; $j <= $steps; $j++) {
$wannum = $i+1;
if ($_POST["conn{$i}interface"] == $_POST["conn{$j}interface"]) {
$savemsg=gettext("You cannot select the same interface for WAN# {$wannum} and WAN #{$j}.");
@@ -436,6 +436,9 @@ function step3_stepsubmitphpaction() {
global $config;
global $stepid, $savemsg;
+ if (!$_POST['enable'])
+ return;
+
if($_POST['address']) {
if(!is_ipaddroralias($_POST['address'])) {
/* item is not an ip or alias. error out */
@@ -447,24 +450,22 @@ function step3_stepsubmitphpaction() {
$steps = intval($config['ezshaper']['step1']['numberofconnections']);
for ($i = 0; $i < $steps; $i++) {
- if ($_POST["conn{$i}upload"]) {
- if (!is_numeric($_POST["conn{$i}upload"])) {
- $wannum = $i + 1;
- $savemsg = gettext("Upload bandwidth of WAN #{$wannum} is not valid.");
- $stepid--;
- return;
- }
- $factor = wizard_get_bandwidthtype_scale($config['ezshaper']['step2']["conn{$i}uploadspeed"]);
- $ifbw = $factor * floatval($config['ezshaper']['step2']["conn{$i}upload"]);
- $factor = wizard_get_bandwidthtype_scale($_POST["conn{$i}uploadspeed"]);
- $input_bw = $factor * floatval($_POST["conn{$i}upload"]);
- if ((0.8 * $ifbw) < $input_bw) {
- $friendly_interface = $i+1;
- $savemsg=gettext("You cannot set the VoIP upload bandwidth on WAN #{$friendly_interface} higher than 80% of the connection.");
- $stepid--;
- return;
- }
+ if (!is_numeric($_POST["conn{$i}upload"])) {
+ $wannum = $i + 1;
+ $savemsg = gettext("Upload bandwidth of WAN #{$wannum} is not valid.");
+ $stepid--;
+ return;
}
+ $factor = wizard_get_bandwidthtype_scale($config['ezshaper']['step2']["conn{$i}uploadspeed"]);
+ $ifbw = $factor * floatval($config['ezshaper']['step2']["conn{$i}upload"]);
+ $factor = wizard_get_bandwidthtype_scale($_POST["conn{$i}uploadspeed"]);
+ $input_bw = $factor * floatval($_POST["conn{$i}upload"]);
+ if ((0.8 * $ifbw) < $input_bw) {
+ $friendly_interface = $i+1;
+ $savemsg=gettext("You cannot set the VoIP upload bandwidth on WAN #{$friendly_interface} higher than 80% of the connection.");
+ $stepid--;
+ return;
+ }
}
$config['ezshaper']['step3']['download'] = $_POST['download'];
@@ -515,7 +516,7 @@ function step5_stepsubmitphpaction() {
global $stepid, $savemsg;
if ( $_POST['enable'] ) {
- if (isset($_POST['bandwidth']) && $_POST['bandwidth'] <> "") {
+ if ($_POST['p2pcatchall']) {
if(!is_numeric($_POST['bandwidth'])) {
$savemsg="Posted value is not a valid bandwidth.";
$stepid--;
diff --git a/usr/local/www/wizards/traffic_shaper_wizard_dedicated.inc b/usr/local/www/wizards/traffic_shaper_wizard_dedicated.inc
index fa15609..b59c5a7 100755
--- a/usr/local/www/wizards/traffic_shaper_wizard_dedicated.inc
+++ b/usr/local/www/wizards/traffic_shaper_wizard_dedicated.inc
@@ -246,7 +246,7 @@ function step2_stepsubmitphpaction() {
/* Input Validation */
$steps = intval($config['ezshaper']['step1']['numberofconnections']);
for ($i = 0; $i < $steps; $i++) {
- for ($j = $i + 1; $j < $steps; $j++) {
+ for ($j = $i + 1; $j <= $steps; $j++) {
if ($_POST["conn{$i}interface"] == $_POST["conn{$j}interface"] || $_POST["conn{$i}interface"] == $_POST["local{$j}interface"]) {
$savemsg=gettext("You cannot select the same interface for connections {$i} and {$j}.");
$stepid--;
@@ -450,6 +450,9 @@ function step3_stepsubmitphpaction() {
global $config;
global $stepid, $savemsg;
+ if (!$_POST['enable'])
+ return;
+
if($_POST['address']) {
if(!is_ipaddroralias($_POST['address'])) {
/* item is not an ip or alias. error out */
@@ -461,39 +464,35 @@ function step3_stepsubmitphpaction() {
$steps = intval($config['ezshaper']['step1']['numberofconnections']);
for ($i = 0; $i < $steps; $i++) {
- if ($_POST["conn{$i}upload"]) {
- if (!is_numeric($_POST["conn{$i}upload"])) {
- $savemsg = gettext("Upload bandwidth of connection {$i} is not valid.");
- $stepid--;
- return;
- }
- $factor = wizard_get_bandwidthtype_scale($config['ezshaper']['step2']["conn{$i}uploadspeed"]);
- $ifbw = $factor * floatval($config['ezshaper']['step2']["conn{$i}upload"]);
- $factor = wizard_get_bandwidthtype_scale($_POST["conn{$i}uploadspeed"]);
- $input_bw = $factor * floatval($_POST["conn{$i}upload"]);
- if ((0.8 * $ifbw) < $input_bw) {
- $savemsg=gettext("You cannot set the VoIP upload bandwidth on connection {$i} higher than 80% of the connection.");
- $stepid--;
- return;
- }
+ if (!is_numeric($_POST["conn{$i}upload"])) {
+ $savemsg = gettext("Upload bandwidth of connection {$i} is not valid.");
+ $stepid--;
+ return;
}
+ $factor = wizard_get_bandwidthtype_scale($config['ezshaper']['step2']["conn{$i}uploadspeed"]);
+ $ifbw = $factor * floatval($config['ezshaper']['step2']["conn{$i}upload"]);
+ $factor = wizard_get_bandwidthtype_scale($_POST["conn{$i}uploadspeed"]);
+ $input_bw = $factor * floatval($_POST["conn{$i}upload"]);
+ if ((0.8 * $ifbw) < $input_bw) {
+ $savemsg=gettext("You cannot set the VoIP upload bandwidth on connection {$i} higher than 80% of the connection.");
+ $stepid--;
+ return;
+ }
- if ($_POST["local{$i}download"]) {
- if (!is_numeric($_POST["local{$i}download"])) {
- $savemsg = gettext("Download bandwidth of connection {$i} is not valid.");
- $stepid--;
- return;
- }
- $factor = wizard_get_bandwidthtype_scale($config['ezshaper']['step2']["conn{$i}downloadspeed"]);
- $ifbw = $factor * floatval($config['ezshaper']['step2']["conn{$i}download"]);
- $factor = wizard_get_bandwidthtype_scale($_POST["local{$i}downloadspeed"]);
- $input_bw = $factor * floatval($_POST["local{$i}download"]);
- if ((0.8 * $ifbw) < $input_bw) {
- $savemsg=gettext("You cannot set the VoIP download bandwidth on connection {$i} higher than 80% of the connection.");
- $stepid--;
- return;
- }
+ if (!is_numeric($_POST["local{$i}download"])) {
+ $savemsg = gettext("Download bandwidth of connection {$i} is not valid.");
+ $stepid--;
+ return;
}
+ $factor = wizard_get_bandwidthtype_scale($config['ezshaper']['step2']["conn{$i}downloadspeed"]);
+ $ifbw = $factor * floatval($config['ezshaper']['step2']["conn{$i}download"]);
+ $factor = wizard_get_bandwidthtype_scale($_POST["local{$i}downloadspeed"]);
+ $input_bw = $factor * floatval($_POST["local{$i}download"]);
+ if ((0.8 * $ifbw) < $input_bw) {
+ $savemsg=gettext("You cannot set the VoIP download bandwidth on connection {$i} higher than 80% of the connection.");
+ $stepid--;
+ return;
+ }
}
for ($i = 0; $i < $steps; $i++) {
@@ -543,7 +542,7 @@ function step5_stepsubmitphpaction() {
global $stepid, $savemsg;
if ( $_POST['enable'] ) {
- if (isset($_POST['bandwidth']) && $_POST['bandwidth'] <> "") {
+ if ($_POST['p2pcatchall']) {
if(!is_numeric($_POST['bandwidth'])) {
$savemsg="Posted value is not a valid bandwidth.";
$stepid--;
@@ -560,7 +559,7 @@ function step5_stepsubmitphpaction() {
$stepid--;
return;
}
- }
+ }
}
}
diff --git a/usr/local/www/wizards/traffic_shaper_wizard_multi_all.inc b/usr/local/www/wizards/traffic_shaper_wizard_multi_all.inc
index 7c13c6c..c6347da 100755
--- a/usr/local/www/wizards/traffic_shaper_wizard_multi_all.inc
+++ b/usr/local/www/wizards/traffic_shaper_wizard_multi_all.inc
@@ -254,7 +254,7 @@ function step2_stepsubmitphpaction() {
$steps = intval($config['ezshaper']['step1']['numberofconnections']);
$localint = intval($config['ezshaper']['step1']['numberoflocalinterfaces']);
for ($i = 0; $i < $steps; $i++) {
- for ($j = $i + 1; $j < $steps; $j++) {
+ for ($j = $i + 1; $j <= $steps; $j++) {
if ($_POST["conn{$i}interface"] == $_POST["conn{$j}interface"]) {
$savemsg=gettext("You cannot select the same interface for connections {$i} and {$j}.");
$stepid--;
@@ -480,6 +480,9 @@ function step3_stepsubmitphpaction() {
global $config;
global $stepid, $savemsg;
+ if (!$_POST['enable'])
+ return;
+
if($_POST['address']) {
if(!is_ipaddroralias($_POST['address'])) {
/* item is not an ip or alias. error out */
@@ -491,8 +494,7 @@ function step3_stepsubmitphpaction() {
$steps = intval($config['ezshaper']['step1']['numberofconnections']);
for ($i = 0; $i < $steps; $i++) {
- if ($_POST["conn{$i}upload"]) {
- if (!is_numeric($_POST["conn{$i}upload"])) {
+ if (!is_numeric($_POST["conn{$i}upload"])) {
$savemsg = gettext("Upload bandwidth of connection {$i} is not valid.");
$stepid--;
return;
@@ -505,27 +507,24 @@ function step3_stepsubmitphpaction() {
$savemsg=gettext("You cannot set the VoIP upload bandwidth on connection {$i} higher than 80% of the connection.");
$stepid--;
return;
- }
- }
+ }
}
$localint = intval($config['ezshaper']['step1']['numberoflocalinterfaces']);
for ($i = 0; $i < $localint; $i++) {
- if ($_POST["local{$i}download"]) {
- if (!is_numeric($_POST["local{$i}download"])) {
- $savemsg = gettext("Download bandwidth of connection {$i} is not valid.");
- $stepid--;
- return;
- }
- $factor = wizard_get_bandwidthtype_scale($config['ezshaper']['step2']["conn{$i}downloadspeed"]);
- $ifbw = $factor * floatval($config['ezshaper']['step2']["conn{$i}download"]);
- $factor = wizard_get_bandwidthtype_scale($_POST["local{$i}downloadspeed"]);
- $input_bw = $factor * floatval($_POST["local{$i}download"]);
- if ((0.8 * $ifbw) < $input_bw) {
- $savemsg=gettext("You cannot set the VoIP download bandwidth on connection {$i} higher than 80% of the connection.");
- $stepid--;
- return;
- }
+ if (!is_numeric($_POST["local{$i}download"])) {
+ $savemsg = gettext("Download bandwidth of connection {$i} is not valid.");
+ $stepid--;
+ return;
+ }
+ $factor = wizard_get_bandwidthtype_scale($config['ezshaper']['step2']["conn{$i}downloadspeed"]);
+ $ifbw = $factor * floatval($config['ezshaper']['step2']["conn{$i}download"]);
+ $factor = wizard_get_bandwidthtype_scale($_POST["local{$i}downloadspeed"]);
+ $input_bw = $factor * floatval($_POST["local{$i}download"]);
+ if ((0.8 * $ifbw) < $input_bw) {
+ $savemsg=gettext("You cannot set the VoIP download bandwidth on connection {$i} higher than 80% of the connection.");
+ $stepid--;
+ return;
}
}
@@ -570,14 +569,14 @@ function step4_stepsubmitphpaction() {
/* item is not an ip or alias. error out */
$savemsg=gettext("Address must be a valid IP address or Firewall Alias. Please correct this value to continue.");
$stepid--;
- }
+ }
}
}
function step5_stepsubmitphpaction() {
global $stepid, $savemsg;
if ( $_POST['enable'] ) {
- if (isset($_POST['bandwidth']) && $_POST['bandwidth'] <> "") {
+ if ($_POST['p2pcatchall']) {
if(!is_numeric($_POST['bandwidth'])) {
$savemsg="Posted value is not a valid bandwidth.";
$stepid--;
diff --git a/usr/local/www/wizards/traffic_shaper_wizard_multi_lan.inc b/usr/local/www/wizards/traffic_shaper_wizard_multi_lan.inc
index 44d5314..a5de47e 100644
--- a/usr/local/www/wizards/traffic_shaper_wizard_multi_lan.inc
+++ b/usr/local/www/wizards/traffic_shaper_wizard_multi_lan.inc
@@ -228,7 +228,7 @@ function step2_stepsubmitphpaction() {
/* Input Validation */
$steps = intval($config['ezshaper']['step1']['numberofconnections']);
for ($i = 0; $i < $steps; $i++) {
- for ($j = $j; $j < $steps; $j++) {
+ for ($j = $i + 1; $j <= $steps; $j++) {
if ($_POST["conn{$i}interface"] == $_POST["conn{$j}interface"]) {
$savemsg=gettext("You cannot select the same interface for different LAN #{$i} and LAN #{$j}.");
$stepid--;
@@ -284,6 +284,9 @@ function step3_stepsubmitphpaction() {
global $config;
global $stepid, $savemsg;
+ if (!$_POST['enable'])
+ return;
+
if($_POST['address']) {
if(!is_ipaddroralias($_POST['address'])) {
/* item is not an ip or alias. error out */
@@ -295,22 +298,20 @@ function step3_stepsubmitphpaction() {
$steps = intval($config['ezshaper']['step1']['numberofconnections']);
for ($i = 0; $i < $steps; $i++) {
- if ($_POST["connupload"]) {
- if (!is_numeric($_POST["connupload"])) {
- $savemsg = gettext("Upload bandwidth of connection {$i} is not valid.");
- $stepid--;
- return;
- }
- $factor = wizard_get_bandwidthtype_scale($config['ezshaper']['step2']["conn{$i}uploadspeed"]);
- $ifbw = $factor * floatval($config['ezshaper']['step2']["conn{$i}upload"]);
- $factor = wizard_get_bandwidthtype_scale($_POST["conn{$i}uploadspeed"]);
- $input_bw = $factor * floatval($_POST["conn{$i}upload"]);
- if ((0.8 * $ifbw) < $input_bw) {
- $savemsg=gettext("You cannot set the VoIP upload bandwidth on connection {$i} higher than 80% of the connection.");
- $stepid--;
- return;
- }
+ if (!is_numeric($_POST["connupload"])) {
+ $savemsg = gettext("Upload bandwidth of connection {$i} is not valid.");
+ $stepid--;
+ return;
}
+ $factor = wizard_get_bandwidthtype_scale($config['ezshaper']['step2']["conn{$i}uploadspeed"]);
+ $ifbw = $factor * floatval($config['ezshaper']['step2']["conn{$i}upload"]);
+ $factor = wizard_get_bandwidthtype_scale($_POST["conn{$i}uploadspeed"]);
+ $input_bw = $factor * floatval($_POST["conn{$i}upload"]);
+ if ((0.8 * $ifbw) < $input_bw) {
+ $savemsg=gettext("You cannot set the VoIP upload bandwidth on connection {$i} higher than 80% of the connection.");
+ $stepid--;
+ return;
+ }
}
}
@@ -357,7 +358,7 @@ function step5_stepsubmitphpaction() {
global $stepid, $savemsg;
if ( $_POST['enable'] ) {
- if (isset($_POST['bandwidth']) && $_POST['bandwidth'] <> "") {
+ if ($_POST['p2pcatchall']) {
if(!is_numeric($_POST['bandwidth'])) {
$savemsg="Posted value is not a valid bandwidth.";
$stepid--;
OpenPOWER on IntegriCloud