diff --git a/src/opnsense/mvc/app/models/OPNsense/Base/Menu/Menu.xml b/src/opnsense/mvc/app/models/OPNsense/Base/Menu/Menu.xml index 08dd158d2..a20626aa0 100644 --- a/src/opnsense/mvc/app/models/OPNsense/Base/Menu/Menu.xml +++ b/src/opnsense/mvc/app/models/OPNsense/Base/Menu/Menu.xml @@ -73,7 +73,6 @@ - diff --git a/src/opnsense/mvc/app/models/OPNsense/Core/ACL_Legacy_Page_Map.json b/src/opnsense/mvc/app/models/OPNsense/Core/ACL_Legacy_Page_Map.json index cfbadc415..3b9ec5e49 100644 --- a/src/opnsense/mvc/app/models/OPNsense/Core/ACL_Legacy_Page_Map.json +++ b/src/opnsense/mvc/app/models/OPNsense/Core/ACL_Legacy_Page_Map.json @@ -456,13 +456,6 @@ "firewall_shaper_queues.php*" ] }, - "page-firewall-trafficshaper-wizard": { - "name": "WebCfg - Firewall: Traffic Shaper: Wizard page", - "descr": "Allow access to the 'Firewall: Traffic Shaper: Wizard' page.", - "match": [ - "firewall_shaper_wizards.php*" - ] - }, "page-firewall-virtualipaddress-edit": { "name": "WebCfg - Firewall: Virtual IP Address: Edit page", "descr": "Allow access to the 'Firewall: Virtual IP Address: Edit' page.", diff --git a/src/www/firewall_shaper.php b/src/www/firewall_shaper.php index 2bee8fe97..fd3154ff5 100644 --- a/src/www/firewall_shaper.php +++ b/src/www/firewall_shaper.php @@ -408,7 +408,6 @@ include("fbegin.inc"); $tab_array = array(); $tab_array[0] = array(gettext("By Interface"), true, "firewall_shaper.php"); $tab_array[1] = array(gettext("By Queue"), false, "firewall_shaper_queues.php"); - $tab_array[4] = array(gettext("Wizards"), false, "firewall_shaper_wizards.php"); display_top_tabs($tab_array); ?> diff --git a/src/www/firewall_shaper_queues.php b/src/www/firewall_shaper_queues.php index ba845419f..fe2ee9ffa 100644 --- a/src/www/firewall_shaper_queues.php +++ b/src/www/firewall_shaper_queues.php @@ -190,7 +190,6 @@ include("head.inc"); $tab_array = array(); $tab_array[0] = array(gettext("By Interface"), false, "firewall_shaper.php"); $tab_array[1] = array(gettext("By Queue"), true, "firewall_shaper_queues.php"); - $tab_array[4] = array(gettext("Wizards"), false, "firewall_shaper_wizards.php"); display_top_tabs($tab_array); ?> diff --git a/src/www/firewall_shaper_wizards.php b/src/www/firewall_shaper_wizards.php deleted file mode 100644 index 4b6c28b69..000000000 --- a/src/www/firewall_shaper_wizards.php +++ /dev/null @@ -1,142 +0,0 @@ - "") { - killbyname('pfctl'); - exit; -} - -if ($_POST['apply']) { - write_config(); - - $retval = 0; - /* Setup pf rules since the user may have changed the optimization value */ - $retval = filter_configure(); - $savemsg = get_std_save_message($retval); - if (stristr($retval, "error") <> true) - $savemsg = get_std_save_message($retval); - else - $savemsg = $retval; - - /* reset rrd queues */ - mwexec('/bin/rm /var/db/rrd/*queuedrops.rrd'); - mwexec('/bin/rm /var/db/rrd/*queues.rrd'); - enable_rrd_graphing(); - - clear_subsystem_dirty('shaper'); -} - -$pgtitle = array(gettext("Firewall"),gettext("Queues"),gettext("Wizards")); -$shortcut_section = "trafficshaper"; - -$wizards = array( - gettext("Multiple Lan/Wan") => "traffic_shaper_wizard_multi_all.xml", - gettext("Dedicated Links") => "traffic_shaper_wizard_dedicated.xml", -); - -$closehead = false; -include("head.inc"); -?> - - - - - - -
-
-
- - - - -

- ".gettext("You must apply the changes in order for them to take effect."));?>

