summaryrefslogtreecommitdiffstats
path: root/usr/local
diff options
context:
space:
mode:
authorErmal <eri@pfsense.org>2011-07-15 17:36:16 +0000
committerErmal <eri@pfsense.org>2011-07-15 17:36:16 +0000
commit746fc9ec0a020a69a1636b153c48ba8f1b070785 (patch)
tree271d9663438e4ad55f99b8ed79bb6693b60c3091 /usr/local
parent189b043dfb49450c397e69d8530ea9411326868d (diff)
downloadpfsense-746fc9ec0a020a69a1636b153c48ba8f1b070785.zip
pfsense-746fc9ec0a020a69a1636b153c48ba8f1b070785.tar.gz
Revert "Ticket #749. Do not create the queues at LAN side for traffic_shaper_wizard and traffic_shaper_wizard_multi_all. Since we cannot control bandwidth its useless to try to handle it(ALTQ was built with this concept in mind."
This reverts commit 4447358371f80814ea1c5e0f00c1a7301a2396f6.
Diffstat (limited to 'usr/local')
-rw-r--r--usr/local/www/wizards/traffic_shaper_wizard.inc386
-rwxr-xr-xusr/local/www/wizards/traffic_shaper_wizard_multi_all.inc398
2 files changed, 784 insertions, 0 deletions
diff --git a/usr/local/www/wizards/traffic_shaper_wizard.inc b/usr/local/www/wizards/traffic_shaper_wizard.inc
index 408d663..3f434bf 100644
--- a/usr/local/www/wizards/traffic_shaper_wizard.inc
+++ b/usr/local/www/wizards/traffic_shaper_wizard.inc
@@ -950,6 +950,392 @@ function apply_all_choosen_items() {
array_pop($tmppath);
}
+/* LAN bandwidth ----------------------------------------------------------------------------------------- */
+
+ $tmppath = array();
+ $altq =& new altq_root_queue();
+
+ $altq->SetInterface('lan');
+ $altq->SetScheduler($config['ezshaper']['step2']["downloadscheduler"]);
+ $altq->SetBandwidth($lanbw/1000);
+ $altq->SetBwscale("Kb");
+ $altq->SetEnabled("on");
+ $altq_list_queues[$altq->GetQname()] =& $altq;
+ array_push($tmppath, 'lan');
+ $altq->SetLink($tmppath);
+ //var_dump($input_errors);
+ $altq->wconfig();
+
+ $sched = $config['ezshaper']['step2']["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']["download"];
+ $voipbwunit = $config['ezshaper']['step3']["downloadspeed"];
+ if ($sched != "HFSC") {
+ if ($voipbwunit == "%")
+ $factor = $lanbw/100;
+ else
+ $factor = wizard_get_bandwidthtype_scale($voipbwunit);
+ $remainbw += $voipbw * $factor;
+ } else
+ $remainbw += 32000; /* 32Kbit/s forHFSC 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 += $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 = $lanbw/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 / $lanbw * 100, 2);
+
+ if ($remainbw > 0 && $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.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'] = $lanbw/1000;
+ $tmpcf['bandwidthtype'] = "Kb";
+ }
+ else if ($sched == "HFSC") {
+ $tmpcf['linkshare3'] = $lanbw/1000 ."Kb";
+ $tmpcf['upperlimit'] = "on";
+ $tmpcf['upperlimit3'] = $lanbw/1000 ."Kb";
+ $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 <br />";
+ //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 <br />";
+ //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 <br />";
+ //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 <br />";
+ //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 <br />";
+ //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 <br />";
+ //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 <br />";
+ //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['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 <br />";
+ //var_dump($input_errors);
+ $qtmp->wconfig();
+ }
+ array_pop($tmppath);
+
+/* End LAN bandwidth ------------------------------------------------------------------------------------- */
+
+
if (!is_array($config['filter']['rule']))
$config['filter']['rule'] = array();
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 aaeeccc..a537a6c 100755
--- a/usr/local/www/wizards/traffic_shaper_wizard_multi_all.inc
+++ b/usr/local/www/wizards/traffic_shaper_wizard_multi_all.inc
@@ -1048,6 +1048,404 @@ function apply_all_choosen_items() {
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 ($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 <br />";
+ //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 <br />";
+ //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 <br />";
+ //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 <br />";
+ //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 <br />";
+ //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 <br />";
+ //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 <br />";
+ //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['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 <br />";
+ //var_dump($input_errors);
+ $qtmp->wconfig();
+ }
+ array_pop($tmppath);
+ }
+
+/* End LAN bandwidth ------------------------------------------------------------------------------------- */
+
+
+
if (!is_array($config['filter']['rule']))
$config['filter']['rule'] = array();
OpenPOWER on IntegriCloud