summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--etc/inc/filter.inc125
-rw-r--r--etc/inc/shaper.inc2413
-rwxr-xr-xusr/local/www/firewall_rules.php24
-rwxr-xr-xusr/local/www/firewall_shaper.php257
-rwxr-xr-xusr/local/www/firewall_shaper_queues.php21
-rw-r--r--usr/local/www/wizards/traffic_shaper_wizard.inc1331
-rw-r--r--usr/local/www/wizards/traffic_shaper_wizard.xml2252
7 files changed, 3479 insertions, 2944 deletions
diff --git a/etc/inc/filter.inc b/etc/inc/filter.inc
index 87054b1..c8a2895 100644
--- a/etc/inc/filter.inc
+++ b/etc/inc/filter.inc
@@ -1346,17 +1346,15 @@ EOD;
require_once('clamav.inc');
$natrules .= clamav_generate_rules('nat');
}
-
if (is_package_installed('frickin') && file_exists('/usr/local/pkg/frickin.inc')) {
require_once ('frickin.inc');
$natrules .= frickin_generate_rules('nat');
}
+ if (is_package_installed('siproxd') && file_exists('/usr/local/pkg/sipproxd.inc')) {
+ require_once('sipproxd.inc');
+ $natrules .= siproxd_generate_rules('nat');
+ }
- if (is_package_installed('siproxd') && file_exists('/usr/local/pkg/sipproxd.inc')) {
- require_once('sipproxd.inc');
- $natrules .= siproxd_generate_rules('nat');
- }
-
$natrules .= process_carp_nat_rules();
$natrules .= "# IMSpector rdr anchor\n";
@@ -1490,7 +1488,7 @@ function generate_user_filter_rule($rule, $ngcounter) {
} else {
/* Check to see if the interface is opt and in our opt list */
- if (strstr($rule['interface'], "opt")) {
+ if (!isset($rule['floating']) && strstr($rule['interface'], "opt")) {
if (!array_key_exists($rule['interface'], $optcfg)) {
$item = "";
foreach($optcfg as $oc) $item .= $oc['if'];
@@ -1577,13 +1575,19 @@ function generate_user_filter_rule($rule, $ngcounter) {
$aline['type'] = $type;
}
- /* ensure the direction is in */
- $aline['direction'] = " in ";
+ if (isset($rule['floating']) && $rule['floating'] == "yes") {
+ if ($rule['direction'] != "any")
+ $aline['direction'] = " " . $rule['direction'] . " ";
+ } else {
+ /* ensure the direction is in */
+ $aline['direction'] = " in ";
+ }
if (isset($rule['log']))
$aline['log'] = "log ";
- $aline['quick'] = "quick ";
+ if (!isset($rule['floating']) || isset($rule['quick']))
+ $aline['quick'] = "quick ";
if ($ispptp) {
$aline['interface'] = "on \$pptp ";
@@ -1602,7 +1606,7 @@ function generate_user_filter_rule($rule, $ngcounter) {
if(is_one_to_one_or_server_nat_rule($rule['destination']['address']))
$canadd = 0;
}
- if($canadd == 0)
+ if($canadd == 0 && !isset($rule['floating']))
$aline['interface'] = "on \$" . convert_real_interface_to_friendly_descr($rule['interface']) . " ";
}
@@ -1780,14 +1784,14 @@ function generate_user_filter_rule($rule, $ngcounter) {
if (isset($rule['protocol'])) {
if($rule['protocol'] == "tcp/udp")
- $aline['prot'] = "proto { tcp udp } ";
+ $aline['prot'] = " proto { tcp udp } ";
elseif($rule['protocol'] == "icmp")
- $aline['prot'] = "inet proto icmp ";
+ $aline['prot'] = " inet proto icmp ";
else
- $aline['prot'] = "proto {$rule['protocol']} ";
+ $aline['prot'] = " proto {$rule['protocol']} ";
} else {
if($rule['source']['port'] <> "" || $rule['destination']['port'] <> "") {
- $aline['prot'] = "proto tcp ";
+ $aline['prot'] = " proto tcp ";
}
}
@@ -1878,9 +1882,9 @@ function generate_user_filter_rule($rule, $ngcounter) {
$srcporta = $srcport[0];
if ((!$srcport[1]) || ($srcport[0] == $srcport[1])) {
if(alias_expand($srcport[0]))
- $aline['srcport'] = "port {$srcporta} ";
+ $aline['srcport'] = " port {$srcporta} ";
else
- $aline['srcport'] = "port = {$srcporta} ";
+ $aline['srcport'] = " port = {$srcporta} ";
} else if (($srcport[0] == 1) && ($srcport[1] == 65535)) {
/* no need for a port statement here */
} else if ($srcport[1] == 65535) {
@@ -1890,12 +1894,12 @@ function generate_user_filter_rule($rule, $ngcounter) {
} else {
$srcport[0]--;
$srcport[1]++;
- $aline['srcport'] = "port {$srcport[0]} >< {$srcport[1]} ";
+ $aline['srcport'] = " port {$srcport[0]} >< {$srcport[1]} ";
}
}
/* OS signatures */
if (($rule['protocol'] == "tcp") && ($rule['os'] <> ""))
- $aline['os'] = "os {$rule['os']} ";
+ $aline['os'] = " os {$rule['os']} ";
}
@@ -1984,19 +1988,19 @@ function generate_user_filter_rule($rule, $ngcounter) {
$dstporta = $dstport[0];
if ((!$dstport[1]) || ($dstport[0] == $dstport[1])) {
if(alias_expand($dstport[0]))
- $aline['dstport'] = "port {$dstporta} ";
+ $aline['dstport'] = " port {$dstporta} ";
else
$aline['dstport'] = "port = {$dstporta} ";
} else if (($dstport[0] == 1) && ($dstport[1] == 65535)) {
/* no need for a port statement here */
} else if ($dstport[1] == 65535) {
- $aline['dstport'] = "port >= {$dstport[0]} ";
+ $aline['dstport'] = " port >= {$dstport[0]} ";
} else if ($dstport[0] == 1) {
- $aline['dstport'] = "port <= {$dstport[1]} ";
+ $aline['dstport'] = " port <= {$dstport[1]} ";
} else {
$dstport[0]--;
$dstport[1]++;
- $aline['dstport'] = "port {$dstport[0]} >< {$dstport[1]} ";
+ $aline['dstport'] = " port {$dstport[0]} >< {$dstport[1]} ";
}
}
}
@@ -2007,6 +2011,13 @@ function generate_user_filter_rule($rule, $ngcounter) {
if ($type == "pass") {
+ if (isset($rule['floating'])) {
+ if (isset($rule['tag']))
+ $aline['tag'] = $rule['tag'];
+ if (isset($rule['tagged']))
+ $aline['tagged'] = $rule['tagged'];
+ }
+
if( isset($rule['source-track']) or isset($rule['max-src-nodes']) or isset($rule['max-src-states']) )
if($rule['protocol'] == "tcp")
$aline['flags'] = "flags S/SA ";
@@ -2107,8 +2118,8 @@ function generate_user_filter_rule($rule, $ngcounter) {
$vpns = " to <vpns> ";
$line .= $aline['type'] . $aline['direction'] . $aline['log'] . $aline['quick'] . $aline['interface'] . $aline['prot'] .
$aline['src'] . $aline['srcport'] . $aline['os'] . $vpns . $aline['dstport'].
- $aline['icmp-type'] . $aline['flags'] .
- " label \"NEGATE_ROUTE: Negate policy route for local network(s)\"\n";
+ $aline['icmp-type'] . $aline['tag'] . $aline['tagged'] . $aline['flags'] .
+ $aline['queue'] . " label \"NEGATE_ROUTE: Negate policy route for local network(s)\"\n";
/* if list */
$iflist = array("lan", "wan");
for ($i = 1; isset($config['interfaces']['opt' . $i]); $i++)
@@ -2132,14 +2143,14 @@ function generate_user_filter_rule($rule, $ngcounter) {
/* return the line */
$line .= $aline['type'] . $aline['direction'] . $aline['log'] . $aline['quick'] . $aline['interface'] . $aline['prot'] .
$aline['src'] . $aline['srcport'] . $aline['os'] . $localnets . $aline['dstport'].
- $aline['icmp-type'] . $aline['flags'] .
+ $aline['icmp-type'] . $aline['tag'] . $aline['tagged'] . $aline['flags'] . $aline['queue'] .
" label \"NEGATE_ROUTE: Negate policy route for local network(s)\"\n";
}
/* piece together the actual user rule */
$line .= $aline['type'] . $aline['direction'] . $aline['log'] . $aline['quick'] . $aline['interface'] . $aline['reply'] .
$aline['route'] . $aline['prot'] . $aline['src'] . $aline['srcport'] . $aline['os'] . $aline['dst'] .
- $aline['dstport'] . $aline['icmp-type'] . $aline['flags'] . $aline['queue'];
+ $aline['dstport'] . $aline['icmp-type'] . $aline['tag'] . $aline['tagged'] . $aline['flags'] . $aline['queue'];
/* is a time based rule schedule attached? */
if($rule['sched']) {
@@ -2233,6 +2244,11 @@ function filter_rules_generate() {
$ipfrules .= clamav_generate_rules('filter');
}
+ if (is_package_installed('squid') && file_exists('/usr/local/pkg/squid.inc')) {
+ require_once('squid.inc');
+ $ipfrules .= squid_generate_rules('filter');
+ }
+
if (is_package_installed('clamav') && file_exists('/usr/local/pkg/clamav.inc')) {
require_once('clamav.inc');
$ipfrules .= clamav_generate_rules('filter');
@@ -2242,11 +2258,10 @@ function filter_rules_generate() {
require_once ('frickin.inc');
$ipfrules .= frickin_generate_rules('filter');
}
-
- if (is_package_installed('siproxd') && file_exists('/usr/local/pkg/sipproxd.inc')) {
- require_once('sipproxd.inc');
- $ipfrules .= siproxd_generate_rules('filter');
- }
+ if (is_package_installed('siproxd') && file_exists('/usr/local/pkg/sipproxd.inc')) {
+ require_once('sipproxd.inc');
+ $ipfrules .= siproxd_generate_rules('filter');
+ }
/* if captive portal is enabled, ensure that access to this port
* is allowed on a locked down interface
@@ -2298,6 +2313,12 @@ table <snort2c> persist
block quick from <snort2c> to any label "Block snort2c hosts"
block quick from any to <snort2c> label "Block snort2c hosts"
+#---------------------------------------------------------------------------
+# default deny rules
+#---------------------------------------------------------------------------
+block in $log all label "Default deny rule"
+block out $log all label "Default deny rule"
+
# loopback
anchor "loopback"
pass in quick on \$loopback all label "pass loopback"
@@ -2486,7 +2507,7 @@ EOD;
# allow access to DHCP server on {$on}
anchor "dhcpserver{$friendly_on}"
pass in quick on \${$friendly_on} proto udp from any port = 68 to 255.255.255.255 port = 67 label "allow access to DHCP server"
-pass in quick on \${$friendly_on} proto udp from any port = 68 to {$oc['ip']} port = 67 label "allow access to DHCP server"
+pass in quick on \${$friendly_on} proto udp from any port = 68 to {$oc['ip']} port = 67 label "allow access to DHCP server"
pass out quick on \${$friendly_on} proto udp from {$oc['ip']} port = 67 to any port = 68 label "allow access to DHCP server"
EOD;
@@ -2749,7 +2770,7 @@ EOD;
}
$ipfrules .= "\n# SSH lockout\n";
- $ipfrules .= "block in log proto tcp from <sshlockout> to any port 22 label \"sshlockout\"\n\n";
+ $ipfrules .= "block in log quick proto tcp from <sshlockout> to any port 22 label \"sshlockout\"\n\n";
$ipfrules .= "anchor \"ftp-proxy/*\"\n";
@@ -2757,13 +2778,25 @@ EOD;
$ipfrules .= "\n\n# ftp-proxy specific\n";
foreach($used_pftpx_ports as $pftpx)
- $ipfrules .= "pass in quick on {$pftpx['interface']} inet proto tcp from any to 127.0.0.1 port {$pftpx['port']} keep state label \"FTP PROXY: Allow traffic to localhost\"\n";
+ $ipfrules .= "pass in on {$pftpx['interface']} inet proto tcp from any to 127.0.0.1 port {$pftpx['port']} keep state label \"FTP PROXY: Allow traffic to localhost\"\n";
$ipfrules .= "\n";
if (isset($config['filter']['rule'])) {
/* Pre-cache all our rules so we only have to generate them once */
$rule_arr = array();
+ /*
+ * XXX: This is a double pass but it needs to be this way.
+ * to allow users to override floating rules.
+ */
+ foreach ($config['filter']['rule'] as $rule) {
+ update_filter_reload_status("Pre-caching information for {$rule['descr']} ...");
+ $line = "";
+ if (!isset ($rule['disabled']) && !isset($rule['floating'])) {
+ $rule_arr[] = generate_user_filter_rule_arr($rule, 0);
+ }
+
+ }
foreach ($config['filter']['rule'] as $rule) {
update_filter_reload_status("Pre-caching {$rule['descr']}...");
$line = "";
@@ -2899,9 +2932,9 @@ EOD;
}
$ipfrules .= <<<EOD
-pass in quick on $lanif inet proto tcp from any to \$loopback port 8021 keep state label "FTP PROXY: Allow traffic to localhost"
-pass in quick on $lanif inet proto tcp from any to \$loopback port 21 keep state label "FTP PROXY: Allow traffic to localhost"
-pass in quick on $wanif inet proto tcp from port 20 to ($wanif) port > 49000 user proxy flags S/SA keep state label "FTP PROXY: PASV mode data connection"
+pass in on $lanif inet proto tcp from any to \$loopback port 8021 keep state label "FTP PROXY: Allow traffic to localhost"
+pass in on $lanif inet proto tcp from any to \$loopback port 21 keep state label "FTP PROXY: Allow traffic to localhost"
+pass in on $wanif inet proto tcp from port 20 to ($wanif) port > 49000 user proxy flags S/SA keep state label "FTP PROXY: PASV mode data connection"
EOD;
@@ -2914,8 +2947,8 @@ EOD;
$ftp_counter = "8022";
foreach($optcfg as $oc) {
if(!isset($oc['gateway']) && $oc['if'] <> "") {
- $ipfrules .= "pass in quick on " . $oc['if'] . " inet proto tcp from any to \$loopback port {$ftp_counter} keep state label \"FTP PROXY: Allow traffic to localhost\"\n";
- $ipfrules .= "pass in quick on " . $oc['if'] . " inet proto tcp from any to \$loopback port 21 keep state label \"FTP PROXY: Allow traffic to localhost\"\n";
+ $ipfrules .= "pass in on " . $oc['if'] . " inet proto tcp from any to \$loopback port {$ftp_counter} keep state label \"FTP PROXY: Allow traffic to localhost\"\n";
+ $ipfrules .= "pass in on " . $oc['if'] . " inet proto tcp from any to \$loopback port 21 keep state label \"FTP PROXY: Allow traffic to localhost\"\n";
}
$ftp_counter++;
}
@@ -2927,7 +2960,7 @@ EOD;
# be sourced from the command port - 1 (typically port 20)
# This workaround doesn't expose us to any extra risk as we'll still only allow
# connections to the firewall on a port that ftp-proxy is listening on
-pass in quick on $wanif inet proto tcp from any to ($wanif) port > 49000 user proxy flags S/SA keep state label "FTP PROXY: RFC959 violation workaround"
+pass in on $wanif inet proto tcp from any to ($wanif) port > 49000 user proxy flags S/SA keep state label "FTP PROXY: RFC959 violation workaround"
EODEOD;
@@ -2935,7 +2968,7 @@ EODEOD;
generate_optcfg_array($optcfg);
foreach($optcfg as $oc) {
if($oc['gateway'] <> "")
- $ipfrules .= "pass in quick on {$oc['if']} inet proto tcp from any to ({$oc['if']}) port > 49000 user proxy flags S/SA keep state label \"FTP PROXY: RFC959 violation workaround\" \n";
+ $ipfrules .= "pass in on {$oc['if']} inet proto tcp from any to ({$oc['if']}) port > 49000 user proxy flags S/SA keep state label \"FTP PROXY: RFC959 violation workaround\" \n";
}
}
}
@@ -2948,12 +2981,6 @@ anchor "imspector"
# uPnPd
anchor "miniupnpd"
-#---------------------------------------------------------------------------
-# default deny rules
-#---------------------------------------------------------------------------
-block in $log quick all label "Default deny rule"
-block out $log quick all label "Default deny rule"
-
EOD;
return $ipfrules;
@@ -3332,4 +3359,4 @@ function return_vpn_subnet($adr) {
}
-?> \ No newline at end of file
+?>
diff --git a/etc/inc/shaper.inc b/etc/inc/shaper.inc
index 3169375..721ce75 100644
--- a/etc/inc/shaper.inc
+++ b/etc/inc/shaper.inc
@@ -1,35 +1,36 @@
<?php
/*
- Copyright (C) 2004, 2005 Scott Ullrich
- Copyright (C) 2008 Ermal Lu\xe7i
- 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.
+ Copyright (C) 2004, 2005 Scott Ullrich
+ Copyright (C) 2008 Ermal Luçi
+ 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.
*/
/* include all configuration functions */
require_once("functions.inc");
require_once("pkg-utils.inc");
require_once("notices.inc");
+//require_once("guiconfig.inc");
/*
* I admit :) this is derived from xmplparse.inc StartElement()
@@ -37,20 +38,20 @@ require_once("notices.inc");
function &get_reference_to_me_in_config(&$mypath) {
global $config;
- $ptr =& $config['shaper'];
+ $ptr =& $config['shaper'];
foreach ($mypath as $indeks) {
- $ptr =& $ptr['queue'][$indeks];
- }
+ $ptr =& $ptr['queue'][$indeks];
+ }
return $ptr;
}
function unset_object_by_reference(&$mypath) {
global $config;
- $ptr =& $config['shaper'];
- for ($i = 0; $i < count($mypath) - 1; $i++) {
- $ptr =& $ptr['queue'][$mypath[$i]];
- }
+ $ptr =& $config['shaper'];
+ for ($i = 0; $i < count($mypath) - 1; $i++) {
+ $ptr =& $ptr['queue'][$mypath[$i]];
+ }
unset($ptr['queue'][$mypath[$i]]);
}
@@ -72,13 +73,13 @@ function clean_child_queues($type, $mypath) {
if (isset($ref['realtime2'])) unset($ref['realtime2']);
if (isset($ref['realtime3'])) unset($ref['realtime3']);
if (isset($ref['upperlimit'])) unset($ref['upperlimit']);
- if (isset($ref['upperlimit1'])) unset($ref['upperlimit1']);
- if (isset($ref['upperlimit2'])) unset($ref['upperlimit2']);
- if (isset($ref['upperlimit3'])) unset($ref['upperlimit3']);
+ if (isset($ref['upperlimit1'])) unset($ref['upperlimit1']);
+ if (isset($ref['upperlimit2'])) unset($ref['upperlimit2']);
+ if (isset($ref['upperlimit3'])) unset($ref['upperlimit3']);
if (isset($ref['linkshare'])) unset($ref['linkshare']);
- if (isset($ref['linkshare1'])) unset($ref['linkshare1']);
- if (isset($ref['linkshare2'])) unset($ref['linkshare2']);
- if (isset($ref['linkshare3'])) unset($ref['linkshare3']);
+ if (isset($ref['linkshare1'])) unset($ref['linkshare1']);
+ if (isset($ref['linkshare2'])) unset($ref['linkshare2']);
+ if (isset($ref['linkshare3'])) unset($ref['linkshare3']);
break;
}
}
@@ -101,18 +102,25 @@ function cleanup_queue_from_rules($queue) {
}
class altq_root_queue {
- var $interface;
- var $tbrconfig ;
- var $bandwidth;
- var $bandwidthtype; /* b, Kb, Mb */
- var $scheduler;
+ var $interface;
+ var $tbrconfig ;
+ var $bandwidth;
+ var $bandwidthtype; /* b, Kb, Mb */
+ var $scheduler;
var $qlimit;
- var $queues = array();
+ var $queues = array();
var $qenabled;
var $link;
var $default_present; /* if we have a default queue set */
+ var $available_bw; /* in b/s */
- /* Accesor functions */
+ /* Accesor functions */
+ function GetAvailableBandwidth() {
+ return $this->available_bw;
+ }
+ function SetAvailableBandwidth($bw) {
+ $this->available_bw = $bw;
+ }
function SetDefaultQueuePresent($value) {
$this->default_present = $value;
}
@@ -128,7 +136,7 @@ class altq_root_queue {
function GetEnabled() {
return $this->qenabled;
}
- function SetEnabled($value = false) {
+ function SetEnabled($value) {
$this->qenabled = $value;
}
function CanHaveChilds() {
@@ -143,36 +151,36 @@ class altq_root_queue {
function SetQname($name) {
$this->interface = trim($name);
}
- function GetInterface() {
- return $this->interface;
- }
- function SetInterface($name) {
- $this->interface = trim($name);
- }
- function GetTbrConfig() {
- return $this->tbrconfig;
- }
- function SetTbrConfig($tbrconfig) {
- $this->tbrconfig = $tbrconfig;
- }
- function GetBandwidth() {
- return $this->bandwidth;
- }
- function SetBandwidth($bw) {
- $this->bandwidth = trim($bw);
- }
- function GetBwscale() {
- return $this->bandwidthtype;
- }
- function SetBwscale($bwscale) {
- $this->bandwidthtype = $bwscale;
- }
- function GetScheduler() {
- return $this->scheduler;
- }
- function SetScheduler($scheduler) {
- $this->scheduler = trim($scheduler);
- }
+ function GetInterface() {
+ return $this->interface;
+ }
+ function SetInterface($name) {
+ $this->interface = trim($name);
+ }
+ function GetTbrConfig() {
+ return $this->tbrconfig;
+ }
+ function SetTbrConfig($tbrconfig) {
+ $this->tbrconfig = $tbrconfig;
+ }
+ function GetBandwidth() {
+ return $this->bandwidth;
+ }
+ function SetBandwidth($bw) {
+ $this->bandwidth = trim($bw);
+ }
+ function GetBwscale() {
+ return $this->bandwidthtype;
+ }
+ function SetBwscale($bwscale) {
+ $this->bandwidthtype = $bwscale;
+ }
+ function GetScheduler() {
+ return $this->scheduler;
+ }
+ function SetScheduler($scheduler) {
+ $this->scheduler = trim($scheduler);
+ }
function GetQlimit() {
return $this->qlimit;
}
@@ -181,26 +189,86 @@ class altq_root_queue {
}
function validate_input($data, &$input_errors) {
-
- do_input_validation($data, $reqdfields, $reqdfieldsn, $input_errors);
-
+ global $config; /* XXX: how to get info about interfaces?! */
+
+ $reqfields[] = "bandwidth";
+ $reqdfieldsn[] = "Bandwidth";
+ $reqfields[] = "bandwidthtype";
+ $reqdfieldsn[] = "Bandwidthtype";
+
+ //do_input_validation($data, $reqdfields, $reqdfieldsn, $input_errors);
+
+ switch ($config['interfaces'][$this->GetQname()]['banwidthtype']) {
+ case "Mb":
+ $factor = 1000;
+ break;
+ case "Kb":
+ $factor = 1;
+ break;
+ case "b":
+ $factor = 1/1000;
+ break;
+ case "Gb":
+ $factor = 1000 * 1000;
+ break;
+ case "%":
+ $factor = intval($config['interfaces'][$this->GetQname()]['banwidth']) / 100;
+ break;
+ default: /* XXX */
+ $factor = 1;
+ break;
+ }
+ switch ($data['banwidthtype']) {
+ case "Mb":
+ $myfactor = 1000;
+ brak;
+ case "Kb":
+ $myfactor = 1;
+ break;
+ case "b":
+ $myfactor = 1/1000;
+ break;
+ case "Gb":
+ $myfactor = 1000 * 1000;
+ break;
+ case "%":
+ $factor = intval($config['interfaces'][$this->GetQname()]['banwidth']) / 100;
+ break;
+ default: /* XXX */
+ $myfactor = 1;
+ break;
+ }
+
+ if (isset($config['interface'][$this->GetQname()]['bandwidth'])) {
+ /* if ($config['interface'][$this->GetQname()]['bandwidth'] * $factor <
+ $data['bandwidth'] * $myfactor)
+ $input_errors[] = "Bandwidth cannot be set higher than that of interface.";
+ */
+ }
+ if ($data['bandwidth'] && (!is_numeric($data['bandwidth'])))
+ $input_errors[] = "Bandwidth must be an integer.";
+ if ($data['bandwidth'] < 0)
+ $input_errors[] = "Bandwidth cannot be negative.";
if ($data['qlimit'] && (!is_numeric($data['qlimit'])))
- $input_errors[] = "Qlimit must be an integer.";
+ $input_errors[] = "Qlimit must be an integer.";
+ if ($data['qlimit'] < 0)
+ $input_errors[] = "Qlimit must be an positive.";
if ($data['tbrconfig'] && (!is_numeric($data['tbrconfig'])))
- $input_errors[] = "Qlimit must be an integer.";
-
- }
+ $input_errors[] = "Tbrsize must be an integer.";
+ if ($data['tbrconfig'] < 0)
+ $input_errors[] = "Tbrsize must be an positive.";
+ }
/* Implement this to shorten some code on the frontend page */
- function ReadConfig(&$conf) {
+ function ReadConfig(&$conf) {
if (isset($conf['tbrconfig']))
- $this->SetTbrConfig($conf['tbrconfig']);
- if ($conf['bandwidth']) {
- $this->SetBandwidth($conf['bandwidth']);
- if ($conf['bandwidthtype'])
- $this->SetBwscale($conf['bandwidthtype']);
- }
+ $this->SetTbrConfig($conf['tbrconfig']);
+ if ($conf['bandwidth'] <> "") {
+ $this->SetBandwidth($conf['bandwidth']);
+ if ($conf['bandwidthtype'] <> "")
+ $this->SetBwscale($conf['bandwidthtype']);
+ }
if (isset($conf['scheduler'])) {
if ($this->GetScheduler() != $conf['scheduler']) {
foreach ($this->queues as $q) {
@@ -208,13 +276,14 @@ class altq_root_queue {
$q->clean_queue($conf['scheduler']);
}
}
- $this->SetScheduler($conf['scheduler']);
+ $this->SetScheduler($conf['scheduler']);
}
- if (isset($conf['qlimit']))
+ if (isset($conf['qlimit']) && $conf['qlimit'] <> "")
$this->SetQlimit($conf['qlimit']);
if (isset($conf['name']))
$this->SetQname($conf['name']);
- $this->SetEnabled($conf['enabled']);
+ //if (isset($conf['enabled']) && $conf['enabled'] == "on")
+ $this->SetEnabled("on");
}
@@ -225,70 +294,96 @@ class altq_root_queue {
$link = &get_reference_to_me_in_config($queue->GetLink());
if ($link && $mylink) {
- if (!is_array($mylink['queue'][$queue->GetQname()]))
- $mylink['queue'][$queue->GetQname()] = array();
+ if (!is_array($mylink['queue'][$queue->GetQname()]))
+ $mylink['queue'][$queue->GetQname()] = array();
- foreach ($link as $key => $value)
- $mylink['queue'][$queue->GetQname()][$key] = $value;
- }
+ foreach ($link as $key => $value)
+ $mylink['queue'][$queue->GetQname()][$key] = $value;
+ }
}
- function &add_queue($interface, &$queue, &$path) {
-
- if (!is_array($this->queues))
- $this->queues = array();
-
- switch ($this->GetScheduler()) {
- case "PRIQ":
- $q =& new priq_queue();
- break;
- case "HFSC":
- $q =& new hfsc_queue();
- break;
- case "CBQ":
- $q =& new cbq_queue();
- break;
- default:
- /* XXX: but should not happen anyway */
- return;
- break;
- }
- $q->ReadConfig($queue);
- $q->SetLink($path);
- $q->SetInterface($this->GetInterface());
- $q->SetEnabled("on");
- $q->SetParent(&$this);
- $this->queues[$q->GetQname()] = &$q;
- $GLOBALS['allqueue_list'][] = $q->GetQname();
- ref_on_altq_queue_list($this->GetQname(), $q->GetQname());
- if (is_array($queue['queue'])) {
- foreach ($queue['queue'] as $key1 => $que) {
- array_push($path, $key1);
- $q->add_queue($q->GetInterface(), &$que, &$path);
- array_pop($path);
- }
+ function &add_queue($interface, &$queue, &$path, &$input_errors) {
+
+ if (!is_array($this->queues))
+ $this->queues = array();
+
+ switch ($this->GetScheduler()) {
+ case "PRIQ":
+ $q =& new priq_queue();
+ break;
+ case "HFSC":
+ $q =& new hfsc_queue();
+ break;
+ case "CBQ":
+ $q =& new cbq_queue();
+ break;
+ default:
+ /* XXX: but should not happen anyway */
+ return;
+ break;
+ }
+ $q->SetLink($path);
+ $q->SetInterface($this->GetInterface());
+ $q->SetEnabled("on");
+ $q->SetParent(&$this);
+ $q->ReadConfig($queue);
+ switch ($q->GetBwscale()) {
+ case "Mb":
+ $factor = 1000;
+ brak;
+ case "Kb":
+ $factor = 1;
+ break;
+ case "b":
+ $factor = 1/1000;
+ break;
+ case "Gb":
+ $factor = 1000 * 1000;
+ break;
+ case "%":
+ $factor = $this->GetAvailableBandwidth() / 100;
+ break;
+ default: /* XXX */
+ $factor = 1;
+ break;
+ }
+ $q->SetAvailableBandwidth($q->GetBandwidth() * $factor);
+ $this->SetAvailableBandwidth($this->GetAvailableBandwidth() - $q->GetBandwidth() * $factor);
+ $q->validate_input($queue, $input_errors);
+ if (count($input_errors)) {
+ return $q;
+ }
+ $this->queues[$q->GetQname()] = &$q;
+ $GLOBALS['allqueue_list'][] = $q->GetQname();
+ ref_on_altq_queue_list($this->GetQname(), $q->GetQname());
+ if (is_array($queue['queue'])) {
+ foreach ($queue['queue'] as $key1 => $que) {
+ array_push($path, $key1);
+ $q->add_queue($q->GetInterface(), &$que, &$path, $input_errors);
+ array_pop($path);
+ }
+ }
+
+ return $q;
}
- return $q;
- }
-
- /* interface here might be optional */
- function &find_queue($interface, $qname) {
- if ($qname == $this->GetQname()) {
- return $this;
- }
- foreach ($this->queues as $q) {
- $result =& $q->find_queue("", $qname);
+ /* interface here might be optional */
+ function &find_queue($interface, $qname) {
+ if ($qname == $this->GetQname()) {
+ return $this;
+ }
+ foreach ($this->queues as $q) {
+ $result =& $q->find_queue("", $qname);
if ($result)
return $result;
- }
- }
+ }
+ }
function &find_parentqueue($interface, $qname) {
if ($qname == $interface) {
$result = NULL;
- } else if ($this->queues[$qname]) {
+ } else if ($this->queues[$qname]) {
$result = $this;
} else if ($this->GetScheduler() <> "PRIQ") {
foreach ($this->queues as $q) {
@@ -313,75 +408,101 @@ class altq_root_queue {
return $tree;
}
- function delete_queue() {
+ function delete_queue() {
foreach ($this->queues as $q)
- $q->delete_queue();
+ $q->delete_queue();
unset_object_by_reference($this->GetLink());
- }
-
- /*
- * First it spits:
- * altq on $interface ..............
- * then it goes like
- * foreach ($queues as $qkey => $queue)
- * this->queues[$qkey]->build_rule();
- */
- function build_rules() {
- if (count($this->queues) > 0 && $this->GetEnabled()) {
- $rules = " altq on " . convert_friendly_interface_to_real_interface_name($this->GetInterface());
- if ($this->GetScheduler())
- $rules .= " ".strtolower($this->GetScheduler());
- if ($this->GetBandwidth())
- $rules .= " bandwidth ".trim($this->GetBandwidth());
- if ($this->GetBwscale())
- $rules .= $this->GetBwscale();
- if ($this->GetTbrConfig())
- $rules .= " tbrsize ".$this->GetTbrConfig();
- if (count($this->queues)) {
- $i = count($this->queues);
- $rules .= " queue { ";
- foreach ($this->queues as $qkey => $qnone) {
- if ($i > 1) {
- $i--;
- $rules .= " {$qkey}, ";
- } else
- $rules .= " {$qkey} ";
- }
- $rules .= " } \n";
- foreach ($this->queues as $q) {
- $rules .= $q->build_rules();
- }
- }
+ }
+
+ /*
+ * First it spits:
+ * altq on $interface ..............
+ * then it goes like
+ * foreach ($queues as $qkey => $queue)
+ * this->queues[$qkey]->build_rule();
+ */
+ function build_rules() {
+ if (count($this->queues) > 0 && $this->GetEnabled()) {
+ $rules = " altq on " . convert_friendly_interface_to_real_interface_name($this->GetInterface());
+ if ($this->GetScheduler())
+ $rules .= " ".strtolower($this->GetScheduler());
+ if ($this->GetBandwidth())
+ $rules .= " bandwidth ".trim($this->GetBandwidth());
+ if ($this->GetBwscale())
+ $rules .= $this->GetBwscale();
+ if ($this->GetTbrConfig())
+ $rules .= " tbrsize ".$this->GetTbrConfig();
+ if (count($this->queues)) {
+ $i = count($this->queues);
+ $rules .= " queue { ";
+ foreach ($this->queues as $qkey => $qnone) {
+ if ($i > 1) {
+ $i--;
+ $rules .= " {$qkey}, ";
+ } else
+ $rules .= " {$qkey} ";
+ }
+ $rules .= " } \n";
+ foreach ($this->queues as $q) {
+ $rules .= $q->build_rules();
+ }
+ }
}
$rules .= " \n";
- return $rules;
- }
+ return $rules;
+ }
function build_javascript() {
- $javascript = "<script type=\"text/javascript\">";
- $javascript .= "function mySuspend() {";
- $javascript .= "if (document.layers && document.layers['shaperarea'] != null);";
- $javascript .= "document.layers['shaperarea'].visibility = 'hidden';";
- $javascript .= "else if (document.all)";
- $javascript .= "document.all['shaperarea'].style.visibility = 'hidden';";
- $javascript .= "}";
-
- $javascript .= "function myResume() {";
- $javascript .= "if (document.layers && document.layers['shaperarea'] != null)";
- $javascript .= "document.layers['shaperarea'].visibility = 'visible';";
- $javascript .= "else if (document.all)";
- $javascript .= "document.all['shaperarea'].style.visibility = 'visible';";
- $javascript .= "}";
- $javascript .= "</script>";
-
- return $javascript;
- }
+ $javascript = "<script type=\"text/javascript\">";
+ $javascript .= "function mySuspend() {";
+ $javascript .= "if (document.layers && document.layers['shaperarea'] != null);";
+ $javascript .= "document.layers['shaperarea'].visibility = 'hidden';";
+ $javascript .= "else if (document.all)";
+ $javascript .= "document.all['shaperarea'].style.visibility = 'hidden';";
+ $javascript .= "}";
+
+ $javascript .= "function myResume() {";
+ $javascript .= "if (document.layers && document.layers['shaperarea'] != null)";
+ $javascript .= "document.layers['shaperarea'].visibility = 'visible';";
+ $javascript .= "else if (document.all)";
+ $javascript .= "document.all['shaperarea'].style.visibility = 'visible';";
+ $javascript .= "}";
+ $javascript .= "</script>";
+
+ return $javascript;
+ }
- /*
- * For requesting the parameters of the root queue
- * to the user like the traffic wizard does.
- */
- function build_form() {
+ function build_shortform() {
+ global $g;
+
+ $altq =& $this;
+ if ($altq)
+ $scheduler = ": " . $altq->GetScheduler();
+ $form = "<tr><td width=\"20%\" class=\"vtable\">";
+ $form .= "<a href=\"firewall_shaper.php?interface" . $this->GetInterface() . "&queue=". $this->GetInterface()."&action=show\">".$this->GetInterface().": ".$scheduler."</a>";
+ $form .= "</td></tr>";
+ $form .= "<tr>";
+ $form .= "<td width=\"50%\" class=\"vncellreq\">";
+ $form .= "Bandwidth: " . $this->GetBandwidth().$this->GetBwscale();
+ $form .= "</td><td width=\"50%\"></td></tr>";
+ $form .= "<tr><td width=\"20%\" class=\"vncellreq\">";
+ $form .= "<a href=\"firewall_shaper_queues.php?interface=";
+ $form .= $this->GetInterface() . "&queue=";
+ $form .= $this->GetQname() . "&action=delete\">";
+ $form .= "<img src=\"";
+ $form .= "./themes/".$g['theme']."/images/icons/icon_minus.gif\"";
+ $form .= " width=\"17\" height=\"17\" border=\"0\" title=\"Disable shaper on i
+nterface\">";
+ $form .= "<span>Disable shaper from interface</span></a></td></tr>";
+
+ return $form;
+
+ }
+ /*
+ * For requesting the parameters of the root queue
+ * to the user like the traffic wizard does.
+ */
+ function build_form() {
$form = "<tr><td valign=\"top\" class=\"vncellreq\"><br><span class=\"vexpl\">Name</span></td>";
$form .= "<td class=\"vncellreq\">";
$form .= "<strong>".$this->GetQname()."</strong>";
@@ -390,19 +511,19 @@ class altq_root_queue {
$form .= "</td>";
$form .= "<td class=\"vncellreq\">";
$form .= "<select id=\"scheduler\" name=\"scheduler\" class=\"formselect\">";
- $form .= "<option value=\"HFSC\"";
+ $form .= "<option value=\"HFSC\"";
if ($this->GetScheduler() == "HFSC")
$form .= " selected=\"yes\"";
$form .= ">HFSC</option>";
- $form .= "<option value=\"CBQ\"";
+ $form .= "<option value=\"CBQ\"";
if ($this->GetScheduler() == "CBQ")
- $form .= " selected=\"yes\"";
+ $form .= " selected=\"yes\"";
$form .= ">CBQ</option>";
- $form .= "<option value=\"PRIQ\"";
+ $form .= "<option value=\"PRIQ\"";
if ($this->GetScheduler() == "PRIQ")
- $form .= " selected=\"yes\"";
+ $form .= " selected=\"yes\"";
$form .= ">PRIQ</option>";
- $form .= "</select>";
+ $form .= "</select>";
$form .= "<br> <span class=\"vexpl\">";
$form .= "NOTE: changing this changes all queues underneath!";
$form .= " Beaware you can loose information.";
@@ -412,30 +533,30 @@ class altq_root_queue {
$form .= "</td><td class=\"vncellreq\">";
$form .= "<input type=\"text\" id=\"bandwidth\" name=\"bandwidth\" value=\"";
$form .= $this->GetBandwidth() . "\">";
- $form .= "<select id=\"bandwidthtype\" name=\"bandwidthtype\" class=\"formselect\">";
- $form .= "<option value=\"Kb\"";
+ $form .= "<select id=\"bandwidthtype\" name=\"bandwidthtype\" class=\"formselect\">";
+ $form .= "<option value=\"Kb\"";
if ($this->GetBwscale() == "Kb")
- $form .= "selected=\"yes\"";
+ $form .= " selected=\"yes\"";
$form .= ">Kbit/s</option>";
- $form .= "<option value=\"Mb\"";
+ $form .= "<option value=\"Mb\"";
if ($this->GetBwscale() == "Mb")
- $form .= "selected=\"yes\"";
- $form .= ">Mbit/s</option>";
- $form .= "<option value=\"\"";
- if ($this->GetBwscale() == "b")
- $form .= "selected=\"yes\"";
- $form .= ">Bit/s</option>";
+ $form .= " selected=\"yes\"";
+ $form .= ">Mbit/s</option>";
+ $form .= "<option value=\"Gb\"";
+ if ($this->GetBwscale() == "Gb")
+ $form .= " selected=\"yes\"";
+ $form .= ">Gbit/s</option>";
$form .= "<option value=\"\"";
- if ($this->GetBwscale() == "%")
- $form .= "selected=\"yes\"";
- $form .= ">%</option>";
- $form .= "</select>";
- $form .= "</td></tr>";
+ if ($this->GetBwscale() == "b")
+ $form .= " selected=\"yes\"";
+ $form .= ">Bit/s</option>";
+ $form .= "</select>";
+ $form .= "</td></tr>";
$form .= "<tr><td valign=\"top\" class=\"vncellreq\">Queue Limit</td>";
- $form .= "<td class=\"vncellreq\">";
- $form .= "<input type=\"text\" id=\"qlimit\" name=\"qlimit\" value=\"";
- $form .= $this->GetQlimit();
- $form .= "\">";
+ $form .= "<td class=\"vncellreq\">";
+ $form .= "<input type=\"text\" id=\"qlimit\" name=\"qlimit\" value=\"";
+ $form .= $this->GetQlimit();
+ $form .= "\">";
$form .= "</td></tr>";
$form .= "<tr><td valign=\"top\" class=\"vncellreq\">Tbr Size</td>";
$form .= "<td class=\"vncellreq\">";
@@ -446,7 +567,7 @@ class altq_root_queue {
$form .= "Adjusts the size, in bytes, of the token bucket regulator.";
$form .= "If not specified, heuristics based on the interface ";
$form .= "bandwidth are used to determine the size.";
- $form .= "</span></td></tr>";
+ $form .= "</span></td></tr>";
$form .= "<input type=\"hidden\" id=\"interface\" name=\"interface\"";
$form .= " value=\"" . $this->GetInterface() . "\">";
$form .= "<input type=\"hidden\" id=\"name\" name=\"name\" value=\"".$this->GetQname()."\" >";
@@ -455,37 +576,37 @@ class altq_root_queue {
return $form;
}
- function update_altq_queue_data(&$data) {
+ function update_altq_queue_data(&$data) {
$this->ReadConfig($data);
}
- /*
- * Should call on each of it queues and subqueues
- * the same function much like build_rules();
- */
- function wconfig() {
- $cflink = &get_reference_to_me_in_config($this->GetLink());
- if (!is_array($cflink))
- $cflink = array();
- $cflink['interface'] = $this->GetInterface();
- $cflink['name'] = $this->GetQname();
- $cflink['scheduler'] = $this->GetScheduler();
- $cflink['bandwidth'] = $this->GetBandwidth();
- $cflink['bandwidthtype'] = $this->GetBwscale();
- $cflink['qlimit'] = $this->GetQlimit();
- $cflink['tbrconfig'] = $this->GetTbrConfig();
- $cflink['enabled'] = $this->GetEnabled();
- }
+ /*
+ * Should call on each of it queues and subqueues
+ * the same function much like build_rules();
+ */
+ function wconfig() {
+ $cflink = &get_reference_to_me_in_config($this->GetLink());
+ if (!is_array($cflink))
+ $cflink = array();
+ $cflink['interface'] = $this->GetInterface();
+ $cflink['name'] = $this->GetQname();
+ $cflink['scheduler'] = $this->GetScheduler();
+ $cflink['bandwidth'] = $this->GetBandwidth();
+ $cflink['bandwidthtype'] = $this->GetBwscale();
+ $cflink['qlimit'] = $this->GetQlimit();
+ $cflink['tbrconfig'] = $this->GetTbrConfig();
+ $cflink['enabled'] = $this->GetEnabled();
+ }
}
class priq_queue {
- var $qname;
- var $qinterface;
- var $qlimit;
- var $qpriority;
- var $description;
- var $isparent;
+ var $qname;
+ var $qinterface;
+ var $qlimit;
+ var $qpriority;
+ var $description;
+ var $isparent;
var $qbandwidth;
var $qbandwidthtype;
var $qdefault;
@@ -496,131 +617,138 @@ class priq_queue {
var $qenabled;
var $qparent;
var $link;
-
+ var $available_bw; /* in b/s */
+
/* This is here to help on form building and building rules/lists */
- var $subqueues = array();
-
- /* Accesor functions */
- function SetLink($link) {
- $this->link = $link;
- }
- function GetLink() {
- return $this->link;
- }
+ var $subqueues = array();
+
+ /* Accesor functions */
+ function GetAvailableBandwidth() {
+ return $this->available_bw;
+ }
+ function SetAvailableBandwidth($bw) {
+ $this->available_bw = $bw;
+ }
+ function SetLink($link) {
+ $this->link = $link;
+ }
+ function GetLink() {
+ return $this->link;
+ }
function &GetParent() {
return $this->qparent;
}
function SetParent(&$parent) {
$this->qparent = &$parent;
}
- function GetEnabled() {
- return $this->qenabled;
- }
- function SetEnabled($value) {
- $this->qenabled = $value;
- }
+ function GetEnabled() {
+ return $this->qenabled;
+ }
+ function SetEnabled($value) {
+ $this->qenabled = $value;
+ }
function CanHaveChilds() {
- return false;
- }
+ return false;
+ }
function CanBeDeleted() {
- return true;
- }
- function GetQname() {
- return $this->qname;
- }
- function SetQname($name) {
- $this->qname = trim($name);
- }
- function GetBandwidth() {
- return $this->qbandwidth;
- }
- function SetBandwidth($bandwidth) {
- $this->qbandwidth = $bandwidth;
- }
- function GetInterface() {
- return $this->qinterface;
- }
- function SetInterface($name) {
- $this->qinterface = trim($name);
- }
- function GetQlimit() {
- return $this->qlimit;
- }
- function SetQlimit($limit) {
- $this->qlimit = $limit;
- }
- function GetQpriority() {
- return $this->qpriority;
- }
- function SetQpriority($priority) {
- $this->qpriority = $priority;
- }
- function GetDescription() {
- return $this->description;
- }
- function SetDescription($str) {
- $this->descritpion = trim($str);
- }
- function GetFirstime() {
- return $this->firsttime;
- }
- function SetFirsttime($number) {
- $this->firsttime = $number;
- }
- function GetBwscale() {
- return $this->qbandwidthtype;
- }
- function SetBwscale($scale) {
- $this->qbandwidthtype = $scale;
- }
+ return true;
+ }
+ function GetQname() {
+ return $this->qname;
+ }
+ function SetQname($name) {
+ $this->qname = trim($name);
+ }
+ function GetBandwidth() {
+ return $this->qbandwidth;
+ }
+ function SetBandwidth($bandwidth) {
+ $this->qbandwidth = $bandwidth;
+ }
+ function GetInterface() {
+ return $this->qinterface;
+ }
+ function SetInterface($name) {
+ $this->qinterface = trim($name);
+ }
+ function GetQlimit() {
+ return $this->qlimit;
+ }
+ function SetQlimit($limit) {
+ $this->qlimit = $limit;
+ }
+ function GetQpriority() {
+ return $this->qpriority;
+ }
+ function SetQpriority($priority) {
+ $this->qpriority = $priority;
+ }
+ function GetDescription() {
+ return $this->description;
+ }
+ function SetDescription($str) {
+ $this->description = trim($str);
+ }
+ function GetFirstime() {
+ return $this->firsttime;
+ }
+ function SetFirsttime($number) {
+ $this->firsttime = $number;
+ }
+ function GetBwscale() {
+ return $this->qbandwidthtype;
+ }
+ function SetBwscale($scale) {
+ $this->qbandwidthtype = $scale;
+ }
function GetDefault() {
- return $this->qdefault;
- }
- function SetDefault($value = false) {
- $this->qdefault = $value;
- altq_set_default_queue($this->GetInterface(), "true");
- }
+ return $this->qdefault;
+ }
+ function SetDefault($value = false) {
+ $this->qdefault = $value;
+ altq_set_default_queue($this->GetInterface(), "true");
+ }
function GetRed() {
- return $this->qred;
- }
- function SetRed($red = false) {
- $this->qred = $red;
- }
+ return $this->qred;
+ }
+ function SetRed($red = false) {
+ $this->qred = $red;
+ }
function GetRio() {
- return $this->qrio;
- }
- function SetRio($rio = false) {
- $this->qrio = $rio;
- }
- function GetEcn() {
- return $this->qecn;
- }
- function SetEcn($ecn = false) {
- $this->qecn = $ecn;
- }
+ return $this->qrio;
+ }
+ function SetRio($rio = false) {
+ $this->qrio = $rio;
+ }
+function GetEcn() {
+ return $this->qecn;
+ }
+ function SetEcn($ecn = false) {
+ $this->qecn = $ecn;
+ }
function GetAck() {
- return $this->qack;
- }
- function SetAck($ack = false) {
- $this->qack = $ack;
- }
+ return $this->qack;
+ }
+ function SetAck($ack = false) {
+ $this->qack = $ack;
+ }
function build_javascript() {
$javascript = "<script type=\"text/javascript\">";
$javascript .= "function mySuspend() { \n";
- $javascript .= "if (document.layers && document.layers['shaperarea'] != null);\n";
- $javascript .= "document.layers['shaperarea'].visibility = 'hidden';\n";
- $javascript .= "else if (document.all)\n";
- $javascript .= "document.all['shaperarea'].style.visibility = 'hidden';\n";
- $javascript .= "}\n";
-
- $javascript .= "function myResume() {\n";
- $javascript .= "if (document.layers && document.layers['shaperarea'] != null)\n";
- $javascript .= "document.layers['shaperarea'].visibility = 'visible';\n";
- $javascript .= "else if (document.all)\n";
- $javascript .= "document.all['shaperarea'].style.visibility = 'visible';\n";
- $javascript .= "}\n";
- $javascript .= "</script>";
+ $javascript .= "if (document.layers && document.layers['shaperarea'] != null);\n";
+ $javascript .= "document.layers['shaperarea'].visibility = 'hidden';\n";
+ $javascript .= "else if (document.all)\n";
+ $javascript .= "document.all['shaperarea'].style.visibility = 'hidden';\n";
+ $javascript .= "}\n";
+
+ $javascript .= "function myResume() {\n";
+ $javascript .= "if (document.layers && document.layers['shaperarea'] != null)\n";
+ $javascript .= "document.layers['shaperarea'].visibility = 'visible';\n";
+ $javascript .= "else if (document.all)\n";
+ $javascript .= "document.all['shaperarea'].style.visibility = 'visible';\n";
+ $javascript .= "}\n";
+ $javascript .= "</script>";
return $javascript;
}
@@ -632,86 +760,87 @@ class priq_queue {
function copy_queue($interface, &$queue) {
global $config;
- $mylink = &get_reference_to_me_in_config($this->GetLink());
- $copylink = &get_reference_to_me_in_config($queue->GetLink());
+ $mylink = &get_reference_to_me_in_config($this->GetLink());
+ $copylink = &get_reference_to_me_in_config($queue->GetLink());
- if ($link && $mylink) {
- if (!is_array($mylink['queue'][$queue->GetQname()]))
- $mylink['queue'][$queue->GetQname()] = array();
+ if ($link && $mylink) {
+ if (!is_array($mylink['queue'][$queue->GetQname()]))
+ $mylink['queue'][$queue->GetQname()] = array();
- foreach ($link as $key => $value)
- $mylink['queue'][$queue->GetQname()][$key] = $value;
+ foreach ($link as $key => $value)
+ $mylink['queue'][$queue->GetQname()][$key] = $value;
}
}
function clean_queue($sched) {
- clean_child_queues($sched, $this->GetLink());
- if (is_array($this->subqueues)) {
- foreach ($this->subqueues as $q)
- $q->clean_queue($sched);
- }
- }
+ clean_child_queues($sched, $this->GetLink());
+ if (is_array($this->subqueues)) {
+ foreach ($this->subqueues as $q)
+ $q->clean_queue($sched);
+ }
+ }
function delete_queue() {
- unref_on_altq_queue_list($this->GetQname());
- if ($this->GetDefault())
- altq_set_default_queue($this->GetInterface(), "false");
- cleanup_queue_from_rules($this->GetQname());
- unset_object_by_reference($this->GetLink());
- }
+ unref_on_altq_queue_list($this->GetQname());
+ if ($this->GetDefault())
+ altq_set_default_queue($this->GetInterface(), "false");
+ cleanup_queue_from_rules($this->GetQname());
+ unset_object_by_reference($this->GetLink());
+ }
function &find_queue($interface, $qname) {
if ($qname == $this->GetQname())
return $this;
}
- function find_parentqueue($interface, $qname) { return; }
+
+ function find_parentqueue($interface, $qname) { return; }
- function validate_input($data, &$input_errors) {
- do_input_validation($data, $reqdfields, $reqdfieldsn, $input_errors);
+ function validate_input($data, &$input_errors) {
+
+ $reqfields[] = "name";
+ $erqfieldsn[] = "Name";
+ //do_input_validation($data, $reqdfields, $reqdfieldsn, $input_errors);
if ($data['priority'] && (!is_numeric($data['priority'])
- || ($data['priority'] < 1) || ($data['priority'] > 15))) {
- $input_errors[] = "The priority must be an integer between 1 and 15.";
- }
+ || ($data['priority'] < 1) || ($data['priority'] > 15))) {
+ $input_errors[] = "The priority must be an integer between 1 and 15.";
+ }
if ($data['qlimit'] && (!is_numeric($data['qlimit'])))
- $input_errors[] = "Queue limit must be an integer";
- if ($data['bandwidth'] && (!is_numeric($data['bandwidth'])))
- $input_errors[] = "Bandwidth must be an integer.";
- if (!preg_match("/^[a-zA-Z0-9_-]*$/", $data['name']))
- $input_errors[] = "Queue names must be alphanumeric and _ or - only.";
+ $input_errors[] = "Queue limit must be an integer";
+ if ($data['qlimit'] < 0)
+ $input_errors[] = "Queue limit must be positive";
+ if (!preg_match("/^[a-zA-Z0-9_-]*$/", $data['name']))
+ $input_errors[] = "Queue names must be alphanumeric and _ or - only.";
-
-
-
}
- function ReadConfig(&$q) {
- if (isset($q['name']))
- $this->SetQname($q['name']);
- if (isset($q['interface']))
- $this->SetInterface($q['interface']);
- if ($q['bandwidth']) {
- $this->SetBandwidth($q['bandwidth']);
- if ($q['bandwidthtype'])
+ function ReadConfig(&$q) {
+ if (isset($q['name']))
+ $this->SetQname($q['name']);
+ if (isset($q['interface']))
+ $this->SetInterface($q['interface']);
+ if ($q['bandwidth'] <> "") {
+ $this->SetBandwidth($q['bandwidth']);
+ if ($q['bandwidthtype'] <> "")
$this->SetBwscale($q['bandwidthtype']);
}
- if (isset($q['qlimit']))
- $this->SetQlimit($q['qlimit']);
- if (isset($q['priority']))
- $this->SetQPriority($q['priority']);
- if (isset($q['descritption']))
- $this->SetDescription($q['description']);
- if ($q['ftpqueue'] == "on")
+ if (isset($q['qlimit']) && $q['qlimit'] <> "")
+ $this->SetQlimit($q['qlimit']);
+ if (isset($q['priority']))
+ $this->SetQPriority($q['priority']);
+ if (isset($q['description']) && $q['description'] != "")
+ $this->SetDescription($q['description']);
+ if (isset($q['ftpqueue']) && $q['ftpqueue'] <> "")
set_is_ftp_queue($this->GetInterface(), $this->GetQname());
$this->SetRed($q['red']);
$this->SetRio($q['rio']);
$this->SetEcn($q['ecn']);
$this->SetDefault($q['default']);
- $this->SetEnabled($conf['enabled']);
+ $this->SetEnabled($q['enabled']);
- }
+ }
function build_tree() {
$tree = " <li><a href=\"firewall_shaper.php?interface=". $this->GetInterface()."&queue=". $this->GetQname()."&action=show";
@@ -735,32 +864,32 @@ class priq_queue {
return $tree;
}
- /* Should return something like:
- * queue $qname on $qinterface bandwidth ....
- */
- function build_rules() {
- $pfq_rule = " queue ". $this->qname;
- if ($this->GetInterface())
- $pfq_rule .= " on ".convert_friendly_interface_to_real_interface_name($this->GetInterface());
- if ($this->GetQpriority())
- $pfq_rule .= " priority ".$this->GetQpriority();
- if ($this->GetQlimit())
- $pfq_rule .= " qlimit " . $this->GetQlimit();
- if ($this->GetRed() || $this->GetRio() || $this->GetEcn() || $this->GetDefault()) {
- $pfq_rule .= " priq ( ";
+ /* Should return something like:
+ * queue $qname on $qinterface bandwidth ....
+ */
+ function build_rules() {
+ $pfq_rule = " queue ". $this->qname;
+ if ($this->GetInterface())
+ $pfq_rule .= " on ".convert_friendly_interface_to_real_interface_name($this->GetInterface());
+ if ($this->GetQpriority())
+ $pfq_rule .= " priority ".$this->GetQpriority();
+ if ($this->GetQlimit())
+ $pfq_rule .= " qlimit " . $this->GetQlimit();
+ if ($this->GetRed() || $this->GetRio() || $this->GetEcn() || $this->GetDefault()) {
+ $pfq_rule .= " priq ( ";
if ($this->GetRed()) {
$comma = 1;
$pfq_rule .= " red ";
}
if ($this->GetRio()) {
if ($comma)
- $pfq_rule .= " ,";
+ $pfq_rule .= " ,";
$comma = 1;
$pfq_rule .= " rio ";
}
if ($this->GetEcn()) {
if ($comma)
- $pfq_rule .= " ,";
+ $pfq_rule .= " ,";
$comma = 1;
$pfq_rule .= " ecn ";
}
@@ -770,52 +899,52 @@ class priq_queue {
$pfq_rule .= " default ";
}
$pfq_rule .= " ) ";
- }
+ }
$pfq_rule .= " \n";
-
- return $pfq_rule;
- }
-
- /*
- * To return the html form to show to user
- * for getting the parameters.
- * Should do even for first time when the
- * object is created and later when we may
- * need to update it.
- */
- function build_form() {
- $form .= "<tr>";
+
+ return $pfq_rule;
+ }
+
+ /*
+ * To return the html form to show to user
+ * for getting the parameters.
+ * Should do even for first time when the
+ * object is created and later when we may
+ * need to update it.
+ */
+ function build_form() {
+ $form .= "<tr>";
$form .= "<td width=\"22%\" valign=\"top\" class=\"vncellreq\">";
$form .= "Queue Name</td><td width=\"78%\" class=\"vtable\">";
$form .= "<input name=\"name\" type=\"text\" id=\"name\" class=\"formfld unknown\" size=\"15\" value=\"";
$form .= htmlspecialchars($this->GetQname());
$form .= "\">";
- $form .= "<br> <span class=\"vexpl\">Enter the name of the queue here. Do not use spaces and limit the size to 15 characters.";
- $form .= "</span></td>";
+ $form .= "<br> <span class=\"vexpl\">Enter the name of the queue here. Do not use spaces and limit the size to 15 characters.";
+ $form .= "</span></td>";
$form .= "</tr><tr>";
- $form .= "<td width=\"22%\" valign=\"top\" class=\"vncellreq\">Priority</td>";
- $form .= "<td width=\"78%\" class=\"vtable\"> <input name=\"priority\" type=\"text\" id=\"priority\" size=\"5\" value=\"";
- $form .= htmlspecialchars($this->GetQpriority());
- $form .= "\">";
- $form .= "<br> <span class=\"vexpl\">For hfsc, the range is 0 to 7. The default is 1. Hfsc queues with a higher priority are preferred in the case of overload.</span></td>";
- $form .= "</tr>";
- $form .= "</tr>";
- $form .= "<td width=\"22%\" valign=\"top\" class=\"vncellreq\">Queue limit</td>";
- $form .= "<td width=\"78%\" class=\"vtable\"> <input name=\"qlimit\" type=\"text\" id=\"qlimit\" size=\"5\" value=\"";
- $form .= htmlspecialchars($this->GetQlimit());
- $form .= "\">";
+ $form .= "<td width=\"22%\" valign=\"top\" class=\"vncellreq\">Priority</td>";
+ $form .= "<td width=\"78%\" class=\"vtable\"> <input name=\"priority\" type=\"text\" id=\"priority\" size=\"5\" value=\"";
+ $form .= htmlspecialchars($this->GetQpriority());
+ $form .= "\">";
+ $form .= "<br> <span class=\"vexpl\">For hfsc, the range is 0 to 7. The default is 1. Hfsc queues with a higher priority are preferred in the case of overload.</span></td>";
+ $form .= "</tr>";
+ $form .= "</tr>";
+ $form .= "<td width=\"22%\" valign=\"top\" class=\"vncellreq\">Queue limit</td>";
+ $form .= "<td width=\"78%\" class=\"vtable\"> <input name=\"qlimit\" type=\"text\" id=\"qlimit\" size=\"5\" value=\"";
+ $form .= htmlspecialchars($this->GetQlimit());
+ $form .= "\">";
$form .= "<br> <span class=\"vexpl\">Queue limit in packet per second.";
- $form .= "</span></td>";
- $form .= "<tr>";
- $form .= "<td width=\"22%\" valign=\"top\" class=\"vncell\">Scheduler options</td>";
- $form .= "<td width=\"78%\" class=\"vtable\">";
+ $form .= "</span></td>";
+ $form .= "<tr>";
+ $form .= "<td width=\"22%\" valign=\"top\" class=\"vncell\">Scheduler options</td>";
+ $form .= "<td width=\"78%\" class=\"vtable\">";
if ($this->GetDefault()) {
- $form .= "<input type=\"checkbox\" id=\"default\" CHECKED name=\"default\"";
+ $form .= "<input type=\"checkbox\" id=\"default\" CHECKED name=\"default\"";
$form .= "> Default queue<br>";
} else if (count($this->subqueues) < 1) {
$form .= "<input type=\"checkbox\" id=\"default\" name=\"default\"";
- $form .= "> Default queue<br>";
+ $form .= "> Default queue<br>";
}
/* XXX: TODO Add check to disable this if it has been set on another queue on this interface. */
$form .= "<input type=\"checkbox\" id=\"ftpqueue\" name=\"ftpqueue\" ";
@@ -823,29 +952,29 @@ class priq_queue {
$form .= " CHECKED";
$form .= ">Use this queue for the ftp proxy<br>";
/* XXX: TODO */
- $form .= "<input type=\"checkbox\" id=\"red\" name=\"red\"";
- if($this->GetRed())
+ $form .= "<input type=\"checkbox\" id=\"red\" name=\"red\"";
+ if($this->GetRed())
$form .= " CHECKED";
$form .= "> <a target=\"_new\" href=\"http://www.openbsd.org/faq/pf/queueing.html#red\">Random Early Detection</a><br>";
- $form .= "<input type=\"checkbox\" id=\"rio\" name=\"rio\"";
- if($this->GetRio())
+ $form .= "<input type=\"checkbox\" id=\"rio\" name=\"rio\"";
+ if($this->GetRio())
$form .= " CHECKED";
$form .= "> <a target=\"_new\" href=\"http://www.openbsd.org/faq/pf/queueing.html#rio\">Random Early Detection In and Out</a><br>";
- $form .= "<input type=\"checkbox\" id=\"ecn\" name=\"ecn\"";
- if($this->GetEcn())
+ $form .= "<input type=\"checkbox\" id=\"ecn\" name=\"ecn\"";
+ if($this->GetEcn())
$form .= " CHECKED";
$form .= "> <a target=\"_new\" href=\"http://www.openbsd.org/faq/pf/queueing.html#ecn\">Explicit Congestion Notification</a><br>";
- $form .= "<span class=\"vexpl\"><br>Select options for this queue";
- $form .= "</tr><tr>";
+ $form .= "<span class=\"vexpl\"><br>Select options for this queue";
+ $form .= "</tr><tr>";
$form .= "<td width=\"22%\" class=\"vncellreq\">Description</td>";
$form .= "<td width=\"78%\" class=\"vtable\">";
$form .= "<input type=\"text\" name=\"description\" size=\"50%\" class=\"formfld unknown\" value=\"" . $this->GetDescription() . "\" >";
$form .= "</td></tr>";
$form .= "<input type=\"hidden\" name=\"interface\" id=\"interface\"";
- $form .= " value=\"".$this->GetInterface()."\">";
+ $form .= " value=\"".$this->GetInterface()."\">";
return $form;
- }
+ }
function build_shortform() {
/* XXX: Hacks in site. Mostly layer violations! */
@@ -855,11 +984,11 @@ class priq_queue {
if ($altq)
$scheduler = ": " . $altq->GetScheduler();
$form = "<tr><td width=\"20%\" class=\"vtable\">";
- $form .= "<a href=\"firewall_shaper.php?interface" . $this->GetInterface() . "&queue=" . $this->GetInterface()."&action=show\">".$this->GetInterface().": ".$scheduler."</a>";
- $form .= "</td></tr>";
+ $form .= "<a href=\"firewall_shaper.php?interface" . $this->GetInterface() . "&queue=" . $this->GetInterface()."&action=show\">".$this->GetInterface().": ".$scheduler."</a>";
+ $form .= "</td></tr>";
/*
* XXX: Hack in sight maybe fix with a class that wraps all
- * of this layer violations
+ * of this layer violations
*/
$form .= "<tr>";
$form .= "<td width=\"50%\" class=\"vncellreq\">";
@@ -872,29 +1001,29 @@ class priq_queue {
$form .= "<tr><td class=\"vncellreq\">Default: on </td></tr>";
$form .= "<tr><td width=\"20%\" class=\"vncellreq\">";
$form .= "<a href=\"firewall_shaper_queues.php?interface=";
- $form .= $this->GetInterface() . "&queue=";
- $form .= $this->GetQname() . "&action=delete\">";
- $form .= "<img src=\"";
- $form .= "./themes/".$g['theme']."/images/icons/icon_minus.gif\"";
- $form .= " width=\"17\" height=\"17\" border=\"0\" title=\"Delete queue from interface\">";
- $form .= "<span>Delete queue from interface</span></a></td></tr>";
+ $form .= $this->GetInterface() . "&queue=";
+ $form .= $this->GetQname() . "&action=delete\">";
+ $form .= "<img src=\"";
+ $form .= "./themes/".$g['theme']."/images/icons/icon_minus.gif\"";
+ $form .= " width=\"17\" height=\"17\" border=\"0\" title=\"Delete queue from interface\">";
+ $form .= "<span>Delete queue from interface</span></a></td></tr>";
return $form;
}
- function update_altq_queue_data(&$q) {
+ function update_altq_queue_data(&$q) {
$this->ReadConfig($q);
}
- function wconfig() {
- $cflink =& get_reference_to_me_in_config($this->GetLink());
+ function wconfig() {
+ $cflink =& get_reference_to_me_in_config($this->GetLink());
if (!is_array($cflink))
$cflink = array();
$cflink['name'] = $this->GetQname();
- $cflink['interface'] = $this->GetInterface();
- $cflink['qlimit'] = $this->GetQlimit();
- $cflink['priority'] = $this->GetQpriority();
+ $cflink['interface'] = $this->GetInterface();
+ $cflink['qlimit'] = $this->GetQlimit();
+ $cflink['priority'] = $this->GetQpriority();
$cflink['description'] = $this->GetDescription();
$cflink['enabled'] = $this->GetEnabled();
$cflink['default'] = $this->GetDefault();
@@ -905,149 +1034,247 @@ class priq_queue {
}
class hfsc_queue extends priq_queue {
- /* realtime */
+ /* realtime */
var $realtime;
- var $r_m1;
- var $r_d;
- var $r_m2;
- /* linkshare */
+ var $r_m1;
+ var $r_d;
+ var $r_m2;
+ /* linkshare */
var $linkshare;
- var $l_m1;
- var $l_d;
- var $l_m2;
- /* upperlimit */
+ var $l_m1;
+ var $l_d;
+ var $l_m2;
+ /* upperlimit */
var $upperlimit;
- var $u_m1;
- var $u_d;
- var $u_m2;
+ var $u_m1;
+ var $u_d;
+ var $u_m2;
- /*
- * HFSC can have nested queues.
- */
+ /*
+ * HFSC can have nested queues.
+ */
function CanHaveChilds() {
- return true;
- }
- function SetRealtime($r_m1, $r_d, $r_m2) {
- $this->r_m1 = $r_m1;
- $this->r_d = $r_d;
- $this->r_m2 = $r_m2;
- $this->realtime = "on";
- }
- function SetLinkshare($l_m1, $l_d, $l_m2) {
- $this->l_m1 = $l_m1;
- $this->l_d = $l_d;
- $this->l_m2 = $l_m2;
- $this->linkshare = "on";
- }
- function SetUpperlimit($u_m1, $u_d, $u_m2) {
- $this->u_m1 = $u_m1;
- $this->u_d = $u_d;
- $this->u_m2 = $u_m2;
- $this->upperlimit = "on";
- }
+ return true;
+ }
function GetRealtime() {
- return $this->realtime;
- }
- function GetR_m1() {
- return $this->r_m1;
- }
- function GetR_d() {
- return $this->r_d;
- }
- function GetR_m2() {
- return $this->r_m2;
- }
- function GetLinkshare() {
- return $this->linkshare;
- }
- function GetL_m1() {
- return $this->l_m1;
- }
- function GetL_d() {
- return $this->l_d;
- }
- function GetL_m2() {
- return $this->l_m2;
- }
- function GetUpperlimit() {
- return $this->upperlimit;
- }
- function GetU_m1() {
- return $this->u_m1;
- }
- function GetU_d() {
- return $this->u_d;
- }
- function GetU_m2() {
- return $this->u_m2;
- }
-
-
- function &add_queue($interface, &$qname, &$path) {
-
- if (!is_array($this->subqueues))
- $this->subqueues = array();
- $q =& new hfsc_queue();
- $q->ReadConfig($qname);
- $this->subqueues[$q->GetQname()] =& $q; //new hfsc_queue();
- $q->SetInterface($this->GetInterface());
- $q->SetParent(&$this);
- $q->SetEnabled("on");
- $q->SetLink($path);
- $this->subqueues[$q->GetQName()] = $q;
- $GLOBALS['allqueue_list'][] = $q->GetQname();
- ref_on_altq_queue_list($this->GetQname(), $q->GetQname());
- if (is_array($qname['queue'])) {
- foreach ($qname['queue'] as $key1 => $que) {
- array_push($path, $key1);
- $q->add_queue($q->GetInterface(), &$que, &$path);
- array_pop($path);
+ return $this->realtime;
+ }
+ function GetR_m1() {
+ return $this->r_m1;
+ }
+ function GetR_d() {
+ return $this->r_d;
+ }
+ function GetR_m2() {
+ return $this->r_m2;
+ }
+ function SetRealtime() {
+ $this->realtime = "on";
+ }
+ function SetR_m1($value) {
+ $this->r_m1 = $value;
+ }
+ function SetR_d($value) {
+ $this->r_d = $value;
+ }
+ function SetR_m2($value) {
+ $this->r_m2 = $value;
+ }
+ function GetLinkshare() {
+ return $this->linkshare;
+ }
+ function GetL_m1() {
+ return $this->l_m1;
+ }
+ function GetL_d() {
+ return $this->l_d;
+ }
+ function GetL_m2() {
+ return $this->l_m2;
+ }
+ function SetLinkshare() {
+ $this->linkshare = "on";
+ }
+ function SetL_m1($value) {
+ $this->l_m1 = $value;
+ }
+ function SetL_d($value) {
+ $this->l_d = $value;
+ }
+ function SetL_m2($value) {
+ $this->l_m2 = $value;
+ }
+ function GetUpperlimit() {
+ return $this->upperlimit;
+ }
+ function GetU_m1() {
+ return $this->u_m1;
+ }
+ function GetU_d() {
+ return $this->u_d;
+ }
+ function GetU_m2() {
+ return $this->u_m2;
+ }
+ function SetUpperlimit() {
+ $this->upperlimit = "on";
+ }
+ function SetU_m1($value) {
+ $this->u_m1 = $value;
+ }
+ function SetU_d($value) {
+ $this->u_d = $value;
+ }
+ function SetU_m2($value) {
+ $this->u_m2 = $value;
+ }
+
+
+
+ function &add_queue($interface, &$qname, &$path, &$input_errors) {
+
+ if (!is_array($this->subqueues))
+ $this->subqueues = array();
+ $q =& new hfsc_queue();
+ $q->SetInterface($this->GetInterface());
+ $q->SetParent(&$this);
+ $this->CalculateRemainingBandwidth($qname['bandwidth'], $qname['bandwidthtype']);
+ $q->ReadConfig($qname);
+ $q->validate_input($qname, $input_errors);
+ if (count($input_errors)) {
+ return $q;
}
- }
-
- return $q;
- }
+ $q->SetEnabled("on");
+ $q->SetLink($path);
+ switch ($q->GetBwscale()) {
+ case "Mb":
+ $factor = 1000;
+ brak;
+ case "Kb":
+ $factor = 1;
+ break;
+ case "b":
+ $factor = 1/1000;
+ break;
+ case "Gb":
+ $factor = 1000 * 1000;
+ break;
+ case "%":
+ $factor = $this->GetAvailableBandwidth() / 100;
+ break;
+ default: /* XXX */
+ $factor = 1;
+ break;
+ }
+ $q->SetAvailableBandwidth($q->GetBandwidth() * $factor);
+ $this->SetAvailableBandwidth($this->GetAvailableBandwidth() - $q->GetBandwidth() * $factor);
+ $q->ReadConfig($qname);
+ $this->subqueues[$q->GetQname()] =& $q; //new hfsc_queue()
+ $GLOBALS['allqueue_list'][] = $q->GetQname();
+ ref_on_altq_queue_list($this->GetQname(), $q->GetQname());
+ if (is_array($qname['queue'])) {
+ foreach ($qname['queue'] as $key1 => $que) {
+ array_push($path, $key1);
+ $q->add_queue($q->GetInterface(), &$que, &$path, $input_errors);
+ array_pop($path);
+ }
+ }
+
+ return $q;
+ }
- function delete_queue() {
- unref_on_altq_queue_list($this->GetQname());
- if ($this->GetDefault())
- altq_set_default_queue($this->GetInterface(), "false");
- cleanup_queue_from_rules($this->GetQname());
- foreach ($this->subqueues as $q)
- $q->delete_queue();
- unset_object_by_reference($this->GetLink());
- }
-
- /*
- * Should search even its childs
- */
- function &find_queue($interface, $qname) {
- if ($qname == $this->GetQname())
- return $this;
+ function delete_queue() {
+ unref_on_altq_queue_list($this->GetQname());
+ if ($this->GetDefault())
+ altq_set_default_queue($this->GetInterface(), "false");
+ cleanup_queue_from_rules($this->GetQname());
+ $parent =& $this->GetParent();
+ $parent->CalculateRemainingBandwidth($this->GetBandwidth(), $this->GetBwscale(), "delete");
+ foreach ($this->subqueues as $q)
+ $q->delete_queue();
+ unset_object_by_reference($this->GetLink());
+ }
- foreach ($this->subqueues as $q) {
- $result =& $q->find_queue("", $qname);
- if ($result)
- return $result;
- }
- }
+ /*
+ * Should search even its childs
+ */
+ function &find_queue($interface, $qname) {
+ if ($qname == $this->GetQname())
+ return $this;
+
+ foreach ($this->subqueues as $q) {
+ $result =& $q->find_queue("", $qname);
+ if ($result)
+ return $result;
+ }
+ }
- function &find_parentqueue($interface, $qname) {
+ function &find_parentqueue($interface, $qname) {
if ($this->subqueues[$qname])
return $this;
- foreach ($this->subqueues as $q) {
- $result = $q->find_parentqueue("", $qname);
+ foreach ($this->subqueues as $q) {
+ $result = $q->find_parentqueue("", $qname);
if ($result)
return $result;
}
- }
+ }
function validate_input($data, &$input_errors) {
parent::validate_input($data, $input_errors);
-
+
+ $reqfields[] = "bandwidth";
+ $reqdfieldsn[] = "Bandwidth";
+ $reqfields[] = "bandwidthtype";
+ $reqdfieldsn[] = "Bandwidthtype";
+
+ //do_input_validation($data, $reqdfields, $reqdfieldsn, $input_errors);
+
+ if ($data['bandwidth'] && (!is_numeric($data['bandwidth'])))
+ $input_errors[] = "Bandwidth must be an integer.";
+
+ if ($data['bandwidth'] < 0)
+ $input_errors[] = "Bandwidth cannot be negative.";
+
+ if ($data['bandwidthtype'] == "%") {
+ /*
+ if ($data['bandwidth'] > 100 || $data['bandwidth'] < 0)
+ $input_errors[] = "Bandwidth in percentage should be between 1 and 100 bounds.";
+ */
+ }
+
+ $parent =& $this->GetParent();
+ switch ($data['bandwidthtype']) {
+ case "Mb":
+ $myfactor = 1000;
+ brak;
+ case "Kb":
+ $myfactor = 1;
+ break;
+ case "b":
+ $myfactor = 1/1000;
+ break;
+ case "Gb":
+ $myfactor = 1000 * 1000;
+ break;
+ case "%":
+ $myfactor = $parent->GetBandwidth() / 100;
+ default: /* XXX */
+ $myfactor = 1;
+ break;
+ }
+/*
+
+ if ($parent->GetAvailableBandwidth() < $data['bandwidth'] * $myfactor)
+ $input_errors[] = "Bandwidth greater than that of parent. Correct the error";
+*/
if ($data['priority'] > 7)
- $input_errors[] = "Priority must be an integer between 1 and 7.";
+ $input_errors[] = "Priority must be an integer between 1 and 7.";
+
+ /*
+ * XXX: WARNING Some of this are not valid checks!
+ * We should check available bandwidth too for these values
+ *
if ($data['upperlimit1'] <> "" && $data['upperlimit2'] == "")
$input_errors[] = ("upperlimit service curve defined but missing burst (d) value");
if ($data['upperlimit2'] <> "" && $data['upperlimit1'] == "")
@@ -1078,27 +1305,53 @@ class hfsc_queue extends priq_queue {
$input_errors[] = ("realtime d value needs to be numeric");
if ($data['realtime3'] <> "" && !is_valid_shaperbw($data['realtime3']))
$input_errors[] = ("realtime m2 value needs to be Kb, Mb, Gb, or %");
+ */
}
- function ReadConfig(&$cflink) {
- parent::ReadConfig($cflink);
- if (isset($cflink['linkshare'])) {
- $this->SetLinkshare($cflink['linkshare1'], $cflink['linkshare2'], $cflink['linkshare3']);
+ function ReadConfig(&$cflink) {
+ if (isset($cflink['linkshare']) && $cflink['linkshare'] <> "") {
+ if (isset($cflink['linkshare1']) && $cflink['linkshare1'] <> "") {
+ $this->SetL_m1($cflink['linkshare1']);
+ $this->SetL_d($cflink['linkshare2']);
+ $this->SetLinkshare();
+ }
+ if (isset($cflink['linkshare3']) && $cflink['linkshare3'] <> "") {
+ $this->SetL_m2($cflink['linkshare3']);
+ $this->SetLinkshare();
+ }
}
- if (isset($cflink['realtime'])) {
- $this->SetRealtime($cflink['realtime1'], $cflink['realtime2'], $cflink['realtime3']);
+ if (isset($cflink['realtime']) && $cflink['realtime'] <> "") {
+ if (isset($cflink['realtime1']) && $cflink['realtime1'] <> "") {
+ $this->SetR_m1($cflink['realtime1']);
+ $this->SetR_d($cflink['realtime2']);
+ $this->SetRealtime();
+ }
+ if (isset($cflink['realtime3']) && $cflink['realtime3'] <> "") {
+ $this->SetR_m2($cflink['realtime3']);
+ $this->SetRealtime();
+ }
}
- if (isset($cflink['upperlimit'])) {
- $this->SetUpperlimit($cflink['upperlimit1'], $cflink['upperlimit2'], $cflink['upperlimit3']);
+ if (isset($cflink['upperlimit']) && $cflink['upperlimit'] <> "") {
+ if (isset($cflink['upperlimit1']) && $cflink['upperlimit1'] <> "") {
+ $this->SetU_m1($cflink['upperlimit1']);
+ $this->SetU_d($cflink['upperlimit2']);
+ $this->SetUpperlimit();
+ }
+ if (isset($cflink['upperlimit3']) && $cflink['upperlimit3'] <> "") {
+ $this->SetU_m2($cflink['upperlimit3']);
+ $this->SetUpperlimit();
+ }
+ }
+ parent::ReadConfig($cflink);
+
}
- }
function build_tree() {
$tree = " <li><a href=\"firewall_shaper.php?interface=" . $this->GetInterface() ."&queue=" . $this->GetQname()."&action=show";
$tree .= "\" ";
if ($this->GetDefault())
- $tree .= " class=\"navlnk\"";
+ $tree .= " class=\"navlnk\"";
$tree .= " >" . $this->GetQname() . "</a>";
if (is_array($this->subqueues)) {
$tree .= "<ul>";
@@ -1111,258 +1364,287 @@ class hfsc_queue extends priq_queue {
return $tree;
}
- /* Even this should take childs in consideration */
- function build_rules() {
+ /* Even this should take childs in consideration */
+ function build_rules() {
- $pfq_rule = " queue ". $this->qname;
- if ($this->GetInterface())
- $pfq_rule .= " on ".convert_friendly_interface_to_real_interface_name($this->GetInterface());
+ $pfq_rule = " queue ". $this->qname;
+ if ($this->GetInterface())
+ $pfq_rule .= " on ".convert_friendly_interface_to_real_interface_name($this->GetInterface());
if ($this->GetBandwidth() && $this->GetBwscale())
- $pfq_rule .= " bandwidth ".trim($this->GetBandwidth()).$this->GetBwscale();
-
- if ($this->GetQpriority())
- $pfq_rule .= " priority " . $this->GetQpriority();
+ $pfq_rule .= " bandwidth ".trim($this->GetBandwidth()).$this->GetBwscale();
+
+ if ($this->GetQpriority())
+ $pfq_rule .= " priority " . $this->GetQpriority();
if ($this->GetQlimit())
$pfq_rule .= " qlimit " . $this->GetQlimit();
if ($this->GetDefault() || $this->GetRed() || $this->GetRio() || $this->GetEcn() || $this->GetRealtime() || $this->GetLinkshare() || $this->GetUpperlimit()) {
- $pfq_rule .= " hfsc ( ";
+ $pfq_rule .= " hfsc ( ";
if ($this->GetRed()) {
- $comma = 1;
- $pfq_rule .= " red ";
- }
- if ($this->GetRio()) {
- if ($comma)
- $pfq_rule .= " ,";
- $comma = 1;
- $pfq_rule .= " rio ";
- }
- if ($this->GetEcn()) {
- if ($comma)
- $pfq_rule .= " ,";
- $comma = 1;
- $pfq_rule .= " ecn ";
- }
- if ($this->GetDefault()) {
- if ($comma)
- $pfq_rule .= " ,";
$comma = 1;
- $pfq_rule .= " default ";
- }
+ $pfq_rule .= " red ";
+ }
+ if ($this->GetRio()) {
+ if ($comma)
+ $pfq_rule .= " ,";
+ $comma = 1;
+ $pfq_rule .= " rio ";
+ }
+ if ($this->GetEcn()) {
+ if ($comma)
+ $pfq_rule .= " ,";
+ $comma = 1;
+ $pfq_rule .= " ecn ";
+ }
+ if ($this->GetDefault()) {
+ if ($comma)
+ $pfq_rule .= " ,";
+ $comma = 1;
+ $pfq_rule .= " default ";
+ }
- if ($this->GetRealtime() ) {
+ if ($this->GetRealtime() <> "") {
if ($comma)
- $pfq_rule .= " , ";
- $pfq_rule .= "realtime ".$this->GetR_m1() . " " . $this->GetR_d()." ". $this->GetR_m2() ." ";
+ $pfq_rule .= " , ";
+ if ($this->GetR_m1() <> "" && $this->GetR_d() <> "" && $this->GetR_m2() <> "")
+ $pfq_rule .= " realtime (".$this->GetR_m1() . ", " . $this->GetR_d().", ". $this->GetR_m2() .") ";
+ else if ($this->GetR_m2() <> "")
+ $pfq_rule .= " realtime " . $this->GetR_m2();
$comma = 1;
}
- if ($this->GetLinkshare()) {
- if ($comma)
+ if ($this->GetLinkshare() <> "") {
+ if ($comma)
$pfq_rule .= " ,";
- $pfq_rule .= " linkshare ".$this->GetL_m1(). " ". $this->GetL_d(). " ". $this->GetL_m2(). " ";
+ if ($this->GetL_m1() <> "" && $this->GetL_d() <> "" && $this->GetL_m2() <> "")
+ $pfq_rule .= " linkshare (".$this->GetL_m1(). ", ". $this->GetL_d(). ", ". $this->GetL_m2(). ") ";
+ else if ($this->GetL_m2() <> "")
+ $pfq_rule .= " linkshare " . $this->GetL_m2() . " ";
$comma = 1;
}
- if ($this->GetUpperlimit()) {
+ if ($this->GetUpperlimit() <> "") {
if ($comma)
$pfq_rule .= " ,";
- $pfq_rule .= " upperlimit ".$this->GetU_m1()." ". $this->GetU_d()." ". $this->GetU_m2(). " ";
+ if ($this->GetU_m1() <> "" && $this->GetU_d() <> "" && $this->GetU_m2() <> "")
+ $pfq_rule .= " upperlimit (".$this->GetU_m1().", ". $this->GetU_d().", ". $this->GetU_m2(). ") ";
+ else if ($this->GetU_m2() <> "")
+ $pfq_rule .= " upperlimit " . $this->GetU_m2() . " ";
}
- $pfq_rule .= " )\n ";
+ $pfq_rule .= " )\n ";
}
if (count($this->subqueues)) {
- $i = count($this->subqueues);
- $pfq_rule .= " { ";
- foreach ($this->subqueues as $qkey => $qnone) {
- if ($i > 1) {
- $i--;
- $pfq_rule .= " {$qkey}, ";
- } else
- $pfq_rule .= " {$qkey} ";
- $pfq_rule .= " } \n";
- foreach ($this->subqueues as $q)
- $pfq_rule .= $q->build_rules();
- }
- }
+ $i = count($this->subqueues);
+ $pfq_rule .= " { ";
+ foreach ($this->subqueues as $qkey => $qnone) {
+ if ($i > 1) {
+ $i--;
+ $pfq_rule .= " {$qkey}, ";
+ } else
+ $pfq_rule .= " {$qkey} ";
+ $pfq_rule .= " } \n";
+ foreach ($this->subqueues as $q)
+ $pfq_rule .= $q->build_rules();
+ }
+ }
$pfq_rule .= " \n";
-
- return $pfq_rule;
- }
+
+ return $pfq_rule;
+ }
function build_javascript() {
$javascript = parent::build_javascript();
$javascript .= "<script type=\"text/javascript\">";
$javascript .= "function enable_realtime(enable_over) { \n";
- $javascript .= "if (document.form.realtime.checked || enable_over) { \n";
- $javascript .= "document.form.realtime1.disabled = 0;\n";
- $javascript .= "document.form.realtime2.disabled = 0;\n";
- $javascript .= "document.form.realtime3.disabled = 0;\n";
- $javascript .= " } else { \n";
- $javascript .= "document.form.realtime1.disabled = 1;\n";
- $javascript .= "document.form.realtime2.disabled = 1;\n";
- $javascript .= "document.form.realtime3.disabled = 1;\n";
- $javascript .= " } \n";
+ $javascript .= "if (document.iform.realtime.checked || enable_over) { \n";
+ $javascript .= "document.iform.realtime1.disabled = 0;\n";
+ $javascript .= "document.iform.realtime2.disabled = 0;\n";
+ $javascript .= "document.iform.realtime3.disabled = 0;\n";
+ $javascript .= " } else { \n";
+ $javascript .= "document.iform.realtime1.disabled = 1;\n";
+ $javascript .= "document.iform.realtime2.disabled = 1;\n";
+ $javascript .= "document.iform.realtime3.disabled = 1;\n";
+ $javascript .= " } \n";
$javascript .= " } \n";
$javascript .= "function enable_linkshare(enable_over) { \n";
- $javascript .= "if (document.form.linkshare.checked || enable_over) { \n";
- $javascript .= "document.form.linkshare1.disabled = 0;\n";
- $javascript .= "document.form.linkshare2.disabled = 0;\n";
- $javascript .= "document.form.linkshare3.disabled = 0;\n";
- $javascript .= " } else { \n";
- $javascript .= "document.form.linkshare1.disabled = 1;\n";
- $javascript .= "document.form.linkshare2.disabled = 1;\n";
- $javascript .= "document.form.linkshare3.disabled = 1;\n";
- $javascript .= " } \n";
+ $javascript .= "if (document.iform.linkshare.checked || enable_over) { \n";
+ $javascript .= "document.iform.linkshare1.disabled = 0;\n";
+ $javascript .= "document.iform.linkshare2.disabled = 0;\n";
+ $javascript .= "document.iform.linkshare3.disabled = 0;\n";
+ $javascript .= " } else { \n";
+ $javascript .= "document.iform.linkshare1.disabled = 1;\n";
+ $javascript .= "document.iform.linkshare2.disabled = 1;\n";
+ $javascript .= "document.iform.linkshare3.disabled = 1;\n";
+ $javascript .= " } \n";
$javascript .= " } \n";
$javascript .= "function enable_upperlimit(enable_over) { \n";
- $javascript .= "if (document.form.upperlimit.checked || enable_over) { \n";
- $javascript .= "document.form.upperlimit1.disabled = 0;\n";
- $javascript .= "document.form.upperlimit2.disabled = 0;\n";
- $javascript .= "document.form.upperlimit3.disabled = 0;\n";
- $javascript .= " } else { \n";
- $javascript .= "document.form.upperlimit1.disabled = 1;\n";
- $javascript .= "document.form.upperlimit2.disabled = 1;\n";
- $javascript .= "document.form.upperlimit3.disabled = 1;\n";
- $javascript .= " } \n";
+ $javascript .= "if (document.iform.upperlimit.checked || enable_over) { \n";
+ $javascript .= "document.iform.upperlimit1.disabled = 0;\n";
+ $javascript .= "document.iform.upperlimit2.disabled = 0;\n";
+ $javascript .= "document.iform.upperlimit3.disabled = 0;\n";
+ $javascript .= " } else { \n";
+ $javascript .= "document.iform.upperlimit1.disabled = 1;\n";
+ $javascript .= "document.iform.upperlimit2.disabled = 1;\n";
+ $javascript .= "document.iform.upperlimit3.disabled = 1;\n";
+ $javascript .= " } \n";
- $javascript .= "} \n";
+ $javascript .= "} \n";
$javascript .= "</script>";
+
return $javascript;
}
- function build_form() {
- $form = "<tr>";
- $form .= "<td valign=\"top\" class=\"vncellreq\">Bandwidth</td>";
- $form .= "<td class=\"vtable\"> <input name=\"bandwidth\" id=\"bandwidth\" class=\"formfld unknown\" value=\"";
- $form .= htmlspecialchars($this->GetBandwidth());
- $form .= "\">";
- $form .= "<select name=\"bandwidthtype\" id=\"bandwidthtype\" class=\"formselect\">";
- $form .= "<option value=\"Mb\"";
- if (stristr($this->GetBwscale(),"Mb"))
- $form .= " selected=\"yes\"";
- $form .= ">Mbit/s</option>";
- $form .= "<option value=\"Kb\"";
- if (stristr($this->GetBwscale(),"Kb"))
- $form .= " selected=\"yes\"";
- $form .= ">Kbit/s</option>";
- $form .= "<option value=\"\"";
- if (stristr($this->GetBwscale(),"b"))
- $form .= " selected=\"yes\"";
- $form .= ">Bit/s</option>";
- $form .= "<option value=\"\"";
- if (stristr($this->GetBwscale(),"%"))
- $form .= " selected=\"yes\"";
- $form .= ">%</option>";
- $form .= "</select> <br>";
- $form .= "<span class=\"vexpl\">Choose the amount of bandwidth for this queue";
- $form .= "</span></td>";
- $form .= parent::build_form();
- $form .= "<tr>";
- $form .= "<td width=\"22%\" valign=\"top\" class=\"vncellreq\">Service Curve (sc)</td>";
- $form .= "<td width=\"78%\" class=\"vtable\">";
- $form .= "<table>";
- $form .= "<tr><td>&nbsp;</td><td><center>m1</center></td><td><center>d</center></td><td><center><b>m2</b></center></td></tr>";
- $form .= "<tr><td><input type=\"checkbox\" id=\"upperlimit\" name=\"upperlimit\"";
- if($this->GetUpperlimit())
- $form .= " CHECKED ";
- $form .= "onChange=\"enable_upperlimit()\"> Upperlimit:</td><td><input size=\"6\" value=\"";
- $form .= htmlspecialchars($this->GetU_m1());
- $form .= "\" id=\"upperlimit1\" name=\"upperlimit1\" ";
+ function build_form() {
+ $form = "<tr>";
+ $form .= "<td valign=\"top\" class=\"vncellreq\">Bandwidth</td>";
+ $form .= "<td class=\"vtable\"> <input name=\"bandwidth\" id=\"bandwidth\" class=\"formfld unknown\" value=\"";
+ $form .= htmlspecialchars($this->GetBandwidth());
+ $form .= "\">";
+ $form .= "<select name=\"bandwidthtype\" id=\"bandwidthtype\" class=\"formselect\">";
+ $form .= "<option value=\"Gb\"";
+ if ($this->GetBwscale() == "Gb")
+ $form .= " selected=\"yes\"";
+ $form .= ">Gbit/s</option>";
+ $form .= "<option value=\"Mb\"";
+ if ($this->GetBwscale() == "Mb")
+ $form .= " selected=\"yes\"";
+ $form .= ">Mbit/s</option>";
+ $form .= "<option value=\"Kb\"";
+ if ($this->GetBwscale() == "Kb")
+ $form .= " selected=\"yes\"";
+ $form .= ">Kbit/s</option>";
+ $form .= "<option value=\"\"";
+ if ($this->GetBwscale() == "b")
+ $form .= " selected=\"yes\"";
+ $form .= ">Bit/s</option>";
+ $form .= "<option value=\"%\"";
+ if ($this->GetBwscale() == "%")
+ $form .= " selected=\"yes\"";
+ $form .= ">%</option>";
+ $form .= "</select> <br>";
+ $form .= "<span class=\"vexpl\">Choose the amount of bandwidth for this queue";
+ $form .= "</span></td>";
+ $form .= parent::build_form();
+ $form .= "<tr>";
+ $form .= "<td width=\"22%\" valign=\"top\" class=\"vncellreq\">Service Curve (sc)</td>";
+ $form .= "<td width=\"78%\" class=\"vtable\">";
+ $form .= "<table>";
+ $form .= "<tr><td>&nbsp;</td><td><center>m1</center></td><td><center>d</center></td><td><center><b>m2</b></center></td></tr>";
+ $form .= "<tr><td><input type=\"checkbox\" id=\"upperlimit\" name=\"upperlimit\"";
+ if($this->GetUpperlimit() <> "")
+ $form .= " CHECKED ";
+ $form .= "onChange=\"enable_upperlimit()\"> Upperlimit:</td><td><input size=\"6\" value=\"";
+ $form .= htmlspecialchars($this->GetU_m1());
+ $form .= "\" id=\"upperlimit1\" name=\"upperlimit1\" ";
+ if (!$this->GetUpperlimit()) $form .= " disabled";
+ $form .= "></td><td><input size=\"6\" value=\"";
+ $form .= htmlspecialchars($this->GetU_d());
+ $form .= "\" id=\"upperlimi2\" name=\"upperlimit2\" ";
if (!$this->GetUpperlimit()) $form .= " disabled";
$form .= "></td><td><input size=\"6\" value=\"";
- $form .= htmlspecialchars($this->GetU_d());
- $form .= "\" id=\"upperlimi2\" name=\"upperlimit2\" ";
- if (!$this->GetUpperlimit()) $form .= " disabled";
- $form .= "></td><td><input size=\"6\" value=\"";
- $form .= htmlspecialchars($this->GetU_m2());
- $form .= "\" id=\"upperlimit3\" name=\"upperlimit3\" ";
+ $form .= htmlspecialchars($this->GetU_m2());
+ $form .= "\" id=\"upperlimit3\" name=\"upperlimit3\" ";
if (!$this->GetUpperlimit()) $form .= " disabled";
$form .= "></td><td>The maximum allowed bandwidth for the queue.</td></tr>";
- $form .= "<tr><td><input type=\"checkbox\" id=\"realtime\" name=\"realtime\"";
- if($this->GetRealtime())
+ $form .= "<tr><td><input type=\"checkbox\" id=\"realtime\" name=\"realtime\"";
+ if($this->GetRealtime() <> "")
$form .= " CHECKED ";
- $form .= "onChange=\"enable_realtime()\"> Real time:</td><td><input size=\"6\" value=\"";
- $form .= htmlspecialchars($this->GetR_m1());
- $form .= "\" id=\"realtime1\" name=\"realtime1\" ";
+ $form .= "onChange=\"enable_realtime()\"> Real time:</td><td><input size=\"6\" value=\"";
+ $form .= htmlspecialchars($this->GetR_m1());
+ $form .= "\" id=\"realtime1\" name=\"realtime1\" ";
if (!$this->GetRealtime()) $form .= " disabled";
$form .= "></td><td><input size=\"6\" value=\"";
- $form .= htmlspecialchars($this->GetR_d());
- $form .= "\" id=\"realtime2\" name=\"realtime2\" ";
+ $form .= htmlspecialchars($this->GetR_d());
+ $form .= "\" id=\"realtime2\" name=\"realtime2\" ";
if (!$this->GetRealtime()) $form .= " disabled";
$form .= "></td><td><input size=\"6\" value=\"";
- $form .= htmlspecialchars($this->GetR_m2());
- $form .= "\" id=\"realtime3\" name=\"realtime3\" ";
+ $form .= htmlspecialchars($this->GetR_m2());
+ $form .= "\" id=\"realtime3\" name=\"realtime3\" ";
if (!$this->GetRealtime()) $form .= " disabled";
$form .= "></td><td>The minimum required bandwidth for the queue.</td></tr>";
- $form .= "<tr><td><input type=\"checkbox\" id=\"linkshare\" id=\"linkshare\" name=\"linkshare\"";
- if($this->GetLinkshare())
+ $form .= "<tr><td><input type=\"checkbox\" id=\"linkshare\" id=\"linkshare\" name=\"linkshare\"";
+ if($this->GetLinkshare() <> "")
$form .= " CHECKED ";
- $form .= "onChange=\"enable_linkshare()\"> Link share:</td><td><input size=\"6\" value=\"";
- $form .= htmlspecialchars($this->GetL_m1());
- $form .= "\" id=\"linkshare1\" name=\"linkshare1\" ";
+ $form .= "onChange=\"enable_linkshare()\"> Link share:</td><td><input size=\"6\" value=\"";
+ $form .= htmlspecialchars($this->GetL_m1());
+ $form .= "\" id=\"linkshare1\" name=\"linkshare1\" ";
if (!$this->GetLinkshare()) $form .= " disabled";
$form .= "></td><td><input size=\"6\" value=\"";
- $form .= htmlspecialchars($this->GetL_d());
- $form .= "\" id=\"linkshare2\" name=\"linkshare2\" ";
+ $form .= htmlspecialchars($this->GetL_d());
+ $form .= "\" id=\"linkshare2\" name=\"linkshare2\" ";
if (!$this->GetLinkshare()) $form .= " disabled";
$form .= "></td><td><input size=\"6\" value=\"";
- $form .= htmlspecialchars($this->GetL_m2());
- $form .= "\" id=\"linkshare3\" name=\"linkshare3\" ";
+ $form .= htmlspecialchars($this->GetL_m2());
+ $form .= "\" id=\"linkshare3\" name=\"linkshare3\" ";
if (!$this->GetLinkshare()) $form .= " disabled";
$form .= "></td><td>The bandwidth share of a backlogged queue - this overrides priority.</td></tr>";
- $form .= "</table><br>";
- $form .= "The format for service curve specifications is (m1, d, m2). m2 controls";
- $form .= "the bandwidth assigned to the queue. m1 and d are optional and can be";
- $form .= "used to control the initial bandwidth assignment. For the first d milliseconds the queue gets the bandwidth given as m1, afterwards the value";
- $form .= "given in m2.";
- $form .= "</span></td>";
- $form .= "</tr>";
-
- return $form;
- }
+ $form .= "</table><br>";
+ $form .= "The format for service curve specifications is (m1, d, m2). m2 controls";
+ $form .= "the bandwidth assigned to the queue. m1 and d are optional and can be";
+ $form .= "used to control the initial bandwidth assignment. For the first d milliseconds the queue gets the bandwidth given as m1, afterwards the value";
+ $form .= "given in m2.";
+ $form .= "</span></td>";
+ $form .= "</tr>";
+
+ return $form;
+ }
function update_altq_queue_data(&$data) {
$this->ReadConfig($data);
}
- function wconfig() {
+ function wconfig() {
$cflink =& get_reference_to_me_in_config($this->GetLink());
- if (!is_array($cflink))
- $cflink = array();
- $cflink['name'] = $this->GetQname();
- $cflink['interface'] = $this->GetInterface();
- $cflink['qlimit'] = $this->GetQlimit();
- $cflink['priority'] = $this->GetQpriority();
- $cflink['description'] = $this->GetDescription();
- $cflink['bandwidth'] = $this->GetBandwidth();
- $cflink['bandwidthtype'] = $this->GetBwscale();
- $cflink['enabled'] = $this->GetEnabled();
- $cflink['default'] = $this->GetDefault();
- $cflink['red'] = $this->GetRed();
- $cflink['rio'] = $this->GetRio();
- $cflink['ecn'] = $this->GetEcn();
- if ($this->GetLinkshare()) {
- $cflink['linkshare'] = "on";
- $cflink['linkshare3'] = $this->GetL_m2();
- $cflink['linkshare2'] = $this->GetL_d();
- $cflink['linkshare1'] = $this->GetL_m1();
- }
- if ($this->GetRealtime()) {
- $cflink['realtime'] = "on";
- $cflink['realtime3'] = $this->GetR_m2();
- $cflink['realtime2'] = $this->GetR_d();
- $cflink['realtime1'] = $this->GetR_m1();
- }
- if ($this->GetUpperlimit()) {
- $cflink['upperlimit'] = "on";
- $cflink['upperlimit3'] = $this->GetU_m2();
- $cflink['upperlimit2'] = $this->GetU_d();
- $cflink['upperlimit1'] = $this->GetU_m1();
+ if (!is_array($cflink))
+ $cflink = array();
+ $cflink['name'] = $this->GetQname();
+ $cflink['interface'] = $this->GetInterface();
+ $cflink['qlimit'] = $this->GetQlimit();
+ $cflink['priority'] = $this->GetQpriority();
+ $cflink['description'] = $this->GetDescription();
+ $cflink['bandwidth'] = $this->GetBandwidth();
+ $cflink['bandwidthtype'] = $this->GetBwscale();
+ $cflink['enabled'] = $this->GetEnabled();
+ $cflink['default'] = $this->GetDefault();
+ $cflink['red'] = $this->GetRed();
+ $cflink['rio'] = $this->GetRio();
+ $cflink['ecn'] = $this->GetEcn();
+ if ($this->GetLinkshare() <> "" ) {
+ if ($this->GetL_m1() <> "") {
+ $cflink['linkshare1'] = $this->GetL_m1();
+ $cflink['linkshare2'] = $this->GetL_d();
+ $cflink['linkshare'] = "on";
+ }
+ if ($this->GetL_m2() <> "") {
+ $cflink['linkshare3'] = $this->GetL_m2();
+ $cflink['linkshare'] = "on";
+ }
+ }
+ if ($this->GetRealtime() <> "" ) {
+ if ($this->GetR_m1() <> "") {
+ $cflink['realtime1'] = $this->GetR_m1();
+ $cflink['realtime2'] = $this->GetR_d();
+ $cflink['realtime'] = "on";
+ }
+ if ($this->GetR_m2()) {
+ $cflink['realtime3'] = $this->GetR_m2();
+ $cflink['realtime'] = "on";
+ }
+ }
+ if ($this->GetUpperlimit() <> "") {
+ if ($this->GetU_m1() <> "") {
+ $cflink['upperlimit1'] = $this->GetU_m1();
+ $cflink['upperlimit2'] = $this->GetU_d();
+ $cflink['upperlimit'] = "on";
+ }
+ if ($this->GetU_m2()) {
+ $cflink['upperlimit3'] = $this->GetU_m2();
+ $cflink['upperlimit'] = "on";
+ }
+ }
}
}
-}
class cbq_queue extends priq_queue {
- var $qborrow;
+ var $qborrow;
function GetBorrow() {
return $this->qborrow;
@@ -1371,90 +1653,159 @@ class cbq_queue extends priq_queue {
$this->qborrow = $borrow;
}
function CanHaveChilds() {
- return true;
- }
+ return true;
+ }
- function &add_queue($interface, &$qname, &$path) {
+ function &add_queue($interface, &$qname, &$path, &$input_errors) {
if (!is_array($this->subqueues))
- $this->subqueues = array();
+ $this->subqueues = array();
$q =& new cbq_queue();
- $q->ReadConfig($qname);
$q->SetInterface($this->GetInterface());
$q->SetParent(&$this);
+ switch ($q->GetBwscale()) {
+ case "Mb":
+ $factor = 1000;
+ brak;
+ case "Kb":
+ $factor = 1;
+ break;
+ case "b":
+ $factor = 1/1000;
+ break;
+ case "Gb":
+ $factor = 1000 * 1000;
+ break;
+ case "%":
+ $factor = $this->GetAvailableBandwidth() / 100;
+ break;
+ default: /* XXX */
+ $factor = 1;
+ break;
+ }
+ $q->SetAvailableBandwidth($q->GetBandwidth() * $factor);
+ $this->SetAvailableBandwidth($this->GetAvailableBandwidth() - $q->GetBandwidth() * $factor);
+ $q->ReadConfig($qname);
+ $q->validate_input($qname, $input_errors);
+ if (count($input_errors)) {
+ return $q;
+ }
$q->SetEnabled("on");
- $q->SetLink($path);
- $this->subqueues[$q->GetQName()] = &$q;
+ $q->SetLink($path);
+ $this->subqueues[$q->GetQName()] = &$q;
$GLOBALS['allqueue_list'][] = $q->GetQname();
ref_on_altq_queue_list($this->GetQname(), $q->GetQname());
if (is_array($qname['queue'])) {
- foreach ($qname['queue'] as $key1 => $que) {
- array_push($path, $key1);
- $q->add_queue($q->GetInterface(), &$que, &$path);
- array_pop($path);
- }
- }
+ foreach ($qname['queue'] as $key1 => $que) {
+ array_push($path, $key1);
+ $q->add_queue($q->GetInterface(), &$que, &$path, $input_errors);
+ array_pop($path);
+ }
+ }
return $q;
- }
+ }
- /*
- * Should search even its childs
- */
- function &find_queue($interface, $qname) {
- if ($qname == $this->GetQname())
- return $this;
- foreach ($this->subqueues as $q) {
- $result =& $q->find_queue("", $qname);
+ /*
+ * Should search even its childs
+ */
+ function &find_queue($interface, $qname) {
+ if ($qname == $this->GetQname())
+ return $this;
+ foreach ($this->subqueues as $q) {
+ $result =& $q->find_queue("", $qname);
if ($result)
- return $result;
- }
- }
+ return $result;
+ }
+ }
function &find_parentqueue($interface, $qname) {
- if ($this->subqueues[$qname])
- return $this;
- foreach ($this->subqueues as $q) {
- $result = $q->find_parentqueue("", $qname);
+ if ($this->subqueues[$qname])
+ return $this;
+ foreach ($this->subqueues as $q) {
+ $result = $q->find_parentqueue("", $qname);
if ($result)
return $result;
}
- }
+ }
function delete_all() {
if (count($this->subqueues)) {
- foreach ($this->subqueues as $q) {
- $q->delete_all();
+ foreach ($this->subqueues as $q) {
+ $q->delete_all();
unset_object_by_reference($q->GetLink());
- unset($q);
- }
- unset($subqueues);
+ unset($q);
+ }
+ unset($subqueues);
+ }
}
- }
- function delete_queue() {
- unref_on_altq_queue_list($this->GetQname());
- if ($this->GetDefault())
- altq_set_default_queue($this->GetInterface(), "false");
- cleanup_queue_from_rules($this->GetQname());
- foreach ($this->subqueues as $q)
- $q->delete_queue();
- unset_object_by_reference($this->subqueues[$qname]->GetLink());
- }
+ function delete_queue() {
+ unref_on_altq_queue_list($this->GetQname());
+ if ($this->GetDefault())
+ altq_set_default_queue($this->GetInterface(), "false");
+ cleanup_queue_from_rules($this->GetQname());
+ foreach ($this->subqueues as $q)
+ $q->delete_queue();
+ $parent =& $this->GetParent();
+ $parent->CalculateRemainingBandwidth($this->GetBandwidth(), $this->GetBwscale(), "delete");
+ unset_object_by_reference($this->subqueues[$qname]->GetLink());
+ }
function validate_input($data, &$input_errors) {
parent::validate_input($data, $input_errors);
+
if ($data['priority'] > 7)
- $input_errors[] = "Priority must be an integer between 1 and 7.
-";
- }
+ $input_errors[] = "Priority must be an integer between 1 and 7.";
+ $reqfields[] = "bandwidth";
+ $reqdfieldsn[] = "Bandwidth";
+ $reqfields[] = "bandwidthtype";
+ $reqdfieldsn[] = "Bandwidthtype";
- function ReadConfig(&$q) {
- parent::ReadConfig($q);
+ //do_input_validation($data, $reqdfields, $reqdfieldsn, $input_errors);
+
+ if ($data['bandwidth'] && (!is_numeric($data['bandwidth'])))
+ $input_errors[] = "Bandwidth must be an integer.";
+
+ if ($data['bandwidth'] < 0)
+ $input_errors[] = "Bandwidth cannot be negative.";
+
+ if ($data['bandwidthtype'] == "%") {
+ if ($data['bandwidth'] > 100 || $data['bandwidth'] < 0)
+ $input_errors[] = "Bandwidth in percentage should be between 1 and 100 bounds.";
+ }
+
+ $parent =& $this->GetParent();
+ switch ($data['bandwidthtype']) {
+ case "Mb":
+ $myfactor = 1000;
+ brak;
+ case "Kb":
+ $myfactor = 1;
+ break;
+ case "b":
+ $myfactor = 1/1000;
+ break;
+ case "Gb":
+ $myfactor = 1000 * 1000;
+ break;
+ case "%":
+ $myfactor = $parent->GetBandwidth() / 100;
+ default: /* XXX */
+ $myfactor = 1;
+ break;
+ }
+/*
+ if ($parent->GetAvailableBandwidth() < $data['bandwidth'] * $myfactor)
+ $input_errors[] = "Bandwidth greater than that of parent. Correct the error";
+*/
+ }
+ function ReadConfig(&$q) {
+ parent::ReadConfig($q);
if ($q['borrow'])
$this->SetBorrow("on");
- }
-
+ }
+
function build_javascript() {
return parent::build_javascript();
}
@@ -1463,7 +1814,7 @@ class cbq_queue extends priq_queue {
$tree = " <li><a href=\"firewall_shaper.php?interface=" . $this->GetInterface()."&queue=" . $this->GetQname()."&action=show";
$tree .= "\" ";
if ($this->GetDefault())
- $tree .= " class=\"navlnk\"";
+ $tree .= " class=\"navlnk\"";
$tree .= " >" . $this->GetQname() . "</a>";
if (is_array($this->subqueues)) {
$tree .= "<ul>";
@@ -1476,214 +1827,134 @@ class cbq_queue extends priq_queue {
return $tree;
}
- /* Even this should take childs in consideration */
- function build_rules() {
-
- $pfq_rule = "queue ". $this->qname;
- if ($this->GetInterface())
- $pfq_rule .= " on ".convert_friendly_interface_to_real_interface_name($this->GetInterface());
- if ($this->GetBandwidth() && $this->GetBwscale())
- $pfq_rule .= " bandwidth ".trim($this->GetBandwidth()).$this->GetBwscale();
- if ($this->GetQpriority())
- $pfq_rule .= " priority " . $this->GetQpriority();
- if ($this->GetQlimit())
- $pfq_rule .= " qlimit " . $this->GetQlimit();
- if ($this->GetDefault() || $this->GetRed() || $this->GetRio() || $this->GetEcn() || $this->GetBorrow()) {
- $pfq_rule .= " cbq ( ";
- if ($this->GetRed()) {
- $comma = 1;
- $pfq_rule .= " red ";
- }
- if ($this->GetRio()) {
- if ($comma)
- $pfq_rule .= " ,";
- $comma = 1;
- $pfq_rule .= " rio ";
- }
- if ($this->GetEcn()) {
- if ($comma)
- $pfq_rule .= " ,";
- $comma = 1;
- $pfq_rule .= " ecn ";
- }
- if ($this->GetDefault()) {
- if ($comma)
- $pfq_rule .= " ,";
- $comma = 1;
- $pfq_rule .= " default ";
- }
- if ($this->GetBorrow()) {
- if ($comma)
- $pfq_rule .= ", ";
- $pfq_rule .= " borrow ";
- }
- $pfq_rule .= " ) ";
- }
- if (count($this->subqueues)) {
- $i = count($this->subqueues);
- $pfq_rule .= " { ";
- foreach ($this->subqueues as $qkey => $qnone) {
- if ($i > 1) {
- $i--;
- $pfq_rule .= " {$qkey}, ";
- } else
- $pfq_rule .= " {$qkey} ";
- }
- $pfq_rule .= " } \n";
- foreach ($this->subqueues as $q)
- $pfq_rule .= $q->build_rules();
- }
- //}
- $pfq_rule .= " \n";
- return $pfq_rule;
- }
-
- function build_form() {
- $form = "<tr>";
- $form .= "<td valign=\"top\" class=\"vncellreq\">Bandwidth</td>";
- $form .= "<td class=\"vtable\"> <input name=\"bandwidth\" id=\"bandwidth\" class=\"formfld unknown\" value=\"";
- if ($this->GetBandwidth() > 0)
- $form .= htmlspecialchars($this->GetBandwidth());
- $form .= "\">";
+ /* Even this should take childs in consideration */
+ function build_rules() {
+ $pfq_rule = "queue ". $this->qname;
+ if ($this->GetInterface())
+ $pfq_rule .= " on ".convert_friendly_interface_to_real_interface_name($this->GetInterface());
+ if ($this->GetBandwidth() && $this->GetBwscale())
+ $pfq_rule .= " bandwidth ".trim($this->GetBandwidth()).$this->GetBwscale();
+ if ($this->GetQpriority())
+ $pfq_rule .= " priority " . $this->GetQpriority();
+ if ($this->GetQlimit())
+ $pfq_rule .= " qlimit " . $this->GetQlimit();
+ if ($this->GetDefault() || $this->GetRed() || $this->GetRio() || $this->GetEcn() || $this->GetBorrow()) {
+ $pfq_rule .= " cbq ( ";
+ if ($this->GetRed()) {
+ $comma = 1;
+ $pfq_rule .= " red ";
+ }
+ if ($this->GetRio()) {
+ if ($comma)
+ $pfq_rule .= " ,";
+ $comma = 1;
+ $pfq_rule .= " rio ";
+ }
+ if ($this->GetEcn()) {
+ if ($comma)
+ $pfq_rule .= " ,";
+ $comma = 1;
+ $pfq_rule .= " ecn ";
+ }
+ if ($this->GetDefault()) {
+ if ($comma)
+ $pfq_rule .= " ,";
+ $comma = 1;
+ $pfq_rule .= " default ";
+ }
+ if ($this->GetBorrow()) {
+ if ($comma)
+ $pfq_rule .= ", ";
+ $pfq_rule .= " borrow ";
+ }
+ $pfq_rule .= " ) ";
+ }
+ if (count($this->subqueues)) {
+ $i = count($this->subqueues);
+ $pfq_rule .= " { ";
+ foreach ($this->subqueues as $qkey => $qnone) {
+ if ($i > 1) {
+ $i--;
+ $pfq_rule .= " {$qkey}, ";
+ } else
+ $pfq_rule .= " {$qkey} ";
+ }
+ $pfq_rule .= " } \n";
+ foreach ($this->subqueues as $q)
+ $pfq_rule .= $q->build_rules();
+ }
+
+ $pfq_rule .= " \n";
+ return $pfq_rule;
+ }
+
+ function build_form() {
+ $form = "<tr>";
+ $form .= "<td valign=\"top\" class=\"vncellreq\">Bandwidth</td>";
+ $form .= "<td class=\"vtable\"> <input name=\"bandwidth\" id=\"bandwidth\" class=\"formfld unknown\" value=\"";
+ if ($this->GetBandwidth() > 0)
+ $form .= htmlspecialchars($this->GetBandwidth());
+ $form .= "\">";
$form .= "<select name=\"bandwidthtype\" id=\"bandwidthtype\" class=\"formselect\">";
- $form .= "<option value=\"Mb\"";
- if (stristr($this->GetBwscale(),"Mb"))
- $form .= " selected=\"yes\"";
- $form .= ">Mbit/s</option>";
- $form .= "<option value=\"Kb\"";
- if (stristr($this->GetBwscale(),"Kb"))
- $form .= " selected=\"yes\"";
- $form .= ">Kbit/s</option>";
- $form .= "<option value=\"\"";
- if (stristr($this->GetBwscale(),"b"))
- $form .= " selected=\"yes\"";
- $form .= ">Bit/s</option>";
- $form .= "<option value=\"\"";
- if (stristr($this->GetBwscale(),"%"))
- $form .= " selected=\"yes\"";
- $form .= ">%</option>";
- $form .= "</select> <br>";
- $form .= "<span class=\"vexpl\">Choose the amount of bandwidth for this
- queue";
- $form .= "</span></td></tr>";
- $form .= parent::build_form();
- $form .= "<tr><td class=\"vncellreq\">Scheduler specific options</td>";
+ $form .= "<option value=\"Gb\"";
+ if ($this->GetBwscale() == "Gb")
+ $form .= " selected=\"yes\"";
+ $form .= ">Gbit/s</option>";
+ $form .= "<option value=\"Mb\"";
+ if ($this->GetBwscale() == "Mb")
+ $form .= " selected=\"yes\"";
+ $form .= ">Mbit/s</option>";
+ $form .= "<option value=\"Kb\"";
+ if ($this->GetBwscale() == "Kb")
+ $form .= " selected=\"yes\"";
+ $form .= ">Kbit/s</option>";
+ $form .= "<option value=\"\"";
+ if ($this->GetBwscale() == "b")
+ $form .= " selected=\"yes\"";
+ $form .= ">Bit/s</option>";
+ $form .= "<option value=\"%\"";
+ if ($this->GetBwscale() == "%")
+ $form .= " selected=\"yes\"";
+ $form .= ">%</option>";
+ $form .= "</select> <br>";
+ $form .= "<span class=\"vexpl\">Choose the amount of bandwidth for this queue";
+ $form .= "</span></td></tr>";
+ $form .= parent::build_form();
+ $form .= "<tr><td class=\"vncellreq\">Scheduler specific options</td>";
$form .= "<td class=\"vtable\"><input type=\"checkbox\" id=\"borrow\" name=\"borrow\"";
- if($this->GetBorrow() == "on")
- $form .= " CHECKED ";
- $form .= "> Borrow from other queues when available<br></td></tr>";
+ if($this->GetBorrow() == "on")
+ $form .= " CHECKED ";
+ $form .= "> Borrow from other queues when available<br></td></tr>";
- return $form;
- }
+ return $form;
+ }
function update_altq_queue_data(&$data) {
$this->ReadConfig($data);
}
- function wconfig() {
+ function wconfig() {
$cflink =& get_reference_to_me_in_config($this->GetLink());
- if (!is_array($cflink))
- $cflink = array();
- $cflink['interface'] = $this->GetInterface();
- $cflink['qlimit'] = $this->GetQlimit();
- $cflink['priority'] = $this->GetQpriority();
- $cflink['name'] = $this->GetQname();
- $cflink['description'] = $this->GetDescription();
+ if (!is_array($cflink))
+ $cflink = array();
+ $cflink['interface'] = $this->GetInterface();
+ $cflink['qlimit'] = $this->GetQlimit();
+ $cflink['priority'] = $this->GetQpriority();
+ $cflink['name'] = $this->GetQname();
+ $cflink['description'] = $this->GetDescription();
$cflink['bandwidth'] = $this->GetBandwidth();
- $cflink['bandwidthtype'] = $this->GetBwscale();
+ $cflink['bandwidthtype'] = $this->GetBwscale();
$cflink['enabled'] = $this->GetEnabled();
$cflink['default'] = $this->GetDefault();
$cflink['red'] = $this->GetRed();
$cflink['rio'] = $this->GetRio();
$cflink['ecn'] = $this->GetEcn();
$cflink['borrow'] = $this->GetBorrow();
- }
-}
-
-/*
- * XXX: TODO Link dummynet(4) in the system.
- */
-
-
-/*
- * List of respective objects!
- */
-$g_pipes_list = array();
-$g_queue_list = array();
-
-class dummynet_class {
- var $buckets;
- /* mask parameters */
- var $dstip;
- var $srcip;
- var $dstport;
- var $srcport;
- var $dstip6;
- var $srcip6;
- var $flowid;
- /* all masks */
- var $dnall;
-
- var $noerror;
- var $plr;
- var $queue;
- var $queue_scale; /* b, Kb */
- var $red; /* red or gred */
- /* red parameters */
- var $w_q;
- var $min_th;
- var $max_th;
- var $max_p;
-
- function GetBuckets() {
- return $this->buckets;
- }
- function SetBuckets($buckets) {
- $this->buckets = $buckets;
- }
- function GetPlr() {
- return $this->plr;
- }
- function SetPlr($plr) {
- $this->plr = $plr;
- }
- /* function GetBuckets() {
- return $this->buckets;
- }
- function SetBuckets($buckets) {
- $this->buckets = $buckets;
- }
- */
- /* Can be used or not */
- function build_rules() { return; }
- function build_form() { return; }
- function update_config() { return; }
- function wconfig() { return; }
+ }
}
-class dnpipe_class extends dummynet_class {
- var $pipe_nr;
- var $bandwidth;
- var $delay;
- function delete_pipe() { return; }
- function build_rules() { return; }
- function build_form() { return; }
- function update_pipe() { return; }
- function wconfig() { return; }
-}
-
-class dnqueue_class extends dummynet_class {
- var $queue_nr;
- var $pipe_parent;
- var $weight;
- function delete_queue() { return; }
- function build_rules() { return; }
- function build_form() { return; }
- function update_queue() { return; }
- function wconfig() { return; }
-}
/*
* XXX: TODO Make a class shaper to hide all these function
@@ -1762,21 +2033,25 @@ function read_altq_config() {
return;
foreach ($a_int as $key => $conf) {
- $int = $conf['interface'];
- $root =& new altq_root_queue();
- $root->SetInterface($int);
- $altq_list_queues[$root->GetInterface()] = &$root;
- $root->ReadConfig($conf);
+ $int = $conf['interface'];
+ $root =& new altq_root_queue();
+ $root->SetInterface($int);
+ $altq_list_queues[$root->GetInterface()] = &$root;
+ $root->ReadConfig($conf);
array_push($path, $key);
$root->SetLink($path);
$GLOBALS['allqueue_list'][] = $root->GetQname();
if (is_array($conf['queue'])) {
foreach ($conf['queue'] as $key1 => $q) {
array_push($path, $key1);
- $root->add_queue($root->GetInterface(), $q, &$path);
+ /*
+ * XXX: we compeletely ignore errors here but anyway we must have
+ * checked them before so no harm should be come from this.
+ */
+ $root->add_queue($root->GetInterface(), $q, &$path, $input_errors);
array_pop($path);
}
- }
+ }
array_pop($path);
}
}
@@ -1819,20 +2094,20 @@ function build_iface_without_this_queue($iface, $qname) {
global $g, $altq_list_queues;
$altq =& $altq_list_queues[$iface];
- if ($altq)
- $scheduler = ": " . $altq->GetScheduler();
+ if ($altq)
+ $scheduler = ": " . $altq->GetScheduler();
$form = "<tr><td width=\"20%\" >";
$form .= "<a href=\"firewall_shaper.php?interface" . $iface . "&queue=" . $iface."&action=show\">".$iface.": ".$scheduler."</a>";
- $form .= "</td></tr>";
- $form .= "<tr><td width=\"100%\" class=\"vncellreq\">";
- $form .= "<a href=\"firewall_shaper_queues.php?interface=";
- $form .= $iface . "&queue=". $qname . "&action=add\">";
- $form .= "<img src=\"";
- $form .= "./themes/".$g['theme']."/images/icons/icon_plus.gif\"";
- $form .= " width=\"17\" height=\"17\" border=\"0\" title=\"Activate queue on this interface\">";
- $form .= " Activate queue on this interface</a></td></tr>";
-
- return $form;
+ $form .= "</td></tr>";
+ $form .= "<tr><td width=\"100%\" class=\"vncellreq\">";
+ $form .= "<a href=\"firewall_shaper_queues.php?interface=";
+ $form .= $iface . "&queue=". $qname . "&action=add\">";
+ $form .= "<img src=\"";
+ $form .= "./themes/".$g['theme']."/images/icons/icon_plus.gif\"";
+ $form .= " width=\"17\" height=\"17\" border=\"0\" title=\"Activate queue on this interface\">";
+ $form .= " Activate queue on this interface</a></td></tr>";
+
+ return $form;
}
diff --git a/usr/local/www/firewall_rules.php b/usr/local/www/firewall_rules.php
index 461b97e..a92ddbf 100755
--- a/usr/local/www/firewall_rules.php
+++ b/usr/local/www/firewall_rules.php
@@ -68,9 +68,12 @@ if (isset($config['ipsec']['enable']) || isset($config['ipsec']['mobileclients']
if(have_ruleint_access("enc0"))
$iflist["enc0"] = "IPsec";
-if (!$if || !isset($iflist[$if]))
- foreach($iflist as $if => $ifname)
- break;
+if (!$if || !isset($iflist[$if])) {
+ if ("any" == $if)
+ $if = "GerneralRules";
+ else if ("FloatingRules" != $if)
+ $if = "wan";
+}
$security_url = "firewall_rules.php?if=". strtolower($if);
if (!isSystemAdmin($HTTP_SERVER_VARS['AUTH_USER'])) {
@@ -225,6 +228,11 @@ echo "<script type=\"text/javascript\" language=\"javascript\" src=\"/javascript
<?php
/* active tabs */
$tab_array = array();
+ if ("FloatingRules" == $if)
+ $active = true;
+ else
+ $active = false;
+ $tab_array[] = array("Floating Rules", $active, "firewall_rules.php?if=FloatingRules");
$tabscounter = 0; $i = 0; foreach ($iflist as $ifent => $ifname) {
if ($ifent == $if)
$active = true;
@@ -258,7 +266,9 @@ echo "<script type=\"text/javascript\" language=\"javascript\" src=\"/javascript
$nrules = 0;
for ($i = 0; isset($a_filter[$i]); $i++) {
$filterent = $a_filter[$i];
- if ($filterent['interface'] != $if)
+ if ($filterent['interface'] != $if && !isset($filterent['floating']))
+ continue;
+ if (isset($filterent['floating']) && "FloatingRules" != $if)
continue;
$nrules++;
}
@@ -328,8 +338,10 @@ echo "<script type=\"text/javascript\" language=\"javascript\" src=\"/javascript
<?php endif; ?>
<?php $nrules = 0; for ($i = 0; isset($a_filter[$i]); $i++):
$filterent = $a_filter[$i];
- if ($filterent['interface'] != $if)
- continue;
+ if ($filterent['interface'] != $if && !isset($filterent['floating']))
+ continue;
+ if (isset($filterent['floating']) && "FloatingRules" != $if)
+ continue;
?>
<tr valign="top" id="fr<?=$nrules;?>">
<td class="listt"><input type="checkbox" id="frc<?=$nrules;?>" name="rule[]" value="<?=$i;?>" onClick="fr_bgcolor('<?=$nrules;?>')" style="margin: 0; padding: 0; width: 15px; height: 15px;"></td>
diff --git a/usr/local/www/firewall_shaper.php b/usr/local/www/firewall_shaper.php
index a82a683..b5ef96c 100755
--- a/usr/local/www/firewall_shaper.php
+++ b/usr/local/www/firewall_shaper.php
@@ -39,7 +39,6 @@ if (!is_array($config['shaper']['queue'])) {
}
read_altq_config();
-
$tree = "<ul class=\"tree\" >";
if (is_array($altq_list_queues)) {
foreach ($altq_list_queues as $altq) {
@@ -88,19 +87,9 @@ if ($interface) {
} else $addnewaltq = true;
}
-$output = "<div id=\"shaperarea\" style=\"position:relative\">";
-if ($queue) {
-$output .= "<tr><td valign=\"top\" class=\"vncellreq\"><br>";
-$output .= "Enable/Disable";
-$output .= "</td><td class=\"vncellreq\">";
-$output .= " <input type=\"checkbox\" id=\"enabled\" name=\"enabled\"";
-if ($can_enable)
- $output .= " CHECKED";
-$output .= " ><span class=\"vexpl\"> Enable/Disable queue and its childs</span>";
-$output .= "</td></tr>";
-}
$dontshow = false;
$newqueue = false;
+$output_form = "";
if ($_GET) {
switch ($action) {
@@ -138,23 +127,23 @@ if ($_GET) {
if ($q) {
$q->SetInterface($interface);
- $output .= $q->build_form();
- $output .= "<input type=\"hidden\" name=\"parentqueue\" id=\"parentqueue\"";
- $output .= " value=\"".$qname."\">";
+ $output_form .= $q->build_form();
+ $output_form .= "<input type=\"hidden\" name=\"parentqueue\" id=\"parentqueue\"";
+ $output_form .= " value=\"".$qname."\">";
unset($q);
$newqueue = true;
}
break;
case "show":
if ($queue)
- $output .= $queue->build_form();
+ $output_form .= $queue->build_form();
else
$input_errors[] = "Queue not found!";
break;
case "enable":
if ($queue) {
$queue->SetEnabled("on");
- $output .= $queue->build_form();
+ $output_form .= $queue->build_form();
write_config();
touch($d_shaperconfdirty_path);
} else
@@ -163,14 +152,14 @@ if ($_GET) {
case "disable":
if ($queue) {
$queue->SetEnabled("");
- $output .= $queue->build_form();
+ $output_form .= $queue->build_form();
write_config();
touch($d_shaperconfdirty_path);
} else
$input_errors[] = "Queue not found!";
break;
default:
- $output .= "<p class=\"pgtitle\">" . $default_shaper_msg."</p>";
+ $output_form .= "<p class=\"pgtitle\">" . $default_shaper_msg."</p>";
$dontshow = true;
break;
}
@@ -180,74 +169,108 @@ if ($_GET) {
if ($addnewaltq) {
$altq =& new altq_root_queue();
$altq->SetInterface($interface);
+
+ switch ($altq->GetBwscale()) {
+ case "Mb":
+ $factor = 1000 * 1000;
+ brak;
+ case "Kb":
+ $factor = 1000;
+ break;
+ case "b":
+ $factor = 1;
+ break;
+ case "Gb":
+ $factor = 1000 * 1000 * 1000;
+ break;
+ case "%": /* We don't use it for root_XXX queues. */
+ default: /* XXX assume Kb by default. */
+ $factor = 1000;
+ break;
+ }
+ $altq->SetAvailableBandwidth($altq->GetBandwidth() * $factor);
$altq->ReadConfig($_POST);
- unset($tmppath);
- $tmppath[] = $altq->GetInterface();
- $altq->SetLink(&$tmppath);
- $altq->wconfig();
- $output .= $altq->build_form();
- write_config();
- touch($d_shaperconfdirty_path);
+ $altq->validate_input($_POST, &$input_errors);
+ if (!$input_errors) {
+ unset($tmppath);
+ $tmppath[] = $altq->GetInterface();
+ $altq->SetLink(&$tmppath);
+ $altq->wconfig();
+ write_config();
+ touch($d_shaperconfdirty_path);
+ $can_enable = true;
+ $can_add = true;
+ }
+ $output_form .= $altq->build_form();
+
} else if ($parentqueue) { /* Add a new queue */
$qtmp =& $altq->find_queue($interface, $parentqueue);
if ($qtmp) {
$tmppath =& $qtmp->GetLink();
array_push($tmppath, $qname);
- $tmp =& $qtmp->add_queue($interface, $_POST, &$tmppath);
- array_pop($tmppath);
- $output .= $tmp->build_form();
- $tmp->wconfig();
- $can_enable = true;
- if ($tmp->CanHaveChilds() && $can_enable)
- $can_add = true;
- else
- $can_add = false;
- write_config();
- touch($d_shaperconfdirty_path);
+ $tmp =& $qtmp->add_queue($interface, $_POST, &$tmppath, &$input_errors);
+ if (!$input_errors) {
+ array_pop($tmppath);
+ $tmp->wconfig();
+ $can_enable = true;
+ if ($tmp->CanHaveChilds() && $can_enable)
+ $can_add = true;
+ else
+ $can_add = false;
+ write_config();
+ touch($d_shaperconfdirty_path);
+ $can_enable = true;
+ if ($altq->GetScheduler() != "PRIQ") /* XXX */
+ $can_add = true;
+ }
+ $output_form .= $tmp->build_form();
} else
$input_errors[] = "Could not add new queue.";
} else if ($_POST['apply']) {
- write_config();
-
- $retval = 0;
- $savemsg = get_std_save_message($retval);
- /* Setup pf rules since the user may have changed the optimizat
-ion value */
- config_lock();
- $retval = filter_configure();
- config_unlock();
- if (stristr($retval, "error") <> true)
- $savemsg = get_std_save_message($retval);
- else
- $savemsg = $retval;
+ write_config();
+
+ $retval = 0;
+ $savemsg = get_std_save_message($retval);
+
+ config_lock();
+ $retval = filter_configure();
+ config_unlock();
+
+ if (stristr($retval, "error") <> true)
+ $savemsg = get_std_save_message($retval);
+ else
+ $savemsg = $retval;
enable_rrd_graphing();
unlink($d_shaperconfdirty_path);
- if ($queue)
- $output .= $queue->build_form();
- else
- $output .= $default_shaper_message;
+
+ if ($queue) {
+ $output_form .= $queue->build_form();
+ $dontshow = false;
+ }
+ else {
+ $output_form .= $default_shaper_message;
+ $dontshow = true;
+ }
- $dontshow = true;
-// header("Location: firewall_shaper.php");
- // exit;
} else if ($queue) {
$queue->validate_input($_POST, &$input_errors);
if (!$input_errors) {
- $queue->update_altq_queue_data($_POST);
- $queue->wconfig();
- $output .= $queue->build_form();
+ $queue->update_altq_queue_data($_POST);
+ $queue->wconfig();
write_config();
- touch($d_shaperconfdirty_path);
- } else
- $input_errors[] = "Could not complete the request.";
- } else
- $input_errors[] = "Ummmm nothing to do?!";
+ touch($d_shaperconfdirty_path);
+ $dontshow = false;
+ }
+ $output_form .= $queue->build_form();
+ } else {
+ $output_form .= "<p class=\"pgtitle\">" . $default_shaper_msg."</p>";
+ $dontshow = true;
+ }
} else {
- $output .= "<p class=\"pgtitle\">" . $default_shaper_msg."</p>";
+ $output_form .= "<p class=\"pgtitle\">" . $default_shaper_msg."</p>";
$dontshow = true;
-
}
@@ -255,57 +278,89 @@ ion value */
if (!$dontshow || $newqueue) {
-$output .= "<tr><td width=\"22%\" valign=\"top\" class=\"vncellreq\">";
-$output .= "Queue Actions";
-$output .= "</td><td valign=\"top\" class=\"vncellreq\" width=\"78%\">";
-
-$output .= "<input type=\"image\" src=\"";
-$output .= "./themes/".$g['theme']."/images/icons/icon_up.gif\"";
-$output .= " width=\"17\" height=\"17\" border=\"0\" title=\"Submit\" >";
+$output_form .= "<tr><td width=\"22%\" valign=\"top\" class=\"vncellreq\">";
+$output_form .= "Queue Actions";
+$output_form .= "</td><td valign=\"top\" class=\"vncellreq\" width=\"78%\">";
+/*
+$output_form .= "<input type=\"image\" src=\"";
+$output_form .= "./themes/".$g['theme']."/images/icons/icon_up.gif\"";
+$output_form .= " width=\"17\" height=\"17\" border=\"0\" title=\"Submit\" >";
+*/
+$output_form .= "<input type=\"submit\" name=\"Submit\" value=\"" . gettext("Save") . "\" class=\"formbtn\" />";
if ($can_add || $addnewaltq) {
- $output .= "<a href=\"firewall_shaper.php?interface=";
- $output .= $altq->GetInterface() . "&queue=";
- $output .= $queue->GetQname() . "&action=add\">";
- $output .= "<img src=\"";
- $output .= "./themes/".$g['theme']."/images/icons/icon_plus.gif\"";
- $output .= " width=\"17\" height=\"17\" border=\"0\" title=\"Add queue\">";
- $output .= "</a>";
- $output .= "<a href=\"firewall_shaper.php?interface=";
- $output .= $altq->GetInterface() . "&queue=";
- $output .= $queue->GetQname() . "&action=delete\">";
- $output .= "<img src=\"";
- $output .= "./themes/".$g['theme']."/images/icons/icon_minus.gif\"";
- $output .= " width=\"17\" height=\"17\" border=\"0\" title=\"Delete a queue\">";
- $output .= "</a>";
+ $output_form .= "<a href=\"firewall_shaper.php?interface=";
+ $output_form .= $interface;
+ if ($queue) {
+ $output_form .= "&queue=" . $queue->GetQname();
+ }
+ $output_form .= "&action=add\">";
+ $output_form .= "<img src=\"";
+ $output_form .= "./themes/".$g['theme']."/images/icons/icon_plus.gif\"";
+ $output_form .= " width=\"17\" height=\"17\" border=\"0\" title=\"Add queue\">";
+ $output_form .= "</a>";
+ $output_form .= "<a href=\"firewall_shaper.php?interface=";
+ $output_form .= $interface . "&queue=";
+ if ($queue) {
+ $output_form .= "&queue=" . $queue->GetQname();
+ }
+ $output_form .= "&action=delete\">";
+ $output_form .= "<img src=\"";
+ $output_form .= "./themes/".$g['theme']."/images/icons/icon_minus.gif\"";
+ $output_form .= " width=\"17\" height=\"17\" border=\"0\"";
+ if ($queue)
+ $output_form .= " title=\"Delete a queue\">";
+ else
+ $output_form .= " title=\"Disable shaper on interface\">";
+ $output_form .= "</a>";
}
-$output .= "</td></tr>";
-$output .= "</div>";
+$output_form .= "</td></tr>";
+$output_form .= "</div>";
}
else
- $output .= "</div>";
+ $output_form .= "</div>";
+
+$output = "<div id=\"shaperarea\" style=\"position:relative\">";
+if (!$dontshow) {
+if ($queue || $altq) {
+ $output .= "<tr><td valign=\"top\" class=\"vncellreq\"><br>";
+ $output .= "Enable/Disable";
+ $output .= "</td><td class=\"vncellreq\">";
+ $output .= " <input type=\"checkbox\" id=\"enabled\" name=\"enabled\"";
+ if ($queue)
+ if ($queue->GetEnabled())
+ $output .= " CHECKED";
+ else if ($altq)
+ if ($altq->GetEnabled())
+ $output .= " CHECKED";
+ $output .= " ><span class=\"vexpl\"> Enable/Disable queue and its childs</span>";
+ $output .= "</td></tr>";
+}
+}
+$output .= $output_form;
$pgtitle = "Firewall: Shaper: By Interface View";
include("head.inc");
-if ($queue) {
- echo "<script type=\"text/javascript\">";
- echo $queue->build_javascript();
- echo "</script>";
-}
?>
+
+<body link="#0000CC" vlink="#0000CC" alink="#0000CC" >
<link rel="stylesheet" type="text/css" media="all" href="./tree/tree.css" />
<script type="text/javascript" src="./tree/tree.js"></script>
+<?php
+if ($queue) {
+ echo "<script type=\"text/javascript\">";
+ echo $queue->build_javascript();
+ echo "</script>";
+}
-<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
-<?php include("fbegin.inc"); ?>
-<p class="pgtitle"><?=$pgtitle?></p>
+include("fbegin.inc");
+?>
<div id="inputerrors"></div>
<?php if ($input_errors) print_input_errors($input_errors); ?>
-<form action="firewall_shaper.php" method="post" name="form" id="form">
+<form action="firewall_shaper.php" method="post" id="iform" name="iform">
-<script type="text/javascript" language="javascript" src="row_toggle.js"></script>
<?php if ($savemsg) print_info_box($savemsg); ?>
<?php if (file_exists($d_shaperconfdirty_path)): ?><p>
<?php print_info_box_np("The traffic shaper configuration has been changed.<br>You must apply the changes in order for them to take effect.");?><br>
diff --git a/usr/local/www/firewall_shaper_queues.php b/usr/local/www/firewall_shaper_queues.php
index c08d00f..a9b0780 100755
--- a/usr/local/www/firewall_shaper_queues.php
+++ b/usr/local/www/firewall_shaper_queues.php
@@ -137,6 +137,16 @@ if ($_POST['apply']) {
unlink($d_shaperconfdirty_path);
}
+/* if this is an AJAX caller then handle via JSON */
+if(isAjax() && is_array($input_errors)) {
+ input_errors2Ajax($input_errors);
+ exit;
+}
+
+/* if ajax is calling, give them an update message */
+if(isAjax())
+ print_info_box_np($savemsg);
+
$pgtitle = "Firewall: Shaper: By Queues View";
include("head.inc");
@@ -144,9 +154,13 @@ include("head.inc");
<link rel="stylesheet" type="text/css" media="all" href="./tree/tree.css" />
<script type="text/javascript" src="./tree/tree.js"></script>
+<?
+/* put your custom HTML head content here */
+/* using some of the $pfSenseHead function calls */
+echo $pfSenseHead->getHTML();
+?>
<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
<?php include("fbegin.inc"); ?>
-<p class="pgtitle"><?=$pgtitle?></p>
<div id="inputerrors"></div>
<?php if ($input_errors) print_input_errors($input_errors); ?>
<form action="firewall_shaper_queues.php" method="post" name="iform" id="iform">
@@ -164,8 +178,8 @@ include("head.inc");
display_top_tabs($tab_array);
?>
</td></tr>
- <tr>
- <td>
+ <tr>
+ <td valign="top">
<div id="mainarea">
<table class="tabcont" width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
@@ -192,7 +206,6 @@ include("head.inc");
</table>
</td></tr>
- </table>
</div>
</td>
</tr>
diff --git a/usr/local/www/wizards/traffic_shaper_wizard.inc b/usr/local/www/wizards/traffic_shaper_wizard.inc
index bf3565e..3a74312 100644
--- a/usr/local/www/wizards/traffic_shaper_wizard.inc
+++ b/usr/local/www/wizards/traffic_shaper_wizard.inc
@@ -6,7 +6,7 @@
Copyright (C) 2006 Bill Marquette - bill.marquette@gmail.com.
Copyright (C) 2006 Scott Ullrich - sullrich@pfsense.com.
- Copyright (C) 2008 Ermal Lu\xe7i
+ Copyright (C) 2008 Ermal Lu<E7>i
All rights reserved.
Redistribution and use in source and binary forms, with or without
@@ -57,6 +57,10 @@ function step1_stepbeforeformdisplay() {
$field['typehint'] = "Queueing discipline to apply on this interface";
$field['options']['option'] = array();
$opts = array();
+ $opts['name'] = "NONE";
+ $opts['value'] = "NONE";
+ $field['options']['option'][] = $opts;
+ $opts = array();
$opts['name'] = "HFSC";
$opts['value'] = "HFSC";
$field['options']['option'][] = $opts;
@@ -97,18 +101,6 @@ function step1_stepbeforeformdisplay() {
conf_mount_ro();
}
-function step1_stepsubmitphpaction() {
- global $g, $config;
- /* wipe previous */
- if(isset($config['shaper']['queue']))
- unset($config['shaper']['queue']);
- if(isset($config['shaper']['rule']))
- unset($config['shaper']['rule']);
- foreach ($config['filter']['rule'] as $key => $rule)
- if ($rule['wizard'] == "yes")
- unset($config['filter']['rule'][$key]);
- write_config();
-}
function step2_stepsubmitphpaction() {
global $config;
@@ -118,9 +110,49 @@ function step2_stepsubmitphpaction() {
continue;
if (!isset($ifdesc['enable']) && $if != "lan" && $if != "wan")
continue;
- if (isset($_POST['bandwidth']) && $_POST['bandwidth'] < 128) {
- $message=gettext("We do not support Bandwidths smaller than 128Kbit/s. Please correct this value to continue.");
- header("Location: /wizard.php?xml=traffic_shaper_wizard.xml&stepid=2&message={$message}");
+ if ($_POST["{$if}scheduler"] == "PRIQ" && !isset($_POST[$if]))
+ continue;
+ if ($_POST["{$if}scheduler"] == "NONE")
+ continue;
+ if (!isset($_POST[$if]) && $_POST["{$if}scheduler"] == "NONE") {
+ $message=gettext("Please specify the bandwidth for interface {$if}.");
+ header("Location: wizard.php?xml=traffic_shaper_wizard.xml&stepid=1&message={$message}");
+ // exit;
+ }
+ if (isset($_POST[$if])) {
+ switch ($ifdesc['banwidthtype']) {
+ case "Mb":
+ $factor = 1000;
+ brak;
+ case "Kb":
+ $factor = 1;
+ break;
+ case "b":
+ $factor = 1/1000;
+ break;
+ case "Gb":
+ $factor = 1000 * 1000;
+ break;
+ default: /* XXX */
+ $factor = 1;
+ break;
+ }
+ if (intval($_POST[$if]) < 128 && trim($_POST["{$if}scheduler"]) == "CBQ") {
+ $message=gettext("We do not support Bandwidths smaller than 128Kbit/s for CBQ scheduler. Please correct this value to continue.");
+ header("Location: wizard.php?xml=traffic_shaper_wizard.xml&stepid=1&message={$message}");
+ // exit;
+ }
+ else if(!is_numeric($_POST[$if]) && trim($_POST["{$if}scheduler"]) != "PRIQ") {
+ $message="You need to specify a value for bandwidth of {$if}!";
+ header("Location: wizard.php?xml=traffic_shaper_wizard.xml&stepid=1&message={$message}");
+ // exit;
+ }
+/* else if ($_POST[$if] <> "" && $ifdesc['bandwidth'] * $factor < intval($_POST[$if])) {
+ $message=gettext("You cannot set the bandwidth higher than the bandwidth of the interface. Please correct this value to continue.");
+ header("Location: wizard.php?xml=traffic_shaper_wizard.xml&stepid=1&message={$message}");
+ exit;
+ }
+*/
}
}
@@ -132,32 +164,50 @@ function step3_stepsubmitphpaction() {
if(!is_alias($_POST['address'])) {
/* item is not an ip or alias. error out */
$message=gettext("Address must be a valid IP address or Firewall Alias. Please correct this value to continue.");
- header("Location: /wizard.php?xml=traffic_shaper_wizard.xml&stepid=3&message={$message}");
-
+ header("Location: wizard.php?xml=traffic_shaper_wizard.xml&stepid=2&message={$message}");
+ exit;
}
}
}
+ if (isset($_POST['bandwidth'])) {
+ if ($_POST['bandwidth'] <> "") {
+ if (!is_numeric($_POST['bandwidth'])) {
+ $message=gettext("Bandwidth should be a number.");
+ header("Location: wizard.php?xml=traffic_shaper_wizard.xml&stepid=2&message={$message}");
+ exit;
+ }
+ if (intval($_POST['bandwidth']) > 40 || intval($_POST['bandwidth']) < 5) {
+ $message=gettext("Bandwidth should be between 5% and 40% for the wizard to work correctly.");
+ header("Location: wizard.php?xml=traffic_shaper_wizard.xml&stepid=2&message={$message}");
+ exit;
+ }
+ }
+ }
}
function step4_stepsubmitphpaction() {
if ( $_POST['enable'] ) {
if(!is_numeric($_POST['bandwidth'])) {
$message="Speed must be a number only! Values should be in percentage.";
- header("Location: /wizard.php?xml=traffic_shaper_wizard.xml&stepid=4&message={$message}");
+ header("Location: wizard.php?xml=traffic_shaper_wizard.xml&stepid=3&message={$message}");
exit;
}
if(!$_POST['bandwidth']) {
$message="You need to specify a value for bandwidth! Values should be in percentage.";
- header("Location: /wizard.php?xml=traffic_shaper_wizard.xml&stepid=4&message={$message}");
+ header("Location: wizard.php?xml=traffic_shaper_wizard.xml&stepid=3&message={$message}");
exit;
}
- if(!is_ipaddr($_POST['address'])) {
+ if (intval($_POST['bandwidth']) > 15 || intval($_POST['bandwidth']) < 5) {
+ $message=gettext("Bandwidth should be between 5% and 15% for the wizard to work correctly.");
+ header("Location: wizard.php?xml=traffic_shaper_wizard.xml&stepid=3&message={$message}");
+ exit;
+ }
+ if($_POST['address'] <> "" && !is_ipaddr($_POST['address'])) {
if(!is_alias($_POST['address'])) {
/* item is not an ip or alias. error out */
$message=gettext("Address must be a valid IP address or Firewall Alias. Please correct this value to continue.");
- header("Location: /wizard.php?xml=traffic_shaper_wizard.xml&stepid=4&message={$message}");
- exit;
- }
+ header("Location: wizard.php?xml=traffic_shaper_wizard.xml&stepid=3&message={$message}");
+ }
}
}
@@ -165,25 +215,31 @@ function step4_stepsubmitphpaction() {
function step5_stepsubmitphpaction() {
if ( $_POST['enable'] ) {
- if (( $_POST['bandwidth'] )) {
+ if (isset($_POST['bandwidth'])) {
if(!is_numeric($_POST['bandwidth'])) {
$message="Speed must be a number only! Values should be in percentage.";
- header("Location: /wizard.php?xml=traffic_shaper_wizard.xml&stepid=4&message={$message}");
- exit;
+ header("Location: wizard.php?xml=traffic_shaper_wizard.xml&stepid=4&message={$message}");
+
}
- }
- }
+ if (intval($_POST['bandwidth']) > 10 || intval($_POST['bandwidth']) < 5) {
+ $message=gettext("Bandwidth should be between 5% and 10% for the wizard to work correctly.");
+ header("Location: wizard.php?xml=traffic_shaper_wizard.xml&stepid=4&message={$message}");
+ }
+ } else {
+ if(!$_POST['bandwidth']) {
+ $message="You need to specify a value for bandwidth! Values should be in percentage.";
+ header("Location: wizard.php?xml=traffic_shaper_wizard.xml&stepid=4&message={$message}");
+ }
+ }
+ }
}
function step8_stepsubmitphpaction() {
global $g, $config, $d_shaperconfdirty_path;
- /* Prepare for next ezshaper wizard run */
- unset($config['shaper']['itemsshaped']);
-
- /* create configuration */
+ /* save the new configuration */
apply_all_choosen_items();
/* reset rrd queues */
@@ -191,7 +247,7 @@ function step8_stepsubmitphpaction() {
system("rm -f /var/db/rrd/wan-queues.rrd");
enable_rrd_graphing();
- /* Create new rules */
+ /* apply the new configuration to the system */
filter_configure();
/* And we're no longer dirty! */
@@ -204,7 +260,7 @@ function step8_stepsubmitphpaction() {
}
function step9_stepsubmitphpaction() {
global $g, $config;
- header("Location: status_filter_reload.php");
+ header("status_filter_reload.php");
}
function apply_all_choosen_items() {
@@ -213,166 +269,152 @@ function apply_all_choosen_items() {
$gamesplist = array();
$gamesplist['battlefield2'] = array();
- /* Battlefield 2 */
- $gamesplist['battlefield2'][] = array('BF2-1500-4999', 'udp', '1500', '4999', 'both');
- $gamesplist['battlefield2'][] = array('BF2-4711', 'tcp', '4711', '4711', 'both');
- $gamesplist['battlefield2'][] = array('BF2-16567', 'udp', '16567', '16567', 'both');
- $gamesplist['battlefield2'][] = array('BF2-27900', 'udp', '27900', '27900', 'both');
- $gamesplist['battlefield2'][] = array('BF2-28910', 'tcp', '28910', '28910', 'both');
- $gamesplist['battlefield2'][] = array('BF2-29900-29901-UDP', 'udp', '29900', '29901', 'both');
- $gamesplist['battlefield2'][] = array('BF2-29900-29901-TCP', 'tcp', '29900', '29901', 'both');
- $gamesplist['battlefield2'][] = array('BF2-27900', 'udp', '27900', '27900', 'both');
- $gamesplist['battlefield2'][] = array('BF2-55123-55125', 'udp', '55123', '55125', 'both');
+ /* Battlefield 2 */
+ $gamesplist['battlefield2'][] = array('BF2-1500-4999', 'udp', '1500', '4999', 'both');
+ $gamesplist['battlefield2'][] = array('BF2-4711', 'tcp', '4711', '4711', 'both');
+ $gamesplist['battlefield2'][] = array('BF2-16567', 'udp', '16567', '16567', 'both');
+ $gamesplist['battlefield2'][] = array('BF2-27900', 'udp', '27900', '27900', 'both');
+ $gamesplist['battlefield2'][] = array('BF2-28910', 'tcp', '28910', '28910', 'both');
+ $gamesplist['battlefield2'][] = array('BF2-29900-29901-UDP', 'udp', '29900', '29901', 'both');
+ $gamesplist['battlefield2'][] = array('BF2-29900-29901-TCP', 'tcp', '29900', '29901', 'both');
+ $gamesplist['battlefield2'][] = array('BF2-27900', 'udp', '27900', '27900', 'both');
+ $gamesplist['battlefield2'][] = array('BF2-55123-55125', 'udp', '55123', '55125', 'both');
$gamesplist['counterstrike'] = array();
- /* counter strike */
- $gamesplist['counterstrike'][] = array('Titan', 'udp', '6003', '6003', 'both');
- $gamesplist['counterstrike'][] = array('Authentication', 'udp', '7002', '7002', 'both');
- $gamesplist['counterstrike'][] = array('Client', 'udp', '6003', '6003', 'both');
- $gamesplist['counterstrike'][] = array('Masterserver', 'udp', '27010', '27010', 'both');
- $gamesplist['counterstrike'][] = array('Mod-Server', 'udp', '27011', '27011', 'both');
- $gamesplist['counterstrike'][] = array('Chat', 'udp', '27012', '27012', 'both');
- $gamesplist['counterstrike'][] = array('HL-Serverport1', 'udp', '27013', '27013', 'both');
- $gamesplist['counterstrike'][] = array('HL-Serverport2', 'udp', '27014', '27014', 'both');
- $gamesplist['counterstrike'][] = array('HL-Serverport', 'udp', '27015', '27015', 'both');
+ /* counter strike */
+ $gamesplist['counterstrike'][] = array('Titan', 'udp', '6003', '6003', 'both');
+ $gamesplist['counterstrike'][] = array('Authentication', 'udp', '7002', '7002', 'both');
+ $gamesplist['counterstrike'][] = array('Client', 'udp', '6003', '6003', 'both');
+ $gamesplist['counterstrike'][] = array('Masterserver', 'udp', '27010', '27010', 'both');
+ $gamesplist['counterstrike'][] = array('Mod-Server', 'udp', '27011', '27011', 'both');
+ $gamesplist['counterstrike'][] = array('Chat', 'udp', '27012', '27012', 'both');
+ $gamesplist['counterstrike'][] = array('HL-Serverport1', 'udp', '27013', '27013', 'both');
+ $gamesplist['counterstrike'][] = array('HL-Serverport2', 'udp', '27014', '27014', 'both');
+ $gamesplist['counterstrike'][] = array('HL-Serverport', 'udp', '27015', '27015', 'both');
$gamesplist['deltaforce'] = array();
- /* delta force */
- $gamesplist['deltaforce'][] = array('Delta1', 'udp', '17478', '17488', 'both');
-
+ /* delta force */
+ $gamesplist['deltaforce'][] = array('Delta1', 'udp', '17478', '17488', 'both');
$gamesplist['quakeiii'] = array();
- /* quake3 */
- $gamesplist['quakeiii'][] = array('quakeiii', 'udp', '27910', '27919', 'both');
-
+ /* quake3 */
+ $gamesplist['quakeiii'][] = array('quakeiii', 'udp', '27910', '27919', 'both');
$gamesplist['tigerwoods2004ps2'] = array();
- /* tiger woods 2004 ps2 */
- $gamesplist['tigerwoods2004ps2'][] = array('Outbound2Player', 'udp', '3658', '3658', 'both');
- $gamesplist['tigerwoods2004ps2'][] = array('Outbound2Player2', 'udp', '6000', '6000', 'both');
- $gamesplist['tigerwoods2004ps2'][] = array('Outbound2EA', 'tcp', '10300', '10301', 'both');
-
+ /* tiger woods 2004 ps2 */
+ $gamesplist['tigerwoods2004ps2'][] = array('Outbound2Player', 'udp', '3658', '3658', 'both');
+ $gamesplist['tigerwoods2004ps2'][] = array('Outbound2Player2', 'udp', '6000', '6000', 'both');
+ $gamesplist['tigerwoods2004ps2'][] = array('Outbound2EA', 'tcp', '10300', '10301', 'both');
$gamesplist['callofduty'] = array();
- $gamesplist['callofduty'][] = array('CallOfDuty1', 'tcp', '28960', '28960', 'both');
- $gamesplist['callofduty'][] = array('CallOfDuty2', 'udp', '28960', '28960', 'both');
-
+ $gamesplist['callofduty'][] = array('CallOfDuty1', 'tcp', '28960', '28960', 'both');
+ $gamesplist['callofduty'][] = array('CallOfDuty2', 'udp', '28960', '28960', 'both');
$gamesplist['planetside'] = array();
- /* PlanetSide */
- $gamesplist['planetside'][] = array('PlanetSide', 'tcp', '7000', '7000', 'both');
- $gamesplist['planetside'][] = array('PlanetSide', 'tcp', '7080', '7080', 'both');
- $gamesplist['planetside'][] = array('PlanetSide2', 'udp', '3016', '3021', 'both');
- $gamesplist['planetside'][] = array('PlanetSide2', 'udp', '45000', '45010', 'both');
- $gamesplist['planetside'][] = array('PlanetSide2', 'udp', '30000', '30500', 'both');
-
+ /* PlanetSide */
+ $gamesplist['planetside'][] = array('PlanetSide', 'tcp', '7000', '7000', 'both');
+ $gamesplist['planetside'][] = array('PlanetSide', 'tcp', '7080', '7080', 'both');
+ $gamesplist['planetside'][] = array('PlanetSide2', 'udp', '3016', '3021', 'both');
+ $gamesplist['planetside'][] = array('PlanetSide2', 'udp', '45000', '45010', 'both');
+ $gamesplist['planetside'][] = array('PlanetSide2', 'udp', '30000', '30500', 'both');
$gamesplist['halo2'] = array();
- /* Halo2 + XBOX Live */
- $gamesplist['halo2'][] = array('Halo2-1', 'udp', '88', '88', 'both');
- $gamesplist['halo2'][] = array('Halo2-2', 'udp', '3074', '3074', 'both');
- $gamesplist['halo2'][] = array('Halo2-3', 'tcp', '3074', '3074', 'both');
-
+ /* Halo2 + XBOX Live */
+ $gamesplist['halo2'][] = array('Halo2-1', 'udp', '88', '88', 'both');
+ $gamesplist['halo2'][] = array('Halo2-2', 'udp', '3074', '3074', 'both');
+ $gamesplist['halo2'][] = array('Halo2-3', 'tcp', '3074', '3074', 'both');
$gamesplist['unrealtournament'] = array();
- /* Unreal Tournament */
- $gamesplist['unrealtournament'][] = array('ur1', 'udp', '7777', '7787', 'both');
- $gamesplist['unrealtournament'][] = array('ur2', 'tcp', '7777', '7787', 'both');
-
+ /* Unreal Tournament */
+ $gamesplist['unrealtournament'][] = array('ur1', 'udp', '7777', '7787', 'both');
+ $gamesplist['unrealtournament'][] = array('ur2', 'tcp', '7777', '7787', 'both');
$gamesplist['doom3'] = array();
- /* doom3 */
- $gamesplist['doom3'][] = array('DOOM3-1', 'udp', '27650', '27650', 'both');
- $gamesplist['doom3'][] = array('DOOM3-2', 'udp', '27666', '27666', 'both');
-
+ /* doom3 */
+ $gamesplist['doom3'][] = array('DOOM3-1', 'udp', '27650', '27650', 'both');
+ $gamesplist['doom3'][] = array('DOOM3-2', 'udp', '27666', '27666', 'both');
$gamesplist['empireearth'] = array();
- /* empire earth */
- $gamesplist['empireearth'][] = array('EmpireEarth-1', 'tcp', '33335', '33336', 'both');
- $gamesplist['empireearth'][] = array('EmpireEarth-2', 'udp', '33334', '33334', 'both');
-
+ /* empire earth */
+ $gamesplist['empireearth'][] = array('EmpireEarth-1', 'tcp', '33335', '33336', 'both');
+ $gamesplist['empireearth'][] = array('EmpireEarth-2', 'udp', '33334', '33334', 'both');
$gamesplist['everquest'] = array();
- /* everquest */
- $gamesplist['everquest'][] = array('Everquest-1', 'tcp', '1024', '6000', 'both');
- $gamesplist['everquest'][] = array('Everquest-2', 'tcp', '7000', '7000', 'both');
- $gamesplist['everquest'][] = array('Everquest-3', 'udp', '1024', '6000', 'both');
- $gamesplist['everquest'][] = array('Everquest-4', 'udp', '7000', '7000', 'both');
-
+ /* everquest */
+ $gamesplist['everquest'][] = array('Everquest-1', 'tcp', '1024', '6000', 'both');
+ $gamesplist['everquest'][] = array('Everquest-2', 'tcp', '7000', '7000', 'both');
+ $gamesplist['everquest'][] = array('Everquest-3', 'udp', '1024', '6000', 'both');
+ $gamesplist['everquest'][] = array('Everquest-4', 'udp', '7000', '7000', 'both');
$gamesplist['everquest2'] = array();
- /* everquest2 */
- $gamesplist['everquest2'][] = array('Everquest2-1', 'tcp', '7000', '7000', 'both');
- $gamesplist['everquest2'][] = array('Everquest2-2', 'udp', '3016', '3021', 'both');
- $gamesplist['everquest2'][] = array('Everquest2-3', 'udp', '9100', '9100', 'both');
- $gamesplist['everquest2'][] = array('Everquest2-4', 'udp', '9700', '9703', 'both');
- $gamesplist['everquest2'][] = array('Everquest2-5', 'udp', '32800', '33000', 'both');
-
+ /* everquest2 */
+ $gamesplist['everquest2'][] = array('Everquest2-1', 'tcp', '7000', '7000', 'both');
+ $gamesplist['everquest2'][] = array('Everquest2-2', 'udp', '3016', '3021', 'both');
+ $gamesplist['everquest2'][] = array('Everquest2-3', 'udp', '9100', '9100', 'both');
+ $gamesplist['everquest2'][] = array('Everquest2-4', 'udp', '9700', '9703', 'both');
+ $gamesplist['everquest2'][] = array('Everquest2-5', 'udp', '32800', '33000', 'both');
$gamesplist['farcry'] = array();
- /* far cry */
- $gamesplist['farcry'][] = array('FarCry-1', 'tcp', '49001', '49002', 'both');
- $gamesplist['farcry'][] = array('FarCry-2', 'udp', '49001', '49002', 'both');
-
+ /* far cry */
+ $gamesplist['farcry'][] = array('FarCry-1', 'tcp', '49001', '49002', 'both');
+ $gamesplist['farcry'][] = array('FarCry-2', 'udp', '49001', '49002', 'both');
$gamesplist['halflife2'] = array();
- /* halflife 2 */
- $gamesplist['halflife2'][] = array('HL2-1', 'tcp', '27020', '27050', 'both');
- $gamesplist['halflife2'][] = array('HL2-2', 'udp', '1200', '1200', 'both');
- $gamesplist['halflife2'][] = array('HL2-3', 'udp', '27000', '27015', 'both');
-
+ /* halflife 2 */
+ $gamesplist['halflife2'][] = array('HL2-1', 'tcp', '27020', '27050', 'both');
+ $gamesplist['halflife2'][] = array('HL2-2', 'udp', '1200', '1200', 'both');
+ $gamesplist['halflife2'][] = array('HL2-3', 'udp', '27000', '27015', 'both');
$gamesplist['halflife'] = array();
- /* halflife */
- $gamesplist['halflife'][] = array('HL-1', 'tcp', '27015', '27015', 'both');
- $gamesplist['halflife'][] = array('HL-2', 'udp', '27650', '27650', 'both');
- $gamesplist['halflife'][] = array('HL-3', 'udp', '27666', '27666', 'both');
-
+ /* halflife */
+ $gamesplist['halflife'][] = array('HL-1', 'tcp', '27015', '27015', 'both');
+ $gamesplist['halflife'][] = array('HL-2', 'udp', '27650', '27650', 'both');
+ $gamesplist['halflife'][] = array('HL-3', 'udp', '27666', '27666', 'both');
$gamesplist['wolfet'] = array();
- /* wolfenstein enemy territory */
- $gamesplist['wolfet'][] = array('WolfET-1', 'tcp', '27960', '27960', 'both');
-
+ /* wolfenstein enemy territory */
+ $gamesplist['wolfet'][] = array('WolfET-1', 'tcp', '27960', '27960', 'both');
$gamesplist['lineage2'] = array();
- /* Lineage II */
- $gamesplist['lineage2'][] = array('Lineage2-2009', 'tcp', '2009', '2009', 'both');
- $gamesplist['lineage2'][] = array('Lineage2-2106', 'tcp', '2106', '2106', 'both');
- $gamesplist['lineage2'][] = array('Lineage2-7777', 'tcp', '7777', '7777', 'both');
+ /* Lineage II */
+ $gamesplist['lineage2'][] = array('Lineage2-2009', 'tcp', '2009', '2009', 'both');
+ $gamesplist['lineage2'][] = array('Lineage2-2106', 'tcp', '2106', '2106', 'both');
+ $gamesplist['lineage2'][] = array('Lineage2-7777', 'tcp', '7777', '7777', 'both');
+
$gamesplist['battlenet'] = array();
- /* Blizzard Publishing games */
- $gamesplist['battlenet'][] = array('Battle.NET', 'tcp', '6112', '6119', 'both');
-/* World of WarCract */
+ /* Blizzard Publishing games */
+ $gamesplist['battlenet'][] = array('Battle.NET', 'tcp', '6112', '6119', 'both');
+
$gamesplist['worldofwarcraft'] = array();
- $gamesplist[] = array('WoW', 'tcp', '3724', '3724', 'both');
+ $gamesplist[] = array('WoW', 'tcp', '3724', '3724', 'both');
-/* Add battle.net only if WoW is selected and battle.net isn't */
$gamesplist['battlenet'] = array();
- $gamesplist[] = array('Battle.NET', 'tcp', '6112', '6119', 'both');
+ /* Add battle.net only if WoW is selected and battle.net isn't */
+ $gamesplist[] = array('Battle.NET', 'tcp', '6112', '6119', 'both');
-/* ArchLord */
$gamesplist['archlord'] = array();
- $gamesplist[] = array('AL-1', 'tcp', '11000', '11000', 'both');
- $gamesplist[] = array('AL-2', 'tcp', '11002', '11002', 'both');
- $gamesplist[] = array('AL-3', 'tcp', '11008', '11008', 'both');
+ /* ArchLord */
+ $gamesplist[] = array('AL-1', 'tcp', '11000', '11000', 'both');
+ $gamesplist[] = array('AL-2', 'tcp', '11002', '11002', 'both');
+ $gamesplist[] = array('AL-3', 'tcp', '11008', '11008', 'both');
-/* GunZ Online */
$gamesplist['gunzonline'] = array();
- $gamesplist['gunzonline'][] = array('GunZOnline', 'udp', '7700', '7700', 'both');
+ /* GunZ Online */
+ $gamesplist['gunzonline'][] = array('GunZOnline', 'udp', '7700', '7700', 'both');
-/* XBox360 */
$gamesplist['xbox360'] = array();
- $gamesplist['xbox360'][] = array('xbox360-1', 'udp', '88', '88', 'both');
- $gamesplist['xbox360'][] = array('xbox360-2', 'udp', '3074', '3074', 'both');
- $gamesplist['xbox360'][] = array('xbox360-3', 'tcp', '3074', '3074', 'both');
+ /* XBox360 */
+ $gamesplist['xbox360'][] = array('xbox360-1', 'udp', '88', '88', 'both');
+ $gamesplist['xbox360'][] = array('xbox360-2', 'udp', '3074', '3074', 'both');
+ $gamesplist['xbox360'][] = array('xbox360-3', 'tcp', '3074', '3074', 'both');
$voiplist = array();
/* asterisk server / same as vonage */
$voiplist['Asterisk'] = array();
- $voiplist['Asterisk'][] = array($_POST['provider'], 'udp', '5060', '5069', 'both');
- $voiplist['Asterisk'][] = array($_POST['provider'], 'udp', '10000', '20000', 'both');
+ $voiplist['Asterisk'][] = array($_POST['provider'], 'udp', '5060', '5069', 'both');
+ $voiplist['Asterisk'][] = array($_POST['provider'], 'udp', '10000', '20000', 'both');
/* VoicePulse server */
$voiplist['VoicePulse'] = array();
@@ -387,171 +429,186 @@ $voiplist['Panasonic'] = array();
$p2plist = array();
- /* To add p2p clients, push Descr,Protocol,Start,End,src/dest/both onto p2plist */
- $p2plist['aimster'] = array();
- $p2plist['aimster'][] = array('Aimster', 'tcp', '7668', '7668', 'both');
- $p2plist['bittorrent'] = array();
- $p2plist['bittorrent'][] = array('BitTorrent', 'tcp', '6881', '6999', 'both');
- $p2plist['bittorrent'][] = array('BitTorrent', 'udp', '6881', '6999', 'both');
- $p2plist['buddyshare'] = array();
- $p2plist['buddyshare'][] = array('BuddyShare', 'tcp', '7788', '7788', 'both');
- $p2plist['cutemx'] = array();
- $p2plist['cutemx'][] = array('CuteMX', 'tcp', '2340', '2340', 'both');
- $p2plist['dc++'] = array();
- $p2plist['dc++'][] = array('DC++', 'tcp', '1412', '1412', 'both');
- $p2plist['dcc'] = array();
- $p2plist['dcc'][] = array('dcc', 'tcp', '6666', '6668', 'both');
- $p2plist['directconnect'] = array();
- $p2plist['directconnect'][] = array('DirectConnect', 'tcp', '412', '412', 'both');
- $p2plist['directfileexpress'] = array();
- $p2plist['directfileexpress'][] = array('DirectFileExpress', 'tcp', '1044', '1045', 'both');
- $p2plist['edonkey2000'] = array();
- $p2plist['edonkey2000'][] = array('EDonkey2000', 'tcp', '4661', '4665', 'both');
- $p2plist['fastTrack'] = array();
- $p2plist['fastTrack'][] = array('FastTrack', 'tcp', '1214', '1214', 'both');
- $p2plist['gnutella'] = array();
- $p2plist['gnutella'][] = array('Gnutella-TCP', 'tcp', '6346', '6346', 'both');
- $p2plist['gnutella'][] = array('Gnutella-UDP', 'udp', '6346', '6346', 'both');
- $p2plist['grouper'] = array();
- $p2plist['grouper'][] = array('grouper', 'tcp', '8038', '8039', 'both');
- $p2plist['hotcomm'] = array();
- $p2plist['hotcomm'][] = array('hotComm', 'tcp', '28864', '28865', 'both');
- $p2plist['hotlineconnect'] = array();
- $p2plist['hotlineconnect'][] = array('HotlineConnect', 'tcp', '5500', '5503', 'both');
- $p2plist['imesh'] = array();
- $p2plist['imesh'][] = array('iMesh', 'tcp', '4329', '4329', 'both');
- $p2plist['napster'] = array();
- $p2plist['napster'][] = array('Napster', 'tcp', '6699', '6701', 'both');
- $p2plist['opennap'] = array();
- $p2plist['opennap'][] = array('OpenNap', 'tcp', '8888', '8889', 'both');
- $p2plist['scour'] = array();
- $p2plist['scour'][] = array('Scour', 'tcp', '8311', '8311', 'both');
- $p2plist['shareaza'] = array();
- $p2plist['shareaza'][] = array('Shareaza', 'tcp', '6346', '6346', 'both');
- $p2plist['songspy'] = array();
- $p2plist['songspy'][] = array('SongSpy', 'tcp', '5190', '5190', 'both');
- $p2plist['winmx'] = array();
- $p2plist['winmx'][] = array('WinMX', 'tcp', '6699', '6699', 'both');
+ /* To add p2p clients, push Descr,Protocol,Start,End,src/dest/both onto p2plist */
+ $p2plist['aimster'] = array();
+ $p2plist['aimster'][] = array('Aimster', 'tcp', '7668', '7668', 'both');
+ $p2plist['bittorrent'] = array();
+ $p2plist['bittorrent'][] = array('BitTorrent', 'tcp', '6881', '6999', 'both');
+ $p2plist['bittorrent'][] = array('BitTorrent', 'udp', '6881', '6999', 'both');
+ $p2plist['buddyshare'] = array();
+ $p2plist['buddyshare'][] = array('BuddyShare', 'tcp', '7788', '7788', 'both');
+ $p2plist['cutemx'] = array();
+ $p2plist['cutemx'][] = array('CuteMX', 'tcp', '2340', '2340', 'both');
+ $p2plist['dc++'] = array();
+ $p2plist['dc++'][] = array('DC++', 'tcp', '1412', '1412', 'both');
+ $p2plist['dcc'] = array();
+ $p2plist['dcc'][] = array('dcc', 'tcp', '6666', '6668', 'both');
+ $p2plist['directconnect'] = array();
+ $p2plist['directconnect'][] = array('DirectConnect', 'tcp', '412', '412', 'both');
+ $p2plist['directfileexpress'] = array();
+ $p2plist['directfileexpress'][] = array('DirectFileExpress', 'tcp', '1044', '1045', 'both');
+ $p2plist['edonkey2000'] = array();
+ $p2plist['edonkey2000'][] = array('EDonkey2000', 'tcp', '4661', '4665', 'both');
+ $p2plist['fastTrack'] = array();
+ $p2plist['fastTrack'][] = array('FastTrack', 'tcp', '1214', '1214', 'both');
+ $p2plist['gnutella'] = array();
+ $p2plist['gnutella'][] = array('Gnutella-TCP', 'tcp', '6346', '6346', 'both');
+ $p2plist['gnutella'][] = array('Gnutella-UDP', 'udp', '6346', '6346', 'both');
+ $p2plist['grouper'] = array();
+ $p2plist['grouper'][] = array('grouper', 'tcp', '8038', '8039', 'both');
+ $p2plist['hotcomm'] = array();
+ $p2plist['hotcomm'][] = array('hotComm', 'tcp', '28864', '28865', 'both');
+ $p2plist['hotlineconnect'] = array();
+ $p2plist['hotlineconnect'][] = array('HotlineConnect', 'tcp', '5500', '5503', 'both');
+ $p2plist['imesh'] = array();
+ $p2plist['imesh'][] = array('iMesh', 'tcp', '4329', '4329', 'both');
+ $p2plist['napster'] = array();
+ $p2plist['napster'][] = array('Napster', 'tcp', '6699', '6701', 'both');
+ $p2plist['opennap'] = array();
+ $p2plist['opennap'][] = array('OpenNap', 'tcp', '8888', '8889', 'both');
+ $p2plist['scour'] = array();
+ $p2plist['scour'][] = array('Scour', 'tcp', '8311', '8311', 'both');
+ $p2plist['shareaza'] = array();
+ $p2plist['shareaza'][] = array('Shareaza', 'tcp', '6346', '6346', 'both');
+ $p2plist['songspy'] = array();
+ $p2plist['songspy'][] = array('SongSpy', 'tcp', '5190', '5190', 'both');
+ $p2plist['winmx'] = array();
+ $p2plist['winmx'][] = array('WinMX', 'tcp', '6699', '6699', 'both');
$othersplist = array();
- /* Unlike other areas we are posting the queue H or L or BLANK */
-
- $othersplist['msrdp'] = array();
- /* MSRDP */
- $othersplist['msrdp'][] = array('MSRDP', 'tcp', '3389', '3389', 'both');
- $othersplist['pptp'] = array();
- /* PPTP */
- $othersplist['pptp'][] = array('PPTP', 'tcp', '1723', '1723', 'both');
- $othersplist['pptp'][] = array('PPTPGRE', 'gre', '', '', 'both');
- $othersplist['ipsec'] = array();
- /* IPSEC */
- $othersplist['ipsec'][] = array('IPSEC', 'udp', '500', '500', 'both');
- $othersplist['ipsec'][] = array('IPSEC', 'ah', '', '', 'both');
- $othersplist['ipsec'][] = array('IPSEC', 'esp', '', '', 'both');
- $othersplist['streamingmp3'] = array();
- /* streaming mp3 media aka shoutcast */
- $othersplist['streamingmp3'][] = array('STREAMINGMP3', 'tcp', '8000', '8100', 'both');
- $othersplist['irc'] = array();
- /* internet relay chat */
- $othersplist['irc'][] = array('IRC', 'tcp', '6667', '6670', 'both');
- $othersplist['jabber'] = array();
- /* jabber */
- $othersplist['jabber'][] = array('IRC', 'tcp', '5222', '5222', 'both');
- $othersplist['jabber'][] = array('IRC', 'tcp', '5223', '5223', 'both');
- $othersplist['jabber'][] = array('IRC', 'tcp', '5269', '5269', 'both');
- $othersplist['dns'] = array();
- /* domain name system */
- $othersplist['dns'][] = array('DNS1', 'tcp', '53', '53', 'both');
- $othersplist['dns'][] = array('DNS2', 'udp', '53', '53', 'both');
- $othersplist['http'] = array();
- /* HTTP aka Web Traffic */
- $othersplist['http'][] = array('HTTP', 'tcp', '80', '80', 'both');
- $othersplist['http'][] = array('HTTPS', 'tcp', '443', '443', 'both');
- $othersplist['smtp'] = array();
- /* Secure shell traffic */
- $othersplist['smtp'][] = array('SMTP', 'tcp', '25', '25', 'both');
- $othersplist['pop3'] = array();
- /* Post Office Protocol - POP3 */
- $othersplist['pop3'][] = array('POP3', 'tcp', '110', '110', 'both');
- $othersplist['icmp'] = array();
- /* ICMP */
- $othersplist['icmp'][] = array('ICMP', 'icmp', '', '', 'both');
- $othersplist['imap'] = array();
- /* IMAP */
- $othersplist['imap'][] = array('IMAP', 'tcp', '143', '143', 'both');
- $othersplist['smb'] = array();
- /* Microsoft SMB and friends */
- $othersplist['smb'][] = array('SMB1', 'tcp', '445', '445', 'both');
- $othersplist['smb'][] = array('SMB2', 'tcp', '137-139', '137-139', 'both');
- $othersplist['rtsp'] = array();
- /* realtime streaming protocol */
- $othersplist['rtsp'][] = array('RTSP1', 'tcp', '554', '554', 'both');
- $othersplist['snmp'] = array();
- /* Simple network management protocol */
- $othersplist['snmp'][] = array('SNMP', 'tcp', '161', '161', 'both');
- $othersplist['snmp'][] = array('SNMP2', 'udp', '161', '161', 'both');
- $othersplist['vnc'] = array();
- /* virtual network control */
- $othersplist['vnc'][] = array('VNC', 'tcp', '5900', '5930', 'both');
- $othersplist['appleremotedesktop'] = array();
- /* apple remote desktop */
- $othersplist['appleremotedesktop'][] = array('AppleRemoteDesktop1', 'tcp', '3283', '3283', 'both');
- $othersplist['appleremotedesktop'][] = array('AppleRemoteDesktop2', 'tcp', '5900', '5900', 'both');
- $othersplist['appleremotedesktop'][] = array('AppleRemoteDesktop3', 'udp', '3283', '3283', 'both');
- $othersplist['appleremotedesktop'][] = array('AppleRemoteDesktop4', 'udp', '5900', '5900', 'both');
- $othersplist['icq'] = array();
- /* icq */
- $othersplist['icq'][] = array('ICQ1', 'tcp', '5190', '5190', 'both');
- $othersplist['icq'][] = array('ICQ2', 'udp', '5190', '5190', 'both');
- $othersplist['lotusnotes'] = array();
- /* lotus notes */
- $othersplist['lotusnotes'][] = array('LotusNotes1', 'tcp', '1352', '1352', 'both');
- $othersplist['lotusnotes'][] = array('LotusNotes2', 'udp', '1352', '1352', 'both');
- $othersplist['aolinstantmessenger'] = array();
- /* AIM */
- $othersplist['aolinstantmessenger'][] = array('AIM', 'tcp', '5190', '5190', 'both');
- $othersplist['msnmessenger'] = array();
- /* msn messenger */
- $othersplist['msnmessenger'][] = array('MSN1', 'tcp', '1863', '1863', 'both');
- $othersplist['msnmessenger'][] = array('MSN2', 'tcp', '6891', '6900', 'both');
- $othersplist['msnmessenger'][] = array('MSN3', 'tcp', '6901', '6901', 'both');
- $othersplist['msnmessenger'][] = array('MSN4', 'udp', '6901', '6901', 'both');
- $othersplist['mysqlserver'] = array();
- /* mysql server */
- $othersplist['mysqlserver'][] = array('MySQL1', 'tcp', '3306', '3306', 'both');
- $othersplist['nntp'] = array();
- /* nntp */
- $othersplist['nntp'][] = array('NNTP1', 'tcp', '119', '119', 'both');
- $othersplist['nntp'][] = array('NNTP2', 'udp', '119', '119', 'both');
- $othersplist['pcanywhere'] = array();
- /* symantec pc anywhere */
- $othersplist['pcanywhere'][] = array('pcany1', 'tcp', '5631', '5631', 'both');
- $othersplist['pcanywhere'][] = array('pcany2', 'udp', '5632', '5632', 'both');
- $othersplist['teamspeak'] = array();
- /* teamspeak */
- $othersplist['teamspeak'][] = array('teamspeak1', 'tcp', '14534', '14534', 'both');
- $othersplist['teamspeak'][] = array('teamspeak2', 'tcp', '51234', '51234', 'both');
- $othersplist['teamspeak'][] = array('teamspeak3', 'udp', '8767', '8768', 'both');
- $othersplist['cvsup'] = array();
- /* cvs */
- $othersplist['cvsup'][] = array('cvsup', 'tcp', '5999', '5999', 'both');
- $othersplist['hbci'] = array();
- /* HBCI */
- $othersplist['hbci'][] = array('HBCI', 'tcp', '3000', '3000', 'both');
- $othersplist['p2pCatchAll'] = array();
- $othersplist['p2pCatchAll'][] = array('p2pCatchAll', 'udp', '', '', 'both', '');
- $othersplist['p2pCatchAll'][] = array('p2pCatchAll2', 'tcp', '', '', 'both', '');
-
-
+ /* Unlike other areas we are posting the queue H or L or BLANK */
+
+ $othersplist['msrdp'] = array();
+ /* MSRDP */
+ $othersplist['msrdp'][] = array('MSRDP', 'tcp', '3389', '3389', 'both');
+ $othersplist['pptp'] = array();
+ /* PPTP */
+ $othersplist['pptp'][] = array('PPTP', 'tcp', '1723', '1723', 'both');
+ $othersplist['pptp'][] = array('PPTPGRE', 'gre', '', '', 'both');
+ $othersplist['ipsec'] = array();
+ /* IPSEC */
+ $othersplist['ipsec'][] = array('IPSEC', 'udp', '500', '500', 'both');
+ $othersplist['ipsec'][] = array('IPSEC', 'ah', '', '', 'both');
+ $othersplist['ipsec'][] = array('IPSEC', 'esp', '', '', 'both');
+ $othersplist['streamingmp3'] = array();
+ /* streaming mp3 media aka shoutcast */
+ $othersplist['streamingmp3'][] = array('STREAMINGMP3', 'tcp', '8000', '8100', 'both');
+ $othersplist['irc'] = array();
+ /* internet relay chat */
+ $othersplist['irc'][] = array('IRC', 'tcp', '6667', '6670', 'both');
+ $othersplist['jabber'] = array();
+ /* jabber */
+ $othersplist['jabber'][] = array('IRC', 'tcp', '5222', '5222', 'both');
+ $othersplist['jabber'][] = array('IRC', 'tcp', '5223', '5223', 'both');
+ $othersplist['jabber'][] = array('IRC', 'tcp', '5269', '5269', 'both');
+ $othersplist['dns'] = array();
+ /* domain name system */
+ $othersplist['dns'][] = array('DNS1', 'tcp', '53', '53', 'both');
+ $othersplist['dns'][] = array('DNS2', 'udp', '53', '53', 'both');
+ $othersplist['http'] = array();
+ /* HTTP aka Web Traffic */
+ $othersplist['http'][] = array('HTTP', 'tcp', '80', '80', 'both');
+ $othersplist['http'][] = array('HTTPS', 'tcp', '443', '443', 'both');
+ $othersplist['smtp'] = array();
+ /* Secure shell traffic */
+ $othersplist['smtp'][] = array('SMTP', 'tcp', '25', '25', 'both');
+ $othersplist['pop3'] = array();
+ /* Post Office Protocol - POP3 */
+ $othersplist['pop3'][] = array('POP3', 'tcp', '110', '110', 'both');
+ $othersplist['icmp'] = array();
+ /* ICMP */
+ $othersplist['icmp'][] = array('ICMP', 'icmp', '', '', 'both');
+ $othersplist['imap'] = array();
+ /* IMAP */
+ $othersplist['imap'][] = array('IMAP', 'tcp', '143', '143', 'both');
+ $othersplist['smb'] = array();
+ /* Microsoft SMB and friends */
+ $othersplist['smb'][] = array('SMB1', 'tcp', '445', '445', 'both');
+ $othersplist['smb'][] = array('SMB2', 'tcp', '137-139', '137-139', 'both');
+ $othersplist['rtsp'] = array();
+ /* realtime streaming protocol */
+ $othersplist['rtsp'][] = array('RTSP1', 'tcp', '554', '554', 'both');
+ $othersplist['snmp'] = array();
+ /* Simple network management protocol */
+ $othersplist['snmp'][] = array('SNMP', 'tcp', '161', '161', 'both');
+ $othersplist['snmp'][] = array('SNMP2', 'udp', '161', '161', 'both');
+ $othersplist['vnc'] = array();
+ /* virtual network control */
+ $othersplist['vnc'][] = array('VNC', 'tcp', '5900', '5930', 'both');
+ $othersplist['appleremotedesktop'] = array();
+ /* apple remote desktop */
+ $othersplist['appleremotedesktop'][] = array('AppleRemoteDesktop1', 'tcp', '3283', '3283', 'both');
+ $othersplist['appleremotedesktop'][] = array('AppleRemoteDesktop2', 'tcp', '5900', '5900', 'both');
+ $othersplist['appleremotedesktop'][] = array('AppleRemoteDesktop3', 'udp', '3283', '3283', 'both');
+ $othersplist['appleremotedesktop'][] = array('AppleRemoteDesktop4', 'udp', '5900', '5900', 'both');
+ $othersplist['icq'] = array();
+ /* icq */
+ $othersplist['icq'][] = array('ICQ1', 'tcp', '5190', '5190', 'both');
+ $othersplist['icq'][] = array('ICQ2', 'udp', '5190', '5190', 'both');
+ $othersplist['lotusnotes'] = array();
+ /* lotus notes */
+ $othersplist['lotusnotes'][] = array('LotusNotes1', 'tcp', '1352', '1352', 'both');
+ $othersplist['lotusnotes'][] = array('LotusNotes2', 'udp', '1352', '1352', 'both');
+ $othersplist['aolinstantmessenger'] = array();
+ /* AIM */
+ $othersplist['aolinstantmessenger'][] = array('AIM', 'tcp', '5190', '5190', 'both');
+ $othersplist['msnmessenger'] = array();
+ /* msn messenger */
+ $othersplist['msnmessenger'][] = array('MSN1', 'tcp', '1863', '1863', 'both');
+ $othersplist['msnmessenger'][] = array('MSN2', 'tcp', '6891', '6900', 'both');
+ $othersplist['msnmessenger'][] = array('MSN3', 'tcp', '6901', '6901', 'both');
+ $othersplist['msnmessenger'][] = array('MSN4', 'udp', '6901', '6901', 'both');
+ $othersplist['mysqlserver'] = array();
+ /* mysql server */
+ $othersplist['mysqlserver'][] = array('MySQL1', 'tcp', '3306', '3306', 'both');
+ $othersplist['nntp'] = array();
+ /* nntp */
+ $othersplist['nntp'][] = array('NNTP1', 'tcp', '119', '119', 'both');
+ $othersplist['nntp'][] = array('NNTP2', 'udp', '119', '119', 'both');
+ $othersplist['pcanywhere'] = array();
+ /* symantec pc anywhere */
+ $othersplist['pcanywhere'][] = array('pcany1', 'tcp', '5631', '5631', 'both');
+ $othersplist['pcanywhere'][] = array('pcany2', 'udp', '5632', '5632', 'both');
+ $othersplist['teamspeak'] = array();
+ /* teamspeak */
+ $othersplist['teamspeak'][] = array('teamspeak1', 'tcp', '14534', '14534', 'both');
+ $othersplist['teamspeak'][] = array('teamspeak2', 'tcp', '51234', '51234', 'both');
+ $othersplist['teamspeak'][] = array('teamspeak3', 'udp', '8767', '8768', 'both');
+ $othersplist['cvsup'] = array();
+ /* cvs */
+ $othersplist['cvsup'][] = array('cvsup', 'tcp', '5999', '5999', 'both');
+ $othersplist['hbci'] = array();
+ /* HBCI */
+ $othersplist['hbci'][] = array('HBCI', 'tcp', '3000', '3000', 'both');
+ $othersplist['p2pCatchAll'] = array();
+ $othersplist['p2pCatchAll'][] = array('p2pCatchAll', 'udp', '', '', 'both', '');
+ $othersplist['p2pCatchAll'][] = array('p2pCatchAll2', 'tcp', '', '', 'both', '');
+
+
+ /*
+ * Wipe previous config.
+ * Doing it here makes sense since we can wipe the previous config only after
+ * the user decides to do so when finishing the wizard.
+ */
+ if(isset($config['shaper']['queue']))
+ unset($config['shaper']['queue']);
+ if(isset($config['shaper']['rule']))
+ unset($config['shaper']['rule']);
+ foreach ($config['filter']['rule'] as $key => $rule)
+ if ($rule['wizard'] == "yes")
+ unset($config['filter']['rule'][$key]);
+
+ /* restart the cached config */
unset($altq_list_queues);
-
$altq_list_queues = array();
$tmppath = array();
foreach ($config['ezshaper']['step2'] as $ifkey => $if) {
-
+ if ($if['scheduler'] == "NONE")
+ continue;
+
$altq =& new altq_root_queue();
$altq->SetInterface($ifkey);
@@ -566,40 +623,69 @@ $othersplist = array();
$sched = $if['scheduler'];
+ $voipbw =0;
+ $voip = false;
+ $penalty = false;
+ $penaltybw = 0;
+ $p2p = false;
+ $p2pcatchall = false;
+ $p2pcatchbw = 0;
+ $games = false;
/* Values are in percent */
if ($sched == "CBQ" || $sched == "HFSC") {
- if (isset($config['ezshaper']['step3']['bandwidth'])) {
- $voip = TRUE;
- $voipbw = $config['ezshaper']['step3']['bandwidth'];
+ if ($config['ezshaper']['step3']['enable']) {
+ $voip = true;
+ if ($config['ezshaper']['step3']['bandwidth'])
+ $voipbw = $config['ezshaper']['step3']['bandwidth'];
+ else
+ $voipbw = 20;
} else {
- $voip = FALSE;
$voipbw = 20;
}
- if (isset($config['ezshaper']['step4']['enable'])) {
- $penalty = TRUE;
+ if ($config['ezshaper']['step4']['enable']) {
+ $penalty = true;
$penaltybw = $config['ezshaper']['step4']['bandwidth'];
} else {
- $penalty = FALSE;
+ $penalty = false;
$penaltybw = 0;
}
- if (isset($config['ezshaper']['step5']['p2pcatchall'])) {
- $p2pcatchall = TRUE;
- $p2pcatchbw = $config['ezshaper']['step5']['bandwidth'];
+ if ($config['ezshaper']['step5']['enable']) {
+ $p2p = true;
+ if ($config['ezshaper']['step5']['p2pcatchall']) {
+ $p2pcatchall = true;
+ $p2pcatchbw = $config['ezshaper']['step5']['bandwidth'];
+ } else {
+ $p2pcatchall = false;
+ $p2pcatchbw = 0;
+ }
} else {
- $p2pcatchall = FALSE;
- $p2pcatchbw = 0;
+ $p2p = false;
+ $p2pcatchall = false;
+ $p2pcatchbw = 0;
}
+ if ($config['ezshaper']['step6']['enable']) {
+ $games = true;
+ } else
+ $games = false;
+ if ($config['ezshaper']['step6']['enable']) {
+ $otherpriority = true;
+ } else
+ $games = false;
- if ($voipbw + $penaltybw + $p2pcatchbw > 40) {
- $message=gettext("Custom Bandwidths are greater than 70%. Please make them more reasonable to continue.");
- header("Location: /wizard.php?xml=traffic_shaper_wizard.xml&stepid=2&message={$message}");
+ if ($voipbw + $penaltybw + $p2pcatchbw > 65) {
+ $message=gettext("Custom Bandwidths are greater than 65%. Please lower them for the wizard to continue.");
+ header("Location: wizard.php?xml=traffic_shaper_wizard.xml&stepid=2&message={$message}");
+ exit;
}
$remainbw = 100 - $voipbw - $penaltybw - $p2pcatchbw;
- }
+ } else
+ $remainbw = 100; /* Needed?! */
+ $factor = 0;
+
if ($sched == "PRIQ" || $sched == "CBQ" || $sched == "HFSC") {
- if ($sched != "HFSC") {
+ // if ($sched != "HFSC") {
if ($sched == "PRIQ")
$q =& new priq_queue();
else if ($sched == "CBQ")
@@ -612,17 +698,23 @@ $othersplist = array();
$tmpcf['borrow'] = "on";
$tmpcf['bandwidth'] = $remainbw * 30/100; /* 30% bandwidth */
$tmpcf['bandwidthtype'] = "%";
+ } else if ($sched == "HFSC") {
+ $tmpcf['bandwidth'] = $remainbw * 30/100; /* 30% bandwidth */
+ $tmpcf['bandwidthtype'] = "%";
+ $tmpcf['realtime'] = "on";
+ $tmpbw = $remainbw * 30/100;
+ $tmpcf['reatlime3'] = "{$tmpbw}%";
}
array_push($tmppath, "qACK");
- $qtmp =& $altq->add_queue($q, &$tmpcf, &$tmppath);
+ $qtmp =& $altq->add_queue($q, &$tmpcf, &$tmppath, $input_errors);
array_pop($tmppath);
$qtmp->wconfig();
- } else {
- /* If you find out how to make qACK for HFSC work be my guest */
- $remainbw = $remainbw + 30;
- }
-
-
+
+ $factor = 30;
+ $remainbw = $remainbw - $remainbw * $factor / 100;
+ // }
+
+ /* NOTE: HFSC bandwidths are higher cause we don't have an ACK queue for it. */
if ($sched == "PRIQ")
$q =& new priq_queue();
else if ($sched == "CBQ")
@@ -637,326 +729,379 @@ $othersplist = array();
$tmpcf['red'] = "on";
if ($sched == "CBQ") {
$tmpcf['borrow'] = "on";
- $tmpcf['bandwidth'] = $remainbw * 7/100; /* 7% bandwidth */
+ $tmpcf['bandwidth'] = $remainbw * 7/(100 - factor); /* 13% bandwidth */
$tmpcf['bandwidthtype'] = "%";
} else if ($sched == "HFSC") {
- $tmpcf['bandwidth'] = $remainbw * 7/100; /* 7% bandwidth */
+ $tmpcf['bandwidth'] = $remainbw * 7/(100 - factor); /* 13% bandwidth */
$tmpcf['bandwidthtype'] = "%";
}
array_push($tmppath, "qDefault");
- $qtmp =& $altq->add_queue($q, &$tmpcf, &$tmppath);
+ $qtmp =& $altq->add_queue($q, &$tmpcf, &$tmppath, $input_errors);
array_pop($tmppath);
$qtmp->wconfig();
-
+ $factor = $factor + 7;
+ $remainbw = $remainbw - $remainbw * $factor / 100;
- if ($sched == "PRIQ")
- $q =& new priq_queue();
- else if ($sched == "CBQ")
- $q =& new cbq_queue();
- else if ($sched == "HFSC")
- $q =& new hfsc_queue();
- $tmpcf = array();
- $tmpcf['name'] = "qP2P";
- $tmpcf['priority'] = 1;
- $tmpcf['red'] = "on";
- if ($p2pcatchall) {
+ if ($p2p) {
+ if ($sched == "PRIQ")
+ $q =& new priq_queue();
+ else if ($sched == "CBQ")
+ $q =& new cbq_queue();
+ else if ($sched == "HFSC")
+ $q =& new hfsc_queue();
+ $tmpcf = array();
+ $tmpcf['name'] = "qP2P";
+ $tmpcf['priority'] = 1;
+ $tmpcf['red'] = "on";
+ if ($p2pcatchall) {
+ if ($sched == "CBQ") {
+ $tmpcf['borrow'] = "on";
+ $tmpcf['bandwidth'] = $p2pcatchbw;
+ $tmpcf['bandwidthtype'] = "%";
+ } else if ($sched == "HFSC") {
+ $tmpcf['bandwidth'] = $p2pcatchbw;
+ $tmpcf['bandwidthtype'] = "%";
+ }
+ $tmpcf['default'] = "on";
+
+ $factor = p2pcatchbw;
+ $remainbw = $remainbw - $remainbw * $factor / 100;
+ } else {
+ if ($sched == "CBQ") {
+ $tmpcf['borrow'] = "on";
+ $tmpcf['bandwidth'] = $remainbw * 5/(100 - $factor); /* 5% bandwidth */
+ $tmpcf['bandwidthtype'] = "%";
+ } else if ($sched == "HFSC") {
+ $tmpcf['bandwidth'] = $remainbw * 5/(100 - $factor); /* 5% bandwidth */
+ $tmpcf['bandwidthtype'] = "%";
+ }
+ $factor = 5;
+ $remainbw = $remainbw - $remainbw * $factor / 100;
+ }
+ array_push($tmppath, "qP2P");
+ $qtmp =& $altq->add_queue($q, &$tmpcf, &$tmppath, $input_errors);
+ array_pop($tmppath);
+ $qtmp->wconfig();
+ }
+
+ if ($voip) {
+ if ($sched == "PRIQ")
+ $q =& new priq_queue();
+ else if ($sched == "CBQ")
+ $q =& new cbq_queue();
+ else if ($sched == "HFSC")
+ $q =& new hfsc_queue();
+ $tmpcf = array();
+ $tmpcf['name'] = "qVoIP";
+ $tmpcf['priority'] = 7;
+ $tmpcf['red'] = "on";
if ($sched == "CBQ") {
$tmpcf['borrow'] = "on";
- $tmpcf['bandwidth'] = $p2pcatchbw;
+ if ($voipbw > 0)
+ $tmpcf['bandwidth'] = $voipbw;
+ else
+ $tmpcf['bandwidth'] = $remainbw * 20/(100 - $factor); /* 20% bandwidth */
$tmpcf['bandwidthtype'] = "%";
+
+ $factor = $voipbw;
+
} else if ($sched == "HFSC") {
- $tmpcf['bandwidth'] = $p2pcatchbw;
- $tmpcf['bandwidthtype'] = "%";
+ if ($voipbw > 0) {
+ $tmpcf['realtime'] = "on";
+ $tmpcf['realtime3'] = "{$voipbw}%";
+ /* XXX: Don't know why PF does not allow only realtime set?! */
+ $tmpcf['bandwidth'] = "{$voipbw}";
+ $tmpcf['bandwidthtype'] = "%";
+ $factor = $voipbw;
+ } else {
+ if (($remainbw * 20/(100 - $factor)) > 20)
+ $r1 = ($remainbw * 20/(100 - $factor)) + 5;
+ else
+ $r1 = 20;
+ $tmpcf['realtime'] = "on";
+ $tmpcf['realtime1'] = "{$r1}%";
+ $tmpcf['realtime2'] = "50";
+ $voipbw = ($remainbw * 20/(100 - $factor)); /* 20% bandwidth */
+ $tmpcf['realtime3'] = "{$voipbw}%";
+ /* XXX: Don't know why PF does not allow only realtime set?! */
+ $tmpcf['bandwidth'] = "{$voipbw}";
+ $tmpcf['bandwidthtype'] = "%";
+ $factor = $voipbw;
+ }
}
- $tmpcf['default'] = "on";
- } else {
+ array_push($tmppath, "qVoIP");
+ $qtmp =& $altq->add_queue($q, &$tmpcf, &$tmppath, $input_errors);
+ array_pop($tmppath);
+ $qtmp->wconfig();
+
+ $remainbw = $remainbw - $remainbw * $factor / 100;
+ }
+
+ if ($games) {
+ if ($sched == "PRIQ")
+ $q =& new priq_queue();
+ else if ($sched == "CBQ")
+ $q =& new cbq_queue();
+ else if ($sched == "HFSC")
+ $q =& new hfsc_queue();
+ $tmpcf = array();
+ $tmpcf['name'] = "qGames";
+ $tmpcf['priority'] = 5;
+ $tmpcf['red'] = "on";
if ($sched == "CBQ") {
$tmpcf['borrow'] = "on";
- $tmpcf['bandwidth'] = $remainbw * 5/100; /* 5% bandwidth */
+ $tmpcf['bandwidth'] = $remainbw * 20/(100 - $factor); /* 20% bandwidth */
$tmpcf['bandwidthtype'] = "%";
} else if ($sched == "HFSC") {
- $tmpcf['bandwidth'] = $remainbw * 5/100; /* 5% bandwidth */
+ $tmpcf['bandwidth'] = $remainbw * 20/(100 - $factor); /* 20% bandwidth */
$tmpcf['bandwidthtype'] = "%";
}
+ array_push($tmppath, "qGames");
+ $qtmp =& $altq->add_queue($q, &$tmpcf, &$tmppath, $input_errors);
+ array_pop($tmppath);
+ $qtmp->wconfig();
+
+ $factor = 20;
+ $remainbw = $remainbw - $remainbw * $factor / 100;
}
- array_push($tmppath, "qP2P");
- $qtmp =& $altq->add_queue($q, &$tmpcf, &$tmppath);
- array_pop($tmppath);
- $qtmp->wconfig();
-
- if ($sched == "PRIQ")
- $q =& new priq_queue();
- else if ($sched == "CBQ")
- $q =& new cbq_queue();
- else if ($sched == "HFSC")
- $q =& new hfsc_queue();
- $tmpcf = array();
- $tmpcf['name'] = "qVoIP";
- $tmpcf['priority'] = 7;
- $tmpcf['red'] = "on";
- if ($sched == "CBQ") {
- $tmpcf['borrow'] = "on";
- if ($voip)
- $tmpcf['bandwidth'] = $voipbw;
- else
- $tmpcf['bandwidth'] = $remainbw * 20/100; /* 20% bandwidth */
- $tmpcf['bandwidthtype'] = "%";
- } else if ($sched == "HFSC") {
- if ($voip) {
- $tmpcf['realtime'] = "on";
- $tmpcf['realtime1'] = "10%";
- $tmpcf['realtime2'] = "50ms";
- $tmpcf['realtime3'] = "{$voipbw}%";
- } else {
- $tmpcf['realtime'] = "on";
- $tmpcf['realtime1'] = "10%";
- $tmpcf['realtime2'] = "50ms";
- $voipbw = ($remainbw * 20/100); /* 20% bandwidth */
- $tmpcf['realtime3'] = "{$voipbw}%";
+
+ if ($otherpriority) {
+ if ($sched == "PRIQ")
+ $q =& new priq_queue();
+ else if ($sched == "CBQ")
+ $q =& new cbq_queue();
+ else if ($sched == "HFSC")
+ $q =& new hfsc_queue();
+ $tmpcf = array();
+ $tmpcf['name'] = "qOthersHigh";
+ $tmpcf['priority'] = 4;
+ $tmpcf['red'] = "on";
+ if ($sched == "CBQ") {
+ $tmpcf['borrow'] = "on";
+ $tmpcf['bandwidth'] = $remainbw * 8/(100 - $factor); /* 8% bandwidth */
+ $tmpcf['bandwidthtype'] = "%";
+ } else if ($sched == "HFSC") {
+ $tmpcf['bandwidth'] = $remainbw * 8/(100 - $factor); /* 8% bandwidth */
+ $tmpcf['bandwidthtype'] = "%";
}
- }
- array_push($tmppath, "qVoIP");
- $qtmp =& $altq->add_queue($q, &$tmpcf, &$tmppath);
- array_pop($tmppath);
- $qtmp->wconfig();
-
- if ($sched == "PRIQ")
- $q =& new priq_queue();
- else if ($sched == "CBQ")
- $q =& new cbq_queue();
- else if ($sched == "HFSC")
- $q =& new hfsc_queue();
- $tmpcf = array();
- $tmpcf['name'] = "qGames";
- $tmpcf['priority'] = 5;
- $tmpcf['red'] = "on";
- if ($sched == "CBQ") {
- $tmpcf['borrow'] = "on";
- $tmpcf['bandwidth'] = $remainbw * 20/100; /* 20% bandwidth */
- $tmpcf['bandwidthtype'] = "%";
- } else if ($sched == "HFSC") {
- $tmpcf['bandwidth'] = $remainbw * 20/100; /* 20% bandwidth */
- $tmpcf['bandwidthtype'] = "%";
- }
- array_push($tmppath, "qGames");
- $qtmp =& $altq->add_queue($q, &$tmpcf, &$tmppath);
- array_pop($tmppath);
- $qtmp->wconfig();
+ array_push($tmppath, "qOthersHigh");
+ $qtmp =& $altq->add_queue($q, &$tmpcf, &$tmppath, $input_errors);
+ array_pop($tmppath);
+ $qtmp->wconfig();
+
+ $factor = 8;
+ $remainbw = $remainbw - $remainbw * $factor / 100;
- if ($sched == "PRIQ")
- $q =& new priq_queue();
- else if ($sched == "CBQ")
- $q =& new cbq_queue();
- else if ($sched == "HFSC")
- $q =& new hfsc_queue();
- $tmpcf = array();
- $tmpcf['name'] = "qOthersHigh";
- $tmpcf['priority'] = 4;
- $tmpcf['red'] = "on";
- if ($sched == "CBQ") {
- $tmpcf['borrow'] = "on";
- $tmpcf['bandwidth'] = $remainbw * 8/100; /* 8% bandwidth */
- $tmpcf['bandwidthtype'] = "%";
- } else if ($sched == "HFSC") {
- $tmpcf['bandwidth'] = $remainbw * 8/100; /* 8% bandwidth */
- $tmpcf['bandwidthtype'] = "%";
- }
- array_push($tmppath, "qOthersHigh");
- $qtmp =& $altq->add_queue($q, &$tmpcf, &$tmppath);
- array_pop($tmppath);
- $qtmp->wconfig();
-
- if ($sched == "PRIQ")
- $q =& new priq_queue();
- else if ($sched == "CBQ")
- $q =& new cbq_queue();
- else if ($sched == "HFSC")
- $q =& new hfsc_queue();
- $tmpcf = array();
- $tmpcf['name'] = "qOthersLow";
- $tmpcf['priority'] = 2;
- $tmpcf['red'] = "on";
- if ($sched == "CBQ") {
- $tmpcf['borrow'] = "on";
- if ($penalty)
- $tmpcf['bandwidth'] = $penaltybw;
- else
- $tmpcf['bandwidth'] = $remainbw * 5/100; /* 5% bandwidth */
- $tmpcf['bandwidthtype'] = "%";
- } else if ($sched == "HFSC") {
- if ($penalty)
- $tmpcf['bandwidth'] = $penaltybw;
- else
- $tmpcf['bandwidth'] = $remainbw * 5/100; /* 5% bandwidth */
- $tmpcf['bandwidthtype'] = "%";
+ if ($sched == "PRIQ")
+ $q =& new priq_queue();
+ else if ($sched == "CBQ")
+ $q =& new cbq_queue();
+ else if ($sched == "HFSC")
+ $q =& new hfsc_queue();
+ $tmpcf = array();
+ $tmpcf['name'] = "qOthersLow";
+ $tmpcf['priority'] = 2;
+ $tmpcf['red'] = "on";
+ if ($sched == "CBQ") {
+ $tmpcf['borrow'] = "on";
+ if ($penalty)
+ $tmpcf['bandwidth'] = $penaltybw;
+ else
+ $tmpcf['bandwidth'] = $remainbw * 5/(100 - $factor); /* 5% bandwidth */
+ $tmpcf['bandwidthtype'] = "%";
+ } else if ($sched == "HFSC") {
+ if ($penalty)
+ $tmpcf['bandwidth'] = $penaltybw;
+ else
+ $tmpcf['bandwidth'] = $remainbw * 5/(100 - $factor); /* 5% bandwidth */
+ $tmpcf['bandwidthtype'] = "%";
+ }
+ array_push($tmppath, "qOthersLow");
+ $qtmp =& $altq->add_queue($q, &$tmpcf, &$tmppath, $input_errors);
+ array_pop($tmppath);
+ $qtmp->wconfig();
}
- array_push($tmppath, "qOthersLow");
- $qtmp =& $altq->add_queue($q, &$tmpcf, &$tmppath);
- array_pop($tmppath);
- $qtmp->wconfig();
-
+
if (!is_array($config['filter']['rule']))
$config['filter']['rule'] = array();
}
array_pop($tmppath);
-
+ }
/* Rules */
if ($penalty) {
if( is_ipaddr($config['ezshaper']['step4']['address']) or is_alias($config['ezshaper']['step4']['address'])) {
$rule = array();
$rule['descr'] = gettext("Penalty Box");
- $rule['interface'] = $altq->GetInterface();
- $rule['source']['network'] = $altq->GetInterface();
-// $rule['source']['any'] = TRUE;
+// $rule['interface'] = $altq->GetInterface();
+// $rule['source']['network'] = $altq->GetInterface();
+ $rule['source']['any'] = TRUE;
$rule['defaultqueue'] = "qOthersLow";
$rule['source']['address'] = $config['ezshaper']['step4']['address'];
$rule['destination']['any'] = TRUE;
+ $rule['floating'] = "yes";
$rule['wizard'] = "yes";
+ $rule['enabled'] = "on";
$config['filter']['rule'][] = $rule;
}
}
/* If user specifies an IP, we don't bother with providers */
- if( is_ipaddr($config['ezshaper']['step3']['address']) or is_alias($config['ezshaper']['step3']['address'])) {
- /* create VOIP rules */
- $rule = array();
- $rule['descr'] = gettext("VOIP Adapter");
- $rule['interface'] = $altq->GetInterface();
- $rule['source']['network'] = $altq->GetInterface();
-// $rule['source']['any'] = TRUE;
- $rule['defaultqueue'] = "qVoIP";
- $rule['source']['address'] = $config['ezshaper']['step3']['address'];
- $rule['destination']['any'] = TRUE;
- $rule['wizard'] = "yes";
- $config['filter']['rule'][] = $rule;
-
- } elseif( $config['ezshaper']['step3']['provider'] == "Generic" ) {
- /* create VOIP rules */
- $rule = array();
- $rule['descr'] = "DiffServ/Lowdelay/Upload";
- $rule['interface'] = $altq->GetInterface();
- $rule['source']['network'] = $altq->GetInterface();
-// $rule['source']['any'] = TRUE;
- $rule['defaultqueue'] = "qVoIP";
- $rule['source']['network'] = $altq->GetInterface();
- $rule['destination']['any'] = TRUE;
- $rule['iptos'] = "lowdelay";
- $rule['wizard'] = "yes";
- $config['filter']['rule'][] = $rule;
-
- } else {
- /* loop through voiplist[] */
- foreach ($voiplist[$config['ezshaper']['step3']['provider']] as $voip) {
- $rule = array();
- $rule['interface'] = $altq->GetInterface();
- $rule['defaultqueue'] = 'qVoIP';
- $rule['source']['network'] = $altq->GetInterface();
-// $rule['source']['any'] = TRUE;
- $rule['destination']['any'] = TRUE;
- $rule['descr'] = "m_voip {$voip[0]} outbound";
- $rule['wizard'] = "yes";
- $rule['destination']['port'] = $voip[2]."-".$voip[3];
- if($voip[1] != '')
- $rule['protocol'] = $voip[1];
- $config['filter']['rule'][] = $rule;
- }
- }
-
+ if ($voip) {
+ if( is_ipaddr($config['ezshaper']['step3']['address']) or is_alias($config['ezshaper']['step3']['address'])) {
+ /* create VOIP rules */
+ $rule = array();
+ $rule['descr'] = gettext("VOIP Adapter");
+ // $rule['interface'] = $altq->GetInterface();
+ // $rule['source']['network'] = $altq->GetInterface();
+ $rule['source']['any'] = TRUE;
+ $rule['defaultqueue'] = "qVoIP";
+ $rule['source']['address'] = $config['ezshaper']['step3']['address'];
+ $rule['destination']['any'] = TRUE;
+ $rule['floating'] = "yes";
+ $rule['wizard'] = "yes";
+ $rule['enabled'] = "on";
+ $config['filter']['rule'][] = $rule;
+
+ } elseif( $config['ezshaper']['step3']['provider'] == "Generic" ) {
+ /* create VOIP rules */
+ $rule = array();
+ $rule['descr'] = "DiffServ/Lowdelay/Upload";
+ // $rule['interface'] = $altq->GetInterface();
+ // $rule['source']['network'] = $altq->GetInterface();
+ $rule['source']['any'] = TRUE;
+ $rule['defaultqueue'] = "qVoIP";
+ $rule['source']['network'] = $altq->GetInterface();
+ $rule['destination']['any'] = TRUE;
+ $rule['iptos'] = "lowdelay";
+ $rule['floating'] = "yes";
+ $rule['wizard'] = "yes";
+ $rule['enabled'] = "on";
+ $config['filter']['rule'][] = $rule;
+
+ } else {
+ /* loop through voiplist[] */
+ foreach ($voiplist[$config['ezshaper']['step3']['provider']] as $voip) {
+ $rule = array();
+ $rule['defaultqueue'] = 'qVoIP';
+ // $rule['interface'] = $altq->GetInterface();
+ // $rule['source']['network'] = $altq->GetInterface();
+ $rule['source']['any'] = TRUE;
+ $rule['destination']['any'] = TRUE;
+ $rule['descr'] = "m_voip {$voip[0]} outbound";
+ $rule['floating'] = "yes";
+ $rule['wizard'] = "yes";
+ $rule['enabled'] = "on";
+ $rule['destination']['port'] = $voip[2]."-".$voip[3];
+ if($voip[1] != '')
+ $rule['protocol'] = $voip[1];
+ $config['filter']['rule'][] = $rule;
+ }
+ }
+ }
/* loop through p2plist[] */
- foreach($config['ezshaper']['step5'] as $key => $val) {
- if (!is_array($p2plist[$key]))
- continue;
- foreach ($p2plist[$key] as $p2pclient) {
- $rule = array();
- $rule['defaultqueue'] = 'qP2P';
- $rule['interface'] = $altq->GetInterface();
- $rule['source']['network'] = $altq->GetInterface();
-// $rule['source']['any'] = TRUE;
- $rule['source']['network'] = $altq->GetInterface();
- $rule['destination']['any'] = TRUE;
- $rule['descr'] = "m_P2P {$p2pclient[0]} outbound";
- $rule['wizard'] = "yes";
- $rule['destination']['port'] = $p2pclient[2]."-".$p2pclient[3];
- if($p2pclient[1] != '')
- $rule['protocol'] = $p2pclient[1];
- $config['filter']['rule'][] = $rule;
- }
+ if ($p2p) {
+ foreach($config['ezshaper']['step5'] as $key => $val) {
+ if (!is_array($p2plist[$key]))
+ continue;
+ foreach ($p2plist[$key] as $p2pclient) {
+ $rule = array();
+ $rule['defaultqueue'] = 'qP2P';
+ // $rule['interface'] = $altq->GetInterface();
+ // $rule['source']['network'] = $altq->GetInterface();
+ $rule['source']['any'] = TRUE;
+ $rule['destination']['any'] = TRUE;
+ $rule['descr'] = "m_P2P {$p2pclient[0]} outbound";
+ $rule['floating'] = "yes";
+ $rule['wizard'] = "yes";
+ $rule['destination']['port'] = $p2pclient[2]."-".$p2pclient[3];
+ if($p2pclient[1] != '')
+ $rule['protocol'] = $p2pclient[1];
+ $config['filter']['rule'][] = $rule;
+ }
+ }
}
-
+
/* loop through gamesplist[] */
- foreach($config['ezshaper']['step6'] as $key => $val) {
- if (!is_array($gamesplist[$key]))
- continue;
- foreach ($gamesplist[$key] as $Gameclient) {
- $rule = array();
- $rule['defaultqueue'] = 'qGames';
- if ($sched != "HFSC")
- $rule['ackqueue'] = 'qACK';
- $rule['interface'] = $altq->GetInterface();
- $rule['source']['network'] = $altq->GetInterface();
-// $rule['source']['any'] = TRUE;
- $rule['destination']['any'] = TRUE;
- $rule['wizard'] = "yes";
- $rule['descr'] = "m_Game {$Gameclient[0]} outbound";
- $rule['destination']['port'] = $Gameclient[2]."-".$Gameclient[3];
- if($Gameclient[1] != '')
- $rule['protocol'] = $Gameclient[1];
- $config['filter']['rule'][] = $rule;
- }
- }
-
- /* loop through othersplist[] */
- foreach($config['ezshaper']['step7'] as $key => $val) {
- if (!is_array($othersplist[$key]))
- continue;
- foreach ($othersplist[$key] as $otherclient) {
- $rule = array();
- switch ($val) {
- case "H":
- $rule['defaultqueue'] = 'qOthersHigh'; /* posted value H or L */
- if ($sched != "HFSC")
+ if ($games) {
+ foreach($config['ezshaper']['step6'] as $key => $val) {
+ if (!is_array($gamesplist[$key]))
+ continue;
+ foreach ($gamesplist[$key] as $Gameclient) {
+ $rule = array();
+ $rule['defaultqueue'] = 'qGames';
+ if ($sched != "HFSC")
$rule['ackqueue'] = 'qACK';
- $loop = 0;
- break;
- case "L":
- $rule['defaultqueue'] = 'qOthersLow'; /* posted value H or L */
- $loop = 0;
- break;
- case "D":
- if ($p2pcatchall) {
- $loop = 0;
- $rule['defaultqueue'] = 'qDefault';
- if ($sched != "HFSC")
- $rule['ackqueue'] = 'qACK';
- } else
- $loop = 1; /* It automitaclly goes to default queue */
- break;
- default:
- $loop = 1;
+ // $rule['interface'] = $altq->GetInterface();
+ // $rule['source']['network'] = $altq->GetInterface();
+ $rule['source']['any'] = TRUE;
+ $rule['destination']['any'] = TRUE;
+ $rule['floating'] = "yes";
+ $rule['wizard'] = "yes";
+ $rule['enabled'] = "on";
+ $rule['descr'] = "m_Game {$Gameclient[0]} outbound";
+ $rule['destination']['port'] = $Gameclient[2]."-".$Gameclient[3];
+ if($Gameclient[1] != '')
+ $rule['protocol'] = $Gameclient[1];
+ $config['filter']['rule'][] = $rule;
+ }
}
- if (!$loop) {
- $rule['interface'] = $altq->GetInterface();
- $rule['source']['network'] = $altq->GetInterface();
-// $rule['source']['any'] = TRUE;
- $rule['destination']['any'] = TRUE;
- $rule['wizard'] = "yes";
- $rule['descr'] = "m_Other {$otherclient[0]} outbound";
-
- if($otherclient[2] or $otherclient[3]) {
- $rule['destination']['port'] = $otherclient[2]."-".$otherclient[3];
+ }
+
+ /* loop through othersplist[] */
+ if ($otherpriority) {
+ foreach($config['ezshaper']['step7'] as $key => $val) {
+ if (!is_array($othersplist[$key]))
+ continue;
+ foreach ($othersplist[$key] as $otherclient) {
+ $rule = array();
+ switch ($val) {
+ case "H":
+ $rule['defaultqueue'] = 'qOthersHigh'; /* posted value H or L */
+ if ($sched != "HFSC")
+ $rule['ackqueue'] = 'qACK';
+ $loop = 0;
+ break;
+ case "L":
+ $rule['defaultqueue'] = 'qOthersLow'; /* posted value H or L */
+ $loop = 0;
+ break;
+ case "D":
+ if ($p2pcatchall) {
+ $loop = 0;
+ $rule['defaultqueue'] = 'qDefault';
+ if ($sched != "HFSC")
+ $rule['ackqueue'] = 'qACK';
+ } else
+ $loop = 1; /* It automitaclly goes to default queue */
+ break;
+ default:
+ $loop = 1;
+ }
+ if (!$loop) {
+ // $rule['interface'] = $altq->GetInterface();
+ // $rule['source']['network'] = $altq->GetInterface();
+ $rule['source']['any'] = TRUE;
+ $rule['destination']['any'] = TRUE;
+ $rule['floating'] = "yes";
+ $rule['wizard'] = "yes";
+ $rule['enabled'] = "on";
+ $rule['descr'] = "m_Other {$otherclient[0]} outbound";
+
+ if($otherclient[2] or $otherclient[3]) {
+ $rule['destination']['port'] = $otherclient[2]."-".$otherclient[3];
+ }
+ if($otherclient[1] != '')
+ $rule['protocol'] = $otherclient[1];
+
+ $config['filter']['rule'][] = $rule;
+ }
}
- if($otherclient[1] != '')
- $rule['protocol'] = $otherclient[1];
-
- $config['filter']['rule'][] = $rule;
}
- }
}
- }
- write_config();
+ write_config();
}
?>
diff --git a/usr/local/www/wizards/traffic_shaper_wizard.xml b/usr/local/www/wizards/traffic_shaper_wizard.xml
index 3335f53..ceff681 100644
--- a/usr/local/www/wizards/traffic_shaper_wizard.xml
+++ b/usr/local/www/wizards/traffic_shaper_wizard.xml
@@ -1,8 +1,7 @@
-<?xml version="1.0" encoding="utf-8" ?>
+<?xml version="1.0"?>
<pfsensewizard>
-<copyright>
-/* $Id$ */
-/*
+ <copyright>/* $Id$ */
+
traffic_shaper_wizard.xml
part of pfSense (http://www.pfsense.org/)
@@ -29,1144 +28,1153 @@
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.
-*/
-</copyright>
-<totalsteps>9</totalsteps>
-<step>
- <id>1</id>
- <title>pfSense Traffic Shaper Wizard</title>
- <disableheader>true</disableheader>
- <description>This wizard will guide you through setting up the pfSense traffic shaper.</description>
- <fields>
- <field>
- <name>Next</name>
- <type>submit</type>
- <warning>Going any further will wipe your existing shaper config! If you do not wish to continue, please click the pfSense logo at the top to return to the webConfigurator.</warning>
- </field>
- </fields>
- <stepbeforeformdisplay>
- step1_stepbeforeformdisplay();
- </stepbeforeformdisplay>
- <stepsubmitphpaction>
- step1_stepsubmitphpaction();
- </stepsubmitphpaction>
- <includefile>/usr/local/www/wizards/traffic_shaper_wizard.inc</includefile>
-</step>
-<step>
- <id>2</id>
- <title>pfSense Traffic Shaper Wizard</title>
- <description>Shaper configuration</description>
- <javascriptafterformdisplay>
- </javascriptafterformdisplay>
- <fields>
- <field>
- <name>Setup network speeds</name>
- <type>listtopic</type>
- </field>
- <field>
- <name>Inside</name>
- <description>Inside interface for shaping your download speeds</description>
- <type>interfaces_selection</type>
- <typehint>This is usually the LAN interface</typehint>
- <bindstofield>ezshaper->step2->inside_int</bindstofield>
- </field>
- <field>
- <name>Download</name>
- <description>The download speed of your WAN link in Kbits/second. Note: PPPOE users should take into account PPPOE overhead and put a lower speed here.</description>
- <type>input</type>
- <validate>^[0-9]*$</validate>
- <message>Download speed must be numerical</message>
- <bindstofield>ezshaper->step2->download</bindstofield>
- </field>
- <field>
- <name>Outside</name>
- <description>Outside interface for shaping your upload speeds</description>
- <type>interfaces_selection</type>
- <typehint>This is usually the WAN interface</typehint>
- <bindstofield>ezshaper->step2->outside_int</bindstofield>
- </field>
- <field>
- <name>Upload</name>
- <description>The upload speed of your WAN link in Kbits/second. Note: PPPOE users should take into account PPPOE overhead and put a lower speed here.</description>
- <type>input</type>
- <validate>^[0-9]*$</validate>
- <message>Upload speed must be numerical</message>
- <bindstofield>ezshaper->step2->upload</bindstofield>
- </field>
- <field>
- <name>Next</name>
- <type>submit</type>
- </field>
- </fields>
- <stepsubmitphpaction>
- step2_stepsubmitphpaction();
- </stepsubmitphpaction>
- <includefile>/usr/local/www/wizards/traffic_shaper_wizard.inc</includefile>
-</step>
-<step>
- <id>3</id>
- <title>pfSense Traffic Shaper Wizard</title>
- <description>Voice over IP</description>
- <fields>
- <field>
- <name>Enable</name>
- <type>checkbox</type>
- <typehint>Prioritize Voice over IP traffic</typehint>
- <description>This will raise the priority of VOIP traffic above all other traffic.</description>
- <bindstofield>ezshaper->step3->enable</bindstofield>
- </field>
- <field>
- <name>Next</name>
- <type>submit</type>
- </field>
- <field>
- <name>VOIP specific settings</name>
- <type>listtopic</type>
- </field>
- <field>
- <name>Provider</name>
- <type>select</type>
- <description>Choose Generic if your provider isn't listed.</description>
- <bindstofield>ezshaper->step3->provider</bindstofield>
- <options>
- <option>
- <name>Generic (lowdelay)</name>
- <value>Generic</value>
- </option>
- <option>
- <name>VoicePulse</name>
- <value>VoicePulse</value>
- </option>
- <option>
- <name>Asterisk/Vonage</name>
- <value>Asterisk</value>
- </option>
- <option>
- <name>PanasonicTDA</name>
- <value>Panasonic</value>
- </option>
- </options>
- </field>
- <field>
- <name>Address</name>
- <type>inputalias</type>
- <description>(Optional) If this is chosen, the provider field will be overridden. This allows you to just provide the IP address of the VOIP adaptor to prioritize. NOTE: You can also use a Firewall Alias in this location.</description>
- <bindstofield>ezshaper->step3->address</bindstofield>
- <message>IP Address field is non-blank and doesn't look like an IP address.</message>
- </field>
- <field>
- <name>Bandwidth</name>
- <type>input</type>
- <typehint>Total bandwidth(in percentage %) guarantee for VOIP phone(s)</typehint>
- <bindstofield>ezshaper->step3->bandwidth</bindstofield>
- </field>
- <field>
- <name>Next</name>
- <type>submit</type>
- </field>
- </fields>
- <stepsubmitphpaction>
- step3_stepsubmitphpaction();
- </stepsubmitphpaction>
- <includefile>/usr/local/www/wizards/traffic_shaper_wizard.inc</includefile>
-</step>
-<step>
- <id>4</id>
- <title>pfSense Traffic Shaper Wizard</title>
- <description>Penalty Box</description>
- <disableallfieldsbydefault>true</disableallfieldsbydefault>
- <fields>
- <field>
- <donotdisable>true</donotdisable>
- <name>Enable</name>
- <type>checkbox</type>
- <typehint>Penalize IP or Alias</typehint>
- <description>This will lower the priority of traffic from this IP or alias.</description>
- <enablefields>Address,Bandwidth</enablefields>
- <bindstofield>ezshaper->step4->enable</bindstofield>
- </field>
- <field>
- <name>Next</name>
- <type>submit</type>
- </field>
- <field>
- <name>PenaltyBox specific settings</name>
- <type>listtopic</type>
- </field>
- <field>
- <name>Address</name>
- <type>input</type>
- <description>This allows you to just provide the IP address of the computer(s) or Penalize. NOTE: You can also use a Firewall Alias in this location.</description>
- <bindstofield>ezshaper->step4->address</bindstofield>
- <message>IP Address field is non-blank and doesn't look like an IP address.</message>
- </field>
- <field>
- <name>Bandwidth</name>
- <description>The limit in percentage.</description>
- <type>input</type>
- <validate>^[0-9]*$</validate>
- <message>Upload speed must be numerical</message>
- <bindstofield>ezshaper->step4->bandwidth</bindstofield>
- </field>
- <field>
- <name>Next</name>
- <type>submit</type>
- </field>
- </fields>
- <stepsubmitphpaction>
- step4_stepsubmitphpaction();
- </stepsubmitphpaction>
- <includefile>/usr/local/www/wizards/traffic_shaper_wizard.inc</includefile>
-</step>
-<step>
- <id>5</id>
- <title>pfSense Traffic Shaper Wizard</title>
- <description>Peer to Peer networking</description>
- <disableallfieldsbydefault>true</disableallfieldsbydefault>
- <fields>
- <field>
- <donotdisable>true</donotdisable>
- <name>Enable</name>
- <type>checkbox</type>
- <typehint>Lower priority of Peer-to-Peer traffic</typehint>
- <description>This will lower the priority of P2P traffic below all other traffic. Please check the items that you would like to prioritize lower than normal traffic.</description>
- <enablefields>p2pCatchAll,Bandwidth,Aimster,BitTorrent,BuddyShare,CuteMX,DCplusplus,dcc,DirectConnect,DirectFileExpress,EDonkey2000,FastTrack,Gnutella,grouper,hotComm,HotlineConnect,iMesh,Napster,OpenNap,Scour,Shareaza,SongSpy,WinMX</enablefields>
- <bindstofield>ezshaper->step5->enable</bindstofield>
- </field>
- <field>
- <name>Next</name>
- <type>submit</type>
- </field>
- <field>
- <name>p2p Catch all</name>
- <type>listtopic</type>
- </field>
- <field>
- <name>p2pCatchAll</name>
- <type>checkbox</type>
- <typehint>When enabled, all uncategorized traffic is fed to the p2p queue.</typehint>
- <bindstofield>ezshaper->step5->p2pcatchall</bindstofield>
- </field>
- <field>
- <name>Bandwidth</name>
- <description>The upload limit in percentage.</description>
- <type>input</type>
- <validate>^[0-9]*$</validate>
- <message>Speed must be numerical and in percentage of parent</message>
- <bindstofield>ezshaper->step5->bandwidth</bindstofield>
- </field>
- <field>
- <name>Enable/Disable specific P2P protocols</name>
- <type>listtopic</type>
- </field>
- <field>
- <name>Aimster</name>
- <type>checkbox</type>
- <typehint>Aimster and other P2P using the Aimster protocol and ports</typehint>
- <bindstofield>ezshaper->step5->aimster</bindstofield>
- </field>
- <field>
- <name>BitTorrent</name>
- <type>checkbox</type>
- <typehint>Bittorrent and other P2P using the Torrent protocol and ports</typehint>
- <bindstofield>ezshaper->step5->bittorrent</bindstofield>
- </field>
- <field>
- <name>BuddyShare</name>
- <type>checkbox</type>
- <typehint>BuddyShare and other P2P using the BuddyShare protocol and ports</typehint>
- <bindstofield>ezshaper->step5->buddyshare</bindstofield>
- </field>
- <field>
- <name>CuteMX</name>
- <type>checkbox</type>
- <typehint>CuteMX and other P2P using the CuteMX protocol and ports</typehint>
- <bindstofield>ezshaper->step5->cutemx</bindstofield>
- </field>
- <field>
- <name>DCplusplus</name>
- <type>checkbox</type>
+ */</copyright>
+
+ <totalsteps>9</totalsteps>
+ <step>
+ <id>1</id>
+ <title>pfSense Traffic Shaper Wizard</title>
+ <disableheader>true</disableheader>
+ <description>This wizard will guide you through setting up the pfSense traffic shaper.</description>
+ <fields>
+ <field>
+ <name>Next</name>
+ <type>submit</type>
+ </field>
+ </fields>
+ <stepbeforeformdisplay>step1_stepbeforeformdisplay();</stepbeforeformdisplay>
+ <includefile>/usr/local/www/wizards/traffic_shaper_wizard.inc</includefile>
+ </step>
+ <step>
+ <id>2</id>
+ <title>pfSense Traffic Shaper Wizard</title>
+ <description>Shaper configuration</description>
+ <javascriptafterformdisplay/>
+ <stepsubmitphpaction> step2_stepsubmitphpaction(); </stepsubmitphpaction>
+ <includefile>/usr/local/www/wizards/traffic_shaper_wizard.inc</includefile>
+ <fields>
+ <field>
+ <name>Setup network speeds</name>
+ <type>listtopic</type>
+ </field>
+ <field>
+ <name>lanscheduler</name>
+ <type>select</type>
+ <typehint>Queueing discipline to apply on this interface</typehint>
+ <options>
+ <option>
+ <name>NONE</name>
+ <value>NONE</value>
+ </option>
+ <option>
+ <name>HFSC</name>
+ <value>HFSC</value>
+ </option>
+ <option>
+ <name>CBQ</name>
+ <value>CBQ</value>
+ </option>
+ <option>
+ <name>PRIQ</name>
+ <value>PRIQ</value>
+ </option>
+ </options>
+ <bindstofield>ezshaper-&gt;step2-&gt;lan-&gt;scheduler</bindstofield>
+ </field>
+ <field>
+ <name>lan</name>
+ <type>input</type>
+ <typehint>Bandwidth in Kbit/sec on this interface</typehint>
+ <validate>^[0-9]*$</validate>
+ <bindstofield>ezshaper-&gt;step2-&gt;lan-&gt;bandwidth</bindstofield>
+ </field>
+ <field>
+ <name>wanscheduler</name>
+ <type>select</type>
+ <typehint>Queueing discipline to apply on this interface</typehint>
+ <options>
+ <option>
+ <name>NONE</name>
+ <value>NONE</value>
+ </option>
+ <option>
+ <name>HFSC</name>
+ <value>HFSC</value>
+ </option>
+ <option>
+ <name>CBQ</name>
+ <value>CBQ</value>
+ </option>
+ <option>
+ <name>PRIQ</name>
+ <value>PRIQ</value>
+ </option>
+ </options>
+ <bindstofield>ezshaper-&gt;step2-&gt;wan-&gt;scheduler</bindstofield>
+ </field>
+ <field>
+ <name>wan</name>
+ <type>input</type>
+ <typehint>Bandwidth in Kbit/sec on this interface</typehint>
+ <validate>^[0-9]*$</validate>
+ <bindstofield>ezshaper-&gt;step2-&gt;wan-&gt;bandwidth</bindstofield>
+ </field>
+ <field>
+ <name>Next</name>
+ <type>submit</type>
+ </field>
+ </fields>
+ </step>
+ <step>
+ <id>3</id>
+ <title>pfSense Traffic Shaper Wizard</title>
+ <description>Voice over IP</description>
+ <fields>
+ <field>
+ <name>Enable</name>
+ <type>checkbox</type>
+ <typehint>Prioritize Voice over IP traffic</typehint>
+ <description>This will raise the priority of VOIP traffic above all other traffic.</description>
+ <bindstofield>ezshaper-&gt;step3-&gt;enable</bindstofield>
+ </field>
+ <field>
+ <name>Next</name>
+ <type>submit</type>
+ </field>
+ <field>
+ <name>VOIP specific settings</name>
+ <type>listtopic</type>
+ </field>
+ <field>
+ <name>Provider</name>
+ <type>select</type>
+ <description>Choose Generic if your provider isn't listed.</description>
+ <bindstofield>ezshaper-&gt;step3-&gt;provider</bindstofield>
+ <options>
+ <option>
+ <name>Generic (lowdelay)</name>
+ <value>Generic</value>
+ </option>
+ <option>
+ <name>VoicePulse</name>
+ <value>VoicePulse</value>
+ </option>
+ <option>
+ <name>Asterisk/Vonage</name>
+ <value>Asterisk</value>
+ </option>
+ <option>
+ <name>PanasonicTDA</name>
+ <value>Panasonic</value>
+ </option>
+ </options>
+ </field>
+ <field>
+ <name>Address</name>
+ <type>inputalias</type>
+ <description>(Optional) If this is chosen, the provider field will be overridden. This allows you to just provide the IP address of the VOIP adaptor to prioritize. NOTE: You can also use a Firewall Alias in this location.</description>
+ <bindstofield>ezshaper-&gt;step3-&gt;address</bindstofield>
+ <message>IP Address field is non-blank and doesn't look like an IP address.</message>
+ </field>
+ <field>
+ <name>Bandwidth</name>
+ <type>input</type>
+ <validate>^[0-9]*$</validate>
+ <typehint>Total bandwidth in percentage(%)(should be between 5 and 60) guarantee for VOIP traffic.</typehint>
+ <bindstofield>ezshaper-&gt;step3-&gt;bandwidth</bindstofield>
+ </field>
+ <field>
+ <name>Next</name>
+ <type>submit</type>
+ </field>
+ </fields>
+ <stepsubmitphpaction>step3_stepsubmitphpaction();</stepsubmitphpaction>
+ <includefile>/usr/local/www/wizards/traffic_shaper_wizard.inc</includefile>
+ </step>
+ <step>
+ <id>4</id>
+ <title>pfSense Traffic Shaper Wizard</title>
+ <description>Penalty Box</description>
+ <disableallfieldsbydefault>true</disableallfieldsbydefault>
+ <fields>
+ <field>
+ <donotdisable>true</donotdisable>
+ <name>Enable</name>
+ <type>checkbox</type>
+ <typehint>Penalize IP or Alias</typehint>
+ <description>This will lower the priority of traffic from this IP or alias.</description>
+ <enablefields>Address,Bandwidth</enablefields>
+ <bindstofield>ezshaper-&gt;step4-&gt;enable</bindstofield>
+ </field>
+ <field>
+ <name>Next</name>
+ <type>submit</type>
+ </field>
+ <field>
+ <name>PenaltyBox specific settings</name>
+ <type>listtopic</type>
+ </field>
+ <field>
+ <name>Address</name>
+ <type>input</type>
+ <description>This allows you to just provide the IP address of the computer(s) or Penalize. NOTE: You can also use a Firewall Alias in this location.</description>
+ <bindstofield>ezshaper-&gt;step4-&gt;address</bindstofield>
+ <message>IP Address field is non-blank and doesn't look like an IP address.</message>
+ </field>
+ <field>
+ <name>Bandwidth</name>
+ <description>The limit in percentage.</description>
+ <type>input</type>
+ <validate>^[0-9]*$</validate>
+ <message>Speed must be numerical and between 5 and 15 percent.</message>
+ <bindstofield>ezshaper-&gt;step4-&gt;bandwidth</bindstofield>
+ </field>
+ <field>
+ <name>Next</name>
+ <type>submit</type>
+ </field>
+ </fields>
+ <stepsubmitphpaction>step4_stepsubmitphpaction();</stepsubmitphpaction>
+ <includefile>/usr/local/www/wizards/traffic_shaper_wizard.inc</includefile>
+ </step>
+ <step>
+ <id>5</id>
+ <title>pfSense Traffic Shaper Wizard</title>
+ <description>Peer to Peer networking</description>
+ <disableallfieldsbydefault>true</disableallfieldsbydefault>
+ <fields>
+ <field>
+ <donotdisable>true</donotdisable>
+ <name>Enable</name>
+ <type>checkbox</type>
+ <typehint>Lower priority of Peer-to-Peer traffic</typehint>
+ <description>This will lower the priority of P2P traffic below all other traffic. Please check the items that you would like to prioritize lower than normal traffic.</description>
+ <enablefields>p2pCatchAll,Bandwidth,Aimster,BitTorrent,BuddyShare,CuteMX,DCplusplus,dcc,DirectConnect,DirectFileExpress,EDonkey2000,FastTrack,Gnutella,grouper,hotComm,HotlineConnect,iMesh,Napster,OpenNap,Scour,Shareaza,SongSpy,WinMX</enablefields>
+ <bindstofield>ezshaper-&gt;step5-&gt;enable</bindstofield>
+ </field>
+ <field>
+ <name>Next</name>
+ <type>submit</type>
+ </field>
+ <field>
+ <name>p2p Catch all</name>
+ <type>listtopic</type>
+ </field>
+ <field>
+ <name>p2pCatchAll</name>
+ <type>checkbox</type>
+ <typehint>When enabled, all uncategorized traffic is fed to the p2p queue.</typehint>
+ <bindstofield>ezshaper-&gt;step5-&gt;p2pcatchall</bindstofield>
+ </field>
+ <field>
+ <name>Bandwidth</name>
+ <description>The limit in percentage.</description>
+ <type>input</type>
+ <validate>^[0-9]*$</validate>
+ <message>Speed must be numerical and in percentage of parent and between 5 and 10 perncent.</message>
+ <bindstofield>ezshaper-&gt;step5-&gt;bandwidth</bindstofield>
+ </field>
+ <field>
+ <name>Enable/Disable specific P2P protocols</name>
+ <type>listtopic</type>
+ </field>
+ <field>
+ <name>Aimster</name>
+ <type>checkbox</type>
+ <typehint>Aimster and other P2P using the Aimster protocol and ports</typehint>
+ <bindstofield>ezshaper-&gt;step5-&gt;aimster</bindstofield>
+ </field>
+ <field>
+ <name>BitTorrent</name>
+ <type>checkbox</type>
+ <typehint>Bittorrent and other P2P using the Torrent protocol and ports</typehint>
+ <bindstofield>ezshaper-&gt;step5-&gt;bittorrent</bindstofield>
+ </field>
+ <field>
+ <name>BuddyShare</name>
+ <type>checkbox</type>
+ <typehint>BuddyShare and other P2P using the BuddyShare protocol and ports</typehint>
+ <bindstofield>ezshaper-&gt;step5-&gt;buddyshare</bindstofield>
+ </field>
+ <field>
+ <name>CuteMX</name>
+ <type>checkbox</type>
+ <typehint>CuteMX and other P2P using the CuteMX protocol and ports</typehint>
+ <bindstofield>ezshaper-&gt;step5-&gt;cutemx</bindstofield>
+ </field>
+ <field>
+ <name>DCplusplus</name>
+ <type>checkbox</type>
<typehint>DC++ and other P2P using the DC++ protocol and ports</typehint>
- <bindstofield>ezshaper->step5->dcplusplus</bindstofield>
- </field>
- <field>
- <name>DCC</name>
- <type>checkbox</type>
+ <bindstofield>ezshaper-&gt;step5-&gt;dcplusplus</bindstofield>
+ </field>
+ <field>
+ <name>DCC</name>
+ <type>checkbox</type>
<typehint>irc DCC file transfers</typehint>
- <bindstofield>ezshaper->step5->dcc</bindstofield>
- </field>
- <field>
- <name>DirectConnect</name>
- <type>checkbox</type>
+ <bindstofield>ezshaper-&gt;step5-&gt;dcc</bindstofield>
+ </field>
+ <field>
+ <name>DirectConnect</name>
+ <type>checkbox</type>
<typehint>DirectConnect and other P2P using the DirectConnect protocol and ports</typehint>
- <bindstofield>ezshaper->step5->directconnect</bindstofield>
- </field>
- <field>
- <name>DirectFileExpress</name>
- <type>checkbox</type>
- <typehint>DirectFileExpress and other P2P using the DirectFileExpress protocol and ports</typehint>
- <bindstofield>ezshaper->step5->directfileexpress</bindstofield>
- </field>
- <field>
- <name>eDonkey2000</name>
- <type>checkbox</type>
+ <bindstofield>ezshaper-&gt;step5-&gt;directconnect</bindstofield>
+ </field>
+ <field>
+ <name>DirectFileExpress</name>
+ <type>checkbox</type>
+ <typehint>DirectFileExpress and other P2P using the DirectFileExpress protocol and ports</typehint>
+ <bindstofield>ezshaper-&gt;step5-&gt;directfileexpress</bindstofield>
+ </field>
+ <field>
+ <name>eDonkey2000</name>
+ <type>checkbox</type>
<typehint>eDonkey and other P2P using the eDonkey protocol and ports</typehint>
- <bindstofield>ezshaper->step5->edonkey2000</bindstofield>
- </field>
- <field>
- <name>FastTrack</name>
- <type>checkbox</type>
+ <bindstofield>ezshaper-&gt;step5-&gt;edonkey2000</bindstofield>
+ </field>
+ <field>
+ <name>FastTrack</name>
+ <type>checkbox</type>
<typehint>FastTrack and other P2P using the FastTrack protocol and ports</typehint>
- <bindstofield>ezshaper->step5->fasttrack</bindstofield>
- </field>
- <field>
- <name>Gnutella</name>
- <type>checkbox</type>
+ <bindstofield>ezshaper-&gt;step5-&gt;fasttrack</bindstofield>
+ </field>
+ <field>
+ <name>Gnutella</name>
+ <type>checkbox</type>
<typehint>Gnutella and other P2P using the Gnutella protocol and ports</typehint>
- <bindstofield>ezshaper->step5->gnutella</bindstofield>
- </field>
- <field>
- <name>grouper</name>
- <type>checkbox</type>
+ <bindstofield>ezshaper-&gt;step5-&gt;gnutella</bindstofield>
+ </field>
+ <field>
+ <name>grouper</name>
+ <type>checkbox</type>
<typehint>grouper and other P2P using the grouper protocol and ports</typehint>
- <bindstofield>ezshaper->step5->grouper</bindstofield>
+ <bindstofield>ezshaper-&gt;step5-&gt;grouper</bindstofield>
</field>
<field>
<name>hotComm</name>
<type>checkbox</type>
<typehint>hotComm and other P2P using the hotComm protocol and ports</typehint>
- <bindstofield>ezshaper->step5->hotcomm</bindstofield>
- </field>
- <field>
- <name>HotlineConnect</name>
- <type>checkbox</type>
+ <bindstofield>ezshaper-&gt;step5-&gt;hotcomm</bindstofield>
+ </field>
+ <field>
+ <name>HotlineConnect</name>
+ <type>checkbox</type>
<typehint>HotlineConnect and other P2P using the HotlineConnect protocol and ports</typehint>
- <bindstofield>ezshaper->step5->hotlineconnect</bindstofield>
- </field>
- <field>
- <name>iMesh</name>
- <type>checkbox</type>
+ <bindstofield>ezshaper-&gt;step5-&gt;hotlineconnect</bindstofield>
+ </field>
+ <field>
+ <name>iMesh</name>
+ <type>checkbox</type>
<typehint>iMesh and other P2P using the iMesh protocol and ports</typehint>
- <bindstofield>ezshaper->step5->imesh</bindstofield>
- </field>
- <field>
- <name>Napster</name>
- <type>checkbox</type>
+ <bindstofield>ezshaper-&gt;step5-&gt;imesh</bindstofield>
+ </field>
+ <field>
+ <name>Napster</name>
+ <type>checkbox</type>
<typehint>Napster and other P2P using the Napster protocol and ports</typehint>
- <bindstofield>ezshaper->step5->napster</bindstofield>
- </field>
- <field>
- <name>OpenNap</name>
- <type>checkbox</type>
+ <bindstofield>ezshaper-&gt;step5-&gt;napster</bindstofield>
+ </field>
+ <field>
+ <name>OpenNap</name>
+ <type>checkbox</type>
<typehint>OpenNap and other P2P using the OpenNap protocol and ports</typehint>
- <bindstofield>ezshaper->step5->opennap</bindstofield>
- </field>
- <field>
- <name>Scour</name>
- <type>checkbox</type>
+ <bindstofield>ezshaper-&gt;step5-&gt;opennap</bindstofield>
+ </field>
+ <field>
+ <name>Scour</name>
+ <type>checkbox</type>
<typehint>Scour and other P2P using the Scour protocol and ports</typehint>
- <bindstofield>ezshaper->step5->scour</bindstofield>
- </field>
- <field>
- <name>Shareaza</name>
- <type>checkbox</type>
+ <bindstofield>ezshaper-&gt;step5-&gt;scour</bindstofield>
+ </field>
+ <field>
+ <name>Shareaza</name>
+ <type>checkbox</type>
<typehint>Shareaza and other P2P using the Shareaza protocol and ports</typehint>
- <bindstofield>ezshaper->step5->shareaza</bindstofield>
- </field>
- <field>
- <name>SongSpy</name>
- <type>checkbox</type>
+ <bindstofield>ezshaper-&gt;step5-&gt;shareaza</bindstofield>
+ </field>
+ <field>
+ <name>SongSpy</name>
+ <type>checkbox</type>
<typehint>SongSpy and other P2P using the SongSpy protocol and ports</typehint>
- <bindstofield>ezshaper->step5->songspy</bindstofield>
- </field>
- <field>
- <name>WinMX</name>
- <type>checkbox</type>
+ <bindstofield>ezshaper-&gt;step5-&gt;songspy</bindstofield>
+ </field>
+ <field>
+ <name>WinMX</name>
+ <type>checkbox</type>
<typehint>WinMX and other P2P using the WinMX protocol and ports</typehint>
- <bindstofield>ezshaper->step5->winmx</bindstofield>
- </field>
- <field>
- <name>Next</name>
- <type>submit</type>
- </field>
- </fields>
- <stepsubmitphpaction>
- step5_stepsubmitphpaction();
- </stepsubmitphpaction>
- <includefile>/usr/local/www/wizards/traffic_shaper_wizard.inc</includefile>
-</step>
-<step>
- <id>6</id>
- <title>pfSense Traffic Shaper Wizard</title>
- <disableallfieldsbydefault>true</disableallfieldsbydefault>
- <description>Network Games</description>
- <fields>
- <field>
- <name>Enable</name>
- <type>checkbox</type>
- <typehint>Prioritize network gaming traffic</typehint>
- <description>This will raise the priority of gaming traffic to higher than most traffic.</description>
- <enablefields>BattleNET,Battlefield2,CallOfDuty,Counterstrike,DeltaForce,DOOM3,EmpireEarth,Everquest,Everquest2,FarCry,GunZOnline,HalfLife,HalfLife2,Halo2,Lineage2,PlanetSide,QuakeIII,TigerWoods2004PS2,UnrealTournament,WolfensteinEnemyTerritory,WorldOfWarcraft,XBox360</enablefields>
- <donotdisable>true</donotdisable>
- <bindstofield>ezshaper->step6->enable</bindstofield>
- </field>
- <field>
- <name>Next</name>
- <type>submit</type>
- </field>
- <field>
- <name>Enable/Disable specific games</name>
- <type>listtopic</type>
- </field>
- <field>
- <name>BattleNET</name>
- <type>checkbox</type>
- <typehint>Battle.net - Virtually every game from Blizzard publishing should match this. This includes the following game series: Starcraft, Diablo, Warcraft. Guild Wars also uses this port.</typehint>
- <bindstofield>ezshaper->step6->battlenet</bindstofield>
- </field>
- <field>
- <name>Battlefield2</name>
- <type>checkbox</type>
- <typehint>Battlefield 2 - this game uses a LARGE port range, be aware that you may need to manually rearrange the resulting rules to correctly prioritize other traffic.</typehint>
- <bindstofield>ezshaper->step6->battlefield2</bindstofield>
- </field>
- <field>
- <name>CallOfDuty</name>
- <type>checkbox</type>
- <typehint>Call Of Duty (United Offensive)</typehint>
- <bindstofield>ezshaper->step6->callofduty</bindstofield>
- </field>
- <field>
- <name>Counterstrike</name>
- <type>checkbox</type>
- <typehint>Counterstrike. The ultimate 1st person shooter.</typehint>
- <bindstofield>ezshaper->step6->counterstrike</bindstofield>
- </field>
- <field>
- <name>DeltaForce</name>
- <type>checkbox</type>
- <typehint>Delta Force</typehint>
- <bindstofield>ezshaper->step6->deltaforce</bindstofield>
- </field>
- <field>
- <name>DOOM3</name>
- <type>checkbox</type>
- <typehint>DOOM3</typehint>
- <bindstofield>ezshaper->step6->doom3</bindstofield>
- </field>
- <field>
- <name>EmpireEarth</name>
- <type>checkbox</type>
- <typehint>Empire Earth</typehint>
- <bindstofield>ezshaper->step6->empireearth</bindstofield>
- </field>
- <field>
- <name>Everquest</name>
- <type>checkbox</type>
- <typehint>Everquest - this game uses a LARGE port range, be aware that you may need to manually rearrange the resulting rules to correctly prioritize other traffic.</typehint>
- <bindstofield>ezshaper->step6->everquest</bindstofield>
- </field>
- <field>
- <name>Everquest2</name>
- <type>checkbox</type>
- <typehint>Everquest II</typehint>
- <bindstofield>ezshaper->step6->everquest2</bindstofield>
- </field>
- <field>
- <name>GunZOnline</name>
- <type>checkbox</type>
- <typehint>GunZ Online</typehint>
- <bindstofield>ezshaper->step6->gunzonline</bindstofield>
- </field>
- <field>
- <name>FarCry</name>
- <type>checkbox</type>
- <typehint>Far Cry</typehint>
- <bindstofield>ezshaper->step6->farcry</bindstofield>
- </field>
- <field>
- <name>HalfLife</name>
- <type>checkbox</type>
- <typehint>HalfLife</typehint>
- <bindstofield>ezshaper->step6->halflife</bindstofield>
- </field>
- <field>
- <name>HalfLife2</name>
- <type>checkbox</type>
- <typehint>HalfLife 2</typehint>
- <bindstofield>ezshaper->step6->halflife2</bindstofield>
- </field>
- <field>
- <name>Halo2</name>
- <type>checkbox</type>
- <typehint>Halo2 via Xbox live</typehint>
- <bindstofield>ezshaper->step6->halo2xbox</bindstofield>
- </field>
- <field>
- <name>Lineage2</name>
- <type>checkbox</type>
- <typehint>Lineage II</typehint>
- <bindstofield>ezshaper->step6->lineage2</bindstofield>
- </field>
- <field>
- <name>PlanetSide</name>
- <type>checkbox</type>
- <typehint>PlanetSide</typehint>
- <bindstofield>ezshaper->step6->planetside</bindstofield>
- </field>
- <field>
- <name>QuakeIII</name>
- <type>checkbox</type>
- <typehint>Quake III</typehint>
- <bindstofield>ezshaper->step6->quakeiii</bindstofield>
- </field>
- <field>
- <name>TigerWoods2004PS2</name>
- <type>checkbox</type>
- <typehint>Tiger Woods 2004 for PS2</typehint>
- <bindstofield>ezshaper->step6->tigerwoods2004ps2</bindstofield>
- </field>
- <field>
- <name>UnrealTournament</name>
- <type>checkbox</type>
- <typehint>Unreal Tournament</typehint>
- <bindstofield>ezshaper->step6->unrealtournament</bindstofield>
- </field>
- <field>
- <name>WolfensteinEnemyTerritory</name>
- <type>checkbox</type>
- <typehint>Wolfenstein Enemy Territory</typehint>
- <bindstofield>ezshaper->step6->wolfet</bindstofield>
- </field>
- <field>
- <name>WorldOfWarcraft</name>
- <type>checkbox</type>
- <typehint>World of Warcraft</typehint>
- <bindstofield>ezshaper->step6->wow</bindstofield>
- </field>
- <field>
- <name>Xbox360</name>
- <type>checkbox</type>
- <typehint>XBox 360</typehint>
- <bindstofield>ezshaper->step6->xbox360</bindstofield>
- </field>
- <field>
- <name>Next</name>
- <type>submit</type>
- </field>
- </fields>
- <includefile>/usr/local/www/wizards/traffic_shaper_wizard.inc</includefile>
-</step>
-<step>
- <id>7</id>
- <title>pfSense Traffic Shaper Wizard</title>
- <disableallfieldsbydefault>true</disableallfieldsbydefault>
- <description>Raise or lower other Applications</description>
- <fields>
- <field>
- <name>Enable</name>
- <type>checkbox</type>
- <typehint>Other networking protocols</typehint>
- <description>This will help raise or lower the priority of other protocols higher than most traffic.</description>
- <enablefields>AIM,AppleRemoteDesktop,DNS,HTTP,ICMP,ICQ,IMAP,IPSEC,IRC,Jabber,LotusNotes,MSN,MSRDP,MySqlServer,PCAnywhere,POP3,PPTP,RTSP,SMB,SMTP,SNMP,StreamingMP3,TeamSpeak,VNC,NNTP,CVSUP</enablefields>
- <donotdisable>true</donotdisable>
- <bindstofield>ezshaper->step7->enable</bindstofield>
- </field>
- <field>
- <name>Next</name>
- <type>submit</type>
- </field>
- <field>
- <name>Remote Service / Terminal emulation</name>
- <type>listtopic</type>
- </field>
- <field>
- <name>MSRDP</name>
- <type>select</type>
- <bindstofield>ezshaper->step7->msrdp</bindstofield>
- <options>
- <option>
- <name>Default priority</name>
- <value>D</value>
- </option>
- <option>
- <name>Higher priority</name>
- <value>H</value>
- </option>
- <option>
- <name>Lower priority</name>
- <value>L</value>
- </option>
- </options>
- <typehint>Microsoft Remote Desktop Protocol</typehint>
- </field>
- <field>
- <name>VNC</name>
- <bindstofield>ezshaper->step7->vnc</bindstofield>
- <type>select</type>
- <options>
- <option>
- <name>Default priority</name>
- <value>D</value>
- </option>
- <option>
- <name>Higher priority</name>
- <value>H</value>
- </option>
- <option>
- <name>Lower priority</name>
- <value>L</value>
- </option>
- </options>
- <typehint>Virtual Network Computing</typehint>
- </field>
- <field>
- <name>AppleRemoteDesktop</name>
- <bindstofield>ezshaper->step7->appleremotedesktop</bindstofield>
- <type>select</type>
- <options>
- <option>
- <name>Default priority</name>
- <value>D</value>
- </option>
- <option>
- <name>Higher priority</name>
- <value>H</value>
- </option>
- <option>
- <name>Lower priority</name>
- <value>L</value>
- </option>
- </options>
- <typehint>Apple Remote Desktop</typehint>
- </field>
- <field>
- <name>PCAnywhere</name>
- <bindstofield>ezshaper->step7->pcanywhere</bindstofield>
- <type>select</type>
- <options>
- <option>
- <name>Default priority</name>
- <value>D</value>
- </option>
- <option>
- <name>Higher priority</name>
- <value>H</value>
- </option>
- <option>
- <name>Lower priority</name>
- <value>L</value>
- </option>
- </options>
- <typehint>Symantec PC Anywhere</typehint>
- </field>
- <field>
- <name>Messengers</name>
- <type>listtopic</type>
- </field>
- <field>
- <name>IRC</name>
- <type>select</type>
- <bindstofield>ezshaper->step7->irc</bindstofield>
- <options>
- <option>
- <name>Default priority</name>
- <value>D</value>
- </option>
- <option>
- <name>Higher priority</name>
- <value>H</value>
- </option>
- <option>
- <name>Lower priority</name>
- <value>L</value>
- </option>
- </options>
- <typehint>Internet Relay Chat</typehint>
- </field>
- <field>
- <name>Jabber</name>
- <type>select</type>
- <bindstofield>ezshaper->step7->jabber</bindstofield>
- <options>
- <option>
- <name>Default priority</name>
- <value>D</value>
- </option>
- <option>
- <name>Higher priority</name>
- <value>H</value>
- </option>
- <option>
- <name>Lower priority</name>
- <value>L</value>
- </option>
- </options>
- <typehint>Jabber instant messanger</typehint>
- </field>
- <field>
- <name>ICQ</name>
- <bindstofield>ezshaper->step7->icq</bindstofield>
- <type>select</type>
- <options>
- <option>
- <name>Default priority</name>
- <value>D</value>
- </option>
- <option>
- <name>Higher priority</name>
- <value>H</value>
- </option>
- <option>
- <name>Lower priority</name>
- <value>L</value>
- </option>
- </options>
- <typehint>ICQ</typehint>
- </field>
- <field>
- <name>AIM</name>
- <bindstofield>ezshaper->step7->aolinstantmessenger</bindstofield>
- <type>select</type>
- <options>
- <option>
- <name>Default priority</name>
- <value>D</value>
- </option>
- <option>
- <name>Higher priority</name>
- <value>H</value>
- </option>
- <option>
- <name>Lower priority</name>
- <value>L</value>
- </option>
- </options>
- <typehint>AOL Instant Messenger</typehint>
- </field>
- <field>
- <name>MSN</name>
- <bindstofield>ezshaper->step7->msnmessenger</bindstofield>
- <type>select</type>
- <options>
- <option>
- <name>Default priority</name>
- <value>D</value>
- </option>
- <option>
- <name>Higher priority</name>
- <value>H</value>
- </option>
- <option>
- <name>Lower priority</name>
- <value>L</value>
- </option>
- </options>
- <typehint>MSN Messenger</typehint>
- </field>
- <field>
- <name>Teamspeak</name>
- <bindstofield>ezshaper->step7->teamspeak</bindstofield>
- <type>select</type>
- <options>
- <option>
- <name>Default priority</name>
- <value>D</value>
- </option>
- <option>
- <name>Higher priority</name>
- <value>H</value>
- </option>
- <option>
- <name>Lower priority</name>
- <value>L</value>
- </option>
- </options>
- <typehint>TeamSpeak</typehint>
- </field>
- <field>
- <name>VPN</name>
- <type>listtopic</type>
- </field>
- <field>
- <name>PPTP</name>
- <type>select</type>
- <bindstofield>ezshaper->step7->pptp</bindstofield>
- <options>
- <option>
- <name>Default priority</name>
- <value>D</value>
- </option>
- <option>
- <name>Higher priority</name>
- <value>H</value>
- </option>
- <option>
- <name>Lower priority</name>
- <value>L</value>
- </option>
- </options>
- <typehint>Microsoft Point to Point tunneling protocol</typehint>
- </field>
- <field>
- <name>IPSEC</name>
- <type>select</type>
- <bindstofield>ezshaper->step7->ipsec</bindstofield>
- <options>
- <option>
- <name>Default priority</name>
- <value>D</value>
- </option>
- <option>
- <name>Higher priority</name>
- <value>H</value>
- </option>
- <option>
- <name>Lower priority</name>
- <value>L</value>
- </option>
- </options>
- <typehint>IPSEC VPN traffic</typehint>
- </field>
- <field>
- <name>Multimedia/Streaming</name>
- <type>listtopic</type>
- </field>
- <field>
- <name>StreamingMP3</name>
- <type>select</type>
- <bindstofield>ezshaper->step7->streamingmp3</bindstofield>
- <options>
- <option>
- <name>Default priority</name>
- <value>D</value>
- </option>
- <option>
- <name>Higher priority</name>
- <value>H</value>
- </option>
- <option>
- <name>Lower priority</name>
- <value>L</value>
- </option>
- </options>
- <typehint>Streaming Media</typehint>
- </field>
- <field>
- <name>RTSP</name>
- <bindstofield>ezshaper->step7->rtsp</bindstofield>
- <type>select</type>
- <options>
- <option>
- <name>Default priority</name>
- <value>D</value>
- </option>
- <option>
- <name>Higher priority</name>
- <value>H</value>
- </option>
- <option>
- <name>Lower priority</name>
- <value>L</value>
- </option>
- </options>
- <typehint>RealTime streaming protocol</typehint>
- </field>
- <field>
- <name>Web</name>
- <type>listtopic</type>
- </field>
- <field>
- <name>HTTP</name>
- <type>select</type>
- <bindstofield>ezshaper->step7->http</bindstofield>
- <options>
- <option>
- <name>Default priority</name>
- <value>D</value>
- </option>
- <option>
- <name>Higher priority</name>
- <value>H</value>
- </option>
- <option>
- <name>Lower priority</name>
- <value>L</value>
- </option>
- </options>
- <typehint>HTTP and HTTPS aka Web Traffic</typehint>
- </field>
- <field>
- <name>Mail</name>
- <type>listtopic</type>
- </field>
- <field>
- <name>SMTP</name>
- <type>select</type>
- <bindstofield>ezshaper->step7->smtp</bindstofield>
- <options>
- <option>
- <name>Default priority</name>
- <value>D</value>
- </option>
- <option>
- <name>Higher priority</name>
- <value>H</value>
- </option>
- <option>
- <name>Lower priority</name>
- <value>L</value>
- </option>
- </options>
- <typehint>Mail Protocol</typehint>
- </field>
- <field>
- <name>POP3</name>
- <type>select</type>
- <bindstofield>ezshaper->step7->pop3</bindstofield>
- <options>
- <option>
- <name>Default priority</name>
- <value>D</value>
- </option>
- <option>
- <name>Higher priority</name>
- <value>H</value>
- </option>
- <option>
- <name>Lower priority</name>
- <value>L</value>
- </option>
- </options>
- <typehint>POP3 Protocol</typehint>
- </field>
- <field>
- <name>IMAP</name>
- <bindstofield>ezshaper->step7->imap</bindstofield>
- <type>select</type>
- <options>
- <option>
- <name>Default priority</name>
- <value>D</value>
- </option>
- <option>
- <name>Higher priority</name>
- <value>H</value>
- </option>
- <option>
- <name>Lower priority</name>
- <value>L</value>
- </option>
- </options>
- <typehint>IMAP Protocol</typehint>
- </field>
- <field>
- <name>LotusNotes</name>
- <bindstofield>ezshaper->step7->lotusnotes</bindstofield>
- <type>select</type>
- <options>
- <option>
- <name>Default priority</name>
- <value>D</value>
- </option>
- <option>
- <name>Higher priority</name>
- <value>H</value>
- </option>
- <option>
- <name>Lower priority</name>
- <value>L</value>
- </option>
- </options>
- <typehint>Lotus Notes</typehint>
- </field>
- <field>
- <name>Miscellaneous</name>
- <type>listtopic</type>
- </field>
- <field>
- <name>DNS</name>
- <type>select</type>
- <bindstofield>ezshaper->step7->dns</bindstofield>
- <options>
- <option>
- <name>Default priority</name>
- <value>D</value>
- </option>
- <option>
- <name>Higher priority</name>
- <value>H</value>
- </option>
- <option>
- <name>Lower priority</name>
- <value>L</value>
- </option>
- </options>
- <typehint>Domain Name Services</typehint>
- </field>
- <field>
- <name>ICMP</name>
- <bindstofield>ezshaper->step7->icmp</bindstofield>
- <type>select</type>
- <options>
- <option>
- <name>Default priority</name>
- <value>D</value>
- </option>
- <option>
- <name>Higher priority</name>
- <value>H</value>
- </option>
- <option>
- <name>Lower priority</name>
- <value>L</value>
- </option>
- </options>
- <typehint>ICMP Protocol</typehint>
- </field>
- <field>
- <name>SMB</name>
- <bindstofield>ezshaper->step7->smb</bindstofield>
- <type>select</type>
- <options>
- <option>
- <name>Default priority</name>
- <value>D</value>
- </option>
- <option>
- <name>Higher priority</name>
- <value>H</value>
- </option>
- <option>
- <name>Lower priority</name>
- <value>L</value>
- </option>
- </options>
- <typehint>Microsoft SMB Protocol and friends</typehint>
- </field>
- <field>
- <name>SNMP</name>
- <bindstofield>ezshaper->step7->snmp</bindstofield>
- <type>select</type>
- <options>
- <option>
- <name>Default priority</name>
- <value>D</value>
- </option>
- <option>
- <name>Higher priority</name>
- <value>H</value>
- </option>
- <option>
- <name>Lower priority</name>
- <value>L</value>
- </option>
- </options>
- <typehint>Simple Network Management Protocol</typehint>
- </field>
- <field>
- <name>MySQLServer</name>
- <bindstofield>ezshaper->step7->mysqlserver</bindstofield>
- <type>select</type>
- <options>
- <option>
- <name>Default priority</name>
- <value>D</value>
- </option>
- <option>
- <name>Higher priority</name>
- <value>H</value>
- </option>
- <option>
- <name>Lower priority</name>
- <value>L</value>
- </option>
- </options>
- <typehint>MySQL Server</typehint>
- </field>
- <field>
- <name>NNTP</name>
- <bindstofield>ezshaper->step7->nntp</bindstofield>
- <type>select</type>
- <options>
- <option>
- <name>Default priority</name>
- <value>D</value>
- </option>
- <option>
- <name>Higher priority</name>
- <value>H</value>
- </option>
- <option>
- <name>Lower priority</name>
- <value>L</value>
- </option>
- </options>
- <typehint>Internet News</typehint>
- </field>
- <field>
- <name>CVSUP</name>
- <bindstofield>ezshaper->step7->cvsup</bindstofield>
- <type>select</type>
- <options>
- <option>
- <name>Default priority</name>
- <value>D</value>
- </option>
- <option>
- <name>Higher priority</name>
- <value>H</value>
- </option>
- <option>
- <name>Lower priority</name>
- <value>L</value>
- </option>
- </options>
- <typehint>CVSUP</typehint>
- </field>
- <field>
- <name>Next</name>
- <type>submit</type>
- </field>
- </fields>
- <includefile>/usr/local/www/wizards/traffic_shaper_wizard.inc</includefile>
-</step>
-<step>
- <id>8</id>
- <title>pfSense Traffic Shaper Wizard</title>
- <field>
- <name>Reload profile notice</name>
- <type>listtopic</type>
- </field>
- <description>
- After pressing Finish the system will load the new profile.&lt;br/&gt;
- Please note that this may take a moment.&lt;br/&gt;
- Also note that the traffic shaper is stateful meaning that only new connections will be shaped.&lt;br/&gt;
- If this is an issue please reset the state table after loading the profile.&lt;br/&gt;
- </description>
- <fields>
- <field>
- <name>Finish</name>
- <type>submit</type>
- </field>
- </fields>
- <stepsubmitphpaction>
- step8_stepsubmitphpaction();
- </stepsubmitphpaction>
- <includefile>/usr/local/www/wizards/traffic_shaper_wizard.inc</includefile>
-</step>
-<step>
- <id>9</id>
- <title>pfSense Traffic Shaper Wizard</title>
- <fields>
+ <bindstofield>ezshaper-&gt;step5-&gt;winmx</bindstofield>
+ </field>
+ <field>
+ <name>Next</name>
+ <type>submit</type>
+ </field>
+ </fields>
+ <stepsubmitphpaction>step5_stepsubmitphpaction();</stepsubmitphpaction>
+ <includefile>/usr/local/www/wizards/traffic_shaper_wizard.inc</includefile>
+ </step>
+ <step>
+ <id>6</id>
+ <title>pfSense Traffic Shaper Wizard</title>
+ <disableallfieldsbydefault>true</disableallfieldsbydefault>
+ <description>Network Games</description>
+ <fields>
+ <field>
+ <name>Enable</name>
+ <type>checkbox</type>
+ <typehint>Prioritize network gaming traffic</typehint>
+ <description>This will raise the priority of gaming traffic to higher than most traffic.</description>
+ <enablefields>BattleNET,Battlefield2,CallOfDuty,Counterstrike,DeltaForce,DOOM3,EmpireEarth,Everquest,Everquest2,FarCry,GunZOnline,HalfLife,HalfLife2,Halo2,Lineage2,PlanetSide,QuakeIII,TigerWoods2004PS2,UnrealTournament,WolfensteinEnemyTerritory,WorldOfWarcraft,XBox360</enablefields>
+ <donotdisable>true</donotdisable>
+ <bindstofield>ezshaper-&gt;step6-&gt;enable</bindstofield>
+ </field>
+ <field>
+ <name>Next</name>
+ <type>submit</type>
+ </field>
+ <field>
+ <name>Enable/Disable specific games</name>
+ <type>listtopic</type>
+ </field>
+ <field>
+ <name>BattleNET</name>
+ <type>checkbox</type>
+ <typehint>Battle.net - Virtually every game from Blizzard publishing should match this. This includes the following game series: Starcraft, Diablo, Warcraft. Guild Wars also uses this port.</typehint>
+ <bindstofield>ezshaper-&gt;step6-&gt;battlenet</bindstofield>
+ </field>
+ <field>
+ <name>Battlefield2</name>
+ <type>checkbox</type>
+ <typehint>Battlefield 2 - this game uses a LARGE port range, be aware that you may need to manually rearrange the resulting rules to correctly prioritize other traffic.</typehint>
+ <bindstofield>ezshaper-&gt;step6-&gt;battlefield2</bindstofield>
+ </field>
+ <field>
+ <name>CallOfDuty</name>
+ <type>checkbox</type>
+ <typehint>Call Of Duty (United Offensive)</typehint>
+ <bindstofield>ezshaper-&gt;step6-&gt;callofduty</bindstofield>
+ </field>
+ <field>
+ <name>Counterstrike</name>
+ <type>checkbox</type>
+ <typehint>Counterstrike. The ultimate 1st person shooter.</typehint>
+ <bindstofield>ezshaper-&gt;step6-&gt;counterstrike</bindstofield>
+ </field>
+ <field>
+ <name>DeltaForce</name>
+ <type>checkbox</type>
+ <typehint>Delta Force</typehint>
+ <bindstofield>ezshaper-&gt;step6-&gt;deltaforce</bindstofield>
+ </field>
+ <field>
+ <name>DOOM3</name>
+ <type>checkbox</type>
+ <typehint>DOOM3</typehint>
+ <bindstofield>ezshaper-&gt;step6-&gt;doom3</bindstofield>
+ </field>
+ <field>
+ <name>EmpireEarth</name>
+ <type>checkbox</type>
+ <typehint>Empire Earth</typehint>
+ <bindstofield>ezshaper-&gt;step6-&gt;empireearth</bindstofield>
+ </field>
+ <field>
+ <name>Everquest</name>
+ <type>checkbox</type>
+ <typehint>Everquest - this game uses a LARGE port range, be aware that you may need to manually rearrange the resulting rules to correctly prioritize other traffic.</typehint>
+ <bindstofield>ezshaper-&gt;step6-&gt;everquest</bindstofield>
+ </field>
+ <field>
+ <name>Everquest2</name>
+ <type>checkbox</type>
+ <typehint>Everquest II</typehint>
+ <bindstofield>ezshaper-&gt;step6-&gt;everquest2</bindstofield>
+ </field>
+ <field>
+ <name>GunZOnline</name>
+ <type>checkbox</type>
+ <typehint>GunZ Online</typehint>
+ <bindstofield>ezshaper-&gt;step6-&gt;gunzonline</bindstofield>
+ </field>
+ <field>
+ <name>FarCry</name>
+ <type>checkbox</type>
+ <typehint>Far Cry</typehint>
+ <bindstofield>ezshaper-&gt;step6-&gt;farcry</bindstofield>
+ </field>
+ <field>
+ <name>HalfLife</name>
+ <type>checkbox</type>
+ <typehint>HalfLife</typehint>
+ <bindstofield>ezshaper-&gt;step6-&gt;halflife</bindstofield>
+ </field>
+ <field>
+ <name>HalfLife2</name>
+ <type>checkbox</type>
+ <typehint>HalfLife 2</typehint>
+ <bindstofield>ezshaper-&gt;step6-&gt;halflife2</bindstofield>
+ </field>
+ <field>
+ <name>Halo2</name>
+ <type>checkbox</type>
+ <typehint>Halo2 via Xbox live</typehint>
+ <bindstofield>ezshaper-&gt;step6-&gt;halo2xbox</bindstofield>
+ </field>
+ <field>
+ <name>Lineage2</name>
+ <type>checkbox</type>
+ <typehint>Lineage II</typehint>
+ <bindstofield>ezshaper-&gt;step6-&gt;lineage2</bindstofield>
+ </field>
+ <field>
+ <name>PlanetSide</name>
+ <type>checkbox</type>
+ <typehint>PlanetSide</typehint>
+ <bindstofield>ezshaper-&gt;step6-&gt;planetside</bindstofield>
+ </field>
+ <field>
+ <name>QuakeIII</name>
+ <type>checkbox</type>
+ <typehint>Quake III</typehint>
+ <bindstofield>ezshaper-&gt;step6-&gt;quakeiii</bindstofield>
+ </field>
+ <field>
+ <name>TigerWoods2004PS2</name>
+ <type>checkbox</type>
+ <typehint>Tiger Woods 2004 for PS2</typehint>
+ <bindstofield>ezshaper-&gt;step6-&gt;tigerwoods2004ps2</bindstofield>
+ </field>
+ <field>
+ <name>UnrealTournament</name>
+ <type>checkbox</type>
+ <typehint>Unreal Tournament</typehint>
+ <bindstofield>ezshaper-&gt;step6-&gt;unrealtournament</bindstofield>
+ </field>
+ <field>
+ <name>WolfensteinEnemyTerritory</name>
+ <type>checkbox</type>
+ <typehint>Wolfenstein Enemy Territory</typehint>
+ <bindstofield>ezshaper-&gt;step6-&gt;wolfet</bindstofield>
+ </field>
+ <field>
+ <name>WorldOfWarcraft</name>
+ <type>checkbox</type>
+ <typehint>World of Warcraft</typehint>
+ <bindstofield>ezshaper-&gt;step6-&gt;wow</bindstofield>
+ </field>
+ <field>
+ <name>Xbox360</name>
+ <type>checkbox</type>
+ <typehint>XBox 360</typehint>
+ <bindstofield>ezshaper-&gt;step6-&gt;xbox360</bindstofield>
+ </field>
+ <field>
+ <name>Next</name>
+ <type>submit</type>
+ </field>
+ </fields>
+ <includefile>/usr/local/www/wizards/traffic_shaper_wizard.inc</includefile>
+ </step>
+ <step>
+ <id>7</id>
+ <title>pfSense Traffic Shaper Wizard</title>
+ <disableallfieldsbydefault>true</disableallfieldsbydefault>
+ <description>Raise or lower other Applications</description>
+ <fields>
+ <field>
+ <name>Enable</name>
+ <type>checkbox</type>
+ <typehint>Other networking protocols</typehint>
+ <description>This will help raise or lower the priority of other protocols higher than most traffic.</description>
+ <enablefields>AIM,AppleRemoteDesktop,DNS,HTTP,ICMP,ICQ,IMAP,IPSEC,IRC,Jabber,LotusNotes,MSN,MSRDP,MySqlServer,PCAnywhere,POP3,PPTP,RTSP,SMB,SMTP,SNMP,StreamingMP3,TeamSpeak,VNC,NNTP,CVSUP</enablefields>
+ <donotdisable>true</donotdisable>
+ <bindstofield>ezshaper-&gt;step7-&gt;enable</bindstofield>
+ </field>
+ <field>
+ <name>Next</name>
+ <type>submit</type>
+ </field>
+ <field>
+ <name>Remote Service / Terminal emulation</name>
+ <type>listtopic</type>
+ </field>
+ <field>
+ <name>MSRDP</name>
+ <type>select</type>
+ <bindstofield>ezshaper-&gt;step7-&gt;msrdp</bindstofield>
+ <options>
+ <option>
+ <name>Default priority</name>
+ <value>D</value>
+ </option>
+ <option>
+ <name>Higher priority</name>
+ <value>H</value>
+ </option>
+ <option>
+ <name>Lower priority</name>
+ <value>L</value>
+ </option>
+ </options>
+ <typehint>Microsoft Remote Desktop Protocol</typehint>
+ </field>
+ <field>
+ <name>VNC</name>
+ <bindstofield>ezshaper-&gt;step7-&gt;vnc</bindstofield>
+ <type>select</type>
+ <options>
+ <option>
+ <name>Default priority</name>
+ <value>D</value>
+ </option>
+ <option>
+ <name>Higher priority</name>
+ <value>H</value>
+ </option>
+ <option>
+ <name>Lower priority</name>
+ <value>L</value>
+ </option>
+ </options>
+ <typehint>Virtual Network Computing</typehint>
+ </field>
+ <field>
+ <name>AppleRemoteDesktop</name>
+ <bindstofield>ezshaper-&gt;step7-&gt;appleremotedesktop</bindstofield>
+ <type>select</type>
+ <options>
+ <option>
+ <name>Default priority</name>
+ <value>D</value>
+ </option>
+ <option>
+ <name>Higher priority</name>
+ <value>H</value>
+ </option>
+ <option>
+ <name>Lower priority</name>
+ <value>L</value>
+ </option>
+ </options>
+ <typehint>Apple Remote Desktop</typehint>
+ </field>
+ <field>
+ <name>PCAnywhere</name>
+ <bindstofield>ezshaper-&gt;step7-&gt;pcanywhere</bindstofield>
+ <type>select</type>
+ <options>
+ <option>
+ <name>Default priority</name>
+ <value>D</value>
+ </option>
+ <option>
+ <name>Higher priority</name>
+ <value>H</value>
+ </option>
+ <option>
+ <name>Lower priority</name>
+ <value>L</value>
+ </option>
+ </options>
+ <typehint>Symantec PC Anywhere</typehint>
+ </field>
+ <field>
+ <name>Messengers</name>
+ <type>listtopic</type>
+ </field>
+ <field>
+ <name>IRC</name>
+ <type>select</type>
+ <bindstofield>ezshaper-&gt;step7-&gt;irc</bindstofield>
+ <options>
+ <option>
+ <name>Default priority</name>
+ <value>D</value>
+ </option>
+ <option>
+ <name>Higher priority</name>
+ <value>H</value>
+ </option>
+ <option>
+ <name>Lower priority</name>
+ <value>L</value>
+ </option>
+ </options>
+ <typehint>Internet Relay Chat</typehint>
+ </field>
+ <field>
+ <name>Jabber</name>
+ <type>select</type>
+ <bindstofield>ezshaper-&gt;step7-&gt;jabber</bindstofield>
+ <options>
+ <option>
+ <name>Default priority</name>
+ <value>D</value>
+ </option>
+ <option>
+ <name>Higher priority</name>
+ <value>H</value>
+ </option>
+ <option>
+ <name>Lower priority</name>
+ <value>L</value>
+ </option>
+ </options>
+ <typehint>Jabber instant messanger</typehint>
+ </field>
+ <field>
+ <name>ICQ</name>
+ <bindstofield>ezshaper-&gt;step7-&gt;icq</bindstofield>
+ <type>select</type>
+ <options>
+ <option>
+ <name>Default priority</name>
+ <value>D</value>
+ </option>
+ <option>
+ <name>Higher priority</name>
+ <value>H</value>
+ </option>
+ <option>
+ <name>Lower priority</name>
+ <value>L</value>
+ </option>
+ </options>
+ <typehint>ICQ</typehint>
+ </field>
+ <field>
+ <name>AIM</name>
+ <bindstofield>ezshaper-&gt;step7-&gt;aolinstantmessenger</bindstofield>
+ <type>select</type>
+ <options>
+ <option>
+ <name>Default priority</name>
+ <value>D</value>
+ </option>
+ <option>
+ <name>Higher priority</name>
+ <value>H</value>
+ </option>
+ <option>
+ <name>Lower priority</name>
+ <value>L</value>
+ </option>
+ </options>
+ <typehint>AOL Instant Messenger</typehint>
+ </field>
+ <field>
+ <name>MSN</name>
+ <bindstofield>ezshaper-&gt;step7-&gt;msnmessenger</bindstofield>
+ <type>select</type>
+ <options>
+ <option>
+ <name>Default priority</name>
+ <value>D</value>
+ </option>
+ <option>
+ <name>Higher priority</name>
+ <value>H</value>
+ </option>
+ <option>
+ <name>Lower priority</name>
+ <value>L</value>
+ </option>
+ </options>
+ <typehint>MSN Messenger</typehint>
+ </field>
+ <field>
+ <name>Teamspeak</name>
+ <bindstofield>ezshaper-&gt;step7-&gt;teamspeak</bindstofield>
+ <type>select</type>
+ <options>
+ <option>
+ <name>Default priority</name>
+ <value>D</value>
+ </option>
+ <option>
+ <name>Higher priority</name>
+ <value>H</value>
+ </option>
+ <option>
+ <name>Lower priority</name>
+ <value>L</value>
+ </option>
+ </options>
+ <typehint>TeamSpeak</typehint>
+ </field>
+ <field>
+ <name>VPN</name>
+ <type>listtopic</type>
+ </field>
+ <field>
+ <name>PPTP</name>
+ <type>select</type>
+ <bindstofield>ezshaper-&gt;step7-&gt;pptp</bindstofield>
+ <options>
+ <option>
+ <name>Default priority</name>
+ <value>D</value>
+ </option>
+ <option>
+ <name>Higher priority</name>
+ <value>H</value>
+ </option>
+ <option>
+ <name>Lower priority</name>
+ <value>L</value>
+ </option>
+ </options>
+ <typehint>Microsoft Point to Point tunneling protocol</typehint>
+ </field>
+ <field>
+ <name>IPSEC</name>
+ <type>select</type>
+ <bindstofield>ezshaper-&gt;step7-&gt;ipsec</bindstofield>
+ <options>
+ <option>
+ <name>Default priority</name>
+ <value>D</value>
+ </option>
+ <option>
+ <name>Higher priority</name>
+ <value>H</value>
+ </option>
+ <option>
+ <name>Lower priority</name>
+ <value>L</value>
+ </option>
+ </options>
+ <typehint>IPSEC VPN traffic</typehint>
+ </field>
+ <field>
+ <name>Multimedia/Streaming</name>
+ <type>listtopic</type>
+ </field>
+ <field>
+ <name>StreamingMP3</name>
+ <type>select</type>
+ <bindstofield>ezshaper-&gt;step7-&gt;streamingmp3</bindstofield>
+ <options>
+ <option>
+ <name>Default priority</name>
+ <value>D</value>
+ </option>
+ <option>
+ <name>Higher priority</name>
+ <value>H</value>
+ </option>
+ <option>
+ <name>Lower priority</name>
+ <value>L</value>
+ </option>
+ </options>
+ <typehint>Streaming Media</typehint>
+ </field>
+ <field>
+ <name>RTSP</name>
+ <bindstofield>ezshaper-&gt;step7-&gt;rtsp</bindstofield>
+ <type>select</type>
+ <options>
+ <option>
+ <name>Default priority</name>
+ <value>D</value>
+ </option>
+ <option>
+ <name>Higher priority</name>
+ <value>H</value>
+ </option>
+ <option>
+ <name>Lower priority</name>
+ <value>L</value>
+ </option>
+ </options>
+ <typehint>RealTime streaming protocol</typehint>
+ </field>
+ <field>
+ <name>Web</name>
+ <type>listtopic</type>
+ </field>
+ <field>
+ <name>HTTP</name>
+ <type>select</type>
+ <bindstofield>ezshaper-&gt;step7-&gt;http</bindstofield>
+ <options>
+ <option>
+ <name>Default priority</name>
+ <value>D</value>
+ </option>
+ <option>
+ <name>Higher priority</name>
+ <value>H</value>
+ </option>
+ <option>
+ <name>Lower priority</name>
+ <value>L</value>
+ </option>
+ </options>
+ <typehint>HTTP and HTTPS aka Web Traffic</typehint>
+ </field>
+ <field>
+ <name>Mail</name>
+ <type>listtopic</type>
+ </field>
+ <field>
+ <name>SMTP</name>
+ <type>select</type>
+ <bindstofield>ezshaper-&gt;step7-&gt;smtp</bindstofield>
+ <options>
+ <option>
+ <name>Default priority</name>
+ <value>D</value>
+ </option>
+ <option>
+ <name>Higher priority</name>
+ <value>H</value>
+ </option>
+ <option>
+ <name>Lower priority</name>
+ <value>L</value>
+ </option>
+ </options>
+ <typehint>Mail Protocol</typehint>
+ </field>
+ <field>
+ <name>POP3</name>
+ <type>select</type>
+ <bindstofield>ezshaper-&gt;step7-&gt;pop3</bindstofield>
+ <options>
+ <option>
+ <name>Default priority</name>
+ <value>D</value>
+ </option>
+ <option>
+ <name>Higher priority</name>
+ <value>H</value>
+ </option>
+ <option>
+ <name>Lower priority</name>
+ <value>L</value>
+ </option>
+ </options>
+ <typehint>POP3 Protocol</typehint>
+ </field>
+ <field>
+ <name>IMAP</name>
+ <bindstofield>ezshaper-&gt;step7-&gt;imap</bindstofield>
+ <type>select</type>
+ <options>
+ <option>
+ <name>Default priority</name>
+ <value>D</value>
+ </option>
+ <option>
+ <name>Higher priority</name>
+ <value>H</value>
+ </option>
+ <option>
+ <name>Lower priority</name>
+ <value>L</value>
+ </option>
+ </options>
+ <typehint>IMAP Protocol</typehint>
+ </field>
+ <field>
+ <name>LotusNotes</name>
+ <bindstofield>ezshaper-&gt;step7-&gt;lotusnotes</bindstofield>
+ <type>select</type>
+ <options>
+ <option>
+ <name>Default priority</name>
+ <value>D</value>
+ </option>
+ <option>
+ <name>Higher priority</name>
+ <value>H</value>
+ </option>
+ <option>
+ <name>Lower priority</name>
+ <value>L</value>
+ </option>
+ </options>
+ <typehint>Lotus Notes</typehint>
+ </field>
+ <field>
+ <name>Miscellaneous</name>
+ <type>listtopic</type>
+ </field>
+ <field>
+ <name>DNS</name>
+ <type>select</type>
+ <bindstofield>ezshaper-&gt;step7-&gt;dns</bindstofield>
+ <options>
+ <option>
+ <name>Default priority</name>
+ <value>D</value>
+ </option>
+ <option>
+ <name>Higher priority</name>
+ <value>H</value>
+ </option>
+ <option>
+ <name>Lower priority</name>
+ <value>L</value>
+ </option>
+ </options>
+ <typehint>Domain Name Services</typehint>
+ </field>
+ <field>
+ <name>ICMP</name>
+ <bindstofield>ezshaper-&gt;step7-&gt;icmp</bindstofield>
+ <type>select</type>
+ <options>
+ <option>
+ <name>Default priority</name>
+ <value>D</value>
+ </option>
+ <option>
+ <name>Higher priority</name>
+ <value>H</value>
+ </option>
+ <option>
+ <name>Lower priority</name>
+ <value>L</value>
+ </option>
+ </options>
+ <typehint>ICMP Protocol</typehint>
+ </field>
+ <field>
+ <name>SMB</name>
+ <bindstofield>ezshaper-&gt;step7-&gt;smb</bindstofield>
+ <type>select</type>
+ <options>
+ <option>
+ <name>Default priority</name>
+ <value>D</value>
+ </option>
+ <option>
+ <name>Higher priority</name>
+ <value>H</value>
+ </option>
+ <option>
+ <name>Lower priority</name>
+ <value>L</value>
+ </option>
+ </options>
+ <typehint>Microsoft SMB Protocol and friends</typehint>
+ </field>
+ <field>
+ <name>SNMP</name>
+ <bindstofield>ezshaper-&gt;step7-&gt;snmp</bindstofield>
+ <type>select</type>
+ <options>
+ <option>
+ <name>Default priority</name>
+ <value>D</value>
+ </option>
+ <option>
+ <name>Higher priority</name>
+ <value>H</value>
+ </option>
+ <option>
+ <name>Lower priority</name>
+ <value>L</value>
+ </option>
+ </options>
+ <typehint>Simple Network Management Protocol</typehint>
+ </field>
+ <field>
+ <name>MySQLServer</name>
+ <bindstofield>ezshaper-&gt;step7-&gt;mysqlserver</bindstofield>
+ <type>select</type>
+ <options>
+ <option>
+ <name>Default priority</name>
+ <value>D</value>
+ </option>
+ <option>
+ <name>Higher priority</name>
+ <value>H</value>
+ </option>
+ <option>
+ <name>Lower priority</name>
+ <value>L</value>
+ </option>
+ </options>
+ <typehint>MySQL Server</typehint>
+ </field>
+ <field>
+ <name>NNTP</name>
+ <bindstofield>ezshaper-&gt;step7-&gt;nntp</bindstofield>
+ <type>select</type>
+ <options>
+ <option>
+ <name>Default priority</name>
+ <value>D</value>
+ </option>
+ <option>
+ <name>Higher priority</name>
+ <value>H</value>
+ </option>
+ <option>
+ <name>Lower priority</name>
+ <value>L</value>
+ </option>
+ </options>
+ <typehint>Internet News</typehint>
+ </field>
+ <field>
+ <name>CVSUP</name>
+ <bindstofield>ezshaper-&gt;step7-&gt;cvsup</bindstofield>
+ <type>select</type>
+ <options>
+ <option>
+ <name>Default priority</name>
+ <value>D</value>
+ </option>
+ <option>
+ <name>Higher priority</name>
+ <value>H</value>
+ </option>
+ <option>
+ <name>Lower priority</name>
+ <value>L</value>
+ </option>
+ </options>
+ <typehint>CVSUP</typehint>
+ </field>
+ <field>
+ <name>Next</name>
+ <type>submit</type>
+ </field>
+ </fields>
+ <includefile>/usr/local/www/wizards/traffic_shaper_wizard.inc</includefile>
+ </step>
+ <step>
+ <id>8</id>
+ <title>pfSense Traffic Shaper Wizard</title>
<field>
- <name>Finish</name>
- <type>submit</type>
+ <name>Reload profile notice</name>
+ <type>listtopic</type>
</field>
- </fields>
- <includefile>/usr/local/www/wizards/traffic_shaper_wizard.inc</includefile>
- <stepsubmitphpaction>
- step9_stepsubmitphpaction();
- </stepsubmitphpaction>
-</step>
+ <description> After pressing Finish the system will load the new profile.&lt;br/&gt; Please note that this may take a moment.&lt;br/&gt; Also note that the traffic shaper is stateful meaning that only new connections will be shaped.&lt;br/&gt; If this is an issue please reset the state table after loading the profile.&lt;br/&gt;</description>
+ <fields>
+ <field>
+ <name>Finish</name>
+ <type>submit</type>
+ </field>
+ </fields>
+ <stepsubmitphpaction>step8_stepsubmitphpaction();</stepsubmitphpaction>
+ <includefile>/usr/local/www/wizards/traffic_shaper_wizard.inc</includefile>
+ </step>
+ <step>
+ <id>9</id>
+ <title>pfSense Traffic Shaper Wizard</title>
+ <fields>
+ <field>
+ <name>Finish</name>
+ <type>submit</type>
+ </field>
+ </fields>
+ <includefile>/usr/local/www/wizards/traffic_shaper_wizard.inc</includefile>
+ <stepsubmitphpaction>step9_stepsubmitphpaction();</stepsubmitphpaction>
+ </step>
</pfsensewizard>
OpenPOWER on IntegriCloud