diff -uNr local.orig/pkg/miniupnpd.inc local/pkg/miniupnpd.inc --- local.orig/pkg/miniupnpd.inc 2010-07-10 11:24:15.000000000 +0000 +++ local/pkg/miniupnpd.inc 2010-07-13 00:30:39.000000000 +0000 @@ -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 -uNr local.orig/pkg/miniupnpd.xml local/pkg/miniupnpd.xml --- local.orig/pkg/miniupnpd.xml 2010-07-12 23:46:34.000000000 +0000 +++ local/pkg/miniupnpd.xml 2010-07-13 00:11:38.000000000 +0000 @@ -1,13 +1,13 @@ - Services: UPnP + Services: UPnP & NAT-PMP miniupnpd - 20070521 + 20100712 Change /usr/local/pkg/miniupnpd.inc - UPnP - Set UPnP settings such as interfaces to listen on. + UPnP & NAT-PMP + Set UPnP & NAT-PMP settings such as interfaces to listen on.
Services
/pkg_edit.php?xml=miniupnpd.xml&id=0
@@ -33,17 +33,29 @@ - UPnP Settings + UPnP & NAT-PMP Settings listtopic - iface_array,overridewanip,upnpqueue,logpackets,sysuptime,permdefault,permuser1,permuser2,permuser3,permuser4 + enable_upnp,enable_natpmp,iface_array,overridewanip,upnpqueue,logpackets,sysuptime,permdefault,permuser1,permuser2,permuser3,permuser4 - Enable UPnP + Enable UPnP & NAT-PMP enable checkbox - iface_array,overridewanip,upnpqueue,logpackets,sysuptime,permdefault,permuser1,permuser2,permuser3,permuser4 + enable_upnp,enable_natpmp,iface_array,overridewanip,upnpqueue,logpackets,sysuptime,permdefault,permuser1,permuser2,permuser3,permuser4 + Allow UPnP Port Mapping + enable_upnp + checkbox + This protocol is often used by Microsoft-compatible systems. + + + Allow NAT-PMP Port Mapping + enable_natpmp + checkbox + This protocol is often used by Apple-compatible systems. + + Interfaces (generally LAN) iface_array lan @@ -74,17 +86,17 @@ input - Log packets handled by UPnP rules? + Log packets handled by UPnP & NAT-PMP rules? logpackets checkbox - Use system uptime instead of UPnP service uptime? + Use system uptime instead of UPnP & NAT-PMP service uptime? sysuptime checkbox - By default deny access to UPnP? + By default deny access to UPnP & NAT-PMP? permdefault checkbox diff -uNr local.orig/www/fbegin.inc local/www/fbegin.inc --- local.orig/www/fbegin.inc 2010-07-10 11:24:16.000000000 +0000 +++ local/www/fbegin.inc 2010-07-12 23:48:53.000000000 +0000 @@ -131,7 +131,7 @@ /* 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 & 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("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 & NAT-PMP", "/status_upnp.php"); $ifentries = get_configured_interface_with_descr(); foreach ($ifentries as $ent => $entdesc) { if (is_array($config['interfaces'][$ent]['wireless']) && diff -uNr local.orig/www/status_upnp.php local/www/status_upnp.php --- local.orig/www/status_upnp.php 2010-07-10 11:24:17.000000000 +0000 +++ local/www/status_upnp.php 2010-07-12 23:57:04.000000000 +0000 @@ -55,7 +55,7 @@ $now = time(); $year = date("Y"); -$pgtitle = array("Status","UPnP Status"); +$pgtitle = array("Status","UPnP & NAT-PMP Status"); include("head.inc"); ?>