- - -
- - - - -
- -
- - -
- - - - - - - - - $wizard): - ?> - - - - - -
- - - " .$wizard . ""; - ?> -
-
-
-
-
-
-
-
- - diff --git a/src/www/wizards/traffic_shaper_wizard_dedicated.inc b/src/www/wizards/traffic_shaper_wizard_dedicated.inc deleted file mode 100644 index 0124b7875..000000000 --- a/src/www/wizards/traffic_shaper_wizard_dedicated.inc +++ /dev/null @@ -1,1654 +0,0 @@ - $ifdesc) { - if (!is_altq_capable(get_real_interface($if))) - continue; - if (interface_has_gateway($if) || interface_has_gatewayv6($if)) - $wans++; - else - $lans++; - } - - foreach ($fields as &$field) - if ($field['name'] == 'numberofconnections') - $field['value'] = ($wans < $lans ? $wans : $lans); -} - -function step1_submitphpaction() { - 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; - global $stepid, $savemsg; - - $wans = 0; - $lans = 0; - $iflist = array(); - $iflisttmp = get_configured_interface_with_descr(); - foreach ($iflisttmp as $if => $ifdesc) { - if (!is_altq_capable(get_real_interface($if))) - continue; - if (interface_has_gateway($if) || interface_has_gatewayv6($if)) - $wans++; - else - $lans++; - $iflist[$if] = $ifdesc; - } - $numberofconnections = intval($config['ezshaper']['step1']['numberofconnections']); - if ($numberofconnections > ($wans < $lans ? $wans : $lans)) { - $savemsg=gettext("You have less interfaces than number of connections!"); - $stepid--; - return; - } - - $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(); - $linknum = $i+1; - $ifsel = ($i * 2); - $field['name'] = "Connection #{$linknum} parameters"; - $field['type'] = "listtopic"; - $fields[] = $field; - - $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) { - // Skip wan interfaces here - if (interface_has_gateway($ifname) || interface_has_gatewayv6($ifname)) - continue; - if ($ifcnt == ($ifsel + 1)) - $field['value'] = $ifname; - $opts = array(); - $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) { - // Skip lan interfaces here - if (!interface_has_gateway($ifname) && !interface_has_gatewayv6($ifname)) - continue; - if ($ifcnt == $ifsel) - $field['value'] = $ifname; - $opts = array(); - $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['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"]) { - $savemsg=gettext("You cannot select the same interface for connections {$i} and {$j}."); - $stepid--; - return; - } - if (trim($_POST["conn{$i}uploadscheduler"]) != "PRIQ") { - 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}uploadscheduler"]) == "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. */ - unset($config['ezshaper']['step2']); - $config['ezshaper']['step2'] = array(); - - for ($i = 0; $i < $steps; $i++) { - $config['ezshaper']['step2']["local{$i}downloadscheduler"] = $_POST["local{$i}downloadscheduler"]; - $config['ezshaper']['step2']["local{$i}interface"] = $_POST["local{$i}interface"]; - $config['ezshaper']['step2']["conn{$i}uploadscheduler"] = $_POST["conn{$i}uploadscheduler"]; - $config['ezshaper']['step2']["conn{$i}upload"] = $_POST["conn{$i}upload"]; - $config['ezshaper']['step2']["conn{$i}uploadspeed"] = $_POST["conn{$i}uploadspeed"]; - $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['displayname'] = "Upstream SIP Server"; - $field['name'] = "upstream_sip_server"; - $enablefields[] = "upstream_sip_server"; - $field['type'] = "inputalias"; - $field['description'] = "(Optional) If this is chosen, the provider field will be overridden. This allows you to provide the IP address of the remote PBX or SIP Trunk 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; - - $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; - - $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['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['enable']) - 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; - } - } - - $steps = intval($config['ezshaper']['step1']['numberofconnections']); - for ($i = 0; $i < $steps; $i++) { - if ($config['ezshaper']['step2']["conn{$i}uploadscheduler"] != "PRIQ") { - if (!is_numeric($_POST["conn{$i}upload"])) { - $savemsg = gettext("Upload bandwidth of connection {$i} is not valid."); - $stepid--; - return; - } - if ($_POST["conn{$i}uploadspeed"] == "%") { - if (intval($_POST["conn{$i}upload"]) > 80) { - $savemsg=gettext("You cannot set the VoIP upload bandwidth on connection {$i} higher than 80% of the connection."); - $stepid--; - return; - } - } else { - $factor = wizard_get_bandwidthtype_scale($config['ezshaper']['step2']["conn{$i}uploadspeed"]); - $ifbw = $factor * floatval($config['ezshaper']['step2']["conn{$i}upload"]); - $factor = wizard_get_bandwidthtype_scale($_POST["conn{$i}uploadspeed"]); - $input_bw = $factor * floatval($_POST["conn{$i}upload"]); - if ((0.8 * $ifbw) < $input_bw) { - $savemsg=gettext("You cannot set the VoIP upload bandwidth on connection {$i} higher than 80% of the connection."); - $stepid--; - return; - } - } - } - - if ($config['ezshaper']['step2']["local{$i}downloadscheduler"] != "PRIQ") { - if (!is_numeric($_POST["local{$i}download"])) { - $savemsg = gettext("Download bandwidth of connection {$i} is not valid."); - $stepid--; - return; - } - if ($_POST["local{$i}downloadspeed"] == "%") { - if (intval($_POST["local{$i}download"]) > 80) { - $savemsg=gettext("You cannot set the VoIP upload bandwidth on connection {$i} higher than 80% of the connection."); - $stepid--; - return; - } - } else { - $factor = wizard_get_bandwidthtype_scale($config['ezshaper']['step2']["conn{$i}downloadspeed"]); - $ifbw = $factor * floatval($config['ezshaper']['step2']["conn{$i}download"]); - $factor = wizard_get_bandwidthtype_scale($_POST["local{$i}downloadspeed"]); - $input_bw = $factor * floatval($_POST["local{$i}download"]); - if ((0.8 * $ifbw) < $input_bw) { - $savemsg=gettext("You cannot set the VoIP download bandwidth on connection {$i} higher than 80% of the connection."); - $stepid--; - return; - } - } - } - } - - for ($i = 0; $i < $steps; $i++) { - $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"]; - } -} - -function step4_stepsubmitphpaction() { - global $config; - global $stepid, $savemsg; - - 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 ($_POST['p2pcatchall']) { - if(!is_numeric($_POST['bandwidth'])) { - $savemsg="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; - } - } - } -} - -function step8_stepsubmitphpaction() { - global $g, $config; - - /* 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(); - - /* apply the new configuration to the system */ - filter_configure(); - - /* And we're no longer dirty! */ - clear_subsystem_dirty('shaper'); - - update_filter_reload_status("Initializing"); - header("Location: status_filter_reload.php"); - exit; -} - -function apply_all_choosen_items() { - global $config, $g, $altq_list_queues, $gamesplist, $voiplist, $othersplist, $p2plist; - - 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'])) - unset($config['shaper']['queue']); - /* XXX: This is ecnundant, 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) - if ($rule['wizard'] == "yes") - unset($config['filter']['rule'][$key]); - - /* restart the cached config */ - unset($altq_list_queues); - $altq_list_queues = array(); - - $steps = intval($config['ezshaper']['step1']['numberofconnections']); - - $interfacelist = array(); - - for ($i = 0; $i < $steps; $i++) { - - $tmppath = array(); - $altq =& new altq_root_queue(); - - $altq->SetInterface($config['ezshaper']['step2']["conn{$i}interface"]); - $interfacelist[] = $config['ezshaper']['step2']["conn{$i}interface"]; - $altq->SetScheduler($config['ezshaper']['step2']["conn{$i}uploadscheduler"]); - $altq->SetBandwidth(floatval($config['ezshaper']['step2']["conn{$i}upload"])); - $altq->SetBwscale($config['ezshaper']['step2']["conn{$i}uploadspeed"]); - $altq->SetEnabled("on"); - $altq_list_queues[$altq->GetQname()] =& $altq; - array_push($tmppath, $config['ezshaper']['step2']["conn{$i}interface"]); - $altq->SetLink($tmppath); - $altq->wconfig(); - - $sched = $config['ezshaper']['step2']["conn{$i}uploadscheduler"]; - $voipbw =0; - $voipbwunit = "Kb"; - $voip = false; - $penalty = false; - $penaltybw = 0; - $penaltybwunit = "Kb"; - $p2p = false; - $p2pcatchall = false; - $p2pcatchbw = 0; - $p2pcatchbwunit = "%"; - $games = false; - $otherpriority = false; - $remainbw = 0; - $factor = 0; - $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 ($voipbwunit == "%") - $factor = $upbw/100; - else - $factor = wizard_get_bandwidthtype_scale($voipbwunit); - $remainbw += $voipbw * $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; - } else { - $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; - } else { - $p2pcatchall = false; - $p2pcatchbw = 0; - } - } else { - $p2p = false; - $p2pcatchall = false; - $p2pcatchbw = 0; - } - if ($config['ezshaper']['step6']['enable']) { - $games = true; - } else { - $games = false; - } - - if ($config['ezshaper']['step7']['enable']) { - $otherpriority = true; - } else { - $otherpriority = false; - } - $remainbw = round($remainbw / $upbw * 100, 2); - - if (intval($remainbw) > 0 && intval($remainbw) > 30) { - $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={$savemsg}"); - exit; - } else { - $remainbw = 100 - $remainbw; - } - - if ($sched != "PRIQ") { - if ($sched == "CBQ") - $q =& new cbq_queue(); - else if ($sched == "HFSC") - $q =& new hfsc_queue(); - $tmpcf = array(); - $tmpcf['name'] = "qInternet"; - //$tmpcf['priority'] = 6; - $tmpcf['ecn'] = "on"; - $tmpcf['enabled'] = "on"; - If ($sched == "CBQ") { - $tmpcf['bandwidth'] = floatval($config['ezshaper']['step2']["conn{$i}upload"]); - $tmpcf['bandwidthtype'] = $config['ezshaper']['step2']["conn{$i}uploadspeed"]; - } - else if ($sched == "HFSC") { - $tmpcf['upperlimit'] = "on"; - $tmpcf['upperlimit3'] = - floatval($config['ezshaper']['step2']["conn{$i}upload"]) . $config['ezshaper']['step2']["conn{$i}uploadspeed"]; - $tmpcf['linkshare'] = "on"; - $tmpcf['linkshare3'] = floatval($config['ezshaper']['step2']["conn{$i}upload"]) . $config['ezshaper']['step2']["conn{$i}uploadspeed"]; - $tmpcf['bandwidth'] = floatval($config['ezshaper']['step2']["conn{$i}upload"]); - $tmpcf['bandwidthtype'] = $config['ezshaper']['step2']["conn{$i}uploadspeed"]; - } - array_push($tmppath, "qInternet"); - $qtmp =& $altq->add_queue($q, $tmpcf, $tmppath, $input_errors); - //array_pop($tmppath); - //echo "qInternet
"; - //var_dump($input_errors); - $qtmp->wconfig(); - $altq =& $qtmp; - } - - if ($sched == "PRIQ") - $q =& new priq_queue(); - else if ($sched == "CBQ") - $q =& new cbq_queue(); - else if ($sched == "HFSC") - $q =& new hfsc_queue(); - $tmpcf = array(); - $tmpcf['name'] = "qACK"; - $tmpcf['priority'] = 6; - $tmpcf['ecn'] = "on"; - $tmpcf['enabled'] = "on"; - If ($sched == "CBQ") { - $tmpcf['borrow'] = "on"; - $tmpcf['bandwidth'] = $remainbw * 0.2; - $tmpcf['bandwidthtype'] = "%"; - } - else if ($sched == "HFSC") { - $lkbw = 0.20 * $remainbw; - $tmpcf['linkshare3'] = "{$lkbw}%"; - $tmpcf['linkshare'] = "on"; - $tmpcf['bandwidth'] = $lkbw; - $tmpcf['bandwidthtype'] = "%"; - } - array_push($tmppath, "qACK"); - $qtmp =& $altq->add_queue($q, $tmpcf, $tmppath, $input_errors); - array_pop($tmppath); - //echo "qACK
"; - //var_dump($input_errors); - $qtmp->wconfig(); - - if ($sched == "PRIQ") - $q =& new priq_queue(); - else if ($sched == "CBQ") - $q =& new cbq_queue(); - else if ($sched == "HFSC") - $q =& new hfsc_queue(); - $tmpcf = array(); - if ($p2pcatchall) - $tmpcf['name'] = "qOthersDefault"; - else - $tmpcf['name'] = "qDefault"; - $tmpcf['priority'] = 3; - $tmpcf['enabled'] = "on"; - if (!$p2pcatchall) - $tmpcf['default'] = "on"; - $tmpcf['ecn'] = "on"; - if ($sched == "CBQ") { - $tmpcf['borrow'] = "on"; - $tmpcf['bandwidth'] = $remainbw * 0.1; /* 10% bandwidth */ - $tmpcf['bandwidthtype'] = "%"; - } else if ($sched == "HFSC") { - $tmpcf['bandwidth'] = $remainbw * 0.1; /* 10% bandwidth */ - $tmpcf['bandwidthtype'] = "%"; - } - array_push($tmppath, $tmpcf['name']); - $qtmp =& $altq->add_queue($q, $tmpcf, $tmppath, $input_errors); - array_pop($tmppath); - //echo "qDefault
"; - //var_dump($input_errors); - $qtmp->wconfig(); - - if ($p2p) { - if ($sched == "PRIQ") - $q =& new priq_queue(); - else if ($sched == "CBQ") - $q =& new cbq_queue(); - else if ($sched == "HFSC") - $q =& new hfsc_queue(); - $tmpcf = array(); - $tmpcf['name'] = "qP2P"; - $tmpcf['priority'] = 1; - $tmpcf['ecn'] = "on"; - $tmpcf['enabled'] = "on"; - if ($p2pcatchall) { - if ($sched == "CBQ") { - $tmpcf['borrow'] = "on"; - $tmpcf['bandwidth'] = $p2pcatchbw; - $tmpcf['bandwidthtype'] = $p2pcatchbwunit; - } else if ($sched == "HFSC") { - $tmpcf['linkshare'] = "on"; - $tmpcf['linkshare3'] = "{$p2pcatchbw}{$p2pcatchbwunit}"; - $tmpcf['upperlimit'] = "on"; - $tmpcf['upperlimit3'] = "{$p2pcatchbw}{$p2pcatchbwunit}"; - $tmpcf['bandwidth'] = $p2pcatchbw; - $tmpcf['bandwidthtype'] = $p2pcatchbwunit; - } - $tmpcf['default'] = "on"; - - } else { - if ($sched == "CBQ") { - $tmpcf['borrow'] = "on"; - $tmpcf['bandwidth'] = $remainbw * 0.05; /* 5% bandwidth */ - $tmpcf['bandwidthtype'] = "%"; - } else if ($sched == "HFSC") { - $tmpbw = $remainbw * 0.05; /* 5% bandwidth */ - $tmpcf['linkshare'] = "on"; - $tmpcf['linkshare3'] = "{$tmpbw}%"; - $tmpcf['upperlimit'] = "on"; - $tmpcf['upperlimit3'] = "{$tmpbw}%"; - $tmpcf['bandwidth'] = $tmpbw; - $tmpcf['bandwidthtype'] = "%"; - } - } - array_push($tmppath, "qP2P"); - $qtmp =& $altq->add_queue($q, $tmpcf, $tmppath, $input_errors); - array_pop($tmppath); - //echo "qP2P
"; - //var_dump($input_errors); - $qtmp->wconfig(); - } - - if ($voip) { - if ($sched == "PRIQ") - $q =& new priq_queue(); - else if ($sched == "CBQ") - $q =& new cbq_queue(); - else if ($sched == "HFSC") - $q =& new hfsc_queue(); - $tmpcf = array(); - $tmpcf['name'] = "qVoIP"; - $tmpcf['priority'] = 7; - $tmpcf['ecn'] = "on"; - $tmpcf['enabled'] = "on"; - if ($sched == "CBQ") { - $tmpcf['borrow'] = "on"; - if ($voipbw > 0) { - $tmpcf['bandwidth'] = $voipbw; - $tmpcf['bandwidthtype'] = $voipbwunit; - } else { - $tmpcf['bandwidth'] = $remainbw * 0.2; /* 20% bandwidth */ - $tmpcf['bandwidthtype'] = "%"; - } - } else if ($sched == "HFSC") { - if ($voipbw > 0) { - $tmpcf['realtime3'] = "{$voipbw}{$voipbwunit}"; - } else { - $voipbw = $remainbw * 0.20; /* 20% bandwidth */ - $tmpcf['realtime3'] = "{$voipbw}%"; - } - $tmpcf['realtime'] = "on"; - $tmpcf['bandwidth'] = 32; - $tmpcf['bandwidthtype'] = "Kb"; - } - array_push($tmppath, "qVoIP"); - $qtmp =& $altq->add_queue($q, $tmpcf, $tmppath, $input_errors); - array_pop($tmppath); - //echo "qVoIP
"; - //var_dump($input_errors); - $qtmp->wconfig(); - } - - if ($games) { - if ($sched == "PRIQ") - $q =& new priq_queue(); - else if ($sched == "CBQ") - $q =& new cbq_queue(); - else if ($sched == "HFSC") - $q =& new hfsc_queue(); - $tmpcf = array(); - $tmpcf['name'] = "qGames"; - $tmpcf['priority'] = 5; - $tmpcf['enabled'] = "on"; - $tmpcf['ecn'] = "on"; - if ($sched == "CBQ") { - $tmpcf['borrow'] = "on"; - $tmpcf['bandwidth'] = $remainbw * 0.2; /* 20% bandwidth */ - $tmpcf['bandwidthtype'] = "%"; - } else if ($sched == "HFSC") { - $gamesbw = $remainbw * 0.2; /* 20% bandwidth */ - $tmpcf['linkshare'] = "on"; - $tmpcf['linkshare3'] = "{$gamesbw}%"; - $tmpcf['bandwidth'] = "{$gamesbw}"; - $tmpcf['bandwidthtype'] = "%"; - } - array_push($tmppath, "qGames"); - $qtmp =& $altq->add_queue($q, $tmpcf, $tmppath, $input_errors); - array_pop($tmppath); - //echo "qGames
"; - //var_dump($input_errors); - $qtmp->wconfig(); - } - - if ($otherpriority) { - if ($sched == "PRIQ") - $q =& new priq_queue(); - else if ($sched == "CBQ") - $q =& new cbq_queue(); - else if ($sched == "HFSC") - $q =& new hfsc_queue(); - $tmpcf = array(); - $tmpcf['name'] = "qOthersHigh"; - $tmpcf['priority'] = 4; - $tmpcf['ecn'] = "on"; - $tmpcf['enabled'] = "on"; - if ($sched == "CBQ") { - $tmpcf['borrow'] = "on"; - $tmpcf['bandwidth'] = $remainbw * 0.1; /* 10% bandwidth */ - $tmpcf['bandwidthtype'] = "%"; - } else if ($sched == "HFSC") { - $tmpcf['linkshare'] = "on"; - $otherbw = $remainbw * 0.1; /* 10% bandwidth */ - $tmpcf['linkshare3'] = "{$otherbw}%"; - $tmpcf['bandwidth'] = $otherbw; - $tmpcf['bandwidthtype'] = "%"; - } - array_push($tmppath, "qOthersHigh"); - $qtmp =& $altq->add_queue($q, $tmpcf, $tmppath, $input_errors); - array_pop($tmppath); - //echo "qHigh
"; - //var_dump($input_errors); - $qtmp->wconfig(); - - - if ($sched == "PRIQ") - $q =& new priq_queue(); - else if ($sched == "CBQ") - $q =& new cbq_queue(); - else if ($sched == "HFSC") - $q =& new hfsc_queue(); - $tmpcf = array(); - $tmpcf['name'] = "qOthersLow"; - $tmpcf['priority'] = 2; - $tmpcf['ecn'] = "on"; - $tmpcf['enabled'] = "on"; - if ($sched == "CBQ") { - $tmpcf['borrow'] = "on"; - if ($penalty) { - $tmpcf['bandwidthtype'] = $penaltybwunit; - $tmpcf['bandwidth'] = $penaltybw; - } else { - $tmpcf['bandwidth'] = $remainbw * 0.05; /* 5% bandwidth */ - $tmpcf['bandwidthtype'] = "%"; - } - } else if ($sched == "HFSC") { - if ($penalty) { - $tmpcf['linkshare3'] = "{$penaltybw}{$penaltybwunit}"; - $tmpcf['bandwidth'] = $penaltybw; - $tmpcf['bandwidthtype'] = $penaltybwunit; - } else { - $lsbw = $remainbw * 0.05; - $tmpcf['linkshare3'] = "{$lsbw}%"; /* 5% bandwidth */ - $tmpcf['bandwidth'] = $lsbw; - $tmpcf['bandwidthtype'] = "%"; - } - $tmpcf['linkshare'] = "on"; - } - array_push($tmppath, "qOthersLow"); - $qtmp =& $altq->add_queue($q, $tmpcf, $tmppath, $input_errors); - array_pop($tmppath); - //echo "qLow
"; - //var_dump($input_errors); - $qtmp->wconfig(); - } - array_pop($tmppath); - - $downfactor = wizard_get_bandwidthtype_scale($config['ezshaper']['step2']["conn{$i}downloadspeed"]); - $downbw = floatval($config['ezshaper']['step2']["conn{$i}download"]) * $downfactor; - - $tmppath = array(); - $altq =& new altq_root_queue(); - - $altq->SetInterface($config['ezshaper']['step2']["local{$i}interface"]); - $altq->SetScheduler($config['ezshaper']['step2']["local{$i}downloadscheduler"]); - //$altq->SetBandwidth($config['ezshaper']['step2']["conn{$i}download"]); - //$altq->SetBwscale($config['ezshaper']['step2']["conn{$i}downloadspeed"]); - $altq->SetEnabled("on"); - $altq_list_queues[$altq->GetQname()] =& $altq; - array_push($tmppath, $config['ezshaper']['step2']["local{$i}interface"]); - $altq->SetLink($tmppath); - //var_dump($input_errors); - $altq->wconfig(); - - $sched = $config['ezshaper']['step2']["local{$i}downloadscheduler"]; - $voipbw =0; - $voipbwunit = "%"; - $voip = false; - $penalty = false; - $penaltybw = 0; - $penaltybwunit = "%"; - $p2p = false; - $p2pcatchall = false; - $p2pcatchbw = 0; - $games = false; - $otherpriority = false; - $remainbw = 0; - - if ($config['ezshaper']['step3']['enable']) { - $voip = true; - $voipbw = $config['ezshaper']['step3']["local{$i}download"]; - $voipbwunit = $config['ezshaper']['step3']["local{$i}downloadspeed"]; - if ($sched != HFSC) { - if ($penaltybwunit == "%") - $factor = $downbw/100; - else - $factor = wizard_get_bandwidthtype_scale($voipbwunit); - $remainbw += floatval($voipbw) * $factor; - } else - $remainbw += 32000; /* 32Kbit/s reserved for HFSC linksharing */ - } - if ($config['ezshaper']['step4']['enable']) { - $penalty = true; - $penaltybw = $config['ezshaper']['step4']['bandwidth']; - $penaltybwunit = $config['ezshaper']['step4']['bandwidthunit']; - if ($penaltybwunit == "%") - $factor = $downbw/100; - else - $factor = wizard_get_bandwidthtype_scale($penaltybwunit); - $remainbw += floatval($penaltybw) * $factor; - } else { - $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 = $downbw/100; - else - $factor = wizard_get_bandwidthtype_scale($p2pcatchbwunit); - $remainbw += floatval($p2pcatchbw) * $factor; - } else { - $p2pcatchall = false; - $p2pcatchbw = 0; - } - } else { - $p2p = false; - $p2pcatchall = false; - $p2pcatchbw = 0; - } - if ($config['ezshaper']['step6']['enable']) { - $games = true; - } else { - $games = false; - } - - if ($config['ezshaper']['step7']['enable']) { - $otherpriority = true; - } else { - $otherpriority = false; - } - $remainbw = round($remainbw / $downbw * 100, 2); - if (intval($remainbw) > 0 && intval($remainbw) > 40) { - $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={$savemsg}"); - exit; - } else { - $remainbw = 100 - $remainbw; - } - - if (!$p2pcatchall) { - if ($sched == "PRIQ") - $q =& new priq_queue(); - else if ($sched == "CBQ") - $q =& new cbq_queue(); - else if ($sched == "HFSC") - $q =& new hfsc_queue(); - $tmpcf = array(); - $tmpcf['name'] = "qLink"; - $tmpcf['priority'] = 2; - $tmpcf['enabled'] = "on"; - $tmpcf['default'] = "on"; - $tmpcf['qlimit'] = 500; - $tmpcf['ecn'] = "on"; - if ($sched == "CBQ") { - $tmpcf['borrow'] = "on"; - $tmpcf['bandwidth'] = 20; /* 20% bandwidth */ - $tmpcf['bandwidthtype'] = "%"; - } else if ($sched == "HFSC") { - $tmpcf['bandwidth'] = 20; /* 20% bandwidth */ - $tmpcf['bandwidthtype'] = "%"; - } - array_push($tmppath, $tmpcf['name']); - $qtmp =& $altq->add_queue($q, $tmpcf, $tmppath, $input_errors); - array_pop($tmppath); - //echo "qDefault
"; - //var_dump($input_errors); - $qtmp->wconfig(); - } - - if ($sched != "PRIQ") { - if ($sched == "CBQ") - $q =& new cbq_queue(); - else if ($sched == "HFSC") - $q =& new hfsc_queue(); - $tmpcf = array(); - $tmpcf['name'] = "qInternet"; - //$tmpcf['priority'] = 6; - $tmpcf['ecn'] = "on"; - $tmpcf['enabled'] = "on"; - If ($sched == "CBQ") { - $tmpcf['bandwidth'] = floatval($config['ezshaper']['step2']["conn{$i}download"]); - $tmpcf['bandwidthtype'] = $config['ezshaper']['step2']["conn{$i}downloadspeed"]; - } - else if ($sched == "HFSC") { - $tmpcf['upperlimit'] = "on"; - $tmpcf['upperlimit3'] = floatval($config['ezshaper']['step2']["conn{$i}download"]) . $config['ezshaper']['step2']["conn{$i}downloadspeed"]; - $tmpcf['linkshare'] = "on"; - $tmpcf['linkshare3'] = floatval($config['ezshaper']['step2']["conn{$i}download"]) . $config['ezshaper']['step2']["conn{$i}downloadspeed"]; - $tmpcf['bandwidth'] = floatval($config['ezshaper']['step2']["conn{$i}download"]); - $tmpcf['bandwidthtype'] = $config['ezshaper']['step2']["conn{$i}downloadspeed"]; - } - array_push($tmppath, "qInternet"); - $qtmp =& $altq->add_queue($q, $tmpcf, $tmppath, $input_errors); - //array_pop($tmppath); - //echo "qInternet
"; - //var_dump($input_errors); - $qtmp->wconfig(); - $altq =& $qtmp; - } - - if ($sched == "PRIQ") - $q =& new priq_queue(); - else if ($sched == "CBQ") - $q =& new cbq_queue(); - else if ($sched == "HFSC") - $q =& new hfsc_queue(); - $tmpcf = array(); - $tmpcf['name'] = "qACK"; - $tmpcf['priority'] = 6; - $tmpcf['ecn'] = "on"; - $tmpcf['enabled'] = "on"; - If ($sched == "CBQ") { - $tmpcf['borrow'] = "on"; - $tmpcf['bandwidth'] = $remainbw * 0.2; - $tmpcf['bandwidthtype'] = "%"; - } else if ($sched == "HFSC") { - $lkbw = 0.20 * $remainbw; - $tmpcf['linkshare3'] = "{$lkbw}%"; - $tmpcf['linkshare'] = "on"; - $tmpcf['bandwidth'] = $lkbw; - $tmpcf['bandwidthtype'] = "%"; - } - array_push($tmppath, "qACK"); - $qtmp =& $altq->add_queue($q, $tmpcf, $tmppath, $input_errors); - array_pop($tmppath); - //echo "qACK $remainbw
"; - //var_dump($input_errors); - $qtmp->wconfig(); - - if ($p2p) { - if ($sched == "PRIQ") - $q =& new priq_queue(); - else if ($sched == "CBQ") - $q =& new cbq_queue(); - else if ($sched == "HFSC") - $q =& new hfsc_queue(); - $tmpcf = array(); - $tmpcf['name'] = "qP2P"; - $tmpcf['priority'] = 1; - $tmpcf['ecn'] = "on"; - $tmpcf['enabled'] = "on"; - if ($p2pcatchall) { - if ($sched == "CBQ") { - $tmpcf['borrow'] = "on"; - $tmpcf['bandwidth'] = $p2pcatchbw; - $tmpcf['bandwidthtype'] = $p2pcatchbwunit; - } else if ($sched == "HFSC") { - $tmpcf['linkshare'] = "on"; - $tmpcf['linkshare3'] = "{$p2pcatchbw}{$p2pcatchbwunit}"; - $tmpcf['upperlimit'] = "on"; - $tmpcf['upperlimit3'] = "{$p2pcatchbw}{$p2pcatchbwunit}"; - $tmpcf['bandwidth'] = $p2pcatchbw; - $tmpcf['bandwidthtype'] = $p2pcatchbwunit; - } - $tmpcf['default'] = "on"; - $tmpcf['qlimit'] = 500; - } else { - if ($sched == "CBQ") { - $tmpcf['borrow'] = "on"; - $tmpcf['bandwidth'] = $remainbw * 0.05; /* 5% bandwidth */ - $tmpcf['bandwidthtype'] = "%"; - } else if ($sched == "HFSC") { - $tmpbw = $remainbw * 0.05; /* 5% bandwidth */ - $tmpcf['linkshare'] = "on"; - $tmpcf['linkshare3'] = "{$tmpbw}%"; - $tmpcf['upperlimit'] = "on"; - $tmpcf['upperlimit3'] = "{$tmpbw}%"; - $tmpcf['bandwidth'] = $tmpbw; - $tmpcf['bandwidthtype'] = "%"; - } - } - array_push($tmppath, "qP2P"); - $qtmp =& $altq->add_queue($q, $tmpcf, $tmppath, $input_errors); - array_pop($tmppath); - //echo "qP2P
"; - //var_dump($input_errors); - $qtmp->wconfig(); - } - - if ($voip) { - if ($sched == "PRIQ") - $q =& new priq_queue(); - else if ($sched == "CBQ") - $q =& new cbq_queue(); - else if ($sched == "HFSC") - $q =& new hfsc_queue(); - $tmpcf = array(); - $tmpcf['name'] = "qVoIP"; - $tmpcf['priority'] = 7; - $tmpcf['ecn'] = "on"; - $tmpcf['enabled'] = "on"; - if ($sched == "CBQ") { - $tmpcf['borrow'] = "on"; - if ($voipbw > 0) { - $tmpcf['bandwidth'] = $voipbw; - $tmpcf['bandwidthtype'] = $voipbwunit; - } else { - $tmpcf['bandwidth'] = $remainbw * 0.2; /* 20% bandwidth */ - $tmpcf['bandwidthtype'] = "%"; - } - } else if ($sched == "HFSC") { - if ($voipbw > 0) { - $tmpcf['realtime3'] = "{$voipbw}{$voipbwunit}"; - } else { - $voipbw = $remainbw * 0.20; /* 20% bandwidth */ - $tmpcf['realtime3'] = "{$voipbw}%"; - } - $tmpcf['realtime'] = "on"; - $tmpcf['bandwidth'] = 32; - $tmpcf['bandwidthtype'] = "Kb"; - } - array_push($tmppath, "qVoIP"); - $qtmp =& $altq->add_queue($q, $tmpcf, $tmppath, $input_errors); - array_pop($tmppath); - //echo "qVoIP
"; - //var_dump($input_errors); - $qtmp->wconfig(); - } - - if ($games) { - if ($sched == "PRIQ") - $q =& new priq_queue(); - else if ($sched == "CBQ") - $q =& new cbq_queue(); - else if ($sched == "HFSC") - $q =& new hfsc_queue(); - $tmpcf = array(); - $tmpcf['name'] = "qGames"; - $tmpcf['priority'] = 5; - $tmpcf['enabled'] = "on"; - $tmpcf['ecn'] = "on"; - if ($sched == "CBQ") { - $tmpcf['borrow'] = "on"; - $tmpcf['bandwidth'] = $remainbw * 0.2; /* 20% bandwidth */ - $tmpcf['bandwidthtype'] = "%"; - } else if ($sched == "HFSC") { - $gamesbw = $remainbw * 0.2; /* 20% bandwidth */ - $tmpcf['linkshare'] = "on"; - $tmpcf['linkshare3'] = "{$gamesbw}%"; - $tmpcf['bandwidth'] = "{$gamesbw}"; - $tmpcf['bandwidthtype'] = "%"; - } - array_push($tmppath, "qGames"); - $qtmp =& $altq->add_queue($q, $tmpcf, $tmppath, $input_errors); - array_pop($tmppath); - //echo "qGames
"; - //var_dump($input_errors); - $qtmp->wconfig(); - } - - if ($otherpriority) { - if ($sched == "PRIQ") - $q =& new priq_queue(); - else if ($sched == "CBQ") - $q =& new cbq_queue(); - else if ($sched == "HFSC") - $q =& new hfsc_queue(); - $tmpcf = array(); - $tmpcf['name'] = "qOthersHigh"; - $tmpcf['priority'] = 4; - $tmpcf['ecn'] = "on"; - $tmpcf['enabled'] = "on"; - if ($sched == "CBQ") { - $tmpcf['borrow'] = "on"; - $tmpcf['bandwidth'] = $remainbw * 0.1; /* 10% bandwidth */ - $tmpcf['bandwidthtype'] = "%"; - } else if ($sched == "HFSC") { - $tmpcf['linkshare'] = "on"; - $otherbw = $remainbw * 0.1; /* 10% bandwidth */ - $tmpcf['linkshare3'] = "{$otherbw}%"; - $tmpcf['bandwidth'] = $otherbw; - $tmpcf['bandwidthtype'] = "%"; - } - array_push($tmppath, "qOthersHigh"); - $qtmp =& $altq->add_queue($q, $tmpcf, $tmppath, $input_errors); - array_pop($tmppath); - //echo "qHigh
"; - //var_dump($input_errors); - $qtmp->wconfig(); - - if ($sched == "PRIQ") - $q =& new priq_queue(); - else if ($sched == "CBQ") - $q =& new cbq_queue(); - else if ($sched == "HFSC") - $q =& new hfsc_queue(); - $tmpcf = array(); - $tmpcf['name'] = "qOthersLow"; - $tmpcf['priority'] = 3; - $tmpcf['ecn'] = "on"; - $tmpcf['enabled'] = "on"; - if ($sched == "CBQ") { - $tmpcf['borrow'] = "on"; - if ($penalty) { - $tmpcf['bandwidth'] = $penaltybw; - $tmpcf['bandwidthtype'] = $penaltybwunit; - } else { - $tmpcf['bandwidthtype'] = "%"; - $tmpcf['bandwidth'] = $remainbw * 0.05; /* 5% bandwidth */ - } - } else if ($sched == "HFSC") { - if ($penalty) { - $tmpcf['linkshare3'] = "{$penaltybw}{$penaltybwunit}"; - $tmpcf['bandwidth'] = $penaltybw; - $tmpcf['bandwidthtype'] = $penaltybwunit; - } else { - $lsbw = $remainbw * 0.05; - $tmpcf['linkshare3'] = "{$lsbw}%"; /* 5% bandwidth */ - $tmpcf['bandwidth'] = $lsbw; - $tmpcf['bandwidthtype'] = "%"; - } - $tmpcf['linkshare'] = "on"; - } - array_push($tmppath, "qOthersLow"); - $qtmp =& $altq->add_queue($q, $tmpcf, $tmppath, $input_errors); - array_pop($tmppath); - //echo "qLow
"; - //var_dump($input_errors); - $qtmp->wconfig(); - } - array_pop($tmppath); - } - - if (!is_array($config['filter']['rule'])) - $config['filter']['rule'] = array(); - - $interfacelist = implode(",", $interfacelist); - - /* Rules */ - if ($penalty) { - if( is_ipaddr($config['ezshaper']['step4']['address']) || is_alias($config['ezshaper']['step4']['address'])) { - $rule = array(); - $rule['type'] = "match"; - $rule['interface'] = $interfacelist; - $rule['descr'] = gettext("Penalty Box"); - $rule['defaultqueue'] = "qOthersLow"; - $rule['source']['address'] = $config['ezshaper']['step4']['address']; - $rule['destination']['any'] = TRUE; - $rule['floating'] = "yes"; - $rule['wizard'] = "yes"; - $rule['enabled'] = "on"; - $rule['created'] = make_config_revision_entry(null, gettext("Traffic Shaper Wizard")); - $config['filter']['rule'][] = $rule; - } - } - - /* If user specifies an IP, we don't bother with providers */ - if ($voip) { - if( is_ipaddr($config['ezshaper']['step3']['address']) || is_alias($config['ezshaper']['step3']['address'])) { - /* create VOIP rules */ - $rule = array(); - $rule['type'] = "match"; - //$rule['interface'] = $interfacelist; - $rule['descr'] = gettext("Connections From Upstream SIP Server"); - $rule['protocol'] = "udp"; - $rule['defaultqueue'] = "qVoIP"; - $rule['source']['address'] = $config['ezshaper']['step3']['address']; - $rule['destination']['any'] = TRUE; - $rule['floating'] = "yes"; - $rule['wizard'] = "yes"; - $rule['enabled'] = "on"; - $rule['created'] = make_config_revision_entry(null, gettext("Traffic Shaper Wizard")); - $config['filter']['rule'][] = $rule; - - $rule = array(); - $rule['type'] = "match"; - //$rule['interface'] = $interfacelist; - $rule['descr'] = gettext("Connections To Upstream SIP Server"); - $rule['protocol'] = "udp"; - $rule['defaultqueue'] = "qVoIP"; - $rule['source']['any'] = TRUE; - $rule['destination']['address'] = $config['ezshaper']['step3']['address']; - $rule['floating'] = "yes"; - $rule['wizard'] = "yes"; - $rule['enabled'] = "on"; - $rule['created'] = make_config_revision_entry(null, gettext("Traffic Shaper Wizard")); - $config['filter']['rule'][] = $rule; - - } elseif( $config['ezshaper']['step3']['provider'] == "Generic" ) { - /* create VOIP rules */ - $rule = array(); - $rule['type'] = "match"; - $rule['interface'] = $interfacelist; - $rule['descr'] = "DiffServ/Lowdelay/Upload"; - $rule['protocol'] = "udp"; - $rule['source']['any'] = TRUE; - $rule['defaultqueue'] = "qVoIP"; - $rule['destination']['any'] = TRUE; - $rule['iptos'] = "lowdelay"; - $rule['floating'] = "yes"; - $rule['wizard'] = "yes"; - $rule['enabled'] = "on"; - $rule['created'] = make_config_revision_entry(null, gettext("Traffic Shaper Wizard")); - $config['filter']['rule'][] = $rule; - - } else { - /* loop through voiplist[] */ - foreach ($voiplist[$config['ezshaper']['step3']['provider']] as $voip) { - $rule = array(); - $rule['type'] = "match"; - $rule['interface'] = $interfacelist; - $rule['defaultqueue'] = 'qVoIP'; - $rule['source']['any'] = TRUE; - $rule['destination']['any'] = TRUE; - $rule['descr'] = "m_voip {$voip[0]} outbound"; - $rule['floating'] = "yes"; - $rule['wizard'] = "yes"; - $rule['enabled'] = "on"; - $rule['destination']['port'] = $voip[2]."-".$voip[3]; - if($voip[1] != '') - $rule['protocol'] = $voip[1]; - $rule['created'] = make_config_revision_entry(null, gettext("Traffic Shaper Wizard")); - $config['filter']['rule'][] = $rule; - } - } - } - - /* loop through p2plist[] */ - if ($p2p) { - foreach($config['ezshaper']['step5'] as $key => $val) { - if (!is_array($p2plist[$key])) - continue; - foreach ($p2plist[$key] as $p2pclient) { - $rule = array(); - $rule['type'] = "match"; - $rule['interface'] = $interfacelist; - $rule['defaultqueue'] = 'qP2P'; - $rule['source']['any'] = TRUE; - $rule['destination']['any'] = TRUE; - $rule['descr'] = "m_P2P {$p2pclient[0]} outbound"; - $rule['floating'] = "yes"; - $rule['wizard'] = "yes"; - $rule['destination']['port'] = $p2pclient[2]."-".$p2pclient[3]; - if($p2pclient[1] != '') - $rule['protocol'] = $p2pclient[1]; - $rule['created'] = make_config_revision_entry(null, gettext("Traffic Shaper Wizard")); - $config['filter']['rule'][] = $rule; - } - } - } - - /* loop through gamesplist[] */ - if ($games) { - foreach($config['ezshaper']['step6'] as $key => $val) { - if (!is_array($gamesplist[$key])) - continue; - foreach ($gamesplist[$key] as $Gameclient) { - $rule = array(); - $rule['type'] = "match"; - $rule['interface'] = $interfacelist; - $rule['defaultqueue'] = 'qGames'; - if ($Gameclient[1] == "tcp") - $rule['ackqueue'] = 'qACK'; - $rule['source']['any'] = TRUE; - $rule['destination']['any'] = TRUE; - $rule['floating'] = "yes"; - $rule['wizard'] = "yes"; - $rule['enabled'] = "on"; - $rule['descr'] = "m_Game {$Gameclient[0]} outbound"; - $rule['destination']['port'] = $Gameclient[2]."-".$Gameclient[3]; - if($Gameclient[1] != '') - $rule['protocol'] = $Gameclient[1]; - $config['filter']['rule'][] = $rule; - } - } - } - - /* loop through othersplist[] */ - if ($otherpriority) { - foreach($config['ezshaper']['step7'] as $key => $val) { - if (!is_array($othersplist[$key])) - continue; - foreach ($othersplist[$key] as $otherclient) { - $rule = array(); - $rule['type'] = "match"; - $rule['interface'] = $interfacelist; - switch ($val) { - case "H": - $rule['defaultqueue'] = 'qOthersHigh'; /* posted value H or L */ - if ($otherclient[1] == "tcp") - $rule['ackqueue'] = 'qACK'; - $loop = 0; - break; - case "L": - $rule['defaultqueue'] = 'qOthersLow'; /* posted value H or L */ - if ($otherclient[1] == "tcp") - $rule['ackqueue'] = 'qACK'; - $loop = 0; - break; - case "D": - if ($p2pcatchall) { - $loop = 0; - $rule['defaultqueue'] = 'qOthersDefault'; - if ($otherclient[1] == "tcp") - $rule['ackqueue'] = 'qACK'; - } else - $loop = 1; /* It automitaclly goes to default queue */ - break; - default: - $loop = 1; - } - if (!$loop) { - $rule['source']['any'] = TRUE; - $rule['destination']['any'] = TRUE; - $rule['floating'] = "yes"; - $rule['wizard'] = "yes"; - $rule['enabled'] = "on"; - $rule['descr'] = "m_Other {$otherclient[0]} outbound"; - - if($otherclient[2] or $otherclient[3]) { - $rule['destination']['port'] = $otherclient[2]."-".$otherclient[3]; - } - if($otherclient[1] != '') - $rule['protocol'] = $otherclient[1]; - $rule['created'] = make_config_revision_entry(null, gettext("Traffic Shaper Wizard")); - $config['filter']['rule'][] = $rule; - } - } - } - } - write_config(); -} - -function wizard_get_bandwidthtype_scale($type = "b") { - switch ($type) { - case "Gb": - $factor = 1024 * 1024 * 1024; - break; - case "Mb": - $factor = 1024 * 1024; - break; - case "Kb": - $factor = 1024; - break; - case "b": - default: - $factor = 1; - break; - } - return intval($factor); -} - -?> diff --git a/src/www/wizards/traffic_shaper_wizard_dedicated.xml b/src/www/wizards/traffic_shaper_wizard_dedicated.xml deleted file mode 100644 index 802bc2b38..000000000 --- a/src/www/wizards/traffic_shaper_wizard_dedicated.xml +++ /dev/null @@ -1,1626 +0,0 @@ - - - - - 8 - - 1 - OPNsense Traffic Shaper Wizard - true - This wizard will guide you through setting up the OPNsense traffic shaper. - Please be aware that Custom Bandwidths should not exceed 30% of the interface/link bandwidth. Keep this in mind during the wizard. - - - - listtopic - Traffic shaper Wizard - - - Enter number of WAN type connections - numberofconnections - input - ^[0-9]+$ - Number of connections you have - ezshaper->step1->numberofconnections - - - Next - submit - - - step1_stepbeforeformdisplay(); - step1_submitphpaction(); - /usr/local/www/wizards/traffic_shaper_wizard_dedicated.inc - - - 2 - OPNsense Traffic Shaper Wizard - Shaper configuration - - step2_stepbeforeformdisplay(); - step2_stepsubmitphpaction(); - /usr/local/www/wizards/traffic_shaper_wizard_dedicated.inc - - - Next - submit - - - - - 3 - OPNsense Traffic Shaper Wizard - Voice over IP - - - Enable - checkbox - Prioritize Voice over IP traffic - This will raise the priority of VOIP traffic above all other traffic. - ezshaper->step3->enable - - - Next - submit - - - VOIP specific settings - listtopic - - - Provider - select - Choose Generic if your provider isn't listed. - ezshaper->step3->provider - - - - - - - - - Upstream SIP Server - inputalias - (Optional) If this is chosen, the provider field will be overridden. This allows you to provide the IP address of the <strong>remote</strong> PBX or SIP Trunk to prioritize. <br />NOTE: You can also use a Firewall Alias in this location. - ezshaper->step3->address - IP Address field is non-blank and doesn't look like an IP address. - - - Bandwidth - input - ^[0-9]*$ - Total bandwidth in percentage(%)(should be between 5 and 40) guarantee for VOIP traffic. - ezshaper->step3->bandwidth - - - Next - submit - - - step3_stepbeforeformdisplay(); - step3_stepsubmitphpaction(); - /usr/local/www/wizards/traffic_shaper_wizard_dedicated.inc - - - 4 - OPNsense Traffic Shaper Wizard - Penalty Box - true - - - true - Enable - checkbox - Penalize IP or Alias - This will lower the priority of traffic from this IP or alias. - Address,Bandwidth,BandwidthSpeed - ezshaper->step4->enable - - - Next - submit - - - PenaltyBox specific settings - listtopic - - - Address - inputalias - 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. - ezshaper->step4->address - IP Address field is non-blank and doesn't look like an IP address. - - - Bandwidth - input - ^[0-9]*$ - Speed must be numerical. - ezshaper->step4->bandwidth - true - - - true - true - true - true - BandwidthSpeed - The limit you want to apply. - select - - - - - - - - ezshaper->step4->bandwidthunit - - - Next - submit - - - step4_stepsubmitphpaction(); - /usr/local/www/wizards/traffic_shaper_wizard_dedicated.inc - - - 5 - OPNsense Traffic Shaper Wizard - Peer to Peer networking - true - - - true - Enable - checkbox - Lower priority of Peer-to-Peer traffic - This will lower the priority of P2P traffic below all other traffic. Please check the items that you would like to prioritize lower than normal traffic. - p2pCatchAll,Bandwidth,BandwidthSpeed,Aimster,BitTorrent,BuddyShare,CuteMX,DCplusplus,dcc,DirectConnect,DirectFileExpress,EDonkey2000,FastTrack,Gnutella,grouper,hotComm,HotlineConnect,iMesh,Napster,OpenNap,Scour,Shareaza,SongSpy,WinMX - ezshaper->step5->enable - - - Next - submit - - - p2p Catch all - listtopic - - - p2pCatchAll - checkbox - When enabled, all uncategorized traffic is fed to the p2p queue. - ezshaper->step5->p2pcatchall - - - Bandwidth - input - ^[0-9]*$ - Speed must be numerical. - ezshaper->step5->bandwidth - true - - - true - true - true - true - BandwidthSpeed - The limit you want to apply. - select - - - - - - - - ezshaper->step5->bandwidthunit - - - Enable/Disable specific P2P protocols - listtopic - - - Aimster - checkbox - Aimster and other P2P using the Aimster protocol and ports - ezshaper->step5->aimster - - - BitTorrent - checkbox - Bittorrent and other P2P using the Torrent protocol and ports - ezshaper->step5->bittorrent - - - BuddyShare - checkbox - BuddyShare and other P2P using the BuddyShare protocol and ports - ezshaper->step5->buddyshare - - - CuteMX - checkbox - CuteMX and other P2P using the CuteMX protocol and ports - ezshaper->step5->cutemx - - - DCplusplus - checkbox - DC++ and other P2P using the DC++ protocol and ports - ezshaper->step5->dcplusplus - - - DCC - checkbox - irc DCC file transfers - ezshaper->step5->dcc - - - DirectConnect - checkbox - DirectConnect and other P2P using the DirectConnect protocol and ports - ezshaper->step5->directconnect - - - DirectFileExpress - checkbox - DirectFileExpress and other P2P using the DirectFileExpress protocol and ports - ezshaper->step5->directfileexpress - - - eDonkey2000 - checkbox - eDonkey and other P2P using the eDonkey protocol and ports - ezshaper->step5->edonkey2000 - - - FastTrack - checkbox - FastTrack and other P2P using the FastTrack protocol and ports - ezshaper->step5->fasttrack - - - Gnutella - checkbox - Gnutella and other P2P using the Gnutella protocol and ports - ezshaper->step5->gnutella - - - grouper - checkbox - grouper and other P2P using the grouper protocol and ports - ezshaper->step5->grouper - - - hotComm - checkbox - hotComm and other P2P using the hotComm protocol and ports - ezshaper->step5->hotcomm - - - HotlineConnect - checkbox - HotlineConnect and other P2P using the HotlineConnect protocol and ports - ezshaper->step5->hotlineconnect - - - iMesh - checkbox - iMesh and other P2P using the iMesh protocol and ports - ezshaper->step5->imesh - - - Napster - checkbox - Napster and other P2P using the Napster protocol and ports - ezshaper->step5->napster - - - OpenNap - checkbox - OpenNap and other P2P using the OpenNap protocol and ports - ezshaper->step5->opennap - - - Scour - checkbox - Scour and other P2P using the Scour protocol and ports - ezshaper->step5->scour - - - Shareaza - checkbox - Shareaza and other P2P using the Shareaza protocol and ports - ezshaper->step5->shareaza - - - SongSpy - checkbox - SongSpy and other P2P using the SongSpy protocol and ports - ezshaper->step5->songspy - - - WinMX - checkbox - WinMX and other P2P using the WinMX protocol and ports - ezshaper->step5->winmx - - - Next - submit - - - step5_stepsubmitphpaction(); - /usr/local/www/wizards/traffic_shaper_wizard_dedicated.inc - - - 6 - OPNsense Traffic Shaper Wizard - true - Network Games - - - Enable - checkbox - Prioritize network gaming traffic - This will raise the priority of gaming traffic to higher than most traffic. - BattleNET,EAOrigin,GameForWindowsLive,PlayStationConsoles,Steam,WiiConsoles,XboxConsoles,ARMA2,ARMA3,Battlefield2,Battlefield3,BattlefieldBC2,Borderlands,CallOfDuty,Counterstrike,Crysis2,Crysis3,DeltaForce,DeadSpace2,DeadSpace3,Dirt3,DOOM3,DragonAge2,EmpireEarth,EveOnline,Everquest,Everquest2,FarCry,FarCry2,FarCry3,GunZOnline,HalfLife,LeagueofLegends,Lineage2,MassEffect3,MechwarriorOnline,Minecraft,OperationFlashpointDR,PlanetSide,PlanetSide2,QuakeIII,QuakeIV,StarWarsTOR,TigerWoods2004PS2,TribesAscend,UnrealTournament,WolfensteinEnemyTerritory,WorldOfWarcraft - true - ezshaper->step6->enable - - - Next - submit - - - Enable/Disable specific game consoles and services - listtopic - - - BattleNET - checkbox - Battle.net - Virtually every game from Blizzard publishing should match this. This includes the following game series: Starcraft, Diablo, Warcraft. Guild Wars also uses this port. - ezshaper->step6->battlenet - - - EAOrigin - checkbox - EA Origin Client - Some PC games by EA use this. - ezshaper->step6->eaorigin - - - GameForWindowsLive - checkbox - Games for Windows Live - ezshaper->step6->gamesforwindowslive - - - PlayStationConsoles - checkbox - PlayStation Consoles - This should cover all ports required for the Playstation 4, Playstation, PS Vita - ezshaper->step6->playstationconsoles - - - Steam - checkbox - Steam Game Client (Includes: America's Army 3, Counter-Strike: Source, Counter-Strike: Global Offensive, Half-Life 2, COD: Black Ops Series, Borderlands 2, Natural Selection 2, Left 4 Dead Series, Portal 2 and many other games on the Steam) - ezshaper->step6->steam - - - WiiConsoles - checkbox - Wii Consoles - Wii, Wii U, DS and 3DS - ezshaper->step6->wiiconsoles - - - XboxConsoles - checkbox - Xbox Consoles - Xbox 360 and Xbox One - ezshaper->step6->xboxconsoles - - - Enable/Disable specific games - listtopic - - - ARMA2 - checkbox - ARMA 2 - ezshaper->step6->arma2 - - - ARMA3 - checkbox - ARMA 3 - ezshaper->step6->arma3 - - - Battlefield2 - checkbox - Battlefield 2 - this game uses a LARGE port range, be aware that you may need to manually rearrange the resulting rules to correctly prioritize other traffic. - ezshaper->step6->battlefield2 - - - Battlefield3 - checkbox - Battlefield 3 and 4 - this game uses a LARGE port range, be aware that you may need to manually rearrange the resulting rules to correctly prioritize other traffic. - ezshaper->step6->battlefield3 - - - BattlefieldBC2 - checkbox - Battlefield: Bad Company 2 - ezshaper->step6->battlefieldbc2 - - - Borderlands - checkbox - Borderlands - ezshaper->step6->borderlands - - - CallOfDuty - checkbox - Call Of Duty (United Offensive) - ezshaper->step6->callofduty - - - Counterstrike - checkbox - Counterstrike. The ultimate 1st person shooter. - ezshaper->step6->counterstrike - - - Crysis2 - checkbox - Crysis 2 - ezshaper->step6->crysis2 - - - Crysis3 - checkbox - Crysis 3 - ezshaper->step6->crysis3 - - - DeadSpace2 - checkbox - Dead Space2 - this game uses a HUGE port range, be aware that you may need to manually rearrange the resulting rules to correctly prioritize other traffic. - ezshaper->step6->deadspace2 - - - DeadSpace3 - checkbox - Dead Space 3 - ezshaper->step6->deadspace3 - - - DeltaForce - checkbox - Delta Force - ezshaper->step6->deltaforce - - - Dirt3 - checkbox - Dirt 3 - ezshaper->step6->dirt3 - - - DOOM3 - checkbox - DOOM3 - ezshaper->step6->doom3 - - - DragonAge2 - checkbox - Dragon Age 2 - ezshaper->step6->dragonage2 - - - EmpireEarth - checkbox - Empire Earth - ezshaper->step6->empireearth - - - EveOnline - checkbox - EVE Online - ezshaper->step6->eveonline - - - Everquest - checkbox - Everquest - this game uses a LARGE port range, be aware that you may need to manually rearrange the resulting rules to correctly prioritize other traffic. - ezshaper->step6->everquest - - - Everquest2 - checkbox - Everquest II - ezshaper->step6->everquest2 - - - FarCry - checkbox - Far Cry - ezshaper->step6->farcry - - - FarCry2 - checkbox - Far Cry 2 - ezshaper->step6->farcry2 - - - FarCry3 - checkbox - Far Cry 3 - ezshaper->step6->farcry3 - - - GunZOnline - checkbox - GunZ Online - ezshaper->step6->gunzonline - - - HalfLife - checkbox - Half-Life - ezshaper->step6->halflife - - - LeagueofLegends - checkbox - League of Legends - this game uses a LARGE port range, be aware that you may need to manually rearrange the resulting rules to correctly prioritize other traffic. - ezshaper->step6->leagueoflegends - - - Lineage2 - checkbox - Lineage II - ezshaper->step6->lineage2 - - - MassEffect3 - checkbox - Mass Effect 3 - ezshaper->step6->masseffect3 - - - MechwarriorOnline - checkbox - MechWarrior: Online - this game uses a LARGE port range, be aware that you may need to manually rearrange the resulting rules to correctly prioritize other traffic. - ezshaper->step6->mechwarrioronline - - - Minecraft - checkbox - Minecraft - ezshaper->step6->minecraft - - - PlanetSide - checkbox - PlanetSide - ezshaper->step6->planetside - - - PlanetSide2 - checkbox - PlanetSide 2 - ezshaper->step6->planetside2 - - - OperationFlashpointDR - checkbox - Operation Flashpoint: Dragon Rising - ezshaper->step6->operationflashpoint-dr - - - QuakeIII - checkbox - Quake III - ezshaper->step6->quakeiii - - - QuakeIV - checkbox - Quake IV - ezshaper->step6->quakeiv - - - StarWarsTOR - checkbox - StarWars: The Old Republic - this game uses a LARGE port range, be aware that you may need to manually rearrange the resulting rules to correctly prioritize other traffic. - ezshaper->step6->starwarstor - - - TigerWoods2004PS2 - checkbox - Tiger Woods 2004 for PS2 - ezshaper->step6->tigerwoods2004ps2 - - - TribesAscend - checkbox - Tribes Ascend - ezshaper->step6->tribesascend - - - UnrealTournament - checkbox - Unreal Tournament Series - ezshaper->step6->unrealtournament - - - WolfensteinEnemyTerritory - checkbox - Wolfenstein Enemy Territory - ezshaper->step6->wolfet - - - WorldOfWarcraft - checkbox - World of Warcraft - ezshaper->step6->wow - - - Next - submit - - - /usr/local/www/wizards/traffic_shaper_wizard_dedicated.inc - - - 7 - OPNsense Traffic Shaper Wizard - true - Raise or lower other Applications - - - Enable - checkbox - Other networking protocols - This will help raise or lower the priority of other protocols higher than most traffic. - AppleRemoteDesktop,MSRDP,PCAnywhere,VNC,AIM,Facetime,GoogleHangouts,ICQ,IRC,Jabber,MSN,TeamSpeak,TeamSpeak3,Ventrilo,PPTP,IPSEC,iTunesRadio,StreamingMP3,RTSP,HTTP,IMAP,LotusNotes,POP3,SMTP,BattleNETDownloader,SteamDownloader,APNS,AppleMobileSync,CrashPlan,CVSUP,DNS,GIT,HBCI,ICMP,MySqlServer,NNTP,Slingbox,SMB,SNMP,Subversion - true - ezshaper->step7->enable - - - Next - submit - - - Remote Service / Terminal emulation - listtopic - - - AppleRemoteDesktop - ezshaper->step7->appleremotedesktop - select - - - - - - Apple Remote Desktop - - - MSRDP - select - ezshaper->step7->msrdp - - - - - - Microsoft Remote Desktop Protocol - - - PCAnywhere - ezshaper->step7->pcanywhere - select - - - - - - Symantec PC Anywhere - - - VNC - ezshaper->step7->vnc - select - - - - - - Virtual Network Computing - - - Messengers - listtopic - - - AIM - ezshaper->step7->aolinstantmessenger - select - - - - - - AOL Instant Messenger - - - Facetime - ezshaper->step7->facetime - select - - - - - - Facetime - - - ICQ - ezshaper->step7->icq - select - - - - - - ICQ - - - IRC - select - ezshaper->step7->irc - - - - - - Internet Relay Chat - - - Jabber - select - ezshaper->step7->jabber - - - - - - Jabber instant messanger - - - GoogleHangouts - ezshaper->step7->googlehangouts - select - - - - - - Google Hangouts - - - MSN - ezshaper->step7->msnmessenger - select - - - - - - MSN Messenger - - - Teamspeak - ezshaper->step7->teamspeak - select - - - - - - TeamSpeak - - - Teamspeak3 - ezshaper->step7->teamspeak3 - select - - - - - - TeamSpeak 3 - - - Ventrilo - ezshaper->step7->ventrilo - select - - - - - - Ventrilo - - - VPN - listtopic - - - PPTP - select - ezshaper->step7->pptp - - - - - - Microsoft Point to Point tunneling protocol - - - IPSEC - select - ezshaper->step7->ipsec - - - - - - IPSEC VPN traffic - - - Multimedia/Streaming - listtopic - - - iTunesRadio - select - ezshaper->step7->itunesradio - - - - - - iTunes Radio - this rule uses a LARGE port range, be aware that you may need to manually rearrange the resulting rules to correctly prioritize other traffic. - - - StreamingMP3 - select - ezshaper->step7->streamingmp3 - - - - - - Streaming Media - - - RTSP - ezshaper->step7->rtsp - select - - - - - - RealTime streaming protocol - - - Web - listtopic - - - HTTP - select - ezshaper->step7->http - - - - - - HTTP and HTTPS aka Web Traffic - - - Mail - listtopic - - - SMTP - select - ezshaper->step7->smtp - - - - - - Mail Protocol - - - POP3 - select - ezshaper->step7->pop3 - - - - - - POP3 Protocol - - - IMAP - ezshaper->step7->imap - select - - - - - - IMAP Protocol - - - LotusNotes - ezshaper->step7->lotusnotes - select - - - - - - Lotus Notes - - - Game Downloader - listtopic - - - BattleNetDownloader - select - ezshaper->step7->battlenetdownloader - - - - - - Battle.NET Downloader - - - SteamDownloader - select - ezshaper->step7->steamdownloader - - - - - - Steam Downloader - - - Miscellaneous - listtopic - - - APNS - select - ezshaper->step7->apns - - - - - - Apple Push Notification Service - - - AppleMobileSync - select - ezshaper->step7->applemobilesync - - - - - - Apple Mobile Sync - - - CrashPlan - ezshaper->step7->crashplan - select - - - - - - CrashPlan - - - CVSUP - ezshaper->step7->cvsup - select - - - - - - CVSUP - - - DNS - select - ezshaper->step7->dns - - - - - - Domain Name Services - - - Git - ezshaper->step7->git - select - - - - - - Git Server - - - HBCI - ezshaper->step7->hbci - select - - - - - - HBCI - - - ICMP - ezshaper->step7->icmp - select - - - - - - ICMP Protocol - - - SMB - ezshaper->step7->smb - select - - - - - - Microsoft SMB Protocol and friends - - - SNMP - ezshaper->step7->snmp - select - - - - - - Simple Network Management Protocol - - - MySQLServer - ezshaper->step7->mysqlserver - select - - - - - - MySQL Server - - - NNTP - ezshaper->step7->nntp - select - - - - - - Internet News - - - Slingbox - ezshaper->step7->slingbox - select - - - - - - Slingbox - - - Subversion - ezshaper->step7->subversion - select - - - - - - Subversion Server - - - Next - submit - - - /usr/local/www/wizards/traffic_shaper_wizard_dedicated.inc - - - 8 - OPNsense Traffic Shaper Wizard - - Reload profile notice - listtopic - - After pressing Finish the system will load the new profile.<br/> Please note that this may take a moment.<br/> Also note that the traffic shaper is stateful meaning that only new connections will be shaped.<br/> If this is an issue please reset the state table after loading the profile.<br/> - - - Finish - submit - - - step8_stepsubmitphpaction(); - /usr/local/www/wizards/traffic_shaper_wizard_dedicated.inc - - diff --git a/src/www/wizards/traffic_shaper_wizard_multi_all.inc b/src/www/wizards/traffic_shaper_wizard_multi_all.inc deleted file mode 100644 index e623a1d30..000000000 --- a/src/www/wizards/traffic_shaper_wizard_multi_all.inc +++ /dev/null @@ -1,1725 +0,0 @@ - $ifdesc) { - if (!is_altq_capable(get_real_interface($if))) - continue; - if (interface_has_gateway($if) || interface_has_gatewayv6($if)) - $wans++; - else - $lans++; - } - - foreach ($fields as &$field) { - if ($field['name'] == 'numberofconnections') - $field['value'] = $wans; - else if ($field['name'] == 'numberoflocalinterfaces') - $field['value'] = $lans; - } -} - -function step1_submitphpaction() { - 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; - } - - if (!isset($_POST['numberoflocalinterfaces'])) { - $savemsg=gettext("You need to specify the number of LAN type interfaces."); - $stepid--; - return; - } - if (intval($_POST['numberoflocalinterfaces']) < 1) { - $savemsg=gettext("The number of LAN type interfaces should be greater than 1."); - $stepid--; - return; - } -} - -function step2_stepbeforeformdisplay() { - global $config, $pkg; - global $stepid, $savemsg; - - $wans = 0; - $lans = 0; - $iflist = array(); - $iflisttmp = get_configured_interface_with_descr(); - foreach ($iflisttmp as $if => $ifdesc) { - if (!is_altq_capable(get_real_interface($if))) - continue; - if (interface_has_gateway($if) || interface_has_gatewayv6($if)) - $wans++; - else - $lans++; - $iflist[$if] = $ifdesc; - } - $numberofconnections = intval($config['ezshaper']['step1']['numberofconnections']); - if ($numberofconnections > $wans) { - $savemsg=gettext("You have less interfaces than number of connections!"); - $stepid--; - return; - } - - $numberoflocalinterfaces = intval($config['ezshaper']['step1']['numberoflocalinterfaces']); - if ($numberoflocalinterfaces > $lans) { - $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(); - - for ($i = 0; $i < $numberoflocalinterfaces; $i++) { - $field = array(); - $interface_friendly = $i+1; - $field['name'] = "Setup connection speed and scheduler information for interface LAN #{$interface_friendly}"; - $field['type'] = "listtopic"; - $fields[] = $field; - - $field = array(); - $field['displayname'] = "Interface & Scheduler"; - $field['name'] = "local{$i}interface"; - $field['type'] = "select"; - $field['options']['option'] = array(); - foreach ($iflist as $ifname => $ifdescr) { - // Skip wan interfaces here - if (interface_has_gateway($ifname) || interface_has_gatewayv6($ifname)) - continue; - $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['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 WAN#{$interface_friendly}"; - $field['type'] = "listtopic"; - $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) { - // Skip lan interfaces here - if (!interface_has_gateway($ifname) && !interface_has_gatewayv6($ifname)) - continue; - $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['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"]) { - $savemsg=gettext("You cannot select the same interface for connections {$i} and {$j}."); - $stepid--; - return; - } - if (trim($_POST["conn{$i}uploadscheduler"]) != "PRIQ") { - 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}uploadscheduler"]) == "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"]) { - $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(); - - for ($i = 0; $i < $localint; $i++) { - $config['ezshaper']['step2']["local{$i}downloadscheduler"] = $_POST["local{$i}downloadscheduler"]; - $config['ezshaper']['step2']["local{$i}interface"] = $_POST["local{$i}interface"]; - } - - for ($i = 0; $i < $steps; $i++) { - $config['ezshaper']['step2']["conn{$i}uploadscheduler"] = $_POST["conn{$i}uploadscheduler"]; - $config['ezshaper']['step2']["conn{$i}upload"] = $_POST["conn{$i}upload"]; - $config['ezshaper']['step2']["conn{$i}uploadspeed"] = $_POST["conn{$i}uploadspeed"]; - $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['displayname'] = "Upstream SIP Server"; - $field['name'] = "upstream_sip_server"; - $enablefields[] = "upstream_sip_server"; - $field['type'] = "inputalias"; - $field['description'] = "(Optional) If this is chosen, the provider field will be overridden. This allows you to provide the IP address of the remote PBX or SIP Trunk 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; - - $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; - - $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; - } - - for ($i = 0; $i < $numberoflocalinterfaces; $i++) { - $field = array(); - $interface_friendly = $i+1; - $field['name'] = "Connection LAN #{$interface_friendly}"; - $field['type'] = "listtopic"; - $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['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['enable']) - 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; - } - } - - $steps = intval($config['ezshaper']['step1']['numberofconnections']); - for ($i = 0; $i < $steps; $i++) { - if ($config['ezshaper']['step2']["conn{$i}uploadscheduler"] == "PRIQ") - continue; - if (!is_numeric($_POST["conn{$i}upload"])) { - $savemsg = gettext("Upload bandwidth of connection {$i} is not valid."); - $stepid--; - return; - } - if ($_POST["conn{$i}uploadspeed"] == "%") { - if (intval($_POST["conn{$i}upload"]) > 80) { - $savemsg=gettext("You cannot set the VoIP upload bandwidth on connection {$i} higher than 80% of the connection."); - $stepid--; - return; - } - } else { - $factor = wizard_get_bandwidthtype_scale($config['ezshaper']['step2']["conn{$i}uploadspeed"]); - $ifbw = $factor * floatval($config['ezshaper']['step2']["conn{$i}upload"]); - $factor = wizard_get_bandwidthtype_scale($_POST["conn{$i}uploadspeed"]); - $input_bw = $factor * floatval($_POST["conn{$i}upload"]); - if ((0.8 * $ifbw) < $input_bw) { - $savemsg=gettext("You cannot set the VoIP upload bandwidth on connection {$i} higher than 80% of the connection."); - $stepid--; - return; - } - } - } - - $localint = intval($config['ezshaper']['step1']['numberoflocalinterfaces']); - for ($i = 0; $i < $localint; $i++) { - if ($config['ezshaper']['step2']["local{$i}downloadscheduler"] == "PRIQ") - continue; - if (!is_numeric($_POST["local{$i}download"])) { - $savemsg = gettext("Download bandwidth of connection {$i} is not valid."); - $stepid--; - return; - } - if ($_POST["local{$i}downloadspeed"] == "%") { - if (intval($_POST["local{$i}download"]) > 80) { - $savemsg=gettext("You cannot set the VoIP download bandwidth on connection {$i} higher than 80% of the connection."); - $stepid--; - return; - } - } else { - for ($j = 0; $j < $steps; $j++) { - $factor = wizard_get_bandwidthtype_scale($config['ezshaper']['step2']["conn{$j}downloadspeed"]); - $ifbw = $factor * floatval($config['ezshaper']['step2']["conn{$j}download"]); - $factor = wizard_get_bandwidthtype_scale($_POST["local{$i}downloadspeed"]); - $input_bw = $factor * floatval($_POST["local{$i}download"]); - if ((0.8 * $ifbw) < $input_bw) { - $savemsg=gettext("You cannot set the VoIP download bandwidth on connection {$j} 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"]; - } - - 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"]; - } -} - -function step4_stepsubmitphpaction() { - global $config; - global $stepid, $savemsg; - - 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 ($_POST['p2pcatchall']) { - if(!is_numeric($_POST['bandwidth'])) { - $savemsg="Posted value is not a valid bandwidth."; - $stepid--; - } - 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; - } - } - } -} - -function step8_stepsubmitphpaction() { - global $g, $config; - - /* 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(); - - /* apply the new configuration to the system */ - filter_configure(); - - /* And we're no longer dirty! */ - clear_subsystem_dirty('shaper'); - - update_filter_reload_status("Initializing"); - header("Location: status_filter_reload.php"); - exit; -} - -function apply_all_choosen_items() { - global $config, $g, $altq_list_queues, $gamesplist, $voiplist, $othersplist, $p2plist; - - 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'])) - unset($config['shaper']['queue']); - /* XXX: This is ecnundant, 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) - if ($rule['wizard'] == "yes") - unset($config['filter']['rule'][$key]); - - /* restart the cached config */ - unset($altq_list_queues); - $altq_list_queues = array(); - - $steps = intval($config['ezshaper']['step1']['numberofconnections']); - - $interfacelist = array(); - - for ($i = 0; $i < $steps; $i++) { - - $tmppath = array(); - $altq =& new altq_root_queue(); - - $altq->SetInterface($config['ezshaper']['step2']["conn{$i}interface"]); - $interfacelist[] = $config['ezshaper']['step2']["conn{$i}interface"]; - $altq->SetScheduler($config['ezshaper']['step2']["conn{$i}uploadscheduler"]); - $altq->SetBandwidth(floatval($config['ezshaper']['step2']["conn{$i}upload"])); - $altq->SetBwscale($config['ezshaper']['step2']["conn{$i}uploadspeed"]); - $altq->SetEnabled("on"); - $altq_list_queues[$altq->GetQname()] =& $altq; - array_push($tmppath, $config['ezshaper']['step2']["conn{$i}interface"]); - $altq->SetLink($tmppath); - $altq->wconfig(); - - $sched = $config['ezshaper']['step2']["conn{$i}uploadscheduler"]; - $voipbw =0; - $voipbwunit = "Kb"; - $voip = false; - $penalty = false; - $penaltybw = 0; - $penaltybwunit = "Kb"; - $p2p = false; - $p2pcatchall = false; - $p2pcatchbw = 0; - $p2pcatchbwunit = "%"; - $games = false; - $otherpriority = false; - $remainbw = 0; - $factor = 0; - $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 ($voipbwunit == "%") - $factor = $upbw/100; - else - $factor = wizard_get_bandwidthtype_scale($voipbwunit); - $remainbw += $voipbw * $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; - } else { - $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; - } else { - $p2pcatchall = false; - $p2pcatchbw = 0; - } - } else { - $p2p = false; - $p2pcatchall = false; - $p2pcatchbw = 0; - } - if ($config['ezshaper']['step6']['enable']) { - $games = true; - } else { - $games = false; - } - - if ($config['ezshaper']['step7']['enable']) { - $otherpriority = true; - } else { - $otherpriority = false; - } - - $remainbw = round($remainbw / $upbw * 100, 2); - - if (intval($remainbw) > 0 && intval($remainbw) > 30) { - $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={$savemsg}"); - exit; - } else { - $remainbw = 100 - $remainbw; - } - - if ($sched != "PRIQ") { - if ($sched == "CBQ") - $q =& new cbq_queue(); - else if ($sched == "HFSC") - $q =& new hfsc_queue(); - $tmpcf = array(); - $tmpcf['name'] = "qInternet"; - //$tmpcf['priority'] = 6; - $tmpcf['ecn'] = "on"; - $tmpcf['enabled'] = "on"; - If ($sched == "CBQ") { - $tmpcf['bandwidth'] = floatval($config['ezshaper']['step2']["conn{$i}upload"]); - $tmpcf['bandwidthtype'] = $config['ezshaper']['step2']["conn{$i}uploadspeed"]; - } - else if ($sched == "HFSC") { - $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['linkshare'] = "on"; - $tmpcf['bandwidth'] = floatval($config['ezshaper']['step2']["conn{$i}upload"]); - $tmpcf['bandwidthtype'] = $config['ezshaper']['step2']["conn{$i}uploadspeed"]; - } - array_push($tmppath, "qInternet"); - $qtmp =& $altq->add_queue($q, $tmpcf, $tmppath, $input_errors); - //array_pop($tmppath); - //echo "qInternet
"; - //var_dump($input_errors); - $qtmp->wconfig(); - $altq =& $qtmp; - } - - if ($sched == "PRIQ") - $q =& new priq_queue(); - else if ($sched == "CBQ") - $q =& new cbq_queue(); - else if ($sched == "HFSC") - $q =& new hfsc_queue(); - $tmpcf = array(); - $tmpcf['name'] = "qACK"; - $tmpcf['priority'] = 6; - $tmpcf['ecn'] = "on"; - $tmpcf['enabled'] = "on"; - If ($sched == "CBQ") { - $tmpcf['borrow'] = "on"; - $tmpcf['bandwidth'] = $remainbw * 0.2; - $tmpcf['bandwidthtype'] = "%"; - } - else if ($sched == "HFSC") { - $lkbw = 0.20 * $remainbw; - $tmpcf['linkshare3'] = "{$lkbw}%"; - $tmpcf['linkshare'] = "on"; - $tmpcf['bandwidth'] = $lkbw; - $tmpcf['bandwidthtype'] = "%"; - } - array_push($tmppath, "qACK"); - $qtmp =& $altq->add_queue($q, $tmpcf, $tmppath, $input_errors); - array_pop($tmppath); - //echo "qACK
"; - //var_dump($input_errors); - $qtmp->wconfig(); - - if ($sched == "PRIQ") - $q =& new priq_queue(); - else if ($sched == "CBQ") - $q =& new cbq_queue(); - else if ($sched == "HFSC") - $q =& new hfsc_queue(); - $tmpcf = array(); - if ($p2pcatchall) - $tmpcf['name'] = "qOthersDefault"; - else - $tmpcf['name'] = "qDefault"; - $tmpcf['priority'] = 3; - $tmpcf['enabled'] = "on"; - if (!$p2pcatchall) - $tmpcf['default'] = "on"; - $tmpcf['ecn'] = "on"; - if ($sched == "CBQ") { - $tmpcf['borrow'] = "on"; - $tmpcf['bandwidth'] = $remainbw * 0.1; /* 10% bandwidth */ - $tmpcf['bandwidthtype'] = "%"; - } else if ($sched == "HFSC") { - $tmpcf['bandwidth'] = $remainbw * 0.1; /* 10% bandwidth */ - $tmpcf['bandwidthtype'] = "%"; - } - array_push($tmppath, $tmpcf['name']); - $qtmp =& $altq->add_queue($q, $tmpcf, $tmppath, $input_errors); - array_pop($tmppath); - //echo "qDefault
"; - //var_dump($input_errors); - $qtmp->wconfig(); - - if ($p2p) { - if ($sched == "PRIQ") - $q =& new priq_queue(); - else if ($sched == "CBQ") - $q =& new cbq_queue(); - else if ($sched == "HFSC") - $q =& new hfsc_queue(); - $tmpcf = array(); - $tmpcf['name'] = "qP2P"; - $tmpcf['priority'] = 1; - $tmpcf['ecn'] = "on"; - $tmpcf['enabled'] = "on"; - if ($p2pcatchall) { - if ($sched == "CBQ") { - $tmpcf['borrow'] = "on"; - $tmpcf['bandwidth'] = $p2pcatchbw; - $tmpcf['bandwidthtype'] = $p2pcatchbwunit; - } else if ($sched == "HFSC") { - $tmpcf['linkshare'] = "on"; - $tmpcf['linkshare3'] = "{$p2pcatchbw}{$p2pcatchbwunit}"; - $tmpcf['upperlimit'] = "on"; - $tmpcf['upperlimit3'] = "{$p2pcatchbw}{$p2pcatchbwunit}"; - $tmpcf['bandwidth'] = $p2pcatchbw; - $tmpcf['bandwidthtype'] = $p2pcatchbwunit; - } - $tmpcf['default'] = "on"; - - } else { - if ($sched == "CBQ") { - $tmpcf['borrow'] = "on"; - $tmpcf['bandwidth'] = $remainbw * 0.05; /* 5% bandwidth */ - $tmpcf['bandwidthtype'] = "%"; - } else if ($sched == "HFSC") { - $tmpbw = $remainbw * 0.05; /* 5% bandwidth */ - $tmpcf['linkshare'] = "on"; - $tmpcf['linkshare3'] = "{$tmpbw}%"; - $tmpcf['upperlimit'] = "on"; - $tmpcf['upperlimit3'] = "{$tmpbw}%"; - $tmpcf['bandwidth'] = $tmpbw; - $tmpcf['bandwidthtype'] = "%"; - } - } - array_push($tmppath, "qP2P"); - $qtmp =& $altq->add_queue($q, $tmpcf, $tmppath, $input_errors); - array_pop($tmppath); - //echo "qP2P
"; - //var_dump($input_errors); - $qtmp->wconfig(); - } - - if ($voip) { - if ($sched == "PRIQ") - $q =& new priq_queue(); - else if ($sched == "CBQ") - $q =& new cbq_queue(); - else if ($sched == "HFSC") - $q =& new hfsc_queue(); - $tmpcf = array(); - $tmpcf['name'] = "qVoIP"; - $tmpcf['priority'] = 7; - $tmpcf['ecn'] = "on"; - $tmpcf['enabled'] = "on"; - if ($sched == "CBQ") { - $tmpcf['borrow'] = "on"; - if ($voipbw > 0) { - $tmpcf['bandwidth'] = $voipbw; - $tmpcf['bandwidthtype'] = $voipbwunit; - } else { - $tmpcf['bandwidth'] = $remainbw * 0.2; /* 20% bandwidth */ - $tmpcf['bandwidthtype'] = "%"; - } - } else if ($sched == "HFSC") { - if ($voipbw > 0) { - $tmpcf['realtime3'] = "{$voipbw}{$voipbwunit}"; - } else { - $voipbw = $remainbw * 0.20; /* 20% bandwidth */ - $tmpcf['realtime3'] = "{$voipbw}%"; - } - $tmpcf['realtime'] = "on"; - $tmpcf['bandwidth'] = 32; - $tmpcf['bandwidthtype'] = "Kb"; - } - array_push($tmppath, "qVoIP"); - $qtmp =& $altq->add_queue($q, $tmpcf, $tmppath, $input_errors); - array_pop($tmppath); - //echo "qVoIP
"; - //var_dump($input_errors); - $qtmp->wconfig(); - } - - if ($games) { - if ($sched == "PRIQ") - $q =& new priq_queue(); - else if ($sched == "CBQ") - $q =& new cbq_queue(); - else if ($sched == "HFSC") - $q =& new hfsc_queue(); - $tmpcf = array(); - $tmpcf['name'] = "qGames"; - $tmpcf['priority'] = 5; - $tmpcf['enabled'] = "on"; - $tmpcf['ecn'] = "on"; - if ($sched == "CBQ") { - $tmpcf['borrow'] = "on"; - $tmpcf['bandwidth'] = $remainbw * 0.2; /* 20% bandwidth */ - $tmpcf['bandwidthtype'] = "%"; - } else if ($sched == "HFSC") { - $gamesbw = $remainbw * 0.2; /* 20% bandwidth */ - $tmpcf['linkshare'] = "on"; - $tmpcf['linkshare3'] = "{$gamesbw}%"; - $tmpcf['bandwidth'] = "{$gamesbw}"; - $tmpcf['bandwidthtype'] = "%"; - } - array_push($tmppath, "qGames"); - $qtmp =& $altq->add_queue($q, $tmpcf, $tmppath, $input_errors); - array_pop($tmppath); - //echo "qGames
"; - //var_dump($input_errors); - $qtmp->wconfig(); - } - - if ($otherpriority) { - if ($sched == "PRIQ") - $q =& new priq_queue(); - else if ($sched == "CBQ") - $q =& new cbq_queue(); - else if ($sched == "HFSC") - $q =& new hfsc_queue(); - $tmpcf = array(); - $tmpcf['name'] = "qOthersHigh"; - $tmpcf['priority'] = 4; - $tmpcf['ecn'] = "on"; - $tmpcf['enabled'] = "on"; - if ($sched == "CBQ") { - $tmpcf['borrow'] = "on"; - $tmpcf['bandwidth'] = $remainbw * 0.1; /* 10% bandwidth */ - $tmpcf['bandwidthtype'] = "%"; - } else if ($sched == "HFSC") { - $tmpcf['linkshare'] = "on"; - $otherbw = $remainbw * 0.1; /* 10% bandwidth */ - $tmpcf['linkshare3'] = "{$otherbw}%"; - $tmpcf['bandwidth'] = $otherbw; - $tmpcf['bandwidthtype'] = "%"; - } - array_push($tmppath, "qOthersHigh"); - $qtmp =& $altq->add_queue($q, $tmpcf, $tmppath, $input_errors); - array_pop($tmppath); - //echo "qHigh
"; - //var_dump($input_errors); - $qtmp->wconfig(); - - - if ($sched == "PRIQ") - $q =& new priq_queue(); - else if ($sched == "CBQ") - $q =& new cbq_queue(); - else if ($sched == "HFSC") - $q =& new hfsc_queue(); - $tmpcf = array(); - $tmpcf['name'] = "qOthersLow"; - $tmpcf['priority'] = 2; - $tmpcf['ecn'] = "on"; - $tmpcf['enabled'] = "on"; - if ($sched == "CBQ") { - $tmpcf['borrow'] = "on"; - if ($penalty) { - $tmpcf['bandwidthtype'] = $penaltybwunit; - $tmpcf['bandwidth'] = $penaltybw; - } else { - $tmpcf['bandwidth'] = $remainbw * 0.05; /* 5% bandwidth */ - $tmpcf['bandwidthtype'] = "%"; - } - } else if ($sched == "HFSC") { - if ($penalty) { - $tmpcf['linkshare3'] = "{$penaltybw}{$penaltybwunit}"; - $tmpcf['bandwidth'] = $penaltybw; - $tmpcf['bandwidthtype'] = $penaltybwunit; - } else { - $lsbw = $remainbw * 0.05; - $tmpcf['linkshare3'] = "{$lsbw}%"; /* 5% bandwidth */ - $tmpcf['bandwidth'] = $lsbw; - $tmpcf['bandwidthtype'] = "%"; - } - $tmpcf['linkshare'] = "on"; - } - array_push($tmppath, "qOthersLow"); - $qtmp =& $altq->add_queue($q, $tmpcf, $tmppath, $input_errors); - array_pop($tmppath); - //echo "qLow
"; - //var_dump($input_errors); - $qtmp->wconfig(); - } - array_pop($tmppath); - } - - /* LAN bandwidth ----------------------------------------------------------------------------------------- */ - $localint = intval($config['ezshaper']['step1']['numberoflocalinterfaces']); - $lanbw = 0; - for ($i = 0; $i < $steps; $i++) { - $down = wizard_get_bandwidthtype_scale($config['ezshaper']['step2']["conn{$i}downloadspeed"]); - $input_bw = floatval($config['ezshaper']['step2']["conn{$i}download"]) * $down; - $lanbw += $input_bw; - } - - for ($i = 0; $i < $localint; $i++) { - - $tmppath = array(); - $altq =& new altq_root_queue(); - - $altq->SetInterface($config['ezshaper']['step2']["local{$i}interface"]); - $altq->SetScheduler($config['ezshaper']['step2']["local{$i}downloadscheduler"]); - //$altq->SetBandwidth($lanbw/1000); - //$altq->SetBwscale("Kb"); - $altq->SetEnabled("on"); - $altq_list_queues[$altq->GetQname()] =& $altq; - array_push($tmppath, $config['ezshaper']['step2']["local{$i}interface"]); - $altq->SetLink($tmppath); - //var_dump($input_errors); - $altq->wconfig(); - - $sched = $config['ezshaper']['step2']["local{$i}downloadscheduler"]; - $voipbw =0; - $voipbwunit = "%"; - $voip = false; - $penalty = false; - $penaltybw = 0; - $penaltybwunit = "%"; - $p2p = false; - $p2pcatchall = false; - $p2pcatchbw = 0; - $games = false; - $otherpriority = false; - $remainbw = 0; - - - if ($config['ezshaper']['step3']['enable']) { - $voip = true; - $voipbw = $config['ezshaper']['step3']["local{$i}download"]; - $voipbwunit = $config['ezshaper']['step3']["local{$i}downloadspeed"]; - if ($sched != HFSC) { - if ($penaltybwunit == "%") - $factor = $lanbw/100; - else - $factor = wizard_get_bandwidthtype_scale($voipbwunit); - $remainbw += floatval($voipbw) * $factor; - } else - $remainbw += 32000; /* 32Kbit/s reserved for HFSC linksharing */ - } - if ($config['ezshaper']['step4']['enable']) { - $penalty = true; - $penaltybw = $config['ezshaper']['step4']['bandwidth']; - $penaltybwunit = $config['ezshaper']['step4']['bandwidthunit']; - if ($penaltybwunit == "%") - $factor = $lanbw/100; - else - $factor = wizard_get_bandwidthtype_scale($penaltybwunit); - $remainbw += floatval($penaltybw) * $factor; - } else { - $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 += floatval($p2pcatchbw) * $factor; - } else { - $p2pcatchall = false; - $p2pcatchbw = 0; - } - } else { - $p2p = false; - $p2pcatchall = false; - $p2pcatchbw = 0; - } - if ($config['ezshaper']['step6']['enable']) { - $games = true; - } else { - $games = false; - } - - if ($config['ezshaper']['step7']['enable']) { - $otherpriority = true; - } else { - $otherpriority = false; - } - $remainbw = round($remainbw / $lanbw * 100, 2); - - if (intval($remainbw) > 0 && intval($remainbw) > 40) { - $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={$savemsg}"); - exit; - } else { - $remainbw = 100 - $remainbw; - } - - if (!$p2pcatchall) { - if ($sched == "PRIQ") - $q =& new priq_queue(); - else if ($sched == "CBQ") - $q =& new cbq_queue(); - else if ($sched == "HFSC") - $q =& new hfsc_queue(); - $tmpcf = array(); - $tmpcf['name'] = "qLink"; - $tmpcf['priority'] = 2; - $tmpcf['enabled'] = "on"; - $tmpcf['default'] = "on"; - $tmpcf['qlimit'] = 500; - $tmpcf['ecn'] = "on"; - if ($sched == "CBQ") { - $tmpcf['borrow'] = "on"; - $tmpcf['bandwidth'] = 20; /* 20% bandwidth */ - $tmpcf['bandwidthtype'] = "%"; - } else if ($sched == "HFSC") { - $tmpcf['bandwidth'] = 20; /* 20% bandwidth */ - $tmpcf['bandwidthtype'] = "%"; - } - array_push($tmppath, $tmpcf['name']); - $qtmp =& $altq->add_queue($q, $tmpcf, $tmppath, $input_errors); - array_pop($tmppath); - //echo "qDefault
"; - //var_dump($input_errors); - $qtmp->wconfig(); - } - - if ($sched != "PRIQ") { - if ($sched == "CBQ") - $q =& new cbq_queue(); - else if ($sched == "HFSC") - $q =& new hfsc_queue(); - $tmpcf = array(); - $tmpcf['name'] = "qInternet"; - //$tmpcf['priority'] = 6; - $tmpcf['ecn'] = "on"; - $tmpcf['enabled'] = "on"; - If ($sched == "CBQ") { - $tmpcf['bandwidth'] = $lanbw/1000; - $tmpcf['bandwidthtype'] = "Kb"; - } - else if ($sched == "HFSC") { - $tmpcf['linkshare3'] = $lanbw/1000 . "Kb"; - $tmpcf['upperlimit3'] = $lanbw/1000 . "Kb"; - $tmpcf['upperlimit'] = "on"; - $tmpcf['linkshare'] = "on"; - $tmpcf['bandwidth'] = $lanbw/1000; - $tmpcf['bandwidthtype'] = "Kb"; - } - array_push($tmppath, "qInternet"); - $qtmp =& $altq->add_queue($q, $tmpcf, $tmppath, $input_errors); - //array_pop($tmppath); - //echo "qInternet
"; - //var_dump($input_errors); - $qtmp->wconfig(); - $altq =& $qtmp; - } - - if ($sched == "PRIQ") - $q =& new priq_queue(); - else if ($sched == "CBQ") - $q =& new cbq_queue(); - else if ($sched == "HFSC") - $q =& new hfsc_queue(); - $tmpcf = array(); - $tmpcf['name'] = "qACK"; - $tmpcf['priority'] = 6; - $tmpcf['ecn'] = "on"; - $tmpcf['enabled'] = "on"; - If ($sched == "CBQ") { - $tmpcf['borrow'] = "on"; - $tmpcf['bandwidth'] = $remainbw * 0.2; - $tmpcf['bandwidthtype'] = "%"; - } - else if ($sched == "HFSC") { - $lkbw = 0.20 * $remainbw; - $tmpcf['linkshare3'] = "{$lkbw}%"; - $tmpcf['linkshare'] = "on"; - $tmpcf['bandwidth'] = $lkbw; - $tmpcf['bandwidthtype'] = "%"; - } - array_push($tmppath, "qACK"); - $qtmp =& $altq->add_queue($q, $tmpcf, $tmppath, $input_errors); - array_pop($tmppath); - //echo "qACK
"; - //var_dump($input_errors); - $qtmp->wconfig(); - - if ($p2p) { - if ($sched == "PRIQ") - $q =& new priq_queue(); - else if ($sched == "CBQ") - $q =& new cbq_queue(); - else if ($sched == "HFSC") - $q =& new hfsc_queue(); - $tmpcf = array(); - $tmpcf['name'] = "qP2P"; - $tmpcf['priority'] = 1; - $tmpcf['ecn'] = "on"; - $tmpcf['enabled'] = "on"; - if ($p2pcatchall) { - if ($sched == "CBQ") { - $tmpcf['borrow'] = "on"; - $tmpcf['bandwidth'] = $p2pcatchbw; - $tmpcf['bandwidthtype'] = $p2pcatchbwunit; - } else if ($sched == "HFSC") { - $tmpcf['linkshare'] = "on"; - $tmpcf['linkshare3'] = "{$p2pcatchbw}{$p2pcatchbwunit}"; - $tmpcf['upperlimit'] = "on"; - $tmpcf['upperlimit3'] = "{$p2pcatchbw}{$p2pcatchbwunit}"; - $tmpcf['bandwidth'] = $p2pcatchbw; - $tmpcf['bandwidthtype'] = $p2pcatchbwunit; - } - $tmpcf['default'] = "on"; - $tmpcf['qlimit'] = 500; - } else { - if ($sched == "CBQ") { - $tmpcf['borrow'] = "on"; - $tmpcf['bandwidth'] = $remainbw * 0.05; /* 5% bandwidth */ - $tmpcf['bandwidthtype'] = "%"; - } else if ($sched == "HFSC") { - $tmpbw = $remainbw * 0.05; /* 5% bandwidth */ - $tmpcf['linkshare'] = "on"; - $tmpcf['linkshare3'] = "{$tmpbw}%"; - $tmpcf['upperlimit'] = "on"; - $tmpcf['upperlimit3'] = "{$tmpbw}%"; - $tmpcf['bandwidth'] = $tmpbw; - $tmpcf['bandwidthtype'] = "%"; - } - } - array_push($tmppath, "qP2P"); - $qtmp =& $altq->add_queue($q, $tmpcf, $tmppath, $input_errors); - array_pop($tmppath); - //echo "qP2P
"; - //var_dump($input_errors); - $qtmp->wconfig(); - } - - if ($voip) { - if ($sched == "PRIQ") - $q =& new priq_queue(); - else if ($sched == "CBQ") - $q =& new cbq_queue(); - else if ($sched == "HFSC") - $q =& new hfsc_queue(); - $tmpcf = array(); - $tmpcf['name'] = "qVoIP"; - $tmpcf['priority'] = 7; - $tmpcf['ecn'] = "on"; - $tmpcf['enabled'] = "on"; - if ($sched == "CBQ") { - $tmpcf['borrow'] = "on"; - if ($voipbw > 0) { - $tmpcf['bandwidth'] = $voipbw; - $tmpcf['bandwidthtype'] = $voipbwunit; - } else { - $tmpcf['bandwidth'] = $remainbw * 0.2; /* 20% bandwidth */ - $tmpcf['bandwidthtype'] = "%"; - } - } else if ($sched == "HFSC") { - if ($voipbw > 0) { - $tmpcf['realtime3'] = "{$voipbw}{$voipbwunit}"; - } else { - $voipbw = $remainbw * 0.20; /* 20% bandwidth */ - $tmpcf['realtime3'] = "{$voipbw}%"; - } - $tmpcf['realtime'] = "on"; - $tmpcf['bandwidth'] = 32; - $tmpcf['bandwidthtype'] = "Kb"; - } - array_push($tmppath, "qVoIP"); - $qtmp =& $altq->add_queue($q, $tmpcf, $tmppath, $input_errors); - array_pop($tmppath); - //echo "qVoIP
"; - //var_dump($input_errors); - $qtmp->wconfig(); - } - - if ($games) { - if ($sched == "PRIQ") - $q =& new priq_queue(); - else if ($sched == "CBQ") - $q =& new cbq_queue(); - else if ($sched == "HFSC") - $q =& new hfsc_queue(); - $tmpcf = array(); - $tmpcf['name'] = "qGames"; - $tmpcf['priority'] = 5; - $tmpcf['enabled'] = "on"; - $tmpcf['ecn'] = "on"; - if ($sched == "CBQ") { - $tmpcf['borrow'] = "on"; - $tmpcf['bandwidth'] = $remainbw * 0.2; /* 20% bandwidth */ - $tmpcf['bandwidthtype'] = "%"; - } else if ($sched == "HFSC") { - $gamesbw = $remainbw * 0.2; /* 20% bandwidth */ - $tmpcf['linkshare'] = "on"; - $tmpcf['linkshare3'] = "{$gamesbw}%"; - $tmpcf['bandwidth'] = "{$gamesbw}"; - $tmpcf['bandwidthtype'] = "%"; - } - array_push($tmppath, "qGames"); - $qtmp =& $altq->add_queue($q, $tmpcf, $tmppath, $input_errors); - array_pop($tmppath); - //echo "qGames
"; - //var_dump($input_errors); - $qtmp->wconfig(); - } - - if ($otherpriority) { - if ($sched == "PRIQ") - $q =& new priq_queue(); - else if ($sched == "CBQ") - $q =& new cbq_queue(); - else if ($sched == "HFSC") - $q =& new hfsc_queue(); - $tmpcf = array(); - $tmpcf['name'] = "qOthersHigh"; - $tmpcf['priority'] = 4; - $tmpcf['ecn'] = "on"; - $tmpcf['enabled'] = "on"; - if ($sched == "CBQ") { - $tmpcf['borrow'] = "on"; - $tmpcf['bandwidth'] = $remainbw * 0.1; /* 10% bandwidth */ - $tmpcf['bandwidthtype'] = "%"; - } else if ($sched == "HFSC") { - $tmpcf['linkshare'] = "on"; - $otherbw = $remainbw * 0.1; /* 10% bandwidth */ - $tmpcf['linkshare3'] = "{$otherbw}%"; - $tmpcf['bandwidth'] = $otherbw; - $tmpcf['bandwidthtype'] = "%"; - } - array_push($tmppath, "qOthersHigh"); - $qtmp =& $altq->add_queue($q, $tmpcf, $tmppath, $input_errors); - array_pop($tmppath); - //echo "qHigh
"; - //var_dump($input_errors); - $qtmp->wconfig(); - - - if ($sched == "PRIQ") - $q =& new priq_queue(); - else if ($sched == "CBQ") - $q =& new cbq_queue(); - else if ($sched == "HFSC") - $q =& new hfsc_queue(); - $tmpcf = array(); - $tmpcf['name'] = "qOthersLow"; - $tmpcf['priority'] = 3; - $tmpcf['ecn'] = "on"; - $tmpcf['enabled'] = "on"; - if ($sched == "CBQ") { - $tmpcf['borrow'] = "on"; - if ($penalty) { - $tmpcf['bandwidth'] = $penaltybw; - $tmpcf['bandwidthtype'] = $penaltybwunit; - } else { - $tmpcf['bandwidthtype'] = "%"; - $tmpcf['bandwidth'] = $remainbw * 0.05; /* 5% bandwidth */ - } - } else if ($sched == "HFSC") { - if ($penalty) { - $tmpcf['linkshare3'] = "{$penaltybw}{$penaltybwunit}"; - $tmpcf['bandwidth'] = $penaltybw; - $tmpcf['bandwidthtype'] = $penaltybwunit; - } else { - $lsbw = $remainbw * 0.05; - $tmpcf['linkshare3'] = "{$lsbw}%"; /* 5% bandwidth */ - $tmpcf['bandwidth'] = $lsbw; - $tmpcf['bandwidthtype'] = "%"; - } - $tmpcf['linkshare'] = "on"; - } - array_push($tmppath, "qOthersLow"); - $qtmp =& $altq->add_queue($q, $tmpcf, $tmppath, $input_errors); - array_pop($tmppath); - //echo "qLow
"; - //var_dump($input_errors); - $qtmp->wconfig(); - } - array_pop($tmppath); - } - -/* End LAN bandwidth ------------------------------------------------------------------------------------- */ - - - - if (!is_array($config['filter']['rule'])) - $config['filter']['rule'] = array(); - - $interfacelist = implode(",", $interfacelist); - - /* Rules */ - if ($penalty) { - if( is_ipaddr($config['ezshaper']['step4']['address']) || is_alias($config['ezshaper']['step4']['address'])) { - $rule = array(); - $rule['type'] = "match"; - $rule['interface'] = $interfacelist; - $rule['descr'] = gettext("Penalty Box"); - $rule['defaultqueue'] = "qOthersLow"; - $rule['source']['address'] = $config['ezshaper']['step4']['address']; - $rule['destination']['any'] = TRUE; - $rule['floating'] = "yes"; - $rule['wizard'] = "yes"; - $rule['enabled'] = "on"; - $rule['created'] = make_config_revision_entry(null, gettext("Traffic Shaper Wizard")); - $config['filter']['rule'][] = $rule; - - } - } - - /* If user specifies an IP, we don't bother with providers */ - if ($voip) { - if( is_ipaddr($config['ezshaper']['step3']['address']) || is_alias($config['ezshaper']['step3']['address'])) { - /* create VOIP rules */ - $rule = array(); - $rule['type'] = "match"; - //$rule['interface'] = $interfacelist; - $rule['descr'] = gettext("Connections From Upstream SIP Server"); - $rule['protocol'] = "udp"; - $rule['defaultqueue'] = "qVoIP"; - $rule['source']['address'] = $config['ezshaper']['step3']['address']; - $rule['destination']['any'] = TRUE; - $rule['floating'] = "yes"; - $rule['wizard'] = "yes"; - $rule['enabled'] = "on"; - $rule['created'] = make_config_revision_entry(null, gettext("Traffic Shaper Wizard")); - $config['filter']['rule'][] = $rule; - - $rule = array(); - $rule['type'] = "match"; - //$rule['interface'] = $interfacelist; - $rule['descr'] = gettext("Connections To Upstream SIP Server"); - $rule['protocol'] = "udp"; - $rule['defaultqueue'] = "qVoIP"; - $rule['source']['any'] = TRUE; - $rule['destination']['address'] = $config['ezshaper']['step3']['address']; - $rule['floating'] = "yes"; - $rule['wizard'] = "yes"; - $rule['enabled'] = "on"; - $rule['created'] = make_config_revision_entry(null, gettext("Traffic Shaper Wizard")); - $config['filter']['rule'][] = $rule; - - } elseif( $config['ezshaper']['step3']['provider'] == "Generic" ) { - /* create VOIP rules */ - $rule = array(); - $rule['type'] = "match"; - $rule['interface'] = $interfacelist; - $rule['descr'] = "DiffServ/Lowdelay/Upload"; - $rule['protocol'] = "udp"; - $rule['source']['any'] = TRUE; - $rule['defaultqueue'] = "qVoIP"; - $rule['destination']['any'] = TRUE; - $rule['iptos'] = "lowdelay"; - $rule['floating'] = "yes"; - $rule['wizard'] = "yes"; - $rule['enabled'] = "on"; - $rule['created'] = make_config_revision_entry(null, gettext("Traffic Shaper Wizard")); - $config['filter']['rule'][] = $rule; - - } else { - /* loop through voiplist[] */ - foreach ($voiplist[$config['ezshaper']['step3']['provider']] as $voip) { - $rule = array(); - $rule['type'] = "match"; - $rule['interface'] = $interfacelist; - $rule['defaultqueue'] = 'qVoIP'; - $rule['source']['any'] = TRUE; - $rule['destination']['any'] = TRUE; - $rule['descr'] = "m_voip {$voip[0]} outbound"; - $rule['floating'] = "yes"; - $rule['wizard'] = "yes"; - $rule['enabled'] = "on"; - $rule['destination']['port'] = $voip[2]."-".$voip[3]; - if($voip[1] != '') - $rule['protocol'] = $voip[1]; - $rule['created'] = make_config_revision_entry(null, gettext("Traffic Shaper Wizard")); - $config['filter']['rule'][] = $rule; - } - } - } - - /* loop through p2plist[] */ - if ($p2p) { - foreach($config['ezshaper']['step5'] as $key => $val) { - if (!is_array($p2plist[$key])) - continue; - foreach ($p2plist[$key] as $p2pclient) { - $rule = array(); - $rule['type'] = "match"; - $rule['interface'] = $interfacelist; - $rule['defaultqueue'] = 'qP2P'; - $rule['source']['any'] = TRUE; - $rule['destination']['any'] = TRUE; - $rule['descr'] = "m_P2P {$p2pclient[0]} outbound"; - $rule['floating'] = "yes"; - $rule['wizard'] = "yes"; - $rule['destination']['port'] = $p2pclient[2]."-".$p2pclient[3]; - if($p2pclient[1] != '') - $rule['protocol'] = $p2pclient[1]; - $rule['created'] = make_config_revision_entry(null, gettext("Traffic Shaper Wizard")); - $config['filter']['rule'][] = $rule; - } - } - } - - /* loop through gamesplist[] */ - if ($games) { - foreach($config['ezshaper']['step6'] as $key => $val) { - if (!is_array($gamesplist[$key])) - continue; - foreach ($gamesplist[$key] as $Gameclient) { - $rule = array(); - $rule['type'] = "match"; - $rule['interface'] = $interfacelist; - $rule['defaultqueue'] = 'qGames'; - if ($Gameclient[1] == "tcp") - $rule['ackqueue'] = 'qACK'; - $rule['source']['any'] = TRUE; - $rule['destination']['any'] = TRUE; - $rule['floating'] = "yes"; - $rule['wizard'] = "yes"; - $rule['enabled'] = "on"; - $rule['descr'] = "m_Game {$Gameclient[0]} outbound"; - $rule['destination']['port'] = $Gameclient[2]."-".$Gameclient[3]; - if($Gameclient[1] != '') - $rule['protocol'] = $Gameclient[1]; - $rule['created'] = make_config_revision_entry(null, gettext("Traffic Shaper Wizard")); - $config['filter']['rule'][] = $rule; - } - } - } - - /* loop through othersplist[] */ - if ($otherpriority) { - foreach($config['ezshaper']['step7'] as $key => $val) { - if (!is_array($othersplist[$key])) - continue; - foreach ($othersplist[$key] as $otherclient) { - $rule = array(); - $rule['type'] = "match"; - $rule['interface'] = $interfacelist; - switch ($val) { - case "H": - $rule['defaultqueue'] = 'qOthersHigh'; /* posted value H or L */ - if ($otherclient[1] == "tcp") - $rule['ackqueue'] = 'qACK'; - $loop = 0; - break; - case "L": - $rule['defaultqueue'] = 'qOthersLow'; /* posted value H or L */ - if ($otherclient[1] == "tcp") - $rule['ackqueue'] = 'qACK'; - $loop = 0; - break; - case "D": - if ($p2pcatchall) { - $loop = 0; - $rule['defaultqueue'] = 'qOthersDefault'; - if ($otherclient[1] == "tcp") - $rule['ackqueue'] = 'qACK'; - } else - $loop = 1; /* It automitaclly goes to default queue */ - break; - default: - $loop = 1; - } - if (!$loop) { - $rule['source']['any'] = TRUE; - $rule['destination']['any'] = TRUE; - $rule['floating'] = "yes"; - $rule['wizard'] = "yes"; - $rule['enabled'] = "on"; - $rule['descr'] = "m_Other {$otherclient[0]} outbound"; - - if($otherclient[2] or $otherclient[3]) { - $rule['destination']['port'] = $otherclient[2]."-".$otherclient[3]; - } - if($otherclient[1] != '') - $rule['protocol'] = $otherclient[1]; - $rule['created'] = make_config_revision_entry(null, gettext("Traffic Shaper Wizard")); - $config['filter']['rule'][] = $rule; - } - } - } - } - write_config(); -} - -function wizard_get_bandwidthtype_scale($type = "b") { - switch ($type) { - case "Gb": - $factor = 1024 * 1024 * 1024; - break; - case "Mb": - $factor = 1024 * 1024; - break; - case "Kb": - $factor = 1024; - break; - case "b": - default: - $factor = 1; - break; - } - return intval($factor); -} - -?> diff --git a/src/www/wizards/traffic_shaper_wizard_multi_all.xml b/src/www/wizards/traffic_shaper_wizard_multi_all.xml deleted file mode 100644 index a7f47fad8..000000000 --- a/src/www/wizards/traffic_shaper_wizard_multi_all.xml +++ /dev/null @@ -1,1634 +0,0 @@ - - - - - 8 - - 1 - OPNsense Traffic Shaper Wizard - true - This wizard will guide you through setting up the OPNsense traffic shaper. - Please be aware that Custom Bandwidths should not exceed 30% of the interface/link bandwidth. Keep this in mind during the wizard. - - - - listtopic - Traffic shaper Wizard - - - Enter number of WAN type connections - numberofconnections - input - ^[0-9]+$ - Number of connections you have - ezshaper->step1->numberofconnections - - - Enter number of LAN type interfaces - numberoflocalinterfaces - input - ^[0-9]+$ - Number of local interfaces you have - ezshaper->step1->numberoflocalinterfaces - - - Next - submit - - - step1_stepbeforeformdisplay(); - step1_submitphpaction(); - /usr/local/www/wizards/traffic_shaper_wizard_multi_all.inc - - - 2 - OPNsense Traffic Shaper Wizard - Shaper configuration - - step2_stepbeforeformdisplay(); - step2_stepsubmitphpaction(); - /usr/local/www/wizards/traffic_shaper_wizard_multi_all.inc - - - Next - submit - - - - - 3 - OPNsense Traffic Shaper Wizard - Voice over IP - - - Enable - checkbox - Prioritize Voice over IP traffic - This will raise the priority of VOIP traffic above all other traffic. - ezshaper->step3->enable - - - Next - submit - - - VOIP specific settings - listtopic - - - Provider - select - Choose Generic if your provider isn't listed. - ezshaper->step3->provider - - - - - - - - - Upstream SIP Server - inputalias - (Optional) If this is chosen, the provider field will be overridden. This allows you to provide the IP address of the <strong>remote</strong> PBX or SIP Trunk to prioritize. <br />NOTE: You can also use a Firewall Alias in this location. - ezshaper->step3->address - IP Address field is non-blank and doesn't look like an IP address. - - - Bandwidth - input - ^[0-9]*$ - Total bandwidth in percentage(%)(should be between 5 and 40) guarantee for VOIP traffic. - ezshaper->step3->bandwidth - - - Next - submit - - - step3_stepbeforeformdisplay(); - step3_stepsubmitphpaction(); - /usr/local/www/wizards/traffic_shaper_wizard_multi_all.inc - - - 4 - OPNsense Traffic Shaper Wizard - Penalty Box - true - - - true - Enable - checkbox - Penalize IP or Alias - This will lower the priority of traffic from this IP or alias. - Address,Bandwidth,BandwidthSpeed - ezshaper->step4->enable - - - Next - submit - - - PenaltyBox specific settings - listtopic - - - Address - inputalias - 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. - ezshaper->step4->address - IP Address field is non-blank and doesn't look like an IP address. - - - Bandwidth - input - ^[0-9]*$ - Speed must be numerical. - ezshaper->step4->bandwidth - true - - - true - true - true - true - BandwidthSpeed - The limit you want to apply. - select - - - - - - - - ezshaper->step4->bandwidthunit - - - Next - submit - - - step4_stepsubmitphpaction(); - /usr/local/www/wizards/traffic_shaper_wizard_multi_all.inc - - - 5 - OPNsense Traffic Shaper Wizard - Peer to Peer networking - true - - - true - Enable - checkbox - Lower priority of Peer-to-Peer traffic - This will lower the priority of P2P traffic below all other traffic. Please check the items that you would like to prioritize lower than normal traffic. - p2pCatchAll,Bandwidth,BandwidthSpeed,Aimster,BitTorrent,BuddyShare,CuteMX,DCplusplus,dcc,DirectConnect,DirectFileExpress,EDonkey2000,FastTrack,Gnutella,grouper,hotComm,HotlineConnect,iMesh,Napster,OpenNap,Scour,Shareaza,SongSpy,WinMX - ezshaper->step5->enable - - - Next - submit - - - p2p Catch all - listtopic - - - p2pCatchAll - checkbox - When enabled, all uncategorized traffic is fed to the p2p queue. - ezshaper->step5->p2pcatchall - - - Bandwidth - input - ^[0-9]*$ - Speed must be numerical. - ezshaper->step5->bandwidth - true - - - true - true - true - true - BandwidthSpeed - The limit you want to apply. - select - - - - - - - - ezshaper->step5->bandwidthunit - - - Enable/Disable specific P2P protocols - listtopic - - - Aimster - checkbox - Aimster and other P2P using the Aimster protocol and ports - ezshaper->step5->aimster - - - BitTorrent - checkbox - Bittorrent and other P2P using the Torrent protocol and ports - ezshaper->step5->bittorrent - - - BuddyShare - checkbox - BuddyShare and other P2P using the BuddyShare protocol and ports - ezshaper->step5->buddyshare - - - CuteMX - checkbox - CuteMX and other P2P using the CuteMX protocol and ports - ezshaper->step5->cutemx - - - DCplusplus - checkbox - DC++ and other P2P using the DC++ protocol and ports - ezshaper->step5->dcplusplus - - - DCC - checkbox - irc DCC file transfers - ezshaper->step5->dcc - - - DirectConnect - checkbox - DirectConnect and other P2P using the DirectConnect protocol and ports - ezshaper->step5->directconnect - - - DirectFileExpress - checkbox - DirectFileExpress and other P2P using the DirectFileExpress protocol and ports - ezshaper->step5->directfileexpress - - - eDonkey2000 - checkbox - eDonkey and other P2P using the eDonkey protocol and ports - ezshaper->step5->edonkey2000 - - - FastTrack - checkbox - FastTrack and other P2P using the FastTrack protocol and ports - ezshaper->step5->fasttrack - - - Gnutella - checkbox - Gnutella and other P2P using the Gnutella protocol and ports - ezshaper->step5->gnutella - - - grouper - checkbox - grouper and other P2P using the grouper protocol and ports - ezshaper->step5->grouper - - - hotComm - checkbox - hotComm and other P2P using the hotComm protocol and ports - ezshaper->step5->hotcomm - - - HotlineConnect - checkbox - HotlineConnect and other P2P using the HotlineConnect protocol and ports - ezshaper->step5->hotlineconnect - - - iMesh - checkbox - iMesh and other P2P using the iMesh protocol and ports - ezshaper->step5->imesh - - - Napster - checkbox - Napster and other P2P using the Napster protocol and ports - ezshaper->step5->napster - - - OpenNap - checkbox - OpenNap and other P2P using the OpenNap protocol and ports - ezshaper->step5->opennap - - - Scour - checkbox - Scour and other P2P using the Scour protocol and ports - ezshaper->step5->scour - - - Shareaza - checkbox - Shareaza and other P2P using the Shareaza protocol and ports - ezshaper->step5->shareaza - - - SongSpy - checkbox - SongSpy and other P2P using the SongSpy protocol and ports - ezshaper->step5->songspy - - - WinMX - checkbox - WinMX and other P2P using the WinMX protocol and ports - ezshaper->step5->winmx - - - Next - submit - - - step5_stepsubmitphpaction(); - /usr/local/www/wizards/traffic_shaper_wizard_multi_all.inc - - - 6 - OPNsense Traffic Shaper Wizard - true - Network Games - - - Enable - checkbox - Prioritize network gaming traffic - This will raise the priority of gaming traffic to higher than most traffic. - BattleNET,EAOrigin,GameForWindowsLive,PlayStationConsoles,Steam,WiiConsoles,XboxConsoles,ARMA2,ARMA3,Battlefield2,Battlefield3,BattlefieldBC2,Borderlands,CallOfDuty,Counterstrike,Crysis2,Crysis3,DeltaForce,DeadSpace2,DeadSpace3,Dirt3,DOOM3,DragonAge2,EmpireEarth,EveOnline,Everquest,Everquest2,FarCry,FarCry2,FarCry3,GunZOnline,HalfLife,LeagueofLegends,Lineage2,MassEffect3,MechwarriorOnline,Minecraft,OperationFlashpointDR,PlanetSide,PlanetSide2,QuakeIII,QuakeIV,StarWarsTOR,TigerWoods2004PS2,TribesAscend,UnrealTournament,WolfensteinEnemyTerritory,WorldOfWarcraft - true - ezshaper->step6->enable - - - Next - submit - - - Enable/Disable specific game consoles and services - listtopic - - - BattleNET - checkbox - Battle.net - Virtually every game from Blizzard publishing should match this. This includes the following game series: Starcraft, Diablo, Warcraft. Guild Wars also uses this port. - ezshaper->step6->battlenet - - - EAOrigin - checkbox - EA Origin Client - Some PC games by EA use this. - ezshaper->step6->eaorigin - - - GameForWindowsLive - checkbox - Games for Windows Live - ezshaper->step6->gamesforwindowslive - - - PlayStationConsoles - checkbox - PlayStation Consoles - This should cover all ports required for the Playstation 4, Playstation, PS Vita - ezshaper->step6->playstationconsoles - - - Steam - checkbox - Steam Game Client (Includes: America's Army 3, Counter-Strike: Source, Counter-Strike: Global Offensive, Half-Life 2, COD: Black Ops Series, Borderlands 2, Natural Selection 2, Left 4 Dead Series, Portal 2 and many other games on the Steam) - ezshaper->step6->steam - - - WiiConsoles - checkbox - Wii Consoles - Wii, Wii U, DS and 3DS - ezshaper->step6->wiiconsoles - - - XboxConsoles - checkbox - Xbox Consoles - Xbox 360 and Xbox One - ezshaper->step6->xboxconsoles - - - Enable/Disable specific games - listtopic - - - ARMA2 - checkbox - ARMA 2 - ezshaper->step6->arma2 - - - ARMA3 - checkbox - ARMA 3 - ezshaper->step6->arma3 - - - Battlefield2 - checkbox - Battlefield 2 - this game uses a LARGE port range, be aware that you may need to manually rearrange the resulting rules to correctly prioritize other traffic. - ezshaper->step6->battlefield2 - - - Battlefield3 - checkbox - Battlefield 3 and 4 - this game uses a LARGE port range, be aware that you may need to manually rearrange the resulting rules to correctly prioritize other traffic. - ezshaper->step6->battlefield3 - - - BattlefieldBC2 - checkbox - Battlefield: Bad Company 2 - ezshaper->step6->battlefieldbc2 - - - Borderlands - checkbox - Borderlands - ezshaper->step6->borderlands - - - CallOfDuty - checkbox - Call Of Duty (United Offensive) - ezshaper->step6->callofduty - - - Counterstrike - checkbox - Counterstrike. The ultimate 1st person shooter. - ezshaper->step6->counterstrike - - - Crysis2 - checkbox - Crysis 2 - ezshaper->step6->crysis2 - - - Crysis3 - checkbox - Crysis 3 - ezshaper->step6->crysis3 - - - DeadSpace2 - checkbox - Dead Space2 - this game uses a HUGE port range, be aware that you may need to manually rearrange the resulting rules to correctly prioritize other traffic. - ezshaper->step6->deadspace2 - - - DeadSpace3 - checkbox - Dead Space 3 - ezshaper->step6->deadspace3 - - - DeltaForce - checkbox - Delta Force - ezshaper->step6->deltaforce - - - Dirt3 - checkbox - Dirt 3 - ezshaper->step6->dirt3 - - - DOOM3 - checkbox - DOOM3 - ezshaper->step6->doom3 - - - DragonAge2 - checkbox - Dragon Age 2 - ezshaper->step6->dragonage2 - - - EmpireEarth - checkbox - Empire Earth - ezshaper->step6->empireearth - - - EveOnline - checkbox - EVE Online - ezshaper->step6->eveonline - - - Everquest - checkbox - Everquest - this game uses a LARGE port range, be aware that you may need to manually rearrange the resulting rules to correctly prioritize other traffic. - ezshaper->step6->everquest - - - Everquest2 - checkbox - Everquest II - ezshaper->step6->everquest2 - - - FarCry - checkbox - Far Cry - ezshaper->step6->farcry - - - FarCry2 - checkbox - Far Cry 2 - ezshaper->step6->farcry2 - - - FarCry3 - checkbox - Far Cry 3 - ezshaper->step6->farcry3 - - - GunZOnline - checkbox - GunZ Online - ezshaper->step6->gunzonline - - - HalfLife - checkbox - Half-Life - ezshaper->step6->halflife - - - LeagueofLegends - checkbox - League of Legends - this game uses a LARGE port range, be aware that you may need to manually rearrange the resulting rules to correctly prioritize other traffic. - ezshaper->step6->leagueoflegends - - - Lineage2 - checkbox - Lineage II - ezshaper->step6->lineage2 - - - MassEffect3 - checkbox - Mass Effect 3 - ezshaper->step6->masseffect3 - - - MechwarriorOnline - checkbox - MechWarrior: Online - this game uses a LARGE port range, be aware that you may need to manually rearrange the resulting rules to correctly prioritize other traffic. - ezshaper->step6->mechwarrioronline - - - Minecraft - checkbox - Minecraft - ezshaper->step6->minecraft - - - PlanetSide - checkbox - PlanetSide - ezshaper->step6->planetside - - - PlanetSide2 - checkbox - PlanetSide 2 - ezshaper->step6->planetside2 - - - OperationFlashpointDR - checkbox - Operation Flashpoint: Dragon Rising - ezshaper->step6->operationflashpoint-dr - - - QuakeIII - checkbox - Quake III - ezshaper->step6->quakeiii - - - QuakeIV - checkbox - Quake IV - ezshaper->step6->quakeiv - - - StarWarsTOR - checkbox - StarWars: The Old Republic - this game uses a LARGE port range, be aware that you may need to manually rearrange the resulting rules to correctly prioritize other traffic. - ezshaper->step6->starwarstor - - - TigerWoods2004PS2 - checkbox - Tiger Woods 2004 for PS2 - ezshaper->step6->tigerwoods2004ps2 - - - TribesAscend - checkbox - Tribes Ascend - ezshaper->step6->tribesascend - - - UnrealTournament - checkbox - Unreal Tournament Series - ezshaper->step6->unrealtournament - - - WolfensteinEnemyTerritory - checkbox - Wolfenstein Enemy Territory - ezshaper->step6->wolfet - - - WorldOfWarcraft - checkbox - World of Warcraft - ezshaper->step6->wow - - - Next - submit - - - /usr/local/www/wizards/traffic_shaper_wizard_multi_all.inc - - - 7 - OPNsense Traffic Shaper Wizard - true - Raise or lower other Applications - - - Enable - checkbox - Other networking protocols - This will help raise or lower the priority of other protocols higher than most traffic. - AppleRemoteDesktop,MSRDP,PCAnywhere,VNC,AIM,Facetime,GoogleHangouts,ICQ,IRC,Jabber,MSN,TeamSpeak,TeamSpeak3,Ventrilo,PPTP,IPSEC,iTunesRadio,StreamingMP3,RTSP,HTTP,IMAP,LotusNotes,POP3,SMTP,BattleNETDownloader,SteamDownloader,APNS,AppleMobileSync,CrashPlan,CVSUP,DNS,GIT,HBCI,ICMP,MySqlServer,NNTP,Slingbox,SMB,SNMP,Subversion - true - ezshaper->step7->enable - - - Next - submit - - - Remote Service / Terminal emulation - listtopic - - - AppleRemoteDesktop - ezshaper->step7->appleremotedesktop - select - - - - - - Apple Remote Desktop - - - MSRDP - select - ezshaper->step7->msrdp - - - - - - Microsoft Remote Desktop Protocol - - - PCAnywhere - ezshaper->step7->pcanywhere - select - - - - - - Symantec PC Anywhere - - - VNC - ezshaper->step7->vnc - select - - - - - - Virtual Network Computing - - - Messengers - listtopic - - - AIM - ezshaper->step7->aolinstantmessenger - select - - - - - - AOL Instant Messenger - - - Facetime - ezshaper->step7->facetime - select - - - - - - Facetime - - - ICQ - ezshaper->step7->icq - select - - - - - - ICQ - - - IRC - select - ezshaper->step7->irc - - - - - - Internet Relay Chat - - - Jabber - select - ezshaper->step7->jabber - - - - - - Jabber instant messanger - - - GoogleHangouts - ezshaper->step7->googlehangouts - select - - - - - - Google Hangouts - - - MSN - ezshaper->step7->msnmessenger - select - - - - - - MSN Messenger - - - Teamspeak - ezshaper->step7->teamspeak - select - - - - - - TeamSpeak - - - Teamspeak3 - ezshaper->step7->teamspeak3 - select - - - - - - TeamSpeak 3 - - - Ventrilo - ezshaper->step7->ventrilo - select - - - - - - Ventrilo - - - VPN - listtopic - - - PPTP - select - ezshaper->step7->pptp - - - - - - Microsoft Point to Point tunneling protocol - - - IPSEC - select - ezshaper->step7->ipsec - - - - - - IPSEC VPN traffic - - - Multimedia/Streaming - listtopic - - - iTunesRadio - select - ezshaper->step7->itunesradio - - - - - - iTunes Radio - this rule uses a LARGE port range, be aware that you may need to manually rearrange the resulting rules to correctly prioritize other traffic. - - - StreamingMP3 - select - ezshaper->step7->streamingmp3 - - - - - - Streaming Media - - - RTSP - ezshaper->step7->rtsp - select - - - - - - RealTime streaming protocol - - - Web - listtopic - - - HTTP - select - ezshaper->step7->http - - - - - - HTTP and HTTPS aka Web Traffic - - - Mail - listtopic - - - SMTP - select - ezshaper->step7->smtp - - - - - - Mail Protocol - - - POP3 - select - ezshaper->step7->pop3 - - - - - - POP3 Protocol - - - IMAP - ezshaper->step7->imap - select - - - - - - IMAP Protocol - - - LotusNotes - ezshaper->step7->lotusnotes - select - - - - - - Lotus Notes - - - Game Downloader - listtopic - - - BattleNetDownloader - select - ezshaper->step7->battlenetdownloader - - - - - - Battle.NET Downloader - - - SteamDownloader - select - ezshaper->step7->steamdownloader - - - - - - Steam Downloader - - - Miscellaneous - listtopic - - - APNS - select - ezshaper->step7->apns - - - - - - Apple Push Notification Service - - - AppleMobileSync - select - ezshaper->step7->applemobilesync - - - - - - Apple Mobile Sync - - - CrashPlan - ezshaper->step7->crashplan - select - - - - - - CrashPlan - - - CVSUP - ezshaper->step7->cvsup - select - - - - - - CVSUP - - - DNS - select - ezshaper->step7->dns - - - - - - Domain Name Services - - - Git - ezshaper->step7->git - select - - - - - - Git Server - - - HBCI - ezshaper->step7->hbci - select - - - - - - HBCI - - - ICMP - ezshaper->step7->icmp - select - - - - - - ICMP Protocol - - - SMB - ezshaper->step7->smb - select - - - - - - Microsoft SMB Protocol and friends - - - SNMP - ezshaper->step7->snmp - select - - - - - - Simple Network Management Protocol - - - MySQLServer - ezshaper->step7->mysqlserver - select - - - - - - MySQL Server - - - NNTP - ezshaper->step7->nntp - select - - - - - - Internet News - - - Slingbox - ezshaper->step7->slingbox - select - - - - - - Slingbox - - - Subversion - ezshaper->step7->subversion - select - - - - - - Subversion Server - - - Next - submit - - - /usr/local/www/wizards/traffic_shaper_wizard_multi_all.inc - - - 8 - OPNsense Traffic Shaper Wizard - - Reload profile notice - listtopic - - After pressing Finish the system will load the new profile.<br/> Please note that this may take a moment.<br/> Also note that the traffic shaper is stateful meaning that only new connections will be shaped.<br/> If this is an issue please reset the state table after loading the profile.<br/> - - - Finish - submit - - - step8_stepsubmitphpaction(); - /usr/local/www/wizards/traffic_shaper_wizard_multi_all.inc - -