summaryrefslogtreecommitdiffstats
path: root/usr/local/pkg
diff options
context:
space:
mode:
authorjim-p <jim@pingle.org>2009-07-09 19:38:58 -0400
committerjim-p <jim@pingle.org>2009-07-09 19:39:44 -0400
commit1729ace8dae580a82f709586ac02f0d6f7075dc3 (patch)
tree2b45507a8a19aefb51314f5c57af7b2f59432977 /usr/local/pkg
parent1afa87e5b2cd6b2e9d6dad198c8f1a828e60d810 (diff)
downloadpfsense-1729ace8dae580a82f709586ac02f0d6f7075dc3.zip
pfsense-1729ace8dae580a82f709586ac02f0d6f7075dc3.tar.gz
Add traffic shaper queue field to UPnP config
Diffstat (limited to 'usr/local/pkg')
-rw-r--r--usr/local/pkg/miniupnpd.inc17
-rw-r--r--usr/local/pkg/miniupnpd.xml7
2 files changed, 23 insertions, 1 deletions
diff --git a/usr/local/pkg/miniupnpd.inc b/usr/local/pkg/miniupnpd.inc
index 57a5ec4..328d9ec 100644
--- a/usr/local/pkg/miniupnpd.inc
+++ b/usr/local/pkg/miniupnpd.inc
@@ -1,6 +1,7 @@
<?php
require_once("config.inc");
require_once("functions.inc");
+ require_once("shaper.inc");
/* MiniUPnPd */
@@ -30,6 +31,12 @@
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) {
+ read_altq_config();
+ $qlist = get_altq_name_list();
+ return in_array($qname, $qlist);
+ }
+
function upnp_validate_ip($ip, $check_cdir) {
/* validate cdir */
if($check_cdir) {
@@ -86,6 +93,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++) {
@@ -202,6 +211,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 56c7ca1..e7a39c1 100644
--- a/usr/local/pkg/miniupnpd.xml
+++ b/usr/local/pkg/miniupnpd.xml
@@ -43,7 +43,7 @@
<fielddescr>Enable UPnP</fielddescr>
<fieldname>enable</fieldname>
<type>checkbox</type>
- <enablefields>iface_array,overridewanip,logpackets,sysuptime,permdefault,permuser1,permuser2,permuser3,permuser4</enablefields>
+ <enablefields>iface_array,overridewanip,upnpqueue,logpackets,sysuptime,permdefault,permuser1,permuser2,permuser3,permuser4</enablefields>
</field>
<field>
<fielddescr>Interfaces (generally LAN)</fielddescr>
@@ -71,6 +71,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