summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--cf/conf/config.xml4
-rw-r--r--conf.default/config.xml4
-rw-r--r--etc/inc/filter.inc440
-rwxr-xr-xusr/local/www/firewall_shaper.php39
-rwxr-xr-xusr/local/www/firewall_shaper_edit.php29
-rwxr-xr-xusr/local/www/firewall_shaper_queues.php49
-rwxr-xr-xusr/local/www/firewall_shaper_queues_edit.php251
-rwxr-xr-xusr/local/www/system_advanced.php8
8 files changed, 534 insertions, 290 deletions
diff --git a/cf/conf/config.xml b/cf/conf/config.xml
index 0639a4c..3cff4e1 100644
--- a/cf/conf/config.xml
+++ b/cf/conf/config.xml
@@ -38,6 +38,8 @@
<subnet>24</subnet>
<media></media>
<mediaopt></mediaopt>
+ <bandwidth>100</bandwidth>
+ <bandwidthtype>Mb</bandwidthtype>
<!--
<wireless>
*see below (opt[n])*
@@ -55,6 +57,8 @@
<dhcphostname></dhcphostname>
<media></media>
<mediaopt></mediaopt>
+ <bandwidth>100</bandwidth>
+ <bandwidthtype>Mb</bandwidthtype>
<!--
<wireless>
*see below (opt[n])*
diff --git a/conf.default/config.xml b/conf.default/config.xml
index 0639a4c..3cff4e1 100644
--- a/conf.default/config.xml
+++ b/conf.default/config.xml
@@ -38,6 +38,8 @@
<subnet>24</subnet>
<media></media>
<mediaopt></mediaopt>
+ <bandwidth>100</bandwidth>
+ <bandwidthtype>Mb</bandwidthtype>
<!--
<wireless>
*see below (opt[n])*
@@ -55,6 +57,8 @@
<dhcphostname></dhcphostname>
<media></media>
<mediaopt></mediaopt>
+ <bandwidth>100</bandwidth>
+ <bandwidthtype>Mb</bandwidthtype>
<!--
<wireless>
*see below (opt[n])*
diff --git a/etc/inc/filter.inc b/etc/inc/filter.inc
index b574fcb..c768119 100644
--- a/etc/inc/filter.inc
+++ b/etc/inc/filter.inc
@@ -81,6 +81,8 @@ function filter_configure() {
$altq_ints = filter_setup_altq_interfaces();
/* generate altq queues */
$altq_queues = filter_generate_altq_queues();
+ /* generate altq rules */
+ $altq_rules = filter_generate_altq_rules();
if( !isset( $config['system']['disablefilter'] ) ) {
mwexec("/sbin/pfctl -e");
@@ -98,6 +100,7 @@ function filter_configure() {
fwrite($fd, $altq_ints);
fwrite($fd, $altq_queues);
fwrite($fd, $natrules);
+ fwrite($fd, $altq_rules);
fwrite($fd, $pfrules);
fclose($fd);
@@ -126,67 +129,67 @@ function filter_get_altq_queue_scheduler_type($associatedrule) {
global $config;
$schedulertype = "";
/* XXX: assign all the OPT interfaces */
- foreach ($config['filter']['rule'] as $rule) {
+ foreach ($config['shaper']['rule'] as $rule) {
if($rule['descr'] == $associatedrule) {
- if($rule['interface'] == "wan") $schedulertpye = $config['interfaces']['wan']['schedulertype'];
- if($rule['interface'] == "lan") $schedulertpye = $config['interfaces']['lan']['schedulertype'];
+ if($rule['interface'] == "wan") $schedulertpye = $config['system']['schedulertype'];
+ if($rule['interface'] == "lan") $schedulertpye = $config['system']['schedulertype'];
+ $schedulertpye = $config['system']['schedulertype'];
}
}
return $schedulertpye;
}
-function filter_get_rule_real_interface($associatedrule) {
- global $config;
- foreach ($config['filter']['rule'] as $rule) {
- if($rule['descr'] == $associatedrule) {
- $interface = $rule['interface'];
- return $config['interfaces'][$interface]['if'];
- }
- }
- return "";
+function filter_get_rule_real_interface($associatedrulenumber) {
+ global $config;
+ $x=0;
+ foreach($config['shaper']['rule'] as $rule) {
+ if($x == $associatedrulenumber)
+ return $rule['interface'];
+ $x++;
+ }
}
-function filter_get_rule_interface($associatedrule) {
+function filter_get_rule_interface($associatedrulenumber) {
global $config;
- foreach ($config['filter']['rule'] as $rule) {
+ foreach ($config['shaper']['rule'] as $rule) {
if($rule['descr'] == $associatedrule) return $rule['interface'];
}
- return "";
+ return $config['shaper']['rule'][$associatedrulenumber]['interface'];
}
function filter_generate_altq_queues() {
global $config;
$altq_rules = "";
- if (is_array($config['pfqueueing']['queue'])) {
- foreach ($config['pfqueueing']['queue'] as $rule) {
+ if (is_array($config['shaper']['queue'])) {
+ foreach ($config['shaper']['queue'] as $rule) {
$options = "";
$altq_rules .= "queue " . $rule['name'] . " ";
if (isset($rule['bandwidth']) and $rule['bandwidth'] <> "")
$altq_rules .= "bandwidth " . $rule['bandwidth'] . $rule['bandwidthtype'] . " ";
if (isset($rule['priority']) and $rule['priority'] <> "")
$altq_rules .= "priority " . $rule['priority'] . " ";
- if(isset($rule['options']['red']) and $rule['options']['red'] <> "")
+ if(isset($rule['red']) and $rule['red'] <> "")
$options .= " red";
- if(isset($rule['options']['borrow']) and $rule['options']['borrow'] <> "")
+ if(isset($rule['borrow']) and $rule['borrow'] <> "")
$options .= " borrow";
- if(isset($rule['options']['ecn']) and $rule['options']['ecn'] <> "")
+ if(isset($rule['ecn']) and $rule['ecn'] <> "")
$options .= " ecn";
- if(isset($rule['options']['rio']) and $rule['options']['rio'] <> "")
+ if(isset($rule['rio']) and $rule['rio'] <> "")
$options .= " rio";
- if(isset($rule['options']['defaultqueue']) and $rule['options']['defaultqueue'] <> "")
+ if(isset($rule['defaultqueue']) and $rule['defaultqueue'] <> "")
$options .= " default";
- if(isset($rule['options']['upperlimit']) and $rule['options']['upperlimit'] <> "") {
- $options .= " upperlimit(" . $rule['options']['upperlimit1'] . " " . $rule['options']['upperlimit2'] . " " . $rule['options']['upperlimit3'] . ")";
+ if(isset($rule['upperlimit']) and $rule['upperlimit'] <> "") {
+ $options .= " upperlimit(" . $rule['upperlimit1'] . " " . $rule['upperlimit2'] . " " . $rule['upperlimit3'] . ")";
}
- if(isset($rule['options']['linkshare']) and $rule['options']['linkshare'] <> "") {
- $options .= " linkshare(" . $rule['options']['linkshare1'] . " " . $rule['options']['linkshare2'] . " " . $rule['options']['linkshare3'] . ")";
+ if(isset($rule['linkshare']) and $rule['linkshare'] <> "") {
+ $options .= " linkshare(" . $rule['linkshare1'] . " " . $rule['linkshare2'] . " " . $rule['linkshare3'] . ")";
}
- if(isset($rule['options']['realtime']) and $rule['options']['realtime'] <> "") {
- $options .= " realtime(" . $rule['options']['realtime1'] . " " . $rule['options']['realtime2'] . " " . $rule['options']['realtime3'] . ")";
+ if(isset($rule['realtime']) and $rule['realtime'] <> "") {
+ $options .= " realtime(" . $rule['realtime1'] . " " . $rule['realtime2'] . " " . $rule['realtime3'] . ")";
}
if($options) {
- $scheduler_type = filter_get_altq_queue_scheduler_type($rule['options']['associatedrule']);
+ $scheduler_type = $config['system']['schedulertype'];
$altq_rules .= $scheduler_type . "(". $options . " )";
}
if (isset($rule['subqueue'])) {
@@ -205,40 +208,45 @@ function filter_generate_altq_queues() {
return $altq_rules;
}
+function filter_translate_real_interface_to_type($interface) {
+ global $config;
+ $int = "na";
+ if($config['interfaces']['wan']['if'] == $interface) $int = "wan";
+ if($config['interfaces']['lan']['if'] == $interface) $int = "lan";
+ return $int;
+}
+
function filter_setup_altq_interfaces() {
global $config;
$altq_rules = "";
$queue_names = "";
$is_first = "";
- $queue_names = "";
- $is_first = "";
- if (is_array($config['interfaces'])) {
- foreach ($config['interfaces'] as $ifname) {
- if (is_array($config['pfqueueing']['queue'])) {
- foreach ($config['pfqueueing']['queue'] as $queue) {
- $schedulertype = $ifname['schedulertype'];
- if(filter_get_altq_queue_scheduler_type($queue['options']['associatedrule']) == $schedulertype) {
- if (filter_get_rule_real_interface($queue['options']['associatedrule']) == $ifname['if']) {
- if(is_subqueue($queue['name']) == 0) {
- if($is_first) $queue_names .= ", ";
- $queue_names .= $queue['name'];
- $is_first = "1";
- }
- }
+ foreach ($config['interfaces'] as $ifname) {
+ $queue_names = "";
+ $is_first = "";
+ if (is_array($config['shaper']['queue'])) {
+ foreach ($config['shaper']['queue'] as $queue) {
+ $rule_interface = filter_get_rule_real_interface($queue['associatedrule']);
+ $workting_with_interface = filter_translate_real_interface_to_type($ifname['if']);
+ if ($rule_interface == $workting_with_interface) {
+ if(is_subqueue($queue['name']) == 0) {
+ if($is_first) $queue_names .= ", ";
+ $queue_names .= $queue['name'];
+ $is_first = "1";
}
}
}
- if(isset($ifname['bandwidth'])) {
- $subnet = $ifname['ipaddr'] . "/" . $ifname['subnet'];
- if($queue_names <> ""){
- $altq_rules .= "altq on " . $ifname['if'] . " ";
- $altq_rules .= $ifname['schedulertype'] . " bandwidth " . $ifname['bandwidth'] . $ifname['bandwidthtype'] . " ";
- $altq_rules .= "queue { " . $queue_names . " }";
- }
- $altq_rules .= "\n";
- $is_first = "";
- $queue_names = "";
+ }
+ if(isset($ifname['bandwidth'])) {
+ $subnet = $ifname['ipaddr'] . "/" . $ifname['subnet'];
+ if($queue_names <> ""){
+ $altq_rules .= "altq on " . $ifname['if'] . " ";
+ $altq_rules .= $config['system']['schedulertype'] . " bandwidth " . $ifname['bandwidth'] . $ifname['bandwidthtype'] . " ";
+ $altq_rules .= "queue { " . $queue_names . " }";
}
+ $altq_rules .= "\n";
+ $is_first = "";
+ $queue_names = "";
}
}
return $altq_rules;
@@ -247,8 +255,8 @@ function filter_setup_altq_interfaces() {
function is_subqueue($name) {
global $config;
$status = "";
- if (is_array($config['pfqueueing']['queue'])) {
- foreach ($config['pfqueueing']['queue'] as $queue) {
+ if (is_array($config['shaper']['queue'])) {
+ foreach ($config['shaper']['queue'] as $queue) {
if(is_array($queue['subqueue'])) {
foreach ($queue['subqueue'] as $sq) {
if($sq['name'] == $name) return 1;
@@ -259,6 +267,320 @@ function is_subqueue($name) {
return 0;
}
+function filter_generate_altq_rules() {
+ global $config, $g;
+
+ $wancfg = $config['interfaces']['wan'];
+ $lancfg = $config['interfaces']['lan'];
+ $pptpdcfg = $config['pptpd'];
+
+ $lanif = $lancfg['if'];
+ $wanif = get_real_wan_interface();
+
+ /* rule groups (optional interfaces: see below) */
+ $ifgroups = array("lan" => 100, "wan" => 200);
+
+ $lanip = $lancfg['ipaddr'];
+ $lansa = gen_subnet($lancfg['ipaddr'], $lancfg['subnet']);
+ $lansn = $lancfg['subnet'];
+
+ /* optional interfaces */
+ $optcfg = array();
+
+ $i = 0;
+
+ if (isset($config['shaper']['rule']))
+ foreach ($config['shaper']['rule'] as $rule) {
+ echo $rule['descr'] . "\n";
+ /* don't include disabled rules */
+ if (isset($rule['disabled'])) {
+ $i++;
+ continue;
+ }
+
+ /* does the rule deal with a PPTP interface? */
+ if ($rule['interface'] == "pptp") {
+
+ if ($pptpdcfg['mode'] != "server") {
+ $i++;
+ continue;
+ }
+
+ $nif = $g['n_pptp_units'];
+ $ispptp = true;
+ } else {
+
+ if (strstr($rule['interface'], "opt")) {
+ if (!array_key_exists($rule['interface'], $optcfg)) {
+ $i++;
+ continue;
+ }
+ }
+
+ $nif = 1;
+ $ispptp = false;
+ }
+
+ if ($pptpdcfg['mode'] != "server") {
+ if (($rule['source']['network'] == "pptp") ||
+ ($rule['destination']['network'] == "pptp")) {
+ $i++;
+ continue;
+ }
+ }
+
+ if ($rule['source']['network'] && strstr($rule['source']['network'], "opt")) {
+ if (!array_key_exists($rule['source']['network'], $optcfg)) {
+ $i++;
+ continue;
+ }
+ }
+ if ($rule['destination']['network'] && strstr($rule['destination']['network'], "opt")) {
+ if (!array_key_exists($rule['destination']['network'], $optcfg)) {
+ $i++;
+ continue;
+ }
+ }
+
+ /* check for unresolvable aliases */
+ if ($rule['source']['address'] && !alias_expand($rule['source']['address'])) {
+ $i++;
+ continue;
+ }
+ if ($rule['destination']['address'] && !alias_expand($rule['destination']['address'])) {
+ $i++;
+ continue;
+ }
+
+ for ($iif = 0; $iif < $nif; $iif++) {
+
+ if (!$ispptp) {
+
+ $groupnum = $ifgroups[$rule['interface']];
+
+ if (!$groupnum) {
+ printf("Invalid interface name in rule $i\n");
+ break;
+ }
+ }
+
+ $type = $rule['type'];
+ if ($type != "pass" && $type != "block" && $type != "reject") {
+ /* default (for older rules) is pass */
+ $type = "pass";
+ }
+
+ if ($type == "reject") {
+ /* special reject packet */
+ if ($rule['protocol'] == "tcp") {
+ $line = "block return-rst";
+ } else if ($rule['protocol'] == "udp") {
+ $line = "block return-icmp";
+ } else {
+ $line = "block";
+ }
+ } else {
+ $line = $type;
+ }
+
+ if(!isset($rule['direction']) and $rule['direction'] <> "") {
+ $line .= " in ";
+ } else {
+ $line .= " " . $rule['direction'] . " ";
+ }
+
+ if (isset($rule['log']))
+ $line .= "log ";
+
+ $line .= "quick ";
+
+ if ($ispptp) {
+ $line .= "on ng" . ($iif+1) . " ";
+ }
+
+ if (isset($rule['protocol'])) {
+ $line .= "proto {$rule['protocol']} ";
+ }
+
+ /* source address */
+ if (isset($rule['source']['any'])) {
+ $src = "any";
+ } else if ($rule['source']['network']) {
+
+ if (strstr($rule['source']['network'], "opt")) {
+ $src = $optcfg[$rule['source']['network']]['sa'] . "/" .
+ $optcfg[$rule['source']['network']]['sn'];
+ } else {
+ switch ($rule['source']['network']) {
+ case 'lan':
+ $src = "$lansa/$lansn";
+ break;
+ case 'pptp':
+ $src = "$pptpsa/$pptpsn";
+ break;
+ }
+ }
+ } else if ($rule['source']['address']) {
+ $src = alias_expand($rule['source']['address']);
+ }
+
+ if (!$src || ($src == "/")) {
+ //printf("No source address found in rule $i\n");
+ break;
+ }
+
+ if (isset($rule['source']['not'])) {
+ $line .= "from !$src ";
+ } else {
+ $line .= "from $src ";
+ }
+
+ if (in_array($rule['protocol'], array("tcp","udp","tcp/udp"))) {
+
+ if ($rule['source']['port']) {
+ $srcport = explode("-", $rule['source']['port']);
+
+ if ((!$srcport[1]) || ($srcport[0] == $srcport[1])) {
+ $line .= "port = {$srcport[0]} ";
+ } else if (($srcport[0] == 1) && ($srcport[1] == 65535)) {
+ /* no need for a port statement here */
+ } else if ($srcport[1] == 65535) {
+ $line .= "port >= {$srcport[0]} ";
+ } else if ($srcport[0] == 1) {
+ $line .= "port <= {$srcport[1]} ";
+ } else {
+ $srcport[0]--;
+ $srcport[1]++;
+ $line .= "port {$srcport[0]} >< {$srcport[1]} ";
+ }
+ }
+ }
+
+ /* destination address */
+ if (isset($rule['destination']['any'])) {
+ $dst = "any";
+ } else if ($rule['destination']['network']) {
+
+ if (strstr($rule['destination']['network'], "opt")) {
+ $dst = $optcfg[$rule['destination']['network']]['sa'] . "/" .
+ $optcfg[$rule['destination']['network']]['sn'];
+ } else {
+ switch ($rule['destination']['network']) {
+ case 'lan':
+ $dst = "$lansa/$lansn";
+ break;
+ case 'pptp':
+ $dst = "$pptpsa/$pptpsn";
+ break;
+ }
+ }
+ } else if ($rule['destination']['address']) {
+ $dst = alias_expand($rule['destination']['address']);
+ }
+
+ if (!$dst || ($dst == "/")) {
+ //printf("No destination address found in rule $i\n");
+ break;
+ }
+
+ if (isset($rule['destination']['not'])) {
+ $line .= "to !$dst ";
+ } else {
+ $line .= "to $dst ";
+ }
+
+ if (in_array($rule['protocol'], array("tcp","udp","tcp/udp"))) {
+
+ if ($rule['destination']['port']) {
+ $dstport = explode("-", $rule['destination']['port']);
+
+ if ((!$dstport[1]) || ($dstport[0] == $dstport[1])) {
+ $line .= "port = {$dstport[0]} ";
+ } else if (($dstport[0] == 1) && ($dstport[1] == 65535)) {
+ /* no need for a port statement here */
+ } else if ($dstport[1] == 65535) {
+ $line .= "port >= {$dstport[0]} ";
+ } else if ($dstport[0] == 1) {
+ $line .= "port <= {$dstport[1]} ";
+ } else {
+ $dstport[0]--;
+ $dstport[1]++;
+ $line .= "port {$dstport[0]} >< {$dstport[1]} ";
+ }
+ }
+ }
+
+ if (($rule['protocol'] == "icmp") && $rule['icmptype']) {
+ $line .= "icmp-type {$rule['icmptype']} ";
+ }
+
+ if ($type == "pass") {
+
+ if( isset($rule['source-track']) or isset($rule['max-src-nodes']) or isset($rule['max-src-states']) )
+ $line .= "flags S/SA ";
+
+ /*
+ # keep state
+ works with TCP, UDP, and ICMP.
+ # modulate state
+ works only with TCP. pfSense will generate strong Initial Sequence Numbers (ISNs)
+ for packets matching this rule.
+ # synproxy state
+ proxies incoming TCP connections to help protect servers from spoofed TCP SYN floods.
+ This option includes the functionality of keep state and modulate state combined.
+ # none
+ do not use state mechanisms to keep track. this is only useful if your doing advanced
+ queueing in certain situations. please check the faq.
+ */
+ if( !isset($rule['statetype'] ) ) {
+ $line .= "keep state ";
+ } else {
+ if($rule['statetype'] == "modulate state" or $rule['statetype'] == "synproxy state") {
+ if($rule['protocol'] == "tcp")
+ $line .= $rule['statetype'] ;
+ } else {
+ if(!$rule['statetype'] == "none")
+ $line .= $rule['statetype'] ;
+ }
+ }
+
+ }
+
+ if ($type == "reject" && $rule['protocol'] == "tcp") {
+ /* special reject packet */
+ $line .= "flags S/SA ";
+ }
+
+ if (isset($rule['flags'])) {
+ $line .= "flags " . $rule['flags'] . " ";
+ }
+
+ if (!$ispptp) {
+ #$line .= "group $groupnum ";
+ }
+
+ $line .= "queue " . filter_altq_get_queuename($que['associatedrule']);
+
+ $line .= "\n";
+
+ $ipfrules .= $line;
+ }
+
+ $i++;
+ }
+
+ return $ipfrules;
+}
+
+function filter_altq_get_queuename($queuenum) {
+ global $config;
+ $x=0;
+ foreach($config['shaper']['queue'] as $rule) {
+ if($x == $associatedrulenumber)
+ return $rule['name'];
+ $x++;
+ }
+}
function filter_flush_nat_table() {
global $config, $g;
@@ -1033,9 +1355,9 @@ EOD;
#$line .= "group $groupnum ";
}
- if(isset($config['pfqueueing']['queue'])) {
- foreach ($config['pfqueueing']['queue'] as $que) {
- if($que['options']['associatedrule'] == $rule['descr']) {
+ if(isset($config['shaper']['queue'])) {
+ foreach ($config['shaper']['queue'] as $que) {
+ if($que['associatedrule'] == $rule['descr']) {
$line .= "queue " . $que['name'];
break;
}
diff --git a/usr/local/www/firewall_shaper.php b/usr/local/www/firewall_shaper.php
index 60e8963..5bb61e4 100755
--- a/usr/local/www/firewall_shaper.php
+++ b/usr/local/www/firewall_shaper.php
@@ -33,26 +33,25 @@
require("guiconfig.inc");
-if (!is_array($config['pfqueueing']['rule'])) {
- $config['pfqueueing']['rule'] = array();
+if (!is_array($config['shaper']['rule'])) {
+ $config['shaper']['rule'] = array();
}
-if (!is_array($config['pfqueueing']['pipe'])) {
- $config['pfqueueing']['pipe'] = array();
+if (!is_array($config['shaper']['pipe'])) {
+ $config['shaper']['pipe'] = array();
}
-if (!is_array($config['pfqueueing']['queue'])) {
- $config['pfqueueing']['queue'] = array();
+if (!is_array($config['shaper']['queue'])) {
+ $config['shaper']['queue'] = array();
}
-$a_shaper = &$config['pfqueueing']['rule'];
-$a_pipe = &$config['pfqueueing']['pipe'];
-$a_queue = &$config['pfqueueing']['queue'];
+$a_shaper = &$config['shaper']['rule'];
+$a_queue = &$config['shaper']['queue'];
-$pconfig['enable'] = isset($config['pfqueueing']['enable']);
+$pconfig['enable'] = isset($config['shaper']['enable']);
if ($_POST) {
if ($_POST['submit']) {
$pconfig = $_POST;
- $config['pfqueueing']['enable'] = $_POST['enable'] ? true : false;
+ $config['shaper']['enable'] = $_POST['enable'] ? true : false;
write_config();
}
@@ -199,22 +198,16 @@ if ($_GET['act'] == "del") {
</td>
<td class="listr"><?=$textss;?>
<?php
- if (isset($shaperent['targetpipe'])) {
- if ($a_pipe[$shaperent['targetpipe']]['descr'])
- $desc = htmlspecialchars($a_pipe[$shaperent['targetpipe']]['descr']);
+ if (isset($shaperent['targetqueue'])) {
+ if ($a_queue[$shaperent['targetqueue']]['name'])
+ $desc = htmlspecialchars($a_queue[$shaperent['targetqueue']]['name']);
else
- $desc = "Pipe " . ($shaperent['targetpipe']+1);
- echo "<a href=\"firewall_shaper_pipes_edit.php?id={$shaperent['targetpipe']}\">{$desc}</a>";
- } else if (isset($shaperent['targetqueue'])) {
- if ($a_queue[$shaperent['targetqueue']]['descr'])
- $desc = htmlspecialchars($a_queue[$shaperent['targetqueue']]['descr']);
- else
- $desc = "Queue " . ($shaperent['targetqueue']+1);
- echo "<a href=\"firewall_shaper_queues_edit.php?id={$shaperent['targetqueue']}\">{$desc}</a>";
+ $desc = "Queue " . ($shaperent['targetpipe']+1);
+ echo "<a href=\"firewall_shaper_pipes_edit.php?id={$shaperent['targetqueue']}\">{$desc}</a>";
}
?><?=$textse;?>
</td>
- <td class="listbg">
+ <td class="listbg"><font color="white">
<?=$textss;?><?=htmlspecialchars($shaperent['descr']);?><?=$textse;?>
&nbsp; </td>
<td valign="middle" nowrap class="list"> <a href="firewall_shaper_edit.php?id=<?=$i;?>"><img src="e.gif" title="edit rule" width="17" height="17" border="0"></a>
diff --git a/usr/local/www/firewall_shaper_edit.php b/usr/local/www/firewall_shaper_edit.php
index 0ff2781..3268048 100755
--- a/usr/local/www/firewall_shaper_edit.php
+++ b/usr/local/www/firewall_shaper_edit.php
@@ -129,11 +129,7 @@ if (isset($id) && $a_shaper[$id]) {
$pconfig['dstmask'], $pconfig['dstnot'],
$pconfig['dstbeginport'], $pconfig['dstendport']);
- if (isset($a_shaper[$id]['targetpipe'])) {
- $pconfig['target'] = "targetpipe:" . $a_shaper[$id]['targetpipe'];
- } else if (isset($a_shaper[$id]['targetqueue'])) {
- $pconfig['target'] = "targetqueue:" . $a_shaper[$id]['targetqueue'];
- }
+ $pconfig['target'] = $a_shaper[$id]['targetqueue'];
$pconfig['direction'] = $a_shaper[$id]['direction'];
$pconfig['iptos'] = $a_shaper[$id]['iptos'];
@@ -459,6 +455,7 @@ function dst_rep_change() {
<?php include("fbegin.inc"); ?>
<p class="pgtitle">Firewall: Traffic shaper: Edit rule</p>
<?php if ($input_errors) print_input_errors($input_errors); ?>
+<?php if (is_array($config['shaper']['queue']) > 0): ?>
<form action="firewall_shaper_edit.php" method="post" name="iform" id="iform">
<table width="100%" border="0" cellpadding="6" cellspacing="0">
@@ -466,21 +463,12 @@ function dst_rep_change() {
<td valign="top" class="vncellreq">Target</td>
<td class="vtable"> <select name="target" class="formfld">
<?php
- foreach ($config['shaper']['pipe'] as $pipei => $pipe): ?>
- <option value="<?="targetpipe:$pipei";?>" <?php if ("targetpipe:$pipei" == $pconfig['target']) echo "selected"; ?>>
- <?php
- echo htmlspecialchars("Pipe " . ($pipei + 1));
- if ($pipe['descr'])
- echo htmlspecialchars(" (" . $pipe['descr'] . ")");
- ?>
- </option>
- <?php endforeach;
foreach ($config['shaper']['queue'] as $queuei => $queue): ?>
- <option value="<?="targetqueue:$queuei";?>" <?php if ("targetqueue:$queuei" == $pconfig['target']) echo "selected"; ?>>
+ <option value="<?="$queuei";?>" <?php if ("$queuei" == $pconfig['target']) echo "selected"; ?>>
<?php
echo htmlspecialchars("Queue " . ($queuei + 1));
- if ($queue['descr'])
- echo htmlspecialchars(" (" . $queue['descr'] . ")");
+ if ($queue['name'])
+ echo htmlspecialchars(" (" . $queue['name'] . ")");
?>
</option>
<?php endforeach; ?>
@@ -694,8 +682,8 @@ function dst_rep_change() {
on the interface specified above (as seen from the firewall's
perspective). </td>
</tr>
-
-
+
+
<tr>
<td width="22%" valign="top" class="vncell">IP packet length</td>
<td width="78%" class="vtable"><input name="iplen" type="text" id="iplen" size="10" value="<?=htmlspecialchars($pconfig['iplen']);?>">
@@ -750,6 +738,9 @@ typesel_change();
proto_change();
//-->
</script>
+<?php else: ?>
+<p><strong>You need to create a queue before you can add a new rule.</strong></p>
+<?php endif; ?>
<?php include("fend.inc"); ?>
</body>
</html>
diff --git a/usr/local/www/firewall_shaper_queues.php b/usr/local/www/firewall_shaper_queues.php
index f7b7c19..94169d5 100755
--- a/usr/local/www/firewall_shaper_queues.php
+++ b/usr/local/www/firewall_shaper_queues.php
@@ -33,14 +33,14 @@
require("guiconfig.inc");
-if (!is_array($config['pfqueueing']['pipe'])) {
- $config['pfqueueing']['pipe'] = array();
+if (!is_array($config['shaper']['pipe'])) {
+ $config['shaper']['pipe'] = array();
}
-if (!is_array($config['pfqueueing']['queue'])) {
- $config['pfqueueing']['queue'] = array();
+if (!is_array($config['shaper']['queue'])) {
+ $config['shaper']['queue'] = array();
}
-$a_queues = &$config['pfqueueing']['queue'];
-$a_pipe = &$config['pfqueueing']['pipe'];
+$a_queues = &$config['shaper']['queue'];
+$a_pipe = &$config['shaper']['pipe'];
$iflist = array("lan" => "LAN", "wan" => "WAN");
@@ -51,8 +51,8 @@ for ($i = 1; isset($config['interfaces']['opt' . $i]); $i++) {
if ($_GET['act'] == "del") {
if ($a_queues[$_GET['id']]) {
/* check that no rule references this queue */
- if (is_array($config['pfqueueing']['rule'])) {
- foreach ($config['pfqueueing']['rule'] as $rule) {
+ if (is_array($config['shaper']['rule'])) {
+ foreach ($config['shaper']['rule'] as $rule) {
if (isset($rule['targetqueue']) && ($rule['targetqueue'] == $_GET['id'])) {
$input_errors[] = "This queue cannot be deleted because it is still referenced by a rule.";
break;
@@ -64,9 +64,9 @@ if ($_GET['act'] == "del") {
unset($a_queues[$_GET['id']]);
/* renumber all rules */
- if (is_array($config['pfqueueing']['rule'])) {
- for ($i = 0; isset($config['pfqueueing']['rule'][$i]); $i++) {
- $currule = &$config['pfqueueing']['rule'][$i];
+ if (is_array($config['shaper']['rule'])) {
+ for ($i = 0; isset($config['shaper']['rule'][$i]); $i++) {
+ $currule = &$config['shaper']['rule'][$i];
if (isset($currule['targetqueue']) && ($currule['targetqueue'] > $_GET['id']))
$currule['targetqueue']--;
}
@@ -112,24 +112,31 @@ if ($_GET['act'] == "del") {
<tr>
<td width="10%" class="listhdrr">No.</td>
<td width="5%" class="listhdrr">Priority</td>
- <td width="20%" class="listhdrr">Assigned Queue</td>
- <td width="30%" class="listhdr">Description</td>
+ <td width="5%" class="listhdr">Default</td>
+ <td width="30%" class="listhdr">Name</td>
<td width="10%" class="list"></td>
</tr>
<?php $i = 0; foreach ($a_queues as $queue): ?>
<tr valign="top">
<td class="listlr">
- <?=($i+1);?></td>
+ <?=($i+1);?>
+ </td>
<td class="listr">
- <?=$queue['priority'];?></td>
- <td class="listr">
- <?php echo $queue['options']['associatedrule']; ?>
-
-
- &nbsp; </td>
+ <?=$queue['priority'];?>
+ </td>
+ <td class="listr">
+ <?php
+ if($queue['default'] <> "") {
+ echo "Yes";
+ } else {
+ echo "No";
+ }
+ ?>
+ </td>
<td class="listbg">
<font color="#FFFFFF"><?=htmlspecialchars($queue['name']);?>
- &nbsp; </td>
+ &nbsp;
+ </td>
<td valign="middle" nowrap class="list"> <a href="firewall_shaper_queues_edit.php?id=<?=$i;?>"><img src="e.gif" width="17" height="17" border="0"></a>
&nbsp;<a href="firewall_shaper_queues.php?act=del&id=<?=$i;?>" onclick="return confirm('Do you really want to delete this queue?')"><img src="x.gif" width="17" height="17" border="0"></a></td>
</tr>
diff --git a/usr/local/www/firewall_shaper_queues_edit.php b/usr/local/www/firewall_shaper_queues_edit.php
index 662505f..d247025 100755
--- a/usr/local/www/firewall_shaper_queues_edit.php
+++ b/usr/local/www/firewall_shaper_queues_edit.php
@@ -5,7 +5,7 @@
Copyright (C) 2004, 2005 Scott Ullrich
All rights reserved.
- originally part of m0n0wall (http://m0n0.ch/wall)
+ Originally part of m0n0wall (http://m0n0.ch/wall)
Copyright (C) 2003-2004 Manuel Kasper <mk@neon1.net>.
All rights reserved.
@@ -33,7 +33,7 @@
require("guiconfig.inc");
-$a_queues = &$config['pfqueueing']['queue'];
+$a_queues = &$config['shaper']['queue'];
$id = $_GET['id'];
if (isset($_POST['id']))
@@ -41,29 +41,30 @@ if (isset($_POST['id']))
$wan_sched = $config['interfaces']['wan']['schedulertype'];
$lan_sched = $config['interfaces']['lan']['schedulertype'];
+$pconfig['schedulertype'] = $config['system']['schedulertype'];
+$schedulertype = $pconfig['schedulertype'];
if (isset($id) && $a_queues[$id]) {
$pconfig['bandwidth'] = $a_queues[$id]['bandwidth'] . $a_queues[$id]['bandwidthtype'];
$pconfig['priority'] = $a_queues[$id]['priority'];
$pconfig['mask'] = $a_queues[$id]['mask'];
$pconfig['name'] = $a_queues[$id]['name'];
- $pconfig['options'] = $a_queues[$id]['options'];
- $pconfig['options']['red'] = $a_queues[$id]['options']['red'];
- $pconfig['options']['ecn'] = $a_queues[$id]['options']['ecn'];
- $pconfig['options']['rio'] = $a_queues[$id]['options']['rio'];
- $pconfig['options']['borrow'] = $a_queues[$id]['options']['borrow'];
- $pconfig['options']['defaultqueue'] = $a_queues[$id]['options']['defaultqueue'];
- $pconfig['options']['parentqueue'] = $a_queues[$id]['options']['parentqueue'];
- $pconfig['options']['upperlimit1'] = $a_queues[$id]['options']['upperlimit1'];
- $pconfig['options']['upperlimit2'] = $a_queues[$id]['options']['upperlimit2'];
- $pconfig['options']['upperlimit3'] = $a_queues[$id]['options']['upperlimit3'];
- $pconfig['options']['realtime1'] = $a_queues[$id]['options']['realtime1'];
- $pconfig['options']['realtime2'] = $a_queues[$id]['options']['realtime2'];
- $pconfig['options']['realtime3'] = $a_queues[$id]['options']['realtime3'];
- $pconfig['options']['linkshare1'] = $a_queues[$id]['options']['linkshare1'];
- $pconfig['options']['linkshare2'] = $a_queues[$id]['options']['linkshare2'];
- $pconfig['options']['linkshare3'] = $a_queues[$id]['options']['linkshare3'];
- $pconfig['schedulertype'] = $a_queues[$id]['schedulertype'];
+ $pconfig = $a_queues[$id];
+ $pconfig['red'] = $a_queues[$id]['red'];
+ $pconfig['ecn'] = $a_queues[$id]['ecn'];
+ $pconfig['rio'] = $a_queues[$id]['rio'];
+ $pconfig['borrow'] = $a_queues[$id]['borrow'];
+ $pconfig['defaultqueue'] = $a_queues[$id]['defaultqueue'];
+ $pconfig['parentqueue'] = $a_queues[$id]['parentqueue'];
+ $pconfig['upperlimit1'] = $a_queues[$id]['upperlimit1'];
+ $pconfig['upperlimit2'] = $a_queues[$id]['upperlimit2'];
+ $pconfig['upperlimit3'] = $a_queues[$id]['upperlimit3'];
+ $pconfig['realtime1'] = $a_queues[$id]['realtime1'];
+ $pconfig['realtime2'] = $a_queues[$id]['realtime2'];
+ $pconfig['realtime3'] = $a_queues[$id]['realtime3'];
+ $pconfig['linkshare1'] = $a_queues[$id]['linkshare1'];
+ $pconfig['linkshare2'] = $a_queues[$id]['linkshare2'];
+ $pconfig['linkshare3'] = $a_queues[$id]['linkshare3'];
$pconfig['bandwidth'] = $a_queues[$id]['bandwidth'];
$pconfig['bandwidthtype'] = $a_queues[$id]['bandwidthtype'];
$pconfig['associatedrule'] = $a_queues[$id]['associatedrule'];
@@ -87,32 +88,32 @@ if ($_POST) {
if (!$input_errors) {
$queue = array();
-
$queue['schedulertype'] = $_POST['schedulertype'];
$queue['bandwidth'] = $_POST['bandwidth'];
$queue['bandwidthtype'] = $_POST['bandwidthtype'];
$queue['priority'] = $_POST['priority'];
$queue['name'] = ereg_replace(" ", "", $_POST['name']);
- $queue['options']['borrow'] = $_POST['borrow'];
- $queue['options']['linkshare'] = $_POST['linkshare'];
- $queue['options']['linkshare3'] = $_POST['linkshare3'];
- $queue['options']['linkshare2'] = $_POST['linkshare2'];
- $queue['options']['linkshare1'] = $_POST['linkshare1'];
- $queue['options']['realtime'] = $_POST['realtime'];
- $queue['options']['realtime3'] = $_POST['realtime3'];
- $queue['options']['realtime2'] = $_POST['realtime2'];
- $queue['options']['realtime1'] = $_POST['realtime1'];
- $queue['options']['upperlimit'] = $_POST['upperlimit'];
- $queue['options']['upperlimit3'] = $_POST['upperlimit3'];
- $queue['options']['upperlimit2'] = $_POST['upperlimit2'];
- $queue['options']['upperlimit1'] = $_POST['upperlimit1'];
- $queue['options']['parentqueue'] = $_POST['parentqueue'];
- $queue['options']['associatedrule'] = $_POST['associatedrule'];
+ $queue['name'] = substr($queue['name'], 0, 14);
+ $queue['borrow'] = $_POST['borrow'];
+ $queue['linkshare'] = $_POST['linkshare'];
+ $queue['linkshare3'] = $_POST['linkshare3'];
+ $queue['linkshare2'] = $_POST['linkshare2'];
+ $queue['linkshare1'] = $_POST['linkshare1'];
+ $queue['realtime'] = $_POST['realtime'];
+ $queue['realtime3'] = $_POST['realtime3'];
+ $queue['realtime2'] = $_POST['realtime2'];
+ $queue['realtime1'] = $_POST['realtime1'];
+ $queue['upperlimit'] = $_POST['upperlimit'];
+ $queue['upperlimit3'] = $_POST['upperlimit3'];
+ $queue['upperlimit2'] = $_POST['upperlimit2'];
+ $queue['upperlimit1'] = $_POST['upperlimit1'];
+ $queue['parentqueue'] = $_POST['parentqueue'];
+ $queue['associatedrule'] = $_POST['associatedrule'];
$scheduleroptions="";
- $queue['options']['rio'] = $_POST['rio'];
- $queue['options']['red'] = $_POST['red'];
- $queue['options']['ecn'] = $_POST['ecn'];
- $queue['options']['defaultqueue'] = $_POST['defaultqueue'];
+ $queue['rio'] = $_POST['rio'];
+ $queue['red'] = $_POST['red'];
+ $queue['ecn'] = $_POST['ecn'];
+ $queue['defaultqueue'] = $_POST['defaultqueue'];
if (isset($id) && $a_queues[$id])
$a_queues[$id] = $queue;
else
@@ -141,117 +142,31 @@ if ($_POST) {
<title><?=gentitle("Firewall: Traffic shaper: Edit queue");?></title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link href="gui.css" rel="stylesheet" type="text/css">
-
-<script language="JavaScript">
-<!--
-function sync_scheduler_options() {
- var wan = '<?=$wan_sched?>';
- var lan = '<?=$lan_sched?>';
- var indexNum = document.forms[0].associatedrule.selectedIndex;
- var associatedrule = document.forms[0].associatedrule.options[indexNum].text;
- var tmp = associatedrule.split(" - ");
- var interface_type_a = '' + eval(tmp[0]) + '';
- var interface_type = String(interface_type_a);
- if(interface_type == 'priq') {
- document.forms[0].rio.disabled = 0;
- document.forms[0].bandwidth.disabled = 1;
- document.forms[0].bandwidthtype.disabled = 1;
- document.forms[0].bandwidth.value = "";
- document.forms[0].bandwidthtype.value = "";
- document.forms[0].defaultqueue.disabled = 0;
- document.forms[0].borrow.disabled = 1;
- document.forms[0].parentqueue.disabled = 1;
- document.forms[0].red.disabled = 0;
- document.forms[0].ecn.disabled = 0;
- document.forms[0].upperlimit.disabled = 1;
- document.forms[0].upperlimit1.disabled = 1;
- document.forms[0].upperlimit2.disabled = 1;
- document.forms[0].upperlimit3.disabled = 1;
- document.forms[0].realtime.disabled = 1;
- document.forms[0].realtime1.disabled = 1;
- document.forms[0].realtime2.disabled = 1;
- document.forms[0].realtime3.disabled = 1;
- document.forms[0].linkshare.disabled = 1;
- document.forms[0].linkshare1.disabled = 1;
- document.forms[0].linkshare2.disabled = 1;
- document.forms[0].linkshare3.disabled = 1;
- document.forms[0].childqueue.disabled = 1;
- document.forms[0].priority.disabled = 0;
- } else if(interface_type == 'cbq') {
- document.forms[0].rio.disabled = 0;
- document.forms[0].borrow.disabled = 0;
- document.forms[0].bandwidth.disabled = 0;
- document.forms[0].bandwidthtype.disabled = 0;
- document.forms[0].defaultqueue.disabled = 0;
- document.forms[0].parentqueue.disabled = 0;
- document.forms[0].red.disabled = 0;
- document.forms[0].ecn.disabled = 0;
- document.forms[0].upperlimit.disabled = 1;
- document.forms[0].upperlimit1.disabled = 1;
- document.forms[0].upperlimit2.disabled = 1;
- document.forms[0].upperlimit3.disabled = 1;
- document.forms[0].realtime.disabled = 1;
- document.forms[0].realtime1.disabled = 1;
- document.forms[0].realtime2.disabled = 1;
- document.forms[0].realtime3.disabled = 1;
- document.forms[0].linkshare.disabled = 1;
- document.forms[0].linkshare1.disabled = 1;
- document.forms[0].linkshare2.disabled = 1;
- document.forms[0].linkshare3.disabled = 1;
- document.forms[0].childqueue.disabled = 0;
- document.forms[0].priority.disabled = 0;
- } else if(interface_type == 'hfsc') {
- document.forms[0].rio.disabled = 0;
- document.forms[0].borrow.disabled = 0;
- document.forms[0].bandwidth.disabled = 0;
- document.forms[0].bandwidthtype.disabled = 0;
- document.forms[0].red.disabled = 0;
- document.forms[0].ecn.disabled = 0;
- document.forms[0].defaultqueue.disabled = 0;
- document.forms[0].parentqueue.disabled = 0;
- document.forms[0].upperlimit.disabled = 0;
- document.forms[0].upperlimit1.disabled = 0;
- document.forms[0].upperlimit2.disabled = 0;
- document.forms[0].upperlimit3.disabled = 0;
- document.forms[0].realtime.disabled = 0;
- document.forms[0].realtime1.disabled = 0;
- document.forms[0].realtime2.disabled = 0;
- document.forms[0].realtime3.disabled = 0;
- document.forms[0].linkshare.disabled = 0;
- document.forms[0].linkshare1.disabled = 0;
- document.forms[0].linkshare2.disabled = 0;
- document.forms[0].linkshare3.disabled = 0;
- document.forms[0].childqueue.disabled = 0;
- document.forms[0].priority.disabled = 0;
- }
-}
--->
-</script>
</head>
-<body onLoad="sync_scheduler_options();" link="#0000CC" vlink="#0000CC" alink="#0000CC">
+<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
<?php include("fbegin.inc"); ?>
<?php
- $red = $pconfig['options']["red"];
- $ecn = $pconfig['options']["ecn"];
- $rio = $pconfig['options']["rio"];
- $borrow = $pconfig['options']["borrow"];
- $upperlimit = $pconfig['options']["upperlimit"];
- $upperlimit1 = $pconfig['options']["upperlimit1"];
- $upperlimit2 = $pconfig['options']["upperlimit2"];
- $upperlimit3 = $pconfig['options']["upperlimit3"];
- $realtime = $pconfig['options']["realtime"];
- $realtime1 = $pconfig['options']["realtime1"];
- $realtime2 = $pconfig['options']["realtime2"];
- $realtime3 = $pconfig['options']["realtime3"];
- $linkshare = $pconfig['options']["linkshare"];
- $linkshare1 = $pconfig['options']["linkshare1"];
- $linkshare2 = $pconfig['options']["linkshare2"];
- $linkshare3 = $pconfig['options']["linkshare3"];
- $parentqueue = $pconfig['options']["parentqueue"];
- $defaultqueue = $pconfig['options']["defaultqueue"];
- $parent = $pconfig['options']["parent"];
+ $red = $pconfig["red"];
+ $ecn = $pconfig["ecn"];
+ $rio = $pconfig["rio"];
+ $borrow = $pconfig["borrow"];
+ $upperlimit = $pconfig["upperlimit"];
+ $upperlimit1 = $pconfig["upperlimit1"];
+ $upperlimit2 = $pconfig["upperlimit2"];
+ $upperlimit3 = $pconfig["upperlimit3"];
+ $realtime = $pconfig["realtime"];
+ $realtime1 = $pconfig["realtime1"];
+ $realtime2 = $pconfig["realtime2"];
+ $realtime3 = $pconfig["realtime3"];
+ $linkshare = $pconfig["linkshare"];
+ $linkshare1 = $pconfig["linkshare1"];
+ $linkshare2 = $pconfig["linkshare2"];
+ $linkshare3 = $pconfig["linkshare3"];
+ $parentqueue = $pconfig["parentqueue"];
+ $defaultqueue = $pconfig["defaultqueue"];
+ $parent = $pconfig["parent"];
$schedulertype = $pconfig["schedulertype"];
?>
<p class="pgtitle">Firewall: Traffic shaper: Edit queue</p>
@@ -259,22 +174,16 @@ function sync_scheduler_options() {
<form action="firewall_shaper_queues_edit.php" method="post" name="iform" id="iform">
<table width="100%" border="0" cellpadding="6" cellspacing="0">
<tr>
- <td valign="top" class="vncellreq">Associate with rule</td>
+ <td valign="top" class="vncellreq">Scheduler Type</td>
<td class="vtable">
- <select name="associatedrule" onChange="sync_scheduler_options();">
<?php
- if($pconfig['options']['associatedrule']) {
- echo "<option value=\"" . $pconfig['options']['associatedrule'] ."\">" . filter_get_rule_interface($pconfig['options']['associatedrule']) . " - " . filter_get_altq_queue_scheduler_type($pconfig['options']['associatedrule']) . " - " . $pconfig['options']['associatedrule'] . "</option>";
- }
- foreach ($config['filter']['rule'] as $rule) {
- echo "<option value=\"" . $rule['descr'] ."\">" . $rule['interface'] . " - " . filter_get_altq_queue_scheduler_type($rule['descr']) . " - " . $rule['descr'] . "</option>";
- }
+ if($schedulertype == "hfsc") echo "Hierarchical Fair Service Curve queueing";
+ else if($schedulertype == "priq") echo "Priority based queueing";
+ else if($schedulertype == "cbq") echo "Class based queueing";
?>
- </select>
- <br>
- <span class="vexpl">Choose which rule to attach this queue to.
- </span></td>
+ </td>
</tr>
+ <?php if ($schedulertype == "cbq"): ?>
<tr>
<td valign="top" class="vncellreq">Bandwidth</td>
<td class="vtable"> <input name="bandwidth" class="formfld" value="<?=htmlspecialchars($pconfig['bandwidth']);?>">
@@ -290,6 +199,7 @@ function sync_scheduler_options() {
<span class="vexpl">Choose the amount of bandwidth for this queue
</span></td>
</tr>
+ <? endif; ?>
<tr>
<td width="22%" valign="top" class="vncellreq">Priority</td>
<td width="78%" class="vtable"> <input name="priority" type="text" id="priority" size="5" value="<?=htmlspecialchars($pconfig['priority']);?>">
@@ -299,18 +209,31 @@ function sync_scheduler_options() {
<tr>
<td width="22%" valign="top" class="vncell"><b>Name</b></td>
<td width="78%" class="vtable"> <input name="name" type="text" class="formfld" id="name" size="40" value="<?=htmlspecialchars($pconfig['name']);?>">
- <br> <span class="vexpl">Enter the name of the queue here. Do not use spaces!
+ <br> <span class="vexpl">Enter the name of the queue here. Do not use spaces and limit the size to 15 characters.
</span></td>
</tr>
<tr>
<td width="22%" valign="top" class="vncell">Scheduler options</td>
<td width="78%" class="vtable">
+ <?php
+ $isdefaultdefined = 0;
+ foreach($config['shaper'] as $queue) {
+ if(isset($queue["defaultqueue"])) $isdefaultdefined = 1;
+ }
+ ?>
+ <?php if ($isdefaultdefined == 0): ?>
<input type="checkbox" id="defaultqueue" name="defaultqueue" <?php if($defaultqueue) echo " CHECKED";?> > Default queue<br>
+ <? endif; ?>
+ <?php if ($schedulertype == "cbq"): ?>
<input type="checkbox" id="borrow" name="borrow" <?php if($borrow) echo " CHECKED";?> > Borrow from other queues when available<br>
+ <? endif; ?>
<input type="checkbox" id="red" name="red" <?php if($red) echo " CHECKED";?> > Random Early Detection<br>
<input type="checkbox" id="rio" name="rio" <?php if($rio) echo " CHECKED";?> > Random Early Detection In and Out<br>
<input type="checkbox" id="ecn" name="ecn" <?php if($ecn) echo " CHECKED";?> > Explicit Congestion Notification<br>
+ <?php if ($schedulertype == "hfsc" or $schedulertype == "cbq"): ?>
<input type="checkbox" id="parentqueue" name="parentqueue" <?php if($parentqueue) echo " CHECKED";?> > This is a parent queue of HFSC/CBQ<br>
+ <?php endif; ?>
+ <?php if ($schedulertype == "hfsc"): ?>
<input type="checkbox" id="upperlimit" name="upperlimit" <?php if($upperlimit) echo " CHECKED";?> > Upperlimit: <input size="3" value="<?=htmlspecialchars($upperlimit1);?>" name="upperlimit1"> <input size="3" value="<?=htmlspecialchars($upperlimit2);?>" name="upperlimit2"> <input size="3" value="<?=htmlspecialchars($upperlimit3);?>" name="upperlimit3"> <br>
<input type="checkbox" id="realtime" name="realtime" <?php if($realtime) echo " CHECKED";?> > Real time: <input size="3" value="<?=htmlspecialchars($realtime1);?>" name="realtime1"> <input size="3" value="<?=htmlspecialchars($realtime2); ?>" name="realtime2"> <input size="3" value="<?=htmlspecialchars($realtime3);?>" name="realtime3"><br>
<input type="checkbox" id="linkshare" id="linkshare" name="linkshare" <?php if($linkshare) echo " CHECKED";?> > Link share: <input size="3" value="<?=htmlspecialchars($linkshare1);?>" value="<?=htmlspecialchars($linkshare1);?>" id="linkshare1" name="linkshare1"> <input size="3" value="<?=htmlspecialchars($linkshare2);?>" id="linkshare2" name="linkshare2"> <input size="3" value="<?=htmlspecialchars($linkshare3);?>" id="linkshare3" name="linkshare3"><br>
@@ -322,12 +245,12 @@ function sync_scheduler_options() {
<td width="78%" class="vtable">
<select id="childqueue" name="childqueue">
<?php
- if(isset($pconfig['pfqueueing']['childqueue']))
- echo "<option value=\"" . $pconfig['pfqueueing']['childqueue'] . "\">" . $pconfig['pfqueueing']['childqueue'] . "</option>";
+ if(isset($pconfig['shaper']['childqueue']))
+ echo "<option value=\"" . $pconfig['shaper']['childqueue'] . "\">" . $pconfig['shaper']['childqueue'] . "</option>";
else
echo "<option value=\"\"></option>";
- if (is_array($config['pfqueueing']['queue'])) {
- foreach ($config['pfqueueing']['queue'] as $queue) {
+ if (is_array($config['shaper']['queue'])) {
+ foreach ($config['shaper']['queue'] as $queue) {
if(is_subqueue($queue['name']) == 0)
echo "<option value=\"" . $queue['name'] . "\">" . $queue['name'] . "</option>";
}
@@ -336,6 +259,7 @@ function sync_scheduler_options() {
</select>
</td>
</tr>
+ <?php endif; ?>
<tr>
<td width="22%" valign="top">&nbsp;</td>
<td width="78%"> <input name="Submit" type="submit" class="formbtn" value="Save">
@@ -347,8 +271,5 @@ function sync_scheduler_options() {
</table>
</form>
<?php include("fend.inc"); ?>
-<script language="JavaScript">
-sync_scheduler_options();
-</script>
</body>
</html>
diff --git a/usr/local/www/system_advanced.php b/usr/local/www/system_advanced.php
index ea1baf3..bdbac0a 100755
--- a/usr/local/www/system_advanced.php
+++ b/usr/local/www/system_advanced.php
@@ -90,7 +90,7 @@ if ($_POST) {
$config['system']['disableconsolemenu'] = $_POST['disableconsolemenu'] ? true : false;
$config['system']['disablefirmwarecheck'] = $_POST['disablefirmwarecheck'] ? true : false;
$config['system']['webgui']['expanddiags'] = $_POST['expanddiags'] ? true : false;
- $config['system']['schedulertype'] = $_POST['schedulertype'];
+
if ($g['platform'] == "generic-pc") {
$oldharddiskstandby = $config['system']['harddiskstandby'];
$config['system']['harddiskstandby'] = $_POST['harddiskstandby'];
@@ -98,6 +98,8 @@ if ($_POST) {
$config['system']['webgui']['noantilockout'] = $_POST['noantilockout'] ? true : false;
$config['filter']['tcpidletimeout'] = $_POST['tcpidletimeout'];
+ $config['system']['schedulertype'] = $_POST['schedulertype'];
+
write_config();
if (($config['system']['webgui']['certificate'] != $oldcert)
@@ -201,11 +203,11 @@ function enable_change(enable_over) {
<td width="78%">
<input name="Submit" type="submit" class="formbtn" value="Save" onclick="enable_change(true)">
</td>
- </tr>
+ </tr>
<tr>
<td colspan="2" class="list" height="12"></td>
</tr>
-
+
<tr>
<td colspan="2" valign="top" class="listtopic">Disable Firewalling</td>
</tr>
OpenPOWER on IntegriCloud