summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBill Marquette <billm@pfsense.org>2005-06-05 05:03:34 +0000
committerBill Marquette <billm@pfsense.org>2005-06-05 05:03:34 +0000
commit2602ae2fa1b638662f7cf896d6c74559cfc6b111 (patch)
tree4cbf7d0a3205d845606a0732f52c65715b721e3f
parentb667f1ce847494f4d397594713c04566ec15b024 (diff)
downloadpfsense-2602ae2fa1b638662f7cf896d6c74559cfc6b111.zip
pfsense-2602ae2fa1b638662f7cf896d6c74559cfc6b111.tar.gz
Split shaper back to individual interfaces
fix VOIP queues (wrong interfaces)
-rw-r--r--etc/inc/filter.inc87
-rw-r--r--usr/local/www/wizards/traffic_shaper_wizard.xml10
2 files changed, 86 insertions, 11 deletions
diff --git a/etc/inc/filter.inc b/etc/inc/filter.inc
index 146bc89..6fa8882 100644
--- a/etc/inc/filter.inc
+++ b/etc/inc/filter.inc
@@ -263,22 +263,96 @@ function filter_get_rule_real_interface($associatedrulenumber) {
}
}
+/* Find a queue that's attached to this one and see if that queue is used on this interface */
+function is_subqueue_used_on_interface($queuename, $interface) {
+ global $config;
+ $qconfig = $config;
+ if (!is_array($qconfig['shaper']['queue'])) return 0;
+
+ foreach ($qconfig['shaper']['queue'] as $queue) {
+ if($queue['attachtoqueue'] == $queuename)
+ $subqueue_interface = filter_is_queue_being_used_on_interface($queue['name'], $interface);
+ /* Useful debugging code for when queues are messed up
+ * echo "{$subqueue_interface}/{$interface}/{$queue['name']}/{$queuename}\n";
+ */
+ if ($subqueue_interface != ""){
+ return 1;
+ }
+ }
+ return 0;
+}
+
function filter_is_queue_being_used_on_interface($queuename, $interface) {
global $config;
$lconfig = $config;
if(!is_array($lconfig['shaper']['rule'])) return;
foreach($lconfig['shaper']['rule'] as $rule) {
- if(($rule['inqueue'] == $queuename && $rule['interface'] == $interface) ||
- ($rule['outqueue'] == $queuename && $rule['interface'] == $interface))
+ if(($rule['inqueue'] == $queuename && $rule['interface'] == $interface))
return $interface;
}
return;
}
-
function filter_setup_altq_interfaces() {
global $config;
$altq_rules = "";
+ $queue_names = "";
+ $is_first = "";
+
+ if(!is_array($config['shaper']['queue'])) return;
+
+ $ifdescrs = array('wan', 'lan');
+ for ($j = 1; isset($config['interfaces']['opt' . $j]); $j++) {
+ $ifdescrs[] = "opt" . $j;
+ }
+
+ foreach ($ifdescrs as $ifdescr => $ifname) {
+
+ $queue_names = "";
+ $is_first = "";
+
+ $workting_with_interface = $ifname;
+
+ foreach ($config['shaper']['queue'] as $queue) {
+ $rule_interface = "";
+ $q = $queue;
+ $rule_interface = filter_is_queue_being_used_on_interface($q['name'], $workting_with_interface);
+ if ($rule_interface == $workting_with_interface) {
+ if(!isset($q['attachtoqueue'])) {
+ if($is_first) $queue_names .= ", ";
+ $queue_names .= $q['name'];
+ $is_first = "1";
+ }
+ } else {
+ if(isset($q['parentqueue']) && ($q['parentqueue'] <> "")) {
+ if(is_subqueue_used_on_interface($q['name'], $workting_with_interface)) {
+ $queue_names .= " ";
+ $queue_names .= $q['name'];
+ $seen[$q['name']] = 1;
+ }
+ }
+ }
+
+ }
+
+ if($queue_names <> ""){
+ $altq_rules .= "altq on " . $config['interfaces'][$ifname]['if'] . " ";
+ if($config['interfaces'][$ifname]['bandwidth'] <> "")
+ $bandwidth = " bandwidth " . $config['interfaces'][$ifname]['bandwidth'] . $config['interfaces'][$ifname]['bandwidthtype'];
+ $altq_rules .= $config['system']['schedulertype'] . $bandwidth . " ";
+ $altq_rules .= "queue { " . $queue_names . " }";
+ }
+ $altq_rules .= "\n";
+
+ }
+ return $altq_rules;
+}
+
+
+
+function broken_filter_setup_altq_interfaces() {
+ global $config;
+ $altq_rules = "";
$altq_ifs = "";
$bandwidth = "";
$queue_names = "";
@@ -307,6 +381,8 @@ function filter_setup_altq_interfaces() {
$seen[$q['name']] = 1;
}
} else {
+echo "{$rule_interface}\n";
+echo "{$workting_with_interface}\n";
if($q['parentqueue'] <> "" and !$seen[$q['name']]) {
$queue_names .= " ";
$queue_names .= $q['name'];
@@ -317,14 +393,13 @@ function filter_setup_altq_interfaces() {
}
if($queue_names <> ""){
- $altq_ifs .= " {$config['interfaces'][$ifname]['if']}";
if($config['interfaces'][$ifname]['bandwidth'] <> "")
$bandwidth = $bandwidth + $config['interfaces'][$ifname]['bandwidth'];
+ $altq_rules .= "altq on {$config['interfaces'][$ifname]['if']} {$config['system']['schedulertype']} bandwidth {$bandwidth}Kb queue \{ {$queue_names} }";
}
}
- $altq_rules = "altq on \{ {$altq_ifs} } {$config['system']['schedulertype']} bandwidth {$bandwidth}Kb queue \{ {$queue_names} }";
return $altq_rules;
}
@@ -346,7 +421,7 @@ function queue_interface_recursive($queuename) {
if($status <> "") return $status;
}
foreach($config['shaper']['rule'] as $rule) {
- if($rule['inqueue'] == $queuename || $rule['outqueue'] == $queuename)
+ if($rule['inqueue'] == $queuename)
return $rule['interface'];
}
}
diff --git a/usr/local/www/wizards/traffic_shaper_wizard.xml b/usr/local/www/wizards/traffic_shaper_wizard.xml
index 249981d..feb6e8e 100644
--- a/usr/local/www/wizards/traffic_shaper_wizard.xml
+++ b/usr/local/www/wizards/traffic_shaper_wizard.xml
@@ -155,9 +155,10 @@
$queue = array();
$queue['name'] = "qLANdef";
- $queue['associatedrule'] = 0;
$queue['priority'] = 3;
$queue['attachtoqueue'] = "qLANRoot";
+ $queue['associatedrule'] = 0;
+ $queue['defaultqueue'] = 'true';
$queue['realtime'] = "on";
$queue['realtime1'] = "10%";
$queue['realtime2'] = "1";
@@ -480,8 +481,7 @@
</fields>
<stepsubmitphpaction>
- /* XXX - billm - needs to actually honor what the user selects still */
-199.206.102.30
+ /* XXX - billm - needs to actually honor what the user selects still */
if ( $_POST['enable'] ) {
/* To add p2p clients, push Descr,Protocol,Start,End,src/dest/both onto p2plist */
@@ -515,7 +515,7 @@
$destsrc = 'destination';
$rule['outqueue'] = 'qP2PUp';
$rule['inqueue'] = 'qP2PDown';
- $rule['interface'] = 'lan';
+ $rule['interface'] = 'wan';
$rule['source']['network'] = 'lan';
$rule['destination']['any'] = TRUE;
$rule['descr'] = "m_P2P {$p2pclient[0]} outbound";
@@ -523,7 +523,7 @@
$destsrc = 'source';
$rule['outqueue'] = 'qP2PDown';
$rule['inqueue'] = 'qP2PUp';
- $rule['interface'] = 'wan';
+ $rule['interface'] = 'lan';
$rule['source']['any'] = TRUE;
$rule['destination']['network'] = 'lan';
$rule['descr'] = "m_P2P {$p2pclient[0]} inbound";
OpenPOWER on IntegriCloud