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 |
}
|
Corrections for shaper wizards. Fixes #13915
were not reflected in the other).