summaryrefslogtreecommitdiffstats
path: root/src/usr/local/www/wizards
diff options
context:
space:
mode:
authorLuiz Otavio O Souza <luiz@netgate.com>2016-11-09 00:21:43 -0600
committerLuiz Otavio O Souza <luiz@netgate.com>2016-11-09 00:21:43 -0600
commitc603770d8e0c51ddd0b8a6bcf281327f0c22db95 (patch)
treef10847fa6c2a93b7e118f4b9eecb24d3a080706d /src/usr/local/www/wizards
parentda7054b7cf77d9322307c52d8340fb30486ce25e (diff)
downloadpfsense-c603770d8e0c51ddd0b8a6bcf281327f0c22db95.zip
pfsense-c603770d8e0c51ddd0b8a6bcf281327f0c22db95.tar.gz
Fix a 'divide by zero' bug on shaper wizard when PRIQ is used and no bandwitdth is entered (the correct setting for a PRIQ scheduler).
Diffstat (limited to 'src/usr/local/www/wizards')
-rw-r--r--src/usr/local/www/wizards/traffic_shaper_wizard_dedicated.inc193
1 files changed, 98 insertions, 95 deletions
diff --git a/src/usr/local/www/wizards/traffic_shaper_wizard_dedicated.inc b/src/usr/local/www/wizards/traffic_shaper_wizard_dedicated.inc
index 7ac38ec..1ebf6f0 100644
--- a/src/usr/local/www/wizards/traffic_shaper_wizard_dedicated.inc
+++ b/src/usr/local/www/wizards/traffic_shaper_wizard_dedicated.inc
@@ -696,71 +696,72 @@ function apply_all_chosen_items() {
$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 == "%")
+ if ($sched != "PRIQ" && $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 ($sched != "PRIQ" && $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 ($sched != "PRIQ" && $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($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;
- }
+ $factor = wizard_get_bandwidthtype_scale($p2pcatchbwunit);
+ $remainbw += $p2pcatchbw * $factor;
} 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);
+ } else {
+ $p2p = false;
+ $p2pcatchall = false;
+ $p2pcatchbw = 0;
+ }
+ if ($config['ezshaper']['step6']['enable']) {
+ $games = true;
+ } else {
+ $games = false;
+ }
- 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 ($config['ezshaper']['step7']['enable']) {
+ $otherpriority = true;
+ } else {
+ $otherpriority = false;
+ }
if ($sched != "PRIQ") {
+ $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 == "CBQ")
$q =& new cbq_queue();
else if ($sched == "HFSC")
@@ -1078,7 +1079,7 @@ function apply_all_chosen_items() {
$otherpriority = false;
$remainbw = 0;
- if ($config['ezshaper']['step3']['enable']) {
+ if ($sched != "PRIQ" && $config['ezshaper']['step3']['enable']) {
$voip = true;
$voipbw = $config['ezshaper']['step3']["local{$i}download"];
$voipbwunit = $config['ezshaper']['step3']["local{$i}downloadspeed"];
@@ -1087,43 +1088,43 @@ function apply_all_chosen_items() {
$factor = $downbw/100;
else
$factor = wizard_get_bandwidthtype_scale($voipbwunit);
- $remainbw += floatval($voipbw) * $factor;
- } else
+ $remainbw += floatval($voipbw) * $factor;
+ } else
$remainbw += 32000; /* 32Kbit/s reserved for HFSC link sharing */
- }
- 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 == "%")
+ }
+ if ($sched != "PRIQ" && $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($p2pcatchbwunit);
- $remainbw += floatval($p2pcatchbw) * $factor;
+ $factor = wizard_get_bandwidthtype_scale($penaltybwunit);
+ $remainbw += floatval($penaltybw) * $factor;
} else {
+ $penalty = false;
+ $penaltybw = 0;
+ }
+ if ($sched != "PRIQ" && $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;
}
- } else {
- $p2p = false;
- $p2pcatchall = false;
- $p2pcatchbw = 0;
- }
if ($config['ezshaper']['step6']['enable']) {
$games = true;
} else {
@@ -1135,16 +1136,18 @@ function apply_all_chosen_items() {
} else {
$otherpriority = false;
}
- $remainbw = round($remainbw / $downbw * 100, 2);
- if (intval($remainbw) > 0 && intval($remainbw) > 40) {
- $savemsg=gettext("Custom Bandwidths are greater than 40%. 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") {
+ $remainbw = round($remainbw / $downbw * 100, 2);
+ if (intval($remainbw) > 0 && intval($remainbw) > 40) {
+ $savemsg=gettext("Custom Bandwidths are greater than 40%. 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;
+ }
+ $downqbw = $downbw;
}
- $downqbw = $downbw;
if (!$p2pcatchall) {
if ($sched == "PRIQ")
$q =& new priq_queue();
OpenPOWER on IntegriCloud