summaryrefslogtreecommitdiffstats
path: root/usr/local/pkg
diff options
context:
space:
mode:
authorScott Ullrich <sullrich@pfsense.homeunix.net>2009-07-09 23:48:49 -0400
committerScott Ullrich <sullrich@pfsense.homeunix.net>2009-07-09 23:48:49 -0400
commit38d0994307d6e1fbc5a1c102930c85310408070a (patch)
tree1e2a2d533a2182bec0144306dbb8d795480436c6 /usr/local/pkg
parenta983b48bc1fddd73eb060f8564550bc7613b1bae (diff)
downloadpfsense-38d0994307d6e1fbc5a1c102930c85310408070a.zip
pfsense-38d0994307d6e1fbc5a1c102930c85310408070a.tar.gz
Define and use queue when available.
Submitted-by: jim-p
Diffstat (limited to 'usr/local/pkg')
-rw-r--r--usr/local/pkg/miniupnpd.inc19
-rw-r--r--usr/local/pkg/miniupnpd.xml5
2 files changed, 24 insertions, 0 deletions
diff --git a/usr/local/pkg/miniupnpd.inc b/usr/local/pkg/miniupnpd.inc
index 0d80700..344f404 100644
--- a/usr/local/pkg/miniupnpd.inc
+++ b/usr/local/pkg/miniupnpd.inc
@@ -30,6 +30,15 @@
return substr($uuid,0,8).'-'.substr($uuid,9,4).'-'.substr($uuid,13,4).'-'.substr($uuid,17,4).'-'.substr($uuid,21,12);
}
+ function upnp_validate_queue($qname) {
+ global $config;
+ $qlist = array();
+ foreach ($config['shaper']['queue'] as $q) {
+ $qlist[] = $q['name'];
+ }
+ return in_array($qname, $qlist);
+ }
+
function upnp_validate_ip($ip, $check_cdir) {
/* validate cdir */
if($check_cdir) {
@@ -90,6 +99,8 @@
$input_errors[] = 'You must specify a value greater than 0 in the \'Maximum Download Speed\' field';
if($post['upload'] && $post['upload'] <= 0)
$input_errors[] = 'You must specify a value greater than 0 in the \'Maximum Upload Speed\' field';
+ if($post['upnpqueue'] && !upnp_validate_queue($post['upnpqueue']))
+ $input_errors[] = 'You must specify a valid traffic shaping queue.';
/* user permissions validation */
for($i=1; $i<=4; $i++) {
@@ -208,6 +219,14 @@
if($upnp_config['permdefault'])
$config_text .= "deny 0-65535 0.0.0.0/0 0-65535\n";
+ /* Recheck if queue is valid */
+ if (!upnp_validate_queue($upnp_config['upnpqueue']))
+ unset($upnp_config['upnpqueue']);
+
+ /* Add shaper queue */
+ if($upnp_config['upnpqueue'])
+ $config_text .= "queue={$upnp_config['upnpqueue']}\n";
+
/* write out the configuration */
upnp_write_config($config_file, $config_text);
diff --git a/usr/local/pkg/miniupnpd.xml b/usr/local/pkg/miniupnpd.xml
index dc3b057..23a0cdf 100644
--- a/usr/local/pkg/miniupnpd.xml
+++ b/usr/local/pkg/miniupnpd.xml
@@ -70,6 +70,11 @@
<type>input</type>
</field>
<field>
+ <fielddescr>Traffic Shaping Queue</fielddescr>
+ <fieldname>upnpqueue</fieldname>
+ <type>input</type>
+ </field>
+ <field>
<fielddescr>Log packets handled by UPnP rules?</fielddescr>
<fieldname>logpackets</fieldname>
<type>checkbox</type>
OpenPOWER on IntegriCloud