summaryrefslogtreecommitdiffstats
path: root/usr/local/www/wizards/traffic_shaper_wizard.inc
diff options
context:
space:
mode:
authorSeth Mos <seth.mos@xs4all.nl>2006-12-14 22:15:14 +0000
committerSeth Mos <seth.mos@xs4all.nl>2006-12-14 22:15:14 +0000
commita42327f2f49b2fa691382e2c6e4d3d84e08e8b00 (patch)
tree916c8d61aec8120634497535c3cc81fc4bbf3d61 /usr/local/www/wizards/traffic_shaper_wizard.inc
parenta32edd353a731f43fdf947549d98d9153daebdc8 (diff)
downloadpfsense-a42327f2f49b2fa691382e2c6e4d3d84e08e8b00.zip
pfsense-a42327f2f49b2fa691382e2c6e4d3d84e08e8b00.tar.gz
Add Penalty box option to the RELENG_1 wizard. I've had no complaints
and the tests work. It works quite similar to voip queue but with a upper limit. NOTE: This does not shape FTP traffic because of the FTP proxy.
Diffstat (limited to 'usr/local/www/wizards/traffic_shaper_wizard.inc')
-rw-r--r--usr/local/www/wizards/traffic_shaper_wizard.inc108
1 files changed, 101 insertions, 7 deletions
diff --git a/usr/local/www/wizards/traffic_shaper_wizard.inc b/usr/local/www/wizards/traffic_shaper_wizard.inc
index 3dbde55..77b120d 100644
--- a/usr/local/www/wizards/traffic_shaper_wizard.inc
+++ b/usr/local/www/wizards/traffic_shaper_wizard.inc
@@ -322,6 +322,100 @@ function step3_stepsubmitphpaction() {
}
}
function step4_stepsubmitphpaction() {
+ global $g, $config;
+ if(!is_numeric($_POST['bandwidthup']) or !is_numeric($_POST['bandwidthdown'])) {
+ $message="Upload and download speeds must be a number only! Values should be Kbits/second.";
+ header("Location: /wizard.php?xml=traffic_shaper_wizard.xml&amp;stepid=4&amp;message={$message}");
+ exit;
+ }
+ if($_POST['address']) {
+ if(!is_ipaddr($_POST['address'])) {
+ if(!is_alias($_POST['address'])) {
+ /* item is not an ip or alias. error out */
+ $message=gettext("Address must be a valid IP address or Firewall Alias. Please correct this value to continue.");
+ header("Location: /wizard.php?xml=traffic_shaper_wizard.xml&amp;stepid=4&amp;message={$message}");
+ exit;
+ }
+ }
+ }
+
+ if ( $_POST['enable'] ) {
+ $downq = "q" . convert_friendly_interface_to_friendly_descr($config['ezshaper']['step2']['inside_int']);
+ $upq = "q" . convert_friendly_interface_to_friendly_descr($config['ezshaper']['step2']['outside_int']);
+ $downint = strtolower($config['ezshaper']['step2']['inside_int']);
+ $upint = strtolower($config['ezshaper']['step2']['outside_int']);
+
+ /* create qPenaltyUp queue */
+ $queue = array();
+ $queue['name'] = "qPenaltyUp";
+ $queue['attachtoqueue'] = "{$upq}Root";
+ $queue['associatedrule'] = 0;
+ $queue['priority'] = 2;
+ $queue['red'] = "on";
+ $queue['ecn'] = "on";
+ if ($config['shaper']['schedulertype'] == "hfsc") {
+ $queue['upperlimit'] = "on";
+ $queue['upperlimit3'] = $_POST['bandwidthup'] . "Kb";
+ $queue['bandwidth'] = 1;
+ $queue['bandwidthtype'] = '%';
+ $queue['qlimit'] = 500;
+ } elseif ($config['shaper']['schedulertype'] == "cbq") {
+ $queue['borrow'] = "off";
+ $queue['bandwidth'] = $_POST['bandwidthup'];
+ $queue['bandwidthtype'] = 'Kb';
+ }
+ $config['shaper']['queue'][] = $queue;
+
+ /* create qPenaltyDown queue */
+ $queue = array();
+ $queue['name'] = "qPenaltyDown";
+ $queue['attachtoqueue'] = "{$downq}Root";
+ $queue['associatedrule'] = 0;
+ $queue['priority'] = 2;
+ $queue['red'] = "on";
+ $queue['ecn'] = "on";
+ if ($config['shaper']['schedulertype'] == "hfsc") {
+ $queue['upperlimit'] = "on";
+ $queue['upperlimit3'] = $_POST['bandwidthdown'] . "Kb";
+ $queue['bandwidth'] = 1;
+ $queue['bandwidthtype'] = '%';
+ $queue['qlimit'] = 500;
+ } elseif ($config['shaper']['schedulertype'] == "cbq") {
+ $queue['borrow'] = "off";
+ $queue['bandwidth'] = $_POST['bandwidthdown'];
+ $queue['bandwidthtype'] = 'Kb';
+ }
+ $config['shaper']['queue'][] = $queue;
+
+ $config['shaper']['itemsshaped']++;
+
+ /* If user specifies an IP, we don't bother with providers */
+ if( is_ipaddr($_POST['address']) or is_alias($_POST['address'])) {
+ /* create Penalty rules */
+ $rule = array();
+ $rule['descr'] = gettext("Penalty IP");
+ $rule['inqueue'] = "qPenaltyDown";
+ $rule['outqueue'] = "qPenaltyUp";
+ $rule['in-interface'] = $downint;
+ $rule['out-interface'] = $upint;
+ /* $rule['source']['network'] = $downint; */
+ $rule['source']['address'] = $_POST['address'];
+ $rule['destination']['any'] = TRUE;
+ $config['shaper']['rule'][] = $rule;
+
+ $rule = array();
+ $rule['descr'] = gettext("Penalty IP");
+ $rule['inqueue'] = "qPenaltyUp";
+ $rule['outqueue'] = "qPenaltyDown";
+ $rule['in-interface'] = $upint;
+ $rule['out-interface'] = $downint;
+ $rule['source']['any'] = TRUE;
+ $rule['destination']['address'] = $_POST['address'];
+ $config['shaper']['rule'][] = $rule;
+ }
+ }
+}
+function step5_stepsubmitphpaction() {
global $g, $config;
/* XXX - billm - needs to actually honor what the user selects still */
if ( $_POST['enable'] ) {
@@ -460,7 +554,7 @@ function step4_stepsubmitphpaction() {
$config['shaper']['queue'][] = $queue;
}
}
-function step5_stepsubmitphpaction() {
+function step6_stepsubmitphpaction() {
global $g, $config;
/* XXX - billm - needs to actually honor what the user selects still */
if ( $_POST['enable'] ) {
@@ -693,7 +787,7 @@ function step5_stepsubmitphpaction() {
}
}
}
-function step6_stepsubmitphpaction() {
+function step7_stepsubmitphpaction() {
global $g, $config;
if ( $_POST['enable'] ) {
$downq = "q" . convert_friendly_interface_to_friendly_descr($config['ezshaper']['step2']['inside_int']);
@@ -994,7 +1088,7 @@ function step6_stepsubmitphpaction() {
}
}
}
-function step7_stepbeforeformdisplay() {
+function step8_stepbeforeformdisplay() {
global $g, $config;
if($config['shaper']['itemsshaped'] == "0") {
/* no shaper items have been selected
@@ -1006,12 +1100,12 @@ function step7_stepbeforeformdisplay() {
$config['shaper']['enable'] = FALSE;
$message = "No items have been selected to shape. Exiting traffic shaper wizard.";
write_config("No shaper items picked, unsetting shaper configuration");
- header("Location: /wizard.php?xml=traffic_shaper_wizard.xml&amp;stepid=7&amp;message={$message}");
+ header("Location: /wizard.php?xml=traffic_shaper_wizard.xml&amp;stepid=8&amp;message={$message}");
exit;
}
}
-function step7_stepsubmitphpaction() {
+function step8_stepsubmitphpaction() {
global $g, $config, $d_shaperconfdirty_path;
/* Sort rules by queue priority */
sort_rule_by_queue_priority();
@@ -1022,7 +1116,7 @@ function step7_stepsubmitphpaction() {
$upint = strtolower($config['ezshaper']['step2']['outside_int']);
/* install default p2p catch all rule if user has enabled option (MUST BE LAST!) */
- if($config['ezshaper']['step4']['p2pcatchall'] == "on") {
+ if($config['ezshaper']['step5']['p2pcatchall'] == "on") {
$othersplist = array();
$othersplist[] = array('p2pCatchAll', 'tcp', '', '', 'both', '');
$othersplist[] = array('p2pCatchAll2', 'udp', '', '', 'both', '');
@@ -1088,7 +1182,7 @@ function step7_stepsubmitphpaction() {
/* Head over and check out the groovy queue stats */
header("Location: status_filter_reload.php");
}
-function step8_stepsubmitphpaction() {
+function step9_stepsubmitphpaction() {
global $g, $config;
header("Location: status_filter_reload.php");
}
OpenPOWER on IntegriCloud