Feature #262 ยป pfSense2-local-miniupnpd.patch
local/pkg/miniupnpd.inc 2010-07-13 00:30:39.000000000 +0000 | ||
---|---|---|
85 | 85 |
} |
86 | 86 | |
87 | 87 |
function validate_form_miniupnpd($post, $input_errors) { |
88 |
if($post['enable'] && (!$post['enable_upnp'] && !$post['enable_natpmp'])) |
|
89 |
$input_errors[] = 'At least one of \'UPnP\' or \'NAT-PMP\' must be allowed'; |
|
88 | 90 |
if($post['iface_array']) |
89 | 91 |
foreach($post['iface_array'] as $iface) |
90 | 92 |
if($iface == 'wan') |
... | ... | |
223 | 225 |
if($upnp_config['upnpqueue']) |
224 | 226 |
$config_text .= "queue={$upnp_config['upnpqueue']}\n"; |
225 | 227 | |
228 |
/* Allow UPnP or NAT-PMP as requested */ |
|
229 |
$config_text .= "enable_upnp=" . ( $upnp_config['enable_upnp'] ? "yes\n" : "no\n" ); |
|
230 |
$config_text .= "enable_natpmp=" . ( $upnp_config['enable_natpmp'] ? "yes\n" : "no\n" ); |
|
231 | ||
226 | 232 |
/* write out the configuration */ |
227 | 233 |
upnp_write_config($config_file, $config_text); |
228 | 234 |
|
local/pkg/miniupnpd.xml 2010-07-13 00:11:38.000000000 +0000 | ||
---|---|---|
1 | 1 |
<?xml version="1.0" encoding="utf-8" ?> |
2 | 2 |
<packagegui> |
3 |
<title>Services: UPnP</title> |
|
3 |
<title>Services: UPnP & NAT-PMP</title>
|
|
4 | 4 |
<name>miniupnpd</name> |
5 |
<version>20070521</version>
|
|
5 |
<version>20100712</version>
|
|
6 | 6 |
<savetext>Change</savetext> |
7 | 7 |
<include_file>/usr/local/pkg/miniupnpd.inc</include_file> |
8 | 8 |
<menu> |
9 |
<name>UPnP</name> |
|
10 |
<tooltiptext>Set UPnP settings such as interfaces to listen on.</tooltiptext> |
|
9 |
<name>UPnP & NAT-PMP</name>
|
|
10 |
<tooltiptext>Set UPnP & NAT-PMP settings such as interfaces to listen on.</tooltiptext>
|
|
11 | 11 |
<section>Services</section> |
12 | 12 |
<url>/pkg_edit.php?xml=miniupnpd.xml&id=0</url> |
13 | 13 |
</menu> |
... | ... | |
33 | 33 |
</service> |
34 | 34 |
<fields> |
35 | 35 |
<field> |
36 |
<name>UPnP Settings</name> |
|
36 |
<name>UPnP & NAT-PMP Settings</name>
|
|
37 | 37 |
<type>listtopic</type> |
38 |
<enablefields>iface_array,overridewanip,upnpqueue,logpackets,sysuptime,permdefault,permuser1,permuser2,permuser3,permuser4</enablefields> |
|
38 |
<enablefields>enable_upnp,enable_natpmp,iface_array,overridewanip,upnpqueue,logpackets,sysuptime,permdefault,permuser1,permuser2,permuser3,permuser4</enablefields>
|
|
39 | 39 |
</field> |
40 | 40 |
<field> |
41 |
<fielddescr>Enable UPnP</fielddescr> |
|
41 |
<fielddescr>Enable UPnP & NAT-PMP</fielddescr>
|
|
42 | 42 |
<fieldname>enable</fieldname> |
43 | 43 |
<type>checkbox</type> |
44 |
<enablefields>iface_array,overridewanip,upnpqueue,logpackets,sysuptime,permdefault,permuser1,permuser2,permuser3,permuser4</enablefields> |
|
44 |
<enablefields>enable_upnp,enable_natpmp,iface_array,overridewanip,upnpqueue,logpackets,sysuptime,permdefault,permuser1,permuser2,permuser3,permuser4</enablefields>
|
|
45 | 45 |
</field> |
46 | 46 |
<field> |
47 |
<fielddescr>Allow UPnP Port Mapping</fielddescr> |
|
48 |
<fieldname>enable_upnp</fieldname> |
|
49 |
<type>checkbox</type> |
|
50 |
<description>This protocol is often used by Microsoft-compatible systems.</description> |
|
51 |
</field> |
|
52 |
<field> |
|
53 |
<fielddescr>Allow NAT-PMP Port Mapping</fielddescr> |
|
54 |
<fieldname>enable_natpmp</fieldname> |
|
55 |
<type>checkbox</type> |
|
56 |
<description>This protocol is often used by Apple-compatible systems.</description> |
|
57 |
</field> |
|
58 |
<field> |
|
47 | 59 |
<fielddescr>Interfaces (generally LAN)</fielddescr> |
48 | 60 |
<fieldname>iface_array</fieldname> |
49 | 61 |
<value>lan</value> |
... | ... | |
74 | 86 |
<type>input</type> |
75 | 87 |
</field> |
76 | 88 |
<field> |
77 |
<fielddescr>Log packets handled by UPnP rules?</fielddescr> |
|
89 |
<fielddescr>Log packets handled by UPnP & NAT-PMP rules?</fielddescr>
|
|
78 | 90 |
<fieldname>logpackets</fieldname> |
79 | 91 |
<type>checkbox</type> |
80 | 92 |
</field> |
81 | 93 |
<field> |
82 |
<fielddescr>Use system uptime instead of UPnP service uptime?</fielddescr> |
|
94 |
<fielddescr>Use system uptime instead of UPnP & NAT-PMP service uptime?</fielddescr>
|
|
83 | 95 |
<fieldname>sysuptime</fieldname> |
84 | 96 |
<type>checkbox</type> |
85 | 97 |
</field> |
86 | 98 |
<field> |
87 |
<fielddescr>By default deny access to UPnP?</fielddescr> |
|
99 |
<fielddescr>By default deny access to UPnP & NAT-PMP?</fielddescr>
|
|
88 | 100 |
<fieldname>permdefault</fieldname> |
89 | 101 |
<type>checkbox</type> |
90 | 102 |
</field> |
local/www/fbegin.inc 2010-07-12 23:48:53.000000000 +0000 | ||
---|---|---|
131 | 131 |
/* no use for UPnP in single-interface deployments |
132 | 132 |
remove to reduce user confusion |
133 | 133 |
*/ |
134 |
$services_menu[] = array("UPnP", "/pkg_edit.php?xml=miniupnpd.xml&id=0"); |
|
134 |
$services_menu[] = array("UPnP & NAT-PMP", "/pkg_edit.php?xml=miniupnpd.xml&id=0");
|
|
135 | 135 |
} |
136 | 136 |
$services_menu[] = array("OpenNTPD", "/pkg_edit.php?xml=openntpd.xml&id=0"); |
137 | 137 |
$services_menu[] = array("Wake on LAN", "/services_wol.php"); |
... | ... | |
166 | 166 |
$status_menu[] = array("System Logs", "/diag_logs.php"); |
167 | 167 |
$status_menu[] = array("Traffic Graph", "/status_graph.php?if=wan"); |
168 | 168 |
if(count($config['interfaces']) > 1) |
169 |
$status_menu[] = array("UPnP", "/status_upnp.php"); |
|
169 |
$status_menu[] = array("UPnP & NAT-PMP", "/status_upnp.php");
|
|
170 | 170 |
$ifentries = get_configured_interface_with_descr(); |
171 | 171 |
foreach ($ifentries as $ent => $entdesc) { |
172 | 172 |
if (is_array($config['interfaces'][$ent]['wireless']) && |
local/www/status_upnp.php 2010-07-12 23:57:04.000000000 +0000 | ||
---|---|---|
55 | 55 |
$now = time(); |
56 | 56 |
$year = date("Y"); |
57 | 57 | |
58 |
$pgtitle = array("Status","UPnP Status"); |
|
58 |
$pgtitle = array("Status","UPnP & NAT-PMP Status");
|
|
59 | 59 |
include("head.inc"); |
60 | 60 |
?> |
61 | 61 |
<body link="#0000CC" vlink="#0000CC" alink="#0000CC"> |