summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjim-p <jimp@pfsense.org>2010-07-14 11:41:00 -0400
committerjim-p <jimp@pfsense.org>2010-07-14 11:41:00 -0400
commit93b2c459855b82920decea1a2db080b0ae09b267 (patch)
treec3c6df76196e4c64949142e9671a6b4350309446
parentf3e0a111e9af72c16b6391035b716bb067d418ed (diff)
downloadpfsense-93b2c459855b82920decea1a2db080b0ae09b267.zip
pfsense-93b2c459855b82920decea1a2db080b0ae09b267.tar.gz
Add NAT-PMP support to UPnP. Fixes #262. Thanks to Salvatore LaMendola for the patch.
-rw-r--r--usr/local/pkg/miniupnpd.inc6
-rw-r--r--usr/local/pkg/miniupnpd.xml34
-rwxr-xr-xusr/local/www/fbegin.inc4
-rw-r--r--usr/local/www/status_upnp.php2
4 files changed, 32 insertions, 14 deletions
diff --git a/usr/local/pkg/miniupnpd.inc b/usr/local/pkg/miniupnpd.inc
index 8d45bad..2da8c93 100644
--- a/usr/local/pkg/miniupnpd.inc
+++ b/usr/local/pkg/miniupnpd.inc
@@ -85,6 +85,8 @@
}
function validate_form_miniupnpd($post, $input_errors) {
+ if($post['enable'] && (!$post['enable_upnp'] && !$post['enable_natpmp']))
+ $input_errors[] = 'At least one of \'UPnP\' or \'NAT-PMP\' must be allowed';
if($post['iface_array'])
foreach($post['iface_array'] as $iface)
if($iface == 'wan')
@@ -223,6 +225,10 @@
if($upnp_config['upnpqueue'])
$config_text .= "queue={$upnp_config['upnpqueue']}\n";
+ /* Allow UPnP or NAT-PMP as requested */
+ $config_text .= "enable_upnp=" . ( $upnp_config['enable_upnp'] ? "yes\n" : "no\n" );
+ $config_text .= "enable_natpmp=" . ( $upnp_config['enable_natpmp'] ? "yes\n" : "no\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 7d38022..03bdddf 100644
--- a/usr/local/pkg/miniupnpd.xml
+++ b/usr/local/pkg/miniupnpd.xml
@@ -1,13 +1,13 @@
<?xml version="1.0" encoding="utf-8" ?>
<packagegui>
- <title>Services: UPnP</title>
+ <title>Services: UPnP &amp; NAT-PMP</title>
<name>miniupnpd</name>
- <version>20070521</version>
+ <version>20100712</version>
<savetext>Change</savetext>
<include_file>/usr/local/pkg/miniupnpd.inc</include_file>
<menu>
- <name>UPnP</name>
- <tooltiptext>Set UPnP settings such as interfaces to listen on.</tooltiptext>
+ <name>UPnP &amp; NAT-PMP</name>
+ <tooltiptext>Set UPnP &amp; NAT-PMP settings such as interfaces to listen on.</tooltiptext>
<section>Services</section>
<url>/pkg_edit.php?xml=miniupnpd.xml&amp;id=0</url>
</menu>
@@ -33,17 +33,29 @@
</service>
<fields>
<field>
- <name>UPnP Settings</name>
+ <name>UPnP &amp; NAT-PMP Settings</name>
<type>listtopic</type>
- <enablefields>iface_array,overridewanip,upnpqueue,logpackets,sysuptime,permdefault,permuser1,permuser2,permuser3,permuser4</enablefields>
+ <enablefields>enable_upnp,enable_natpmp,iface_array,overridewanip,upnpqueue,logpackets,sysuptime,permdefault,permuser1,permuser2,permuser3,permuser4</enablefields>
</field>
<field>
- <fielddescr>Enable UPnP</fielddescr>
+ <fielddescr>Enable UPnP &amp; NAT-PMP</fielddescr>
<fieldname>enable</fieldname>
<type>checkbox</type>
- <enablefields>iface_array,overridewanip,upnpqueue,logpackets,sysuptime,permdefault,permuser1,permuser2,permuser3,permuser4</enablefields>
+ <enablefields>enable_upnp,enable_natpmp,iface_array,overridewanip,upnpqueue,logpackets,sysuptime,permdefault,permuser1,permuser2,permuser3,permuser4</enablefields>
</field>
<field>
+ <fielddescr>Allow UPnP Port Mapping</fielddescr>
+ <fieldname>enable_upnp</fieldname>
+ <type>checkbox</type>
+ <description>This protocol is often used by Microsoft-compatible systems.</description>
+ </field>
+ <field>
+ <fielddescr>Allow NAT-PMP Port Mapping</fielddescr>
+ <fieldname>enable_natpmp</fieldname>
+ <type>checkbox</type>
+ <description>This protocol is often used by Apple-compatible systems.</description>
+ </field>
+ <field>
<fielddescr>Interfaces (generally LAN)</fielddescr>
<fieldname>iface_array</fieldname>
<value>lan</value>
@@ -74,17 +86,17 @@
<type>input</type>
</field>
<field>
- <fielddescr>Log packets handled by UPnP rules?</fielddescr>
+ <fielddescr>Log packets handled by UPnP &amp; NAT-PMP rules?</fielddescr>
<fieldname>logpackets</fieldname>
<type>checkbox</type>
</field>
<field>
- <fielddescr>Use system uptime instead of UPnP service uptime?</fielddescr>
+ <fielddescr>Use system uptime instead of UPnP &amp; NAT-PMP service uptime?</fielddescr>
<fieldname>sysuptime</fieldname>
<type>checkbox</type>
</field>
<field>
- <fielddescr>By default deny access to UPnP?</fielddescr>
+ <fielddescr>By default deny access to UPnP &amp; NAT-PMP?</fielddescr>
<fieldname>permdefault</fieldname>
<type>checkbox</type>
</field>
diff --git a/usr/local/www/fbegin.inc b/usr/local/www/fbegin.inc
index 8552fbc..488a313 100755
--- a/usr/local/www/fbegin.inc
+++ b/usr/local/www/fbegin.inc
@@ -131,7 +131,7 @@ if(count($config['interfaces']) > 1) {
/* no use for UPnP in single-interface deployments
remove to reduce user confusion
*/
- $services_menu[] = array("UPnP", "/pkg_edit.php?xml=miniupnpd.xml&id=0");
+ $services_menu[] = array("UPnP &amp; NAT-PMP", "/pkg_edit.php?xml=miniupnpd.xml&id=0");
}
$services_menu[] = array("OpenNTPD", "/pkg_edit.php?xml=openntpd.xml&id=0");
$services_menu[] = array("Wake on LAN", "/services_wol.php");
@@ -166,7 +166,7 @@ $status_menu[] = array("Services", "/status_services.php");
$status_menu[] = array("System Logs", "/diag_logs.php");
$status_menu[] = array("Traffic Graph", "/status_graph.php?if=wan");
if(count($config['interfaces']) > 1)
- $status_menu[] = array("UPnP", "/status_upnp.php");
+ $status_menu[] = array("UPnP &amp; NAT-PMP", "/status_upnp.php");
$ifentries = get_configured_interface_with_descr();
foreach ($ifentries as $ent => $entdesc) {
if (is_array($config['interfaces'][$ent]['wireless']) &&
diff --git a/usr/local/www/status_upnp.php b/usr/local/www/status_upnp.php
index 3cc4755..024633f 100644
--- a/usr/local/www/status_upnp.php
+++ b/usr/local/www/status_upnp.php
@@ -55,7 +55,7 @@ exec("/sbin/pfctl -aminiupnpd -sn", $rdr_entries, $pf_ret);
$now = time();
$year = date("Y");
-$pgtitle = array("Status","UPnP Status");
+$pgtitle = array("Status","UPnP &amp; NAT-PMP Status");
include("head.inc");
?>
<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
OpenPOWER on IntegriCloud