summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStephen Beaver <sbeaver@netgate.com>2016-01-07 10:04:21 -0500
committerStephen Beaver <sbeaver@netgate.com>2016-01-07 10:04:21 -0500
commit37d4f3639a9fab1ccfcb53130aff66e2140a72d1 (patch)
tree8e2fea60ffa46e244e6cc26d3945da344959c45f
parenteccb4c9ea5f2f7e350bd3878b4e86edecbe9f25c (diff)
parentbfc94df0bf33e520287e61b740c9c0af0481b8f3 (diff)
downloadpfsense-37d4f3639a9fab1ccfcb53130aff66e2140a72d1.zip
pfsense-37d4f3639a9fab1ccfcb53130aff66e2140a72d1.tar.gz
Merge pull request #2372 from phil-davis/patch-2
-rw-r--r--src/etc/inc/shaper.inc82
1 files changed, 63 insertions, 19 deletions
diff --git a/src/etc/inc/shaper.inc b/src/etc/inc/shaper.inc
index 25afd86..3d48490 100644
--- a/src/etc/inc/shaper.inc
+++ b/src/etc/inc/shaper.inc
@@ -292,7 +292,7 @@ class altq_root_queue {
var $interface;
var $tbrconfig ;
var $bandwidth;
- var $bandwidthtype; /* b, Kb, Mb */
+ var $bandwidthtype; /* b, Kb, Mb, Gb, % */
var $scheduler;
var $qlimit;
var $queues = array();
@@ -383,6 +383,28 @@ class altq_root_queue {
$this->qlimit = $limit;
}
+ function GetBwscaleText() {
+ switch ($this->bandwidthtype) {
+ case "b":
+ $bwscaletext = "Bit/s";
+ break;
+ case "Kb":
+ $bwscaletext = "Kbit/s";
+ break;
+ case "Mb":
+ $bwscaletext = "Mbit/s";
+ break;
+ case "Gb":
+ $bwscaletext = "Gbit/s";
+ break;
+ default:
+ /* For others that do not need translating like % */
+ $bwscaletext = $this->bandwidthtype;
+ break;
+ }
+ return $bwscaletext;
+ }
+
function validate_input($data, &$input_errors) {
$reqdfields[] = "bandwidth";
@@ -719,7 +741,7 @@ class altq_root_queue {
$form .= 'Bandwidth';
$form .= ' </dt>';
$form .= ' <dd>';
- $form .= $this->GetBandwidth() . '&nbsp;' . $this->GetBwscale();
+ $form .= $this->GetBandwidth() . '&nbsp;' . $this->GetBwscaleText();
$form .= ' </dd>';
$form .= ' <dt>';
@@ -792,10 +814,10 @@ class altq_root_queue {
'bandwidthtype',
null,
$this->GetBwscale(),
- array('Kb' => 'Kb',
- 'Mb' => 'Mb',
- 'Gb' => 'Gb',
- 'b' => 'b',
+ array('Kb' => 'Kbit/s',
+ 'Mb' => 'Mbit/s',
+ 'Gb' => 'Gbit/s',
+ 'b' => 'Bit/s',
'%' => '%')
));
@@ -1022,6 +1044,28 @@ class priq_queue {
$this->qack = $ack;
}
+ function GetBwscaleText() {
+ switch ($this->qbandwidthtype) {
+ case "b":
+ $bwscaletext = "Bit/s";
+ break;
+ case "Kb":
+ $bwscaletext = "Kbit/s";
+ break;
+ case "Mb":
+ $bwscaletext = "Mbit/s";
+ break;
+ case "Gb":
+ $bwscaletext = "Gbit/s";
+ break;
+ default:
+ /* For others that do not need translating like % */
+ $bwscaletext = $this->qbandwidthtype;
+ break;
+ }
+ return $bwscaletext;
+ }
+
function build_javascript() {
$javascript = "<script type=\"text/javascript\">";
$javascript .= "//<![CDATA[\n";
@@ -1449,7 +1493,7 @@ class priq_queue {
$form .= 'Bandwidth';
$form .= ' </dt>';
$form .= ' <dd>';
- $form .= $this->GetBandwidth() . '&nbsp;' . $this->GetBwscale();
+ $form .= $this->GetBandwidth() . '&nbsp;' . $this->GetBwscaleText();
$form .= ' </dd>';
$tmpvalue = $this->GetQpriority();
@@ -2220,10 +2264,10 @@ EOJS;
'bandwidthtype',
null,
$this->GetBwscale(),
- array('Kb' => 'Kb',
- 'Mb' => 'Mb',
- 'Gb' => 'Gb',
- 'b' => 'b',
+ array('Kb' => 'Kbit/s',
+ 'Mb' => 'Mbit/s',
+ 'Gb' => 'Gbit/s',
+ 'b' => 'Bit/s',
'%' => '%')
));
@@ -2778,10 +2822,10 @@ class cbq_queue extends priq_queue {
'bandwidthtype',
null,
$this->GetBwscale(),
- array('Kb' => 'Kb',
- 'Mb' => 'Mb',
- 'Gb' => 'Gb',
- 'b' => 'b',
+ array('Kb' => 'Kbit/s',
+ 'Mb' => 'Mbit/s',
+ 'Gb' => 'Gbit/s',
+ 'b' => 'Bit/s',
'%' => '%')
));
@@ -3079,10 +3123,10 @@ class fairq_queue extends priq_queue {
'bandwidthtype',
null,
$this->GetBwscale(),
- array('Kb' => 'Kb',
- 'Mb' => 'Mb',
- 'Gb' => 'Gb',
- 'b' => 'b',
+ array('Kb' => 'Kbit/s',
+ 'Mb' => 'Mbit/s',
+ 'Gb' => 'Gbit/s',
+ 'b' => 'Bit/s',
'%' => '%')
));
OpenPOWER on IntegriCloud