summaryrefslogtreecommitdiffstats
path: root/usr/local/www/wizards
diff options
context:
space:
mode:
authorErmal <eri@pfsense.org>2010-12-22 13:57:45 +0000
committerErmal <eri@pfsense.org>2010-12-22 13:59:05 +0000
commit475c1932c3158a4e9ca718ae3ba2a2eee739ef61 (patch)
tree0669450e7de32517d8c8b58ae9a5679c8a92130f /usr/local/www/wizards
parentd526314b97fbabb2fb4fe65d4986b4d3977041bb (diff)
downloadpfsense-475c1932c3158a4e9ca718ae3ba2a2eee739ef61.zip
pfsense-475c1932c3158a4e9ca718ae3ba2a2eee739ef61.tar.gz
Use the provided settings even for HFSC scheduler instead of hardcoding 32Kbit/s speed on VoIP. Also cleanup some whitespace.
Diffstat (limited to 'usr/local/www/wizards')
-rw-r--r--usr/local/www/wizards/traffic_shaper_wizard.inc59
-rwxr-xr-xusr/local/www/wizards/traffic_shaper_wizard_dedicated.inc63
-rwxr-xr-xusr/local/www/wizards/traffic_shaper_wizard_multi_all.inc112
-rw-r--r--usr/local/www/wizards/traffic_shaper_wizard_multi_lan.inc77
4 files changed, 146 insertions, 165 deletions
diff --git a/usr/local/www/wizards/traffic_shaper_wizard.inc b/usr/local/www/wizards/traffic_shaper_wizard.inc
index 26f3049..c7cb8d5 100644
--- a/usr/local/www/wizards/traffic_shaper_wizard.inc
+++ b/usr/local/www/wizards/traffic_shaper_wizard.inc
@@ -623,45 +623,42 @@ function apply_all_choosen_items() {
$upbw = floatval($config['ezshaper']['step2']["conn{$i}upload"]) * $upfactor;
if ($config['ezshaper']['step3']['enable']) {
- $voip = true;
- $voipbw = floatval($config['ezshaper']['step3']["conn{$i}upload"]);
- $voipbwunit = $config['ezshaper']['step3']["conn{$i}uploadspeed"];
- if ($sched != "HFSC") {
- if ($voipbwunit == "%")
- $factor = $upbw/100;
- else
- $factor = wizard_get_bandwidthtype_scale($voipbwunit);
- $remainbw += $voipbw * $factor;
- } else
- $remainbw += 32000; /* 32Kbit/s forHFSC linksharing */
+ $voip = true;
+ $voipbw = floatval($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;
+ $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;
+ $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;
+ $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;
+ $p2pcatchall = false;
+ $p2pcatchbw = 0;
}
} else {
$p2p = false;
diff --git a/usr/local/www/wizards/traffic_shaper_wizard_dedicated.inc b/usr/local/www/wizards/traffic_shaper_wizard_dedicated.inc
index 04d4474..e59472f 100755
--- a/usr/local/www/wizards/traffic_shaper_wizard_dedicated.inc
+++ b/usr/local/www/wizards/traffic_shaper_wizard_dedicated.inc
@@ -645,48 +645,42 @@ function apply_all_choosen_items() {
$upbw = floatval($config['ezshaper']['step2']["conn{$i}upload"]) * $upfactor;
if ($config['ezshaper']['step3']['enable']) {
- $voip = true;
- $voipbw = $config['ezshaper']['step3']["conn{$i}upload"];
- $voipbwunit = $config['ezshaper']['step3']["conn{$i}uploadspeed"];
- if ($sched != "HFSC") {
- if ($voipbwunit == "%")
- $factor = $upbw/100;
- else
- $factor = wizard_get_bandwidthtype_scale($voipbwunit);
- $remainbw += $voipbw * $factor;
- } else
- $remainbw += 32000; /* 32Kbit/s forHFSC linksharing */
- //echo "<br/>" .$remainbw . " : hmmm " .intval($config['ezshaper']['step3']["conn{$i}upload"]) ."/". $factor;
+ $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;
- //echo "<br/>".$remainbw . " : hmmm " . ($config['ezshaper']['step4']['bandwidth']) . " / " .$factor;
+ $penalty = true;
+ $penaltybw = $config['ezshaper']['step4']['bandwidth'];
+ $penaltybwunit = $config['ezshaper']['step4']['bandwidthunit'];
+ if ($penaltybwunit == "%")
+ $factor = $upbw/100;
+ else
+ $factor = wizard_get_bandwidthtype_scale($penaltybwunit);
+ $remainbw += $penaltybw * $factor;
} else {
- $penalty = false;
- $penaltybw = 0;
+ $penalty = false;
+ $penaltybw = 0;
}
if ($config['ezshaper']['step5']['enable']) {
$p2p = true;
if ($config['ezshaper']['step5']['p2pcatchall']) {
- $p2pcatchall = true;
- $p2pcatchbw = $config['ezshaper']['step5']['bandwidth'];
- $p2pcatchbwunit = $config['ezshaper']['step5']['bandwidthunit'];
- if ($p2pcatchbwunit == "%")
- $factor = $upbw/100;
- else
- $factor = wizard_get_bandwidthtype_scale($p2pcatchbwunit);
- $remainbw += $p2pcatchbw * $factor;
- //echo "<br/>".$remainbw . " : hmmm " . floatval($config['ezshaper']['step5']['bandwidth']) ."/".$factor;
+ $p2pcatchall = true;
+ $p2pcatchbw = $config['ezshaper']['step5']['bandwidth'];
+ $p2pcatchbwunit = $config['ezshaper']['step5']['bandwidthunit'];
+ if ($p2pcatchbwunit == "%")
+ $factor = $upbw/100;
+ else
+ $factor = wizard_get_bandwidthtype_scale($p2pcatchbwunit);
+ $remainbw += $p2pcatchbw * $factor;
} else {
- $p2pcatchall = false;
- $p2pcatchbw = 0;
+ $p2pcatchall = false;
+ $p2pcatchbw = 0;
}
} else {
$p2p = false;
@@ -704,7 +698,6 @@ function apply_all_choosen_items() {
} else {
$otherpriority = false;
}
- //echo "<br/>" .$remainbw . " <br/>";
$remainbw = round($remainbw / $upbw * 100, 2);
if (intval($remainbw) > 0 && intval($remainbw) > 30) {
diff --git a/usr/local/www/wizards/traffic_shaper_wizard_multi_all.inc b/usr/local/www/wizards/traffic_shaper_wizard_multi_all.inc
index 8ff8c60..ab15f97 100755
--- a/usr/local/www/wizards/traffic_shaper_wizard_multi_all.inc
+++ b/usr/local/www/wizards/traffic_shaper_wizard_multi_all.inc
@@ -681,75 +681,69 @@ function apply_all_choosen_items() {
$voip = true;
$voipbw = $config['ezshaper']['step3']["conn{$i}upload"];
$voipbwunit = $config['ezshaper']['step3']["conn{$i}uploadspeed"];
- if ($sched != "HFSC") {
- if ($voipbwunit == "%")
- $factor = $upbw/100;
- else
- $factor = wizard_get_bandwidthtype_scale($voipbwunit);
- $remainbw += $voipbw * $factor;
- } else
- $remainbw += 32000; /* 32Kbit/s forHFSC linksharing */
- //echo "<br/>" .$remainbw . " : hmmm " .intval($config['ezshaper']['step3']["conn{$i}upload"]) ."/". $factor;
- }
- if ($config['ezshaper']['step4']['enable']) {
- $penalty = true;
- $penaltybw = $config['ezshaper']['step4']['bandwidth'];
- $penaltybwunit = $config['ezshaper']['step4']['bandwidthunit'];
- if ($penaltybwunit == "%")
+ 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($penaltybwunit);
- $remainbw += $penaltybw * $factor;
- //echo "<br/>".$remainbw . " : hmmm " . ($config['ezshaper']['step4']['bandwidth']) . " / " .$factor;
+ $factor = wizard_get_bandwidthtype_scale($p2pcatchbwunit);
+ $remainbw += $p2pcatchbw * $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;
- //echo "<br/>".$remainbw . " : hmmm " . floatval($config['ezshaper']['step5']['bandwidth']) ."/".$factor;
- } else {
- $p2pcatchall = false;
- $p2pcatchbw = 0;
- }
- } else {
- $p2p = false;
$p2pcatchall = false;
$p2pcatchbw = 0;
}
- if ($config['ezshaper']['step6']['enable']) {
- $games = true;
- } else {
- $games = false;
- }
+ } 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;
- }
+ if ($config['ezshaper']['step7']['enable']) {
+ $otherpriority = true;
+ } else {
+ $otherpriority = false;
+ }
- $remainbw = round($remainbw / $upbw * 100, 2);
+ $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 (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")
+ if ($sched != "PRIQ") {
+ if ($sched == "CBQ")
$q =& new cbq_queue();
else if ($sched == "HFSC")
$q =& new hfsc_queue();
diff --git a/usr/local/www/wizards/traffic_shaper_wizard_multi_lan.inc b/usr/local/www/wizards/traffic_shaper_wizard_multi_lan.inc
index 4bf3998..44d5314 100644
--- a/usr/local/www/wizards/traffic_shaper_wizard_multi_lan.inc
+++ b/usr/local/www/wizards/traffic_shaper_wizard_multi_lan.inc
@@ -458,45 +458,42 @@ function apply_all_choosen_items() {
$upbw = floatval($config['ezshaper']['step2']["conndownload"]) * $upfactor;
if ($config['ezshaper']['step3']['enable']) {
- $voip = true;
- $voipbw = $config['ezshaper']['step3']["conndownload"];
- $voipbwunit = $config['ezshaper']['step3']["conndownloadspeed"];
- if ($sched != "HFSC") {
- if ($voipbwunit == "%")
- $factor = $upbw/100;
- else
- $factor = wizard_get_bandwidthtype_scale($voipbwunit);
- $remainbw += $voipbw * $factor;
- } else
- $remainbw += 32000; /* 32Kbit/s forHFSC linksharing */
+ $voip = true;
+ $voipbw = $config['ezshaper']['step3']["conndownload"];
+ $voipbwunit = $config['ezshaper']['step3']["conndownloadspeed"];
+ 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;
+ $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;
+ $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;
+ $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;
+ $p2pcatchall = false;
+ $p2pcatchbw = 0;
}
} else {
$p2p = false;
@@ -1350,19 +1347,19 @@ function apply_all_choosen_items() {
function wizard_get_bandwidthtype_scale($type = "b") {
switch ($type) {
- case "Gb":
+ case "Gb":
$factor = 1024 * 1024 * 1024;
- break;
- case "Mb":
+ break;
+ case "Mb":
$factor = 1024 * 1024;
- break;
- case "Kb":
+ break;
+ case "Kb":
$factor = 1024;
- break;
- case "b":
- default:
+ break;
+ case "b":
+ default:
$factor = 1;
- break;
+ break;
}
return intval($factor);
}
OpenPOWER on IntegriCloud