Project

General

Profile

« Previous | Next » 

Revision d9fb30c4

Added by Jim Pingle about 2 years ago

Corrections for shaper wizards. Fixes #13915

  • Fix many inconsistencies in formatting between the wizards
  • Fix a few potential bugs in both (changes made to one to fix issues
    were not reflected in the other).
  • Various style and whitespace corrections.

View differences:

src/usr/local/www/wizards/traffic_shaper_wizard_dedicated.inc
29 29
	global $stepid, $savemsg, $pkg;
30 30
	$fields = array_get_path($pkg, 'step/0/fields/field', []);
31 31

  
32
	$wans = 0;
33 32
	$lans = 0;
33
	$wans = 0;
34 34

  
35 35
	$iflisttmp = get_configured_interface_with_descr();
36 36
	foreach ($iflisttmp as $if => $ifdesc) {
......
302 302
	$steps = intval(config_get_path('ezshaper/step1/numberofconnections', 0));
303 303
	for ($i = 0; $i < $steps; $i++) {
304 304
		for ($j = $i + 1; $j <= $steps; $j++) {
305
			if ($_POST["conn{$i}interface"] == $_POST["conn{$j}interface"] || $_POST["conn{$i}interface"] == $_POST["local{$j}interface"]) {
305
			if (($_POST["conn{$i}interface"] == $_POST["conn{$j}interface"]) ||
306
			    ($_POST["conn{$i}interface"] == $_POST["local{$j}interface"])) {
306 307
				$savemsg=gettext("The same interface cannot be selected for connections {$i} and {$j}.");
307 308
				$stepid--;
308 309
				return;
......
325 326
					$stepid--;
326 327
					return;
327 328
				}
328
				if (intval($upbw) < 128 && $_POST["conn{$i}uploadspeed"] == "Kb" && trim($_POST["conn{$i}uploadscheduler"]) == "CBQ") {
329
				if ((trim($_POST["conn{$i}uploadscheduler"]) == "CBQ") &&
330
				    (intval($upbw) < 128 && $_POST["conn{$i}uploadspeed"] == "Kb")) {
329 331
					$savemsg=gettext("Uploads smaller than 128Kbit/s is not supported for connection {$i} on CBQ scheduler.");
330 332
					$stepid--;
331 333
					return;
332 334
				}
333 335
			}
334
			if ($_POST["local{$i}interface"] == $_POST["conn{$j}interface"] || $_POST["local{$i}interface"] == $_POST["local{$j}interface"]) {
336
			if (($_POST["local{$i}interface"] == $_POST["conn{$j}interface"]) ||
337
			    ($_POST["local{$i}interface"] == $_POST["local{$j}interface"])) {
335 338
				$savemsg=gettext("The same interface cannot be selected for local and outside.");
336 339
				$stepid--;
337 340
				return;
......
465 468
		$voipfields[] = $field;
466 469

  
467 470
		$field = [];
468
		$field['combinefieldsend'] = "true";
469 471
		$field['displayname'] = "Units";
472
		$field['combinefieldsend'] = "true";
470 473
		$field['dontdisplayname'] = "true";
471 474
		$field['dontcombinecells'] = "true";
472 475
		$field['name'] = "local{$i}downloadspeed";
......
556 559
					return;
557 560
				}
558 561
			} else {
559
				$factor = wizard_get_bandwidthtype_scale(config_get_path("ezshaper/step2/conn{$j}downloadspeed"));
560
				$ifbw = $factor * floatval(config_get_path("ezshaper/step2/conn{$j}download", 0.0));
562
				$factor = wizard_get_bandwidthtype_scale(config_get_path("ezshaper/step2/conn{$i}downloadspeed"));
563
				$ifbw = $factor * floatval(config_get_path("ezshaper/step2/conn{$i}download", 0.0));
561 564
				$factor = wizard_get_bandwidthtype_scale($_POST["local{$i}downloadspeed"]);
562 565
				$input_bw = $factor * floatval($_POST["local{$i}download"]);
563 566
				if ((0.8 * $ifbw) < $input_bw) {
......
577 580
	if ($_POST['enable'] == 'on') {
578 581
		config_set_path("ezshaper/step3/enable", 'on');
579 582
	}
583
	if (!empty($_POST['provider'])) {
584
		$VoIPproviders = ["Generic", "VoicePulse", "Asterisk", "Panasonic"];
585
		if (in_array($_POST['provider'], $VoIPproviders)) {
586
			config_set_path("ezshaper/step3/provider", $_POST['provider']);
587
		}
588
	}
580 589
	for ($i = 0; $i < $steps; $i++) {
581 590
		config_set_path("ezshaper/step3/local{$i}download", $_POST["local{$i}download"]);
582 591
		config_set_path("ezshaper/step3/local{$i}downloadspeed", $_POST["local{$i}downloadspeed"]);
......
784 793
			$otherpriority = false;
785 794
		}
786 795

  
787
			if ($sched != "PRIQ") {
788
				$remainbw = round($remainbw / $upbw * 100, 2);
796
		if ($sched != "PRIQ") {
797
			$remainbw = round($remainbw / $upbw * 100, 2);
789 798

  
790
				if (intval($remainbw) > 0 && intval($remainbw) > 30) {
791
					$savemsg=gettext("Custom Bandwidths are greater than 30%. Please lower them for the wizard to continue.");
792
					header("Location: wizard.php?xml=traffic_shaper_wizard_dedicated.xml&stepid=2&message={$savemsg}");
793
					exit;
794
				} else {
795
					$remainbw = 100 - $remainbw;
796
				}
799
			if (intval($remainbw) > 0 && intval($remainbw) > 30) {
800
				$savemsg=gettext("Custom Bandwidths are greater than 30%. Please lower them for the wizard to continue.");
801
				header("Location: wizard.php?xml=traffic_shaper_wizard_dedicated.xml&stepid=2&message={$savemsg}");
802
				exit;
803
			} else {
804
				$remainbw = 100 - $remainbw;
805
			}
806

  
807
			if ($sched == "CBQ") {
808
				$__tmp_q = new cbq_queue();
809
				$q =& $__tmp_q;
810
			} elseif ($sched == "HFSC") {
811
				$__tmp_q = new hfsc_queue();
812
				$q =& $__tmp_q;
813
			}
814

  
815
			$tmpcf = [];
816
			$tmpcf['name'] = "qInternet";
817
			//$tmpcf['priority'] = 6;
818
			$tmpcf['ecn'] = "on";
819
			$tmpcf['enabled'] = "on";
820
			If ($sched == "CBQ") {
821
				$tmpcf['bandwidth'] = floatval(config_get_path("ezshaper/step2/conn${i}upload", 0.0));
822
				$tmpcf['bandwidthtype'] = config_get_path("ezshaper/step2/conn${i}uploadspeed");
823
			} elseif ($sched == "HFSC") {
824
				$tmpcf['upperlimit'] = "on";
825
				$tmpcf['upperlimit3'] = floatval(config_get_path("ezshaper/step2/conn${i}upload", 0.0)) .
826
							config_get_path("ezshaper/step2/conn${i}uploadspeed");
827
				$tmpcf['linkshare'] = "on";
828
				$tmpcf['linkshare3'] = floatval(config_get_path("ezshaper/step2/conn${i}upload", 0.0)) .
829
							config_get_path("ezshaper/step2/conn${i}uploadspeed");
830
				$tmpcf['bandwidth'] =  floatval(config_get_path("ezshaper/step2/conn${i}upload", 0.0));
831
				$tmpcf['bandwidthtype'] = config_get_path("ezshaper/step2/conn${i}uploadspeed");
832
			}
833

  
834
			array_push($tmppath, "qInternet");
835
			$qtmp =& $altq->add_queue($q, $tmpcf, $tmppath, $input_errors);
836
			//array_pop($tmppath);
837
			$qtmp->wconfig();
838
			$altq =& $qtmp;
839
		}
840

  
841
		if ($sched == "PRIQ") {
842
			$__tmp_q = new priq_queue(); $q =& $__tmp_q;
843
		} elseif ($sched == "CBQ") {
844
			$__tmp_q = new cbq_queue(); $q =& $__tmp_q;
845
		} elseif ($sched == "HFSC") {
846
			$__tmp_q = new hfsc_queue(); $q =& $__tmp_q;
847
		}
848
		$tmpcf = [];
849
		$tmpcf['name'] = "qACK";
850
		$tmpcf['priority'] = 6;
851
		$tmpcf['ecn'] = "on";
852
		$tmpcf['enabled'] = "on";
853
		If ($sched == "CBQ") {
854
			$tmpcf['borrow'] = "on";
855
			$tmpcf['bandwidth'] = intval($remainbw * 0.2);
856
			$tmpcf['bandwidthtype'] = "%";
857
		} elseif ($sched == "HFSC") {
858
			$lkbw = 0.20 * $remainbw;
859
			$tmpcf['linkshare3'] = intval($lkbw) . "%";
860
			$tmpcf['linkshare'] = "on";
861
			$tmpcf['bandwidth'] = intval($lkbw);
862
			$tmpcf['bandwidthtype'] = "%";
863
		}
864
		array_push($tmppath, "qACK");
865
		$qtmp =& $altq->add_queue($q, $tmpcf, $tmppath, $input_errors);
866
		array_pop($tmppath);
867
		$qtmp->wconfig();
868

  
869
		if ($sched == "PRIQ") {
870
			$__tmp_q = new priq_queue();
871
			$q =& $__tmp_q;
872
		} elseif ($sched == "CBQ") {
873
			$__tmp_q = new cbq_queue();
874
			$q =& $__tmp_q;
875
		} elseif ($sched == "HFSC") {
876
			$__tmp_q = new hfsc_queue();
877
			$q =& $__tmp_q;
878
		}
879
		$tmpcf = [];
880
		if ($p2pcatchall) {
881
			$tmpcf['name'] = "qOthersDefault";
882
		} else {
883
			$tmpcf['name'] = "qDefault";
884
		}
885
		$tmpcf['priority'] = 3;
886
		$tmpcf['enabled'] = "on";
887
		if (!$p2pcatchall) {
888
			$tmpcf['default'] = "on";
889
		}
890
		$tmpcf['ecn'] = "on";
891
		if ($sched == "CBQ") {
892
			$tmpcf['borrow'] = "on";
893
			$tmpcf['bandwidth'] = $remainbw * 0.1; /* 10% bandwidth */
894
			$tmpcf['bandwidthtype'] = "%";
895
		} elseif ($sched == "HFSC") {
896
			$tmpcf['bandwidth'] = $remainbw * 0.1; /* 10% bandwidth */
897
			$tmpcf['bandwidthtype'] = "%";
898
		}
899
		array_push($tmppath, $tmpcf['name']);
900
		$qtmp =& $altq->add_queue($q, $tmpcf, $tmppath, $input_errors);
901
		array_pop($tmppath);
902
		$qtmp->wconfig();
797 903

  
904
		if ($p2p) {
905
			if ($sched == "PRIQ") {
906
				$__tmp_q = new priq_queue();
907
				$q =& $__tmp_q;
908
			} elseif ($sched == "CBQ") {
909
				$__tmp_q = new cbq_queue();
910
				$q =& $__tmp_q;
911
			} elseif ($sched == "HFSC") {
912
				$__tmp_q = new hfsc_queue();
913
				$q =& $__tmp_q;
914
			}
915
			$tmpcf = [];
916
			$tmpcf['name'] = "qP2P";
917
			$tmpcf['priority'] = 1;
918
			$tmpcf['ecn'] = "on";
919
			$tmpcf['enabled'] = "on";
920
			if ($p2pcatchall) {
798 921
				if ($sched == "CBQ") {
799
					$__tmp_q = new cbq_queue();
800
					$q =& $__tmp_q;
922
					$tmpcf['borrow'] = "on";
923
					$tmpcf['bandwidth'] = $p2pcatchbw;
924
					$tmpcf['bandwidthtype'] = $p2pcatchbwunit;
801 925
				} elseif ($sched == "HFSC") {
802
					$__tmp_q = new hfsc_queue();
803
					$q =& $__tmp_q;
926
					$tmpcf['linkshare'] = "on";
927
					$tmpcf['linkshare3'] = "{$p2pcatchbw}{$p2pcatchbwunit}";
928
					$tmpcf['upperlimit'] = "on";
929
					$tmpcf['upperlimit3'] = "{$p2pcatchbw}{$p2pcatchbwunit}";
930
					$tmpcf['bandwidth'] = $p2pcatchbw;
931
					$tmpcf['bandwidthtype'] = $p2pcatchbwunit;
804 932
				}
805

  
806
				$tmpcf = [];
807
				$tmpcf['name'] = "qInternet";
808
				//$tmpcf['priority'] = 6;
809
				$tmpcf['ecn'] = "on";
810
				$tmpcf['enabled'] = "on";
811
				If ($sched == "CBQ") {
812
					$tmpcf['bandwidth'] = floatval(config_get_path("ezshaper/step2/conn${i}upload", 0.0));
813
					$tmpcf['bandwidthtype'] = config_get_path("ezshaper/step2/conn${i}uploadspeed");
933
				$tmpcf['default'] = "on";
934
			} else {
935
				if ($sched == "CBQ") {
936
					$tmpcf['borrow'] = "on";
937
					$tmpcf['bandwidth'] = $remainbw * 0.05; /* 5% bandwidth */
938
					$tmpcf['bandwidthtype'] = "%";
814 939
				} elseif ($sched == "HFSC") {
815
					$tmpcf['upperlimit'] = "on";
816
					$tmpcf['upperlimit3'] = floatval(config_get_path("ezshaper/step2/conn${i}upload", 0.0)) . config_get_path("ezshaper/step2/conn${i}uploadspeed");
940
					$tmpbw = $remainbw * 0.05; /* 5% bandwidth */
817 941
					$tmpcf['linkshare'] = "on";
818
					$tmpcf['linkshare3'] = floatval(config_get_path("ezshaper/step2/conn${i}upload", 0.0)) . config_get_path("ezshaper/step2/conn${i}uploadspeed");
819
					$tmpcf['bandwidth'] =  floatval(config_get_path("ezshaper/step2/conn${i}upload", 0.0));
820
					$tmpcf['bandwidthtype'] = config_get_path("ezshaper/step2/conn${i}uploadspeed");
942
					$tmpcf['linkshare3'] = "{$tmpbw}%";
943
					$tmpcf['upperlimit'] = "on";
944
					$tmpcf['upperlimit3'] = "{$tmpbw}%";
945
					$tmpcf['bandwidth'] = $tmpbw;
946
					$tmpcf['bandwidthtype'] = "%";
821 947
				}
822
				array_push($tmppath, "qInternet");
823
				$qtmp =& $altq->add_queue($q, $tmpcf, $tmppath, $input_errors);
824
				//array_pop($tmppath);
825
				//echo "qInternet <br />";
826
				//var_dump($input_errors);
827
				$qtmp->wconfig();
828
				$altq =& $qtmp;
829 948
			}
949
			array_push($tmppath, "qP2P");
950
			$qtmp =& $altq->add_queue($q, $tmpcf, $tmppath, $input_errors);
951
			array_pop($tmppath);
952
			$qtmp->wconfig();
953
		}
830 954

  
955
		if ($voip) {
831 956
			if ($sched == "PRIQ") {
832
				$__tmp_q = new priq_queue(); $q =& $__tmp_q;
957
				$__tmp_q = new priq_queue();
958
				$q =& $__tmp_q;
833 959
			} elseif ($sched == "CBQ") {
834
				$__tmp_q = new cbq_queue(); $q =& $__tmp_q;
960
				$__tmp_q = new cbq_queue();
961
				$q =& $__tmp_q;
835 962
			} elseif ($sched == "HFSC") {
836
				$__tmp_q = new hfsc_queue(); $q =& $__tmp_q;
963
				$__tmp_q = new hfsc_queue();
964
				$q =& $__tmp_q;
837 965
			}
838 966
			$tmpcf = [];
839
			$tmpcf['name'] = "qACK";
840
			$tmpcf['priority'] = 6;
967
			$tmpcf['name'] = "qVoIP";
968
			$tmpcf['priority'] = 7;
841 969
			$tmpcf['ecn'] = "on";
842 970
			$tmpcf['enabled'] = "on";
843
			If ($sched == "CBQ") {
971
			if ($sched == "CBQ") {
972
				$tmpcf['borrow'] = "on";
973
				if ($voipbw > 0) {
974
					$tmpcf['bandwidth'] = $voipbw;
975
					$tmpcf['bandwidthtype'] = $voipbwunit;
976
				} else {
977
					$tmpcf['bandwidth'] = $remainbw * 0.2; /* 20% bandwidth */
978
					$tmpcf['bandwidthtype'] = "%";
979
				}
980
			} elseif ($sched == "HFSC") {
981
				if ($voipbw > 0) {
982
					$tmpcf['realtime3'] = "{$voipbw}{$voipbwunit}";
983
				} else {
984
					$voipbw = $remainbw * 0.20; /* 20% bandwidth */
985
					$tmpcf['realtime3'] = "{$voipbw}%";
986
				}
987
				$tmpcf['realtime'] = "on";
988
				$tmpcf['bandwidth'] = 32;
989
				$tmpcf['bandwidthtype'] = "Kb";
990
			}
991
			array_push($tmppath, "qVoIP");
992
			$qtmp =& $altq->add_queue($q, $tmpcf, $tmppath, $input_errors);
993
			array_pop($tmppath);
994
			$qtmp->wconfig();
995
		}
996

  
997
		if ($games) {
998
			if ($sched == "PRIQ") {
999
				$__tmp_q = new priq_queue();
1000
				$q =& $__tmp_q;
1001
			} elseif ($sched == "CBQ") {
1002
				$__tmp_q = new cbq_queue();
1003
				$q =& $__tmp_q;
1004
			} elseif ($sched == "HFSC") {
1005
				$__tmp_q = new hfsc_queue();
1006
				$q =& $__tmp_q;
1007
			}
1008
			$tmpcf = [];
1009
			$tmpcf['name'] = "qGames";
1010
			$tmpcf['priority'] = 5;
1011
			$tmpcf['enabled'] = "on";
1012
			$tmpcf['ecn'] = "on";
1013
			if ($sched == "CBQ") {
844 1014
				$tmpcf['borrow'] = "on";
845
				$tmpcf['bandwidth'] = $remainbw * 0.2;
1015
				$tmpcf['bandwidth'] = $remainbw * 0.2; /* 20% bandwidth */
846 1016
				$tmpcf['bandwidthtype'] = "%";
847 1017
			} elseif ($sched == "HFSC") {
848
				$lkbw = 0.20 * $remainbw;
849
				$tmpcf['linkshare3'] = "{$lkbw}%";
1018
				$gamesbw = $remainbw * 0.2; /* 20% bandwidth */
850 1019
				$tmpcf['linkshare'] = "on";
851
				$tmpcf['bandwidth'] = $lkbw;
1020
				$tmpcf['linkshare3'] = "{$gamesbw}%";
1021
				$tmpcf['bandwidth'] = "{$gamesbw}";
852 1022
				$tmpcf['bandwidthtype'] = "%";
853 1023
			}
854
			array_push($tmppath, "qACK");
1024
			array_push($tmppath, "qGames");
855 1025
			$qtmp =& $altq->add_queue($q, $tmpcf, $tmppath, $input_errors);
856 1026
			array_pop($tmppath);
857
			//echo "qACK <br />";
858
			//var_dump($input_errors);
859 1027
			$qtmp->wconfig();
1028
		}
860 1029

  
1030
		if ($otherpriority) {
861 1031
			if ($sched == "PRIQ") {
862
				$__tmp_q = new priq_queue(); $q =& $__tmp_q;
1032
				$__tmp_q = new priq_queue();
1033
				$q =& $__tmp_q;
863 1034
			} elseif ($sched == "CBQ") {
864
				$__tmp_q = new cbq_queue(); $q =& $__tmp_q;
1035
				$__tmp_q = new cbq_queue();
1036
				$q =& $__tmp_q;
865 1037
			} elseif ($sched == "HFSC") {
866
				$__tmp_q = new hfsc_queue(); $q =& $__tmp_q;
1038
				$__tmp_q = new hfsc_queue();
1039
				$q =& $__tmp_q;
867 1040
			}
868 1041
			$tmpcf = [];
869
			if ($p2pcatchall) {
870
				$tmpcf['name'] = "qOthersDefault";
871
			} else {
872
				$tmpcf['name'] = "qDefault";
873
			}
874
			$tmpcf['priority'] = 3;
875
			$tmpcf['enabled'] = "on";
876
			if (!$p2pcatchall) {
877
				$tmpcf['default'] = "on";
878
			}
1042
			$tmpcf['name'] = "qOthersHigh";
1043
			$tmpcf['priority'] = 4;
879 1044
			$tmpcf['ecn'] = "on";
1045
			$tmpcf['enabled'] = "on";
880 1046
			if ($sched == "CBQ") {
881 1047
				$tmpcf['borrow'] = "on";
882 1048
				$tmpcf['bandwidth'] = $remainbw * 0.1; /* 10% bandwidth */
883 1049
				$tmpcf['bandwidthtype'] = "%";
884 1050
			} elseif ($sched == "HFSC") {
885
				$tmpcf['bandwidth'] = $remainbw * 0.1; /* 10% bandwidth */
1051
				$tmpcf['linkshare'] = "on";
1052
				$otherbw = $remainbw * 0.1; /* 10% bandwidth */
1053
				$tmpcf['linkshare3'] = "{$otherbw}%";
1054
				$tmpcf['bandwidth'] = $otherbw;
886 1055
				$tmpcf['bandwidthtype'] = "%";
887 1056
			}
888
			array_push($tmppath, $tmpcf['name']);
1057
			array_push($tmppath, "qOthersHigh");
889 1058
			$qtmp =& $altq->add_queue($q, $tmpcf, $tmppath, $input_errors);
890 1059
			array_pop($tmppath);
891
			//echo "qDefault <br />";
892
			//var_dump($input_errors);
893 1060
			$qtmp->wconfig();
894 1061

  
895
			if ($p2p) {
896
				if ($sched == "PRIQ") {
897
					$__tmp_q = new priq_queue(); $q =& $__tmp_q;
898
				} elseif ($sched == "CBQ") {
899
					$__tmp_q = new cbq_queue(); $q =& $__tmp_q;
900
				} elseif ($sched == "HFSC") {
901
					$__tmp_q = new hfsc_queue(); $q =& $__tmp_q;
902
				}
903
				$tmpcf = [];
904
				$tmpcf['name'] = "qP2P";
905
				$tmpcf['priority'] = 1;
906
				$tmpcf['ecn'] = "on";
907
				$tmpcf['enabled'] = "on";
908
				if ($p2pcatchall) {
909
					if ($sched == "CBQ") {
910
						$tmpcf['borrow'] = "on";
911
						$tmpcf['bandwidth'] = $p2pcatchbw;
912
						$tmpcf['bandwidthtype'] = $p2pcatchbwunit;
913
					} elseif ($sched == "HFSC") {
914
						$tmpcf['linkshare'] = "on";
915
						$tmpcf['linkshare3'] = "{$p2pcatchbw}{$p2pcatchbwunit}";
916
						$tmpcf['upperlimit'] = "on";
917
						$tmpcf['upperlimit3'] = "{$p2pcatchbw}{$p2pcatchbwunit}";
918
						$tmpcf['bandwidth'] = $p2pcatchbw;
919
						$tmpcf['bandwidthtype'] = $p2pcatchbwunit;
920
					}
921
					$tmpcf['default'] = "on";
922

  
923
				} else {
924
					if ($sched == "CBQ") {
925
						$tmpcf['borrow'] = "on";
926
						$tmpcf['bandwidth'] = $remainbw * 0.05; /* 5% bandwidth */
927
						$tmpcf['bandwidthtype'] = "%";
928
					} elseif ($sched == "HFSC") {
929
						$tmpbw = $remainbw * 0.05; /* 5% bandwidth */
930
						$tmpcf['linkshare'] = "on";
931
						$tmpcf['linkshare3'] = "{$tmpbw}%";
932
						$tmpcf['upperlimit'] = "on";
933
						$tmpcf['upperlimit3'] = "{$tmpbw}%";
934
						$tmpcf['bandwidth'] = $tmpbw;
935
						$tmpcf['bandwidthtype'] = "%";
936
					}
937
				}
938
				array_push($tmppath, "qP2P");
939
				$qtmp =& $altq->add_queue($q, $tmpcf, $tmppath, $input_errors);
940
				array_pop($tmppath);
941
				//echo "qP2P <br />";
942
				//var_dump($input_errors);
943
				$qtmp->wconfig();
944
			}
945

  
946
			if ($voip) {
947
				if ($sched == "PRIQ") {
948
					$__tmp_q = new priq_queue(); $q =& $__tmp_q;
949
				} elseif ($sched == "CBQ") {
950
					$__tmp_q = new cbq_queue(); $q =& $__tmp_q;
951
				} elseif ($sched == "HFSC") {
952
					$__tmp_q = new hfsc_queue(); $q =& $__tmp_q;
953
				}
954
				$tmpcf = [];
955
				$tmpcf['name'] = "qVoIP";
956
				$tmpcf['priority'] = 7;
957
				$tmpcf['ecn'] = "on";
958
				$tmpcf['enabled'] = "on";
959
				if ($sched == "CBQ") {
960
					$tmpcf['borrow'] = "on";
961
					if ($voipbw > 0) {
962
						$tmpcf['bandwidth'] = $voipbw;
963
						$tmpcf['bandwidthtype'] = $voipbwunit;
964
					} else {
965
						$tmpcf['bandwidth'] = $remainbw * 0.2; /* 20% bandwidth */
966
						$tmpcf['bandwidthtype'] = "%";
967
					}
968
				} elseif ($sched == "HFSC") {
969
					if ($voipbw > 0) {
970
						$tmpcf['realtime3'] = "{$voipbw}{$voipbwunit}";
971
					} else {
972
						$voipbw = $remainbw * 0.20; /* 20% bandwidth */
973
						$tmpcf['realtime3'] = "{$voipbw}%";
974
					}
975
					$tmpcf['realtime'] = "on";
976
					$tmpcf['bandwidth'] = 32;
977
					$tmpcf['bandwidthtype'] = "Kb";
978
				}
979
				array_push($tmppath, "qVoIP");
980
				$qtmp =& $altq->add_queue($q, $tmpcf, $tmppath, $input_errors);
981
				array_pop($tmppath);
982
				//echo "qVoIP <br />";
983
				//var_dump($input_errors);
984
				$qtmp->wconfig();
1062
			if ($sched == "PRIQ") {
1063
				$__tmp_q = new priq_queue();
1064
				$q =& $__tmp_q;
1065
			} elseif ($sched == "CBQ") {
1066
				$__tmp_q = new cbq_queue();
1067
				$q =& $__tmp_q;
1068
			} elseif ($sched == "HFSC") {
1069
				$__tmp_q = new hfsc_queue();
1070
				$q =& $__tmp_q;
985 1071
			}
986

  
987
			if ($games) {
988
				if ($sched == "PRIQ") {
989
					$__tmp_q = new priq_queue(); $q =& $__tmp_q;
990
				} elseif ($sched == "CBQ") {
991
					$__tmp_q = new cbq_queue(); $q =& $__tmp_q;
992
				} elseif ($sched == "HFSC") {
993
					$__tmp_q = new hfsc_queue(); $q =& $__tmp_q;
994
				}
995
				$tmpcf = [];
996
				$tmpcf['name'] = "qGames";
997
				$tmpcf['priority'] = 5;
998
				$tmpcf['enabled'] = "on";
999
				$tmpcf['ecn'] = "on";
1000
				if ($sched == "CBQ") {
1001
					$tmpcf['borrow'] = "on";
1002
					$tmpcf['bandwidth'] = $remainbw * 0.2; /* 20% bandwidth */
1003
					$tmpcf['bandwidthtype'] = "%";
1004
				} elseif ($sched == "HFSC") {
1005
					$gamesbw = $remainbw * 0.2; /* 20% bandwidth */
1006
					$tmpcf['linkshare'] = "on";
1007
					$tmpcf['linkshare3'] = "{$gamesbw}%";
1008
					$tmpcf['bandwidth'] = "{$gamesbw}";
1072
			$tmpcf = [];
1073
			$tmpcf['name'] = "qOthersLow";
1074
			$tmpcf['priority'] = 2;
1075
			$tmpcf['ecn'] = "on";
1076
			$tmpcf['enabled'] = "on";
1077
			if ($sched == "CBQ") {
1078
				$tmpcf['borrow'] = "on";
1079
				if ($penalty) {
1080
					$tmpcf['bandwidthtype'] = $penaltybwunit;
1081
					$tmpcf['bandwidth'] = $penaltybw;
1082
				} else {
1083
					$tmpcf['bandwidth'] = $remainbw * 0.05; /* 5% bandwidth */
1009 1084
					$tmpcf['bandwidthtype'] = "%";
1010 1085
				}
1011
				array_push($tmppath, "qGames");
1012
				$qtmp =& $altq->add_queue($q, $tmpcf, $tmppath, $input_errors);
1013
				array_pop($tmppath);
1014
				//echo "qGames <br />";
1015
				//var_dump($input_errors);
1016
				$qtmp->wconfig();
1017
			}
1018

  
1019
			if ($otherpriority) {
1020
				if ($sched == "PRIQ") {
1021
					$__tmp_q = new priq_queue(); $q =& $__tmp_q;
1022
				} elseif ($sched == "CBQ") {
1023
					$__tmp_q = new cbq_queue(); $q =& $__tmp_q;
1024
				} elseif ($sched == "HFSC") {
1025
					$__tmp_q = new hfsc_queue(); $q =& $__tmp_q;
1026
				}
1027
				$tmpcf = [];
1028
				$tmpcf['name'] = "qOthersHigh";
1029
				$tmpcf['priority'] = 4;
1030
				$tmpcf['ecn'] = "on";
1031
				$tmpcf['enabled'] = "on";
1032
				if ($sched == "CBQ") {
1033
					$tmpcf['borrow'] = "on";
1034
					$tmpcf['bandwidth'] = $remainbw * 0.1; /* 10% bandwidth */
1035
					$tmpcf['bandwidthtype'] = "%";
1036
				} elseif ($sched == "HFSC") {
1037
					$tmpcf['linkshare'] = "on";
1038
					$otherbw = $remainbw * 0.1; /* 10% bandwidth */
1039
					$tmpcf['linkshare3'] = "{$otherbw}%";
1040
					$tmpcf['bandwidth'] = $otherbw;
1086
			} elseif ($sched == "HFSC") {
1087
				if ($penalty) {
1088
					$tmpcf['linkshare3'] = "{$penaltybw}{$penaltybwunit}";
1089
					$tmpcf['bandwidth'] = $penaltybw;
1090
					$tmpcf['bandwidthtype'] = $penaltybwunit;
1091
				} else {
1092
					$lsbw = $remainbw * 0.05;
1093
					$tmpcf['linkshare3'] = "{$lsbw}%"; /* 5% bandwidth */
1094
					$tmpcf['bandwidth'] = $lsbw;
1041 1095
					$tmpcf['bandwidthtype'] = "%";
1042 1096
				}
1043
				array_push($tmppath, "qOthersHigh");
1044
				$qtmp =& $altq->add_queue($q, $tmpcf, $tmppath, $input_errors);
1045
				array_pop($tmppath);
1046
				//echo "qHigh <br />";
1047
				//var_dump($input_errors);
1048
				$qtmp->wconfig();
1049

  
1050

  
1051
				if ($sched == "PRIQ") {
1052
					$__tmp_q = new priq_queue(); $q =& $__tmp_q;
1053
				} elseif ($sched == "CBQ") {
1054
					$__tmp_q = new cbq_queue(); $q =& $__tmp_q;
1055
				} elseif ($sched == "HFSC") {
1056
					$__tmp_q = new hfsc_queue(); $q =& $__tmp_q;
1057
				}
1058
				$tmpcf = [];
1059
				$tmpcf['name'] = "qOthersLow";
1060
				$tmpcf['priority'] = 2;
1061
				$tmpcf['ecn'] = "on";
1062
				$tmpcf['enabled'] = "on";
1063
				if ($sched == "CBQ") {
1064
					$tmpcf['borrow'] = "on";
1065
					if ($penalty) {
1066
						$tmpcf['bandwidthtype'] = $penaltybwunit;
1067
						$tmpcf['bandwidth'] = $penaltybw;
1068
					} else {
1069
						$tmpcf['bandwidth'] = $remainbw * 0.05; /* 5% bandwidth */
1070
						$tmpcf['bandwidthtype'] = "%";
1071
					}
1072
				} elseif ($sched == "HFSC") {
1073
					if ($penalty) {
1074
						$tmpcf['linkshare3'] = "{$penaltybw}{$penaltybwunit}";
1075
						$tmpcf['bandwidth'] = $penaltybw;
1076
						$tmpcf['bandwidthtype'] = $penaltybwunit;
1077
					} else {
1078
						$lsbw = $remainbw * 0.05;
1079
						$tmpcf['linkshare3'] = "{$lsbw}%"; /* 5% bandwidth */
1080
						$tmpcf['bandwidth'] = $lsbw;
1081
						$tmpcf['bandwidthtype'] = "%";
1082
					}
1083
					$tmpcf['linkshare'] = "on";
1084
				}
1085
				array_push($tmppath, "qOthersLow");
1086
				$qtmp =& $altq->add_queue($q, $tmpcf, $tmppath, $input_errors);
1087
				array_pop($tmppath);
1088
				//echo "qLow <br />";
1089
				//var_dump($input_errors);
1090
				$qtmp->wconfig();
1097
				$tmpcf['linkshare'] = "on";
1091 1098
			}
1099
			array_push($tmppath, "qOthersLow");
1100
			$qtmp =& $altq->add_queue($q, $tmpcf, $tmppath, $input_errors);
1092 1101
			array_pop($tmppath);
1102
			$qtmp->wconfig();
1103
		}
1104
		array_pop($tmppath);
1093 1105

  
1094
			$downfactor = wizard_get_bandwidthtype_scale(config_get_path("ezshaper/step2/conn${i}downloadspeed"));
1095
			$downbw = floatval(config_get_path("ezshaper/step2/conn${i}download", 0.0)) * $downfactor;
1096

  
1097
			$tmppath = [];
1098
			$__tmp_altq = new altq_root_queue(); $altq =& $__tmp_altq;
1099

  
1100
			$altq->SetInterface(config_get_path("ezshaper/step2/local${i}interface"));
1101
			$altq->SetScheduler(config_get_path("ezshaper/step2/local{$i}downloadscheduler"));
1102
			$altq->SetBandwidth(floatval(config_get_path("ezshaper/step2/conn${i}download", 0.0)));
1103
			$altq->SetBwscale(config_get_path("ezshaper/step2/conn${i}downloadspeed"));
1104
			$altq->SetEnabled("on");
1105
			$altq_list_queues[$altq->GetQname()] =& $altq;
1106
			array_push($tmppath, config_get_path("ezshaper/step2/local${i}interface"));
1107
			$altq->SetLink($tmppath);
1108
			//var_dump($input_errors);
1109
			$altq->wconfig();
1110

  
1111
			$sched = config_get_path("ezshaper/step2/local{$i}downloadscheduler");
1112
			$voipbw =0;
1113
			$voipbwunit = "%";
1114
			$voip = false;
1115
			$penalty = false;
1116
			$penaltybw = 0;
1117
			$penaltybwunit = "%";
1118
			$p2p = false;
1119
			$p2pcatchall = false;
1120
			$p2pcatchbw = 0;
1121
			$games = false;
1122
			$otherpriority = false;
1123
			$remainbw = 0;
1106
		$downfactor = wizard_get_bandwidthtype_scale(config_get_path("ezshaper/step2/conn${i}downloadspeed"));
1107
		$downbw = floatval(config_get_path("ezshaper/step2/conn${i}download", 0.0)) * $downfactor;
1124 1108

  
1125
			if (config_path_enabled('ezshaper/step3')) {
1126
				$voip = true;
1127
				if ($sched != "PRIQ") {
1128
					$voipbw = config_get_path("ezshaper/step3/local{$i}download");
1129
					$voipbwunit = config_get_path("ezshaper/step3/local{$i}downloadspeed");
1130
					if ($sched != 'HFSC') {
1131
						if ($voipbwunit == "%") {
1132
							$factor = $downbw/100;
1133
						} else {
1134
							$factor = wizard_get_bandwidthtype_scale($voipbwunit);
1135
						}
1136
						$remainbw += floatval($voipbw) * $factor;
1109
		$tmppath = [];
1110
		$__tmp_altq = new altq_root_queue(); $altq =& $__tmp_altq;
1111

  
1112
		$altq->SetInterface(config_get_path("ezshaper/step2/local${i}interface"));
1113
		$altq->SetScheduler(config_get_path("ezshaper/step2/local{$i}downloadscheduler"));
1114
		$altq->SetBandwidth(floatval(config_get_path("ezshaper/step2/conn${i}download", 0.0)));
1115
		$altq->SetBwscale(config_get_path("ezshaper/step2/conn${i}downloadspeed"));
1116
		$altq->SetEnabled("on");
1117
		$altq_list_queues[$altq->GetQname()] =& $altq;
1118
		array_push($tmppath, config_get_path("ezshaper/step2/local${i}interface"));
1119
		$altq->SetLink($tmppath);
1120
		$altq->wconfig();
1121

  
1122
		$sched = config_get_path("ezshaper/step2/local{$i}downloadscheduler");
1123
		$voipbw =0;
1124
		$voipbwunit = "%";
1125
		$voip = false;
1126
		$penalty = false;
1127
		$penaltybw = 0;
1128
		$penaltybwunit = "%";
1129
		$p2p = false;
1130
		$p2pcatchall = false;
1131
		$p2pcatchbw = 0;
1132
		$games = false;
1133
		$otherpriority = false;
1134
		$remainbw = 0;
1135

  
1136
		if (config_path_enabled('ezshaper/step3')) {
1137
			$voip = true;
1138
			if ($sched != "PRIQ") {
1139
				$voipbw = config_get_path("ezshaper/step3/local{$i}download");
1140
				$voipbwunit = config_get_path("ezshaper/step3/local{$i}downloadspeed");
1141
				if ($sched != 'HFSC') {
1142
					if ($voipbwunit == "%") {
1143
						$factor = $downbw/100;
1137 1144
					} else {
1138
						$remainbw += 32000; /* 32Kbit/s reserved for HFSC link sharing */
1145
						$factor = wizard_get_bandwidthtype_scale($voipbwunit);
1139 1146
					}
1147
					$remainbw += floatval($voipbw) * $factor;
1148
				} else {
1149
					$remainbw += 32000; /* 32Kbit/s reserved for HFSC link sharing */
1140 1150
				}
1141 1151
			}
1142
			if (config_path_enabled('ezshaper/step4')) {
1143
				$penalty = true;
1152
		}
1153
		if (config_path_enabled('ezshaper/step4')) {
1154
			$penalty = true;
1155
			if ($sched != "PRIQ") {
1156
				$penaltybw = config_get_path('ezshaper/step4/bandwidth');
1157
				$penaltybwunit = config_get_path('ezshaper/step4/bandwidthunit');
1158
				if ($penaltybwunit == "%") {
1159
					$factor = $downbw/100;
1160
				} else {
1161
					$factor = wizard_get_bandwidthtype_scale($penaltybwunit);
1162
				}
1163
				$remainbw += floatval($penaltybw) * $factor;
1164
			}
1165
		}
1166
		if (config_path_enabled('ezshaper/step5')) {
1167
			$p2p = true;
1168
			if (!empty(config_get_path('ezshaper/step5/p2pcatchall'))) {
1169
				$p2pcatchall = true;
1144 1170
				if ($sched != "PRIQ") {
1145
					$penaltybw = config_get_path('ezshaper/step4/bandwidth');
1146
					$penaltybwunit = config_get_path('ezshaper/step4/bandwidthunit');
1147
					if ($penaltybwunit == "%") {
1171
					$p2pcatchbw = config_get_path('ezshaper/step5/bandwidth');
1172
					$p2pcatchbwunit = config_get_path('ezshaper/step5/bandwidthunit');
1173
					if ($p2pcatchbwunit == "%") {
1148 1174
						$factor = $downbw/100;
1149 1175
					} else {
1150
						$factor = wizard_get_bandwidthtype_scale($penaltybwunit);
1176
						$factor = wizard_get_bandwidthtype_scale($p2pcatchbwunit);
1151 1177
					}
1152
					$remainbw += floatval($penaltybw) * $factor;
1153
				}
1154
			}
1155
			if (config_path_enabled('ezshaper/step5')) {
1156
				$p2p = true;
1157
				if (!empty(config_get_path('ezshaper/step5/p2pcatchall'))) {
1158
					$p2pcatchall = true;
1159
					if ($sched != "PRIQ") {
1160
						$p2pcatchbw = config_get_path('ezshaper/step5/bandwidth');
1161
						$p2pcatchbwunit = config_get_path('ezshaper/step5/bandwidthunit');
1162
						if ($p2pcatchbwunit == "%") {
1163
							$factor = $downbw/100;
1164
						} else {
1165
							$factor = wizard_get_bandwidthtype_scale($p2pcatchbwunit);
1166
						}
1167
						$remainbw += floatval($p2pcatchbw) * $factor;
1168
					}
1169
				} else {
1170
					$p2pcatchall = false;
1171
					$p2pcatchbw = 0;
1178
					$remainbw += floatval($p2pcatchbw) * $factor;
1172 1179
				}
1173 1180
			} else {
1174
				$p2p = false;
1175 1181
				$p2pcatchall = false;
1176 1182
				$p2pcatchbw = 0;
1177 1183
			}
1184
		} else {
1185
			$p2p = false;
1186
			$p2pcatchall = false;
1187
			$p2pcatchbw = 0;
1188
		}
1178 1189
		if (config_path_enabled('ezshaper/step6')) {
1179 1190
			$games = true;
1180 1191
		} else {
1181 1192
			$games = false;
1182 1193
		}
1183

  
1184 1194
		if (config_path_enabled('ezshaper/step7')) {
1185 1195
			$otherpriority = true;
1186 1196
		} else  {
......
1200 1210

  
1201 1211
		if (!$p2pcatchall) {
1202 1212
			if ($sched == "PRIQ") {
1203
				$__tmp_q = new priq_queue(); $q =& $__tmp_q;
1213
				$__tmp_q = new priq_queue();
1214
				$q =& $__tmp_q;
1204 1215
			} elseif ($sched == "CBQ") {
1205
				$__tmp_q = new cbq_queue(); $q =& $__tmp_q;
1216
				$__tmp_q = new cbq_queue();
1217
				$q =& $__tmp_q;
1206 1218
			} elseif ($sched == "HFSC") {
1207
				$__tmp_q = new hfsc_queue(); $q =& $__tmp_q;
1219
				$__tmp_q = new hfsc_queue();
1220
				$q =& $__tmp_q;
1208 1221
			}
1209 1222
			$tmpcf = [];
1210 1223
			$tmpcf['name'] = "qLink";
......
1224 1237
			array_push($tmppath, $tmpcf['name']);
1225 1238
			$qtmp =& $altq->add_queue($q, $tmpcf, $tmppath, $input_errors);
1226 1239
			array_pop($tmppath);
1227
			//echo "qDefault <br />";
1228
			//var_dump($input_errors);
1229 1240
			$qtmp->wconfig();
1230 1241

  
1231
			$downqbw *= 0.8; /* $downqbw - 20% */
1242
			if ($sched != "PRIQ") {
1243
				$downqbw *= 0.8; /* $downqbw - 20% */
1244
			}
1232 1245
		}
1233 1246

  
1234 1247
		if ($sched != "PRIQ") {
1235 1248
			if ($sched == "CBQ") {
1236
				$__tmp_q = new cbq_queue(); $q =& $__tmp_q;
1249
				$__tmp_q = new cbq_queue();
1250
				$q =& $__tmp_q;
1237 1251
			} elseif ($sched == "HFSC") {
1238
				$__tmp_q = new hfsc_queue(); $q =& $__tmp_q;
1252
				$__tmp_q = new hfsc_queue();
1253
				$q =& $__tmp_q;
1239 1254
			}
1240 1255
			$tmpcf = [];
1241 1256
			$tmpcf['name'] = "qInternet";
......
1256 1271
			array_push($tmppath, "qInternet");
1257 1272
			$qtmp =& $altq->add_queue($q, $tmpcf, $tmppath, $input_errors);
1258 1273
			//array_pop($tmppath);
1259
			//echo "qInternet <br />";
1260
			//var_dump($input_errors);
1261 1274
			$qtmp->wconfig();
1262 1275
			$altq =& $qtmp;
1263 1276
		}
1264 1277

  
1265 1278
		if ($sched == "PRIQ") {
1266
			$__tmp_q = new priq_queue(); $q =& $__tmp_q;
1279
			$__tmp_q = new priq_queue();
1280
			$q =& $__tmp_q;
1267 1281
		} elseif ($sched == "CBQ") {
1268
			$__tmp_q = new cbq_queue(); $q =& $__tmp_q;
1282
			$__tmp_q = new cbq_queue();
1283
			$q =& $__tmp_q;
1269 1284
		} elseif ($sched == "HFSC") {
1270
			$__tmp_q = new hfsc_queue(); $q =& $__tmp_q;
1285
			$__tmp_q = new hfsc_queue();
1286
			$q =& $__tmp_q;
1271 1287
		}
1272 1288
		$tmpcf = [];
1273 1289
		$tmpcf['name'] = "qACK";
......
1288 1304
		array_push($tmppath, "qACK");
1289 1305
		$qtmp =& $altq->add_queue($q, $tmpcf, $tmppath, $input_errors);
1290 1306
		array_pop($tmppath);
1291
		//echo "qACK $remainbw <br />";
1292
		//var_dump($input_errors);
1293 1307
		$qtmp->wconfig();
1294 1308

  
1295 1309
		if ($p2p) {
1296 1310
			if ($sched == "PRIQ") {
1297
				$__tmp_q = new priq_queue(); $q =& $__tmp_q;
1311
				$__tmp_q = new priq_queue();
1312
				$q =& $__tmp_q;
1298 1313
			} elseif ($sched == "CBQ") {
1299
				$__tmp_q = new cbq_queue(); $q =& $__tmp_q;
1314
				$__tmp_q = new cbq_queue();
1315
				$q =& $__tmp_q;
1300 1316
			} elseif ($sched == "HFSC") {
1301
				$__tmp_q = new hfsc_queue(); $q =& $__tmp_q;
1317
				$__tmp_q = new hfsc_queue();
1318
				$q =& $__tmp_q;
1302 1319
			}
1303 1320
			$tmpcf = [];
1304 1321
			$tmpcf['name'] = "qP2P";
......
1338 1355
			array_push($tmppath, "qP2P");
1339 1356
			$qtmp =& $altq->add_queue($q, $tmpcf, $tmppath, $input_errors);
1340 1357
			array_pop($tmppath);
1341
			//echo "qP2P <br />";
1342
			//var_dump($input_errors);
1343 1358
			$qtmp->wconfig();
1344 1359
		}
1345 1360

  
1346 1361
		if ($voip) {
1347 1362
			if ($sched == "PRIQ") {
1348
				$__tmp_q = new priq_queue(); $q =& $__tmp_q;
1363
				$__tmp_q = new priq_queue();
1364
				$q =& $__tmp_q;
1349 1365
			} elseif ($sched == "CBQ") {
1350
				$__tmp_q = new cbq_queue(); $q =& $__tmp_q;
1366
				$__tmp_q = new cbq_queue();
1367
				$q =& $__tmp_q;
1351 1368
			} elseif ($sched == "HFSC") {
1352
				$__tmp_q = new hfsc_queue(); $q =& $__tmp_q;
1369
				$__tmp_q = new hfsc_queue();
1370
				$q =& $__tmp_q;
1353 1371
			}
1354 1372
			$tmpcf = [];
1355 1373
			$tmpcf['name'] = "qVoIP";
......
1379 1397
			array_push($tmppath, "qVoIP");
1380 1398
			$qtmp =& $altq->add_queue($q, $tmpcf, $tmppath, $input_errors);
1381 1399
			array_pop($tmppath);
1382
			//echo "qVoIP <br />";
1383
			//var_dump($input_errors);
1384 1400
			$qtmp->wconfig();
1385 1401
		}
1386 1402

  
1387 1403
		if ($games) {
1388 1404
			if ($sched == "PRIQ") {
1389
				$__tmp_q = new priq_queue(); $q =& $__tmp_q;
1405
				$__tmp_q = new priq_queue();
1406
				$q =& $__tmp_q;
1390 1407
			} elseif ($sched == "CBQ") {
1391
				$__tmp_q = new cbq_queue(); $q =& $__tmp_q;
1408
				$__tmp_q = new cbq_queue();
1409
				$q =& $__tmp_q;
1392 1410
			} elseif ($sched == "HFSC") {
1393
				$__tmp_q = new hfsc_queue(); $q =& $__tmp_q;
1411
				$__tmp_q = new hfsc_queue();
1412
				$q =& $__tmp_q;
1394 1413
			}
1395 1414
			$tmpcf = [];
1396 1415
			$tmpcf['name'] = "qGames";
......
1411 1430
			array_push($tmppath, "qGames");
1412 1431
			$qtmp =& $altq->add_queue($q, $tmpcf, $tmppath, $input_errors);
1413 1432
			array_pop($tmppath);
1414
			//echo "qGames <br />";
1415
			//var_dump($input_errors);
1416 1433
			$qtmp->wconfig();
1417 1434
		}
1418 1435

  
1419 1436
		if ($otherpriority) {
1420 1437
			if ($sched == "PRIQ") {
1421
				$__tmp_q = new priq_queue(); $q =& $__tmp_q;
1438
				$__tmp_q = new priq_queue();
1439
				$q =& $__tmp_q;
1422 1440
			} elseif ($sched == "CBQ") {
1423
				$__tmp_q = new cbq_queue(); $q =& $__tmp_q;
1441
				$__tmp_q = new cbq_queue();
1442
				$q =& $__tmp_q;
1424 1443
			} elseif ($sched == "HFSC") {
1425
				$__tmp_q = new hfsc_queue(); $q =& $__tmp_q;
1444
				$__tmp_q = new hfsc_queue();
1445
				$q =& $__tmp_q;
1426 1446
			}
1427 1447
			$tmpcf = [];
1428 1448
			$tmpcf['name'] = "qOthersHigh";
......
1443 1463
			array_push($tmppath, "qOthersHigh");
1444 1464
			$qtmp =& $altq->add_queue($q, $tmpcf, $tmppath, $input_errors);
1445 1465
			array_pop($tmppath);
1446
			//echo "qHigh <br />";
1447
			//var_dump($input_errors);
1448 1466
			$qtmp->wconfig();
1449 1467

  
1450 1468
			if ($sched == "PRIQ") {
1451
				$__tmp_q = new priq_queue(); $q =& $__tmp_q;
1469
				$__tmp_q = new priq_queue();
1470
				$q =& $__tmp_q;
1452 1471
			} elseif ($sched == "CBQ") {
1453
				$__tmp_q = new cbq_queue(); $q =& $__tmp_q;
1472
				$__tmp_q = new cbq_queue();
1473
				$q =& $__tmp_q;
1454 1474
			} elseif ($sched == "HFSC") {
1455
				$__tmp_q = new hfsc_queue(); $q =& $__tmp_q;
1475
				$__tmp_q = new hfsc_queue();
1476
				$q =& $__tmp_q;
1456 1477
			}
1457 1478
			$tmpcf = [];
1458 1479
			$tmpcf['name'] = "qOthersLow";
......
1484 1505
			array_push($tmppath, "qOthersLow");
1485 1506
			$qtmp =& $altq->add_queue($q, $tmpcf, $tmppath, $input_errors);
1486 1507
			array_pop($tmppath);
1487
			//echo "qLow <br />";
1488
			//var_dump($input_errors);
1489 1508
			$qtmp->wconfig();
1490 1509
		}
1491 1510
		array_pop($tmppath);
......
1580 1599
			$rule['created'] = make_config_revision_entry(null, gettext("Traffic Shaper Wizard"));
1581 1600
			$rule['tracker'] = $tracker++;
1582 1601
			$filter_rules[] = $rule;
1583

  
1584 1602
		} elseif (config_get_path('ezshaper/step3/provider') == "Generic") {
1585 1603
			/* create VOIP rules */
1586 1604
			$rule = [];
......
1685 1703
				if ($Gameclient[1] != '') {
1686 1704
					$rule['protocol'] = $Gameclient[1];
1687 1705
				}
1706
				$rule['created'] = make_config_revision_entry(null, gettext("Traffic Shaper Wizard"));
1707
				$rule['tracker'] = $tracker++;
1688 1708
				$filter_rules[] = $rule;
1689 1709
			}
1690 1710
		}
src/usr/local/www/wizards/traffic_shaper_wizard_multi_all.inc
58 58
			}
59 59
		}
60 60
	}
61

  
61 62
	if (!empty($fields)) {
62 63
		array_set_path($pkg, 'step/0/fields/field', $fields);
63 64
	}
......
127 128
		$stepid--;
128 129
		return;
129 130
	}
131

  
130 132
	$cfgname = "traffic_shaper_wizard_multi_all.xml";
131 133

  
132 134
	$fields = [];
......
218 220
		$fields[] = $field;
219 221

  
220 222
		$field = [];
223
		$field['displayname'] = "Interface Scheduler";
224
		$field['name'] = "conn{$i}uploadscheduler";
221 225
		$field['combinefieldsend'] = "true";
222 226
		$field['dontdisplayname'] = "true";
223 227
		$field['dontcombinecells'] = "true";
224
		$field['displayname'] = "Interface Scheduler";
225
		$field['name'] = "conn{$i}uploadscheduler";
226 228
		$field['type'] = "select";
227 229
		$field['typehint'] = "Queueing discipline to apply on the upload of this connection.";
228 230
		$field['options'] = [];
......
351 353
					$stepid--;
352 354
					return;
353 355
				}
354
				if (intval($upbw) < 128 && $_POST["conn{$i}uploadspeed"] == "Kb" && trim($_POST["conn{$i}uploadscheduler"]) == "CBQ") {
356
				if ((trim($_POST["conn{$i}uploadscheduler"]) == "CBQ") &&
357
				    (intval($upbw) < 128 && $_POST["conn{$i}uploadspeed"] == "Kb")) {
355 358
					$savemsg=gettext("Uploads smaller than 128Kbit/s is not supported for connection {$i} on CBQ scheduler.");
356 359
					$stepid--;
357 360
					return;
......
406 409
	$enablefields = [];
407 410

  
408 411
	$field = [];
409
	$field['name'] = "enable";
412
	$field['name'] = "Enable";
410 413
	$field['type'] = "checkbox";
411 414
	$field['typehint'] = "Prioritize Voice over IP traffic.";
412 415
	$field['bindstofield'] = "ezshaper->step3->enable";
......
418 421
	$field['type'] = "listtopic";
419 422
	$voipfields[] = $field;
420 423

  
424
	$field = [];
421 425
	$field['name'] = "Provider";
422 426
	$enablefields[] = "Provider";
423 427
	$field['type'] = "select";
......
454 458
	$voipfields[] = $field;
455 459

  
456 460
	for ($i = 0; $i < $numberofconnections; $i++) {
457
		$field = [];
458 461
		$interface_friendly = $i+1;
462
		$field = [];
459 463
		$field['name'] = "Connection WAN #{$interface_friendly}";
460 464
		$field['type'] = "listtopic";
461 465
		$voipfields[] = $field;
462 466

  
463 467
		$field = [];
464
		$field['displayname'] = "Upload";
468
		$field['displayname'] = "Upload rate";
465 469
		$field['name'] = "conn{$i}upload";
466 470
		$enablefields[] = "conn{$i}upload";
467 471
		$field['type'] = "input";
......
470 474
		$voipfields[] = $field;
471 475

  
472 476
		$field = [];
477
		$field['displayname'] = "Units";
473 478
		$field['combinefieldsend'] = "true";
474 479
		$field['dontdisplayname'] = "true";
475 480
		$field['dontcombinecells'] = "true";
476 481
		$field['name'] = "conn{$i}uploadspeed";
477 482
		$enablefields[] = "conn{$i}uploadspeed";
478 483
		$field['typehint'] = "Upload bandwidth guarantee for VOIP phone(s) on connection {$i}.";
479
		$field['displayname'] = "Units";
480 484
		$field['type'] = "select";
481 485
		$field['options'] = [];
482 486
		$field['options']['option'] = [];
......
504 508
		$voipfields[] = $field;
505 509

  
506 510
		$field = [];
507
		$field['displayname'] = "Download";
511
		$field['displayname'] = "Download rate";
508 512
		$field['name'] = "local{$i}download";
509 513
		$enablefields[] = "local{$i}download";
510 514
		$field['type'] = "input";
......
513 517
		$voipfields[] = $field;
514 518

  
515 519
		$field = [];
520
		$field['displayname'] = "Units";
516 521
		$field['combinefieldsend'] = "true";
517 522
		$field['dontdisplayname'] = "true";
518 523
		$field['dontcombinecells'] = "true";
519 524
		$field['name'] = "local{$i}downloadspeed";
520 525
		$enablefields[] = "local{$i}downloadspeed";
521 526
		$field['typehint'] = "Download bandwidth guarantee for VOIP phone(s) on connections.";
522
		$field['displayname'] = "Units";
523 527
		$field['type'] = "select";
524 528
		$field['options'] = [];
525 529
		$field['options']['option'] = [];
......
656 660
	if ( $_POST['enable'] ) {
657 661
		if (!$_POST['bandwidth']) {
658 662
			$savemsg="A value for bandwidth must be specified.";
659

  
660 663
			$stepid--;
661 664
			return;
662 665
		}
......
691 694
			if (!is_numeric($_POST['bandwidth'])) {
692 695
				$savemsg="Posted value is not a valid bandwidth.";
693 696
				$stepid--;
697
				return;
694 698
			}
695 699
			if ($_POST['bandwidthspeed'] <> "%") {
696 700
				$savemsg = gettext("Only percentage bandwidth specification is allowed.");
......
860 864
			}
861 865

  
862 866
			if ($sched == "CBQ") {
863
				$__tmp_q = new cbq_queue(); $q =& $__tmp_q;
867
				$__tmp_q = new cbq_queue();
868
				$q =& $__tmp_q;
864 869
			} elseif ($sched == "HFSC") {
865
				$__tmp_q = new hfsc_queue(); $q =& $__tmp_q;
870
				$__tmp_q = new hfsc_queue();
871
				$q =& $__tmp_q;
866 872
			}
873

  
867 874
			$tmpcf = [];
868 875
			$tmpcf['name'] = "qInternet";
869 876
			//$tmpcf['priority'] = 6;
......
873 880
				$tmpcf['bandwidth'] = floatval(config_get_path("ezshaper/step2/conn${i}upload", 0.0));
874 881
				$tmpcf['bandwidthtype'] = config_get_path("ezshaper/step2/conn${i}uploadspeed");
875 882
			} elseif ($sched == "HFSC") {
876
				$tmpcf['linkshare3'] =
877
					floatval(config_get_path("ezshaper/step2/conn${i}upload", 0.0)) . config_get_path("ezshaper/step2/conn${i}uploadspeed");
878
				$tmpcf['upperlimit3'] =
879
					floatval(config_get_path("ezshaper/step2/conn${i}upload", 0.0)) . config_get_path("ezshaper/step2/conn${i}uploadspeed");
880 883
				$tmpcf['upperlimit'] = "on";
881

  
882

  
884
				$tmpcf['upperlimit3'] = floatval(config_get_path("ezshaper/step2/conn${i}upload", 0.0)) .
885
							config_get_path("ezshaper/step2/conn${i}uploadspeed");
883 886
				$tmpcf['linkshare'] = "on";
887
				$tmpcf['linkshare3'] = floatval(config_get_path("ezshaper/step2/conn${i}upload", 0.0)) .
888
							config_get_path("ezshaper/step2/conn${i}uploadspeed");
884 889
				$tmpcf['bandwidth'] =  floatval(config_get_path("ezshaper/step2/conn${i}upload", 0.0));
885 890
				$tmpcf['bandwidthtype'] = config_get_path("ezshaper/step2/conn${i}uploadspeed");
886 891
			}
......
888 893
			array_push($tmppath, "qInternet");
889 894
			$qtmp =& $altq->add_queue($q, $tmpcf, $tmppath, $input_errors);
890 895
			//array_pop($tmppath);
891
			//echo "qInternet <br />";
892
			//var_dump($input_errors);
893 896
			$qtmp->wconfig();
894 897
			$altq =& $qtmp;
895 898
		}
......
920 923
		array_push($tmppath, "qACK");
921 924
		$qtmp =& $altq->add_queue($q, $tmpcf, $tmppath, $input_errors);
922 925
		array_pop($tmppath);
923
		//echo "qACK <br />";
924
		//var_dump($input_errors);
925 926
		$qtmp->wconfig();
926 927

  
927 928
		if ($sched == "PRIQ") {
928
			$__tmp_q = new priq_queue(); $q =& $__tmp_q;
929
			$__tmp_q = new priq_queue();
930
			$q =& $__tmp_q;
929 931
		} elseif ($sched == "CBQ") {
930
			$__tmp_q = new cbq_queue(); $q =& $__tmp_q;
932
			$__tmp_q = new cbq_queue();
933
			$q =& $__tmp_q;
931 934
		} elseif ($sched == "HFSC") {
932
			$__tmp_q = new hfsc_queue(); $q =& $__tmp_q;
935
			$__tmp_q = new hfsc_queue();
936
			$q =& $__tmp_q;
933 937
		}
934 938
		$tmpcf = [];
935 939
		if ($p2pcatchall) {
......
954 958
		array_push($tmppath, $tmpcf['name']);
955 959
		$qtmp =& $altq->add_queue($q, $tmpcf, $tmppath, $input_errors);
956 960
		array_pop($tmppath);
957
		//echo "qDefault <br />";
958
			//var_dump($input_errors);
959
			$qtmp->wconfig();
960

  
961
			if ($p2p) {
962
				if ($sched == "PRIQ") {
963
					$__tmp_q = new priq_queue(); $q =& $__tmp_q;
964
				} elseif ($sched == "CBQ") {
965
					$__tmp_q = new cbq_queue(); $q =& $__tmp_q;
966
				} elseif ($sched == "HFSC") {
967
					$__tmp_q = new hfsc_queue(); $q =& $__tmp_q;
968
				}
969
				$tmpcf = [];
970
				$tmpcf['name'] = "qP2P";
971
				$tmpcf['priority'] = 1;
972
				$tmpcf['ecn'] = "on";
973
				$tmpcf['enabled'] = "on";
974
				if ($p2pcatchall) {
975
					if ($sched == "CBQ") {
976
						$tmpcf['borrow'] = "on";
977
						$tmpcf['bandwidth'] = $p2pcatchbw;
978
						$tmpcf['bandwidthtype'] = $p2pcatchbwunit;
979
					} elseif ($sched == "HFSC") {
980
						$tmpcf['linkshare'] = "on";
981
						$tmpcf['linkshare3'] = "{$p2pcatchbw}{$p2pcatchbwunit}";
982
						$tmpcf['upperlimit'] = "on";
983
						$tmpcf['upperlimit3'] = "{$p2pcatchbw}{$p2pcatchbwunit}";
984
						$tmpcf['bandwidth'] = $p2pcatchbw;
985
						$tmpcf['bandwidthtype'] = $p2pcatchbwunit;
986
					}
987
					$tmpcf['default'] = "on";
961
		$qtmp->wconfig();
988 962

  
989
				} else {
990
					if ($sched == "CBQ") {
991
						$tmpcf['borrow'] = "on";
992
						$tmpcf['bandwidth'] = $remainbw * 0.05; /* 5% bandwidth */
993
						$tmpcf['bandwidthtype'] = "%";
994
					} elseif ($sched == "HFSC") {
995
						$tmpbw = $remainbw * 0.05; /* 5% bandwidth */
996
						$tmpcf['linkshare'] = "on";
997
						$tmpcf['linkshare3'] = "{$tmpbw}%";
998
						$tmpcf['upperlimit'] = "on";
999
						$tmpcf['upperlimit3'] = "{$tmpbw}%";
1000
						$tmpcf['bandwidth'] = $tmpbw;
1001
						$tmpcf['bandwidthtype'] = "%";
1002
					}
1003
				}
1004
				array_push($tmppath, "qP2P");
1005
				$qtmp =& $altq->add_queue($q, $tmpcf, $tmppath, $input_errors);
1006
				array_pop($tmppath);
1007
				//echo "qP2P <br />";
1008
				//var_dump($input_errors);
1009
				$qtmp->wconfig();
963
		if ($p2p) {
964
			if ($sched == "PRIQ") {
965
				$__tmp_q = new priq_queue();
966
				$q =& $__tmp_q;
967
			} elseif ($sched == "CBQ") {
968
				$__tmp_q = new cbq_queue();
969
				$q =& $__tmp_q;
970
			} elseif ($sched == "HFSC") {
971
				$__tmp_q = new hfsc_queue();
972
				$q =& $__tmp_q;
1010 973
			}
1011

  
1012
			if ($voip) {
1013
				if ($sched == "PRIQ") {
1014
					$__tmp_q = new priq_queue(); $q =& $__tmp_q;
1015
				} elseif ($sched == "CBQ") {
1016
					$__tmp_q = new cbq_queue(); $q =& $__tmp_q;
1017
				} elseif ($sched == "HFSC") {
1018
					$__tmp_q = new hfsc_queue(); $q =& $__tmp_q;
1019
				}
1020
				$tmpcf = [];
1021
				$tmpcf['name'] = "qVoIP";
1022
				$tmpcf['priority'] = 7;
1023
				$tmpcf['ecn'] = "on";
1024
				$tmpcf['enabled'] = "on";
974
			$tmpcf = [];
975
			$tmpcf['name'] = "qP2P";
976
			$tmpcf['priority'] = 1;
977
			$tmpcf['ecn'] = "on";
978
			$tmpcf['enabled'] = "on";
979
			if ($p2pcatchall) {
1025 980
				if ($sched == "CBQ") {
1026 981
					$tmpcf['borrow'] = "on";
1027
					if ($voipbw > 0) {
1028
						$tmpcf['bandwidth'] = $voipbw;
1029
						$tmpcf['bandwidthtype'] = $voipbwunit;
1030
					} else {
1031
						$tmpcf['bandwidth'] = $remainbw * 0.2; /* 20% bandwidth */
1032
						$tmpcf['bandwidthtype'] = "%";
1033
					}
982
					$tmpcf['bandwidth'] = $p2pcatchbw;
983
					$tmpcf['bandwidthtype'] = $p2pcatchbwunit;
1034 984
				} elseif ($sched == "HFSC") {
1035
					if ($voipbw > 0) {
1036
						$tmpcf['realtime3'] = "{$voipbw}{$voipbwunit}";
1037
					} else {
1038
						$voipbw = $remainbw * 0.20; /* 20% bandwidth */
1039
						$tmpcf['realtime3'] = "{$voipbw}%";
1040
					}
1041
					$tmpcf['realtime'] = "on";
1042
					$tmpcf['bandwidth'] = 32;
1043
					$tmpcf['bandwidthtype'] = "Kb";
1044
				}
1045
				array_push($tmppath, "qVoIP");
1046
				$qtmp =& $altq->add_queue($q, $tmpcf, $tmppath, $input_errors);
1047
				array_pop($tmppath);
1048
				//echo "qVoIP <br />";
1049
				//var_dump($input_errors);
1050
				$qtmp->wconfig();
1051
			}
1052

  
1053
			if ($games) {
1054
				if ($sched == "PRIQ") {
1055
					$__tmp_q = new priq_queue(); $q =& $__tmp_q;
1056
				} elseif ($sched == "CBQ") {
1057
					$__tmp_q = new cbq_queue(); $q =& $__tmp_q;
1058
				} elseif ($sched == "HFSC") {
1059
					$__tmp_q = new hfsc_queue(); $q =& $__tmp_q;
985
					$tmpcf['linkshare'] = "on";
986
					$tmpcf['linkshare3'] = "{$p2pcatchbw}{$p2pcatchbwunit}";
987
					$tmpcf['upperlimit'] = "on";
988
					$tmpcf['upperlimit3'] = "{$p2pcatchbw}{$p2pcatchbwunit}";
989
					$tmpcf['bandwidth'] = $p2pcatchbw;
990
					$tmpcf['bandwidthtype'] = $p2pcatchbwunit;
1060 991
				}
1061
				$tmpcf = [];
1062
				$tmpcf['name'] = "qGames";
1063
				$tmpcf['priority'] = 5;
1064
				$tmpcf['enabled'] = "on";
1065
				$tmpcf['ecn'] = "on";
992
				$tmpcf['default'] = "on";
993
			} else {
1066 994
				if ($sched == "CBQ") {
1067 995
					$tmpcf['borrow'] = "on";
1068
					$tmpcf['bandwidth'] = $remainbw * 0.2; /* 20% bandwidth */
996
					$tmpcf['bandwidth'] = $remainbw * 0.05; /* 5% bandwidth */
1069 997
					$tmpcf['bandwidthtype'] = "%";
1070 998
				} elseif ($sched == "HFSC") {
1071
					$gamesbw = $remainbw * 0.2; /* 20% bandwidth */
999
					$tmpbw = $remainbw * 0.05; /* 5% bandwidth */
1072 1000
					$tmpcf['linkshare'] = "on";
1073
					$tmpcf['linkshare3'] = "{$gamesbw}%";
1074
					$tmpcf['bandwidth'] = "{$gamesbw}";
1001
					$tmpcf['linkshare3'] = "{$tmpbw}%";
1002
					$tmpcf['upperlimit'] = "on";
1003
					$tmpcf['upperlimit3'] = "{$tmpbw}%";
1004
					$tmpcf['bandwidth'] = $tmpbw;
1075 1005
					$tmpcf['bandwidthtype'] = "%";
1076 1006
				}
1077
				array_push($tmppath, "qGames");
1078
				$qtmp =& $altq->add_queue($q, $tmpcf, $tmppath, $input_errors);
1079
				array_pop($tmppath);
1080
				//echo "qGames <br />";
1081
				//var_dump($input_errors);
1082
				$qtmp->wconfig();
1083 1007
			}
1008
			array_push($tmppath, "qP2P");
1009
			$qtmp =& $altq->add_queue($q, $tmpcf, $tmppath, $input_errors);
1010
			array_pop($tmppath);
1011
			$qtmp->wconfig();
1012
		}
1084 1013

  
1085
			if ($otherpriority) {
1086
				if ($sched == "PRIQ") {
1087
					$__tmp_q = new priq_queue(); $q =& $__tmp_q;
1088
				} elseif ($sched == "CBQ") {
1089
					$__tmp_q = new cbq_queue(); $q =& $__tmp_q;
1090
				} elseif ($sched == "HFSC") {
1091
					$__tmp_q = new hfsc_queue(); $q =& $__tmp_q;
1092
				}
1093
				$tmpcf = [];
1094
				$tmpcf['name'] = "qOthersHigh";
1095
				$tmpcf['priority'] = 4;
1096
				$tmpcf['ecn'] = "on";
1097
				$tmpcf['enabled'] = "on";
1098
				if ($sched == "CBQ") {
1099
					$tmpcf['borrow'] = "on";
1100
					$tmpcf['bandwidth'] = $remainbw * 0.1; /* 10% bandwidth */
1101
					$tmpcf['bandwidthtype'] = "%";
1102
				} elseif ($sched == "HFSC") {
1103
					$tmpcf['linkshare'] = "on";
1104
					$otherbw = $remainbw * 0.1; /* 10% bandwidth */
1105
					$tmpcf['linkshare3'] = "{$otherbw}%";
1106
					$tmpcf['bandwidth'] = $otherbw;
1014
		if ($voip) {
1015
			if ($sched == "PRIQ") {
1016
				$__tmp_q = new priq_queue();
1017
				$q =& $__tmp_q;
1018
			} elseif ($sched == "CBQ") {
1019
				$__tmp_q = new cbq_queue();
1020
				$q =& $__tmp_q;
1021
			} elseif ($sched == "HFSC") {
1022
				$__tmp_q = new hfsc_queue();
1023
				$q =& $__tmp_q;
1024
			}
1025
			$tmpcf = [];
1026
			$tmpcf['name'] = "qVoIP";
1027
			$tmpcf['priority'] = 7;
1028
			$tmpcf['ecn'] = "on";
1029
			$tmpcf['enabled'] = "on";
1030
			if ($sched == "CBQ") {
1031
				$tmpcf['borrow'] = "on";
1032
				if ($voipbw > 0) {
1033
					$tmpcf['bandwidth'] = $voipbw;
1034
					$tmpcf['bandwidthtype'] = $voipbwunit;
1035
				} else {
1036
					$tmpcf['bandwidth'] = $remainbw * 0.2; /* 20% bandwidth */
1107 1037
					$tmpcf['bandwidthtype'] = "%";
1108 1038
				}
1109
				array_push($tmppath, "qOthersHigh");
1110
				$qtmp =& $altq->add_queue($q, $tmpcf, $tmppath, $input_errors);
1111
				array_pop($tmppath);
1112
				//echo "qHigh <br />";
1113
				//var_dump($input_errors);
1114
				$qtmp->wconfig();
1115

  
1116

  
1117
				if ($sched == "PRIQ") {
1118
					$__tmp_q = new priq_queue(); $q =& $__tmp_q;
1119
				} elseif ($sched == "CBQ") {
1120
					$__tmp_q = new cbq_queue(); $q =& $__tmp_q;
1121
				} elseif ($sched == "HFSC") {
1122
					$__tmp_q = new hfsc_queue(); $q =& $__tmp_q;
1039
			} elseif ($sched == "HFSC") {
1040
				if ($voipbw > 0) {
1041
					$tmpcf['realtime3'] = "{$voipbw}{$voipbwunit}";
1042
				} else {
1043
					$voipbw = $remainbw * 0.20; /* 20% bandwidth */
1044
					$tmpcf['realtime3'] = "{$voipbw}%";
1123 1045
				}
1124
				$tmpcf = [];
1125
				$tmpcf['name'] = "qOthersLow";
1126
				$tmpcf['priority'] = 2;
1127
				$tmpcf['ecn'] = "on";
1128
				$tmpcf['enabled'] = "on";
1129
				if ($sched == "CBQ") {
1130
					$tmpcf['borrow'] = "on";
1131
					if ($penalty) {
1132
						$tmpcf['bandwidthtype'] = $penaltybwunit;
1133
						$tmpcf['bandwidth'] = $penaltybw;
1134
					} else {
1135
						$tmpcf['bandwidth'] = $remainbw * 0.05; /* 5% bandwidth */
1136
						$tmpcf['bandwidthtype'] = "%";
1137
					}
1138
				} elseif ($sched == "HFSC") {
1139
					if ($penalty) {
1140
						$tmpcf['linkshare3'] = "{$penaltybw}{$penaltybwunit}";
1141
						$tmpcf['bandwidth'] = $penaltybw;
1142
						$tmpcf['bandwidthtype'] = $penaltybwunit;
1143
					} else {
1144
						$lsbw = $remainbw * 0.05;
1145
						$tmpcf['linkshare3'] = "{$lsbw}%"; /* 5% bandwidth */
1146
						$tmpcf['bandwidth'] = $lsbw;
1147
						$tmpcf['bandwidthtype'] = "%";
1148
					}
1149
					$tmpcf['linkshare'] = "on";
1046
				$tmpcf['realtime'] = "on";
1047
				$tmpcf['bandwidth'] = 32;
... This diff was truncated because it exceeds the maximum size that can be displayed.

Also available in: Unified diff