Project

General

Profile

« Previous | Next » 

Revision 4ebc299b

Added by Viktor Gurov almost 4 years ago

UPnP STUN configuration. Feature #10587

View differences:

src/usr/local/pkg/miniupnpd.inc
118 118
			$input_errors[] = 'You must specify a valid traffic shaping queue.';
119 119
		}
120 120

  
121
		if ($post['enable_stun']) {
122
			if (!$post['stun_host'] || (!is_ipaddrv4($post['stun_host']) && !is_hostname($post['stun_host']))) {
123
				$input_errors[] = 'A valid IP address or hostname for \'STUN Server\' must be specified';
124
			}
125
			if (!$post['stun_port'] || !is_port($post['stun_port'])) {
126
				$input_errors[] = 'A valid port number for \'STUN Port\' must be specified';
127
			}
128
		}
129

  
121 130
		/* user permissions validation */
122 131
		$j = substr_count(implode(array_keys($post)), "permuser");
123 132
		for ($i = 0; $i < $j; $i++) {
......
275 284
				$config_text .= "enable_upnp="   . ($upnp_config['enable_upnp']   ? "yes\n" : "no\n");
276 285
				$config_text .= "enable_natpmp=" . ($upnp_config['enable_natpmp'] ? "yes\n" : "no\n");
277 286

  
287
				/* STUN configuration */
288
				if ($upnp_config['enable_stun']) {
289
					$config_text .= "ext_perform_stun=yes\n";
290
					$config_text .= "ext_stun_host={$upnp_config['stun_host']}\n";
291
					$config_text .= "ext_stun_port={$upnp_config['stun_port']}\n";
292
				}
293

  
278 294
				/* write out the configuration */
279 295
				upnp_write_config($config_file, $config_text);
280 296

  
src/usr/local/pkg/miniupnpd.xml
102 102
			<type>checkbox</type>
103 103
			<description>Deny access to UPnP &amp; NAT-PMP by default.</description>
104 104
		</field>
105
		<field>
106
			<name>STUN Configuration</name>
107
			<type>listtopic</type>
108
		</field>
109
		<field>
110
			<name>STUN Help</name>
111
			<type>info</type>
112
			<description>
113
				The External interface must have a public IP address. Otherwise it is behind NAT and port
114
				forwarding is impossible. In some cases the External interface can be behind unrestricted NAT 1:1
115
				when all incoming traffic is forwarded and routed to the External interface without any filtering.
116
				In these cases UPnP service needs to know the public IP address and it can be learned by asking an
117
				external server via STUN protocol. The following option enables retrieving the external public IP
118
			       	address from a STUN server and detection of the NAT type.
119
			</description>
120
		</field>
121
		<field>
122
			<fielddescr>Enable STUN</fielddescr>
123
			<fieldname>enable_stun</fieldname>
124
			<type>checkbox</type>
125
			<description>Enable retvieving external IP address from STUN server.</description>
126
			<enablefields>stun_host,stun_port</enablefields>
127
		</field>
128
		<field>
129
			<fielddescr>STUN Server</fielddescr>
130
			<fieldname>stun_host</fieldname>
131
			<type>input</type>
132
			<description>
133
				<![CDATA[
134
				STUN Server, either hostname or IP address.</br></br>
135

  
136
				Some public STUN servers:</br>
137
				stun.sipgate.net</br>
138
				stun.xten.com</br>
139
				stun.l.google.com (on non standard port 19302)</br>
140
				]]>
141
			</description>
142
		</field>
143
		<field>
144
			<fielddescr>STUN Port</fielddescr>
145
			<fieldname>stun_port</fieldname>
146
			<type>input</type>
147
			<default_value>3478</default_value>
148
			<description>STUN UDP port (Default: 3478)</description>
149
		</field>
105 150
		<field>
106 151
			<name>UPnP Access Control Lists</name>
107 152
			<type>listtopic</type>

Also available in: Unified diff