diff options
author | Scott Ullrich <sullrich@pfsense.org> | 2005-12-29 04:53:39 +0000 |
---|---|---|
committer | Scott Ullrich <sullrich@pfsense.org> | 2005-12-29 04:53:39 +0000 |
commit | 6577d78252fc37981410567f9b21f0415355c6dd (patch) | |
tree | 5e2e4ac9940399ed1d4c4d0009ca99779fc94f84 /usr | |
parent | 8ecf26d8edc6339f8d06fe9416bceb75160922da (diff) | |
download | pfsense-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-x | usr/local/www/guiconfig.inc | 22 | ||||
-rw-r--r-- | usr/local/www/wizards/traffic_shaper_wizard.xml | 19 |
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> |