summaryrefslogtreecommitdiffstats
path: root/usr
diff options
context:
space:
mode:
authorScott Ullrich <sullrich@pfsense.org>2005-12-29 04:53:39 +0000
committerScott Ullrich <sullrich@pfsense.org>2005-12-29 04:53:39 +0000
commit6577d78252fc37981410567f9b21f0415355c6dd (patch)
tree5e2e4ac9940399ed1d4c4d0009ca99779fc94f84 /usr
parent8ecf26d8edc6339f8d06fe9416bceb75160922da (diff)
downloadpfsense-6577d78252fc37981410567f9b21f0415355c6dd.zip
pfsense-6577d78252fc37981410567f9b21f0415355c6dd.tar.gz
MFC 8799
EZShaper wizard will now spit out rules ordered by queue priority in order to at least make a stab at a reasonable rule order
Diffstat (limited to 'usr')
-rwxr-xr-xusr/local/www/guiconfig.inc22
-rw-r--r--usr/local/www/wizards/traffic_shaper_wizard.xml19
2 files changed, 40 insertions, 1 deletions
diff --git a/usr/local/www/guiconfig.inc b/usr/local/www/guiconfig.inc
index 2ddda6f..d607e02 100755
--- a/usr/local/www/guiconfig.inc
+++ b/usr/local/www/guiconfig.inc
@@ -490,6 +490,28 @@ function wol_sort() {
usort($config['wol']['wolentry'], "wolcmp");
}
+function sort_rule_by_queue_priority() {
+ global $g, $config;
+ global $queues;
+
+ function rqpcmp($a, $b) {
+ global $queues;
+
+ $ra = $queues[$a['outqueue']];
+ $rb = $queues[$b['outqueue']];
+
+ if ($ra == $rb)
+ return 0;
+ /* reverse sort - we want higher priority first */
+ return ($ra < $rb) ? 1 : -1;
+ }
+
+ foreach($config['shaper']['queue'] as $q) {
+ $queues[$q['name']] = $q['priority'];
+ }
+
+ usort($config['shaper']['rule'], "rqpcmp");
+}
function gentitle($pgname) {
global $config;
return $config['system']['hostname'] . "." . $config['system']['domain'] . " - " . $pgname;
diff --git a/usr/local/www/wizards/traffic_shaper_wizard.xml b/usr/local/www/wizards/traffic_shaper_wizard.xml
index 7dd328d..7bb86a5 100644
--- a/usr/local/www/wizards/traffic_shaper_wizard.xml
+++ b/usr/local/www/wizards/traffic_shaper_wizard.xml
@@ -2019,7 +2019,24 @@
<stepsubmitphpaction>
$config['shaper']['enable'] = TRUE;
unset($config['shaper']['itemsshaped']);
- unlink_if_exists($d_shaperconfdirty_path);
+ /* Sort rules by queue priority */
+ sort_rule_by_queue_priority();
+
+ /* Enable shaper */
+ $config['shaper']['enable'] = TRUE;
+
+ /* Prepare for next ezshaper wizard run */
+ unset($config['shaper']['itemsshaped']);
+
+ /* Create new rules */
+ filter_configure_sync();
+
+ /* And we're no longer dirty! */
+ unlink_if_exists($d_shaperconfdirty_path);
+
+ /* Head over and check out the groovy queue stats */
+ header("Location: /status_queues.php");
+
filter_configure_sync();
header("Location: /status_queues.php");
</stepsubmitphpaction>
OpenPOWER on IntegriCloud