. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ require("guiconfig.inc"); if($_GET['reset'] <> "") { mwexec("killall -9 pfctl php"); exit; } if (!is_array($config['shaper']['queue'])) { $config['shaper']['queue'] = array(); } $a_queues = &$config['shaper']['queue']; /* redirect to wizard if shaper isn't already configured */ if(isset($config['shaper']['enable'])) { $pconfig['enable'] = TRUE; } else { if(!is_array($config['shaper']['queue'])) Header("Location: wizard.php?xml=traffic_shaper_wizard.xml"); } $iflist = array("lan" => "LAN", "wan" => "WAN"); for ($i = 1; isset($config['interfaces']['opt' . $i]); $i++) { $iflist['opt' . $i] = $config['interfaces']['opt' . $i]['descr']; } if ($_POST['apply'] || $_POST['submit']) { $config['shaper']['enable'] = true; write_config(); $retval = 0; $savemsg = get_std_save_message($retval); /* Setup pf rules since the user may have changed the optimization value */ config_lock(); $retval = filter_configure(); config_unlock(); if(stristr($retval, "error") <> true) $savemsg = get_std_save_message($retval); else $savemsg = $retval; if(file_exists($d_shaperconfdirty_path)) unlink($d_shaperconfdirty_path); } if ($_GET['act'] == "del") { if ($a_queues[$_GET['id']]) { /* check that no rule references this queue */ 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; } } } if (!$input_errors) { unset($a_queues[$_GET['id']]); /* renumber all rules */ 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']--; } } write_config(); touch($d_shaperconfdirty_path); header("Location: firewall_shaper_queues.php"); exit; } } } if ($_POST) { /* yuck - IE won't send value attributes for image buttons, while Mozilla does - so we use .x/.y to fine move button clicks instead... */ unset($movebtn); foreach ($_POST as $pn => $pd) { if (preg_match("/move_(\d+)_x/", $pn, $matches)) { $movebtn = $matches[1]; break; } } /* move selected rules before this rule */ if (isset($movebtn) && is_array($_POST['queue']) && count($_POST['queue'])) { $a_queue_new = array(); /* copy all rules < $movebtn and not selected */ for ($i = 0; $i < $movebtn; $i++) { if (!in_array($i, $_POST['queue'])) $a_queue_new[] = $a_queues[$i]; } /* copy all selected rules */ for ($i = 0; $i < count($a_queues); $i++) { if ($i == $movebtn) continue; if (in_array($i, $_POST['queue'])) $a_queue_new[] = $a_queues[$i]; } /* copy $movebtn rule */ if ($movebtn < count($a_queues)) $a_queue_new[] = $a_queues[$movebtn]; /* copy all rules > $movebtn and not selected */ for ($i = $movebtn+1; $i < count($a_queues); $i++) { if (!in_array($i, $_POST['queue'])) $a_queue_new[] = $a_queues[$i]; } $a_queues = $a_queue_new; write_config(); touch($d_shaperconfdirty_path); header("Location: firewall_shaper_queues.php"); exit; } } $pgtitle = "Firewall: Shaper: Queues"; include("head.inc"); ?>

You must apply the changes in order for them to take effect.");?>
    Flags Priority Default Bandwidth Name  
  "") echo " RED"; if($queue['rio'] <> "") echo " RIO"; if($queue['ecn'] <> "") echo " ECN"; if($queue['borrow'] <> "") echo " Borrow"; if(isset($queue['ack'])) echo "ACK" ?>     "") { echo "Yes"; } else { echo "No"; } ?>    

Note:
A queue can only be deleted if it is not referenced by any rules.
You can check the results of your queues at Status:Queues.