summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRenato Botelho <renato.botelho@bluepex.com>2010-08-20 10:04:54 -0300
committerRenato Botelho <renato.botelho@bluepex.com>2010-08-20 10:04:54 -0300
commitd23525a09f77bf4f9df04d0e7ed076c5c8f768cb (patch)
tree38af1141385208c127c98d4c83d7a33214f084e8
parent18efed8bcebbcbcd28e94d9780db8f910f951ceb (diff)
parent19b5c3e7f62f6c08ffef434a89a8c1147d21e82a (diff)
downloadpfsense-d23525a09f77bf4f9df04d0e7ed076c5c8f768cb.zip
pfsense-d23525a09f77bf4f9df04d0e7ed076c5c8f768cb.tar.gz
Merge remote branch 'mainline/master' into inc
-rw-r--r--etc/inc/filter.inc7
-rw-r--r--etc/inc/interfaces.inc20
-rw-r--r--etc/inc/pfsense-utils.inc40
-rw-r--r--etc/inc/services.inc117
-rw-r--r--etc/inc/system.inc2
-rw-r--r--etc/inc/upgrade_config.inc21
-rw-r--r--etc/inc/wizardapp.inc348
-rw-r--r--etc/inc/zeromq.inc215
-rwxr-xr-xetc/rc.bootup18
-rwxr-xr-xetc/rc.interfaces_wan_configure8
-rwxr-xr-xusr/local/www/guiconfig.inc2117
-rwxr-xr-xusr/local/www/interfaces.php12
-rwxr-xr-xusr/local/www/services_dhcp_relay.php180
-rw-r--r--usr/local/www/system_groupmanager.php10
-rw-r--r--usr/local/www/system_groupmanager_addprivs.php10
-rwxr-xr-xusr/local/www/wizard.php11
-rw-r--r--usr/local/www/wizards/traffic_shaper_wizard.inc1194
-rw-r--r--usr/local/www/wizards/traffic_shaper_wizard.xml9
-rwxr-xr-xusr/local/www/wizards/traffic_shaper_wizard_dedicated.inc1237
-rwxr-xr-xusr/local/www/wizards/traffic_shaper_wizard_dedicated.xml12
-rwxr-xr-xusr/local/www/wizards/traffic_shaper_wizard_multi_all.inc1307
-rwxr-xr-xusr/local/www/wizards/traffic_shaper_wizard_multi_all.xml12
-rw-r--r--usr/local/www/wizards/traffic_shaper_wizard_multi_lan.inc829
-rw-r--r--usr/local/www/wizards/traffic_shaper_wizard_multi_lan.xml13
-rwxr-xr-xusr/local/www/xmlrpc.php19
25 files changed, 3398 insertions, 4370 deletions
diff --git a/etc/inc/filter.inc b/etc/inc/filter.inc
index 3182d9e..1f50139 100644
--- a/etc/inc/filter.inc
+++ b/etc/inc/filter.inc
@@ -144,10 +144,11 @@ function filter_delete_states_for_down_gateways() {
global $config;
$a_gateways = return_gateways_status();
- foreach ($a_gateways as $gateway) {
+ foreach ($a_gateways as $gwip => $gateway) {
if (stristr($status['status'], "down")) {
- if (is_ipaddr($gateway['srcip']))
- mwexec("/sbin/pfctl -b {$gateway['srcip']}");
+ if (is_ipaddr($gateway['srcip']) && is_ipaddr($gwip)) {
+ mwexec("/sbin/pfctl -b {$gateway['srcip']} -b {$gwip}");
+ }
}
}
}
diff --git a/etc/inc/interfaces.inc b/etc/inc/interfaces.inc
index 8aedff3..15c7a85 100644
--- a/etc/inc/interfaces.inc
+++ b/etc/inc/interfaces.inc
@@ -844,9 +844,8 @@ function interface_bring_down($interface = "wan", $destroy = false) {
sleep(2);
}
unlink_if_exists("{$g['varetc_path']}/mpd_{$interface}.conf");
- if (isset($ppp['ondemand']) && !$destroy) {
- interface_configure($interface);
- }
+ if (isset($ppp['ondemand']) && !$destroy)
+ file_put_contents("{$g['tmp_path']}/interface_configure", $interface);
break;
}
}
@@ -2322,7 +2321,7 @@ function interface_configure($interface = "wan", $reloadall = false) {
if (!$g['booting']) {
/* remove all IPv4 addresses */
while (mwexec("/sbin/ifconfig " . escapeshellarg($realif) . " -alias", true) == 0);
- interface_bring_down($interface);
+ interface_bring_down($interface, true);
}
/* wireless configuration? */
@@ -2372,9 +2371,16 @@ function interface_configure($interface = "wan", $reloadall = false) {
if (!empty($wancfg['mtu']))
pfSense_interface_mtu($realif, $wancfg['mtu']);
+ $options = pfSense_get_interface_addresses($realif);
+ if (is_array($options) && isset($options['caps']['polling'])) {
+ if (isset($config['system']['polling']))
+ pfSense_interface_capabilities($realif, IFCAP_POLLING);
+ else
+ pfSense_interface_capabilities($realif, -IFCAP_POLLING);
+ }
+
/* skip vlans for checksumming and polling */
- if (!stristr($realif, "vlan")) {
- $options = pfSense_get_interface_addresses($realif);
+ if (!stristr($realif, "vlan") && is_array($options)) {
$flags = 0;
if(isset($config['system']['disablechecksumoffloading'])) {
if (isset($options['encaps']['txcsum']))
@@ -2847,7 +2853,7 @@ function guess_interface_from_ip($ipaddress) {
return false;
}
/* create a route table we can search */
- exec("netstat -rnW", $output, $ret);
+ exec("netstat -rnWf inet", $output, $ret);
foreach($output as $line) {
if(preg_match("/^[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+\/[0-9]+[ ]+link[#]/", $line)) {
$fields = preg_split("/[ ]+/", $line);
diff --git a/etc/inc/pfsense-utils.inc b/etc/inc/pfsense-utils.inc
index 794d1b6..37cb340 100644
--- a/etc/inc/pfsense-utils.inc
+++ b/etc/inc/pfsense-utils.inc
@@ -275,26 +275,6 @@ function is_schedule_inuse($schedule) {
return false;
}
-/****f* pfsense-utils/setup_polling_defaults
- * NAME
- * sets up sysctls for polling
- * INPUTS
- *
- * RESULT
- * null
- * NOTES
- *
- ******/
-function setup_polling_defaults() {
- global $g, $config;
- if($config['system']['polling_each_burst'])
- mwexec("sysctl kern.polling.each_burst={$config['system']['polling_each_burst']}");
- if($config['system']['polling_burst_max'])
- mwexec("sysctl kern.polling.burst_max={$config['system']['polling_burst_max']}");
- if($config['system']['polling_user_frac'])
- mwexec("sysctl kern.polling.user_frac={$config['system']['polling_user_frac']}");
-}
-
/****f* pfsense-utils/setup_polling
* NAME
* sets up polling
@@ -308,25 +288,17 @@ function setup_polling_defaults() {
function setup_polling() {
global $g, $config;
- setup_polling_defaults();
-
if (isset($config['system']['polling']))
mwexec("/sbin/sysctl kern.polling.idle_poll=1");
else
mwexec("/sbin/sysctl kern.polling.idle_poll=0");
- /* if list */
- $iflist = get_configured_interface_list();
-
- foreach ($iflist as $ifent => $ifname) {
- $real_interface = get_real_interface($ifname);
- if (interface_supports_polling($real_interface)) {
- if (isset($config['system']['polling']))
- pfSense_interface_capabilities($real_interface, IFCAP_POLLING);
- else
- pfSense_interface_capabilities($real_interface, -IFCAP_POLLING);
- }
- }
+ if($config['system']['polling_each_burst'])
+ mwexec("/sbin/sysctl kern.polling.each_burst={$config['system']['polling_each_burst']}");
+ if($config['system']['polling_burst_max'])
+ mwexec("/sbin/sysctl kern.polling.burst_max={$config['system']['polling_burst_max']}");
+ if($config['system']['polling_user_frac'])
+ mwexec("/sbin/sysctl kern.polling.user_frac={$config['system']['polling_user_frac']}");
}
/****f* pfsense-utils/setup_microcode
diff --git a/etc/inc/services.inc b/etc/inc/services.inc
index 95d14fc..ff0b805 100644
--- a/etc/inc/services.inc
+++ b/etc/inc/services.inc
@@ -6,6 +6,7 @@
originally part of m0n0wall (http://m0n0.ch/wall)
Copyright (C) 2003-2004 Manuel Kasper <mk@neon1.net>.
+ Copyright (C) 2010 Ermal Luçi
All rights reserved.
Redistribution and use in source and binary forms, with or without
@@ -477,21 +478,10 @@ function services_dhcrelay_configure() {
/* kill any running dhcrelay */
killbypid("{$g['varrun_path']}/dhcrelay.pid");
- $dhcrelaycfg = $config['dhcrelay'];
+ $dhcrelaycfg =& $config['dhcrelay'];
/* DHCPRelay enabled on any interfaces? */
- $dhcrelayenable = false;
- if(is_array($dhcrelaycfg)) {
- foreach ($dhcrelaycfg as $dhcrelayif => $dhcrelayifconf) {
- if (isset($dhcrelayifconf['enable']) &&
- (($dhcrelayif == "lan") ||
- (isset($config['interfaces'][$dhcrelayif]['enable']) &&
- $config['interfaces'][$dhcrelayif]['if'] && (!link_interface_to_bridge($dhcrelayif)))))
- $dhcrelayenable = true;
- }
- }
-
- if (!$dhcrelayenable)
+ if (!isset($dhcrelaycfg['enable']))
return 0;
if ($g['booting'])
@@ -499,56 +489,79 @@ function services_dhcrelay_configure() {
else
sleep(1);
- $dhcrelayifs = array();
- foreach ($dhcrelaycfg as $dhcrelayif => $dhcrelayifconf) {
-
- $ifcfg = $config['interfaces'][$dhcrelayif];
+ $iflist = get_configured_interface_list();
- if (!isset($dhcrelayifconf['enable']) ||
- (($dhcrelayif != "lan") &&
- (!isset($ifcfg['enable']) || !$ifcfg['if'] ||
- link_interface_to_bridge($dhcrelayif))))
+ $dhcifaces = explode(",", $dhcrelaycfg['interface']);
+ foreach ($dhcifaces as $dhcrelayif) {
+ if (!isset($iflist[$dhcrelayif]) ||
+ link_interface_to_bridge($dhcrelayif))
continue;
- $dhcrelayifs[] = get_real_interface($dhcrelayif);
+ if (is_ipaddr(get_interface_ip($dhcrelayif)))
+ $dhcrelayifs[] = get_real_interface($dhcrelayif);
}
- /* In order for the relay to work, it needs to be active on the
- interface in which the destination server sits */
- $iflist = get_configured_interface_list();
- foreach ($iflist as $ifname) {
- $subnet = get_interface_ip($ifname) . "/" . get_interface_subnet($ifname);
- if (ip_in_subnet($dhcrelaycfg['server'],$subnet)) {
- $destif = get_real_interface($ifname);
- break;
+ /*
+ * In order for the relay to work, it needs to be active
+ * on the interface in which the destination server sits.
+ */
+ $srvips = explode(",", $dhcrelaycfg['server']);
+ foreach ($srvips as $srcidx => $srvip) {
+ unset($destif);
+ foreach ($iflist as $ifname) {
+ $subnet = get_interface_ip($ifname);
+ if (!is_ipaddr($subnet))
+ continue;
+ $subnet .= "/" . get_interface_subnet($ifname);
+ if (ip_in_subnet($srvip, $subnet)) {
+ $destif = get_real_interface($ifname);
+ break;
+ }
}
- }
- if (!isset($destif)) {
- if (is_array($config['staticroutes']['route'])) {
- foreach ($config['staticroutes']['route'] as $rtent) {
- if (ip_in_subnet($dhcrelaycfg['server'], $rtent['network'])) {
- $a_gateways = return_gateways_array(true);
- $destif = $a_gateways[$rtent['gateway']]['interface'];
- break;
+ if (!isset($destif)) {
+ if (is_array($config['staticroutes']['route'])) {
+ foreach ($config['staticroutes']['route'] as $rtent) {
+ if (ip_in_subnet($srvip, $rtent['network'])) {
+ $a_gateways = return_gateways_array(true);
+ $destif = $a_gateways[$rtent['gateway']]['interface'];
+ break;
+ }
}
}
}
- }
- if (!isset($destif)) {
- if (is_array($config['gateways']['gateway_item'])) {
- foreach ($config['gateways']['gateway_item'] as $gateway) {
- if (isset($gateway['defaultgw'])) {
- $a_gateways = return_gateways_array(true);
- $destif = $a_gateways[$rtent['gateway']]['interface'];
+ if (!isset($destif)) {
+ /* Create a array from the existing route table */
+ exec("/usr/bin/netstat -rnWf inet", $route_str);
+ array_shift($route_str);
+ array_shift($route_str);
+ array_shift($route_str);
+ array_shift($route_str);
+ $route_arr = array();
+ foreach($route_str as $routeline) {
+ $items = preg_split("/[ ]+/i", $routeline);
+ if (ip_in_subnet($srvip, $items[0])) {
+ $destif = trim($items[2]);
break;
- }
- }
- } else
- $destif = get_real_interface("wan");
- }
+ }
+ }
+ }
+
+ if (!isset($destif)) {
+ if (is_array($config['gateways']['gateway_item'])) {
+ foreach ($config['gateways']['gateway_item'] as $gateway) {
+ if (isset($gateway['defaultgw'])) {
+ $a_gateways = return_gateways_array(true);
+ $destif = $a_gateways[$rtent['gateway']]['interface'];
+ break;
+ }
+ }
+ } else
+ $destif = get_real_interface("wan");
+ }
- $dhcrelayifs[] = $destif;
+ $dhcrelayifs[] = $destif;
+ }
$dhcrelayifs = array_unique($dhcrelayifs);
/* fire up dhcrelay */
@@ -557,7 +570,7 @@ function services_dhcrelay_configure() {
if (isset($dhcrelaycfg['agentoption']))
$cmd .= " -a -m replace";
- $cmd .= " {$dhcrelaycfg['server']}";
+ $cmd .= " " . implode(" ", $srvips);
mwexec($cmd);
return 0;
diff --git a/etc/inc/system.inc b/etc/inc/system.inc
index 3606621..4689840 100644
--- a/etc/inc/system.inc
+++ b/etc/inc/system.inc
@@ -726,7 +726,7 @@ function system_generate_lighty_config($filename,
$document_root = "/usr/local/www/",
$cert_location = "cert.pem",
$ca_location = "ca.pem",
- $max_procs = 1,
+ $max_procs = 2,
$max_requests = "2",
$fast_cgi_enable = true,
$captive_portal = false) {
diff --git a/etc/inc/upgrade_config.inc b/etc/inc/upgrade_config.inc
index a59c855..f782b45 100644
--- a/etc/inc/upgrade_config.inc
+++ b/etc/inc/upgrade_config.inc
@@ -2069,4 +2069,25 @@ function upgrade_064_to_065() {
$config['system']['disablelargereceiveoffloading'] = true;
}
+function upgrade_065_to_066() {
+ global $config;
+
+ $dhcrelaycfg =& $config['dhcrelay'];
+
+ if (is_array($dhcrelaycfg)) {
+ $dhcrelayifs = array();
+ $foundifs = false;
+ /* DHCPRelay enabled on any interfaces? */
+ foreach ($dhcrelaycfg as $dhcrelayif => $dhcrelayifconf) {
+ if (isset($dhcrelayifconf['enable'])) {
+ $dhcrelayifs[] = $dhcrelayif;
+ unset($dhcrelaycfg['dhcrelayif']);
+ $foundifs = true;
+ }
+ }
+ if ($foundifs == true)
+ $dhcrelaycfg['interface'] = implode(",", $dhcrelayifs);
+ }
+}
+
?>
diff --git a/etc/inc/wizardapp.inc b/etc/inc/wizardapp.inc
new file mode 100644
index 0000000..bb9a6e4
--- /dev/null
+++ b/etc/inc/wizardapp.inc
@@ -0,0 +1,348 @@
+<?php
+/*
+ part of pfSense (http://www.pfsense.org/)
+
+ Copyright (C) 2006 Bill Marquette - bill.marquette@gmail.com.
+ Copyright (C) 2006 Scott Ullrich - sullrich@pfsense.com.
+ Copyright (C) 2008-2010 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.
+*/
+
+$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');
+
+$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');
+
+$gamesplist['deltaforce'] = array();
+ /* delta force */
+ $gamesplist['deltaforce'][] = array('Delta1', 'udp', '17478', '17488', 'both');
+
+$gamesplist['quakeiii'] = array();
+ /* 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');
+
+$gamesplist['callofduty'] = array();
+ $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');
+
+$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');
+
+$gamesplist['unrealtournament'] = array();
+ /* 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');
+
+$gamesplist['empireearth'] = array();
+ /* 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');
+
+$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');
+
+$gamesplist['farcry'] = array();
+ /* 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');
+
+$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');
+
+$gamesplist['wolfet'] = array();
+ /* 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');
+
+$gamesplist['battlenet'] = array();
+ /* Blizzard Publishing games */
+ $gamesplist['battlenet'][] = array('Battle.NET', 'tcp', '6112', '6119', 'both');
+ $gamesplist['battlenet'][] = array('Battle.NET-2', 'tcp', '1119', '1119', 'both');
+
+$gamesplist['worldofwarcraft'] = array();
+ $gamesplist[] = array('WoW', 'tcp', '3724', '3724', 'both');
+
+$gamesplist['battlenet'] = array();
+ /* Add battle.net only if WoW is selected and battle.net isn't */
+ $gamesplist[] = array('Battle.NET', 'tcp', '6112', '6119', 'both');
+
+$gamesplist['gunzonline'] = array();
+ /* GunZ Online */
+ $gamesplist['gunzonline'][] = array('GunZOnline', 'udp', '7700', '7700', 'both');
+
+$gamesplist['xbox360'] = array();
+ /* 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');
+
+ /* VoicePulse server */
+$voiplist['VoicePulse'] = array();
+ $voiplist['VoicePulse'][] = array('VoicePulse', 'udp', '16384', '16482', 'both');
+ $voiplist['VoicePulse'][] = array('VoicePulse', 'udp', '4569', '4569', 'both');
+
+ /* Panasonic Hybrid PBX */
+$voiplist['Panasonic'] = array();
+ $voiplist['Panasonic'][] = array('Panasonic1', 'udp', '8000', '8063', 'both');
+ $voiplist['Panasonic'][] = array('Panasonic2', 'udp', '9300', '9301', 'both');
+ $voiplist['Panasonic'][] = array('Panasonic3', 'udp', '2747', '2747', 'both');
+
+
+$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');
+
+
+
+$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['slingbox'] = array();
+ $othersplist['slingbox'][] = array('Slingbox1', 'tcp', '5001', '5001', 'both');
+ $othersplist['slingbox'][] = array('Slingbox2', 'udp', '5001', '5001', 'both');
+
+
+?>
diff --git a/etc/inc/zeromq.inc b/etc/inc/zeromq.inc
index 0e96aef..fe39e82 100644
--- a/etc/inc/zeromq.inc
+++ b/etc/inc/zeromq.inc
@@ -34,98 +34,127 @@ define('ZEROMQ_FASLE', 'false');
$do_not_include_config_gui_inc = true;
require("auth.inc");
+//$debug = true;
+
/* zeromq_send: Send a message to a member node */
-function zeromq_send($protocol = "tcp", $ipaddress, $port, $method, $params, $username, $password) {
- if(!$ipaddress || !$port || !$message || !$username || !$password)
- return;
-
+function zeromq_send($protocol = "tcp", $ipaddress = "127.0.0.1", $port = "8888",
+ $method, $params, $username, $password) {
+
+ global $debug;
+
/* Set calling function and auth information */
- $params['username'] = $username;
- $params['password'] = $password;
- $params['function'] = $method;
+ $xmlparams = array(
+ $username,
+ $password,
+ $method,
+ $params
+ );
- /* Serialize the data we are going to send over */
- $serialized = serialize($params);
-
/* Create new queue object */
$queue = new ZMQSocket(new ZMQContext(), ZMQ::SOCKET_REQ, "MySock1");
$queue->connect("{$protocol}://{$ipaddress}:{$port}");
/* Assign socket 1 to the queue, send and receive */
- $result = $queue->send($serialized)->recv();
+ $result = $queue->send(serialize($xmlparams))->recv();
- /* Unserialize the return and return */
+ /* xmlrpc_params_to_php() the result and return */
$unserializedresult = unserialize($result);
/* Return the result to the caller */
return $unserializedresult;
}
-function zeromq_server($protocol = "tcp", $ipaddress, $port) {
- if(!$ipaddress || !$port)
+function zeromq_server($protocol = "tcp", $ipaddress = "127.0.0.1", $port = "8888") {
+ global $debug;
+ if(!$ipaddress || !$port) {
+ if($debug)
+ echo "ERROR: You must pass, proto, ipaddress and port\n";
return;
+ }
+ if($debug)
+ echo "Creating ZMQSocket()\n";
$server = new ZMQSocket(new ZMQContext(), ZMQ::SOCKET_REP);
+ if($debug)
+ echo "Binding to {$protocol}://{$ipaddress}:{$port}\n";
$server->bind("{$protocol}://{$ipaddress}:{$port}");
- /* Loop receiving and echoing back */
+ if($debug)
+ echo "Entering while() loop\n";
while ($msg = $server->recv()) {
- $message = unserialize($msg);
- switch ($message['function']) {
+ // Convert the XML to a PHP array
+ $message = unserialize($msg);
+ if($debug) {
+ echo "Message received:\n";
+ print_r($message);
+ }
+ switch ($message[2]) {
case "pfsense.exec_shell":
$function_to_call = "exec_shell_zeromq";
- break;
+ break;
case "pfsense.exec_php":
$function_to_call = "exec_php_zeromq";
- break;
+ break;
case "pfsense.filter_configure":
$function_to_call = "filter_configure_zeromq";
- break;
+ break;
case "pfsense.interfaces_carp_configure":
$function_to_call = "interfaces_carp_configure_zeromq";
- break;
+ break;
case "pfsense.backup_config_section":
$function_to_call = "backup_config_section_zeromq";
- break;
+ break;
case "pfsense.restore_config_section":
$function_to_call = "restore_config_section_zeromq";
- break;
+ break;
case "pfsense.merge_config_section":
$function_to_call = "merge_config_section_zeromq";
- break;
+ break;
case "pfsense.merge_installedpackages_section_zeromq":
$function_to_call = "merge_installedpackages_section_zeromq";
- break;
+ break;
case "pfsense.check_firmware_version":
$function_to_call = "check_firmware_version_zeromq";
- break;
+ break;
case "pfsense.reboot":
$function_to_call = "reboot_zeromq";
- break;
+ break;
case "pfsense.get_notices":
$function_to_call = "get_notices_zeromq";
- break;
+ break;
}
- if(!$function_to_call)
+ if(!$function_to_call) {
+ if($debug)
+ echo "ERROR: Could not find a function to call";
return;
- // Call function that is being invoked
+ } else {
+ if($debug)
+ echo "Invoking function {$message[2]}()\n;";
+ }
+ /* Call function that is being invoked */
$result = $function_to_call($message);
- /* echo back the result */
- $server->send($result);
+ /* echo back the result */
+ $server->send($result);
}
}
function zeromq_auth($params) {
- global $config, $g;
+ global $config, $g, $debug;
- $username = $params['username'];
- $password = $params['password'];
+ $username = $params[0];
+ $passwd = $params[1];
$user = getUserEntry($username);
- if (!$user)
+ if (!$user) {
+ if($debug)
+ echo "Could not locate user $username with getUserEntry()\n";
return false;
+ }
- if (is_account_disabled($username) || is_account_expired($username))
+ if (is_account_disabled($username) || is_account_expired($username)) {
+ if($debug)
+ echo "Returning account expired/disabled\n";
return false;
-
+ }
+
if ($user['password']) {
$passwd = crypt($passwd, $user['password']);
if ($passwd == $user['password'])
@@ -138,79 +167,91 @@ function zeromq_auth($params) {
return true;
}
+ if($debug)
+ echo "zeromq_auth() fall through == false\n";
+
return false;
}
function exec_php_zeromq($raw_params) {
- global $config, $g;
- $params = xmlrpc_params_to_php($raw_params);
- if(!zeromq_auth($params))
+ global $config, $g, $debug;
+ $params = $raw_params;
+ if(zeromq_auth($raw_params) == false) {
+ if($debug)
+ echo "Auth failed in exec_shell_zeromq()\n";
return ZEROMQ_AUTH_FAIL;
- $exec_php = $params[0];
+ }
+ $exec_php = $params[3];
+ if($debug)
+ echo "Running exec_php_zeromq(): {$exec_php}\n";
eval($exec_php);
if($toreturn) {
- $response = XML_RPC_encode($toreturn);
- return new XML_RPC_Response($response);
+ return serialize($toreturn);
} else
return ZEROMQ_FASLE;
}
function exec_shell_zeromq($raw_params) {
- global $config, $g;
- $params = xmlrpc_params_to_php($raw_params);
- if(!zeromq_auth($params))
+ global $config, $g, $debug;
+ $params = $raw_params;
+ if(zeromq_auth($raw_params) == false) {
+ if($debug)
+ echo "Auth failed in exec_shell_zeromq()\n";
return ZEROMQ_AUTH_FAIL;
- $shell_cmd = $params[0];
+ }
+ $shell_cmd = $params[3];
+ if($debug)
+ echo "Running exec_shell_zeromq(): {$shell_cmd}\n";
mwexec($shell_cmd);
return ZEROMQ_FASLE;
}
function backup_config_section_zeromq($raw_params) {
- global $config, $g;
- $params = xmlrpc_params_to_php($raw_params);
- if(!zeromq_auth($params))
+ global $config, $g, $debug;
+ $params = $raw_params;
+ if(zeromq_auth($raw_params) == false)
return ZEROMQ_AUTH_FAIL;
- $val = array_intersect_key($config, array_flip($params[0]));
- return new XML_RPC_Response(XML_RPC_encode($val));
+ $val = array_intersect_key($config, array_flip($params[3]));
+ return serialize($val);
}
function restore_config_section_zeromq($raw_params) {
- global $config, $g;
- $params = xmlrpc_params_to_php($raw_params);
- if(!zeromq_auth($params))
+ global $config, $g, $debug;
+ $params = $raw_params;
+ if(zeromq_auth($raw_params) == false)
return ZEROMQ_AUTH_FAIL;
- $config = array_merge($config, $params[0]);
- $mergedkeys = implode(",", array_keys($params[0]));
- write_config(sprintf(gettext("Merged in config (%s sections) from XMLRPC client."),$mergedkeys));
+ $config = array_merge($config, $params[3]);
+ $mergedkeys = implode(",", array_keys($params[3]));
+ write_config(sprintf(gettext("Merged in config (%s sections) from ZeroMQ client."),$mergedkeys));
return ZEROMQ_FASLE;
}
function merge_installedpackages_section_zeromq($raw_params) {
- global $config, $g;
- $params = xmlrpc_params_to_php($raw_params);
- if(!zeromq_auth($params))
+ global $config, $g, $debug;
+ $params = $raw_params;
+ if(zeromq_auth($raw_params) == false)
return ZEROMQ_AUTH_FAIL;
$config['installedpackages'] = array_merge($config['installedpackages'], $params[0]);
- $mergedkeys = implode(",", array_keys($params[0]));
- write_config(sprintf(gettext("Merged in config (%s sections) from XMLRPC client."),$mergedkeys));
+ $mergedkeys = implode(",", array_keys($params[3]));
+ write_config(sprintf(gettext("Merged in config (%s sections) from ZeroMQ client."),$mergedkeys));
return ZEROMQ_FASLE;
}
function merge_config_section_zeromq($raw_params) {
- global $config, $g;
- $params = xmlrpc_params_to_php($raw_params);
- if(!zeromq_auth($params))
+ global $config, $g, $debug;
+ $params = $raw_params;
+ if(zeromq_auth($raw_params) == false)
return ZEROMQ_AUTH_FAIL;
$config = array_merge_recursive_unique($config, $params[0]);
- $mergedkeys = implode(",", array_keys($params[0]));
- write_config("Merged in config ({$mergedkeys} sections) from XMLRPC client.");
+ $mergedkeys = implode(",", array_keys($params[3]));
+ write_config("Merged in config ({$mergedkeys} sections) from ZeroMQ client.");
return ZEROMQ_FASLE;
}
function filter_configure_zeromq($raw_params) {
- global $config, $g;
- $params = xmlrpc_params_to_php($raw_params);
- if(!zeromq_auth($params))
+ global $config, $g, $debug;
+ $params = $raw_params;
+ if(zeromq_auth($raw_params) == false)
return ZEROMQ_AUTH_FAIL;
filter_configure();
system_routing_configure();
@@ -225,9 +266,9 @@ function filter_configure_zeromq($raw_params) {
}
function interfaces_carp_configure_zeromq($raw_params) {
- global $config, $g;
- $params = xmlrpc_params_to_php($raw_params);
- if(!zeromq_auth($params))
+ global $config, $g, $debug;
+ $params = $raw_params;
+ if(zeromq_auth($raw_params) == false)
return ZEROMQ_AUTH_FAIL;
interfaces_carp_setup();
interfaces_vips_configure();
@@ -235,25 +276,26 @@ function interfaces_carp_configure_zeromq($raw_params) {
}
function check_firmware_version_zeromq($raw_params) {
- global $XML_RPC_String;
- $params = xmlrpc_params_to_php($raw_params);
- if(!zeromq_auth($params)) return ZEROMQ_AUTH_FAIL;
- return new XML_RPC_Response(new XML_RPC_Value(check_firmware_version(false), $XML_RPC_String));
+ global $config, $g, $debug;
+ $params = $raw_params;
+ if(zeromq_auth($raw_params) == false)
+ return ZEROMQ_AUTH_FAIL;
+ return serialize(check_firmware_version(false));
}
function reboot_zeromq($raw_params) {
- global $config, $g;
- $params = xmlrpc_params_to_php($raw_params);
- if(!zeromq_auth($params))
+ global $config, $g, $debug;
+ $params = $raw_params;
+ if(zeromq_auth($raw_params) == false)
return ZEROMQ_AUTH_FAIL;
mwexec_bg("/etc/rc.reboot");
return ZEROMQ_FASLE;
}
function get_notices_zeromq($raw_params) {
- global $g;
- $params = xmlrpc_params_to_php($raw_params);
- if(!zeromq_auth($params))
+ global $config, $g, $debug;
+ $params = $raw_params;
+ if(zeromq_auth($raw_params) == false)
return ZEROMQ_AUTH_FAIL;
require("notices.inc");
if(!$params) {
@@ -261,8 +303,7 @@ function get_notices_zeromq($raw_params) {
} else {
$toreturn = get_notices($params);
}
- $response = new XML_RPC_Response(XML_RPC_encode($toreturn));
- return $response;
+ return serialize($toreturn);
}
?>
diff --git a/etc/rc.bootup b/etc/rc.bootup
index 0cd201a..6141d91 100755
--- a/etc/rc.bootup
+++ b/etc/rc.bootup
@@ -208,6 +208,16 @@ echo "Starting Secure Shell Services...";
mwexec_bg("/etc/sshd");
echo "done.\n";
+/* setup polling */
+echo "Setting up polling defaults...";
+setup_polling();
+echo "done.\n";
+
+/* setup interface microcode which improves tcp/ip speed */
+echo "Setting up interfaces microcode...";
+setup_microcode();
+echo "done.\n";
+
/* set up interfaces */
if(!$debugging)
mute_kernel_msgs();
@@ -306,14 +316,6 @@ voucher_configure();
/* run any shell commands specified in config.xml */
system_do_shell_commands();
-/* setup polling */
-setup_polling();
-
-/* setup interface microcode which improves tcp/ip speed */
-echo "Setting up microcode and tx/rx offloading...";
-setup_microcode();
-echo "done.\n";
-
/* start IPsec tunnels */
vpn_ipsec_configure();
diff --git a/etc/rc.interfaces_wan_configure b/etc/rc.interfaces_wan_configure
index 02063f5..3969777 100755
--- a/etc/rc.interfaces_wan_configure
+++ b/etc/rc.interfaces_wan_configure
@@ -34,6 +34,12 @@ require_once("functions.inc");
require_once("filter.inc");
require_once("shaper.inc");
-interface_configure("wan");
+$argument = str_replace("\n", "", $argv[1]);
+if (empty($argument))
+ interface_configure("wan");
+else {
+ if (!empty($config['interfaces'][$argument]))
+ interface_configure($argument);
+}
?>
diff --git a/usr/local/www/guiconfig.inc b/usr/local/www/guiconfig.inc
index 76678b2..ae8cbab 100755
--- a/usr/local/www/guiconfig.inc
+++ b/usr/local/www/guiconfig.inc
@@ -1,1059 +1,1058 @@
-<?php
-/* $Id$ */
-/*
- guiconfig.inc
- by Scott Ullrich, Copyright 2004, All rights reserved.
- originally based on of m0n0wall (http://m0n0.ch/wall)
-
- Copyright (C) 2003-2004 Manuel Kasper <mk@neon1.net>.
- All rights reserved.
-
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions are met:
-
- 1. Redistributions of source code must retain the above copyright notice,
- this list of conditions and the following disclaimer.
-
- 2. Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
-
- THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
- INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
- AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
- OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- POSSIBILITY OF SUCH DAMAGE.
-*/
-/*
- pfSense_MODULE: base
-*/
-
-/* Include authentication routines */
-/* THIS MUST BE ABOVE ALL OTHER CODE */
-require_once("authgui.inc");
-
-/* make sure nothing is cached */
-if (!$omit_nocacheheaders) {
- header("Expires: 0");
- header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
- header("Cache-Control: no-store, no-cache, must-revalidate");
- header("Cache-Control: post-check=0, pre-check=0", false);
- header("Pragma: no-cache");
-}
-
-/* parse the configuration and include all configuration functions */
-require_once("functions.inc");
-
-/* Pull in all the gui related display classes) */
-foreach (scandir("/usr/local/www/classes/") as $file) {
- if (stristr($file, ".inc") !== false) {
- require_once("classes/{$file}");
- }
-}
-/*
- * if user has selected a custom template, use it.
- * otherwise default to pfsense template
- */
-if($config['theme'] <> "")
- $g['theme'] = $config['theme'];
-else
- $g['theme'] = "pfsense";
-
-/*
- * If this device is an apple ipod/iphone
- * switch the theme to one that works with it.
- */
-$apple_ua = array("iPhone","iPod", "iPad");
-foreach($apple_ua as $useragent)
- if(strstr($_SERVER['HTTP_USER_AGENT'], $useragent))
- $g['theme'] = "pfsense";
-
-/* used by progress bar */
-$lastseen = "-1";
-
-$navlevelsep = ": "; /* navigation level separator string */
-$mandfldhtml = ""; /* display this before mandatory input fields */
-$mandfldhtmlspc = ""; /* same as above, but with spacing */
-
-/* Some ajax scripts still need access to GUI */
-if(!$ignorefirmwarelock) {
- if (is_subsystem_dirty('firmwarelock')) {
- if (!$d_isfwfile) {
- header("Location: system_firmware.php");
- exit;
- } else {
- return;
- }
- }
-}
-
-$firewall_rules_dscp_types = array("af11",
- "af12",
- "af13",
- "af21",
- "af22",
- "af23",
- "af31",
- "af32",
- "af33",
- "af41",
- "af42",
- "af43",
- "EF",
- "1-64",
- "0x10",
- "0x04-0xfc");
-
-$auth_server_types = array(
- 'ldap' => "LDAP",
- 'radius' => "Radius");
-
-$ldap_urltypes = array(
- 'TCP - Standard' => 389,
- 'SSL - Encrypted' => 636);
-
-$ldap_scopes = array(
- 'one' => "One Level",
- 'subtree' => "Entire Subtree");
-
-$ldap_protvers = array(
- 2,
- 3);
-
-$ldap_templates = array(
-
- 'open' => array(
- 'desc' => "OpenLDAP",
- 'attr_user' => "cn",
- 'attr_group' => "cn",
- 'attr_member' => "member"),
-
- 'msad' => array(
- 'desc' => "Microsoft AD",
- 'attr_user' => "samAccountName",
- 'attr_group' => "cn",
- 'attr_member' => "memberOf"),
-
- 'edir' => array(
- 'desc' => "Novell eDirectory",
- 'attr_user' => "cn",
- 'attr_group' => "cn",
- 'attr_member' => "uniqueMember"));
-
-$radius_srvcs = array(
- 'both' => "Authentication and Accounting",
- 'auth' => "Authentication",
- 'acct' => "Accounting");
-
-$netbios_nodetypes = array(
- '0' => "none",
- '1' => "b-node",
- '2' => "p-node",
- '4' => "m-node",
- '5' => "h-node");
-
-/* some well knows ports */
-$wkports = array(
- 5999 => "CVSup",
- 53 => "DNS",
- 21 => "FTP",
- 3000 => "HBCI",
- 80 => "HTTP",
- 443 => "HTTPS",
- 5190 => "ICQ",
- 113 => "IDENT/AUTH",
- 143 => "IMAP",
- 993 => "IMAP/S",
- 4500 => "IPsec NAT-T",
- 500 => "ISAKMP",
- 1701 => "L2TP",
- 389 => "LDAP",
- 1755 => "MMS/TCP",
- 7000 => "MMS/UDP",
- 445 => "MS DS",
- 3389 => "MS RDP",
- 1512 => "MS WINS",
- 1863 => "MSN",
- 119 => "NNTP",
- 123 => "NTP",
- 138 => "NetBIOS-DGM",
- 137 => "NetBIOS-NS",
- 139 => "NetBIOS-SSN",
- 1194 => "OpenVPN",
- 110 => "POP3",
- 995 => "POP3/S",
- 1723 => "PPTP",
- 1812 => "RADIUS",
- 1813 => "RADIUS accounting",
- 5004 => "RTP",
- 5060 => "SIP",
- 25 => "SMTP",
- 465 => "SMTP/S",
- 161 => "SNMP",
- 162 => "SNMP-Trap",
- 22 => "SSH",
- 3478 => "STUN",
- 3544 => "Teredo",
- 23 => "Telnet",
- 69 => "TFTP",
- 5900 => "VNC");
-
-/* TCP flags */
-$tcpflags = array("fin", "syn", "rst", "psh", "ack", "urg");
-
-$specialnets = array("pptp" => "PPTP clients", "pppoe" => "PPPoE clients", "l2tp" => "L2TP clients");
-
-$spiflist = get_configured_interface_with_descr(false, true);
-foreach ($spiflist as $ifgui => $ifdesc) {
- $specialnets[$ifgui] = $ifdesc . " net";
- $specialnets[$ifgui . 'ip'] = $ifdesc . " address";
-}
-
-$medias = array("auto" => "autoselect", "100full" => "100BASE-TX full-duplex",
- "100half" => "100BASE-TX half-duplex", "10full" => "10BASE-T full-duplex",
- "10half" => "10BASE-T half-duplex");
-
-$wlan_modes = array("bss" => "Infrastructure (BSS)", "adhoc" => "Ad-hoc (IBSS)",
- "hostap" => "Access Point");
-
-/* platforms that support firmware updating */
-$fwupplatforms = array('pfSense', 'net45xx', 'net48xx', 'generic-pc', 'embedded', 'wrap', 'nanobsd');
-
-function do_input_validation($postdata, $reqdfields, $reqdfieldsn, $input_errors) {
-
- /* check for bad control characters */
- foreach ($postdata as $pn => $pd) {
- if (is_string($pd) && preg_match("/[\\x00-\\x08\\x0b\\x0c\\x0e-\\x1f]/", $pd)) {
- $input_errors[] = "The field '" . $pn . "' contains invalid characters.";
- }
- }
-
- for ($i = 0; $i < count($reqdfields); $i++) {
- if ($_POST[$reqdfields[$i]] == "" && $_REQUEST[$reqdfields[$i]] == "") {
- $input_errors[] = "The field '" . $reqdfieldsn[$i] . "' is required.";
- }
- }
-}
-
-function print_input_errors($input_errors) {
- global $g;
-
- print <<<EOF
- <p>
- <table border="0" cellspacing="0" cellpadding="4" width="100%">
- <tr>
- <td class="inputerrorsleft">
- <img src="./themes/{$g['theme']}/images/icons/icon_error.gif">
- </td>
- <td class="inputerrorsright">
- <span class="errmsg"><p>
- The following input errors were detected:
- <ul>
-EOF;
- foreach ($input_errors as $ierr) {
- echo "<li>" . htmlspecialchars($ierr) . "</li>";
- }
-
- print <<<EOF2
- </ul>
- </span>
- </td></tr>
- </table>
- </p>&nbsp;<br>
-EOF2;
-
-}
-
-function verify_gzip_file($fname) {
-
- $returnvar = mwexec("/usr/bin/gzip -t " . escapeshellarg($fname));
- if ($returnvar != 0)
- return 0;
- else
- return 1;
-}
-
-function print_info_box_np($msg, $name="apply",$value="Apply changes") {
- global $g, $nifty_redbox, $nifty_blackbox, $nifty_background;
-
- // Set the Nifty background color if one is not set already (defaults to white)
- if($nifty_background == "")
- $nifty_background = "#FFF";
-
- if(stristr($msg, "apply") != false || stristr($msg, "save") != false || stristr($msg, "create") != false) {
- $savebutton = "<td class='infoboxsave'>";
- $savebutton .= "<input name=\"{$name}\" type=\"submit\" class=\"formbtn\" id=\"${name}\" value=\"{$value}\">";
- if($_POST['if'])
- $savebutton .= "<input type='hidden' name='if' value='{$_POST['if']}'>";
- $savebutton.="</td>";
- }
- $nifty_redbox = "#990000";
- $nifty_blackbox = "#000000";
-
- $themename = $g['theme'];
-
- if(file_exists("/usr/local/www/themes/{$themename}/tabcontrols.php")) {
- $toeval = file_get_contents("/usr/local/www/themes/{$themename}/tabcontrols.php");
- eval($toeval);
- }
-
- if(file_exists("/usr/local/www/themes/{$themename}/infobox.php")) {
- $toeval = file_get_contents("/usr/local/www/themes/{$themename}/infobox.php");
- eval($toeval);
- }
-
- if(!$savebutton) {
- $savebutton = '<td class="infoboxsave"><input value="Close" type="button" onClick="$(\'redboxtable\').hide();"></td>';
- }
-
- echo <<<EOFnp
- <table class='infobox' id='redboxtable'>
- <tr>
- <td>
- <div class='infoboxnp' id='redbox'>
- <table class='infoboxnptable2'>
- <tr>
- <td class='infoboxnptd'>
- &nbsp;&nbsp;&nbsp;<img class='infoboxnpimg' src="/themes/{$g['theme']}/images/icons/icon_exclam.gif" >
- </td>
- <td class='infoboxnptd2'>
- <b>{$msg}</b>
- </td>
- {$savebutton}
- </tr>
- </table>
- </div>
- <div>
- <p/>
- </div>
- </td>
- </tr>
- </table>
- <script type="text/javascript">
- NiftyCheck();
- Rounded("div#redbox","all","{$nifty_background}","{$nifty_redbox}","smooth");
- Rounded("td#blackbox","all","{$nifty_background}","{$nifty_blackbox}","smooth");
- </script>
-EOFnp;
-
-}
-
-function print_info_box_np_undo($msg, $name="apply",$value="Apply changes", $undo) {
- global $g;
-
- if(stristr($msg, "apply") != false || stristr($msg, "save") != false || stristr($msg, "create") != false) {
- $savebutton = "<td class='infoboxsave'><nobr>";
- $savebutton .= " <input type=\"button\" value=\"Undo\" onClick=\"document.location='{$undo}'\">";
- $savebutton .= " <input name=\"{$name}\" type=\"submit\" class=\"formbtn\" id=\"${name}\" value=\"{$value}\">";
- $savebutton.="</nobr></td>";
- if($_POST['if'])
- $savebutton .= "<input type='hidden' name='if' value='{$_POST['if']}'>";
- }
- $nifty_redbox = "#990000";
- $nifty_blackbox = "#000000";
-
- $themename = $g['theme'];
-
- if(file_exists("/usr/local/www/themes/{$themename}/tabcontrols.php")) {
- $toeval = file_get_contents("/usr/local/www/themes/{$themename}/tabcontrols.php");
- eval($toeval);
- }
-
- if(file_exists("/usr/local/www/themes/{$themename}/infobox.php")) {
- $toeval = file_get_contents("/usr/local/www/themes/{$themename}/infobox.php");
- eval($toeval);
- }
-
-
- if(!$savebutton) {
- $savebutton = '<td class="infoboxsave"><input value="Close" type="button" onClick="$(\'redboxtable\').hide();"></td>';
- }
-
- echo <<<EOFnp
- <table class='infobox' id='redboxtable'>
- <tr>
- <td>
- <div class='infoboxnp' id='redbox'>
- <table class='infoboxnptable2'>
- <tr>
- <td class='infoboxnptd'>
- &nbsp;&nbsp;&nbsp;<img class='infoboxnpimg' src="/themes/{$g['theme']}/images/icons/icon_exclam.gif" >
- </td>
- <td class='infoboxnptd2'>
- <b>{$msg}</b>
- </td>
- {$savebutton}
- {$undobutton}
- </tr>
- </table>
- </div>
- <div>
- <p/>
- </div>
- </td>
- </tr>
- </table>
- <script type="text/javascript">
- NiftyCheck();
- Rounded("div#redbox","all","#FFF","{$nifty_redbox}","smooth");
- Rounded("td#blackbox","all","#FFF","{$nifty_blackbox}","smooth");
- </script>
-EOFnp;
-
-}
-
-function print_info_box($msg) {
- print_info_box_np($msg);
-}
-
-function get_std_save_message($ok) {
- global $d_sysrebootreqd_path;
-
- return "The changes have been applied successfully. You can also <a href='status_filter_reload.php'>monitor</a> the filter reload progress.";
-}
-
-function pprint_address($adr) {
- global $specialnets;
-
- if (isset($adr['any'])) {
- $padr = "*";
- } else if ($adr['network']) {
- $padr = $specialnets[$adr['network']];
- } else {
- $padr = $adr['address'];
- }
-
- if (isset($adr['not']))
- $padr = "! " . $padr;
-
- return $padr;
-}
-
-function pprint_port($port) {
- global $wkports;
-
- $pport = "";
-
- if (!$port)
- return "*";
- else {
- $srcport = explode("-", $port);
- if ((!$srcport[1]) || ($srcport[0] == $srcport[1])) {
- $pport = $srcport[0];
- if ($wkports[$srcport[0]]) {
- $pport .= " (" . $wkports[$srcport[0]] . ")";
- }
- } else
- $pport .= $srcport[0] . " - " . $srcport[1];
- }
-
- return $pport;
-}
-
-/* sort by interface only, retain the original order of rules that apply to
- the same interface */
-function filter_rules_sort() {
- global $config;
-
- /* mark each rule with the sequence number (to retain the order while sorting) */
- for ($i = 0; isset($config['filter']['rule'][$i]); $i++)
- $config['filter']['rule'][$i]['seq'] = $i;
-
- function filtercmp($a, $b) {
- if ($a['interface'] == $b['interface'])
- return $a['seq'] - $b['seq'];
- else
- return -strcmp($a['interface'], $b['interface']);
- }
-
- usort($config['filter']['rule'], "filtercmp");
-
- /* strip the sequence numbers again */
- for ($i = 0; isset($config['filter']['rule'][$i]); $i++)
- unset($config['filter']['rule'][$i]['seq']);
-}
-
-function gentitle($title) {
- global $navlevelsep;
- if(!is_array($title))
- return $title;
- else
- return join($navlevelsep, $title);
-}
-
-function genhtmltitle($title) {
- global $config;
- return gentitle($title);
-}
-
-/* update the changedesc and changecount(er) variables */
-function update_changedesc($update) {
- global $changedesc;
- global $changecount;
-
- $changedesc .= " {$update}";
- $changecount++;
-}
-
-function clear_log_file($logfile = "/var/log/system.log") {
- global $config, $g;
- exec("/usr/bin/killall syslogd");
- if(isset($config['system']['disablesyslogclog'])) {
- unlink($logfile);
- touch($logfile);
- } else {
- if(isset($config['system']['usefifolog']))
- exec("/usr/sbin/fifolog_create -s 511488 {$logfile}");
- else
- exec("/usr/sbin/clog -i -s 511488 {$logfile}");
- }
- system_syslogd_start();
-}
-
-function dump_clog($logfile, $tail, $withorig = true, $grepfor = "", $grepinvert = "") {
- global $g, $config;
- $sor = isset($config['syslog']['reverse']) ? "-r" : "";
- $logarr = "";
- $grepline = " ";
- if(is_array($grepfor))
- foreach($grepfor as $agrep)
- $grepline .= " | grep \"$agrep\"";
- if(is_array($grepinvert))
- foreach($grepinvert as $agrep)
- $grepline .= " | grep -v \"$agrep\"";
- if(file_exists($logfile) && filesize($logfile) == 0) {
- $logarr = array("Log file started.");
- } else {
- if($config['system']['disablesyslogclog']) {
- exec("cat {$logfile}{$grepline} | /usr/bin/tail {$sor} -n {$tail}", $logarr);
- } else {
- if(isset($config['system']['usefifolog']))
- exec("/usr/sbin/fifolog_reader {$logfile}{$grepline} | /usr/bin/tail {$sor} -n {$tail}", $logarr);
- else
- exec("/usr/sbin/clog {$logfile}{$grepline}| grep -v \"CLOG\" | grep -v \"\033\" | /usr/bin/tail {$sor} -n {$tail}", $logarr);
- }
- }
- foreach ($logarr as $logent) {
- $logent = preg_split("/\s+/", $logent, 6);
- echo "<tr valign=\"top\">\n";
- if ($withorig) {
- if(isset($config['system']['usefifolog'])) {
- $entry_date_time = htmlspecialchars(date("F j, Y, g:i a","" . $logent[1] . ""));
- $entry_text = htmlspecialchars($logent[5]);
- } else {
- $entry_date_time = htmlspecialchars(join(" ", array_slice($logent, 0, 3)));
- $entry_text = htmlspecialchars($logent[4] . " " . $logent[5]);
- }
- echo "<td class=\"listlr\" nowrap>{$entry_date_time}</td>\n";
- echo "<td class=\"listr\">{$entry_text}</td>\n";
-
- } else {
- echo "<td class=\"listlr\" colspan=\"2\">" . htmlspecialchars($logent[5]) . "</td>\n";
- }
- echo "</tr>\n";
- }
-}
-
-function return_clog($logfile, $tail, $withorig = true, $grepfor = "", $grepinvert = "", $grepreverse = false) {
- global $g, $config;
- $sor = (isset($config['syslog']['reverse']) || $grepreverse) ? "-r" : "";
- $logarr = "";
- $grepline = " ";
- if(is_array($grepfor))
- foreach($grepfor as $agrep)
- $grepline .= " | grep \"$agrep\"";
- if(is_array($grepinvert))
- foreach($grepinvert as $agrep)
- $grepline .= " | grep -v \"$agrep\"";
- if($config['system']['disablesyslogclog']) {
- exec("cat {$logfile}{$grepline} | /usr/bin/tail {$sor} -n {$tail}", $logarr);
- } else {
- if(isset($config['system']['usefifolog'])) {
- exec("/usr/sbin/fifolog_reader {$logfile}{$grepline} | /usr/bin/tail {$sor} -n {$tail}", $logarr);
- } else {
- exec("/usr/sbin/clog {$logfile}{$grepline}| grep -v \"CLOG\" | grep -v \"\033\" | /usr/bin/tail {$sor} -n {$tail}", $logarr);
- }
- }
- return($logarr);
-}
-
-/* Check if variable has changed, update and log if it has
- * returns true if var changed
- * varname = variable name in plain text
- * orig = original value
- * new = new value
- */
-function update_if_changed($varname, & $orig, $new) {
- if (is_array($orig) && is_array($new)) {
- $a_diff = array_diff($orig, $new);
- foreach ($a_diff as $diff) {
- update_changedesc("removed {$varname}: \"{$diff}\"");
- }
- $a_diff = array_diff($new, $orig);
- foreach ($a_diff as $diff) {
- update_changedesc("added {$varname}: \"{$diff}\"");
- }
- $orig = $new;
- return true;
-
- } else {
- if ($orig != $new) {
- update_changedesc("{$varname}: \"{$orig}\" -> \"{$new}\"");
- $orig = $new;
- return true;
- }
- }
- return false;
-}
-
-function address_to_pconfig($adr, &$padr, &$pmask, &$pnot, &$pbeginport, &$pendport) {
-
- if (isset($adr['any']))
- $padr = "any";
- else if ($adr['network'])
- $padr = $adr['network'];
- else if ($adr['address']) {
- list($padr, $pmask) = explode("/", $adr['address']);
- if (!$pmask)
- $pmask = 32;
- }
-
- if (isset($adr['not']))
- $pnot = 1;
- else
- $pnot = 0;
-
- if ($adr['port']) {
- list($pbeginport, $pendport) = explode("-", $adr['port']);
- if (!$pendport)
- $pendport = $pbeginport;
- } else if (!is_alias($pbeginport) && !is_alias($pendport)) {
- $pbeginport = "any";
- $pendport = "any";
- }
-}
-
-function pconfig_to_address(&$adr, $padr, $pmask, $pnot=false, $pbeginport=0, $pendport=0) {
-
- $adr = array();
-
- if ($padr == "any")
- $adr['any'] = true;
- else if (is_specialnet($padr))
- $adr['network'] = $padr;
- else {
- $adr['address'] = $padr;
- if ($pmask != 32)
- $adr['address'] .= "/" . $pmask;
- }
-
- if ($pnot)
- $adr['not'] = true;
- else
- unset($adr['not']);
-
- if (($pbeginport != 0) && ($pbeginport != "any")) {
- if ($pbeginport != $pendport)
- $adr['port'] = $pbeginport . "-" . $pendport;
- else
- $adr['port'] = $pbeginport;
- }
-
- if(is_alias($pbeginport)) {
- $adr['port'] = $pbeginport;
- }
-}
-
-function is_specialnet($net) {
- global $specialsrcdst;
-
- if(!$net)
- return false;
- if (in_array($net, $specialsrcdst))
- return true;
- else
- return false;
-}
-
-//function to create widget tabs when called
-function display_widget_tabs(& $tab_array) {
- echo "<div id='tabs'>";
- $tabscounter = 0;
- foreach ($tab_array as $ta) {
- $dashpos = strpos($ta[2],'-');
- $tabname = $ta[2] . "-tab";
- $tabclass = substr($ta[2],0,$dashpos);
- $tabclass = $tabclass . "-class";
- if ($ta[1] == true) {
- $tabActive = "table-cell";
- $tabNonActive = "none";
- }
- else {
- $tabActive = "none";
- $tabNonActive = "table-cell";
- }
- echo "<div id='{$ta[2]}-active' class='{$tabclass}-tabactive' style='display:{$tabActive}; background-color:#EEEEEE; color:black;'>";
- echo "<B>&nbsp;&nbsp;&nbsp;{$ta[0]}";
- echo "&nbsp;&nbsp;&nbsp;</B>";
- echo "</div>";
-
- echo "<div id='{$ta[2]}-deactive' class='{$tabclass}-tabdeactive' style='display:{$tabNonActive}; background-color:#777777; color:white; cursor: pointer;' onClick=\"return changeTabDIV('{$ta[2]}')\">";
- echo "<B>&nbsp;&nbsp;&nbsp;{$ta[0]}";
- echo "&nbsp;&nbsp;&nbsp;</B>";
- echo "</div>";
- }
-
- echo "<script type=\"text/javascript\">";
- echo "NiftyCheck();\n";
- echo "Rounded(\"div.{$tabclass}-tabactive\",\"top\",\"#CCCCCC\",\"#EEEEEE\",\"smooth\");\n";
- echo "Rounded(\"div.{$tabclass}-tabdeactive\",\"top\",\"#CCCCCC\",\"#777777\",\"smooth\");\n";
- echo "</script>";
- echo "</div>";
-}
-
-
-// Return inline javascript file or CSS to minimizie
-// request count going back to server.
-function outputJavaScriptFileInline($javascript) {
- if(file_exists($javascript)) {
- echo "\n<script type=\"text/javascript\">\n";
- include($javascript);
- echo "\n</script>\n";
- } else {
- echo "\n\n<!-- Could not location file: {$javascript} -->\n\n";
- }
-}
-
-
-
-function outputCSSPrintFileInline($css) {
- if(file_exists($css)) {
- echo "\n<style media=\"print\" type=\"text/css\">\n";
- include($css);
- echo "\n</style>\n";
- } else {
- echo "\n\n<!-- Could not location file: {$css} -->\n\n";
- }
-}
-
-
-function outputCSSFileInline($css) {
- if(file_exists($css)) {
- echo "\n<style type=\"text/css\">\n";
- include($css);
- echo "\n</style>\n";
- } else {
- echo "\n\n<!-- Could not location file: {$css} -->\n\n";
- }
-}
-
-$rfc2616 = array(
- 100 => "100 Continue",
- 101 => "101 Switching Protocols",
- 200 => "200 OK",
- 201 => "201 Created",
- 202 => "202 Accepted",
- 203 => "203 Non-Authoritative Information",
- 204 => "204 No Content",
- 205 => "205 Reset Content",
- 206 => "206 Partial Content",
- 300 => "300 Multiple Choices",
- 301 => "301 Moved Permanently",
- 302 => "302 Found",
- 303 => "303 See Other",
- 304 => "304 Not Modified",
- 305 => "305 Use Proxy",
- 306 => "306 (Unused)",
- 307 => "307 Temporary Redirect",
- 400 => "400 Bad Request",
- 401 => "401 Unauthorized",
- 402 => "402 Payment Required",
- 403 => "403 Forbidden",
- 404 => "404 Not Found",
- 405 => "405 Method Not Allowed",
- 406 => "406 Not Acceptable",
- 407 => "407 Proxy Authentication Required",
- 408 => "408 Request Timeout",
- 409 => "409 Conflict",
- 410 => "410 Gone",
- 411 => "411 Length Required",
- 412 => "412 Precondition Failed",
- 413 => "413 Request Entity Too Large",
- 414 => "414 Request-URI Too Long",
- 415 => "415 Unsupported Media Type",
- 416 => "416 Requested Range Not Satisfiable",
- 417 => "417 Expectation Failed",
- 500 => "500 Internal Server Error",
- 501 => "501 Not Implemented",
- 502 => "502 Bad Gateway",
- 503 => "503 Service Unavailable",
- 504 => "504 Gateway Timeout",
- 505 => "505 HTTP Version Not Supported"
-);
-
-function is_rfc2616_code($code) {
- global $rfc2616;
- if (isset($rfc2616[$code]))
- return true;
- else
- return false;
-}
-
-function print_rfc2616_select($tag, $current){
- global $rfc2616;
-
- /* Default to 200 OK if not set */
- if ($current == "")
- $current = 200;
-
- echo "<select id=\"{$tag}\" name=\"{$tag}\">\n";
- foreach($rfc2616 as $code => $message) {
- if ($code == $current) {
- $sel = " selected";
- } else {
- $sel = "";
- }
- echo "<option value=\"{$code}\"{$sel}>{$message}</option>\n";
- }
-}
-
-// Useful debugging function, much cleaner than print_r
-function echo_array($array,$return_me=false){
- if(is_array($array) == false){
- $return = "The provided variable is not an array.";
- }else{
- foreach($array as $name=>$value){
- if(is_array($value)){
- $return .= "";
- $return .= "['<b>$name</b>'] {<div style='margin-left:10px;'>\n";
- $return .= echo_array($value,true);
- $return .= "</div>}";
- $return .= "\n\n";
- }else{
- if(is_string($value)){
- $value = "\"$value\"";
- }
- $return .= "['<b>$name</b>'] = $value\n\n";
- }
- }
- }
- if($return_me == true){
- return $return;
- }else{
- echo "<pre>".$return."</pre>";
- }
-}
-
-/****f* pfsense-utils/display_top_tabs
- * NAME
- * display_top_tabs - display tabs with rounded edges
- * INPUTS
- * $text - array of tabs
- * RESULT
- * null
- ******/
-function display_top_tabs(& $tab_array) {
- global $HTTP_SERVER_VARS;
- global $config;
- global $g;
- global $tab_array_indent;
- global $tab_array_space;
- global $tab_array_char_limit;
-
- /* does the user have access to this tab?
- * master user has access to everything.
- * if the user does not have access, simply
- * unset the tab item.
- */
-
- /* empty string code */
- if ($tab_array_indent == '')
- {
- $tab_array_indent = 0;
- }
- if ($tab_array_space == '')
- {
- $tab_array_space = 1;
- }
- if ($tab_array_char_limit == '')
- {
- $tab_array_char_limit = 82;
- }
-
- $tab_temp = array ();
- foreach ($tab_array as $ta)
- if(isAllowedPage($ta[2]))
- $tab_temp[] = $ta;
- /*
- // FIXME : if the checks are not good enough
- // in isAllowedPage, it needs to be
- // fixed instead of kludging here
-
- // TODO: humm what shall we do with pkg_edit.php and pkg.php?
- if ((strpos($link, "pkg.php")) !== false || (strpos($link, "pkg_edit.php")) !== false) {
- $pos_equal = strpos($link, "=");
- $pos_xmlsuffix = strpos($link, ".xml");
- // do we match an absolute url including ?xml= foo
- if(!isAllowedPage($link, $allowed))
- $link = substr($link, $pos_equal +1, ($pos_xmlsuffix - $pos_equal +3));
- }
- // next check - what if the basename contains a query string?
- if ((strpos($link, "?")) !== false) {
- $pos_qmark = strpos($link, "?");
- $link = substr($link, 0, $pos_qmark);
- }
- $authorized_text = print_r($allowed, true);
- if(is_array($authorized))
- if (in_array(basename($link), $authorized))
- */
-
- unset ($tab_array);
- $tab_array = & $tab_temp;
-
- $tab_active_bg = "#EEEEEE";
- $tab_inactive_bg = "#777777";
- $nifty_tabs_corners = "#FFF";
- $font_color = "white";
-
- /* if tabcontrols.php exist for a theme, allow it to be overriden */
- $themename = $config['theme'];
- $filename = "/usr/local/www/themes/{$themename}/tabcontrols.php";
- if(file_exists($filename)) {
- $eval_code = file_get_contents($filename);
- eval($eval_code);
- }
-
- $tabcharcount = 0;
- foreach ($tab_array as $ta)
- $tabcharcount = $tabcharcount + strlen($ta[0]);
-
- // If the character count of the tab names is > 670
- // then show a select item dropdown menubox.
- if($tabcharcount > $tab_array_char_limit) {
- echo "Currently viewing: ";
- echo "<select name='TabSelect' onchange='tabs_will_go(this)'>\n";
- foreach ($tab_array as $ta) {
- if($ta[1]=="true")
- $selected = " SELECTED";
- else
- $selected = "";
- // Onclick in option will not work in some browser
- // echo "<option onClick=\"document.location='{$ta[2]}';\"{$selected}>{$ta['0']}</option>\n";
- echo "<option value=\"{$ta[2]}\"{$selected}>{$ta['0']}</option>\n";
- }
- echo "</select>\n<p/>";
- echo "<script type=\"text/javascript\">";
- echo " function tabs_will_go(obj){ document.location = obj.value; }";
- echo "</script>";
- } else {
- //////>>>
- echo "<div class=\"newtabmenu\" style=\"margin:{$tab_array_space}px {$tab_array_indent}px; width:775px;\">\n";
- echo "<!-- Tabbed bar code-->\n";
- echo "<ul class=\"newtabmenu\">\n";
- $tabscounter = 0;
- foreach ($tab_array as $ta) {
- if ($ta[1] == true) {
- echo " <li class=\"newtabmenu_active\"><a href=\"{$ta[2]}\"><span>{$ta[0]}</span></a></li>\n";
- } else {
- echo " <li><a href=\"{$ta[2]}\"><span>{$ta[0]}</span></a></li>\n";
- }
- $tabscounter++;
- }
- echo "</ul>\n</div>\n";
- ////////>>>>
- }
-}
-
-function add_package_tabs($tabgroup, & $tab_array) {
- global $config, $g;
-
- if(!is_array($config['installedpackages']))
- return;
- if(!is_array($config['installedpackages']['tab']))
- return;
-
- foreach($config['installedpackages']['tab'] as $tab) {
- if ($tab['group'] !== $group)
- continue;
- $tab_entry = array();
- if($tab['name']) {
- $tab_entry[] = $tab['name'];
- $tab_entry[] = false;
- $tab_entry[] = $tab['url'];
- $tab_array[] = $tab_entry;
- }
- }
-}
-
-function rule_popup($src,$srcport,$dst,$dstport){
- global $config;
- $aliases_array = array();
- if($config['aliases']['alias'] <> "" and is_array($config['aliases']['alias']))
- {
- $span_begin = "";
- $alias_src_span_begin = "";
- $alias_src_span_end = "";
- $alias_src_port_span_begin = "";
- $alias_src_port_span_end = "";
- $alias_dst_span_begin = "";
- $alias_dst_span_end = "";
- $alias_dst_port_span_begin = "";
- $alias_dst_port_span_end = "";
- $alias_content_text = "";
- foreach($config['aliases']['alias'] as $alias_name)
- {
- $alias_addresses = explode (" ", $alias_name['address']);
- $alias_details = explode ("||", $alias_name['detail']);
- $alias_objects_with_details = "";
- $counter = 0;
- if ($alias_name['url']) {
- $alias_objects_with_details .= $alias_name['url'] . "<br/>";
- }
- foreach($alias_addresses as $alias_ports_address)
- {
- $alias_objects_with_details .= $alias_addresses[$counter];
- $alias_detail_default = strpos ($alias_details[$counter],"Entry added");
- if ($alias_details[$counter] != "" && $alias_detail_default === False){
- $alias_objects_with_details .=" - " . $alias_details[$counter];
- }
- $alias_objects_with_details .= "<br>";
- $counter++;
- }
- //max character length for caption field
- $maxlength = 60;
-
- $alias_descr_substr = $alias_name['descr'];
- $alias_content_text = htmlspecialchars($alias_objects_with_details);
- $alias_caption = htmlspecialchars($alias_descr_substr . ":");
- $strlength = strlen ($alias_caption);
- if ($strlength >= $maxlength)
- $alias_caption = substr($alias_caption, 0, $maxlength) . "...";
-
- $alias_caption_escaped = str_replace("'", "\'", $alias_caption);
- $span_begin = "<span style=\"cursor: help;\" onmouseover=\"domTT_activate(this, event, 'content', '<h1>$alias_caption_escaped</h1><p>$alias_content_text</p>', 'trail', true, 'delay', 0, 'fade', 'both', 'fadeMax', 93, 'styleClass', 'niceTitle');\" onmouseout=\"this.style.color = ''; domTT_mouseout(this, event);\"><U>";
-
- if ($alias_name['name'] == $src)
- $alias_src_span_begin = $span_begin;
- if ($alias_name['name'] == $srcport)
- $alias_src_port_span_begin = $span_begin;
- if ($alias_name['name'] == $dst)
- $alias_dst_span_begin = $span_begin;
- if ($alias_name['name'] == $dstport)
- $alias_dst_port_span_begin = $span_begin;
- }
- $descriptions = array ();
- $descriptions['src'] = $alias_src_span_begin;
- $descriptions['srcport'] = $alias_src_port_span_begin;
- $descriptions['dst'] = $alias_dst_span_begin;
- $descriptions['dstport'] = $alias_dst_port_span_begin;
-
- return $descriptions;
- }
-}
-
-?> \ No newline at end of file
+<?php
+/*
+ guiconfig.inc
+ by Scott Ullrich, Copyright 2004, All rights reserved.
+ originally based on of m0n0wall (http://m0n0.ch/wall)
+
+ Copyright (C) 2003-2004 Manuel Kasper <mk@neon1.net>.
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ 1. Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+
+ 2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+
+ THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
+ INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
+ AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
+ OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ POSSIBILITY OF SUCH DAMAGE.
+*/
+/*
+ pfSense_MODULE: base
+*/
+
+/* Include authentication routines */
+/* THIS MUST BE ABOVE ALL OTHER CODE */
+require_once("authgui.inc");
+
+/* make sure nothing is cached */
+if (!$omit_nocacheheaders) {
+ header("Expires: 0");
+ header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
+ header("Cache-Control: no-store, no-cache, must-revalidate");
+ header("Cache-Control: post-check=0, pre-check=0", false);
+ header("Pragma: no-cache");
+}
+
+/* parse the configuration and include all configuration functions */
+require_once("functions.inc");
+
+/* Pull in all the gui related display classes) */
+foreach (scandir("/usr/local/www/classes/") as $file) {
+ if (stristr($file, ".inc") !== false) {
+ require_once("classes/{$file}");
+ }
+}
+/*
+ * if user has selected a custom template, use it.
+ * otherwise default to pfsense template
+ */
+if($config['theme'] <> "")
+ $g['theme'] = $config['theme'];
+else
+ $g['theme'] = "pfsense";
+
+/*
+ * If this device is an apple ipod/iphone
+ * switch the theme to one that works with it.
+ */
+$apple_ua = array("iPhone","iPod", "iPad");
+foreach($apple_ua as $useragent)
+ if(strstr($_SERVER['HTTP_USER_AGENT'], $useragent))
+ $g['theme'] = "pfsense";
+
+/* used by progress bar */
+$lastseen = "-1";
+
+$navlevelsep = ": "; /* navigation level separator string */
+$mandfldhtml = ""; /* display this before mandatory input fields */
+$mandfldhtmlspc = ""; /* same as above, but with spacing */
+
+/* Some ajax scripts still need access to GUI */
+if(!$ignorefirmwarelock) {
+ if (is_subsystem_dirty('firmwarelock')) {
+ if (!$d_isfwfile) {
+ header("Location: system_firmware.php");
+ exit;
+ } else {
+ return;
+ }
+ }
+}
+
+$firewall_rules_dscp_types = array("af11",
+ "af12",
+ "af13",
+ "af21",
+ "af22",
+ "af23",
+ "af31",
+ "af32",
+ "af33",
+ "af41",
+ "af42",
+ "af43",
+ "EF",
+ "1-64",
+ "0x10",
+ "0x04-0xfc");
+
+$auth_server_types = array(
+ 'ldap' => "LDAP",
+ 'radius' => "Radius");
+
+$ldap_urltypes = array(
+ 'TCP - Standard' => 389,
+ 'SSL - Encrypted' => 636);
+
+$ldap_scopes = array(
+ 'one' => "One Level",
+ 'subtree' => "Entire Subtree");
+
+$ldap_protvers = array(
+ 2,
+ 3);
+
+$ldap_templates = array(
+
+ 'open' => array(
+ 'desc' => "OpenLDAP",
+ 'attr_user' => "cn",
+ 'attr_group' => "cn",
+ 'attr_member' => "member"),
+
+ 'msad' => array(
+ 'desc' => "Microsoft AD",
+ 'attr_user' => "samAccountName",
+ 'attr_group' => "cn",
+ 'attr_member' => "memberOf"),
+
+ 'edir' => array(
+ 'desc' => "Novell eDirectory",
+ 'attr_user' => "cn",
+ 'attr_group' => "cn",
+ 'attr_member' => "uniqueMember"));
+
+$radius_srvcs = array(
+ 'both' => "Authentication and Accounting",
+ 'auth' => "Authentication",
+ 'acct' => "Accounting");
+
+$netbios_nodetypes = array(
+ '0' => "none",
+ '1' => "b-node",
+ '2' => "p-node",
+ '4' => "m-node",
+ '5' => "h-node");
+
+/* some well knows ports */
+$wkports = array(
+ 5999 => "CVSup",
+ 53 => "DNS",
+ 21 => "FTP",
+ 3000 => "HBCI",
+ 80 => "HTTP",
+ 443 => "HTTPS",
+ 5190 => "ICQ",
+ 113 => "IDENT/AUTH",
+ 143 => "IMAP",
+ 993 => "IMAP/S",
+ 4500 => "IPsec NAT-T",
+ 500 => "ISAKMP",
+ 1701 => "L2TP",
+ 389 => "LDAP",
+ 1755 => "MMS/TCP",
+ 7000 => "MMS/UDP",
+ 445 => "MS DS",
+ 3389 => "MS RDP",
+ 1512 => "MS WINS",
+ 1863 => "MSN",
+ 119 => "NNTP",
+ 123 => "NTP",
+ 138 => "NetBIOS-DGM",
+ 137 => "NetBIOS-NS",
+ 139 => "NetBIOS-SSN",
+ 1194 => "OpenVPN",
+ 110 => "POP3",
+ 995 => "POP3/S",
+ 1723 => "PPTP",
+ 1812 => "RADIUS",
+ 1813 => "RADIUS accounting",
+ 5004 => "RTP",
+ 5060 => "SIP",
+ 25 => "SMTP",
+ 465 => "SMTP/S",
+ 161 => "SNMP",
+ 162 => "SNMP-Trap",
+ 22 => "SSH",
+ 3478 => "STUN",
+ 3544 => "Teredo",
+ 23 => "Telnet",
+ 69 => "TFTP",
+ 5900 => "VNC");
+
+/* TCP flags */
+$tcpflags = array("fin", "syn", "rst", "psh", "ack", "urg");
+
+$specialnets = array("pptp" => "PPTP clients", "pppoe" => "PPPoE clients", "l2tp" => "L2TP clients");
+
+$spiflist = get_configured_interface_with_descr(false, true);
+foreach ($spiflist as $ifgui => $ifdesc) {
+ $specialnets[$ifgui] = $ifdesc . " net";
+ $specialnets[$ifgui . 'ip'] = $ifdesc . " address";
+}
+
+$medias = array("auto" => "autoselect", "100full" => "100BASE-TX full-duplex",
+ "100half" => "100BASE-TX half-duplex", "10full" => "10BASE-T full-duplex",
+ "10half" => "10BASE-T half-duplex");
+
+$wlan_modes = array("bss" => "Infrastructure (BSS)", "adhoc" => "Ad-hoc (IBSS)",
+ "hostap" => "Access Point");
+
+/* platforms that support firmware updating */
+$fwupplatforms = array('pfSense', 'net45xx', 'net48xx', 'generic-pc', 'embedded', 'wrap', 'nanobsd');
+
+function do_input_validation($postdata, $reqdfields, $reqdfieldsn, $input_errors) {
+
+ /* check for bad control characters */
+ foreach ($postdata as $pn => $pd) {
+ if (is_string($pd) && preg_match("/[\\x00-\\x08\\x0b\\x0c\\x0e-\\x1f]/", $pd)) {
+ $input_errors[] = "The field '" . $pn . "' contains invalid characters.";
+ }
+ }
+
+ for ($i = 0; $i < count($reqdfields); $i++) {
+ if ($_POST[$reqdfields[$i]] == "" && $_REQUEST[$reqdfields[$i]] == "") {
+ $input_errors[] = "The field '" . $reqdfieldsn[$i] . "' is required.";
+ }
+ }
+}
+
+function print_input_errors($input_errors) {
+ global $g;
+
+ print <<<EOF
+ <p>
+ <table border="0" cellspacing="0" cellpadding="4" width="100%">
+ <tr>
+ <td class="inputerrorsleft">
+ <img src="./themes/{$g['theme']}/images/icons/icon_error.gif">
+ </td>
+ <td class="inputerrorsright">
+ <span class="errmsg"><p>
+ The following input errors were detected:
+ <ul>
+EOF;
+ foreach ($input_errors as $ierr) {
+ echo "<li>" . htmlspecialchars($ierr) . "</li>";
+ }
+
+ print <<<EOF2
+ </ul>
+ </span>
+ </td></tr>
+ </table>
+ </p>&nbsp;<br>
+EOF2;
+
+}
+
+function verify_gzip_file($fname) {
+
+ $returnvar = mwexec("/usr/bin/gzip -t " . escapeshellarg($fname));
+ if ($returnvar != 0)
+ return 0;
+ else
+ return 1;
+}
+
+function print_info_box_np($msg, $name="apply",$value="Apply changes") {
+ global $g, $nifty_redbox, $nifty_blackbox, $nifty_background;
+
+ // Set the Nifty background color if one is not set already (defaults to white)
+ if($nifty_background == "")
+ $nifty_background = "#FFF";
+
+ if(stristr($msg, "apply") != false || stristr($msg, "save") != false || stristr($msg, "create") != false) {
+ $savebutton = "<td class='infoboxsave'>";
+ $savebutton .= "<input name=\"{$name}\" type=\"submit\" class=\"formbtn\" id=\"${name}\" value=\"{$value}\">";
+ if($_POST['if'])
+ $savebutton .= "<input type='hidden' name='if' value='{$_POST['if']}'>";
+ $savebutton.="</td>";
+ }
+ $nifty_redbox = "#990000";
+ $nifty_blackbox = "#000000";
+
+ $themename = $g['theme'];
+
+ if(file_exists("/usr/local/www/themes/{$themename}/tabcontrols.php")) {
+ $toeval = file_get_contents("/usr/local/www/themes/{$themename}/tabcontrols.php");
+ eval($toeval);
+ }
+
+ if(file_exists("/usr/local/www/themes/{$themename}/infobox.php")) {
+ $toeval = file_get_contents("/usr/local/www/themes/{$themename}/infobox.php");
+ eval($toeval);
+ }
+
+ if(!$savebutton) {
+ $savebutton = '<td class="infoboxsave"><input value="Close" type="button" onClick="$(\'redboxtable\').hide();"></td>';
+ }
+
+ echo <<<EOFnp
+ <table class='infobox' id='redboxtable'>
+ <tr>
+ <td>
+ <div class='infoboxnp' id='redbox'>
+ <table class='infoboxnptable2'>
+ <tr>
+ <td class='infoboxnptd'>
+ &nbsp;&nbsp;&nbsp;<img class='infoboxnpimg' src="/themes/{$g['theme']}/images/icons/icon_exclam.gif" >
+ </td>
+ <td class='infoboxnptd2'>
+ <b>{$msg}</b>
+ </td>
+ {$savebutton}
+ </tr>
+ </table>
+ </div>
+ <div>
+ <p/>
+ </div>
+ </td>
+ </tr>
+ </table>
+ <script type="text/javascript">
+ NiftyCheck();
+ Rounded("div#redbox","all","{$nifty_background}","{$nifty_redbox}","smooth");
+ Rounded("td#blackbox","all","{$nifty_background}","{$nifty_blackbox}","smooth");
+ </script>
+EOFnp;
+
+}
+
+function print_info_box_np_undo($msg, $name="apply",$value="Apply changes", $undo) {
+ global $g;
+
+ if(stristr($msg, "apply") != false || stristr($msg, "save") != false || stristr($msg, "create") != false) {
+ $savebutton = "<td class='infoboxsave'><nobr>";
+ $savebutton .= " <input type=\"button\" value=\"Undo\" onClick=\"document.location='{$undo}'\">";
+ $savebutton .= " <input name=\"{$name}\" type=\"submit\" class=\"formbtn\" id=\"${name}\" value=\"{$value}\">";
+ $savebutton.="</nobr></td>";
+ if($_POST['if'])
+ $savebutton .= "<input type='hidden' name='if' value='{$_POST['if']}'>";
+ }
+ $nifty_redbox = "#990000";
+ $nifty_blackbox = "#000000";
+
+ $themename = $g['theme'];
+
+ if(file_exists("/usr/local/www/themes/{$themename}/tabcontrols.php")) {
+ $toeval = file_get_contents("/usr/local/www/themes/{$themename}/tabcontrols.php");
+ eval($toeval);
+ }
+
+ if(file_exists("/usr/local/www/themes/{$themename}/infobox.php")) {
+ $toeval = file_get_contents("/usr/local/www/themes/{$themename}/infobox.php");
+ eval($toeval);
+ }
+
+
+ if(!$savebutton) {
+ $savebutton = '<td class="infoboxsave"><input value="Close" type="button" onClick="$(\'redboxtable\').hide();"></td>';
+ }
+
+ echo <<<EOFnp
+ <table class='infobox' id='redboxtable'>
+ <tr>
+ <td>
+ <div class='infoboxnp' id='redbox'>
+ <table class='infoboxnptable2'>
+ <tr>
+ <td class='infoboxnptd'>
+ &nbsp;&nbsp;&nbsp;<img class='infoboxnpimg' src="/themes/{$g['theme']}/images/icons/icon_exclam.gif" >
+ </td>
+ <td class='infoboxnptd2'>
+ <b>{$msg}</b>
+ </td>
+ {$savebutton}
+ {$undobutton}
+ </tr>
+ </table>
+ </div>
+ <div>
+ <p/>
+ </div>
+ </td>
+ </tr>
+ </table>
+ <script type="text/javascript">
+ NiftyCheck();
+ Rounded("div#redbox","all","#FFF","{$nifty_redbox}","smooth");
+ Rounded("td#blackbox","all","#FFF","{$nifty_blackbox}","smooth");
+ </script>
+EOFnp;
+
+}
+
+function print_info_box($msg) {
+ print_info_box_np($msg);
+}
+
+function get_std_save_message($ok) {
+ global $d_sysrebootreqd_path;
+
+ return "The changes have been applied successfully. You can also <a href='status_filter_reload.php'>monitor</a> the filter reload progress.";
+}
+
+function pprint_address($adr) {
+ global $specialnets;
+
+ if (isset($adr['any'])) {
+ $padr = "*";
+ } else if ($adr['network']) {
+ $padr = $specialnets[$adr['network']];
+ } else {
+ $padr = $adr['address'];
+ }
+
+ if (isset($adr['not']))
+ $padr = "! " . $padr;
+
+ return $padr;
+}
+
+function pprint_port($port) {
+ global $wkports;
+
+ $pport = "";
+
+ if (!$port)
+ return "*";
+ else {
+ $srcport = explode("-", $port);
+ if ((!$srcport[1]) || ($srcport[0] == $srcport[1])) {
+ $pport = $srcport[0];
+ if ($wkports[$srcport[0]]) {
+ $pport .= " (" . $wkports[$srcport[0]] . ")";
+ }
+ } else
+ $pport .= $srcport[0] . " - " . $srcport[1];
+ }
+
+ return $pport;
+}
+
+/* sort by interface only, retain the original order of rules that apply to
+ the same interface */
+function filter_rules_sort() {
+ global $config;
+
+ /* mark each rule with the sequence number (to retain the order while sorting) */
+ for ($i = 0; isset($config['filter']['rule'][$i]); $i++)
+ $config['filter']['rule'][$i]['seq'] = $i;
+
+ function filtercmp($a, $b) {
+ if ($a['interface'] == $b['interface'])
+ return $a['seq'] - $b['seq'];
+ else
+ return -strcmp($a['interface'], $b['interface']);
+ }
+
+ usort($config['filter']['rule'], "filtercmp");
+
+ /* strip the sequence numbers again */
+ for ($i = 0; isset($config['filter']['rule'][$i]); $i++)
+ unset($config['filter']['rule'][$i]['seq']);
+}
+
+function gentitle($title) {
+ global $navlevelsep;
+ if(!is_array($title))
+ return $title;
+ else
+ return join($navlevelsep, $title);
+}
+
+function genhtmltitle($title) {
+ global $config;
+ return gentitle($title);
+}
+
+/* update the changedesc and changecount(er) variables */
+function update_changedesc($update) {
+ global $changedesc;
+ global $changecount;
+
+ $changedesc .= " {$update}";
+ $changecount++;
+}
+
+function clear_log_file($logfile = "/var/log/system.log") {
+ global $config, $g;
+ exec("/usr/bin/killall syslogd");
+ if(isset($config['system']['disablesyslogclog'])) {
+ unlink($logfile);
+ touch($logfile);
+ } else {
+ if(isset($config['system']['usefifolog']))
+ exec("/usr/sbin/fifolog_create -s 511488 {$logfile}");
+ else
+ exec("/usr/sbin/clog -i -s 511488 {$logfile}");
+ }
+ system_syslogd_start();
+}
+
+function dump_clog($logfile, $tail, $withorig = true, $grepfor = "", $grepinvert = "") {
+ global $g, $config;
+ $sor = isset($config['syslog']['reverse']) ? "-r" : "";
+ $logarr = "";
+ $grepline = " ";
+ if(is_array($grepfor))
+ foreach($grepfor as $agrep)
+ $grepline .= " | grep \"$agrep\"";
+ if(is_array($grepinvert))
+ foreach($grepinvert as $agrep)
+ $grepline .= " | grep -v \"$agrep\"";
+ if(file_exists($logfile) && filesize($logfile) == 0) {
+ $logarr = array("Log file started.");
+ } else {
+ if($config['system']['disablesyslogclog']) {
+ exec("cat {$logfile}{$grepline} | /usr/bin/tail {$sor} -n {$tail}", $logarr);
+ } else {
+ if(isset($config['system']['usefifolog']))
+ exec("/usr/sbin/fifolog_reader {$logfile}{$grepline} | /usr/bin/tail {$sor} -n {$tail}", $logarr);
+ else
+ exec("/usr/sbin/clog {$logfile}{$grepline}| grep -v \"CLOG\" | grep -v \"\033\" | /usr/bin/tail {$sor} -n {$tail}", $logarr);
+ }
+ }
+ foreach ($logarr as $logent) {
+ $logent = preg_split("/\s+/", $logent, 6);
+ echo "<tr valign=\"top\">\n";
+ if ($withorig) {
+ if(isset($config['system']['usefifolog'])) {
+ $entry_date_time = htmlspecialchars(date("F j, Y, g:i a","" . $logent[1] . ""));
+ $entry_text = htmlspecialchars($logent[5]);
+ } else {
+ $entry_date_time = htmlspecialchars(join(" ", array_slice($logent, 0, 3)));
+ $entry_text = htmlspecialchars($logent[4] . " " . $logent[5]);
+ }
+ echo "<td class=\"listlr\" nowrap>{$entry_date_time}</td>\n";
+ echo "<td class=\"listr\">{$entry_text}</td>\n";
+
+ } else {
+ echo "<td class=\"listlr\" colspan=\"2\">" . htmlspecialchars($logent[5]) . "</td>\n";
+ }
+ echo "</tr>\n";
+ }
+}
+
+function return_clog($logfile, $tail, $withorig = true, $grepfor = "", $grepinvert = "", $grepreverse = false) {
+ global $g, $config;
+ $sor = (isset($config['syslog']['reverse']) || $grepreverse) ? "-r" : "";
+ $logarr = "";
+ $grepline = " ";
+ if(is_array($grepfor))
+ foreach($grepfor as $agrep)
+ $grepline .= " | grep \"$agrep\"";
+ if(is_array($grepinvert))
+ foreach($grepinvert as $agrep)
+ $grepline .= " | grep -v \"$agrep\"";
+ if($config['system']['disablesyslogclog']) {
+ exec("cat {$logfile}{$grepline} | /usr/bin/tail {$sor} -n {$tail}", $logarr);
+ } else {
+ if(isset($config['system']['usefifolog'])) {
+ exec("/usr/sbin/fifolog_reader {$logfile}{$grepline} | /usr/bin/tail {$sor} -n {$tail}", $logarr);
+ } else {
+ exec("/usr/sbin/clog {$logfile}{$grepline}| grep -v \"CLOG\" | grep -v \"\033\" | /usr/bin/tail {$sor} -n {$tail}", $logarr);
+ }
+ }
+ return($logarr);
+}
+
+/* Check if variable has changed, update and log if it has
+ * returns true if var changed
+ * varname = variable name in plain text
+ * orig = original value
+ * new = new value
+ */
+function update_if_changed($varname, & $orig, $new) {
+ if (is_array($orig) && is_array($new)) {
+ $a_diff = array_diff($orig, $new);
+ foreach ($a_diff as $diff) {
+ update_changedesc("removed {$varname}: \"{$diff}\"");
+ }
+ $a_diff = array_diff($new, $orig);
+ foreach ($a_diff as $diff) {
+ update_changedesc("added {$varname}: \"{$diff}\"");
+ }
+ $orig = $new;
+ return true;
+
+ } else {
+ if ($orig != $new) {
+ update_changedesc("{$varname}: \"{$orig}\" -> \"{$new}\"");
+ $orig = $new;
+ return true;
+ }
+ }
+ return false;
+}
+
+function address_to_pconfig($adr, &$padr, &$pmask, &$pnot, &$pbeginport, &$pendport) {
+
+ if (isset($adr['any']))
+ $padr = "any";
+ else if ($adr['network'])
+ $padr = $adr['network'];
+ else if ($adr['address']) {
+ list($padr, $pmask) = explode("/", $adr['address']);
+ if (!$pmask)
+ $pmask = 32;
+ }
+
+ if (isset($adr['not']))
+ $pnot = 1;
+ else
+ $pnot = 0;
+
+ if ($adr['port']) {
+ list($pbeginport, $pendport) = explode("-", $adr['port']);
+ if (!$pendport)
+ $pendport = $pbeginport;
+ } else if (!is_alias($pbeginport) && !is_alias($pendport)) {
+ $pbeginport = "any";
+ $pendport = "any";
+ }
+}
+
+function pconfig_to_address(&$adr, $padr, $pmask, $pnot=false, $pbeginport=0, $pendport=0) {
+
+ $adr = array();
+
+ if ($padr == "any")
+ $adr['any'] = true;
+ else if (is_specialnet($padr))
+ $adr['network'] = $padr;
+ else {
+ $adr['address'] = $padr;
+ if ($pmask != 32)
+ $adr['address'] .= "/" . $pmask;
+ }
+
+ if ($pnot)
+ $adr['not'] = true;
+ else
+ unset($adr['not']);
+
+ if (($pbeginport != 0) && ($pbeginport != "any")) {
+ if ($pbeginport != $pendport)
+ $adr['port'] = $pbeginport . "-" . $pendport;
+ else
+ $adr['port'] = $pbeginport;
+ }
+
+ if(is_alias($pbeginport)) {
+ $adr['port'] = $pbeginport;
+ }
+}
+
+function is_specialnet($net) {
+ global $specialsrcdst;
+
+ if(!$net)
+ return false;
+ if (in_array($net, $specialsrcdst))
+ return true;
+ else
+ return false;
+}
+
+//function to create widget tabs when called
+function display_widget_tabs(& $tab_array) {
+ echo "<div id='tabs'>";
+ $tabscounter = 0;
+ foreach ($tab_array as $ta) {
+ $dashpos = strpos($ta[2],'-');
+ $tabname = $ta[2] . "-tab";
+ $tabclass = substr($ta[2],0,$dashpos);
+ $tabclass = $tabclass . "-class";
+ if ($ta[1] == true) {
+ $tabActive = "table-cell";
+ $tabNonActive = "none";
+ }
+ else {
+ $tabActive = "none";
+ $tabNonActive = "table-cell";
+ }
+ echo "<div id='{$ta[2]}-active' class='{$tabclass}-tabactive' style='display:{$tabActive}; background-color:#EEEEEE; color:black;'>";
+ echo "<B>&nbsp;&nbsp;&nbsp;{$ta[0]}";
+ echo "&nbsp;&nbsp;&nbsp;</B>";
+ echo "</div>";
+
+ echo "<div id='{$ta[2]}-deactive' class='{$tabclass}-tabdeactive' style='display:{$tabNonActive}; background-color:#777777; color:white; cursor: pointer;' onClick=\"return changeTabDIV('{$ta[2]}')\">";
+ echo "<B>&nbsp;&nbsp;&nbsp;{$ta[0]}";
+ echo "&nbsp;&nbsp;&nbsp;</B>";
+ echo "</div>";
+ }
+
+ echo "<script type=\"text/javascript\">";
+ echo "NiftyCheck();\n";
+ echo "Rounded(\"div.{$tabclass}-tabactive\",\"top\",\"#CCCCCC\",\"#EEEEEE\",\"smooth\");\n";
+ echo "Rounded(\"div.{$tabclass}-tabdeactive\",\"top\",\"#CCCCCC\",\"#777777\",\"smooth\");\n";
+ echo "</script>";
+ echo "</div>";
+}
+
+
+// Return inline javascript file or CSS to minimizie
+// request count going back to server.
+function outputJavaScriptFileInline($javascript) {
+ if(file_exists($javascript)) {
+ echo "\n<script type=\"text/javascript\">\n";
+ include($javascript);
+ echo "\n</script>\n";
+ } else {
+ echo "\n\n<!-- Could not location file: {$javascript} -->\n\n";
+ }
+}
+
+
+
+function outputCSSPrintFileInline($css) {
+ if(file_exists($css)) {
+ echo "\n<style media=\"print\" type=\"text/css\">\n";
+ include($css);
+ echo "\n</style>\n";
+ } else {
+ echo "\n\n<!-- Could not location file: {$css} -->\n\n";
+ }
+}
+
+
+function outputCSSFileInline($css) {
+ if(file_exists($css)) {
+ echo "\n<style type=\"text/css\">\n";
+ include($css);
+ echo "\n</style>\n";
+ } else {
+ echo "\n\n<!-- Could not location file: {$css} -->\n\n";
+ }
+}
+
+$rfc2616 = array(
+ 100 => "100 Continue",
+ 101 => "101 Switching Protocols",
+ 200 => "200 OK",
+ 201 => "201 Created",
+ 202 => "202 Accepted",
+ 203 => "203 Non-Authoritative Information",
+ 204 => "204 No Content",
+ 205 => "205 Reset Content",
+ 206 => "206 Partial Content",
+ 300 => "300 Multiple Choices",
+ 301 => "301 Moved Permanently",
+ 302 => "302 Found",
+ 303 => "303 See Other",
+ 304 => "304 Not Modified",
+ 305 => "305 Use Proxy",
+ 306 => "306 (Unused)",
+ 307 => "307 Temporary Redirect",
+ 400 => "400 Bad Request",
+ 401 => "401 Unauthorized",
+ 402 => "402 Payment Required",
+ 403 => "403 Forbidden",
+ 404 => "404 Not Found",
+ 405 => "405 Method Not Allowed",
+ 406 => "406 Not Acceptable",
+ 407 => "407 Proxy Authentication Required",
+ 408 => "408 Request Timeout",
+ 409 => "409 Conflict",
+ 410 => "410 Gone",
+ 411 => "411 Length Required",
+ 412 => "412 Precondition Failed",
+ 413 => "413 Request Entity Too Large",
+ 414 => "414 Request-URI Too Long",
+ 415 => "415 Unsupported Media Type",
+ 416 => "416 Requested Range Not Satisfiable",
+ 417 => "417 Expectation Failed",
+ 500 => "500 Internal Server Error",
+ 501 => "501 Not Implemented",
+ 502 => "502 Bad Gateway",
+ 503 => "503 Service Unavailable",
+ 504 => "504 Gateway Timeout",
+ 505 => "505 HTTP Version Not Supported"
+);
+
+function is_rfc2616_code($code) {
+ global $rfc2616;
+ if (isset($rfc2616[$code]))
+ return true;
+ else
+ return false;
+}
+
+function print_rfc2616_select($tag, $current){
+ global $rfc2616;
+
+ /* Default to 200 OK if not set */
+ if ($current == "")
+ $current = 200;
+
+ echo "<select id=\"{$tag}\" name=\"{$tag}\">\n";
+ foreach($rfc2616 as $code => $message) {
+ if ($code == $current) {
+ $sel = " selected";
+ } else {
+ $sel = "";
+ }
+ echo "<option value=\"{$code}\"{$sel}>{$message}</option>\n";
+ }
+}
+
+// Useful debugging function, much cleaner than print_r
+function echo_array($array,$return_me=false){
+ if(is_array($array) == false){
+ $return = "The provided variable is not an array.";
+ }else{
+ foreach($array as $name=>$value){
+ if(is_array($value)){
+ $return .= "";
+ $return .= "['<b>$name</b>'] {<div style='margin-left:10px;'>\n";
+ $return .= echo_array($value,true);
+ $return .= "</div>}";
+ $return .= "\n\n";
+ }else{
+ if(is_string($value)){
+ $value = "\"$value\"";
+ }
+ $return .= "['<b>$name</b>'] = $value\n\n";
+ }
+ }
+ }
+ if($return_me == true){
+ return $return;
+ }else{
+ echo "<pre>".$return."</pre>";
+ }
+}
+
+/****f* pfsense-utils/display_top_tabs
+ * NAME
+ * display_top_tabs - display tabs with rounded edges
+ * INPUTS
+ * $text - array of tabs
+ * RESULT
+ * null
+ ******/
+function display_top_tabs(& $tab_array) {
+ global $HTTP_SERVER_VARS;
+ global $config;
+ global $g;
+ global $tab_array_indent;
+ global $tab_array_space;
+ global $tab_array_char_limit;
+
+ /* does the user have access to this tab?
+ * master user has access to everything.
+ * if the user does not have access, simply
+ * unset the tab item.
+ */
+
+ /* empty string code */
+ if ($tab_array_indent == '')
+ {
+ $tab_array_indent = 0;
+ }
+ if ($tab_array_space == '')
+ {
+ $tab_array_space = 1;
+ }
+ if ($tab_array_char_limit == '')
+ {
+ $tab_array_char_limit = 82;
+ }
+
+ $tab_temp = array ();
+ foreach ($tab_array as $ta)
+ if(isAllowedPage($ta[2]))
+ $tab_temp[] = $ta;
+ /*
+ // FIXME : if the checks are not good enough
+ // in isAllowedPage, it needs to be
+ // fixed instead of kludging here
+
+ // TODO: humm what shall we do with pkg_edit.php and pkg.php?
+ if ((strpos($link, "pkg.php")) !== false || (strpos($link, "pkg_edit.php")) !== false) {
+ $pos_equal = strpos($link, "=");
+ $pos_xmlsuffix = strpos($link, ".xml");
+ // do we match an absolute url including ?xml= foo
+ if(!isAllowedPage($link, $allowed))
+ $link = substr($link, $pos_equal +1, ($pos_xmlsuffix - $pos_equal +3));
+ }
+ // next check - what if the basename contains a query string?
+ if ((strpos($link, "?")) !== false) {
+ $pos_qmark = strpos($link, "?");
+ $link = substr($link, 0, $pos_qmark);
+ }
+ $authorized_text = print_r($allowed, true);
+ if(is_array($authorized))
+ if (in_array(basename($link), $authorized))
+ */
+
+ unset ($tab_array);
+ $tab_array = & $tab_temp;
+
+ $tab_active_bg = "#EEEEEE";
+ $tab_inactive_bg = "#777777";
+ $nifty_tabs_corners = "#FFF";
+ $font_color = "white";
+
+ /* if tabcontrols.php exist for a theme, allow it to be overriden */
+ $themename = $config['theme'];
+ $filename = "/usr/local/www/themes/{$themename}/tabcontrols.php";
+ if(file_exists($filename)) {
+ $eval_code = file_get_contents($filename);
+ eval($eval_code);
+ }
+
+ $tabcharcount = 0;
+ foreach ($tab_array as $ta)
+ $tabcharcount = $tabcharcount + strlen($ta[0]);
+
+ // If the character count of the tab names is > 670
+ // then show a select item dropdown menubox.
+ if($tabcharcount > $tab_array_char_limit) {
+ echo "Currently viewing: ";
+ echo "<select name='TabSelect' onchange='tabs_will_go(this)'>\n";
+ foreach ($tab_array as $ta) {
+ if($ta[1]=="true")
+ $selected = " SELECTED";
+ else
+ $selected = "";
+ // Onclick in option will not work in some browser
+ // echo "<option onClick=\"document.location='{$ta[2]}';\"{$selected}>{$ta['0']}</option>\n";
+ echo "<option value=\"{$ta[2]}\"{$selected}>{$ta['0']}</option>\n";
+ }
+ echo "</select>\n<p/>";
+ echo "<script type=\"text/javascript\">";
+ echo " function tabs_will_go(obj){ document.location = obj.value; }";
+ echo "</script>";
+ } else {
+ //////>>>
+ echo "<div class=\"newtabmenu\" style=\"margin:{$tab_array_space}px {$tab_array_indent}px; width:775px;\">\n";
+ echo "<!-- Tabbed bar code-->\n";
+ echo "<ul class=\"newtabmenu\">\n";
+ $tabscounter = 0;
+ foreach ($tab_array as $ta) {
+ if ($ta[1] == true) {
+ echo " <li class=\"newtabmenu_active\"><a href=\"{$ta[2]}\"><span>{$ta[0]}</span></a></li>\n";
+ } else {
+ echo " <li><a href=\"{$ta[2]}\"><span>{$ta[0]}</span></a></li>\n";
+ }
+ $tabscounter++;
+ }
+ echo "</ul>\n</div>\n";
+ ////////>>>>
+ }
+}
+
+function add_package_tabs($tabgroup, & $tab_array) {
+ global $config, $g;
+
+ if(!is_array($config['installedpackages']))
+ return;
+ if(!is_array($config['installedpackages']['tab']))
+ return;
+
+ foreach($config['installedpackages']['tab'] as $tab) {
+ if ($tab['group'] !== $group)
+ continue;
+ $tab_entry = array();
+ if($tab['name']) {
+ $tab_entry[] = $tab['name'];
+ $tab_entry[] = false;
+ $tab_entry[] = $tab['url'];
+ $tab_array[] = $tab_entry;
+ }
+ }
+}
+
+function rule_popup($src,$srcport,$dst,$dstport){
+ global $config;
+ $aliases_array = array();
+ if($config['aliases']['alias'] <> "" and is_array($config['aliases']['alias']))
+ {
+ $span_begin = "";
+ $alias_src_span_begin = "";
+ $alias_src_span_end = "";
+ $alias_src_port_span_begin = "";
+ $alias_src_port_span_end = "";
+ $alias_dst_span_begin = "";
+ $alias_dst_span_end = "";
+ $alias_dst_port_span_begin = "";
+ $alias_dst_port_span_end = "";
+ $alias_content_text = "";
+ foreach($config['aliases']['alias'] as $alias_name)
+ {
+ $alias_addresses = explode (" ", $alias_name['address']);
+ $alias_details = explode ("||", $alias_name['detail']);
+ $alias_objects_with_details = "";
+ $counter = 0;
+ if ($alias_name['url']) {
+ $alias_objects_with_details .= $alias_name['url'] . "<br/>";
+ }
+ foreach($alias_addresses as $alias_ports_address)
+ {
+ $alias_objects_with_details .= $alias_addresses[$counter];
+ $alias_detail_default = strpos ($alias_details[$counter],"Entry added");
+ if ($alias_details[$counter] != "" && $alias_detail_default === False){
+ $alias_objects_with_details .=" - " . $alias_details[$counter];
+ }
+ $alias_objects_with_details .= "<br>";
+ $counter++;
+ }
+ //max character length for caption field
+ $maxlength = 60;
+
+ $alias_descr_substr = $alias_name['descr'];
+ $alias_content_text = htmlspecialchars($alias_objects_with_details);
+ $alias_caption = htmlspecialchars($alias_descr_substr . ":");
+ $strlength = strlen ($alias_caption);
+ if ($strlength >= $maxlength)
+ $alias_caption = substr($alias_caption, 0, $maxlength) . "...";
+
+ $alias_caption_escaped = str_replace("'", "\'", $alias_caption);
+ $span_begin = "<span style=\"cursor: help;\" onmouseover=\"domTT_activate(this, event, 'content', '<h1>$alias_caption_escaped</h1><p>$alias_content_text</p>', 'trail', true, 'delay', 0, 'fade', 'both', 'fadeMax', 93, 'styleClass', 'niceTitle');\" onmouseout=\"this.style.color = ''; domTT_mouseout(this, event);\"><U>";
+
+ if ($alias_name['name'] == $src)
+ $alias_src_span_begin = $span_begin;
+ if ($alias_name['name'] == $srcport)
+ $alias_src_port_span_begin = $span_begin;
+ if ($alias_name['name'] == $dst)
+ $alias_dst_span_begin = $span_begin;
+ if ($alias_name['name'] == $dstport)
+ $alias_dst_port_span_begin = $span_begin;
+ }
+ $descriptions = array ();
+ $descriptions['src'] = $alias_src_span_begin;
+ $descriptions['srcport'] = $alias_src_port_span_begin;
+ $descriptions['dst'] = $alias_dst_span_begin;
+ $descriptions['dstport'] = $alias_dst_port_span_begin;
+
+ return $descriptions;
+ }
+}
+
+?>
diff --git a/usr/local/www/interfaces.php b/usr/local/www/interfaces.php
index bc8cfec..a451954 100755
--- a/usr/local/www/interfaces.php
+++ b/usr/local/www/interfaces.php
@@ -339,8 +339,10 @@ if ($_POST) {
unset($input_errors);
$pconfig = $_POST;
conf_mount_rw();
+
/* filter out spaces from descriptions */
$_POST['descr'] = remove_bad_chars($_POST['descr']);
+
/* okay first of all, cause we are just hiding the PPPoE HTML
* fields releated to PPPoE resets, we are going to unset $_POST
* vars, if the reset feature should not be used. Otherwise the
@@ -355,11 +357,13 @@ if ($_POST) {
unset($_POST['pppoe_pr_preset_val']);
}
/* optional interface if list */
- $iflist = get_configured_interface_with_descr();
+ $iflist = get_configured_interface_with_descr(false, true);
/* description unique? */
foreach ($iflist as $ifent => $ifdescr) {
- if ($if != $ifent && $ifdescr == $_POST['descr'])
+ if ($if != $ifent && $ifdescr == $_POST['descr']) {
$input_errors[] = gettext("An interface with the specified description already exists.");
+ break;
+ }
}
/* input validation */
if (isset($config['dhcpd']) && isset($config['dhcpd'][$if]['enable']) && $_POST['type'] != "static")
@@ -370,6 +374,10 @@ if ($_POST) {
$reqdfields = explode(" ", "ipaddr subnet gateway");
$reqdfieldsn = array(gettext("IP address"),gettext("Subnet bit count"),gettext("Gateway"));
do_input_validation($_POST, $reqdfields, $reqdfieldsn, &$input_errors);
+ case "none":
+ case "dhcp":
+ if (in_array($wancfg['ipaddr'], array("ppp", "pppoe", "pptp", "l2tp")))
+ $input_errors[] = "You have to reassign the interface to be able to configure as {$_POST['type']}.";
break;
case "ppp":
$reqdfields = explode(" ", "port phone");
diff --git a/usr/local/www/services_dhcp_relay.php b/usr/local/www/services_dhcp_relay.php
index c9e8fd1..c8e918c 100755
--- a/usr/local/www/services_dhcp_relay.php
+++ b/usr/local/www/services_dhcp_relay.php
@@ -1,10 +1,9 @@
<?php
-/* $Id$ */
/*
- services_dhcp.php
- part of m0n0wall (http://m0n0.ch/wall)
+ services_dhcp_relay.php
Copyright (C) 2003-2004 Justin Ellison <justin@techadvise.com>.
+ Copyright (C) 2010 Ermal Luçi
All rights reserved.
Redistribution and use in source and binary forms, with or without
@@ -39,51 +38,17 @@
##|*MATCH=services_dhcp_relay.php*
##|-PRIV
-function get_wan_dhcp_server() {
- global $config, $g;
- $dhclientfn = $g['vardb_path'] . "/dhclient.leases." . $config['interfaces']['wan']['if'];
- if(file_exists($dhclientfn))
- $leases = file($dhclientfn);
- else
- $leases = array();
- /* Start at the end, work backwards finding the latest lease for the WAN */
- $dhcpserver = "";
- $iface = "";
- $iface = "";
- for ($i = (count($leases)-1); $i >= 0; $i--) {
- if ($leases[$i] == "}") {
- unset($iface);
- unset($dhcpserver);
- } elseif (strstr($leases[$i],"interface")) {
- preg_match("/\s+interface \"(\w+)\";/",$leases[$i],$iface);
- } elseif (strstr($leases[$i],"dhcp-server-identifier")) {
- preg_match("/\s+dhcp-server-identifier (\d+\.\d+\.\d+\.\d+);/",$leases[$i],$dhcpserver);
- }
- if ($iface == $config['interfaces']['wan'] && isset($dhcpserver)) {
- break;
- }
- }
- return $dhcpserver[1];
-}
-
-
require("guiconfig.inc");
-$if = $_GET['if'];
-if ($_POST['if'])
- $if = $_POST['if'];
-
-$iflist = get_configured_interface_with_descr();
-
-if (!$if || !isset($iflist[$if]))
- $if = "lan";
-
-$pconfig['enable'] = isset($config['dhcrelay'][$if]['enable']);
+$pconfig['enable'] = isset($config['dhcrelay']['enable']);
+if (empty($config['dhcrelay']['interface']))
+ $pconfig['interface'] = array();
+else
+ $pconfig['interface'] = explode(",", $config['dhcrelay']['interface']);
$pconfig['server'] = $config['dhcrelay']['server'];
-$pconfig['proxydhcp'] = isset($config['dhcrelay']['proxydhcp']);
$pconfig['agentoption'] = isset($config['dhcrelay']['agentoption']);
-$ifcfg = $config['interfaces'][$if];
+$iflist = get_configured_interface_with_descr();
/* set the enabled flag which will tell us if DHCP server is enabled
* on any interface. We will use this to disable dhcp-relay since
@@ -92,7 +57,7 @@ $ifcfg = $config['interfaces'][$if];
$dhcpd_enabled = false;
if (is_array($config['dhcpd'])) {
foreach($config['dhcpd'] as $dhcp)
- if(isset($dhcp['enable']))
+ if (isset($dhcp['enable']))
$dhcpd_enabled = true;
}
@@ -103,42 +68,25 @@ if ($_POST) {
/* input validation */
if ($_POST['enable']) {
- if (isset($_POST['proxydhcp']))
- $_POST['server'] = get_wan_dhcp_server();
- $reqdfields = explode(" ", "server");
- $reqdfieldsn = array(gettext("Destination Server"));
+ $reqdfields = explode(" ", "server interface");
+ $reqdfieldsn = array(gettext("Destination Server"), gettext("Interface"));
do_input_validation($_POST, $reqdfields, $reqdfieldsn, &$input_errors);
- if (($_POST['server'] && !is_ipaddr($_POST['server'])))
- $input_errors[] = gettext("A valid Destination Server IP address must be specified.");
-
- if (!$input_errors) {
- /* make sure that the DHCP server isn't enabled on this interface */
- if (isset($config['dhcpd'][$if]['enable']))
- $input_errors[] = sprintf(gettext("You must disable the DHCP server on the %s interface before enabling the DHCP Relay."),$iflist[$if]);
- /* make sure that the DHCP server isn't running on any of the implied interfaces */
- foreach ($config['interfaces'] as $ifname => $ifcfg) {
- $subnet = $ifcfg['ipaddr'] . "/" . $ifcfg['subnet'];
- if (ip_in_subnet($_POST['server'],$subnet))
- $destif = $ifname;
+ if ($_POST['server']) {
+ $checksrv = explode(",", $_POST['server']);
+ foreach ($checksrv as $srv) {
+ if (!is_ipaddr($srv))
+ $input_errors[] = gettext("A valid Destination Server IP address must be specified.");
}
- if (!isset($destif))
- $destif = "wan";
- if (isset($config['dhcpd'][$destif]['enable']))
- $input_errors[] = sprintf(gettext("You must disable the DHCP server on the %s interface before enabling the DHCP Relay."),$destif);
-
- /* if proxydhcp is selected, make sure DHCP is enabled on WAN */
- if (isset($config['dhcrelay']['proxydhcp']) && $config['interfaces']['wan']['ipaddr'] != "dhcp")
- $input_errors[] = gettext("You must have DHCP active on the WAN interface before enabling the DHCP proxy option.");
}
}
if (!$input_errors) {
+ $config['dhcrelay']['enable'] = $_POST['enable'] ? true : false;
+ $config['dhcrelay']['interface'] = implode(",", $_POST['interface']);
$config['dhcrelay']['agentoption'] = $_POST['agentoption'] ? true : false;
- $config['dhcrelay']['proxydhcp'] = $_POST['proxydhcp'] ? true : false;
$config['dhcrelay']['server'] = $_POST['server'];
- $config['dhcrelay'][$if]['enable'] = $_POST['enable'] ? true : false;
write_config();
@@ -159,15 +107,12 @@ include("head.inc");
function enable_change(enable_over) {
if (document.iform.enable.checked || enable_over) {
document.iform.server.disabled = 0;
+ document.iform.interface.disabled = 0;
document.iform.agentoption.disabled = 0;
- document.iform.proxydhcp.disabled = 0;
} else {
document.iform.server.disabled = 1;
+ document.iform.interface.disabled = 1;
document.iform.agentoption.disabled = 1;
- document.iform.proxydhcp.disabled = 1;
- }
- if (document.iform.proxydhcp.checked) {
- document.iform.server.disabled = 1;
}
}
//-->
@@ -179,69 +124,68 @@ function enable_change(enable_over) {
<form action="services_dhcp_relay.php" method="post" name="iform" id="iform">
<?php if ($input_errors) print_input_errors($input_errors); ?>
<?php if ($savemsg) print_info_box($savemsg); ?>
-<?php
- if ($dhcpd_enabled) {
- echo gettext("DHCP Server is currently enabled. Cannot enable the DHCP Relay service while the DHCP Server is enabled on any interface.");
- include("fend.inc");
- echo "</body>";
- echo "</html>";
- exit;
- }
-?>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
- <tr><td>
- <?php
- /* active tabs */
- $tab_array = array();
- $tabscounter = 0;
- $i = 0;
- foreach ($iflist as $ifent => $ifname) {
- if ($ifent == $if)
- $active = true;
- else
- $active = false;
- $tab_array[] = array($ifname, $active, "services_dhcp_relay.php?if={$ifent}");
- }
- display_top_tabs($tab_array);
- ?>
- </td></tr>
<tr>
<td>
<div id="mainarea">
<table class="tabcont" width="100%" border="0" cellpadding="6" cellspacing="0">
- <tr>
- <td width="22%" valign="top" class="vtable">&nbsp;</td>
+<?php
+ if ($dhcpd_enabled):
+ echo gettext("DHCP Server is currently enabled. Cannot enable the DHCP Relay service while the DHCP Server is enabled on any interface.");
+ else:
+?>
+ <tr>
+ <td colspan="2" valign="top" class="listtopic"><?=gettext("DHCP Relay configuration"); ?></td>
+ </tr>
+ <tr>
+ <td width="22%" valign="top" class="vncellreq">Enable</td>
+ <td width="78%" class="vtable">
+ <input name="enable" type="checkbox" value="yes" <?php if ($pconfig['enable']) echo "checked"; ?> onClick="enable_change(false)">
+ <strong><?php printf(gettext("Enable DHCP relay on interface"));?></strong>
+ </td>
+ </tr>
+ <tr>
+ <td width="22%" valign="top" class="vncellreq">Interface(s)</td>
<td width="78%" class="vtable">
-<input name="enable" type="checkbox" value="yes" <?php if ($pconfig['enable']) echo "checked"; ?> onClick="enable_change(false)">
- <strong><?php printf(gettext("Enable DHCP relay on " .
- "%s " .
- "interface"),htmlspecialchars($iflist[$if]));?></strong></td>
- </tr>
- <tr>
+ <select id="interface" name="interface[]" multiple="true" class="formselect" size="3">
+ <?php
+ foreach ($iflist as $ifent => $ifdesc) {
+ if (!is_ipaddr(get_interface_ip($ifent)))
+ continue;
+ echo "<option value='{$ifent}'";
+ if (in_array($ifent, $pconfig['interface']))
+ echo "selected";
+ echo ">{$ifdesc}</option>\n";
+ }
+ ?>
+ </select>
+ <br />Interfaces without an ip address will not be shown.
+ </td>
+ </tr>
+ <tr>
<td width="22%" valign="top" class="vtable">&nbsp;</td>
<td width="78%" class="vtable">
<input name="agentoption" type="checkbox" value="yes" <?php if ($pconfig['agentoption']) echo "checked"; ?>>
<strong><?=gettext("Append circuit ID and agent ID to requests"); ?></strong><br>
<?php printf(gettext("If this is checked, the DHCP relay will append the circuit ID (%s interface number) and the agent ID to the DHCP request."), $g['product_name']); ?></td>
- </tr>
- <tr>
+ </tr>
+ <tr>
<td width="22%" valign="top" class="vncell"><?=gettext("Destination server");?></td>
<td width="78%" class="vtable">
- <input name="proxydhcp" type="checkbox" value="yes" <?php if ($pconfig['proxydhcp']) echo "checked"; ?> onClick="enable_change(false)"> <?=gettext("Proxy requests to DHCP server on WAN subnet");?>
- <br><br><input name="server" type="text" class="formfld unknown" id="server" size="20" value="<?=htmlspecialchars($pconfig['server']);?>">
+ <input name="server" type="text" class="formfld unknown" id="server" size="20" value="<?=htmlspecialchars($pconfig['server']);?>">
<br>
- <?=gettext("This is the IP address of the server to which the DHCP packet is relayed. Select \"Proxy requests to DHCP server on WAN subnet\" to relay DHCP packets to the server that was used on the WAN interface.");?>
+ <?=gettext("This is the IP address of the server to which the DHCP packet is relayed. You can enter multiple ip address server entries separated by commas. Select \"Proxy requests to DHCP server on WAN subnet\" to relay DHCP packets to the server that was used on the WAN interface.");?>
</td>
- </tr>
- <tr>
+ </tr>
+ <tr>
<td width="22%" valign="top">&nbsp;</td>
<td width="78%">
- <input name="if" type="hidden" value="<?=$if;?>">
<input name="Submit" type="submit" class="formbtn" value="<?=gettext("Save");?>" onclick="enable_change(true)">
</td>
- </tr>
- </table>
+ </tr>
+<?php endif; ?>
+ </table>
</div>
</td>
</tr>
diff --git a/usr/local/www/system_groupmanager.php b/usr/local/www/system_groupmanager.php
index 0097eb9..d3978f0 100644
--- a/usr/local/www/system_groupmanager.php
+++ b/usr/local/www/system_groupmanager.php
@@ -82,10 +82,12 @@ if ($_GET['act'] == "delpriv") {
$privdeleted = $priv_list[$a_group[$id]['priv'][$_GET['privid']]]['name'];
unset($a_group[$id]['priv'][$_GET['privid']]);
- foreach ($a_group[$id]['member'] as $uid) {
- $user = getUserEntryByUID($uid);
- if ($user)
- local_user_set($user);
+ if (is_array($a_group[$id]['member'])) {
+ foreach ($a_group[$id]['member'] as $uid) {
+ $user = getUserEntryByUID($uid);
+ if ($user)
+ local_user_set($user);
+ }
}
write_config();
diff --git a/usr/local/www/system_groupmanager_addprivs.php b/usr/local/www/system_groupmanager_addprivs.php
index 63642b6..104d562 100644
--- a/usr/local/www/system_groupmanager_addprivs.php
+++ b/usr/local/www/system_groupmanager_addprivs.php
@@ -96,10 +96,12 @@ if ($_POST) {
else
$a_group['priv'] = array_merge($a_group['priv'], $pconfig['sysprivs']);
- foreach ($a_group['member'] as $uid) {
- $user = getUserEntryByUID($uid);
- if ($user)
- local_user_set($user);
+ if (is_array($a_group['member'])) {
+ foreach ($a_group['member'] as $uid) {
+ $user = getUserEntryByUID($uid);
+ if ($user)
+ local_user_set($user);
+ }
}
admin_groups_sort();
diff --git a/usr/local/www/wizard.php b/usr/local/www/wizard.php
index ff6ded1..d4a2b02 100755
--- a/usr/local/www/wizard.php
+++ b/usr/local/www/wizard.php
@@ -173,8 +173,8 @@ include("head.inc");
?>
<body link="#0000CC" vlink="#0000CC" alink="#0000CC" >
-
<?php
+
if(file_exists("/usr/local/www/themes/{$g['theme']}/wizard.css"))
echo "<link rel=\"stylesheet\" href=\"/themes/{$g['theme']}/wizard.css\" media=\"all\" />\n";
else
@@ -321,10 +321,6 @@ function showchange() {
<img border="0" src="./themes/<?= $g['theme']; ?>/images/logo.gif"></a>
<p>
<div style="width:800px;background-color:#ffffff" id="roundme">
-<table bgcolor="#ffffff" width="95%" border="0" cellspacing="0" cellpadding="2">
- <!-- wizard goes here -->
- <tr><td>&nbsp;</td></tr>
- <tr><td colspan='2'>
<?php
if ($savemsg)
print_info_box($savemsg);
@@ -332,7 +328,10 @@ function showchange() {
print_info_box(htmlspecialchars($_GET['message']));
if ($_POST['message'] != "")
print_info_box(htmlspecialchars($_POST['message']));
-?></td></tr>
+?>
+<table bgcolor="#ffffff" width="95%" border="0" cellspacing="0" cellpadding="2">
+ <!-- wizard goes here -->
+ <tr><td>&nbsp;</td></tr>
<tr>
<td class="tabcont">
<table width="100%" border="0" cellpadding="6" cellspacing="0">
diff --git a/usr/local/www/wizards/traffic_shaper_wizard.inc b/usr/local/www/wizards/traffic_shaper_wizard.inc
index aa5d023..78344cf 100644
--- a/usr/local/www/wizards/traffic_shaper_wizard.inc
+++ b/usr/local/www/wizards/traffic_shaper_wizard.inc
@@ -1,12 +1,11 @@
<?php
-/* $Id$ */
/*
traffic_shaper_wizard.inc
part of pfSense (http://www.pfsense.org/)
Copyright (C) 2006 Bill Marquette - bill.marquette@gmail.com.
Copyright (C) 2006 Scott Ullrich - sullrich@pfsense.com.
- Copyright (C) 2008 Ermal Luçi
+ Copyright (C) 2008-2010 Ermal Luçi
All rights reserved.
Redistribution and use in source and binary forms, with or without
@@ -32,233 +31,234 @@
*/
function step1_submitphpaction() {
-
- if (!isset($_POST['numberofconnections'])) {
- $message=gettext("You need to specify the number of connections.");
- header("Location:wizard.php?xml=traffic_shaper_wizard.xml&stepid=0&message={$message}");
- exit;
- }
- if (intval($_POST['numberofconnections']) > 100 || intval($_POST['numberofconnections']) < 1) {
- $message=gettext("The number of connections supported is between 1 and 100.");
- header("Location:wizard.php?xml=traffic_shaper_wizard.xml&stepid=0&message={$message}");
- exit;
- }
+ global $stepid, $savemsg;
+
+ if (!isset($_POST['numberofconnections'])) {
+ $savemsg=gettext("You need to specify the number of connections.");
+ $stepid--;
+ return;
+ }
+ if (intval($_POST['numberofconnections']) < 1) {
+ $savemsg=gettext("The number of connections should be greater than 1.");
+ $stepid--;
+ return;
+ }
}
function step2_stepbeforeformdisplay() {
- global $config, $pkg;
-
- $numberofinterfaces = 0;
- $iflist = array();
- $iflisttmp = get_configured_interface_with_descr();
- foreach ($iflisttmp as $if => $ifdesc) {
- if (!is_altq_capable(get_real_interface($if)))
- continue;
- if ($if == "lan")
- continue;
- $numberofinterfaces++;
- $iflist[$if] = $ifdesc;
- }
- $numberofconnections = intval($config['ezshaper']['step1']['numberofconnections']);
- if ($numberofconnections > $numberofinterfaces) {
- $message=gettext("You have less interfaces than number of connections!");
- header("Location:wizard.php?xml=traffic_shaper_wizard.xml&stepid=0&message={$message}");
- exit;
- }
-
- $cfgname = "traffic_shaper_wizard.xml";
+ global $config, $pkg;
+ global $stepid, $savemsg;
+
+ $numberofinterfaces = 0;
+ $iflist = array();
+ $iflisttmp = get_configured_interface_with_descr();
+ foreach ($iflisttmp as $if => $ifdesc) {
+ if (!is_altq_capable(get_real_interface($if)))
+ continue;
+ if ($if == "lan")
+ continue;
+ $numberofinterfaces++;
+ $iflist[$if] = $ifdesc;
+ }
+ $numberofconnections = intval($config['ezshaper']['step1']['numberofconnections']);
+ if ($numberofconnections > $numberofinterfaces) {
+ $savemsg=gettext("You have less interfaces than number of connections!");
+ $stepid--;
+ return;
+ }
- $fields =& $pkg['step'][1]['fields']['field'];
-
- /*
- unset($config['ezshaper']['step2']);
- $config['ezshaper']['step2'] = array();
- write_config();
- */
- $fields = array();
+ $cfgname = "traffic_shaper_wizard.xml";
+ $fields =& $pkg['step'][1]['fields']['field'];
+
+ /*
+ unset($config['ezshaper']['step2']);
+ $config['ezshaper']['step2'] = array();
+ write_config();
+ */
+ $fields = array();
+
+ $field = array();
+ $field['name'] = "Setup LAN scheduler";
+ $field['type'] = "listtopic";
+ $fields[] = $field;
+ $field = array();
+ $field['displayname'] = "Download Scheduler";
+ $field['name'] = "downloadscheduler";
+ $field['type'] = "select";
+ $field['typehint'] = "Queueing discipline to apply on the download of this connection.";
+ $field['options']['option'] = array();
+ $opts = array();
+ $opts['name'] = "HFSC";
+ $opts['value'] = "HFSC";
+ $field['options']['option'][] = $opts;
+ $opts = array();
+ $opts['name'] = "CBQ";
+ $opts['value'] = "CBQ";
+ $field['options']['option'][] = $opts;
+ $opts = array();
+ $opts['name'] = "PRIQ";
+ $opts['value'] = "PRIQ";
+ $field['options']['option'][] = $opts;
+ $field['bindstofield'] = "ezshaper->step2->downloadscheduler";
+ $fields[] = $field;
+
+ for ($i = 0; $i < $numberofconnections; $i++) {
$field = array();
- $field['name'] = "Setup LAN scheduler";
+ $interface_friendly = $i+1;
+ $field['name'] = "Setup connection speed and scheduler information for WAN #{$interface_friendly}";
$field['type'] = "listtopic";
$fields[] = $field;
+
$field = array();
- $field['displayname'] = "Download Scheduler";
- $field['name'] = "downloadscheduler";
- $field['type'] = "select";
- $field['typehint'] = "Queueing discipline to apply on the download of this connection.";
+ $field['displayname'] = "Interface";
+ $field['name'] = "conn{$i}interface";
+ $field['type'] = "select";
+ $field['typehint'] = "Interface of connection.";
$field['options']['option'] = array();
+ foreach ($iflist as $ifname => $ifdescr) {
$opts = array();
- $opts['name'] = "HFSC";
- $opts['value'] = "HFSC";
+ $opts['displayname'] = $ifdescr;
+ $opts['name'] = $ifname;
+ $opts['value'] = $ifname;
+ $field['options']['option'][] = $opts;
+ }
+ $field['bindstofield'] = "ezshaper->step2->conn{$i}interface";
+ $fields[] = $field;
+
+ $field = array();
+ $field['displayname'] = "Upload Scheduler";
+ $field['name'] = "conn{$i}uploadscheduler";
+ $field['type'] = "select";
+ $field['typehint'] = "Queueing discipline to apply on the upload of this connection.";
+ $field['options']['option'] = array();
+ $opts = array();
+ $opts['name'] = "HFSC";
+ $opts['value'] = "HFSC";
$field['options']['option'][] = $opts;
- $opts = array();
- $opts['name'] = "CBQ";
- $opts['value'] = "CBQ";
+ $opts = array();
+ $opts['name'] = "CBQ";
+ $opts['value'] = "CBQ";
$field['options']['option'][] = $opts;
- $opts = array();
- $opts['name'] = "PRIQ";
- $opts['value'] = "PRIQ";
+ $opts = array();
+ $opts['name'] = "PRIQ";
+ $opts['value'] = "PRIQ";
$field['options']['option'][] = $opts;
- $field['bindstofield'] = "ezshaper->step2->downloadscheduler";
+ $field['bindstofield'] = "ezshaper->step2->conn{$i}uploadscheduler";
$fields[] = $field;
+ $field = array();
+ $field['displayname'] = "Connection Upload";
+ $field['name'] = "conn{$i}upload";
+ $field['type'] = "input";
+ $field['bindstofield'] = "ezshaper->step2->conn{$i}upload";
+ $field['combinefieldsbegin'] = "true";
+ $fields[] = $field;
- for ($i = 0; $i < $numberofconnections; $i++) {
+ $field = array();
+ $field['combinefieldsend'] = "true";
+ $field['dontdisplayname'] = "true";
+ $field['dontcombinecells'] = "true";
+ $field['name'] = "conn{$i}uploadspeed";
+ $field['typehint'] = "Upload bandwidth on this connection.";
+ $field['type'] = "select";
+ $field['options']['option'] = array();
+ $opts = array();
+ $opts['value'] = "Kb";
+ $opts['name'] = "Kbit/s";
+ $field['options']['option'][] = $opts;
+ $opts = array();
+ $opts['value'] = "Mb";
+ $opts['name'] = "Mbit/s";
+ $field['options']['option'][] = $opts;
+ $opts = array();
+ $opts['value'] = "Gb";
+ $opts['name'] = "Gbit/s";
+ $field['options']['option'][] = $opts;
+ $field['bindstofield'] = "ezshaper->step2->conn{$i}uploadspeed";
+ $fields[] = $field;
- $field = array();
- $interface_friendly = $i+1;
- $field['name'] = "Setup connection speed and scheduler information for WAN ({$interface_friendly})";
- $field['type'] = "listtopic";
- $fields[] = $field;
-
- $field = array();
- $field['displayname'] = "Interface";
- $field['name'] = "conn{$i}interface";
- $field['type'] = "select";
- $field['typehint'] = "Interface of connection ({$interface_friendly}).";
- $field['options']['option'] = array();
- foreach ($iflist as $ifname => $ifdescr) {
- $opts = array();
- $opts['displayname'] = $ifdescr;
- $opts['name'] = $ifname;
- $opts['value'] = $ifname;
- $field['options']['option'][] = $opts;
- }
- $field['bindstofield'] = "ezshaper->step2->conn{$i}interface";
- $fields[] = $field;
-
- $field['displayname'] = "Upload Scheduler";
- $field['name'] = "conn{$i}uploadscheduler";
- $field['type'] = "select";
- $field['typehint'] = "Queueing discipline to apply on the upload of this connection.";
- $field['options']['option'] = array();
- $opts = array();
- $opts['name'] = "HFSC";
- $opts['value'] = "HFSC";
- $field['options']['option'][] = $opts;
- $opts = array();
- $opts['name'] = "CBQ";
- $opts['value'] = "CBQ";
- $field['options']['option'][] = $opts;
- $opts = array();
- $opts['name'] = "PRIQ";
- $opts['value'] = "PRIQ";
- $field['options']['option'][] = $opts;
- $field['bindstofield'] = "ezshaper->step2->conn{$i}uploadscheduler";
- $fields[] = $field;
-
- $field = array();
- $field['displayname'] = "Connection Upload";
- $field['name'] = "conn{$i}upload";
- $field['type'] = "input";
- $field['bindstofield'] = "ezshaper->step2->conn{$i}upload";
- $field['combinefieldsbegin'] = "true";
- $fields[] = $field;
-
- $field = array();
- $field['combinefieldsend'] = "true";
- $field['dontdisplayname'] = "true";
- $field['dontcombinecells'] = "true";
- $field['name'] = "conn{$i}uploadspeed";
- $field['typehint'] = "Upload bandwidth on this connection.";
- $field['type'] = "select";
- $field['options']['option'] = array();
- $opts = array();
- $opts['value'] = "Kb";
- $opts['name'] = "Kbit/s";
- $field['options']['option'][] = $opts;
- $opts = array();
- $opts['value'] = "Mb";
- $opts['name'] = "Mbit/s";
- $field['options']['option'][] = $opts;
- $opts = array();
- $opts['value'] = "Gb";
- $opts['name'] = "Gbit/s";
- $field['options']['option'][] = $opts;
- $field['bindstofield'] = "ezshaper->step2->conn{$i}uploadspeed";
- $fields[] = $field;
-
- $field = array();
- $field['displayname'] = "Connection Download";
- $field['name'] = "conn{$i}download";
- $field['type'] = "input";
- $field['bindstofield'] = "ezshaper->step2->conn{$i}download";
- $field['combinefieldsbegin'] = "true";
- $fields[] = $field;
-
- $field = array();
- $field['combinefieldsend'] = "true";
- $field['dontdisplayname'] = "true";
- $field['dontcombinecells'] = "true";
- $field['name'] = "conn{$i}downloadspeed";
- $field['typehint'] = "Download bandwidth on this connection.";
- $field['type'] = "select";
- $field['options']['option'] = array();
- $opts = array();
- $opts['value'] = "Kb";
- $opts['name'] = "Kbit/s";
- $field['options']['option'][] = $opts;
- $opts = array();
- $opts['value'] = "Mb";
- $opts['name'] = "Mbit/s";
- $field['options']['option'][] = $opts;
- $opts = array();
- $opts['value'] = "Gb";
- $opts['name'] = "Gbit/s";
- $field['options']['option'][] = $opts;
- $field['bindstofield'] = "ezshaper->step2->conn{$i}downloadspeed";
- $fields[] = $field;
- }
$field = array();
- $field['name'] = "Next";
- $field['type'] = "submit";
+ $field['displayname'] = "Connection Download";
+ $field['name'] = "conn{$i}download";
+ $field['type'] = "input";
+ $field['bindstofield'] = "ezshaper->step2->conn{$i}download";
+ $field['combinefieldsbegin'] = "true";
$fields[] = $field;
+ $field = array();
+ $field['combinefieldsend'] = "true";
+ $field['dontdisplayname'] = "true";
+ $field['dontcombinecells'] = "true";
+ $field['name'] = "conn{$i}downloadspeed";
+ $field['typehint'] = "Download bandwidth on this connection.";
+ $field['type'] = "select";
+ $field['options']['option'] = array();
+ $opts = array();
+ $opts['value'] = "Kb";
+ $opts['name'] = "Kbit/s";
+ $field['options']['option'][] = $opts;
+ $opts = array();
+ $opts['value'] = "Mb";
+ $opts['name'] = "Mbit/s";
+ $field['options']['option'][] = $opts;
+ $opts = array();
+ $opts['value'] = "Gb";
+ $opts['name'] = "Gbit/s";
+ $field['options']['option'][] = $opts;
+ $field['bindstofield'] = "ezshaper->step2->conn{$i}downloadspeed";
+ $fields[] = $field;
+ }
+ $field = array();
+ $field['name'] = "Next";
+ $field['type'] = "submit";
+ $fields[] = $field;
}
function step2_stepsubmitphpaction() {
global $config;
+ global $stepid, $savemsg;
$sumdownloads = 0;
/* Input Validation */
$steps = intval($config['ezshaper']['step1']['numberofconnections']);
for ($i = 0; $i < $steps; $i++) {
- for ($j = $j; $j < $steps; $j++) {
- if ($_POST["conn{$i}interface"] == $_POST["conn{$j}interface"]) {
- $message=gettext("You cannot select the same interface for connections {$i} and {$j}.");
- header("Location: wizard.php?xml=traffic_shaper_wizard.xml&stepid=1&message={$message}");
- exit;
- }
- if (!is_numeric($_POST["conn{$i}upload"])) {
- $message = gettext("Upload bandwidth of connection {$i} is not valid.");
- header("Location: wizard.php?xml=traffic_shaper_wizard.xml&stepid=1&message={$message}");
- exit;
- }
- if (!is_numeric($_POST["conn{$i}download"])) {
- $message = gettext("Download bandwidth of connection {$i} is not valid.");
- header("Location: wizard.php?xml=traffic_shaper_wizard.xml&stepid=1&message={$message}");
- exit;
- }
- $upbw = $_POST["conn{$i}upload"];
- $downbw = $_POST["conn{$i}download"];
- if ($upbw == 0 || $downbw = 0) {
- $message = gettext("You cannot specify 0 bandwidth!");
- header("Location: wizard.php?xml=traffic_shaper_wizard.xml&stepid=1&message={$message}");
- exit;
- }
-
- if ($upbw < 128 && $_POST["conn{$i}uploadspeed"] == "Kb" && trim($_POST["conn{$i}scheduler"]) == "CBQ") {
- $message=gettext("We do not support Bandwidths smaller than 128Kbit/s for CBQ scheduler.");
- header("Location: wizard.php?xml=traffic_shaper_wizard.xml&stepid=1&message={$message}");
- exit;
- }
- if ($downbw < 128 && $_POST["conn{$i}downloadspeed"] == "Kb" && trim($_POST["downloadscheduler"]) == "CBQ") {
- $message=gettext("We do not support Bandwidths smaller than 128Kbit/s for CBQ scheduler.");
- header("Location: wizard.php?xml=traffic_shaper_wizard.xml&stepid=1&message={$message}");
- exit;
- }
-
+ for ($j = $i + 1; $j < $steps; $j++) {
+ $wannum = $i+1;
+ if ($_POST["conn{$i}interface"] == $_POST["conn{$j}interface"]) {
+ $savemsg=gettext("You cannot select the same interface for WAN# {$wannum} and WAN #{$j}.");
+ $stepid--;
+ return;
+ }
+ if (!is_numeric($_POST["conn{$i}upload"])) {
+ $savemsg = gettext("WAN #{$wannum}: Upload bandwidth is not valid.");
+ $stepid--;
+ return;
+ }
+ if (!is_numeric($_POST["conn{$i}download"])) {
+ $savemsg = gettext("WAN #{$wannum}: Download bandwidth is not valid.");
+ $stepid--;
+ return;
}
+ $upbw = $_POST["conn{$i}upload"];
+ $downbw = $_POST["conn{$i}download"];
+ if ($upbw < 1 || $downbw < 1) {
+ $savemsg = gettext("WAN #{$wannum}: You cannot specify bandwidth less then 1!");
+ $stepid--;
+ return;
+ }
+ if ($upbw < 128 && $_POST["conn{$i}uploadspeed"] == "Kb" && trim($_POST["conn{$i}scheduler"]) == "CBQ") {
+ $savemsg=gettext("WAN #{$wannum}: We do not support Bandwidths smaller than 128Kbit/s for CBQ scheduler.");
+ $stepid--;
+ return;
+ }
+ if ($downbw < 128 && $_POST["conn{$i}downloadspeed"] == "Kb" && trim($_POST["downloadscheduler"]) == "CBQ") {
+ $savemsg=gettext("WAN #{$wannum}: We do not support Bandwidths smaller than 128Kbit/s for CBQ scheduler.");
+ $stepid--;
+ return;
+ }
+
+ }
}
/* This is necessary since the wizard expects predefined fields. */
unset($config['ezshaper']['step2']);
@@ -273,167 +273,175 @@ function step2_stepsubmitphpaction() {
$config['ezshaper']['step2']["conn{$i}downloadspeed"] = $_POST["conn{$i}downloadspeed"];
$config['ezshaper']['step2']["conn${i}interface"] = $_POST["conn{$i}interface"];
}
-
- /* Not needed, called by wizard.php */
-// write_config();
}
function step3_stepbeforeformdisplay() {
global $config, $pkg;
+ global $stepid, $savemsg;
+
+ $cfgname = "traffic_shaper_wizard.xml";
+
+ $numberofconnections = intval($config['ezshaper']['step1']['numberofconnections']);
+
+ $fields =& $pkg['step'][1]['fields']['field'];
+
+ $voipfields =& $pkg['step'][2]['fields']['field'];
+
+ $voipfields = array();
+ $enablefields = array();
+
+ $field = array();
+ $field['name'] = "enable";
+ $field['type'] = "checkbox";
+ $field['typehint'] = "Prioritize Voice over IP traffic.";
+ $field['bindstofield'] = "ezshaper->step3->enable";
+ $field['descritpion'] = "This will raise the priority of VOIP traffic above all other traffic.";
+ $voipfields[] = $field;
+
+ $field = array();
+ $field['name'] = "Next";
+ $field['type'] = "submit";
+ $voipfields[] = $field;
+
+ $field = array();
+ $field['name'] = "VOIP specific settings";
+ $field['type'] = "listtopic";
+ $voipfields[] = $field;
+
+ $field = array();
+ $field['name'] = "Provider";
+ $enablefields[] = "Provider";
+ $field['type'] = "select";
+ $field['description'] = "Choose Generic if your provider isn't listed.";
+ $field['options']['option'] = array();
+ $opts = array();
+ $opts['name'] = "Generic (lowdelay)";
+ $opts['value'] = "Generic";
+ $field['options']['option'][] = $opts;
+ $opts = array();
+ $opts['name'] = "VoicePulse";
+ $opts['value'] = "VoicePulse";
+ $field['options']['option'][] = $opts;
+ $opts = array();
+ $opts['name'] = "Asterisk/Vonage";
+ $opts['value'] = "Asterisk";
+ $field['options']['option'][] = $opts;
+ $opts = array();
+ $opts['name'] = "PanasonicTDA";
+ $opts['value'] = "Panasonic";
+ $field['options']['option'][] = $opts;
+ $field['bindstofield'] = "ezshaper->step3->provider";
+ $voipfields[] = $field;
+
+ $field = array();
+ $field['name'] = "Address";
+ $enablefields[] = "Address";
+ $field['type'] = "inputalias";
+ $field['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.";
+ $field['message'] = "IP Address field is non-blank and doesn't look like an IP address.";
+ $field['bindstofield'] = "ezshaper->step3->address";
+ $voipfields[] = $field;
+
+ $field = array();
+ $interface_friendly = $i+1;
+ $field['name'] = "Upload bandwidth for each WAN(interface)";
+ $field['type'] = "listtopic";
+ $voipfields[] = $field;
+
+ for ($i = 0; $i < $numberofconnections; $i++) {
+ $field = array();
+ $wannum = $i+1;
+ $field['displayname'] = "WAN #{$wannum} upload";
+ $field['name'] = "conn{$i}upload";
+ $enablefields[] = "conn{$i}upload";
+ $field['type'] = "input";
+ $field['bindstofield'] = "ezshaper->step3->conn{$i}upload";
+ $field['combinefieldsbegin'] = "true";
+ $voipfields[] = $field;
- $cfgname = "traffic_shaper_wizard.xml";
-
- $numberofconnections = intval($config['ezshaper']['step1']['numberofconnections']);
-
- $fields =& $pkg['step'][1]['fields']['field'];
-
- $voipfields =& $pkg['step'][2]['fields']['field'];
-
- $voipfields = array();
-
- $field = array();
- $field['name'] = "enable";
- $field['type'] = "checkbox";
- $field['typehint'] = "Prioritize Voice over IP traffic.";
- $field['bindstofield'] = "ezshaper->step3->enable";
- $field['descritpion'] = "This will raise the priority of VOIP traffic above all other traffic.";
- $voipfields[] = $field;
-
- $field = array();
- $field['name'] = "Next";
- $field['type'] = "submit";
- $voipfields[] = $field;
-
- $field = array();
- $field['name'] = "VOIP specific settings";
- $field['type'] = "listtopic";
- $voipfields[] = $field;
-
- $field['name'] = "Provider";
- $field['type'] = "select";
- $field['description'] = "Choose Generic if your provider isn't listed.";
- $field['options']['option'] = array();
- $opts = array();
- $opts['name'] = "Generic (lowdelay)";
- $opts['value'] = "Generic";
- $field['options']['option'][] = $opts;
- $opts = array();
- $opts['name'] = "VoicePulse";
- $opts['value'] = "VoicePulse";
- $field['options']['option'][] = $opts;
- $opts = array();
- $opts['name'] = "Asterisk/Vonage";
- $opts['value'] = "Asterisk";
- $field['options']['option'][] = $opts;
- $opts = array();
- $opts['name'] = "PanasonicTDA";
- $opts['value'] = "Panasonic";
- $field['options']['option'][] = $opts;
- $field['bindstofield'] = "ezshaper->step3->provider";
- $voipfields[] = $field;
-
- $field = array();
- $field['name'] = "Address";
- $field['type'] = "inputalias";
- $field['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.";
- $field['message'] = "IP Address field is non-blank and doesn't look like an IP address.";
- $field['bindstofield'] = "ezshaper->step3->address";
- $voipfields[] = $field;
-
- $field = array();
- $interface_friendly = $i+1;
- $field['name'] = "Upload bandwidth for each interface";
- $field['type'] = "listtopic";
- $voipfields[] = $field;
-
- for ($i = 0; $i < $numberofconnections; $i++) {
- $field = array();
- $field['displayname'] = "Connection upload";
- $field['name'] = "conn{$i}upload";
- $field['type'] = "input";
- $field['bindstofield'] = "ezshaper->step3->conn{$i}upload";
- $field['combinefieldsbegin'] = "true";
- $voipfields[] = $field;
-
- $field = array();
- $field['combinefieldsend'] = "true";
- $field['dontdisplayname'] = "true";
- $field['dontcombinecells'] = "true";
- $field['name'] = "conn{$i}uploadspeed";
- $friendly_interface = $i+1;
- $field['typehint'] = "Upload bandwidth guarantee for VOIP phone(s) on connection #{$friendly_interface}.";
- $field['type'] = "select";
- $field['options']['option'] = array();
- $opts = array();
- $opts['value'] = "Kb";
- $opts['name'] = "Kbit/s";
- $field['options']['option'][] = $opts;
- $opts = array();
- $opts['value'] = "Mb";
- $opts['name'] = "Mbit/s";
- $field['options']['option'][] = $opts;
- $opts = array();
- $opts['value'] = "Gb";
- $opts['name'] = "Gbit/s";
- $field['options']['option'][] = $opts;
- $field['bindstofield'] = "ezshaper->step3->conn{$i}uploadspeed";
- $voipfields[] = $field;
- }
-
-
- $field = array();
- $interface_friendly = $i+1;
- $field['name'] = "Combined download bandwidth for Voice over IP phones";
- $field['type'] = "listtopic";
- $voipfields[] = $field;
-
- $field = array();
- $field['name'] = "download";
- $field['type'] = "input";
- $field['bindstofield'] = "ezshaper->step3->download";
- $field['combinefieldsbegin'] = "true";
- $voipfields[] = $field;
-
- $field = array();
- $field['combinefieldsend'] = "true";
- $field['dontdisplayname'] = "true";
- $field['dontcombinecells'] = "true";
- $field['name'] = "downloadspeed";
- $field['typehint'] = "Download bandwidth guarantee for VOIP phone(s) on connections.";
- $field['type'] = "select";
- $field['options']['option'] = array();
- $opts = array();
- $opts['value'] = "Kb";
- $opts['name'] = "Kbit/s";
- $field['options']['option'][] = $opts;
- $opts = array();
- $opts['value'] = "Mb";
- $opts['name'] = "Mbit/s";
- $field['options']['option'][] = $opts;
- $opts = array();
- $opts['value'] = "Gb";
- $opts['name'] = "Gbit/s";
- $field['options']['option'][] = $opts;
- $field['bindstofield'] = "ezshaper->step3->downloadspeed";
- $voipfields[] = $field;
+ $field = array();
+ $field['combinefieldsend'] = "true";
+ $field['dontdisplayname'] = "true";
+ $field['dontcombinecells'] = "true";
+ $field['name'] = "conn{$i}uploadspeed";
+ $enablefields[] = "conn{$i}uploadspeed";
+ $friendly_interface = $i+1;
+ $field['typehint'] = "Upload bandwidth guarantee for VOIP phone(s) on connection #{$friendly_interface}.";
+ $field['type'] = "select";
+ $field['options']['option'] = array();
+ $opts = array();
+ $opts['value'] = "Kb";
+ $opts['name'] = "Kbit/s";
+ $field['options']['option'][] = $opts;
+ $opts = array();
+ $opts['value'] = "Mb";
+ $opts['name'] = "Mbit/s";
+ $field['options']['option'][] = $opts;
+ $opts = array();
+ $opts['value'] = "Gb";
+ $opts['name'] = "Gbit/s";
+ $field['options']['option'][] = $opts;
+ $field['bindstofield'] = "ezshaper->step3->conn{$i}uploadspeed";
+ $voipfields[] = $field;
+ }
- $field = array();
- $field['name'] = "Next";
- $field['type'] = "submit";
+ $field = array();
+ $interface_friendly = $i+1;
+ $field['name'] = "Download bandwidth(speed) for Voice over IP phones";
+ $field['type'] = "listtopic";
+ $voipfields[] = $field;
+
+ $field = array();
+ $field['name'] = "download";
+ $field['displayname'] = "LAN download";
+ $enablefields[] = "download";
+ $field['type'] = "input";
+ $field['bindstofield'] = "ezshaper->step3->download";
+ $field['combinefieldsbegin'] = "true";
+ $voipfields[] = $field;
+
+ $field = array();
+ $field['combinefieldsend'] = "true";
+ $field['dontdisplayname'] = "true";
+ $field['dontcombinecells'] = "true";
+ $field['name'] = "downloadspeed";
+ $enablefields[] = "downloadspeed";
+ $field['typehint'] = "Download bandwidth guarantee for VOIP phone(s) on connections.";
+ $field['type'] = "select";
+ $field['options']['option'] = array();
+ $opts = array();
+ $opts['value'] = "Kb";
+ $opts['name'] = "Kbit/s";
+ $field['options']['option'][] = $opts;
+ $opts = array();
+ $opts['value'] = "Mb";
+ $opts['name'] = "Mbit/s";
+ $field['options']['option'][] = $opts;
+ $opts = array();
+ $opts['value'] = "Gb";
+ $opts['name'] = "Gbit/s";
+ $field['options']['option'][] = $opts;
+ $field['bindstofield'] = "ezshaper->step3->downloadspeed";
+ $voipfields[] = $field;
+
+ $field = array();
+ $field['name'] = "Next";
+ $field['type'] = "submit";
$voipfields[] = $field;
+
+ $voipfields[0]['enablefields'] = implode(",", $enablefields);
}
function step3_stepsubmitphpaction() {
global $config;
+ global $stepid, $savemsg;
if($_POST['address']) {
- if(!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=2&message={$message}");
- exit;
- }
+ if(!is_ipaddroralias($_POST['address'])) {
+ /* item is not an ip or alias. error out */
+ $savemsg=gettext("Address must be a valid IP address or Firewall Alias. Please correct this value to continue.");
+ $stepid--;
+ return;
}
}
@@ -441,19 +449,20 @@ function step3_stepsubmitphpaction() {
for ($i = 0; $i < $steps; $i++) {
if ($_POST["conn{$i}upload"]) {
if (!is_numeric($_POST["conn{$i}upload"])) {
- $message = gettext("Upload bandwidth of connection {$i} is not valid.");
- header("Location: wizard.php?xml=traffic_shaper_wizard.xml&stepid=2&message={$message}");
- exit;
- }
+ $wannum = $i + 1;
+ $savemsg = gettext("Upload bandwidth of WAN #{$wannum} is not valid.");
+ $stepid--;
+ return;
+ }
$factor = wizard_get_bandwidthtype_scale($config['ezshaper']['step2']["conn{$i}uploadspeed"]);
$ifbw = $factor * floatval($config['ezshaper']['step2']["conn{$i}upload"]);
$factor = wizard_get_bandwidthtype_scale($_POST["conn{$i}uploadspeed"]);
$input_bw = $factor * floatval($_POST["conn{$i}upload"]);
if ((0.8 * $ifbw) < $input_bw) {
$friendly_interface = $i+1;
- $message=gettext("You cannot set the VoIP upload bandwidth on connection #{$friendly_interface} higher than 80% of the connection.");
- header("Location: wizard.php?xml=traffic_shaper_wizard.xml&stepid=2&message={$message}");
- exit;
+ $savemsg=gettext("You cannot set the VoIP upload bandwidth on WAN #{$friendly_interface} higher than 80% of the connection.");
+ $stepid--;
+ return;
}
}
}
@@ -463,98 +472,92 @@ function step3_stepsubmitphpaction() {
for ($i = 0; $i < $steps; $i++) {
$config['ezshaper']['step3']["conn{$i}upload"] = $_POST["conn{$i}upload"];
$config['ezshaper']['step3']["conn{$i}uploadspeed"] = $_POST["conn{$i}uploadspeed"];
- }
-
- /* Not needed, called by wizard.php */
- //write_config();
-
+ }
}
function step4_stepsubmitphpaction() {
- global $config;
-
- if ( $_POST['enable'] ) {
- if(!$_POST['bandwidth']) {
- $message="You need to specify a value for bandwidth!";
- header("Location: wizard.php?xml=traffic_shaper_wizard.xml&stepid=3&message={$message}");
- exit;
- }
- if(!is_numeric($_POST['bandwidth'])) {
- $message="The posted value is not a valid bandwidth.";
- header("Location: wizard.php?xml=traffic_shaper_wizard.xml&stepid=3&message={$message}");
- exit;
- }
+ global $config;
+ global $stepid, $savemsg;
- if ($_POST['bandwidthspeed'] <> "%") {
- $message = gettext("Only percentage bandwidth specification is allowed.");
- header("Location: wizard.php?xml=traffic_shaper_wizard.xml&stepid=3&message={$message}");
- exit;
- }
- $bw = $_POST['bandwidth'];
- if($bw > 15 && $bw < 2) {
- $message="Values should be between 2% and 15%!";
- header("Location: wizard.php?xml=traffic_shaper_wizard.xml&stepid=3&message={$message}");
- exit;
- }
+ if ( $_POST['enable'] ) {
+ if(!$_POST['bandwidth']) {
+ $savemsg="You need to specify a value for bandwidth!";
+ $stepid--;
+ return;
+ }
+ if(!is_numeric($_POST['bandwidth'])) {
+ $savemsg="The posted value is not a valid bandwidth.";
+ $stepid--;
+ return;
+ }
- 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=3&message={$message}");
- }
- }
+ if ($_POST['bandwidthspeed'] <> "%") {
+ $savemsg = gettext("Only percentage bandwidth specification is allowed.");
+ $stepid--;
+ return;
+ }
+ $bw = $_POST['bandwidth'];
+ if($bw > 15 && $bw < 2) {
+ $savemsg="Values should be between 2% and 15%!";
+ $stepid--;
+ return;
}
+ if($_POST['address'] <> "" && !is_ipaddroralias($_POST['address'])) {
+ /* item is not an ip or alias. error out */
+ $savemsg=gettext("Address must be a valid IP address or Firewall Alias. Please correct this value to continue.");
+ $stepid--;
+ }
+ }
}
function step5_stepsubmitphpaction() {
+ global $stepid, $savemsg;
if ( $_POST['enable'] ) {
if (isset($_POST['bandwidth']) && $_POST['bandwidth'] <> "") {
if(!is_numeric($_POST['bandwidth'])) {
- $message="Posted value is not a valid bandwidth.";
- header("Location: wizard.php?xml=traffic_shaper_wizard.xml&stepid=4&message={$message}");
-
+ $savemsg="Posted value is not a valid bandwidth.";
+ $stepid--;
+ return;
}
if ($_POST['bandwidthspeed'] <> "%") {
- $message = gettext("Only percentage bandwidth specification is allowed.");
- header("Location: wizard.php?xml=traffic_shaper_wizard.xml&stepid=4&message={$message}");
- exit;
+ $savemsg = gettext("Only percentage bandwidth specification is allowed.");
+ $stepid--;
+ return;
+ }
+ $bw = $_POST['bandwidth'];
+ if($bw > 15 && $bw < 2) {
+ $savemsg="Values should be between 2% and 15%!";
+ $stepid--;
+ return;
}
- $bw = $_POST['bandwidth'];
- if($bw > 15 && $bw < 2) {
- $message="Values should be between 2% and 15%!";
- header("Location: wizard.php?xml=traffic_shaper_wizard.xml&stepid=3&message={$message}");
- exit;
- }
-
}
}
}
function step8_stepsubmitphpaction() {
- global $g, $config;
+ global $g, $config;
- /* save the new configuration */
- apply_all_choosen_items();
+ /* save the new configuration */
+ apply_all_choosen_items();
- /* reset rrd queues */
- system("rm -f /var/db/rrd/*queuedrops.rrd");
- system("rm -f /var/db/rrd/*queues.rrd");
- enable_rrd_graphing();
+ /* reset rrd queues */
+ system("rm -f /var/db/rrd/*queuedrops.rrd");
+ system("rm -f /var/db/rrd/*queues.rrd");
+ enable_rrd_graphing();
- /* apply the new configuration to the system */
- filter_configure();
+ /* apply the new configuration to the system */
+ filter_configure();
- /* And we're no longer dirty! */
- clear_subsystem_dirty('shaper');
+ /* And we're no longer dirty! */
+ clear_subsystem_dirty('shaper');
- update_filter_reload_status("Initializing");
+ update_filter_reload_status("Initializing");
- /* Head over and check out the groovy queue stats */
- header("Location: status_filter_reload.php");
+ /* Head over and check out the groovy queue stats */
+ header("Location: status_filter_reload.php");
}
function step9_stepsubmitphpaction() {
global $g, $config;
@@ -562,322 +565,9 @@ function step9_stepsubmitphpaction() {
}
function apply_all_choosen_items() {
- global $config, $g, $altq_list_queues;
-
-$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');
-
-$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');
-
-$gamesplist['deltaforce'] = array();
- /* delta force */
- $gamesplist['deltaforce'][] = array('Delta1', 'udp', '17478', '17488', 'both');
-
-$gamesplist['quakeiii'] = array();
- /* 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');
-
-$gamesplist['callofduty'] = array();
- $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');
-
-$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');
-
-$gamesplist['unrealtournament'] = array();
- /* 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');
-
-$gamesplist['empireearth'] = array();
- /* 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');
-
-$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');
-
-$gamesplist['farcry'] = array();
- /* 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');
-
-$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');
-
-$gamesplist['wolfet'] = array();
- /* 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');
-
-$gamesplist['battlenet'] = array();
- /* Blizzard Publishing games */
- $gamesplist['battlenet'][] = array('Battle.NET', 'tcp', '6112', '6119', 'both');
- $gamesplist['battlenet'][] = array('Battle.NET-2', 'tcp', '1119', '1119', 'both');
-
-$gamesplist['worldofwarcraft'] = array();
- $gamesplist[] = array('WoW', 'tcp', '3724', '3724', 'both');
-
-$gamesplist['battlenet'] = array();
- /* Add battle.net only if WoW is selected and battle.net isn't */
- $gamesplist[] = array('Battle.NET', 'tcp', '6112', '6119', 'both');
-
-$gamesplist['gunzonline'] = array();
- /* GunZ Online */
- $gamesplist['gunzonline'][] = array('GunZOnline', 'udp', '7700', '7700', 'both');
-
-$gamesplist['xbox360'] = array();
- /* 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');
-
- /* VoicePulse server */
-$voiplist['VoicePulse'] = array();
- $voiplist['VoicePulse'][] = array('VoicePulse', 'udp', '16384', '16482', 'both');
- $voiplist['VoicePulse'][] = array('VoicePulse', 'udp', '4569', '4569', 'both');
-
- /* Panasonic Hybrid PBX */
-$voiplist['Panasonic'] = array();
- $voiplist['Panasonic'][] = array('Panasonic1', 'udp', '8000', '8063', 'both');
- $voiplist['Panasonic'][] = array('Panasonic2', 'udp', '9300', '9301', 'both');
- $voiplist['Panasonic'][] = array('Panasonic3', 'udp', '2747', '2747', 'both');
-
-
-$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');
-
-
-
-$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['slingbox'] = array();
- $othersplist['slingbox'][] = array('Slingbox1', 'tcp', '5001', '5001', 'both');
- $othersplist['slingbox'][] = array('Slingbox2', 'udp', '5001', '5001', 'both');
+ global $config, $g, $altq_list_queues, $gamesplist;
+
+ require_once("wizardapp.inc");
/*
* Wipe previous config.
@@ -997,7 +687,7 @@ $othersplist = array();
$remainbw = round($remainbw / $upbw * 100, 2);
if ($remainbw > 0 && $remainbw > 30) {
- $message=gettext("Custom Bandwidths are greater than 30%. Please lower them for the wizard to continue.");
+ $savemsg=gettext("Custom Bandwidths are greater than 30%. Please lower them for the wizard to continue.");
header("Location: wizard.php?xml=traffic_shaper_wizard.xml&stepid=2&message={$message}");
exit;
} else {
@@ -1023,8 +713,6 @@ $othersplist = array();
else if ($sched == "HFSC") {
$lkbw = 0.20 * $remainbw;
$tmpcf['linkshare3'] = "{$lkbw}%";
- $tmpcf['linkshare2'] = 100;
- $tmpcf['linkshare1'] = "0b";
$tmpcf['linkshare'] = "on";
$tmpcf['bandwidth'] = $lkbw;
$tmpcf['bandwidthtype'] = "%";
@@ -1086,8 +774,6 @@ $othersplist = array();
$tmpcf['bandwidthtype'] = $p2pcatchbwunit;
} else if ($sched == "HFSC") {
$tmpcf['linkshare'] = "on";
- $tmpcf['linkshare1'] = "{$p2pcatchbw}{$p2pcatchbwunit}";
- $tmpcf['linkshare2'] = 300;
$tmpcf['linkshare3'] = "{$p2pcatchbw}{$p2pcatchbwunit}";
$tmpcf['upperlimit'] = "on";
$tmpcf['upperlimit3'] = "{$p2pcatchbw}{$p2pcatchbwunit}";
@@ -1104,8 +790,6 @@ $othersplist = array();
} else if ($sched == "HFSC") {
$tmpbw = $remainbw * 0.05; /* 5% bandwidth */
$tmpcf['linkshare'] = "on";
- $tmpcf['linkshare1'] = "{$tmpbw}%";
- $tmpcf['linkshare2'] = 300;
$tmpcf['linkshare3'] = "{$tmpbw}%";
$tmpcf['upperlimit'] = "on";
$tmpcf['upperlimit3'] = "{$tmpbw}%";
@@ -1150,9 +834,7 @@ $othersplist = array();
$tmpcf['realtime3'] = "{$voipbw}%";
}
$tmpcf['realtime'] = "on";
- $tmpcf['realtime2'] = "10";
$tmpcf['bandwidth'] = 32;
- $tmpcf['realtime1'] = "0b";
$tmpcf['bandwidthtype'] = "Kb";
}
array_push($tmppath, "qVoIP");
@@ -1182,8 +864,6 @@ $othersplist = array();
} else if ($sched == "HFSC") {
$gamesbw = $remainbw * 0.2; /* 20% bandwidth */
$tmpcf['linkshare'] = "on";
- $tmpcf['linkshare1'] = "0b";
- $tmpcf['linkshare2'] = "50";
$tmpcf['linkshare3'] = "{$gamesbw}%";
$tmpcf['bandwidth'] = "{$gamesbw}";
$tmpcf['bandwidthtype'] = "%";
@@ -1215,8 +895,6 @@ $othersplist = array();
} else if ($sched == "HFSC") {
$tmpcf['linkshare'] = "on";
$otherbw = $remainbw * 0.1; /* 10% bandwidth */
- $tmpcf['linkshare1'] = "0b";
- $tmpcf['linkshare2'] = 200;
$tmpcf['linkshare3'] = "{$otherbw}%";
$tmpcf['bandwidth'] = $otherbw;
$tmpcf['bandwidthtype'] = "%";
@@ -1250,18 +928,15 @@ $othersplist = array();
} else if ($sched == "HFSC") {
if ($penalty) {
$tmpcf['linkshare3'] = "{$penaltybw}{$penaltybwunit}";
- $tmpcf['linkshare1'] = "{$penaltybw}{$penaltybwunit}";
$tmpcf['bandwidth'] = $penaltybw;
$tmpcf['bandwidthtype'] = $penaltybwunit;
} else {
$lsbw = $remainbw * 0.05;
- $tmpcf['linkshare1'] = "{$lsbw}%"; /* 5% bandwidth */
$tmpcf['linkshare3'] = "{$lsbw}%"; /* 5% bandwidth */
$tmpcf['bandwidth'] = $lsbw;
$tmpcf['bandwidthtype'] = "%";
}
$tmpcf['linkshare'] = "on";
- $tmpcf['linkshare2'] = 500;
}
array_push($tmppath, "qOthersLow");
$qtmp =& $altq->add_queue($q, &$tmpcf, &$tmppath, $input_errors);
@@ -1364,7 +1039,7 @@ $othersplist = array();
$remainbw = round($remainbw / $lanbw * 100, 2);
if ($remainbw > 0 && $remainbw > 30) {
- $message=gettext("Custom Bandwidths are greater than 30%. Please lower them for the wizard to continue.");
+ $savemsg=gettext("Custom Bandwidths are greater than 30%. Please lower them for the wizard to continue.");
header("Location: wizard.php?xml=traffic_shaper_wizard.xml&stepid=2&message={$message}");
exit;
} else {
@@ -1386,13 +1061,9 @@ $othersplist = array();
$tmpcf['bandwidthtype'] = "Kb";
}
else if ($sched == "HFSC") {
- $tmpcf['linkshare1'] = $tmpcf['linkshare3'] = $lanbw/1000 ."Kb";
+ $tmpcf['linkshare3'] = $lanbw/1000 ."Kb";
$tmpcf['upperlimit'] = "on";
$tmpcf['upperlimit3'] = $lanbw/1000 ."Kb";
-
-
- $tmpcf['linkshare2'] = 100;
- //$tmpcf['linkshare1'] = "0b";
$tmpcf['linkshare'] = "on";
$tmpcf['bandwidth'] = $lanbw/1000;
$tmpcf['bandwidthtype'] = "Kb";
@@ -1426,8 +1097,6 @@ $othersplist = array();
else if ($sched == "HFSC") {
$lkbw = 0.20 * $remainbw;
$tmpcf['linkshare3'] = "{$lkbw}%";
- $tmpcf['linkshare2'] = 100;
- $tmpcf['linkshare1'] = "0b";
$tmpcf['linkshare'] = "on";
$tmpcf['bandwidth'] = $lkbw;
$tmpcf['bandwidthtype'] = "%";
@@ -1489,8 +1158,6 @@ $othersplist = array();
$tmpcf['bandwidthtype'] = $p2pcatchbwunit;
} else if ($sched == "HFSC") {
$tmpcf['linkshare'] = "on";
- $tmpcf['linkshare1'] = "{$p2pcatchbw}{$p2pcatchbwunit}";
- $tmpcf['linkshare2'] = 300;
$tmpcf['linkshare3'] = "{$p2pcatchbw}{$p2pcatchbwunit}";
$tmpcf['upperlimit'] = "on";
$tmpcf['upperlimit3'] = "{$p2pcatchbw}{$p2pcatchbwunit}";
@@ -1507,8 +1174,6 @@ $othersplist = array();
} else if ($sched == "HFSC") {
$tmpbw = $remainbw * 0.05; /* 5% bandwidth */
$tmpcf['linkshare'] = "on";
- $tmpcf['linkshare1'] = "{$tmpbw}%";
- $tmpcf['linkshare2'] = 300;
$tmpcf['linkshare3'] = "{$tmpbw}%";
$tmpcf['upperlimit'] = "on";
$tmpcf['upperlimit3'] = "{$tmpbw}%";
@@ -1553,9 +1218,7 @@ $othersplist = array();
$tmpcf['realtime3'] = "{$voipbw}%";
}
$tmpcf['realtime'] = "on";
- $tmpcf['realtime2'] = "10";
$tmpcf['bandwidth'] = 32;
- $tmpcf['realtime1'] = "0b";
$tmpcf['bandwidthtype'] = "Kb";
}
array_push($tmppath, "qVoIP");
@@ -1585,8 +1248,6 @@ $othersplist = array();
} else if ($sched == "HFSC") {
$gamesbw = $remainbw * 0.2; /* 20% bandwidth */
$tmpcf['linkshare'] = "on";
- $tmpcf['linkshare1'] = "0b";
- $tmpcf['linkshare2'] = "50";
$tmpcf['linkshare3'] = "{$gamesbw}%";
$tmpcf['bandwidth'] = "{$gamesbw}";
$tmpcf['bandwidthtype'] = "%";
@@ -1618,8 +1279,6 @@ $othersplist = array();
} else if ($sched == "HFSC") {
$tmpcf['linkshare'] = "on";
$otherbw = $remainbw * 0.1; /* 10% bandwidth */
- $tmpcf['linkshare1'] = "0b";
- $tmpcf['linkshare2'] = 200;
$tmpcf['linkshare3'] = "{$otherbw}%";
$tmpcf['bandwidth'] = $otherbw;
$tmpcf['bandwidthtype'] = "%";
@@ -1653,18 +1312,15 @@ $othersplist = array();
} else if ($sched == "HFSC") {
if ($penalty) {
$tmpcf['linkshare3'] = "{$penaltybw}{$penaltybwunit}";
- $tmpcf['linkshare1'] = "{$penaltybw}{$penaltybwunit}";
$tmpcf['bandwidth'] = $penaltybw;
$tmpcf['bandwidthtype'] = $penaltybwunit;
} else {
$lsbw = $remainbw * 0.05;
- $tmpcf['linkshare1'] = "{$lsbw}%"; /* 5% bandwidth */
$tmpcf['linkshare3'] = "{$lsbw}%"; /* 5% bandwidth */
$tmpcf['bandwidth'] = $lsbw;
$tmpcf['bandwidthtype'] = "%";
}
$tmpcf['linkshare'] = "on";
- $tmpcf['linkshare2'] = 500;
}
array_push($tmppath, "qOthersLow");
$qtmp =& $altq->add_queue($q, &$tmpcf, &$tmppath, $input_errors);
diff --git a/usr/local/www/wizards/traffic_shaper_wizard.xml b/usr/local/www/wizards/traffic_shaper_wizard.xml
index 3b802e7..002ed24 100644
--- a/usr/local/www/wizards/traffic_shaper_wizard.xml
+++ b/usr/local/www/wizards/traffic_shaper_wizard.xml
@@ -1,11 +1,12 @@
<?xml version="1.0"?>
<pfsensewizard>
- <copyright>
+ <copyright><![CDATA[
+ /*
traffic_shaper_wizard.xml
part of pfSense (http://www.pfsense.org/)
Copyright (C) 2005 Bill Marquette - bill.marquette@gmail.com.
- Copyright (C) 2008 Ermal Luci
+ Copyright (C) 2008-2010 Ermal Luci
All rights reserved.
Redistribution and use in source and binary forms, with or without
@@ -28,7 +29,7 @@
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>
+ */]]></copyright>
<totalsteps>9</totalsteps>
<step>
<id>1</id>
@@ -146,7 +147,7 @@
<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>
+ <enablefields>address,bandwidth,bandwidthspeed</enablefields>
<bindstofield>ezshaper-&gt;step4-&gt;enable</bindstofield>
</field>
<field>
diff --git a/usr/local/www/wizards/traffic_shaper_wizard_dedicated.inc b/usr/local/www/wizards/traffic_shaper_wizard_dedicated.inc
index f9b2d14..b640c05 100755
--- a/usr/local/www/wizards/traffic_shaper_wizard_dedicated.inc
+++ b/usr/local/www/wizards/traffic_shaper_wizard_dedicated.inc
@@ -1,12 +1,11 @@
<?php
-/* $Id$ */
/*
- traffic_shaper_wizard.inc
+ traffic_shaper_wizard_dedicated.inc
part of pfSense (http://www.pfsense.org/)
Copyright (C) 2006 Bill Marquette - bill.marquette@gmail.com.
Copyright (C) 2006 Scott Ullrich - sullrich@pfsense.com.
- Copyright (C) 2008 Ermal Luçi
+ Copyright (C) 2008-2010 Ermal Luçi
All rights reserved.
Redistribution and use in source and binary forms, with or without
@@ -32,246 +31,255 @@
*/
function step1_submitphpaction() {
-
- if (!isset($_POST['numberofconnections'])) {
- $message=gettext("You need to specify the number of connections.");
- header("Location:wizard.php?xml=traffic_shaper_wizard_dedicated.xml&stepid=0&message={$message}");
- exit;
- }
- if (intval($_POST['numberofconnections']) > 100 || intval($_POST['numberofconnections']) < 1) {
- $message=gettext("The number of connections supported is between 1 and 100.");
- header("Location:wizard.php?xml=traffic_shaper_wizard_dedicated.xml&stepid=0&message={$message}");
- exit;
- }
+ global $stepid, $savemsg;
+
+ if (!isset($_POST['numberofconnections'])) {
+ $savemsg=gettext("You need to specify the number of connections.");
+ $stepid--;
+ return;
+ }
+ if (intval($_POST['numberofconnections']) < 1) {
+ $savemsg=gettext("The number of connections should be greater than 1.");
+ $stepid--;
+ return;
+ }
}
function step2_stepbeforeformdisplay() {
- global $config, $pkg;
-
- $numberofinterfaces = 0;
- $iflist = array();
- $iflisttmp = get_configured_interface_with_descr();
- foreach ($iflisttmp as $if => $ifdesc) {
- if (!is_altq_capable(get_real_interface($if)))
- continue;
- if ($if == "lan")
- continue;
- $numberofinterfaces++;
- $iflist[$if] = $ifdesc;
- }
- $numberofconnections = intval($config['ezshaper']['step1']['numberofconnections']);
- if ($numberofconnections > ($numberofinterfaces/2)) {
- $message=gettext("You have less interfaces than number of connections!");
- header("Location:wizard.php?xml=traffic_shaper_wizard_dedicated.xml&stepid=0&message={$message}");
- exit;
- }
-
- $cfgname = "traffic_shaper_wizard_dedicated.xml";
+ global $config, $pkg;
+ global $stepid, $savemsg;
+
+ $numberofinterfaces = 0;
+ $iflist = array();
+ $iflisttmp = get_configured_interface_with_descr();
+ foreach ($iflisttmp as $if => $ifdesc) {
+ if (!is_altq_capable(get_real_interface($if)))
+ continue;
+ $numberofinterfaces++;
+ $iflist[$if] = $ifdesc;
+ }
+ $numberofconnections = intval($config['ezshaper']['step1']['numberofconnections']);
+ if ($numberofconnections > ($numberofinterfaces/2)) {
+ $savemsg=gettext("You have less interfaces than number of connections!");
+ $stepid--;
+ return;
+ }
- $fields =& $pkg['step'][1]['fields']['field'];
-
- /*
- unset($config['ezshaper']['step2']);
- $config['ezshaper']['step2'] = array();
- write_config();
- */
- $fields = array();
+ $cfgname = "traffic_shaper_wizard_dedicated.xml";
+
+ $fields =& $pkg['step'][1]['fields']['field'];
+
+ /*
+ unset($config['ezshaper']['step2']);
+ $config['ezshaper']['step2'] = array();
+ write_config();
+ */
+ $fields = array();
+
+ for ($i = 0; $i < $numberofconnections; $i++) {
$field = array();
- $field['name'] = "Setup schedulers";
+ $linknum = $i+1;
+ $ifsel = ($i * 2);
+ $field['name'] = "Connection #{$linknum} parameters";
$field['type'] = "listtopic";
$fields[] = $field;
- for ($i = 0; $i < $numberofconnections; $i++) {
- $field = array();
- $field['displayname'] = "Local interface";
- $field['name'] = "local{$i}interface";
- $field['type'] = "select";
-// $field['typehint'] = "Interface of this connection.";
- $field['options']['option'] = array();
- foreach ($iflist as $ifname => $ifdescr) {
- $opts = array();
- $opts['displayname'] = $ifdescr;
- $opts['name'] = $ifname;
- $opts['value'] = $ifname;
- $field['options']['option'][] = $opts;
- }
- $field['combinefieldsbegin'] = "true";
- $field['bindstofield'] = "ezshaper->step2->local{$i}interface";
- $fields[] = $field;
-
- $field = array();
- $field['combinefieldsend'] = "true";
- $field['dontdisplayname'] = "true";
- $field['dontcombinecells'] = "true";
-
- $field['displayname'] = "Download scheduler";
- $field['name'] = "local{$i}downloadscheduler";
- $field['type'] = "select";
- $field['typehint'] = "Queueing discipline to apply on the download of this connection.";
- $field['options']['option'] = array();
- $opts = array();
- $opts['name'] = "HFSC";
- $opts['value'] = "HFSC";
- $field['options']['option'][] = $opts;
- $opts = array();
- $opts['name'] = "CBQ";
- $opts['value'] = "CBQ";
- $field['options']['option'][] = $opts;
- $opts = array();
- $opts['name'] = "PRIQ";
- $opts['value'] = "PRIQ";
- $field['options']['option'][] = $opts;
- $field['bindstofield'] = "ezshaper->step2->local{$i}downloadscheduler";
- $fields[] = $field;
-
- $field = array();
- $field['displayname'] = "WAN Interface";
- $field['name'] = "conn{$i}interface";
- $field['type'] = "select";
- //$field['typehint'] = "Interface of this connection.";
- $field['options']['option'] = array();
- foreach ($iflist as $ifname => $ifdescr) {
- $opts = array();
- $opts['displayname'] = $ifdescr;
- $opts['name'] = $ifname;
- $opts['value'] = $ifname;
- $field['options']['option'][] = $opts;
- }
- $field['bindstofield'] = "ezshaper->step2->conn{$i}interface";
- $field['combinefieldsbegin'] = "true";
- $fields[] = $field;
-
- $field['displayname'] = "Upload scheduler";
- $field['name'] = "conn{$i}uploadscheduler";
- $field['combinefieldsend'] = "true";
- $field['dontdisplayname'] = "true";
- $field['dontcombinecells'] = "true";
- $field['type'] = "select";
- $field['typehint'] = "Queueing discipline to apply on the upload of this connection.";
- $field['options']['option'] = array();
- $opts = array();
- $opts['name'] = "HFSC";
- $opts['value'] = "HFSC";
- $field['options']['option'][] = $opts;
- $opts = array();
- $opts['name'] = "CBQ";
- $opts['value'] = "CBQ";
- $field['options']['option'][] = $opts;
- $opts = array();
- $opts['name'] = "PRIQ";
- $opts['value'] = "PRIQ";
- $field['options']['option'][] = $opts;
- $field['bindstofield'] = "ezshaper->step2->conn{$i}uploadscheduler";
- $fields[] = $field;
-
- $field = array();
- $field['name'] = "conn{$i}upload";
- $field['type'] = "input";
- $field['bindstofield'] = "ezshaper->step2->conn{$i}upload";
- $field['combinefieldsbegin'] = "true";
- $fields[] = $field;
-
- $field = array();
- $field['combinefieldsend'] = "true";
- $field['dontdisplayname'] = "true";
- $field['dontcombinecells'] = "true";
- $field['name'] = "conn{$i}uploadspeed";
- $field['typehint'] = "Upload bandwidth on this connection.";
- $field['type'] = "select";
- $field['options']['option'] = array();
- $opts = array();
- $opts['value'] = "Kb";
- $opts['name'] = "Kbit/s";
- $field['options']['option'][] = $opts;
- $opts = array();
- $opts['value'] = "Mb";
- $opts['name'] = "Mbit/s";
- $field['options']['option'][] = $opts;
- $opts = array();
- $opts['value'] = "Gb";
- $opts['name'] = "Gbit/s";
- $field['options']['option'][] = $opts;
- $field['bindstofield'] = "ezshaper->step2->conn{$i}uploadspeed";
- $fields[] = $field;
-
- $field = array();
- $field['name'] = "conn{$i}download";
- $field['type'] = "input";
- $field['bindstofield'] = "ezshaper->step2->conn{$i}download";
- $field['combinefieldsbegin'] = "true";
- $fields[] = $field;
-
- $field = array();
- $field['combinefieldsend'] = "true";
- $field['dontdisplayname'] = "true";
- $field['dontcombinecells'] = "true";
- $field['name'] = "conn{$i}downloadspeed";
- $field['typehint'] = "Download bandwidth on this connection.";
- $field['type'] = "select";
- $field['options']['option'] = array();
- $opts = array();
- $opts['value'] = "Kb";
- $opts['name'] = "Kbit/s";
- $field['options']['option'][] = $opts;
+ $field = array();
+ $field['displayname'] = "Local interface";
+ $field['name'] = "local{$i}interface";
+ $field['type'] = "select";
+ $field['options']['option'] = array();
+ $ifcnt = 0;
+ foreach ($iflist as $ifname => $ifdescr) {
+ if ($ifcnt == ($ifsel + 1))
+ $field['value'] = $ifname;
$opts = array();
- $opts['value'] = "Mb";
- $opts['name'] = "Mbit/s";
- $field['options']['option'][] = $opts;
+ $opts['displayname'] = $ifdescr;
+ $opts['name'] = $ifname;
+ $opts['value'] = $ifname;
+ $field['options']['option'][] = $opts;
+ $ifcnt++;
+ }
+ $field['combinefieldsbegin'] = "true";
+ $field['bindstofield'] = "ezshaper->step2->local{$i}interface";
+ $fields[] = $field;
+
+ $field = array();
+ $field['combinefieldsend'] = "true";
+ $field['dontdisplayname'] = "true";
+ $field['dontcombinecells'] = "true";
+ $field['name'] = "local{$i}downloadscheduler";
+ $field['type'] = "select";
+ $field['typehint'] = "Queueing discipline to apply on the download of this connection.";
+ $field['options']['option'] = array();
+ $opts = array();
+ $opts['name'] = "HFSC";
+ $opts['value'] = "HFSC";
+ $field['options']['option'][] = $opts;
+ $opts = array();
+ $opts['name'] = "CBQ";
+ $opts['value'] = "CBQ";
+ $field['options']['option'][] = $opts;
+ $opts = array();
+ $opts['name'] = "PRIQ";
+ $opts['value'] = "PRIQ";
+ $field['options']['option'][] = $opts;
+ $field['bindstofield'] = "ezshaper->step2->local{$i}downloadscheduler";
+ $fields[] = $field;
+
+ $field = array();
+ $field['displayname'] = "WAN Interface";
+ $field['name'] = "conn{$i}interface";
+ $field['type'] = "select";
+ $field['options']['option'] = array();
+ $ifcnt = 0;
+ foreach ($iflist as $ifname => $ifdescr) {
+ if ($ifcnt == $ifsel)
+ $field['value'] = $ifname;
$opts = array();
- $opts['value'] = "Gb";
- $opts['name'] = "Gbit/s";
- $field['options']['option'][] = $opts;
- $field['bindstofield'] = "ezshaper->step2->conn{$i}downloadspeed";
- $fields[] = $field;
+ $opts['displayname'] = $ifdescr;
+ $opts['name'] = $ifname;
+ $opts['value'] = $ifname;
+ $field['options']['option'][] = $opts;
+ $ifcnt++;
}
+ $field['bindstofield'] = "ezshaper->step2->conn{$i}interface";
+ $field['combinefieldsbegin'] = "true";
+ $fields[] = $field;
+
+ $field = array();
+ $field['name'] = "conn{$i}uploadscheduler";
+ $field['combinefieldsend'] = "true";
+ $field['dontdisplayname'] = "true";
+ $field['dontcombinecells'] = "true";
+ $field['type'] = "select";
+ $field['typehint'] = "Queueing discipline to apply on the upload of this connection.";
+ $field['options']['option'] = array();
+ $opts = array();
+ $opts['name'] = "HFSC";
+ $opts['value'] = "HFSC";
+ $field['options']['option'][] = $opts;
+ $opts = array();
+ $opts['name'] = "CBQ";
+ $opts['value'] = "CBQ";
+ $field['options']['option'][] = $opts;
+ $opts = array();
+ $opts['name'] = "PRIQ";
+ $opts['value'] = "PRIQ";
+ $field['options']['option'][] = $opts;
+ $field['bindstofield'] = "ezshaper->step2->conn{$i}uploadscheduler";
+ $fields[] = $field;
+
+ $field = array();
+ $field['displayname'] = "Upload";
+ $field['name'] = "conn{$i}upload";
+ $field['type'] = "input";
+ $field['bindstofield'] = "ezshaper->step2->conn{$i}upload";
+ $field['combinefieldsbegin'] = "true";
+ $fields[] = $field;
+
$field = array();
- $field['name'] = "Next";
- $field['type'] = "submit";
+ $field['combinefieldsend'] = "true";
+ $field['dontdisplayname'] = "true";
+ $field['dontcombinecells'] = "true";
+ $field['name'] = "conn{$i}uploadspeed";
+ $field['typehint'] = "Upload bandwidth on this connection.";
+ $field['type'] = "select";
+ $field['options']['option'] = array();
+ $opts = array();
+ $opts['value'] = "Kb";
+ $opts['name'] = "Kbit/s";
+ $field['options']['option'][] = $opts;
+ $opts = array();
+ $opts['value'] = "Mb";
+ $opts['name'] = "Mbit/s";
+ $field['options']['option'][] = $opts;
+ $opts = array();
+ $opts['value'] = "Gb";
+ $opts['name'] = "Gbit/s";
+ $field['options']['option'][] = $opts;
+ $field['bindstofield'] = "ezshaper->step2->conn{$i}uploadspeed";
$fields[] = $field;
+ $field = array();
+ $field['displayname'] = "Download";
+ $field['name'] = "conn{$i}download";
+ $field['type'] = "input";
+ $field['bindstofield'] = "ezshaper->step2->conn{$i}download";
+ $field['combinefieldsbegin'] = "true";
+ $fields[] = $field;
+
+ $field = array();
+ $field['combinefieldsend'] = "true";
+ $field['dontdisplayname'] = "true";
+ $field['dontcombinecells'] = "true";
+ $field['name'] = "conn{$i}downloadspeed";
+ $field['typehint'] = "Download bandwidth on this connection.";
+ $field['type'] = "select";
+ $field['options']['option'] = array();
+ $opts = array();
+ $opts['value'] = "Kb";
+ $opts['name'] = "Kbit/s";
+ $field['options']['option'][] = $opts;
+ $opts = array();
+ $opts['value'] = "Mb";
+ $opts['name'] = "Mbit/s";
+ $field['options']['option'][] = $opts;
+ $opts = array();
+ $opts['value'] = "Gb";
+ $opts['name'] = "Gbit/s";
+ $field['options']['option'][] = $opts;
+ $field['bindstofield'] = "ezshaper->step2->conn{$i}downloadspeed";
+ $fields[] = $field;
+ }
+ $field = array();
+ $field['name'] = "Next";
+ $field['type'] = "submit";
+ $fields[] = $field;
}
function step2_stepsubmitphpaction() {
global $config;
+ global $stepid, $savemsg;
$sumdownloads = 0;
/* Input Validation */
$steps = intval($config['ezshaper']['step1']['numberofconnections']);
for ($i = 0; $i < $steps; $i++) {
- for ($j = $i + 1; $j < $steps; $j++) {
- if ($_POST["conn{$i}interface"] == $_POST["conn{$j}interface"] || $_POST["conn{$i}interface"] == $_POST["local{$j}interface"]) {
- $message=gettext("You cannot select the same interface for connections {$i} and {$j}.");
- header("Location: wizard.php?xml=traffic_shaper_wizard_dedicated.xml&stepid=1&message={$message}");
- exit;
- }
- if (!is_numeric($_POST["conn{$i}upload"])) {
- $message = gettext("Upload bandwidth of connection {$i} is not valid.");
- header("Location: wizard.php?xml=traffic_shaper_wizard_dedicated.xml&stepid=1&message={$message}");
- exit;
- }
- if (!is_numeric($_POST["conn{$i}download"])) {
- $message = gettext("Download bandwidth of connection {$i} is not valid.");
- header("Location: wizard.php?xml=traffic_shaper_wizard_dedicated.xml&stepid=1&message={$message}");
- exit;
- }
- $upbw = $_POST["conn{$i}upload"];
- $downbw = $_POST["conn{$i}download"];
- if ($upbw == 0 || $downbw = 0) {
- $message = gettext("You cannot specify 0 bandwidth!");
- header("Location: wizard.php?xml=traffic_shaper_wizard_dedicated.xml&stepid=1&message={$message}");
- exit;
- }
- if (intval($upbw) < 128 && $_POST["conn{$i}uploadspeed"] == "Kb" && trim($_POST["conn{$i}scheduler"]) == "CBQ") {
- $message=gettext("Uploads smaller than 128Kbit/s is not supported for connection {$i} on CBQ scheduler.");
- header("Location: wizard.php?xml=traffic_shaper_wizard_dedicated.xml&stepid=1&message={$message}");
- exit;
- }
- if ($_POST["local{$i}interface"] == $_POST["conn{$j}interface"] || $_POST["local{$i}interface"] == $_POST["local{$j}interface"]) {
- $message=gettext("You cannot select the same interface for local and outside.");
- header("Location: wizard.php?xml=traffic_shaper_wizard_dedicated.xml&stepid=1&message={$message}");
- exit;
- }
+ for ($j = $i + 1; $j < $steps; $j++) {
+ if ($_POST["conn{$i}interface"] == $_POST["conn{$j}interface"] || $_POST["conn{$i}interface"] == $_POST["local{$j}interface"]) {
+ $savemsg=gettext("You cannot select the same interface for connections {$i} and {$j}.");
+ $stepid--;
+ return;
+ }
+ if (!is_numeric($_POST["conn{$i}upload"])) {
+ $savemsg = gettext("Upload bandwidth of connection {$i} is not valid.");
+ $stepid--;
+ return;
+ }
+ if (!is_numeric($_POST["conn{$i}download"])) {
+ $savemsg = gettext("Download bandwidth of connection {$i} is not valid.");
+ $stepid--;
+ return;
+ }
+ $upbw = $_POST["conn{$i}upload"];
+ $downbw = $_POST["conn{$i}download"];
+ if ($upbw < 1 || $downbw < 1) {
+ $savemsg = gettext("You cannot specify bandwidth smaller than 1!");
+ $stepid--;
+ return;
+ }
+ if (intval($upbw) < 128 && $_POST["conn{$i}uploadspeed"] == "Kb" && trim($_POST["conn{$i}scheduler"]) == "CBQ") {
+ $savemsg=gettext("Uploads smaller than 128Kbit/s is not supported for connection {$i} on CBQ scheduler.");
+ $stepid--;
+ return;
}
+ if ($_POST["local{$i}interface"] == $_POST["conn{$j}interface"] || $_POST["local{$i}interface"] == $_POST["local{$j}interface"]) {
+ $savemsg=gettext("You cannot select the same interface for local and outside.");
+ $stepid--;
+ return;
+ }
+ }
}
/* This is necessary since the wizard expects pecnefined fields. */
@@ -287,151 +295,167 @@ function step2_stepsubmitphpaction() {
$config['ezshaper']['step2']["conn{$i}download"] = $_POST["conn{$i}download"];
$config['ezshaper']['step2']["conn{$i}downloadspeed"] = $_POST["conn{$i}downloadspeed"];
$config['ezshaper']['step2']["conn${i}interface"] = $_POST["conn{$i}interface"];
- }
-
+ }
}
function step3_stepbeforeformdisplay() {
global $config, $pkg;
+ global $stepid, $savemsg;
+
+ $cfgname = "traffic_shaper_wizard_dedicated.xml";
+
+ $numberofconnections = intval($config['ezshaper']['step1']['numberofconnections']);
+
+ $fields =& $pkg['step'][1]['fields']['field'];
+
+ $voipfields =& $pkg['step'][2]['fields']['field'];
+
+ $voipfields = array();
+ $enablefields = array();
+
+ $field = array();
+ $field['name'] = "Enable";
+ $field['type'] = "checkbox";
+ $field['typehint'] = "Prioritize Voice over IP traffic.";
+ $field['bindstofield'] = "ezshaper->step3->enable";
+ $field['descritpion'] = "This will raise the priority of VOIP traffic above all other traffic.";
+ $voipfields[] = $field;
+
+ $field = array();
+ $field['name'] = "Next";
+ $field['type'] = "submit";
+ $voipfields[] = $field;
+
+ $field = array();
+ $field['name'] = "VOIP specific settings";
+ $field['type'] = "listtopic";
+ $voipfields[] = $field;
+
+ $field = array();
+ $field['name'] = "Provider";
+ $enablefields[] = "Provider";
+ $field['type'] = "select";
+ $field['description'] = "Choose Generic if your provider isn't listed.";
+ $field['options']['option'] = array();
+ $opts = array();
+ $opts['name'] = "Generic (lowdelay)";
+ $opts['value'] = "Generic";
+ $field['options']['option'][] = $opts;
+ $opts = array();
+ $opts['name'] = "VoicePulse";
+ $opts['value'] = "VoicePulse";
+ $field['options']['option'][] = $opts;
+ $opts = array();
+ $opts['name'] = "Asterisk/Vonage";
+ $opts['value'] = "Asterisk";
+ $field['options']['option'][] = $opts;
+ $opts = array();
+ $opts['name'] = "PanasonicTDA";
+ $opts['value'] = "Panasonic";
+ $field['options']['option'][] = $opts;
+ $field['bindstofield'] = "ezshaper->step3->provider";
+ $voipfields[] = $field;
+
+ $field = array();
+ $field['name'] = "Address";
+ $enablefields[] = "Address";
+ $field['type'] = "inputalias";
+ $field['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.";
+ $field['message'] = "IP Address field is non-blank and doesn't look like an IP address.";
+ $field['bindstofield'] = "ezshaper->step3->address";
+ $voipfields[] = $field;
+
+ for ($i = 0; $i < $numberofconnections; $i++) {
+ $connum = $i + 1;
+ $field = array();
+ $field['name'] = "Connection #{$connum} parameters";
+ $field['type'] = "listtopic";
+ $voipfields[] = $field;
+
+ $field = array();
+ $field['displayname'] = "Upload";
+ $field['name'] = "conn{$i}upload";
+ $enablefields[] = "conn{$i}upload";
+ $field['type'] = "input";
+ $field['bindstofield'] = "ezshaper->step3->conn{$i}upload";
+ $field['combinefieldsbegin'] = "true";
+ $voipfields[] = $field;
- $cfgname = "traffic_shaper_wizard_dedicated.xml";
+ $field = array();
+ $field['combinefieldsend'] = "true";
+ $field['dontdisplayname'] = "true";
+ $field['dontcombinecells'] = "true";
+ $field['name'] = "conn{$i}uploadspeed";
+ $enablefields[] = "conn{$i}uploadspeed";
+ $field['typehint'] = "Upload bandwidth guarantee for VOIP phone(s) on connection {$i}.";
+ $field['type'] = "select";
+ $field['options']['option'] = array();
+ $opts = array();
+ $opts['value'] = "Kb";
+ $opts['name'] = "Kbit/s";
+ $field['options']['option'][] = $opts;
+ $opts = array();
+ $opts['value'] = "Mb";
+ $opts['name'] = "Mbit/s";
+ $field['options']['option'][] = $opts;
+ $opts = array();
+ $opts['value'] = "Gb";
+ $opts['name'] = "Gbit/s";
+ $field['options']['option'][] = $opts;
+ $field['bindstofield'] = "ezshaper->step3->conn{$i}uploadspeed";
+ $voipfields[] = $field;
- $numberofconnections = intval($config['ezshaper']['step1']['numberofconnections']);
+ $field = array();
+ $field['displayname'] = "Download";
+ $field['name'] = "local{$i}download";
+ $enablefields[] = "local{$i}download";
+ $field['type'] = "input";
+ $field['bindstofield'] = "ezshaper->step3->local{$i}download";
+ $field['combinefieldsbegin'] = "true";
+ $voipfields[] = $field;
- $fields =& $pkg['step'][1]['fields']['field'];
-
- $voipfields =& $pkg['step'][2]['fields']['field'];
-
- $voipfields = array();
-
- $field = array();
- $field['name'] = "enable";
- $field['type'] = "checkbox";
- $field['typehint'] = "Prioritize Voice over IP traffic.";
- $field['bindstofield'] = "ezshaper->step3->enable";
- $field['descritpion'] = "This will raise the priority of VOIP traffic above all other traffic.";
- $voipfields[] = $field;
-
- $field = array();
- $field['name'] = "Next";
- $field['type'] = "submit";
- $voipfields[] = $field;
-
- $field = array();
- $field['name'] = "VOIP specific settings";
- $field['type'] = "listtopic";
- $voipfields[] = $field;
-
- $field['name'] = "Provider";
- $field['type'] = "select";
- $field['description'] = "Choose Generic if your provider isn't listed.";
- $field['options']['option'] = array();
- $opts = array();
- $opts['name'] = "Generic (lowdelay)";
- $opts['value'] = "Generic";
- $field['options']['option'][] = $opts;
- $opts = array();
- $opts['name'] = "VoicePulse";
- $opts['value'] = "VoicePulse";
- $field['options']['option'][] = $opts;
- $opts = array();
- $opts['name'] = "Asterisk/Vonage";
- $opts['value'] = "Asterisk";
- $field['options']['option'][] = $opts;
- $opts = array();
- $opts['name'] = "PanasonicTDA";
- $opts['value'] = "Panasonic";
- $field['options']['option'][] = $opts;
- $field['bindstofield'] = "ezshaper->step3->provider";
- $voipfields[] = $field;
-
- $field = array();
- $field['name'] = "Address";
- $field['type'] = "inputalias";
- $field['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.";
- $field['message'] = "IP Address field is non-blank and doesn't look like an IP address.";
- $field['bindstofield'] = "ezshaper->step3->address";
- $voipfields[] = $field;
-
- for ($i = 0; $i < $numberofconnections; $i++) {
- $field = array();
- $field['name'] = "conn{$i}upload";
- $field['type'] = "input";
- $field['bindstofield'] = "ezshaper->step3->conn{$i}upload";
- $field['combinefieldsbegin'] = "true";
- $voipfields[] = $field;
-
- $field = array();
- $field['combinefieldsend'] = "true";
- $field['dontdisplayname'] = "true";
- $field['dontcombinecells'] = "true";
- $field['name'] = "conn{$i}uploadspeed";
- $field['typehint'] = "Upload bandwidth guarantee for VOIP phone(s) on connection {$i}.";
- $field['type'] = "select";
- $field['options']['option'] = array();
- $opts = array();
- $opts['value'] = "Kb";
- $opts['name'] = "Kbit/s";
- $field['options']['option'][] = $opts;
- $opts = array();
- $opts['value'] = "Mb";
- $opts['name'] = "Mbit/s";
- $field['options']['option'][] = $opts;
- $opts = array();
- $opts['value'] = "Gb";
- $opts['name'] = "Gbit/s";
- $field['options']['option'][] = $opts;
- $field['bindstofield'] = "ezshaper->step3->conn{$i}uploadspeed";
- $voipfields[] = $field;
-
- $field = array();
- $field['name'] = "local{$i}download";
- $field['type'] = "input";
- $field['bindstofield'] = "ezshaper->step3->local{$i}download";
- $field['combinefieldsbegin'] = "true";
- $voipfields[] = $field;
-
- $field = array();
- $field['combinefieldsend'] = "true";
- $field['dontdisplayname'] = "true";
- $field['dontcombinecells'] = "true";
- $field['name'] = "local{$i}downloadspeed";
- $field['typehint'] = "Download bandwidth guarantee for VOIP phone(s) on connections.";
- $field['type'] = "select";
- $field['options']['option'] = array();
- $opts = array();
- $opts['value'] = "Kb";
- $opts['name'] = "Kbit/s";
- $field['options']['option'][] = $opts;
- $opts = array();
- $opts['value'] = "Mb";
- $opts['name'] = "Mbit/s";
- $field['options']['option'][] = $opts;
- $opts = array();
- $opts['value'] = "Gb";
- $opts['name'] = "Gbit/s";
- $field['options']['option'][] = $opts;
- $field['bindstofield'] = "ezshaper->step3->local{$i}downloadspeed";
- $voipfields[] = $field;
- }
+ $field = array();
+ $field['combinefieldsend'] = "true";
+ $field['dontdisplayname'] = "true";
+ $field['dontcombinecells'] = "true";
+ $field['name'] = "local{$i}downloadspeed";
+ $enablefields[] = "local{$i}downloadspeed";
+ $field['typehint'] = "Download bandwidth guarantee for VOIP phone(s) on connections.";
+ $field['type'] = "select";
+ $field['options']['option'] = array();
+ $opts = array();
+ $opts['value'] = "Kb";
+ $opts['name'] = "Kbit/s";
+ $field['options']['option'][] = $opts;
+ $opts = array();
+ $opts['value'] = "Mb";
+ $opts['name'] = "Mbit/s";
+ $field['options']['option'][] = $opts;
+ $opts = array();
+ $opts['value'] = "Gb";
+ $opts['name'] = "Gbit/s";
+ $field['options']['option'][] = $opts;
+ $field['bindstofield'] = "ezshaper->step3->local{$i}downloadspeed";
+ $voipfields[] = $field;
+ }
- $field = array();
- $field['name'] = "Next";
- $field['type'] = "submit";
+ $field = array();
+ $field['name'] = "Next";
+ $field['type'] = "submit";
$voipfields[] = $field;
+ $voipfields[0]['enablefields'] = implode(",", $enablefields);
}
function step3_stepsubmitphpaction() {
global $config;
+ global $stepid, $savemsg;
if($_POST['address']) {
- if(!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_dedicated.xml&stepid=2&message={$message}");
- exit;
- }
+ if(!is_ipaddroralias($_POST['address'])) {
+ /* item is not an ip or alias. error out */
+ $savemsg=gettext("Address must be a valid IP address or Firewall Alias. Please correct this value to continue.");
+ $stepid--;
+ return;
}
}
@@ -439,134 +463,128 @@ function step3_stepsubmitphpaction() {
for ($i = 0; $i < $steps; $i++) {
if ($_POST["conn{$i}upload"]) {
if (!is_numeric($_POST["conn{$i}upload"])) {
- $message = gettext("Upload bandwidth of connection {$i} is not valid.");
- header("Location: wizard.php?xml=traffic_shaper_wizard_dedicated.xml&stepid=2&message={$message}");
- exit;
- }
+ $savemsg = gettext("Upload bandwidth of connection {$i} is not valid.");
+ $stepid--;
+ return;
+ }
$factor = wizard_get_bandwidthtype_scale($config['ezshaper']['step2']["conn{$i}uploadspeed"]);
$ifbw = $factor * floatval($config['ezshaper']['step2']["conn{$i}upload"]);
$factor = wizard_get_bandwidthtype_scale($_POST["conn{$i}uploadspeed"]);
$input_bw = $factor * floatval($_POST["conn{$i}upload"]);
if ((0.8 * $ifbw) < $input_bw) {
- $message=gettext("You cannot set the VoIP upload bandwidth on connection {$i} higher than 80% of the connection.");
- header("Location: wizard.php?xml=traffic_shaper_wizard_dedicated.xml&stepid=2&message={$message}");
- exit;
+ $savemsg=gettext("You cannot set the VoIP upload bandwidth on connection {$i} higher than 80% of the connection.");
+ $stepid--;
+ return;
}
}
if ($_POST["local{$i}download"]) {
if (!is_numeric($_POST["local{$i}download"])) {
- $message = gettext("Download bandwidth of connection {$i} is not valid.");
- header("Location: wizard.php?xml=traffic_shaper_wizard_dedicated.xml&stepid=2&message={$message}");
- exit;
- }
+ $savemsg = gettext("Download bandwidth of connection {$i} is not valid.");
+ $stepid--;
+ return;
+ }
$factor = wizard_get_bandwidthtype_scale($config['ezshaper']['step2']["conn{$i}downloadspeed"]);
$ifbw = $factor * floatval($config['ezshaper']['step2']["conn{$i}download"]);
$factor = wizard_get_bandwidthtype_scale($_POST["local{$i}downloadspeed"]);
$input_bw = $factor * floatval($_POST["local{$i}download"]);
if ((0.8 * $ifbw) < $input_bw) {
- $message=gettext("You cannot set the VoIP download bandwidth on connection {$i} higher than 80% of the connection.");
- header("Location: wizard.php?xml=traffic_shaper_wizard_dedicated.xml&stepid=2&message={$message}");
- exit;
+ $savemsg=gettext("You cannot set the VoIP download bandwidth on connection {$i} higher than 80% of the connection.");
+ $stepid--;
+ return;
}
}
}
-
for ($i = 0; $i < $steps; $i++) {
$config['ezshaper']['step3']["local{$i}download"] = $_POST["local{$i}download"];
$config['ezshaper']['step3']["local{$i}downloadspeed"] = $_POST["local{$i}downloadspeed"];
$config['ezshaper']['step3']["conn{$i}upload"] = $_POST["conn{$i}upload"];
$config['ezshaper']['step3']["conn{$i}uploadspeed"] = $_POST["conn{$i}uploadspeed"];
- }
-
- /* Not needed, called by wizard.php */
- //write_config();
-
+ }
}
function step4_stepsubmitphpaction() {
- global $config;
-
- if ( $_POST['enable'] ) {
- if(!$_POST['bandwidth']) {
- $message="You need to specify a value for bandwidth!";
- header("Location: wizard.php?xml=traffic_shaper_wizard_dedicated.xml&stepid=3&message={$message}");
- exit;
- }
- if(!is_numeric($_POST['bandwidth'])) {
- $message="The posted value is not a valid bandwidth.";
- header("Location: wizard.php?xml=traffic_shaper_wizard_dedicated.xml&stepid=3&message={$message}");
- exit;
- }
-
- if ($_POST['bandwidthspeed'] <> "%") {
- $message = gettext("Only percentage bandwidth specification is allowed.");
- header("Location: wizard.php?xml=traffic_shaper_wizard_dedicated.xml&stepid=3&message={$message}");
- exit;
- }
- $bw = wizard_get_bw($_POST['bandwidth']);
- if($bw > 15 && $bw < 2) {
- $message="Values should be between 2% and 15%!";
- header("Location: wizard.php?xml=traffic_shaper_wizard_dedicated.xml&stepid=3&message={$message}");
- exit;
- }
+ global $config;
+ global $stepid, $savemsg;
- 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_dedicated.xml&stepid=3&message={$message}");
- }
- }
+ if ( $_POST['enable'] ) {
+ if(!$_POST['bandwidth']) {
+ $savemsg="You need to specify a value for bandwidth!";
+ $stepid--;
+ return;
+ }
+ if(!is_numeric($_POST['bandwidth'])) {
+ $savemsg="The posted value is not a valid bandwidth.";
+ $stepid--;
+ return;
}
+ if ($_POST['bandwidthspeed'] <> "%") {
+ $savemsg = gettext("Only percentage bandwidth specification is allowed.");
+ $stepid--;
+ return;
+ }
+ $bw = wizard_get_bw($_POST['bandwidth']);
+ if($bw > 15 && $bw < 2) {
+ $savemsg="Values should be between 2% and 15%!";
+ $stepid--;
+ return;
+ }
+ if($_POST['address'] <> "" && !is_ipaddroralias($_POST['address'])) {
+ /* item is not an ip or alias. error out */
+ $savemsg=gettext("Address must be a valid IP address or Firewall Alias. Please correct this value to continue.");
+ $stepid--;
+ }
+ }
}
function step5_stepsubmitphpaction() {
+ global $stepid, $savemsg;
+
if ( $_POST['enable'] ) {
if (isset($_POST['bandwidth']) && $_POST['bandwidth'] <> "") {
if(!is_numeric($_POST['bandwidth'])) {
- $message="Posted value is not a valid bandwidth.";
- header("Location: wizard.php?xml=traffic_shaper_wizard_dedicated.xml&stepid=4&message={$message}");
-
+ $savemsg="Posted value is not a valid bandwidth.";
+ $stepid--;
+ return;
}
if ($_POST['bandwidthspeed'] <> "%") {
- $message = gettext("Only percentage bandwidth specification is allowed.");
- header("Location: wizard.php?xml=traffic_shaper_wizard_dedicated.xml&stepid=4&message={$message}");
- exit;
+ $savemsg = gettext("Only percentage bandwidth specification is allowed.");
+ $stepid--;
+ return;
}
$bw = wizard_get_bw($_POST['bandwidth']);
if($bw > 15 && $bw < 2) {
- $message="Values should be between 2% and 15%!";
- header("Location: wizard.php?xml=traffic_shaper_wizard_dedicated.xml&stepid=3&message={$message}");
- exit;
+ $savemsg="Values should be between 2% and 15%!";
+ $stepid--;
+ return;
}
}
}
}
function step8_stepsubmitphpaction() {
- global $g, $config;
+ global $g, $config;
- /* save the new configuration */
- apply_all_choosen_items();
+ /* save the new configuration */
+ apply_all_choosen_items();
- /* reset rrd queues */
- system("rm -f /var/db/rrd/*queuedrops.rrd");
- system("rm -f /var/db/rrd/*queues.rrd");
- enable_rrd_graphing();
+ /* reset rrd queues */
+ system("rm -f /var/db/rrd/*queuedrops.rrd");
+ system("rm -f /var/db/rrd/*queues.rrd");
+ enable_rrd_graphing();
- /* apply the new configuration to the system */
- filter_configure();
+ /* apply the new configuration to the system */
+ filter_configure();
- /* And we're no longer dirty! */
- clear_subsystem_dirty('shaper');
+ /* And we're no longer dirty! */
+ clear_subsystem_dirty('shaper');
- update_filter_reload_status("Initializing");
+ update_filter_reload_status("Initializing");
- /* Head over and check out the groovy queue stats */
- header("Location: status_filter_reload.php");
+ /* Head over and check out the groovy queue stats */
+ header("Location: status_filter_reload.php");
}
function step9_stepsubmitphpaction() {
@@ -575,322 +593,9 @@ function step9_stepsubmitphpaction() {
}
function apply_all_choosen_items() {
- global $config, $g, $altq_list_queues;
-
-$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');
-
-$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');
-
-$gamesplist['deltaforce'] = array();
- /* delta force */
- $gamesplist['deltaforce'][] = array('Delta1', 'udp', '17478', '17488', 'both');
-
-$gamesplist['quakeiii'] = array();
- /* 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');
-
-$gamesplist['callofduty'] = array();
- $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');
-
-$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');
-
-$gamesplist['unrealtournament'] = array();
- /* 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');
-
-$gamesplist['empireearth'] = array();
- /* 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');
-
-$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');
-
-$gamesplist['farcry'] = array();
- /* 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');
-
-$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');
-
-$gamesplist['wolfet'] = array();
- /* 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');
-
-$gamesplist['battlenet'] = array();
- /* Blizzard Publishing games */
- $gamesplist['battlenet'][] = array('Battle.NET', 'tcp', '6112', '6119', 'both');
- $gamesplist['battlenet'][] = array('Battle.NET-2', 'tcp', '1119', '1119', 'both');
-
-$gamesplist['worldofwarcraft'] = array();
- $gamesplist[] = array('WoW', 'tcp', '3724', '3724', 'both');
-
-$gamesplist['battlenet'] = array();
- /* Add battle.net only if WoW is selected and battle.net isn't */
- $gamesplist[] = array('Battle.NET', 'tcp', '6112', '6119', 'both');
-
-$gamesplist['gunzonline'] = array();
- /* GunZ Online */
- $gamesplist['gunzonline'][] = array('GunZOnline', 'udp', '7700', '7700', 'both');
-
-$gamesplist['xbox360'] = array();
- /* 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');
-
- /* VoicePulse server */
-$voiplist['VoicePulse'] = array();
- $voiplist['VoicePulse'][] = array('VoicePulse', 'udp', '16384', '16482', 'both');
- $voiplist['VoicePulse'][] = array('VoicePulse', 'udp', '4569', '4569', 'both');
-
- /* Panasonic Hybrid PBX */
-$voiplist['Panasonic'] = array();
- $voiplist['Panasonic'][] = array('Panasonic1', 'udp', '8000', '8063', 'both');
- $voiplist['Panasonic'][] = array('Panasonic2', 'udp', '9300', '9301', 'both');
- $voiplist['Panasonic'][] = array('Panasonic3', 'udp', '2747', '2747', 'both');
-
-
-$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');
-
-
-
-$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['slingbox'] = array();
- $othersplist['slingbox'][] = array('Slingbox1', 'tcp', '5001', '5001', 'both');
- $othersplist['slingbox'][] = array('Slingbox2', 'udp', '5001', '5001', 'both');
+ global $config, $g, $altq_list_queues, $gamesplist;
+
+ require_once("wizardapp.inc");
/*
* Wipe previous config.
@@ -1009,7 +714,7 @@ $othersplist = array();
$remainbw = round($remainbw / $upbw * 100, 2);
if (intval($remainbw) > 0 && intval($remainbw) > 30) {
- $message=gettext("Custom Bandwidths are greater than 30%. Please lower them for the wizard to continue.");
+ $savemsg=gettext("Custom Bandwidths are greater than 30%. Please lower them for the wizard to continue.");
header("Location: wizard.php?xml=traffic_shaper_wizard_dedicated.xml&stepid=2&message={$message}");
exit;
} else {
@@ -1031,16 +736,11 @@ $othersplist = array();
$tmpcf['bandwidthtype'] = $config['ezshaper']['step2']["conn{$i}uploadspeed"];
}
else if ($sched == "HFSC") {
- $tmpcf['linkshare1'] = $tmpcf['linkshare3'] =
- floatval($config['ezshaper']['step2']["conn{$i}upload"]) . $config['ezshaper']['step2']["conn{$i}uploadspeed"];
-
+ $tmpcf['linkshare3'] = floatval($config['ezshaper']['step2']["conn{$i}upload"]) . $config['ezshaper']['step2']["conn{$i}uploadspeed"];
$tmpcf['upperlimit'] = "on";
$tmpcf['upperlimit3'] =
- floatval($config['ezshaper']['step2']["conn{$i}upload"]) . $config['ezshaper']['step2']["conn{$i}uploadspeed"];
-
-
+ floatval($config['ezshaper']['step2']["conn{$i}upload"]) . $config['ezshaper']['step2']["conn{$i}uploadspeed"];
$tmpcf['linkshare2'] = 100;
- //$tmpcf['linkshare1'] = "0b";
$tmpcf['linkshare'] = "on";
$tmpcf['bandwidth'] = floatval($config['ezshaper']['step2']["conn{$i}upload"]);
$tmpcf['bandwidthtype'] = $config['ezshaper']['step2']["conn{$i}uploadspeed"];
@@ -1073,8 +773,6 @@ $othersplist = array();
else if ($sched == "HFSC") {
$lkbw = 0.20 * $remainbw;
$tmpcf['linkshare3'] = "{$lkbw}%";
- $tmpcf['linkshare2'] = 100;
- $tmpcf['linkshare1'] = "0b";
$tmpcf['linkshare'] = "on";
$tmpcf['bandwidth'] = $lkbw;
$tmpcf['bandwidthtype'] = "%";
@@ -1136,8 +834,6 @@ $othersplist = array();
$tmpcf['bandwidthtype'] = $p2pcatchbwunit;
} else if ($sched == "HFSC") {
$tmpcf['linkshare'] = "on";
- $tmpcf['linkshare1'] = "{$p2pcatchbw}{$p2pcatchbwunit}";
- $tmpcf['linkshare2'] = 300;
$tmpcf['linkshare3'] = "{$p2pcatchbw}{$p2pcatchbwunit}";
$tmpcf['upperlimit'] = "on";
$tmpcf['upperlimit3'] = "{$p2pcatchbw}{$p2pcatchbwunit}";
@@ -1154,8 +850,6 @@ $othersplist = array();
} else if ($sched == "HFSC") {
$tmpbw = $remainbw * 0.05; /* 5% bandwidth */
$tmpcf['linkshare'] = "on";
- $tmpcf['linkshare1'] = "{$tmpbw}%";
- $tmpcf['linkshare2'] = 300;
$tmpcf['linkshare3'] = "{$tmpbw}%";
$tmpcf['upperlimit'] = "on";
$tmpcf['upperlimit3'] = "{$tmpbw}%";
@@ -1200,9 +894,7 @@ $othersplist = array();
$tmpcf['realtime3'] = "{$voipbw}%";
}
$tmpcf['realtime'] = "on";
- $tmpcf['realtime2'] = "10";
$tmpcf['bandwidth'] = 32;
- $tmpcf['realtime1'] = "0b";
$tmpcf['bandwidthtype'] = "Kb";
}
array_push($tmppath, "qVoIP");
@@ -1232,8 +924,6 @@ $othersplist = array();
} else if ($sched == "HFSC") {
$gamesbw = $remainbw * 0.2; /* 20% bandwidth */
$tmpcf['linkshare'] = "on";
- $tmpcf['linkshare1'] = "0b";
- $tmpcf['linkshare2'] = "50";
$tmpcf['linkshare3'] = "{$gamesbw}%";
$tmpcf['bandwidth'] = "{$gamesbw}";
$tmpcf['bandwidthtype'] = "%";
@@ -1265,8 +955,6 @@ $othersplist = array();
} else if ($sched == "HFSC") {
$tmpcf['linkshare'] = "on";
$otherbw = $remainbw * 0.1; /* 10% bandwidth */
- $tmpcf['linkshare1'] = "0b";
- $tmpcf['linkshare2'] = 200;
$tmpcf['linkshare3'] = "{$otherbw}%";
$tmpcf['bandwidth'] = $otherbw;
$tmpcf['bandwidthtype'] = "%";
@@ -1302,18 +990,15 @@ $othersplist = array();
} else if ($sched == "HFSC") {
if ($penalty) {
$tmpcf['linkshare3'] = "{$penaltybw}{$penaltybwunit}";
- $tmpcf['linkshare1'] = "{$penaltybw}{$penaltybwunit}";
$tmpcf['bandwidth'] = $penaltybw;
$tmpcf['bandwidthtype'] = $penaltybwunit;
} else {
$lsbw = $remainbw * 0.05;
- $tmpcf['linkshare1'] = "{$lsbw}%"; /* 5% bandwidth */
$tmpcf['linkshare3'] = "{$lsbw}%"; /* 5% bandwidth */
$tmpcf['bandwidth'] = $lsbw;
$tmpcf['bandwidthtype'] = "%";
}
$tmpcf['linkshare'] = "on";
- $tmpcf['linkshare2'] = 500;
}
array_push($tmppath, "qOthersLow");
$qtmp =& $altq->add_queue($q, &$tmpcf, &$tmppath, $input_errors);
@@ -1415,7 +1100,7 @@ $othersplist = array();
}
$remainbw = round($remainbw / $downbw * 100, 2);
if (intval($remainbw) > 0 && intval($remainbw) > 40) {
- $message=gettext("Custom Bandwidths are greater than 30%. Please lower them for the wizard to continue.");
+ $savemsg=gettext("Custom Bandwidths are greater than 30%. Please lower them for the wizard to continue.");
header("Location: wizard.php?xml=traffic_shaper_wizard_dedicated.xml&stepid=2&message={$message}");
exit;
} else {
@@ -1437,15 +1122,10 @@ $othersplist = array();
$tmpcf['bandwidthtype'] = $config['ezshaper']['step2']["conn{$i}downloadspeed"];
}
else if ($sched == "HFSC") {
- $tmpcf['linkshare1'] = $tmpcf['linkshare3'] =
- floatval($config['ezshaper']['step2']["conn{$i}download"]) . $config['ezshaper']['step2']["conn{$i}downloadspeed"];
-
+ $tmpcf['linkshare3'] = floatval($config['ezshaper']['step2']["conn{$i}download"]) . $config['ezshaper']['step2']["conn{$i}downloadspeed"];
$tmpcf['upperlimit'] = "on";
- $tmpcf['upperlimit3'] =
- floatval($config['ezshaper']['step2']["conn{$i}download"]) . $config['ezshaper']['step2']["conn{$i}downloadspeed"];
-
+ $tmpcf['upperlimit3'] = floatval($config['ezshaper']['step2']["conn{$i}download"]) . $config['ezshaper']['step2']["conn{$i}downloadspeed"];
$tmpcf['linkshare2'] = 100;
- //$tmpcf['linkshare1'] = "0b";
$tmpcf['linkshare'] = "on";
$tmpcf['bandwidth'] = floatval($config['ezshaper']['step2']["conn{$i}download"]);
$tmpcf['bandwidthtype'] = $config['ezshaper']['step2']["conn{$i}downloadspeed"];
@@ -1478,8 +1158,6 @@ $othersplist = array();
else if ($sched == "HFSC") {
$lkbw = 0.20 * $remainbw;
$tmpcf['linkshare3'] = "{$lkbw}%";
- $tmpcf['linkshare2'] = 100;
- $tmpcf['linkshare1'] = "0b";
$tmpcf['linkshare'] = "on";
$tmpcf['bandwidth'] = $lkbw;
$tmpcf['bandwidthtype'] = "%";
@@ -1541,8 +1219,6 @@ $othersplist = array();
$tmpcf['bandwidthtype'] = $p2pcatchbwunit;
} else if ($sched == "HFSC") {
$tmpcf['linkshare'] = "on";
- $tmpcf['linkshare1'] = "{$p2pcatchbw}{$p2pcatchbwunit}";
- $tmpcf['linkshare2'] = 300;
$tmpcf['linkshare3'] = "{$p2pcatchbw}{$p2pcatchbwunit}";
$tmpcf['upperlimit'] = "on";
$tmpcf['upperlimit3'] = "{$p2pcatchbw}{$p2pcatchbwunit}";
@@ -1559,8 +1235,6 @@ $othersplist = array();
} else if ($sched == "HFSC") {
$tmpbw = $remainbw * 0.05; /* 5% bandwidth */
$tmpcf['linkshare'] = "on";
- $tmpcf['linkshare1'] = "{$tmpbw}%";
- $tmpcf['linkshare2'] = 300;
$tmpcf['linkshare3'] = "{$tmpbw}%";
$tmpcf['upperlimit'] = "on";
$tmpcf['upperlimit3'] = "{$tmpbw}%";
@@ -1605,9 +1279,7 @@ $othersplist = array();
$tmpcf['realtime3'] = "{$voipbw}%";
}
$tmpcf['realtime'] = "on";
- $tmpcf['realtime2'] = "10";
$tmpcf['bandwidth'] = 32;
- $tmpcf['realtime1'] = "0b";
$tmpcf['bandwidthtype'] = "Kb";
}
array_push($tmppath, "qVoIP");
@@ -1637,8 +1309,6 @@ $othersplist = array();
} else if ($sched == "HFSC") {
$gamesbw = $remainbw * 0.2; /* 20% bandwidth */
$tmpcf['linkshare'] = "on";
- $tmpcf['linkshare1'] = "0b";
- $tmpcf['linkshare2'] = "50";
$tmpcf['linkshare3'] = "{$gamesbw}%";
$tmpcf['bandwidth'] = "{$gamesbw}";
$tmpcf['bandwidthtype'] = "%";
@@ -1670,8 +1340,6 @@ $othersplist = array();
} else if ($sched == "HFSC") {
$tmpcf['linkshare'] = "on";
$otherbw = $remainbw * 0.1; /* 10% bandwidth */
- $tmpcf['linkshare1'] = "0b";
- $tmpcf['linkshare2'] = 200;
$tmpcf['linkshare3'] = "{$otherbw}%";
$tmpcf['bandwidth'] = $otherbw;
$tmpcf['bandwidthtype'] = "%";
@@ -1707,18 +1375,15 @@ $othersplist = array();
} else if ($sched == "HFSC") {
if ($penalty) {
$tmpcf['linkshare3'] = "{$penaltybw}{$penaltybwunit}";
- $tmpcf['linkshare1'] = "{$penaltybw}{$penaltybwunit}";
$tmpcf['bandwidth'] = $penaltybw;
$tmpcf['bandwidthtype'] = $penaltybwunit;
} else {
$lsbw = $remainbw * 0.05;
- $tmpcf['linkshare1'] = "{$lsbw}%"; /* 5% bandwidth */
$tmpcf['linkshare3'] = "{$lsbw}%"; /* 5% bandwidth */
$tmpcf['bandwidth'] = $lsbw;
$tmpcf['bandwidthtype'] = "%";
}
$tmpcf['linkshare'] = "on";
- $tmpcf['linkshare2'] = 500;
}
array_push($tmppath, "qOthersLow");
$qtmp =& $altq->add_queue($q, &$tmpcf, &$tmppath, $input_errors);
diff --git a/usr/local/www/wizards/traffic_shaper_wizard_dedicated.xml b/usr/local/www/wizards/traffic_shaper_wizard_dedicated.xml
index fd7e40c..56cd97d 100755
--- a/usr/local/www/wizards/traffic_shaper_wizard_dedicated.xml
+++ b/usr/local/www/wizards/traffic_shaper_wizard_dedicated.xml
@@ -1,12 +1,12 @@
<?xml version="1.0"?>
<pfsensewizard>
- <copyright>/* $Id$ */
-
+ <copyright><![CDATA[
+ /*
traffic_shaper_wizard_dedicated.xml
part of pfSense (http://www.pfsense.org/)
Copyright (C) 2005 Bill Marquette - bill.marquette@gmail.com.
- Copyright (C) 2008 Ermal Luci
+ Copyright (C) 2008-2010 Ermal Luci
All rights reserved.
Redistribution and use in source and binary forms, with or without
@@ -29,7 +29,7 @@
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>
+ */]]></copyright>
<totalsteps>9</totalsteps>
<step>
@@ -152,7 +152,7 @@
<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>
+ <enablefields>Address,Bandwidth,BandwidthSpeed</enablefields>
<bindstofield>ezshaper-&gt;step4-&gt;enable</bindstofield>
</field>
<field>
@@ -165,7 +165,7 @@
</field>
<field>
<name>Address</name>
- <type>input</type>
+ <type>inputalias</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>
diff --git a/usr/local/www/wizards/traffic_shaper_wizard_multi_all.inc b/usr/local/www/wizards/traffic_shaper_wizard_multi_all.inc
index 61c836e..7e88216 100755
--- a/usr/local/www/wizards/traffic_shaper_wizard_multi_all.inc
+++ b/usr/local/www/wizards/traffic_shaper_wizard_multi_all.inc
@@ -1,12 +1,11 @@
<?php
-/* $Id$ */
/*
- traffic_shaper_wizard.inc
+ traffic_shaper_wizard_multi_all.inc
part of pfSense (http://www.pfsense.org/)
Copyright (C) 2006 Bill Marquette - bill.marquette@gmail.com.
Copyright (C) 2006 Scott Ullrich - sullrich@pfsense.com.
- Copyright (C) 2008 Ermal Luçi
+ Copyright (C) 2008-2010 Ermal Luçi
All rights reserved.
Redistribution and use in source and binary forms, with or without
@@ -32,284 +31,276 @@
*/
function step1_submitphpaction() {
-
- if (!isset($_POST['numberofconnections'])) {
- $message=gettext("You need to specify the number of connections.");
- header("Location:wizard.php?xml=traffic_shaper_wizard_multi_all.xml&stepid=0&message={$message}");
- exit;
- }
- if (intval($_POST['numberofconnections']) > 100 || intval($_POST['numberofconnections']) < 1) {
- $message=gettext("The number of connections supported is between 1 and 100.");
- header("Location:wizard.php?xml=traffic_shaper_wizard_multi_all.xml&stepid=0&message={$message}");
- exit;
- }
+ global $stepid, $savemsg;
+
+ if (!isset($_POST['numberofconnections'])) {
+ $savemsg=gettext("You need to specify the number of connections.");
+ $stepid--;
+ $stepid--;
+ return;
+ }
+ if (intval($_POST['numberofconnections']) < 1) {
+ $savemsg=gettext("The number of connections should be greater than 1.");
+ $stepid--;
+ return;
+ }
}
function step2_stepbeforeformdisplay() {
- global $config, $pkg;
-
- $numberofinterfaces = 0;
- $iflist = array();
- $iflisttmp = get_configured_interface_with_descr();
- foreach ($iflisttmp as $if => $ifdesc) {
- if (!is_altq_capable(get_real_interface($if)))
- continue;
- if ($if == "lan")
- continue;
- $numberofinterfaces++;
- $iflist[$if] = $ifdesc;
- }
- $numberofconnections = intval($config['ezshaper']['step1']['numberofconnections']);
- if ($numberofconnections > $numberofinterfaces) {
- $message=gettext("You have less interfaces than number of connections!");
- header("Location:wizard.php?xml=traffic_shaper_wizard_multi_all.xml&stepid=0&message={$message}");
- exit;
- }
-
- $numberoflocalinterfaces = intval($config['ezshaper']['step1']['numberoflocalinterfaces']);
- if ($numberoflocalinterfaces > $numberofinterfaces) {
- $message=gettext("You have less interfaces than number of connections!");
- header("Location:wizard.php?xml=traffic_shaper_wizard_multi_all.xml&stepid=0&message={$message}");
- exit;
- }
-
+ global $config, $pkg;
+ global $stepid, $savemsg;
+
+ $numberofinterfaces = 0;
+ $iflist = array();
+ $iflisttmp = get_configured_interface_with_descr();
+ foreach ($iflisttmp as $if => $ifdesc) {
+ if (!is_altq_capable(get_real_interface($if)))
+ continue;
+ $numberofinterfaces++;
+ $iflist[$if] = $ifdesc;
+ }
+ $numberofconnections = intval($config['ezshaper']['step1']['numberofconnections']);
+ if ($numberofconnections > $numberofinterfaces) {
+ $savemsg=gettext("You have less interfaces than number of connections!");
+ $stepid--;
+ return;
+ }
- $cfgname = "traffic_shaper_wizard_multi_all.xml";
+ $numberoflocalinterfaces = intval($config['ezshaper']['step1']['numberoflocalinterfaces']);
+ if ($numberoflocalinterfaces > $numberofinterfaces) {
+ $savemsg=gettext("You have less interfaces than number of connections!");
+ $stepid--;
+ return;
+ }
+ $cfgname = "traffic_shaper_wizard_multi_all.xml";
- $fields =& $pkg['step'][1]['fields']['field'];
-
- /*
- unset($config['ezshaper']['step2']);
- $config['ezshaper']['step2'] = array();
- write_config();
- */
- $fields = array();
-
+ $fields =& $pkg['step'][1]['fields']['field'];
+
+ /*
+ unset($config['ezshaper']['step2']);
+ $config['ezshaper']['step2'] = array();
+ write_config();
+ */
+ $fields = array();
+
+ for ($i = 0; $i < $numberoflocalinterfaces; $i++) {
$field = array();
- $field['name'] = "Setup LAN schedulers";
+ $interface_friendly = $i+1;
+ $field['name'] = "Setup connection speed and scheduler information for interface LAN #{$interface_friendly}";
$field['type'] = "listtopic";
$fields[] = $field;
- for ($i = 0; $i < $numberoflocalinterfaces; $i++) {
- $field = array();
- $field['name'] = "local{$i}interface";
- $field['type'] = "select";
-// $field['typehint'] = "Interface of this connection.";
- $field['options']['option'] = array();
- foreach ($iflist as $ifname => $ifdescr) {
- $opts = array();
- $opts['displayname'] = $ifdescr;
- $opts['name'] = $ifname;
- $opts['value'] = $ifname;
- $field['options']['option'][] = $opts;
- }
- /* LAN is needed here */
- $opts = array();
- $opts['name'] = "lan";
- $opts['value'] = "lan";
- $field['options']['option'][] = $opts;
-
- $field['combinefieldsbegin'] = "true";
- $field['bindstofield'] = "ezshaper->step2->local{$i}interface";
- $fields[] = $field;
-
- $field = array();
- $field['combinefieldsend'] = "true";
- $field['dontdisplayname'] = "true";
- $field['dontcombinecells'] = "true";
-
- $field['name'] = "local{$i}downloadscheduler";
- $field['type'] = "select";
- $field['typehint'] = "Queueing discipline to apply on this local interface.";
- $field['options']['option'] = array();
- $opts = array();
- $opts['name'] = "HFSC";
- $opts['value'] = "HFSC";
- $field['options']['option'][] = $opts;
- $opts = array();
- $opts['name'] = "CBQ";
- $opts['value'] = "CBQ";
- $field['options']['option'][] = $opts;
+ $field = array();
+ $field['displayname'] = "Interface & Scheduler";
+ $field['name'] = "local{$i}interface";
+ $field['type'] = "select";
+ $field['options']['option'] = array();
+ foreach ($iflist as $ifname => $ifdescr) {
$opts = array();
- $opts['name'] = "PRIQ";
- $opts['value'] = "PRIQ";
- $field['options']['option'][] = $opts;
- $field['bindstofield'] = "ezshaper->step2->local{$i}downloadscheduler";
- $fields[] = $field;
+ $opts['displayname'] = $ifdescr;
+ $opts['name'] = $ifname;
+ $opts['value'] = $ifname;
+ $field['options']['option'][] = $opts;
}
+ $field['combinefieldsbegin'] = "true";
+ $field['bindstofield'] = "ezshaper->step2->local{$i}interface";
+ $fields[] = $field;
$field = array();
- $field['name'] = "Setup connections speeds";
- $field['type'] = "listtopic";
+ $field['combinefieldsend'] = "true";
+ $field['dontdisplayname'] = "true";
+ $field['dontcombinecells'] = "true";
+ $field['name'] = "local{$i}downloadscheduler";
+ $field['type'] = "select";
+ $field['typehint'] = "Queueing discipline to apply on this local interface.";
+ $field['options']['option'] = array();
+ $opts = array();
+ $opts['name'] = "HFSC";
+ $opts['value'] = "HFSC";
+ $field['options']['option'][] = $opts;
+ $opts = array();
+ $opts['name'] = "CBQ";
+ $opts['value'] = "CBQ";
+ $field['options']['option'][] = $opts;
+ $opts = array();
+ $opts['name'] = "PRIQ";
+ $opts['value'] = "PRIQ";
+ $field['options']['option'][] = $opts;
+ $field['bindstofield'] = "ezshaper->step2->local{$i}downloadscheduler";
$fields[] = $field;
+ }
- for ($i = 0; $i < $numberofconnections; $i++) {
-
- $field = array();
- $interface_friendly = $i+1;
- $field['name'] = "Setup connection speed and scheduler information for interface #{$interface_friendly}";
- $field['type'] = "listtopic";
- $fields[] = $field;
-
- $field = array();
- $field['name'] = "conn{$i}interface";
- $field['type'] = "select";
- $interface_real = $i+1;
- $field['typehint'] = "Select interface #{$interface_real} that you would like to shape";
- $field['options']['option'] = array();
- foreach ($iflist as $ifname => $ifdescr) {
- $opts = array();
- $opts['displayname'] = $ifdescr;
- $opts['name'] = $ifname;
- $opts['value'] = $ifname;
- $field['options']['option'][] = $opts;
- }
- $field['bindstofield'] = "ezshaper->step2->conn{$i}interface";
- $fields[] = $field;
+ for ($i = 0; $i < $numberofconnections; $i++) {
+ $field = array();
+ $interface_friendly = $i+1;
+ $field['name'] = "Setup connection speed and scheduler information for interface WAN#{$interface_friendly}";
+ $field['type'] = "listtopic";
+ $fields[] = $field;
- $field['name'] = "conn{$i}uploadscheduler";
- $field['type'] = "select";
- $field['typehint'] = "Queueing discipline to apply on the upload of this connection.";
- $field['options']['option'] = array();
- $opts = array();
- $opts['name'] = "HFSC";
- $opts['value'] = "HFSC";
- $field['options']['option'][] = $opts;
- $opts = array();
- $opts['name'] = "CBQ";
- $opts['value'] = "CBQ";
- $field['options']['option'][] = $opts;
- $opts = array();
- $opts['name'] = "PRIQ";
- $opts['value'] = "PRIQ";
- $field['options']['option'][] = $opts;
- $field['bindstofield'] = "ezshaper->step2->conn{$i}uploadscheduler";
- $fields[] = $field;
-
- $field = array();
- $field['name'] = "conn{$i}upload";
- $field['type'] = "input";
- $field['bindstofield'] = "ezshaper->step2->conn{$i}upload";
- $field['combinefieldsbegin'] = "true";
- $fields[] = $field;
-
- $field = array();
- $field['combinefieldsend'] = "true";
- $field['dontdisplayname'] = "true";
- $field['dontcombinecells'] = "true";
- $field['name'] = "conn{$i}uploadspeed";
- $field['typehint'] = "Upload bandwidth on this connection.";
- $field['type'] = "select";
- $field['options']['option'] = array();
- $opts = array();
- $opts['value'] = "Kb";
- $opts['name'] = "Kbit/s";
- $field['options']['option'][] = $opts;
- $opts = array();
- $opts['value'] = "Mb";
- $opts['name'] = "Mbit/s";
- $field['options']['option'][] = $opts;
- $opts = array();
- $opts['value'] = "Gb";
- $opts['name'] = "Gbit/s";
- $field['options']['option'][] = $opts;
- $field['bindstofield'] = "ezshaper->step2->conn{$i}uploadspeed";
- $fields[] = $field;
-
- $field = array();
- $field['name'] = "conn{$i}download";
- $field['type'] = "input";
- $field['bindstofield'] = "ezshaper->step2->conn{$i}download";
- $field['combinefieldsbegin'] = "true";
- $fields[] = $field;
-
- $field = array();
- $field['combinefieldsend'] = "true";
- $field['dontdisplayname'] = "true";
- $field['dontcombinecells'] = "true";
- $field['name'] = "conn{$i}downloadspeed";
- $field['typehint'] = "Download bandwidth on this connection.";
- $field['type'] = "select";
- $field['options']['option'] = array();
- $opts = array();
- $opts['value'] = "Kb";
- $opts['name'] = "Kbit/s";
- $field['options']['option'][] = $opts;
- $opts = array();
- $opts['value'] = "Mb";
- $opts['name'] = "Mbit/s";
- $field['options']['option'][] = $opts;
- $opts = array();
- $opts['value'] = "Gb";
- $opts['name'] = "Gbit/s";
- $field['options']['option'][] = $opts;
- $field['bindstofield'] = "ezshaper->step2->conn{$i}downloadspeed";
- $fields[] = $field;
+ $field = array();
+ $field['displayname'] = "Interface & Scheduler";
+ $field['name'] = "conn{$i}interface";
+ $field['type'] = "select";
+ $interface_real = $i+1;
+ $field['options']['option'] = array();
+ foreach ($iflist as $ifname => $ifdescr) {
+ $opts = array();
+ $opts['displayname'] = $ifdescr;
+ $opts['name'] = $ifname;
+ $opts['value'] = $ifname;
+ $field['options']['option'][] = $opts;
}
+ $field['bindstofield'] = "ezshaper->step2->conn{$i}interface";
+ $field['combinefieldsbegin'] = "true";
+ $fields[] = $field;
+
$field = array();
- $field['name'] = "Next";
- $field['type'] = "submit";
+ $field['combinefieldsend'] = "true";
+ $field['dontdisplayname'] = "true";
+ $field['dontcombinecells'] = "true";
+ $field['name'] = "conn{$i}uploadscheduler";
+ $field['type'] = "select";
+ $field['typehint'] = "Queueing discipline to apply on the upload of this connection.";
+ $field['options']['option'] = array();
+ $opts = array();
+ $opts['name'] = "HFSC";
+ $opts['value'] = "HFSC";
+ $field['options']['option'][] = $opts;
+ $opts = array();
+ $opts['name'] = "CBQ";
+ $opts['value'] = "CBQ";
+ $field['options']['option'][] = $opts;
+ $opts = array();
+ $opts['name'] = "PRIQ";
+ $opts['value'] = "PRIQ";
+ $field['options']['option'][] = $opts;
+ $field['bindstofield'] = "ezshaper->step2->conn{$i}uploadscheduler";
$fields[] = $field;
+
+ $field = array();
+ $field['displayname'] = "Upload";
+ $field['name'] = "conn{$i}upload";
+ $field['type'] = "input";
+ $field['bindstofield'] = "ezshaper->step2->conn{$i}upload";
+ $field['combinefieldsbegin'] = "true";
+ $fields[] = $field;
+
+ $field = array();
+ $field['combinefieldsend'] = "true";
+ $field['dontdisplayname'] = "true";
+ $field['dontcombinecells'] = "true";
+ $field['name'] = "conn{$i}uploadspeed";
+ $field['typehint'] = "Upload bandwidth on this connection.";
+ $field['type'] = "select";
+ $field['options']['option'] = array();
+ $opts = array();
+ $opts['value'] = "Kb";
+ $opts['name'] = "Kbit/s";
+ $field['options']['option'][] = $opts;
+ $opts = array();
+ $opts['value'] = "Mb";
+ $opts['name'] = "Mbit/s";
+ $field['options']['option'][] = $opts;
+ $opts = array();
+ $opts['value'] = "Gb";
+ $opts['name'] = "Gbit/s";
+ $field['options']['option'][] = $opts;
+ $field['bindstofield'] = "ezshaper->step2->conn{$i}uploadspeed";
+ $fields[] = $field;
+
+ $field = array();
+ $field['displayname'] = "Download";
+ $field['name'] = "conn{$i}download";
+ $field['type'] = "input";
+ $field['bindstofield'] = "ezshaper->step2->conn{$i}download";
+ $field['combinefieldsbegin'] = "true";
+ $fields[] = $field;
+
+ $field = array();
+ $field['combinefieldsend'] = "true";
+ $field['dontdisplayname'] = "true";
+ $field['dontcombinecells'] = "true";
+ $field['name'] = "conn{$i}downloadspeed";
+ $field['typehint'] = "Download bandwidth on this connection.";
+ $field['type'] = "select";
+ $field['options']['option'] = array();
+ $opts = array();
+ $opts['value'] = "Kb";
+ $opts['name'] = "Kbit/s";
+ $field['options']['option'][] = $opts;
+ $opts = array();
+ $opts['value'] = "Mb";
+ $opts['name'] = "Mbit/s";
+ $field['options']['option'][] = $opts;
+ $opts = array();
+ $opts['value'] = "Gb";
+ $opts['name'] = "Gbit/s";
+ $field['options']['option'][] = $opts;
+ $field['bindstofield'] = "ezshaper->step2->conn{$i}downloadspeed";
+ $fields[] = $field;
+ }
+ $field = array();
+ $field['name'] = "Next";
+ $field['type'] = "submit";
+ $fields[] = $field;
}
function step2_stepsubmitphpaction() {
global $config;
+ global $stepid, $savemsg;
$sumdownloads = 0;
-
+
/* Input Validation */
$steps = intval($config['ezshaper']['step1']['numberofconnections']);
$localint = intval($config['ezshaper']['step1']['numberoflocalinterfaces']);
for ($i = 0; $i < $steps; $i++) {
- for ($j = $i + 1; $j < $steps; $j++) {
- if ($_POST["conn{$i}interface"] == $_POST["conn{$j}interface"]) {
- $message=gettext("You cannot select the same interface for connections {$i} and {$j}.");
- header("Location: wizard.php?xml=traffic_shaper_wizard_multi_all.xml&stepid=1&message={$message}");
- exit;
- }
- if (!is_numeric($_POST["conn{$i}upload"])) {
- $message = gettext("Upload bandwidth of connection {$i} is not valid.");
- header("Location: wizard.php?xml=traffic_shaper_wizard_multi_all.xml&stepid=1&message={$message}");
- exit;
- }
- if (!is_numeric($_POST["conn{$i}download"])) {
- $message = gettext("Download bandwidth of connection {$i} is not valid.");
- header("Location: wizard.php?xml=traffic_shaper_wizard_multi_all.xml&stepid=1&message={$message}");
- exit;
- }
- $upbw = $_POST["conn{$i}upload"];
- $downbw = $_POST["conn{$i}download"];
- if ($upbw == 0 || $downbw = 0) {
- $message = gettext("You cannot specify 0 bandwidth!")
-;
- header("Location: wizard.php?xml=traffic_shaper_wizard_multi_all.xml&stepid=1&message
-={$message}");
- exit;
- }
- if (intval($upbw) < 128 && $_POST["conn{$i}uploadspeed"] == "Kb" && trim($_POST["conn{$i}scheduler"]) == "CBQ") {
- $message=gettext("Uploads smaller than 128Kbit/s is not supported for connection {$i} on CBQ scheduler.");
- header("Location: wizard.php?xml=traffic_shaper_wizard_multi_all.xml&stepid=1&message={$message}");
- exit;
- }
+ for ($j = $i + 1; $j < $steps; $j++) {
+ if ($_POST["conn{$i}interface"] == $_POST["conn{$j}interface"]) {
+ $savemsg=gettext("You cannot select the same interface for connections {$i} and {$j}.");
+ $stepid--;
+ return;
}
- for ($j = 0; $j < $localint; $j++) {
- if ($_POST["conn{$i}interface"] == $_POST["local{$j}interface"]) {
- $message=gettext("You cannot select the same interface for local and outside.");
- header("Location: wizard.php?xml=traffic_shaper_wizard_multi_all.xml&stepid=1&message={$message}");
- exit;
- }
+ if (!is_numeric($_POST["conn{$i}upload"])) {
+ $savemsg = gettext("Upload bandwidth of connection {$i} is not valid.");
+ $stepid--;
+ return;
+ }
+ if (!is_numeric($_POST["conn{$i}download"])) {
+ $savemsg = gettext("Download bandwidth of connection {$i} is not valid.");
+ $stepid--;
+ return;
+ }
+ $upbw = $_POST["conn{$i}upload"];
+ $downbw = $_POST["conn{$i}download"];
+ if ($upbw < 1 || $downbw < 1) {
+ $savemsg = gettext("You cannot specify 0 bandwidth!");
+ $stepid--;
+ return;
+ }
+ if (intval($upbw) < 128 && $_POST["conn{$i}uploadspeed"] == "Kb" && trim($_POST["conn{$i}scheduler"]) == "CBQ") {
+ $savemsg=gettext("Uploads smaller than 128Kbit/s is not supported for connection {$i} on CBQ scheduler.");
+ $stepid--;
+ return;
+ }
+ }
+ for ($j = 0; $j < $localint; $j++) {
+ if ($_POST["conn{$i}interface"] == $_POST["local{$j}interface"]) {
+ $savemsg=gettext("You cannot select the same interface for local and outside.");
+ $stepid--;
+ return;
}
- }
+ }
+ }
for ($i = 0; $i < $localint; $i++) {
for ($j = $i + 1; $j < $localint; $j++) {
- if ($_POST["local{$i}interface"] == $_POST["local{$j}interface"]) {
- $message=gettext("You cannot select the same interface twice on local interfaces.");
- header("Location: wizard.php?xml=traffic_shaper_wizard_multi_all.xml&stepid=1&message={$message}");
- exit;
- }
+ if ($_POST["local{$i}interface"] == $_POST["local{$j}interface"]) {
+ $savemsg=gettext("You cannot select the same interface twice on local interfaces.");
+ $stepid--;
+ return;
+ }
}
}
-
/* This is necessary since the wizard expects pecnefined fields. */
unset($config['ezshaper']['step2']);
$config['ezshaper']['step2'] = array();
@@ -326,154 +317,175 @@ function step2_stepsubmitphpaction() {
$config['ezshaper']['step2']["conn{$i}download"] = $_POST["conn{$i}download"];
$config['ezshaper']['step2']["conn{$i}downloadspeed"] = $_POST["conn{$i}downloadspeed"];
$config['ezshaper']['step2']["conn${i}interface"] = $_POST["conn{$i}interface"];
- }
-
+ }
}
function step3_stepbeforeformdisplay() {
global $config, $pkg;
+ global $stepid, $savemsg;
+
+ $cfgname = "traffic_shaper_wizard_multi_all.xml";
+
+ $numberofconnections = intval($config['ezshaper']['step1']['numberofconnections']);
+ $numberoflocalinterfaces = intval($config['ezshaper']['step1']['numberoflocalinterfaces']);
+
+ $fields =& $pkg['step'][1]['fields']['field'];
+
+ $voipfields =& $pkg['step'][2]['fields']['field'];
+
+ $voipfields = array();
+ $enablefields = array();
+
+ $field = array();
+ $field['name'] = "enable";
+ $field['type'] = "checkbox";
+ $field['typehint'] = "Prioritize Voice over IP traffic.";
+ $field['bindstofield'] = "ezshaper->step3->enable";
+ $field['descritpion'] = "This will raise the priority of VOIP traffic above all other traffic.";
+ $voipfields[] = $field;
+
+ $field = array();
+ $field['name'] = "Next";
+ $field['type'] = "submit";
+ $voipfields[] = $field;
+
+ $field = array();
+ $field['name'] = "VOIP specific settings";
+ $field['type'] = "listtopic";
+ $voipfields[] = $field;
+
+ $field['name'] = "Provider";
+ $enablefields[] = "Provider";
+ $field['type'] = "select";
+ $field['description'] = "Choose Generic if your provider isn't listed.";
+ $field['options']['option'] = array();
+ $opts = array();
+ $opts['name'] = "Generic (lowdelay)";
+ $opts['value'] = "Generic";
+ $field['options']['option'][] = $opts;
+ $opts = array();
+ $opts['name'] = "VoicePulse";
+ $opts['value'] = "VoicePulse";
+ $field['options']['option'][] = $opts;
+ $opts = array();
+ $opts['name'] = "Asterisk/Vonage";
+ $opts['value'] = "Asterisk";
+ $field['options']['option'][] = $opts;
+ $opts = array();
+ $opts['name'] = "PanasonicTDA";
+ $opts['value'] = "Panasonic";
+ $field['options']['option'][] = $opts;
+ $field['bindstofield'] = "ezshaper->step3->provider";
+ $voipfields[] = $field;
+
+ $field = array();
+ $field['name'] = "Address";
+ $enablefields[] = "Address";
+ $field['type'] = "inputalias";
+ $field['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.";
+ $field['message'] = "IP Address field is non-blank and doesn't look like an IP address.";
+ $field['bindstofield'] = "ezshaper->step3->address";
+ $voipfields[] = $field;
+
+ for ($i = 0; $i < $numberofconnections; $i++) {
+ $field = array();
+ $interface_friendly = $i+1;
+ $field['name'] = "Connection WAN #{$interface_friendly}";
+ $field['type'] = "listtopic";
+ $voipfields[] = $field;
- $cfgname = "traffic_shaper_wizard_multi_all.xml";
+ $field = array();
+ $field['displayname'] = "Upload";
+ $field['name'] = "conn{$i}upload";
+ $enablefields[] = "conn{$i}upload";
+ $field['type'] = "input";
+ $field['bindstofield'] = "ezshaper->step3->conn{$i}upload";
+ $field['combinefieldsbegin'] = "true";
+ $voipfields[] = $field;
- $numberofconnections = intval($config['ezshaper']['step1']['numberofconnections']);
- $numberoflocalinterfaces = intval($config['ezshaper']['step1']['numberoflocalinterfaces']);
+ $field = array();
+ $field['combinefieldsend'] = "true";
+ $field['dontdisplayname'] = "true";
+ $field['dontcombinecells'] = "true";
+ $field['name'] = "conn{$i}uploadspeed";
+ $enablefields[] = "conn{$i}uploadspeed";
+ $field['typehint'] = "Upload bandwidth guarantee for VOIP phone(s) on connection {$i}.";
+ $field['type'] = "select";
+ $field['options']['option'] = array();
+ $opts = array();
+ $opts['value'] = "Kb";
+ $opts['name'] = "Kbit/s";
+ $field['options']['option'][] = $opts;
+ $opts = array();
+ $opts['value'] = "Mb";
+ $opts['name'] = "Mbit/s";
+ $field['options']['option'][] = $opts;
+ $opts = array();
+ $opts['value'] = "Gb";
+ $opts['name'] = "Gbit/s";
+ $field['options']['option'][] = $opts;
+ $field['bindstofield'] = "ezshaper->step3->conn{$i}uploadspeed";
+ $voipfields[] = $field;
+ }
- $fields =& $pkg['step'][1]['fields']['field'];
-
- $voipfields =& $pkg['step'][2]['fields']['field'];
-
- $voipfields = array();
-
- $field = array();
- $field['name'] = "enable";
- $field['type'] = "checkbox";
- $field['typehint'] = "Prioritize Voice over IP traffic.";
- $field['bindstofield'] = "ezshaper->step3->enable";
- $field['descritpion'] = "This will raise the priority of VOIP traffic above all other traffic.";
- $voipfields[] = $field;
-
- $field = array();
- $field['name'] = "Next";
- $field['type'] = "submit";
- $voipfields[] = $field;
-
- $field = array();
- $field['name'] = "VOIP specific settings";
- $field['type'] = "listtopic";
- $voipfields[] = $field;
-
- $field['name'] = "Provider";
- $field['type'] = "select";
- $field['description'] = "Choose Generic if your provider isn't listed.";
- $field['options']['option'] = array();
- $opts = array();
- $opts['name'] = "Generic (lowdelay)";
- $opts['value'] = "Generic";
- $field['options']['option'][] = $opts;
- $opts = array();
- $opts['name'] = "VoicePulse";
- $opts['value'] = "VoicePulse";
- $field['options']['option'][] = $opts;
- $opts = array();
- $opts['name'] = "Asterisk/Vonage";
- $opts['value'] = "Asterisk";
- $field['options']['option'][] = $opts;
- $opts = array();
- $opts['name'] = "PanasonicTDA";
- $opts['value'] = "Panasonic";
- $field['options']['option'][] = $opts;
- $field['bindstofield'] = "ezshaper->step3->provider";
- $voipfields[] = $field;
-
- $field = array();
- $field['name'] = "Address";
- $field['type'] = "inputalias";
- $field['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.";
- $field['message'] = "IP Address field is non-blank and doesn't look like an IP address.";
- $field['bindstofield'] = "ezshaper->step3->address";
- $voipfields[] = $field;
-
- for ($i = 0; $i < $numberofconnections; $i++) {
- $field = array();
- $field['name'] = "conn{$i}upload";
- $field['type'] = "input";
- $field['bindstofield'] = "ezshaper->step3->conn{$i}upload";
- $field['combinefieldsbegin'] = "true";
- $voipfields[] = $field;
-
- $field = array();
- $field['combinefieldsend'] = "true";
- $field['dontdisplayname'] = "true";
- $field['dontcombinecells'] = "true";
- $field['name'] = "conn{$i}uploadspeed";
- $field['typehint'] = "Upload bandwidth guarantee for VOIP phone(s) on connection {$i}.";
- $field['type'] = "select";
- $field['options']['option'] = array();
- $opts = array();
- $opts['value'] = "Kb";
- $opts['name'] = "Kbit/s";
- $field['options']['option'][] = $opts;
- $opts = array();
- $opts['value'] = "Mb";
- $opts['name'] = "Mbit/s";
- $field['options']['option'][] = $opts;
- $opts = array();
- $opts['value'] = "Gb";
- $opts['name'] = "Gbit/s";
- $field['options']['option'][] = $opts;
- $field['bindstofield'] = "ezshaper->step3->conn{$i}uploadspeed";
- $voipfields[] = $field;
- }
+ for ($i = 0; $i < $numberoflocalinterfaces; $i++) {
+ $field = array();
+ $interface_friendly = $i+1;
+ $field['name'] = "Connection LAN #{$interface_friendly}";
+ $field['type'] = "listtopic";
+ $voipfields[] = $field;
- for ($i = 0; $i < $numberoflocalinterfaces; $i++) {
- $field = array();
- $field['name'] = "local{$i}download";
- $field['type'] = "input";
- $field['bindstofield'] = "ezshaper->step3->local{$i}download";
- $field['combinefieldsbegin'] = "true";
- $voipfields[] = $field;
-
- $field = array();
- $field['combinefieldsend'] = "true";
- $field['dontdisplayname'] = "true";
- $field['dontcombinecells'] = "true";
- $field['name'] = "local{$i}downloadspeed";
- $field['typehint'] = "Download bandwidth guarantee for VOIP phone(s) on connections.";
- $field['type'] = "select";
- $field['options']['option'] = array();
- $opts = array();
- $opts['value'] = "Kb";
- $opts['name'] = "Kbit/s";
- $field['options']['option'][] = $opts;
- $opts = array();
- $opts['value'] = "Mb";
- $opts['name'] = "Mbit/s";
- $field['options']['option'][] = $opts;
- $opts = array();
- $opts['value'] = "Gb";
- $opts['name'] = "Gbit/s";
- $field['options']['option'][] = $opts;
- $field['bindstofield'] = "ezshaper->step3->local{$i}downloadspeed";
- $voipfields[] = $field;
- }
+ $field = array();
+ $field['displayname'] = "Download";
+ $field['name'] = "local{$i}download";
+ $enablefields[] = "local{$i}download";
+ $field['type'] = "input";
+ $field['bindstofield'] = "ezshaper->step3->local{$i}download";
+ $field['combinefieldsbegin'] = "true";
+ $voipfields[] = $field;
- $field = array();
- $field['name'] = "Next";
- $field['type'] = "submit";
+ $field = array();
+ $field['combinefieldsend'] = "true";
+ $field['dontdisplayname'] = "true";
+ $field['dontcombinecells'] = "true";
+ $field['name'] = "local{$i}downloadspeed";
+ $enablefields[] = "local{$i}downloadspeed";
+ $field['typehint'] = "Download bandwidth guarantee for VOIP phone(s) on connections.";
+ $field['type'] = "select";
+ $field['options']['option'] = array();
+ $opts = array();
+ $opts['value'] = "Kb";
+ $opts['name'] = "Kbit/s";
+ $field['options']['option'][] = $opts;
+ $opts = array();
+ $opts['value'] = "Mb";
+ $opts['name'] = "Mbit/s";
+ $field['options']['option'][] = $opts;
+ $opts = array();
+ $opts['value'] = "Gb";
+ $opts['name'] = "Gbit/s";
+ $field['options']['option'][] = $opts;
+ $field['bindstofield'] = "ezshaper->step3->local{$i}downloadspeed";
+ $voipfields[] = $field;
+ }
+
+ $field = array();
+ $field['name'] = "Next";
+ $field['type'] = "submit";
$voipfields[] = $field;
+ $voipfields[0]['enablefields'] = implode(",", $enablefields);
}
function step3_stepsubmitphpaction() {
global $config;
+ global $stepid, $savemsg;
if($_POST['address']) {
- if(!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_multi_all.xml&stepid=2&message={$message}");
- exit;
- }
+ if(!is_ipaddroralias($_POST['address'])) {
+ /* item is not an ip or alias. error out */
+ $savemsg=gettext("Address must be a valid IP address or Firewall Alias. Please correct this value to continue.");
+ $stepid--;
+ return;
}
}
@@ -481,18 +493,18 @@ function step3_stepsubmitphpaction() {
for ($i = 0; $i < $steps; $i++) {
if ($_POST["conn{$i}upload"]) {
if (!is_numeric($_POST["conn{$i}upload"])) {
- $message = gettext("Upload bandwidth of connection {$i} is not valid.");
- header("Location: wizard.php?xml=traffic_shaper_wizard_multi_all.xml&stepid=2&message={$message}");
- exit;
- }
+ $savemsg = gettext("Upload bandwidth of connection {$i} is not valid.");
+ $stepid--;
+ return;
+ }
$factor = wizard_get_bandwidthtype_scale($config['ezshaper']['step2']["conn{$i}uploadspeed"]);
$ifbw = $factor * floatval($config['ezshaper']['step2']["conn{$i}upload"]);
$factor = wizard_get_bandwidthtype_scale($_POST["conn{$i}uploadspeed"]);
$input_bw = $factor * floatval($_POST["conn{$i}upload"]);
if ((0.8 * $ifbw) < $input_bw) {
- $message=gettext("You cannot set the VoIP upload bandwidth on connection {$i} higher than 80% of the connection.");
- header("Location: wizard.php?xml=traffic_shaper_wizard_multi_all.xml&stepid=2&message={$message}");
- exit;
+ $savemsg=gettext("You cannot set the VoIP upload bandwidth on connection {$i} higher than 80% of the connection.");
+ $stepid--;
+ return;
}
}
}
@@ -501,23 +513,22 @@ function step3_stepsubmitphpaction() {
for ($i = 0; $i < $localint; $i++) {
if ($_POST["local{$i}download"]) {
if (!is_numeric($_POST["local{$i}download"])) {
- $message = gettext("Download bandwidth of connection {$i} is not valid.");
- header("Location: wizard.php?xml=traffic_shaper_wizard_multi_all.xml&stepid=2&message={$message}");
- exit;
- }
+ $savemsg = gettext("Download bandwidth of connection {$i} is not valid.");
+ $stepid--;
+ return;
+ }
$factor = wizard_get_bandwidthtype_scale($config['ezshaper']['step2']["conn{$i}downloadspeed"]);
$ifbw = $factor * floatval($config['ezshaper']['step2']["conn{$i}download"]);
$factor = wizard_get_bandwidthtype_scale($_POST["local{$i}downloadspeed"]);
$input_bw = $factor * floatval($_POST["local{$i}download"]);
if ((0.8 * $ifbw) < $input_bw) {
- $message=gettext("You cannot set the VoIP download bandwidth on connection {$i} higher than 80% of the connection.");
- header("Location: wizard.php?xml=traffic_shaper_wizard_multi_all.xml&stepid=2&message={$message}");
- exit;
+ $savemsg=gettext("You cannot set the VoIP download bandwidth on connection {$i} higher than 80% of the connection.");
+ $stepid--;
+ return;
}
}
}
-
for ($i = 0; $i < $localint; $i++) {
$config['ezshaper']['step3']["local{$i}download"] = $_POST["local{$i}download"];
$config['ezshaper']['step3']["local{$i}downloadspeed"] = $_POST["local{$i}downloadspeed"];
@@ -530,60 +541,57 @@ function step3_stepsubmitphpaction() {
}
function step4_stepsubmitphpaction() {
- global $config;
-
- if ( $_POST['enable'] ) {
- if(!$_POST['bandwidth']) {
- $message="You need to specify a value for bandwidth!";
- header("Location: wizard.php?xml=traffic_shaper_wizard_multi_all.xml&stepid=3&message={$message}");
- exit;
- }
- if(!is_numeric($_POST['bandwidth'])) {
- $message="The posted value is not a valid bandwidth.";
- header("Location: wizard.php?xml=traffic_shaper_wizard_multi_all.xml&stepid=3&message={$message}");
- exit;
- }
-
- if ($_POST['bandwidthspeed'] <> "%") {
- $message = gettext("Only percentage bandwidth specification is allowed.");
- header("Location: wizard.php?xml=traffic_shaper_wizard_multi_all.xml&stepid=3&message={$message}");
- exit;
- }
- $bw = $_POST['bandwidth'];
- if($bw > 15 && $bw < 2) {
- $message="Values should be between 2% and 15%!";
- header("Location: wizard.php?xml=traffic_shaper_wizard_multi_all.xml&stepid=3&message={$message}");
- exit;
- }
+ global $config;
+ global $stepid, $savemsg;
- 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_multi_all.xml&stepid=3&message={$message}");
- }
- }
+ if ( $_POST['enable'] ) {
+ if(!$_POST['bandwidth']) {
+ $savemsg="You need to specify a value for bandwidth!";
+ $stepid--;
+ return;
}
-
+ if(!is_numeric($_POST['bandwidth'])) {
+ $savemsg="The posted value is not a valid bandwidth.";
+ $stepid--;
+ return;
+ }
+ if ($_POST['bandwidthspeed'] <> "%") {
+ $savemsg = gettext("Only percentage bandwidth specification is allowed.");
+ $stepid--;
+ return;
+ }
+ $bw = $_POST['bandwidth'];
+ if($bw > 15 && $bw < 2) {
+ $savemsg="Values should be between 2% and 15%!";
+ $stepid--;
+ return;
+ }
+ if($_POST['address'] <> "" && !is_ipaddroralias($_POST['address'])) {
+ /* item is not an ip or alias. error out */
+ $savemsg=gettext("Address must be a valid IP address or Firewall Alias. Please correct this value to continue.");
+ $stepid--;
+ }
+ }
}
function step5_stepsubmitphpaction() {
+ global $stepid, $savemsg;
if ( $_POST['enable'] ) {
if (isset($_POST['bandwidth']) && $_POST['bandwidth'] <> "") {
if(!is_numeric($_POST['bandwidth'])) {
- $message="Posted value is not a valid bandwidth.";
- header("Location: wizard.php?xml=traffic_shaper_wizard_multi_all.xml&stepid=4&message={$message}");
+ $savemsg="Posted value is not a valid bandwidth.";
+ $stepid--;
}
if ($_POST['bandwidthspeed'] <> "%") {
- $message = gettext("Only percentage bandwidth specification is allowed.");
- header("Location: wizard.php?xml=traffic_shaper_wizard_multi_all.xml&stepid=4&message={$message}");
- exit;
+ $savemsg = gettext("Only percentage bandwidth specification is allowed.");
+ $stepid--;
+ return;
}
$bw = $_POST['bandwidth'];
if($bw > 15 && $bw < 2) {
- $message="Values should be between 2% and 15%!";
- header("Location: wizard.php?xml=traffic_shaper_wizard_multi_all.xml&stepid=3&message={$message}");
- exit;
+ $savemsg="Values should be between 2% and 15%!";
+ $stepid--;
+ return;
}
}
}
@@ -617,322 +625,9 @@ function step9_stepsubmitphpaction() {
}
function apply_all_choosen_items() {
- global $config, $g, $altq_list_queues;
-
-$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');
-
-$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');
-
-$gamesplist['deltaforce'] = array();
- /* delta force */
- $gamesplist['deltaforce'][] = array('Delta1', 'udp', '17478', '17488', 'both');
-
-$gamesplist['quakeiii'] = array();
- /* 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');
-
-$gamesplist['callofduty'] = array();
- $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');
-
-$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');
-
-$gamesplist['unrealtournament'] = array();
- /* 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');
-
-$gamesplist['empireearth'] = array();
- /* 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');
-
-$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');
-
-$gamesplist['farcry'] = array();
- /* 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');
-
-$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');
-
-$gamesplist['wolfet'] = array();
- /* 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');
-
-$gamesplist['battlenet'] = array();
- /* Blizzard Publishing games */
- $gamesplist['battlenet'][] = array('Battle.NET', 'tcp', '6112', '6119', 'both');
- $gamesplist['battlenet'][] = array('Battle.NET-2', 'tcp', '1119', '1119', 'both');
-
-$gamesplist['worldofwarcraft'] = array();
- $gamesplist[] = array('WoW', 'tcp', '3724', '3724', 'both');
-
-$gamesplist['battlenet'] = array();
- /* Add battle.net only if WoW is selected and battle.net isn't */
- $gamesplist[] = array('Battle.NET', 'tcp', '6112', '6119', 'both');
-
-$gamesplist['gunzonline'] = array();
- /* GunZ Online */
- $gamesplist['gunzonline'][] = array('GunZOnline', 'udp', '7700', '7700', 'both');
-
-$gamesplist['xbox360'] = array();
- /* 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');
-
- /* VoicePulse server */
-$voiplist['VoicePulse'] = array();
- $voiplist['VoicePulse'][] = array('VoicePulse', 'udp', '16384', '16482', 'both');
- $voiplist['VoicePulse'][] = array('VoicePulse', 'udp', '4569', '4569', 'both');
-
- /* Panasonic Hybrid PBX */
-$voiplist['Panasonic'] = array();
- $voiplist['Panasonic'][] = array('Panasonic1', 'udp', '8000', '8063', 'both');
- $voiplist['Panasonic'][] = array('Panasonic2', 'udp', '9300', '9301', 'both');
- $voiplist['Panasonic'][] = array('Panasonic3', 'udp', '2747', '2747', 'both');
-
-
-$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');
-
-
-
-$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['slingbox'] = array();
- $othersplist['slingbox'][] = array('Slingbox1', 'tcp', '5001', '5001', 'both');
- $othersplist['slingbox'][] = array('Slingbox2', 'udp', '5001', '5001', 'both');
+ global $config, $g, $altq_list_queues, $gamesplist;
+
+ require_once("wizardapp.inc");
/*
* Wipe previous config.
@@ -987,49 +682,49 @@ $othersplist = array();
$upfactor = wizard_get_bandwidthtype_scale($config['ezshaper']['step2']["conn{$i}uploadspeed"]);
$upbw = floatval($config['ezshaper']['step2']["conn{$i}upload"]) * $upfactor;
- if ($config['ezshaper']['step3']['enable']) {
- $voip = true;
- $voipbw = $config['ezshaper']['step3']["conn{$i}upload"];
- $voipbwunit = $config['ezshaper']['step3']["conn{$i}uploadspeed"];
- if ($sched != "HFSC") {
- if ($voipbwunit == "%")
- $factor = $upbw/100;
- else
- $factor = wizard_get_bandwidthtype_scale($voipbwunit);
- $remainbw += $voipbw * $factor;
- } else
- $remainbw += 32000; /* 32Kbit/s forHFSC linksharing */
- //echo "<br/>" .$remainbw . " : hmmm " .intval($config['ezshaper']['step3']["conn{$i}upload"]) ."/". $factor;
+ if ($config['ezshaper']['step3']['enable']) {
+ $voip = true;
+ $voipbw = $config['ezshaper']['step3']["conn{$i}upload"];
+ $voipbwunit = $config['ezshaper']['step3']["conn{$i}uploadspeed"];
+ if ($sched != "HFSC") {
+ if ($voipbwunit == "%")
+ $factor = $upbw/100;
+ else
+ $factor = wizard_get_bandwidthtype_scale($voipbwunit);
+ $remainbw += $voipbw * $factor;
+ } else
+ $remainbw += 32000; /* 32Kbit/s forHFSC linksharing */
+ //echo "<br/>" .$remainbw . " : hmmm " .intval($config['ezshaper']['step3']["conn{$i}upload"]) ."/". $factor;
}
if ($config['ezshaper']['step4']['enable']) {
- $penalty = true;
- $penaltybw = $config['ezshaper']['step4']['bandwidth'];
- $penaltybwunit = $config['ezshaper']['step4']['bandwidthunit'];
- if ($penaltybwunit == "%")
- $factor = $upbw/100;
- else
- $factor = wizard_get_bandwidthtype_scale($penaltybwunit);
- $remainbw += $penaltybw * $factor;
- //echo "<br/>".$remainbw . " : hmmm " . ($config['ezshaper']['step4']['bandwidth']) . " / " .$factor;
+ $penalty = true;
+ $penaltybw = $config['ezshaper']['step4']['bandwidth'];
+ $penaltybwunit = $config['ezshaper']['step4']['bandwidthunit'];
+ if ($penaltybwunit == "%")
+ $factor = $upbw/100;
+ else
+ $factor = wizard_get_bandwidthtype_scale($penaltybwunit);
+ $remainbw += $penaltybw * $factor;
+ //echo "<br/>".$remainbw . " : hmmm " . ($config['ezshaper']['step4']['bandwidth']) . " / " .$factor;
} else {
- $penalty = false;
- $penaltybw = 0;
+ $penalty = false;
+ $penaltybw = 0;
}
if ($config['ezshaper']['step5']['enable']) {
$p2p = true;
if ($config['ezshaper']['step5']['p2pcatchall']) {
- $p2pcatchall = true;
- $p2pcatchbw = $config['ezshaper']['step5']['bandwidth'];
- $p2pcatchbwunit = $config['ezshaper']['step5']['bandwidthunit'];
- if ($p2pcatchbwunit == "%")
- $factor = $upbw/100;
- else
- $factor = wizard_get_bandwidthtype_scale($p2pcatchbwunit);
- $remainbw += $p2pcatchbw * $factor;
- //echo "<br/>".$remainbw . " : hmmm " . floatval($config['ezshaper']['step5']['bandwidth']) ."/".$factor;
+ $p2pcatchall = true;
+ $p2pcatchbw = $config['ezshaper']['step5']['bandwidth'];
+ $p2pcatchbwunit = $config['ezshaper']['step5']['bandwidthunit'];
+ if ($p2pcatchbwunit == "%")
+ $factor = $upbw/100;
+ else
+ $factor = wizard_get_bandwidthtype_scale($p2pcatchbwunit);
+ $remainbw += $p2pcatchbw * $factor;
+ //echo "<br/>".$remainbw . " : hmmm " . floatval($config['ezshaper']['step5']['bandwidth']) ."/".$factor;
} else {
- $p2pcatchall = false;
- $p2pcatchbw = 0;
+ $p2pcatchall = false;
+ $p2pcatchbw = 0;
}
} else {
$p2p = false;
@@ -1051,7 +746,7 @@ $othersplist = array();
$remainbw = round($remainbw / $upbw * 100, 2);
if (intval($remainbw) > 0 && intval($remainbw) > 30) {
- $message=gettext("Custom Bandwidths are greater than 30%. Please lower them for the wizard to continue.");
+ $savemsg=gettext("Custom Bandwidths are greater than 30%. Please lower them for the wizard to continue.");
header("Location: wizard.php?xml=traffic_shaper_wizard_multi_all.xml&stepid=2&message={$message}");
exit;
} else {
@@ -1073,15 +768,13 @@ $othersplist = array();
$tmpcf['bandwidthtype'] = $config['ezshaper']['step2']["conn{$i}uploadspeed"];
}
else if ($sched == "HFSC") {
- $tmpcf['linkshare1'] = $tmpcf['linkshare3'] =
+ $tmpcf['linkshare3'] =
floatval($config['ezshaper']['step2']["conn{$i}upload"]) . $config['ezshaper']['step2']["conn{$i}uploadspeed"];
$tmpcf['upperlimit3'] =
floatval($config['ezshaper']['step2']["conn{$i}upload"]) . $config['ezshaper']['step2']["conn{$i}uploadspeed"];
$tmpcf['upperlimit'] = "on";
- $tmpcf['linkshare2'] = 100;
- //$tmpcf['linkshare1'] = "0b";
$tmpcf['linkshare'] = "on";
$tmpcf['bandwidth'] = floatval($config['ezshaper']['step2']["conn{$i}upload"]);
$tmpcf['bandwidthtype'] = $config['ezshaper']['step2']["conn{$i}uploadspeed"];
@@ -1114,8 +807,6 @@ $othersplist = array();
else if ($sched == "HFSC") {
$lkbw = 0.20 * $remainbw;
$tmpcf['linkshare3'] = "{$lkbw}%";
- $tmpcf['linkshare2'] = 100;
- $tmpcf['linkshare1'] = "0b";
$tmpcf['linkshare'] = "on";
$tmpcf['bandwidth'] = $lkbw;
$tmpcf['bandwidthtype'] = "%";
@@ -1177,8 +868,6 @@ $othersplist = array();
$tmpcf['bandwidthtype'] = $p2pcatchbwunit;
} else if ($sched == "HFSC") {
$tmpcf['linkshare'] = "on";
- $tmpcf['linkshare1'] = "{$p2pcatchbw}{$p2pcatchbwunit}";
- $tmpcf['linkshare2'] = 300;
$tmpcf['linkshare3'] = "{$p2pcatchbw}{$p2pcatchbwunit}";
$tmpcf['upperlimit'] = "on";
$tmpcf['upperlimit3'] = "{$p2pcatchbw}{$p2pcatchbwunit}";
@@ -1195,8 +884,6 @@ $othersplist = array();
} else if ($sched == "HFSC") {
$tmpbw = $remainbw * 0.05; /* 5% bandwidth */
$tmpcf['linkshare'] = "on";
- $tmpcf['linkshare1'] = "{$tmpbw}%";
- $tmpcf['linkshare2'] = 300;
$tmpcf['linkshare3'] = "{$tmpbw}%";
$tmpcf['upperlimit'] = "on";
$tmpcf['upperlimit3'] = "{$tmpbw}%";
@@ -1241,9 +928,7 @@ $othersplist = array();
$tmpcf['realtime3'] = "{$voipbw}%";
}
$tmpcf['realtime'] = "on";
- $tmpcf['realtime2'] = "10";
$tmpcf['bandwidth'] = 32;
- $tmpcf['realtime1'] = "0b";
$tmpcf['bandwidthtype'] = "Kb";
}
array_push($tmppath, "qVoIP");
@@ -1273,8 +958,6 @@ $othersplist = array();
} else if ($sched == "HFSC") {
$gamesbw = $remainbw * 0.2; /* 20% bandwidth */
$tmpcf['linkshare'] = "on";
- $tmpcf['linkshare1'] = "0b";
- $tmpcf['linkshare2'] = "50";
$tmpcf['linkshare3'] = "{$gamesbw}%";
$tmpcf['bandwidth'] = "{$gamesbw}";
$tmpcf['bandwidthtype'] = "%";
@@ -1306,8 +989,6 @@ $othersplist = array();
} else if ($sched == "HFSC") {
$tmpcf['linkshare'] = "on";
$otherbw = $remainbw * 0.1; /* 10% bandwidth */
- $tmpcf['linkshare1'] = "0b";
- $tmpcf['linkshare2'] = 200;
$tmpcf['linkshare3'] = "{$otherbw}%";
$tmpcf['bandwidth'] = $otherbw;
$tmpcf['bandwidthtype'] = "%";
@@ -1343,18 +1024,15 @@ $othersplist = array();
} else if ($sched == "HFSC") {
if ($penalty) {
$tmpcf['linkshare3'] = "{$penaltybw}{$penaltybwunit}";
- $tmpcf['linkshare1'] = "{$penaltybw}{$penaltybwunit}";
$tmpcf['bandwidth'] = $penaltybw;
$tmpcf['bandwidthtype'] = $penaltybwunit;
} else {
$lsbw = $remainbw * 0.05;
- $tmpcf['linkshare1'] = "{$lsbw}%"; /* 5% bandwidth */
$tmpcf['linkshare3'] = "{$lsbw}%"; /* 5% bandwidth */
$tmpcf['bandwidth'] = $lsbw;
$tmpcf['bandwidthtype'] = "%";
}
$tmpcf['linkshare'] = "on";
- $tmpcf['linkshare2'] = 500;
}
array_push($tmppath, "qOthersLow");
$qtmp =& $altq->add_queue($q, &$tmpcf, &$tmppath, $input_errors);
@@ -1466,7 +1144,7 @@ $othersplist = array();
$remainbw = round($remainbw / $lanbw * 100, 2);
if (intval($remainbw) > 0 && intval($remainbw) > 40) {
- $message=gettext("Custom Bandwidths are greater than 30%. Please lower them for the wizard to continue.");
+ $savemsg=gettext("Custom Bandwidths are greater than 30%. Please lower them for the wizard to continue.");
header("Location: wizard.php?xml=traffic_shaper_wizard_multi_all.xml&stepid=2&message={$message}");
exit;
} else {
@@ -1488,11 +1166,9 @@ $othersplist = array();
$tmpcf['bandwidthtype'] = "Kb";
}
else if ($sched == "HFSC") {
- $tmpcf['linkshare1'] = $tmpcf['linkshare3'] = $lanbw/1000 . "Kb";
+ $tmpcf['linkshare3'] = $lanbw/1000 . "Kb";
$tmpcf['upperlimit3'] = $lanbw/1000 . "Kb";
$tmpcf['upperlimit'] = "on";
- $tmpcf['linkshare2'] = 100;
- //$tmpcf['linkshare1'] = "0b";
$tmpcf['linkshare'] = "on";
$tmpcf['bandwidth'] = $lanbw/1000;
$tmpcf['bandwidthtype'] = "Kb";
@@ -1525,8 +1201,6 @@ $othersplist = array();
else if ($sched == "HFSC") {
$lkbw = 0.20 * $remainbw;
$tmpcf['linkshare3'] = "{$lkbw}%";
- $tmpcf['linkshare2'] = 100;
- $tmpcf['linkshare1'] = "0b";
$tmpcf['linkshare'] = "on";
$tmpcf['bandwidth'] = $lkbw;
$tmpcf['bandwidthtype'] = "%";
@@ -1588,8 +1262,6 @@ $othersplist = array();
$tmpcf['bandwidthtype'] = $p2pcatchbwunit;
} else if ($sched == "HFSC") {
$tmpcf['linkshare'] = "on";
- $tmpcf['linkshare1'] = "{$p2pcatchbw}{$p2pcatchbwunit}";
- $tmpcf['linkshare2'] = 300;
$tmpcf['linkshare3'] = "{$p2pcatchbw}{$p2pcatchbwunit}";
$tmpcf['upperlimit'] = "on";
$tmpcf['upperlimit3'] = "{$p2pcatchbw}{$p2pcatchbwunit}";
@@ -1606,8 +1278,6 @@ $othersplist = array();
} else if ($sched == "HFSC") {
$tmpbw = $remainbw * 0.05; /* 5% bandwidth */
$tmpcf['linkshare'] = "on";
- $tmpcf['linkshare1'] = "{$tmpbw}%";
- $tmpcf['linkshare2'] = 300;
$tmpcf['linkshare3'] = "{$tmpbw}%";
$tmpcf['upperlimit'] = "on";
$tmpcf['upperlimit3'] = "{$tmpbw}%";
@@ -1652,9 +1322,7 @@ $othersplist = array();
$tmpcf['realtime3'] = "{$voipbw}%";
}
$tmpcf['realtime'] = "on";
- $tmpcf['realtime2'] = "10";
$tmpcf['bandwidth'] = 32;
- $tmpcf['realtime1'] = "0b";
$tmpcf['bandwidthtype'] = "Kb";
}
array_push($tmppath, "qVoIP");
@@ -1684,8 +1352,6 @@ $othersplist = array();
} else if ($sched == "HFSC") {
$gamesbw = $remainbw * 0.2; /* 20% bandwidth */
$tmpcf['linkshare'] = "on";
- $tmpcf['linkshare1'] = "0b";
- $tmpcf['linkshare2'] = "50";
$tmpcf['linkshare3'] = "{$gamesbw}%";
$tmpcf['bandwidth'] = "{$gamesbw}";
$tmpcf['bandwidthtype'] = "%";
@@ -1717,8 +1383,6 @@ $othersplist = array();
} else if ($sched == "HFSC") {
$tmpcf['linkshare'] = "on";
$otherbw = $remainbw * 0.1; /* 10% bandwidth */
- $tmpcf['linkshare1'] = "0b";
- $tmpcf['linkshare2'] = 200;
$tmpcf['linkshare3'] = "{$otherbw}%";
$tmpcf['bandwidth'] = $otherbw;
$tmpcf['bandwidthtype'] = "%";
@@ -1754,18 +1418,15 @@ $othersplist = array();
} else if ($sched == "HFSC") {
if ($penalty) {
$tmpcf['linkshare3'] = "{$penaltybw}{$penaltybwunit}";
- $tmpcf['linkshare1'] = "{$penaltybw}{$penaltybwunit}";
$tmpcf['bandwidth'] = $penaltybw;
$tmpcf['bandwidthtype'] = $penaltybwunit;
} else {
$lsbw = $remainbw * 0.05;
- $tmpcf['linkshare1'] = "{$lsbw}%"; /* 5% bandwidth */
$tmpcf['linkshare3'] = "{$lsbw}%"; /* 5% bandwidth */
$tmpcf['bandwidth'] = $lsbw;
$tmpcf['bandwidthtype'] = "%";
}
$tmpcf['linkshare'] = "on";
- $tmpcf['linkshare2'] = 500;
}
array_push($tmppath, "qOthersLow");
$qtmp =& $altq->add_queue($q, &$tmpcf, &$tmppath, $input_errors);
diff --git a/usr/local/www/wizards/traffic_shaper_wizard_multi_all.xml b/usr/local/www/wizards/traffic_shaper_wizard_multi_all.xml
index 6bac859..2b42d92 100755
--- a/usr/local/www/wizards/traffic_shaper_wizard_multi_all.xml
+++ b/usr/local/www/wizards/traffic_shaper_wizard_multi_all.xml
@@ -1,12 +1,12 @@
<?xml version="1.0"?>
<pfsensewizard>
- <copyright>/* $Id$ */
-
+ <copyright><![CDATA[
+ /*
traffic_shaper_wizard_multi_all.xml
part of pfSense (http://www.pfsense.org/)
Copyright (C) 2005 Bill Marquette - bill.marquette@gmail.com.
- Copyright (C) 2008 Ermal Luci
+ Copyright (C) 2008-2010 Ermal Luci
All rights reserved.
Redistribution and use in source and binary forms, with or without
@@ -29,7 +29,7 @@
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>
+ */]]></copyright>
<totalsteps>9</totalsteps>
<step>
@@ -160,7 +160,7 @@
<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>
+ <enablefields>Address,Bandwidth,BandwidthSpeed</enablefields>
<bindstofield>ezshaper-&gt;step4-&gt;enable</bindstofield>
</field>
<field>
@@ -173,7 +173,7 @@
</field>
<field>
<name>Address</name>
- <type>input</type>
+ <type>inputalias</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>
diff --git a/usr/local/www/wizards/traffic_shaper_wizard_multi_lan.inc b/usr/local/www/wizards/traffic_shaper_wizard_multi_lan.inc
index 5306c8c..9cdbf46 100644
--- a/usr/local/www/wizards/traffic_shaper_wizard_multi_lan.inc
+++ b/usr/local/www/wizards/traffic_shaper_wizard_multi_lan.inc
@@ -1,12 +1,11 @@
<?php
-/* $Id$ */
/*
- traffic_shaper_wizard.inc
+ traffic_shaper_wizard_multi_lan.inc
part of pfSense (http://www.pfsense.org/)
Copyright (C) 2006 Bill Marquette - bill.marquette@gmail.com.
Copyright (C) 2006 Scott Ullrich - sullrich@pfsense.com.
- Copyright (C) 2008 Ermal Luçi
+ Copyright (C) 2008-2010 Ermal Luçi
All rights reserved.
Redistribution and use in source and binary forms, with or without
@@ -32,52 +31,170 @@
*/
function step1_submitphpaction() {
- if (!isset($_POST['numberofconnections'])) {
- $message=gettext("You need to specify the number of local interfaces connected.");
- header("Location:wizard.php?xml=traffic_shaper_wizard_multi_lan.xml&stepid=0&message={$message}");
- exit;
- }
- if (intval($_POST['numberofconnections']) > 100 || intval($_POST['numberofconnections']) < 1) {
- $message=gettext("The number of local interfaces supported is between 1 and 100.");
- header("Location:wizard.php?xml=traffic_shaper_wizard_multi_lan.xml&stepid=0&message={$message}");
- exit;
- }
+ global $stepid, $savemsg;
+
+ if (!isset($_POST['numberofconnections'])) {
+ $savemsg=gettext("You need to specify the number of local interfaces connected.");
+ $stepid--;
+ }
+ if (intval($_POST['numberofconnections']) < 1) {
+ $savemsg=gettext("The number of local connection needs to be greater than 1.");
+ $stepid--;
+ }
}
function step2_stepbeforeformdisplay() {
- global $config, $pkg;
-
- $numberofinterfaces = 0;
- $iflist = array();
- $iflisttmp = get_configured_interface_with_descr();
- foreach ($iflisttmp as $if => $ifdesc) {
- if (!is_altq_capable(get_real_interface($if)))
- continue;
- $numberofinterfaces++;
- $iflist[$if] = $ifdesc;
- }
- $numberofconnections = intval($config['ezshaper']['step1']['numberofconnections']);
- if ($numberofconnections > $numberofinterfaces) {
- $message=gettext("You do not have {$numberofconnections} of local interfaces!");
- header("Location:wizard.php?xml=traffic_shaper_wizard_multi_lan.xml&stepid=0&message={$message}");
- exit;
- }
+ global $config, $pkg;
+ global $stepid, $savemsg;
+
+ $numberofinterfaces = 0;
+ $iflist = array();
+ $iflisttmp = get_configured_interface_with_descr();
+ foreach ($iflisttmp as $if => $ifdesc) {
+ if (!is_altq_capable(get_real_interface($if)))
+ continue;
+ if ($if == "wan")
+ continue;
+ $numberofinterfaces++;
+ $iflist[$if] = $ifdesc;
+ }
+ $numberofconnections = intval($config['ezshaper']['step1']['numberofconnections']);
+ if ($numberofconnections > $numberofinterfaces) {
+ $savemsg=gettext("You do not have {$numberofconnections} of local interfaces!");
+ $stepid--;
+ return;
+ }
- $fields =& $pkg['step'][1]['fields']['field'];
-
- /*
- unset($config['ezshaper']['step2']);
- $config['ezshaper']['step2'] = array();
- write_config();
- */
- $fields = array();
+ $fields =& $pkg['step'][1]['fields']['field'];
+
+ /*
+ unset($config['ezshaper']['step2']);
+ $config['ezshaper']['step2'] = array();
+ write_config();
+ */
+ $fields = array();
+
+ $field = array();
+ $field['name'] = "Setup WAN(upload) scheduler";
+ $field['type'] = "listtopic";
+ $fields[] = $field;
+ $field = array();
+ $field['name'] = "Upload Scheduler";
+ $field['type'] = "select";
+ $field['typehint'] = "Queueing discipline to apply on the upload of this link.";
+ $field['options']['option'] = array();
+ $opts = array();
+ $opts['name'] = "HFSC";
+ $opts['value'] = "HFSC";
+ $field['options']['option'][] = $opts;
+ $opts = array();
+ $opts['name'] = "CBQ";
+ $opts['value'] = "CBQ";
+ $field['options']['option'][] = $opts;
+ $opts = array();
+ $opts['name'] = "PRIQ";
+ $opts['value'] = "PRIQ";
+ $field['options']['option'][] = $opts;
+ $field['bindstofield'] = "ezshaper->step2->uploadscheduler";
+ $fields[] = $field;
+
+ $field = array();
+ $field['name'] = "Setup link speed details";
+ $field['type'] = "listtopic";
+ $fields[] = $field;
+ $field = array();
+ $field['name'] = "connupload";
+ $field['displayname'] = "Link Upload";
+ $field['type'] = "input";
+ $field['bindstofield'] = "ezshaper->step2->connupload";
+ $field['combinefieldsbegin'] = "true";
+ $fields[] = $field;
+
+ $field = array();
+ $field['combinefieldsend'] = "true";
+ $field['dontdisplayname'] = "true";
+ $field['dontcombinecells'] = "true";
+ $field['name'] = "connuploadspeed";
+ $field['typehint'] = "Upload bandwidth on this connection.";
+ $field['type'] = "select";
+ $field['options']['option'] = array();
+ $opts = array();
+ $opts['value'] = "Kb";
+ $opts['name'] = "Kbit/s";
+ $field['options']['option'][] = $opts;
+ $opts = array();
+ $opts['value'] = "Mb";
+ $opts['name'] = "Mbit/s";
+ $field['options']['option'][] = $opts;
+ $opts = array();
+ $opts['value'] = "Gb";
+ $opts['name'] = "Gbit/s";
+ $field['options']['option'][] = $opts;
+ $field['bindstofield'] = "ezshaper->step2->connuploadspeed";
+ $fields[] = $field;
+
+ $field = array();
+ $field['name'] = "conndownload";
+ $field['displayname'] = "Link Download";
+ $field['type'] = "input";
+ $field['bindstofield'] = "ezshaper->step2->conndownload";
+ $field['combinefieldsbegin'] = "true";
+ $fields[] = $field;
+
+ $field = array();
+ $field['combinefieldsend'] = "true";
+ $field['dontdisplayname'] = "true";
+ $field['dontcombinecells'] = "true";
+ $field['name'] = "conndownloadspeed";
+ $field['typehint'] = "Download bandwidth on this connection.";
+ $field['type'] = "select";
+ $field['options']['option'] = array();
+ $opts = array();
+ $opts['value'] = "Kb";
+ $opts['name'] = "Kbit/s";
+ $field['options']['option'][] = $opts;
+ $opts = array();
+ $opts['value'] = "Mb";
+ $opts['name'] = "Mbit/s";
+ $field['options']['option'][] = $opts;
+ $opts = array();
+ $opts['value'] = "Gb";
+ $opts['name'] = "Gbit/s";
+ $field['options']['option'][] = $opts;
+ $field['bindstofield'] = "ezshaper->step2->conn{$i}downloadspeed";
+ $fields[] = $field;
+
+ for ($i = 0; $i < $numberofconnections; $i++) {
$field = array();
- $field['name'] = "Setup WAN scheduler";
+ $interface_friendly = $i+1;
+ $field['name'] = "Setup connection speed and scheduler information for LAN interface #{$interface_friendly}";
$field['type'] = "listtopic";
$fields[] = $field;
+
$field = array();
- $field['name'] = "Upload Scheduler";
+ $field['name'] = "conn{$i}interface";
+ $field['displayname'] = "LAN interface";
+ $field['type'] = "select";
+ $field['typehint'] = "Interface of this connection.";
+ $field['options']['option'] = array();
+ $ifselect = 0;
+ foreach ($iflist as $ifname => $ifdescr) {
+ if ($ifselect > 0 && $ifselect == ($i + 1))
+ $field['value'] = $ifname;
+ $opts = array();
+ $opts['displayname'] = $ifdescr;
+ $opts['name'] = $ifname;
+ $opts['value'] = $ifname;
+ $field['options']['option'][] = $opts;
+ $ifselect++;
+ }
+ $field['bindstofield'] = "ezshaper->step2->conn{$i}interface";
+ $fields[] = $field;
+
+ $field = array();
+ $field['name'] = "conn{$i}downloadscheduler";
+ $field['displayname'] = "LAN Scheduler";
$field['type'] = "select";
$field['typehint'] = "Queueing discipline to apply on the upload of this connection.";
$field['options']['option'] = array();
@@ -93,165 +210,58 @@ function step2_stepbeforeformdisplay() {
$opts['name'] = "PRIQ";
$opts['value'] = "PRIQ";
$field['options']['option'][] = $opts;
- $field['bindstofield'] = "ezshaper->step2->uploadscheduler";
- $fields[] = $field;
-
- $field = array();
- $field['name'] = "Setup connection speeds";
- $field['type'] = "listtopic";
- $fields[] = $field;
- $field = array();
- $field['name'] = "connupload";
- $field['type'] = "input";
- $field['bindstofield'] = "ezshaper->step2->connupload";
- $field['combinefieldsbegin'] = "true";
- $fields[] = $field;
-
- $field = array();
- $field['combinefieldsend'] = "true";
- $field['dontdisplayname'] = "true";
- $field['dontcombinecells'] = "true";
- $field['name'] = "connuploadspeed";
- $field['typehint'] = "Upload bandwidth on this connection.";
- $field['type'] = "select";
- $field['options']['option'] = array();
- $opts = array();
- $opts['value'] = "Kb";
- $opts['name'] = "Kbit/s";
- $field['options']['option'][] = $opts;
- $opts = array();
- $opts['value'] = "Mb";
- $opts['name'] = "Mbit/s";
- $field['options']['option'][] = $opts;
- $opts = array();
- $opts['value'] = "Gb";
- $opts['name'] = "Gbit/s";
- $field['options']['option'][] = $opts;
- $field['bindstofield'] = "ezshaper->step2->connuploadspeed";
- $fields[] = $field;
-
- $field = array();
- $field['name'] = "conndownload";
- $field['type'] = "input";
- $field['bindstofield'] = "ezshaper->step2->conndownload";
- $field['combinefieldsbegin'] = "true";
- $fields[] = $field;
-
- $field = array();
- $field['combinefieldsend'] = "true";
- $field['dontdisplayname'] = "true";
- $field['dontcombinecells'] = "true";
- $field['name'] = "conndownloadspeed";
- $field['typehint'] = "Download bandwidth on this connection.";
- $field['type'] = "select";
- $field['options']['option'] = array();
- $opts = array();
- $opts['value'] = "Kb";
- $opts['name'] = "Kbit/s";
- $field['options']['option'][] = $opts;
- $opts = array();
- $opts['value'] = "Mb";
- $opts['name'] = "Mbit/s";
- $field['options']['option'][] = $opts;
- $opts = array();
- $opts['value'] = "Gb";
- $opts['name'] = "Gbit/s";
- $field['options']['option'][] = $opts;
- $field['bindstofield'] = "ezshaper->step2->conn{$i}downloadspeed";
- $fields[] = $field;
-
- for ($i = 0; $i < $numberofconnections; $i++) {
-
- $field = array();
- $interface_friendly = $i+1;
- $field['name'] = "Setup connection speed and scheduler information for interface #{$interface_friendly}";
- $field['type'] = "listtopic";
- $fields[] = $field;
-
- $field = array();
- $field['name'] = "conn{$i}interface";
- $field['type'] = "select";
- $field['typehint'] = "Interface of this connection.";
- $field['options']['option'] = array();
- foreach ($iflist as $ifname => $ifdescr) {
- $opts = array();
- $opts['displayname'] = $ifdescr;
- $opts['name'] = $ifname;
- $opts['value'] = $ifname;
- $field['options']['option'][] = $opts;
- }
- $field['bindstofield'] = "ezshaper->step2->conn{$i}interface";
- $fields[] = $field;
-
- $field['name'] = "conn{$i}downloadscheduler";
- $field['type'] = "select";
- $field['typehint'] = "Queueing discipline to apply on the upload of this connection.";
- $field['options']['option'] = array();
- $opts = array();
- $opts['name'] = "HFSC";
- $opts['value'] = "HFSC";
- $field['options']['option'][] = $opts;
- $opts = array();
- $opts['name'] = "CBQ";
- $opts['value'] = "CBQ";
- $field['options']['option'][] = $opts;
- $opts = array();
- $opts['name'] = "PRIQ";
- $opts['value'] = "PRIQ";
- $field['options']['option'][] = $opts;
- $field['bindstofield'] = "ezshaper->step2->conn{$i}downloadscheduler";
- $fields[] = $field;
-
- }
-
- $field = array();
- $field['name'] = "Next";
- $field['type'] = "submit";
+ $field['bindstofield'] = "ezshaper->step2->conn{$i}downloadscheduler";
$fields[] = $field;
+ }
+ $field = array();
+ $field['name'] = "Next";
+ $field['type'] = "submit";
+ $fields[] = $field;
}
function step2_stepsubmitphpaction() {
global $config;
+ global $stepid, $savemsg;
$sumdownloads = 0;
/* Input Validation */
- $steps = intval($config['ezshaper']['step1']['enternumberoflantypeconnections']);
+ $steps = intval($config['ezshaper']['step1']['numberofconnections']);
for ($i = 0; $i < $steps; $i++) {
for ($j = $j; $j < $steps; $j++) {
if ($_POST["conn{$i}interface"] == $_POST["conn{$j}interface"]) {
- $message=gettext("You cannot select the same interface for connections {$i} and {$j}.");
- header("Location: wizard.php?xml=traffic_shaper_wizard_multi_lan.xml&stepid=1&message={$message}");
- exit;
+ $savemsg=gettext("You cannot select the same interface for different LAN #{$i} and LAN #{$j}.");
+ $stepid--;
+ return;
}
}
}
if (!is_numeric($_POST["connupload"])) {
- $message = gettext("Upload bandwidth of connection is not valid.");
- header("Location: wizard.php?xml=traffic_shaper_wizard_multi_lan.xml&stepid=1&message={$message}");
- exit;
+ $savemsg= gettext("Upload bandwidth of connection is not valid.");
+ $stepid--;
+ return;
}
if (!is_numeric($_POST["conndownload"])) {
- $message = gettext("Download bandwidth of connection is not valid.");
- header("Location: wizard.php?xml=traffic_shaper_wizard_multi_lan.xml&stepid=1&message={$message}");
- exit;
+ $savemsg= gettext("Download bandwidth of connection is not valid.");
+ $stepid--;
+ return;
}
$upbw = floatval($_POST["connupload"]);
$downbw = floatval($_POST["conndownload"]);
- if ($upbw == 0 || $downbw = 0) {
- $message = gettext("You cannot specify 0 bandwidth!");
- header("Location: wizard.php?xml=traffic_shaper_wizard_multi_lan.xml&stepid=1&message={$message}");
- exit;
+ if ($upbw < 1 || $downbw < 1) {
+ $savemsg = gettext("You cannot specify bandwidth less than 1!");
+ $stepid--;
+ return;
}
if (intval($upbw) < 128 && $_POST["connuploadspeed"] == "Kb" && trim($_POST["connscheduler"]) == "CBQ") {
- $message=gettext("We do not support Bandwidths smaller than 128Kbit/s for CBQ scheduler.");
- header("Location: wizard.php?xml=traffic_shaper_wizard_multi_lan.xml&stepid=1&message={$message}");
- exit;
+ $savemsg=gettext("We do not support Bandwidths smaller than 128Kbit/s for CBQ scheduler.");
+ $stepid--;
+ return;
}
if ($downbw < 128 && $_POST["conndownloadspeed"] == "Kb" && trim($_POST["downloadscheduler"]) == "CBQ") {
- $message=gettext("We do not support Bandwidths smaller than 128Kbit/s for CBQ scheduler.");
- header("Location: wizard.php?xml=traffic_shaper_wizard_multi_lan.xml&stepid=1&message={$message}");
- exit;
+ $savemsg=gettext("We do not support Bandwidths smaller than 128Kbit/s for CBQ scheduler.");
+ $stepid--;
+ return;
}
/* This is necessary since the wizard expects pecnefined fields. */
@@ -268,22 +278,18 @@ function step2_stepsubmitphpaction() {
$config['ezshaper']['step2']["conn{$i}downloadscheduler"] = $_POST["conn{$i}downloadscheduler"];
$config['ezshaper']['step2']["conn${i}interface"] = $_POST["conn{$i}interface"];
}
-
- /* Not needed, called by wizard.php */
-// write_config();
}
function step3_stepsubmitphpaction() {
global $config;
+ global $stepid, $savemsg;
if($_POST['address']) {
- if(!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_multi_lan.xml&stepid=2&message={$message}");
- exit;
- }
+ if(!is_ipaddroralias($_POST['address'])) {
+ /* item is not an ip or alias. error out */
+ $savemsg=gettext("Address must be a valid IP address or Firewall Alias. Please correct this value to continue.");
+ $stepid--;
+ return;
}
}
@@ -291,81 +297,85 @@ function step3_stepsubmitphpaction() {
for ($i = 0; $i < $steps; $i++) {
if ($_POST["connupload"]) {
if (!is_numeric($_POST["connupload"])) {
- $message = gettext("Upload bandwidth of connection {$i} is not valid.");
- header("Location: wizard.php?xml=traffic_shaper_wizard_multi_lan.xml&stepid=2&message={$message}");
- exit;
- }
+ $savemsg = gettext("Upload bandwidth of connection {$i} is not valid.");
+ $stepid--;
+ return;
+ }
$factor = wizard_get_bandwidthtype_scale($config['ezshaper']['step2']["conn{$i}uploadspeed"]);
$ifbw = $factor * floatval($config['ezshaper']['step2']["conn{$i}upload"]);
$factor = wizard_get_bandwidthtype_scale($_POST["conn{$i}uploadspeed"]);
$input_bw = $factor * floatval($_POST["conn{$i}upload"]);
if ((0.8 * $ifbw) < $input_bw) {
- $message=gettext("You cannot set the VoIP upload bandwidth on connection {$i} higher than 80% of the connection.");
- header("Location: wizard.php?xml=traffic_shaper_wizard_multi_lan.xml&stepid=2&message={$message}");
- exit;
+ $savemsg=gettext("You cannot set the VoIP upload bandwidth on connection {$i} higher than 80% of the connection.");
+ $stepid--;
+ return;
}
}
}
}
function step4_stepsubmitphpaction() {
- global $config;
-
- if ( $_POST['enable'] ) {
- if(!$_POST['bandwidth']) {
- $message="You need to specify a value for bandwidth!";
- header("Location: wizard.php?xml=traffic_shaper_wizard_multi_lan.xml&stepid=3&message={$message}");
- exit;
- }
- if(!is_numeric($_POST['bandwidth'])) {
- $message="The posted value is not a valid bandwidth.";
- header("Location: wizard.php?xml=traffic_shaper_wizard_multi_lan.xml&stepid=3&message={$message}");
- exit;
- }
+ global $config;
+ global $stepid, $savemsg;
- if ($_POST['bandwidthspeed'] <> "%") {
- $message = gettext("Only percentage bandwidth specification is allowed.");
- header("Location: wizard.php?xml=traffic_shaper_wizard_multi_lan.xml&stepid=3&message={$message}");
- exit;
- }
- $bw = $_POST['bandwidth'];
- if($bw > 15 && $bw < 2) {
- $message="Values should be between 2% and 15%!";
- header("Location: wizard.php?xml=traffic_shaper_wizard_multi_lan.xml&stepid=3&message={$message}");
- exit;
- }
+ if ( $_POST['enable'] ) {
+ if(!$_POST['bandwidth']) {
+ $savemsg="You need to specify a value for bandwidth!";
+ $stepid--;
+ return;
+ }
+ if(!is_numeric($_POST['bandwidth'])) {
+ $savemsg="The posted value is not a valid bandwidth.";
+ $stepid--;
+ return;
+ }
- 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_multi_lan.xml&stepid=3&message={$message}");
- }
- }
+ if ($_POST['bandwidthspeed'] <> "%") {
+ $savemsg = gettext("Only percentage bandwidth specification is allowed.");
+ $stepid--;
+ return;
+ }
+ $bw = $_POST['bandwidth'];
+ if($bw > 15 && $bw < 2) {
+ $savemsg="Values should be between 2% and 15%!";
+ $stepid--;
+ return;
}
+ if($_POST['address']) {
+ if(!is_ipaddroralias($_POST['address'])) {
+ /* item is not an ip or alias. error out */
+ $savemsg=gettext("Address must be a valid IP address or Firewall Alias. Please correct this value to continue.");
+ $stepid--;
+ return;
+ }
+ }
+ }
}
function step5_stepsubmitphpaction() {
+ global $stepid, $savemsg;
+
if ( $_POST['enable'] ) {
if (isset($_POST['bandwidth']) && $_POST['bandwidth'] <> "") {
if(!is_numeric($_POST['bandwidth'])) {
- $message="Posted value is not a valid bandwidth.";
- header("Location: wizard.php?xml=traffic_shaper_wizard_multi_lan.xml&stepid=4&message={$message}");
+ $savemsg="Posted value is not a valid bandwidth.";
+ $stepid--;
+ return;
}
if ($_POST['bandwidthspeed'] <> "%") {
- $message = gettext("Only percentage bandwidth specification is allowed.");
- header("Location: wizard.php?xml=traffic_shaper_wizard_multi_lan.xml&stepid=4&message={$message}");
- exit;
+ $savemsg = gettext("Only percentage bandwidth specification is allowed.");
+ $stepid--;
+ return;
}
$bw = $_POST['bandwidth'];
if($bw > 15 && $bw < 2) {
- $message="Values should be between 2% and 15%!";
- header("Location: wizard.php?xml=traffic_shaper_wizard_multi_lan.xml&stepid=3&message={$message}");
- exit;
+ $savemsg="Values should be between 2% and 15%!";
+ $stepid--;
+ return;
}
- }
+ }
}
}
@@ -398,329 +408,18 @@ function step9_stepsubmitphpaction() {
}
function apply_all_choosen_items() {
- global $config, $g, $altq_list_queues;
-
- $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');
-
- $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');
-
- $gamesplist['deltaforce'] = array();
- /* delta force */
- $gamesplist['deltaforce'][] = array('Delta1', 'udp', '17478', '17488', 'both');
-
- $gamesplist['quakeiii'] = array();
- /* 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');
-
- $gamesplist['callofduty'] = array();
- $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');
-
- $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');
-
- $gamesplist['unrealtournament'] = array();
- /* 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');
-
- $gamesplist['empireearth'] = array();
- /* 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');
-
- $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');
-
- $gamesplist['farcry'] = array();
- /* 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');
-
- $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');
-
- $gamesplist['wolfet'] = array();
- /* 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');
-
- $gamesplist['battlenet'] = array();
- /* Blizzard Publishing games */
- $gamesplist['battlenet'][] = array('Battle.NET', 'tcp', '6112', '6119', 'both');
- $gamesplist['battlenet'][] = array('Battle.NET-2', 'tcp', '1119', '1119', 'both');
-
- $gamesplist['worldofwarcraft'] = array();
- $gamesplist[] = array('WoW', 'tcp', '3724', '3724', 'both');
-
- $gamesplist['battlenet'] = array();
- /* Add battle.net only if WoW is selected and battle.net isn't */
- $gamesplist[] = array('Battle.NET', 'tcp', '6112', '6119', 'both');
-
- $gamesplist['gunzonline'] = array();
- /* GunZ Online */
- $gamesplist['gunzonline'][] = array('GunZOnline', 'udp', '7700', '7700', 'both');
-
- $gamesplist['xbox360'] = array();
- /* 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');
-
- /* VoicePulse server */
- $voiplist['VoicePulse'] = array();
- $voiplist['VoicePulse'][] = array('VoicePulse', 'udp', '16384', '16482', 'both');
- $voiplist['VoicePulse'][] = array('VoicePulse', 'udp', '4569', '4569', 'both');
-
- /* Panasonic Hybrid PBX */
- $voiplist['Panasonic'] = array();
- $voiplist['Panasonic'][] = array('Panasonic1', 'udp', '8000', '8063', 'both');
- $voiplist['Panasonic'][] = array('Panasonic2', 'udp', '9300', '9301', 'both');
- $voiplist['Panasonic'][] = array('Panasonic3', 'udp', '2747', '2747', 'both');
-
-
- $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');
-
- $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['slingbox'] = array();
- $othersplist['slingbox'][] = array('Slingbox1', 'tcp', '5001', '5001', 'both');
- $othersplist['slingbox'][] = array('Slingbox2', 'udp', '5001', '5001', 'both');
+ global $config, $g, $altq_list_queues, $gamesplist;
+
+ require_once("wizardapp.inc");
/*
* Wipe previous config.
* Doing it here makes sense since we can wipe the previous config only after
* the user decides to do so, finishing the wizard.
*/
- if(isset($config['shaper']['queue']))
+ if (isset($config['shaper']['queue']))
unset($config['shaper']['queue']);
- /* XXX: This is ecnundant, because this should be handled by converter at startup. */
+ /* XXX: This is redundant, because this should be handled by converter at startup. */
if(isset($config['shaper']['rule']))
unset($config['shaper']['rule']);
foreach ($config['filter']['rule'] as $key => $rule)
@@ -731,7 +430,7 @@ function apply_all_choosen_items() {
unset($altq_list_queues);
$altq_list_queues = array();
- $steps = floatval($config['ezshaper']['step1']['enternumberoflantypeconnections']);
+ $steps = floatval($config['ezshaper']['step1']['numberofconnections']);
for ($i = 0; $i < $steps; $i++) {
$tmppath = array();
@@ -845,14 +544,12 @@ function apply_all_choosen_items() {
$tmpcf['bandwidth'] = floatval($config['ezshaper']['step2']["conndownload"]);
$tmpcf['bandwidthtype'] = $config['ezshaper']['step2']["conndownloadspeed"];
} else if ($sched == "HFSC") {
- $tmpcf['linkshare1'] = $tmpcf['linkshare3'] =
+ $tmpcf['linkshare3'] =
floatval($config['ezshaper']['step2']["conndownload"]) . $config['ezshaper']['step2']["conndownloadspeed"];
$tmpcf['upperlimit'] = "on";
$tmpcf['upperlimit3'] =
floatval($config['ezshaper']['step2']["conndownload"]) . $config['ezshaper']['step2']["conndownloadspeed"];
- $tmpcf['linkshare2'] = 100;
- //$tmpcf['linkshare1'] = "0b";
$tmpcf['linkshare'] = "on";
$tmpcf['bandwidth'] = floatval($config['ezshaper']['step2']["conndownload"]);
$tmpcf['bandwidthtype'] = $config['ezshaper']['step2']["conndownloadspeed"];
@@ -887,8 +584,6 @@ function apply_all_choosen_items() {
else if ($sched == "HFSC") {
$lkbw = 0.20 * $remainbw;
$tmpcf['linkshare3'] = "{$lkbw}%";
- $tmpcf['linkshare2'] = 100;
- $tmpcf['linkshare1'] = "0b";
$tmpcf['linkshare'] = "on";
$tmpcf['bandwidth'] = $lkbw;
$tmpcf['bandwidthtype'] = "%";
@@ -950,8 +645,6 @@ function apply_all_choosen_items() {
$tmpcf['bandwidthtype'] = $p2pcatchbwunit;
} else if ($sched == "HFSC") {
$tmpcf['linkshare'] = "on";
- $tmpcf['linkshare1'] = "{$p2pcatchbw}{$p2pcatchbwunit}";
- $tmpcf['linkshare2'] = 300;
$tmpcf['linkshare3'] = "{$p2pcatchbw}{$p2pcatchbwunit}";
$tmpcf['upperlimit'] = "on";
$tmpcf['upperlimit3'] = "{$p2pcatchbw}{$p2pcatchbwunit}";
@@ -968,8 +661,6 @@ function apply_all_choosen_items() {
} else if ($sched == "HFSC") {
$tmpbw = $remainbw * 0.05; /* 5% bandwidth */
$tmpcf['linkshare'] = "on";
- $tmpcf['linkshare1'] = "{$tmpbw}%";
- $tmpcf['linkshare2'] = 300;
$tmpcf['linkshare3'] = "{$tmpbw}%";
$tmpcf['upperlimit'] = "on";
$tmpcf['upperlimit3'] = "{$tmpbw}%";
@@ -1014,9 +705,7 @@ function apply_all_choosen_items() {
$tmpcf['realtime3'] = "{$voipbw}%";
}
$tmpcf['realtime'] = "on";
- $tmpcf['realtime2'] = "10";
$tmpcf['bandwidth'] = 32;
- $tmpcf['realtime1'] = "0b";
$tmpcf['bandwidthtype'] = "Kb";
}
array_push($tmppath, "qVoIP");
@@ -1046,8 +735,6 @@ function apply_all_choosen_items() {
} else if ($sched == "HFSC") {
$gamesbw = $remainbw * 0.2; /* 20% bandwidth */
$tmpcf['linkshare'] = "on";
- $tmpcf['linkshare1'] = "0b";
- $tmpcf['linkshare2'] = "50";
$tmpcf['linkshare3'] = "{$gamesbw}%";
$tmpcf['bandwidth'] = "{$gamesbw}";
$tmpcf['bandwidthtype'] = "%";
@@ -1079,8 +766,6 @@ function apply_all_choosen_items() {
} else if ($sched == "HFSC") {
$tmpcf['linkshare'] = "on";
$otherbw = $remainbw * 0.1; /* 10% bandwidth */
- $tmpcf['linkshare1'] = "0b";
- $tmpcf['linkshare2'] = 200;
$tmpcf['linkshare3'] = "{$otherbw}%";
$tmpcf['bandwidth'] = $otherbw;
$tmpcf['bandwidthtype'] = "%";
@@ -1114,18 +799,15 @@ function apply_all_choosen_items() {
} else if ($sched == "HFSC") {
if ($penalty) {
$tmpcf['linkshare3'] = "{$penaltybw}{$penaltybwunit}";
- $tmpcf['linkshare1'] = "{$penaltybw}{$penaltybwunit}";
$tmpcf['bandwidth'] = $penaltybw;
$tmpcf['bandwidthtype'] = $penaltybwunit;
} else {
$lsbw = $remainbw * 0.05;
- $tmpcf['linkshare1'] = "{$lsbw}%"; /* 5% bandwidth */
$tmpcf['linkshare3'] = "{$lsbw}%"; /* 5% bandwidth */
$tmpcf['bandwidth'] = $lsbw;
$tmpcf['bandwidthtype'] = "%";
}
$tmpcf['linkshare'] = "on";
- $tmpcf['linkshare2'] = 500;
}
array_push($tmppath, "qOthersLow");
$qtmp =& $altq->add_queue($q, &$tmpcf, &$tmppath, $input_errors);
@@ -1258,8 +940,6 @@ function apply_all_choosen_items() {
else if ($sched == "HFSC") {
$lkbw = 0.20 * $remainbw;
$tmpcf['linkshare3'] = "{$lkbw}%";
- $tmpcf['linkshare2'] = 100;
- $tmpcf['linkshare1'] = "0b";
$tmpcf['linkshare'] = "on";
$tmpcf['bandwidth'] = $lkbw;
$tmpcf['bandwidthtype'] = "%";
@@ -1322,8 +1002,6 @@ function apply_all_choosen_items() {
$tmpcf['bandwidthtype'] = $p2pcatchbwunit;
} else if ($sched == "HFSC") {
$tmpcf['linkshare'] = "on";
- $tmpcf['linkshare1'] = "{$p2pcatchbw}{$p2pcatchbwunit}";
- $tmpcf['linkshare2'] = 300;
$tmpcf['linkshare3'] = "{$p2pcatchbw}{$p2pcatchbwunit}";
$tmpcf['upperlimit'] = "on";
$tmpcf['upperlimit3'] = "{$p2pcatchbw}{$p2pcatchbwunit}";
@@ -1340,8 +1018,6 @@ function apply_all_choosen_items() {
} else if ($sched == "HFSC") {
$tmpbw = $remainbw * 0.05; /* 5% bandwidth */
$tmpcf['linkshare'] = "on";
- $tmpcf['linkshare1'] = "{$tmpbw}%";
- $tmpcf['linkshare2'] = 300;
$tmpcf['linkshare3'] = "{$tmpbw}%";
$tmpcf['upperlimit'] = "on";
$tmpcf['upperlimit3'] = "{$tmpbw}%";
@@ -1386,9 +1062,7 @@ function apply_all_choosen_items() {
$tmpcf['realtime3'] = "{$voipbw}%";
}
$tmpcf['realtime'] = "on";
- $tmpcf['realtime2'] = "10";
$tmpcf['bandwidth'] = 32;
- $tmpcf['realtime1'] = "0b";
$tmpcf['bandwidthtype'] = "Kb";
}
array_push($tmppath, "qVoIP");
@@ -1418,8 +1092,6 @@ function apply_all_choosen_items() {
} else if ($sched == "HFSC") {
$gamesbw = $remainbw * 0.2; /* 20% bandwidth */
$tmpcf['linkshare'] = "on";
- $tmpcf['linkshare1'] = "0b";
- $tmpcf['linkshare2'] = "50";
$tmpcf['linkshare3'] = "{$gamesbw}%";
$tmpcf['bandwidth'] = "{$gamesbw}";
$tmpcf['bandwidthtype'] = "%";
@@ -1451,8 +1123,6 @@ function apply_all_choosen_items() {
} else if ($sched == "HFSC") {
$tmpcf['linkshare'] = "on";
$otherbw = $remainbw * 0.1; /* 10% bandwidth */
- $tmpcf['linkshare1'] = "0b";
- $tmpcf['linkshare2'] = 200;
$tmpcf['linkshare3'] = "{$otherbw}%";
$tmpcf['bandwidth'] = $otherbw;
$tmpcf['bandwidthtype'] = "%";
@@ -1486,18 +1156,15 @@ function apply_all_choosen_items() {
} else if ($sched == "HFSC") {
if ($penalty) {
$tmpcf['linkshare3'] = "{$penaltybw}{$penaltybwunit}";
- $tmpcf['linkshare1'] = "{$penaltybw}{$penaltybwunit}";
$tmpcf['bandwidth'] = $penaltybw;
$tmpcf['bandwidthtype'] = $penaltybwunit;
} else {
$lsbw = $remainbw * 0.05;
- $tmpcf['linkshare1'] = "{$lsbw}%"; /* 5% bandwidth */
$tmpcf['linkshare3'] = "{$lsbw}%"; /* 5% bandwidth */
$tmpcf['bandwidth'] = $lsbw;
$tmpcf['bandwidthtype'] = "%";
}
$tmpcf['linkshare'] = "on";
- $tmpcf['linkshare2'] = 500;
}
array_push($tmppath, "qOthersLow");
$qtmp =& $altq->add_queue($q, &$tmpcf, &$tmppath, $input_errors);
diff --git a/usr/local/www/wizards/traffic_shaper_wizard_multi_lan.xml b/usr/local/www/wizards/traffic_shaper_wizard_multi_lan.xml
index 0b0a6be..f97932b 100644
--- a/usr/local/www/wizards/traffic_shaper_wizard_multi_lan.xml
+++ b/usr/local/www/wizards/traffic_shaper_wizard_multi_lan.xml
@@ -1,12 +1,12 @@
<?xml version="1.0"?>
<pfsensewizard>
- <copyright>/* $Id$ */
-
+ <copyright><![CDATA[
+ /*
traffic_shaper_wizard_multi_lan.xml
part of pfSense (http://www.pfsense.org/)
Copyright (C) 2005 Bill Marquette - bill.marquette@gmail.com.
- Copyright (C) 2008 Ermal Luci
+ Copyright (C) 2008-2010 Ermal Luci
All rights reserved.
Redistribution and use in source and binary forms, with or without
@@ -29,7 +29,7 @@
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>
+ */]]></copyright>
<totalsteps>9</totalsteps>
<step>
@@ -80,6 +80,7 @@
<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>
+ <enablefields>provider,address,downloadspeed,downloadspeedunit,uploadspeed,uploadspeedunit</enablefields>
</field>
<field>
<name>Next</name>
@@ -208,7 +209,7 @@
<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>
+ <enablefields>address,bandwidth,bandwidthspeed</enablefields>
<bindstofield>ezshaper-&gt;step4-&gt;enable</bindstofield>
</field>
<field>
@@ -221,7 +222,7 @@
</field>
<field>
<name>Address</name>
- <type>input</type>
+ <type>inputalias</type>
<description>This allows you to just provide the IP address of the computer(s) to 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>
diff --git a/usr/local/www/xmlrpc.php b/usr/local/www/xmlrpc.php
index d7b7e88..93ce802 100755
--- a/usr/local/www/xmlrpc.php
+++ b/usr/local/www/xmlrpc.php
@@ -155,7 +155,14 @@ $restore_config_section_sig = array(
function restore_config_section_xmlrpc($raw_params) {
global $config, $xmlrpc_g;
$params = xmlrpc_params_to_php($raw_params);
- if(!xmlrpc_auth($params)) return $xmlrpc_g['return']['authfail'];
+ if(!xmlrpc_auth($params))
+ return $xmlrpc_g['return']['authfail'];
+ if (isset($params[0]['virtualip'])) {
+ if(is_array($config['virtualip']['vip'])) {
+ foreach ($config['virtualip']['vip'] as $vip)
+ interface_vip_bring_down($vip);
+ }
+ }
$config = array_merge($config, $params[0]);
$mergedkeys = implode(",", array_keys($params[0]));
write_config(sprintf(gettext("Merged in config (%s sections) from XMLRPC client."),$mergedkeys));
@@ -201,7 +208,14 @@ $merge_config_section_sig = array(
function merge_config_section_xmlrpc($raw_params) {
global $config, $xmlrpc_g;
$params = xmlrpc_params_to_php($raw_params);
- if(!xmlrpc_auth($params)) return $xmlrpc_g['return']['authfail'];
+ if(!xmlrpc_auth($params))
+ return $xmlrpc_g['return']['authfail'];
+ if (isset($params[0]['virtualip'])) {
+ if(is_array($config['virtualip']['vip'])) {
+ foreach ($config['virtualip']['vip'] as $vip)
+ interface_vip_bring_down($vip);
+ }
+ }
$config = array_merge_recursive_unique($config, $params[0]);
$mergedkeys = implode(",", array_keys($params[0]));
write_config("Merged in config ({$mergedkeys} sections) from XMLRPC client.");
@@ -248,7 +262,6 @@ function interfaces_carp_configure_xmlrpc($raw_params) {
global $xmlrpc_g;
$params = xmlrpc_params_to_php($raw_params);
if(!xmlrpc_auth($params)) return $xmlrpc_g['return']['authfail'];
- interfaces_carp_setup();
interfaces_vips_configure();
return $xmlrpc_g['return']['true'];
}
OpenPOWER on IntegriCloud