25 |
25 |
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
26 |
26 |
POSSIBILITY OF SUCH DAMAGE.
|
27 |
27 |
|
28 |
|
pfSense_BUILDER_BINARIES: /bin/kill /sbin/kldload /bin/rm /bin/ps
|
29 |
|
pfSense_MODULE: shaper
|
|
28 |
pfSense_BUILDER_BINARIES: /bin/kill /sbin/kldload /bin/rm /bin/ps
|
|
29 |
pfSense_MODULE: shaper
|
30 |
30 |
*/
|
31 |
31 |
|
32 |
32 |
/* XXX: needs some reducing on include. */
|
... | ... | |
208 |
208 |
$altq =& $altq_list_queues[$int];
|
209 |
209 |
if ($altq) {
|
210 |
210 |
$bw_3 = $altq->GetBandwidth();
|
211 |
|
$bw_3 = $bw_3 * get_bandwidthtype_scale($altq->GetBwscale());
|
|
211 |
$bw_3 = $bw_3 * get_bandwidthtype_scale($altq->GetBwscale());
|
212 |
212 |
return floatval($bw_3);
|
213 |
213 |
} else {
|
214 |
214 |
return 0;
|
... | ... | |
576 |
576 |
/*
|
577 |
577 |
* First it spits:
|
578 |
578 |
* altq on $interface ..............
|
579 |
|
* then it goes like
|
580 |
|
* foreach ($queues as $qkey => $queue) {
|
581 |
|
* this->queues[$qkey]->build_rule();
|
582 |
|
* }
|
|
579 |
* then it goes like
|
|
580 |
* foreach ($queues as $qkey => $queue) {
|
|
581 |
* this->queues[$qkey]->build_rule();
|
|
582 |
* }
|
583 |
583 |
*/
|
584 |
584 |
function build_rules(&$default = false) {
|
585 |
585 |
if (count($this->queues) > 0 && $this->GetEnabled() == "on") {
|
586 |
586 |
$default = false;
|
587 |
|
$rules = " altq on " . get_real_interface($this->GetInterface());
|
|
587 |
$rules = " altq on " . get_real_interface($this->GetInterface());
|
588 |
588 |
if ($this->GetScheduler()) {
|
589 |
589 |
$rules .= " ".strtolower($this->GetScheduler());
|
590 |
590 |
}
|
... | ... | |
625 |
625 |
}
|
626 |
626 |
$frule .= $rules;
|
627 |
627 |
} else if ($this->GetEnabled() == "on" && $this->GetScheduler() == "CODELQ") {
|
628 |
|
$rules = " altq on " . get_real_interface($this->GetInterface());
|
|
628 |
$rules = " altq on " . get_real_interface($this->GetInterface());
|
629 |
629 |
if ($this->GetScheduler()) {
|
630 |
630 |
$rules .= " ".strtolower($this->GetScheduler());
|
631 |
631 |
}
|
... | ... | |
701 |
701 |
/*
|
702 |
702 |
* For requesting the parameters of the root queues
|
703 |
703 |
* to the user like the traffic wizard does.
|
704 |
|
*/
|
|
704 |
*/
|
705 |
705 |
function build_form() {
|
706 |
|
|
|
706 |
|
707 |
707 |
$sform = new Form(new Form_Button(
|
708 |
708 |
'Submit',
|
709 |
709 |
'Save'
|
710 |
710 |
));
|
711 |
|
|
|
711 |
|
712 |
712 |
$section = new Form_Section(null);
|
713 |
|
|
|
713 |
|
714 |
714 |
$section->addInput(new Form_Checkbox(
|
715 |
715 |
'enabled',
|
716 |
716 |
'Enable/Disable',
|
... | ... | |
718 |
718 |
($this->GetEnabled() == "on"),
|
719 |
719 |
'on'
|
720 |
720 |
));
|
721 |
|
|
|
721 |
|
722 |
722 |
$section->addInput(new Form_StaticText(
|
723 |
723 |
'Name',
|
724 |
724 |
$this->GetQname()
|
725 |
725 |
));
|
726 |
|
|
|
726 |
|
727 |
727 |
$section->addInput(new Form_Select(
|
728 |
728 |
'scheduler',
|
729 |
729 |
'Scheduler Type',
|
730 |
730 |
$this->GetScheduler(),
|
731 |
|
array('HFSC' => 'HFSC',
|
|
731 |
array('HFSC' => 'HFSC',
|
732 |
732 |
'CBQ' => 'CBQ',
|
733 |
733 |
'FAIRQ' => 'FAIRQ',
|
734 |
734 |
'CODELQ' => 'CODELQ',
|
735 |
735 |
'PRIQ' => 'PRIQ')
|
736 |
736 |
))->setHelp('Changing this changes all child queues! Beware you can lose information.');
|
737 |
|
|
|
737 |
|
738 |
738 |
$group = new Form_group('Bandwidth');
|
739 |
|
|
|
739 |
|
740 |
740 |
$group->add(new Form_Input(
|
741 |
741 |
'bandwidth',
|
742 |
742 |
null,
|
743 |
743 |
'number',
|
744 |
744 |
$this->GetBandwidth()
|
745 |
745 |
));
|
746 |
|
|
|
746 |
|
747 |
747 |
$group->add(new Form_Select(
|
748 |
748 |
'bandwidthtype',
|
749 |
749 |
null,
|
... | ... | |
753 |
753 |
'Gb' => 'Gb',
|
754 |
754 |
'b' => 'b')
|
755 |
755 |
));
|
756 |
|
|
|
756 |
|
757 |
757 |
$section->add($group);
|
758 |
|
|
|
758 |
|
759 |
759 |
$section->addInput(new Form_Input(
|
760 |
760 |
'qlimit',
|
761 |
761 |
'Queue Limit',
|
762 |
762 |
'number',
|
763 |
763 |
$this->GetQlimit()
|
764 |
764 |
));
|
765 |
|
|
|
765 |
|
766 |
766 |
$section->addInput(new Form_Input(
|
767 |
767 |
'tbrconfig',
|
768 |
768 |
'TRB Size',
|
769 |
769 |
'number',
|
770 |
770 |
$this->GetTbrConfig()
|
771 |
771 |
))->setHelp('Adjusts the size, in bytes, of the token bucket regulator. If not specified, heuristics based on the interface ' .
|
772 |
|
'bandwidth are used to determine the size.');
|
773 |
|
|
|
772 |
'bandwidth are used to determine the size.');
|
|
773 |
|
774 |
774 |
$section->addInput(new Form_Input(
|
775 |
775 |
'interface',
|
776 |
776 |
null,
|
777 |
777 |
'hidden',
|
778 |
778 |
$this->GetInterface()
|
779 |
779 |
));
|
780 |
|
|
|
780 |
|
781 |
781 |
$section->addInput(new Form_Input(
|
782 |
782 |
'name',
|
783 |
783 |
null,
|
784 |
784 |
'hidden',
|
785 |
785 |
$this->GetQname()
|
786 |
786 |
));
|
787 |
|
|
|
787 |
|
788 |
788 |
$sform->add($section);
|
789 |
|
|
|
789 |
|
790 |
790 |
return($sform);
|
791 |
791 |
}
|
792 |
792 |
|
... | ... | |
1085 |
1085 |
$input_errors[] = "Bandwidth cannot be negative.";
|
1086 |
1086 |
}
|
1087 |
1087 |
if ($data['priority'] && (!is_numeric($data['priority']) ||
|
1088 |
|
($data['priority'] < 1) || ($data['priority'] > 15))) {
|
|
1088 |
($data['priority'] < 1) || ($data['priority'] > 15))) {
|
1089 |
1089 |
$input_errors[] = gettext("The priority must be an integer between 1 and 15.");
|
1090 |
1090 |
}
|
1091 |
1091 |
if ($data['qlimit'] && (!is_numeric($data['qlimit']))) {
|
... | ... | |
1262 |
1262 |
* object is created and later when we may
|
1263 |
1263 |
* need to update it. (2)
|
1264 |
1264 |
*/
|
1265 |
|
|
|
1265 |
|
1266 |
1266 |
function build_form() {
|
1267 |
|
|
|
1267 |
|
1268 |
1268 |
$sform = new Form();
|
1269 |
|
|
|
1269 |
|
1270 |
1270 |
$section = new Form_Section(null);
|
1271 |
|
|
|
1271 |
|
1272 |
1272 |
$section->addInput(new Form_Checkbox(
|
1273 |
1273 |
'enabled',
|
1274 |
1274 |
'Enable/Disable',
|
... | ... | |
1276 |
1276 |
($this->GetEnabled() == "on"),
|
1277 |
1277 |
'on'
|
1278 |
1278 |
));
|
1279 |
|
|
|
1279 |
|
1280 |
1280 |
$section->addInput(new Form_StaticText(
|
1281 |
1281 |
'Name',
|
1282 |
1282 |
$this->GetQname()
|
1283 |
1283 |
))->setHelp('Enter the name of the queue here. Do not use spaces and limit the size to 15 characters.');
|
1284 |
|
|
|
1284 |
|
1285 |
1285 |
$section->addInput(new Form_Input(
|
1286 |
1286 |
'priority',
|
1287 |
1287 |
'Priority',
|
... | ... | |
1296 |
1296 |
'number',
|
1297 |
1297 |
$this->GetQlimit()
|
1298 |
1298 |
))->setHelp('Queue limit in packets.');
|
1299 |
|
|
|
1299 |
|
1300 |
1300 |
$group = new Form_Group('Scheduler options');
|
1301 |
|
|
|
1301 |
|
1302 |
1302 |
if (empty($this->subqueues)) {
|
1303 |
1303 |
$group->add(new Form_Checkbox(
|
1304 |
1304 |
'default',
|
1305 |
1305 |
null,
|
1306 |
1306 |
null,
|
1307 |
1307 |
$this->GetDefault()
|
1308 |
|
))->setHelp('Default Queue');
|
|
1308 |
))->setHelp('Default Queue');
|
1309 |
1309 |
}
|
1310 |
|
|
|
1310 |
|
1311 |
1311 |
$group->add(new Form_Checkbox(
|
1312 |
1312 |
'red',
|
1313 |
1313 |
null,
|
1314 |
1314 |
null,
|
1315 |
1315 |
!empty($this->GetRed())
|
1316 |
1316 |
))->setHelp('<a target="_new" href="http://www.openbsd.org/faq/pf/queueing.html#red">' . gettext('Random Early Detection') . '</a>');
|
1317 |
|
|
|
1317 |
|
1318 |
1318 |
$group->add(new Form_Checkbox(
|
1319 |
1319 |
'rio',
|
1320 |
1320 |
null,
|
1321 |
1321 |
null,
|
1322 |
1322 |
!empty($this->GetRio())
|
1323 |
1323 |
))->setHelp('<a target="_new" href="http://www.openbsd.org/faq/pf/queueing.html#rio">' . gettext('Random Early Detection In and Out') . '</a>');
|
1324 |
|
|
|
1324 |
|
1325 |
1325 |
$group->add(new Form_Checkbox(
|
1326 |
1326 |
'ecn',
|
1327 |
1327 |
null,
|
1328 |
1328 |
null,
|
1329 |
1329 |
!empty($this->GetEcn())
|
1330 |
1330 |
))->setHelp('<a target="_new" href="http://www.openbsd.org/faq/pf/queueing.html#ecn">' . gettext('Explicit Congestion Notification') . '</a>');
|
1331 |
|
|
|
1331 |
|
1332 |
1332 |
$group->add(new Form_Checkbox(
|
1333 |
1333 |
'codel',
|
1334 |
1334 |
null,
|
... | ... | |
1337 |
1337 |
))->setHelp('<a target="_new" href="http://www.openbsd.org/faq/pf/queueing.html#ecn">' . gettext('Explicit Congestion Notification') . '</a>');
|
1338 |
1338 |
|
1339 |
1339 |
$group->setHelp('Select options for this queue');
|
1340 |
|
|
1341 |
|
$section->add($group);
|
1342 |
|
|
|
1340 |
|
|
1341 |
$section->add($group);
|
|
1342 |
|
1343 |
1343 |
$section->addInput(new Form_Input(
|
1344 |
1344 |
'description',
|
1345 |
1345 |
'Description',
|
1346 |
1346 |
'text',
|
1347 |
1347 |
$this->GetDescription()
|
1348 |
1348 |
));
|
1349 |
|
|
|
1349 |
|
1350 |
1350 |
$section->addInput(new Form_Input(
|
1351 |
1351 |
'interface',
|
1352 |
1352 |
null,
|
1353 |
1353 |
'hidden',
|
1354 |
1354 |
$this->GetInterface()
|
1355 |
|
));
|
1356 |
|
|
|
1355 |
));
|
|
1356 |
|
1357 |
1357 |
$sform->add($section);
|
1358 |
|
|
|
1358 |
|
1359 |
1359 |
return($sform);
|
1360 |
|
}
|
|
1360 |
}
|
1361 |
1361 |
|
1362 |
1362 |
function build_shortform() {
|
1363 |
1363 |
/* XXX: Hacks in sight. Mostly layer violations! */
|
... | ... | |
1820 |
1820 |
if ($data['linkshare3'] <> "" && !is_valid_shaperbw($data['linkshare3'])) {
|
1821 |
1821 |
$input_errors[] = gettext("linkshare m2 value needs to be Kb, Mb, Gb, or %");
|
1822 |
1822 |
}
|
1823 |
|
if ($data['realtime1'] <> "" && $data['realtime2'] == "") {
|
|
1823 |
if ($data['realtime1'] <> "" && $data['realtime2'] == "") {
|
1824 |
1824 |
$input_errors[] = gettext("realtime service curve defined but missing (d) value");
|
1825 |
1825 |
}
|
1826 |
|
if ($data['realtime2'] <> "" && $data['realtime1'] == "") {
|
|
1826 |
if ($data['realtime2'] <> "" && $data['realtime1'] == "") {
|
1827 |
1827 |
$input_errors[] = gettext("realtime service curve defined but missing initial bandwidth (m1) value");
|
1828 |
1828 |
}
|
1829 |
1829 |
|
... | ... | |
1997 |
1997 |
$default = true;
|
1998 |
1998 |
}
|
1999 |
1999 |
|
2000 |
|
if ($this->GetRealtime() <> "") {
|
|
2000 |
if ($this->GetRealtime() <> "") {
|
2001 |
2001 |
if ($comma) {
|
2002 |
2002 |
$pfq_rule .= " , ";
|
2003 |
2003 |
}
|
2004 |
2004 |
if ($this->GetR_m1() <> "" && $this->GetR_d() <> "" && $this->GetR_m2() <> "") {
|
2005 |
2005 |
$pfq_rule .= " realtime (".$this->GetR_m1() . ", " . $this->GetR_d().", ". $this->GetR_m2() .") ";
|
2006 |
|
} else if ($this->GetR_m2() <> "") {
|
|
2006 |
} else if ($this->GetR_m2() <> "") {
|
2007 |
2007 |
$pfq_rule .= " realtime " . $this->GetR_m2();
|
2008 |
2008 |
}
|
2009 |
2009 |
$comma = 1;
|
... | ... | |
2054 |
2054 |
}
|
2055 |
2055 |
|
2056 |
2056 |
function build_javascript() {
|
2057 |
|
|
|
2057 |
|
2058 |
2058 |
$javascript = <<<EOJS
|
2059 |
2059 |
<script type="text/javascript">
|
2060 |
|
//<![CDATA[
|
|
2060 |
//<![CDATA[
|
2061 |
2061 |
events.push(function(){
|
2062 |
|
|
2063 |
|
// Disables the specified input element
|
2064 |
|
function disableInput(id, disable) {
|
2065 |
|
$('#' + id).prop("disabled", disable);
|
2066 |
|
}
|
2067 |
|
|
2068 |
|
// Upperlimit
|
2069 |
|
function enable_upperlimit() {
|
2070 |
|
disableInput('upperlimit1', !$('#upperlimit').prop('checked'));
|
2071 |
|
disableInput('upperlimit2', !$('#upperlimit').prop('checked'));
|
2072 |
|
disableInput('upperlimit3', !$('#upperlimit').prop('checked'));
|
2073 |
|
}
|
2074 |
|
|
2075 |
|
$('#upperlimit').click(function () {
|
2076 |
|
enable_upperlimit();
|
2077 |
|
});
|
2078 |
|
|
2079 |
|
enable_upperlimit();
|
2080 |
|
|
2081 |
|
// realtime
|
2082 |
|
function enable_realtime() {
|
2083 |
|
disableInput('realtime1', !$('#realtime').prop('checked'));
|
2084 |
|
disableInput('realtime2', !$('#realtime').prop('checked'));
|
2085 |
|
disableInput('realtime3', !$('#realtime').prop('checked'));
|
2086 |
|
}
|
2087 |
|
|
2088 |
|
$('#realtime').click(function () {
|
2089 |
|
enable_realtime();
|
2090 |
|
});
|
2091 |
|
|
2092 |
|
enable_realtime();
|
2093 |
|
|
2094 |
|
// linkshare
|
2095 |
|
function enable_linkshare() {
|
2096 |
|
disableInput('linkshare1', !$('#linkshare').prop('checked'));
|
2097 |
|
disableInput('linkshare2', !$('#linkshare').prop('checked'));
|
2098 |
|
disableInput('linkshare3', !$('#linkshare').prop('checked'));
|
2099 |
|
}
|
2100 |
|
|
2101 |
|
$('#linkshare').click(function () {
|
2102 |
|
enable_linkshare();
|
2103 |
|
});
|
2104 |
|
|
2105 |
|
enable_linkshare();
|
|
2062 |
|
|
2063 |
// Disables the specified input element
|
|
2064 |
function disableInput(id, disable) {
|
|
2065 |
$('#' + id).prop("disabled", disable);
|
|
2066 |
}
|
|
2067 |
|
|
2068 |
// Upperlimit
|
|
2069 |
function enable_upperlimit() {
|
|
2070 |
disableInput('upperlimit1', !$('#upperlimit').prop('checked'));
|
|
2071 |
disableInput('upperlimit2', !$('#upperlimit').prop('checked'));
|
|
2072 |
disableInput('upperlimit3', !$('#upperlimit').prop('checked'));
|
|
2073 |
}
|
|
2074 |
|
|
2075 |
$('#upperlimit').click(function () {
|
|
2076 |
enable_upperlimit();
|
|
2077 |
});
|
|
2078 |
|
|
2079 |
enable_upperlimit();
|
|
2080 |
|
|
2081 |
// realtime
|
|
2082 |
function enable_realtime() {
|
|
2083 |
disableInput('realtime1', !$('#realtime').prop('checked'));
|
|
2084 |
disableInput('realtime2', !$('#realtime').prop('checked'));
|
|
2085 |
disableInput('realtime3', !$('#realtime').prop('checked'));
|
|
2086 |
}
|
|
2087 |
|
|
2088 |
$('#realtime').click(function () {
|
|
2089 |
enable_realtime();
|
|
2090 |
});
|
|
2091 |
|
|
2092 |
enable_realtime();
|
|
2093 |
|
|
2094 |
// linkshare
|
|
2095 |
function enable_linkshare() {
|
|
2096 |
disableInput('linkshare1', !$('#linkshare').prop('checked'));
|
|
2097 |
disableInput('linkshare2', !$('#linkshare').prop('checked'));
|
|
2098 |
disableInput('linkshare3', !$('#linkshare').prop('checked'));
|
|
2099 |
}
|
|
2100 |
|
|
2101 |
$('#linkshare').click(function () {
|
|
2102 |
enable_linkshare();
|
|
2103 |
});
|
|
2104 |
|
|
2105 |
enable_linkshare();
|
2106 |
2106 |
});
|
2107 |
|
//]]>
|
2108 |
|
</script>
|
|
2107 |
//]]>
|
|
2108 |
</script>
|
2109 |
2109 |
EOJS;
|
2110 |
|
/*
|
2111 |
|
$javascript = parent::build_javascript();
|
2112 |
|
$javascript .= "<script type=\"text/javascript\">";
|
2113 |
|
$javascript .= "//<![CDATA[\n";
|
2114 |
|
$javascript .= "function enable_realtime(enable_over) { \n";
|
2115 |
|
$javascript .= "if (document.iform.realtime.checked || enable_over) { \n";
|
2116 |
|
$javascript .= "document.iform.realtime1.disabled = 0;\n";
|
2117 |
|
$javascript .= "document.iform.realtime2.disabled = 0;\n";
|
2118 |
|
$javascript .= "document.iform.realtime3.disabled = 0;\n";
|
2119 |
|
$javascript .= " } else { \n";
|
2120 |
|
$javascript .= "document.iform.realtime1.disabled = 1;\n";
|
2121 |
|
$javascript .= "document.iform.realtime2.disabled = 1;\n";
|
2122 |
|
$javascript .= "document.iform.realtime3.disabled = 1;\n";
|
2123 |
|
$javascript .= " } \n";
|
2124 |
|
$javascript .= " } \n";
|
2125 |
|
$javascript .= "function enable_linkshare(enable_over) { \n";
|
2126 |
|
$javascript .= "if (document.iform.linkshare.checked || enable_over) { \n";
|
2127 |
|
$javascript .= "document.iform.linkshare1.disabled = 0;\n";
|
2128 |
|
$javascript .= "document.iform.linkshare2.disabled = 0;\n";
|
2129 |
|
$javascript .= "document.iform.linkshare3.disabled = 0;\n";
|
2130 |
|
$javascript .= " } else { \n";
|
2131 |
|
$javascript .= "document.iform.linkshare1.disabled = 1;\n";
|
2132 |
|
$javascript .= "document.iform.linkshare2.disabled = 1;\n";
|
2133 |
|
$javascript .= "document.iform.linkshare3.disabled = 1;\n";
|
2134 |
|
$javascript .= " } \n";
|
2135 |
|
$javascript .= " } \n";
|
2136 |
|
$javascript .= "function enable_upperlimit(enable_over) { \n";
|
2137 |
|
$javascript .= "if (document.iform.upperlimit.checked || enable_over) { \n";
|
2138 |
|
$javascript .= "document.iform.upperlimit1.disabled = 0;\n";
|
2139 |
|
$javascript .= "document.iform.upperlimit2.disabled = 0;\n";
|
2140 |
|
$javascript .= "document.iform.upperlimit3.disabled = 0;\n";
|
2141 |
|
$javascript .= " } else { \n";
|
2142 |
|
$javascript .= "document.iform.upperlimit1.disabled = 1;\n";
|
2143 |
|
$javascript .= "document.iform.upperlimit2.disabled = 1;\n";
|
2144 |
|
$javascript .= "document.iform.upperlimit3.disabled = 1;\n";
|
2145 |
|
$javascript .= " } \n";
|
2146 |
|
|
2147 |
|
$javascript .= "} \n";
|
2148 |
|
$javascript .= "//]]>";
|
2149 |
|
$javascript .= "</script>";*/
|
2150 |
2110 |
|
2151 |
2111 |
return $javascript;
|
2152 |
2112 |
}
|
2153 |
2113 |
|
2154 |
2114 |
function build_form() {
|
2155 |
|
|
|
2115 |
|
2156 |
2116 |
$sform = parent::build_form();
|
2157 |
|
|
|
2117 |
|
2158 |
2118 |
$section = new Form_Section('Service Curve (sc)');
|
2159 |
2119 |
|
2160 |
2120 |
$group = new Form_Group('Bandwidth');
|
2161 |
|
|
|
2121 |
|
2162 |
2122 |
$group->add(new Form_Input(
|
2163 |
2123 |
'bandwidth',
|
2164 |
2124 |
null,
|
2165 |
2125 |
'number',
|
2166 |
2126 |
$this->GetBandwidth()
|
2167 |
2127 |
));
|
2168 |
|
|
|
2128 |
|
2169 |
2129 |
$group->add(new Form_Select(
|
2170 |
2130 |
'bandwidthtype',
|
2171 |
2131 |
null,
|
... | ... | |
2175 |
2135 |
'Gb' => 'Gb',
|
2176 |
2136 |
'b' => 'b')
|
2177 |
2137 |
));
|
2178 |
|
|
|
2138 |
|
2179 |
2139 |
$group->setHelp('Choose the amount of bandwidth for this queue');
|
2180 |
|
|
|
2140 |
|
2181 |
2141 |
$section->add($group);
|
2182 |
|
|
|
2142 |
|
2183 |
2143 |
$group = new Form_Group('Max bandwidth for queue.');
|
2184 |
|
|
|
2144 |
|
2185 |
2145 |
$group->add(new Form_Checkbox(
|
2186 |
2146 |
'upperlimit',
|
2187 |
2147 |
null,
|
2188 |
2148 |
'Upper Limit',
|
2189 |
2149 |
($this->GetUpperlimit()<> "")
|
2190 |
|
));
|
2191 |
|
|
|
2150 |
));
|
|
2151 |
|
2192 |
2152 |
$group->add(new Form_Input(
|
2193 |
2153 |
'upperlimit1',
|
2194 |
2154 |
null,
|
2195 |
2155 |
'text',
|
2196 |
2156 |
$this->GetU_m1()
|
2197 |
2157 |
));
|
2198 |
|
|
|
2158 |
|
2199 |
2159 |
$group->add(new Form_Input(
|
2200 |
2160 |
'upperlimit2',
|
2201 |
2161 |
null,
|
... | ... | |
2208 |
2168 |
'text',
|
2209 |
2169 |
$this->GetU_m2()
|
2210 |
2170 |
));
|
2211 |
|
|
2212 |
|
|
2213 |
|
$section->add($group);
|
2214 |
|
|
|
2171 |
|
|
2172 |
|
|
2173 |
$section->add($group);
|
|
2174 |
|
2215 |
2175 |
$group = new Form_Group('Min bandwidth for queue.');
|
2216 |
|
|
|
2176 |
|
2217 |
2177 |
$group->add(new Form_Checkbox(
|
2218 |
2178 |
'realtime',
|
2219 |
2179 |
null,
|
2220 |
2180 |
'Real Time',
|
2221 |
2181 |
($this->GetRealtime()<> "")
|
2222 |
|
));
|
2223 |
|
|
|
2182 |
));
|
|
2183 |
|
2224 |
2184 |
$group->add(new Form_Input(
|
2225 |
2185 |
'realtime1',
|
2226 |
2186 |
null,
|
2227 |
2187 |
'text',
|
2228 |
2188 |
$this->GetR_m1()
|
2229 |
2189 |
));
|
2230 |
|
|
|
2190 |
|
2231 |
2191 |
$group->add(new Form_Input(
|
2232 |
2192 |
'realtime2',
|
2233 |
2193 |
null,
|
... | ... | |
2240 |
2200 |
'text',
|
2241 |
2201 |
$this->GetR_m2()
|
2242 |
2202 |
));
|
2243 |
|
|
|
2203 |
|
2244 |
2204 |
$section->add($group);
|
2245 |
|
|
|
2205 |
|
2246 |
2206 |
$group = new Form_Group('B/W share of a backlogged queue.');
|
2247 |
|
|
|
2207 |
|
2248 |
2208 |
$group->add(new Form_Checkbox(
|
2249 |
2209 |
'linkshare',
|
2250 |
2210 |
null,
|
2251 |
2211 |
'Link Share',
|
2252 |
2212 |
($this->GetLinkshare()<> "")
|
2253 |
|
));
|
2254 |
|
|
|
2213 |
));
|
|
2214 |
|
2255 |
2215 |
$group->add(new Form_Input(
|
2256 |
2216 |
'linkshare1',
|
2257 |
2217 |
null,
|
2258 |
2218 |
'text',
|
2259 |
2219 |
$this->GetL_m1()
|
2260 |
2220 |
));
|
2261 |
|
|
|
2221 |
|
2262 |
2222 |
$group->add(new Form_Input(
|
2263 |
2223 |
'linkshare2',
|
2264 |
2224 |
null,
|
... | ... | |
2271 |
2231 |
'text',
|
2272 |
2232 |
$this->GetL_m2()
|
2273 |
2233 |
));
|
2274 |
|
|
|
2234 |
|
2275 |
2235 |
$group->sethelp('Bandwidth share overrides priority.' . '<br />' .
|
2276 |
2236 |
'The format for service curve specifications is (m1, d, m2). m2 controls the bandwidth assigned to the queue. ' .
|
2277 |
2237 |
'm1 and d are optional and can be used to control the initial bandwidth assignment. ' .
|
2278 |
2238 |
'For the first d milliseconds the queue gets the bandwidth given as m1, afterwards the value given in m2.');
|
2279 |
|
|
|
2239 |
|
2280 |
2240 |
$section->add($group);
|
2281 |
|
|
|
2241 |
|
2282 |
2242 |
$sform->add($section);
|
2283 |
|
|
2284 |
|
return($sform);
|
|
2243 |
|
|
2244 |
return($sform);
|
2285 |
2245 |
}
|
2286 |
2246 |
|
2287 |
2247 |
function update_altq_queue_data(&$data) {
|
... | ... | |
2708 |
2668 |
|
2709 |
2669 |
function build_form() {
|
2710 |
2670 |
$sform = parent::build_form();
|
2711 |
|
|
|
2671 |
|
2712 |
2672 |
$section = new Form_Section('');
|
2713 |
2673 |
|
2714 |
2674 |
$group = new Form_Group('Bandwidth');
|
2715 |
|
|
|
2675 |
|
2716 |
2676 |
$group->add(new Form_Input(
|
2717 |
2677 |
'bandwidth',
|
2718 |
2678 |
null,
|
2719 |
2679 |
'number',
|
2720 |
2680 |
$this->GetBandwidth()
|
2721 |
2681 |
));
|
2722 |
|
|
|
2682 |
|
2723 |
2683 |
$group->add(new Form_Select(
|
2724 |
2684 |
'bandwidthtype',
|
2725 |
2685 |
null,
|
... | ... | |
2729 |
2689 |
'Gb' => 'Gb',
|
2730 |
2690 |
'b' => 'b')
|
2731 |
2691 |
));
|
2732 |
|
|
|
2692 |
|
2733 |
2693 |
$group->setHelp('Choose the amount of bandwidth for this queue');
|
2734 |
2694 |
|
2735 |
2695 |
$section->add($group);
|
2736 |
|
|
|
2696 |
|
2737 |
2697 |
$section->addInput(new Form_Checkbox(
|
2738 |
2698 |
'borrow',
|
2739 |
2699 |
'Scheduler option',
|
2740 |
2700 |
'Borrow from other queues when available',
|
2741 |
2701 |
($this->GetBorrow() == "on")
|
2742 |
|
));
|
2743 |
|
|
|
2702 |
));
|
|
2703 |
|
2744 |
2704 |
return $sform;
|
2745 |
2705 |
}
|
2746 |
2706 |
|
... | ... | |
2948 |
2908 |
$pfq_rule .= " qlimit " . $this->GetQlimit();
|
2949 |
2909 |
}
|
2950 |
2910 |
if ($this->GetDefault() || $this->GetRed() || $this->GetRio() ||
|
2951 |
|
$this->GetEcn() || $this->GetBuckets() || $this->GetHogs() || $this->GetCodel()) {
|
|
2911 |
$this->GetEcn() || $this->GetBuckets() || $this->GetHogs() || $this->GetCodel()) {
|
2952 |
2912 |
$pfq_rule .= " fairq ( ";
|
2953 |
2913 |
$tmpvalue = trim($this->GetRed());
|
2954 |
2914 |
if (!empty($tmpvalue)) {
|
... | ... | |
3008 |
2968 |
|
3009 |
2969 |
function build_form() {
|
3010 |
2970 |
$form = parent::build_form();
|
3011 |
|
|
|
2971 |
|
3012 |
2972 |
$section = new Form_Section('');
|
3013 |
2973 |
|
3014 |
2974 |
$group = new Form_Group('Bandwidth');
|
3015 |
|
|
|
2975 |
|
3016 |
2976 |
$group->add(new Form_Input(
|
3017 |
2977 |
'bandwidth',
|
3018 |
2978 |
null,
|
3019 |
2979 |
'number',
|
3020 |
2980 |
$this->GetBandwidth()
|
3021 |
2981 |
));
|
3022 |
|
|
|
2982 |
|
3023 |
2983 |
$group->add(new Form_Select(
|
3024 |
2984 |
'bandwidthtype',
|
3025 |
2985 |
null,
|
... | ... | |
3029 |
2989 |
'Gb' => 'Gb',
|
3030 |
2990 |
'b' => 'b')
|
3031 |
2991 |
));
|
3032 |
|
|
|
2992 |
|
3033 |
2993 |
$group->setHelp('Choose the amount of bandwidth for this queue');
|
3034 |
2994 |
|
3035 |
2995 |
$section->add($group);
|
3036 |
|
|
|
2996 |
|
3037 |
2997 |
|
3038 |
2998 |
$form .= "<tr><td class=\"vncellreq\">" . gettext("Scheduler specific options") . "</td>";
|
3039 |
2999 |
$form .= "<td class=\"vtable\"><table><tr><td>";
|
... | ... | |
3248 |
3208 |
shaper_do_input_validation($data, $reqdfields, $reqdfieldsn, $input_errors);
|
3249 |
3209 |
|
3250 |
3210 |
if ($data['plr'] && (!is_numeric($data['plr']) ||
|
3251 |
|
($data['plr'] < 0) || ($data['plr'] > 1))) {
|
|
3211 |
($data['plr'] < 0) || ($data['plr'] > 1))) {
|
3252 |
3212 |
$input_errors[] = gettext("Plr must be a value between 0 and 1.");
|
3253 |
3213 |
}
|
3254 |
3214 |
if ($data['buckets'] && (!is_numeric($data['buckets']) ||
|
3255 |
|
($data['buckets'] < 16) || ($data['buckets'] > 65535))) {
|
|
3215 |
($data['buckets'] < 16) || ($data['buckets'] > 65535))) {
|
3256 |
3216 |
$input_errors[] = gettext("Buckets must be an integer between 16 and 65535.");
|
3257 |
3217 |
}
|
3258 |
3218 |
if ($data['qlimit'] && (!is_numeric($data['qlimit']))) {
|
... | ... | |
3791 |
3751 |
$form .= "</select>";
|
3792 |
3752 |
$form .= " <br />";
|
3793 |
3753 |
$form .= "<span class=\"vexpl\">" . gettext("If 'source' or 'destination' slots is chosen, \n"
|
3794 |
|
. "a dynamic pipe with the bandwidth, delay, packet loss and queue size given above will \n"
|
3795 |
|
. "be created for each source/destination IP address encountered, \n"
|
3796 |
|
. "respectively. This makes it possible to easily specify bandwidth \n"
|
3797 |
|
. "limits per host.") . "</span><br />";
|
|
3754 |
. "a dynamic pipe with the bandwidth, delay, packet loss and queue size given above will \n"
|
|
3755 |
. "be created for each source/destination IP address encountered, \n"
|
|
3756 |
. "respectively. This makes it possible to easily specify bandwidth \n"
|
|
3757 |
. "limits per host.") . "</span><br />";
|
3798 |
3758 |
$form .= "255.255.255.255/ <input type=\"text\" class=\"formfld unknown\" size=\"2\" id=\"maskbits\" name=\"maskbits\" value=\"";
|
3799 |
3759 |
if ($mask['type'] <> "none") {
|
3800 |
3760 |
$form .= $mask['bits'];
|
... | ... | |
3816 |
3776 |
$form .= " />";
|
3817 |
3777 |
$form .= " IPV6 mask bits (1-128)<br />";
|
3818 |
3778 |
$form .= "<span class=\"vexpl\">" . gettext("If 'source' or 'destination' slots is chosen, \n"
|
3819 |
|
. "leaving the mask bits blank will create one pipe per host. Otherwise specify \n"
|
3820 |
|
. "the number of 'one' bits in the subnet mask used to group multiple hosts \n"
|
3821 |
|
. "per pipe.") . "</span>";
|
|
3779 |
. "leaving the mask bits blank will create one pipe per host. Otherwise specify \n"
|
|
3780 |
. "the number of 'one' bits in the subnet mask used to group multiple hosts \n"
|
|
3781 |
. "per pipe.") . "</span>";
|
3822 |
3782 |
$form .= "</td></tr>";
|
3823 |
3783 |
$form .= "<tr><td valign=\"middle\" class=\"vncellreq\">" . gettext("Description") . "</td>";
|
3824 |
3784 |
$form .= "<td class=\"vncellreq\">";
|
... | ... | |
3841 |
3801 |
$form .= "<input name=\"delay\" type=\"text\" id=\"delay\" size=\"5\" value=\"";
|
3842 |
3802 |
$form .= $this->GetDelay() . "\" />";
|
3843 |
3803 |
$form .= " ms<br /> <span class=\"vexpl\">" . gettext("Hint: in most cases, you "
|
3844 |
|
. "should specify 0 here (or leave the field empty)") . "</span><br />";
|
|
3804 |
. "should specify 0 here (or leave the field empty)") . "</span><br />";
|
3845 |
3805 |
$form .= "</td></tr>";
|
3846 |
3806 |
$form .= "<tr style=\"display:none\" id=\"sprtable1\">";
|
3847 |
3807 |
$form .= "<td valign=\"middle\" class=\"vncellreq\">" . gettext("Packet loss rate") . "</td>";
|
... | ... | |
3849 |
3809 |
$form .= "<input name=\"plr\" type=\"text\" id=\"plr\" size=\"5\" value=\"";
|
3850 |
3810 |
$form .= $this->GetPlr() . "\" />";
|
3851 |
3811 |
$form .= " <br /> <span class=\"vexpl\">" . gettext("Hint: in most cases, you "
|
3852 |
|
. "should specify 0 here (or leave the field empty). "
|
3853 |
|
. "A value of 0.001 means one packet in 1000 gets dropped") . "</span>";
|
|
3812 |
. "should specify 0 here (or leave the field empty). "
|
|
3813 |
. "A value of 0.001 means one packet in 1000 gets dropped") . "</span>";
|
3854 |
3814 |
$form .= "</td></tr>";
|
3855 |
3815 |
$form .= "<tr style=\"display:none\" id=\"sprtable2\">";
|
3856 |
3816 |
$form .= "<td valign=\"middle\" class=\"vncellreq\">" . gettext("Queue Size") . "</td>";
|
... | ... | |
3859 |
3819 |
$form .= $this->GetQlimit() . "\" />";
|
3860 |
3820 |
$form .= " slots<br />";
|
3861 |
3821 |
$form .= "<span class=\"vexpl\">" . gettext("Hint: in most cases, you "
|
3862 |
|
. "should leave the field empty. All packets in this pipe are placed into a fixed-size queue first, "
|
3863 |
|
. "then they are delayed by value specified in the Delay field, and then they "
|
3864 |
|
. "are delivered to their destination.") . "</span>";
|
|
3822 |
. "should leave the field empty. All packets in this pipe are placed into a fixed-size queue first, "
|
|
3823 |
. "then they are delayed by value specified in the Delay field, and then they "
|
|
3824 |
. "are delivered to their destination.") . "</span>";
|
3865 |
3825 |
$form .= "</td></tr>";
|
3866 |
3826 |
$form .= "<tr style=\"display:none\" id=\"sprtable5\">";
|
3867 |
3827 |
$form .= "<td valign=\"middle\" class=\"vncellreq\">" . gettext("Bucket Size") . "</td>";
|
... | ... | |
3940 |
3900 |
parent::validate_input($data, $input_errors);
|
3941 |
3901 |
|
3942 |
3902 |
if ($data['weight'] && ((!is_numeric($data['weight'])) ||
|
3943 |
|
($data['weight'] < 1 && $data['weight'] > 100))) {
|
|
3903 |
($data['weight'] < 1 && $data['weight'] > 100))) {
|
3944 |
3904 |
$input_errors[] = gettext("Weight must be an integer between 1 and 100.");
|
3945 |
3905 |
}
|
3946 |
3906 |
}
|
... | ... | |
4055 |
4015 |
return parent::build_javascript();
|
4056 |
4016 |
}
|
4057 |
4017 |
|
4058 |
|
|
4059 |
4018 |
function build_formX() {
|
4060 |
4019 |
$form = "<tr><td valign=\"middle\" class=\"vncellreq\"><br />";
|
4061 |
4020 |
$form .= gettext("Enable/Disable");
|
... | ... | |
4831 |
4790 |
$dummynet_pipe_list = array();
|
4832 |
4791 |
|
4833 |
4792 |
if (!is_array($config['dnshaper']['queue']) ||
|
4834 |
|
!count($config['dnshaper']['queue'])) {
|
|
4793 |
!count($config['dnshaper']['queue'])) {
|
4835 |
4794 |
return;
|
4836 |
4795 |
}
|
4837 |
4796 |
|
... | ... | |
4867 |
4826 |
foreach ($shaperIFlist as $shif => $shDescr) {
|
4868 |
4827 |
if ($altq_list_queues[$shif]) {
|
4869 |
4828 |
continue;
|
4870 |
|
} else {
|
|
4829 |
} else {
|
4871 |
4830 |
if (!is_altq_capable(get_real_interface($shif))) {
|
4872 |
4831 |
continue;
|
4873 |
4832 |
}
|
... | ... | |
5002 |
4961 |
|
5003 |
4962 |
}
|
5004 |
4963 |
|
|
4964 |
$default_shaper_msg = sprintf(gettext("Welcome to the %s Traffic Shaper."), $g['product_name']) . "</b><br />";
|
|
4965 |
$default_shaper_msg .= gettext("The tree on the left helps you navigate through the queues.<br />"
|
|
4966 |
. "Buttons at the bottom represent queue actions and are activated accordingly.");
|
5005 |
4967 |
|
5006 |
|
$default_shaper_msg = "<tr><td align=\"center\" width=\"80%\">";
|
5007 |
|
$default_shaper_msg .= "<span class=\"vexpl\"><strong><b>" . sprintf(gettext("Welcome to the %s Traffic Shaper."), $g['product_name']) . "</b><br />";
|
5008 |
|
$default_shaper_msg .= gettext("The tree on the left helps you navigate through the queues <br />"
|
5009 |
|
. "buttons at the bottom represent queue actions and are activated accordingly.");
|
5010 |
|
$default_shaper_msg .= "</strong></span>";
|
5011 |
|
$default_shaper_msg .= "</td></tr>";
|
5012 |
|
|
5013 |
|
$dn_default_shaper_msg = "<tr><td align=\"center\" width=\"80%\">";
|
5014 |
|
$dn_default_shaper_msg .= "<span class=\"vexpl\"><strong><b>" . sprintf(gettext("Welcome to the %s Traffic Shaper."), $g['product_name']) . "</b><br />";
|
5015 |
|
$dn_default_shaper_msg .= gettext("The tree on the left helps you navigate through the queues <br />"
|
5016 |
|
. "buttons at the bottom represent queue actions and are activated accordingly.");
|
5017 |
|
$dn_default_shaper_msg .= "</strong></span>";
|
5018 |
|
$dn_default_shaper_msg .= "</td></tr>";
|
|
4968 |
$dn_default_shaper_msg = $default_shaper_msg;
|
5019 |
4969 |
|
5020 |
4970 |
?>
|
Final changes on firewall_shaper ??