950 |
950 |
array_pop($tmppath);
|
951 |
951 |
}
|
952 |
952 |
|
953 |
|
/* LAN bandwidth ----------------------------------------------------------------------------------------- */
|
|
953 |
/* LAN bandwidth ----------------------------------------------------------------------------------------- */
|
954 |
954 |
|
955 |
955 |
$tmppath = array();
|
956 |
956 |
$altq =& new altq_root_queue();
|
957 |
957 |
|
958 |
958 |
$altq->SetInterface('lan');
|
959 |
959 |
$altq->SetScheduler($config['ezshaper']['step2']["downloadscheduler"]);
|
960 |
|
$altq->SetBandwidth($lanbw/1000);
|
961 |
|
$altq->SetBwscale("Kb");
|
|
960 |
//$altq->SetBandwidth($lanbw/1000);
|
|
961 |
//$altq->SetBwscale("Kb");
|
962 |
962 |
$altq->SetEnabled("on");
|
963 |
963 |
$altq_list_queues[$altq->GetQname()] =& $altq;
|
964 |
964 |
array_push($tmppath, 'lan');
|
... | ... | |
979 |
979 |
$games = false;
|
980 |
980 |
$otherpriority = false;
|
981 |
981 |
$remainbw = 0;
|
982 |
|
|
983 |
|
|
984 |
|
if ($config['ezshaper']['step3']['enable']) {
|
985 |
|
$voip = true;
|
986 |
|
$voipbw = $config['ezshaper']['step3']["download"];
|
987 |
|
$voipbwunit = $config['ezshaper']['step3']["downloadspeed"];
|
988 |
|
if ($sched != "HFSC") {
|
989 |
|
if ($voipbwunit == "%")
|
990 |
|
$factor = $lanbw/100;
|
991 |
|
else
|
992 |
|
$factor = wizard_get_bandwidthtype_scale($voipbwunit);
|
993 |
|
$remainbw += $voipbw * $factor;
|
994 |
|
} else
|
995 |
|
$remainbw += 32000; /* 32Kbit/s forHFSC linksharing */
|
996 |
|
}
|
997 |
|
if ($config['ezshaper']['step4']['enable']) {
|
998 |
|
$penalty = true;
|
999 |
|
$penaltybw = $config['ezshaper']['step4']['bandwidth'];
|
1000 |
|
$penaltybwunit = $config['ezshaper']['step4']['bandwidthunit'];
|
1001 |
|
if ($penaltybwunit == "%")
|
|
982 |
|
|
983 |
if ($config['ezshaper']['step3']['enable']) {
|
|
984 |
$voip = true;
|
|
985 |
$voipbw = $config['ezshaper']['step3']["download"];
|
|
986 |
$voipbwunit = $config['ezshaper']['step3']["downloadspeed"];
|
|
987 |
if ($sched != "HFSC") {
|
|
988 |
if ($voipbwunit == "%")
|
|
989 |
$factor = $lanbw/100;
|
|
990 |
else
|
|
991 |
$factor = wizard_get_bandwidthtype_scale($voipbwunit);
|
|
992 |
$remainbw += $voipbw * $factor;
|
|
993 |
} else
|
|
994 |
$remainbw += 32000; /* 32Kbit/s forHFSC linksharing */
|
|
995 |
}
|
|
996 |
if ($config['ezshaper']['step4']['enable']) {
|
|
997 |
$penalty = true;
|
|
998 |
$penaltybw = $config['ezshaper']['step4']['bandwidth'];
|
|
999 |
$penaltybwunit = $config['ezshaper']['step4']['bandwidthunit'];
|
|
1000 |
if ($penaltybwunit == "%")
|
|
1001 |
$factor = $lanbw/100;
|
|
1002 |
else
|
|
1003 |
$factor = wizard_get_bandwidthtype_scale($penaltybwunit);
|
|
1004 |
$remainbw += $penaltybw * $factor;
|
|
1005 |
} else {
|
|
1006 |
$penalty = false;
|
|
1007 |
$penaltybw = 0;
|
|
1008 |
}
|
|
1009 |
if ($config['ezshaper']['step5']['enable']) {
|
|
1010 |
$p2p = true;
|
|
1011 |
if ($config['ezshaper']['step5']['p2pcatchall']) {
|
|
1012 |
$p2pcatchall = true;
|
|
1013 |
$p2pcatchbw = $config['ezshaper']['step5']['bandwidth'];
|
|
1014 |
$p2pcatchbwunit = $config['ezshaper']['step5']['bandwidthunit'];
|
|
1015 |
if ($p2pcatchbwunit == "%")
|
1002 |
1016 |
$factor = $lanbw/100;
|
1003 |
1017 |
else
|
1004 |
|
$factor = wizard_get_bandwidthtype_scale($penaltybwunit);
|
1005 |
|
$remainbw += $penaltybw * $factor;
|
1006 |
|
} else {
|
1007 |
|
$penalty = false;
|
1008 |
|
$penaltybw = 0;
|
1009 |
|
}
|
1010 |
|
if ($config['ezshaper']['step5']['enable']) {
|
1011 |
|
$p2p = true;
|
1012 |
|
if ($config['ezshaper']['step5']['p2pcatchall']) {
|
1013 |
|
$p2pcatchall = true;
|
1014 |
|
$p2pcatchbw = $config['ezshaper']['step5']['bandwidth'];
|
1015 |
|
$p2pcatchbwunit = $config['ezshaper']['step5']['bandwidthunit'];
|
1016 |
|
if ($p2pcatchbwunit == "%")
|
1017 |
|
$factor = $lanbw/100;
|
1018 |
|
else
|
1019 |
|
$factor = wizard_get_bandwidthtype_scale($p2pcatchbwunit);
|
1020 |
|
$remainbw += $p2pcatchbw * $factor;
|
1021 |
|
} else {
|
1022 |
|
$p2pcatchall = false;
|
1023 |
|
$p2pcatchbw = 0;
|
1024 |
|
}
|
1025 |
|
} else {
|
1026 |
|
$p2p = false;
|
1027 |
|
$p2pcatchall = false;
|
1028 |
|
$p2pcatchbw = 0;
|
1029 |
|
}
|
1030 |
|
if ($config['ezshaper']['step6']['enable']) {
|
1031 |
|
$games = true;
|
|
1018 |
$factor = wizard_get_bandwidthtype_scale($p2pcatchbwunit);
|
|
1019 |
$remainbw += $p2pcatchbw * $factor;
|
1032 |
1020 |
} else {
|
1033 |
|
$games = false;
|
|
1021 |
$p2pcatchall = false;
|
|
1022 |
$p2pcatchbw = 0;
|
1034 |
1023 |
}
|
1035 |
|
|
1036 |
|
if ($config['ezshaper']['step7']['enable']) {
|
1037 |
|
$otherpriority = true;
|
1038 |
|
} else {
|
1039 |
|
$otherpriority = false;
|
1040 |
|
}
|
1041 |
|
$remainbw = round($remainbw / $lanbw * 100, 2);
|
|
1024 |
} else {
|
|
1025 |
$p2p = false;
|
|
1026 |
$p2pcatchall = false;
|
|
1027 |
$p2pcatchbw = 0;
|
|
1028 |
}
|
|
1029 |
if ($config['ezshaper']['step6']['enable'])
|
|
1030 |
$games = true;
|
|
1031 |
else
|
|
1032 |
$games = false;
|
|
1033 |
|
|
1034 |
if ($config['ezshaper']['step7']['enable'])
|
|
1035 |
$otherpriority = true;
|
|
1036 |
else
|
|
1037 |
$otherpriority = false;
|
|
1038 |
$remainbw = round($remainbw / $lanbw * 100, 2);
|
|
1039 |
|
|
1040 |
if ($remainbw > 0 && $remainbw > 30) {
|
|
1041 |
$savemsg=gettext("Custom Bandwidths are greater than 30%. Please lower them for the wizard to continue.");
|
|
1042 |
header("Location: wizard.php?xml=traffic_shaper_wizard.xml&stepid=2&message={$savemsg}");
|
|
1043 |
exit;
|
|
1044 |
} else
|
|
1045 |
$remainbw = 100 - $remainbw;
|
|
1046 |
|
|
1047 |
if ($sched == "PRIQ")
|
|
1048 |
$q =& new priq_queue();
|
|
1049 |
else if ($sched == "CBQ")
|
|
1050 |
$q =& new cbq_queue();
|
|
1051 |
else if ($sched == "HFSC")
|
|
1052 |
$q =& new hfsc_queue();
|
|
1053 |
$tmpcf = array();
|
|
1054 |
$tmpcf['name'] = "qLink";
|
|
1055 |
$tmpcf['priority'] = 1;
|
|
1056 |
$tmpcf['enabled'] = "on";
|
|
1057 |
$tmpcf['default'] = "on";
|
|
1058 |
$tmpcf['ecn'] = "on";
|
|
1059 |
if ($sched == "CBQ") {
|
|
1060 |
$tmpcf['borrow'] = "on";
|
|
1061 |
$tmpcf['bandwidth'] = 20; /* 20% bandwidth */
|
|
1062 |
$tmpcf['bandwidthtype'] = "%";
|
|
1063 |
} else if ($sched == "HFSC") {
|
|
1064 |
$tmpcf['bandwidth'] = 20; /* 20% bandwidth */
|
|
1065 |
$tmpcf['bandwidthtype'] = "%";
|
|
1066 |
}
|
|
1067 |
array_push($tmppath, $tmpcf['name']);
|
|
1068 |
$qtmp =& $altq->add_queue($q, &$tmpcf, &$tmppath, $input_errors);
|
|
1069 |
array_pop($tmppath);
|
|
1070 |
//echo "qDefault <br />";
|
|
1071 |
//var_dump($input_errors);
|
|
1072 |
$qtmp->wconfig();
|
|
1073 |
|
|
1074 |
if ($sched != "PRIQ") {
|
|
1075 |
if ($sched == "CBQ")
|
|
1076 |
$q =& new cbq_queue();
|
|
1077 |
else if ($sched == "HFSC")
|
|
1078 |
$q =& new hfsc_queue();
|
|
1079 |
$tmpcf = array();
|
|
1080 |
$tmpcf['name'] = "qInternet";
|
|
1081 |
//$tmpcf['priority'] = 6;
|
|
1082 |
$tmpcf['ecn'] = "on";
|
|
1083 |
$tmpcf['enabled'] = "on";
|
|
1084 |
If ($sched == "CBQ") {
|
|
1085 |
$tmpcf['bandwidth'] = $lanbw/1000;
|
|
1086 |
$tmpcf['bandwidthtype'] = "Kb";
|
|
1087 |
}
|
|
1088 |
else if ($sched == "HFSC") {
|
|
1089 |
$tmpcf['linkshare3'] = $lanbw/1000 ."Kb";
|
|
1090 |
$tmpcf['upperlimit'] = "on";
|
|
1091 |
$tmpcf['upperlimit3'] = $lanbw/1000 ."Kb";
|
|
1092 |
$tmpcf['linkshare'] = "on";
|
|
1093 |
$tmpcf['bandwidth'] = $lanbw/1000;
|
|
1094 |
$tmpcf['bandwidthtype'] = "Kb";
|
|
1095 |
}
|
|
1096 |
array_push($tmppath, "qInternet");
|
|
1097 |
$qtmp =& $altq->add_queue($q, &$tmpcf, &$tmppath, $input_errors);
|
|
1098 |
//array_pop($tmppath);
|
|
1099 |
//echo "qInternet <br />";
|
|
1100 |
//var_dump($input_errors);
|
|
1101 |
$qtmp->wconfig();
|
|
1102 |
$altq =& $qtmp;
|
|
1103 |
}
|
1042 |
1104 |
|
1043 |
|
if ($remainbw > 0 && $remainbw > 30) {
|
1044 |
|
$savemsg=gettext("Custom Bandwidths are greater than 30%. Please lower them for the wizard to continue.");
|
1045 |
|
header("Location: wizard.php?xml=traffic_shaper_wizard.xml&stepid=2&message={$savemsg}");
|
1046 |
|
exit;
|
|
1105 |
if ($sched == "PRIQ")
|
|
1106 |
$q =& new priq_queue();
|
|
1107 |
else if ($sched == "CBQ")
|
|
1108 |
$q =& new cbq_queue();
|
|
1109 |
else if ($sched == "HFSC")
|
|
1110 |
$q =& new hfsc_queue();
|
|
1111 |
$tmpcf = array();
|
|
1112 |
$tmpcf['name'] = "qACK";
|
|
1113 |
$tmpcf['priority'] = 6;
|
|
1114 |
$tmpcf['ecn'] = "on";
|
|
1115 |
$tmpcf['enabled'] = "on";
|
|
1116 |
If ($sched == "CBQ") {
|
|
1117 |
$tmpcf['borrow'] = "on";
|
|
1118 |
$tmpcf['bandwidth'] = $remainbw * 0.2;
|
|
1119 |
$tmpcf['bandwidthtype'] = "%";
|
|
1120 |
} else if ($sched == "HFSC") {
|
|
1121 |
$lkbw = 0.20 * $remainbw;
|
|
1122 |
$tmpcf['linkshare3'] = "{$lkbw}%";
|
|
1123 |
$tmpcf['linkshare'] = "on";
|
|
1124 |
$tmpcf['bandwidth'] = $lkbw;
|
|
1125 |
$tmpcf['bandwidthtype'] = "%";
|
|
1126 |
}
|
|
1127 |
array_push($tmppath, "qACK");
|
|
1128 |
$qtmp =& $altq->add_queue($q, &$tmpcf, &$tmppath, $input_errors);
|
|
1129 |
array_pop($tmppath);
|
|
1130 |
//echo "qACK <br />";
|
|
1131 |
//var_dump($input_errors);
|
|
1132 |
$qtmp->wconfig();
|
|
1133 |
|
|
1134 |
if ($p2p) {
|
|
1135 |
if ($sched == "PRIQ")
|
|
1136 |
$q =& new priq_queue();
|
|
1137 |
else if ($sched == "CBQ")
|
|
1138 |
$q =& new cbq_queue();
|
|
1139 |
else if ($sched == "HFSC")
|
|
1140 |
$q =& new hfsc_queue();
|
|
1141 |
$tmpcf = array();
|
|
1142 |
$tmpcf['name'] = "qP2P";
|
|
1143 |
$tmpcf['priority'] = 1;
|
|
1144 |
$tmpcf['ecn'] = "on";
|
|
1145 |
$tmpcf['enabled'] = "on";
|
|
1146 |
if ($p2pcatchall) {
|
|
1147 |
if ($sched == "CBQ") {
|
|
1148 |
$tmpcf['borrow'] = "on";
|
|
1149 |
$tmpcf['bandwidth'] = $p2pcatchbw;
|
|
1150 |
$tmpcf['bandwidthtype'] = $p2pcatchbwunit;
|
|
1151 |
} else if ($sched == "HFSC") {
|
|
1152 |
$tmpcf['linkshare'] = "on";
|
|
1153 |
$tmpcf['linkshare3'] = "{$p2pcatchbw}{$p2pcatchbwunit}";
|
|
1154 |
$tmpcf['upperlimit'] = "on";
|
|
1155 |
$tmpcf['upperlimit3'] = "{$p2pcatchbw}{$p2pcatchbwunit}";
|
|
1156 |
$tmpcf['bandwidth'] = $p2pcatchbw;
|
|
1157 |
$tmpcf['bandwidthtype'] = $p2pcatchbwunit;
|
|
1158 |
}
|
|
1159 |
//$tmpcf['default'] = "on";
|
1047 |
1160 |
} else {
|
1048 |
|
$remainbw = 100 - $remainbw;
|
|
1161 |
if ($sched == "CBQ") {
|
|
1162 |
$tmpcf['borrow'] = "on";
|
|
1163 |
$tmpcf['bandwidth'] = $remainbw * 0.05; /* 5% bandwidth */
|
|
1164 |
$tmpcf['bandwidthtype'] = "%";
|
|
1165 |
} else if ($sched == "HFSC") {
|
|
1166 |
$tmpbw = $remainbw * 0.05; /* 5% bandwidth */
|
|
1167 |
$tmpcf['linkshare'] = "on";
|
|
1168 |
$tmpcf['linkshare3'] = "{$tmpbw}%";
|
|
1169 |
$tmpcf['upperlimit'] = "on";
|
|
1170 |
$tmpcf['upperlimit3'] = "{$tmpbw}%";
|
|
1171 |
$tmpcf['bandwidth'] = $tmpbw;
|
|
1172 |
$tmpcf['bandwidthtype'] = "%";
|
|
1173 |
}
|
1049 |
1174 |
}
|
|
1175 |
array_push($tmppath, "qP2P");
|
|
1176 |
$qtmp =& $altq->add_queue($q, &$tmpcf, &$tmppath, $input_errors);
|
|
1177 |
array_pop($tmppath);
|
|
1178 |
//echo "qP2P <br />";
|
|
1179 |
//var_dump($input_errors);
|
|
1180 |
$qtmp->wconfig();
|
|
1181 |
}
|
1050 |
1182 |
|
1051 |
|
if ($sched != "PRIQ") {
|
1052 |
|
if ($sched == "CBQ")
|
1053 |
|
$q =& new cbq_queue();
|
1054 |
|
else if ($sched == "HFSC")
|
1055 |
|
$q =& new hfsc_queue();
|
1056 |
|
$tmpcf = array();
|
1057 |
|
$tmpcf['name'] = "qInternet";
|
1058 |
|
//$tmpcf['priority'] = 6;
|
1059 |
|
$tmpcf['ecn'] = "on";
|
1060 |
|
$tmpcf['enabled'] = "on";
|
1061 |
|
If ($sched == "CBQ") {
|
1062 |
|
$tmpcf['bandwidth'] = $lanbw/1000;
|
1063 |
|
$tmpcf['bandwidthtype'] = "Kb";
|
1064 |
|
}
|
1065 |
|
else if ($sched == "HFSC") {
|
1066 |
|
$tmpcf['linkshare3'] = $lanbw/1000 ."Kb";
|
1067 |
|
$tmpcf['upperlimit'] = "on";
|
1068 |
|
$tmpcf['upperlimit3'] = $lanbw/1000 ."Kb";
|
1069 |
|
$tmpcf['linkshare'] = "on";
|
1070 |
|
$tmpcf['bandwidth'] = $lanbw/1000;
|
1071 |
|
$tmpcf['bandwidthtype'] = "Kb";
|
1072 |
|
}
|
1073 |
|
array_push($tmppath, "qInternet");
|
1074 |
|
$qtmp =& $altq->add_queue($q, &$tmpcf, &$tmppath, $input_errors);
|
1075 |
|
//array_pop($tmppath);
|
1076 |
|
//echo "qInternet <br />";
|
1077 |
|
//var_dump($input_errors);
|
1078 |
|
$qtmp->wconfig();
|
1079 |
|
$altq =& $qtmp;
|
|
1183 |
if ($voip) {
|
|
1184 |
if ($sched == "PRIQ")
|
|
1185 |
$q =& new priq_queue();
|
|
1186 |
else if ($sched == "CBQ")
|
|
1187 |
$q =& new cbq_queue();
|
|
1188 |
else if ($sched == "HFSC")
|
|
1189 |
$q =& new hfsc_queue();
|
|
1190 |
$tmpcf = array();
|
|
1191 |
$tmpcf['name'] = "qVoIP";
|
|
1192 |
$tmpcf['priority'] = 7;
|
|
1193 |
$tmpcf['ecn'] = "on";
|
|
1194 |
$tmpcf['enabled'] = "on";
|
|
1195 |
if ($sched == "CBQ") {
|
|
1196 |
$tmpcf['borrow'] = "on";
|
|
1197 |
if ($voipbw > 0) {
|
|
1198 |
$tmpcf['bandwidth'] = $voipbw;
|
|
1199 |
$tmpcf['bandwidthtype'] = $voipbwunit;
|
|
1200 |
} else {
|
|
1201 |
$tmpcf['bandwidth'] = $remainbw * 0.2; /* 20% bandwidth */
|
|
1202 |
$tmpcf['bandwidthtype'] = "%";
|
|
1203 |
}
|
|
1204 |
} else if ($sched == "HFSC") {
|
|
1205 |
if ($voipbw > 0) {
|
|
1206 |
$tmpcf['realtime3'] = "{$voipbw}{$voipbwunit}";
|
|
1207 |
} else {
|
|
1208 |
$voipbw = $remainbw * 0.20; /* 20% bandwidth */
|
|
1209 |
$tmpcf['realtime3'] = "{$voipbw}%";
|
|
1210 |
}
|
|
1211 |
$tmpcf['realtime'] = "on";
|
|
1212 |
$tmpcf['bandwidth'] = 32;
|
|
1213 |
$tmpcf['bandwidthtype'] = "Kb";
|
1080 |
1214 |
}
|
|
1215 |
array_push($tmppath, "qVoIP");
|
|
1216 |
$qtmp =& $altq->add_queue($q, &$tmpcf, &$tmppath, $input_errors);
|
|
1217 |
array_pop($tmppath);
|
|
1218 |
//echo "qVoIP <br />";
|
|
1219 |
//var_dump($input_errors);
|
|
1220 |
$qtmp->wconfig();
|
|
1221 |
}
|
1081 |
1222 |
|
1082 |
|
|
|
1223 |
if ($games) {
|
1083 |
1224 |
if ($sched == "PRIQ")
|
1084 |
1225 |
$q =& new priq_queue();
|
1085 |
1226 |
else if ($sched == "CBQ")
|
1086 |
|
$q =& new cbq_queue();
|
|
1227 |
$q =& new cbq_queue();
|
1087 |
1228 |
else if ($sched == "HFSC")
|
1088 |
|
$q =& new hfsc_queue();
|
|
1229 |
$q =& new hfsc_queue();
|
1089 |
1230 |
$tmpcf = array();
|
1090 |
|
$tmpcf['name'] = "qACK";
|
1091 |
|
$tmpcf['priority'] = 6;
|
1092 |
|
$tmpcf['ecn'] = "on";
|
|
1231 |
$tmpcf['name'] = "qGames";
|
|
1232 |
$tmpcf['priority'] = 5;
|
1093 |
1233 |
$tmpcf['enabled'] = "on";
|
1094 |
|
If ($sched == "CBQ") {
|
|
1234 |
$tmpcf['ecn'] = "on";
|
|
1235 |
if ($sched == "CBQ") {
|
1095 |
1236 |
$tmpcf['borrow'] = "on";
|
1096 |
|
$tmpcf['bandwidth'] = $remainbw * 0.2;
|
|
1237 |
$tmpcf['bandwidth'] = $remainbw * 0.2; /* 20% bandwidth */
|
1097 |
1238 |
$tmpcf['bandwidthtype'] = "%";
|
1098 |
|
}
|
1099 |
|
else if ($sched == "HFSC") {
|
1100 |
|
$lkbw = 0.20 * $remainbw;
|
1101 |
|
$tmpcf['linkshare3'] = "{$lkbw}%";
|
|
1239 |
} else if ($sched == "HFSC") {
|
|
1240 |
$gamesbw = $remainbw * 0.2; /* 20% bandwidth */
|
1102 |
1241 |
$tmpcf['linkshare'] = "on";
|
1103 |
|
$tmpcf['bandwidth'] = $lkbw;
|
|
1242 |
$tmpcf['linkshare3'] = "{$gamesbw}%";
|
|
1243 |
$tmpcf['bandwidth'] = "{$gamesbw}";
|
1104 |
1244 |
$tmpcf['bandwidthtype'] = "%";
|
1105 |
1245 |
}
|
1106 |
|
array_push($tmppath, "qACK");
|
|
1246 |
array_push($tmppath, "qGames");
|
1107 |
1247 |
$qtmp =& $altq->add_queue($q, &$tmpcf, &$tmppath, $input_errors);
|
1108 |
1248 |
array_pop($tmppath);
|
1109 |
|
//echo "qACK <br />";
|
|
1249 |
//echo "qGames <br />";
|
1110 |
1250 |
//var_dump($input_errors);
|
1111 |
1251 |
$qtmp->wconfig();
|
|
1252 |
}
|
1112 |
1253 |
|
|
1254 |
if ($otherpriority) {
|
1113 |
1255 |
if ($sched == "PRIQ")
|
1114 |
1256 |
$q =& new priq_queue();
|
1115 |
1257 |
else if ($sched == "CBQ")
|
... | ... | |
1117 |
1259 |
else if ($sched == "HFSC")
|
1118 |
1260 |
$q =& new hfsc_queue();
|
1119 |
1261 |
$tmpcf = array();
|
1120 |
|
if ($p2pcatchall)
|
1121 |
|
$tmpcf['name'] = "qOthersDefault";
|
1122 |
|
else
|
1123 |
|
$tmpcf['name'] = "qDefault";
|
1124 |
|
$tmpcf['priority'] = 3;
|
1125 |
|
$tmpcf['enabled'] = "on";
|
1126 |
|
if (!$p2pcatchall)
|
1127 |
|
$tmpcf['default'] = "on";
|
|
1262 |
$tmpcf['name'] = "qOthersHigh";
|
|
1263 |
$tmpcf['priority'] = 4;
|
1128 |
1264 |
$tmpcf['ecn'] = "on";
|
|
1265 |
$tmpcf['enabled'] = "on";
|
1129 |
1266 |
if ($sched == "CBQ") {
|
1130 |
1267 |
$tmpcf['borrow'] = "on";
|
1131 |
1268 |
$tmpcf['bandwidth'] = $remainbw * 0.1; /* 10% bandwidth */
|
1132 |
1269 |
$tmpcf['bandwidthtype'] = "%";
|
1133 |
1270 |
} else if ($sched == "HFSC") {
|
1134 |
|
$tmpcf['bandwidth'] = $remainbw * 0.1; /* 10% bandwidth */
|
|
1271 |
$tmpcf['linkshare'] = "on";
|
|
1272 |
$otherbw = $remainbw * 0.1; /* 10% bandwidth */
|
|
1273 |
$tmpcf['linkshare3'] = "{$otherbw}%";
|
|
1274 |
$tmpcf['bandwidth'] = $otherbw;
|
1135 |
1275 |
$tmpcf['bandwidthtype'] = "%";
|
1136 |
1276 |
}
|
1137 |
|
array_push($tmppath, $tmpcf['name']);
|
|
1277 |
array_push($tmppath, "qOthersHigh");
|
1138 |
1278 |
$qtmp =& $altq->add_queue($q, &$tmpcf, &$tmppath, $input_errors);
|
1139 |
1279 |
array_pop($tmppath);
|
1140 |
|
//echo "qDefault <br />";
|
|
1280 |
//echo "qHigh <br />";
|
1141 |
1281 |
//var_dump($input_errors);
|
1142 |
1282 |
$qtmp->wconfig();
|
1143 |
|
|
1144 |
|
if ($p2p) {
|
1145 |
|
if ($sched == "PRIQ")
|
1146 |
|
$q =& new priq_queue();
|
1147 |
|
else if ($sched == "CBQ")
|
1148 |
|
$q =& new cbq_queue();
|
1149 |
|
else if ($sched == "HFSC")
|
1150 |
|
$q =& new hfsc_queue();
|
1151 |
|
$tmpcf = array();
|
1152 |
|
$tmpcf['name'] = "qP2P";
|
1153 |
|
$tmpcf['priority'] = 1;
|
1154 |
|
$tmpcf['ecn'] = "on";
|
1155 |
|
$tmpcf['enabled'] = "on";
|
1156 |
|
if ($p2pcatchall) {
|
1157 |
|
if ($sched == "CBQ") {
|
1158 |
|
$tmpcf['borrow'] = "on";
|
1159 |
|
$tmpcf['bandwidth'] = $p2pcatchbw;
|
1160 |
|
$tmpcf['bandwidthtype'] = $p2pcatchbwunit;
|
1161 |
|
} else if ($sched == "HFSC") {
|
1162 |
|
$tmpcf['linkshare'] = "on";
|
1163 |
|
$tmpcf['linkshare3'] = "{$p2pcatchbw}{$p2pcatchbwunit}";
|
1164 |
|
$tmpcf['upperlimit'] = "on";
|
1165 |
|
$tmpcf['upperlimit3'] = "{$p2pcatchbw}{$p2pcatchbwunit}";
|
1166 |
|
$tmpcf['bandwidth'] = $p2pcatchbw;
|
1167 |
|
$tmpcf['bandwidthtype'] = $p2pcatchbwunit;
|
1168 |
|
}
|
1169 |
|
$tmpcf['default'] = "on";
|
1170 |
|
|
|
1283 |
|
|
1284 |
if ($sched == "PRIQ")
|
|
1285 |
$q =& new priq_queue();
|
|
1286 |
else if ($sched == "CBQ")
|
|
1287 |
$q =& new cbq_queue();
|
|
1288 |
else if ($sched == "HFSC")
|
|
1289 |
$q =& new hfsc_queue();
|
|
1290 |
$tmpcf = array();
|
|
1291 |
$tmpcf['name'] = "qOthersLow";
|
|
1292 |
$tmpcf['priority'] = 2;
|
|
1293 |
$tmpcf['ecn'] = "on";
|
|
1294 |
$tmpcf['enabled'] = "on";
|
|
1295 |
if ($sched == "CBQ") {
|
|
1296 |
$tmpcf['borrow'] = "on";
|
|
1297 |
if ($penalty)
|
|
1298 |
$tmpcf['bandwidth'] = $penaltybw;
|
|
1299 |
else
|
|
1300 |
$tmpcf['bandwidth'] = $remainbw * 0.05; /* 5% bandwidth */
|
|
1301 |
$tmpcf['bandwidthtype'] = "%";
|
|
1302 |
} else if ($sched == "HFSC") {
|
|
1303 |
if ($penalty) {
|
|
1304 |
$tmpcf['linkshare3'] = "{$penaltybw}{$penaltybwunit}";
|
|
1305 |
$tmpcf['bandwidth'] = $penaltybw;
|
|
1306 |
$tmpcf['bandwidthtype'] = $penaltybwunit;
|
1171 |
1307 |
} else {
|
1172 |
|
if ($sched == "CBQ") {
|
1173 |
|
$tmpcf['borrow'] = "on";
|
1174 |
|
$tmpcf['bandwidth'] = $remainbw * 0.05; /* 5% bandwidth */
|
1175 |
|
$tmpcf['bandwidthtype'] = "%";
|
1176 |
|
} else if ($sched == "HFSC") {
|
1177 |
|
$tmpbw = $remainbw * 0.05; /* 5% bandwidth */
|
1178 |
|
$tmpcf['linkshare'] = "on";
|
1179 |
|
$tmpcf['linkshare3'] = "{$tmpbw}%";
|
1180 |
|
$tmpcf['upperlimit'] = "on";
|
1181 |
|
$tmpcf['upperlimit3'] = "{$tmpbw}%";
|
1182 |
|
$tmpcf['bandwidth'] = $tmpbw;
|
1183 |
|
$tmpcf['bandwidthtype'] = "%";
|
1184 |
|
}
|
|
1308 |
$lsbw = $remainbw * 0.05;
|
|
1309 |
$tmpcf['linkshare3'] = "{$lsbw}%"; /* 5% bandwidth */
|
|
1310 |
$tmpcf['bandwidth'] = $lsbw;
|
|
1311 |
$tmpcf['bandwidthtype'] = "%";
|
1185 |
1312 |
}
|
1186 |
|
array_push($tmppath, "qP2P");
|
1187 |
|
$qtmp =& $altq->add_queue($q, &$tmpcf, &$tmppath, $input_errors);
|
1188 |
|
array_pop($tmppath);
|
1189 |
|
//echo "qP2P <br />";
|
1190 |
|
//var_dump($input_errors);
|
1191 |
|
$qtmp->wconfig();
|
1192 |
|
}
|
1193 |
|
|
1194 |
|
if ($voip) {
|
1195 |
|
if ($sched == "PRIQ")
|
1196 |
|
$q =& new priq_queue();
|
1197 |
|
else if ($sched == "CBQ")
|
1198 |
|
$q =& new cbq_queue();
|
1199 |
|
else if ($sched == "HFSC")
|
1200 |
|
$q =& new hfsc_queue();
|
1201 |
|
$tmpcf = array();
|
1202 |
|
$tmpcf['name'] = "qVoIP";
|
1203 |
|
$tmpcf['priority'] = 7;
|
1204 |
|
$tmpcf['ecn'] = "on";
|
1205 |
|
$tmpcf['enabled'] = "on";
|
1206 |
|
if ($sched == "CBQ") {
|
1207 |
|
$tmpcf['borrow'] = "on";
|
1208 |
|
if ($voipbw > 0) {
|
1209 |
|
$tmpcf['bandwidth'] = $voipbw;
|
1210 |
|
$tmpcf['bandwidthtype'] = $voipbwunit;
|
1211 |
|
} else {
|
1212 |
|
$tmpcf['bandwidth'] = $remainbw * 0.2; /* 20% bandwidth */
|
1213 |
|
$tmpcf['bandwidthtype'] = "%";
|
1214 |
|
}
|
1215 |
|
} else if ($sched == "HFSC") {
|
1216 |
|
if ($voipbw > 0) {
|
1217 |
|
$tmpcf['realtime3'] = "{$voipbw}{$voipbwunit}";
|
1218 |
|
} else {
|
1219 |
|
$voipbw = $remainbw * 0.20; /* 20% bandwidth */
|
1220 |
|
$tmpcf['realtime3'] = "{$voipbw}%";
|
1221 |
|
}
|
1222 |
|
$tmpcf['realtime'] = "on";
|
1223 |
|
$tmpcf['bandwidth'] = 32;
|
1224 |
|
$tmpcf['bandwidthtype'] = "Kb";
|
1225 |
|
}
|
1226 |
|
array_push($tmppath, "qVoIP");
|
1227 |
|
$qtmp =& $altq->add_queue($q, &$tmpcf, &$tmppath, $input_errors);
|
1228 |
|
array_pop($tmppath);
|
1229 |
|
//echo "qVoIP <br />";
|
1230 |
|
//var_dump($input_errors);
|
1231 |
|
$qtmp->wconfig();
|
1232 |
|
}
|
1233 |
|
|
1234 |
|
if ($games) {
|
1235 |
|
if ($sched == "PRIQ")
|
1236 |
|
$q =& new priq_queue();
|
1237 |
|
else if ($sched == "CBQ")
|
1238 |
|
$q =& new cbq_queue();
|
1239 |
|
else if ($sched == "HFSC")
|
1240 |
|
$q =& new hfsc_queue();
|
1241 |
|
$tmpcf = array();
|
1242 |
|
$tmpcf['name'] = "qGames";
|
1243 |
|
$tmpcf['priority'] = 5;
|
1244 |
|
$tmpcf['enabled'] = "on";
|
1245 |
|
$tmpcf['ecn'] = "on";
|
1246 |
|
if ($sched == "CBQ") {
|
1247 |
|
$tmpcf['borrow'] = "on";
|
1248 |
|
$tmpcf['bandwidth'] = $remainbw * 0.2; /* 20% bandwidth */
|
1249 |
|
$tmpcf['bandwidthtype'] = "%";
|
1250 |
|
} else if ($sched == "HFSC") {
|
1251 |
|
$gamesbw = $remainbw * 0.2; /* 20% bandwidth */
|
1252 |
|
$tmpcf['linkshare'] = "on";
|
1253 |
|
$tmpcf['linkshare3'] = "{$gamesbw}%";
|
1254 |
|
$tmpcf['bandwidth'] = "{$gamesbw}";
|
1255 |
|
$tmpcf['bandwidthtype'] = "%";
|
1256 |
|
}
|
1257 |
|
array_push($tmppath, "qGames");
|
1258 |
|
$qtmp =& $altq->add_queue($q, &$tmpcf, &$tmppath, $input_errors);
|
1259 |
|
array_pop($tmppath);
|
1260 |
|
//echo "qGames <br />";
|
1261 |
|
//var_dump($input_errors);
|
1262 |
|
$qtmp->wconfig();
|
1263 |
|
}
|
1264 |
|
|
1265 |
|
if ($otherpriority) {
|
1266 |
|
if ($sched == "PRIQ")
|
1267 |
|
$q =& new priq_queue();
|
1268 |
|
else if ($sched == "CBQ")
|
1269 |
|
$q =& new cbq_queue();
|
1270 |
|
else if ($sched == "HFSC")
|
1271 |
|
$q =& new hfsc_queue();
|
1272 |
|
$tmpcf = array();
|
1273 |
|
$tmpcf['name'] = "qOthersHigh";
|
1274 |
|
$tmpcf['priority'] = 4;
|
1275 |
|
$tmpcf['ecn'] = "on";
|
1276 |
|
$tmpcf['enabled'] = "on";
|
1277 |
|
if ($sched == "CBQ") {
|
1278 |
|
$tmpcf['borrow'] = "on";
|
1279 |
|
$tmpcf['bandwidth'] = $remainbw * 0.1; /* 10% bandwidth */
|
1280 |
|
$tmpcf['bandwidthtype'] = "%";
|
1281 |
|
} else if ($sched == "HFSC") {
|
1282 |
|
$tmpcf['linkshare'] = "on";
|
1283 |
|
$otherbw = $remainbw * 0.1; /* 10% bandwidth */
|
1284 |
|
$tmpcf['linkshare3'] = "{$otherbw}%";
|
1285 |
|
$tmpcf['bandwidth'] = $otherbw;
|
1286 |
|
$tmpcf['bandwidthtype'] = "%";
|
1287 |
|
}
|
1288 |
|
array_push($tmppath, "qOthersHigh");
|
1289 |
|
$qtmp =& $altq->add_queue($q, &$tmpcf, &$tmppath, $input_errors);
|
1290 |
|
array_pop($tmppath);
|
1291 |
|
//echo "qHigh <br />";
|
1292 |
|
//var_dump($input_errors);
|
1293 |
|
$qtmp->wconfig();
|
1294 |
|
|
1295 |
|
|
1296 |
|
if ($sched == "PRIQ")
|
1297 |
|
$q =& new priq_queue();
|
1298 |
|
else if ($sched == "CBQ")
|
1299 |
|
$q =& new cbq_queue();
|
1300 |
|
else if ($sched == "HFSC")
|
1301 |
|
$q =& new hfsc_queue();
|
1302 |
|
$tmpcf = array();
|
1303 |
|
$tmpcf['name'] = "qOthersLow";
|
1304 |
|
$tmpcf['priority'] = 2;
|
1305 |
|
$tmpcf['ecn'] = "on";
|
1306 |
|
$tmpcf['enabled'] = "on";
|
1307 |
|
if ($sched == "CBQ") {
|
1308 |
|
$tmpcf['borrow'] = "on";
|
1309 |
|
if ($penalty)
|
1310 |
|
$tmpcf['bandwidth'] = $penaltybw;
|
1311 |
|
else
|
1312 |
|
$tmpcf['bandwidth'] = $remainbw * 0.05; /* 5% bandwidth */
|
1313 |
|
$tmpcf['bandwidthtype'] = "%";
|
1314 |
|
} else if ($sched == "HFSC") {
|
1315 |
|
if ($penalty) {
|
1316 |
|
$tmpcf['linkshare3'] = "{$penaltybw}{$penaltybwunit}";
|
1317 |
|
$tmpcf['bandwidth'] = $penaltybw;
|
1318 |
|
$tmpcf['bandwidthtype'] = $penaltybwunit;
|
1319 |
|
} else {
|
1320 |
|
$lsbw = $remainbw * 0.05;
|
1321 |
|
$tmpcf['linkshare3'] = "{$lsbw}%"; /* 5% bandwidth */
|
1322 |
|
$tmpcf['bandwidth'] = $lsbw;
|
1323 |
|
$tmpcf['bandwidthtype'] = "%";
|
1324 |
|
}
|
1325 |
|
$tmpcf['linkshare'] = "on";
|
1326 |
|
}
|
1327 |
|
array_push($tmppath, "qOthersLow");
|
1328 |
|
$qtmp =& $altq->add_queue($q, &$tmpcf, &$tmppath, $input_errors);
|
1329 |
|
array_pop($tmppath);
|
1330 |
|
//echo "qLow <br />";
|
1331 |
|
//var_dump($input_errors);
|
1332 |
|
$qtmp->wconfig();
|
|
1313 |
$tmpcf['linkshare'] = "on";
|
1333 |
1314 |
}
|
|
1315 |
array_push($tmppath, "qOthersLow");
|
|
1316 |
$qtmp =& $altq->add_queue($q, &$tmpcf, &$tmppath, $input_errors);
|
1334 |
1317 |
array_pop($tmppath);
|
|
1318 |
//echo "qLow <br />";
|
|
1319 |
//var_dump($input_errors);
|
|
1320 |
$qtmp->wconfig();
|
|
1321 |
}
|
|
1322 |
array_pop($tmppath);
|
1335 |
1323 |
|
1336 |
|
/* End LAN bandwidth ------------------------------------------------------------------------------------- */
|
1337 |
|
|
1338 |
|
|
|
1324 |
/* End LAN bandwidth ------------------------------------------------------------------------------------- */
|
1339 |
1325 |
|
1340 |
1326 |
if (!is_array($config['filter']['rule']))
|
1341 |
1327 |
$config['filter']['rule'] = array();
|
Re-enable downstream queues but with the difference that the default queue now tries to use all the link when possible and the bandwidth limit is specified on a subqueue instead of the interface.